@galaxy-io/dls 2.12.0 → 2.12.2
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/charts/ChartLegend.js +42 -23
- package/dist/charts/constants.d.ts +3 -1
- package/dist/charts/constants.js +4 -2
- package/dist/modal/Modal.js +4 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -4,6 +4,8 @@ import Text, { TextSize, TextVariant } from "../text/Text.js";
|
|
|
4
4
|
import { t } from "../theme/tokens/t.js";
|
|
5
5
|
import Flex, { AlignItems } from "../layout/Flex.js";
|
|
6
6
|
import Tooltip from "../tooltip/Tooltip.js";
|
|
7
|
+
import Box from "../layout/Box.js";
|
|
8
|
+
import Popover, { PopoverTrigger } from "../overlays/Popover.js";
|
|
7
9
|
import { ChartLegendPlacement, ChartMarkState, ChartPalette, ChartSwatch } from "./types.js";
|
|
8
10
|
import { CHART_MARK_STATE_TO_CSS_MAP } from "./ChartPrimitives.js";
|
|
9
11
|
import "./constants.js";
|
|
@@ -26,8 +28,10 @@ import { cx } from "@linaria/core";
|
|
|
26
28
|
* Entries are list items. Hovering one previews its series (a pointer enhancement; keyboard users
|
|
27
29
|
* hear every series in the announcement). On a filterable chart each entry is also a toggle button
|
|
28
30
|
* (`aria-pressed`): a click pins its series, ⌘ / Ctrl / Shift-click adds or removes it. Entries
|
|
29
|
-
* collapsed behind "+N more"
|
|
30
|
-
*
|
|
31
|
+
* collapsed behind "+N more" always draw at full strength: the list is for reading, and the
|
|
32
|
+
* trigger already carries the isolation. On a filterable chart a click (or Enter) on "+N more"
|
|
33
|
+
* opens a `Popover` whose entries are the same toggles, focus on the first (a tooltip holds no
|
|
34
|
+
* controls, and touch cannot hover); otherwise a `Tooltip` lists them on hover. A
|
|
31
35
|
* filterable chart's legend ends in a slot for its filter chip, right after the last entry (under
|
|
32
36
|
* the column when RIGHT): the slot always keeps its height, and a bottom legend always keeps room
|
|
33
37
|
* for the chip's width, so pinning never moves an entry. Spacing is padding on each entry and on
|
|
@@ -77,7 +81,10 @@ var MEASURE_PLACEMENT_TO_CSS_MAP = {
|
|
|
77
81
|
[ChartLegendPlacement.BOTTOM]: "gx-ChartLegend-ChartLegendPlacement_BOTTOM-cixvbm6",
|
|
78
82
|
[ChartLegendPlacement.RIGHT]: "gx-ChartLegend-ChartLegendPlacement_RIGHT-c1ehakcs"
|
|
79
83
|
};
|
|
80
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* The filter chips' slot: one or two chips, never taller than the row it sets. The fit keeps its
|
|
86
|
+
* minimum free; it shrinks into whatever the entries leave, up to its cap, and the chips truncate.
|
|
87
|
+
*/
|
|
81
88
|
var FilterSlot = /*#__PURE__*/ styled("li")({
|
|
82
89
|
name: "FilterSlot",
|
|
83
90
|
class: "gx-ChartLegend-FilterSlot-fsomlsk",
|
|
@@ -157,7 +164,7 @@ function ChartLegend({ items, placement, swatch, inset, extent = 0, isFixedExten
|
|
|
157
164
|
const rendered = Array.from(measure.children);
|
|
158
165
|
const trigger = rendered.pop();
|
|
159
166
|
if (!trigger) return;
|
|
160
|
-
const available = isVertical ? extent || Number.POSITIVE_INFINITY : list.clientWidth - inset - (hasFilterSlot ?
|
|
167
|
+
const available = isVertical ? extent || Number.POSITIVE_INFINITY : list.clientWidth - inset - (hasFilterSlot ? 120 : 0);
|
|
161
168
|
const sizeOf = (element) => {
|
|
162
169
|
const rect = element.getBoundingClientRect();
|
|
163
170
|
return Math.ceil(isVertical ? rect.height : rect.width);
|
|
@@ -196,6 +203,26 @@ function ChartLegend({ items, placement, swatch, inset, extent = 0, isFixedExten
|
|
|
196
203
|
const inline = items.slice(0, fitCount ?? items.length);
|
|
197
204
|
const overflow = items.slice(inline.length);
|
|
198
205
|
const triggerState = overflow.some((item) => getEntryState(item.key) === ChartMarkState.ACTIVE) ? ChartMarkState.ACTIVE : ChartMarkState.MUTED;
|
|
206
|
+
/** The collapsed entries: toggles on a filterable chart (in a Popover), read-only otherwise. */
|
|
207
|
+
const overflowList = /* @__PURE__ */ jsx(OverflowList, { children: overflow.map((item) => /* @__PURE__ */ jsx(Entry, {
|
|
208
|
+
item,
|
|
209
|
+
swatch,
|
|
210
|
+
isVertical: true,
|
|
211
|
+
state: ChartMarkState.ACTIVE,
|
|
212
|
+
isPinned: isEntryPinned?.(item.key) ?? false,
|
|
213
|
+
onEnter: () => onItemEnter(item.key),
|
|
214
|
+
onLeave: onItemLeave,
|
|
215
|
+
onClick: onItemClick && ((isAdditive) => onItemClick(item.key, isAdditive))
|
|
216
|
+
}, item.key)) });
|
|
217
|
+
const overflowTrigger = /* @__PURE__ */ jsx("button", {
|
|
218
|
+
type: "button",
|
|
219
|
+
className: TRIGGER_CSS,
|
|
220
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
221
|
+
size: TextSize.BODY_SM,
|
|
222
|
+
variant: TextVariant.SECONDARY,
|
|
223
|
+
children: `+${overflow.length} more`
|
|
224
|
+
})
|
|
225
|
+
});
|
|
199
226
|
const variables = {
|
|
200
227
|
"--gx-chart-legend-inset": `${inset}px`,
|
|
201
228
|
...isVertical && extent > 0 && isFixedExtent && { "--gx-chart-legend-extent": `${extent}px` }
|
|
@@ -251,26 +278,18 @@ function ChartLegend({ items, placement, swatch, inset, extent = 0, isFixedExten
|
|
|
251
278
|
0
|
|
252
279
|
],
|
|
253
280
|
className: cx(ENTRY_CSS, CHART_MARK_STATE_TO_CSS_MAP[triggerState]),
|
|
254
|
-
children: /* @__PURE__ */ jsx(
|
|
281
|
+
children: onItemClick ? /* @__PURE__ */ jsx(Popover, {
|
|
282
|
+
trigger: PopoverTrigger.CLICK,
|
|
283
|
+
placement: isVertical ? Placement.RIGHT_START : Placement.TOP_START,
|
|
284
|
+
body: /* @__PURE__ */ jsx(Box, {
|
|
285
|
+
padding: [8, 12],
|
|
286
|
+
children: overflowList
|
|
287
|
+
}),
|
|
288
|
+
children: overflowTrigger
|
|
289
|
+
}) : /* @__PURE__ */ jsx(Tooltip, {
|
|
255
290
|
placement: isVertical ? Placement.RIGHT : Placement.TOP,
|
|
256
|
-
body:
|
|
257
|
-
|
|
258
|
-
swatch,
|
|
259
|
-
isVertical: true,
|
|
260
|
-
state: ChartMarkState.ACTIVE,
|
|
261
|
-
isPinned: isEntryPinned?.(item.key) ?? false,
|
|
262
|
-
onEnter: () => onItemEnter(item.key),
|
|
263
|
-
onLeave: onItemLeave
|
|
264
|
-
}, item.key)) }),
|
|
265
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
266
|
-
type: "button",
|
|
267
|
-
className: TRIGGER_CSS,
|
|
268
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
269
|
-
size: TextSize.BODY_SM,
|
|
270
|
-
variant: TextVariant.SECONDARY,
|
|
271
|
-
children: `+${overflow.length} more`
|
|
272
|
-
})
|
|
273
|
-
})
|
|
291
|
+
body: overflowList,
|
|
292
|
+
children: overflowTrigger
|
|
274
293
|
})
|
|
275
294
|
}),
|
|
276
295
|
hasFilterSlot && /* @__PURE__ */ jsx(FilterSlot, {
|
|
@@ -99,8 +99,10 @@ export declare const CHART_TOOLTIP_MAX_ROWS = 8;
|
|
|
99
99
|
export declare const CHART_LEGEND_SIDE_GAP: number;
|
|
100
100
|
/** @internal Height a side legend gives up to its filter chips: the 8px top padding and a 20px `Chip SMALL`. */
|
|
101
101
|
export declare const CHART_LEGEND_FILTER_EXTENT: number;
|
|
102
|
-
/** @internal Widest the filter chips grow (one or two) before their labels truncate
|
|
102
|
+
/** @internal Widest the filter chips grow (one or two) before their labels truncate. */
|
|
103
103
|
export declare const CHART_LEGEND_FILTER_MAX_WIDTH = 240;
|
|
104
|
+
/** @internal Room a bottom legend always keeps for its filter chips, so pinning never moves an entry; the chips take more, up to the max, when the entries leave it. */
|
|
105
|
+
export declare const CHART_LEGEND_FILTER_MIN_WIDTH = 120;
|
|
104
106
|
/** @internal Height cap of the "+N more" legend list (about eight entries) before it scrolls. */
|
|
105
107
|
export declare const CHART_LEGEND_OVERFLOW_MAX_HEIGHT = 208;
|
|
106
108
|
/** @internal 2:1, the aspect-ratio fallback of cartesian charts and PieChart. */
|
package/dist/charts/constants.js
CHANGED
|
@@ -109,11 +109,13 @@ var CHART_TOOLTIP_MAX_ROWS = 8;
|
|
|
109
109
|
var CHART_LEGEND_SIDE_GAP = px(SPACE[16]);
|
|
110
110
|
/** @internal Height a side legend gives up to its filter chips: the 8px top padding and a 20px `Chip SMALL`. */
|
|
111
111
|
var CHART_LEGEND_FILTER_EXTENT = px(SPACE[8]) + px(CONTROL_SIZE.xSmall);
|
|
112
|
-
/** @internal Widest the filter chips grow (one or two) before their labels truncate
|
|
112
|
+
/** @internal Widest the filter chips grow (one or two) before their labels truncate. */
|
|
113
113
|
var CHART_LEGEND_FILTER_MAX_WIDTH = 240;
|
|
114
|
+
/** @internal Room a bottom legend always keeps for its filter chips, so pinning never moves an entry; the chips take more, up to the max, when the entries leave it. */
|
|
115
|
+
var CHART_LEGEND_FILTER_MIN_WIDTH = 120;
|
|
114
116
|
/** @internal Height cap of the "+N more" legend list (about eight entries) before it scrolls. */
|
|
115
117
|
var CHART_LEGEND_OVERFLOW_MAX_HEIGHT = 208;
|
|
116
118
|
/** @internal 2:1, the aspect-ratio fallback of cartesian charts and PieChart. */
|
|
117
119
|
var CHART_DEFAULT_ASPECT_RATIO = 2;
|
|
118
120
|
//#endregion
|
|
119
|
-
export { AREA_FILL_OPACITY, AREA_STACKED_FILL_OPACITY, AUTO_INSET_LEFT_STEP, AXIS_LABEL_GAP, AXIS_TITLE_BAND, AXIS_TITLE_GAP, BAR_GAP_RATIO, BAR_RADIUS, BAR_RADIUS_NARROW, CAPTION_CHAR_WIDTH_PX, CAPTION_LINE, CATEGORY_AXIS_LABEL_GAP, CATEGORY_AXIS_LABEL_HEIGHT, CATEGORY_GAP_RATIO, CHART_DEFAULT_ASPECT_RATIO, CHART_LEGEND_FILTER_EXTENT, CHART_LEGEND_FILTER_MAX_WIDTH, CHART_LEGEND_OVERFLOW_MAX_HEIGHT, CHART_LEGEND_SIDE_GAP, CHART_MARK_OPACITY_ACTIVE, CHART_MARK_OPACITY_DIMMED, CHART_MARK_OPACITY_MUTED, CHART_TOOLTIP_MAX_ROWS, CHART_TOOLTIP_OFFSET, DEFAULT_VALUE_TICK_COUNT, GRID_LINE_BLEED, HEATMAP_CELL_GAP_RATIO, LINE_DASH, LINE_POINT_RADIUS, LINE_STROKE_WIDTH, MAX_AUTO_INSET_LEFT, MAX_BAR_GAP, MAX_CATEGORY_GAP, MAX_HEATMAP_CELL_GAP, MIN_AUTO_INSET_LEFT, MIN_BAR_GAP, MIN_BAR_LENGTH, MIN_CATEGORY_GAP, MIN_CATEGORY_LABEL_GAP, MIN_HEATMAP_CELL_GAP, MIN_VALUE_TICK_SPACING, NARROW_BAR_WIDTH, PIE_SLICE_GAP, PLOT_INSET_BOTTOM, PLOT_INSET_RIGHT, PLOT_INSET_TOP, RADIAL_PLOT_INSET, STACK_SEGMENT_GAP, VALUE_AXIS_LABEL_HEIGHT, VALUE_AXIS_TICK_GAP };
|
|
121
|
+
export { AREA_FILL_OPACITY, AREA_STACKED_FILL_OPACITY, AUTO_INSET_LEFT_STEP, AXIS_LABEL_GAP, AXIS_TITLE_BAND, AXIS_TITLE_GAP, BAR_GAP_RATIO, BAR_RADIUS, BAR_RADIUS_NARROW, CAPTION_CHAR_WIDTH_PX, CAPTION_LINE, CATEGORY_AXIS_LABEL_GAP, CATEGORY_AXIS_LABEL_HEIGHT, CATEGORY_GAP_RATIO, CHART_DEFAULT_ASPECT_RATIO, CHART_LEGEND_FILTER_EXTENT, CHART_LEGEND_FILTER_MAX_WIDTH, CHART_LEGEND_FILTER_MIN_WIDTH, CHART_LEGEND_OVERFLOW_MAX_HEIGHT, CHART_LEGEND_SIDE_GAP, CHART_MARK_OPACITY_ACTIVE, CHART_MARK_OPACITY_DIMMED, CHART_MARK_OPACITY_MUTED, CHART_TOOLTIP_MAX_ROWS, CHART_TOOLTIP_OFFSET, DEFAULT_VALUE_TICK_COUNT, GRID_LINE_BLEED, HEATMAP_CELL_GAP_RATIO, LINE_DASH, LINE_POINT_RADIUS, LINE_STROKE_WIDTH, MAX_AUTO_INSET_LEFT, MAX_BAR_GAP, MAX_CATEGORY_GAP, MAX_HEATMAP_CELL_GAP, MIN_AUTO_INSET_LEFT, MIN_BAR_GAP, MIN_BAR_LENGTH, MIN_CATEGORY_GAP, MIN_CATEGORY_LABEL_GAP, MIN_HEATMAP_CELL_GAP, MIN_VALUE_TICK_SPACING, NARROW_BAR_WIDTH, PIE_SLICE_GAP, PLOT_INSET_BOTTOM, PLOT_INSET_RIGHT, PLOT_INSET_TOP, RADIAL_PLOT_INSET, STACK_SEGMENT_GAP, VALUE_AXIS_LABEL_HEIGHT, VALUE_AXIS_TICK_GAP };
|
package/dist/modal/Modal.js
CHANGED
|
@@ -107,7 +107,10 @@ var MODAL_SIZE_TO_CSS_MAP = {
|
|
|
107
107
|
["LARGE"]: "gx-Modal-LARGE-lbri8ij",
|
|
108
108
|
["X_LARGE"]: "gx-Modal-X_LARGE-xxdonbm"
|
|
109
109
|
};
|
|
110
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* `isFullscreen`: the panel takes the whole width, and the panel's own `flex-shrink: 1` gives the
|
|
112
|
+
* aside its share. A width, not a flex override: `Panel`'s `flex` comes later in the stylesheet.
|
|
113
|
+
*/
|
|
111
114
|
var FULLSCREEN_PANEL_CSS = "gx-Modal-FULLSCREEN_PANEL_CSS-f1c1q51w";
|
|
112
115
|
var FOCUS_SCOPE_CSS = "gx-Modal-FOCUS_SCOPE_CSS-f1aye683";
|
|
113
116
|
/** The dialog (`role="dialog"`): the panel, then the aside, in a row (a column on a phone). Draws nothing itself. */
|