@galaxy-io/dls 2.4.1 → 2.5.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/beacons/Beacon.d.ts +6 -6
- package/dist/beacons/Beacon.js +22 -19
- package/dist/buttons/Button.d.ts +6 -0
- package/dist/buttons/Button.js +3 -2
- package/dist/charts/BarChart.d.ts +2 -2
- package/dist/charts/ChartLegend.js +2 -1
- package/dist/charts/LineChart.js +1 -0
- package/dist/charts/PieChart.js +1 -0
- package/dist/charts/Sparkline.d.ts +5 -4
- package/dist/charts/Sparkline.js +21 -18
- package/dist/charts/barChartGeometry.d.ts +2 -2
- package/dist/charts/barChartLegend.js +2 -0
- package/dist/charts/chartPalette.d.ts +9 -5
- package/dist/charts/chartPalette.js +8 -2
- package/dist/charts/types.d.ts +7 -5
- package/dist/charts/useSeriesColorResolver.d.ts +2 -1
- package/dist/chips/Chip.d.ts +6 -5
- package/dist/chips/Chip.js +24 -21
- package/dist/feedback/EmptyState.d.ts +29 -3
- package/dist/feedback/EmptyState.js +39 -13
- package/dist/feedback/ProgressBar.d.ts +5 -4
- package/dist/feedback/ProgressBar.js +25 -22
- package/dist/feedback/ProgressCircle.d.ts +5 -4
- package/dist/feedback/ProgressCircle.js +25 -22
- package/dist/inputs/CheckboxGroup.d.ts +5 -1
- package/dist/inputs/CheckboxGroup.js +4 -2
- package/dist/inputs/ColorInput.d.ts +6 -2
- package/dist/inputs/ColorInput.js +4 -2
- package/dist/inputs/CopyInput.d.ts +6 -2
- package/dist/inputs/CopyInput.js +1 -1
- package/dist/inputs/CronInput.d.ts +6 -2
- package/dist/inputs/CronInput.js +4 -2
- package/dist/inputs/DateInput.d.ts +6 -2
- package/dist/inputs/DateInput.js +4 -2
- package/dist/inputs/DurationInput.d.ts +6 -2
- package/dist/inputs/DurationInput.js +4 -2
- package/dist/inputs/FileInput.d.ts +5 -1
- package/dist/inputs/FileInput.js +4 -2
- package/dist/inputs/Input.d.ts +7 -1
- package/dist/inputs/Input.js +7 -4
- package/dist/inputs/KeyValueInput.d.ts +6 -2
- package/dist/inputs/KeyValueInput.js +4 -2
- package/dist/inputs/MultiSelectInput.d.ts +5 -1
- package/dist/inputs/NumberInput.js +2 -1
- package/dist/inputs/PasswordInput.js +2 -1
- package/dist/inputs/PinInput.d.ts +6 -2
- package/dist/inputs/PinInput.js +4 -2
- package/dist/inputs/RadioGroup.d.ts +5 -1
- package/dist/inputs/RadioGroup.js +4 -2
- package/dist/inputs/SelectInput.d.ts +5 -1
- package/dist/inputs/SelectInput.js +4 -2
- package/dist/inputs/SliderInput.d.ts +6 -2
- package/dist/inputs/SliderInput.js +4 -2
- package/dist/inputs/TagInput.d.ts +6 -2
- package/dist/inputs/TagInput.js +4 -2
- package/dist/inputs/TextAreaInput.d.ts +6 -2
- package/dist/inputs/TextAreaInput.js +6 -3
- package/dist/inputs/ToggleInput.d.ts +5 -1
- package/dist/inputs/ToggleInput.js +4 -2
- package/dist/inputs/internal/ownField.d.ts +10 -5
- package/dist/inputs/internal/ownField.js +14 -9
- package/dist/layout/Box.d.ts +1 -1
- package/dist/layout/Box.js +20 -27
- package/dist/layout/Flex.d.ts +24 -1
- package/dist/layout/Flex.js +25 -5
- package/dist/layout/FlexItem.d.ts +24 -1
- package/dist/layout/FlexItem.js +22 -3
- package/dist/layout/internal/surface.d.ts +13 -0
- package/dist/layout/internal/surface.js +28 -0
- package/dist/lists/DescriptionList.d.ts +6 -0
- package/dist/lists/DescriptionList.js +13 -11
- package/dist/modal/ConfirmDialog.d.ts +4 -0
- package/dist/modal/ConfirmDialog.js +7 -4
- package/dist/shapes/Circle.d.ts +6 -5
- package/dist/shapes/Circle.js +21 -18
- package/dist/shapes/Square.d.ts +6 -5
- package/dist/shapes/Square.js +21 -18
- package/dist/styles.css +1 -1
- package/dist/table/TableCore.js +3 -2
- package/dist/theme/enums.d.ts +1 -1
- package/dist/theme/enums.js +1 -1
- package/dist/theme/tokens/palette.d.ts +5 -1
- package/dist/theme/tokens/palette.js +9 -1
- package/dist/theme/tokens/types.d.ts +9 -1
- package/dist/timeline/Timeline.d.ts +6 -5
- package/dist/timeline/Timeline.js +20 -17
- package/package.json +1 -1
package/dist/beacons/Beacon.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AriaAttributes, type CSSProperties } from "react";
|
|
2
|
-
import type { Hex,
|
|
2
|
+
import type { Hex, RoleColor } from "../theme/tokens/types.js";
|
|
3
3
|
/** Canonical rungs; the member names the rung of the text the dot sits beside (or the label's step). */
|
|
4
4
|
export declare enum BeaconSize {
|
|
5
5
|
/** 4px, beside `caption` (12px line); a label is `caption` with a 4px gap. */
|
|
@@ -85,12 +85,12 @@ interface BeaconColorProps {
|
|
|
85
85
|
*/
|
|
86
86
|
variant?: undefined;
|
|
87
87
|
/**
|
|
88
|
-
* Categorical palette family (`"blue"`, `"violet"`, …)
|
|
89
|
-
* `solid.<
|
|
90
|
-
* For categories;
|
|
91
|
-
* Not with `variant`.
|
|
88
|
+
* Categorical palette family (`"blue"`, `"violet"`, …) or a status role as a string
|
|
89
|
+
* (`"success"`, `"error"`): the dot and ring take `solid.<name>.background` and the label
|
|
90
|
+
* `text.<name>`, the way a status variant renders. For categories and data-driven marks; a status
|
|
91
|
+
* that is meaning takes `variant`. Not with `variant`.
|
|
92
92
|
*/
|
|
93
|
-
color:
|
|
93
|
+
color: RoleColor;
|
|
94
94
|
}
|
|
95
95
|
/** Beacon props. Passing both `variant` and `color` is a type error. */
|
|
96
96
|
export type BeaconProps = BeaconBaseProps & (BeaconVariantProps | BeaconColorProps);
|
package/dist/beacons/Beacon.js
CHANGED
|
@@ -125,33 +125,36 @@ var BEACON_VARIANT_TO_CSS_MAP = {
|
|
|
125
125
|
};
|
|
126
126
|
/** Categorical `color`: the label `text.<family>`, the dot `solid.<family>.background`, the way a status variant renders. */
|
|
127
127
|
var BEACON_COLOR_TO_CSS_MAP = {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
128
|
+
success: "gx-Beacon-success-s1nxs4in",
|
|
129
|
+
warning: "gx-Beacon-warning-w1dc3rbq",
|
|
130
|
+
error: "gx-Beacon-error-edasyys",
|
|
131
|
+
red: "gx-Beacon-red-r1rjlf72",
|
|
132
|
+
orange: "gx-Beacon-orange-ofhdj80",
|
|
133
|
+
amber: "gx-Beacon-amber-a1lpbbc5",
|
|
134
|
+
yellow: "gx-Beacon-yellow-y1wxkqi6",
|
|
135
|
+
lime: "gx-Beacon-lime-l9ukjzr",
|
|
136
|
+
green: "gx-Beacon-green-g1be6eig",
|
|
137
|
+
emerald: "gx-Beacon-emerald-emvjtgh",
|
|
138
|
+
teal: "gx-Beacon-teal-tkh8tqf",
|
|
139
|
+
cyan: "gx-Beacon-cyan-c1e21vro",
|
|
140
|
+
sky: "gx-Beacon-sky-sxwnre2",
|
|
141
|
+
blue: "gx-Beacon-blue-b1qbmqgn",
|
|
142
|
+
indigo: "gx-Beacon-indigo-idn9ked",
|
|
143
|
+
violet: "gx-Beacon-violet-v1tc1xnc",
|
|
144
|
+
purple: "gx-Beacon-purple-pgzv1cm",
|
|
145
|
+
fuchsia: "gx-Beacon-fuchsia-f1marsuc",
|
|
146
|
+
pink: "gx-Beacon-pink-p1ikfn3f",
|
|
147
|
+
rose: "gx-Beacon-rose-romuo8"
|
|
145
148
|
};
|
|
146
149
|
/** Declared after the variant and color maps so `hex` wins over them: the label and the dot both take it. */
|
|
147
|
-
var HEX_CSS = "gx-Beacon-HEX_CSS-
|
|
150
|
+
var HEX_CSS = "gx-Beacon-HEX_CSS-h14k32og";
|
|
148
151
|
/**
|
|
149
152
|
* One pulse every thirteen `duration.base` steps (1.95s, the 1.x 2s default), linear, forever: the
|
|
150
153
|
* ring, in the dot's fill, grows from the dot's edge to 2.5× while it fades from 0.5 to 0. Paint-only (`transform`), so
|
|
151
154
|
* the line box never moves. The keyframes are global, so the name is `gx-` prefixed.
|
|
152
155
|
* `REDUCED_MOTION` stops it and the ring falls back to its resting `opacity: 0`.
|
|
153
156
|
*/
|
|
154
|
-
var PULSE_CSS = "gx-Beacon-PULSE_CSS-
|
|
157
|
+
var PULSE_CSS = "gx-Beacon-PULSE_CSS-p88byx5";
|
|
155
158
|
/**
|
|
156
159
|
* A status dot, alone or with its `label`; its color is a role (`variant`), a category (`color`) or
|
|
157
160
|
* data (`hex`), and it can pulse.
|
package/dist/buttons/Button.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Icon as PhosphorIcon } from "@phosphor-icons/react";
|
|
2
2
|
import { type AriaAttributes, type CSSProperties, type ElementType, type FocusEventHandler, type MouseEvent, type MouseEventHandler, type ReactNode } from "react";
|
|
3
3
|
import { type DropdownSlot } from "../dropdown/Dropdown.js";
|
|
4
|
+
import { IconWeight } from "../icons/Icon.js";
|
|
4
5
|
/** Mode (Constitution V-A local mode set, declared in `scripts/lint-dls.ts` `MODE_SETS`). */
|
|
5
6
|
export declare enum ButtonVariant {
|
|
6
7
|
/** Monochrome solid (`solid.primary`): the one main action in a view. The default. */
|
|
@@ -34,6 +35,11 @@ export declare enum ButtonSize {
|
|
|
34
35
|
export interface ButtonBaseProps extends AriaAttributes {
|
|
35
36
|
/** Phosphor icon component: `PlusIcon`, not `<PlusIcon />`. Sized to the rung and colored by the variant. */
|
|
36
37
|
icon?: PhosphorIcon;
|
|
38
|
+
/**
|
|
39
|
+
* Weight of `icon`. `FILL` for a brand glyph (a GitHub or Slack logo); the loading ring, the external arrow and the split caret keep `REGULAR`.
|
|
40
|
+
* @default IconWeight.REGULAR
|
|
41
|
+
*/
|
|
42
|
+
iconWeight?: IconWeight;
|
|
37
43
|
/**
|
|
38
44
|
* Put `icon` after the label instead of before it.
|
|
39
45
|
* @default false
|
package/dist/buttons/Button.js
CHANGED
|
@@ -6,7 +6,7 @@ import Kbd, { KbdSize, KbdVariant } from "../text/Kbd.js";
|
|
|
6
6
|
import Tooltip from "../tooltip/Tooltip.js";
|
|
7
7
|
import Dropdown from "../dropdown/Dropdown.js";
|
|
8
8
|
import { parseHotkey, useHotkey } from "../hooks/useHotkey.js";
|
|
9
|
-
import Icon, { IconVariant } from "../icons/Icon.js";
|
|
9
|
+
import Icon, { IconVariant, IconWeight } from "../icons/Icon.js";
|
|
10
10
|
import IconSlot from "../icons/internal/IconSlot.js";
|
|
11
11
|
import Rotate from "../transform/Rotate.js";
|
|
12
12
|
/* empty css */
|
|
@@ -314,7 +314,7 @@ function toAriaKeyShortcuts(hotKeys, isMac) {
|
|
|
314
314
|
return names.join("+");
|
|
315
315
|
}
|
|
316
316
|
/** The standard action control: a label, an icon or both, in one of four modes and five rungs. */
|
|
317
|
-
var Button = forwardRef(function Button({ label, icon, isIconTrailing = false, leading, trailing, hotKeys, shouldBindHotKey = false, variant = "PRIMARY", size = "MEDIUM", type = "button", href, isExternal = false, as, tooltip, dropdown, isDisabled = false, isLoading = false, isActive, isRound = false, fillWidth = false, onClick, ariaLabel, id, className, style, ...rest }, ref) {
|
|
317
|
+
var Button = forwardRef(function Button({ label, icon, iconWeight = IconWeight.REGULAR, isIconTrailing = false, leading, trailing, hotKeys, shouldBindHotKey = false, variant = "PRIMARY", size = "MEDIUM", type = "button", href, isExternal = false, as, tooltip, dropdown, isDisabled = false, isLoading = false, isActive, isRound = false, fillWidth = false, onClick, ariaLabel, id, className, style, ...rest }, ref) {
|
|
318
318
|
const isMac = useIsMac();
|
|
319
319
|
const rootRef = useRef(null);
|
|
320
320
|
const setRootRef = useCallback((node) => {
|
|
@@ -388,6 +388,7 @@ var Button = forwardRef(function Button({ label, icon, isIconTrailing = false, l
|
|
|
388
388
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
389
389
|
component: icon,
|
|
390
390
|
size: iconPx,
|
|
391
|
+
weight: iconWeight,
|
|
391
392
|
variant: IconVariant.INHERIT
|
|
392
393
|
})
|
|
393
394
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactElement, type RefAttributes } from "react";
|
|
2
|
-
import type { Hex } from "../theme/tokens/types.js";
|
|
2
|
+
import type { Hex, RoleColor } from "../theme/tokens/types.js";
|
|
3
3
|
import { type BaseCartesianChartProps, type ChartPalette, type ChartSeriesStyles } from "./types.js";
|
|
4
4
|
/** How bar values are scaled before drawing. Not a grouped/stacked switch: that comes from the data. */
|
|
5
5
|
export declare enum BarChartNormalization {
|
|
@@ -17,7 +17,7 @@ export interface BarChartComponentDatum<TComponentKey extends string = string> {
|
|
|
17
17
|
/** Segment magnitude. Negative values stack below the zero baseline. */
|
|
18
18
|
value: number;
|
|
19
19
|
/** Palette slot; defaults to the component's position in the automatic order. */
|
|
20
|
-
color?: ChartPalette;
|
|
20
|
+
color?: ChartPalette | RoleColor;
|
|
21
21
|
/** Raw color. Discouraged: it does not follow the theme. Wins over `color`. */
|
|
22
22
|
hex?: Hex;
|
|
23
23
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
2
2
|
import { Placement } from "../theme/enums.js";
|
|
3
3
|
import Text, { TextSize, TextVariant } from "../text/Text.js";
|
|
4
|
+
import { t } from "../theme/tokens/t.js";
|
|
4
5
|
import Flex, { AlignItems } from "../layout/Flex.js";
|
|
5
6
|
import Tooltip from "../tooltip/Tooltip.js";
|
|
6
7
|
import { ChartLegendPlacement, ChartMarkState, ChartPalette, ChartSwatch } from "./types.js";
|
|
@@ -99,7 +100,7 @@ var OverflowList = /*#__PURE__*/ styled("ul")({
|
|
|
99
100
|
});
|
|
100
101
|
function Swatch({ item, swatch }) {
|
|
101
102
|
return /* @__PURE__ */ jsx(SwatchColor, {
|
|
102
|
-
style: { "--gx-chart-mark-color": item.hex ?? CHART_PALETTE_TO_COLOR_MAP[item.palette ?? ChartPalette.TERTIARY] },
|
|
103
|
+
style: { "--gx-chart-mark-color": item.hex ?? (item.hue !== void 0 ? t.color.text[item.hue] : CHART_PALETTE_TO_COLOR_MAP[item.palette ?? ChartPalette.TERTIARY]) },
|
|
103
104
|
children: swatch === ChartSwatch.CIRCLE ? /* @__PURE__ */ jsx(Circle, {
|
|
104
105
|
size: CircleSize.SMALL,
|
|
105
106
|
variant: CircleVariant.INHERIT
|
package/dist/charts/LineChart.js
CHANGED
|
@@ -84,6 +84,7 @@ function LineChartRootInner(props, ref) {
|
|
|
84
84
|
key,
|
|
85
85
|
label: series[key]?.label ?? key,
|
|
86
86
|
...color.palette !== void 0 && { palette: color.palette },
|
|
87
|
+
...color.hue !== void 0 && { hue: color.hue },
|
|
87
88
|
...color.hex !== void 0 && { hex: color.hex }
|
|
88
89
|
};
|
|
89
90
|
}), [colors, series]);
|
package/dist/charts/PieChart.js
CHANGED
|
@@ -83,6 +83,7 @@ function PieChartInner(props, ref) {
|
|
|
83
83
|
key: item.id,
|
|
84
84
|
label: item.label,
|
|
85
85
|
...item.color.palette !== void 0 && { palette: item.color.palette },
|
|
86
|
+
...item.color.hue !== void 0 && { hue: item.color.hue },
|
|
86
87
|
...item.color.hex !== void 0 && { hex: item.color.hex }
|
|
87
88
|
})), [resolvedSlices]);
|
|
88
89
|
const arcKeys = useMemo(() => legendItems.map((item) => item.key), [legendItems]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AriaAttributes, type CSSProperties } from "react";
|
|
2
|
-
import type { Hex,
|
|
2
|
+
import type { Hex, RoleColor } from "../theme/tokens/types.js";
|
|
3
3
|
import { type ChartValueDomain } from "./types.js";
|
|
4
4
|
/** Rung of the row the sparkline sits in. Height = control height; default width = 4 × height. */
|
|
5
5
|
export declare enum SparklineSize {
|
|
@@ -94,11 +94,12 @@ interface SparklineColorProps {
|
|
|
94
94
|
*/
|
|
95
95
|
variant?: undefined;
|
|
96
96
|
/**
|
|
97
|
-
* Categorical palette family (`"blue"`, `"violet"`, …)
|
|
98
|
-
*
|
|
97
|
+
* Categorical palette family (`"blue"`, `"violet"`, …) or a status role as a string
|
|
98
|
+
* (`"success"`, `"error"`): the marks take `text.<name>`, the way a status variant renders. For
|
|
99
|
+
* a series' category or data-driven color; a status that is meaning takes `variant`. Not with
|
|
99
100
|
* `variant`.
|
|
100
101
|
*/
|
|
101
|
-
color:
|
|
102
|
+
color: RoleColor;
|
|
102
103
|
}
|
|
103
104
|
/** Sparkline props. Passing both `variant` and `color` is a type error. */
|
|
104
105
|
export type SparklineProps = SparklineBaseProps & (SparklineVariantProps | SparklineColorProps);
|
package/dist/charts/Sparkline.js
CHANGED
|
@@ -112,26 +112,29 @@ var SPARKLINE_VARIANT_TO_CSS_MAP = {
|
|
|
112
112
|
};
|
|
113
113
|
/** Categorical `color`: `text.<family>`, the way a status variant renders. */
|
|
114
114
|
var SPARKLINE_COLOR_TO_CSS_MAP = {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
115
|
+
success: "gx-Sparkline-success-s1g1xl1p",
|
|
116
|
+
warning: "gx-Sparkline-warning-w1jau8rz",
|
|
117
|
+
error: "gx-Sparkline-error-e1oe0nww",
|
|
118
|
+
red: "gx-Sparkline-red-r927tvl",
|
|
119
|
+
orange: "gx-Sparkline-orange-o17vquw4",
|
|
120
|
+
amber: "gx-Sparkline-amber-a1dzgnla",
|
|
121
|
+
yellow: "gx-Sparkline-yellow-y11hl6v6",
|
|
122
|
+
lime: "gx-Sparkline-lime-l1dtbnvn",
|
|
123
|
+
green: "gx-Sparkline-green-g1hj4qmv",
|
|
124
|
+
emerald: "gx-Sparkline-emerald-e157jvnt",
|
|
125
|
+
teal: "gx-Sparkline-teal-t14oiqli",
|
|
126
|
+
cyan: "gx-Sparkline-cyan-czvb5wf",
|
|
127
|
+
sky: "gx-Sparkline-sky-s1rblyi3",
|
|
128
|
+
blue: "gx-Sparkline-blue-b1lhbciw",
|
|
129
|
+
indigo: "gx-Sparkline-indigo-i1l7cy0y",
|
|
130
|
+
violet: "gx-Sparkline-violet-vpfz7ft",
|
|
131
|
+
purple: "gx-Sparkline-purple-p14stz7g",
|
|
132
|
+
fuchsia: "gx-Sparkline-fuchsia-f41c05i",
|
|
133
|
+
pink: "gx-Sparkline-pink-psamfb6",
|
|
134
|
+
rose: "gx-Sparkline-rose-r3yynzk"
|
|
132
135
|
};
|
|
133
136
|
/** Declared after the variant and color maps so `hex` wins over them. */
|
|
134
|
-
var HEX_CSS = "gx-Sparkline-HEX_CSS-
|
|
137
|
+
var HEX_CSS = "gx-Sparkline-HEX_CSS-hhfwv7i";
|
|
135
138
|
/** A finite reading, or `null` for a gap. */
|
|
136
139
|
var toReading = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
137
140
|
/** The vertical range: the override where given, else the mark's default from the readings. */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* has to know how the palette maps to tokens. Values equal to a scale step come from `SPACE` /
|
|
8
8
|
* `RADIUS` (through `constants.ts`); widths, ratios and thresholds are geometry, not spacing.
|
|
9
9
|
*/
|
|
10
|
-
import type { Hex } from "../theme/tokens/types.js";
|
|
10
|
+
import type { Hex, RoleColor } from "../theme/tokens/types.js";
|
|
11
11
|
import type { ChartSeriesColor } from "./chartPalette.js";
|
|
12
12
|
import type { ChartPalette } from "./types.js";
|
|
13
13
|
/** @internal Ceiling on one bar's width: past it the width stops carrying information (1.x). */
|
|
@@ -153,7 +153,7 @@ export interface ResolveBarColorArgs<TMetric extends string> {
|
|
|
153
153
|
/** Index of the component within its bar. */
|
|
154
154
|
componentIndex: number;
|
|
155
155
|
/** The segment's palette override. */
|
|
156
|
-
explicit?: ChartPalette | undefined;
|
|
156
|
+
explicit?: ChartPalette | RoleColor | undefined;
|
|
157
157
|
/** The segment's raw color override. */
|
|
158
158
|
hex?: Hex | undefined;
|
|
159
159
|
}
|
|
@@ -8,6 +8,7 @@ function getBarLegendItems({ isStacked, series, groups, colors }) {
|
|
|
8
8
|
key: metric,
|
|
9
9
|
label: series[metric]?.label ?? metric,
|
|
10
10
|
...color.palette !== void 0 && { palette: color.palette },
|
|
11
|
+
...color.hue !== void 0 && { hue: color.hue },
|
|
11
12
|
...color.hex !== void 0 && { hex: color.hex }
|
|
12
13
|
};
|
|
13
14
|
});
|
|
@@ -19,6 +20,7 @@ function getBarLegendItems({ isStacked, series, groups, colors }) {
|
|
|
19
20
|
key: component.key,
|
|
20
21
|
label: component.label,
|
|
21
22
|
...color.palette !== void 0 && { palette: color.palette },
|
|
23
|
+
...color.hue !== void 0 && { hue: color.hue },
|
|
22
24
|
...color.hex !== void 0 && { hex: color.hex }
|
|
23
25
|
});
|
|
24
26
|
});
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import type { Hex,
|
|
1
|
+
import type { Hex, RoleColor } from "../theme/tokens/types.js";
|
|
2
2
|
import { ChartPalette } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* @internal Automatic assignment order: the eight hues, purple first. Status slots never join it
|
|
5
5
|
* (an ordinary ninth series must not read as an error).
|
|
6
6
|
*/
|
|
7
7
|
export declare const CHART_PALETTE_ORDER: readonly ChartPalette[];
|
|
8
|
-
/** @internal A chart ramp: a palette family or a status role. Never gray. */
|
|
9
|
-
export type ChartHue =
|
|
8
|
+
/** @internal A chart ramp: a palette family or a status role (`RoleColor`). Never gray. */
|
|
9
|
+
export type ChartHue = RoleColor;
|
|
10
|
+
/** @internal A series `color` is a palette slot (SCREAMING member) or a role name (lowercase string). */
|
|
11
|
+
export declare const isChartPalette: (value: ChartPalette | RoleColor) => value is ChartPalette;
|
|
10
12
|
/**
|
|
11
13
|
* @internal Palette slot → its family. The status slots are the status roles (there is no `INFO`
|
|
12
14
|
* slot); the old neutral slots `PRIMARY` /
|
|
@@ -24,10 +26,12 @@ export interface ChartSeriesColor {
|
|
|
24
26
|
color: string;
|
|
25
27
|
/** The slot, when the color came from the palette. */
|
|
26
28
|
palette?: ChartPalette;
|
|
29
|
+
/** The role name, when the series set one (`"error"`, `"blue"`). */
|
|
30
|
+
hue?: RoleColor;
|
|
27
31
|
/** The raw color, when the series set one. */
|
|
28
32
|
hex?: Hex;
|
|
29
33
|
}
|
|
30
34
|
/** @internal The slot at a position in the automatic order (wraps after eight). */
|
|
31
35
|
export declare function chartPaletteAt(index: number): ChartPalette;
|
|
32
|
-
/** @internal Resolves a series color: `hex` wins, then an explicit slot, then the automatic order. */
|
|
33
|
-
export declare function resolveChartSeriesColor(index: number, explicit?: ChartPalette, hex?: Hex): ChartSeriesColor;
|
|
36
|
+
/** @internal Resolves a series color: `hex` wins, then an explicit slot or role name, then the automatic order. */
|
|
37
|
+
export declare function resolveChartSeriesColor(index: number, explicit?: ChartPalette | RoleColor, hex?: Hex): ChartSeriesColor;
|
|
@@ -21,6 +21,8 @@ var CHART_PALETTE_ORDER = [
|
|
|
21
21
|
ChartPalette.YELLOW,
|
|
22
22
|
ChartPalette.GREEN
|
|
23
23
|
];
|
|
24
|
+
/** @internal A series `color` is a palette slot (SCREAMING member) or a role name (lowercase string). */
|
|
25
|
+
var isChartPalette = (value) => value in CHART_PALETTE_TO_HUE_MAP;
|
|
24
26
|
/**
|
|
25
27
|
* @internal Palette slot → its family. The status slots are the status roles (there is no `INFO`
|
|
26
28
|
* slot); the old neutral slots `PRIMARY` /
|
|
@@ -52,12 +54,16 @@ function chartPaletteAt(index) {
|
|
|
52
54
|
const order = CHART_PALETTE_ORDER;
|
|
53
55
|
return order[(index % order.length + order.length) % order.length] ?? ChartPalette.PURPLE;
|
|
54
56
|
}
|
|
55
|
-
/** @internal Resolves a series color: `hex` wins, then an explicit slot, then the automatic order. */
|
|
57
|
+
/** @internal Resolves a series color: `hex` wins, then an explicit slot or role name, then the automatic order. */
|
|
56
58
|
function resolveChartSeriesColor(index, explicit, hex) {
|
|
57
59
|
if (hex !== void 0) return {
|
|
58
60
|
color: hex,
|
|
59
61
|
hex
|
|
60
62
|
};
|
|
63
|
+
if (explicit !== void 0 && !isChartPalette(explicit)) return {
|
|
64
|
+
color: t.color.text[explicit],
|
|
65
|
+
hue: explicit
|
|
66
|
+
};
|
|
61
67
|
const palette = explicit ?? chartPaletteAt(index);
|
|
62
68
|
return {
|
|
63
69
|
color: CHART_PALETTE_TO_COLOR_MAP[palette],
|
|
@@ -65,4 +71,4 @@ function resolveChartSeriesColor(index, explicit, hex) {
|
|
|
65
71
|
};
|
|
66
72
|
}
|
|
67
73
|
//#endregion
|
|
68
|
-
export { CHART_NEUTRAL_COLOR, CHART_PALETTE_ORDER, CHART_PALETTE_TO_COLOR_MAP, CHART_PALETTE_TO_HUE_MAP, chartPaletteAt, resolveChartSeriesColor };
|
|
74
|
+
export { CHART_NEUTRAL_COLOR, CHART_PALETTE_ORDER, CHART_PALETTE_TO_COLOR_MAP, CHART_PALETTE_TO_HUE_MAP, chartPaletteAt, isChartPalette, resolveChartSeriesColor };
|
package/dist/charts/types.d.ts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
import type { AriaAttributes, CSSProperties, ReactNode } from "react";
|
|
21
|
-
import type { Hex } from "../theme/tokens/types.js";
|
|
21
|
+
import type { Hex, RoleColor } from "../theme/tokens/types.js";
|
|
22
22
|
/**
|
|
23
23
|
* Series color slot. Members are canonical color-set names (Constitution
|
|
24
24
|
* III.4). The first eight are the automatic order (purple leads); the rest are for explicit,
|
|
@@ -114,8 +114,8 @@ export type ChartLabelFormatter = (label: string) => string;
|
|
|
114
114
|
export interface ChartSeriesStyle {
|
|
115
115
|
/** Name shown in the legend, the tooltip and the accessible summary. */
|
|
116
116
|
label: string;
|
|
117
|
-
/** Palette slot. Defaults to the series' position in the record, walked through the automatic order. */
|
|
118
|
-
color?: ChartPalette;
|
|
117
|
+
/** Palette slot, or a role name (`"error"`, `"blue"`) for a series whose color is data (a run status). Defaults to the series' position in the record, walked through the automatic order. */
|
|
118
|
+
color?: ChartPalette | RoleColor;
|
|
119
119
|
/** Raw color for a data-driven series color. Discouraged: it does not follow the theme. Wins over `color`. */
|
|
120
120
|
hex?: Hex;
|
|
121
121
|
}
|
|
@@ -252,9 +252,11 @@ export interface ChartLegendItem {
|
|
|
252
252
|
key: string;
|
|
253
253
|
/** Series label. */
|
|
254
254
|
label: string;
|
|
255
|
-
/** Palette slot of the swatch, when the series has no `hex`. */
|
|
255
|
+
/** Palette slot of the swatch, when the series has no `hex` and no `hue`. */
|
|
256
256
|
palette?: ChartPalette;
|
|
257
|
-
/**
|
|
257
|
+
/** Role name of the swatch, when the series set one. */
|
|
258
|
+
hue?: RoleColor;
|
|
259
|
+
/** Raw swatch color; wins over `palette` and `hue`. */
|
|
258
260
|
hex?: Hex;
|
|
259
261
|
}
|
|
260
262
|
/** Props every chart takes (the shared vocabulary in `chartgroupprovider.md`). */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RoleColor } from "../theme/tokens/types.js";
|
|
1
2
|
import { type ChartSeriesColor } from "./chartPalette.js";
|
|
2
3
|
import { ChartPalette, type ChartSeriesStyles } from "./types.js";
|
|
3
4
|
/** @internal What `useSeriesColorResolver` returns. */
|
|
@@ -7,7 +8,7 @@ export interface SeriesColorResolver<TKey extends string> {
|
|
|
7
8
|
/** Color of a series: its `hex`, its `color` slot, or its position in the automatic order. */
|
|
8
9
|
resolve: (key: TKey) => ChartSeriesColor;
|
|
9
10
|
/** Color by position, for marks that are not series (a stack's components). */
|
|
10
|
-
resolveByIndex: (index: number, explicit?: ChartPalette) => ChartSeriesColor;
|
|
11
|
+
resolveByIndex: (index: number, explicit?: ChartPalette | RoleColor) => ChartSeriesColor;
|
|
11
12
|
/** Neutral, for a mark that names no series. */
|
|
12
13
|
neutral: ChartSeriesColor;
|
|
13
14
|
}
|
package/dist/chips/Chip.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Icon as PhosphorIcon } from "@phosphor-icons/react";
|
|
2
2
|
import { type AriaAttributes, type CSSProperties, type MouseEvent, type ReactNode } from "react";
|
|
3
|
-
import type { Hex,
|
|
3
|
+
import type { Hex, RoleColor } from "../theme/tokens/types.js";
|
|
4
4
|
/** Canonical rungs; the member names the control rung the chip sits in. */
|
|
5
5
|
export declare enum ChipSize {
|
|
6
6
|
/** 16px tall, `caption` text, 10px icon. */
|
|
@@ -153,11 +153,12 @@ interface ChipColorProps {
|
|
|
153
153
|
*/
|
|
154
154
|
variant?: undefined;
|
|
155
155
|
/**
|
|
156
|
-
* Categorical palette family (`"blue"`, `"violet"`, …)
|
|
157
|
-
*
|
|
158
|
-
*
|
|
156
|
+
* Categorical palette family (`"blue"`, `"violet"`, …) or a status role as a string
|
|
157
|
+
* (`"success"`, `"error"`): the name's text, fill and border, the way a status variant renders.
|
|
158
|
+
* For categories and data-driven chips (a source type, a team, a run status map); a status that
|
|
159
|
+
* is meaning takes `variant`. Not with `variant`.
|
|
159
160
|
*/
|
|
160
|
-
color:
|
|
161
|
+
color: RoleColor;
|
|
161
162
|
}
|
|
162
163
|
/**
|
|
163
164
|
* Chip props. A chip with nothing to show or name (`<Chip icon={TagIcon} />`) is a type error, and
|
package/dist/chips/Chip.js
CHANGED
|
@@ -152,30 +152,33 @@ var CHIP_VARIANT_TO_CSS_MAP = {
|
|
|
152
152
|
};
|
|
153
153
|
/** Categorical `color`: the family's text, fill and border, as a status variant renders. */
|
|
154
154
|
var CHIP_COLOR_TO_CSS_MAP = {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
155
|
+
success: "gx-Chip-success-s1buqu4j",
|
|
156
|
+
warning: "gx-Chip-warning-w1xofe8u",
|
|
157
|
+
error: "gx-Chip-error-elle9kf",
|
|
158
|
+
red: "gx-Chip-red-rvehr9v",
|
|
159
|
+
orange: "gx-Chip-orange-o6qjmz2",
|
|
160
|
+
amber: "gx-Chip-amber-atd4jog",
|
|
161
|
+
yellow: "gx-Chip-yellow-yvlk44e",
|
|
162
|
+
lime: "gx-Chip-lime-l1pq316v",
|
|
163
|
+
green: "gx-Chip-green-gm0lqld",
|
|
164
|
+
emerald: "gx-Chip-emerald-eyyt7c0",
|
|
165
|
+
teal: "gx-Chip-teal-t11ah2de",
|
|
166
|
+
cyan: "gx-Chip-cyan-czbiez9",
|
|
167
|
+
sky: "gx-Chip-sky-s9o9u3v",
|
|
168
|
+
blue: "gx-Chip-blue-b1ec95in",
|
|
169
|
+
indigo: "gx-Chip-indigo-iptfyqj",
|
|
170
|
+
violet: "gx-Chip-violet-v1fzme42",
|
|
171
|
+
purple: "gx-Chip-purple-piztats",
|
|
172
|
+
fuchsia: "gx-Chip-fuchsia-f1g78mhs",
|
|
173
|
+
pink: "gx-Chip-pink-p1t4qqih",
|
|
174
|
+
rose: "gx-Chip-rose-r1na9n10"
|
|
172
175
|
};
|
|
173
176
|
/** `hex`: declared after the variant and color maps so it wins over them. */
|
|
174
|
-
var HEX_CSS = "gx-Chip-HEX_CSS-
|
|
175
|
-
var HAS_BORDER_CSS = "gx-Chip-HAS_BORDER_CSS-
|
|
177
|
+
var HEX_CSS = "gx-Chip-HEX_CSS-hy859dk";
|
|
178
|
+
var HAS_BORDER_CSS = "gx-Chip-HAS_BORDER_CSS-htyaijm";
|
|
176
179
|
/** Declared after `HAS_BORDER_CSS`, so selection wins. */
|
|
177
|
-
var SELECTED_CSS = "gx-Chip-SELECTED_CSS-
|
|
178
|
-
var PILL_CSS = "gx-Chip-PILL_CSS-
|
|
180
|
+
var SELECTED_CSS = "gx-Chip-SELECTED_CSS-s94m49k";
|
|
181
|
+
var PILL_CSS = "gx-Chip-PILL_CSS-p10jj8uz";
|
|
179
182
|
/** Label and count type step per rung (Constitution III-A.4). */
|
|
180
183
|
var CHIP_SIZE_TO_TEXT_SIZE_MAP = {
|
|
181
184
|
["X_SMALL"]: TextSize.CAPTION,
|
|
@@ -9,15 +9,39 @@ export declare enum EmptyStateSize {
|
|
|
9
9
|
/** A whole page or main region: 40px tile, heading_sm header. */
|
|
10
10
|
LARGE = "LARGE"
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
/** Color role of the tile (color set, subset). */
|
|
13
|
+
export declare enum EmptyStateVariant {
|
|
14
|
+
/** A quiet tile: `text.secondary` icon on a `border.primary` hairline. The default. */
|
|
15
|
+
SECONDARY = "SECONDARY",
|
|
16
|
+
/** Something failed: `text.error` icon on a `border.error` hairline. */
|
|
17
|
+
ERROR = "ERROR"
|
|
18
|
+
}
|
|
19
|
+
/** The mark above the header: an icon in a tile, or a graphic of the app's own. */
|
|
20
|
+
interface EmptyStateIconProps {
|
|
21
|
+
/** Phosphor icon component (`TrayIcon`, not `<TrayIcon />`) shown in a small tile above the header. Not with `graphic`. */
|
|
22
|
+
icon?: PhosphorIcon;
|
|
23
|
+
/** A node of the app's own above the header. Not with `icon`. */
|
|
24
|
+
graphic?: undefined;
|
|
25
|
+
}
|
|
26
|
+
/** An app illustration instead of the icon tile. */
|
|
27
|
+
interface EmptyStateGraphicProps {
|
|
28
|
+
/** Phosphor icon component shown in a small tile above the header. Not with `graphic`. */
|
|
29
|
+
icon?: undefined;
|
|
30
|
+
/** A node of the app's own (ghost rows, a diagram) above the header, with no tile around it. Not with `icon`. */
|
|
31
|
+
graphic: ReactNode;
|
|
32
|
+
}
|
|
33
|
+
interface EmptyStateBaseProps extends AriaAttributes {
|
|
13
34
|
/** One line that says what would be here ("No runs yet", "No results for “orders”"). Medium weight. */
|
|
14
35
|
header: string;
|
|
15
36
|
/** Why it is empty or what to do next. Up to three short lines; wraps at about 48 characters. */
|
|
16
37
|
description?: string;
|
|
17
|
-
/** Phosphor icon component (`TrayIcon`, not `<TrayIcon />`) shown in a small tile above the header. */
|
|
18
|
-
icon?: PhosphorIcon;
|
|
19
38
|
/** The way out: usually one `PRIMARY` and one `SECONDARY` `Button` (or a `Link`), in that order. Use `ButtonSize.SMALL` at `SMALL`, `MEDIUM` otherwise. */
|
|
20
39
|
actions?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Color role of the icon tile: `ERROR` when the region is empty because something failed (the tile border and icon turn `error`). Does not color a `graphic`.
|
|
42
|
+
* @default EmptyStateVariant.SECONDARY
|
|
43
|
+
*/
|
|
44
|
+
variant?: EmptyStateVariant;
|
|
21
45
|
/**
|
|
22
46
|
* Where it sits: a cell, chart or menu (`SMALL`), a panel or card (`MEDIUM`), or a whole page (`LARGE`). Scales the tile, the type and the padding.
|
|
23
47
|
* @default EmptyStateSize.MEDIUM
|
|
@@ -34,6 +58,8 @@ export interface EmptyStateProps extends AriaAttributes {
|
|
|
34
58
|
/** Inline style on the root `<div>`; only for setting CSS custom properties. */
|
|
35
59
|
style?: CSSProperties;
|
|
36
60
|
}
|
|
61
|
+
/** EmptyState props. Passing both `icon` and `graphic` is a type error. */
|
|
62
|
+
export type EmptyStateProps = EmptyStateBaseProps & (EmptyStateIconProps | EmptyStateGraphicProps);
|
|
37
63
|
/** A centered icon, header, description and actions for a region with nothing to show. */
|
|
38
64
|
declare const EmptyState: import("react").ForwardRefExoticComponent<EmptyStateProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
39
65
|
export default EmptyState;
|