@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
@@ -297,6 +297,30 @@ injectString("th", "Last 12 months", "12 \u0E40\u0E14\u0E37\u0E2D\u0E19\u0E17\u0
297
297
  injectString("tr", "Last 12 months", "Son 12 ay");
298
298
  injectString("zh-Hans", "Last 12 months", "\u6700\u8FD1 12 \u4E2A\u6708");
299
299
  injectString("zh-TW", "Last 12 months", "\u904E\u53BB 12 \u500B\u6708");
300
+ injectString("cs", "Year to date", "Od za\u010D\xE1tku roku");
301
+ injectString("da-DK", "Year to date", "\xC5r til dato");
302
+ injectString("de", "Year to date", "Seit Jahresbeginn");
303
+ injectString("en", "Year to date", "Year to date");
304
+ injectString("es", "Year to date", "A\xF1o a la fecha");
305
+ injectString("fi-FI", "Year to date", "Vuoden alusta");
306
+ injectString("fr", "Year to date", "Cumul jusqu\u2019\xE0 ce jour");
307
+ injectString("fr-FR", "Year to date", "L\u2019ann\xE9e pass\xE9e");
308
+ injectString("hu-HU", "Year to date", "\xC9v a mai napig");
309
+ injectString("id", "Year to date", "Tahun hingga saat ini");
310
+ injectString("it", "Year to date", "Dall'inizio dell'anno");
311
+ injectString("ja", "Year to date", "\u7D2F\u8A08");
312
+ injectString("ko-KR", "Year to date", "\uC62C\uD574 \uD604\uC7AC\uAE4C\uC9C0");
313
+ injectString("ms", "Year to date", "Tahun ini hingga tarikh ini");
314
+ injectString("nb-NO", "Year to date", "\xC5r til dato");
315
+ injectString("nl", "Year to date", "Jaar tot heden");
316
+ injectString("pl", "Year to date", "Od pocz\u0105tku roku");
317
+ injectString("pt-BR", "Year to date", "Acumulado no ano");
318
+ injectString("sk-SK", "Year to date", "Rok od za\u010Diatku");
319
+ injectString("sv", "Year to date", "\xC5r till dagens datum");
320
+ injectString("th", "Year to date", "\u0E15\u0E49\u0E19\u0E1B\u0E35\u0E16\u0E36\u0E07\u0E1B\u0E31\u0E08\u0E08\u0E38\u0E1A\u0E31\u0E19");
321
+ injectString("tr", "Year to date", "Y\u0131lba\u015F\u0131ndan bug\xFCne kadar");
322
+ injectString("zh-Hans", "Year to date", "\u5E74\u521D\u81F3\u4ECA");
323
+ injectString("zh-TW", "Year to date", "\u5E74\u521D\u81F3\u4ECA");
300
324
  injectString("cs", "Custom", "Vlastn\xED");
301
325
  injectString("da-DK", "Custom", "Brugerdefineret");
302
326
  injectString("de", "Custom", "Individuell");
@@ -433,7 +457,8 @@ const options = {
433
457
  "ThisQuarter": (translate, toLocalDateTime, _firstDayOfWeek, toReverseOffsetDateTime) => (0, dateRangeUtils_1.GET_THIS_QUARTER_OPTION)(toLocalDateTime, translate, toReverseOffsetDateTime),
434
458
  "LastQuarter": (translate, toLocalDateTime, _firstDayOfWeek, toReverseOffsetDateTime) => (0, dateRangeUtils_1.GET_LAST_QUARTER_OPTION)(toLocalDateTime, translate, toReverseOffsetDateTime),
435
459
  "LastYear": (translate, toLocalDateTime, _firstDayOfWeek, toReverseOffsetDateTime) => (0, dateRangeUtils_1.GET_LAST_YEAR_OPTION)(toLocalDateTime, translate, toReverseOffsetDateTime),
436
- "ThisYear": (translate, toLocalDateTime, _firstDayOfWeek, toReverseOffsetDateTime) => (0, dateRangeUtils_1.GET_THIS_YEAR_OPTION)(toLocalDateTime, translate, toReverseOffsetDateTime)
460
+ "ThisYear": (translate, toLocalDateTime, _firstDayOfWeek, toReverseOffsetDateTime) => (0, dateRangeUtils_1.GET_THIS_YEAR_OPTION)(toLocalDateTime, translate, toReverseOffsetDateTime),
461
+ "YearToDate": (translate, toLocalDateTime, _firstDayOfWeek, toReverseOffsetDateTime) => (0, dateRangeUtils_1.GET_YEAR_TO_DATE_OPTION)(toLocalDateTime, translate, toReverseOffsetDateTime)
437
462
  };
438
463
  function getRangeOption(option, translate, toLocalDateTime, firstDayOfWeek, toReverseOffsetDateTime) {
439
464
  if (typeof option === "string") {
@@ -449,7 +474,7 @@ function getRangeOption(option, translate, toLocalDateTime, firstDayOfWeek, toRe
449
474
  }, option);
450
475
  }
451
476
  exports.getRangeOption = getRangeOption;
452
- 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")];
477
+ 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")];
453
478
  const getRangeOptionsArray = (initialOptions, translate, toLocalDateTime, firstDayOfWeek, toReverseOffsetDateTime, customLabel, isPrevRangeCustom, customGetRangeOptions) => {
454
479
  const optionsArray = initialOptions.map(opt => getRangeOption(opt, translate, toLocalDateTime, firstDayOfWeek, toReverseOffsetDateTime)).filter(option => !!option);
455
480
  const hasCustomOption = customLabel || initialOptions.includes("Custom");
@@ -737,7 +762,7 @@ const getDateRangeAdjustedStep = (translate, label) => {
737
762
  const periodDayAdjusted = ["Today", "Yesterday", translate("Today"), translate("Yesterday")];
738
763
  const periodSevenDaysAdjusted = ["ThisWeek", "NextWeek", "LastWeek", "LastSevenDays", translate("This week"), translate("Next week"), translate("Last week"), translate("Last 7 days")];
739
764
  const periodThirtyDaysAdjusted = ["LastThirtyDays", translate("Last 30 days")];
740
- const yearAdjusted = ["LastYear", "ThisYear", "LastTwelveMonths", translate("Last 12 months"), translate("Last year"), translate("This year")];
765
+ const yearAdjusted = ["LastYear", "ThisYear", "LastTwelveMonths", "YearToDate", translate("Last 12 months"), translate("Last year"), translate("This year"), translate("Year to date")];
741
766
  const quarterAdjusted = ["ThisQuarter", "LastQuarter", translate("This quarter"), translate("Last quarter")];
742
767
  if (!label) {
743
768
  return exports.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,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormFieldAdditionalInfo = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const formFieldAssistiveError_1 = require("./formFieldAssistiveError");
6
+ const formFieldCounter_1 = require("./formFieldCounter");
7
+ const FormFieldAdditionalInfo = ({ assistiveId, errorId, driveTextClass, error, assistive, counter, showAdditionalInfo }) => showAdditionalInfo ?
8
+ (0, jsx_runtime_1.jsxs)("div", { className: "zen-form-field__secondary", children: [(0, jsx_runtime_1.jsx)(formFieldAssistiveError_1.FormFieldAssistiveError, { assistiveId: assistiveId, errorId: errorId, driveTextClass: driveTextClass, value: error, assistive: assistive }), (0, jsx_runtime_1.jsx)(formFieldCounter_1.FormFieldCounter, { value: counter })] })
9
+ : null;
10
+ exports.FormFieldAdditionalInfo = FormFieldAdditionalInfo;
@@ -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,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormFieldAssistiveError = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const classNames_1 = require("../../commonHelpers/classNames/classNames");
6
+ const formFieldError_1 = require("../../formFieldError/formFieldError");
7
+ const FormFieldAssistiveError = ({ assistiveId, errorId, driveTextClass, value, assistive }) => (0, jsx_runtime_1.jsx)("div", { id: assistiveId || errorId, className: (0, classNames_1.classNames)([
8
+ "zen-form-field__text",
9
+ driveTextClass || "",
10
+ value ? "zen-form-field__text--error" : ""
11
+ ]), children: value ? (0, jsx_runtime_1.jsx)(formFieldError_1.FormFieldError, { error: value }) : assistive });
12
+ exports.FormFieldAssistiveError = FormFieldAssistiveError;
@@ -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,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormFieldCounter = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const classNames_1 = require("../../commonHelpers/classNames/classNames");
6
+ const FormFieldCounter = ({ value }) => value ? (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-form-field__length"]), children: value }) : null;
7
+ exports.FormFieldCounter = FormFieldCounter;
@@ -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,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormFieldLoading = exports.TEXTAREA_HEIGHT = exports.DEFAULT_HEIGHT = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const skeleton_1 = require("../../skeleton/skeleton");
6
+ const textareaRaw_1 = require("../../textareaRaw/textareaRaw");
7
+ const useFormFieldProps_1 = require("../hooks/useFormFieldProps");
8
+ exports.DEFAULT_HEIGHT = 32;
9
+ exports.TEXTAREA_HEIGHT = 110;
10
+ // eslint-disable-next-line @typescript-eslint/comma-dangle
11
+ const FormFieldLoading = ({ skeletonProps, props, wrapperComponent }) => {
12
+ const { classes } = (0, useFormFieldProps_1.useFormFieldProps)(props, wrapperComponent);
13
+ const height = wrapperComponent.displayName === textareaRaw_1.TextareaRaw.displayName ? exports.TEXTAREA_HEIGHT : exports.DEFAULT_HEIGHT;
14
+ return (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, Object.assign({ className: classes, height: height }, skeletonProps));
15
+ };
16
+ exports.FormFieldLoading = FormFieldLoading;
@@ -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 {};
@@ -2,12 +2,30 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FormFieldWithLabel = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const classNames_1 = require("../../commonHelpers/classNames/classNames");
5
7
  const formGroupItem_1 = require("../../formGroupItem/formGroupItem");
6
8
  const trailingComponent_1 = require("./trailingComponent");
7
- const FormFieldWithLabel = ({ hasCustomWidth, classes, widthObj, props, id, container, trailing, trailingId, showAdditionalInfo }) => {
9
+ const useContainer_1 = require("../hooks/useContainer");
10
+ const formSectionProvider_1 = require("../../formSection/utils/formSectionProvider");
11
+ const useFormFieldProps_1 = require("../hooks/useFormFieldProps");
12
+ // eslint-disable-next-line @typescript-eslint/comma-dangle
13
+ const FormFieldWithLabel = ({ props, wrapperComponent }) => {
14
+ const { id, hasCustomWidth, widthObj, trailingId, trailing, showAdditionalInfo, classes } = (0, useFormFieldProps_1.useFormFieldProps)(props, wrapperComponent);
15
+ const container = (0, useContainer_1.useContainer)(props, wrapperComponent);
16
+ const labelClasses = (0, classNames_1.classNames)([props.labelClassesName || "", props.labelAlign === "top" ? "zen-form-field-label--top" : ""]);
17
+ const { isFormSection } = (0, react_1.useContext)(formSectionProvider_1.FormSectionContext);
18
+ // Form component
19
+ if (isFormSection) {
20
+ if (!hasCustomWidth) {
21
+ return (0, jsx_runtime_1.jsxs)("div", { className: classes, children: [props.label && (0, jsx_runtime_1.jsx)(formGroupItem_1.FormGroupItem, { className: labelClasses, id: id, value: props.label, tooltip: props.tooltip }), (0, jsx_runtime_1.jsx)("div", { className: props.controlClassesName, children: container })] });
22
+ }
23
+ return (0, jsx_runtime_1.jsxs)("div", { style: { display: "flex" }, children: [(0, jsx_runtime_1.jsxs)("div", { className: classes, style: widthObj, children: [props.label && (0, jsx_runtime_1.jsx)(formGroupItem_1.FormGroupItem, { className: labelClasses, id: id, value: props.label, tooltip: props.tooltip }), (0, jsx_runtime_1.jsx)("div", { className: props.controlClassesName, children: container })] }), trailing && (0, jsx_runtime_1.jsx)(trailingComponent_1.TrailingComponent, { id: trailingId, value: trailing, hasAdditionalInfo: !!showAdditionalInfo })] });
24
+ }
25
+ // Standalone component
8
26
  if (!hasCustomWidth) {
9
- return (0, jsx_runtime_1.jsxs)("div", { className: classes, style: widthObj, children: [props.label && (0, jsx_runtime_1.jsx)(formGroupItem_1.FormGroupItem, { className: props.labelClassesName, id: id, value: props.label, tooltip: props.tooltip }), (0, jsx_runtime_1.jsx)("div", { className: props.controlClassesName, children: container })] });
27
+ return (0, jsx_runtime_1.jsxs)("div", { className: classes, children: [props.label && (0, jsx_runtime_1.jsx)(formGroupItem_1.FormGroupItem, { className: labelClasses, id: id, value: props.label, tooltip: props.tooltip }), (0, jsx_runtime_1.jsx)("div", { className: props.controlClassesName, children: container })] });
10
28
  }
11
- return (0, jsx_runtime_1.jsxs)("div", { style: { display: "flex" }, children: [(0, jsx_runtime_1.jsxs)("div", { className: classes, style: widthObj, children: [props.label && (0, jsx_runtime_1.jsx)(formGroupItem_1.FormGroupItem, { className: props.labelClassesName, id: id, value: props.label, tooltip: props.tooltip }), (0, jsx_runtime_1.jsx)("div", { className: props.controlClassesName, children: container })] }), trailing && (0, jsx_runtime_1.jsx)(trailingComponent_1.TrailingComponent, { id: trailingId, value: trailing, hasAdditionalInfo: !!showAdditionalInfo })] });
29
+ return (0, jsx_runtime_1.jsxs)("div", { style: { display: "flex" }, children: [(0, jsx_runtime_1.jsxs)("div", { className: classes, children: [props.label && (0, jsx_runtime_1.jsx)(formGroupItem_1.FormGroupItem, { className: labelClasses, id: id, value: props.label, tooltip: props.tooltip }), (0, jsx_runtime_1.jsx)("div", { style: widthObj, className: props.controlClassesName, children: container })] }), trailing && (0, jsx_runtime_1.jsx)(trailingComponent_1.TrailingComponent, { id: trailingId, value: trailing, hasAdditionalInfo: !!showAdditionalInfo })] });
12
30
  };
13
31
  exports.FormFieldWithLabel = FormFieldWithLabel;
@@ -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 {};
@@ -3,7 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FormFieldWithoutLabel = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const trailingComponent_1 = require("./trailingComponent");
6
- const FormFieldWithoutLabel = ({ hasCustomWidth, classes, widthObj, container, trailing, trailingId, showAdditionalInfo }) => {
6
+ const useContainer_1 = require("../hooks/useContainer");
7
+ const useFormFieldProps_1 = require("../hooks/useFormFieldProps");
8
+ // eslint-disable-next-line @typescript-eslint/comma-dangle
9
+ const FormFieldWithoutLabel = ({ props, wrapperComponent }) => {
10
+ const { hasCustomWidth, widthObj, trailing, trailingId, showAdditionalInfo, classes } = (0, useFormFieldProps_1.useFormFieldProps)(props, wrapperComponent);
11
+ const container = (0, useContainer_1.useContainer)(props, wrapperComponent);
7
12
  if (!hasCustomWidth) {
8
13
  return (0, jsx_runtime_1.jsx)("div", { className: classes, style: widthObj, children: container });
9
14
  }
@@ -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,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isOldFormFieldComponent = exports.OLD_FORM_FIELD_COMPONENTS = void 0;
4
+ exports.OLD_FORM_FIELD_COMPONENTS = [
5
+ "SearchInputRaw",
6
+ "SelectRaw",
7
+ "StepperRaw",
8
+ "TextAreaInput",
9
+ "TextInputRaw"
10
+ ];
11
+ const isOldFormFieldComponent = (component) => exports.OLD_FORM_FIELD_COMPONENTS.includes((component === null || component === void 0 ? void 0 : component.displayName) || "") || exports.OLD_FORM_FIELD_COMPONENTS.includes((component === null || component === void 0 ? void 0 : component.name) || "");
12
+ exports.isOldFormFieldComponent = isOldFormFieldComponent;
@@ -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 {};
@@ -2,7 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TrailingComponent = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const TrailingComponent = ({ id, value, hasAdditionalInfo }) => {
5
+ const TrailingComponent = ({ id, value, hasAdditionalInfo, hasCustomWidth }) => {
6
+ if (hasCustomWidth) {
7
+ return null;
8
+ }
9
+ if (!value) {
10
+ return null;
11
+ }
6
12
  if (hasAdditionalInfo) {
7
13
  return (0, jsx_runtime_1.jsx)("div", { className: "zen-form-field__trailing-wrapper", children: (0, jsx_runtime_1.jsx)("span", { className: "zen-form-field__trailing-text", id: id, children: value }) });
8
14
  }
@@ -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 {};
@@ -13,92 +13,25 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.FormField = void 0;
15
15
  const jsx_runtime_1 = require("react/jsx-runtime");
16
- const react_1 = require("react");
17
- const classNames_1 = require("../commonHelpers/classNames/classNames");
18
- const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
19
- const formFieldError_1 = require("../formFieldError/formFieldError");
20
16
  const formFieldBanner_1 = require("./components/formFieldBanner");
21
- const useMobile_1 = require("../commonHelpers/hooks/useMobile");
22
- const useBanner_1 = require("./hooks/useBanner");
23
- const useAssistive_1 = require("./hooks/useAssistive");
24
- const useTrailing_1 = require("./hooks/useTrailing");
25
- const useError_1 = require("./hooks/useError");
26
17
  const rangeRawLabelCheck_1 = require("./utils/rangeRawLabelCheck");
27
- const skeleton_1 = require("../skeleton/skeleton");
28
- const textareaRaw_1 = require("../textareaRaw/textareaRaw");
29
18
  const useSkeleton_1 = require("./hooks/useSkeleton");
30
- const useWidth_1 = require("./hooks/useWidth");
31
- const useDisabled_1 = require("./hooks/useDisabled");
32
19
  const useLoading_1 = require("./hooks/useLoading");
33
- const useReadonly_1 = require("./hooks/useReadonly");
34
20
  const formFieldWithLabel_1 = require("./components/formFieldWithLabel");
35
21
  const formFieldWithoutLabel_1 = require("./components/formFieldWithoutLabel");
36
- const trailingComponent_1 = require("./components/trailingComponent");
37
- const formSectionProvider_1 = require("../formSection/utils/formSectionProvider");
38
- const OLD_FORM_FIELD_COMPONENTS = [
39
- "SearchInputRaw",
40
- "SelectRaw",
41
- "StepperRaw",
42
- "TextAreaInput",
43
- "TextInputRaw"
44
- ];
45
- const isOldFormFieldComponent = (component) =>
46
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
47
- 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) || "");
22
+ const formFieldLoading_1 = require("./components/formFieldLoading");
48
23
  // eslint-disable-next-line @typescript-eslint/naming-convention
49
24
  const FormField = function FormFieldInner(WrappedComponent) {
50
- // eslint-disable-next-line complexity
51
25
  const InnerFormField = (props) => {
52
- const isMobile = (0, useMobile_1.useMobile)();
53
- const ref = props.ref;
54
- const { isFormSection } = (0, react_1.useContext)(formSectionProvider_1.FormSectionContext);
55
- const { id: assistiveId, assistive } = (0, useAssistive_1.useAssistive)(props);
56
- const { id: trailingId, trailing } = (0, useTrailing_1.useTrailing)(props);
57
- const { id: errorId, error, errorBanner } = (0, useError_1.useError)(props);
58
- const { id: bannerId, banner: bannerComp } = (0, useBanner_1.useBanner)(props);
59
- const disabledProps = (0, useDisabled_1.useDisabled)(props);
60
- const _a = (0, useWidth_1.useWidth)(props), { hasCustomWidth } = _a, widthObj = __rest(_a, ["hasCustomWidth"]);
61
26
  const skeletonProps = __rest((0, useSkeleton_1.useSkeleton)(props), []);
62
27
  const isLoading = (0, useLoading_1.useLoading)(props, WrappedComponent.displayName);
63
- const isReadonly = (0, useReadonly_1.useReadonly)(props);
64
- // TODO: add tests
65
- const banner = errorBanner || bannerComp;
66
- const isInputContainerHidden = isReadonly && props.isError;
67
- const { className, inputClassName, counter } = props, rest = __rest(props, ["className", "inputClassName", "counter"]);
68
- const driveTextClass = (0, useDriveClassName_1.useDriveClassName)("zen-form-field__text");
69
- // TODO: Banner? Only it or assistive text?
70
- const showAdditionalInfo = (error || assistive || counter) && !isReadonly;
71
- const componentClassName = (0, classNames_1.classNames)(["zen-form-field__input", inputClassName || ""]);
72
- const ariaDescribedBy = `${assistiveId} ${trailingId} ${errorId} ${bannerId}`.trim();
73
- const localId = (0, react_1.useId)();
74
- const id = props.id || localId;
75
- const container = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-form-field__input-container", isReadonly ? "zen-form-field__input-container--review" : "", isInputContainerHidden ? "zen-form-field__input-container--hidden" : "", trailing ? "zen-form-field__input-container--with-trailing" : ""]), children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(WrappedComponent, Object.assign({}, rest, disabledProps, { isReadOnly: isReadonly, id: id, className: componentClassName, ref: ref, isLoadingError: props.isError, isError: !!error, "aria-describedby": ariaDescribedBy })), showAdditionalInfo ?
76
- (0, jsx_runtime_1.jsxs)("div", { className: "zen-form-field__secondary", children: [(0, jsx_runtime_1.jsx)("div", { id: assistiveId || errorId, className: (0, classNames_1.classNames)([
77
- "zen-form-field__text",
78
- driveTextClass || "",
79
- error ? "zen-form-field__text--error" : ""
80
- ]), children: error ? (0, jsx_runtime_1.jsx)(formFieldError_1.FormFieldError, { error: error }) : assistive }), counter
81
- ? (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-form-field__length"]), children: counter })
82
- : ""] })
83
- : null] }), !hasCustomWidth && trailing && (0, jsx_runtime_1.jsx)(trailingComponent_1.TrailingComponent, { id: trailingId, value: trailing, hasAdditionalInfo: !!showAdditionalInfo })] }), banner] }), [isInputContainerHidden, trailing, rest, disabledProps, isReadonly, id, componentClassName, ref, props.isError, error, ariaDescribedBy, hasCustomWidth, trailingId, showAdditionalInfo, assistiveId, errorId, driveTextClass, assistive, counter, banner]);
84
- const classes = (0, classNames_1.classNames)([
85
- "zen-form-field",
86
- isMobile ? "zen-form-field--mobile" : "",
87
- banner ? "zen-form-field--with-banner" : "",
88
- !props.label ? "" : props.labelAlign ? `zen-form-field--label-${props.labelAlign}` : "zen-form-field--label-left",
89
- !isOldFormFieldComponent(WrappedComponent) ? "zen-form-field--new-component" : "",
90
- isFormSection ? "zen-form-field--form-item" : "",
91
- className || ""
92
- ]);
93
28
  if (isLoading) {
94
- const height = WrappedComponent.displayName === textareaRaw_1.TextareaRaw.displayName ? 110 : 32;
95
- return (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, Object.assign({ className: classes, height: height }, skeletonProps));
29
+ return (0, jsx_runtime_1.jsx)(formFieldLoading_1.FormFieldLoading, { props: props, wrapperComponent: WrappedComponent, skeletonProps: skeletonProps });
96
30
  }
97
- // TODO: refactor?
98
31
  if (props.label && (0, rangeRawLabelCheck_1.rangeRawLabelCheck)(WrappedComponent, props)) {
99
- return (0, jsx_runtime_1.jsx)(formFieldWithLabel_1.FormFieldWithLabel, { hasCustomWidth: hasCustomWidth, classes: classes, widthObj: widthObj, props: props, id: id, container: container, trailing: trailing, trailingId: trailingId, showAdditionalInfo: !!showAdditionalInfo });
32
+ return (0, jsx_runtime_1.jsx)(formFieldWithLabel_1.FormFieldWithLabel, { props: props, wrapperComponent: WrappedComponent });
100
33
  }
101
- return (0, jsx_runtime_1.jsx)(formFieldWithoutLabel_1.FormFieldWithoutLabel, { hasCustomWidth: hasCustomWidth, classes: classes, widthObj: widthObj, container: container, trailing: trailing, trailingId: trailingId, showAdditionalInfo: !!showAdditionalInfo });
34
+ return (0, jsx_runtime_1.jsx)(formFieldWithoutLabel_1.FormFieldWithoutLabel, { props: props, wrapperComponent: WrappedComponent });
102
35
  };
