origam 2.37.38 → 2.37.40

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/src/components/Chart/OrigamChartAxis.vue +15 -1
  3. package/dist/src/components/Chart/OrigamChartBoxPlot.vue +5 -1
  4. package/dist/src/components/Chart/OrigamChartBullet.vue +5 -1
  5. package/dist/src/components/Chart/OrigamChartCandlestick.vue +5 -1
  6. package/dist/src/components/Chart/OrigamChartCartesian.vue +9 -2
  7. package/dist/src/components/Chart/OrigamChartHeatmap.vue +6 -1
  8. package/dist/src/components/Chart/OrigamChartHoneycomb.vue +5 -1
  9. package/dist/src/components/Chart/OrigamChartMap.vue +7 -2
  10. package/dist/src/components/Chart/OrigamChartPareto.vue +5 -1
  11. package/dist/src/components/Chart/OrigamChartPictorial.vue +7 -2
  12. package/dist/src/components/Chart/OrigamChartPolar.vue +5 -1
  13. package/dist/src/components/Chart/OrigamChartPolarBar.vue +5 -1
  14. package/dist/src/components/Chart/OrigamChartPyramid.vue +5 -1
  15. package/dist/src/components/Chart/OrigamChartRadar.vue +6 -1
  16. package/dist/src/components/Chart/OrigamChartSankey.vue +7 -2
  17. package/dist/src/components/Chart/OrigamChartSparkline.vue +11 -4
  18. package/dist/src/components/Chart/OrigamChartStreamgraph.vue +5 -1
  19. package/dist/src/components/Chart/OrigamChartSunburst.vue +5 -1
  20. package/dist/src/components/Chart/OrigamChartTreemap.vue +5 -1
  21. package/dist/src/components/Chart/OrigamChartVariwide.vue +5 -1
  22. package/dist/src/components/Chart/OrigamChartWordCloud.vue +5 -1
  23. package/dist/src/composables/Chart/chart-roving.composable.cjs +69 -0
  24. package/dist/src/composables/Chart/chart-roving.composable.d.ts +33 -0
  25. package/dist/src/composables/Chart/chart-roving.composable.js +64 -0
  26. package/dist/src/composables/index.cjs +12 -0
  27. package/dist/src/composables/index.d.ts +1 -0
  28. package/dist/src/composables/index.js +1 -0
  29. package/dist/src/consts/Chart/chart.const.cjs +14 -1
  30. package/dist/src/consts/Chart/chart.const.d.ts +53 -1
  31. package/dist/src/consts/Chart/chart.const.js +13 -0
  32. package/dist/src/interfaces/Chart/chart-axis.interface.d.ts +11 -0
  33. package/dist/src/interfaces/Chart/chart-roving.interface.cjs +1 -0
  34. package/dist/src/interfaces/Chart/chart-roving.interface.d.ts +12 -0
  35. package/dist/src/interfaces/Chart/chart-roving.interface.js +0 -0
  36. package/dist/src/interfaces/index.cjs +11 -0
  37. package/dist/src/interfaces/index.d.ts +1 -0
  38. package/dist/src/interfaces/index.js +1 -0
  39. package/dist/src/types/Chart/chart.type.d.ts +8 -0
  40. package/dist/src/utils/Chart/chart-axis-label.util.cjs +35 -0
  41. package/dist/src/utils/Chart/chart-axis-label.util.d.ts +24 -0
  42. package/dist/src/utils/Chart/chart-axis-label.util.js +24 -0
  43. package/package.json +1 -1
@@ -14,6 +14,7 @@
14
14
  :role="CHART_SVG_ROLE"
15
15
  :aria-label="svgAriaLabel"
16
16
  data-cy="origam-chart-sparkline-svg"
17
+ @keydown="onChartKeydown"
17
18
  @mousemove="onSvgMouseMove"
18
19
  @mouseleave="onSvgMouseLeave"
19
20
  @click="onSvgClick"
@@ -35,7 +36,8 @@
35
36
  :width="bar.width"
36
37
  :height="bar.height"
37
38
  :style="{ fill: resolvedColor }"
38
- tabindex="0"
39
+ tabindex="-1"
40
+ data-chart-point
39
41
  role="button"
40
42
  :aria-label="pointAriaLabel(bar.index)"
41
43
  :data-cy="`origam-chart-sparkline-bar-${ bar.index }`"
@@ -59,7 +61,8 @@
59
61
  :width="bar.width"
60
62
  :height="bar.height"
61
63
  :style="{ fill: resolvedColor }"
62
- tabindex="0"
64
+ tabindex="-1"
65
+ data-chart-point
63
66
  role="button"
64
67
  :aria-label="pointAriaLabel(bar.index)"
65
68
  :data-cy="`origam-chart-sparkline-hbar-${ bar.index }`"
@@ -98,7 +101,8 @@
98
101
  :cy="pt.cy"
99
102
  :r="markerSize"
100
103
  :style="{ fill: resolvedColor }"
101
- tabindex="0"
104
+ tabindex="-1"
105
+ data-chart-point
102
106
  role="button"
103
107
  :aria-label="pointAriaLabel(pt.index)"
104
108
  :data-cy="`origam-chart-sparkline-marker-${ pt.index }`"
@@ -117,7 +121,8 @@
117
121
  :cy="m.cy"
