@geotab/zenith 3.17.1 → 3.18.0-beta.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.
Files changed (56) hide show
  1. package/README.md +8 -0
  2. package/dist/chart/pieChart/pieLegendPlugin.js +3 -0
  3. package/dist/chart/pieChart/renderPieLegend.js +6 -4
  4. package/dist/chart/plugins/legend/legendFocus.d.ts +2 -0
  5. package/dist/chart/plugins/legend/legendFocus.js +20 -0
  6. package/dist/chart/plugins/legend/legendPlugin.js +3 -0
  7. package/dist/chart/plugins/legend/renderLegend.js +9 -5
  8. package/dist/commonHelpers/hooks/useFormFieldValues/useFormFieldValues.d.ts +2 -1
  9. package/dist/commonHelpers/hooks/useFormFieldValues/useFormFieldValues.js +1 -0
  10. package/dist/commonHelpers/hooks/useMergedRef.d.ts +6 -0
  11. package/dist/commonHelpers/hooks/useMergedRef.js +37 -0
  12. package/dist/commonStyles/typography/typography.less +9 -0
  13. package/dist/dateInputInner/dateInputInnerReducer.d.ts +1 -0
  14. package/dist/dateInputInner/dateInputInnerReducer.js +18 -0
  15. package/dist/dateInputRaw/types.d.ts +1 -0
  16. package/dist/dateInputRaw/types.js +18 -0
  17. package/dist/dateRangeRaw/types.d.ts +1 -0
  18. package/dist/dateRangeRaw/types.js +18 -0
  19. package/dist/dateRangeRaw/utils/areMapsEqual.d.ts +1 -0
  20. package/dist/dateRangeRaw/utils/areMapsEqual.js +18 -0
  21. package/dist/index.css +123 -0
  22. package/dist/miniTabs/miniTabs.d.ts +2 -1
  23. package/dist/miniTabs/miniTabs.js +2 -2
  24. package/dist/miniTabs/miniTabsItem.js +1 -1
  25. package/dist/stepperRaw/stepperRaw.js +5 -2
  26. package/dist/textInputRaw/textInputRaw.js +4 -2
  27. package/dist/textareaRaw/textareaRaw.js +4 -2
  28. package/dist/utils/dateInputUtils/useTodayButton.d.ts +1 -0
  29. package/dist/utils/dateInputUtils/useTodayButton.js +18 -0
  30. package/esm/chart/pieChart/pieLegendPlugin.js +3 -0
  31. package/esm/chart/pieChart/renderPieLegend.js +6 -4
  32. package/esm/chart/plugins/legend/legendFocus.d.ts +2 -0
  33. package/esm/chart/plugins/legend/legendFocus.js +15 -0
  34. package/esm/chart/plugins/legend/legendPlugin.js +3 -0
  35. package/esm/chart/plugins/legend/renderLegend.js +9 -5
  36. package/esm/commonHelpers/hooks/useFormFieldValues/useFormFieldValues.d.ts +2 -1
  37. package/esm/commonHelpers/hooks/useFormFieldValues/useFormFieldValues.js +1 -0
  38. package/esm/commonHelpers/hooks/useMergedRef.d.ts +6 -0
  39. package/esm/commonHelpers/hooks/useMergedRef.js +33 -0
  40. package/esm/dateInputInner/dateInputInnerReducer.d.ts +1 -0
  41. package/esm/dateInputInner/dateInputInnerReducer.js +2 -0
  42. package/esm/dateInputRaw/types.d.ts +1 -0
  43. package/esm/dateInputRaw/types.js +2 -0
  44. package/esm/dateRangeRaw/types.d.ts +1 -0
  45. package/esm/dateRangeRaw/types.js +2 -0
  46. package/esm/dateRangeRaw/utils/areMapsEqual.d.ts +1 -0
  47. package/esm/dateRangeRaw/utils/areMapsEqual.js +2 -0
  48. package/esm/miniTabs/miniTabs.d.ts +2 -1
  49. package/esm/miniTabs/miniTabs.js +2 -2
  50. package/esm/miniTabs/miniTabsItem.js +1 -1
  51. package/esm/stepperRaw/stepperRaw.js +5 -2
  52. package/esm/textInputRaw/textInputRaw.js +4 -2
  53. package/esm/textareaRaw/textareaRaw.js +4 -2
  54. package/esm/utils/dateInputUtils/useTodayButton.d.ts +1 -0
  55. package/esm/utils/dateInputUtils/useTodayButton.js +2 -0
  56. package/package.json +8 -1
package/README.md CHANGED
@@ -47,6 +47,14 @@ Zenith library provides components defined in Zenith Design System. It includes
47
47
 
48
48
  ## Change log
49
49
 
50
+ ### 3.18.0
51
+
52
+ - Add opt-in `fill` prop to `MiniTabs` so the tabs fill the available width
53
+ - Make chart legend items keyboard accessible
54
+ - Add `stepper` support to `Filters.DateRange` as a single pill around the chip; make the `Filters` side panel date range full width
55
+ - Add `data-xxxl` typography style (`zen-data-xxxl`)
56
+ - Focus the first invalid field when a React Hook Form submit fails in `TextInput`, `Textarea` and `Stepper` (including the `Raw` variants)
57
+
50
58
  ### 3.17.1
51
59
 
52
60
  - Preserve filter names and show applied selection counts.
@@ -4,6 +4,7 @@ exports.pieLegendPlugin = void 0;
4
4
  const zen_1 = require("../../utils/zen");
5
5
  const getPieLegendItems_1 = require("./getPieLegendItems");
6
6
  const renderPieLegend_1 = require("./renderPieLegend");
7
+ const legendFocus_1 = require("../plugins/legend/legendFocus");
7
8
  const pieLegendPlugin = (containerId, options, isDrive, rawData, isHidden, toggleHidden) => ({
8
9
  id: "zenithPieLegend",
9
10
  isDrive,
@@ -37,9 +38,11 @@ const pieLegendPlugin = (containerId, options, isDrive, rawData, isHidden, toggl
37
38
  barWidth: hidden ? 0 : total > 0 ? (rawValues[item.index] / total) * 100 : 0
38
39
  }));
39
40
  });
41
+ const focusedIndex = (0, legendFocus_1.getFocusedLegendIndex)(container);
40
42
  container.innerHTML = "";
41
43
  container.classList.remove("zen-legend--hidden");
42
44
  (0, renderPieLegend_1.renderPieLegend)(container, isDrive, items, options);
45
+ (0, legendFocus_1.restoreLegendFocus)(container, focusedIndex);
43
46
  }
44
47
  });
45
48
  exports.pieLegendPlugin = pieLegendPlugin;
