@geotab/zenith 3.3.0 → 3.4.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 (279) hide show
  1. package/README.md +17 -0
  2. package/dist/advancedGroupsFilter/advancedGroupsFilterFormSection.js +1 -1
  3. package/dist/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.js +0 -39
  4. package/dist/alertRaw/components/alertAnimation.js +8 -4
  5. package/dist/card/card.d.ts +1 -1
  6. package/dist/card/card.js +1 -3
  7. package/dist/card/components/status.js +2 -2
  8. package/dist/chart/barChart/getBarTooltipItems.js +31 -2
  9. package/dist/chart/barChart.js +2 -1
  10. package/dist/chart/utils/getYAxisMeta.d.ts +1 -1
  11. package/dist/chart/utils/getYAxisMeta.js +44 -1
  12. package/dist/checkbox/checkbox.js +3 -3
  13. package/dist/dataGrid/emptySearchList/emptySearchList.d.ts +6 -7
  14. package/dist/dataGrid/emptySearchList/emptySearchList.js +15 -23
  15. package/dist/dateInputRaw/dateInputRaw.d.ts +1 -1
  16. package/dist/dateRangeRaw/dateRangeRaw.d.ts +1 -1
  17. package/dist/dateRangeRaw/utils/dateRangeUtils.d.ts +1 -0
  18. package/dist/dateRangeRaw/utils/dateRangeUtils.js +39 -1
  19. package/dist/dropdownRaw/dropdownRaw.d.ts +1 -1
  20. package/dist/emptyState/emptyState.d.ts +9 -0
  21. package/dist/emptyState/emptyState.js +14 -0
  22. package/dist/emptyState/hooks/useIcon.d.ts +2 -0
  23. package/dist/emptyState/hooks/useIcon.js +17 -0
  24. package/dist/filtersBar/components/filtersBarPeriodPicker/getRangeOption.d.ts +1 -0
  25. package/dist/filtersBar/components/filtersBarPeriodPicker/getRangeOption.js +28 -3
  26. package/dist/formField/components/formFieldAdditionalInfo.d.ts +12 -0
  27. package/dist/formField/components/formFieldAdditionalInfo.js +10 -0
  28. package/dist/formField/components/formFieldAssistiveError.d.ts +10 -0
  29. package/dist/formField/components/formFieldAssistiveError.js +12 -0
  30. package/dist/formField/components/formFieldCounter.d.ts +6 -0
  31. package/dist/formField/components/formFieldCounter.js +7 -0
  32. package/dist/formField/components/formFieldLoading.d.ts +12 -0
  33. package/dist/formField/components/formFieldLoading.js +16 -0
  34. package/dist/formField/components/formFieldWithLabel.d.ts +8 -11
  35. package/dist/formField/components/formFieldWithLabel.js +21 -3
  36. package/dist/formField/components/formFieldWithoutLabel.d.ts +8 -9
  37. package/dist/formField/components/formFieldWithoutLabel.js +6 -1
  38. package/dist/formField/components/isOldFormFieldComponent.d.ts +2 -0
  39. package/dist/formField/components/isOldFormFieldComponent.js +12 -0
  40. package/dist/formField/components/trailingComponent.d.ts +2 -1
  41. package/dist/formField/components/trailingComponent.js +7 -1
  42. package/dist/formField/formField.d.ts +17 -35
  43. package/dist/formField/formField.js +4 -71
  44. package/dist/formField/hooks/useContainer.d.ts +2 -0
  45. package/dist/formField/hooks/useContainer.js +47 -0
  46. package/dist/formField/hooks/useError.d.ts +1 -1
  47. package/dist/formField/hooks/useFormFieldClasses.d.ts +2 -0
  48. package/dist/formField/hooks/useFormFieldClasses.js +30 -0
  49. package/dist/formField/hooks/useFormFieldProps.d.ts +17 -0
  50. package/dist/formField/hooks/useFormFieldProps.js +37 -0
  51. package/dist/formField/hooks/useTrailing.d.ts +1 -1
  52. package/dist/formField/hooks/useTrailing.js +1 -1
  53. package/dist/formField/hooks/useWidth.d.ts +1 -1
  54. package/dist/formField/types.d.ts +35 -0
  55. package/dist/formField/types.js +2 -0
  56. package/dist/formGroup/components/formGroupList.d.ts +1 -1
  57. package/dist/formGroup/components/formGroupToggle.d.ts +1 -1
  58. package/dist/formGroup/formGroup.d.ts +1 -1
  59. package/dist/formGroup/hooks/useLabelAlign.d.ts +1 -1
  60. package/dist/formGroup/types.d.ts +1 -1
  61. package/dist/formGroup/utils/applyCustomControlClasses.d.ts +1 -1
  62. package/dist/formGroup/utils/applyCustomLabelClasses.d.ts +1 -1
  63. package/dist/formGroup/utils/getControlClasses/getControlClasses.d.ts +1 -1
  64. package/dist/formGroup/utils/getControlClasses/getOneLabelOneControlClasses.d.ts +1 -1
  65. package/dist/formGroup/utils/getControlClasses/getOneLabelTwoControlsClasses.d.ts +1 -1
  66. package/dist/formGroup/utils/getControlClasses/getTwoLabelsOneControlClasses.d.ts +1 -1
  67. package/dist/formGroup/utils/getControlClasses/getTwoLabelsTwoControlsClasses.d.ts +1 -1
  68. package/dist/formGroup/utils/getLabelClasses/getLabelClasses.d.ts +1 -1
  69. package/dist/formGroup/utils/getLabelClasses/getOneLabelOneControlClasses.d.ts +1 -1
  70. package/dist/formGroup/utils/getLabelClasses/getOneLabelTwoControlsClasses.d.ts +1 -1
  71. package/dist/formGroup/utils/getLabelClasses/getTwoLabelsOneControlClasses.d.ts +1 -1
  72. package/dist/formGroup/utils/getLabelClasses/getTwoLabelsTwoControlsClasses.d.ts +1 -1
  73. package/dist/formGroup/utils/getListClasses.d.ts +1 -1
  74. package/dist/formGroup/utils/getToggleClasses.d.ts +1 -1
  75. package/dist/formGroup/utils/initializeState.d.ts +1 -1
  76. package/dist/formGroup/utils/isTopAlign.d.ts +1 -1
  77. package/dist/formLayout/types.d.ts +1 -1
  78. package/dist/formSection/types.d.ts +1 -1
  79. package/dist/formSection/utils/formSectionProvider.d.ts +1 -1
  80. package/dist/groupButtonRaw/groupButtonRaw.d.ts +1 -1
  81. package/dist/groupsFilterRaw/groupsFilterRaw.d.ts +1 -1
  82. package/dist/groupsFilterRaw/groupsHelper.js +2 -2
  83. package/dist/headerTitle/headerTitle.js +1 -1
  84. package/dist/images/imageAdjustFilter.d.ts +4 -0
  85. package/dist/images/imageAdjustFilter.js +16 -0
  86. package/dist/images/imageNoMatchingAssets.d.ts +4 -0
  87. package/dist/images/imageNoMatchingAssets.js +16 -0
  88. package/dist/index.css +619 -524
  89. package/dist/index.d.ts +6 -2
  90. package/dist/index.js +23 -16
  91. package/dist/inputAdornments/inputAdornments.d.ts +2 -1
  92. package/dist/inputAdornments/inputAdornments.js +2 -2
  93. package/dist/layout/layout.js +11 -7
  94. package/dist/list/itemData/itemData.d.ts +1 -0
  95. package/dist/list/itemData/itemDataInternal.d.ts +2 -1
  96. package/dist/list/itemData/itemDataInternal.js +4 -2
  97. package/dist/list/itemData/itemDataWaiting.d.ts +2 -1
  98. package/dist/list/itemData/itemDataWaiting.js +4 -1
  99. package/dist/list/list.d.ts +13 -4
  100. package/dist/list/list.js +29 -12
  101. package/dist/list/utils/getLoadingItems.d.ts +1 -1
  102. package/dist/list/utils/getLoadingItems.js +4 -4
  103. package/dist/modal/modal.js +7 -0
  104. package/dist/pillExpandable/pillExpandable.d.ts +1 -0
  105. package/dist/pillExpandable/pillExpandable.js +74 -33
  106. package/dist/radioGroupRaw/radioGroupRaw.d.ts +1 -1
  107. package/dist/rangeRaw/rangeRaw.d.ts +1 -1
  108. package/dist/summary/summary.js +0 -1
  109. package/dist/summaryTile/summaryTile.js +2 -2
  110. package/dist/table/children/tableEmpty.d.ts +1 -1
  111. package/dist/table/children/useTableChildren.js +1 -1
  112. package/dist/timePickerRaw/timePickerRaw.d.ts +1 -1
  113. package/dist/tooltip/tooltip.d.ts +15 -4
  114. package/dist/tooltip/tooltip.js +421 -158
  115. package/dist/utils/localization/translations/cs.json +2 -1
  116. package/dist/utils/localization/translations/da-DK.json +2 -1
  117. package/dist/utils/localization/translations/de.json +2 -1
  118. package/dist/utils/localization/translations/en.json +2 -1
  119. package/dist/utils/localization/translations/es.json +3 -2
  120. package/dist/utils/localization/translations/fi-FI.json +2 -1
  121. package/dist/utils/localization/translations/fr-FR.json +2 -1
  122. package/dist/utils/localization/translations/fr.json +3 -2
  123. package/dist/utils/localization/translations/hu-HU.json +2 -1
  124. package/dist/utils/localization/translations/id.json +2 -1
  125. package/dist/utils/localization/translations/it.json +2 -1
  126. package/dist/utils/localization/translations/ja.json +2 -1
  127. package/dist/utils/localization/translations/ko-KR.json +2 -1
  128. package/dist/utils/localization/translations/ms.json +2 -1
  129. package/dist/utils/localization/translations/nb-NO.json +2 -1
  130. package/dist/utils/localization/translations/nl.json +2 -1
  131. package/dist/utils/localization/translations/pl.json +2 -1
  132. package/dist/utils/localization/translations/pt-BR.json +2 -1
  133. package/dist/utils/localization/translations/sk-SK.json +2 -1
  134. package/dist/utils/localization/translations/sv.json +2 -1
  135. package/dist/utils/localization/translations/th.json +2 -1
  136. package/dist/utils/localization/translations/tr.json +2 -1
  137. package/dist/utils/localization/translations/zh-Hans.json +2 -1
  138. package/dist/utils/localization/translations/zh-TW.json +2 -1
  139. package/dist/utils/positioningUtils/calculatePosition.d.ts +1 -1
  140. package/dist/utils/positioningUtils/calculatePosition.js +11 -1
  141. package/esm/advancedGroupsFilter/advancedGroupsFilterFormSection.js +1 -1
  142. package/esm/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.js +0 -39
  143. package/esm/alertRaw/components/alertAnimation.js +8 -4
  144. package/esm/card/card.d.ts +1 -1
  145. package/esm/card/card.js +1 -3
  146. package/esm/card/components/status.js +2 -2
  147. package/esm/chart/barChart/getBarTooltipItems.js +31 -2
  148. package/esm/chart/barChart.js +2 -1
  149. package/esm/chart/utils/getYAxisMeta.d.ts +1 -1
  150. package/esm/chart/utils/getYAxisMeta.js +44 -1
  151. package/esm/checkbox/checkbox.js +3 -3
  152. package/esm/dataGrid/emptySearchList/emptySearchList.d.ts +6 -7
  153. package/esm/dataGrid/emptySearchList/emptySearchList.js +16 -24
  154. package/esm/dateInputRaw/dateInputRaw.d.ts +1 -1
  155. package/esm/dateRangeRaw/dateRangeRaw.d.ts +1 -1
  156. package/esm/dateRangeRaw/utils/dateRangeUtils.d.ts +1 -0
  157. package/esm/dateRangeRaw/utils/dateRangeUtils.js +37 -0
  158. package/esm/dropdownRaw/dropdownRaw.d.ts +1 -1
  159. package/esm/emptyState/emptyState.d.ts +9 -0
  160. package/esm/emptyState/emptyState.js +10 -0
  161. package/esm/emptyState/hooks/useIcon.d.ts +2 -0
  162. package/esm/emptyState/hooks/useIcon.js +10 -0
  163. package/esm/filtersBar/components/filtersBarPeriodPicker/getRangeOption.d.ts +1 -0
  164. package/esm/filtersBar/components/filtersBarPeriodPicker/getRangeOption.js +29 -4
  165. package/esm/formField/components/formFieldAdditionalInfo.d.ts +12 -0
  166. package/esm/formField/components/formFieldAdditionalInfo.js +6 -0
  167. package/esm/formField/components/formFieldAssistiveError.d.ts +10 -0
  168. package/esm/formField/components/formFieldAssistiveError.js +8 -0
  169. package/esm/formField/components/formFieldCounter.d.ts +6 -0
  170. package/esm/formField/components/formFieldCounter.js +3 -0
  171. package/esm/formField/components/formFieldLoading.d.ts +12 -0
  172. package/esm/formField/components/formFieldLoading.js +12 -0
  173. package/esm/formField/components/formFieldWithLabel.d.ts +8 -11
  174. package/esm/formField/components/formFieldWithLabel.js +21 -3
  175. package/esm/formField/components/formFieldWithoutLabel.d.ts +8 -9
  176. package/esm/formField/components/formFieldWithoutLabel.js +6 -1
  177. package/esm/formField/components/isOldFormFieldComponent.d.ts +2 -0
  178. package/esm/formField/components/isOldFormFieldComponent.js +8 -0
  179. package/esm/formField/components/trailingComponent.d.ts +2 -1
  180. package/esm/formField/components/trailingComponent.js +7 -1
  181. package/esm/formField/formField.d.ts +17 -35
  182. package/esm/formField/formField.js +5 -72
  183. package/esm/formField/hooks/useContainer.d.ts +2 -0
  184. package/esm/formField/hooks/useContainer.js +43 -0
  185. package/esm/formField/hooks/useError.d.ts +1 -1
  186. package/esm/formField/hooks/useFormFieldClasses.d.ts +2 -0
  187. package/esm/formField/hooks/useFormFieldClasses.js +26 -0
  188. package/esm/formField/hooks/useFormFieldProps.d.ts +17 -0
  189. package/esm/formField/hooks/useFormFieldProps.js +33 -0
  190. package/esm/formField/hooks/useTrailing.d.ts +1 -1
  191. package/esm/formField/hooks/useTrailing.js +1 -1
  192. package/esm/formField/hooks/useWidth.d.ts +1 -1
  193. package/esm/formField/types.d.ts +35 -0
  194. package/esm/formField/types.js +1 -0
  195. package/esm/formGroup/components/formGroupList.d.ts +1 -1
  196. package/esm/formGroup/components/formGroupToggle.d.ts +1 -1
  197. package/esm/formGroup/formGroup.d.ts +1 -1
  198. package/esm/formGroup/hooks/useLabelAlign.d.ts +1 -1
  199. package/esm/formGroup/types.d.ts +1 -1
  200. package/esm/formGroup/utils/applyCustomControlClasses.d.ts +1 -1
  201. package/esm/formGroup/utils/applyCustomLabelClasses.d.ts +1 -1
  202. package/esm/formGroup/utils/getControlClasses/getControlClasses.d.ts +1 -1
  203. package/esm/formGroup/utils/getControlClasses/getOneLabelOneControlClasses.d.ts +1 -1
  204. package/esm/formGroup/utils/getControlClasses/getOneLabelTwoControlsClasses.d.ts +1 -1
  205. package/esm/formGroup/utils/getControlClasses/getTwoLabelsOneControlClasses.d.ts +1 -1
  206. package/esm/formGroup/utils/getControlClasses/getTwoLabelsTwoControlsClasses.d.ts +1 -1
  207. package/esm/formGroup/utils/getLabelClasses/getLabelClasses.d.ts +1 -1
  208. package/esm/formGroup/utils/getLabelClasses/getOneLabelOneControlClasses.d.ts +1 -1
  209. package/esm/formGroup/utils/getLabelClasses/getOneLabelTwoControlsClasses.d.ts +1 -1
  210. package/esm/formGroup/utils/getLabelClasses/getTwoLabelsOneControlClasses.d.ts +1 -1
  211. package/esm/formGroup/utils/getLabelClasses/getTwoLabelsTwoControlsClasses.d.ts +1 -1
  212. package/esm/formGroup/utils/getListClasses.d.ts +1 -1
  213. package/esm/formGroup/utils/getToggleClasses.d.ts +1 -1
  214. package/esm/formGroup/utils/initializeState.d.ts +1 -1
  215. package/esm/formGroup/utils/isTopAlign.d.ts +1 -1
  216. package/esm/formLayout/types.d.ts +1 -1
  217. package/esm/formSection/types.d.ts +1 -1
  218. package/esm/formSection/utils/formSectionProvider.d.ts +1 -1
  219. package/esm/groupButtonRaw/groupButtonRaw.d.ts +1 -1
  220. package/esm/groupsFilterRaw/groupsFilterRaw.d.ts +1 -1
  221. package/esm/groupsFilterRaw/groupsHelper.js +2 -2
  222. package/esm/headerTitle/headerTitle.js +1 -1
  223. package/esm/images/imageAdjustFilter.d.ts +4 -0
  224. package/esm/images/imageAdjustFilter.js +12 -0
  225. package/esm/images/imageNoMatchingAssets.d.ts +4 -0
  226. package/esm/images/imageNoMatchingAssets.js +12 -0
  227. package/esm/index.d.ts +6 -2
  228. package/esm/index.js +4 -1
  229. package/esm/inputAdornments/inputAdornments.d.ts +2 -1
  230. package/esm/inputAdornments/inputAdornments.js +2 -2
  231. package/esm/layout/layout.js +11 -7
  232. package/esm/list/itemData/itemData.d.ts +1 -0
  233. package/esm/list/itemData/itemDataInternal.d.ts +2 -1
  234. package/esm/list/itemData/itemDataInternal.js +4 -2
  235. package/esm/list/itemData/itemDataWaiting.d.ts +2 -1
  236. package/esm/list/itemData/itemDataWaiting.js +4 -1
  237. package/esm/list/list.d.ts +13 -4
  238. package/esm/list/list.js +29 -12
  239. package/esm/list/utils/getLoadingItems.d.ts +1 -1
  240. package/esm/list/utils/getLoadingItems.js +4 -4
  241. package/esm/modal/modal.js +7 -0
  242. package/esm/pillExpandable/pillExpandable.d.ts +1 -0
  243. package/esm/pillExpandable/pillExpandable.js +74 -33
  244. package/esm/radioGroupRaw/radioGroupRaw.d.ts +1 -1
  245. package/esm/rangeRaw/rangeRaw.d.ts +1 -1
  246. package/esm/summary/summary.js +0 -1
  247. package/esm/summaryTile/summaryTile.js +2 -2
  248. package/esm/table/children/tableEmpty.d.ts +1 -1
  249. package/esm/table/children/useTableChildren.js +1 -1
  250. package/esm/timePickerRaw/timePickerRaw.d.ts +1 -1
  251. package/esm/tooltip/tooltip.d.ts +15 -4
  252. package/esm/tooltip/tooltip.js +388 -138
  253. package/esm/utils/localization/translations/cs.json +2 -1
  254. package/esm/utils/localization/translations/da-DK.json +2 -1
  255. package/esm/utils/localization/translations/de.json +2 -1
  256. package/esm/utils/localization/translations/en.json +2 -1
  257. package/esm/utils/localization/translations/es.json +3 -2
  258. package/esm/utils/localization/translations/fi-FI.json +2 -1
  259. package/esm/utils/localization/translations/fr-FR.json +2 -1
  260. package/esm/utils/localization/translations/fr.json +3 -2
  261. package/esm/utils/localization/translations/hu-HU.json +2 -1
  262. package/esm/utils/localization/translations/id.json +2 -1
  263. package/esm/utils/localization/translations/it.json +2 -1
  264. package/esm/utils/localization/translations/ja.json +2 -1
  265. package/esm/utils/localization/translations/ko-KR.json +2 -1
  266. package/esm/utils/localization/translations/ms.json +2 -1
  267. package/esm/utils/localization/translations/nb-NO.json +2 -1
  268. package/esm/utils/localization/translations/nl.json +2 -1
  269. package/esm/utils/localization/translations/pl.json +2 -1
  270. package/esm/utils/localization/translations/pt-BR.json +2 -1
  271. package/esm/utils/localization/translations/sk-SK.json +2 -1
  272. package/esm/utils/localization/translations/sv.json +2 -1
  273. package/esm/utils/localization/translations/th.json +2 -1
  274. package/esm/utils/localization/translations/tr.json +2 -1
  275. package/esm/utils/localization/translations/zh-Hans.json +2 -1
  276. package/esm/utils/localization/translations/zh-TW.json +2 -1
  277. package/esm/utils/positioningUtils/calculatePosition.d.ts +1 -1
  278. package/esm/utils/positioningUtils/calculatePosition.js +11 -1
  279. package/package.json +1 -1