118
122
  :r="m.r"
119
123
  :style="{ fill: m.fill }"
120
- tabindex="0"
124
+ tabindex="-1"
125
+ data-chart-point
121
126
  role="button"
122
127
  :aria-label="pointAriaLabel(m.dataIndex)"
123
128
  :data-cy="`origam-chart-sparkline-special-${ m.role }`"
@@ -162,6 +167,7 @@ import {
162
167
  computed,
163
168
  ref
164
169
  } from "vue";
170
+ import { useChartRoving } from "../../composables/Chart/chart-roving.composable";
165
171
  import { useChartSize } from "../../composables/Chart/chart-size.composable";
166
172
  import { useLocale } from "../../composables/Commons/locale.composable";
167
173
  import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.composable";
@@ -246,6 +252,7 @@ const { marginClasses, marginStyles } = useMargin(props);
246
252
  const { paddingClasses, paddingStyles } = usePadding(props);
247
253
  const { roundedClasses, roundedStyles } = useRounded(props);
248
254
  const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.sparkline);
255
+ const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
249
256
  const PADDING_X = 2;
250
257
  const PADDING_Y = 2;
251
258
  const activeSeries = computed(() => props.series?.[0] ?? null);
@@ -42,6 +42,7 @@
42
42
  :aria-label="svgAriaLabel"
43
43
  preserveAspectRatio="xMidYMid meet"
44
44
  data-cy="origam-chart-streamgraph-svg"
45
+ @keydown="onChartKeydown"
45
46
  @mousemove="onSvgMouseMove"
46
47
  @mouseleave="onSvgMouseLeave"
47
48
  >
@@ -103,7 +104,8 @@
103
104
  :d="ribbon.d"
104
105
  :style="{ fill: ribbon.color }"
105
106
  :data-cy="`origam-chart-streamgraph-ribbon-${ ribbon.seriesIndex }`"
106
- tabindex="0"
107
+ tabindex="-1"
108
+ data-chart-point
107
109
  role="button"
108
110
  :aria-label="ribbonAriaLabel(ribbon)"
109
111
  @click="onRibbonActivate(ribbon, $event)"
@@ -187,6 +189,7 @@ import OrigamChartTooltip from "./OrigamChartTooltip.vue";
187
189
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
188
190
  import { useChartSize } from "../../composables/Chart/chart-size.composable";
189
191
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
192
+ import { useChartRoving } from "../../composables/Chart/chart-roving.composable";
190
193
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
191
194
  import { useDimension } from "../../composables/Commons/dimension.composable";
192
195
  import { useElevation } from "../../composables/Commons/elevation.composable";
@@ -273,6 +276,7 @@ const { roundedClasses, roundedStyles } = useRounded(props);
273
276
  const { headerTypographyStyles } = useChartHeaderTypography(props);
274
277
  const chartAnimationStyle = useChartAnimationStyle(props);
275
278
  const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.streamgraph);
279
+ const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
276
280
  const PADDING = { top: 24, right: 24, bottom: 40, left: 40 };
277
281
  const AXIS_LABEL_OFFSET = 6;