@@ -19,8 +19,7 @@ const renderPieLegend = (element, isDrive, items, options) => {
19
19
  <div class="zen-pie-legend__item-bar" data-bar-width="${(_a = item.barWidth) !== null && _a !== void 0 ? _a : 0}"></div>
20
20
  </div>`
21
21
  : "";
22
- return `<li class="zen-pie-legend__item" data-index="${item.index}">
23
- <span class="zen-pie-legend__item-color"></span>
22
+ const content = `<span class="zen-pie-legend__item-color"></span>
24
23
  <div class="zen-pie-legend__item-content">
25
24
  <div class="zen-pie-legend__item-row">
26
25
  <p class="${labelClass}">${(0, escapeHtml_1.htmlEscape)(item.text)}</p>
@@ -28,8 +27,11 @@ const renderPieLegend = (element, isDrive, items, options) => {
28
27
  ${percentageHtml}
29
28
  </div>
30
29
  ${barHtml}
31
- </div>
32
- </li>`;
30
+ </div>`;
31
+ const control = item.onClick
32
+ ? `<button type="button" class="zen-pie-legend__button" aria-pressed="${!item.hidden}">${content}</button>`
33
+ : `<span class="zen-pie-legend__button">${content}</span>`;
34
+ return `<li class="zen-pie-legend__item" data-index="${item.index}">${control}</li>`;
33
35
  })
34
36
  .join("");
35
37
  element.innerHTML = `<ul class="${classes}">${listItems}</ul>`;
@@ -0,0 +1,2 @@
1
+ export declare const getFocusedLegendIndex: (container: HTMLElement) => string | undefined;
2
+ export declare const restoreLegendFocus: (container: HTMLElement, index: string | undefined) => void;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.restoreLegendFocus = exports.getFocusedLegendIndex = void 0;
4
+ const getFocusedLegendIndex = (container) => {
5
+ var _a, _b;
6
+ const active = container.ownerDocument.activeElement;
7
+ if (!active || !container.contains(active)) {
8
+ return undefined;
9
+ }
10
+ return (_b = (_a = active.closest("[data-index]")) === null || _a === void 0 ? void 0 : _a.getAttribute("data-index")) !== null && _b !== void 0 ? _b : undefined;
11
+ };
12
+ exports.getFocusedLegendIndex = getFocusedLegendIndex;
13
+ const restoreLegendFocus = (container, index) => {
14
+ var _a;
15
+ if (index === undefined) {
16
+ return;
17
+ }
18
+ (_a = container.querySelector(`[data-index="${index}"] button`)) === null || _a === void 0 ? void 0 : _a.focus();
19
+ };
20
+ exports.restoreLegendFocus = restoreLegendFocus;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.legendPlugin = exports.LEGEND_PLUGIN_ID = void 0;
4
4
  const renderLegend_1 = require("./renderLegend");
5
+ const legendFocus_1 = require("./legendFocus");
5
6
  const getLineLegendItems_1 = require("../../lineChart/getLineLegendItems");
6
7
  const getBarLegendItems_1 = require("../../barChart/getBarLegendItems");
7
8
  const getPieLegendItems_1 = require("../../pieChart/getPieLegendItems");
@@ -20,6 +21,7 @@ const legendPlugin = (containerId, options, isDrive, isHidden, toggleHidden) =>
20
21
  container.classList.add("zen-legend--hidden");
21
22
  return;
22
23
  }
24
+ const focusedIndex = (0, legendFocus_1.getFocusedLegendIndex)(container);
23
25
  container.innerHTML = "";
24
26
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
27
  const chartType = chart.config.type;
@@ -46,6 +48,7 @@ const legendPlugin = (containerId, options, isDrive, isHidden, toggleHidden) =>
46
48
  }
47
49
  container.classList.remove("zen-legend--hidden");
48
50
  (0, renderLegend_1.renderLegend)(container, this.isDrive, items);
51
+ (0, legendFocus_1.restoreLegendFocus)(container, focusedIndex);
49
52
  }
50
53
  });
51
54
  exports.legendPlugin = legendPlugin;
@@ -6,13 +6,17 @@ const escapeHtml_1 = require("../../../utils/escapeHtml");
6
6
  const renderLegend = (element, isDrive, items) => {
7
7
  const classes = (0, classNames_1.classNames)(["zen-legend", isDrive ? "zen-legend--drive" : ""]);
8
8
  const listItems = items
9
- .map((item, index) => `<li class="zen-legend__item" data-index="${index}">
10
- <span class="zen-legend__item-color" style="background-color: ${item.color};"></span>
9
+ .map((item, index) => {
10
+ const content = `<span class="zen-legend__item-color" style="background-color: ${item.color};"></span>
11
11
  <p class="${(0, classNames_1.classNames)(["zen-legend__item-label", item.hidden ? "zen-legend__item-label--hidden" : ""])}">${(0, escapeHtml_1.htmlEscape)(item.text)}</p>
12
12
  ${item.value !== undefined
13
- ? `<p class="${(0, classNames_1.classNames)(["zen-legend__item-value", item.hidden ? "zen-legend__item-value--hidden" : ""])}">${(0, escapeHtml_1.htmlEscape)(item.value)}</p>`
14
- : ""}
15
- </li>`)
13
+ ? `<p class="${(0, classNames_1.classNames)(["zen-legend__item-value", item.hidden ? "zen-legend__item-value--hidden" : ""])}">${(0, escapeHtml_1.htmlEscape)(item.value)}</p>`
14
+ : ""}`;
15
+ const control = item.onClick
16
+ ? `<button type="button" class="zen-legend__button" aria-pressed="${!item.hidden}">${content}</button>`
17
+ : `<span class="zen-legend__button">${content}</span>`;
18
+ return `<li class="zen-legend__item" data-index="${index}">${control}</li>`;
19
+ })
16
20
  .join("");
17
21
  element.innerHTML = `<ul class='${classes}'>${listItems}</ul>`;
18
22
  const itemElements = element.querySelectorAll(".zen-legend__item");
@@ -1,4 +1,4 @@
1
- import { RegisterOptions, UseControllerProps } from "react-hook-form";
1
+ import { RefCallBack, RegisterOptions, UseControllerProps } from "react-hook-form";
2
2
  interface IRegisterOptions extends Partial<Pick<RegisterOptions, "required" | "min" | "max" | "maxLength" | "minLength" | "value" | "onChange" | "onBlur" | "disabled">> {
3
3
  }
4
4
  export interface IRulesProps extends IRegisterOptions {
@@ -8,6 +8,7 @@ export interface IRulesProps extends IRegisterOptions {
8
8
  interface IUseFormFieldValues extends IRegisterOptions {
9
9
  name?: string;
10
10
  pattern?: string;
11
+ ref?: RefCallBack;
11
12
  }
12
13
  export declare const useFormFieldValues: (controller?: UseControllerProps, props?: IRulesProps) => IUseFormFieldValues;
13
14
  export {};
@@ -40,6 +40,7 @@ const useFormFieldValues = (controller, props) => {
40
40
  value: field.value,
41
41
  onChange: field.onChange,
42
42
  onBlur: field.onBlur,
43
+ ref: field.ref,
43
44
  disabled: controller === null || controller === void 0 ? void 0 : controller.disabled,
44
45
  name: field.name,
45
46
  required: (0, getRuleValue_1.getRuleValue)((_a = controller === null || controller === void 0 ? void 0 : controller.rules) === null || _a === void 0 ? void 0 : _a.required),
@@ -0,0 +1,6 @@
1
+ import { Ref } from "react";
2
+ /**
3
+ * Merges two refs (e.g. the consumer ref and the one provided by React Hook Form).
4
+ * Without the second ref the first one is returned unchanged, so callers without a controller behave exactly as before.
5
+ */
6
+ export declare const useMergedRef: <T>(refA?: Ref<T>, refB?: Ref<T>) => Ref<T> | undefined;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMergedRef = void 0;
4
+ const react_1 = require("react");
5
+ const assignRef = (ref, node) => {
6
+ if (typeof ref === "function") {
7
+ return ref(node);
8
+ }
9
+ if (ref) {
10
+ ref.current = node;
11
+ }
12
+ return undefined;
13
+ };
14
+ const detachRef = (ref, cleanup) => {
15
+ if (typeof cleanup === "function") {
16
+ cleanup();
17
+ }
18
+ else {
19
+ assignRef(ref, null);
20
+ }
21
+ };
22
+ /**
23
+ * Merges two refs (e.g. the consumer ref and the one provided by React Hook Form).
24
+ * Without the second ref the first one is returned unchanged, so callers without a controller behave exactly as before.
25
+ */
26
+ const useMergedRef = (refA, refB) => {
27
+ const merged = (0, react_1.useCallback)((node) => {
28
+ const cleanupA = assignRef(refA, node);
29
+ const cleanupB = assignRef(refB, node);
30
+ return () => {
31
+ detachRef(refA, cleanupA);
32
+ detachRef(refB, cleanupB);
33
+ };
34
+ }, [refA, refB]);
35
+ return refB ? merged : refA;
36
+ };
37
+ exports.useMergedRef = useMergedRef;
@@ -78,6 +78,11 @@
78
78
  @heading-06-letter-spacing: 0;
79
79
  @heading-06-text-transformI: uppercase;
80
80
 
81
+ //data-xxxl
82
+ @data-xxxl-font-size: 42;
83
+ @data-xxxl-line-height: 52;
84
+ @data-xxxl-letter-spacing: 0;
85
+
81
86
  //data-01
82
87
  //data-xxl
83
88
  @data-01-font-size: 32;
@@ -338,6 +343,10 @@
338
343
  }
339
344
 
340
345
  // Data
346
+ .zen-data-xxxl {
347
+ .zen-font(@main-font-family, @data-xxxl-font-size, @data-xxxl-line-height, @data-xxxl-letter-spacing);
348
+ }
349
+
341
350
  .zen-data-xxl {
342
351
  .zen-font(@main-font-family, @data-01-font-size, @data-01-line-height);
343
352
  }
@@ -0,0 +1 @@
1
+ export * from "../datePickerCommon/hooks/useDateInputInner/dateInputInnerReducer";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // Kept so that deep imports of the old path keep working; the module moved to datePickerCommon in 3.17.1.
18
+ __exportStar(require("../datePickerCommon/hooks/useDateInputInner/dateInputInnerReducer"), exports);
@@ -0,0 +1 @@
1
+ export * from "../datePickerCommon/types/dateInputRaw";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // Kept so that deep imports of the old path keep working; the module moved to datePickerCommon in 3.17.1.
18
+ __exportStar(require("../datePickerCommon/types/dateInputRaw"), exports);
@@ -0,0 +1 @@
1
+ export * from "../datePickerCommon/types/dateRangeRaw";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // Kept so that deep imports of the old path keep working; the module moved to datePickerCommon in 3.17.1.
18
+ __exportStar(require("../datePickerCommon/types/dateRangeRaw"), exports);
@@ -0,0 +1 @@
1
+ export * from "../../datePickerCommon/utils/areMapsEqual";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // Kept so that deep imports of the old path keep working; the module moved to datePickerCommon in 3.17.1.
18
+ __exportStar(require("../../datePickerCommon/utils/areMapsEqual"), exports);
package/dist/index.css CHANGED
@@ -251,6 +251,19 @@ html:lang(ar) .zen-heading-06 {
251
251
  html:lang(ar) .zen-heading-xs-300 {
252
252
  font-family: "Noto Sans Arabic", Roboto, "Segoe UI", Segoe, "Helvetica Neue", Helvetica, sans-serif;
253
253
  }
254
+ .zen-data-xxxl {
255
+ font-family: Roboto, "Segoe UI", Segoe, "Helvetica Neue", Helvetica, sans-serif;
256
+ font-size: 2.625rem;
257
+ font-style: normal;
258
+ font-weight: 400;
259
+ letter-spacing: 0rem;
260
+ line-height: 3.25rem;
261
+ text-transform: none;
262
+ text-decoration: none;
263
+ }
264
+ html:lang(ar) .zen-data-xxxl {
265
+ font-family: "Noto Sans Arabic", Roboto, "Segoe UI", Segoe, "Helvetica Neue", Helvetica, sans-serif;
266
+ }
254
267
  .zen-data-xxl {
255
268
  font-family: Roboto, "Segoe UI", Segoe, "Helvetica Neue", Helvetica, sans-serif;
256
269
  font-size: 2rem;
@@ -12187,6 +12200,10 @@ html:lang(ar) .zen-scroll-drum__item {
12187
12200
  outline: 2px solid var(--borders-form-field--active);
12188
12201
  outline-offset: -2px;
12189
12202
  }
12203
+ .zen-chart > .zen-summary {
12204
+ padding-block-start: 0.1875rem;
12205
+ padding-inline-start: 0.0625rem;
12206
+ }
12190
12207
  .zen-chart__chart {
12191
12208
  flex: 1 1 100%;
12192
12209
  overflow: hidden;
@@ -12195,6 +12212,9 @@ html:lang(ar) .zen-scroll-drum__item {
12195
12212
  flex: 0 0 auto;
12196
12213
  padding-inline-start: 0.5rem;
12197
12214
  overflow: hidden;
12215
+ padding-block: 0.1875rem;
12216
+ padding-inline-end: 0.1875rem;
12217
+ margin-block-start: -0.1875rem;
12198
12218
  }
12199
12219
  .zen-chart__x-axis {
12200
12220
  flex: 0 0 auto;
@@ -12256,10 +12276,28 @@ html:lang(ar) .zen-chart__x-axis {
12256
12276
  }
12257
12277
  .zen-pie-legend__item {
12258
12278
  display: flex;
12279
+ }
12280
+ .zen-pie-legend__button {
12281
+ display: flex;
12282
+ flex: 1;
12259
12283
  gap: 0.5rem;
12260
12284
  align-items: flex-start;
12285
+ min-width: 0;
12286
+ margin: 0;
12287
+ padding: 0;
12288
+ border: 0;
12289
+ background: none;
12290
+ font: inherit;
12291
+ color: inherit;
12292
+ text-align: start;
12293
+ }
12294
+ button.zen-pie-legend__button {
12261
12295
  cursor: pointer;
12262
12296
  }
12297
+ .zen-pie-legend__button:focus-visible {
12298
+ outline: 1px solid var(--borders-form-field--active);
12299
+ outline-offset: 2px;
12300
+ }
12263
12301
  .zen-pie-legend__item-color {
12264
12302
  --color-box-size: 8px;
12265
12303
  display: inline-block;
@@ -12434,6 +12472,10 @@ button.zen-summary__clickable {
12434
12472
  padding: 0;
12435
12473
  outline: inherit;
12436
12474
  }
12475
+ button.zen-summary__clickable:focus-visible {
12476
+ outline: 1px solid var(--borders-form-field--active);
12477
+ outline-offset: 2px;
12478
+ }
12437
12479
  .zen-summary__clickable {
12438
12480
  cursor: pointer;
12439
12481
  }
@@ -12730,10 +12772,27 @@ html:lang(ar) .zen-chart-insight__text {
12730
12772
  }
12731
12773
  .zen-legend__item {
12732
12774
  display: flex;
12775
+ }
12776
+ .zen-legend__button {
12777
+ display: flex;
12733
12778
  gap: 4px;
12734
12779
  align-items: center;
12780
+ min-width: 0;
12781
+ margin: 0;
12782
+ padding: 0;
12783
+ border: 0;
12784
+ background: none;
12785
+ font: inherit;
12786
+ color: inherit;
12787
+ text-align: start;
12788
+ }
12789
+ button.zen-legend__button {
12735
12790
  cursor: pointer;
12736
12791
  }
12792
+ .zen-legend__button:focus-visible {
12793
+ outline: 1px solid var(--borders-form-field--active);
12794
+ outline-offset: 2px;
12795
+ }
12737
12796
  .zen-legend__item-color {
12738
12797
  --color-box-size: 8px;
12739
12798
  display: inline-block;
@@ -13751,6 +13810,50 @@ html:lang(ar) .zen-date-segment-input {
13751
13810
  height: 2.75rem;
13752
13811
  width: 2.75rem;
13753
13812
  }
13813
+ .zen-date-range-wrapper.zen-date-range-wrapper--chip {
13814
+ width: auto;
13815
+ align-items: stretch;
13816
+ box-sizing: border-box;
13817
+ height: 2rem;
13818
+ border: var(--border-width-default) solid var(--borders-general);
13819
+ border-radius: 0.5rem;
13820
+ box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.15);
13821
+ background: var(--backgrounds-main);
13822
+ overflow: hidden;
13823
+ }
13824
+ .zen-date-range-wrapper.zen-date-range-wrapper--chip.zen-date-range-wrapper--mobile,
13825
+ .zen-date-range-wrapper.zen-date-range-wrapper--chip.zen-date-range-wrapper--drive,
13826
+ .zen-date-range-wrapper.zen-date-range-wrapper--chip.zen-date-range-wrapper--drive-tablet {
13827
+ height: 2.5rem;
13828
+ }
13829
+ .zen-date-range-wrapper.zen-date-range-wrapper--chip:hover {
13830
+ border-color: var(--borders-form-field--hover);
13831
+ }
13832
+ .zen-date-range-wrapper.zen-date-range-wrapper--chip:has(:focus-visible) {
13833
+ outline: 1px solid var(--borders-form-field--active);
13834
+ outline-offset: 1px;
13835
+ }
13836
+ .zen-date-range-wrapper.zen-date-range-wrapper--chip .zen-chip {
13837
+ border: none;
13838
+ box-shadow: none;
13839
+ background: transparent;
13840
+ border-radius: 0;
13841
+ height: 100%;
13842
+ }
13843
+ .zen-date-range-wrapper.zen-date-range-wrapper--chip .zen-date-range__stepper {
13844
+ height: auto;
13845
+ align-self: stretch;
13846
+ width: 1.75rem;
13847
+ border: none;
13848
+ border-radius: 0;
13849
+ margin: 0;
13850
+ background: transparent;
13851
+ }
13852
+ .zen-date-range-wrapper.zen-date-range-wrapper--chip .zen-date-range__stepper:hover:not(:disabled),
13853
+ .zen-date-range-wrapper.zen-date-range-wrapper--chip .zen-date-range__stepper:focus {
13854
+ border: none;
13855
+ background-color: var(--backgrounds-hover);
13856
+ }
13754
13857
  .zen-date-range {
13755
13858
  box-sizing: border-box;
13756
13859
  }
@@ -18810,6 +18913,9 @@ html:lang(ar) .zen-side-panel-filters__title--mobile {
18810
18913
  .zen-side-panel-filters__item-element.zen-side-panel-filters__item-element:not(.zen-side-panel-filters__item-element--custom).zen-side-panel-filters__item-element--centred .zen-caption__content {
18811
18914
  margin: 0;
18812
18915
  }
18916
+ .zen-side-panel-filters__date-wrapper.zen-side-panel-filters__date-wrapper {
18917
+ width: 100%;
18918
+ }
18813
18919
  .zen-side-panel-filters__item-label {
18814
18920
  margin-block-end: 0.25rem;
18815
18921
  font-family: Roboto, "Segoe UI", Segoe, "Helvetica Neue", Helvetica, sans-serif;
@@ -20176,6 +20282,23 @@ html:lang(ar) .zen-mini-tabs {
20176
20282
  .zen-mini-tabs--xlarge .zen-mini-tabs__header-item {
20177
20283
  max-width: 12.5rem;
20178
20284
  }
20285
+ .zen-mini-tabs.zen-mini-tabs--fill {
20286
+ width: 100%;
20287
+ height: 100%;
20288
+ display: flex;
20289
+ flex-direction: column;
20290
+ }
20291
+ .zen-mini-tabs.zen-mini-tabs--fill > .zen-mini-tabs__content {
20292
+ flex: 1 1 auto;
20293
+ min-height: 0;
20294
+ display: flex;
20295
+ flex-direction: column;
20296
+ }
20297
+ .zen-mini-tabs.zen-mini-tabs--fill > .zen-mini-tabs__content > .zen-mini-tabs__content-wrapper {
20298
+ flex: 1 1 auto;
20299
+ min-height: 0;
20300
+ overflow: auto;
20301
+ }
20179
20302
  .zen-mini-tabs__header {
20180
20303
  width: 100%;
20181
20304
  display: flex;
@@ -18,6 +18,7 @@ export interface IMiniTabs {
18
18
  onTabChange: (newTabId: string) => void;
19
19
  className?: string;
20
20
  size?: MiniTabsSize;
21
+ fill?: boolean;
21
22
  children: React.ReactElement<typeof MiniTabsItem> | React.ReactElement<typeof MiniTabsItem>[];
22
23
  }
23
- export declare const MiniTabs: ({ activeTabId, onTabChange, children, size, className }: IMiniTabs) => import("react/jsx-runtime").JSX.Element;
24
+ export declare const MiniTabs: ({ activeTabId, onTabChange, children, size, className, fill }: IMiniTabs) => import("react/jsx-runtime").JSX.Element;
@@ -17,7 +17,7 @@ var MiniTabsSize;
17
17
  MiniTabsSize["Large"] = "large";
18
18
  MiniTabsSize["XLarge"] = "xlarge";
19
19
  })(MiniTabsSize || (exports.MiniTabsSize = MiniTabsSize = {}));
20
- const MiniTabs = ({ activeTabId, onTabChange, children, size = MiniTabsSize.Medium, className }) => {
20
+ const MiniTabs = ({ activeTabId, onTabChange, children, size = MiniTabsSize.Medium, className, fill = false }) => {
21
21
  const maxTabsValue = 3;
22
22
  const [tabs, setTabs] = (0, react_2.useState)([]);
23
23
  const activeButtonRef = (0, react_2.useRef)(null);
@@ -38,6 +38,6 @@ const MiniTabs = ({ activeTabId, onTabChange, children, size = MiniTabsSize.Medi
38
38
  var _a;
39
39
  (_a = activeButtonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
40
40
  }, [activeTabId]);
41
- return ((0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-mini-tabs", `zen-mini-tabs--${size}`, className ? className : ""]), children: tabs.length ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "zen-mini-tabs__header", role: "tablist", onKeyDown: keyDownHandler, ref: tabsRef, children: tabs.map(tab => ((0, jsx_runtime_1.jsx)(miniTabsHeaderItem_1.MiniTabsHeaderItem, { id: tab.id, isActive: activeTabId === tab.id, handleClick: handleTabItemClick, buttonRef: tab.id === activeTabId ? activeButtonRef : undefined, dataAnalyticsId: tab.dataAnalyticsId, children: tab.name }, tab.id))) }), (0, jsx_runtime_1.jsx)("div", { className: "zen-mini-tabs__content", children: tabs.map((props) => ((0, react_1.createElement)(miniTabsItem_1.MiniTabsItem, Object.assign({}, props, { key: props.id, activeId: activeTabId })))) })] })) : null }));
41
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-mini-tabs", `zen-mini-tabs--${size}`, fill ? "zen-mini-tabs--fill" : "", className ? className : ""]), children: tabs.length ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "zen-mini-tabs__header", role: "tablist", onKeyDown: keyDownHandler, ref: tabsRef, children: tabs.map(tab => ((0, jsx_runtime_1.jsx)(miniTabsHeaderItem_1.MiniTabsHeaderItem, { id: tab.id, isActive: activeTabId === tab.id, handleClick: handleTabItemClick, buttonRef: tab.id === activeTabId ? activeButtonRef : undefined, dataAnalyticsId: tab.dataAnalyticsId, children: tab.name }, tab.id))) }), (0, jsx_runtime_1.jsx)("div", { className: "zen-mini-tabs__content", children: tabs.map((props) => ((0, react_1.createElement)(miniTabsItem_1.MiniTabsItem, Object.assign({}, props, { key: props.id, activeId: activeTabId })))) })] })) : null }));
42
42
  };
43
43
  exports.MiniTabs = MiniTabs;
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MiniTabsItem = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const classNames_1 = require("../commonHelpers/classNames/classNames");
6
- const MiniTabsItem = ({ id, children, activeId }) => ((0, jsx_runtime_1.jsx)("div", { className: "zen-mini-tabs__content", children: (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-mini-tabs__content-wrapper", activeId !== id ? "zen-mini-tabs__content-wrapper--hidden" : ""]), role: "tabpanel", "aria-labelledby": id, tabIndex: 0, id: `panel-${id}`, hidden: activeId && activeId !== id ? true : false, children: children }) }));
6
+ const MiniTabsItem = ({ id, children, activeId }) => ((0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-mini-tabs__content-wrapper", activeId !== id ? "zen-mini-tabs__content-wrapper--hidden" : ""]), role: "tabpanel", "aria-labelledby": id, tabIndex: 0, id: `panel-${id}`, hidden: activeId && activeId !== id ? true : false, children: children }));
7
7
  exports.MiniTabsItem = MiniTabsItem;
@@ -93,6 +93,7 @@ const reviewTextControl_1 = require("../formGroup/components/reviewTextControl")
93
93
  const useFormFieldValues_1 = require("../commonHelpers/hooks/useFormFieldValues/useFormFieldValues");
94
94
  const useMobile_1 = require("../commonHelpers/hooks/useMobile");
95
95
  const useMobileClassName_1 = require("../utils/theme/useMobileClassName");
96
+ const useMergedRef_1 = require("../commonHelpers/hooks/useMergedRef");
96
97
  // according to design
97
98
  exports.INPUT_DEFAULT_WIDTH = 47;
98
99
  exports.INPUT_DEFAULT_WIDTH_DRIVE = 56;
@@ -126,7 +127,8 @@ const StepperRaw = props => {
126
127
  min = -Infinity,
127
128
  max = Infinity,
128
129
  maxLength,
129
- disabled
130
+ disabled,
131
+ ref: fieldRef
130
132
  } = (0, useFormFieldValues_1.useFormFieldValues)(props.controller, props);
131
133
  const isErrorShown = !disabled && !readonly && isError;
132
134
  const validValue = (0, getValidValue_1.getValidValue)(value, min, max);
@@ -147,6 +149,7 @@ const StepperRaw = props => {
147
149
  } = (0, useLanguage_1.useLanguage)();
148
150
  const localRef = (0, react_1.useRef)(null);
149
151
  const currRef = props.ref || localRef;
152
+ const inputRef = (0, useMergedRef_1.useMergedRef)(currRef, fieldRef);
150
153
  if (isReadOnly) {
151
154
  return (0, jsx_runtime_1.jsx)(reviewTextControl_1.ReviewTextControl, {
152
155
  value: String(value)
@@ -158,7 +161,7 @@ const StepperRaw = props => {
158
161
  className: "zen-stepper-field__input-wrapper",
159
162
  children: [(0, jsx_runtime_1.jsx)("input", {
160
163
  id: id,
161
- ref: currRef,
164
+ ref: inputRef,
162
165
  min: min,
163
166
  max: max,
164
167
  value: validValue,
@@ -8,14 +8,16 @@ const reviewTextControl_1 = require("../formGroup/components/reviewTextControl")
8
8
  const useFormFieldValues_1 = require("../commonHelpers/hooks/useFormFieldValues/useFormFieldValues");
9
9
  const useMobileClassName_1 = require("../utils/theme/useMobileClassName");
10
10
  const getAriaAttributes_1 = require("../commonHelpers/getAriaAttributes");
11
+ const useMergedRef_1 = require("../commonHelpers/hooks/useMergedRef");
11
12
  const TextInputRaw = (props) => {
12
13
  const driveComponentClass = (0, useDriveClassName_1.useDriveClassName)("zen-text-input");
13
14
  const mobileComponentClass = (0, useMobileClassName_1.useMobileClassName)("zen-text-input");
14
- const { required, min, max, maxLength, minLength, value = "", onChange, onBlur, disabled, name, pattern } = (0, useFormFieldValues_1.useFormFieldValues)(props.controller, props);
15
+ const { required, min, max, maxLength, minLength, value = "", onChange, onBlur, disabled, name, pattern, ref: fieldRef } = (0, useFormFieldValues_1.useFormFieldValues)(props.controller, props);
16
+ const inputRef = (0, useMergedRef_1.useMergedRef)(props.ref, fieldRef);
15
17
  if (props.isReadOnly) {
16
18
  return (0, jsx_runtime_1.jsx)(reviewTextControl_1.ReviewTextControl, { value: value, password: props.type === "password" });
17
19
  }
18
- return ((0, jsx_runtime_1.jsx)("input", Object.assign({ id: props.id, ref: props.ref, type: props.type || "text", className: (0, classNames_1.classNames)([
20
+ return ((0, jsx_runtime_1.jsx)("input", Object.assign({ id: props.id, ref: inputRef, type: props.type || "text", className: (0, classNames_1.classNames)([
19
21
  "zen-text-input",
20
22
  mobileComponentClass || driveComponentClass || "",
21
23
  props.className || "",
@@ -6,14 +6,16 @@ const classNames_1 = require("../commonHelpers/classNames/classNames");
6
6
  const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
7
7
  const useFormFieldValues_1 = require("../commonHelpers/hooks/useFormFieldValues/useFormFieldValues");
8
8
  const reviewTextControl_1 = require("../formGroup/components/reviewTextControl");
9
+ const useMergedRef_1 = require("../commonHelpers/hooks/useMergedRef");
9
10
  const TextareaRaw = (props) => {
10
11
  const driveComponentClass = (0, useDriveClassName_1.useDriveClassName)("zen-text-input");
11
12
  const { id, rows = 6, className = "", resize = true, readonly = false, placeholder, isError, ariaLabel, ariaLabelledby, onKeyDown, onFocus, isReadOnly, ref } = props;
12
- const { maxLength, minLength, value = "", onChange, onBlur, disabled, name, required } = (0, useFormFieldValues_1.useFormFieldValues)(props.controller, props);
13
+ const { maxLength, minLength, value = "", onChange, onBlur, disabled, name, required, ref: fieldRef } = (0, useFormFieldValues_1.useFormFieldValues)(props.controller, props);
14
+ const textareaRef = (0, useMergedRef_1.useMergedRef)(ref, fieldRef);
13
15
  if (isReadOnly) {
14
16
  return (0, jsx_runtime_1.jsx)(reviewTextControl_1.ReviewTextControl, { value: value });
15
17
  }
16
- return ((0, jsx_runtime_1.jsx)("textarea", { ref: ref, id: id, rows: rows, minLength: minLength, maxLength: maxLength, className: (0, classNames_1.classNames)([
18
+ return ((0, jsx_runtime_1.jsx)("textarea", { ref: textareaRef, id: id, rows: rows, minLength: minLength, maxLength: maxLength, className: (0, classNames_1.classNames)([
17
19
  "zen-textarea",
18
20
  resize ? "" : "zen-textarea--no-resize",
19
21
  driveComponentClass || "",
@@ -0,0 +1 @@
1
+ export * from "../../datePickerCommon/hooks/useDateInputInner/useTodayButton";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // Kept so that deep imports of the old path keep working; the module moved to datePickerCommon in 3.17.1.
18
+ __exportStar(require("../../datePickerCommon/hooks/useDateInputInner/useTodayButton"), exports);
@@ -1,6 +1,7 @@
1
1
  import { zen } from "../../utils/zen";
2
2
  import { getPieLegendItems } from "./getPieLegendItems";
3
3
  import { renderPieLegend } from "./renderPieLegend";
4
+ import { getFocusedLegendIndex, restoreLegendFocus } from "../plugins/legend/legendFocus";
4
5
  export const pieLegendPlugin = (containerId, options, isDrive, rawData, isHidden, toggleHidden) => ({
5
6
  id: "zenithPieLegend",
6
7
  isDrive,
@@ -34,8 +35,10 @@ export const pieLegendPlugin = (containerId, options, isDrive, rawData, isHidden
34
35
  barWidth: hidden ? 0 : total > 0 ? (rawValues[item.index] / total) * 100 : 0
35
36
  }));
36
37
  });
38
+ const focusedIndex = getFocusedLegendIndex(container);
37
39
  container.innerHTML = "";
38
40
  container.classList.remove("zen-legend--hidden");
39
41
  renderPieLegend(container, isDrive, items, options);
42
+ restoreLegendFocus(container, focusedIndex);
40
43
  }
41
44
  });
@@ -16,8 +16,7 @@ export const renderPieLegend = (element, isDrive, items, options) => {
16
16
  <div class="zen-pie-legend__item-bar" data-bar-width="${(_a = item.barWidth) !== null && _a !== void 0 ? _a : 0}"></div>
17
17
  </div>`
18
18
  : "";
19
- return `<li class="zen-pie-legend__item" data-index="${item.index}">
20
- <span class="zen-pie-legend__item-color"></span>
19
+ const content = `<span class="zen-pie-legend__item-color"></span>
21
20
  <div class="zen-pie-legend__item-content">
22
21
  <div class="zen-pie-legend__item-row">
23
22
  <p class="${labelClass}">${htmlEscape(item.text)}</p>
@@ -25,8 +24,11 @@ export const renderPieLegend = (element, isDrive, items, options) => {
25
24
  ${percentageHtml}
26
25
  </div>
27
26
  ${barHtml}
28
- </div>
29
- </li>`;
27
+ </div>`;
28
+ const control = item.onClick
29
+ ? `<button type="button" class="zen-pie-legend__button" aria-pressed="${!item.hidden}">${content}</button>`
30
+ : `<span class="zen-pie-legend__button">${content}</span>`;
31
+ return `<li class="zen-pie-legend__item" data-index="${item.index}">${control}</li>`;
30
32
  })