103
36
  InnerFormField.displayName = "InnerFormField";
104
37
  return InnerFormField;
@@ -0,0 +1,2 @@
1
+ import { TFormFieldComponentProps } from "../formField";
2
+ export declare const useContainer: <T>(props: TFormFieldComponentProps<T>, wrapperComponent: React.FC<T>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,47 @@
1
+ "use strict";
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)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.useContainer = void 0;
15
+ const jsx_runtime_1 = require("react/jsx-runtime");
16
+ const react_1 = require("react");
17
+ const classNames_1 = require("../../commonHelpers/classNames/classNames");
18
+ const useDriveClassName_1 = require("../../utils/theme/useDriveClassName");
19
+ const formFieldAdditionalInfo_1 = require("../components/formFieldAdditionalInfo");
20
+ const trailingComponent_1 = require("../components/trailingComponent");
21
+ const useAssistive_1 = require("./useAssistive");
22
+ const useBanner_1 = require("./useBanner");
23
+ const useDisabled_1 = require("./useDisabled");
24
+ const useError_1 = require("./useError");
25
+ const useReadonly_1 = require("./useReadonly");
26
+ const useWidth_1 = require("./useWidth");
27
+ const useFormFieldProps_1 = require("./useFormFieldProps");
28
+ // eslint-disable-next-line
29
+ const useContainer = (props, wrapperComponent) => {
30
+ const { id, wrapperComponent: WrappedComponent, trailing, trailingId, showAdditionalInfo } = (0, useFormFieldProps_1.useFormFieldProps)(props, wrapperComponent);
31
+ const { className, inputClassName, counter } = props, rest = __rest(props, ["className", "inputClassName", "counter"]);
32
+ const { id: errorId, error, errorBanner } = (0, useError_1.useError)(props);
33
+ const { id: bannerId, banner: bannerComp } = (0, useBanner_1.useBanner)(props);
34
+ const { id: assistiveId, assistive } = (0, useAssistive_1.useAssistive)(props);
35
+ const disabledProps = (0, useDisabled_1.useDisabled)(props);
36
+ const componentClassName = (0, classNames_1.classNames)(["zen-form-field__input", inputClassName || ""]);
37
+ const ariaDescribedBy = `${assistiveId} ${trailingId} ${errorId} ${bannerId}`.trim();
38
+ const isReadonly = (0, useReadonly_1.useReadonly)(props);
39
+ const { hasCustomWidth } = (0, useWidth_1.useWidth)(props);
40
+ const driveTextClass = (0, useDriveClassName_1.useDriveClassName)("zen-form-field__text");
41
+ const isInputContainerHidden = isReadonly && props.isError;
42
+ const ref = props.ref;
43
+ const banner = errorBanner || bannerComp;
44
+ const container = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-form-field__input-container", isReadonly ? "zen-form-field__input-container--review" : "", isInputContainerHidden ? "zen-form-field__input-container--hidden" : "", trailing ? "zen-form-field__input-container--with-trailing" : ""]), children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(WrappedComponent, Object.assign({}, rest, disabledProps, { isReadOnly: isReadonly, id: id, className: componentClassName, ref: ref, isLoadingError: props.isError, isError: !!error, "aria-describedby": ariaDescribedBy })), (0, jsx_runtime_1.jsx)(formFieldAdditionalInfo_1.FormFieldAdditionalInfo, { assistiveId: assistiveId, errorId: errorId, driveTextClass: driveTextClass, error: error, assistive: assistive, counter: counter, showAdditionalInfo: showAdditionalInfo })] }), (0, jsx_runtime_1.jsx)(trailingComponent_1.TrailingComponent, { hasCustomWidth: hasCustomWidth, id: trailingId, value: trailing, hasAdditionalInfo: !!showAdditionalInfo })] }), banner] }), [isReadonly, isInputContainerHidden, trailing, WrappedComponent, rest, disabledProps, id, componentClassName, ref, props.isError, error, ariaDescribedBy, assistiveId, errorId, driveTextClass, assistive, counter, showAdditionalInfo, hasCustomWidth, trailingId, banner]);
45
+ return container;
46
+ };
47
+ exports.useContainer = useContainer;
@@ -1,6 +1,6 @@
1
1
  import { ReactElement } from "react";
