@galaxy-io/dls 2.3.1 → 2.4.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/biome/plugins/no-inline-style.grit +6 -3
- package/biome/plugins/warn/no-inline-style.grit +3 -1
- package/dist/beacons/Beacon.d.ts +7 -6
- package/dist/beacons/Beacon.js +21 -14
- package/dist/brand/GalaxyFilamentWordmark.js +10 -11
- package/dist/brand/GalaxyLogomark.js +8 -14
- package/dist/{three → brand}/GalaxyLogomark3D.d.ts +1 -6
- package/dist/{three → brand}/GalaxyLogomark3D.js +16 -17
- package/dist/brand/GalaxyWordmark.js +10 -36
- package/dist/{three → brand}/assets/galaxy-logomark.js +1 -1
- package/dist/{three → brand/internal}/galaxyLogomark3DScene.d.ts +1 -3
- package/dist/{three → brand/internal}/galaxyLogomark3DScene.js +45 -50
- package/dist/brand/internal/svg/GalaxyFilamentWordmarkSvg.d.ts +13 -0
- package/dist/brand/internal/svg/GalaxyFilamentWordmarkSvg.js +26 -0
- package/dist/brand/internal/svg/GalaxyLogomarkSvg.d.ts +13 -0
- package/dist/brand/internal/svg/GalaxyLogomarkSvg.js +30 -0
- package/dist/brand/internal/svg/GalaxyWordmarkSvg.d.ts +13 -0
- package/dist/brand/internal/svg/GalaxyWordmarkSvg.js +36 -0
- package/dist/charts/BarChart.js +3 -5
- package/dist/charts/ChartFrame.d.ts +4 -7
- package/dist/charts/ChartFrame.js +5 -5
- package/dist/charts/ChartLegend.d.ts +2 -9
- package/dist/charts/ChartLegend.js +4 -12
- package/dist/charts/ChartTooltip.d.ts +2 -3
- package/dist/charts/ChartTooltip.js +3 -3
- package/dist/charts/Heatmap.js +3 -4
- package/dist/charts/LineChart.d.ts +1 -1
- package/dist/charts/LineChart.js +3 -4
- package/dist/charts/PieChart.js +3 -4
- package/dist/charts/types.d.ts +12 -0
- package/dist/charts/types.js +9 -1
- package/dist/inputs/NumberInput.d.ts +1 -1
- package/dist/inputs/PasswordInput.d.ts +1 -1
- package/dist/inputs/SearchInput.d.ts +1 -1
- package/dist/inputs/ToggleInput.d.ts +9 -9
- package/dist/inputs/ToggleInput.js +40 -25
- package/dist/styles.css +1 -1
- package/dist/theme/tokens/light.js +2 -2
- package/dist/tokens.css +2 -2
- package/package.json +11 -10
|
@@ -8,9 +8,7 @@ export interface GalaxyLogomark3DSceneOptions {
|
|
|
8
8
|
isAutoRotate: boolean;
|
|
9
9
|
/** Drag to orbit (no zoom, no pan). */
|
|
10
10
|
isInteractive: boolean;
|
|
11
|
-
/**
|
|
12
|
-
isHoverable: boolean;
|
|
13
|
-
/** Auto-rotation rate in rad/s; the flip lasts `0.5 / speed` s. */
|
|
11
|
+
/** Auto-rotation rate in rad/s. */
|
|
14
12
|
speed: number;
|
|
15
13
|
}
|
|
16
14
|
/** @internal A mounted scene. */
|
|
@@ -1,22 +1,48 @@
|
|
|
1
|
-
import galaxy_logomark_default from "
|
|
2
|
-
import { ACESFilmicToneMapping, AmbientLight, Box3, DirectionalLight, Group, MathUtils, Mesh, MeshPhysicalMaterial, PMREMGenerator, PerspectiveCamera, Scene, Vector3, WebGLRenderer } from "three";
|
|
1
|
+
import galaxy_logomark_default from "../assets/galaxy-logomark.js";
|
|
2
|
+
import { ACESFilmicToneMapping, AmbientLight, Box3, Color, DirectionalLight, Group, MathUtils, Mesh, MeshPhysicalMaterial, PMREMGenerator, PerspectiveCamera, Scene, Vector3, WebGLRenderer } from "three";
|
|
3
3
|
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
|
|
4
4
|
import { RoomEnvironment } from "three/addons/environments/RoomEnvironment.js";
|
|
5
5
|
import { OBJLoader } from "three/addons/loaders/OBJLoader.js";
|
|
6
|
-
//#region src/
|
|
6
|
+
//#region src/brand/internal/galaxyLogomark3DScene.ts
|
|
7
7
|
/**
|
|
8
8
|
* @internal The three.js scene behind `GalaxyLogomark3D`; not documented API. The component loads
|
|
9
|
-
* this module with a dynamic `import()` after mount, so three.js and the ~2.4 MB model
|
|
10
|
-
*
|
|
11
|
-
* react-three-fiber scene with its
|
|
12
|
-
* three-light rig, a procedural
|
|
9
|
+
* this module with a dynamic `import()` after mount, so three.js and the ~2.4 MB model
|
|
10
|
+
* (`src/brand/assets/galaxy-logomark.obj`, imported as text) stay out of every other module's
|
|
11
|
+
* graph and out of build-time evaluation. A port of the 1.x react-three-fiber scene with its
|
|
12
|
+
* default look: one glossy physical material, the simple three-light rig, a procedural
|
|
13
|
+
* `RoomEnvironment` (no CDN fetch), drag-to-orbit only.
|
|
13
14
|
*/
|
|
14
15
|
/** The 1.x mesh scale: the resting mark spans ≈ 76% of the canvas at the 1.x camera. */
|
|
15
16
|
var MESH_SCALE = .088;
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Reflection strength and sheen of the material, by the color's lightness. The 1.x values
|
|
19
|
+
* (`envMapIntensity` 1.5, `sheen` 1) were tuned on the white mark, where the white diffuse
|
|
20
|
+
* dominates and the room reflections read as a soft gloss. On a black mark the diffuse is gone and
|
|
21
|
+
* the same reflections read as a mirror, so a dark color takes a fraction of them and the two
|
|
22
|
+
* marks carry the same amount of shine (a dark mark is also a little rougher, so its highlights
|
|
23
|
+
* spread like the white one's instead of pooling into mirror spots); colors in between interpolate
|
|
24
|
+
* on relative luminance.
|
|
25
|
+
*/
|
|
26
|
+
var LIGHT_MATERIAL = {
|
|
27
|
+
envMapIntensity: 1.5,
|
|
28
|
+
sheen: 1,
|
|
29
|
+
roughness: 0
|
|
30
|
+
};
|
|
31
|
+
var DARK_MATERIAL = {
|
|
32
|
+
envMapIntensity: .3,
|
|
33
|
+
sheen: .2,
|
|
34
|
+
roughness: .4
|
|
35
|
+
};
|
|
36
|
+
/** Reflection, sheen and roughness for a color, from its relative luminance (three's linear-sRGB channels). */
|
|
37
|
+
function materialTuning(hex) {
|
|
38
|
+
const { r, g, b } = new Color(hex);
|
|
39
|
+
const luminance = MathUtils.clamp(.2126 * r + .7152 * g + .0722 * b, 0, 1);
|
|
40
|
+
return {
|
|
41
|
+
envMapIntensity: MathUtils.lerp(DARK_MATERIAL.envMapIntensity, LIGHT_MATERIAL.envMapIntensity, luminance),
|
|
42
|
+
sheen: MathUtils.lerp(DARK_MATERIAL.sheen, LIGHT_MATERIAL.sheen, luminance),
|
|
43
|
+
roughness: MathUtils.lerp(DARK_MATERIAL.roughness, LIGHT_MATERIAL.roughness, luminance)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
20
46
|
/** Eases an angle 10% of the way to rest by the shortest way, snapping to 0 once invisible. */
|
|
21
47
|
var settle = (angle) => {
|
|
22
48
|
const next = MathUtils.lerp(wrapAngle(angle), 0, .1);
|
|
@@ -24,8 +50,6 @@ var settle = (angle) => {
|
|
|
24
50
|
};
|
|
25
51
|
/** The same angle in [-π, π). */
|
|
26
52
|
var wrapAngle = (angle) => MathUtils.euclideanModulo(angle + Math.PI, Math.PI * 2) - Math.PI;
|
|
27
|
-
/** -1, 0 or 1. */
|
|
28
|
-
var randomAxis = () => Math.floor(Math.random() * 3) - 1;
|
|
29
53
|
/**
|
|
30
54
|
* @internal Renders the Galaxy logomark into `canvas` and keeps it moving until `dispose()`.
|
|
31
55
|
* Calls `onFirstFrame` once, after the first frame is drawn.
|
|
@@ -60,15 +84,13 @@ function mountGalaxyLogomark3DScene(canvas, options, onFirstFrame) {
|
|
|
60
84
|
color: current.color,
|
|
61
85
|
sheenColor: current.color,
|
|
62
86
|
metalness: 0,
|
|
63
|
-
roughness: 0,
|
|
64
87
|
transmission: 0,
|
|
65
88
|
thickness: 0,
|
|
66
89
|
ior: 1,
|
|
67
90
|
clearcoat: 0,
|
|
68
91
|
clearcoatRoughness: 0,
|
|
69
|
-
sheen: 1,
|
|
70
92
|
sheenRoughness: 0,
|
|
71
|
-
|
|
93
|
+
...materialTuning(current.color)
|
|
72
94
|
});
|
|
73
95
|
const model = new OBJLoader().parse(galaxy_logomark_default);
|
|
74
96
|
model.traverse((child) => {
|
|
@@ -91,44 +113,14 @@ function mountGalaxyLogomark3DScene(canvas, options, onFirstFrame) {
|
|
|
91
113
|
if (!current.isInteractive) setInteractive(false);
|
|
92
114
|
const startTime = performance.now();
|
|
93
115
|
const elapsedSeconds = () => (performance.now() - startTime) / 1e3;
|
|
94
|
-
let flipStart = null;
|
|
95
|
-
let flipAxes = {
|
|
96
|
-
x: 0,
|
|
97
|
-
y: 1,
|
|
98
|
-
z: 0
|
|
99
|
-
};
|
|
100
|
-
const onPointerEnter = () => {
|
|
101
|
-
if (!current.isHoverable) return;
|
|
102
|
-
let axes = {
|
|
103
|
-
x: randomAxis(),
|
|
104
|
-
y: randomAxis(),
|
|
105
|
-
z: randomAxis()
|
|
106
|
-
};
|
|
107
|
-
while (axes.x === 0 && axes.y === 0 && axes.z === 0) axes = {
|
|
108
|
-
x: randomAxis(),
|
|
109
|
-
y: randomAxis(),
|
|
110
|
-
z: randomAxis()
|
|
111
|
-
};
|
|
112
|
-
flipAxes = axes;
|
|
113
|
-
flipStart = elapsedSeconds();
|
|
114
|
-
};
|
|
115
|
-
canvas.addEventListener("pointerenter", onPointerEnter);
|
|
116
116
|
let hasDrawn = false;
|
|
117
117
|
let frame = 0;
|
|
118
118
|
const tick = () => {
|
|
119
119
|
frame = requestAnimationFrame(tick);
|
|
120
|
-
const elapsed = elapsedSeconds();
|
|
121
|
-
const flipDuration = .5 / current.speed;
|
|
122
120
|
const { rotation } = group;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
} else {
|
|
127
|
-
flipStart = null;
|
|
128
|
-
rotation.x = settle(rotation.x);
|
|
129
|
-
rotation.z = settle(rotation.z);
|
|
130
|
-
rotation.y = current.isAutoRotate ? elapsed * current.speed : settle(rotation.y);
|
|
131
|
-
}
|
|
121
|
+
rotation.x = settle(rotation.x);
|
|
122
|
+
rotation.z = settle(rotation.z);
|
|
123
|
+
rotation.y = current.isAutoRotate ? elapsedSeconds() * current.speed : settle(rotation.y);
|
|
132
124
|
renderer.render(scene, camera);
|
|
133
125
|
if (!hasDrawn) {
|
|
134
126
|
hasDrawn = true;
|
|
@@ -142,13 +134,16 @@ function mountGalaxyLogomark3DScene(canvas, options, onFirstFrame) {
|
|
|
142
134
|
if (next.color !== current.color) {
|
|
143
135
|
material.color.set(next.color);
|
|
144
136
|
material.sheenColor.set(next.color);
|
|
137
|
+
const tuning = materialTuning(next.color);
|
|
138
|
+
material.envMapIntensity = tuning.envMapIntensity;
|
|
139
|
+
material.sheen = tuning.sheen;
|
|
140
|
+
material.roughness = tuning.roughness;
|
|
145
141
|
}
|
|
146
142
|
if (next.isInteractive !== current.isInteractive) setInteractive(next.isInteractive);
|
|
147
143
|
current = next;
|
|
148
144
|
},
|
|
149
145
|
dispose() {
|
|
150
146
|
cancelAnimationFrame(frame);
|
|
151
|
-
canvas.removeEventListener("pointerenter", onPointerEnter);
|
|
152
147
|
controls.dispose();
|
|
153
148
|
model.traverse((child) => {
|
|
154
149
|
if (child instanceof Mesh) child.geometry.dispose();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal Generated by `pnpm assets` from `src/brand/assets/galaxy-filament-wordmark.svg`.
|
|
3
|
+
* Do not edit: change the SVG and run `pnpm assets`. Every fill is `currentColor` and the
|
|
4
|
+
* root has no size; the public mark that renders this sets both.
|
|
5
|
+
*/
|
|
6
|
+
import { type SVGProps } from "react";
|
|
7
|
+
declare const GalaxyFilamentWordmarkSvg: import("react").ForwardRefExoticComponent<Omit<SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
8
|
+
export default GalaxyFilamentWordmarkSvg;
|
|
9
|
+
/** @internal The artwork's viewBox; the public mark derives its width as `size × width / height`. */
|
|
10
|
+
export declare const GALAXY_FILAMENT_WORDMARK_VIEW_BOX: {
|
|
11
|
+
readonly width: 4513;
|
|
12
|
+
readonly height: 1200;
|
|
13
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/brand/internal/svg/GalaxyFilamentWordmarkSvg.tsx
|
|
4
|
+
/**
|
|
5
|
+
* @internal Generated by `pnpm assets` from `src/brand/assets/galaxy-filament-wordmark.svg`.
|
|
6
|
+
* Do not edit: change the SVG and run `pnpm assets`. Every fill is `currentColor` and the
|
|
7
|
+
* root has no size; the public mark that renders this sets both.
|
|
8
|
+
*/
|
|
9
|
+
var GalaxyFilamentWordmarkSvg = forwardRef(function GalaxyFilamentWordmarkSvg(props, ref) {
|
|
10
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
viewBox: "0 0 4513 1200",
|
|
13
|
+
fill: "currentColor",
|
|
14
|
+
ref,
|
|
15
|
+
...props,
|
|
16
|
+
children: /* @__PURE__ */ jsx("path", { d: "M181.814 1141.98L159.701 1200L0 985.717L292.377 210.999L363.136 151.659H701.801L660.525 253.856H517.432L468.053 385.708H617.534L579.697 487.246H429.725L181.814 1141.98ZM720.432 336.273L766.622 212.318H1005.44L958.942 336.273H720.432ZM505.694 910.552L701.758 384.404H941.065L745.001 910.552H505.694ZM825.912 910.552L1109.45 151.659L1131.06 92.978L1290.77 307.262L1065.71 910.552H825.912ZM1452.44 720.004L1419.51 808.356H1510.91L1544.32 720.004H1452.44ZM1582.16 617.808L1630.81 487.259H1539.41L1510.41 563.743H1271.11L1316.32 443.085L1359.56 384.404H1864.71L1886.33 443.085L1711.4 910.552H1185.61L1163.99 851.872L1250.96 617.808H1582.16ZM2016.67 910.552H1788.05L1983.62 385.063H2742.33L2763.95 443.085L2590 910.552H2361.38L2519.61 487.259H2457.44L2299.21 910.552H2082.28L2240.01 487.259H2173.91L2016.67 910.552ZM2998.33 664.621L2943.8 808.356H3034.7L3075 703.522H3314.3L3258.29 852.531L3215.04 910.552H2709.9L2688.27 852.531L2840.6 443.085L2883.84 385.063H3388.99L3410.62 443.085L3330.03 665.281H3090.23V664.621H2998.33ZM3128.07 563.083L3155.09 487.259H3063.2L3035.68 563.083H3128.07ZM3553.12 910.552H3313.32L3508.9 385.063H4033.2L4054.83 443.085L3880.38 910.552H3640.59L3798.81 487.259H3710.36L3553.12 910.552ZM4120.38 481.326L4158.22 379.788L4243.72 149.681L4265.34 91L4425.04 304.625L4397.53 379.788H4513L4470.74 481.326H4359.69L4237.83 808.356H4343.2L4299.17 910.552H4197.24H4003.92L3980.82 854.51L4120.38 481.326Z" })
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
GalaxyFilamentWordmarkSvg.displayName = "GalaxyFilamentWordmarkSvg";
|
|
20
|
+
/** @internal The artwork's viewBox; the public mark derives its width as `size × width / height`. */
|
|
21
|
+
var GALAXY_FILAMENT_WORDMARK_VIEW_BOX = {
|
|
22
|
+
width: 4513,
|
|
23
|
+
height: 1200
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { GALAXY_FILAMENT_WORDMARK_VIEW_BOX, GalaxyFilamentWordmarkSvg as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal Generated by `pnpm assets` from `src/brand/assets/galaxy-logomark.svg`.
|
|
3
|
+
* Do not edit: change the SVG and run `pnpm assets`. Every fill is `currentColor` and the
|
|
4
|
+
* root has no size; the public mark that renders this sets both.
|
|
5
|
+
*/
|
|
6
|
+
import { type SVGProps } from "react";
|
|
7
|
+
declare const GalaxyLogomarkSvg: import("react").ForwardRefExoticComponent<Omit<SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
8
|
+
export default GalaxyLogomarkSvg;
|
|
9
|
+
/** @internal The artwork's viewBox; the public mark derives its width as `size × width / height`. */
|
|
10
|
+
export declare const GALAXY_LOGOMARK_VIEW_BOX: {
|
|
11
|
+
readonly width: 1080;
|
|
12
|
+
readonly height: 1080;
|
|
13
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/brand/internal/svg/GalaxyLogomarkSvg.tsx
|
|
4
|
+
/**
|
|
5
|
+
* @internal Generated by `pnpm assets` from `src/brand/assets/galaxy-logomark.svg`.
|
|
6
|
+
* Do not edit: change the SVG and run `pnpm assets`. Every fill is `currentColor` and the
|
|
7
|
+
* root has no size; the public mark that renders this sets both.
|
|
8
|
+
*/
|
|
9
|
+
var GalaxyLogomarkSvg = forwardRef(function GalaxyLogomarkSvg(props, ref) {
|
|
10
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
viewBox: "0 0 1080 1080",
|
|
13
|
+
fill: "currentColor",
|
|
14
|
+
ref,
|
|
15
|
+
...props,
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx("path", { d: "M239.88,479.75c132.27,0,239.88-107.61,239.88-239.88S372.14,0,239.88,0,0,107.61,0,239.88s107.61,239.88,239.88,239.88" }),
|
|
18
|
+
/* @__PURE__ */ jsx("path", { d: "M840.12,600.25c-132.27,0-239.88,107.61-239.88,239.88s107.61,239.88,239.88,239.88,239.88-107.61,239.88-239.88-107.61-239.88-239.88-239.88" }),
|
|
19
|
+
/* @__PURE__ */ jsx("path", { d: "M473.59,894.23c27.96-103.95.03-195.9,112.41-308.28,112.37-112.38,204.13-84.39,308.07-112.32,8.08-1.87,16.02-4.15,23.77-6.81.07-.02.13-.04.19-.06h.01c94.13-32.43,161.95-121.88,161.95-226.88C1080,107.61,972.39,0,840.12,0,735.12,0,645.68,67.82,613.25,161.95h-.01c-.03.1-.05.18-.08.26-2.65,7.72-4.92,15.61-6.78,23.67-27.93,103.9-.72,196.5-112.24,308.02-111.53,111.52-204.35,84.54-308.26,112.48-8.06,1.86-15.95,4.13-23.67,6.78-.08.02-.16.05-.25.08h-.01C67.82,645.68,0,735.13,0,840.13,0,972.39,107.61,1079.99,239.88,1079.99c105,0,194.46-67.82,226.88-161.95,0,0,0,0,0,0,0-.02,0-.04.01-.06,1.66-4.8,3.16-9.67,4.51-14.6.83-3.02,1.59-6.07,2.3-9.14" })
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
GalaxyLogomarkSvg.displayName = "GalaxyLogomarkSvg";
|
|
24
|
+
/** @internal The artwork's viewBox; the public mark derives its width as `size × width / height`. */
|
|
25
|
+
var GALAXY_LOGOMARK_VIEW_BOX = {
|
|
26
|
+
width: 1080,
|
|
27
|
+
height: 1080
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { GALAXY_LOGOMARK_VIEW_BOX, GalaxyLogomarkSvg as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal Generated by `pnpm assets` from `src/brand/assets/galaxy-wordmark.svg`.
|
|
3
|
+
* Do not edit: change the SVG and run `pnpm assets`. Every fill is `currentColor` and the
|
|
4
|
+
* root has no size; the public mark that renders this sets both.
|
|
5
|
+
*/
|
|
6
|
+
import { type SVGProps } from "react";
|
|
7
|
+
declare const GalaxyWordmarkSvg: import("react").ForwardRefExoticComponent<Omit<SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
8
|
+
export default GalaxyWordmarkSvg;
|
|
9
|
+
/** @internal The artwork's viewBox; the public mark derives its width as `size × width / height`. */
|
|
10
|
+
export declare const GALAXY_WORDMARK_VIEW_BOX: {
|
|
11
|
+
readonly width: 1080;
|
|
12
|
+
readonly height: 355.84;
|
|
13
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/brand/internal/svg/GalaxyWordmarkSvg.tsx
|
|
4
|
+
/**
|
|
5
|
+
* @internal Generated by `pnpm assets` from `src/brand/assets/galaxy-wordmark.svg`.
|
|
6
|
+
* Do not edit: change the SVG and run `pnpm assets`. Every fill is `currentColor` and the
|
|
7
|
+
* root has no size; the public mark that renders this sets both.
|
|
8
|
+
*/
|
|
9
|
+
var GalaxyWordmarkSvg = forwardRef(function GalaxyWordmarkSvg(props, ref) {
|
|
10
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
viewBox: "0 0 1080 355.84",
|
|
13
|
+
fill: "currentColor",
|
|
14
|
+
ref,
|
|
15
|
+
...props,
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("path", { d: "M55.16,176.18c0,40.12,20.28,53.2,46.88,53.2s46.01-13.08,46.01-53.2-19.41-53.2-46.01-53.2-46.88,13.08-46.88,53.2M98.34,355.84c-63.01,0-98.34-22.68-98.34-74.13h61.05c-.87,25.95,15.26,30.96,40.99,30.96s45.35-6.98,45.35-37.72v-17.66c-11.56,11.34-28.56,18.97-50.58,18.97C37.5,276.26,0,243.55,0,176.18s38.81-102.26,90.92-102.26c22.68,0,42.3,8.94,56.47,22.02v-18.53h55.6v197.54c0,58.22-37.29,80.89-104.66,80.89" }), /* @__PURE__ */ jsx("path", { d: "M300.69,231.56c19.62,0,37.94-8.07,46.01-27.47v-31.4c-9.59,10.25-21.59,17.88-40.77,21.8l-10.9,2.18c-14.83,3.05-20.93,7.41-20.93,17.88s10.47,17.01,26.6,17.01M346.69,255.11c-15.26,15.7-32.71,23.33-59.09,23.33-41.65,0-71.08-23.77-71.08-63.89,0-32.71,17.88-48.62,74.79-58.22l31.18-5.23c19.19-3.27,24.2-7.2,24.2-15.92s-3.49-14.83-32.05-14.83c-21.37,0-37.94,6.11-35.76,26.6h-57.56c-3.93-53.2,45.57-73.04,92.89-73.04,55.6,0,87.87,21.59,87.87,72.82v128.21h-55.38v-19.84Z" })] }),
|
|
18
|
+
/* @__PURE__ */ jsx("rect", {
|
|
19
|
+
x: 419.1,
|
|
20
|
+
width: 55.6,
|
|
21
|
+
height: 274.95
|
|
22
|
+
}),
|
|
23
|
+
/* @__PURE__ */ jsx("path", { d: "M572.39,231.56c19.62,0,37.94-8.07,46.01-27.47v-31.4c-9.59,10.25-21.59,17.88-40.77,21.8l-10.9,2.18c-14.83,3.05-20.93,7.41-20.93,17.88s10.47,17.01,26.6,17.01M618.39,255.11c-15.26,15.7-32.7,23.33-59.09,23.33-41.65,0-71.08-23.77-71.08-63.89,0-32.71,17.88-48.62,74.79-58.22l31.18-5.23c19.19-3.27,24.2-7.2,24.2-15.92s-3.49-14.83-32.05-14.83c-21.37,0-37.94,6.11-35.76,26.6h-57.56c-3.93-53.2,45.57-73.04,92.89-73.04,55.6,0,87.87,21.59,87.87,72.82v128.21h-55.38v-19.84Z" }),
|
|
24
|
+
/* @__PURE__ */ jsx("polygon", { points: "776.09 221.75 739.25 274.95 672.53 274.95 742.3 176.61 673.62 77.4 740.12 77.4 776.75 131.26 813.38 77.4 879.01 77.4 809.24 176.39 878.57 274.95 812.29 274.95 776.09 221.75" }),
|
|
25
|
+
/* @__PURE__ */ jsx("path", { d: "M1080,77.4l-82.85,226.98c-10.25,27.91-20.93,51.46-52.55,51.46-13.08,0-27.47-3.05-41.43-7.2v-50.37l10.03,3.05c20.06,6.11,29,1.31,34.01-12.65l5.45-15.26-75.44-196.02h60.83l41.21,120.58,42.74-120.58h58Z" })
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
GalaxyWordmarkSvg.displayName = "GalaxyWordmarkSvg";
|
|
30
|
+
/** @internal The artwork's viewBox; the public mark derives its width as `size × width / height`. */
|
|
31
|
+
var GALAXY_WORDMARK_VIEW_BOX = {
|
|
32
|
+
width: 1080,
|
|
33
|
+
height: 355.84
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { GALAXY_WORDMARK_VIEW_BOX, GalaxyWordmarkSvg as default };
|
package/dist/charts/BarChart.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Orientation } from "../theme/enums.js";
|
|
2
|
-
import { ChartKind, ChartLegendPlacement, ChartMarkState, ChartTargetShape } from "./types.js";
|
|
2
|
+
import { ChartKind, ChartLegendPlacement, ChartMarkState, ChartSwatch, ChartTargetShape } from "./types.js";
|
|
3
3
|
import { CHART_BAR_CSS, CHART_CURSOR_BAND_CSS, CHART_CURSOR_BAND_SELECTED_CSS, CHART_MARK_STATE_TO_CSS_MAP } from "./ChartPrimitives.js";
|
|
4
4
|
import "./constants.js";
|
|
5
5
|
import { ChartCategoryAxis, ChartValueAxis } from "./ChartAxis.js";
|
|
6
6
|
import { resolveChartSeriesColor } from "./chartPalette.js";
|
|
7
|
-
import { ChartLegendSwatch } from "./ChartLegend.js";
|
|
8
7
|
import { ChartFrame } from "./ChartFrame.js";
|
|
9
8
|
import { formatChartValue, resolveValueFormatter } from "./chartFormat.js";
|
|
10
9
|
import { useCartesianChartLayout } from "./useCartesianChartLayout.js";
|
|
@@ -49,7 +48,7 @@ function visualOrder(components) {
|
|
|
49
48
|
return [...indexed].sort((a, b) => rank(a) - rank(b) || a.index - b.index).map(({ component }) => component);
|
|
50
49
|
}
|
|
51
50
|
function BarChartInner(props, ref) {
|
|
52
|
-
const { series, groups, normalization = "NONE", minSegmentLength = 0, valueFormatter, labelFormatter, valueDomain, axisLabels, hasLegend = true, hasTooltip = true, renderTooltip, isLoading = false, placeholder = DEFAULT_PLACEHOLDER, onSelect, selection, isFilterable = false, defaultSelection, onSelectionChange, ariaLabel, id, className, style, ...rest } = props;
|
|
51
|
+
const { series, groups, normalization = "NONE", minSegmentLength = 0, valueFormatter, labelFormatter, valueDomain, axisLabels, hasLegend = true, swatch = ChartSwatch.SQUARE, hasTooltip = true, renderTooltip, isLoading = false, placeholder = DEFAULT_PLACEHOLDER, onSelect, selection, isFilterable = false, defaultSelection, onSelectionChange, ariaLabel, id, className, style, ...rest } = props;
|
|
53
52
|
const plotRef = useRef(null);
|
|
54
53
|
const colors = useSeriesColorResolver(series);
|
|
55
54
|
const axisValueFormatter = normalization === "PERCENT" && valueFormatter === void 0 ? PERCENT_AXIS_FORMATTER : valueFormatter;
|
|
@@ -261,8 +260,7 @@ function BarChartInner(props, ref) {
|
|
|
261
260
|
formatCategoryKey: formatLabel,
|
|
262
261
|
legendItems,
|
|
263
262
|
legendPlacement: ChartLegendPlacement.BOTTOM,
|
|
264
|
-
|
|
265
|
-
tooltipSwatch: ChartLegendSwatch.SQUARE,
|
|
263
|
+
swatch,
|
|
266
264
|
children: [
|
|
267
265
|
geometry.bands.filter((band) => interaction.selectedCategoryIndices.has(band.groupIndex)).map((band) => /* @__PURE__ */ jsx("rect", {
|
|
268
266
|
x: band.x,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type CSSProperties, type ForwardedRef, type ReactNode, type RefObject } from "react";
|
|
2
|
-
import { type
|
|
3
|
-
import { type ChartCategoryTarget, ChartKind, type ChartLegendItem, ChartLegendPlacement, type ChartMarkTarget, type ChartPlotTooltipModel, type ChartTooltipRenderer } from "./types.js";
|
|
2
|
+
import { type ChartCategoryTarget, ChartKind, type ChartLegendItem, ChartLegendPlacement, type ChartMarkTarget, type ChartPlotTooltipModel, type ChartSwatch, type ChartTooltipRenderer } from "./types.js";
|
|
4
3
|
import type { ChartDimensions } from "./useChartDimensions.js";
|
|
5
4
|
import type { ChartInteraction } from "./useChartInteraction.js";
|
|
6
5
|
import type { ChartTooltipVerticalAlign } from "./useChartTooltipPosition.js";
|
|
@@ -70,10 +69,8 @@ export interface ChartFrameProps {
|
|
|
70
69
|
legendItems: ChartLegendItem[];
|
|
71
70
|
/** Legend placement. */
|
|
72
71
|
legendPlacement: ChartLegendPlacement;
|
|
73
|
-
/**
|
|
74
|
-
|
|
75
|
-
/** Tooltip row swatch shape. Defaults to `CIRCLE` (BarChart passes `SQUARE`). */
|
|
76
|
-
tooltipSwatch?: ChartLegendSwatch | undefined;
|
|
72
|
+
/** The `swatch` prop, resolved: legend entries and tooltip rows share it. */
|
|
73
|
+
swatch: ChartSwatch;
|
|
77
74
|
/** A chart's own legend in place of the series legend (Heatmap's step legend). */
|
|
78
75
|
legend?: ReactNode;
|
|
79
76
|
/** Names a raw category key in the filter chip (the chart's `labelFormatter`). @default the key */
|
|
@@ -84,4 +81,4 @@ export interface ChartFrameProps {
|
|
|
84
81
|
style?: CSSProperties | undefined;
|
|
85
82
|
}
|
|
86
83
|
/** @internal The chart shell. */
|
|
87
|
-
export declare function ChartFrame({ rootRef, plotRef, id, className, style, rest, dimensions, interaction, kind, categoryCount, ariaLabel, aspectRatio, axes, children, plotOverlay, plotClassName, describeCategory, hasTooltip, buildCategoryTooltip, renderTooltip, categoryTargets, markTargets, targetsTransform, onCategorySelect, onMarkSelect, anchorHalfWidth, placeAwayFromX, verticalAlign, isEmpty, isLoading, placeholder, hasLegend, legendItems, legendPlacement,
|
|
84
|
+
export declare function ChartFrame({ rootRef, plotRef, id, className, style, rest, dimensions, interaction, kind, categoryCount, ariaLabel, aspectRatio, axes, children, plotOverlay, plotClassName, describeCategory, hasTooltip, buildCategoryTooltip, renderTooltip, categoryTargets, markTargets, targetsTransform, onCategorySelect, onMarkSelect, anchorHalfWidth, placeAwayFromX, verticalAlign, isEmpty, isLoading, placeholder, hasLegend, legendItems, legendPlacement, swatch, legend, formatCategoryKey, }: ChartFrameProps): import("react").JSX.Element;
|
|
@@ -61,7 +61,7 @@ var Overlay = /*#__PURE__*/ styled("div")({
|
|
|
61
61
|
/** A standalone `Skeleton RECT` that takes the whole plot box. */
|
|
62
62
|
var LOADING_SKELETON_CSS = "gx-ChartFrame-LOADING_SKELETON_CSS-l1oi7u1q";
|
|
63
63
|
/**
|
|
64
|
-
* A chart's own legend (Heatmap's steps) with the filter chip after it. Both carry the legend's
|
|
64
|
+
* A chart's own legend (Heatmap's steps) with the filter chip after it. Both carry the legend's 12px
|
|
65
65
|
* top padding and center on each other, so the chip centers on the legend's text line.
|
|
66
66
|
*/
|
|
67
67
|
var CustomLegendBar = /*#__PURE__*/ styled("div")({
|
|
@@ -70,7 +70,7 @@ var CustomLegendBar = /*#__PURE__*/ styled("div")({
|
|
|
70
70
|
propsAsIs: false
|
|
71
71
|
});
|
|
72
72
|
/**
|
|
73
|
-
* The chips after a chart's own legend. Its height (the
|
|
73
|
+
* The chips after a chart's own legend. Its height (the 12px top padding and a 20px chip) is kept
|
|
74
74
|
* while nothing is pinned, so the plot above never moves when a chip appears.
|
|
75
75
|
*/
|
|
76
76
|
var CustomFilterSlot = /*#__PURE__*/ styled("div")({
|
|
@@ -109,7 +109,7 @@ var NAVIGATION_KEYS = new Set([
|
|
|
109
109
|
"End"
|
|
110
110
|
]);
|
|
111
111
|
/** @internal The chart shell. */
|
|
112
|
-
function ChartFrame({ rootRef, plotRef, id, className, style, rest, dimensions, interaction, kind, categoryCount, ariaLabel, aspectRatio, axes, children, plotOverlay, plotClassName, describeCategory, hasTooltip, buildCategoryTooltip, renderTooltip, categoryTargets, markTargets, targetsTransform, onCategorySelect, onMarkSelect, anchorHalfWidth, placeAwayFromX, verticalAlign, isEmpty, isLoading, placeholder, hasLegend, legendItems, legendPlacement,
|
|
112
|
+
function ChartFrame({ rootRef, plotRef, id, className, style, rest, dimensions, interaction, kind, categoryCount, ariaLabel, aspectRatio, axes, children, plotOverlay, plotClassName, describeCategory, hasTooltip, buildCategoryTooltip, renderTooltip, categoryTargets, markTargets, targetsTransform, onCategorySelect, onMarkSelect, anchorHalfWidth, placeAwayFromX, verticalAlign, isEmpty, isLoading, placeholder, hasLegend, legendItems, legendPlacement, swatch, legend, formatCategoryKey }) {
|
|
113
113
|
const { width, height, insets, isMeasured } = dimensions;
|
|
114
114
|
const [announcement, setAnnouncement] = useState("");
|
|
115
115
|
const { rootPassthrough, plotAria } = useMemo(() => {
|
|
@@ -247,7 +247,7 @@ function ChartFrame({ rootRef, plotRef, id, className, style, rest, dimensions,
|
|
|
247
247
|
const legendNode = !hasLegend || isSkeleton ? null : legend ?? /* @__PURE__ */ jsx(ChartLegend, {
|
|
248
248
|
items: legendItems,
|
|
249
249
|
placement: legendPlacement,
|
|
250
|
-
swatch
|
|
250
|
+
swatch,
|
|
251
251
|
inset: isSideLegend ? CHART_LEGEND_SIDE_GAP : insets.left,
|
|
252
252
|
extent: isSideLegend ? Math.max(0, height - (interaction.isFilterable ? CHART_LEGEND_FILTER_EXTENT : 0)) : 0,
|
|
253
253
|
isFixedExtent: !interaction.isFilterable,
|
|
@@ -321,7 +321,7 @@ function ChartFrame({ rootRef, plotRef, id, className, style, rest, dimensions,
|
|
|
321
321
|
placeAwayFromX: placeAwayFromX === void 0 ? void 0 : placeAwayFromX + insets.left,
|
|
322
322
|
verticalAlign,
|
|
323
323
|
renderTooltip,
|
|
324
|
-
swatch
|
|
324
|
+
swatch
|
|
325
325
|
}),
|
|
326
326
|
/* @__PURE__ */ jsx(LiveRegion, {
|
|
327
327
|
"aria-live": "polite",
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import { type ChartLegendItem, ChartLegendPlacement, ChartMarkState } from "./types.js";
|
|
3
|
-
/** @internal Swatch shape: a dot for line series, a square for filled series. */
|
|
4
|
-
export declare enum ChartLegendSwatch {
|
|
5
|
-
/** `Circle SMALL`: line series. */
|
|
6
|
-
CIRCLE = "CIRCLE",
|
|
7
|
-
/** `Square SMALL`: area, bar, arc and heatmap series. */
|
|
8
|
-
SQUARE = "SQUARE"
|
|
9
|
-
}
|
|
2
|
+
import { type ChartLegendItem, ChartLegendPlacement, ChartMarkState, ChartSwatch } from "./types.js";
|
|
10
3
|
/** @internal Props of `ChartLegend`. */
|
|
11
4
|
export interface ChartLegendProps {
|
|
12
5
|
/** Entries in series order. */
|
|
@@ -14,7 +7,7 @@ export interface ChartLegendProps {
|
|
|
14
7
|
/** Line (BOTTOM) or column (RIGHT). */
|
|
15
8
|
placement: ChartLegendPlacement;
|
|
16
9
|
/** Swatch shape. */
|
|
17
|
-
swatch:
|
|
10
|
+
swatch: ChartSwatch;
|
|
18
11
|
/** BOTTOM: left padding that aligns the legend with the plot. */
|
|
19
12
|
inset: number;
|
|
20
13
|
/** RIGHT: the plot height the column fits into (0 = unconstrained). */
|
|
@@ -3,7 +3,7 @@ import { Placement } from "../theme/enums.js";
|
|
|
3
3
|
import Text, { TextSize, TextVariant } from "../text/Text.js";
|
|
4
4
|
import Flex, { AlignItems } from "../layout/Flex.js";
|
|
5
5
|
import Tooltip from "../tooltip/Tooltip.js";
|
|
6
|
-
import { ChartLegendPlacement, ChartMarkState, ChartPalette } from "./types.js";
|
|
6
|
+
import { ChartLegendPlacement, ChartMarkState, ChartPalette, ChartSwatch } from "./types.js";
|
|
7
7
|
import { CHART_MARK_STATE_TO_CSS_MAP } from "./ChartPrimitives.js";
|
|
8
8
|
import "./constants.js";
|
|
9
9
|
import { isAdditiveEvent } from "./chartSelection.js";
|
|
@@ -32,14 +32,6 @@ import { cx } from "@linaria/core";
|
|
|
32
32
|
* padding on each entry (trailing in a row, split above and below in a column so the column
|
|
33
33
|
* centers), not a flex gap, so sweeping across entries never drops the isolation. Isolation changes opacity only; it never rescales the axis.
|
|
34
34
|
*/
|
|
35
|
-
/** @internal Swatch shape: a dot for line series, a square for filled series. */
|
|
36
|
-
var ChartLegendSwatch = /* @__PURE__ */ function(ChartLegendSwatch) {
|
|
37
|
-
/** `Circle SMALL`: line series. */
|
|
38
|
-
ChartLegendSwatch["CIRCLE"] = "CIRCLE";
|
|
39
|
-
/** `Square SMALL`: area, bar, arc and heatmap series. */
|
|
40
|
-
ChartLegendSwatch["SQUARE"] = "SQUARE";
|
|
41
|
-
return ChartLegendSwatch;
|
|
42
|
-
}({});
|
|
43
35
|
/**
|
|
44
36
|
* A swatch takes its slot's mark color (`CHART_PALETTE_TO_COLOR_MAP`) through `currentColor`, so
|
|
45
37
|
* the legend always matches the marks (the hue slots that stand in for the old neutrals included).
|
|
@@ -61,7 +53,7 @@ var List = /*#__PURE__*/ styled("ul")({
|
|
|
61
53
|
class: "gx-ChartLegend-List-l1lgbp5d",
|
|
62
54
|
propsAsIs: false
|
|
63
55
|
});
|
|
64
|
-
/** Legend placement → list layout. BOTTOM aligns the first entry with
|
|
56
|
+
/** Legend placement → list layout. BOTTOM sits 12px under the plot and aligns the first entry with its left edge. */
|
|
65
57
|
var CHART_LEGEND_PLACEMENT_TO_LIST_CSS_MAP = {
|
|
66
58
|
[ChartLegendPlacement.BOTTOM]: "gx-ChartLegend-ChartLegendPlacement_BOTTOM-c681qv5",
|
|
67
59
|
[ChartLegendPlacement.RIGHT]: "gx-ChartLegend-ChartLegendPlacement_RIGHT-c1l24ron"
|
|
@@ -108,7 +100,7 @@ var OverflowList = /*#__PURE__*/ styled("ul")({
|
|
|
108
100
|
function Swatch({ item, swatch }) {
|
|
109
101
|
return /* @__PURE__ */ jsx(SwatchColor, {
|
|
110
102
|
style: { "--gx-chart-mark-color": item.hex ?? CHART_PALETTE_TO_COLOR_MAP[item.palette ?? ChartPalette.TERTIARY] },
|
|
111
|
-
children: swatch ===
|
|
103
|
+
children: swatch === ChartSwatch.CIRCLE ? /* @__PURE__ */ jsx(Circle, {
|
|
112
104
|
size: CircleSize.SMALL,
|
|
113
105
|
variant: CircleVariant.INHERIT
|
|
114
106
|
}) : /* @__PURE__ */ jsx(Square, {
|
|
@@ -281,4 +273,4 @@ function ChartLegend({ items, placement, swatch, inset, extent = 0, isFixedExten
|
|
|
281
273
|
})] });
|
|
282
274
|
}
|
|
283
275
|
//#endregion
|
|
284
|
-
export { ChartLegend
|
|
276
|
+
export { ChartLegend };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ChartTooltipModel, ChartTooltipRenderer } from "./types.js";
|
|
1
|
+
import { ChartSwatch, type ChartTooltipModel, type ChartTooltipRenderer } from "./types.js";
|
|
3
2
|
import { type ChartTooltipVerticalAlign } from "./useChartTooltipPosition.js";
|
|
4
3
|
/** @internal Props of `ChartTooltip`. */
|
|
5
4
|
export interface ChartTooltipProps {
|
|
@@ -18,7 +17,7 @@ export interface ChartTooltipProps {
|
|
|
18
17
|
/** Replaces the body. */
|
|
19
18
|
renderTooltip?: ChartTooltipRenderer | undefined;
|
|
20
19
|
/** Row swatch shape, matching the chart's legend. Defaults to `CIRCLE`. */
|
|
21
|
-
swatch?:
|
|
20
|
+
swatch?: ChartSwatch | undefined;
|
|
22
21
|
}
|
|
23
22
|
/** @internal The chart tooltip body and positioner. */
|
|
24
23
|
export declare function ChartTooltip({ model, containerWidth, containerHeight, anchorHalfWidth, placeAwayFromX, verticalAlign, renderTooltip, swatch, }: ChartTooltipProps): import("react").JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Text, { TextSize, TextVariant } from "../text/Text.js";
|
|
2
2
|
import Flex, { AlignItems, FlexDirection } from "../layout/Flex.js";
|
|
3
|
+
import { ChartSwatch } from "./types.js";
|
|
3
4
|
import "./constants.js";
|
|
4
5
|
import Circle, { CircleSize } from "../shapes/Circle.js";
|
|
5
6
|
import Square, { SquareSize } from "../shapes/Square.js";
|
|
6
|
-
import { ChartLegendSwatch } from "./ChartLegend.js";
|
|
7
7
|
import Grid, { GridAlignItems } from "../layout/Grid.js";
|
|
8
8
|
import { useChartTooltipPosition } from "./useChartTooltipPosition.js";
|
|
9
9
|
/* empty css */
|
|
@@ -32,7 +32,7 @@ function Row({ row, swatch }) {
|
|
|
32
32
|
alignItems: AlignItems.CENTER,
|
|
33
33
|
gap: 8,
|
|
34
34
|
minWidth: 0,
|
|
35
|
-
children: [swatch ===
|
|
35
|
+
children: [swatch === ChartSwatch.SQUARE ? /* @__PURE__ */ jsx(Square, {
|
|
36
36
|
size: SquareSize.SMALL,
|
|
37
37
|
hex: row.color
|
|
38
38
|
}) : /* @__PURE__ */ jsx(Circle, {
|
|
@@ -52,7 +52,7 @@ function Row({ row, swatch }) {
|
|
|
52
52
|
})] });
|
|
53
53
|
}
|
|
54
54
|
/** @internal The chart tooltip body and positioner. */
|
|
55
|
-
function ChartTooltip({ model, containerWidth, containerHeight, anchorHalfWidth, placeAwayFromX, verticalAlign, renderTooltip, swatch =
|
|
55
|
+
function ChartTooltip({ model, containerWidth, containerHeight, anchorHalfWidth, placeAwayFromX, verticalAlign, renderTooltip, swatch = ChartSwatch.CIRCLE }) {
|
|
56
56
|
const [retained, setRetained] = useState(model);
|
|
57
57
|
if (model !== null && model !== retained) setRetained(model);
|
|
58
58
|
const displayed = model ?? retained;
|
package/dist/charts/Heatmap.js
CHANGED
|
@@ -2,13 +2,12 @@ import { Orientation } from "../theme/enums.js";
|
|
|
2
2
|
import Text, { TextSize, TextVariant } from "../text/Text.js";
|
|
3
3
|
import { t } from "../theme/tokens/t.js";
|
|
4
4
|
import Flex, { AlignItems } from "../layout/Flex.js";
|
|
5
|
-
import { ChartKind, ChartLegendPlacement, ChartMarkState, ChartPalette, ChartTargetShape } from "./types.js";
|
|
5
|
+
import { ChartKind, ChartLegendPlacement, ChartMarkState, ChartPalette, ChartSwatch, ChartTargetShape } from "./types.js";
|
|
6
6
|
import { CHART_MARK_STATE_TO_CSS_MAP, HEATMAP_CELL_CSS, HEATMAP_EMPTY_CELL_CSS } from "./ChartPrimitives.js";
|
|
7
7
|
import { PLOT_INSET_BOTTOM, PLOT_INSET_RIGHT, PLOT_INSET_TOP } from "./constants.js";
|
|
8
8
|
import { clamp } from "./chartScales.js";
|
|
9
9
|
import { ChartCategoryAxis } from "./ChartAxis.js";
|
|
10
10
|
import Square, { SquareSize, SquareVariant } from "../shapes/Square.js";
|
|
11
|
-
import { ChartLegendSwatch } from "./ChartLegend.js";
|
|
12
11
|
import { ChartFrame } from "./ChartFrame.js";
|
|
13
12
|
import { formatChartValue } from "./chartFormat.js";
|
|
14
13
|
import { useChartDimensions } from "./useChartDimensions.js";
|
|
@@ -99,7 +98,7 @@ function HeatmapLegend({ ramp, min, max, hasEmpty, inset }) {
|
|
|
99
98
|
}
|
|
100
99
|
/** A grid of cells colored by value along one hue's token ramp. */
|
|
101
100
|
var Heatmap = forwardRef(function Heatmap(props, ref) {
|
|
102
|
-
const { cells, columns: explicitColumns, rows: explicitRows, color = ChartPalette.PURPLE, labelFormatter, valueDomain, valueFormatter, hasLegend = true, hasTooltip = true, renderTooltip, isLoading = false, placeholder = DEFAULT_PLACEHOLDER, onSelect, selection, isFilterable = false, defaultSelection, onSelectionChange, ariaLabel, id, className, style, ...rest } = props;
|
|
101
|
+
const { cells, columns: explicitColumns, rows: explicitRows, color = ChartPalette.PURPLE, labelFormatter, valueDomain, valueFormatter, hasLegend = true, swatch = ChartSwatch.SQUARE, hasTooltip = true, renderTooltip, isLoading = false, placeholder = DEFAULT_PLACEHOLDER, onSelect, selection, isFilterable = false, defaultSelection, onSelectionChange, ariaLabel, id, className, style, ...rest } = props;
|
|
103
102
|
const plotRef = useRef(null);
|
|
104
103
|
const { formatValue, formatLabel } = useChartFormatters(valueFormatter, labelFormatter);
|
|
105
104
|
const { columns, rows } = useMemo(() => getHeatmapLabels(cells, explicitColumns, explicitRows), [
|
|
@@ -276,7 +275,7 @@ var Heatmap = forwardRef(function Heatmap(props, ref) {
|
|
|
276
275
|
hasLegend,
|
|
277
276
|
legendItems: [],
|
|
278
277
|
legendPlacement: ChartLegendPlacement.BOTTOM,
|
|
279
|
-
|
|
278
|
+
swatch,
|
|
280
279
|
legend: isEmpty ? null : /* @__PURE__ */ jsx(HeatmapLegend, {
|
|
281
280
|
ramp,
|
|
282
281
|
min: formatValue(domain[0]),
|
|
@@ -47,7 +47,7 @@ export interface LineChartRootProps<TMetric extends string> extends LineChartOwn
|
|
|
47
47
|
fill: LineChartFill;
|
|
48
48
|
/** Stack the series in array order (AreaChart): top edges are running totals. */
|
|
49
49
|
isStacked: boolean;
|
|
50
|
-
/** Which chart (default name and
|
|
50
|
+
/** Which chart (default name and swatch). */
|
|
51
51
|
kind: ChartKind;
|
|
52
52
|
}
|
|
53
53
|
/** @internal The generic signature of `LineChartRoot` (docgen reads an arrow function). */
|
package/dist/charts/LineChart.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Orientation } from "../theme/enums.js";
|
|
2
|
-
import { ChartCurve, ChartKind, ChartLegendPlacement, ChartTargetShape } from "./types.js";
|
|
2
|
+
import { ChartCurve, ChartKind, ChartLegendPlacement, ChartSwatch, ChartTargetShape } from "./types.js";
|
|
3
3
|
import { CHART_CURSOR_LINE_CSS, CHART_CURSOR_LINE_SELECTED_CSS, CHART_MARK_STATE_TO_CSS_MAP, CHART_POINT_CSS } from "./ChartPrimitives.js";
|
|
4
4
|
import { LINE_POINT_RADIUS } from "./constants.js";
|
|
5
5
|
import { ChartCategoryAxis, ChartValueAxis } from "./ChartAxis.js";
|
|
6
|
-
import { ChartLegendSwatch } from "./ChartLegend.js";
|
|
7
6
|
import { ChartFrame } from "./ChartFrame.js";
|
|
8
7
|
import { formatChartValue } from "./chartFormat.js";
|
|
9
8
|
import { buildLineChartGeometry, getLineValueDomain, getStackedLineValueDomain, hasNoReadings } from "./lineChartGeometry.js";
|
|
@@ -41,7 +40,7 @@ var DEFAULT_PLACEHOLDER = "No data available";
|
|
|
41
40
|
* components, no public mode prop (the `MenuRoot` precedent).
|
|
42
41
|
*/
|
|
43
42
|
function LineChartRootInner(props, ref) {
|
|
44
|
-
const { series, lines, categories, curve = ChartCurve.SMOOTH, fill, isStacked, kind, valueFormatter, labelFormatter, valueDomain, axisLabels, hasLegend = true, hasTooltip = true, renderTooltip, isLoading = false, placeholder = DEFAULT_PLACEHOLDER, onSelect, selection, isFilterable = false, defaultSelection, onSelectionChange, ariaLabel, id, className, style, ...rest } = props;
|
|
43
|
+
const { series, lines, categories, curve = ChartCurve.SMOOTH, fill, isStacked, kind, valueFormatter, labelFormatter, valueDomain, axisLabels, hasLegend = true, swatch = kind === ChartKind.AREA ? ChartSwatch.SQUARE : ChartSwatch.CIRCLE, hasTooltip = true, renderTooltip, isLoading = false, placeholder = DEFAULT_PLACEHOLDER, onSelect, selection, isFilterable = false, defaultSelection, onSelectionChange, ariaLabel, id, className, style, ...rest } = props;
|
|
45
44
|
const plotRef = useRef(null);
|
|
46
45
|
const colors = useSeriesColorResolver(series);
|
|
47
46
|
const { dimensions, domain, valueTicks, formatValue, formatLabel } = useCartesianChartLayout({
|
|
@@ -219,7 +218,7 @@ function LineChartRootInner(props, ref) {
|
|
|
219
218
|
formatCategoryKey: formatLabel,
|
|
220
219
|
legendItems,
|
|
221
220
|
legendPlacement: ChartLegendPlacement.BOTTOM,
|
|
222
|
-
|
|
221
|
+
swatch,
|
|
223
222
|
children: [
|
|
224
223
|
!isEmpty && geometry.paths.map((path) => path.areaPath ? /* @__PURE__ */ jsx("path", {
|
|
225
224
|
d: path.areaPath,
|
package/dist/charts/PieChart.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import Text, { TextSize, TextWeight } from "../text/Text.js";
|
|
2
|
-
import { ChartKind, ChartLegendPlacement, ChartTargetShape } from "./types.js";
|
|
2
|
+
import { ChartKind, ChartLegendPlacement, ChartSwatch, ChartTargetShape } from "./types.js";
|
|
3
3
|
import { CHART_ARC_CSS, CHART_MARK_STATE_TO_CSS_MAP } from "./ChartPrimitives.js";
|
|
4
4
|
import { RADIAL_PLOT_INSET } from "./constants.js";
|
|
5
|
-
import { ChartLegendSwatch } from "./ChartLegend.js";
|
|
6
5
|
import { ChartTooltipVerticalAlign } from "./useChartTooltipPosition.js";
|
|
7
6
|
import { ChartFrame } from "./ChartFrame.js";
|
|
8
7
|
import { formatNumber, formatPercent } from "../utils/format.js";
|
|
@@ -47,7 +46,7 @@ var CenterBox = /*#__PURE__*/ styled("div")({
|
|
|
47
46
|
propsAsIs: false
|
|
48
47
|
});
|
|
49
48
|
function PieChartInner(props, ref) {
|
|
50
|
-
const { series, slices, isSolid = false, minSliceShare = PIE_MIN_SLICE_SHARE, aggregatedLabel = DEFAULT_AGGREGATED_LABEL, children, valueFormatter, hasLegend = true, hasTooltip = true, renderTooltip, isLoading = false, placeholder = DEFAULT_PLACEHOLDER, onSelect, selection, isFilterable = false, defaultSelection, onSelectionChange, ariaLabel, id, className, style, ...rest } = props;
|
|
49
|
+
const { series, slices, isSolid = false, minSliceShare = PIE_MIN_SLICE_SHARE, aggregatedLabel = DEFAULT_AGGREGATED_LABEL, children, valueFormatter, hasLegend = true, swatch = ChartSwatch.SQUARE, hasTooltip = true, renderTooltip, isLoading = false, placeholder = DEFAULT_PLACEHOLDER, onSelect, selection, isFilterable = false, defaultSelection, onSelectionChange, ariaLabel, id, className, style, ...rest } = props;
|
|
51
50
|
const plotRef = useRef(null);
|
|
52
51
|
const colors = useSeriesColorResolver(series);
|
|
53
52
|
const dimensions = useChartDimensions(plotRef, PLOT_INSETS);
|
|
@@ -190,7 +189,7 @@ function PieChartInner(props, ref) {
|
|
|
190
189
|
hasLegend,
|
|
191
190
|
legendItems,
|
|
192
191
|
legendPlacement: ChartLegendPlacement.RIGHT,
|
|
193
|
-
|
|
192
|
+
swatch,
|
|
194
193
|
children: /* @__PURE__ */ jsx("g", {
|
|
195
194
|
transform: centerTransform,
|
|
196
195
|
children: geometry.arcs.map((item, index) => /* @__PURE__ */ jsx("path", {
|