@hitachivantara/uikit-react-core 5.66.12 → 5.66.14

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 (263) hide show
  1. package/dist/cjs/ActionsGeneric/ActionsGeneric.cjs +1 -2
  2. package/dist/cjs/AvatarGroup/AvatarGroup.cjs +1 -2
  3. package/dist/cjs/BaseDropdown/BaseDropdown.cjs +2 -4
  4. package/dist/cjs/Box/Box.cjs +13 -14
  5. package/dist/cjs/Button/Button.cjs +3 -6
  6. package/dist/cjs/Calendar/CalendarHeader/CalendarHeader.cjs +2 -4
  7. package/dist/cjs/Calendar/SingleCalendar/CalendarCell.cjs +1 -2
  8. package/dist/cjs/Calendar/SingleCalendar/SingleCalendar.cjs +4 -8
  9. package/dist/cjs/Calendar/utils.cjs +4 -8
  10. package/dist/cjs/Carousel/Carousel.cjs +26 -11
  11. package/dist/cjs/Carousel/CarouselControls.cjs +9 -2
  12. package/dist/cjs/ColorPicker/Fields/Fields.cjs +4 -8
  13. package/dist/cjs/DatePicker/DatePicker.cjs +6 -12
  14. package/dist/cjs/Dialog/Dialog.cjs +2 -4
  15. package/dist/cjs/Drawer/Drawer.cjs +1 -2
  16. package/dist/cjs/DropDownMenu/DropDownMenu.cjs +2 -4
  17. package/dist/cjs/Dropdown/Dropdown.cjs +1 -2
  18. package/dist/cjs/Dropdown/List/List.cjs +2 -4
  19. package/dist/cjs/Dropdown/utils.cjs +1 -2
  20. package/dist/cjs/FileUploader/DropZone/DropZone.cjs +3 -6
  21. package/dist/cjs/FileUploader/FileList/FileList.cjs +1 -2
  22. package/dist/cjs/FilterGroup/FilterContent/FilterContent.cjs +2 -4
  23. package/dist/cjs/Focus/Focus.cjs +7 -14
  24. package/dist/cjs/Forms/FormElement/utils/FormUtils.cjs +6 -4
  25. package/dist/cjs/GlobalActions/GlobalActions.styles.cjs +1 -2
  26. package/dist/cjs/Grid/Grid.cjs +7 -4
  27. package/dist/cjs/Header/Navigation/useSelectionPath.cjs +1 -2
  28. package/dist/cjs/Input/Input.cjs +2 -4
  29. package/dist/cjs/Link/Link.cjs +1 -2
  30. package/dist/cjs/List/List.cjs +12 -15
  31. package/dist/cjs/List/utils.cjs +1 -2
  32. package/dist/cjs/ListContainer/ListContainer.cjs +1 -2
  33. package/dist/cjs/ListContainer/ListContext/ListContext.cjs +1 -2
  34. package/dist/cjs/ListContainer/ListItem/ListItem.cjs +3 -6
  35. package/dist/cjs/LoadingContainer/LoadingContainer.cjs +2 -1
  36. package/dist/cjs/Pagination/Select.cjs +1 -2
  37. package/dist/cjs/QueryBuilder/Rule/Attribute/Attribute.cjs +1 -2
  38. package/dist/cjs/QueryBuilder/Rule/Value/NumericValue/NumericValue.cjs +2 -2
  39. package/dist/cjs/QueryBuilder/utils/reducer.cjs +1 -2
  40. package/dist/cjs/ScrollTo/Horizontal/ScrollToHorizontal.cjs +2 -2
  41. package/dist/cjs/ScrollTo/Vertical/ScrollToVertical.cjs +2 -2
  42. package/dist/cjs/Select/Select.cjs +2 -2
  43. package/dist/cjs/Skeleton/Skeleton.cjs +1 -2
  44. package/dist/cjs/Slider/Slider.cjs +1 -2
  45. package/dist/cjs/Slider/SliderInput/SliderInput.cjs +1 -2
  46. package/dist/cjs/Slider/utils.cjs +4 -8
  47. package/dist/cjs/Stack/Stack.cjs +1 -2
  48. package/dist/cjs/Table/TableContext.cjs +1 -2
  49. package/dist/cjs/Table/TableSectionContext.cjs +1 -2
  50. package/dist/cjs/Table/hooks/useBulkActions.cjs +1 -2
  51. package/dist/cjs/Table/hooks/useRowExpand.cjs +5 -1
  52. package/dist/cjs/Table/utils/fallbacks.cjs +1 -2
  53. package/dist/cjs/Tag/Tag.cjs +2 -4
  54. package/dist/cjs/TagsInput/TagsInput.cjs +2 -3
  55. package/dist/cjs/TextArea/TextArea.cjs +1 -2
  56. package/dist/cjs/TimeAgo/TimeAgo.cjs +1 -2
  57. package/dist/cjs/TimeAgo/useTimeout.cjs +1 -2
  58. package/dist/cjs/TimePicker/Placeholder.cjs +3 -6
  59. package/dist/cjs/TimePicker/TimePicker.cjs +3 -6
  60. package/dist/cjs/TreeView/TreeItem/TreeItem.cjs +2 -1
  61. package/dist/cjs/TreeView/TreeItem/useHvTreeItem.cjs +3 -6
  62. package/dist/cjs/TreeView/internals/DescendantProvider.cjs +1 -2
  63. package/dist/cjs/TreeView/internals/hooks/plugins/useTreeViewExpansion.cjs +1 -2
  64. package/dist/cjs/TreeView/internals/hooks/plugins/useTreeViewFocus.cjs +1 -2
  65. package/dist/cjs/TreeView/internals/hooks/plugins/useTreeViewKeyboardNavigation.cjs +1 -2
  66. package/dist/cjs/TreeView/internals/hooks/plugins/useTreeViewNodes.cjs +1 -2
  67. package/dist/cjs/TreeView/internals/hooks/plugins/useTreeViewSelection.cjs +1 -2
  68. package/dist/cjs/TreeView/internals/hooks/useInstanceEventHandler.cjs +1 -2
  69. package/dist/cjs/TreeView/internals/hooks/useTreeView.cjs +1 -2
  70. package/dist/cjs/TreeView/internals/hooks/useTreeViewInstanceEvents.cjs +1 -2
  71. package/dist/cjs/TreeView/internals/hooks/useTreeViewModels.cjs +1 -2
  72. package/dist/cjs/Typography/utils.cjs +1 -2
  73. package/dist/cjs/VerticalNavigation/Header/Header.cjs +1 -2
  74. package/dist/cjs/VerticalNavigation/Navigation/Navigation.cjs +2 -4
  75. package/dist/cjs/VerticalNavigation/TreeView/TreeView.cjs +3 -6
  76. package/dist/cjs/VerticalNavigation/TreeView/TreeViewItem.cjs +4 -8
  77. package/dist/cjs/hooks/useForkRef.cjs +1 -2
  78. package/dist/cjs/hooks/useUniqueId.cjs +2 -4
  79. package/dist/cjs/providers/Provider.cjs +2 -4
  80. package/dist/cjs/utils/classes.cjs +6 -3
  81. package/dist/cjs/utils/deepMerge.cjs +2 -1
  82. package/dist/cjs/utils/helpers.cjs +1 -2
  83. package/dist/cjs/utils/theme.cjs +1 -2
  84. package/dist/cjs/utils/useSavedState.cjs +1 -2
  85. package/dist/esm/ActionsGeneric/ActionsGeneric.js +1 -2
  86. package/dist/esm/ActionsGeneric/ActionsGeneric.js.map +1 -1
  87. package/dist/esm/AvatarGroup/AvatarGroup.js +1 -2
  88. package/dist/esm/AvatarGroup/AvatarGroup.js.map +1 -1
  89. package/dist/esm/BaseDropdown/BaseDropdown.js +2 -4
  90. package/dist/esm/BaseDropdown/BaseDropdown.js.map +1 -1
  91. package/dist/esm/Box/Box.js +13 -14
  92. package/dist/esm/Box/Box.js.map +1 -1
  93. package/dist/esm/Button/Button.js +3 -6
  94. package/dist/esm/Button/Button.js.map +1 -1
  95. package/dist/esm/Button/Button.styles.js.map +1 -1
  96. package/dist/esm/Calendar/CalendarHeader/CalendarHeader.js +2 -4
  97. package/dist/esm/Calendar/CalendarHeader/CalendarHeader.js.map +1 -1
  98. package/dist/esm/Calendar/SingleCalendar/CalendarCell.js +1 -2
  99. package/dist/esm/Calendar/SingleCalendar/CalendarCell.js.map +1 -1
  100. package/dist/esm/Calendar/SingleCalendar/SingleCalendar.js +4 -8
  101. package/dist/esm/Calendar/SingleCalendar/SingleCalendar.js.map +1 -1
  102. package/dist/esm/Calendar/utils.js +4 -8
  103. package/dist/esm/Calendar/utils.js.map +1 -1
  104. package/dist/esm/Card/Card.js.map +1 -1
  105. package/dist/esm/Carousel/Carousel.js +26 -11
  106. package/dist/esm/Carousel/Carousel.js.map +1 -1
  107. package/dist/esm/Carousel/CarouselControls.js +9 -2
  108. package/dist/esm/Carousel/CarouselControls.js.map +1 -1
  109. package/dist/esm/ColorPicker/Fields/Fields.js +3 -6
  110. package/dist/esm/ColorPicker/Fields/Fields.js.map +1 -1
  111. package/dist/esm/DatePicker/DatePicker.js +6 -12
  112. package/dist/esm/DatePicker/DatePicker.js.map +1 -1
  113. package/dist/esm/Dialog/Dialog.js +2 -4
  114. package/dist/esm/Dialog/Dialog.js.map +1 -1
  115. package/dist/esm/Drawer/Drawer.js +1 -2
  116. package/dist/esm/Drawer/Drawer.js.map +1 -1
  117. package/dist/esm/DropDownMenu/DropDownMenu.js +2 -4
  118. package/dist/esm/DropDownMenu/DropDownMenu.js.map +1 -1
  119. package/dist/esm/Dropdown/Dropdown.js +1 -2
  120. package/dist/esm/Dropdown/Dropdown.js.map +1 -1
  121. package/dist/esm/Dropdown/List/List.js +2 -4
  122. package/dist/esm/Dropdown/List/List.js.map +1 -1
  123. package/dist/esm/Dropdown/utils.js +1 -2
  124. package/dist/esm/Dropdown/utils.js.map +1 -1
  125. package/dist/esm/FileUploader/DropZone/DropZone.js +3 -6
  126. package/dist/esm/FileUploader/DropZone/DropZone.js.map +1 -1
  127. package/dist/esm/FileUploader/FileList/FileList.js +1 -2
  128. package/dist/esm/FileUploader/FileList/FileList.js.map +1 -1
  129. package/dist/esm/FilterGroup/FilterContent/FilterContent.js +2 -4
  130. package/dist/esm/FilterGroup/FilterContent/FilterContent.js.map +1 -1
  131. package/dist/esm/Focus/Focus.js +7 -14
  132. package/dist/esm/Focus/Focus.js.map +1 -1
  133. package/dist/esm/Forms/FormElement/FormElement.js.map +1 -1
  134. package/dist/esm/Forms/FormElement/context/FormElementContext.js.map +1 -1
  135. package/dist/esm/Forms/FormElement/context/FormElementDescriptorsContext.js.map +1 -1
  136. package/dist/esm/Forms/FormElement/utils/FormUtils.js +6 -4
  137. package/dist/esm/Forms/FormElement/utils/FormUtils.js.map +1 -1
  138. package/dist/esm/GlobalActions/GlobalActions.styles.js +1 -2
  139. package/dist/esm/GlobalActions/GlobalActions.styles.js.map +1 -1
  140. package/dist/esm/Grid/Grid.js +7 -4
  141. package/dist/esm/Grid/Grid.js.map +1 -1
  142. package/dist/esm/Header/Navigation/useSelectionPath.js +1 -2
  143. package/dist/esm/Header/Navigation/useSelectionPath.js.map +1 -1
  144. package/dist/esm/Input/Input.js +2 -4
  145. package/dist/esm/Input/Input.js.map +1 -1
  146. package/dist/esm/Link/Link.js +1 -2
  147. package/dist/esm/Link/Link.js.map +1 -1
  148. package/dist/esm/List/List.js +12 -15
  149. package/dist/esm/List/List.js.map +1 -1
  150. package/dist/esm/List/utils.js +1 -2
  151. package/dist/esm/List/utils.js.map +1 -1
  152. package/dist/esm/ListContainer/ListContainer.js +4 -5
  153. package/dist/esm/ListContainer/ListContainer.js.map +1 -1
  154. package/dist/esm/ListContainer/ListContext/ListContext.js +1 -2
  155. package/dist/esm/ListContainer/ListContext/ListContext.js.map +1 -1
  156. package/dist/esm/ListContainer/ListItem/ListItem.js +5 -8
  157. package/dist/esm/ListContainer/ListItem/ListItem.js.map +1 -1
  158. package/dist/esm/Loading/Loading.js.map +1 -1
  159. package/dist/esm/LoadingContainer/LoadingContainer.js +2 -1
  160. package/dist/esm/LoadingContainer/LoadingContainer.js.map +1 -1
  161. package/dist/esm/MultiButton/MultiButton.js.map +1 -1
  162. package/dist/esm/Pagination/Select.js +1 -2
  163. package/dist/esm/Pagination/Select.js.map +1 -1
  164. package/dist/esm/QueryBuilder/Rule/Attribute/Attribute.js +1 -2
  165. package/dist/esm/QueryBuilder/Rule/Attribute/Attribute.js.map +1 -1
  166. package/dist/esm/QueryBuilder/Rule/Operator/Operator.js.map +1 -1
  167. package/dist/esm/QueryBuilder/Rule/Value/NumericValue/NumericValue.js +2 -2
  168. package/dist/esm/QueryBuilder/Rule/Value/NumericValue/NumericValue.js.map +1 -1
  169. package/dist/esm/QueryBuilder/utils/index.js.map +1 -1
  170. package/dist/esm/QueryBuilder/utils/reducer.js +1 -2
  171. package/dist/esm/QueryBuilder/utils/reducer.js.map +1 -1
  172. package/dist/esm/ScrollTo/Horizontal/ScrollToHorizontal.js +2 -2
  173. package/dist/esm/ScrollTo/Horizontal/ScrollToHorizontal.js.map +1 -1
  174. package/dist/esm/ScrollTo/Vertical/ScrollToVertical.js +2 -2
  175. package/dist/esm/ScrollTo/Vertical/ScrollToVertical.js.map +1 -1
  176. package/dist/esm/Section/Section.js.map +1 -1
  177. package/dist/esm/Select/Select.js +2 -2
  178. package/dist/esm/Select/Select.js.map +1 -1
  179. package/dist/esm/SimpleGrid/SimpleGrid.styles.js.map +1 -1
  180. package/dist/esm/Skeleton/Skeleton.js +1 -2
  181. package/dist/esm/Skeleton/Skeleton.js.map +1 -1
  182. package/dist/esm/Slider/Slider.js +1 -2
  183. package/dist/esm/Slider/Slider.js.map +1 -1
  184. package/dist/esm/Slider/SliderInput/SliderInput.js +1 -2
  185. package/dist/esm/Slider/SliderInput/SliderInput.js.map +1 -1
  186. package/dist/esm/Slider/utils.js +4 -8
  187. package/dist/esm/Slider/utils.js.map +1 -1
  188. package/dist/esm/Snackbar/Snackbar.js.map +1 -1
  189. package/dist/esm/Stack/Stack.js +1 -2
  190. package/dist/esm/Stack/Stack.js.map +1 -1
  191. package/dist/esm/Table/TableCell/TableCell.js.map +1 -1
  192. package/dist/esm/Table/TableContext.js +1 -2
  193. package/dist/esm/Table/TableContext.js.map +1 -1
  194. package/dist/esm/Table/TableHeader/TableHeader.js.map +1 -1
  195. package/dist/esm/Table/TableRow/TableRow.js.map +1 -1
  196. package/dist/esm/Table/TableSectionContext.js +1 -2
  197. package/dist/esm/Table/TableSectionContext.js.map +1 -1
  198. package/dist/esm/Table/hooks/useBulkActions.js +1 -2
  199. package/dist/esm/Table/hooks/useBulkActions.js.map +1 -1
  200. package/dist/esm/Table/hooks/useHeaderGroups.js.map +1 -1
  201. package/dist/esm/Table/hooks/usePagination.js.map +1 -1
  202. package/dist/esm/Table/hooks/useResizeColumns.js.map +1 -1
  203. package/dist/esm/Table/hooks/useRowExpand.js +5 -1
  204. package/dist/esm/Table/hooks/useRowExpand.js.map +1 -1
  205. package/dist/esm/Table/hooks/useRowSelection.js.map +1 -1
  206. package/dist/esm/Table/hooks/useSortBy.js.map +1 -1
  207. package/dist/esm/Table/hooks/useSticky.js.map +1 -1
  208. package/dist/esm/Table/hooks/useTableStyles.js.map +1 -1
  209. package/dist/esm/Table/utils/fallbacks.js +1 -2
  210. package/dist/esm/Table/utils/fallbacks.js.map +1 -1
  211. package/dist/esm/Tag/Tag.js +2 -4
  212. package/dist/esm/Tag/Tag.js.map +1 -1
  213. package/dist/esm/TagsInput/TagsInput.js +2 -3
  214. package/dist/esm/TagsInput/TagsInput.js.map +1 -1
  215. package/dist/esm/TextArea/TextArea.js +1 -2
  216. package/dist/esm/TextArea/TextArea.js.map +1 -1
  217. package/dist/esm/TimeAgo/TimeAgo.js +1 -2
  218. package/dist/esm/TimeAgo/TimeAgo.js.map +1 -1
  219. package/dist/esm/TimeAgo/useTimeout.js +1 -2
  220. package/dist/esm/TimeAgo/useTimeout.js.map +1 -1
  221. package/dist/esm/TimePicker/Placeholder.js +3 -6
  222. package/dist/esm/TimePicker/Placeholder.js.map +1 -1
  223. package/dist/esm/TimePicker/TimePicker.js +3 -6
  224. package/dist/esm/TimePicker/TimePicker.js.map +1 -1
  225. package/dist/esm/TreeView/TreeItem/TreeItem.js +2 -1
  226. package/dist/esm/TreeView/TreeItem/TreeItem.js.map +1 -1
  227. package/dist/esm/TreeView/TreeItem/useHvTreeItem.js +2 -4
  228. package/dist/esm/TreeView/TreeItem/useHvTreeItem.js.map +1 -1
  229. package/dist/esm/Typography/utils.js +1 -2
  230. package/dist/esm/Typography/utils.js.map +1 -1
  231. package/dist/esm/VerticalNavigation/Header/Header.js +1 -2
  232. package/dist/esm/VerticalNavigation/Header/Header.js.map +1 -1
  233. package/dist/esm/VerticalNavigation/Navigation/Navigation.js +2 -4
  234. package/dist/esm/VerticalNavigation/Navigation/Navigation.js.map +1 -1
  235. package/dist/esm/VerticalNavigation/NavigationSlider/utils/NavigationSlider.utils.js.map +1 -1
  236. package/dist/esm/VerticalNavigation/TreeView/TreeView.js +3 -6
  237. package/dist/esm/VerticalNavigation/TreeView/TreeView.js.map +1 -1
  238. package/dist/esm/VerticalNavigation/TreeView/TreeViewContext.js.map +1 -1
  239. package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.js +4 -8
  240. package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.js.map +1 -1
  241. package/dist/esm/VerticalNavigation/VerticalNavigation.js.map +1 -1
  242. package/dist/esm/VerticalNavigation/VerticalNavigationContext.js.map +1 -1
  243. package/dist/esm/hocs/withTooltip.js.map +1 -1
  244. package/dist/esm/hooks/useComputation.js.map +1 -1
  245. package/dist/esm/hooks/useCss.js.map +1 -1
  246. package/dist/esm/hooks/useForkRef.js.map +1 -1
  247. package/dist/esm/hooks/useUniqueId.js +1 -2
  248. package/dist/esm/hooks/useUniqueId.js.map +1 -1
  249. package/dist/esm/providers/Provider.js +2 -4
  250. package/dist/esm/providers/Provider.js.map +1 -1
  251. package/dist/esm/types/generic.js.map +1 -1
  252. package/dist/esm/utils/classes.js +6 -3
  253. package/dist/esm/utils/classes.js.map +1 -1
  254. package/dist/esm/utils/deepMerge.js +2 -1
  255. package/dist/esm/utils/deepMerge.js.map +1 -1
  256. package/dist/esm/utils/helpers.js +1 -2
  257. package/dist/esm/utils/helpers.js.map +1 -1
  258. package/dist/esm/utils/theme.js +1 -2
  259. package/dist/esm/utils/theme.js.map +1 -1
  260. package/dist/esm/utils/useSavedState.js +1 -2
  261. package/dist/esm/utils/useSavedState.js.map +1 -1
  262. package/dist/types/index.d.ts +299 -365
  263. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"FormElement.js","sources":["../../../../src/Forms/FormElement/FormElement.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { useDefaultProps } from \"../../hooks/useDefaultProps\";\nimport { useUniqueId } from \"../../hooks/useUniqueId\";\nimport { HvBaseProps } from \"../../types/generic\";\nimport { ExtractNames } from \"../../utils/classes\";\nimport { HvFormElementContextProvider } from \"./context/FormElementContext\";\nimport { HvFormElementDescriptorsContextProvider } from \"./context/FormElementDescriptorsContext\";\nimport { HvFormElementValueContextProvider } from \"./context/FormElementValueContext\";\nimport { staticClasses, useClasses } from \"./FormElement.styles\";\nimport { findDescriptors } from \"./utils/FormUtils\";\n\nexport { staticClasses as formElementClasses };\n\nexport type HvFormElementClasses = ExtractNames<typeof useClasses>;\n\nexport type HvFormStatus = \"standBy\" | \"valid\" | \"invalid\" | \"empty\";\n\nexport interface HvFormElementProps\n extends HvBaseProps<HTMLDivElement, \"onChange\"> {\n /**\n * Name of the form element.\n *\n * Part of a name/value pair, should be the name property of the underling native input.\n */\n name?: string;\n /**\n * Current value of the form element.\n *\n * Part of a name/value pair, should be the value property of the underling native input.\n */\n value?: any;\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be provided instead.\n */\n label?: React.ReactNode;\n /** Provide additional descriptive text for the form element. */\n description?: React.ReactNode;\n /** Whether the form element is disabled. */\n disabled?: boolean;\n /** Indicates that the form element is not editable. */\n readOnly?: boolean;\n /** Indicates that user input is required on the form element. */\n required?: boolean;\n /**\n * The status of the form element.\n *\n * Valid is correct, invalid is incorrect and standBy means no validations have run.\n *\n * When uncontrolled and unspecified it will default to \"standBy\" and change to either \"valid\"\n * or \"invalid\" after any change to the state.\n */\n status?: HvFormStatus;\n /** The error message to show when `status` is \"invalid\". */\n statusMessage?: string;\n /** The callback fired when the value changes. */\n onChange?: (event: React.FormEvent<HTMLDivElement>) => void;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvFormElementClasses;\n}\n\nexport const HvFormElement = (props: HvFormElementProps) => {\n const {\n classes: classesProp,\n className,\n children,\n id,\n name,\n value,\n disabled = false,\n required = false,\n readOnly = false,\n status = \"standBy\",\n ...others\n } = useDefaultProps(\"HvFormElement\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const elementId = useUniqueId(id);\n\n const contextValue = useMemo(\n () => ({\n elementId,\n elementName: name,\n elementStatus: status,\n elementDisabled: disabled,\n elementRequired: required,\n elementReadOnly: readOnly,\n }),\n [disabled, elementId, name, readOnly, required, status],\n );\n\n const descriptors = useMemo(() => findDescriptors(children), [children]);\n\n return (\n <div id={id} className={cx(classes.root, className)} {...others}>\n <HvFormElementContextProvider value={contextValue}>\n <HvFormElementValueContextProvider value={value}>\n <HvFormElementDescriptorsContextProvider value={descriptors}>\n {children}\n </HvFormElementDescriptorsContextProvider>\n </HvFormElementValueContextProvider>\n </HvFormElementContextProvider>\n </div>\n );\n};\n\nHvFormElement.formElementType = \"formelement\";\n"],"names":[],"mappings":";;;;;;;;;;AAgEa,MAAA,gBAAgB,CAAC,UAA8B;AACpD,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,WAAW;AAAA,IACX,WAAW;AAAA,IACX,SAAS;AAAA,IACT,GAAG;AAAA,EAAA,IACD,gBAAgB,iBAAiB,KAAK;AAE1C,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAExC,QAAA,YAAY,YAAY,EAAE;AAEhC,QAAM,eAAe;AAAA,IACnB,OAAO;AAAA,MACL;AAAA,MACA,aAAa;AAAA,MACb,eAAe;AAAA,MACf,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,IAAA;AAAA,IAEnB,CAAC,UAAU,WAAW,MAAM,UAAU,UAAU,MAAM;AAAA,EAAA;AAGlD,QAAA,cAAc,QAAQ,MAAM,gBAAgB,QAAQ,GAAG,CAAC,QAAQ,CAAC;AAGrE,SAAA,oBAAC,OAAI,EAAA,IAAQ,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,QACvD,UAAA,oBAAC,gCAA6B,OAAO,cACnC,UAAC,oBAAA,mCAAA,EAAkC,OACjC,UAAA,oBAAC,yCAAwC,EAAA,OAAO,aAC7C,SAAA,CACH,EACF,CAAA,EAAA,CACF,EACF,CAAA;AAEJ;AAEA,cAAc,kBAAkB;"}