278
282
  const plot = computed(() => ({
@@ -42,6 +42,7 @@
42
42
  :aria-label="svgAriaLabel"
43
43
  preserveAspectRatio="xMidYMid meet"
44
44
  data-cy="origam-chart-sunburst-svg"
45
+ @keydown="onChartKeydown"
45
46
  @mousemove="onSvgMouseMove"
46
47
  @mouseleave="onSvgMouseLeave"
47
48
  >
@@ -61,7 +62,8 @@
61
62
  :d="node.d"
62
63
  :style="{ fill: node.color }"
63
64
  :data-cy="`origam-chart-sunburst-arc-${ node.id }`"
64
- tabindex="0"
65
+ tabindex="-1"
66
+ data-chart-point
65
67
  role="button"
66
68
  :aria-label="nodeAriaLabel(node)"
67
69
  @click="onNodeActivate(node, $event)"
@@ -172,6 +174,7 @@ import OrigamChartTooltip from "./OrigamChartTooltip.vue";
172
174
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
173
175
  import { useChartSize } from "../../composables/Chart/chart-size.composable";
174
176
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
177
+ import { useChartRoving } from "../../composables/Chart/chart-roving.composable";
175
178
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
176
179
  import { useDimension } from "../../composables/Commons/dimension.composable";
177
180
  import { useElevation } from "../../composables/Commons/elevation.composable";
@@ -255,6 +258,7 @@ const { roundedClasses, roundedStyles } = useRounded(props);
255
258
  const { headerTypographyStyles } = useChartHeaderTypography(props);
256
259
  const chartAnimationStyle = useChartAnimationStyle(props);
257
260
  const { resizeRef: svgRef, width: svgWidth } = useChartSize(CHART_SIZE_FALLBACK.sunburst, { aspectRatio: CHART_ASPECT_RATIO.radial });
261
+ const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
258
262
  const center = computed(() => svgWidth.value / 2);
259
263
  const MAX_DEPTH_CAP = 4;
260
264
  const LABEL_ANGLE_INLINE = 0.1;
@@ -42,6 +42,7 @@
42
42
  :aria-label="svgAriaLabel"
43
43
  preserveAspectRatio="xMidYMid meet"
44
44
  data-cy="origam-chart-treemap-svg"
45
+ @keydown="onChartKeydown"
45
46
  @mousemove="onSvgMouseMove"
46
47
  @mouseleave="onSvgMouseLeave"
47
48
  >
@@ -69,7 +70,8 @@
69
70
  ry="2"
70
71
  :style="{ fill: tile.color }"
71
72
  :data-cy="`origam-chart-treemap-tile-${ tile.index }`"
72
- tabindex="0"
73
+ tabindex="-1"
74
+ data-chart-point
73
75
  role="button"
74
76
  :aria-label="tileAriaLabel(tile)"
75
77
  @click="onTileActivate(tile, $event)"
@@ -169,6 +171,7 @@ import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.co
169
171
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
170
172
  import { useChartSize } from "../../composables/Chart/chart-size.composable";
171
173
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
174
+ import { useChartRoving } from "../../composables/Chart/chart-roving.composable";
172
175
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
173
176
  import { useDimension } from "../../composables/Commons/dimension.composable";
174
177
  import { useElevation } from "../../composables/Commons/elevation.composable";
@@ -258,6 +261,7 @@ useUnsupportedProp(
258
261
  );
259
262
  const chartAnimationStyle = useChartAnimationStyle(props);
260
263
  const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.treemap);
264
+ const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
261
265
  const PADDING = { top: 8, right: 8, bottom: 8, left: 8 };
262
266
  const LABEL_MIN_WIDTH = 60;
263
267
  const LABEL_MIN_HEIGHT = 24;
@@ -42,6 +42,7 @@
42
42
  :aria-label="svgAriaLabel"
43
43
  preserveAspectRatio="xMidYMid meet"
44
44
  data-cy="origam-chart-variwide-svg"
45
+ @keydown="onChartKeydown"
45
46
  @mousemove="onSvgMouseMove"
46
47
  @mouseleave="onSvgMouseLeave"
47
48
  >
@@ -153,7 +154,8 @@
153
154
  rx="2"
154
155
  ry="2"
155
156
  :style="{ fill: col.color }"
156
- tabindex="0"
157
+ tabindex="-1"
158
+ data-chart-point
157
159
  role="button"
158
160
  :aria-label="columnAriaLabel(col)"
159
161
  :data-cy="`origam-chart-variwide-bar-${ col.index }`"
@@ -243,6 +245,7 @@ import OrigamChartTooltip from "./OrigamChartTooltip.vue";
243
245
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
244
246
  import { useChartSize } from "../../composables/Chart/chart-size.composable";
245
247
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
248
+ import { useChartRoving } from "../../composables/Chart/chart-roving.composable";
246
249
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
247
250
  import { useDimension } from "../../composables/Commons/dimension.composable";
248
251
  import { useElevation } from "../../composables/Commons/elevation.composable";
@@ -331,6 +334,7 @@ const { roundedClasses, roundedStyles } = useRounded(props);
331
334
  const { headerTypographyStyles } = useChartHeaderTypography(props);
332
335
  const chartAnimationStyle = useChartAnimationStyle(props);
333
336
  const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.variwide);
337
+ const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
334
338
  const TICK_SIZE = 4;
335
339
  const PLOT = {
336
340
  top: 24,
@@ -42,6 +42,7 @@
42
42
  :aria-label="svgAriaLabel"
43
43
  preserveAspectRatio="xMidYMid meet"
44
44
  data-cy="origam-chart-word-cloud-svg"
45
+ @keydown="onChartKeydown"
45
46
  @mousemove="onSvgMouseMove"
46
47
  @mouseleave="onSvgMouseLeave"
47
48
  >
@@ -67,7 +68,8 @@
67
68
  dominant-baseline="central"
68
69
  :transform="`translate(${ word.x }, ${ word.y }) rotate(${ word.angle })`"
69
70
  :data-cy="`origam-chart-word-cloud-word-${ word.index }`"
70
- tabindex="0"
71
+ tabindex="-1"
72
+ data-chart-point
71
73
  role="button"
72
74
  :aria-label="`${ word.text }: ${ formatValue(word.value) }`"
73
75
  @click="onWordActivate(word, $event)"
@@ -141,6 +143,7 @@ import OrigamChartTooltip from "./OrigamChartTooltip.vue";
141
143
  import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.composable";
142
144
  import { useChartSize } from "../../composables/Chart/chart-size.composable";
143
145
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
146
+ import { useChartRoving } from "../../composables/Chart/chart-roving.composable";
144
147
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
145
148
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
146
149
  import { useDimension } from "../../composables/Commons/dimension.composable";
@@ -237,6 +240,7 @@ const { headerTypographyStyles } = useChartHeaderTypography({
237
240
  }
238
241
  });
239
242
  const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.wordCloud);