31
33
  .join("");
32
34
  element.innerHTML = `<ul class="${classes}">${listItems}</ul>`;
@@ -0,0 +1,2 @@
1
+ export declare const getFocusedLegendIndex: (container: HTMLElement) => string | undefined;
2
+ export declare const restoreLegendFocus: (container: HTMLElement, index: string | undefined) => void;
@@ -0,0 +1,15 @@
1
+ export const getFocusedLegendIndex = (container) => {
2
+ var _a, _b;
3
+ const active = container.ownerDocument.activeElement;
4
+ if (!active || !container.contains(active)) {
5
+ return undefined;
6
+ }
7
+ return (_b = (_a = active.closest("[data-index]")) === null || _a === void 0 ? void 0 : _a.getAttribute("data-index")) !== null && _b !== void 0 ? _b : undefined;
8
+ };
9
+ export const restoreLegendFocus = (container, index) => {
10
+ var _a;
11
+ if (index === undefined) {
12
+ return;
13
+ }
14
+ (_a = container.querySelector(`[data-index="${index}"] button`)) === null || _a === void 0 ? void 0 : _a.focus();
15
+ };
@@ -1,4 +1,5 @@
1
1
  import { renderLegend } from "./renderLegend";
2
+ import { getFocusedLegendIndex, restoreLegendFocus } from "./legendFocus";
2
3
  import { getLineLegendItems } from "../../lineChart/getLineLegendItems";