1
+ {"version":3,"file":"FormElement.js","sources":["../../../../src/Forms/FormElement/FormElement.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { useDefaultProps } from \"../../hooks/useDefaultProps\";\nimport { useUniqueId } from \"../../hooks/useUniqueId\";\nimport { HvBaseProps } from \"../../types/generic\";\nimport { ExtractNames } from \"../../utils/classes\";\nimport { HvFormElementContextProvider } from \"./context/FormElementContext\";\nimport { HvFormElementDescriptorsContextProvider } from \"./context/FormElementDescriptorsContext\";\nimport { HvFormElementValueContextProvider } from \"./context/FormElementValueContext\";\nimport { staticClasses, useClasses } from \"./FormElement.styles\";\nimport { findDescriptors } from \"./utils/FormUtils\";\n\nexport { staticClasses as formElementClasses };\n\nexport type HvFormElementClasses = ExtractNames<typeof useClasses>;\n\nexport type HvFormStatus = \"standBy\" | \"valid\" | \"invalid\" | \"empty\";\n\nexport interface HvFormElementProps\n extends HvBaseProps<HTMLDivElement, \"onChange\" | \"onToggle\"> {\n /**\n * Name of the form element.\n *\n * Part of a name/value pair, should be the name property of the underling native input.\n */\n name?: string;\n /**\n * Current value of the form element.\n *\n * Part of a name/value pair, should be the value property of the underling native input.\n */\n value?: any;\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be provided instead.\n */\n label?: React.ReactNode;\n /** Provide additional descriptive text for the form element. */\n description?: React.ReactNode;\n /** Whether the form element is disabled. */\n disabled?: boolean;\n /** Indicates that the form element is not editable. */\n readOnly?: boolean;\n /** Indicates that user input is required on the form element. */\n required?: boolean;\n /**\n * The status of the form element.\n *\n * Valid is correct, invalid is incorrect and standBy means no validations have run.\n *\n * When uncontrolled and unspecified it will default to \"standBy\" and change to either \"valid\"\n * or \"invalid\" after any change to the state.\n */\n status?: HvFormStatus;\n /** The error message to show when `status` is \"invalid\". */\n statusMessage?: string;\n /** The callback fired when the value changes. */\n onChange?: (event: React.FormEvent<HTMLDivElement>) => void;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvFormElementClasses;\n}\n\nexport const HvFormElement = (props: HvFormElementProps) => {\n const {\n classes: classesProp,\n className,\n children,\n id,\n name,\n value,\n disabled = false,\n required = false,\n readOnly = false,\n status = \"standBy\",\n ...others\n } = useDefaultProps(\"HvFormElement\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const elementId = useUniqueId(id);\n\n const contextValue = useMemo(\n () => ({\n elementId,\n elementName: name,\n elementStatus: status,\n elementDisabled: disabled,\n elementRequired: required,\n elementReadOnly: readOnly,\n }),\n [disabled, elementId, name, readOnly, required, status],\n );\n\n const descriptors = useMemo(() => findDescriptors(children), [children]);\n\n return (\n <div id={id} className={cx(classes.root, className)} {...others}>\n <HvFormElementContextProvider value={contextValue}>\n <HvFormElementValueContextProvider value={value}>\n <HvFormElementDescriptorsContextProvider value={descriptors}>\n {children}\n </HvFormElementDescriptorsContextProvider>\n </HvFormElementValueContextProvider>\n </HvFormElementContextProvider>\n </div>\n );\n};\n\nHvFormElement.formElementType = \"formelement\";\n"],"names":[],"mappings":";;;;;;;;;;AAgEa,MAAA,gBAAgB,CAAC,UAA8B;AACpD,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,WAAW;AAAA,IACX,WAAW;AAAA,IACX,SAAS;AAAA,IACT,GAAG;AAAA,EAAA,IACD,gBAAgB,iBAAiB,KAAK;AAE1C,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAExC,QAAA,YAAY,YAAY,EAAE;AAEhC,QAAM,eAAe;AAAA,IACnB,OAAO;AAAA,MACL;AAAA,MACA,aAAa;AAAA,MACb,eAAe;AAAA,MACf,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,IAAA;AAAA,IAEnB,CAAC,UAAU,WAAW,MAAM,UAAU,UAAU,MAAM;AAAA,EAAA;AAGlD,QAAA,cAAc,QAAQ,MAAM,gBAAgB,QAAQ,GAAG,CAAC,QAAQ,CAAC;AAGrE,SAAA,oBAAC,OAAI,EAAA,IAAQ,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,QACvD,UAAA,oBAAC,gCAA6B,OAAO,cACnC,UAAC,oBAAA,mCAAA,EAAkC,OACjC,UAAA,oBAAC,yCAAwC,EAAA,OAAO,aAC7C,SAAA,CACH,EACF,CAAA,EAAA,CACF,EACF,CAAA;AAEJ;AAEA,cAAc,kBAAkB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormElementContext.js","sources":["../../../../../src/Forms/FormElement/context/FormElementContext.ts"],"sourcesContent":["import React from \"react\";\n\nexport const HvFormElementContext = React.createContext<{\n elementId?: string;\n elementDisabled?: boolean;\n elementRequired?: boolean;\n elementStatus?: string;\n}>({});\n\nexport const HvFormElementContextProvider = HvFormElementContext.Provider;\nexport const HvFormElementContextConsumer = HvFormElementContext.Consumer;\nexport default HvFormElementContext;\n"],"names":["React"],"mappings":";AAEO,MAAM,uBAAuBA,eAAM,cAKvC,EAAE;AAEE,MAAM,+BAA+B,qBAAqB;AAC1D,MAAM,+BAA+B,qBAAqB;"}
1
+ {"version":3,"file":"FormElementContext.js","sources":["../../../../../src/Forms/FormElement/context/FormElementContext.ts"],"sourcesContent":["import React from \"react\";\n\nexport interface HvFormElementContextValue {\n elementId?: string;\n elementDisabled?: boolean;\n elementRequired?: boolean;\n elementStatus?: string;\n elementReadOnly?: boolean;\n elementName?: string;\n}\n\nexport const HvFormElementContext =\n React.createContext<HvFormElementContextValue>({});\n\nexport const HvFormElementContextProvider = HvFormElementContext.Provider;\nexport const HvFormElementContextConsumer = HvFormElementContext.Consumer;\nexport default HvFormElementContext;\n"],"names":["React"],"mappings":";AAWO,MAAM,uBACXA,eAAM,cAAyC,EAAE;AAE5C,MAAM,+BAA+B,qBAAqB;AAC1D,MAAM,+BAA+B,qBAAqB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormElementDescriptorsContext.js","sources":["../../../../../src/Forms/FormElement/context/FormElementDescriptorsContext.ts"],"sourcesContent":["import React from \"react\";\n\nexport const HvFormElementDescriptorsContext = React.createContext<{\n input?: any;\n label?: any;\n}>({});\n\nexport const HvFormElementDescriptorsContextProvider =\n HvFormElementDescriptorsContext.Provider;\nexport const HvFormElementDescriptorsContextConsumer =\n HvFormElementDescriptorsContext.Consumer;\nexport default HvFormElementDescriptorsContext;\n"],"names":["React"],"mappings":";AAEO,MAAM,kCAAkCA,eAAM,cAGlD,EAAE;AAEE,MAAM,0CACX,gCAAgC;AAC3B,MAAM,0CACX,gCAAgC;"}
1
+ {"version":3,"file":"FormElementDescriptorsContext.js","sources":["../../../../../src/Forms/FormElement/context/FormElementDescriptorsContext.ts"],"sourcesContent":["import React from \"react\";\n\nexport interface HvFormElementDescriptorsContextValue {\n input?: any;\n label?: any;\n descriptors?: any;\n}\n\nexport const HvFormElementDescriptorsContext =\n React.createContext<HvFormElementDescriptorsContextValue>({});\n\nexport const HvFormElementDescriptorsContextProvider =\n HvFormElementDescriptorsContext.Provider;\nexport const HvFormElementDescriptorsContextConsumer =\n HvFormElementDescriptorsContext.Consumer;\nexport default HvFormElementDescriptorsContext;\n"],"names":["React"],"mappings":";AAQO,MAAM,kCACXA,eAAM,cAAoD,EAAE;AAEvD,MAAM,0CACX,gCAAgC;AAC3B,MAAM,0CACX,gCAAgC;"}
@@ -10,10 +10,12 @@ const findDescriptors = (children, descriptors = {
10
10
  }) => {
11
11
  React__default.Children.forEach(children, (child) => {
12
12
  if (child?.type?.formElementType && child.props?.id) {
13
- descriptors[child.type.formElementType]?.push({
14
- id: child.props?.id,
15
- htmlFor: child.props?.htmlFor
16
- });
13
+ descriptors[child.type.formElementType]?.push(
14
+ {
15
+ id: child.props?.id,
16
+ htmlFor: child.props?.htmlFor
17
+ }
18
+ );
17
19
  }
18
20
  if (child?.type?.formElementType !== "formelement") {
19
21
  findDescriptors(child?.props?.children, descriptors);
@@ -1 +1 @@
1
- {"version":3,"file":"FormUtils.js","sources":["../../../../../src/Forms/FormElement/utils/FormUtils.ts"],"sourcesContent":["import React from \"react\";\n\ninterface Descriptor {\n id?: string;\n htmlFor?: string;\n}\n/**\n * Scans the element's children looking for the children IDs that match the different form element types.\n * This function will produce an object that has a key for each provided name\n * Inside each key there will be an array with each id of the found descriptor.\n *\n * @param {Array} children - The children inside the form element to scan.\n * @param {Object} descriptors - Initial descriptors map (used for recursion).\n *\n */\nconst findDescriptors = (\n children,\n descriptors: {\n input: Descriptor[];\n label: Descriptor[];\n description: Descriptor[];\n controlled: Descriptor[];\n errormessage: Descriptor[];\n HvCalendarHeader?: Descriptor[];\n } = {\n input: [],\n label: [],\n description: [],\n controlled: [],\n errormessage: [],\n\n // TODO: refactor this out\n HvCalendarHeader: [],\n },\n) => {\n React.Children.forEach(children, (child) => {\n if (child?.type?.formElementType && child.props?.id) {\n descriptors[child.type.formElementType]?.push({\n id: child.props?.id,\n htmlFor: child.props?.htmlFor,\n });\n }\n\n if (child?.type?.formElementType !== \"formelement\") {\n findDescriptors(child?.props?.children, descriptors);\n }\n });\n\n return descriptors;\n};\n\nconst getIdReferenceListFor = (\n formElementType,\n descriptors,\n filterFor = null,\n) => {\n const referenceList = descriptors?.[formElementType]\n ?.filter((d) => d.htmlFor !== filterFor)\n ?.map((d) => d.id)\n .join(\" \")\n .trim();\n\n return referenceList !== \"\" ? referenceList : undefined;\n};\n\nconst getIdReferenceFor = (formElementType, descriptors, filterFor = null) => {\n const referenceList = descriptors?.[formElementType]\n ?.filter((d) => d.htmlFor !== filterFor)\n ?.map((d) => d.id)?.[0];\n\n return referenceList !== \"\" ? referenceList : undefined;\n};\n\nconst buildFormElementPropsFromContext = (\n name,\n disabled,\n readOnly,\n required,\n context,\n) => {\n return {\n name: name || context?.elementName,\n disabled: disabled !== undefined ? disabled : context?.elementDisabled,\n readOnly: readOnly !== undefined ? readOnly : context?.elementReadOnly,\n required: required !== undefined ? required : context?.elementRequired,\n status: context?.elementStatus,\n };\n};\n\nconst buildAriaPropsFromContext = (props, context, isInvalid, inputId) => {\n const arias: React.AriaAttributes = {\n \"aria-labelledby\":\n props?.[\"aria-labelledby\"] !== undefined\n ? props?.[\"aria-labelledby\"]\n : getIdReferenceListFor(\"label\", context?.descriptors, inputId),\n \"aria-describedby\":\n props?.[\"aria-describedby\"] !== undefined\n ? props?.[\"aria-describedby\"]\n : getIdReferenceListFor(\"description\", context?.descriptors),\n \"aria-controls\":\n props?.[\"aria-controls\"] !== undefined\n ? props?.[\"aria-controls\"]\n : getIdReferenceListFor(\"controlled\", context?.descriptors),\n };\n\n if (isInvalid) {\n arias[\"aria-invalid\"] = isInvalid;\n arias[\"aria-errormessage\"] =\n props?.[\"aria-errormessage\"] !== undefined\n ? props?.[\"aria-errormessage\"]\n : getIdReferenceFor(\"errormessage\", context?.descriptors);\n }\n\n return arias;\n};\n\nexport {\n findDescriptors,\n getIdReferenceListFor,\n getIdReferenceFor,\n buildFormElementPropsFromContext,\n buildAriaPropsFromContext,\n};\n"],"names":["React"],"mappings":";AAeM,MAAA,kBAAkB,CACtB,UACA,cAOI;AAAA,EACF,OAAO,CAAC;AAAA,EACR,OAAO,CAAC;AAAA,EACR,aAAa,CAAC;AAAA,EACd,YAAY,CAAC;AAAA,EACb,cAAc,CAAC;AAAA;AAAA,EAGf,kBAAkB,CAAC;AACrB,MACG;AACHA,iBAAM,SAAS,QAAQ,UAAU,CAAC,UAAU;AAC1C,QAAI,OAAO,MAAM,mBAAmB,MAAM,OAAO,IAAI;AACnD,kBAAY,MAAM,KAAK,eAAe,GAAG,KAAK;AAAA,QAC5C,IAAI,MAAM,OAAO;AAAA,QACjB,SAAS,MAAM,OAAO;AAAA,MAAA,CACvB;AAAA,IACH;AAEI,QAAA,OAAO,MAAM,oBAAoB,eAAe;AAClC,sBAAA,OAAO,OAAO,UAAU,WAAW;AAAA,IACrD;AAAA,EAAA,CACD;AAEM,SAAA;AACT;AAEA,MAAM,wBAAwB,CAC5B,iBACA,aACA,YAAY,SACT;AACG,QAAA,gBAAgB,cAAc,eAAe,GAC/C,OAAO,CAAC,MAAM,EAAE,YAAY,SAAS,GACrC,IAAI,CAAC,MAAM,EAAE,EAAE,EAChB,KAAK,GAAG,EACR;AAEI,SAAA,kBAAkB,KAAK,gBAAgB;AAChD;AAEA,MAAM,oBAAoB,CAAC,iBAAiB,aAAa,YAAY,SAAS;AAC5E,QAAM,gBAAgB,cAAc,eAAe,GAC/C,OAAO,CAAC,MAAM,EAAE,YAAY,SAAS,GACrC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC;AAEjB,SAAA,kBAAkB,KAAK,gBAAgB;AAChD;AAEA,MAAM,mCAAmC,CACvC,MACA,UACA,UACA,UACA,YACG;AACI,SAAA;AAAA,IACL,MAAM,QAAQ,SAAS;AAAA,IACvB,UAAU,aAAa,SAAY,WAAW,SAAS;AAAA,IACvD,UAAU,aAAa,SAAY,WAAW,SAAS;AAAA,IACvD,UAAU,aAAa,SAAY,WAAW,SAAS;AAAA,IACvD,QAAQ,SAAS;AAAA,EAAA;AAErB;AAEA,MAAM,4BAA4B,CAAC,OAAO,SAAS,WAAW,YAAY;AACxE,QAAM,QAA8B;AAAA,IAClC,mBACE,QAAQ,iBAAiB,MAAM,SAC3B,QAAQ,iBAAiB,IACzB,sBAAsB,SAAS,SAAS,aAAa,OAAO;AAAA,IAClE,oBACE,QAAQ,kBAAkB,MAAM,SAC5B,QAAQ,kBAAkB,IAC1B,sBAAsB,eAAe,SAAS,WAAW;AAAA,IAC/D,iBACE,QAAQ,eAAe,MAAM,SACzB,QAAQ,eAAe,IACvB,sBAAsB,cAAc,SAAS,WAAW;AAAA,EAAA;AAGhE,MAAI,WAAW;AACb,UAAM,cAAc,IAAI;AACxB,UAAM,mBAAmB,IACvB,QAAQ,mBAAmB,MAAM,SAC7B,QAAQ,mBAAmB,IAC3B,kBAAkB,gBAAgB,SAAS,WAAW;AAAA,EAC9D;AAEO,SAAA;AACT;"}
1
+ {"version":3,"file":"FormUtils.js","sources":["../../../../../src/Forms/FormElement/utils/FormUtils.ts"],"sourcesContent":["import React from \"react\";\nimport { InputBaseComponentProps } from \"@mui/material\";\n\nimport { HvFormElementContextValue } from \"../context/FormElementContext\";\nimport { HvFormElementDescriptorsContextValue } from \"../context/FormElementDescriptorsContext\";\n\ninterface Descriptor {\n id?: string;\n htmlFor?: string;\n}\n/**\n * Scans the element's children looking for the children IDs that match the different form element types.\n * This function will produce an object that has a key for each provided name\n * Inside each key there will be an array with each id of the found descriptor.\n *\n * @param {Array} children - The children inside the form element to scan.\n * @param {Object} descriptors - Initial descriptors map (used for recursion).\n *\n */\nconst findDescriptors = (\n children: React.ReactNode,\n descriptors: {\n input: Descriptor[];\n label: Descriptor[];\n description: Descriptor[];\n controlled: Descriptor[];\n errormessage: Descriptor[];\n HvCalendarHeader?: Descriptor[];\n } = {\n input: [],\n label: [],\n description: [],\n controlled: [],\n errormessage: [],\n\n // TODO: refactor this out\n HvCalendarHeader: [],\n },\n) => {\n React.Children.forEach(children, (child: any) => {\n if (child?.type?.formElementType && child.props?.id) {\n descriptors[child.type.formElementType as keyof typeof descriptors]?.push(\n {\n id: child.props?.id,\n htmlFor: child.props?.htmlFor,\n },\n );\n }\n\n if (child?.type?.formElementType !== \"formelement\") {\n findDescriptors(child?.props?.children, descriptors);\n }\n });\n\n return descriptors;\n};\n\nconst getIdReferenceListFor = (\n formElementType: string,\n descriptors: any,\n filterFor: string | null = null,\n) => {\n const referenceList = descriptors?.[formElementType]\n ?.filter((d: any) => d.htmlFor !== filterFor)\n ?.map((d: any) => d.id)\n .join(\" \")\n .trim();\n\n return referenceList !== \"\" ? referenceList : undefined;\n};\n\nconst getIdReferenceFor = (\n formElementType: string,\n descriptors: any,\n filterFor = null,\n) => {\n const referenceList = descriptors?.[formElementType]\n ?.filter((d: any) => d.htmlFor !== filterFor)\n ?.map((d: any) => d.id)?.[0];\n\n return referenceList !== \"\" ? referenceList : undefined;\n};\n\nconst buildFormElementPropsFromContext = (\n name?: string,\n disabled?: boolean,\n readOnly?: boolean,\n required?: boolean,\n context?: HvFormElementContextValue,\n) => {\n return {\n name: name || context?.elementName,\n disabled: disabled !== undefined ? disabled : context?.elementDisabled,\n readOnly: readOnly !== undefined ? readOnly : context?.elementReadOnly,\n required: required !== undefined ? required : context?.elementRequired,\n status: context?.elementStatus,\n };\n};\n\nconst buildAriaPropsFromContext = (\n props: InputBaseComponentProps,\n context: HvFormElementDescriptorsContextValue,\n isInvalid: boolean,\n inputId?: string,\n) => {\n const arias: React.AriaAttributes = {\n \"aria-labelledby\":\n props?.[\"aria-labelledby\"] !== undefined\n ? props?.[\"aria-labelledby\"]\n : getIdReferenceListFor(\"label\", context?.descriptors, inputId),\n \"aria-describedby\":\n props?.[\"aria-describedby\"] !== undefined\n ? props?.[\"aria-describedby\"]\n : getIdReferenceListFor(\"description\", context?.descriptors),\n \"aria-controls\":\n props?.[\"aria-controls\"] !== undefined\n ? props?.[\"aria-controls\"]\n : getIdReferenceListFor(\"controlled\", context?.descriptors),\n };\n\n if (isInvalid) {\n arias[\"aria-invalid\"] = isInvalid;\n arias[\"aria-errormessage\"] =\n props?.[\"aria-errormessage\"] !== undefined\n ? props?.[\"aria-errormessage\"]\n : getIdReferenceFor(\"errormessage\", context?.descriptors);\n }\n\n return arias;\n};\n\nexport {\n findDescriptors,\n getIdReferenceListFor,\n getIdReferenceFor,\n buildFormElementPropsFromContext,\n buildAriaPropsFromContext,\n};\n"],"names":["React"],"mappings":";AAmBM,MAAA,kBAAkB,CACtB,UACA,cAOI;AAAA,EACF,OAAO,CAAC;AAAA,EACR,OAAO,CAAC;AAAA,EACR,aAAa,CAAC;AAAA,EACd,YAAY,CAAC;AAAA,EACb,cAAc,CAAC;AAAA;AAAA,EAGf,kBAAkB,CAAC;AACrB,MACG;AACHA,iBAAM,SAAS,QAAQ,UAAU,CAAC,UAAe;AAC/C,QAAI,OAAO,MAAM,mBAAmB,MAAM,OAAO,IAAI;AACvC,kBAAA,MAAM,KAAK,eAA2C,GAAG;AAAA,QACnE;AAAA,UACE,IAAI,MAAM,OAAO;AAAA,UACjB,SAAS,MAAM,OAAO;AAAA,QACxB;AAAA,MAAA;AAAA,IAEJ;AAEI,QAAA,OAAO,MAAM,oBAAoB,eAAe;AAClC,sBAAA,OAAO,OAAO,UAAU,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AC3B,kBAAkB,gBAAgB,SAAS,WAAW;AAAA,EAC9D;AAEO,SAAA;AACT;"}
@@ -71,8 +71,7 @@ const { staticClasses, useClasses } = createClasses("HvGlobalActions", {
71
71
  });
72
72
  const getBreakpointStyles = (isUpMd, isSmDown) => {
73
73
  const unit = isUpMd ? 4 : isSmDown ? 2 : 0;
74
- if (!unit)
75
- return {};
74
+ if (!unit) return {};
76
75
  return {
77
76
  width: `calc(100% - 2 * ${theme.spacing(unit)})`,
78
77
  marginLeft: theme.spacing(unit),
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalActions.styles.js","sources":["../../../src/GlobalActions/GlobalActions.styles.tsx"],"sourcesContent":["import { CSSInterpolation } from \"@emotion/serialize\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { createClasses } from \"../utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvGlobalActions\", {\n root: {\n position: \"relative\",\n },\n positionSticky: {\n width: \"100%\",\n position: \"sticky\",\n },\n positionFixed: {\n width: \"100%\",\n position: \"fixed\",\n },\n global: {\n zIndex: `calc(${theme.zIndices.banner} - 2)`,\n top: 0,\n left: 0,\n padding: theme.spacing(1, 0),\n backdropFilter: \"blur(1px)\",\n\n \"&:before\": {\n content: \"''\",\n display: \"flex\",\n position: \"absolute\",\n inset: 0,\n background: theme.colors.atmo2,\n opacity: \"75%\",\n },\n\n \"& $wrapper\": {\n top: 0,\n left: 0,\n backgroundColor: theme.colors.atmo1,\n width: \"100%\",\n borderWidth: 1,\n borderRadius: theme.radii.round,\n },\n },\n section: {\n \"& $wrapper\": {\n borderTopWidth: 1,\n paddingLeft: 0,\n },\n },\n wrapper: {\n padding: theme.space.xs,\n position: \"relative\",\n display: \"flex\",\n justifyContent: \"flex-start\",\n alignItems: \"center\",\n gap: theme.space.xs,\n borderColor: theme.colors.atmo4,\n paddingLeft: theme.space.sm,\n },\n\n /** @deprecated use classes.global $wrapper */\n globalSectionArea: {},\n /** @deprecated use classes.section $wrapper */\n globalWrapperComplement: {},\n backButton: {},\n name: {\n flexGrow: 1,\n },\n /** @deprecated use classes.name */\n sectionName: {},\n actions: {\n display: \"flex\",\n alignItems: \"center\",\n gap: theme.space.xs,\n // TODO: remove in v6 in favour of consistently setting `flexGrow: 1` in a title \"wrapper\"\n marginLeft: \"auto\",\n },\n});\n\nexport const getBreakpointStyles = (\n isUpMd: boolean,\n isSmDown: boolean,\n): CSSInterpolation => {\n const unit = isUpMd ? 4 : isSmDown ? 2 : 0;\n if (!unit) return {};\n\n return {\n width: `calc(100% - 2 * ${theme.spacing(unit)})`,\n marginLeft: theme.spacing(unit),\n marginRight: theme.spacing(unit),\n };\n};\n"],"names":[],"mappings":";;AAKO,MAAM,EAAE,eAAe,eAAe,cAAc,mBAAmB;AAAA,EAC5E,MAAM;AAAA,IACJ,UAAU;AAAA,EACZ;AAAA,EACA,gBAAgB;AAAA,IACd,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,eAAe;AAAA,IACb,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,QAAQ;AAAA,IACN,QAAQ,QAAQ,MAAM,SAAS,MAAM;AAAA,IACrC,KAAK;AAAA,IACL,MAAM;AAAA,IACN,SAAS,MAAM,QAAQ,GAAG,CAAC;AAAA,IAC3B,gBAAgB;AAAA,IAEhB,YAAY;AAAA,MACV,SAAS;AAAA,MACT,SAAS;AAAA,MACT,UAAU;AAAA,MACV,OAAO;AAAA,MACP,YAAY,MAAM,OAAO;AAAA,MACzB,SAAS;AAAA,IACX;AAAA,IAEA,cAAc;AAAA,MACZ,KAAK;AAAA,MACL,MAAM;AAAA,MACN,iBAAiB,MAAM,OAAO;AAAA,MAC9B,OAAO;AAAA,MACP,aAAa;AAAA,MACb,cAAc,MAAM,MAAM;AAAA,IAC5B;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,cAAc;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,SAAS,MAAM,MAAM;AAAA,IACrB,UAAU;AAAA,IACV,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,KAAK,MAAM,MAAM;AAAA,IACjB,aAAa,MAAM,OAAO;AAAA,IAC1B,aAAa,MAAM,MAAM;AAAA,EAC3B;AAAA;AAAA,EAGA,mBAAmB,CAAC;AAAA;AAAA,EAEpB,yBAAyB,CAAC;AAAA,EAC1B,YAAY,CAAC;AAAA,EACb,MAAM;AAAA,IACJ,UAAU;AAAA,EACZ;AAAA;AAAA,EAEA,aAAa,CAAC;AAAA,EACd,SAAS;AAAA,IACP,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,KAAK,MAAM,MAAM;AAAA;AAAA,IAEjB,YAAY;AAAA,EACd;AACF,CAAC;AAEY,MAAA,sBAAsB,CACjC,QACA,aACqB;AACrB,QAAM,OAAO,SAAS,IAAI,WAAW,IAAI;AACzC,MAAI,CAAC;AAAM,WAAO;AAEX,SAAA;AAAA,IACL,OAAO,mBAAmB,MAAM,QAAQ,IAAI,CAAC;AAAA,IAC7C,YAAY,MAAM,QAAQ,IAAI;AAAA,IAC9B,aAAa,MAAM,QAAQ,IAAI;AAAA,EAAA;AAEnC;"}
1
+ {"version":3,"file":"GlobalActions.styles.js","sources":["../../../src/GlobalActions/GlobalActions.styles.tsx"],"sourcesContent":["import { CSSInterpolation } from \"@emotion/serialize\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { createClasses } from \"../utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvGlobalActions\", {\n root: {\n position: \"relative\",\n },\n positionSticky: {\n width: \"100%\",\n position: \"sticky\",\n },\n positionFixed: {\n width: \"100%\",\n position: \"fixed\",\n },\n global: {\n zIndex: `calc(${theme.zIndices.banner} - 2)`,\n top: 0,\n left: 0,\n padding: theme.spacing(1, 0),\n backdropFilter: \"blur(1px)\",\n\n \"&:before\": {\n content: \"''\",\n display: \"flex\",\n position: \"absolute\",\n inset: 0,\n background: theme.colors.atmo2,\n opacity: \"75%\",\n },\n\n \"& $wrapper\": {\n top: 0,\n left: 0,\n backgroundColor: theme.colors.atmo1,\n width: \"100%\",\n borderWidth: 1,\n borderRadius: theme.radii.round,\n },\n },\n section: {\n \"& $wrapper\": {\n borderTopWidth: 1,\n paddingLeft: 0,\n },\n },\n wrapper: {\n padding: theme.space.xs,\n position: \"relative\",\n display: \"flex\",\n justifyContent: \"flex-start\",\n alignItems: \"center\",\n gap: theme.space.xs,\n borderColor: theme.colors.atmo4,\n paddingLeft: theme.space.sm,\n },\n\n /** @deprecated use classes.global $wrapper */\n globalSectionArea: {},\n /** @deprecated use classes.section $wrapper */\n globalWrapperComplement: {},\n backButton: {},\n name: {\n flexGrow: 1,\n },\n /** @deprecated use classes.name */\n sectionName: {},\n actions: {\n display: \"flex\",\n alignItems: \"center\",\n gap: theme.space.xs,\n // TODO: remove in v6 in favour of consistently setting `flexGrow: 1` in a title \"wrapper\"\n marginLeft: \"auto\",\n },\n});\n\nexport const getBreakpointStyles = (\n isUpMd: boolean,\n isSmDown: boolean,\n): CSSInterpolation => {\n const unit = isUpMd ? 4 : isSmDown ? 2 : 0;\n if (!unit) return {};\n\n return {\n width: `calc(100% - 2 * ${theme.spacing(unit)})`,\n marginLeft: theme.spacing(unit),\n marginRight: theme.spacing(unit),\n };\n};\n"],"names":[],"mappings":";;AAKO,MAAM,EAAE,eAAe,eAAe,cAAc,mBAAmB;AAAA,EAC5E,MAAM;AAAA,IACJ,UAAU;AAAA,EACZ;AAAA,EACA,gBAAgB;AAAA,IACd,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,eAAe;AAAA,IACb,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,QAAQ;AAAA,IACN,QAAQ,QAAQ,MAAM,SAAS,MAAM;AAAA,IACrC,KAAK;AAAA,IACL,MAAM;AAAA,IACN,SAAS,MAAM,QAAQ,GAAG,CAA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,10 +28,13 @@ function getGridSpacing(spacing) {
28
28
  gridSpacing = BREAKPOINT_GUTTERS[spacing];
29
29
  }
30
30
  } else if (typeof spacing === "object") {
31
- gridSpacing = Object.keys(spacing).reduce((acc, bp) => {
32
- acc[bp] = BREAKPOINT_GUTTERS[spacing[bp]] ?? spacing[bp];
33
- return acc;
34
- }, {});
31
+ gridSpacing = Object.keys(spacing).reduce(
32
+ (acc, bp) => {
33
+ acc[bp] = BREAKPOINT_GUTTERS[spacing[bp]] ?? spacing[bp];
34
+ return acc;
35
+ },
36
+ {}
37
+ );
35
38
  } else if (spacing === 0) {
36
39
  gridSpacing = { xs: 0 };
37
40
  } else {
@@ -1 +1 @@
1
- {"version":3,"file":"Grid.js","sources":["../../../src/Grid/Grid.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport MuiGrid, { GridProps as MuiGridProps } from \"@mui/material/Grid\";\n\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { useWidth } from \"../hooks/useWidth\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { staticClasses, useClasses } from \"./Grid.styles\";\n\nexport { staticClasses as gridClasses };\n\nexport type HvGridClasses = ExtractNames<typeof useClasses>;\n\nconst BREAKPOINT_GUTTERS = {\n xs: 2,\n sm: 2,\n md: 4,\n lg: 4,\n xl: 4,\n};\n\nconst BREAKPOINT_COLUMNS = {\n xs: 4,\n sm: 8,\n md: 12,\n lg: 12,\n xl: 12,\n};\n\nexport type HvGridDirection =\n | \"row\"\n | \"row-reverse\"\n | \"column\"\n | \"column-reverse\";\n\nexport type HvGridSpacing =\n | \"xs\"\n | \"sm\"\n | \"md\"\n | \"lg\"\n | \"xl\"\n | \"auto\"\n | 1\n | 2\n | 3\n | 4\n | 5\n | 6\n | 7\n | 8\n | 9\n | 10;\n\nexport interface HvGridProps extends Omit<MuiGridProps, \"classes\" | \"columns\"> {\n /**\n * If `true`, the component will have the flex *container* behavior.\n * You should be wrapping *items* with a *container*.\n */\n container?: boolean;\n /**\n * If `true`, the component will have the flex *item* behavior.\n * You should be wrapping *items* with a *container*.\n */\n item?: boolean;\n /**\n * Defines the space between the type item component. It can only be used on a type container component.\n * Based in the 8x factor defined in the theme, it allows the definition of this factor based on the factor\n * (number between 0 and 10), breakpoint or auto.\n */\n spacing?: HvGridSpacing | number;\n /**\n * Defines the vertical space between the type item component. It can only be used on a type container component.\n * Based in the 8x factor defined in the theme, it allows the definition of this factor based on the factor\n * (number between 0 and 10), breakpoint or auto.\n * It overrides the value of the spacing prop.\n */\n rowSpacing?: HvGridSpacing | number;\n /**\n * Defines the horizontal space between the type item component. It can only be used on a type container component.\n * Based in the 8x factor defined in the theme, it allows the definition of this factor based on the factor\n * (number between 0 and 10), breakpoint or auto.\n * It overrides the value of the spacing prop.\n */\n columnSpacing?: HvGridSpacing | number;\n /**\n * The number of columns.\n * Defaults to a 12-column grid.\n * The value \"auto\" implements the Design System directives in terms of variable number of columns.\n * @default 12\n */\n columns?: \"auto\" | MuiGridProps[\"columns\"];\n /**\n * Defines the `flex-direction` style property.\n * It is applied for all screen sizes.\n */\n direction?: HvGridDirection;\n /**\n * Defines the `justify-content` style property.\n * It is applied for all screen sizes.\n */\n justify?:\n | \"flex-start\"\n | \"center\"\n | \"flex-end\"\n | \"space-between\"\n | \"space-around\"\n | \"space-evenly\";\n /**\n * Defines the number of grids the component is going to use.\n * It's applied for all the screen sizes with the lowest priority.\n */\n xs?: number | boolean;\n /**\n * Defines the number of grids the component is going to use.\n * It's applied for the `sm` breakpoint and wider screens if not overridden.\n */\n sm?: number | boolean;\n /**\n * Defines the number of grids the component is going to use.\n * It's applied for the `md` breakpoint and wider screens if not overridden.\n */\n md?: number | boolean;\n /**\n * Defines the number of grids the component is going to use.\n * It's applied for the `lg` breakpoint and wider screens if not overridden.\n */\n lg?: number | boolean;\n /**\n * Defines the number of grids the component is going to use.\n * It's applied for the `xl` breakpoint and wider screens.\n */\n xl?: number | boolean;\n /**\n * Defines the `flex-wrap` style property.\n * It's applied for all screen sizes.\n */\n wrap?: \"nowrap\" | \"wrap\" | \"wrap-reverse\";\n /**\n * If `true`, it sets `min-width: 0` on the item.\n * Refer to the limitations section of the documentation to better understand the use case.\n */\n zeroMinWidth?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvGridClasses;\n}\n\nfunction getGridSpacing(spacing: HvGridProps[\"spacing\"]) {\n let gridSpacing: MuiGridProps[\"spacing\"];\n\n if (typeof spacing === \"string\") {\n if (spacing === \"auto\") {\n gridSpacing = BREAKPOINT_GUTTERS;\n } else {\n gridSpacing = BREAKPOINT_GUTTERS[spacing];\n }\n } else if (typeof spacing === \"object\") {\n gridSpacing = Object.keys(spacing).reduce((acc, bp) => {\n acc[bp] = BREAKPOINT_GUTTERS[spacing[bp]] ?? spacing[bp];\n return acc;\n }, {});\n } else if (spacing === 0) {\n gridSpacing = { xs: 0 };\n } else {\n gridSpacing = spacing;\n }\n\n return gridSpacing;\n}\n\nfunction getNumberOfColumns(columns: HvGridProps[\"columns\"]) {\n let numberOfColumns: MuiGridProps[\"columns\"];\n\n if (columns === \"auto\") {\n numberOfColumns = BREAKPOINT_COLUMNS;\n } else {\n numberOfColumns = columns;\n }\n\n return numberOfColumns;\n}\n\nfunction getContainerProps(\n spacing: HvGridProps[\"spacing\"],\n rowSpacing: HvGridProps[\"rowSpacing\"],\n columnSpacing: HvGridProps[\"columnSpacing\"],\n columns: HvGridProps[\"columns\"],\n) {\n const containerProps: Pick<\n MuiGridProps,\n \"container\" | \"spacing\" | \"rowSpacing\" | \"columnSpacing\" | \"columns\"\n > = { container: true };\n\n if (spacing != null) {\n containerProps.spacing = getGridSpacing(spacing);\n }\n if (rowSpacing != null) {\n containerProps.rowSpacing = getGridSpacing(rowSpacing);\n }\n if (columnSpacing != null) {\n containerProps.columnSpacing = getGridSpacing(columnSpacing);\n }\n if (columns != null) {\n containerProps.columns = getNumberOfColumns(columns);\n }\n\n return containerProps;\n}\n\nconst WidthGrid = forwardRef<HTMLDivElement, HvGridProps>((props, ref) => {\n const { container, spacing, rowSpacing, columnSpacing, columns, ...others } =\n props;\n\n const width = useWidth();\n\n const containerProps = container\n ? getContainerProps(\n spacing === \"auto\" ? width : spacing,\n rowSpacing === \"auto\" ? width : rowSpacing,\n columnSpacing === \"auto\" ? width : columnSpacing,\n columns,\n )\n : {};\n\n return <MuiGrid ref={ref} {...containerProps} {...others} />;\n});\n\n/**\n * The grid creates visual consistency between layouts while allowing flexibility\n * across a wide variety of designs. This component is based on a 12-column grid layout.\n *\n * It's based on the [Material UI Grid](https://mui.com/material-ui/react-grid/).\n *\n * The definitions were set following the Design System directives:\n *\n * | Breakpoint | Width (in px) | Gutters (in px) | Number of columns |\n * | ---------- | ------------- | --------------- | ----------------- |\n * | xs | [0-600[ | 16 | 4 |\n * | sm | [600-960[ | 16 | 8 |\n * | md | [960-1270[ | 32 | 12 |\n * | lg | [1270-1920[ | 32 | 12 |\n * | xl | [1920-...[ | 32 | 12 |\n *\n * However, the number of columns is set to 12 for all breakpoints, as it serves most\n * of the use cases and simplifies the implementation.\n * To opt-in to the Design System directives, you can set the `columns` prop to `auto`.\n *\n * Also, the Design System specifications are omissive about the horizontal gutters.\n * The HvGrid sets them to the same value as the vertical gutters, depending on the breakpoint.\n * It can be overridden by setting the `rowSpacing` prop.\n */\nexport const HvGrid = forwardRef<HTMLDivElement, HvGridProps>((props, ref) => {\n const {\n item,\n container,\n spacing = \"auto\",\n rowSpacing,\n columnSpacing,\n columns,\n classes: classesProp,\n ...others\n } = useDefaultProps(\"HvGrid\", props);\n\n const { classes } = useClasses(classesProp);\n\n // Fixes MUI error when using spacings as objects and the grid is an item and container\n // When set to \"auto\", the spacing changes depending on the screen's breakpoint\n // The condition avoids using useWidth and re-rendering the component unnecessarily\n if (\n container &&\n item &&\n (spacing === \"auto\" || rowSpacing === \"auto\" || columnSpacing === \"auto\")\n ) {\n return (\n <WidthGrid\n ref={ref}\n classes={classes}\n item={item}\n container={container}\n spacing={spacing}\n rowSpacing={rowSpacing}\n columnSpacing={columnSpacing}\n columns={columns}\n {...others}\n />\n );\n }\n\n const containerProps = container\n ? getContainerProps(spacing, rowSpacing, columnSpacing, columns)\n : {};\n\n return (\n <MuiGrid\n ref={ref}\n classes={classes}\n item={item}\n {...containerProps}\n {...others}\n />\n );\n});\n"],"names":[],"mappings":";;;;;;;AAYA,MAAM,qBAAqB;AAAA,EACzB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,qBAAqB;AAAA,EACzB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAuHA,SAAS,eAAe,SAAiC;AACnD,MAAA;AAEA,MAAA,OAAO,YAAY,UAAU;AAC/B,QAAI,YAAY,QAAQ;AACR,oBAAA;AAAA,IAAA,OACT;AACL,oBAAc,mBAAmB,OAAO;AAAA,IAC1C;AAAA,EAAA,WACS,OAAO,YAAY,UAAU;AACtC,kBAAc,OAAO,KAAK,OAAO,EAAE,OAAO,CAAC,KAAK,OAAO;AACjD,UAAA,EAAE,IAAI,mBAAmB,QAAQ,EAAE,CAAC,KAAK,QAAQ,EAAE;AAChD,aAAA;AAAA,IACT,GAAG,CAAE,CAAA;AAAA,EAAA,WACI,YAAY,GAAG;AACV,kBAAA,EAAE,IAAI;EAAE,OACjB;AACS,kBAAA;AAAA,EAChB;AAEO,SAAA;AACT;AAEA,SAAS,mBAAmB,SAAiC;AACvD,MAAA;AAEJ,MAAI,YAAY,QAAQ;AACJ,sBAAA;AAAA,EAAA,OACb;AACa,sBAAA;AAAA,EACpB;AAEO,SAAA;AACT;AAEA,SAAS,kBACP,SACA,YACA,eACA,SACA;AACM,QAAA,iBAGF,EAAE,WAAW;AAEjB,MAAI,WAAW,MAAM;AACJ,mBAAA,UAAU,eAAe,OAAO;AAAA,EACjD;AACA,MAAI,cAAc,MAAM;AACP,mBAAA,aAAa,e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"version":3,"file":"Grid.js","sources":["../../../src/Grid/Grid.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport MuiGrid, { GridProps as MuiGridProps } from \"@mui/material/Grid\";\n\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { useWidth } from \"../hooks/useWidth\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { staticClasses, useClasses } from \"./Grid.styles\";\n\nexport { staticClasses as gridClasses };\n\nexport type HvGridClasses = ExtractNames<typeof useClasses>;\n\nconst BREAKPOINT_GUTTERS = {\n xs: 2,\n sm: 2,\n md: 4,\n lg: 4,\n xl: 4,\n};\n\nconst BREAKPOINT_COLUMNS = {\n xs: 4,\n sm: 8,\n md: 12,\n lg: 12,\n xl: 12,\n};\n\nexport type HvGridDirection =\n | \"row\"\n | \"row-reverse\"\n | \"column\"\n | \"column-reverse\";\n\nexport type HvGridSpacing =\n | \"xs\"\n | \"sm\"\n | \"md\"\n | \"lg\"\n | \"xl\"\n | \"auto\"\n | 1\n | 2\n | 3\n | 4\n | 5\n | 6\n | 7\n | 8\n | 9\n | 10;\n\nexport interface HvGridProps extends Omit<MuiGridProps, \"classes\" | \"columns\"> {\n /**\n * If `true`, the component will have the flex *container* behavior.\n * You should be wrapping *items* with a *container*.\n */\n container?: boolean;\n /**\n * If `true`, the component will have the flex *item* behavior.\n * You should be wrapping *items* with a *container*.\n */\n item?: boolean;\n /**\n * Defines the space between the type item component. It can only be used on a type container component.\n * Based in the 8x factor defined in the theme, it allows the definition of this factor based on the factor\n * (number between 0 and 10), breakpoint or auto.\n */\n spacing?: HvGridSpacing | number;\n /**\n * Defines the vertical space between the type item component. It can only be used on a type container component.\n * Based in the 8x factor defined in the theme, it allows the definition of this factor based on the factor\n * (number between 0 and 10), breakpoint or auto.\n * It overrides the value of the spacing prop.\n */\n rowSpacing?: HvGridSpacing | number;\n /**\n * Defines the horizontal space between the type item component. It can only be used on a type container component.\n * Based in the 8x factor defined in the theme, it allows the definition of this factor based on the factor\n * (number between 0 and 10), breakpoint or auto.\n * It overrides the value of the spacing prop.\n */\n columnSpacing?: HvGridSpacing | number;\n /**\n * The number of columns.\n * Defaults to a 12-column grid.\n * The value \"auto\" implements the Design System directives in terms of variable number of columns.\n * @default 12\n */\n columns?: \"auto\" | MuiGridProps[\"columns\"];\n /**\n * Defines the `flex-direction` style property.\n * It is applied for all screen sizes.\n */\n direction?: HvGridDirection;\n /**\n * Defines the `justify-content` style property.\n * It is applied for all screen sizes.\n */\n justify?:\n | \"flex-start\"\n | \"center\"\n | \"flex-end\"\n | \"space-between\"\n | \"space-around\"\n | \"space-evenly\";\n /**\n * Defines the number of grids the component is going to use.\n * It's applied for all the screen sizes with the lowest priority.\n */\n xs?: number | boolean;\n /**\n * Defines the number of grids the component is going to use.\n * It's applied for the `sm` breakpoint and wider screens if not overridden.\n */\n sm?: number | boolean;\n /**\n * Defines the number of grids the component is going to use.\n * It's applied for the `md` breakpoint and wider screens if not overridden.\n */\n md?: number | boolean;\n /**\n * Defines the number of grids the component is going to use.\n * It's applied for the `lg` breakpoint and wider screens if not overridden.\n */\n lg?: number | boolean;\n /**\n * Defines the number of grids the component is going to use.\n * It's applied for the `xl` breakpoint and wider screens.\n */\n xl?: number | boolean;\n /**\n * Defines the `flex-wrap` style property.\n * It's applied for all screen sizes.\n */\n wrap?: \"nowrap\" | \"wrap\" | \"wrap-reverse\";\n /**\n * If `true`, it sets `min-width: 0` on the item.\n * Refer to the limitations section of the documentation to better understand the use case.\n */\n zeroMinWidth?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvGridClasses;\n}\n\nfunction getGridSpacing(spacing: HvGridProps[\"spacing\"]) {\n let gridSpacing: MuiGridProps[\"spacing\"];\n\n if (typeof spacing === \"string\") {\n if (spacing === \"auto\") {\n gridSpacing = BREAKPOINT_GUTTERS;\n } else {\n gridSpacing = BREAKPOINT_GUTTERS[spacing];\n }\n } else if (typeof spacing === \"object\") {\n gridSpacing = Object.keys(spacing).reduce<Record<string, number>>(\n (acc, bp) => {\n acc[bp] = BREAKPOINT_GUTTERS[spacing[bp]] ?? spacing[bp];\n return acc;\n },\n {},\n );\n } else if (spacing === 0) {\n gridSpacing = { xs: 0 };\n } else {\n gridSpacing = spacing;\n }\n\n return gridSpacing;\n}\n\nfunction getNumberOfColumns(columns: HvGridProps[\"columns\"]) {\n let numberOfColumns: MuiGridProps[\"columns\"];\n\n if (columns === \"auto\") {\n numberOfColumns = BREAKPOINT_COLUMNS;\n } else {\n numberOfColumns = columns;\n }\n\n return numberOfColumns;\n}\n\nfunction getContainerProps(\n spacing: HvGridProps[\"spacing\"],\n rowSpacing: HvGridProps[\"rowSpacing\"],\n columnSpacing: HvGridProps[\"columnSpacing\"],\n columns: HvGridProps[\"columns\"],\n) {\n const containerProps: Pick<\n MuiGridProps,\n \"container\" | \"spacing\" | \"rowSpacing\" | \"columnSpacing\" | \"columns\"\n > = { container: true };\n\n if (spacing != null) {\n containerProps.spacing = getGridSpacing(spacing);\n }\n if (rowSpacing != null) {\n containerProps.rowSpacing = getGridSpacing(rowSpacing);\n }\n if (columnSpacing != null) {\n containerProps.columnSpacing = getGridSpacing(columnSpacing);\n }\n if (columns != null) {\n containerProps.columns = getNumberOfColumns(columns);\n }\n\n return containerProps;\n}\n\nconst WidthGrid = forwardRef<HTMLDivElement, HvGridProps>((props, ref) => {\n const { container, spacing, rowSpacing, columnSpacing, columns, ...others } =\n props;\n\n const width = useWidth();\n\n const containerProps = container\n ? getContainerProps(\n spacing === \"auto\" ? width : spacing,\n rowSpacing === \"auto\" ? width : rowSpacing,\n columnSpacing === \"auto\" ? width : columnSpacing,\n columns,\n )\n : {};\n\n return <MuiGrid ref={ref} {...containerProps} {...others} />;\n});\n\n/**\n * The grid creates visual consistency between layouts while allowing flexibility\n * across a wide variety of designs. This component is based on a 12-column grid layout.\n *\n * It's based on the [Material UI Grid](https://mui.com/material-ui/react-grid/).\n *\n * The definitions were set following the Design System directives:\n *\n * | Breakpoint | Width (in px) | Gutters (in px) | Number of columns |\n * | ---------- | ------------- | --------------- | ----------------- |\n * | xs | [0-600[ | 16 | 4 |\n * | sm | [600-960[ | 16 | 8 |\n * | md | [960-1270[ | 32 | 12 |\n * | lg | [1270-1920[ | 32 | 12 |\n * | xl | [1920-...[ | 32 | 12 |\n *\n * However, the number of columns is set to 12 for all breakpoints, as it serves most\n * of the use cases and simplifies the implementation.\n * To opt-in to the Design System directives, you can set the `columns` prop to `auto`.\n *\n * Also, the Design System specifications are omissive about the horizontal gutters.\n * The HvGrid sets them to the same value as the vertical gutters, depending on the breakpoint.\n * It can be overridden by setting the `rowSpacing` prop.\n */\nexport const HvGrid = forwardRef<HTMLDivElement, HvGridProps>((props, ref) => {\n const {\n item,\n container,\n spacing = \"auto\",\n rowSpacing,\n columnSpacing,\n columns,\n classes: classesProp,\n ...others\n } = useDefaultProps(\"HvGrid\", props);\n\n const { classes } = useClasses(classesProp);\n\n // Fixes MUI error when using spacings as objects and the grid is an item and container\n // When set to \"auto\", the spacing changes depending on the screen's breakpoint\n // The condition avoids using useWidth and re-rendering the component unnecessarily\n if (\n container &&\n item &&\n (spacing === \"auto\" || rowSpacing === \"auto\" || columnSpacing === \"auto\")\n ) {\n return (\n <WidthGrid\n ref={ref}\n classes={classes}\n item={item}\n container={container}\n spacing={spacing}\n rowSpacing={rowSpacing}\n columnSpacing={columnSpacing}\n columns={columns}\n {...others}\n />\n );\n }\n\n const containerProps = container\n ? getContainerProps(spacing, rowSpacing, columnSpacing, columns)\n : {};\n\n return (\n <MuiGrid\n ref={ref}\n classes={classes}\n item={item}\n {...containerProps}\n {...others}\n />\n );\n});\n"],"names":[],"mappings":";;;;;;;AAYA,MAAM,qBAAqB;AAAA,EACzB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,qBAAqB;AAAA,EACzB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IA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AAAA,IAChC,kBAAkB,SAAS,QAAQ;AAAA,IACnC;AAAA,MAEF;AAEJ,6BAAQ,SAAQ,EAAA,KAAW,GAAG,gBAAiB,GAAG,OAAQ,CAAA;AAC5D,CAAC;AA0BM,MAAM,SAAS,WAAwC,CAAC,OAAO,QAAQ;AACtE,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,GAAG;AAAA,EAAA,IACD,gBAAgB,UAAU,KAAK;AAEnC,QAAM,EAAE,QAAA,IAAY,WAAW,WAAW;AAK1C,MACE,aACA,SACC,YAAY,UAAU,eAAe,UAAU,kBAAkB,SAClE;AAEE,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACC,GAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AAEM,QAAA,iBAAiB,YACnB,kBAAkB,SAAS,YAAY,eAAe,OAAO,IAC7D;AAGF,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MACH,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;"}
@@ -5,8 +5,7 @@ const getSelectionPath = (data, selectedId, selection = [], idx = -1, parent = [
5
5
  const isSelected = item.id === selectedId;
6
6
  if (isSelected)
7
7
  selection.push(...idx > -1 ? [parent[idx].id] : [], item.id);
8
- if (hasData)
9
- getSelectionPath(item.data, selectedId, selection, i, data);
8
+ if (hasData) getSelectionPath(item.data, selectedId, selection, i, data);
10
9
  });
11
10
  return selection;
12
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useSelectionPath.js","sources":["../../../../src/Header/Navigation/useSelectionPath.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nexport interface HvHeaderNavigationItemProp {\n id: string;\n label: string;\n path?: string;\n href?: string;\n target?: string;\n data?: HvHeaderNavigationItemProp[];\n}\n\nconst getSelectionPath = (\n data: HvHeaderNavigationItemProp[] | undefined,\n selectedId: string | undefined,\n selection: string[] = [],\n idx = -1,\n parent: HvHeaderNavigationItemProp[] = [],\n): string[] => {\n data?.forEach((item: HvHeaderNavigationItemProp, i) => {\n const hasData = item.data?.length;\n\n const isSelected = item.id === selectedId;\n\n if (isSelected)\n selection.push(...(idx > -1 ? [parent[idx].id] : []), item.id);\n\n if (hasData) getSelectionPath(item.data, selectedId, selection, i, data);\n });\n\n return selection;\n};\n\nexport const useSelectionPath = (\n data: HvHeaderNavigationItemProp[],\n selectedId?: string,\n): string[] => {\n const [selectionPath, setSelectionPath] = useState<string[]>([]);\n\n useEffect(() => {\n const path = getSelectionPath(data, selectedId);\n\n setSelectionPath(path);\n }, [data, selectedId]);\n\n return selectionPath;\n};\n"],"names":[],"mappings":";AAWA,MAAM,mBAAmB,CACvB,MACA,YACA,YAAsB,IACtB,MAAM,IACN,SAAuC,OAC1B;AACP,QAAA,QAAQ,CAAC,MAAkC,MAAM;AAC/C,UAAA,UAAU,KAAK,MAAM;AAErB,UAAA,aAAa,KAAK,OAAO;AAE3B,QAAA;AACF,gBAAU,KAAK,GAAI,MAAM,KAAK,CAAC,OAAO,GAAG,EAAE,EAAE,IAAI,CAAC,GAAI,KAAK,EAAE;AAE3D,QAAA;AAAS,uBAAiB,KAAK,MAAM,YAAY,WAAW,GAAG,IAAI;AAAA,EAAA,CACxE;AAEM,SAAA;AACT;AAEa,MAAA,mBAAmB,CAC9B,MACA,eACa;AACb,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAmB,CAAE,CAAA;AAE/D,YAAU,MAAM;AACR,UAAA,OAAO,iBAAiB,MAAM,UAAU;AAE9C,qBAAiB,IAAI;AAAA,EAAA,GACpB,CAAC,MAAM,UAAU,CAAC;AAEd,SAAA;AACT;"}
1
+ {"version":3,"file":"useSelectionPath.js","sources":["../../../../src/Header/Navigation/useSelectionPath.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nexport interface HvHeaderNavigationItemProp {\n id: string;\n label: string;\n path?: string;\n href?: string;\n target?: string;\n data?: HvHeaderNavigationItemProp[];\n}\n\nconst getSelectionPath = (\n data: HvHeaderNavigationItemProp[] | undefined,\n selectedId: string | undefined,\n selection: string[] = [],\n idx = -1,\n parent: HvHeaderNavigationItemProp[] = [],\n): string[] => {\n data?.forEach((item: HvHeaderNavigationItemProp, i) => {\n const hasData = item.data?.length;\n\n const isSelected = item.id === selectedId;\n\n if (isSelected)\n selection.push(...(idx > -1 ? [parent[idx].id] : []), item.id);\n\n if (hasData) getSelectionPath(item.data, selectedId, selection, i, data);\n });\n\n return selection;\n};\n\nexport const useSelectionPath = (\n data: HvHeaderNavigationItemProp[],\n selectedId?: string,\n): string[] => {\n const [selectionPath, setSelectionPath] = useState<string[]>([]);\n\n useEffect(() => {\n const path = getSelectionPath(data, selectedId);\n\n setSelectionPath(path);\n }, [data, selectedId]);\n\n return selectionPath;\n};\n"],"names":[],"mappings":";AAWA,MAAM,mBAAmB,CACvB,MACA,YACA,YAAsB,IACtB,MAAM,IACN,SAAuC,OAC1B;AACP,QAAA,QAAQ,CAAC,MAAkC,MAAM;AAC/C,UAAA,UAAU,KAAK,MAAM;AAErB,UAAA,aAAa,KAAK,OAAO;AAE3B,QAAA;AACF,gBAAU,KAAK,GAAI,MAAM,KAAK,CAAC,OAAO,GAAG,EAAE,EAAE,IAAI,CAAC,GAAI,KAAK,EAAE;AAE/D,QAAI,QAA0B,kBAAA,KAAK,MAAM,YAAY,WAAW,GAAG,IAAI;AAAA,EAAA,CACxE;AAEM,SAAA;AACT;AAEa,MAAA,mBAAmB,CAC9B,MACA,eACa;AACb,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAmB,CAAE,CAAA;AAE/D,YAAU,MAAM;AACR,UAAA,OAAO,iBAAiB,MAAM,UAAU;AAE9C,qBAAiB,IAAI;AAAA,EAAA,GACpB,CAAC,MAAM,UAAU,CAAC;AAEd,SAAA;AACT;"}
@@ -203,8 +203,7 @@ const HvInput = forwardRef((props, ref) => {
203
203
  }
204
204
  };
205
205
  const onInputBlurHandler = (event) => {
206
- if (eventTargetIsInsideContainer(suggestionsRef.current, event))
207
- return;
206
+ if (eventTargetIsInsideContainer(suggestionsRef.current, event)) return;
208
207
  setFocused(false);
209
208
  const inputValidity = performValidation();
210
209
  onBlur?.(event, value, inputValidity);
@@ -241,8 +240,7 @@ const HvInput = forwardRef((props, ref) => {
241
240
  if (event.relatedTarget) {
242
241
  setTimeout(() => {
243
242
  const list = getSuggestions(null);
244
- if (!list?.contains(document.activeElement))
245
- suggestionClearHandler();
243
+ if (!list?.contains(document.activeElement)) suggestionClearHandler();
246
244
  }, 10);
247
245
  }
248
246
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sources":["../../../src/Input/Input.tsx"],"sourcesContent":["import {\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { InputBaseComponentProps as MuiInputBaseComponentProps } from \"@mui/material/InputBase\";\nimport { useForkRef } from \"@mui/material/utils\";\nimport {\n CloseXS,\n Preview,\n PreviewOff,\n Search,\n Success,\n} from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvBaseInput, HvBaseInputProps } from \"../BaseInput\";\nimport {\n computeValidationMessage,\n computeValidationState,\n computeValidationType,\n DEFAULT_ERROR_MESSAGES,\n hasBuiltInValidations,\n HvInputValidity,\n validateInput,\n} from \"../BaseInput/validations\";\nimport {\n HvAdornment,\n HvAdornmentProps,\n HvFormElement,\n HvFormElementProps,\n HvFormStatus,\n HvInfoMessage,\n HvLabel,\n HvSuggestion,\n HvSuggestions,\n HvSuggestionsProps,\n HvWarningText,\n isInvalid,\n isValid,\n} from \"../Forms\";\nimport validationStates from \"../Forms/FormElement/validationStates\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { useIsMounted } from \"../hooks/useIsMounted\";\nimport { useLabels } from \"../hooks/useLabels\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { HvTooltip } from \"../Tooltip\";\nimport { HvInputSuggestion, HvValidationMessages } from \"../types/forms\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { isKey } from \"../utils/keyboardUtils\";\nimport { setId } from \"../utils/setId\";\nimport { staticClasses, useClasses } from \"./Input.styles\";\n\nexport { staticClasses as inputClasses };\n\nexport type HvInputClasses = ExtractNames<typeof useClasses>;\n\ntype InputElement = HTMLInputElement | HTMLTextAreaElement;\n\nexport interface HvInputProps\n extends HvBaseProps<\n HTMLElement,\n \"onChange\" | \"onBlur\" | \"onFocus\" | \"onKeyDown\" | \"color\"\n > {\n /** The form element name. */\n name?: string;\n /** The value of the form element. */\n value?: string;\n /** When uncontrolled, defines the initial input value. */\n defaultValue?: string;\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be inputted via inputProps.\n */\n label?: React.ReactNode;\n /** Provide additional descriptive text for the form element. */\n description?: React.ReactNode;\n /** Indicates that the form element is disabled. */\n disabled?: boolean;\n /** Indicates that the form element is not editable. */\n readOnly?: boolean;\n /** Indicates that user input is required on the form element. */\n required?: boolean;\n /**\n * The status of the form element.\n *\n * Valid is correct, invalid is incorrect and standBy means no validations have run.\n *\n * When uncontrolled and unspecified it will default to \"standBy\" and change to either \"valid\"\n * or \"invalid\" after any change to `checked`, depending of the values of both `required` and `checked`.\n */\n status?: HvFormStatus;\n /** The error message to show when `status` is \"invalid\". */\n statusMessage?: string;\n /**\n * The function that will be executed onChange, allows modification of the input,\n * it receives the value. If a new value should be presented it must returned it.\n */\n onChange?: HvBaseInputProps[\"onChange\"];\n /**\n * Callback called when the user submits the value by pressing Enter/Return.\n *\n * Also called when the search button is clicked (when type is \"search\").\n */\n onEnter?: (\n event: React.KeyboardEvent<InputElement> | React.MouseEvent,\n value: string,\n ) => void;\n /**\n * The function that will be executed onBlur, allows checking the validation state,\n * it receives the value and the validation state.\n */\n onBlur?: (\n event: React.FocusEvent<InputElement>,\n value: string,\n validationState: HvInputValidity,\n ) => void;\n /**\n * The function that will be executed onBlur, allows checking the value state,\n * it receives the value.\n */\n onFocus?: (event: React.FocusEvent<InputElement>, value: string) => void;\n /**\n * The function that will be executed onKeyDown, allows checking the value state,\n * it receives the event and value.\n */\n onKeyDown?: (\n event: React.KeyboardEvent<InputElement> | React.MouseEvent,\n value: string,\n ) => void;\n /** The input type. */\n type?: React.HTMLInputTypeAttribute;\n /** The placeholder value of the input. */\n placeholder?: string;\n /** Internal labels?. */\n labels?: HvInputLabels & Record<string, any>;\n /** An Object containing the various texts associated with the input. */\n validationMessages?: HvValidationMessages;\n /** Attributes applied to the input element. */\n inputProps?: MuiInputBaseComponentProps;\n /**\n * Allows passing a ref to the underlying input\n * @deprecated Use `ref` directly instead\n * */\n inputRef?: HvBaseInputProps[\"inputRef\"];\n /** The function that will be executed to received an array of objects that has a label and id to create list of suggestion */\n suggestionListCallback?: (value: string) => HvInputSuggestion[] | null;\n /**\n * The custom validation function, it receives the value and must return\n * either `true` for valid or `false` for invalid, default validations would only\n * occur if this function is null or undefined\n */\n validation?: (value: string) => boolean;\n /** If `true` it should autofocus. */\n autoFocus?: boolean;\n /** If `true` the clear button is disabled. */\n disableClear?: boolean;\n /** If `true` the reveal password button is disabled. Valid only when type is \"password\". */\n disableRevealPassword?: boolean;\n /** If `true` the search button is disabled. Valid only when type is \"search\". */\n disableSearchButton?: boolean;\n /**\n * If `true` the validation icon adornment is visible. Defaults to `false`.\n *\n * Currently, DS specifications define only a positive feedback icon;\n * errors are signaled through the border style and by displaying the error message.\n */\n showValidationIcon?: boolean;\n /** A custom icon to be added into the input. */\n endAdornment?: React.ReactNode;\n /** The maximum allowed length of the characters, if this value is null no check will be performed. */\n maxCharQuantity?: number;\n /** The minimum allowed length of the characters, if this value is null no check will be perform. */\n minCharQuantity?: number;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvInputClasses;\n}\n\nconst DEFAULT_LABELS = {\n /** The label of the clear button. */\n clearButtonLabel: \"Clear the text\",\n /** The label of the reveal password button. */\n revealPasswordButtonLabel: \"Reveal password\",\n /** The tooltip of the reveal password button when the password is hidden. */\n revealPasswordButtonClickToShowTooltip: \"Click to show password.\",\n /** The tooltip of the reveal password button when the password is revealed. */\n revealPasswordButtonClickToHideTooltip: \"Click to hide password.\",\n /** The label of the search button. */\n searchButtonLabel: \"Search\",\n};\n\nexport type HvInputLabels = Partial<typeof DEFAULT_LABELS>;\n\nfunction eventTargetIsInsideContainer(\n container: HTMLElement | null,\n event: React.FocusEvent<any>,\n) {\n return !!container?.contains(event.relatedTarget);\n}\n\n/** Changes a given `input`'s `value`, triggering its `onChange` */\nconst changeInputValue = (input: HTMLInputElement | null, value = \"\") => {\n const event = new Event(\"input\", { bubbles: true });\n\n /** Original `input.value` setter (React overrides it). */\n const setInputValue = Object.getOwnPropertyDescriptor(\n window.HTMLInputElement.prototype,\n \"value\",\n )?.set;\n\n setInputValue?.call(input, value);\n input?.dispatchEvent(event);\n};\n\n/**\n * A text input box is a graphical control element intended to enable the user to input text information to be used by the software.\n */\nexport const HvInput = forwardRef<InputElement, HvInputProps>((props, ref) => {\n const {\n classes: classesProp,\n className,\n id,\n name,\n value: valueProp,\n defaultValue = \"\",\n required = false,\n readOnly = false,\n disabled = false,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n onChange,\n onEnter,\n status,\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n type = \"text\",\n placeholder,\n autoFocus = false,\n labels: labelsProp,\n validationMessages,\n disableClear = false,\n disableRevealPassword = false,\n disableSearchButton = false,\n endAdornment,\n maxCharQuantity,\n minCharQuantity,\n validation,\n showValidationIcon = false,\n suggestionListCallback,\n inputRef: inputRefProp,\n onBlur,\n onFocus,\n onKeyDown,\n inputProps = {},\n ...others\n } = useDefaultProps(\"HvInput\", props);\n const { classes, cx } = useClasses(classesProp);\n const labels = useLabels(DEFAULT_LABELS, labelsProp);\n const elementId = useUniqueId(id);\n\n const inputRef = useRef<HTMLInputElement>(null);\n const forkedRef = useForkRef(ref, inputRef, inputRefProp);\n const suggestionsRef = useRef<HTMLElement>(null);\n\n const [focused, setFocused] = useState(false);\n\n // Signals that the user has manually edited the input value\n const isDirty = useRef(false);\n\n // Value related state\n const [value, setValue] = useControlled(valueProp, defaultValue);\n\n const isEmptyValue = value == null || value === \"\";\n\n // Validation related state\n const [validationState, setValidationState] = useControlled(\n status,\n validationStates.standBy,\n );\n\n const [validationMessage, setValidationMessage] = useControlled(\n statusMessage,\n \"\",\n );\n\n // validationMessages reference tends to change, as users will not memoize/useState for it;\n // dependencies must be more explicit so we set\n const errorMessages = useMemo(\n () => ({ ...DEFAULT_ERROR_MESSAGES, ...validationMessages }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n validationMessages?.error,\n validationMessages?.requiredError,\n validationMessages?.minCharError,\n validationMessages?.maxCharError,\n validationMessages?.typeMismatchError,\n ],\n );\n\n const validationType = useMemo(() => computeValidationType(type), [type]);\n\n // Validates the input, sets the status and the statusMessage accordingly (if uncontrolled)\n // and returns the validity state of the input.\n const performValidation = useCallback(() => {\n const inputValidity = validateInput(\n inputRef.current,\n value,\n required,\n minCharQuantity,\n maxCharQuantity,\n validationType,\n validation,\n );\n\n // This will only run if status is uncontrolled\n setValidationState(computeValidationState(inputValidity, isEmptyValue));\n\n // This will only run if statusMessage is uncontrolled\n setValidationMessage(\n computeValidationMessage(inputValidity, errorMessages),\n );\n\n return inputValidity;\n }, [\n errorMessages,\n isEmptyValue,\n maxCharQuantity,\n minCharQuantity,\n required,\n setValidationMessage,\n setValidationState,\n validation,\n validationType,\n value,\n ]);\n\n // The error message area will only be created if:\n // - an external element that provides an error message isn't identified via aria-errormessage AND\n // - both status and statusMessage properties are being controlled OR\n // - status is uncontrolled and any of the built-in validations are active\n const canShowError =\n ariaErrorMessage == null &&\n ((status !== undefined && statusMessage !== undefined) ||\n (status === undefined &&\n hasBuiltInValidations(\n required,\n validationType,\n minCharQuantity,\n maxCharQuantity,\n validation,\n inputProps,\n )));\n\n const isStateInvalid = isInvalid(validationState);\n\n // Input type related state\n const [revealPassword, setRevealPassword] = useState(false);\n\n const realType = useMemo(() => {\n if (type === \"password\") {\n return revealPassword ? \"text\" : \"password\";\n }\n\n if (type === \"search\") {\n return \"search\";\n }\n\n return \"text\";\n }, [revealPassword, type]);\n\n // Suggestions related state\n const [suggestionValues, setSuggestionValues] = useState<\n HvSuggestion[] | null\n >(null);\n\n const canShowSuggestions = suggestionListCallback != null;\n const hasSuggestions = !!suggestionValues;\n\n // Miscellaneous state\n const hasLabel = label != null;\n const hasDescription = description != null;\n\n /**\n * Looks for the node that represent the input inside the material tree and focus it.\n */\n const focusInput = () => {\n inputRef.current?.focus();\n };\n\n const isMounted = useIsMounted();\n\n /**\n * Clears the suggestion array.\n */\n const suggestionClearHandler = () => {\n if (isMounted.current) {\n setSuggestionValues(null);\n }\n };\n\n /**\n * Fills of the suggestion array.\n */\n const suggestionHandler = (val: string) => {\n const suggestionsArray = suggestionListCallback?.(val);\n if (suggestionsArray?.[0]?.label) {\n setSuggestionValues(suggestionsArray);\n } else {\n suggestionClearHandler();\n }\n };\n\n /**\n * Executes the user callback adds the selection to the state and clears the suggestions.\n */\n const suggestionSelectedHandler: HvSuggestionsProps[\"onSuggestionSelected\"] =\n (event, item) => {\n const newValue = item.value || (item.label as any);\n\n changeInputValue(inputRef.current, newValue);\n\n focusInput();\n suggestionClearHandler();\n\n if (type === \"search\") {\n // trigger the onEnter callback when the user selects an option in a search box\n onEnter?.(event, newValue);\n }\n };\n\n const onChangeHandler: HvBaseInputProps[\"onChange\"] = (event, newValue) => {\n isDirty.current = true;\n\n // set the input value (only when value is uncontrolled)\n setValue(newValue);\n\n onChange?.(event, newValue);\n\n if (canShowSuggestions) {\n // an edge case might be a controlled input whose onChange callback\n // doesn't change the value (or sets another): the suggestionListCallback\n // callback will still receive the original rejected value.\n // a refactor is needed so the suggestionListCallback might be called only\n // when the input is uncontrolled, providing a way to externally control\n // the suggestion values.\n suggestionHandler(newValue);\n }\n };\n\n /**\n * Validates the input updating the state and modifying the info text, also executes\n * the user provided onBlur passing the current validation status and value.\n */\n const onInputBlurHandler: HvBaseInputProps[\"onBlur\"] = (event) => {\n // If the blur is executed when choosing an suggestion it should be ignored.\n if (eventTargetIsInsideContainer(suggestionsRef.current, event)) return;\n\n setFocused(false);\n\n const inputValidity = performValidation();\n\n onBlur?.(event, value, inputValidity);\n };\n\n /**\n * Updates the state putting again the value from the state because the input value is\n * not automatically manage, it also executes the onFocus function from the user passing the value\n */\n const onFocusHandler: HvBaseInputProps[\"onFocus\"] = (event) => {\n setFocused(true);\n\n // reset validation status to standBy (only when status is uncontrolled)\n setValidationState(validationStates.standBy);\n\n onFocus?.(event, value);\n };\n\n const getSuggestions = (li: number | null) => {\n // TODO Replace with ref\n const listEl = document.getElementById(\n setId(elementId, \"suggestions-list\") || \"\",\n );\n return li != null ? listEl?.getElementsByTagName(\"li\")?.[li] : listEl;\n };\n\n const onSuggestionKeyDown: HvSuggestionsProps[\"onKeyDown\"] = (event) => {\n if (isKey(event, \"Esc\")) {\n suggestionClearHandler();\n focusInput();\n } else if (isKey(event, \"Tab\")) {\n suggestionClearHandler();\n }\n };\n\n /** Focus the suggestion list when the arrow down is pressed. */\n const onKeyDownHandler: HvBaseInputProps[\"onKeyDown\"] = (event) => {\n if (isKey(event, \"ArrowDown\") && hasSuggestions) {\n const li = getSuggestions(0);\n li?.focus();\n } else if (isKey(event, \"Enter\")) {\n onEnter?.(event, value);\n }\n\n onKeyDown?.(event, value);\n };\n\n /** Clears the suggestion list on blur. */\n const onContainerBlurHandler: HvFormElementProps[\"onBlur\"] = (event) => {\n if (event.relatedTarget) {\n setTimeout(() => {\n const list = getSuggestions(null);\n if (!list?.contains(document.activeElement)) suggestionClearHandler();\n }, 10);\n }\n };\n\n const hasOnEnter = onEnter != null;\n\n // show the clear button only if the input is enabled, not read-only, disableClear is false and the input is not empty\n // also, don't show it when the input type is \"search\" and the input is active (standBy)\n const showClear =\n !disabled &&\n !readOnly &&\n !disableClear &&\n !isEmptyValue &&\n (!hasOnEnter ||\n type !== \"search\" ||\n disableSearchButton ||\n validationState !== validationStates.standBy);\n\n const showSearchIcon = type === \"search\" && !disableSearchButton;\n\n const showRevealPasswordButton =\n type === \"password\" && !disableRevealPassword;\n\n /**\n * Clears the input value from the state and refocus the input.\n */\n const handleClear = useCallback(() => {\n // reset validation status to standBy (only when status is uncontrolled)\n setValidationState(validationStates.standBy);\n\n changeInputValue(inputRef.current, \"\");\n\n // we want to focus the input when clicked and not active\n setTimeout(focusInput);\n }, [setValidationState]);\n\n const clearButton = useMemo(() => {\n if (!showClear) {\n return null;\n }\n\n return (\n <HvAdornment\n // Don't control visibility when the search icon is enabled\n className={cx(classes.adornmentButton, {\n [classes.iconClear]: !showSearchIcon,\n })}\n onClick={handleClear}\n aria-label={labels?.clearButtonLabel}\n aria-controls={setId(elementId, \"input\")}\n icon={<CloseXS />}\n />\n );\n }, [\n showClear,\n classes.adornmentButton,\n classes.iconClear,\n showSearchIcon,\n handleClear,\n labels?.clearButtonLabel,\n elementId,\n cx,\n ]);\n\n /**\n * Calls the onEnter callback and refocus the input.\n */\n const handleSearch = useCallback<NonNullable<HvAdornmentProps[\"onClick\"]>>(\n (event) => {\n onEnter?.(event, value);\n },\n [onEnter, value],\n );\n\n const searchButton = useMemo(() => {\n // If the search icon is not actionable, only show it when the input is empty or active\n const reallyShowIt =\n showSearchIcon &&\n (isEmptyValue ||\n (hasOnEnter && validationState === validationStates.standBy));\n\n if (!reallyShowIt) {\n return null;\n }\n\n return (\n <HvAdornment\n className={classes.adornmentButton}\n onClick={hasOnEnter ? handleSearch : undefined}\n aria-label={labels?.searchButtonLabel}\n icon={<Search />}\n />\n );\n }, [\n showSearchIcon,\n isEmptyValue,\n hasOnEnter,\n validationState,\n classes.adornmentButton,\n handleSearch,\n labels?.searchButtonLabel,\n ]);\n\n /**\n * Changes input type and refocus the input.\n */\n const handleRevealPassword = useCallback(() => {\n setRevealPassword(!revealPassword);\n }, [revealPassword]);\n\n const revealPasswordButton = useMemo(() => {\n if (!showRevealPasswordButton) {\n return null;\n }\n\n return (\n <HvTooltip\n disableFocusListener\n disableTouchListener\n title={\n revealPassword\n ? labels?.revealPasswordButtonClickToHideTooltip\n : labels?.revealPasswordButtonClickToShowTooltip\n }\n >\n <HvAdornment\n className={classes.adornmentButton}\n onClick={handleRevealPassword}\n aria-label={labels?.revealPasswordButtonLabel}\n aria-controls={setId(elementId, \"input\")}\n icon={revealPassword ? <PreviewOff /> : <Preview />}\n />\n </HvTooltip>\n );\n }, [\n showRevealPasswordButton,\n revealPassword,\n labels?.revealPasswordButtonClickToHideTooltip,\n labels?.revealPasswordButtonClickToShowTooltip,\n labels?.revealPasswordButtonLabel,\n classes.adornmentButton,\n handleRevealPassword,\n elementId,\n ]);\n\n const validationIcon = useMemo(() => {\n if (!showValidationIcon) {\n return null;\n }\n\n if (!isValid(validationState)) {\n return null;\n }\n\n return <Success color=\"positive\" className={classes.icon} />;\n }, [showValidationIcon, validationState, classes.icon]);\n\n // useMemo to avoid repetitive cloning of the custom icon\n const customIconEl = useMemo(\n () =>\n isValidElement(endAdornment) &&\n cloneElement(endAdornment as React.ReactElement, {\n className: cx(endAdornment.props.className, classes.icon),\n }),\n [classes.icon, endAdornment, cx],\n );\n\n const adornments = useMemo(() => {\n if (\n !clearButton &&\n !revealPasswordButton &&\n !searchButton &&\n !validationIcon &&\n !customIconEl\n )\n return null;\n\n // note: specification implies that the custom icon should be hidden when\n // a validation feedback icon is being shown.\n return (\n <div className={classes.adornmentsBox} aria-hidden=\"true\">\n {clearButton}\n {revealPasswordButton}\n {searchButton}\n {validationIcon || customIconEl}\n </div>\n );\n }, [\n classes.adornmentsBox,\n clearButton,\n customIconEl,\n revealPasswordButton,\n searchButton,\n validationIcon,\n ]);\n\n // run initial validation after first render\n // and also when any validation condition changes\n useEffect(() => {\n if (focused || (!isDirty.current && isEmptyValue)) {\n // skip validation if currently focused or if empty and\n // the user never manually edited the input value\n return;\n }\n\n performValidation();\n }, [focused, isEmptyValue, performValidation]);\n\n const errorMessageId = isStateInvalid\n ? canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage\n : undefined;\n\n return (\n <HvFormElement\n id={id}\n name={name}\n status={validationState}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n className={cx(\n classes.root,\n {\n [classes.hasSuggestions]: hasSuggestions,\n },\n className,\n )}\n onBlur={onContainerBlurHandler}\n >\n {(hasLabel || hasDescription) && (\n <div className={classes.labelContainer}>\n {hasLabel && (\n <HvLabel\n id={setId(elementId, \"label\")}\n className={classes.label}\n htmlFor={setId(elementId, \"input\")}\n label={label}\n />\n )}\n\n {hasDescription && (\n <HvInfoMessage\n id={setId(elementId, \"description\")}\n className={classes.description}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n <HvBaseInput\n id={\n hasLabel || showClear || showRevealPasswordButton\n ? setId(elementId, \"input\")\n : setId(id, \"input\")\n }\n name={name}\n value={value}\n required={required}\n readOnly={readOnly}\n disabled={disabled}\n onChange={onChangeHandler}\n autoFocus={autoFocus}\n onKeyDown={onKeyDownHandler}\n onBlur={onInputBlurHandler}\n onFocus={onFocusHandler}\n placeholder={placeholder}\n type={realType}\n classes={{\n input: classes.input,\n inputRoot: classes.inputRoot,\n inputRootFocused: classes.inputRootFocused,\n inputRootDisabled: classes.inputRootDisabled,\n inputRootMultiline: classes.inputRootMultiline,\n inputBorderContainer: classes.inputBorderContainer,\n }}\n invalid={isStateInvalid}\n inputProps={{\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-invalid\": isStateInvalid ? true : undefined,\n \"aria-errormessage\": errorMessageId,\n \"aria-describedby\":\n ariaDescribedBy != null\n ? ariaDescribedBy\n : description\n ? setId(elementId, \"description\")\n : undefined,\n \"aria-controls\": canShowSuggestions\n ? setId(elementId, \"suggestions\")\n : undefined,\n\n ref: inputRef,\n\n // prevent browsers auto-fill/suggestions when we have our own\n autoComplete: canShowSuggestions ? \"off\" : undefined,\n\n ...inputProps,\n }}\n inputRef={forkedRef}\n endAdornment={adornments}\n {...others}\n />\n {canShowSuggestions && (\n <>\n {hasSuggestions && (\n <div role=\"presentation\" className={classes.inputExtension} />\n )}\n <HvSuggestions\n ref={suggestionsRef}\n id={setId(elementId, \"suggestions\")}\n classes={{\n root: classes.suggestionsContainer,\n list: classes.suggestionList,\n }}\n expanded={hasSuggestions}\n anchorEl={inputRef.current?.parentElement}\n onClose={suggestionClearHandler}\n onKeyDown={onSuggestionKeyDown}\n onSuggestionSelected={suggestionSelectedHandler}\n suggestionValues={suggestionValues}\n />\n </>\n )}\n {canShowError && (\n <HvWarningText\n id={setId(elementId, \"error\")}\n disableBorder\n className={classes.error}\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n});\n"],"names":["validationState","validationStates"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0LA,MAAM,iBAAiB;AAAA;AAAA,EAErB,kBAAkB;AAAA;AAAA,EAElB,2BAA2B;AAAA;AAAA,EAE3B,wCAAwC;AAAA;AAAA,EAExC,wCAAwC;AAAA;AAAA,EAExC,mBAAmB;AACrB;AAIA,SAAS,6BACP,WACA,OACA;AACA,SAAO,CAAC,CAAC,WAAW,SAAS,MAAM,aAAa;AAClD;AAGA,MAAM,mBAAmB,CAAC,OAAgC,QAAQ,OAAO;AACvE,QAAM,QAAQ,IAAI,MAAM,SAAS,EAAE,SAAS,MAAM;AAGlD,QAAM,gBAAgB,OAAO;AAAA,IAC3B,OAAO,iBAAiB;AAAA,IACxB;AAAA,EACC,GAAA;AAEY,iBAAA,KAAK,OAAO,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mB;AAAA,cACnB,gBAAgB,iBAAiB,OAAO;AAAA,cACxC,qBAAqB;AAAA,cACrB,oBACE,mBAAmB,OACf,kBACA,cACE,MAAM,WAAW,aAAa,IAC9B;AAAA,cACR,iBAAiB,qBACb,MAAM,WAAW,aAAa,IAC9B;AAAA,cAEJ,KAAK;AAAA;AAAA,cAGL,cAAc,qBAAqB,QAAQ;AAAA,cAE3C,GAAG;AAAA,YACL;AAAA,YACA,UAAU;AAAA,YACV,cAAc;AAAA,YACb,GAAG;AAAA,UAAA;AAAA,QACN;AAAA,QACC,sBAEI,qBAAA,UAAA,EAAA,UAAA;AAAA,UAAA,sCACE,OAAI,EAAA,MAAK,gBAAe,WAAW,QAAQ,gBAAgB;AAAA,UAE9D;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAK;AAAA,cACL,IAAI,MAAM,WAAW,aAAa;AAAA,cAClC,SAAS;AAAA,gBACP,MAAM,QAAQ;AAAA,gBACd,MAAM,QAAQ;AAAA,cAChB;AAAA,cACA,UAAU;AAAA,cACV,UAAU,SAAS,SAAS;AAAA,cAC5B,SAAS;AAAA,cACT,WAAW;AAAA,cACX,sBAAsB;AAAA,cACtB;AAAA,YAAA;AAAA,UACF;AAAA,QAAA,GACF;AAAA,QAED,gBACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI,MAAM,WAAW,OAAO;AAAA,YAC5B,eAAa;AAAA,YACb,WAAW,QAAQ;AAAA,YAElB,UAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
1
+ {"version":3,"file":"Input.js","sources":["../../../src/Input/Input.tsx"],"sourcesContent":["import {\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { InputBaseComponentProps as MuiInputBaseComponentProps } from \"@mui/material/InputBase\";\nimport { useForkRef } from \"@mui/material/utils\";\nimport {\n CloseXS,\n Preview,\n PreviewOff,\n Search,\n Success,\n} from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvBaseInput, HvBaseInputProps } from \"../BaseInput\";\nimport {\n computeValidationMessage,\n computeValidationState,\n computeValidationType,\n DEFAULT_ERROR_MESSAGES,\n hasBuiltInValidations,\n HvInputValidity,\n validateInput,\n} from \"../BaseInput/validations\";\nimport {\n HvAdornment,\n HvAdornmentProps,\n HvFormElement,\n HvFormElementProps,\n HvFormStatus,\n HvInfoMessage,\n HvLabel,\n HvSuggestion,\n HvSuggestions,\n HvSuggestionsProps,\n HvWarningText,\n isInvalid,\n isValid,\n} from \"../Forms\";\nimport validationStates from \"../Forms/FormElement/validationStates\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { useIsMounted } from \"../hooks/useIsMounted\";\nimport { useLabels } from \"../hooks/useLabels\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { HvTooltip } from \"../Tooltip\";\nimport { HvInputSuggestion, HvValidationMessages } from \"../types/forms\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { isKey } from \"../utils/keyboardUtils\";\nimport { setId } from \"../utils/setId\";\nimport { staticClasses, useClasses } from \"./Input.styles\";\n\nexport { staticClasses as inputClasses };\n\nexport type HvInputClasses = ExtractNames<typeof useClasses>;\n\ntype InputElement = HTMLInputElement | HTMLTextAreaElement;\n\nexport interface HvInputProps\n extends HvBaseProps<\n HTMLElement,\n \"onChange\" | \"onBlur\" | \"onFocus\" | \"onKeyDown\" | \"color\"\n > {\n /** The form element name. */\n name?: string;\n /** The value of the form element. */\n value?: string;\n /** When uncontrolled, defines the initial input value. */\n defaultValue?: string;\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be inputted via inputProps.\n */\n label?: React.ReactNode;\n /** Provide additional descriptive text for the form element. */\n description?: React.ReactNode;\n /** Indicates that the form element is disabled. */\n disabled?: boolean;\n /** Indicates that the form element is not editable. */\n readOnly?: boolean;\n /** Indicates that user input is required on the form element. */\n required?: boolean;\n /**\n * The status of the form element.\n *\n * Valid is correct, invalid is incorrect and standBy means no validations have run.\n *\n * When uncontrolled and unspecified it will default to \"standBy\" and change to either \"valid\"\n * or \"invalid\" after any change to `checked`, depending of the values of both `required` and `checked`.\n */\n status?: HvFormStatus;\n /** The error message to show when `status` is \"invalid\". */\n statusMessage?: string;\n /**\n * The function that will be executed onChange, allows modification of the input,\n * it receives the value. If a new value should be presented it must returned it.\n */\n onChange?: HvBaseInputProps[\"onChange\"];\n /**\n * Callback called when the user submits the value by pressing Enter/Return.\n *\n * Also called when the search button is clicked (when type is \"search\").\n */\n onEnter?: (\n event: React.KeyboardEvent<InputElement> | React.MouseEvent,\n value: string,\n ) => void;\n /**\n * The function that will be executed onBlur, allows checking the validation state,\n * it receives the value and the validation state.\n */\n onBlur?: (\n event: React.FocusEvent<InputElement>,\n value: string,\n validationState: HvInputValidity,\n ) => void;\n /**\n * The function that will be executed onBlur, allows checking the value state,\n * it receives the value.\n */\n onFocus?: (event: React.FocusEvent<InputElement>, value: string) => void;\n /**\n * The function that will be executed onKeyDown, allows checking the value state,\n * it receives the event and value.\n */\n onKeyDown?: (\n event: React.KeyboardEvent<InputElement> | React.MouseEvent,\n value: string,\n ) => void;\n /** The input type. */\n type?: React.HTMLInputTypeAttribute;\n /** The placeholder value of the input. */\n placeholder?: string;\n /** Internal labels?. */\n labels?: HvInputLabels & Record<string, any>;\n /** An Object containing the various texts associated with the input. */\n validationMessages?: HvValidationMessages;\n /** Attributes applied to the input element. */\n inputProps?: MuiInputBaseComponentProps;\n /**\n * Allows passing a ref to the underlying input\n * @deprecated Use `ref` directly instead\n * */\n inputRef?: HvBaseInputProps[\"inputRef\"];\n /** The function that will be executed to received an array of objects that has a label and id to create list of suggestion */\n suggestionListCallback?: (value: string) => HvInputSuggestion[] | null;\n /**\n * The custom validation function, it receives the value and must return\n * either `true` for valid or `false` for invalid, default validations would only\n * occur if this function is null or undefined\n */\n validation?: (value: string) => boolean;\n /** If `true` it should autofocus. */\n autoFocus?: boolean;\n /** If `true` the clear button is disabled. */\n disableClear?: boolean;\n /** If `true` the reveal password button is disabled. Valid only when type is \"password\". */\n disableRevealPassword?: boolean;\n /** If `true` the search button is disabled. Valid only when type is \"search\". */\n disableSearchButton?: boolean;\n /**\n * If `true` the validation icon adornment is visible. Defaults to `false`.\n *\n * Currently, DS specifications define only a positive feedback icon;\n * errors are signaled through the border style and by displaying the error message.\n */\n showValidationIcon?: boolean;\n /** A custom icon to be added into the input. */\n endAdornment?: React.ReactNode;\n /** The maximum allowed length of the characters, if this value is null no check will be performed. */\n maxCharQuantity?: number;\n /** The minimum allowed length of the characters, if this value is null no check will be perform. */\n minCharQuantity?: number;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvInputClasses;\n}\n\nconst DEFAULT_LABELS = {\n /** The label of the clear button. */\n clearButtonLabel: \"Clear the text\",\n /** The label of the reveal password button. */\n revealPasswordButtonLabel: \"Reveal password\",\n /** The tooltip of the reveal password button when the password is hidden. */\n revealPasswordButtonClickToShowTooltip: \"Click to show password.\",\n /** The tooltip of the reveal password button when the password is revealed. */\n revealPasswordButtonClickToHideTooltip: \"Click to hide password.\",\n /** The label of the search button. */\n searchButtonLabel: \"Search\",\n};\n\nexport type HvInputLabels = Partial<typeof DEFAULT_LABELS>;\n\nfunction eventTargetIsInsideContainer(\n container: HTMLElement | null,\n event: React.FocusEvent<any>,\n) {\n return !!container?.contains(event.relatedTarget);\n}\n\n/** Changes a given `input`'s `value`, triggering its `onChange` */\nconst changeInputValue = (input: HTMLInputElement | null, value = \"\") => {\n const event = new Event(\"input\", { bubbles: true });\n\n /** Original `input.value` setter (React overrides it). */\n const setInputValue = Object.getOwnPropertyDescriptor(\n window.HTMLInputElement.prototype,\n \"value\",\n )?.set;\n\n setInputValue?.call(input, value);\n input?.dispatchEvent(event);\n};\n\n/**\n * A text input box is a graphical control element intended to enable the user to input text information to be used by the software.\n */\nexport const HvInput = forwardRef<InputElement, HvInputProps>((props, ref) => {\n const {\n classes: classesProp,\n className,\n id,\n name,\n value: valueProp,\n defaultValue = \"\",\n required = false,\n readOnly = false,\n disabled = false,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n onChange,\n onEnter,\n status,\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n type = \"text\",\n placeholder,\n autoFocus = false,\n labels: labelsProp,\n validationMessages,\n disableClear = false,\n disableRevealPassword = false,\n disableSearchButton = false,\n endAdornment,\n maxCharQuantity,\n minCharQuantity,\n validation,\n showValidationIcon = false,\n suggestionListCallback,\n inputRef: inputRefProp,\n onBlur,\n onFocus,\n onKeyDown,\n inputProps = {},\n ...others\n } = useDefaultProps(\"HvInput\", props);\n const { classes, cx } = useClasses(classesProp);\n const labels = useLabels(DEFAULT_LABELS, labelsProp);\n const elementId = useUniqueId(id);\n\n const inputRef = useRef<HTMLInputElement>(null);\n const forkedRef = useForkRef(ref, inputRef, inputRefProp);\n const suggestionsRef = useRef<HTMLElement>(null);\n\n const [focused, setFocused] = useState(false);\n\n // Signals that the user has manually edited the input value\n const isDirty = useRef(false);\n\n // Value related state\n const [value, setValue] = useControlled(valueProp, defaultValue);\n\n const isEmptyValue = value == null || value === \"\";\n\n // Validation related state\n const [validationState, setValidationState] = useControlled(\n status,\n validationStates.standBy,\n );\n\n const [validationMessage, setValidationMessage] = useControlled(\n statusMessage,\n \"\",\n );\n\n // validationMessages reference tends to change, as users will not memoize/useState for it;\n // dependencies must be more explicit so we set\n const errorMessages = useMemo(\n () => ({ ...DEFAULT_ERROR_MESSAGES, ...validationMessages }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n validationMessages?.error,\n validationMessages?.requiredError,\n validationMessages?.minCharError,\n validationMessages?.maxCharError,\n validationMessages?.typeMismatchError,\n ],\n );\n\n const validationType = useMemo(() => computeValidationType(type), [type]);\n\n // Validates the input, sets the status and the statusMessage accordingly (if uncontrolled)\n // and returns the validity state of the input.\n const performValidation = useCallback(() => {\n const inputValidity = validateInput(\n inputRef.current,\n value,\n required,\n minCharQuantity,\n maxCharQuantity,\n validationType,\n validation,\n );\n\n // This will only run if status is uncontrolled\n setValidationState(computeValidationState(inputValidity, isEmptyValue));\n\n // This will only run if statusMessage is uncontrolled\n setValidationMessage(\n computeValidationMessage(inputValidity, errorMessages),\n );\n\n return inputValidity;\n }, [\n errorMessages,\n isEmptyValue,\n maxCharQuantity,\n minCharQuantity,\n required,\n setValidationMessage,\n setValidationState,\n validation,\n validationType,\n value,\n ]);\n\n // The error message area will only be created if:\n // - an external element that provides an error message isn't identified via aria-errormessage AND\n // - both status and statusMessage properties are being controlled OR\n // - status is uncontrolled and any of the built-in validations are active\n const canShowError =\n ariaErrorMessage == null &&\n ((status !== undefined && statusMessage !== undefined) ||\n (status === undefined &&\n hasBuiltInValidations(\n required,\n validationType,\n minCharQuantity,\n maxCharQuantity,\n validation,\n inputProps,\n )));\n\n const isStateInvalid = isInvalid(validationState);\n\n // Input type related state\n const [revealPassword, setRevealPassword] = useState(false);\n\n const realType = useMemo(() => {\n if (type === \"password\") {\n return revealPassword ? \"text\" : \"password\";\n }\n\n if (type === \"search\") {\n return \"search\";\n }\n\n return \"text\";\n }, [revealPassword, type]);\n\n // Suggestions related state\n const [suggestionValues, setSuggestionValues] = useState<\n HvSuggestion[] | null\n >(null);\n\n const canShowSuggestions = suggestionListCallback != null;\n const hasSuggestions = !!suggestionValues;\n\n // Miscellaneous state\n const hasLabel = label != null;\n const hasDescription = description != null;\n\n /**\n * Looks for the node that represent the input inside the material tree and focus it.\n */\n const focusInput = () => {\n inputRef.current?.focus();\n };\n\n const isMounted = useIsMounted();\n\n /**\n * Clears the suggestion array.\n */\n const suggestionClearHandler = () => {\n if (isMounted.current) {\n setSuggestionValues(null);\n }\n };\n\n /**\n * Fills of the suggestion array.\n */\n const suggestionHandler = (val: string) => {\n const suggestionsArray = suggestionListCallback?.(val);\n if (suggestionsArray?.[0]?.label) {\n setSuggestionValues(suggestionsArray);\n } else {\n suggestionClearHandler();\n }\n };\n\n /**\n * Executes the user callback adds the selection to the state and clears the suggestions.\n */\n const suggestionSelectedHandler: HvSuggestionsProps[\"onSuggestionSelected\"] =\n (event, item) => {\n const newValue = item.value || (item.label as any);\n\n changeInputValue(inputRef.current, newValue);\n\n focusInput();\n suggestionClearHandler();\n\n if (type === \"search\") {\n // trigger the onEnter callback when the user selects an option in a search box\n onEnter?.(event, newValue);\n }\n };\n\n const onChangeHandler: HvBaseInputProps[\"onChange\"] = (event, newValue) => {\n isDirty.current = true;\n\n // set the input value (only when value is uncontrolled)\n setValue(newValue);\n\n onChange?.(event, newValue);\n\n if (canShowSuggestions) {\n // an edge case might be a controlled input whose onChange callback\n // doesn't change the value (or sets another): the suggestionListCallback\n // callback will still receive the original rejected value.\n // a refactor is needed so the suggestionListCallback might be called only\n // when the input is uncontrolled, providing a way to externally control\n // the suggestion values.\n suggestionHandler(newValue);\n }\n };\n\n /**\n * Validates the input updating the state and modifying the info text, also executes\n * the user provided onBlur passing the current validation status and value.\n */\n const onInputBlurHandler: HvBaseInputProps[\"onBlur\"] = (event) => {\n // If the blur is executed when choosing an suggestion it should be ignored.\n if (eventTargetIsInsideContainer(suggestionsRef.current, event)) return;\n\n setFocused(false);\n\n const inputValidity = performValidation();\n\n onBlur?.(event, value, inputValidity);\n };\n\n /**\n * Updates the state putting again the value from the state because the input value is\n * not automatically manage, it also executes the onFocus function from the user passing the value\n */\n const onFocusHandler: HvBaseInputProps[\"onFocus\"] = (event) => {\n setFocused(true);\n\n // reset validation status to standBy (only when status is uncontrolled)\n setValidationState(validationStates.standBy);\n\n onFocus?.(event, value);\n };\n\n const getSuggestions = (li: number | null) => {\n // TODO Replace with ref\n const listEl = document.getElementById(\n setId(elementId, \"suggestions-list\") || \"\",\n );\n return li != null ? listEl?.getElementsByTagName(\"li\")?.[li] : listEl;\n };\n\n const onSuggestionKeyDown: HvSuggestionsProps[\"onKeyDown\"] = (event) => {\n if (isKey(event, \"Esc\")) {\n suggestionClearHandler();\n focusInput();\n } else if (isKey(event, \"Tab\")) {\n suggestionClearHandler();\n }\n };\n\n /** Focus the suggestion list when the arrow down is pressed. */\n const onKeyDownHandler: HvBaseInputProps[\"onKeyDown\"] = (event) => {\n if (isKey(event, \"ArrowDown\") && hasSuggestions) {\n const li = getSuggestions(0);\n li?.focus();\n } else if (isKey(event, \"Enter\")) {\n onEnter?.(event, value);\n }\n\n onKeyDown?.(event, value);\n };\n\n /** Clears the suggestion list on blur. */\n const onContainerBlurHandler: HvFormElementProps[\"onBlur\"] = (event) => {\n if (event.relatedTarget) {\n setTimeout(() => {\n const list = getSuggestions(null);\n if (!list?.contains(document.activeElement)) suggestionClearHandler();\n }, 10);\n }\n };\n\n const hasOnEnter = onEnter != null;\n\n // show the clear button only if the input is enabled, not read-only, disableClear is false and the input is not empty\n // also, don't show it when the input type is \"search\" and the input is active (standBy)\n const showClear =\n !disabled &&\n !readOnly &&\n !disableClear &&\n !isEmptyValue &&\n (!hasOnEnter ||\n type !== \"search\" ||\n disableSearchButton ||\n validationState !== validationStates.standBy);\n\n const showSearchIcon = type === \"search\" && !disableSearchButton;\n\n const showRevealPasswordButton =\n type === \"password\" && !disableRevealPassword;\n\n /**\n * Clears the input value from the state and refocus the input.\n */\n const handleClear = useCallback(() => {\n // reset validation status to standBy (only when status is uncontrolled)\n setValidationState(validationStates.standBy);\n\n changeInputValue(inputRef.current, \"\");\n\n // we want to focus the input when clicked and not active\n setTimeout(focusInput);\n }, [setValidationState]);\n\n const clearButton = useMemo(() => {\n if (!showClear) {\n return null;\n }\n\n return (\n <HvAdornment\n // Don't control visibility when the search icon is enabled\n className={cx(classes.adornmentButton, {\n [classes.iconClear]: !showSearchIcon,\n })}\n onClick={handleClear}\n aria-label={labels?.clearButtonLabel}\n aria-controls={setId(elementId, \"input\")}\n icon={<CloseXS />}\n />\n );\n }, [\n showClear,\n classes.adornmentButton,\n classes.iconClear,\n showSearchIcon,\n handleClear,\n labels?.clearButtonLabel,\n elementId,\n cx,\n ]);\n\n /**\n * Calls the onEnter callback and refocus the input.\n */\n const handleSearch = useCallback<NonNullable<HvAdornmentProps[\"onClick\"]>>(\n (event) => {\n onEnter?.(event, value);\n },\n [onEnter, value],\n );\n\n const searchButton = useMemo(() => {\n // If the search icon is not actionable, only show it when the input is empty or active\n const reallyShowIt =\n showSearchIcon &&\n (isEmptyValue ||\n (hasOnEnter && validationState === validationStates.standBy));\n\n if (!reallyShowIt) {\n return null;\n }\n\n return (\n <HvAdornment\n className={classes.adornmentButton}\n onClick={hasOnEnter ? handleSearch : undefined}\n aria-label={labels?.searchButtonLabel}\n icon={<Search />}\n />\n );\n }, [\n showSearchIcon,\n isEmptyValue,\n hasOnEnter,\n validationState,\n classes.adornmentButton,\n handleSearch,\n labels?.searchButtonLabel,\n ]);\n\n /**\n * Changes input type and refocus the input.\n */\n const handleRevealPassword = useCallback(() => {\n setRevealPassword(!revealPassword);\n }, [revealPassword]);\n\n const revealPasswordButton = useMemo(() => {\n if (!showRevealPasswordButton) {\n return null;\n }\n\n return (\n <HvTooltip\n disableFocusListener\n disableTouchListener\n title={\n revealPassword\n ? labels?.revealPasswordButtonClickToHideTooltip\n : labels?.revealPasswordButtonClickToShowTooltip\n }\n >\n <HvAdornment\n className={classes.adornmentButton}\n onClick={handleRevealPassword}\n aria-label={labels?.revealPasswordButtonLabel}\n aria-controls={setId(elementId, \"input\")}\n icon={revealPassword ? <PreviewOff /> : <Preview />}\n />\n </HvTooltip>\n );\n }, [\n showRevealPasswordButton,\n revealPassword,\n labels?.revealPasswordButtonClickToHideTooltip,\n labels?.revealPasswordButtonClickToShowTooltip,\n labels?.revealPasswordButtonLabel,\n classes.adornmentButton,\n handleRevealPassword,\n elementId,\n ]);\n\n const validationIcon = useMemo(() => {\n if (!showValidationIcon) {\n return null;\n }\n\n if (!isValid(validationState)) {\n return null;\n }\n\n return <Success color=\"positive\" className={classes.icon} />;\n }, [showValidationIcon, validationState, classes.icon]);\n\n // useMemo to avoid repetitive cloning of the custom icon\n const customIconEl = useMemo(\n () =>\n isValidElement(endAdornment) &&\n cloneElement(endAdornment as React.ReactElement, {\n className: cx(endAdornment.props.className, classes.icon),\n }),\n [classes.icon, endAdornment, cx],\n );\n\n const adornments = useMemo(() => {\n if (\n !clearButton &&\n !revealPasswordButton &&\n !searchButton &&\n !validationIcon &&\n !customIconEl\n )\n return null;\n\n // note: specification implies that the custom icon should be hidden when\n // a validation feedback icon is being shown.\n return (\n <div className={classes.adornmentsBox} aria-hidden=\"true\">\n {clearButton}\n {revealPasswordButton}\n {searchButton}\n {validationIcon || customIconEl}\n </div>\n );\n }, [\n classes.adornmentsBox,\n clearButton,\n customIconEl,\n revealPasswordButton,\n searchButton,\n validationIcon,\n ]);\n\n // run initial validation after first render\n // and also when any validation condition changes\n useEffect(() => {\n if (focused || (!isDirty.current && isEmptyValue)) {\n // skip validation if currently focused or if empty and\n // the user never manually edited the input value\n return;\n }\n\n performValidation();\n }, [focused, isEmptyValue, performValidation]);\n\n const errorMessageId = isStateInvalid\n ? canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage\n : undefined;\n\n return (\n <HvFormElement\n id={id}\n name={name}\n status={validationState}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n className={cx(\n classes.root,\n {\n [classes.hasSuggestions]: hasSuggestions,\n },\n className,\n )}\n onBlur={onContainerBlurHandler}\n >\n {(hasLabel || hasDescription) && (\n <div className={classes.labelContainer}>\n {hasLabel && (\n <HvLabel\n id={setId(elementId, \"label\")}\n className={classes.label}\n htmlFor={setId(elementId, \"input\")}\n label={label}\n />\n )}\n\n {hasDescription && (\n <HvInfoMessage\n id={setId(elementId, \"description\")}\n className={classes.description}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n <HvBaseInput\n id={\n hasLabel || showClear || showRevealPasswordButton\n ? setId(elementId, \"input\")\n : setId(id, \"input\")\n }\n name={name}\n value={value}\n required={required}\n readOnly={readOnly}\n disabled={disabled}\n onChange={onChangeHandler}\n autoFocus={autoFocus}\n onKeyDown={onKeyDownHandler}\n onBlur={onInputBlurHandler}\n onFocus={onFocusHandler}\n placeholder={placeholder}\n type={realType}\n classes={{\n input: classes.input,\n inputRoot: classes.inputRoot,\n inputRootFocused: classes.inputRootFocused,\n inputRootDisabled: classes.inputRootDisabled,\n inputRootMultiline: classes.inputRootMultiline,\n inputBorderContainer: classes.inputBorderContainer,\n }}\n invalid={isStateInvalid}\n inputProps={{\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-invalid\": isStateInvalid ? true : undefined,\n \"aria-errormessage\": errorMessageId,\n \"aria-describedby\":\n ariaDescribedBy != null\n ? ariaDescribedBy\n : description\n ? setId(elementId, \"description\")\n : undefined,\n \"aria-controls\": canShowSuggestions\n ? setId(elementId, \"suggestions\")\n : undefined,\n\n ref: inputRef,\n\n // prevent browsers auto-fill/suggestions when we have our own\n autoComplete: canShowSuggestions ? \"off\" : undefined,\n\n ...inputProps,\n }}\n inputRef={forkedRef}\n endAdornment={adornments}\n {...others}\n />\n {canShowSuggestions && (\n <>\n {hasSuggestions && (\n <div role=\"presentation\" className={classes.inputExtension} />\n )}\n <HvSuggestions\n ref={suggestionsRef}\n id={setId(elementId, \"suggestions\")}\n classes={{\n root: classes.suggestionsContainer,\n list: classes.suggestionList,\n }}\n expanded={hasSuggestions}\n anchorEl={inputRef.current?.parentElement}\n onClose={suggestionClearHandler}\n onKeyDown={onSuggestionKeyDown}\n onSuggestionSelected={suggestionSelectedHandler}\n suggestionValues={suggestionValues}\n />\n </>\n )}\n {canShowError && (\n <HvWarningText\n id={setId(elementId, \"error\")}\n disableBorder\n className={classes.error}\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n});\n"],"names":["validationState","validationStates"],"mappings":";;;;;;;;;;;;;;;;;;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AA,QAED,gBACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI,MAAM,WAAW,OAAO;AAAA,YAC5B,eAAa;AAAA,YACb,WAAW,QAAQ;AAAA,YAElB,UAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
@@ -18,8 +18,7 @@ const HvLink = (props) => {
18
18
  {
19
19
  href: route,
20
20
  onClick: (event) => {
21
- if (!onClick)
22
- return;
21
+ if (!onClick) return;
23
22
  event.preventDefault();
24
23
  onClick?.(event, data);
25
24
  },
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sources":["../../../src/Link/Link.tsx"],"sourcesContent":["import { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { staticClasses, useClasses } from \"./Link.styles\";\n\nexport { staticClasses as linkClasses };\n\nexport type HvLinkClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvLinkProps extends HvBaseProps<HTMLAnchorElement, \"onClick\"> {\n onClick?: (event: React.MouseEvent<HTMLAnchorElement>, data: any) => void;\n route?: string;\n data?: any;\n children: any;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvLinkClasses;\n}\n\nexport const HvLink = (props: HvLinkProps) => {\n const {\n onClick,\n classes: classesProp,\n className,\n route,\n data,\n children,\n ...others\n } = useDefaultProps(\"HvLink\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n return (\n <a\n href={route}\n onClick={(event) => {\n if (!onClick) return;\n\n event.preventDefault();\n onClick?.(event, data);\n }}\n className={cx(classes.a, className)}\n {...others}\n >\n {children}\n </a>\n );\n};\n"],"names":[],"mappings":";;;;AAkBa,MAAA,SAAS,CAAC,UAAuB;AACtC,QAAA;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,UAAU,KAAK;AAEnC,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAG5C,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAM;AAAA,MACN,SAAS,CAAC,UAAU;AAClB,YAAI,CAAC;AAAS;AAEd,cAAM,eAAe;AACrB,kBAAU,OAAO,IAAI;AAAA,MACvB;AAAA,MACA,WAAW,GAAG,QAAQ,GAAG,SAAS;AAAA,MACjC,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;"}
1
+ {"version":3,"file":"Link.js","sources":["../../../src/Link/Link.tsx"],"sourcesContent":["import { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { staticClasses, useClasses } from \"./Link.styles\";\n\nexport { staticClasses as linkClasses };\n\nexport type HvLinkClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvLinkProps extends HvBaseProps<HTMLAnchorElement, \"onClick\"> {\n onClick?: (event: React.MouseEvent<HTMLAnchorElement>, data: any) => void;\n route?: string;\n data?: any;\n children: any;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvLinkClasses;\n}\n\nexport const HvLink = (props: HvLinkProps) => {\n const {\n onClick,\n classes: classesProp,\n className,\n route,\n data,\n children,\n ...others\n } = useDefaultProps(\"HvLink\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n return (\n <a\n href={route}\n onClick={(event) => {\n if (!onClick) return;\n\n event.preventDefault();\n onClick?.(event, data);\n }}\n className={cx(classes.a, className)}\n {...others}\n >\n {children}\n </a>\n );\n};\n"],"names":[],"mappings":";;;;AAkBa,MAAA,SAAS,CAAC,UAAuB;AACtC,QAAA;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,UAAU,KAAK;AAEnC,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAG5C,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAM;AAAA,MACN,SAAS,CAAC,UAAU;AAClB,YAAI,CAAC,QAAS;AAEd,cAAM,eAAe;AACrB,kBAAU,OAAO,IAAI;AAAA,MACvB;AAAA,MACA,WAAW,GAAG,QAAQ,GAAG,SAAS;AAAA,MACjC,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;"}
@@ -54,17 +54,13 @@ const HvList = (props) => {
54
54
  setList(parsedList);
55
55
  }, [valuesProp, multiSelect, selectable, singleSelectionToggle, setList]);
56
56
  const [role, itemRole] = useMemo(() => {
57
- if (selectable && useSelector)
58
- return ["list", "listitem"];
59
- if (selectable)
60
- return ["listbox", "option"];
57
+ if (selectable && useSelector) return ["list", "listitem"];
58
+ if (selectable) return ["listbox", "option"];
61
59
  return ["menu", "menuitem"];
62
60
  }, [selectable, useSelector]);
63
61
  const handleSelect = (evt, item) => {
64
- if (!item.path)
65
- evt.preventDefault();
66
- if (item.disabled)
67
- return;
62
+ if (!item.path) evt.preventDefault();
63
+ if (item.disabled) return;
68
64
  const passedProps = { multiSelect, selectable, singleSelectionToggle };
69
65
  const parsedList = parseList(item, passedProps, void 0, list);
70
66
  setList(parsedList);
@@ -86,10 +82,10 @@ const HvList = (props) => {
86
82
  onChange?.(parsedList);
87
83
  };
88
84
  const renderLeftIcon = (item) => {
89
- return isValidElement(item.icon) ? item.icon : item.icon?.({
85
+ return isValidElement(item.icon) ? item.icon : typeof item.icon === "function" ? item.icon?.({
90
86
  isSelected: item.selected,
91
87
  isDisabled: item.disabled
92
- });
88
+ }) : null;
93
89
  };
94
90
  const renderSelectAll = () => {
95
91
  const { selectAll, selectionConjunction } = labels;
@@ -119,8 +115,7 @@ const HvList = (props) => {
119
115
  return !multiSelect && item.path ? /* @__PURE__ */ jsx(HvLink, { route: item.path, classes: { a: classes.link }, children: /* @__PURE__ */ jsx(HvOverflowTooltip, { data: item.label }) }) : /* @__PURE__ */ jsx(HvOverflowTooltip, { data: item.label });
120
116
  };
121
117
  const renderSelectItem = (item, itemId) => {
122
- if (!useSelector)
123
- return renderItemText(item);
118
+ if (!useSelector) return renderItemText(item);
124
119
  const Component = multiSelect ? HvCheckBox : HvRadio;
125
120
  return /* @__PURE__ */ jsx(
126
121
  Component,
@@ -172,7 +167,10 @@ const HvList = (props) => {
172
167
  listRef.current.scrollToItem(selectedItemIndex);
173
168
  }
174
169
  }, [listRef, selectedItemIndex]);
175
- const renderVirtualizedListItem = ({ index, style }) => {
170
+ const renderVirtualizedListItem = ({
171
+ index,
172
+ style
173
+ }) => {
176
174
  const item = filteredList[index];
177
175
  const tabIndex = item.tabIndex || !anySelected && index === 0 || item.selected && !item.disabled ? 0 : -1;
178
176
  return renderListItem(item, index, {
@@ -216,8 +214,7 @@ const HvList = (props) => {
216
214
  condensed,
217
215
  ariaMultiSelectable
218
216
  ]);
219
- if (filteredList.length === 0)
220
- return null;
217
+ if (filteredList.length === 0) return null;
221
218
  return /* @__PURE__ */ jsxs(Fragment, { children: [
222
219
  multiSelect && useSelector && showSelectAll && renderSelectAll(),
223
220
  !virtualized ? /* @__PURE__ */ jsx(