@geotab/zenith 3.17.1-beta.3 → 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 (68) 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/datePickerCommon/hooks/useDateRangeRaw/useDateRangeRawCore.d.ts +7 -1
  18. package/dist/datePickerCommon/hooks/useDateRangeRaw/useDateRangeRawCore.js +5 -5
  19. package/dist/dateRangeRaw/types.d.ts +1 -0
  20. package/dist/dateRangeRaw/types.js +18 -0
  21. package/dist/dateRangeRaw/utils/areMapsEqual.d.ts +1 -0
  22. package/dist/dateRangeRaw/utils/areMapsEqual.js +18 -0
  23. package/dist/dateRangeRawNew/hooks/useDateRangeNewParts.d.ts +7 -1
  24. package/dist/dateRangeRawNew/hooks/useDateRangeNewParts.js +24 -15
  25. package/dist/dateRangeRawNew/hooks/useDateRangeRawNew.js +2 -2
  26. package/dist/dateRangeRawNew/hooks/useRangeEntry.js +31 -4
  27. package/dist/index.css +123 -0
  28. package/dist/miniTabs/miniTabs.d.ts +2 -1
  29. package/dist/miniTabs/miniTabs.js +2 -2
  30. package/dist/miniTabs/miniTabsItem.js +1 -1
  31. package/dist/stepperRaw/stepperRaw.js +5 -2
  32. package/dist/textInputRaw/textInputRaw.js +4 -2
  33. package/dist/textareaRaw/textareaRaw.js +4 -2
  34. package/dist/utils/dateInputUtils/useTodayButton.d.ts +1 -0
  35. package/dist/utils/dateInputUtils/useTodayButton.js +18 -0
  36. package/esm/chart/pieChart/pieLegendPlugin.js +3 -0
  37. package/esm/chart/pieChart/renderPieLegend.js +6 -4
  38. package/esm/chart/plugins/legend/legendFocus.d.ts +2 -0
  39. package/esm/chart/plugins/legend/legendFocus.js +15 -0
  40. package/esm/chart/plugins/legend/legendPlugin.js +3 -0
  41. package/esm/chart/plugins/legend/renderLegend.js +9 -5
  42. package/esm/commonHelpers/hooks/useFormFieldValues/useFormFieldValues.d.ts +2 -1
  43. package/esm/commonHelpers/hooks/useFormFieldValues/useFormFieldValues.js +1 -0
  44. package/esm/commonHelpers/hooks/useMergedRef.d.ts +6 -0
  45. package/esm/commonHelpers/hooks/useMergedRef.js +33 -0
  46. package/esm/dateInputInner/dateInputInnerReducer.d.ts +1 -0
  47. package/esm/dateInputInner/dateInputInnerReducer.js +2 -0
  48. package/esm/dateInputRaw/types.d.ts +1 -0
  49. package/esm/dateInputRaw/types.js +2 -0
  50. package/esm/datePickerCommon/hooks/useDateRangeRaw/useDateRangeRawCore.d.ts +7 -1
  51. package/esm/datePickerCommon/hooks/useDateRangeRaw/useDateRangeRawCore.js +5 -5
  52. package/esm/dateRangeRaw/types.d.ts +1 -0
  53. package/esm/dateRangeRaw/types.js +2 -0
  54. package/esm/dateRangeRaw/utils/areMapsEqual.d.ts +1 -0
  55. package/esm/dateRangeRaw/utils/areMapsEqual.js +2 -0
  56. package/esm/dateRangeRawNew/hooks/useDateRangeNewParts.d.ts +7 -1
  57. package/esm/dateRangeRawNew/hooks/useDateRangeNewParts.js +24 -15
  58. package/esm/dateRangeRawNew/hooks/useDateRangeRawNew.js +2 -2
  59. package/esm/dateRangeRawNew/hooks/useRangeEntry.js +31 -4
  60. package/esm/miniTabs/miniTabs.d.ts +2 -1
  61. package/esm/miniTabs/miniTabs.js +2 -2
  62. package/esm/miniTabs/miniTabsItem.js +1 -1
  63. package/esm/stepperRaw/stepperRaw.js +5 -2
  64. package/esm/textInputRaw/textInputRaw.js +4 -2
  65. package/esm/textareaRaw/textareaRaw.js +4 -2
  66. package/esm/utils/dateInputUtils/useTodayButton.d.ts +1 -0
  67. package/esm/utils/dateInputUtils/useTodayButton.js +2 -0
  68. package/package.json +8 -1
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";
@@ -60,7 +60,13 @@ export declare const useDateRangeRawCore: (props: TWithDefaultOptions<TDateRange
60
60
  datesValidation: (val: any) => boolean;
61
61
  isDatesValid: import("react").RefObject<boolean>;
62
62
  previousStepOption: import("react").RefObject<string>;
63
- handleDateRangeSelection: (newVal: string) => void;
63
+ handleDateRangeSelection: (newVal: string, transformRange?: (range: {
64
+ from: Date;
65
+ to: Date;
66
+ }) => {
67
+ from: Date;
68
+ to: Date;
69
+ }) => void;
64
70
  handleApplyClick: () => void;
65
71
  handleCancelClick: () => void;
66
72
  handleClearClick: () => void;
@@ -211,12 +211,12 @@ export const useDateRangeRawCore = (props, behavior) => {
211
211
  }, [isOpen, isStaleCustomDraft, prevSelection]);