243
+ const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
240
244
  const fontScale = computed(() => Math.min(
241
245
  svgWidth.value / CHART_SIZE_FALLBACK.wordCloud.width,
242
246
  svgHeight.value / CHART_SIZE_FALLBACK.wordCloud.height
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.resolveChartRovingTarget = resolveChartRovingTarget;
7
+ exports.useChartRoving = useChartRoving;
8
+ var _vue = require("vue");
9
+ var _chart = require("../../consts/Chart/chart.const.cjs");
10
+ function resolveChartRovingTarget(series, current, action) {
11
+ if (!series.length) return -1;
12
+ if (action === "first") return 0;
13
+ if (action === "last") return series.length - 1;
14
+ const keys = [...new Set(series)];
15
+ const vertical = action === "nextSeries" || action === "previousSeries";
16
+ const step = action === "next" || action === "nextSeries" ? 1 : -1;
17
+ if (vertical && keys.length > 1) {
18
+ const target = keys.indexOf(series[current] ?? "") + step;
19
+ if (target < 0 || target >= keys.length) return current;
20
+ const position = series.slice(0, current).filter(key => key === series[current]).length;
21
+ const inTarget = series.flatMap((key, index) => key === keys[target] ? [index] : []);
22
+ return inTarget[Math.min(position, inTarget.length - 1)] ?? current;
23
+ }
24
+ const group = vertical ? series.map((_, index) => index) : series.flatMap((key, index) => key === series[current] ? [index] : []);
25
+ const next = group.indexOf(current) + step;
26
+ return group[next] ?? current;
27
+ }
28
+ function useChartRoving(svgRef) {
29
+ let activeIndex = 0;
30
+ let host = null;
31
+ const points = () => [...(svgRef.value?.querySelectorAll(_chart.CHART_POINT_SELECTOR) ?? [])];
32
+ const sync = () => {
33
+ const items = points();
34
+ activeIndex = Math.max(0, Math.min(activeIndex, items.length - 1));
35
+ items.forEach((el, index) => {
36
+ const value = index === activeIndex ? "0" : "-1";
37
+ if (el.getAttribute("tabindex") !== value) el.setAttribute("tabindex", value);
38
+ });
39
+ };
40
+ const onFocusin = event => {
41
+ const index = points().indexOf(event.target);
42
+ if (index < 0 || index === activeIndex) return;
43
+ activeIndex = index;
44
+ sync();
45
+ };
46
+ const onKeydown = event => {
47
+ const action = _chart.CHART_ROVING_KEY_ACTIONS[event.key];
48
+ if (!action || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
49
+ const items = points();
50
+ const current = items.indexOf(event.target);
51
+ if (current < 0) return;
52
+ event.preventDefault();
53
+ const target = resolveChartRovingTarget(items.map(el => el.getAttribute(_chart.CHART_SERIES_ATTR) ?? ""), current, action);
54
+ if (target < 0 || target === current) return;
55
+ activeIndex = target;
56
+ sync();
57
+ items[target]?.focus();
58
+ };
59
+ (0, _vue.onMounted)(() => {
60
+ sync();
61
+ host = svgRef.value?.parentElement ?? null;
62
+ host?.addEventListener("focusin", onFocusin);
63
+ });
64
+ (0, _vue.onBeforeUnmount)(() => host?.removeEventListener("focusin", onFocusin));
65
+ (0, _vue.onUpdated)(sync);
66
+ return {
67
+ onKeydown
68
+ };
69
+ }
@@ -0,0 +1,33 @@
1
+ import { type Ref } from 'vue';
2
+ import type { IChartRoving } from '../../interfaces/Chart/chart-roving.interface';
3
+ import type { TChartRovingAction } from '../../types/Chart/chart.type';
4
+ /*********************************************************
5
+ * resolveChartRovingTarget
6
+ *
7
+ * @description
8
+ * Pure navigation rule of the roving tabindex (#1333): from the point at
9
+ * `current`, returns the index of the point `action` leads to.
10
+ * `series[i]` is the series key of the i-th point in DOM order.
11
+ * Left/Right stay inside the current series; Up/Down jump to the adjacent
12
+ * series at the same position (clamped when that series is shorter).
13
+ * With a single series the vertical arrows behave like Left/Right.
14
+ * Nothing wraps: at an end the focus stays where it is.
15
+ ********************************************************/
16
+ export declare function resolveChartRovingTarget(series: string[], current: number, action: TChartRovingAction): number;
17
+ /*********************************************************
18
+ * useChartRoving
19
+ *
20
+ * @description
21
+ * Gives a chart ONE tab stop (WAI-ARIA roving tabindex, WCAG 2.1.1 / 2.4.3).
22
+ * The points carry `data-chart-point` and a static `tabindex="-1"`.
23
+ * This composable promotes the last active one (else the first) to
24
+ * `tabindex="0"` after mount and after each update, and moves it with the
25
+ * arrow keys. Bind `onKeydown` on the chart `<svg>`; `svgRef` is the template
26
+ * ref of that `<svg>`.
27
+ *
28
+ * @description
29
+ * The focus listener lives on the svg's PARENT, never on the svg: Blink makes
30
+ * an SVG element keyboard-focusable as soon as it has a focus / focusin
31
+ * listener, which would add a second tab stop (the svg itself).
32
+ ********************************************************/
33
+ export declare function useChartRoving(svgRef: Ref<SVGSVGElement | null | undefined>): IChartRoving;
@@ -0,0 +1,64 @@
1
+ import { onBeforeUnmount, onMounted, onUpdated } from "vue";
2
+ import {
3
+ CHART_POINT_SELECTOR,
4
+ CHART_ROVING_KEY_ACTIONS,
5
+ CHART_SERIES_ATTR
6
+ } from "../../consts/Chart/chart.const.js";
7
+ export function resolveChartRovingTarget(series, current, action) {
8
+ if (!series.length) return -1;
9
+ if (action === "first") return 0;
10
+ if (action === "last") return series.length - 1;
11
+ const keys = [...new Set(series)];
12
+ const vertical = action === "nextSeries" || action === "previousSeries";
13
+ const step = action === "next" || action === "nextSeries" ? 1 : -1;
14
+ if (vertical && keys.length > 1) {
15
+ const target = keys.indexOf(series[current] ?? "") + step;
16
+ if (target < 0 || target >= keys.length) return current;
17
+ const position = series.slice(0, current).filter((key) => key === series[current]).length;
18
+ const inTarget = series.flatMap((key, index) => key === keys[target] ? [index] : []);
19
+ return inTarget[Math.min(position, inTarget.length - 1)] ?? current;
20
+ }
21
+ const group = vertical ? series.map((_, index) => index) : series.flatMap((key, index) => key === series[current] ? [index] : []);
22
+ const next = group.indexOf(current) + step;
23
+ return group[next] ?? current;
24
+ }
25
+ export function useChartRoving(svgRef) {
26
+ let activeIndex = 0;
27
+ let host = null;
28
+ const points = () => [...svgRef.value?.querySelectorAll(CHART_POINT_SELECTOR) ?? []];
29
+ const sync = () => {
30
+ const items = points();
31
+ activeIndex = Math.max(0, Math.min(activeIndex, items.length - 1));
32
+ items.forEach((el, index) => {
33
+ const value = index === activeIndex ? "0" : "-1";
34
+ if (el.getAttribute("tabindex") !== value) el.setAttribute("tabindex", value);
35
+ });
36
+ };
37
+ const onFocusin = (event) => {
38
+ const index = points().indexOf(event.target);
39
+ if (index < 0 || index === activeIndex) return;
40
+ activeIndex = index;
41
+ sync();
42
+ };
43
+ const onKeydown = (event) => {
44
+ const action = CHART_ROVING_KEY_ACTIONS[event.key];
45
+ if (!action || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
46
+ const items = points();
47
+ const current = items.indexOf(event.target);
48
+ if (current < 0) return;
49
+ event.preventDefault();
50
+ const target = resolveChartRovingTarget(items.map((el) => el.getAttribute(CHART_SERIES_ATTR) ?? ""), current, action);
51
+ if (target < 0 || target === current) return;
52
+ activeIndex = target;
53
+ sync();
54
+ items[target]?.focus();
55
+ };
56
+ onMounted(() => {
57
+ sync();
58
+ host = svgRef.value?.parentElement ?? null;
59
+ host?.addEventListener("focusin", onFocusin);
60
+ });
61
+ onBeforeUnmount(() => host?.removeEventListener("focusin", onFocusin));
62
+ onUpdated(sync);
63
+ return { onKeydown };
64
+ }
@@ -1692,4 +1692,16 @@ Object.keys(_chartSize).forEach(function (key) {
1692
1692
  return _chartSize[key];
1693
1693
  }
1694
1694
  });
1695
+ });
1696
+ var _chartRoving = require("./Chart/chart-roving.composable.cjs");
1697
+ Object.keys(_chartRoving).forEach(function (key) {
1698
+ if (key === "default" || key === "__esModule") return;
1699
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
1700
+ if (key in exports && exports[key] === _chartRoving[key]) return;
1701
+ Object.defineProperty(exports, key, {
1702
+ enumerable: true,
1703
+ get: function () {
1704
+ return _chartRoving[key];
1705
+ }
1706
+ });
1695
1707
  });
@@ -151,3 +151,4 @@ export * from './Chart/chart-animation.composable';
151
151
  export * from './Chart/chart-header-typography.composable';
152
152
  export * from './Chart/chart-zoom.composable';
153
153
  export * from './Chart/chart-size.composable';
154
+ export * from './Chart/chart-roving.composable';
@@ -139,3 +139,4 @@ export * from "./Chart/chart-animation.composable.js";
139
139
  export * from "./Chart/chart-header-typography.composable.js";
140
140
  export * from "./Chart/chart-zoom.composable.js";
141
141
  export * from "./Chart/chart-size.composable.js";
142
+ export * from "./Chart/chart-roving.composable.js";
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.CHART_Y_TICK_COUNT = exports.CHART_TICK_LABEL_PRECISION_FACTOR = exports.CHART_SVG_ROLE = exports.CHART_SLICE_LABEL_PREFIX = exports.CHART_SIZE_FALLBACK = exports.CHART_SCATTER_MIN_RADIUS = exports.CHART_SCATTER_MAX_RADIUS = exports.CHART_SCATTER_DEFAULT_RADIUS = exports.CHART_RANGE_SELECTOR_DEFAULT_BUTTONS = exports.CHART_RADAR_RADIUS_INSET = exports.CHART_RADAR_MIN_RADIUS = exports.CHART_RADAR_MARKER_RADIUS = exports.CHART_POINT_MARKER_RADIUS = exports.CHART_PLOT_LINE_LABEL_TOP_OFFSET = exports.CHART_PLOT_LINE_LABEL_OFFSET = exports.CHART_PLOT_LINE_DEFAULT_WIDTH = exports.CHART_PLOT_BAND_DEFAULT_OPACITY = exports.CHART_PIE_RADIUS_INSET = exports.CHART_PIE_MIN_RADIUS = exports.CHART_PERCENT_TICK_STEP = exports.CHART_PERCENT_MIN = exports.CHART_PERCENT_MAX = exports.CHART_NICE_STEP_LADDER = exports.CHART_EPSILON = exports.CHART_DEFAULT_PALETTE = exports.CHART_DASH_ARRAY_SOLID = exports.CHART_DASH_ARRAY_DOTTED = exports.CHART_DASH_ARRAY_DASHED = exports.CHART_COLOR_FALLBACK = exports.CHART_BAR_SLOT_FILL_RATIO = exports.CHART_ASPECT_RATIO = exports.CHART_ANNOTATION_LABEL_PADDING = exports.CHART_ANNOTATION_LABEL_MIN_WIDTH = exports.CHART_ANNOTATION_LABEL_HEIGHT = exports.CHART_ANNOTATION_LABEL_CHAR_WIDTH = exports.CHART_ANNOTATION_DEFAULT_WIDTH = exports.CHART_ANNOTATION_DEFAULT_RADIUS = exports.CHART_ANNOTATION_DEFAULT_DY = exports.CHART_ANNOTATION_ARROWHEAD_WIDTH_FACTOR = exports.CHART_ANNOTATION_ARROWHEAD_SPREAD = exports.CHART_ANNOTATION_ARROWHEAD_PRECISION = exports.CHART_ANNOTATION_ARROWHEAD_MIN_SIZE = exports.CHART_ANIMATION_DURATION_DEFAULT = void 0;
6
+ exports.CHART_Y_TICK_COUNT = exports.CHART_TICK_LABEL_PRECISION_FACTOR = exports.CHART_SVG_ROLE = exports.CHART_SLICE_LABEL_PREFIX = exports.CHART_SIZE_FALLBACK = exports.CHART_SERIES_ATTR = exports.CHART_SCATTER_MIN_RADIUS = exports.CHART_SCATTER_MAX_RADIUS = exports.CHART_SCATTER_DEFAULT_RADIUS = exports.CHART_ROVING_KEY_ACTIONS = exports.CHART_RANGE_SELECTOR_DEFAULT_BUTTONS = exports.CHART_RADAR_RADIUS_INSET = exports.CHART_RADAR_MIN_RADIUS = exports.CHART_RADAR_MARKER_RADIUS = exports.CHART_POINT_SELECTOR = exports.CHART_POINT_MARKER_RADIUS = exports.CHART_POINT_ATTR = exports.CHART_PLOT_LINE_LABEL_TOP_OFFSET = exports.CHART_PLOT_LINE_LABEL_OFFSET = exports.CHART_PLOT_LINE_DEFAULT_WIDTH = exports.CHART_PLOT_BAND_DEFAULT_OPACITY = exports.CHART_PIE_RADIUS_INSET = exports.CHART_PIE_MIN_RADIUS = exports.CHART_PERCENT_TICK_STEP = exports.CHART_PERCENT_MIN = exports.CHART_PERCENT_MAX = exports.CHART_NICE_STEP_LADDER = exports.CHART_EPSILON = exports.CHART_DEFAULT_PALETTE = exports.CHART_DASH_ARRAY_SOLID = exports.CHART_DASH_ARRAY_DOTTED = exports.CHART_DASH_ARRAY_DASHED = exports.CHART_COLOR_FALLBACK = exports.CHART_BAR_SLOT_FILL_RATIO = exports.CHART_AXIS_LABEL_MIN_GAP = exports.CHART_AXIS_LABEL_CHAR_WIDTH = exports.CHART_ASPECT_RATIO = exports.CHART_ANNOTATION_LABEL_PADDING = exports.CHART_ANNOTATION_LABEL_MIN_WIDTH = exports.CHART_ANNOTATION_LABEL_HEIGHT = exports.CHART_ANNOTATION_LABEL_CHAR_WIDTH = exports.CHART_ANNOTATION_DEFAULT_WIDTH = exports.CHART_ANNOTATION_DEFAULT_RADIUS = exports.CHART_ANNOTATION_DEFAULT_DY = exports.CHART_ANNOTATION_ARROWHEAD_WIDTH_FACTOR = exports.CHART_ANNOTATION_ARROWHEAD_SPREAD = exports.CHART_ANNOTATION_ARROWHEAD_PRECISION = exports.CHART_ANNOTATION_ARROWHEAD_MIN_SIZE = exports.CHART_ANIMATION_DURATION_DEFAULT = void 0;
7
7
  var _intent = require("../../enums/Commons/intent.enum.cjs");
8
8
  const CHART_Y_TICK_COUNT = exports.CHART_Y_TICK_COUNT = 5;
9
9
  const CHART_ANIMATION_DURATION_DEFAULT = exports.CHART_ANIMATION_DURATION_DEFAULT = 600;
@@ -76,6 +76,19 @@ const CHART_SCATTER_MIN_RADIUS = exports.CHART_SCATTER_MIN_RADIUS = 5;
76
76
  const CHART_SCATTER_MAX_RADIUS = exports.CHART_SCATTER_MAX_RADIUS = 36;
77
77
  const CHART_SLICE_LABEL_PREFIX = exports.CHART_SLICE_LABEL_PREFIX = "Slice";
78
78
  const CHART_SVG_ROLE = exports.CHART_SVG_ROLE = "group";
79
+ const CHART_POINT_ATTR = exports.CHART_POINT_ATTR = "data-chart-point";
80
+ const CHART_POINT_SELECTOR = exports.CHART_POINT_SELECTOR = `[${CHART_POINT_ATTR}]`;
81
+ const CHART_SERIES_ATTR = exports.CHART_SERIES_ATTR = "data-chart-series";
82
+ const CHART_ROVING_KEY_ACTIONS = exports.CHART_ROVING_KEY_ACTIONS = {
83
+ ArrowRight: "next",
84
+ ArrowLeft: "previous",
85
+ ArrowDown: "nextSeries",
86
+ ArrowUp: "previousSeries",
87
+ Home: "first",
88
+ End: "last"
89
+ };
90
+ const CHART_AXIS_LABEL_CHAR_WIDTH = exports.CHART_AXIS_LABEL_CHAR_WIDTH = 8;
91
+ const CHART_AXIS_LABEL_MIN_GAP = exports.CHART_AXIS_LABEL_MIN_GAP = 8;
79
92
  const CHART_SIZE_FALLBACK = exports.CHART_SIZE_FALLBACK = {
80
93
  boxPlot: {
81
94
  width: 600,
@@ -1,3 +1,4 @@
1
+ import type { TChartRovingAction } from '../../types/Chart/chart.type';
1
2
  import type { TIntent } from '../../types/Commons/intent.type';
2
3
  /**
3
4
  * How many Y-axis ticks `<OrigamChart>` draws by default. The
@@ -260,7 +261,7 @@ export declare const CHART_SLICE_LABEL_PREFIX = "Slice";
260
261
  *
261
262
  * @description
262
263
  * Role of the root `<svg>` of every chart whose data points are focusable
263
- * (`role="button"` + `tabindex="0"`). It is `group`, never `img`: an `img`
264
+ * (`role="button"`, one roving tab stop per chart, #1333). It is `group`, never `img`: an `img`
264
265
  * renders its subtree presentational, so a screen reader announces only the
265
266
  * picture while the keyboard stops on each point (axe `nested-interactive`,
266
267
  * WCAG 4.1.2, #1318 and #1153).
@@ -268,6 +269,57 @@ export declare const CHART_SLICE_LABEL_PREFIX = "Slice";
268
269
  * focusable points be announced.
269
270
  ********************************************************/
270
271
  export declare const CHART_SVG_ROLE = "group";
272
+ /*********************************************************
273
+ * CHART_POINT_ATTR
274
+ *
275
+ * @description
276
+ * Boolean data attribute carried by every focusable data point of a chart
277
+ * (`role="button"`). It is what `useChartRoving` selects: the other
278
+ * `role="button"` of a chart (the zoom-reset control) keep their own tab
279
+ * stop (#1333).
280
+ ********************************************************/
281
+ export declare const CHART_POINT_ATTR = "data-chart-point";
282
+ /*********************************************************
283
+ * CHART_POINT_SELECTOR
284
+ *
285
+ * @description
286
+ * CSS selector matching the focusable data points of a chart.
287
+ ********************************************************/
288
+ export declare const CHART_POINT_SELECTOR = "[data-chart-point]";
289
+ /*********************************************************
290
+ * CHART_SERIES_ATTR
291
+ *
292
+ * @description
293
+ * Optional data attribute naming the series (or row) a point belongs to.
294
+ * ArrowUp / ArrowDown move between these groups at the same position.
295
+ * Points without it form a single series, for which the vertical arrows
296
+ * behave like ArrowLeft / ArrowRight (the listbox / radio-group pattern),
297
+ * so a vertical key is never dead.
298
+ ********************************************************/
299
+ export declare const CHART_SERIES_ATTR = "data-chart-series";
300
+ /*********************************************************
301
+ * CHART_ROVING_KEY_ACTIONS
302
+ *
303
+ * @description
304
+ * Keyboard model of the single tab stop of a chart (#1333):
305
+ * Left/Right = previous/next point, Up/Down = previous/next series,
306
+ * Home/End = first/last point. Enter and Space stay handled by each point
307
+ * (same emit as a click); Tab is left to the browser and exits the chart.
308
+ ********************************************************/
309
+ export declare const CHART_ROVING_KEY_ACTIONS: Readonly<Record<string, TChartRovingAction>>;
310
+ /*********************************************************
311
+ * CHART_AXIS_LABEL_CHAR_WIDTH / CHART_AXIS_LABEL_MIN_GAP — décimation (#1325)
312
+ *
313
+ * @description
314
+ * Repli (SSR, avant mesure) pour la largeur d'une étiquette de l'axe X (px par caractère,
315
+ * pour la police 0.75rem par défaut, taillée sur le glyphe large) et
316
+ * espace minimal exigé entre deux étiquettes voisines. Servent à calculer
317
+ * le pas de décimation « une étiquette sur N ». Après montage la largeur est mesurée :
318
+ * la largeur par caractère ne sert plus qu'au premier rendu (l'écart reste utilisé), où un
319
+ * `--origam-chart__axis-label---font-size` très supérieur au défaut peut sous-estimer.
320
+ ********************************************************/
321
+ export declare const CHART_AXIS_LABEL_CHAR_WIDTH = 8;
322
+ export declare const CHART_AXIS_LABEL_MIN_GAP = 8;
271
323
  /*********************************************************
272
324
  * CHART_SIZE_FALLBACK (#1324)
273
325
  *
@@ -61,6 +61,19 @@ export const CHART_SCATTER_MIN_RADIUS = 5;
61
61
  export const CHART_SCATTER_MAX_RADIUS = 36;
62
62
  export const CHART_SLICE_LABEL_PREFIX = "Slice";
63
63
  export const CHART_SVG_ROLE = "group";
64
+ export const CHART_POINT_ATTR = "data-chart-point";
65
+ export const CHART_POINT_SELECTOR = `[${CHART_POINT_ATTR}]`;
66
+ export const CHART_SERIES_ATTR = "data-chart-series";
67
+ export const CHART_ROVING_KEY_ACTIONS = {
68
+ ArrowRight: "next",
69
+ ArrowLeft: "previous",
70
+ ArrowDown: "nextSeries",
71
+ ArrowUp: "previousSeries",
72
+ Home: "first",
73
+ End: "last"
74
+ };
75
+ export const CHART_AXIS_LABEL_CHAR_WIDTH = 8;
76
+ export const CHART_AXIS_LABEL_MIN_GAP = 8;
64
77
  export const CHART_SIZE_FALLBACK = {
65
78
  boxPlot: { width: 600, height: 400 },
66
79
  bullet: { width: 600, height: 400 },
@@ -100,3 +100,14 @@ export interface IChartSecondaryYAxis {
100
100
  /** Optional axis title rendered alongside the right axis. */
101
101
  title?: string;
102
102
  }
103
+ /*********************************************************
104
+ * IChartAxisLabelSlot (#1325)
105
+ *
106
+ * @description
107
+ * Une étiquette X avec son index et son état de décimation.
108
+ ********************************************************/
109
+ export interface IChartAxisLabelSlot {
110
+ tick: IChartTick;
111
+ i: number;
112
+ shown: boolean;
113
+ }
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,12 @@
1
+ /*********************************************************
2
+ * IChartRoving
3
+ *
4
+ * @description
5
+ * Handler returned by `useChartRoving`, to bind on the chart `<svg>` with
6
+ * `@keydown`: Arrow / Home / End navigation between the points of the chart.
7
+ * The composable also keeps the single tab stop in sync with the rendered
8
+ * points (mount, update, focus).
9
+ ********************************************************/
10
+ export interface IChartRoving {
11
+ onKeydown: (event: KeyboardEvent) => void;
12
+ }
@@ -3116,6 +3116,17 @@ Object.keys(_chartGauge).forEach(function (key) {
3116
3116
  }
3117
3117
  });
3118
3118
  });