3
4
  import { getBarLegendItems } from "../../barChart/getBarLegendItems";
4
5
  import { getPieLegendItems } from "../../pieChart/getPieLegendItems";
@@ -17,6 +18,7 @@ export const legendPlugin = (containerId, options, isDrive, isHidden, toggleHidd
17
18
  container.classList.add("zen-legend--hidden");
18
19
  return;
19
20
  }
21
+ const focusedIndex = getFocusedLegendIndex(container);
20
22
  container.innerHTML = "";
21
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
24
  const chartType = chart.config.type;
@@ -43,5 +45,6 @@ export const legendPlugin = (containerId, options, isDrive, isHidden, toggleHidd
43
45
  }
44
46
  container.classList.remove("zen-legend--hidden");
45
47
  renderLegend(container, this.isDrive, items);
48
+ restoreLegendFocus(container, focusedIndex);
46
49
  }
47
50
  });
@@ -3,13 +3,17 @@ import { htmlEscape } from "../../../utils/escapeHtml";
3
3
  export const renderLegend = (element, isDrive, items) => {
4
4
  const classes = classNames(["zen-legend", isDrive ? "zen-legend--drive" : ""]);
5
5
  const listItems = items
6
- .map((item, index) => `<li class="zen-legend__item" data-index="${index}">
7
- <span class="zen-legend__item-color" style="background-color: ${item.color};"></span>
6
+ .map((item, index) => {
7
+ const content = `<span class="zen-legend__item-color" style="background-color: ${item.color};"></span>
8
8
  <p class="${classNames(["zen-legend__item-label", item.hidden ? "zen-legend__item-label--hidden" : ""])}">${htmlEscape(item.text)}</p>
9
9
  ${item.value !== undefined
10
- ? `<p class="${classNames(["zen-legend__item-value", item.hidden ? "zen-legend__item-value--hidden" : ""])}">${htmlEscape(item.value)}</p>`
11
- : ""}
12
- </li>`)
10
+ ? `<p class="${classNames(["zen-legend__item-value", item.hidden ? "zen-legend__item-value--hidden" : ""])}">${htmlEscape(item.value)}</p>`
11
+ : ""}`;
12
+ const control = item.onClick
13
+ ? `<button type="button" class="zen-legend__button" aria-pressed="${!item.hidden}">${content}</button>`
14
+ : `<span class="zen-legend__button">${content}</span>`;
15
+ return `<li class="zen-legend__item" data-index="${index}">${control}</li>`;
16
+ })
13
17
  .join("");