212
212
  const handleDateRangeSelection = useCallback(
213
213
  // eslint-disable-next-line complexity
214
- newVal => {
215
- var _a, _b;
214
+ (newVal, transformRange) => {
215
+ var _a, _b, _c;
216
216
  const selection = options.find(option => option.id === newVal);
217
217
  newVal === CUSTOM_CALENDAR_ID && setShowMobileCalendar(true);
218
218
  if (selection && newVal !== CUSTOM_CALENDAR_ID && selection.getRange) {
219
- const range = selection.getRange();
219
+ const range = (_a = transformRange === null || transformRange === void 0 ? void 0 : transformRange(selection.getRange())) !== null && _a !== void 0 ? _a : selection.getRange();
220
220
  const normalizedDates = normalizeDates(range.from.toISOString(), range.to.toISOString(), disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter);
221
221
  const newRange = newVal === CUSTOM_CALENDAR_ID ? {
222
222
  from: new Date(normalizedDates.from),
@@ -234,8 +234,8 @@ export const useDateRangeRawCore = (props, behavior) => {
234
234
  }, newRange)));
235
235
  previousStepOption.current = "";
236
236
  } else {
237
- const startDateForNormalize = ((_a = selection === null || selection === void 0 ? void 0 : selection.getRange) === null || _a === void 0 ? void 0 : _a.call(selection)) && (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label) !== newVal ? selection.getRange().from : value === null || value === void 0 ? void 0 : value.from;
238
- const endDateForNormalize = ((_b = selection === null || selection === void 0 ? void 0 : selection.getRange) === null || _b === void 0 ? void 0 : _b.call(selection)) && (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label) !== newVal ? selection.getRange().to : value === null || value === void 0 ? void 0 : value.to;
237
+ const startDateForNormalize = ((_b = selection === null || selection === void 0 ? void 0 : selection.getRange) === null || _b === void 0 ? void 0 : _b.call(selection)) && (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label) !== newVal ? selection.getRange().from : value === null || value === void 0 ? void 0 : value.from;
238
+ const endDateForNormalize = ((_c = selection === null || selection === void 0 ? void 0 : selection.getRange) === null || _c === void 0 ? void 0 : _c.call(selection)) && (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label) !== newVal ? selection.getRange().to : value === null || value === void 0 ? void 0 : value.to;
239
239
  if (!datesValidation(startDateForNormalize === undefined && endDateForNormalize === undefined ? undefined : {
240
240
  from: startDateForNormalize,
241
241
  to: endDateForNormalize
@@ -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";
@@ -12,7 +12,13 @@ interface IUseDateRangeNewParts {
12
12
  setShowMobileCalendar: (isVisible: boolean) => void;
13
13
  /** What was last applied; closing without Apply goes back to it. */
14
14
  prevSelection: IDateRangeValue | undefined;
15
- selectOption: (optionId: string) => void;
15
+ selectOption: (optionId: string, transformRange?: (range: {
16
+ from: Date;
17
+ to: Date;
18
+ }) => {
19
+ from: Date;
20
+ to: Date;
21
+ }) => void;
16
22
  segmentedTriggerRef: RefObject<HTMLElement | null>;
17
23
  hasApplyButton: boolean;
18
24
  defaultValue?: IDateRangeValue;