@galaxy-io/dls 1.4.10 → 1.4.12
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/accordion/Accordion.d.ts +19 -2
- package/dist/accordion/Accordion.js +8 -0
- package/dist/avatar/Avatar.d.ts +9 -0
- package/dist/avatar/Avatar.js +4 -0
- package/dist/avatar/AvatarShimmer.d.ts +2 -0
- package/dist/avatar/AvatarShimmer.js +1 -0
- package/dist/backgrounds/CellGridBackground.d.ts +12 -1
- package/dist/backgrounds/CellGridBackground.js +5 -0
- package/dist/backgrounds/CrossGridBackground.d.ts +13 -1
- package/dist/backgrounds/CrossGridBackground.js +4 -0
- package/dist/backgrounds/DotGridBackground.d.ts +12 -1
- package/dist/backgrounds/DotGridBackground.js +4 -0
- package/dist/badge/Badge.d.ts +12 -0
- package/dist/badge/Badge.js +7 -0
- package/dist/beacons/Beacon.d.ts +7 -13
- package/dist/beacons/Beacon.js +3 -0
- package/dist/buttons/Button.d.ts +18 -0
- package/dist/buttons/Button.js +10 -1
- package/dist/charts/BarChart.d.ts +4 -1
- package/dist/charts/BarChart.js +17 -8
- package/dist/charts/ChartCategoryTargets.d.ts +5 -12
- package/dist/charts/ChartCategoryTargets.js +1 -2
- package/dist/charts/ChartFrame.d.ts +3 -4
- package/dist/charts/ChartFrame.js +10 -25
- package/dist/charts/ChartLegend.js +26 -23
- package/dist/charts/ChartPrimitives.d.ts +38 -17
- package/dist/charts/ChartPrimitives.js +74 -73
- package/dist/charts/DashboardProvider.d.ts +57 -0
- package/dist/charts/DashboardProvider.js +30 -0
- package/dist/charts/LineChart.js +2 -1
- package/dist/charts/PieChart.js +1 -1
- package/dist/charts/ProgressBar.d.ts +13 -1
- package/dist/charts/ProgressBar.js +7 -0
- package/dist/charts/StatChart.d.ts +10 -1
- package/dist/charts/StatChart.js +5 -0
- package/dist/charts/constants.d.ts +20 -24
- package/dist/charts/constants.js +21 -25
- package/dist/charts/types.d.ts +10 -2
- package/dist/charts/types.js +9 -1
- package/dist/charts/useChartInteraction.d.ts +37 -10
- package/dist/charts/useChartInteraction.js +72 -12
- package/dist/chips/Chip.d.ts +20 -1
- package/dist/chips/Chip.js +9 -1
- package/dist/containers/FlexItem.d.ts +14 -12
- package/dist/containers/FlexItem.js +4 -0
- package/dist/containers/FlexWrapper.d.ts +29 -96
- package/dist/containers/FlexWrapper.js +12 -0
- package/dist/containers/GridWrapper.d.ts +25 -66
- package/dist/containers/GridWrapper.js +8 -0
- package/dist/containers/Spacing.d.ts +10 -0
- package/dist/containers/Spacing.js +7 -0
- package/dist/containers/Wrapper.d.ts +11 -1
- package/dist/containers/Wrapper.js +4 -0
- package/dist/dividers/HorizontalDivider.d.ts +2 -0
- package/dist/dividers/HorizontalDivider.js +1 -0
- package/dist/dividers/VerticalDivider.d.ts +4 -0
- package/dist/dividers/VerticalDivider.js +4 -0
- package/dist/drawer/Drawer.d.ts +11 -4
- package/dist/drawer/Drawer.js +7 -0
- package/dist/dropdown/Dropdown.d.ts +24 -0
- package/dist/dropdown/Dropdown.js +9 -0
- package/dist/editor/CodeEditor.d.ts +23 -42
- package/dist/editor/CodeEditor.js +9 -1
- package/dist/hooks/useDismiss.d.ts +6 -0
- package/dist/hooks/useDismiss.js +6 -0
- package/dist/hooks/useElementClientSize.d.ts +2 -2
- package/dist/hooks/useResize.d.ts +5 -2
- package/dist/icons/GalaxyLogomark.d.ts +9 -1
- package/dist/icons/GalaxyLogomark.js +7 -1
- package/dist/icons/GalaxyLogomark3D.d.ts +15 -0
- package/dist/icons/GalaxyLogomark3D.js +9 -0
- package/dist/icons/GalaxyLogomarkAnimation.d.ts +10 -0
- package/dist/icons/GalaxyLogomarkAnimation.js +7 -1
- package/dist/icons/GalaxyWordmark.d.ts +7 -1
- package/dist/icons/GalaxyWordmark.js +5 -1
- package/dist/icons/Icon.d.ts +10 -0
- package/dist/icons/Icon.js +5 -0
- package/dist/inputs/CheckboxInput.d.ts +13 -0
- package/dist/inputs/CheckboxInput.js +8 -0
- package/dist/inputs/ColorInput.d.ts +15 -0
- package/dist/inputs/ColorInput.js +6 -0
- package/dist/inputs/CopyInput.d.ts +9 -0
- package/dist/inputs/CopyInput.js +4 -0
- package/dist/inputs/DateInput.d.ts +13 -0
- package/dist/inputs/DateInput.js +5 -0
- package/dist/inputs/Input.d.ts +37 -0
- package/dist/inputs/Input.js +13 -0
- package/dist/inputs/MultiSelectInput.d.ts +26 -0
- package/dist/inputs/MultiSelectInput.js +6 -0
- package/dist/inputs/MultiTextInput.d.ts +16 -0
- package/dist/inputs/MultiTextInput.js +9 -0
- package/dist/inputs/NumberInput.d.ts +7 -1
- package/dist/inputs/NumberInput.js +5 -0
- package/dist/inputs/PasswordInput.d.ts +9 -1
- package/dist/inputs/PasswordInput.js +4 -0
- package/dist/inputs/RadioInput.d.ts +13 -0
- package/dist/inputs/RadioInput.js +8 -0
- package/dist/inputs/SelectInput.d.ts +30 -0
- package/dist/inputs/SelectInput.js +8 -0
- package/dist/inputs/SliderInput.d.ts +15 -0
- package/dist/inputs/SliderInput.js +6 -0
- package/dist/inputs/SwitcherInput.d.ts +10 -1
- package/dist/inputs/SwitcherInput.js +4 -0
- package/dist/inputs/TextAreaInput.d.ts +24 -0
- package/dist/inputs/TextAreaInput.js +9 -0
- package/dist/inputs/TextInput.d.ts +8 -1
- package/dist/inputs/TextInput.js +6 -0
- package/dist/inputs/ToggleInput.d.ts +11 -0
- package/dist/inputs/ToggleInput.js +6 -0
- package/dist/lists/BulletedList.d.ts +4 -0
- package/dist/lists/BulletedList.js +2 -0
- package/dist/modal/Modal.d.ts +8 -0
- package/dist/modal/Modal.js +6 -0
- package/dist/overlay/OverlayProvider.d.ts +11 -0
- package/dist/overlay/OverlayProvider.js +7 -0
- package/dist/overlay/constants.d.ts +1 -0
- package/dist/overlay/constants.js +1 -0
- package/dist/overlay/useOverlay.d.ts +11 -0
- package/dist/overlay/useOverlay.js +9 -0
- package/dist/resizable/HorizontalResizeHandle.d.ts +8 -1
- package/dist/resizable/HorizontalResizeHandle.js +6 -0
- package/dist/resizable/VerticalResizeHandle.d.ts +8 -1
- package/dist/resizable/VerticalResizeHandle.js +6 -0
- package/dist/shapes/Circle.d.ts +4 -1
- package/dist/shapes/Circle.js +1 -0
- package/dist/shapes/Square.d.ts +4 -1
- package/dist/shapes/Square.js +1 -0
- package/dist/styles.css +14 -14
- package/dist/table/InfiniteSpreadsheet.d.ts +7 -0
- package/dist/table/InfiniteSpreadsheet.js +7 -0
- package/dist/table/InfiniteTable.d.ts +8 -0
- package/dist/table/InfiniteTable.js +8 -0
- package/dist/table/VirtualizedInfiniteTable.d.ts +7 -0
- package/dist/table/VirtualizedInfiniteTable.js +7 -0
- package/dist/text/Bold.d.ts +4 -0
- package/dist/text/Bold.js +4 -0
- package/dist/text/Code.d.ts +4 -0
- package/dist/text/Code.js +4 -0
- package/dist/text/EditableText.d.ts +10 -1
- package/dist/text/EditableText.js +7 -0
- package/dist/text/Ellipsis.d.ts +6 -4
- package/dist/text/Ellipsis.js +4 -0
- package/dist/text/HotKeys.d.ts +10 -0
- package/dist/text/HotKeys.js +6 -0
- package/dist/text/MarkdownText.d.ts +9 -1
- package/dist/text/MarkdownText.js +6 -0
- package/dist/text/Paragraph.d.ts +17 -0
- package/dist/text/Paragraph.js +7 -0
- package/dist/text/RequiredMarker.d.ts +3 -1
- package/dist/text/RequiredMarker.js +1 -0
- package/dist/text/Selectable.d.ts +4 -0
- package/dist/text/Selectable.js +4 -0
- package/dist/text/Text.d.ts +19 -0
- package/dist/text/Text.js +10 -0
- package/dist/text/TextShimmer.d.ts +7 -0
- package/dist/text/TextShimmer.js +4 -0
- package/dist/theme/GalaxyTheme.d.ts +35 -4
- package/dist/theme/GalaxyTheme.js +13 -1
- package/dist/theme/constants.d.ts +1 -6
- package/dist/theme/constants.js +10 -15
- package/dist/theme/index.js +2 -1
- package/dist/theme/types.d.ts +21 -0
- package/dist/theme/types.js +10 -0
- package/dist/toast/Toast.d.ts +11 -0
- package/dist/toast/Toast.js +5 -0
- package/dist/toast/ToastProvider.d.ts +9 -0
- package/dist/toast/ToastProvider.js +4 -0
- package/dist/toast/useToast.d.ts +7 -0
- package/dist/toast/useToast.js +7 -0
- package/dist/tooltip/Tooltip.d.ts +19 -1
- package/dist/tooltip/Tooltip.js +9 -0
- package/dist/transform/Fade.d.ts +7 -0
- package/dist/transform/Fade.js +6 -0
- package/dist/transform/Flash.d.ts +4 -0
- package/dist/transform/Flash.js +4 -0
- package/dist/transform/Rotate.d.ts +7 -0
- package/dist/transform/Rotate.js +4 -0
- package/dist/transform/ScaleFade.d.ts +7 -0
- package/dist/transform/ScaleFade.js +6 -0
- package/dist/transform/Spin.d.ts +7 -0
- package/dist/transform/Spin.js +5 -0
- package/dist/widget/Widget.d.ts +18 -1
- package/dist/widget/Widget.js +5 -0
- package/package.json +1 -1
package/dist/charts/PieChart.js
CHANGED
|
@@ -76,7 +76,7 @@ var PieChart = ({ series, slices, width, height, fillWidth, fillHeight, aspectRa
|
|
|
76
76
|
const interaction = useChartInteraction({
|
|
77
77
|
categoryCount: geometry.arcs.length,
|
|
78
78
|
seriesKeys: legendKeys,
|
|
79
|
-
|
|
79
|
+
isDisabled: noTooltip || isLoading || isEmpty,
|
|
80
80
|
isLoading
|
|
81
81
|
});
|
|
82
82
|
const buildCategoryTooltip = useCallback((index) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Fill color. Signals what the progress *means* — neutral, healthy, at risk. */
|
|
1
2
|
export declare enum ProgressBarVariant {
|
|
2
3
|
PRIMARY = "PRIMARY",
|
|
3
4
|
SECONDARY = "SECONDARY",
|
|
@@ -6,12 +7,23 @@ export declare enum ProgressBarVariant {
|
|
|
6
7
|
WARNING = "WARNING",
|
|
7
8
|
ERROR = "ERROR"
|
|
8
9
|
}
|
|
9
|
-
interface ProgressBarProps {
|
|
10
|
+
export interface ProgressBarProps {
|
|
11
|
+
/** Fill, 0–100. Values outside that range render empty rather than clamping. */
|
|
10
12
|
percentage: number;
|
|
13
|
+
/** @default ProgressBarVariant.PRIMARY */
|
|
11
14
|
variant?: ProgressBarVariant;
|
|
15
|
+
/** Bar thickness in px. @default 4 */
|
|
12
16
|
height?: number;
|
|
17
|
+
/** Render 0% as truly empty instead of the default hairline sliver. */
|
|
13
18
|
noSliverOnZero?: boolean;
|
|
19
|
+
/** Drop the pulse on the fill. */
|
|
14
20
|
noAnimation?: boolean;
|
|
15
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* A horizontal completion bar.
|
|
24
|
+
*
|
|
25
|
+
* At 0% it leaves a 0.5px sliver so the track still reads as a bar rather than
|
|
26
|
+
* an empty box — set `noSliverOnZero` when exact emptiness matters.
|
|
27
|
+
*/
|
|
16
28
|
declare const ProgressBar: ({ percentage, variant, height, noSliverOnZero, noAnimation, }: ProgressBarProps) => import("react").JSX.Element;
|
|
17
29
|
export default ProgressBar;
|
|
@@ -5,6 +5,7 @@ import { match } from "ts-pattern";
|
|
|
5
5
|
import { useMemo } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
//#region src/charts/ProgressBar.tsx
|
|
8
|
+
/** Fill color. Signals what the progress *means* — neutral, healthy, at risk. */
|
|
8
9
|
var ProgressBarVariant = /* @__PURE__ */ function(ProgressBarVariant) {
|
|
9
10
|
ProgressBarVariant["PRIMARY"] = "PRIMARY";
|
|
10
11
|
ProgressBarVariant["SECONDARY"] = "SECONDARY";
|
|
@@ -40,6 +41,12 @@ var ProgressBarFill = withTheme(/*#__PURE__*/ styled("div")({
|
|
|
40
41
|
"p1sc05jm-2": [_exp6()]
|
|
41
42
|
}
|
|
42
43
|
}));
|
|
44
|
+
/**
|
|
45
|
+
* A horizontal completion bar.
|
|
46
|
+
*
|
|
47
|
+
* At 0% it leaves a 0.5px sliver so the track still reads as a bar rather than
|
|
48
|
+
* an empty box — set `noSliverOnZero` when exact emptiness matters.
|
|
49
|
+
*/
|
|
43
50
|
var ProgressBar = ({ percentage, variant = "PRIMARY", height = 4, noSliverOnZero = false, noAnimation = false }) => {
|
|
44
51
|
return /* @__PURE__ */ jsx(StyledProgressBar, {
|
|
45
52
|
$height: height,
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
/** Surface treatment of the stat tile. */
|
|
2
3
|
export declare enum StatChartVariant {
|
|
3
4
|
BASE = "BASE",
|
|
4
5
|
PRIMARY = "PRIMARY",
|
|
5
6
|
SECONDARY = "SECONDARY",
|
|
6
7
|
TERTIARY = "TERTIARY"
|
|
7
8
|
}
|
|
8
|
-
interface StatChartProps {
|
|
9
|
+
export interface StatChartProps {
|
|
10
|
+
/** What the number means. Rendered small and secondary above the value. */
|
|
9
11
|
label: string;
|
|
12
|
+
/** The headline figure. A node, so it can carry a unit or a trend indicator. */
|
|
10
13
|
value: ReactNode;
|
|
14
|
+
/** @default StatChartVariant.PRIMARY */
|
|
11
15
|
variant?: StatChartVariant;
|
|
16
|
+
/** Drop the hairline border — for tiles inside an already-bordered container. */
|
|
12
17
|
noBorder?: boolean;
|
|
13
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* A single-number stat tile — the KPI card. Fixed 140px minimum width so a row
|
|
21
|
+
* of them lines up without you setting widths.
|
|
22
|
+
*/
|
|
14
23
|
declare const StatChart: ({ label, value, variant, noBorder, }: StatChartProps) => import("react").JSX.Element;
|
|
15
24
|
export default StatChart;
|
package/dist/charts/StatChart.js
CHANGED
|
@@ -6,6 +6,7 @@ import { styled } from "@linaria/react";
|
|
|
6
6
|
import { match } from "ts-pattern";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/charts/StatChart.tsx
|
|
9
|
+
/** Surface treatment of the stat tile. */
|
|
9
10
|
var StatChartVariant = /* @__PURE__ */ function(StatChartVariant) {
|
|
10
11
|
StatChartVariant["BASE"] = "BASE";
|
|
11
12
|
StatChartVariant["PRIMARY"] = "PRIMARY";
|
|
@@ -24,6 +25,10 @@ var StatChartWrapper = withTheme(/*#__PURE__*/ styled("div")({
|
|
|
24
25
|
"slaxlp8-1": [_exp2()]
|
|
25
26
|
}
|
|
26
27
|
}));
|
|
28
|
+
/**
|
|
29
|
+
* A single-number stat tile — the KPI card. Fixed 140px minimum width so a row
|
|
30
|
+
* of them lines up without you setting widths.
|
|
31
|
+
*/
|
|
27
32
|
var StatChart = ({ label, value, variant = "PRIMARY", noBorder }) => {
|
|
28
33
|
return /* @__PURE__ */ jsx(StatChartWrapper, {
|
|
29
34
|
$variant: variant,
|
|
@@ -159,27 +159,13 @@ export declare const AGGREGATED_SLICE_KEY = "__other__";
|
|
|
159
159
|
/** Margin around a pie, which needs no axis gutters. */
|
|
160
160
|
export declare const PIE_CHART_MARGIN: ChartMargin;
|
|
161
161
|
/**
|
|
162
|
-
* Duration in ms for
|
|
162
|
+
* Duration in ms for the tooltip's fade and glide.
|
|
163
163
|
*
|
|
164
|
-
* Sits inside the 75–150ms band the DLS uses everywhere else.
|
|
165
|
-
*
|
|
166
|
-
*
|
|
164
|
+
* Sits inside the 75–150ms band the DLS uses everywhere else. Only the tooltip
|
|
165
|
+
* transitions — mark and legend emphasis snaps, because emphasis is feedback
|
|
166
|
+
* and feedback that eases in reads as lag.
|
|
167
167
|
*/
|
|
168
168
|
export declare const CHART_TRANSITION_MS = 100;
|
|
169
|
-
/**
|
|
170
|
-
* Delay in ms before marks return to full strength after the pointer leaves.
|
|
171
|
-
*
|
|
172
|
-
* Restoring immediately makes the whole chart flash while the pointer sweeps
|
|
173
|
-
* across categories. Highlighting stays instant (no delay) — only the
|
|
174
|
-
* *un*-highlight waits, so a sweep reads as one continuous gesture.
|
|
175
|
-
*
|
|
176
|
-
* Kept short because it does less work than it looks: while the pointer is
|
|
177
|
-
* anywhere in the plot the chart is still engaged, so `ChartPlotGroup` and
|
|
178
|
-
* `ChartLegendRow` zero this out and category-to-category sweeping is already
|
|
179
|
-
* instant. All this actually covers is the moment the pointer leaves entirely,
|
|
180
|
-
* where a long delay just feels like lag.
|
|
181
|
-
*/
|
|
182
|
-
export declare const CHART_RESTORE_DELAY_MS = 200;
|
|
183
169
|
/**
|
|
184
170
|
* Opacity ramp for the mark states.
|
|
185
171
|
*
|
|
@@ -195,6 +181,14 @@ export declare const CHART_RESTORE_DELAY_MS = 200;
|
|
|
195
181
|
*/
|
|
196
182
|
export declare const CHART_MARK_OPACITY_ACTIVE = 1;
|
|
197
183
|
export declare const CHART_MARK_OPACITY_MUTED = 0.1;
|
|
184
|
+
/**
|
|
185
|
+
* The whisper tier, for `ChartMarkState.DIMMED`.
|
|
186
|
+
*
|
|
187
|
+
* Deliberately far gentler than MUTED: it is used where another affordance —
|
|
188
|
+
* BarChart's cursor band — already marks the hovered category, so the
|
|
189
|
+
* off-category marks only need to step back, not disappear.
|
|
190
|
+
*/
|
|
191
|
+
export declare const CHART_MARK_OPACITY_DIMMED = 0.4;
|
|
198
192
|
/** Distance in px between the tooltip and its anchor. */
|
|
199
193
|
export declare const CHART_TOOLTIP_OFFSET = 10;
|
|
200
194
|
/** Minimum width of the tooltip, in px. */
|
|
@@ -204,15 +198,17 @@ export declare const CHART_TOOLTIP_MAX_WIDTH = 320;
|
|
|
204
198
|
/** Gap in px between the plot box and a side-placed legend. */
|
|
205
199
|
export declare const CHART_LEGEND_SIDE_GAP = 16;
|
|
206
200
|
/**
|
|
207
|
-
*
|
|
201
|
+
* Spacing in px between entries in a horizontal legend.
|
|
208
202
|
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
203
|
+
* Applied as each entry's *trailing padding*, not a flex gap on the row: a gap
|
|
204
|
+
* is dead space between hover targets, and sweeping across it drops the series
|
|
205
|
+
* isolation between every pair of entries. Because the padding lives inside
|
|
206
|
+
* the entries, measured entry sizes already include the spacing and the fit
|
|
207
|
+
* computation needs no separate gap term.
|
|
212
208
|
*/
|
|
213
209
|
export declare const CHART_LEGEND_COLUMN_GAP = 16;
|
|
214
|
-
/**
|
|
215
|
-
* {@link CHART_LEGEND_COLUMN_GAP}:
|
|
210
|
+
/** Spacing in px between entries in a vertical legend. Same contract as
|
|
211
|
+
* {@link CHART_LEGEND_COLUMN_GAP}: trailing padding on the entry, no flex gap. */
|
|
216
212
|
export declare const CHART_LEGEND_VERTICAL_GAP = 8;
|
|
217
213
|
/**
|
|
218
214
|
* Ceiling on the collapsed-legend popover's height, in px.
|
package/dist/charts/constants.js
CHANGED
|
@@ -169,28 +169,14 @@ var PIE_CHART_MARGIN = {
|
|
|
169
169
|
left: 8
|
|
170
170
|
};
|
|
171
171
|
/**
|
|
172
|
-
* Duration in ms for
|
|
172
|
+
* Duration in ms for the tooltip's fade and glide.
|
|
173
173
|
*
|
|
174
|
-
* Sits inside the 75–150ms band the DLS uses everywhere else.
|
|
175
|
-
*
|
|
176
|
-
*
|
|
174
|
+
* Sits inside the 75–150ms band the DLS uses everywhere else. Only the tooltip
|
|
175
|
+
* transitions — mark and legend emphasis snaps, because emphasis is feedback
|
|
176
|
+
* and feedback that eases in reads as lag.
|
|
177
177
|
*/
|
|
178
178
|
var CHART_TRANSITION_MS = 100;
|
|
179
179
|
/**
|
|
180
|
-
* Delay in ms before marks return to full strength after the pointer leaves.
|
|
181
|
-
*
|
|
182
|
-
* Restoring immediately makes the whole chart flash while the pointer sweeps
|
|
183
|
-
* across categories. Highlighting stays instant (no delay) — only the
|
|
184
|
-
* *un*-highlight waits, so a sweep reads as one continuous gesture.
|
|
185
|
-
*
|
|
186
|
-
* Kept short because it does less work than it looks: while the pointer is
|
|
187
|
-
* anywhere in the plot the chart is still engaged, so `ChartPlotGroup` and
|
|
188
|
-
* `ChartLegendRow` zero this out and category-to-category sweeping is already
|
|
189
|
-
* instant. All this actually covers is the moment the pointer leaves entirely,
|
|
190
|
-
* where a long delay just feels like lag.
|
|
191
|
-
*/
|
|
192
|
-
var CHART_RESTORE_DELAY_MS = 200;
|
|
193
|
-
/**
|
|
194
180
|
* Opacity ramp for the mark states.
|
|
195
181
|
*
|
|
196
182
|
* The grammar is inherited from the reference charts and is the opposite of the
|
|
@@ -205,6 +191,14 @@ var CHART_RESTORE_DELAY_MS = 200;
|
|
|
205
191
|
*/
|
|
206
192
|
var CHART_MARK_OPACITY_ACTIVE = 1;
|
|
207
193
|
var CHART_MARK_OPACITY_MUTED = .1;
|
|
194
|
+
/**
|
|
195
|
+
* The whisper tier, for `ChartMarkState.DIMMED`.
|
|
196
|
+
*
|
|
197
|
+
* Deliberately far gentler than MUTED: it is used where another affordance —
|
|
198
|
+
* BarChart's cursor band — already marks the hovered category, so the
|
|
199
|
+
* off-category marks only need to step back, not disappear.
|
|
200
|
+
*/
|
|
201
|
+
var CHART_MARK_OPACITY_DIMMED = .4;
|
|
208
202
|
/** Distance in px between the tooltip and its anchor. */
|
|
209
203
|
var CHART_TOOLTIP_OFFSET = 10;
|
|
210
204
|
/** Minimum width of the tooltip, in px. */
|
|
@@ -214,15 +208,17 @@ var CHART_TOOLTIP_MAX_WIDTH = 320;
|
|
|
214
208
|
/** Gap in px between the plot box and a side-placed legend. */
|
|
215
209
|
var CHART_LEGEND_SIDE_GAP = 16;
|
|
216
210
|
/**
|
|
217
|
-
*
|
|
211
|
+
* Spacing in px between entries in a horizontal legend.
|
|
218
212
|
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
213
|
+
* Applied as each entry's *trailing padding*, not a flex gap on the row: a gap
|
|
214
|
+
* is dead space between hover targets, and sweeping across it drops the series
|
|
215
|
+
* isolation between every pair of entries. Because the padding lives inside
|
|
216
|
+
* the entries, measured entry sizes already include the spacing and the fit
|
|
217
|
+
* computation needs no separate gap term.
|
|
222
218
|
*/
|
|
223
219
|
var CHART_LEGEND_COLUMN_GAP = 16;
|
|
224
|
-
/**
|
|
225
|
-
* {@link CHART_LEGEND_COLUMN_GAP}:
|
|
220
|
+
/** Spacing in px between entries in a vertical legend. Same contract as
|
|
221
|
+
* {@link CHART_LEGEND_COLUMN_GAP}: trailing padding on the entry, no flex gap. */
|
|
226
222
|
var CHART_LEGEND_VERTICAL_GAP = 8;
|
|
227
223
|
/**
|
|
228
224
|
* Ceiling on the collapsed-legend popover's height, in px.
|
|
@@ -280,4 +276,4 @@ var CHART_PALETTE_ORDER = [
|
|
|
280
276
|
ChartPalette.RED
|
|
281
277
|
];
|
|
282
278
|
//#endregion
|
|
283
|
-
export { AGGREGATED_SLICE_KEY, AUTO_MARGIN_LEFT_STEP, AXIS_TITLE_BAND, AXIS_TITLE_GAP, BAR_GAP_COMFORTABLE, BAR_GAP_MEDIUM, BAR_GAP_TIGHT, BAR_RADIUS, BAR_RADIUS_NARROW, BAR_WIDTH_RATIO, CAPTION_CHAR_WIDTH_PX, CATEGORY_AXIS_LABEL_GAP, CATEGORY_AXIS_LABEL_HEIGHT, CHART_LEGEND_COLUMN_GAP, CHART_LEGEND_OVERFLOW_MAX_HEIGHT, CHART_LEGEND_SIDE_GAP, CHART_LEGEND_VERTICAL_GAP, CHART_MARK_OPACITY_ACTIVE, CHART_MARK_OPACITY_MUTED, CHART_PALETTE_ORDER,
|
|
279
|
+
export { AGGREGATED_SLICE_KEY, AUTO_MARGIN_LEFT_STEP, AXIS_TITLE_BAND, AXIS_TITLE_GAP, BAR_GAP_COMFORTABLE, BAR_GAP_MEDIUM, BAR_GAP_TIGHT, BAR_RADIUS, BAR_RADIUS_NARROW, BAR_WIDTH_RATIO, CAPTION_CHAR_WIDTH_PX, CATEGORY_AXIS_LABEL_GAP, CATEGORY_AXIS_LABEL_HEIGHT, CHART_LEGEND_COLUMN_GAP, CHART_LEGEND_OVERFLOW_MAX_HEIGHT, CHART_LEGEND_SIDE_GAP, CHART_LEGEND_VERTICAL_GAP, CHART_MARK_OPACITY_ACTIVE, CHART_MARK_OPACITY_DIMMED, CHART_MARK_OPACITY_MUTED, CHART_PALETTE_ORDER, CHART_TOOLTIP_MAX_WIDTH, CHART_TOOLTIP_MIN_WIDTH, CHART_TOOLTIP_OFFSET, CHART_TRANSITION_MS, DEFAULT_CHART_MARGIN, DEFAULT_LINE_STROKE_WIDTH, DEFAULT_VALUE_TICK_COUNT, GRID_LINE_BLEED, GROUP_GAP_COMFORTABLE, GROUP_GAP_MEDIUM, GROUP_GAP_TIGHT, LINE_AREA_OPACITY, LINE_POINT_RADIUS, MAX_AUTO_MARGIN_LEFT, MAX_BAR_WIDTH, MAX_GAP_SHARE, MIN_AUTO_MARGIN_LEFT, MIN_BARS_FOR_TIGHT_SPACING, MIN_BAR_LENGTH, MIN_CATEGORY_LABEL_GAP, NARROW_BAR_WIDTH, PIE_CHART_MARGIN, PIE_CORNER_RADIUS, PIE_DONUT_INNER_RATIO, PIE_MAX_AUTO_INNER_RATIO, PIE_MAX_INSET_SHARE, PIE_MIN_SLICE_SHARE, PIE_PAD_ANGLE, PIE_TOOLTIP_ANCHOR_INSET, STACK_SEGMENT_GAP, VALUE_AXIS_LABEL_HEIGHT, VALUE_AXIS_TICK_GAP, WIDTH_FOR_MEDIUM_SPACING, WIDTH_FOR_TIGHT_SPACING };
|
package/dist/charts/types.d.ts
CHANGED
|
@@ -153,8 +153,16 @@ export declare enum ChartCategoryLabelMode {
|
|
|
153
153
|
export declare enum ChartMarkState {
|
|
154
154
|
/** Full strength — the default, and the hovered category. */
|
|
155
155
|
ACTIVE = "active",
|
|
156
|
-
/** Softened, for
|
|
157
|
-
MUTED = "muted"
|
|
156
|
+
/** Softened, for marks outside the engaged series or category. */
|
|
157
|
+
MUTED = "muted",
|
|
158
|
+
/**
|
|
159
|
+
* Barely softened — a whisper of {@link MUTED}.
|
|
160
|
+
*
|
|
161
|
+
* Used where another affordance already carries the emphasis and strong
|
|
162
|
+
* muting would be a second, louder voice: BarChart's category axis dims
|
|
163
|
+
* like this because the cursor band is the highlight.
|
|
164
|
+
*/
|
|
165
|
+
DIMMED = "dimmed"
|
|
158
166
|
}
|
|
159
167
|
/** Which pair of a rectangle's corners carries the radius. */
|
|
160
168
|
export declare enum BarCorners {
|
package/dist/charts/types.js
CHANGED
|
@@ -115,8 +115,16 @@ var ChartCategoryLabelMode = /* @__PURE__ */ function(ChartCategoryLabelMode) {
|
|
|
115
115
|
var ChartMarkState = /* @__PURE__ */ function(ChartMarkState) {
|
|
116
116
|
/** Full strength — the default, and the hovered category. */
|
|
117
117
|
ChartMarkState["ACTIVE"] = "active";
|
|
118
|
-
/** Softened, for
|
|
118
|
+
/** Softened, for marks outside the engaged series or category. */
|
|
119
119
|
ChartMarkState["MUTED"] = "muted";
|
|
120
|
+
/**
|
|
121
|
+
* Barely softened — a whisper of {@link MUTED}.
|
|
122
|
+
*
|
|
123
|
+
* Used where another affordance already carries the emphasis and strong
|
|
124
|
+
* muting would be a second, louder voice: BarChart's category axis dims
|
|
125
|
+
* like this because the cursor band is the highlight.
|
|
126
|
+
*/
|
|
127
|
+
ChartMarkState["DIMMED"] = "dimmed";
|
|
120
128
|
return ChartMarkState;
|
|
121
129
|
}({});
|
|
122
130
|
/** Which pair of a rectangle's corners carries the radius. */
|
|
@@ -9,10 +9,14 @@ import { ChartMarkState } from "./types";
|
|
|
9
9
|
* - **Series** — a legend key. Hovering (or focusing) a legend entry isolates
|
|
10
10
|
* that series.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* Plus one read-only source: inside a `DashboardProvider`, a chart that
|
|
13
|
+
* supplies {@link UseChartInteractionOptions.categoryKeys} follows the category
|
|
14
|
+
* hovered in a sibling chart, matched by raw label. Following emphasizes; it
|
|
15
|
+
* opens the tooltip only when the provider opts in via `sharedTooltip`, which
|
|
16
|
+
* is what {@link ChartInteraction.showTooltip} folds together. The series axis
|
|
17
|
+
* deliberately does not sync: series keys are chart-local vocabulary, and
|
|
18
|
+
* isolating "Delivered" in a chart that happens to share the name would
|
|
19
|
+
* correlate nothing.
|
|
16
20
|
*
|
|
17
21
|
* Deliberately no click layer. Clicking used to pin the hover so it survived
|
|
18
22
|
* the pointer leaving, and it read as the chart getting stuck — the emphasis
|
|
@@ -23,12 +27,28 @@ interface UseChartInteractionOptions {
|
|
|
23
27
|
categoryCount: number;
|
|
24
28
|
/** Legend keys currently rendered. A key that disappears clears stale hover. */
|
|
25
29
|
seriesKeys?: string[];
|
|
30
|
+
/**
|
|
31
|
+
* Raw category labels, index-aligned with {@link categoryCount}. Supplying
|
|
32
|
+
* them opts the chart into `DashboardProvider` crosshair sync; omit (as
|
|
33
|
+
* PieChart does) to stay out. Raw labels, never `labelFormatter` output —
|
|
34
|
+
* two charts formatting the same label differently must still match.
|
|
35
|
+
*/
|
|
36
|
+
categoryKeys?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* How marks outside the active category recede. Defaults to
|
|
39
|
+
* {@link ChartMarkState.MUTED}; BarChart passes
|
|
40
|
+
* {@link ChartMarkState.DIMMED} because its cursor band already carries the
|
|
41
|
+
* category highlight and strong muting on top of it would shout. Only the
|
|
42
|
+
* category axis softens — series (legend) isolation always mutes fully,
|
|
43
|
+
* since there the muting *is* the affordance.
|
|
44
|
+
*/
|
|
45
|
+
categoryMuteState?: ChartMarkState;
|
|
26
46
|
/** Suppress all interaction — used while loading and when the tooltip is off. */
|
|
27
|
-
|
|
47
|
+
isDisabled?: boolean;
|
|
28
48
|
/**
|
|
29
49
|
* Render every mark muted, whatever the two axes say.
|
|
30
50
|
*
|
|
31
|
-
* Distinct from {@link
|
|
51
|
+
* Distinct from {@link isDisabled}, which suppresses *input*. Loading suppresses
|
|
32
52
|
* *emphasis*: there is nothing yet worth drawing attention to. Folded in here
|
|
33
53
|
* rather than left to each mark, because the alternative is the same
|
|
34
54
|
* `isLoading ? MUTED : getMarkState(…)` ternary hand-copied at every mark —
|
|
@@ -43,11 +63,18 @@ interface MarkStateArgs {
|
|
|
43
63
|
seriesKey?: string;
|
|
44
64
|
}
|
|
45
65
|
export interface ChartInteraction {
|
|
46
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* The active category — this chart's own hover, or failing that the category
|
|
68
|
+
* a `DashboardProvider` sibling is hovering, resolved to a local index.
|
|
69
|
+
*/
|
|
47
70
|
activeIndex: number | null;
|
|
71
|
+
/**
|
|
72
|
+
* True when this chart should present its tooltip for {@link activeIndex}:
|
|
73
|
+
* its own pointer hover always, a synced sibling's only when the
|
|
74
|
+
* `DashboardProvider` opts in via `sharedTooltip`.
|
|
75
|
+
*/
|
|
76
|
+
showTooltip: boolean;
|
|
48
77
|
hoveredSeriesKey: string | null;
|
|
49
|
-
/** True while *either* axis is engaged; cancels the mark restore delay. */
|
|
50
|
-
isEngaged: boolean;
|
|
51
78
|
/**
|
|
52
79
|
* Emphasis for one mark, composed from both axes.
|
|
53
80
|
*
|
|
@@ -65,5 +92,5 @@ export interface ChartInteraction {
|
|
|
65
92
|
onSeriesEnter: (seriesKey: string) => void;
|
|
66
93
|
onSeriesLeave: () => void;
|
|
67
94
|
}
|
|
68
|
-
export declare function useChartInteraction({ categoryCount, seriesKeys,
|
|
95
|
+
export declare function useChartInteraction({ categoryCount, seriesKeys, categoryKeys, categoryMuteState, isDisabled, isLoading, }: UseChartInteractionOptions): ChartInteraction;
|
|
69
96
|
export {};
|
|
@@ -1,19 +1,74 @@
|
|
|
1
1
|
import { ChartMarkState } from "./types.js";
|
|
2
|
-
import {
|
|
2
|
+
import { DashboardContext } from "./DashboardProvider.js";
|
|
3
|
+
import { useCallback, useContext, useEffect, useId, useMemo, useState } from "react";
|
|
3
4
|
//#region src/charts/useChartInteraction.ts
|
|
4
|
-
function useChartInteraction({ categoryCount, seriesKeys,
|
|
5
|
+
function useChartInteraction({ categoryCount, seriesKeys, categoryKeys, categoryMuteState = ChartMarkState.MUTED, isDisabled = false, isLoading = false }) {
|
|
5
6
|
const [hoveredIndex, setHoveredIndex] = useState(null);
|
|
6
7
|
const [hoveredSeriesKey, setHoveredSeriesKey] = useState(null);
|
|
8
|
+
const sync = useContext(DashboardContext);
|
|
9
|
+
const syncId = useId();
|
|
10
|
+
const canSync = sync !== null && categoryKeys !== void 0;
|
|
11
|
+
const setActive = sync?.setActive;
|
|
12
|
+
const clearActive = sync?.clearActive;
|
|
7
13
|
const safeHovered = hoveredIndex !== null && hoveredIndex < categoryCount ? hoveredIndex : null;
|
|
8
14
|
const safeHoveredSeries = hoveredSeriesKey !== null && (seriesKeys === void 0 || seriesKeys.includes(hoveredSeriesKey)) ? hoveredSeriesKey : null;
|
|
15
|
+
/**
|
|
16
|
+
* Publish this chart's hover to the sync group.
|
|
17
|
+
*
|
|
18
|
+
* An effect over the derived label rather than calls inside the pointer
|
|
19
|
+
* handlers, so three edge cases collapse into one place: data shrinking
|
|
20
|
+
* under a resting pointer (the `safeHovered` guard nulls the key → clears),
|
|
21
|
+
* the label at the resting index changing (republishes what is now under
|
|
22
|
+
* the pointer), and unmount while source (the cleanup effect below).
|
|
23
|
+
* Source-only writes still hold — `localKey` derives from `safeHovered`,
|
|
24
|
+
* which only this chart's own pointer sets.
|
|
25
|
+
*/
|
|
26
|
+
const localKey = canSync && safeHovered !== null ? categoryKeys[safeHovered] ?? null : null;
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!setActive || !clearActive) return;
|
|
29
|
+
if (localKey !== null) setActive({
|
|
30
|
+
sourceId: syncId,
|
|
31
|
+
categoryKey: localKey
|
|
32
|
+
});
|
|
33
|
+
else clearActive(syncId);
|
|
34
|
+
}, [
|
|
35
|
+
setActive,
|
|
36
|
+
clearActive,
|
|
37
|
+
syncId,
|
|
38
|
+
localKey
|
|
39
|
+
]);
|
|
40
|
+
useEffect(() => () => clearActive?.(syncId), [clearActive, syncId]);
|
|
41
|
+
/**
|
|
42
|
+
* The category a sibling is hovering, resolved to this chart's own index.
|
|
43
|
+
*
|
|
44
|
+
* `isLoading` blocks following — the marks are force-muted anyway, but
|
|
45
|
+
* without the guard LineChart would still draw its cursor and dots through
|
|
46
|
+
* a loading plot. An unmatched label resolves to no crosshair at all, which
|
|
47
|
+
* is how charts with partially overlapping categories degrade.
|
|
48
|
+
*/
|
|
49
|
+
const followedIndex = useMemo(() => {
|
|
50
|
+
if (!canSync || isLoading) return null;
|
|
51
|
+
const entry = sync.activeEntry;
|
|
52
|
+
if (entry === null || entry.sourceId === syncId) return null;
|
|
53
|
+
const index = categoryKeys.indexOf(entry.categoryKey);
|
|
54
|
+
return index === -1 ? null : index;
|
|
55
|
+
}, [
|
|
56
|
+
canSync,
|
|
57
|
+
isLoading,
|
|
58
|
+
sync?.activeEntry,
|
|
59
|
+
syncId,
|
|
60
|
+
categoryKeys
|
|
61
|
+
]);
|
|
62
|
+
const effectiveIndex = safeHovered ?? followedIndex;
|
|
63
|
+
const showTooltip = safeHovered !== null || followedIndex !== null && (sync?.sharedTooltip ?? false);
|
|
9
64
|
const onCategoryEnter = useCallback((categoryIndex) => {
|
|
10
|
-
if (
|
|
65
|
+
if (isDisabled) return;
|
|
11
66
|
setHoveredIndex(categoryIndex);
|
|
12
|
-
}, [
|
|
67
|
+
}, [isDisabled]);
|
|
13
68
|
const onCategoryLeave = useCallback(() => {
|
|
14
|
-
if (
|
|
69
|
+
if (isDisabled) return;
|
|
15
70
|
setHoveredIndex(null);
|
|
16
|
-
}, [
|
|
71
|
+
}, [isDisabled]);
|
|
17
72
|
const onSeriesEnter = useCallback((seriesKey) => {
|
|
18
73
|
setHoveredSeriesKey(seriesKey);
|
|
19
74
|
}, []);
|
|
@@ -22,23 +77,28 @@ function useChartInteraction({ categoryCount, seriesKeys, disabled = false, isLo
|
|
|
22
77
|
}, []);
|
|
23
78
|
const getMarkState = useCallback(({ categoryIndex, seriesKey }) => {
|
|
24
79
|
if (isLoading) return ChartMarkState.MUTED;
|
|
25
|
-
|
|
80
|
+
const categoryMuted = categoryIndex !== void 0 && effectiveIndex !== null && categoryIndex !== effectiveIndex;
|
|
81
|
+
if (seriesKey !== void 0 && safeHoveredSeries !== null && seriesKey !== safeHoveredSeries) return ChartMarkState.MUTED;
|
|
82
|
+
if (categoryMuted) return categoryMuteState;
|
|
83
|
+
return ChartMarkState.ACTIVE;
|
|
26
84
|
}, [
|
|
27
85
|
isLoading,
|
|
28
|
-
|
|
29
|
-
safeHoveredSeries
|
|
86
|
+
effectiveIndex,
|
|
87
|
+
safeHoveredSeries,
|
|
88
|
+
categoryMuteState
|
|
30
89
|
]);
|
|
31
90
|
return useMemo(() => ({
|
|
32
|
-
activeIndex:
|
|
91
|
+
activeIndex: effectiveIndex,
|
|
92
|
+
showTooltip,
|
|
33
93
|
hoveredSeriesKey: safeHoveredSeries,
|
|
34
|
-
isEngaged: safeHovered !== null || safeHoveredSeries !== null,
|
|
35
94
|
getMarkState,
|
|
36
95
|
onCategoryEnter,
|
|
37
96
|
onCategoryLeave,
|
|
38
97
|
onSeriesEnter,
|
|
39
98
|
onSeriesLeave
|
|
40
99
|
}), [
|
|
41
|
-
|
|
100
|
+
effectiveIndex,
|
|
101
|
+
showTooltip,
|
|
42
102
|
safeHoveredSeries,
|
|
43
103
|
getMarkState,
|
|
44
104
|
onCategoryEnter,
|
package/dist/chips/Chip.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Icon as PhosphorIcon } from "@phosphor-icons/react";
|
|
2
|
+
/** Chip color. Tints the background, border and label together. */
|
|
2
3
|
export declare enum ChipVariant {
|
|
3
4
|
PRIMARY = "PRIMARY",
|
|
4
5
|
PRIMARY_ALT = "PRIMARY_ALT",
|
|
@@ -15,25 +16,43 @@ export declare enum ChipVariant {
|
|
|
15
16
|
PURPLE = "PURPLE",
|
|
16
17
|
TEAL = "TEAL"
|
|
17
18
|
}
|
|
19
|
+
/** Chip height. Also drives label and icon size. */
|
|
18
20
|
export declare enum ChipSize {
|
|
19
21
|
SMALL = "SMALL",
|
|
20
22
|
MEDIUM = "MEDIUM",
|
|
21
23
|
LARGE = "LARGE"
|
|
22
24
|
}
|
|
23
25
|
export interface ChipProps {
|
|
26
|
+
/** Chip text. Required unless `icon` is set — with neither, nothing renders. */
|
|
24
27
|
label?: string | number;
|
|
28
|
+
/** @default ChipVariant.SECONDARY */
|
|
25
29
|
variant?: ChipVariant;
|
|
30
|
+
/** @default ChipSize.MEDIUM */
|
|
26
31
|
size?: ChipSize;
|
|
32
|
+
/** Custom leading graphic. Takes precedence over `icon`. */
|
|
27
33
|
svg?: React.ReactNode;
|
|
34
|
+
/** Phosphor icon *component* — pass `TagIcon`, not `<TagIcon />`. */
|
|
28
35
|
icon?: PhosphorIcon;
|
|
36
|
+
/** Adds a trailing × button. Omit and the chip isn't dismissible. */
|
|
29
37
|
onDismiss?: () => void;
|
|
38
|
+
/** Also flips the cursor to `pointer`. */
|
|
30
39
|
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
40
|
+
/** Fully rounded ends instead of the default small radius. */
|
|
31
41
|
isPill?: boolean;
|
|
42
|
+
/** Drop the fill and keep only the border. */
|
|
32
43
|
noBackground?: boolean;
|
|
44
|
+
/** Swap the label for a shimmer placeholder. */
|
|
33
45
|
isLoading?: boolean;
|
|
46
|
+
/** Truncate a long label with an ellipsis. Needs a width-bounded parent. */
|
|
34
47
|
isEllipsis?: boolean;
|
|
35
|
-
/**
|
|
48
|
+
/** Selected styling — border picks up the variant color. */
|
|
36
49
|
isActive?: boolean;
|
|
37
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* A compact tag for a value, filter, or status.
|
|
53
|
+
*
|
|
54
|
+
* Renders `null` when neither `label` nor `icon` is set. Adding `onDismiss`
|
|
55
|
+
* appends a × button; adding `onClick` makes the whole chip clickable.
|
|
56
|
+
*/
|
|
38
57
|
declare const Chip: ({ label, variant, size, svg, icon, onDismiss, onClick, isPill, noBackground, isLoading, isEllipsis, isActive, }: ChipProps) => import("react").JSX.Element | null;
|
|
39
58
|
export default Chip;
|
package/dist/chips/Chip.js
CHANGED
|
@@ -12,6 +12,7 @@ import { match } from "ts-pattern";
|
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { XIcon } from "@phosphor-icons/react";
|
|
14
14
|
//#region src/chips/Chip.tsx
|
|
15
|
+
/** Chip color. Tints the background, border and label together. */
|
|
15
16
|
var ChipVariant = /* @__PURE__ */ function(ChipVariant) {
|
|
16
17
|
ChipVariant["PRIMARY"] = "PRIMARY";
|
|
17
18
|
ChipVariant["PRIMARY_ALT"] = "PRIMARY_ALT";
|
|
@@ -29,6 +30,7 @@ var ChipVariant = /* @__PURE__ */ function(ChipVariant) {
|
|
|
29
30
|
ChipVariant["TEAL"] = "TEAL";
|
|
30
31
|
return ChipVariant;
|
|
31
32
|
}({});
|
|
33
|
+
/** Chip height. Also drives label and icon size. */
|
|
32
34
|
var ChipSize = /* @__PURE__ */ function(ChipSize) {
|
|
33
35
|
ChipSize["SMALL"] = "SMALL";
|
|
34
36
|
ChipSize["MEDIUM"] = "MEDIUM";
|
|
@@ -40,7 +42,7 @@ var _exp2 = () => ({ $size }) => {
|
|
|
40
42
|
return match($size).with("SMALL", () => "18px").with("MEDIUM", () => "20px").with("LARGE", () => "24px").exhaustive();
|
|
41
43
|
};
|
|
42
44
|
var _exp3 = () => ({ $size }) => {
|
|
43
|
-
return match($size).with("SMALL", () => "0
|
|
45
|
+
return match($size).with("SMALL", () => "0 5px").with("MEDIUM", () => "0 6px").with("LARGE", () => "0 8px").exhaustive();
|
|
44
46
|
};
|
|
45
47
|
var _exp4 = () => ({ theme, $variant, $noBackground }) => {
|
|
46
48
|
if ($noBackground) return "transparent";
|
|
@@ -111,6 +113,12 @@ var CHIP_SIZE_TO_TEXT_SIZE = {
|
|
|
111
113
|
["MEDIUM"]: TextSize.BODY_MD,
|
|
112
114
|
["LARGE"]: TextSize.BODY_LG
|
|
113
115
|
};
|
|
116
|
+
/**
|
|
117
|
+
* A compact tag for a value, filter, or status.
|
|
118
|
+
*
|
|
119
|
+
* Renders `null` when neither `label` nor `icon` is set. Adding `onDismiss`
|
|
120
|
+
* appends a × button; adding `onClick` makes the whole chip clickable.
|
|
121
|
+
*/
|
|
114
122
|
var Chip = ({ label, variant = "SECONDARY", size = "MEDIUM", svg, icon, onDismiss, onClick, isPill, noBackground, isLoading, isEllipsis, isActive }) => {
|
|
115
123
|
if (!label && !icon) return null;
|
|
116
124
|
if (isLoading) return /* @__PURE__ */ jsxs(StyledChip, {
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
import { type CSSProperties } from "react";
|
|
2
2
|
import { AlignItems, JustifyContent } from "./FlexWrapper";
|
|
3
|
-
interface FlexItemProps {
|
|
3
|
+
export interface FlexItemProps {
|
|
4
|
+
/** @default "static" */
|
|
4
5
|
position?: CSSProperties["position"];
|
|
5
|
-
/**
|
|
6
|
-
* flex-grow of this item within its parent flex container.
|
|
7
|
-
* Defaults to 0 (content-sized), matching the CSS default.
|
|
8
|
-
*/
|
|
6
|
+
/** flex-grow within the parent flex container. @default 0 */
|
|
9
7
|
grow?: number;
|
|
10
|
-
/**
|
|
11
|
-
* flex-shrink of this item within its parent flex container.
|
|
12
|
-
* Defaults to 1, matching the CSS default.
|
|
13
|
-
*/
|
|
8
|
+
/** flex-shrink within the parent flex container. @default 1 */
|
|
14
9
|
shrink?: number;
|
|
15
|
-
/**
|
|
16
|
-
* flex-basis of this item. Defaults to auto.
|
|
17
|
-
*/
|
|
10
|
+
/** flex-basis. A number is px. @default "auto" */
|
|
18
11
|
basis?: number | string;
|
|
19
12
|
overflow?: CSSProperties["overflow"];
|
|
20
13
|
whiteSpace?: CSSProperties["whiteSpace"];
|
|
21
14
|
textOverflow?: CSSProperties["textOverflow"];
|
|
15
|
+
/** A number is px. */
|
|
22
16
|
width?: number | string;
|
|
17
|
+
/** A number is px. */
|
|
23
18
|
height?: number | string;
|
|
19
|
+
/** `width: 100%`. Takes precedence over `width`. */
|
|
24
20
|
fillWidth?: boolean;
|
|
21
|
+
/** `height: 100%`. Takes precedence over `height`. */
|
|
25
22
|
fillHeight?: boolean;
|
|
26
23
|
/**
|
|
27
24
|
* Defaults to "flex" (not "block"): a FlexItem is itself a flex container,
|
|
@@ -40,8 +37,13 @@ interface FlexItemProps {
|
|
|
40
37
|
maxWidth?: number | string;
|
|
41
38
|
maxHeight?: number | string;
|
|
42
39
|
padding?: CSSProperties["padding"];
|
|
40
|
+
/** Also flips the cursor to `pointer`. */
|
|
43
41
|
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
44
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* A single child of a `FlexWrapper`, for when one item needs its own grow,
|
|
45
|
+
* shrink, or sizing rules. Reach for it only when the wrapper can't express it.
|
|
46
|
+
*/
|
|
45
47
|
declare const FlexItem: import("react").ForwardRefExoticComponent<FlexItemProps & {
|
|
46
48
|
children?: import("react").ReactNode | undefined;
|
|
47
49
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -55,6 +55,10 @@ var StyledFlexItem = /*#__PURE__*/ styled("div")({
|
|
|
55
55
|
"s1he36jx-17": [_exp16()]
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
+
/**
|
|
59
|
+
* A single child of a `FlexWrapper`, for when one item needs its own grow,
|
|
60
|
+
* shrink, or sizing rules. Reach for it only when the wrapper can't express it.
|
|
61
|
+
*/
|
|
58
62
|
var FlexItem = forwardRef(({ children, position, grow, shrink, basis, overflow, whiteSpace, textOverflow, width, height, fillWidth, fillHeight, display, alignItems, justifyContent, minWidth, minHeight, maxWidth, maxHeight, padding, onClick }, ref) => {
|
|
59
63
|
return /* @__PURE__ */ jsx(StyledFlexItem, {
|
|
60
64
|
ref,
|