14
18
  element.innerHTML = `<ul class='${classes}'>${listItems}</ul>`;
15
19
  const itemElements = element.querySelectorAll(".zen-legend__item");
@@ -1,4 +1,4 @@
1
- import { RegisterOptions, UseControllerProps } from "react-hook-form";
1
+ import { RefCallBack, RegisterOptions, UseControllerProps } from "react-hook-form";
2
2
  interface IRegisterOptions extends Partial<Pick<RegisterOptions, "required" | "min" | "max" | "maxLength" | "minLength" | "value" | "onChange" | "onBlur" | "disabled">> {
3
3
  }
4
4
  export interface IRulesProps extends IRegisterOptions {
@@ -8,6 +8,7 @@ export interface IRulesProps extends IRegisterOptions {
8
8
  interface IUseFormFieldValues extends IRegisterOptions {
9
9
  name?: string;
10
10
  pattern?: string;
11
+ ref?: RefCallBack;
11
12
  }
12
13
  export declare const useFormFieldValues: (controller?: UseControllerProps, props?: IRulesProps) => IUseFormFieldValues;
13
14
  export {};
@@ -37,6 +37,7 @@ export const useFormFieldValues = (controller, props) => {
37
37
  value: field.value,
38
38
  onChange: field.onChange,
39
39
  onBlur: field.onBlur,
40
+ ref: field.ref,
40
41
  disabled: controller === null || controller === void 0 ? void 0 : controller.disabled,
41
42
  name: field.name,
42
43
  required: getRuleValue((_a = controller === null || controller === void 0 ? void 0 : controller.rules) === null || _a === void 0 ? void 0 : _a.required),
@@ -0,0 +1,6 @@
1
+ import { Ref } from "react";
2
+ /**
3
+ * Merges two refs (e.g. the consumer ref and the one provided by React Hook Form).
4
+ * Without the second ref the first one is returned unchanged, so callers without a controller behave exactly as before.
5
+ */
6
+ export declare const useMergedRef: <T>(refA?: Ref<T>, refB?: Ref<T>) => Ref<T> | undefined;
@@ -0,0 +1,33 @@
1
+ import { useCallback } from "react";
2
+ const assignRef = (ref, node) => {
3
+ if (typeof ref === "function") {
4
+ return ref(node);
5
+ }
6
+ if (ref) {
7
+ ref.current = node;
8
+ }
9
+ return undefined;
10
+ };
11
+ const detachRef = (ref, cleanup) => {
12
+ if (typeof cleanup === "function") {
13
+ cleanup();
14
+ }
15
+ else {
16
+ assignRef(ref, null);
17
+ }
18
+ };
19
+ /**
20
+ * Merges two refs (e.g. the consumer ref and the one provided by React Hook Form).
21
+ * Without the second ref the first one is returned unchanged, so callers without a controller behave exactly as before.
22
+ */
23
+ export const useMergedRef = (refA, refB) => {
24
+ const merged = useCallback((node) => {
25
+ const cleanupA = assignRef(refA, node);
26
+ const cleanupB = assignRef(refB, node);
27
+ return () => {
28
+ detachRef(refA, cleanupA);
29
+ detachRef(refB, cleanupB);
30
+ };
31
+ }, [refA, refB]);
32
+ return refB ? merged : refA;
33
+ };
@@ -0,0 +1 @@
1
+ export * from "../datePickerCommon/hooks/useDateInputInner/dateInputInnerReducer";
@@ -0,0 +1,2 @@
1
+ // Kept so that deep imports of the old path keep working; the module moved to datePickerCommon in 3.17.1.
2
+ export * from "../datePickerCommon/hooks/useDateInputInner/dateInputInnerReducer";
@@ -0,0 +1 @@
1
+ export * from "../datePickerCommon/types/dateInputRaw";
@@ -0,0 +1,2 @@
1
+ // Kept so that deep imports of the old path keep working; the module moved to datePickerCommon in 3.17.1.
2
+ export * from "../datePickerCommon/types/dateInputRaw";
@@ -0,0 +1 @@
1
+ export * from "../datePickerCommon/types/dateRangeRaw";
@@ -0,0 +1,2 @@
1
+ // Kept so that deep imports of the old path keep working; the module moved to datePickerCommon in 3.17.1.
2
+ export * from "../datePickerCommon/types/dateRangeRaw";
@@ -0,0 +1 @@
1
+ export * from "../../datePickerCommon/utils/areMapsEqual";
@@ -0,0 +1,2 @@
1
+ // Kept so that deep imports of the old path keep working; the module moved to datePickerCommon in 3.17.1.
2
+ export * from "../../datePickerCommon/utils/areMapsEqual";
@@ -18,6 +18,7 @@ export interface IMiniTabs {
18
18
  onTabChange: (newTabId: string) => void;
19
19
  className?: string;
20
20
  size?: MiniTabsSize;
21
+ fill?: boolean;
21
22
  children: React.ReactElement<typeof MiniTabsItem> | React.ReactElement<typeof MiniTabsItem>[];
22
23
  }
23
- export declare const MiniTabs: ({ activeTabId, onTabChange, children, size, className }: IMiniTabs) => import("react/jsx-runtime").JSX.Element;
24
+ export declare const MiniTabs: ({ activeTabId, onTabChange, children, size, className, fill }: IMiniTabs) => import("react/jsx-runtime").JSX.Element;
@@ -14,7 +14,7 @@ export var MiniTabsSize;
14
14
  MiniTabsSize["Large"] = "large";
15
15
  MiniTabsSize["XLarge"] = "xlarge";
16
16
  })(MiniTabsSize || (MiniTabsSize = {}));
17
- export const MiniTabs = ({ activeTabId, onTabChange, children, size = MiniTabsSize.Medium, className }) => {
17
+ export const MiniTabs = ({ activeTabId, onTabChange, children, size = MiniTabsSize.Medium, className, fill = false }) => {
18
18
  const maxTabsValue = 3;
19
19
  const [tabs, setTabs] = useState([]);
20
20
  const activeButtonRef = useRef(null);
@@ -35,5 +35,5 @@ export const MiniTabs = ({ activeTabId, onTabChange, children, size = MiniTabsSi
35
35
  var _a;
36
36
  (_a = activeButtonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
37
37
  }, [activeTabId]);
38
- return (_jsx("div", { className: classNames(["zen-mini-tabs", `zen-mini-tabs--${size}`, className ? className : ""]), children: tabs.length ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "zen-mini-tabs__header", role: "tablist", onKeyDown: keyDownHandler, ref: tabsRef, children: tabs.map(tab => (_jsx(MiniTabsHeaderItem, { id: tab.id, isActive: activeTabId === tab.id, handleClick: handleTabItemClick, buttonRef: tab.id === activeTabId ? activeButtonRef : undefined, dataAnalyticsId: tab.dataAnalyticsId, children: tab.name }, tab.id))) }), _jsx("div", { className: "zen-mini-tabs__content", children: tabs.map((props) => (_createElement(MiniTabsItem, Object.assign({}, props, { key: props.id, activeId: activeTabId })))) })] })) : null }));
38
+ return (_jsx("div", { className: classNames(["zen-mini-tabs", `zen-mini-tabs--${size}`, fill ? "zen-mini-tabs--fill" : "", className ? className : ""]), children: tabs.length ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "zen-mini-tabs__header", role: "tablist", onKeyDown: keyDownHandler, ref: tabsRef, children: tabs.map(tab => (_jsx(MiniTabsHeaderItem, { id: tab.id, isActive: activeTabId === tab.id, handleClick: handleTabItemClick, buttonRef: tab.id === activeTabId ? activeButtonRef : undefined, dataAnalyticsId: tab.dataAnalyticsId, children: tab.name }, tab.id))) }), _jsx("div", { className: "zen-mini-tabs__content", children: tabs.map((props) => (_createElement(MiniTabsItem, Object.assign({}, props, { key: props.id, activeId: activeTabId })))) })] })) : null }));
39
39
  };