@@ -1,7 +1,14 @@
1
1
  import { injectString } from "../../utils/localization/translationsDictionary";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { classNames } from "../../commonHelpers/classNames/classNames";
4
- import { ImageNothingFound } from "../../images/imageNothingFound";
2
+ var __rest = this && this.__rest || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
6
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
7
+ }
8
+ return t;
9
+ };
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { EmptyState } from "../../emptyState/emptyState";
5
12
  import { useLanguage } from "../../utils/localization/useLanguage";
6
13
  injectString("cs", "Try adjusting your search or filter.", "Zkuste upravit sv\xE9 vyhled\xE1v\xE1n\xED nebo filtr.");
7
14
  injectString("da-DK", "Try adjusting your search or filter.", "Pr\xF8v at justere din s\xF8gning eller dit filter.");
@@ -27,29 +34,14 @@ injectString("th", "Try adjusting your search or filter.", "\u0E25\u0E2D\u0E07\u
27
34
  injectString("tr", "Try adjusting your search or filter.", "Araman\u0131z\u0131 veya filtrenizi ayarlamay\u0131 deneyin.");
28
35
  injectString("zh-Hans", "Try adjusting your search or filter.", "\u5C1D\u8BD5\u8C03\u6574\u60A8\u7684\u641C\u7D22\u6216\u7B5B\u9009\u6761\u4EF6\u3002");
29
36
  injectString("zh-TW", "Try adjusting your search or filter.", "\u8ACB\u5617\u8A66\u8ABF\u6574\u60A8\u7684\u641C\u5C0B\u6216\u7BE9\u9078\u689D\u4EF6\u3002");
30
- export const EmptySearchList = ({
31
- className,
32
- children,
33
- description,
34
- image
35
- }) => {
37
+ export const EmptySearchList = _a => {
38
+ var props = __rest(_a, []);
36
39
  const {
37
40
  translate
38
41
  } = useLanguage();
39
- return _jsxs("div", {
40
- className: classNames(["zen-empty-list-search", className || ""]),
41
- children: [image ? _jsx("div", {
42
- className: "zen-empty-list-search__image",
43
- children: image
44
- }) : _jsx(ImageNothingFound, {
45
- className: "zen-empty-list-search__image"
46
- }), _jsx("h2", {
47
- className: "zen-empty-list-search__header",
48
- children: children
49
- }), _jsx("div", {
50
- className: "zen-empty-list-search__description",
51
- children: description || translate("Try adjusting your search or filter.")
52
- })]
53
- });
42
+ return _jsx(EmptyState, Object.assign({}, props, {
43
+ description: props.description || translate("Try adjusting your search or filter."),
44
+ children: props.children
45
+ }));
54
46
  };
55
47
  EmptySearchList.translations = ["Try adjusting your search or filter."];
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import "./dateInputRaw.less";
3
- import { IFormFieldComponent } from "../formField/formField";
3
+ import { IFormFieldComponent } from "../formField/types";
4
4
  import { IDateInputRawDefault, TDateInputRaw } from "./types";
5
5
  import { IChipsParent } from "../chip/chip";
6
6
  export interface IDateInputRaw extends IDateInputRawDefault, IChipsParent {
@@ -2,7 +2,7 @@
2
2
  import "./dateRangeRaw.less";
3
3
  import { IZenComponentProps } from "../commonHelpers/zenComponent";
4
4
  import { TButton } from "../button/buttonType";
5
- import { IFormFieldComponent } from "../formField/formField";
5
+ import { IFormFieldComponent } from "../formField/types";
6
6
  import { IChipsParent } from "../chip/chip";
7
7
  import { TDateRangeOption, IDateRangeValue, IDateRangeValueOptionalLabel } from "./utils/dateRangeUtils";
8
8
  import { TDateRangeRaw } from "./types";
@@ -28,6 +28,7 @@ export declare const GET_NEXT_MONTH_OPTION: (toLocalDateTime?: TToLocalDateTime,
28
28
  export declare const GET_LAST_MONTH_OPTION: (toLocalDateTime?: TToLocalDateTime, translate?: TTranslate, toReverseOffsetDateTime?: TToLocalDateTime) => IDateRangeOption;
29
29
  export declare const GET_LAST_SEVEN_DAYS_OPTION: (toLocalDateTime?: TToLocalDateTime, translate?: TTranslate, toReverseOffsetDateTime?: TToLocalDateTime) => IDateRangeOption;
30
30
  export declare const GET_LAST_THIRTY_DAYS_OPTION: (toLocalDateTime?: TToLocalDateTime, translate?: TTranslate, toReverseOffsetDateTime?: TToLocalDateTime) => IDateRangeOption;
31
+ export declare const GET_YEAR_TO_DATE_OPTION: (toLocalDateTime?: TToLocalDateTime, translate?: TTranslate, toReverseOffsetDateTime?: TToLocalDateTime) => IDateRangeOption;
31
32
  export declare const GET_LAST_TWELVE_MONTHS_OPTION: (toLocalDateTime?: TToLocalDateTime, translate?: TTranslate, toReverseOffsetDateTime?: TToLocalDateTime) => IDateRangeOption;
32
33
  export declare const GET_LAST_THREE_MONTH_OPTION: (toLocalDateTime?: TToLocalDateTime, translate?: TTranslate, toReverseOffsetDateTime?: TToLocalDateTime) => IDateRangeOption;
33
34
  export declare const GET_LAST_QUARTER_OPTION: (toLocalDateTime?: TToLocalDateTime, translate?: TTranslate, toReverseOffsetDateTime?: TToLocalDateTime) => IDateRangeOption;
@@ -240,6 +240,30 @@ injectString("th", "Last 30 days", "30 \u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E1
240
240
  injectString("tr", "Last 30 days", "Son 30 g\xFCn");
241
241
  injectString("zh-Hans", "Last 30 days", "\u6700\u8FD1 30 \u5929");
242
242
  injectString("zh-TW", "Last 30 days", "\u904E\u53BB 30 \u5929");
243
+ injectString("cs", "Year to date", "Od za\u010D\xE1tku roku");
244
+ injectString("da-DK", "Year to date", "\xC5r til dato");
245
+ injectString("de", "Year to date", "Seit Jahresbeginn");
246
+ injectString("en", "Year to date", "Year to date");
247
+ injectString("es", "Year to date", "A\xF1o a la fecha");
248
+ injectString("fi-FI", "Year to date", "Vuoden alusta");
249
+ injectString("fr", "Year to date", "Cumul jusqu\u2019\xE0 ce jour");
250
+ injectString("fr-FR", "Year to date", "L\u2019ann\xE9e pass\xE9e");
251
+ injectString("hu-HU", "Year to date", "\xC9v a mai napig");
252
+ injectString("id", "Year to date", "Tahun hingga saat ini");
253
+ injectString("it", "Year to date", "Dall'inizio dell'anno");
254
+ injectString("ja", "Year to date", "\u7D2F\u8A08");
255
+ injectString("ko-KR", "Year to date", "\uC62C\uD574 \uD604\uC7AC\uAE4C\uC9C0");
256
+ injectString("ms", "Year to date", "Tahun ini hingga tarikh ini");
257
+ injectString("nb-NO", "Year to date", "\xC5r til dato");
258
+ injectString("nl", "Year to date", "Jaar tot heden");
259
+ injectString("pl", "Year to date", "Od pocz\u0105tku roku");
260
+ injectString("pt-BR", "Year to date", "Acumulado no ano");
261
+ injectString("sk-SK", "Year to date", "Rok od za\u010Diatku");
262
+ injectString("sv", "Year to date", "\xC5r till dagens datum");
263
+ injectString("th", "Year to date", "\u0E15\u0E49\u0E19\u0E1B\u0E35\u0E16\u0E36\u0E07\u0E1B\u0E31\u0E08\u0E08\u0E38\u0E1A\u0E31\u0E19");
264
+ injectString("tr", "Year to date", "Y\u0131lba\u015F\u0131ndan bug\xFCne kadar");
265
+ injectString("zh-Hans", "Year to date", "\u5E74\u521D\u81F3\u4ECA");
266
+ injectString("zh-TW", "Year to date", "\u5E74\u521D\u81F3\u4ECA");
243
267
  injectString("cs", "Last 12 months", "Posledn\xEDch 12 m\u011Bs\xEDc\u016F");
244
268
  injectString("da-DK", "Last 12 months", "Sidste 12 m\xE5neder");
245
269
  injectString("de", "Last 12 months", "Letzte 12 Monate");
@@ -534,6 +558,19 @@ export const GET_LAST_THIRTY_DAYS_OPTION = (toLocalDateTime = defaultToLocalDate
534
558
  })
535
559
  };
536
560
  };
561
+ export const GET_YEAR_TO_DATE_OPTION = (toLocalDateTime = defaultToLocalDateTime, translate = defaultTranslate, toReverseOffsetDateTime = defaultToReverseOffsetDateTime) => {
562
+ const startDate = new Date(getNewStartDate(toLocalDateTime).getFullYear(), 0, 1);
563
+ const endDate = getNewEndDate(toLocalDateTime);
564
+ const from = toReverseOffsetDateTime(startDate);
565
+ const to = toReverseOffsetDateTime(endDate);
566
+ return {
567
+ label: translate("Year to date"),
568
+ getRange: () => ({
569
+ from,
570
+ to
571
+ })
572
+ };
573
+ };
537
574
  export const GET_LAST_TWELVE_MONTHS_OPTION = (toLocalDateTime = defaultToLocalDateTime, translate = defaultTranslate, toReverseOffsetDateTime = defaultToReverseOffsetDateTime) => {
538
575
  const startDate = addMonths(getNewStartDate(toLocalDateTime), -12);
539
576
  const endDate = getNewEndDate(toLocalDateTime);
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import "./dropdownRaw.less";
3
- import { IFormFieldComponent } from "../formField/formField";
3
+ import { IFormFieldComponent } from "../formField/types";
4
4
  import { TDropdownRaw } from "./types";
5
5
  export declare const DropdownRaw: React.FC<TDropdownRaw & IFormFieldComponent>;
6
6
  export declare const TRANSLATIONS: string[];
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from "react";
2
+ import "./emptyState.less";
3
+ import { IZenComponentProps } from "../commonHelpers/zenComponent";
4
+ export interface IEmptyState extends IZenComponentProps {
5
+ description?: string;
6
+ image?: ReactNode | React.FC;
7
+ children: ReactNode;
8
+ }
9
+ export declare const EmptyState: ({ className, children, description, image }: IEmptyState) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { classNames } from "../commonHelpers/classNames/classNames";
3
+ import { ImageNothingFound } from "../images/imageNothingFound";
4
+ import { useIcon } from "./hooks/useIcon";
5
+ export const EmptyState = ({ className, children, description, image }) => {
6
+ const icon = useIcon(image);
7
+ return _jsxs("div", { className: classNames(["zen-empty-state", className || ""]), children: [icon
8
+ ? _jsx("div", { className: "zen-empty-state__image", children: icon })
9
+ : _jsx(ImageNothingFound, { className: "zen-empty-state__image" }), children && _jsx("h2", { className: "zen-empty-state__header", children: children }), description && _jsx("div", { className: "zen-empty-state__description", children: description })] });
10
+ };
@@ -0,0 +1,2 @@
1
+ import React, { ReactNode } from "react";
2
+ export declare const useIcon: (icon: ReactNode | React.FC) => string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.FunctionComponentElement<{}> | null | undefined;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ export const useIcon = (icon) => {
3
+ const svgIcon = React.useMemo(() => {
4
+ if (typeof icon === "function") {
5
+ return React.createElement(icon, {});
6
+ }
7
+ return icon;
8
+ }, [icon]);
9
+ return svgIcon;
10
+ };
@@ -24,6 +24,7 @@ declare const options: {
24
24
  LastQuarter: (translate: (s: string) => string, toLocalDateTime: (date: Date | string) => Date, _firstDayOfWeek?: TDayName, toReverseOffsetDateTime?: (date: Date | string) => Date) => IDateRangeOption;
25
25
  LastYear: (translate: (s: string) => string, toLocalDateTime: (date: Date | string) => Date, _firstDayOfWeek?: TDayName, toReverseOffsetDateTime?: (date: Date | string) => Date) => IDateRangeOption;
26
26
  ThisYear: (translate: (s: string) => string, toLocalDateTime: (date: Date | string) => Date, _firstDayOfWeek?: TDayName, toReverseOffsetDateTime?: (date: Date | string) => Date) => IDateRangeOption;
27
+ YearToDate: (translate: (s: string) => string, toLocalDateTime: (date: Date | string) => Date, _firstDayOfWeek?: TDayName, toReverseOffsetDateTime?: (date: Date | string) => Date) => IDateRangeOption;
27
28
  };
28
29
  export type TDateRangeName = keyof typeof options | "Custom";
29
30
  export declare function getRangeOption(option: TDateRangeOption, translate: (s: string) => string, toLocalDateTime?: (date: Date | string) => Date, firstDayOfWeek?: TDayName, toReverseOffsetDateTime?: (date: Date | string) => Date): IDateRangeOptionId | undefined;
@@ -1,5 +1,5 @@
1
1
  import { injectString } from "../../../utils/localization/translationsDictionary";
2
- import { GET_LAST_MONTH_OPTION, GET_LAST_THREE_MONTH_OPTION, GET_LAST_SEVEN_DAYS_OPTION, GET_LAST_THIRTY_DAYS_OPTION, GET_LAST_TWELVE_MONTHS_OPTION, GET_LAST_WEEK_OPTION, GET_NEXT_MONTH_OPTION, GET_NEXT_WEEK_OPTION, GET_THIS_MONTH_OPTION, GET_THIS_WEEK_OPTION, GET_TODAY_OPTION, GET_YESTERDAY_OPTION, GET_LAST_QUARTER_OPTION, GET_THIS_QUARTER_OPTION, GET_THIS_YEAR_OPTION, GET_LAST_YEAR_OPTION } from "../../../dateRange/dateRangeUtils";
2
+ import { GET_LAST_MONTH_OPTION, GET_LAST_THREE_MONTH_OPTION, GET_LAST_SEVEN_DAYS_OPTION, GET_LAST_THIRTY_DAYS_OPTION, GET_LAST_TWELVE_MONTHS_OPTION, GET_YEAR_TO_DATE_OPTION, GET_LAST_WEEK_OPTION, GET_NEXT_MONTH_OPTION, GET_NEXT_WEEK_OPTION, GET_THIS_MONTH_OPTION, GET_THIS_WEEK_OPTION, GET_TODAY_OPTION, GET_YESTERDAY_OPTION, GET_LAST_QUARTER_OPTION, GET_THIS_QUARTER_OPTION, GET_THIS_YEAR_OPTION, GET_LAST_YEAR_OPTION } from "../../../dateRange/dateRangeUtils";
3
3
  import { CUSTOM_CALENDAR_ID } from "../../../dateRangeInner/dateRangeInner";
4
4
  injectString("cs", "This week", "Tento t\xFDden");
5
5
  injectString("da-DK", "This week", "Denne uge");
@@ -289,6 +289,30 @@ injectString("th", "Last 12 months", "12 \u0E40\u0E14\u0E37\u0E2D\u0E19\u0E17\u0
289
289
  injectString("tr", "Last 12 months", "Son 12 ay");
290
290
  injectString("zh-Hans", "Last 12 months", "\u6700\u8FD1 12 \u4E2A\u6708");
291
291
  injectString("zh-TW", "Last 12 months", "\u904E\u53BB 12 \u500B\u6708");
292
+ injectString("cs", "Year to date", "Od za\u010D\xE1tku roku");
293
+ injectString("da-DK", "Year to date", "\xC5r til dato");
294
+ injectString("de", "Year to date", "Seit Jahresbeginn");
295
+ injectString("en", "Year to date", "Year to date");
296
+ injectString("es", "Year to date", "A\xF1o a la fecha");
297
+ injectString("fi-FI", "Year to date", "Vuoden alusta");
298
+ injectString("fr", "Year to date", "Cumul jusqu\u2019\xE0 ce jour");
299
+ injectString("fr-FR", "Year to date", "L\u2019ann\xE9e pass\xE9e");
300
+ injectString("hu-HU", "Year to date", "\xC9v a mai napig");
301
+ injectString("id", "Year to date", "Tahun hingga saat ini");
302
+ injectString("it", "Year to date", "Dall'inizio dell'anno");
303
+ injectString("ja", "Year to date", "\u7D2F\u8A08");
304
+ injectString("ko-KR", "Year to date", "\uC62C\uD574 \uD604\uC7AC\uAE4C\uC9C0");
305
+ injectString("ms", "Year to date", "Tahun ini hingga tarikh ini");
306
+ injectString("nb-NO", "Year to date", "\xC5r til dato");
307
+ injectString("nl", "Year to date", "Jaar tot heden");
308
+ injectString("pl", "Year to date", "Od pocz\u0105tku roku");
309
+ injectString("pt-BR", "Year to date", "Acumulado no ano");
310
+ injectString("sk-SK", "Year to date", "Rok od za\u010Diatku");
311
+ injectString("sv", "Year to date", "\xC5r till dagens datum");
312
+ injectString("th", "Year to date", "\u0E15\u0E49\u0E19\u0E1B\u0E35\u0E16\u0E36\u0E07\u0E1B\u0E31\u0E08\u0E08\u0E38\u0E1A\u0E31\u0E19");
313
+ injectString("tr", "Year to date", "Y\u0131lba\u015F\u0131ndan bug\xFCne kadar");
314
+ injectString("zh-Hans", "Year to date", "\u5E74\u521D\u81F3\u4ECA");
315
+ injectString("zh-TW", "Year to date", "\u5E74\u521D\u81F3\u4ECA");
292
316
  injectString("cs", "Custom", "Vlastn\xED");
293
317
  injectString("da-DK", "Custom", "Brugerdefineret");
294
318
  injectString("de", "Custom", "Individuell");
@@ -425,7 +449,8 @@ const options = {
425
449
  "ThisQuarter": (translate, toLocalDateTime, _firstDayOfWeek, toReverseOffsetDateTime) => GET_THIS_QUARTER_OPTION(toLocalDateTime, translate, toReverseOffsetDateTime),
426
450
  "LastQuarter": (translate, toLocalDateTime, _firstDayOfWeek, toReverseOffsetDateTime) => GET_LAST_QUARTER_OPTION(toLocalDateTime, translate, toReverseOffsetDateTime),
427
451
  "LastYear": (translate, toLocalDateTime, _firstDayOfWeek, toReverseOffsetDateTime) => GET_LAST_YEAR_OPTION(toLocalDateTime, translate, toReverseOffsetDateTime),
428
- "ThisYear": (translate, toLocalDateTime, _firstDayOfWeek, toReverseOffsetDateTime) => GET_THIS_YEAR_OPTION(toLocalDateTime, translate, toReverseOffsetDateTime)
452
+ "ThisYear": (translate, toLocalDateTime, _firstDayOfWeek, toReverseOffsetDateTime) => GET_THIS_YEAR_OPTION(toLocalDateTime, translate, toReverseOffsetDateTime),
453
+ "YearToDate": (translate, toLocalDateTime, _firstDayOfWeek, toReverseOffsetDateTime) => GET_YEAR_TO_DATE_OPTION(toLocalDateTime, translate, toReverseOffsetDateTime)
429
454
  };
430
455
  export function getRangeOption(option, translate, toLocalDateTime, firstDayOfWeek, toReverseOffsetDateTime) {
431
456
  if (typeof option === "string") {
@@ -440,7 +465,7 @@ export function getRangeOption(option, translate, toLocalDateTime, firstDayOfWee
440
465
  id: option.label
441
466
  }, option);
442
467
  }
443
- const getSecondaryLabelOptions = translate => ["ThisWeek", "NextWeek", "LastWeek", "ThisMonth", "LastMonth", "NextMonth", "LastThreeMonths", "LastYear", "ThisYear", "ThisQuarter", "LastQuarter", "LastTwelveMonths", translate("This week"), translate("Next week"), translate("Last week"), translate("This month"), translate("Last month"), translate("Next month"), translate("Last 3 months"), translate("Last year"), translate("This year"), translate("This quarter"), translate("Last quarter"), translate("Last 12 months")];
468
+ const getSecondaryLabelOptions = translate => ["ThisWeek", "NextWeek", "LastWeek", "ThisMonth", "LastMonth", "NextMonth", "LastThreeMonths", "LastYear", "ThisYear", "ThisQuarter", "LastQuarter", "LastTwelveMonths", "YearToDate", translate("This week"), translate("Next week"), translate("Last week"), translate("This month"), translate("Last month"), translate("Next month"), translate("Last 3 months"), translate("Last year"), translate("This year"), translate("This quarter"), translate("Last quarter"), translate("Last 12 months"), translate("Year to date")];
444
469
  export const getRangeOptionsArray = (initialOptions, translate, toLocalDateTime, firstDayOfWeek, toReverseOffsetDateTime, customLabel, isPrevRangeCustom, customGetRangeOptions) => {
445
470
  const optionsArray = initialOptions.map(opt => getRangeOption(opt, translate, toLocalDateTime, firstDayOfWeek, toReverseOffsetDateTime)).filter(option => !!option);
446
471
  const hasCustomOption = customLabel || initialOptions.includes("Custom");
@@ -725,7 +750,7 @@ export const getDateRangeAdjustedStep = (translate, label) => {
725
750
  const periodDayAdjusted = ["Today", "Yesterday", translate("Today"), translate("Yesterday")];
726
751
  const periodSevenDaysAdjusted = ["ThisWeek", "NextWeek", "LastWeek", "LastSevenDays", translate("This week"), translate("Next week"), translate("Last week"), translate("Last 7 days")];
727
752
  const periodThirtyDaysAdjusted = ["LastThirtyDays", translate("Last 30 days")];
728
- const yearAdjusted = ["LastYear", "ThisYear", "LastTwelveMonths", translate("Last 12 months"), translate("Last year"), translate("This year")];
753
+ const yearAdjusted = ["LastYear", "ThisYear", "LastTwelveMonths", "YearToDate", translate("Last 12 months"), translate("Last year"), translate("This year"), translate("Year to date")];
729
754
  const quarterAdjusted = ["ThisQuarter", "LastQuarter", translate("This quarter"), translate("Last quarter")];
730
755
  if (!label) {
731
756
  return DEFAULT_STEP_OPTION;
@@ -0,0 +1,12 @@
1
+ import { FC } from "react";
2
+ interface IFormFieldAdditionalInfoProps {
3
+ assistiveId?: string;
4
+ errorId: string;
5
+ driveTextClass?: string;
6
+ error?: string | null | undefined;
7
+ assistive?: string | null;
8
+ counter?: string | number | React.ReactElement;
9
+ showAdditionalInfo?: boolean;
10
+ }
11
+ export declare const FormFieldAdditionalInfo: FC<IFormFieldAdditionalInfoProps>;
12
+ export {};
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { FormFieldAssistiveError } from "./formFieldAssistiveError";
3
+ import { FormFieldCounter } from "./formFieldCounter";
4
+ export const FormFieldAdditionalInfo = ({ assistiveId, errorId, driveTextClass, error, assistive, counter, showAdditionalInfo }) => showAdditionalInfo ?
5
+ _jsxs("div", { className: "zen-form-field__secondary", children: [_jsx(FormFieldAssistiveError, { assistiveId: assistiveId, errorId: errorId, driveTextClass: driveTextClass, value: error, assistive: assistive }), _jsx(FormFieldCounter, { value: counter })] })
6
+ : null;
@@ -0,0 +1,10 @@
1
+ import { FC } from "react";
2
+ interface IFormFieldAssistiveError {
3
+ assistiveId?: string;
4
+ errorId: string;
5
+ driveTextClass?: string;
6
+ value?: string | null | undefined;
7
+ assistive?: string | null;
8
+ }
9
+ export declare const FormFieldAssistiveError: FC<IFormFieldAssistiveError>;
10
+ export {};
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { classNames } from "../../commonHelpers/classNames/classNames";
3
+ import { FormFieldError } from "../../formFieldError/formFieldError";
4
+ export const FormFieldAssistiveError = ({ assistiveId, errorId, driveTextClass, value, assistive }) => _jsx("div", { id: assistiveId || errorId, className: classNames([
5
+ "zen-form-field__text",
6
+ driveTextClass || "",
7
+ value ? "zen-form-field__text--error" : ""
8
+ ]), children: value ? _jsx(FormFieldError, { error: value }) : assistive });
@@ -0,0 +1,6 @@
1
+ import { FC } from "react";
2
+ interface IFormFieldCounterProps {
3
+ value?: string | number | React.ReactElement;
4
+ }
5
+ export declare const FormFieldCounter: FC<IFormFieldCounterProps>;
6
+ export {};
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { classNames } from "../../commonHelpers/classNames/classNames";
3
+ export const FormFieldCounter = ({ value }) => value ? _jsx("div", { className: classNames(["zen-form-field__length"]), children: value }) : null;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { Skeleton } from "../../skeleton/skeleton";
3
+ import { TFormFieldComponentProps } from "../formField";
4
+ export declare const DEFAULT_HEIGHT = 32;
5
+ export declare const TEXTAREA_HEIGHT = 110;
6
+ interface IFormFieldLoadingProps<T> {
7
+ skeletonProps?: Partial<React.ComponentProps<typeof Skeleton>>;
8
+ props: TFormFieldComponentProps<T>;
9
+ wrapperComponent: React.FC<T>;
10
+ }
11
+ export declare const FormFieldLoading: <T>({ skeletonProps, props, wrapperComponent }: IFormFieldLoadingProps<T>) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Skeleton } from "../../skeleton/skeleton";
3
+ import { TextareaRaw } from "../../textareaRaw/textareaRaw";
4
+ import { useFormFieldProps } from "../hooks/useFormFieldProps";
5
+ export const DEFAULT_HEIGHT = 32;
6
+ export const TEXTAREA_HEIGHT = 110;
7
+ // eslint-disable-next-line @typescript-eslint/comma-dangle
8
+ export const FormFieldLoading = ({ skeletonProps, props, wrapperComponent }) => {
9
+ const { classes } = useFormFieldProps(props, wrapperComponent);
10
+ const height = wrapperComponent.displayName === TextareaRaw.displayName ? TEXTAREA_HEIGHT : DEFAULT_HEIGHT;
11
+ return _jsx(Skeleton, Object.assign({ className: classes, height: height }, skeletonProps));
12
+ };
@@ -1,11 +1,8 @@
1
- export declare const FormFieldWithLabel: ({ hasCustomWidth, classes, widthObj, props, id, container, trailing, trailingId, showAdditionalInfo }: {
2
- hasCustomWidth: any;
3
- classes: any;
4
- widthObj: any;
5
- props: any;
6
- id: any;
7
- container: any;
8
- trailing: any;
9
- trailingId: any;
10
- showAdditionalInfo: any;
11
- }) => import("react/jsx-runtime").JSX.Element;
1
+ /// <reference types="react" />
2
+ import { TFormFieldComponentProps } from "../formField";
3
+ interface IFormFieldWithLabelProps<T> {
4
+ props: TFormFieldComponentProps<T>;
5
+ wrapperComponent: React.FC<T>;
6
+ }
7
+ export declare const FormFieldWithLabel: <T>({ props, wrapperComponent }: IFormFieldWithLabelProps<T>) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -1,9 +1,27 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useContext } from "react";
3
+ import { classNames } from "../../commonHelpers/classNames/classNames";
2
4
  import { FormGroupItem } from "../../formGroupItem/formGroupItem";
3
5
  import { TrailingComponent } from "./trailingComponent";
4
- export const FormFieldWithLabel = ({ hasCustomWidth, classes, widthObj, props, id, container, trailing, trailingId, showAdditionalInfo }) => {
6
+ import { useContainer } from "../hooks/useContainer";
7
+ import { FormSectionContext } from "../../formSection/utils/formSectionProvider";
8
+ import { useFormFieldProps } from "../hooks/useFormFieldProps";
9
+ // eslint-disable-next-line @typescript-eslint/comma-dangle
10
+ export const FormFieldWithLabel = ({ props, wrapperComponent }) => {
11
+ const { id, hasCustomWidth, widthObj, trailingId, trailing, showAdditionalInfo, classes } = useFormFieldProps(props, wrapperComponent);
12
+ const container = useContainer(props, wrapperComponent);
13
+ const labelClasses = classNames([props.labelClassesName || "", props.labelAlign === "top" ? "zen-form-field-label--top" : ""]);
14
+ const { isFormSection } = useContext(FormSectionContext);
15
+ // Form component
16
+ if (isFormSection) {
17
+ if (!hasCustomWidth) {
18
+ return _jsxs("div", { className: classes, children: [props.label && _jsx(FormGroupItem, { className: labelClasses, id: id, value: props.label, tooltip: props.tooltip }), _jsx("div", { className: props.controlClassesName, children: container })] });
19
+ }
20
+ return _jsxs("div", { style: { display: "flex" }, children: [_jsxs("div", { className: classes, style: widthObj, children: [props.label && _jsx(FormGroupItem, { className: labelClasses, id: id, value: props.label, tooltip: props.tooltip }), _jsx("div", { className: props.controlClassesName, children: container })] }), trailing && _jsx(TrailingComponent, { id: trailingId, value: trailing, hasAdditionalInfo: !!showAdditionalInfo })] });
21
+ }
22
+ // Standalone component
5
23
  if (!hasCustomWidth) {
6
- return _jsxs("div", { className: classes, style: widthObj, children: [props.label && _jsx(FormGroupItem, { className: props.labelClassesName, id: id, value: props.label, tooltip: props.tooltip }), _jsx("div", { className: props.controlClassesName, children: container })] });
24
+ return _jsxs("div", { className: classes, children: [props.label && _jsx(FormGroupItem, { className: labelClasses, id: id, value: props.label, tooltip: props.tooltip }), _jsx("div", { className: props.controlClassesName, children: container })] });
7
25
  }
8
- return _jsxs("div", { style: { display: "flex" }, children: [_jsxs("div", { className: classes, style: widthObj, children: [props.label && _jsx(FormGroupItem, { className: props.labelClassesName, id: id, value: props.label, tooltip: props.tooltip }), _jsx("div", { className: props.controlClassesName, children: container })] }), trailing && _jsx(TrailingComponent, { id: trailingId, value: trailing, hasAdditionalInfo: !!showAdditionalInfo })] });
26
+ return _jsxs("div", { style: { display: "flex" }, children: [_jsxs("div", { className: classes, children: [props.label && _jsx(FormGroupItem, { className: labelClasses, id: id, value: props.label, tooltip: props.tooltip }), _jsx("div", { style: widthObj, className: props.controlClassesName, children: container })] }), trailing && _jsx(TrailingComponent, { id: trailingId, value: trailing, hasAdditionalInfo: !!showAdditionalInfo })] });
9
27
  };
@@ -1,9 +1,8 @@
1
- export declare const FormFieldWithoutLabel: ({ hasCustomWidth, classes, widthObj, container, trailing, trailingId, showAdditionalInfo }: {
2
- hasCustomWidth: any;
3
- classes: any;
4
- widthObj: any;
5
- container: any;
6
- trailing: any;
7
- trailingId: any;
8
- showAdditionalInfo: any;
9
- }) => import("react/jsx-runtime").JSX.Element;
1
+ /// <reference types="react" />
2
+ import { TFormFieldComponentProps } from "../formField";
3
+ interface IFormFieldWithoutLabelProps<T> {
4
+ props: TFormFieldComponentProps<T>;
5
+ wrapperComponent: React.FC<T>;
6
+ }
7
+ export declare const FormFieldWithoutLabel: <T>({ props, wrapperComponent }: IFormFieldWithoutLabelProps<T>) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -1,6 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { TrailingComponent } from "./trailingComponent";
3
- export const FormFieldWithoutLabel = ({ hasCustomWidth, classes, widthObj, container, trailing, trailingId, showAdditionalInfo }) => {
3
+ import { useContainer } from "../hooks/useContainer";
4
+ import { useFormFieldProps } from "../hooks/useFormFieldProps";
5
+ // eslint-disable-next-line @typescript-eslint/comma-dangle
6
+ export const FormFieldWithoutLabel = ({ props, wrapperComponent }) => {
7
+ const { hasCustomWidth, widthObj, trailing, trailingId, showAdditionalInfo, classes } = useFormFieldProps(props, wrapperComponent);
8
+ const container = useContainer(props, wrapperComponent);
4
9
  if (!hasCustomWidth) {
5
10
  return _jsx("div", { className: classes, style: widthObj, children: container });
6
11
  }
@@ -0,0 +1,2 @@
1
+ export declare const OLD_FORM_FIELD_COMPONENTS: string[];
2
+ export declare const isOldFormFieldComponent: (component?: React.FC) => boolean;
@@ -0,0 +1,8 @@
1
+ export const OLD_FORM_FIELD_COMPONENTS = [
2
+ "SearchInputRaw",
3
+ "SelectRaw",
4
+ "StepperRaw",
5
+ "TextAreaInput",
6
+ "TextInputRaw"
7
+ ];
8
+ export const isOldFormFieldComponent = (component) => OLD_FORM_FIELD_COMPONENTS.includes((component === null || component === void 0 ? void 0 : component.displayName) || "") || OLD_FORM_FIELD_COMPONENTS.includes((component === null || component === void 0 ? void 0 : component.name) || "");
@@ -1,8 +1,9 @@
1
1
  import { FC } from "react";
2
2
  interface ITrailingComponentProps {
3
3
  id: string;
4
- value: string;
4
+ value?: string | null;
5
5
  hasAdditionalInfo: boolean;
6
+ hasCustomWidth?: boolean;
6
7
  }
7
8
  export declare const TrailingComponent: FC<ITrailingComponentProps>;
8
9
  export {};
@@ -1,5 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- export const TrailingComponent = ({ id, value, hasAdditionalInfo }) => {
2
+ export const TrailingComponent = ({ id, value, hasAdditionalInfo, hasCustomWidth }) => {
3
+ if (hasCustomWidth) {
4
+ return null;
5
+ }
6
+ if (!value) {
7
+ return null;
8
+ }
3
9
  if (hasAdditionalInfo) {
4
10
  return _jsx("div", { className: "zen-form-field__trailing-wrapper", children: _jsx("span", { className: "zen-form-field__trailing-text", id: id, children: value }) });
5
11
  }
@@ -1,39 +1,22 @@
1
- import React, { Ref, PropsWithChildren } from "react";
2
- import { Exclusive } from "../commonHelpers/types/exclusive";
1
+ import React from "react";
3
2
  import { IReactFormItemController, IZenGridItem } from "../commonHelpers/zenComponent";
4
- import { ILoadingBase } from "../commonHelpers/loading";
3
+ import { IFormFieldComponent, TFormField } from "./types";
5
4
  import "./formField.less";
6
- export type TLabelAlign = "left" | "top";
7
- interface IFormFieldBase extends PropsWithChildren {
8
- className?: string;
9
- inputClassName?: string;
10
- error?: string;
11
- assistive?: string;
12
- counter?: string;
13
- trailing?: string;
14
- isReadOnly?: boolean;
15
- disabled?: boolean;
16
- width?: string | number;
17
- }
18
- export interface IFormFieldWithLabel extends IFormFieldBase, ILoadingBase {
19
- label?: string;
20
- labelAlign?: TLabelAlign;
21
- tooltip?: React.ReactNode;
22
- labelClassesName?: string;
23
- controlClassesName?: string;
24
- readOnlyValue?: string | React.ReactNode | ((content: React.ReactNode) => React.ReactNode);
25
- }
26
- export interface IFormField extends IFormFieldBase {
27
- }
28
- export type TFormField = Exclusive<IFormFieldWithLabel, IFormField>;
29
- export interface IFormFieldComponent {
30
- isError?: boolean;
31
- isReadOnly?: boolean;
32
- children?: React.ReactNode;
33
- isLoadingError?: boolean;
34
- bannerLabel?: string;
35
- ref?: Ref<HTMLElement | null>;
36
- }
5
+ /**
6
+ * Use cases:
7
+ * As form component / as standalone component
8
+ * 1 with label
9
+ * 2 without label
10
+ * 3 with banner
11
+ * 4 with assistive text
12
+ * 5 with error
13
+ * 6 with trailing text
14
+ * 7 with loading state
15
+ * 8 loading error (banner)
16
+ * 9 with custom width
17
+ * 10 exceptions (RangeRaw)
18
+ * 11 with counter
19
+ */
37
20
  export type TFormFieldComponentProps<T> = Omit<T, "isError"> & TFormField & IZenGridItem & IReactFormItemController;
38
21
  export declare const FormField: {
39
22
  <T extends IFormFieldComponent>(WrappedComponent: React.FC<T>): {
@@ -42,4 +25,3 @@ export declare const FormField: {
42
25
  };
43
26
  Banner: React.FC<import("./components/formFieldBanner").IFormFieldBannerProps>;
44
27
  };
45
- export {};