3119
+ var _chartRoving = require("./Chart/chart-roving.interface.cjs");
3120
+ Object.keys(_chartRoving).forEach(function (key) {
3121
+ if (key === "default" || key === "__esModule") return;
3122
+ if (key in exports && exports[key] === _chartRoving[key]) return;
3123
+ Object.defineProperty(exports, key, {
3124
+ enumerable: true,
3125
+ get: function () {
3126
+ return _chartRoving[key];
3127
+ }
3128
+ });
3129
+ });
3119
3130
  var _chartPyramid = require("./Chart/chart-pyramid.interface.cjs");
3120
3131
  Object.keys(_chartPyramid).forEach(function (key) {
3121
3132
  if (key === "default" || key === "__esModule") return;
@@ -281,6 +281,7 @@ export * from './Chart/chart-cartesian.interface';
281
281
  export * from './Chart/chart-polar.interface';
282
282
  export * from './Chart/chart-radar.interface';
283
283
  export * from './Chart/chart-gauge.interface';
284
+ export * from './Chart/chart-roving.interface';
284
285
  export * from './Chart/chart-pyramid.interface';
285
286
  export * from './Chart/chart-honeycomb.interface';
286
287
  export * from './Chart/chart-treemap.interface';
@@ -281,6 +281,7 @@ export * from "./Chart/chart-cartesian.interface.js";
281
281
  export * from "./Chart/chart-polar.interface.js";
282
282
  export * from "./Chart/chart-radar.interface.js";
283
283
  export * from "./Chart/chart-gauge.interface.js";
284
+ export * from "./Chart/chart-roving.interface.js";
284
285
  export * from "./Chart/chart-pyramid.interface.js";
285
286
  export * from "./Chart/chart-honeycomb.interface.js";
286
287
  export * from "./Chart/chart-treemap.interface.js";
@@ -54,3 +54,11 @@ export type TOrigamChart = InstanceType<typeof OrigamChart>;
54
54
  * interchangeable and neither replaces the other.
55
55
  */
56
56
  export type TPathPoint = [number, number];
57
+ /*********************************************************
58
+ * TChartRovingAction
59
+ *
60
+ * @description
61
+ * Movement requested by a navigation key inside a chart (roving tabindex,
62
+ * #1333): previous / next point, previous / next series, first / last point.
63
+ ********************************************************/
64
+ export type TChartRovingAction = 'next' | 'previous' | 'nextSeries' | 'previousSeries' | 'first' | 'last';