@@ -1,3 +1,3 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { classNames } from "../commonHelpers/classNames/classNames";
3
- export const MiniTabsItem = ({ id, children, activeId }) => (_jsx("div", { className: "zen-mini-tabs__content", children: _jsx("div", { className: classNames(["zen-mini-tabs__content-wrapper", activeId !== id ? "zen-mini-tabs__content-wrapper--hidden" : ""]), role: "tabpanel", "aria-labelledby": id, tabIndex: 0, id: `panel-${id}`, hidden: activeId && activeId !== id ? true : false, children: children }) }));
3
+ export const MiniTabsItem = ({ id, children, activeId }) => (_jsx("div", { className: classNames(["zen-mini-tabs__content-wrapper", activeId !== id ? "zen-mini-tabs__content-wrapper--hidden" : ""]), role: "tabpanel", "aria-labelledby": id, tabIndex: 0, id: `panel-${id}`, hidden: activeId && activeId !== id ? true : false, children: children }));
@@ -19,6 +19,7 @@ import { ReviewTextControl } from "../formGroup/components/reviewTextControl";
19
19
  import { useFormFieldValues } from "../commonHelpers/hooks/useFormFieldValues/useFormFieldValues";
20
20
  import { useMobile } from "../commonHelpers/hooks/useMobile";