2
2
  import { IReactFormItemController } from "../../commonHelpers/zenComponent";
3
- import { IFormFieldComponent, TFormField } from "../formField";
3
+ import { IFormFieldComponent, TFormField } from "../types";
4
4
  import { Exclusive } from "../../commonHelpers/types/exclusive";
5
5
  import { IFormFieldBannerProps } from "../components/formFieldBanner";
6
6
  export type TErrorType = "text" | "banner";
@@ -0,0 +1,2 @@
1
+ import { TFormFieldComponentProps } from "../formField";
2
+ export declare const useFormFieldClasses: <T>(props: TFormFieldComponentProps<T>, component: React.FC<T>) => string;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useFormFieldClasses = void 0;
4
+ const react_1 = require("react");
5
+ const classNames_1 = require("../../commonHelpers/classNames/classNames");
6
+ const useMobile_1 = require("../../commonHelpers/hooks/useMobile");
7
+ const formSectionProvider_1 = require("../../formSection/utils/formSectionProvider");
8
+ const isOldFormFieldComponent_1 = require("../components/isOldFormFieldComponent");
9
+ const useBanner_1 = require("./useBanner");
10
+ const useError_1 = require("./useError");
11
+ const rangeRawLabelCheck_1 = require("../utils/rangeRawLabelCheck");
12
+ // eslint-disable-next-line @typescript-eslint/comma-dangle
13
+ const useFormFieldClasses = (props, component) => {
14
+ const isMobile = (0, useMobile_1.useMobile)();
15
+ const { isFormSection } = (0, react_1.useContext)(formSectionProvider_1.FormSectionContext);
16
+ const { banner: bannerComp } = (0, useBanner_1.useBanner)(props);
17
+ const { errorBanner } = (0, useError_1.useError)(props);
18
+ const banner = errorBanner || bannerComp;
19
+ const classes = (0, classNames_1.classNames)([
20
+ "zen-form-field",
21
+ isMobile ? "zen-form-field--mobile" : "",
22
+ banner ? "zen-form-field--with-banner" : "",
23
+ (!props.label || !(0, rangeRawLabelCheck_1.rangeRawLabelCheck)(component, props)) ? "" : props.labelAlign ? `zen-form-field--label-${props.labelAlign}` : "zen-form-field--label-left",
24
+ !(0, isOldFormFieldComponent_1.isOldFormFieldComponent)(component) ? "zen-form-field--new-component" : "",
25
+ isFormSection ? "zen-form-field--form-item" : "",
26
+ props.className || ""
27
+ ]);
28
+ return classes;
29
+ };
30
+ exports.useFormFieldClasses = useFormFieldClasses;
@@ -0,0 +1,17 @@
1
+ import { FC } from "react";
2
+ import { TFormFieldComponentProps } from "../formField";
3
+ export declare const useFormFieldProps: <T>(props: TFormFieldComponentProps<T>, wrapperComponent: FC<T>) => {
4
+ id: string;
5
+ wrapperComponent: FC<T>;
6
+ props: TFormFieldComponentProps<T>;
7
+ hasCustomWidth: boolean;
8
+ widthObj: {
9
+ width: string | number;
10
+ } | {
11
+ width?: undefined;
12
+ };
13
+ trailingId: string;
14
+ trailing: string | undefined;
15
+ showAdditionalInfo: boolean;
16
+ classes: string;
17
+ };