21
21
  import { useMobileClassName } from "../utils/theme/useMobileClassName";
22
+ import { useMergedRef } from "../commonHelpers/hooks/useMergedRef";
22
23
  // according to design
23
24
  injectString("cs", "Increase value", "Zv\xFD\u0161it hodnotu");
24
25
  injectString("da-DK", "Increase value", "For\xF8g v\xE6rdi");
@@ -118,7 +119,8 @@ export const StepperRaw = props => {
118
119
  min = -Infinity,
119
120
  max = Infinity,
120
121
  maxLength,
121
- disabled
122
+ disabled,
123
+ ref: fieldRef
122
124
  } = useFormFieldValues(props.controller, props);
123
125
  const isErrorShown = !disabled && !readonly && isError;
124
126
  const validValue = getValidValue(value, min, max);
@@ -139,6 +141,7 @@ export const StepperRaw = props => {
139
141
  } = useLanguage();
140
142
  const localRef = useRef(null);
141
143
  const currRef = props.ref || localRef;
144
+ const inputRef = useMergedRef(currRef, fieldRef);
142
145
  if (isReadOnly) {
143
146
  return _jsx(ReviewTextControl, {
144
147
  value: String(value)
@@ -150,7 +153,7 @@ export const StepperRaw = props => {
150
153
  className: "zen-stepper-field__input-wrapper",
151
154
  children: [_jsx("input", {
152
155
  id: id,
153
- ref: currRef,
156
+ ref: inputRef,
154
157
  min: min,
155
158
  max: max,
156
159
  value: validValue,
@@ -5,14 +5,16 @@ import { ReviewTextControl } from "../formGroup/components/reviewTextControl";
5
5
  import { useFormFieldValues } from "../commonHelpers/hooks/useFormFieldValues/useFormFieldValues";
6
6
  import { useMobileClassName } from "../utils/theme/useMobileClassName";
7
7
  import { getAriaAttributes } from "../commonHelpers/getAriaAttributes";
8
+ import { useMergedRef } from "../commonHelpers/hooks/useMergedRef";
8
9
  export const TextInputRaw = (props) => {
9
10
  const driveComponentClass = useDriveClassName("zen-text-input");
10
11
  const mobileComponentClass = useMobileClassName("zen-text-input");
11
- const { required, min, max, maxLength, minLength, value = "", onChange, onBlur, disabled, name, pattern } = useFormFieldValues(props.controller, props);
12
+ const { required, min, max, maxLength, minLength, value = "", onChange, onBlur, disabled, name, pattern, ref: fieldRef } = useFormFieldValues(props.controller, props);
13
+ const inputRef = useMergedRef(props.ref, fieldRef);
12
14
  if (props.isReadOnly) {
13
15
  return _jsx(ReviewTextControl, { value: value, password: props.type === "password" });
14
16
  }
15
- return (_jsx("input", Object.assign({ id: props.id, ref: props.ref, type: props.type || "text", className: classNames([
17
+ return (_jsx("input", Object.assign({ id: props.id, ref: inputRef, type: props.type || "text", className: classNames([
16
18
  "zen-text-input",
17
19
  mobileComponentClass || driveComponentClass || "",
18
20
  props.className || "",
@@ -3,14 +3,16 @@ import { classNames } from "../commonHelpers/classNames/classNames";
3
3
  import { useDriveClassName } from "../utils/theme/useDriveClassName";
4
4
  import { useFormFieldValues } from "../commonHelpers/hooks/useFormFieldValues/useFormFieldValues";
5
5
  import { ReviewTextControl } from "../formGroup/components/reviewTextControl";
6
+ import { useMergedRef } from "../commonHelpers/hooks/useMergedRef";
6
7
  export const TextareaRaw = (props) => {
7
8
  const driveComponentClass = useDriveClassName("zen-text-input");
8
9
  const { id, rows = 6, className = "", resize = true, readonly = false, placeholder, isError, ariaLabel, ariaLabelledby, onKeyDown, onFocus, isReadOnly, ref } = props;
9
- const { maxLength, minLength, value = "", onChange, onBlur, disabled, name, required } = useFormFieldValues(props.controller, props);
10
+ const { maxLength, minLength, value = "", onChange, onBlur, disabled, name, required, ref: fieldRef } = useFormFieldValues(props.controller, props);
11
+ const textareaRef = useMergedRef(ref, fieldRef);
10
12
  if (isReadOnly) {
11
13
  return _jsx(ReviewTextControl, { value: value });
12
14
  }
13
- return (_jsx("textarea", { ref: ref, id: id, rows: rows, minLength: minLength, maxLength: maxLength, className: classNames([
15
+ return (_jsx("textarea", { ref: textareaRef, id: id, rows: rows, minLength: minLength, maxLength: maxLength, className: classNames([
14
16
  "zen-textarea",
15
17
  resize ? "" : "zen-textarea--no-resize",
16
18
  driveComponentClass || "",
@@ -0,0 +1 @@
1
+ export * from "../../datePickerCommon/hooks/useDateInputInner/useTodayButton";
@@ -0,0 +1,2 @@
1
+ // Kept so that deep imports of the old path keep working; the module moved to datePickerCommon in 3.17.1.
2
+ export * from "../../datePickerCommon/hooks/useDateInputInner/useTodayButton";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geotab/zenith",
3
- "version": "3.17.1",
3
+ "version": "3.18.0-beta.0",
4
4
  "description": "Zenith components library on React",
5
5
  "main": "dist/index.js",
6
6
  "types": "esm/index.d.ts",
@@ -29,6 +29,7 @@
29
29
  "inject-translations": "node build-utils/translations/inject-translations.js",
30
30
  "lint": "npx eslint",
31
31
  "lint-fix": "npm run lint -- --fix",
32
+ "myg-integration": "bash myg-integration.sh",
32
33
  "new": "node newComponent.mjs",
33
34
  "prettier": "npx prettier . --config '.prettierrc' --ignore-path '.prettierignore'",
34
35
  "prettier-check": "npm run prettier -- --check",
@@ -42,6 +43,9 @@
42
43
  "vrt-test": "playwright test --config visual-regression/playwright.config.ts --update-snapshots=missing",
43
44
  "vrt-update": "playwright test --config visual-regression/playwright.config.ts --update-snapshots",
44
45
  "vrt-report": "playwright show-report visual-regression-report",
46
+ "vrt-rtl-test": "playwright test --config visual-regression/rtl/playwright.config.ts --update-snapshots=missing",
47
+ "vrt-rtl-update": "playwright test --config visual-regression/rtl/playwright.config.ts --update-snapshots",
48
+ "vrt-rtl-report": "playwright show-report visual-regression-rtl-report",
45
49
  "test-watch": "npm run clean && npm run test-build && npx tsc -b tsconfig.jestTests.json -w",
46
50
  "check-duplicates": "node build-utils/check-duplicates.mjs",
47
51
  "translations": "node build-utils/translations/translation-integrity.mjs",
@@ -156,5 +160,8 @@
156
160
  "minimatch@<9": {
157
161
  "brace-expansion": "^1.1.18"
158
162
  }
163
+ },
164
+ "publishConfig": {
165
+ "access": "public"
159
166
  }
160
167
  }