@hitachivantara/uikit-react-core 5.9.1 → 5.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/cjs/components/ActionsGeneric/ActionsGeneric.cjs.map +1 -1
  2. package/dist/cjs/components/BaseInput/BaseInput.cjs +18 -1
  3. package/dist/cjs/components/BaseInput/BaseInput.cjs.map +1 -1
  4. package/dist/cjs/components/BreadCrumb/BreadCrumb.cjs +3 -3
  5. package/dist/cjs/components/BreadCrumb/BreadCrumb.cjs.map +1 -1
  6. package/dist/cjs/components/BreadCrumb/Page/Page.cjs +22 -12
  7. package/dist/cjs/components/BreadCrumb/Page/Page.cjs.map +1 -1
  8. package/dist/cjs/components/BreadCrumb/Page/Page.styles.cjs +19 -44
  9. package/dist/cjs/components/BreadCrumb/Page/Page.styles.cjs.map +1 -1
  10. package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.styles.cjs +4 -8
  11. package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.styles.cjs.map +1 -1
  12. package/dist/cjs/components/Calendar/SingleCalendar/CalendarCell.cjs +5 -17
  13. package/dist/cjs/components/Calendar/SingleCalendar/CalendarCell.cjs.map +1 -1
  14. package/dist/cjs/components/Calendar/utils.cjs +0 -8
  15. package/dist/cjs/components/Calendar/utils.cjs.map +1 -1
  16. package/dist/cjs/components/DropDownMenu/DropDownMenu.cjs +24 -29
  17. package/dist/cjs/components/DropDownMenu/DropDownMenu.cjs.map +1 -1
  18. package/dist/cjs/components/DropDownMenu/DropDownMenu.styles.cjs +27 -75
  19. package/dist/cjs/components/DropDownMenu/DropDownMenu.styles.cjs.map +1 -1
  20. package/dist/cjs/components/DropDownMenu/dropDownMenuClasses.cjs +1 -1
  21. package/dist/cjs/components/DropDownMenu/dropDownMenuClasses.cjs.map +1 -1
  22. package/dist/cjs/components/FileUploader/DropZone/DropZone.cjs +5 -4
  23. package/dist/cjs/components/FileUploader/DropZone/DropZone.cjs.map +1 -1
  24. package/dist/cjs/components/Pagination/Pagination.styles.cjs +10 -14
  25. package/dist/cjs/components/Pagination/Pagination.styles.cjs.map +1 -1
  26. package/dist/cjs/components/Table/TableCell/TableCell.cjs +4 -4
  27. package/dist/cjs/components/Table/TableCell/TableCell.cjs.map +1 -1
  28. package/dist/cjs/components/Table/TableCell/TableCell.styles.cjs +2 -14
  29. package/dist/cjs/components/Table/TableCell/TableCell.styles.cjs.map +1 -1
  30. package/dist/cjs/components/Table/TableRow/TableRow.cjs +6 -6
  31. package/dist/cjs/components/Table/TableRow/TableRow.cjs.map +1 -1
  32. package/dist/cjs/components/Table/utils/utils.cjs +0 -5
  33. package/dist/cjs/components/Table/utils/utils.cjs.map +1 -1
  34. package/dist/cjs/components/Tooltip/Tooltip.cjs.map +1 -1
  35. package/dist/cjs/components/Tooltip/Tooltip.styles.cjs +23 -37
  36. package/dist/cjs/components/Tooltip/Tooltip.styles.cjs.map +1 -1
  37. package/dist/cjs/components/VerticalNavigation/Actions/Actions.cjs +2 -2
  38. package/dist/cjs/components/VerticalNavigation/Actions/Actions.cjs.map +1 -1
  39. package/dist/cjs/components/VerticalNavigation/Header/Header.cjs +2 -2
  40. package/dist/cjs/components/VerticalNavigation/Header/Header.cjs.map +1 -1
  41. package/dist/cjs/components/VerticalNavigation/Navigation/Navigation.cjs +15 -8
  42. package/dist/cjs/components/VerticalNavigation/Navigation/Navigation.cjs.map +1 -1
  43. package/dist/cjs/components/VerticalNavigation/NavigationPopup/NavigationPopup.cjs +1 -0
  44. package/dist/cjs/components/VerticalNavigation/NavigationPopup/NavigationPopup.cjs.map +1 -1
  45. package/dist/cjs/components/VerticalNavigation/TreeView/TreeViewItem.cjs +5 -5
  46. package/dist/cjs/components/VerticalNavigation/TreeView/TreeViewItem.cjs.map +1 -1
  47. package/dist/cjs/components/VerticalNavigation/VerticalNavigation.cjs +7 -3
  48. package/dist/cjs/components/VerticalNavigation/VerticalNavigation.cjs.map +1 -1
  49. package/dist/cjs/components/VerticalNavigation/VerticalNavigationContext.cjs +1 -1
  50. package/dist/cjs/components/VerticalNavigation/VerticalNavigationContext.cjs.map +1 -1
  51. package/dist/cjs/hooks/useUniqueId.cjs +1 -1
  52. package/dist/cjs/hooks/useUniqueId.cjs.map +1 -1
  53. package/dist/cjs/index.cjs +2 -3
  54. package/dist/cjs/index.cjs.map +1 -1
  55. package/dist/cjs/utils/checkValidHexColorValue.cjs +9 -0
  56. package/dist/cjs/utils/checkValidHexColorValue.cjs.map +1 -0
  57. package/dist/esm/components/ActionsGeneric/ActionsGeneric.js.map +1 -1
  58. package/dist/esm/components/BaseInput/BaseInput.js +18 -1
  59. package/dist/esm/components/BaseInput/BaseInput.js.map +1 -1
  60. package/dist/esm/components/BreadCrumb/BreadCrumb.js +3 -3
  61. package/dist/esm/components/BreadCrumb/BreadCrumb.js.map +1 -1
  62. package/dist/esm/components/BreadCrumb/Page/Page.js +23 -13
  63. package/dist/esm/components/BreadCrumb/Page/Page.js.map +1 -1
  64. package/dist/esm/components/BreadCrumb/Page/Page.styles.js +19 -42
  65. package/dist/esm/components/BreadCrumb/Page/Page.styles.js.map +1 -1
  66. package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.styles.js +4 -8
  67. package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.styles.js.map +1 -1
  68. package/dist/esm/components/Calendar/SingleCalendar/CalendarCell.js +6 -18
  69. package/dist/esm/components/Calendar/SingleCalendar/CalendarCell.js.map +1 -1
  70. package/dist/esm/components/Calendar/utils.js +1 -9
  71. package/dist/esm/components/Calendar/utils.js.map +1 -1
  72. package/dist/esm/components/DropDownMenu/DropDownMenu.js +25 -30
  73. package/dist/esm/components/DropDownMenu/DropDownMenu.js.map +1 -1
  74. package/dist/esm/components/DropDownMenu/DropDownMenu.styles.js +27 -73
  75. package/dist/esm/components/DropDownMenu/DropDownMenu.styles.js.map +1 -1
  76. package/dist/esm/components/DropDownMenu/dropDownMenuClasses.js +1 -1
  77. package/dist/esm/components/DropDownMenu/dropDownMenuClasses.js.map +1 -1
  78. package/dist/esm/components/FileUploader/DropZone/DropZone.js +5 -4
  79. package/dist/esm/components/FileUploader/DropZone/DropZone.js.map +1 -1
  80. package/dist/esm/components/Pagination/Pagination.styles.js +10 -14
  81. package/dist/esm/components/Pagination/Pagination.styles.js.map +1 -1
  82. package/dist/esm/components/Table/TableCell/TableCell.js +2 -2
  83. package/dist/esm/components/Table/TableCell/TableCell.js.map +1 -1
  84. package/dist/esm/components/Table/TableCell/TableCell.styles.js +2 -14
  85. package/dist/esm/components/Table/TableCell/TableCell.styles.js.map +1 -1
  86. package/dist/esm/components/Table/TableRow/TableRow.js +2 -2
  87. package/dist/esm/components/Table/TableRow/TableRow.js.map +1 -1
  88. package/dist/esm/components/Table/utils/utils.js +0 -5
  89. package/dist/esm/components/Table/utils/utils.js.map +1 -1
  90. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  91. package/dist/esm/components/Tooltip/Tooltip.styles.js +24 -38
  92. package/dist/esm/components/Tooltip/Tooltip.styles.js.map +1 -1
  93. package/dist/esm/components/VerticalNavigation/Actions/Actions.js +2 -2
  94. package/dist/esm/components/VerticalNavigation/Actions/Actions.js.map +1 -1
  95. package/dist/esm/components/VerticalNavigation/Header/Header.js +2 -2
  96. package/dist/esm/components/VerticalNavigation/Header/Header.js.map +1 -1
  97. package/dist/esm/components/VerticalNavigation/Navigation/Navigation.js +15 -8
  98. package/dist/esm/components/VerticalNavigation/Navigation/Navigation.js.map +1 -1
  99. package/dist/esm/components/VerticalNavigation/NavigationPopup/NavigationPopup.js +1 -0
  100. package/dist/esm/components/VerticalNavigation/NavigationPopup/NavigationPopup.js.map +1 -1
  101. package/dist/esm/components/VerticalNavigation/TreeView/TreeViewItem.js +5 -5
  102. package/dist/esm/components/VerticalNavigation/TreeView/TreeViewItem.js.map +1 -1
  103. package/dist/esm/components/VerticalNavigation/VerticalNavigation.js +7 -3
  104. package/dist/esm/components/VerticalNavigation/VerticalNavigation.js.map +1 -1
  105. package/dist/esm/components/VerticalNavigation/VerticalNavigationContext.js +1 -1
  106. package/dist/esm/components/VerticalNavigation/VerticalNavigationContext.js.map +1 -1
  107. package/dist/esm/hooks/useUniqueId.js +2 -2
  108. package/dist/esm/hooks/useUniqueId.js.map +1 -1
  109. package/dist/esm/index.js +5 -6
  110. package/dist/esm/utils/checkValidHexColorValue.js +9 -0
  111. package/dist/esm/utils/checkValidHexColorValue.js.map +1 -0
  112. package/dist/types/index.d.ts +41 -45
  113. package/package.json +5 -5
  114. package/dist/cjs/hocs/withId.cjs +0 -31
  115. package/dist/cjs/hocs/withId.cjs.map +0 -1
  116. package/dist/esm/hocs/withId.js +0 -28
  117. package/dist/esm/hocs/withId.js.map +0 -1
@@ -1,21 +1,22 @@
1
- import { clsx } from "clsx";
2
1
  import { useMemo } from "react";
3
2
  import { ClassNames } from "@emotion/react";
4
3
  import { theme } from "@hitachivantara/uikit-styles";
5
4
  import { MoreOptionsVertical } from "@hitachivantara/uikit-react-icons";
6
- import withId from "../../hocs/withId.js";
7
- import { StyledButton, StyledBaseDropDown, StyledPanel } from "./DropDownMenu.styles.js";
5
+ import { styles } from "./DropDownMenu.styles.js";
8
6
  import dropDownMenuClasses from "./dropDownMenuClasses.js";
9
7
  import { jsx } from "@emotion/react/jsx-runtime";
8
+ import useUniqueId from "../../hooks/useUniqueId.js";
10
9
  import { getPrevNextFocus } from "../../utils/focusableElementFinder.js";
10
+ import { HvBaseDropdown } from "../BaseDropdown/BaseDropdown.js";
11
+ import { HvPanel } from "../Panel/Panel.js";
11
12
  import { HvList } from "../List/List.js";
12
13
  import { useControlled } from "../../hooks/useControlled.js";
13
14
  import { setId } from "../../utils/setId.js";
14
- import { outlineStyles } from "../../utils/focusUtils.js";
15
+ import { HvButton } from "../Button/Button.js";
15
16
  import { isKeypress } from "../../utils/keyboardUtils/keyCheck.js";
16
17
  import { keyboardCodes } from "../../utils/keyboardUtils/keyboardCodes.js";
17
18
  const HvDropDownMenu = ({
18
- id,
19
+ id: idProp,
19
20
  classes,
20
21
  className,
21
22
  icon,
@@ -32,6 +33,7 @@ const HvDropDownMenu = ({
32
33
  ...others
33
34
  }) => {
34
35
  const [open, setOpen] = useControlled(expanded, Boolean(defaultExpanded));
36
+ const id = useUniqueId(idProp, "dropdown-menu");
35
37
  const focusNodes = getPrevNextFocus(setId(id, "icon-button"));
36
38
  const listId = setId(id, "list");
37
39
  const handleClose = (event) => {
@@ -51,19 +53,6 @@ const HvDropDownMenu = ({
51
53
  var _a;
52
54
  (_a = containerRef == null ? void 0 : containerRef.getElementsByTagName("li")[0]) == null ? void 0 : _a.focus();
53
55
  };
54
- const headerComponent = /* @__PURE__ */ jsx(StyledButton, {
55
- icon: true,
56
- variant: category,
57
- id: setId(id, "icon-button"),
58
- className: clsx(dropDownMenuClasses.icon, classes == null ? void 0 : classes.icon, open && clsx(dropDownMenuClasses.iconSelected, classes == null ? void 0 : classes.iconSelected)),
59
- "aria-expanded": open,
60
- disabled,
61
- "aria-label": "Dropdown menu",
62
- $open: open,
63
- children: icon || /* @__PURE__ */ jsx(MoreOptionsVertical, {
64
- color: disabled ? "secondary_60" : void 0
65
- })
66
- });
67
56
  const condensed = useMemo(() => dataList.every((el) => !el.icon), [dataList]);
68
57
  const popperStyle = {
69
58
  style: {
@@ -76,21 +65,26 @@ const HvDropDownMenu = ({
76
65
  children: ({
77
66
  css,
78
67
  cx
79
- }) => /* @__PURE__ */ jsx(StyledBaseDropDown, {
68
+ }) => /* @__PURE__ */ jsx(HvBaseDropdown, {
80
69
  id,
81
- className: cx(dropDownMenuClasses.container, className, classes == null ? void 0 : classes.container),
70
+ className: cx(dropDownMenuClasses.container, css(styles.container), className, classes == null ? void 0 : classes.container),
82
71
  classes: {
83
- root: cx(dropDownMenuClasses.root, css({
84
- display: "inline-block",
85
- width: "auto",
86
- "&.focus-visible $icon": {
87
- ...outlineStyles
88
- }
89
- }), classes == null ? void 0 : classes.root),
72
+ root: cx(dropDownMenuClasses.root, css(styles.root), classes == null ? void 0 : classes.root),
90
73
  container: cx(dropDownMenuClasses.baseContainer, classes == null ? void 0 : classes.baseContainer)
91
74
  },
92
75
  expanded: open && !disabled,
93
- component: headerComponent,
76
+ component: /* @__PURE__ */ jsx(HvButton, {
77
+ icon: true,
78
+ variant: category,
79
+ id: setId(id, "icon-button"),
80
+ className: cx(dropDownMenuClasses.icon, open && dropDownMenuClasses.iconSelected, css(styles.icon), open && css(styles.iconSelected), classes == null ? void 0 : classes.icon, open && (classes == null ? void 0 : classes.iconSelected)),
81
+ "aria-expanded": open,
82
+ disabled,
83
+ "aria-label": "Dropdown menu",
84
+ children: icon || /* @__PURE__ */ jsx(MoreOptionsVertical, {
85
+ color: disabled ? "secondary_60" : void 0
86
+ })
87
+ }),
94
88
  "aria-haspopup": "menu",
95
89
  placement,
96
90
  variableWidth: true,
@@ -103,7 +97,8 @@ const HvDropDownMenu = ({
103
97
  onContainerCreation: setFocusToContent,
104
98
  popperProps: popperStyle,
105
99
  ...others,
106
- children: /* @__PURE__ */ jsx(StyledPanel, {
100
+ children: /* @__PURE__ */ jsx(HvPanel, {
101
+ className: cx(dropDownMenuClasses.menuListRoot, css(styles.menuListRoot), classes == null ? void 0 : classes.menuListRoot),
107
102
  children: /* @__PURE__ */ jsx(HvList, {
108
103
  id: listId,
109
104
  values: dataList,
@@ -123,7 +118,7 @@ const HvDropDownMenu = ({
123
118
  })
124
119
  });
125
120
  };
126
- const HvDropDownMenu$1 = withId(HvDropDownMenu);
121
+ const HvDropDownMenu$1 = HvDropDownMenu;
127
122
  export {
128
123
  HvDropDownMenu$1 as default
129
124
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DropDownMenu.js","sources":["../../../../src/components/DropDownMenu/DropDownMenu.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useMemo } from \"react\";\nimport { ClassNames } from \"@emotion/react\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { MoreOptionsVertical } from \"@hitachivantara/uikit-react-icons\";\nimport { useControlled } from \"@core/hooks\";\nimport { HvBaseProps } from \"@core/types\";\nimport withId from \"@core/hocs/withId\";\nimport {\n isKeypress,\n keyboardCodes,\n outlineStyles,\n setId,\n getPrevNextFocus,\n} from \"@core/utils\";\n\nimport {\n HvBaseDropdownProps,\n HvButtonVariant,\n HvList,\n HvListValue,\n} from \"@core/components\";\nimport {\n StyledBaseDropDown,\n StyledButton,\n StyledPanel,\n} from \"./DropDownMenu.styles\";\nimport dropDownMenuClasses, {\n HvDropDownMenuClasses,\n} from \"./dropDownMenuClasses\";\n\nexport interface HvDropDownMenuProps\n extends HvBaseProps<HTMLDivElement, \"onClick\"> {\n /** Icon. */\n icon?: React.ReactElement;\n /**\n * A list containing the elements to be rendered.\n *\n * - label: The label of the element to be rendered.\n * - selected: The selection state of the element.\n * - disabled: The disabled state of the element.\n * - icon: The icon node to be rendered on the left.\n * - showNavIcon: If true renders the navigation icon on the right.\n */\n dataList: HvListValue[];\n /** Placement of the dropdown. */\n placement?: \"left\" | \"right\";\n /** Disable the portal behavior. The children stay within it's parent DOM hierarchy. */\n disablePortal?: boolean;\n /** Function executed on toggle of the dropdown. Should receive the open status. */\n onToggle?: (event: Event, open: boolean) => void;\n /** Function executed in each onClick. Should received the clicked element. */\n onClick?: (\n event: React.ChangeEvent<HTMLLIElement>,\n value: HvListValue\n ) => void;\n /** Keep the Dropdown Menu opened after clicking one option */\n keepOpened?: boolean;\n /** Defines if the component is disabled. */\n disabled?: boolean;\n /** If true it should be displayed open. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** The variant to be used in the header. */\n category?: HvButtonVariant;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvDropDownMenuClasses;\n}\n\n/**\n * A drop-down menu is a graphical control element, similar to a list box, that allows the user to choose a value from a list.\n */\nconst HvDropDownMenu = ({\n id,\n classes,\n className,\n icon,\n placement = \"right\",\n dataList,\n disablePortal = false,\n onToggle,\n onClick,\n keepOpened = true,\n disabled = false,\n expanded,\n defaultExpanded = false,\n category = \"secondaryGhost\",\n ...others\n}: HvDropDownMenuProps) => {\n const [open, setOpen] = useControlled(expanded, Boolean(defaultExpanded));\n const focusNodes = getPrevNextFocus(setId(id, \"icon-button\"));\n\n const listId = setId(id, \"list\");\n\n const handleClose = (event) => {\n // this will only run if uncontrolled\n setOpen(false);\n onToggle?.(event, false);\n };\n\n // If the ESCAPE key is pressed inside the list, the close handler must be called.\n const handleKeyDown = (event) => {\n if (isKeypress(event, keyboardCodes.Tab)) {\n const node = event.shiftKey ? focusNodes.prevFocus : focusNodes.nextFocus;\n if (node) setTimeout(() => node.focus(), 0);\n handleClose(event);\n }\n event.preventDefault();\n };\n\n const setFocusToContent = (containerRef) => {\n containerRef?.getElementsByTagName(\"li\")[0]?.focus();\n };\n\n const headerComponent = (\n <StyledButton\n icon\n variant={category}\n id={setId(id, \"icon-button\")}\n className={clsx(\n dropDownMenuClasses.icon,\n classes?.icon,\n open && clsx(dropDownMenuClasses.iconSelected, classes?.iconSelected)\n )}\n aria-expanded={open}\n disabled={disabled}\n aria-label=\"Dropdown menu\"\n $open={open}\n >\n {icon || (\n <MoreOptionsVertical color={disabled ? \"secondary_60\" : undefined} />\n )}\n </StyledButton>\n );\n\n const condensed = useMemo(() => dataList.every((el) => !el.icon), [dataList]);\n const popperStyle: HvBaseDropdownProps[\"popperProps\"] = {\n style: {\n zIndex: theme.zIndices.tooltip,\n width: \"auto\",\n position: \"relative\",\n },\n };\n\n return (\n <ClassNames>\n {({ css, cx }) => (\n <StyledBaseDropDown\n id={id}\n className={cx(\n dropDownMenuClasses.container,\n className,\n classes?.container\n )}\n classes={{\n root: cx(\n dropDownMenuClasses.root,\n css({\n display: \"inline-block\",\n width: \"auto\",\n \"&.focus-visible $icon\": {\n ...outlineStyles,\n },\n }),\n classes?.root\n ),\n container: cx(\n dropDownMenuClasses.baseContainer,\n classes?.baseContainer\n ),\n }}\n expanded={open && !disabled}\n component={headerComponent}\n aria-haspopup=\"menu\"\n placement={placement}\n variableWidth\n disablePortal={disablePortal}\n onToggle={(e, s) => {\n // this will only run if uncontrolled\n setOpen(s);\n onToggle?.(e, s);\n }}\n disabled={disabled}\n onContainerCreation={setFocusToContent}\n popperProps={popperStyle}\n {...others}\n >\n <StyledPanel>\n <HvList\n id={listId}\n values={dataList}\n selectable={false}\n condensed={condensed}\n onClick={(event, item) => {\n if (!keepOpened) handleClose(event);\n onClick?.(event, item);\n }}\n onKeyDown={handleKeyDown}\n classes={{\n root: cx(dropDownMenuClasses.menuList, classes?.menuList),\n }}\n />\n </StyledPanel>\n </StyledBaseDropDown>\n )}\n </ClassNames>\n );\n};\n\nexport default withId(HvDropDownMenu);\n"],"names":["HvDropDownMenu","id","classes","className","icon","placement","dataList","disablePortal","onToggle","onClick","keepOpened","disabled","expanded","defaultExpanded","category","others","open","setOpen","useControlled","Boolean","focusNodes","getPrevNextFocus","setId","listId","handleClose","event","handleKeyDown","isKeypress","keyboardCodes","Tab","node","shiftKey","prevFocus","nextFocus","setTimeout","focus","preventDefault","setFocusToContent","containerRef","getElementsByTagName","headerComponent","StyledButton","variant","clsx","dropDownMenuClasses","iconSelected","$open","children","_jsx","MoreOptionsVertical","color","undefined","condensed","useMemo","every","el","popperStyle","style","zIndex","theme","zIndices","tooltip","width","position","ClassNames","css","cx","StyledBaseDropDown","container","root","display","outlineStyles","baseContainer","component","variableWidth","e","s","onContainerCreation","popperProps","StyledPanel","HvList","values","selectable","item","onKeyDown","menuList","withId"],"mappings":";;;;;;;;;;;;;;;;AAyEA,MAAMA,iBAAiBA,CAAC;AAAA,EACtBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,YAAY;AAAA,EACZC;AAAAA,EACAC,gBAAgB;AAAA,EAChBC;AAAAA,EACAC;AAAAA,EACAC,aAAa;AAAA,EACbC,WAAW;AAAA,EACXC;AAAAA,EACAC,kBAAkB;AAAA,EAClBC,WAAW;AAAA,EACX,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Q;AAAA,UAC1D;AAAA,QAAA,CAAE;AAAA,MAAA,CACF;AAAA,IAAA,CACU;AAAA,EAAA,CAGP;AAEjB;AAEA,MAAeC,mBAAAA,OAAOtF,cAAc;"}
1
+ {"version":3,"file":"DropDownMenu.js","sources":["../../../../src/components/DropDownMenu/DropDownMenu.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { ClassNames } from \"@emotion/react\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { MoreOptionsVertical } from \"@hitachivantara/uikit-react-icons\";\nimport { useControlled, useUniqueId } from \"@core/hooks\";\nimport { HvBaseProps } from \"@core/types\";\nimport {\n isKeypress,\n keyboardCodes,\n setId,\n getPrevNextFocus,\n} from \"@core/utils\";\nimport {\n HvBaseDropdown,\n HvBaseDropdownProps,\n HvButton,\n HvButtonVariant,\n HvList,\n HvListValue,\n HvPanel,\n} from \"@core/components\";\nimport { styles } from \"./DropDownMenu.styles\";\nimport dropDownMenuClasses, {\n HvDropDownMenuClasses,\n} from \"./dropDownMenuClasses\";\n\nexport interface HvDropDownMenuProps\n extends HvBaseProps<HTMLDivElement, \"onClick\"> {\n /** Icon. */\n icon?: React.ReactElement;\n /**\n * A list containing the elements to be rendered.\n *\n * - label: The label of the element to be rendered.\n * - selected: The selection state of the element.\n * - disabled: The disabled state of the element.\n * - icon: The icon node to be rendered on the left.\n * - showNavIcon: If true renders the navigation icon on the right.\n */\n dataList: HvListValue[];\n /** Placement of the dropdown. */\n placement?: \"left\" | \"right\";\n /** Disable the portal behavior. The children stay within it's parent DOM hierarchy. */\n disablePortal?: boolean;\n /** Function executed on toggle of the dropdown. Should receive the open status. */\n onToggle?: (event: Event, open: boolean) => void;\n /** Function executed in each onClick. Should received the clicked element. */\n onClick?: (\n event: React.ChangeEvent<HTMLLIElement>,\n value: HvListValue\n ) => void;\n /** Keep the Dropdown Menu opened after clicking one option */\n keepOpened?: boolean;\n /** Defines if the component is disabled. */\n disabled?: boolean;\n /** If true it should be displayed open. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** The variant to be used in the header. */\n category?: HvButtonVariant;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvDropDownMenuClasses;\n}\n\n/**\n * A drop-down menu is a graphical control element, similar to a list box, that allows the user to choose a value from a list.\n */\nconst HvDropDownMenu = ({\n id: idProp,\n classes,\n className,\n icon,\n placement = \"right\",\n dataList,\n disablePortal = false,\n onToggle,\n onClick,\n keepOpened = true,\n disabled = false,\n expanded,\n defaultExpanded = false,\n category = \"secondaryGhost\",\n ...others\n}: HvDropDownMenuProps) => {\n const [open, setOpen] = useControlled(expanded, Boolean(defaultExpanded));\n const id = useUniqueId(idProp, \"dropdown-menu\");\n const focusNodes = getPrevNextFocus(setId(id, \"icon-button\"));\n\n const listId = setId(id, \"list\");\n\n const handleClose = (event) => {\n // this will only run if uncontrolled\n setOpen(false);\n onToggle?.(event, false);\n };\n\n // If the ESCAPE key is pressed inside the list, the close handler must be called.\n const handleKeyDown = (event) => {\n if (isKeypress(event, keyboardCodes.Tab)) {\n const node = event.shiftKey ? focusNodes.prevFocus : focusNodes.nextFocus;\n if (node) setTimeout(() => node.focus(), 0);\n handleClose(event);\n }\n event.preventDefault();\n };\n\n const setFocusToContent = (containerRef) => {\n containerRef?.getElementsByTagName(\"li\")[0]?.focus();\n };\n\n const condensed = useMemo(() => dataList.every((el) => !el.icon), [dataList]);\n const popperStyle: HvBaseDropdownProps[\"popperProps\"] = {\n style: {\n zIndex: theme.zIndices.tooltip,\n width: \"auto\",\n position: \"relative\",\n },\n };\n\n return (\n <ClassNames>\n {({ css, cx }) => (\n <HvBaseDropdown\n id={id}\n className={cx(\n dropDownMenuClasses.container,\n css(styles.container),\n className,\n classes?.container\n )}\n classes={{\n root: cx(dropDownMenuClasses.root, css(styles.root), classes?.root),\n container: cx(\n dropDownMenuClasses.baseContainer,\n classes?.baseContainer\n ),\n }}\n expanded={open && !disabled}\n component={\n <HvButton\n icon\n variant={category}\n id={setId(id, \"icon-button\")}\n className={cx(\n dropDownMenuClasses.icon,\n open && dropDownMenuClasses.iconSelected,\n css(styles.icon),\n open && css(styles.iconSelected),\n classes?.icon,\n open && classes?.iconSelected\n )}\n aria-expanded={open}\n disabled={disabled}\n aria-label=\"Dropdown menu\"\n >\n {icon || (\n <MoreOptionsVertical\n color={disabled ? \"secondary_60\" : undefined}\n />\n )}\n </HvButton>\n }\n aria-haspopup=\"menu\"\n placement={placement}\n variableWidth\n disablePortal={disablePortal}\n onToggle={(e, s) => {\n // this will only run if uncontrolled\n setOpen(s);\n onToggle?.(e, s);\n }}\n disabled={disabled}\n onContainerCreation={setFocusToContent}\n popperProps={popperStyle}\n {...others}\n >\n <HvPanel\n className={cx(\n dropDownMenuClasses.menuListRoot,\n css(styles.menuListRoot),\n classes?.menuListRoot\n )}\n >\n <HvList\n id={listId}\n values={dataList}\n selectable={false}\n condensed={condensed}\n onClick={(event, item) => {\n if (!keepOpened) handleClose(event);\n onClick?.(event, item);\n }}\n onKeyDown={handleKeyDown}\n classes={{\n root: cx(dropDownMenuClasses.menuList, classes?.menuList),\n }}\n />\n </HvPanel>\n </HvBaseDropdown>\n )}\n </ClassNames>\n );\n};\n\nexport default HvDropDownMenu;\n"],"names":["HvDropDownMenu","id","idProp","classes","className","icon","placement","dataList","disablePortal","onToggle","onClick","keepOpened","disabled","expanded","defaultExpanded","category","others","open","setOpen","useControlled","Boolean","useUniqueId","focusNodes","getPrevNextFocus","setId","listId","handleClose","event","handleKeyDown","isKeypress","keyboardCodes","Tab","node","shiftKey","prevFocus","nextFocus","setTimeout","focus","preventDefault","setFocusToContent","containerRef","getElementsByTagName","condensed","useMemo","every","el","popperStyle","style","zIndex","theme","zIndices","tooltip","width","position","ClassNames","children","css","cx","HvBaseDropdown","dropDownMenuClasses","container","styles","root","baseContainer","component","HvButton","variant","iconSelected","_jsx","MoreOptionsVertical","color","undefined","variableWidth","e","s","onContainerCreation","popperProps","HvPanel","menuListRo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NzE,WAAWqD,GACTE,oBAAoBmB,cACpBtB,IAAIK,OAAOiB,YAAY,GACvB3E,mCAAS2E,YAAY;AAAA,QACrBvB,8BAEDwB,QAAM;AAAA,UACL9E,IAAIwB;AAAAA,UACJuD,QAAQzE;AAAAA,UACR0E,YAAY;AAAA,UACZvC;AAAAA,UACAhC,SAASA,CAACiB,OAAOuD,SAAS;AACxB,gBAAI,CAACvE;AAAYe,0BAAYC,KAAK;AAClCjB,+CAAUiB,OAAOuD;AAAAA,UACnB;AAAA,UACAC,WAAWvD;AAAAA,UACXzB,SAAS;AAAA,YACP2D,MAAML,GAAGE,oBAAoByB,UAAUjF,mCAASiF,QAAQ;AAAA,UAC1D;AAAA,QAAA,CAAE;AAAA,MAAA,CACF;AAAA,IAAA,CACM;AAAA,EAAA,CAGH;AAEjB;AAEA,MAAA,mBAAepF;"}
@@ -1,63 +1,26 @@
1
- import _styled from "@emotion/styled/base";
2
- import { transientOptions } from "../../utils/transientOptions.js";
3
1
  import { theme } from "@hitachivantara/uikit-styles";
4
- import { forwardRef } from "react";
5
- import { jsx } from "@emotion/react/jsx-runtime";
6
- import { HvBaseDropdown } from "../BaseDropdown/BaseDropdown.js";
7
- import { HvPanel } from "../Panel/Panel.js";
8
- import { HvButton } from "../Button/Button.js";
9
- function _EMOTION_STRINGIFIED_CSS_ERROR__() {
10
- return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
11
- }
12
- function _extends() {
13
- _extends = Object.assign ? Object.assign.bind() : function(target) {
14
- for (var i = 1; i < arguments.length; i++) {
15
- var source = arguments[i];
16
- for (var key in source) {
17
- if (Object.prototype.hasOwnProperty.call(source, key)) {
18
- target[key] = source[key];
19
- }
20
- }
2
+ import dropDownMenuClasses from "./dropDownMenuClasses.js";
3
+ import { outlineStyles } from "../../utils/focusUtils.js";
4
+ const styles = {
5
+ container: {
6
+ width: 32
7
+ },
8
+ root: {
9
+ display: "inline-block",
10
+ width: "auto",
11
+ [`&.focus-visible .${dropDownMenuClasses.icon}`]: {
12
+ ...outlineStyles
21
13
  }
22
- return target;
23
- };
24
- return _extends.apply(this, arguments);
25
- }
26
- const StyledBaseDropDown = /* @__PURE__ */ _styled((props) => /* @__PURE__ */ jsx(HvBaseDropdown, {
27
- ...props
28
- }), process.env.NODE_ENV === "production" ? {
29
- target: "e13q7myz2"
30
- } : {
31
- target: "e13q7myz2",
32
- label: "StyledBaseDropDown"
33
- })(process.env.NODE_ENV === "production" ? {
34
- name: "1p2i2oq",
35
- styles: "width:32px"
36
- } : {
37
- name: "1p2i2oq",
38
- styles: "width:32px",
39
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2h2LXVpa2l0LXJlYWN0L2h2LXVpa2l0LXJlYWN0L3BhY2thZ2VzL2NvcmUvc3JjL2NvbXBvbmVudHMvRHJvcERvd25NZW51L0Ryb3BEb3duTWVudS5zdHlsZXMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWNrQyIsImZpbGUiOiIvaG9tZS9ydW5uZXIvd29yay9odi11aWtpdC1yZWFjdC9odi11aWtpdC1yZWFjdC9wYWNrYWdlcy9jb3JlL3NyYy9jb21wb25lbnRzL0Ryb3BEb3duTWVudS9Ecm9wRG93bk1lbnUuc3R5bGVzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSBcIkBlbW90aW9uL3N0eWxlZFwiO1xuaW1wb3J0IHtcbiAgSHZCYXNlRHJvcGRvd24sXG4gIEh2QmFzZURyb3Bkb3duUHJvcHMsXG4gIEh2QnV0dG9uLFxuICBIdkJ1dHRvblByb3BzLFxuICBIdlBhbmVsLFxuICBIdlBhbmVsUHJvcHMsXG59IGZyb20gXCJAY29yZS9jb21wb25lbnRzXCI7XG5pbXBvcnQgeyB0cmFuc2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jb2xvcnMuc2hhZG93LFxuXG4gICAgXCImOmhvdmVyXCI6IHtcbiAgICAgIGJhY2tncm91bmRDb2xvcjogdGhlbWUuY29sb3JzLmF0bW8xLFxuICAgIH0sXG5cbiAgICBcIiYgc3ZnIC5jb2xvcjBcIjoge1xuICAgICAgZmlsbDogdGhlbWUuY29sb3JzLnNlY29uZGFyeSxcbiAgICB9LFxuXG4gICAgYm9yZGVyUmFkaXVzOiBgJHt0aGVtZS5yYWRpaS5iYXNlfSAke3RoZW1lLnJhZGlpLmJhc2V9IDBweCAwcHhgLFxuICAgIGJvcmRlcjogdGhlbWUuZHJvcERvd25NZW51LmJvcmRlck9wZW5lZCxcbiAgfSksXG59KSk7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWRQYW5lbCA9IHN0eWxlZCgocHJvcHM6IEh2UGFuZWxQcm9wcykgPT4gKFxuICA8SHZQYW5lbCB7Li4ucHJvcHN9IC8+XG4pKSh7XG4gIGJvcmRlcjogdGhlbWUuZHJvcERvd25NZW51LmJvcmRlck9wZW5lZCxcbiAgYm9yZGVyUmFkaXVzOiB0aGVtZS5kcm9wRG93bk1lbnUuYm9yZGVyUmFkaXVzLFxufSk7XG4iXX0= */",
40
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
41
- });
42
- const StyledButton = /* @__PURE__ */ _styled(forwardRef((props, ref) => {
43
- return /* @__PURE__ */ jsx(HvButton, {
44
- ...props,
45
- ref
46
- });
47
- }), process.env.NODE_ENV === "production" ? _extends({}, {
48
- target: "e13q7myz1"
49
- }, transientOptions) : _extends({}, {
50
- target: "e13q7myz1",
51
- label: "StyledButton"
52
- }, transientOptions))(({
53
- $open
54
- }) => ({
55
- position: "relative",
56
- boxSizing: "content-box",
57
- padding: 0,
58
- borderRadius: theme.dropDownMenu.borderRadius,
59
- border: theme.dropDownMenu.borderClosed,
60
- ...$open && {
14
+ },
15
+ icon: {
16
+ position: "relative",
17
+ width: 32,
18
+ boxSizing: "border-box",
19
+ padding: 0,
20
+ borderRadius: theme.dropDownMenu.borderRadius,
21
+ border: theme.dropDownMenu.borderClosed
22
+ },
23
+ iconSelected: {
61
24
  backgroundColor: theme.colors.atmo1,
62
25
  boxShadow: theme.colors.shadow,
63
26
  "&:hover": {
@@ -68,22 +31,13 @@ const StyledButton = /* @__PURE__ */ _styled(forwardRef((props, ref) => {
68
31
  },
69
32
  borderRadius: `${theme.radii.base} ${theme.radii.base} 0px 0px`,
70
33
  border: theme.dropDownMenu.borderOpened
34
+ },
35
+ menuListRoot: {
36
+ border: theme.dropDownMenu.borderOpened,
37
+ borderRadius: theme.dropDownMenu.borderRadius
71
38
  }
72
- }), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2h2LXVpa2l0LXJlYWN0L2h2LXVpa2l0LXJlYWN0L3BhY2thZ2VzL2NvcmUvc3JjL2NvbXBvbmVudHMvRHJvcERvd25NZW51L0Ryb3BEb3duTWVudS5zdHlsZXMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW9CNEIiLCJmaWxlIjoiL2hvbWUvcnVubmVyL3dvcmsvaHYtdWlraXQtcmVhY3QvaHYtdWlraXQtcmVhY3QvcGFja2FnZXMvY29yZS9zcmMvY29tcG9uZW50cy9Ecm9wRG93bk1lbnUvRHJvcERvd25NZW51LnN0eWxlcy50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gXCJAZW1vdGlvbi9zdHlsZWRcIjtcbmltcG9ydCB7XG4gIEh2QmFzZURyb3Bkb3duLFxuICBIdkJhc2VEcm9wZG93blByb3BzLFxuICBIdkJ1dHRvbixcbiAgSHZCdXR0b25Qcm9wcyxcbiAgSHZQYW5lbCxcbiAgSHZQYW5lbFByb3BzLFxufSBmcm9tIFwiQGNvcmUvY29tcG9uZW50c1wiO1xuaW1wb3J0IHsgd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sb3JzLnNoYWRvdyxcblxuICAgIFwiJjpob3ZlclwiOiB7XG4gICAgICBiYWNrZ3JvdW5kQ29sb3I6IHRoZW1lLmNvbG9ycy5hdG1vMSxcbiAgICB9LFxuXG4gICAgXCImIHN2ZyAuY29sb3IwXCI6IHtcbiAgICAgIGZpbGw6IHRoZW1lLmNvbG9ycy5zZWNvbmRhcnksXG4gICAgfSxcblxuICAgIGJvcmRlclJhZGl1czogYCR7dGhlbWUucmFkaWkuYmFzZX0gJHt0aGVtZS5yYWRpaS5iYXNlfSAwcHggMHB4YCxcbiAgICBib3JkZXI6IHRoZW1lLmRyb3BEb3duTWVudS5ib3JkZXJPcGVuZWQsXG4gIH0pLFxufSkpO1xuXG5leHBvcnQgY29uc3QgU3R5bGVkUGFuZWwgPSBzdHlsZWQoKHByb3BzOiBIdlBhbmVsUHJvcHMpID0+IChcbiAgPEh2UGFuZWwgey4uLnByb3BzfSAvPlxuKSkoe1xuICBib3JkZXI6IHRoZW1lLmRyb3BEb3duTWVudS5ib3JkZXJPcGVuZWQsXG4gIGJvcmRlclJhZGl1czogdGhlbWUuZHJvcERvd25NZW51LmJvcmRlclJhZGl1cyxcbn0pO1xuIl19 */");
73
- const StyledPanel = /* @__PURE__ */ _styled((props) => /* @__PURE__ */ jsx(HvPanel, {
74
- ...props
75
- }), process.env.NODE_ENV === "production" ? {
76
- target: "e13q7myz0"
77
- } : {
78
- target: "e13q7myz0",
79
- label: "StyledPanel"
80
- })({
81
- border: theme.dropDownMenu.borderOpened,
82
- borderRadius: theme.dropDownMenu.borderRadius
83
- }, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2h2LXVpa2l0LXJlYWN0L2h2LXVpa2l0LXJlYWN0L3BhY2thZ2VzL2NvcmUvc3JjL2NvbXBvbmVudHMvRHJvcERvd25NZW51L0Ryb3BEb3duTWVudS5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JvcmRlclJhZGl1czogdGhlbWUuZHJvcERvd25NZW51LmJvcmRlclJhZGl1cyxcbn0pO1xuIl19 */");
39
+ };
84
40
  export {
85
- StyledBaseDropDown,
86
- StyledButton,
87
- StyledPanel
41
+ styles
88
42
  };
89
43
  //# sourceMappingURL=DropDownMenu.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropDownMenu.styles.js","sources":["../../../../src/components/DropDownMenu/DropDownMenu.styles.tsx"],"sourcesContent":["import styled from \"@emotion/styled\";\nimport {\n HvBaseDropdown,\n HvBaseDropdownProps,\n HvButton,\n HvButtonProps,\n HvPanel,\n HvPanelProps,\n} from \"@core/components\";\nimport { transientOptions } from \"@core/utils/transientOptions\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { forwardRef } from \"react\";\nimport { PolymorphicRef } from \"@core/types\";\n\nexport const StyledBaseDropDown = styled((props: HvBaseDropdownProps) => (\n <HvBaseDropdown {...props} />\n))({\n width: 32,\n});\n\nexport const StyledButton = styled(\n forwardRef((props: HvButtonProps, ref?: PolymorphicRef<\"button\">) => {\n return <HvButton {...props} ref={ref} />;\n }),\n transientOptions\n)(({ $open }: { $open: boolean }) => ({\n position: \"relative\",\n boxSizing: \"content-box\",\n padding: 0,\n\n borderRadius: theme.dropDownMenu.borderRadius,\n border: theme.dropDownMenu.borderClosed,\n\n ...($open && {\n backgroundColor: theme.colors.atmo1,\n boxShadow: theme.colors.shadow,\n\n \"&:hover\": {\n backgroundColor: theme.colors.atmo1,\n },\n\n \"& svg .color0\": {\n fill: theme.colors.secondary,\n },\n\n borderRadius: `${theme.radii.base} ${theme.radii.base} 0px 0px`,\n border: theme.dropDownMenu.borderOpened,\n }),\n}));\n\nexport const StyledPanel = styled((props: HvPanelProps) => (\n <HvPanel {...props} />\n))({\n border: theme.dropDownMenu.borderOpened,\n borderRadius: theme.dropDownMenu.borderRadius,\n});\n"],"names":["StyledBaseDropDown","_styled","props","HvBaseDropdown","process","env","NODE_ENV","target","label","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","StyledButton","forwardRef","ref","HvButton","_extends","transientOptions","$open","position","boxSizing","padding","borderRadius","theme","dropDownMenu","border","borderClosed","backgroundColor","colors","atmo1","boxShadow","shadow","fill","secondary","radii","base","borderOpened","StyledPanel","HvPanel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAcO,MAAMA,qBAAqBC,wBAAO,CAACC,8BACvCC,gBAAc;AAAA,EAAA,GAAKD;AAAK,CAAA,GAC1BE,QAAAC,IAAAC,aAAA,eAAA;AAAA,EAAAC,QAAA;AAAA,IAAA;AAAA,EAAAA,QAAA;AAAA,EAAAC,OAAA;AAAA,CAAA,EAACJ,QAAAC,IAAAC,aAAA,eAAA;AAAA,EAAAG,MAAA;AAAA,EAAAC,QAAA;AAAA,IAAA;AAAA,EAAAD,MAAA;AAAA,EAAAC,QAAA;AAAA,EAAAC,KAAA;AAAA,EAAAC,UAAAC;AAAA,CAEA;AAEK,MAAMC,eAAeb,wBAC1Bc,WAAW,CAACb,OAAsBc,QAAmC;AACnE,6BAAQC,UAAQ;AAAA,IAAA,GAAKf;AAAAA,IAAOc;AAAAA,EAAAA,CAAY;AAC1C,CAAC,GAACZ,QAAAC,IAAAC,4BAAAY,SAAA,IAAA;AAAA,EAAAX,QAAA;AAAA,GACFY,gBAAgB,IAAAD,SAAA,IAAA;AAAA,EAAAX,QAAA;AAAA,EAAAC,OAAA;AAAA,GAAhBW,gBAAgB,CACjB,EAAC,CAAC;AAAA,EAAEC;AAA0B,OAAO;AAAA,EACpCC,UAAU;AAAA,EACVC,WAAW;AAAA,EACXC,SAAS;AAAA,EAETC,cAAcC,MAAMC,aAAaF;AAAAA,EACjCG,QAAQF,MAAMC,aAAaE;AAAAA,EAE3B,GAAIR,SAAS;AAAA,IACXS,iBAAiBJ,MAAMK,OAAOC;AAAAA,IAC9BC,WAAWP,MAAMK,OAAOG;AAAAA,IAExB,WAAW;AAAA,MACTJ,iBAAiBJ,MAAMK,OAAOC;AAAAA,IAChC;AAAA,IAEA,iBAAiB;AAAA,MACfG,MAAMT,MAAMK,OAAOK;AAAAA,IACrB;AAAA,IAEAX,cAAe,GAAEC,MAAMW,MAAMC,QAAQZ,MAAMW,MAAMC;AAAAA,IACjDV,QAAQF,MAAMC,aAAaY;AAAAA,EAC7B;AACF,IAAElC,QAAAC,IAAAC,aAAC,eAAA,KAAA,i8EAAA;AAEI,MAAMiC,cAActC,wBAAO,CAACC,8BAChCsC,SAAO;AAAA,EAAA,GAAKtC;AAAK,CAAA,GACnBE,QAAAC,IAAAC,aAAA,eAAA;AAAA,EAAAC,QAAA;AAAA,IAAA;AAAA,EAAAA,QAAA;AAAA,EAAAC,OAAA;AAAA,CAAA,EAAE;AAAA,EACDmB,QAAQF,MAAMC,aAAaY;AAAAA,EAC3Bd,cAAcC,MAAMC,aAAaF;AACnC,GAACpB,QAAAC,IAAAC,aAAC,eAAA,KAAA,i8EAAA;"}
1
+ {"version":3,"file":"DropDownMenu.styles.js","sources":["../../../../src/components/DropDownMenu/DropDownMenu.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\nimport { outlineStyles } from \"@core/utils\";\nimport { CSSInterpolation } from \"@emotion/serialize\";\nimport dropDownMenuClasses, {\n HvDropDownMenuClasses,\n} from \"./dropDownMenuClasses\";\n\nexport const styles: Partial<\n Record<keyof HvDropDownMenuClasses, CSSInterpolation>\n> = {\n container: {\n width: 32,\n },\n root: {\n display: \"inline-block\",\n width: \"auto\",\n [`&.focus-visible .${dropDownMenuClasses.icon}`]: {\n ...outlineStyles,\n },\n },\n icon: {\n position: \"relative\",\n width: 32,\n boxSizing: \"border-box\",\n padding: 0,\n borderRadius: theme.dropDownMenu.borderRadius,\n border: theme.dropDownMenu.borderClosed,\n },\n iconSelected: {\n backgroundColor: theme.colors.atmo1,\n boxShadow: theme.colors.shadow,\n\n \"&:hover\": {\n backgroundColor: theme.colors.atmo1,\n },\n\n \"& svg .color0\": {\n fill: theme.colors.secondary,\n },\n\n borderRadius: `${theme.radii.base} ${theme.radii.base} 0px 0px`,\n border: theme.dropDownMenu.borderOpened,\n },\n menuListRoot: {\n border: theme.dropDownMenu.borderOpened,\n borderRadius: theme.dropDownMenu.borderRadius,\n },\n};\n"],"names":["styles","container","width","root","display","dropDownMenuClasses","icon","outlineStyles","position","boxSizing","padding","borderRadius","theme","dropDownMenu","border","borderClosed","iconSelected","backgroundColor","colors","atmo1","boxShadow","shadow","fill","secondary","radii","base","borderOpened","menuListRoot"],"mappings":";;;AAOO,MAAMA,SAET;AAAA,EACFC,WAAW;AAAA,IACTC,OAAO;AAAA,EACT;AAAA,EACAC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTF,OAAO;AAAA,IACP,CAAE,oBAAmBG,oBAAoBC,MAAM,GAAG;AAAA,MAChD,GAAGC;AAAAA,IACL;AAAA,EACF;AAAA,EACAD,MAAM;AAAA,IACJE,UAAU;AAAA,IACVN,OAAO;AAAA,IACPO,WAAW;AAAA,IACXC,SAAS;AAAA,IACTC,cAAcC,MAAMC,aAAaF;AAAAA,IACjCG,QAAQF,MAAMC,aAAaE;AAAAA,EAC7B;AAAA,EACAC,cAAc;AAAA,IACZC,iBAAiBL,MAAMM,OAAOC;AAAAA,IAC9BC,WAAWR,MAAMM,OAAOG;AAAAA,IAExB,WAAW;AAAA,MACTJ,iBAAiBL,MAAMM,OAAOC;AAAAA,IAChC;AAAA,IAEA,iBAAiB;AAAA,MACfG,MAAMV,MAAMM,OAAOK;AAAAA,IACrB;AAAA,IAEAZ,cAAe,GAAEC,MAAMY,MAAMC,QAAQb,MAAMY,MAAMC;AAAAA,IACjDX,QAAQF,MAAMC,aAAaa;AAAAA,EAC7B;AAAA,EACAC,cAAc;AAAA,IACZb,QAAQF,MAAMC,aAAaa;AAAAA,IAC3Bf,cAAcC,MAAMC,aAAaF;AAAAA,EACnC;AACF;"}
@@ -1,5 +1,5 @@
1
1
  import { getClasses } from "../../utils/classes.js";
2
- const classKeys = ["root", "container", "baseContainer", "icon", "iconSelected", "menuList"];
2
+ const classKeys = ["root", "container", "baseContainer", "icon", "iconSelected", "menuList", "menuListRoot"];
3
3
  const dropDownMenuClasses = getClasses(classKeys, "HvDropDownMenu");
4
4
  const dropDownMenuClasses$1 = dropDownMenuClasses;
5
5
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"dropDownMenuClasses.js","sources":["../../../../src/components/DropDownMenu/dropDownMenuClasses.ts"],"sourcesContent":["import { getClasses } from \"@core/utils\";\n\nexport interface HvDropDownMenuClasses {\n /** Styles applied to the root. */\n root?: string;\n /** Styles applied to the container. */\n container?: string;\n /** Styles applied to the BaseDropdown container. */\n baseContainer?: string;\n /** Styles applied to the icon. */\n icon?: string;\n /** Styles applied to the icon when selected. */\n iconSelected?: string;\n /** Styles applied to the list. */\n menuList?: string;\n}\n\nconst classKeys: (keyof HvDropDownMenuClasses)[] = [\n \"root\",\n \"container\",\n \"baseContainer\",\n \"icon\",\n \"iconSelected\",\n \"menuList\",\n];\n\nconst dropDownMenuClasses = getClasses(classKeys, \"HvDropDownMenu\");\n\nexport default dropDownMenuClasses;\n"],"names":["classKeys","dropDownMenuClasses","getClasses"],"mappings":";AAiBA,MAAMA,YAA6C,CACjD,QACA,aACA,iBACA,QACA,gBACA,UAAU;AAGZ,MAAMC,sBAAsBC,WAAWF,WAAW,gBAAgB;AAElE,MAAA,wBAAeC;"}
1
+ {"version":3,"file":"dropDownMenuClasses.js","sources":["../../../../src/components/DropDownMenu/dropDownMenuClasses.ts"],"sourcesContent":["import { getClasses } from \"@core/utils\";\n\nexport interface HvDropDownMenuClasses {\n /** Styles applied to the root. */\n root?: string;\n /** Styles applied to the container. */\n container?: string;\n /** Styles applied to the BaseDropdown container. */\n baseContainer?: string;\n /** Styles applied to the icon. */\n icon?: string;\n /** Styles applied to the icon when selected. */\n iconSelected?: string;\n /** Styles applied to the list root. */\n menuListRoot?: string;\n /** Styles applied to the list. */\n menuList?: string;\n}\n\nconst classKeys: (keyof HvDropDownMenuClasses)[] = [\n \"root\",\n \"container\",\n \"baseContainer\",\n \"icon\",\n \"iconSelected\",\n \"menuList\",\n \"menuListRoot\",\n];\n\nconst dropDownMenuClasses = getClasses(classKeys, \"HvDropDownMenu\");\n\nexport default dropDownMenuClasses;\n"],"names":["classKeys","dropDownMenuClasses","getClasses"],"mappings":";AAmBA,MAAMA,YAA6C,CACjD,QACA,aACA,iBACA,QACA,gBACA,YACA,cAAc;AAGhB,MAAMC,sBAAsBC,WAAWF,WAAW,gBAAgB;AAElE,MAAA,wBAAeC;"}
@@ -2,16 +2,16 @@ import { useState, useRef } from "react";
2
2
  import uniqueId from "lodash/uniqueId";
3
3
  import accept from "attr-accept";
4
4
  import { clsx } from "clsx";
5
- import withId from "../../../hocs/withId.js";
6
5
  import { convertUnits } from "../utils.js";
7
6
  import { StyledDropZoneLabelsGroup, StyledLabel, StyledInfoMessage, StyledDropZoneContainer, StyledInput, StyledDropArea, StyledDropAreaLabel, StyledDragText, StyledDropAreaIcon, StyledDropAreaLabels, StyledSelectedFilesText } from "./DropZone.styles.js";
8
7
  import dropZoneClasses from "./dropZoneClasses.js";
9
8
  import { jsxs, Fragment, jsx } from "@emotion/react/jsx-runtime";
9
+ import useUniqueId from "../../../hooks/useUniqueId.js";
10
10
  import { setId } from "../../../utils/setId.js";
11
11
  import { isKeypress } from "../../../utils/keyboardUtils/keyCheck.js";
12
12
  import { keyboardCodes } from "../../../utils/keyboardUtils/keyboardCodes.js";
13
- const HvDropZone = withId(({
14
- id,
13
+ const HvDropZone = ({
14
+ id: idProp,
15
15
  classes,
16
16
  labels,
17
17
  acceptedFiles,
@@ -22,6 +22,7 @@ const HvDropZone = withId(({
22
22
  disabled = false,
23
23
  onFilesAdded
24
24
  }) => {
25
+ const id = useUniqueId(idProp, "dropzone");
25
26
  const [dragState, setDrag] = useState(false);
26
27
  const inputRef = useRef(null);
27
28
  const leaveDropArea = () => {
@@ -158,7 +159,7 @@ const HvDropZone = withId(({
158
159
  })]
159
160
  })]
160
161
  });
161
- });
162
+ };
162
163
  export {
163
164
  HvDropZone
164
165
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DropZone.js","sources":["../../../../../src/components/FileUploader/DropZone/DropZone.tsx"],"sourcesContent":["import React, { useRef, useState } from \"react\";\nimport uniqueId from \"lodash/uniqueId\";\nimport accept from \"attr-accept\";\nimport { clsx } from \"clsx\";\nimport { isKeypress, keyboardCodes, setId } from \"@core/utils\";\nimport withId from \"@core/hocs/withId\";\nimport { convertUnits } from \"../utils\";\nimport {\n StyledDragText,\n StyledDropArea,\n StyledDropAreaIcon,\n StyledDropAreaLabel,\n StyledDropAreaLabels,\n StyledDropZoneContainer,\n StyledDropZoneLabelsGroup,\n StyledInfoMessage,\n StyledInput,\n StyledLabel,\n StyledSelectedFilesText,\n} from \"./DropZone.styles\";\nimport dropZoneClasses, { HvDropZoneClasses } from \"./dropZoneClasses\";\nimport { HvFileData, HvFilesAddedEvent } from \"../File\";\n\nexport interface HvDropZoneLabels {\n /**\n * Extensions of the accepted file types\n */\n acceptedFiles?: string;\n /**\n * Dropzone area label.\n */\n dropzone?: string;\n /**\n * Size file warning label.\n */\n sizeWarning?: string;\n /**\n * Size file warning label.\n */\n drag?: string;\n /**\n * Size file warning label.\n */\n selectFiles?: string;\n /**\n * Theming sheet used to style components\n * */\n dropFiles?: string;\n /**\n * Message to display when file size is greater than allowed\n * */\n fileSizeError?: string;\n /**\n * Message to display when file type is greater than allowed\n * */\n fileTypeError?: string;\n}\n\nexport interface HvDropZoneProps {\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * Labels to present in FileUploader.\n */\n labels?: HvDropZoneLabels;\n /**\n * Whether the Dropzone should accept multiple files at once.\n */\n multiple?: boolean;\n /**\n * If the input is disabled or not\n */\n disabled?: boolean;\n /**\n * Files extensions accepted for upload.\n */\n acceptedFiles: string[];\n /**\n * Max upload size\n * */\n maxFileSize: number;\n /**\n * Function responsible for processing files added to the drop zone.\n */\n onFilesAdded?: HvFilesAddedEvent;\n /**\n * Whether the DropZone should hide labels or not.\n */\n hideLabels?: boolean;\n /**\n * Attributes applied to the input element.\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n /**\n * A Jss Object used to override or extend the styles applied to the component.\n */\n classes?: HvDropZoneClasses;\n}\n\nexport const HvDropZone = withId(\n ({\n id,\n classes,\n labels,\n acceptedFiles,\n maxFileSize,\n inputProps,\n hideLabels,\n multiple = true,\n disabled = false,\n onFilesAdded,\n }: HvDropZoneProps) => {\n const [dragState, setDrag] = useState<boolean>(false);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const leaveDropArea = () => {\n setDrag(false);\n };\n\n const enterDropArea = () => {\n setDrag(true);\n };\n\n const onChangeHandler = (filesList: FileList) => {\n const filesToProcess = Object.keys(filesList).map((e) => filesList[e]);\n\n const newFiles: HvFileData[] = [];\n\n filesToProcess.forEach((file: File) => {\n const newFile: HvFileData = file;\n\n const isSizeAllowed = file.size <= maxFileSize;\n const isFileAccepted =\n !acceptedFiles.length ||\n acceptedFiles.indexOf(file.type.split(\"/\")[1]) > -1 ||\n acceptedFiles.some((acceptExtension) =>\n accept({ name: file.name, type: file.type }, acceptExtension)\n );\n\n if (!isFileAccepted) {\n newFile.errorMessage = labels?.fileTypeError;\n newFile.status = \"fail\";\n } else if (!isSizeAllowed) {\n newFile.errorMessage = labels?.fileSizeError;\n newFile.status = \"fail\";\n }\n\n newFile.id = uniqueId(\"uploaded-file-data-\");\n newFiles.push(newFile);\n });\n\n onFilesAdded?.(newFiles);\n };\n\n return (\n <>\n {!hideLabels && (\n <StyledDropZoneLabelsGroup\n id={id}\n className={clsx(\n classes?.dropZoneLabelsGroup,\n dropZoneClasses.dropZoneLabelsGroup\n )}\n aria-label=\"File Dropzone\"\n >\n <StyledLabel\n id={setId(id, \"input-file-label\")}\n htmlFor={setId(id, \"input-file\")}\n label={labels?.dropzone}\n className={clsx(\n classes?.dropZoneLabel,\n dropZoneClasses.dropZoneLabel\n )}\n $disabled={disabled}\n />\n <StyledInfoMessage\n $disabled={disabled}\n id={setId(id, \"description\")}\n >\n {Number.isInteger(maxFileSize) &&\n `${labels?.sizeWarning} ${convertUnits(maxFileSize)}`}\n {labels?.acceptedFiles && labels.acceptedFiles}\n {!labels?.acceptedFiles &&\n acceptedFiles.length > 0 &&\n `\\u00A0(${acceptedFiles.join(\", \")})`}\n </StyledInfoMessage>\n </StyledDropZoneLabelsGroup>\n )}\n <StyledDropZoneContainer\n id={setId(id, \"button\")}\n className={clsx(\n classes?.dropZoneContainer,\n dropZoneClasses.dropZoneContainer,\n dragState && clsx(classes?.dragAction, dropZoneClasses.dragAction),\n disabled &&\n clsx(\n classes?.dropZoneContainerDisabled,\n dropZoneClasses.dropZoneContainerDisabled\n )\n )}\n $drag={dragState}\n $disabled={disabled}\n role=\"button\"\n tabIndex={0}\n onDragEnter={(event) => {\n if (!disabled) {\n enterDropArea();\n event.stopPropagation();\n event.preventDefault();\n }\n }}\n onDragLeave={leaveDropArea}\n onDropCapture={leaveDropArea}\n onDragOver={(event) => {\n if (!disabled) {\n enterDropArea();\n event.stopPropagation();\n event.preventDefault();\n }\n }}\n onDrop={(event) => {\n if (!disabled) {\n const { files } = event.dataTransfer;\n if (multiple === true || files.length === 1) {\n event.stopPropagation();\n event.preventDefault();\n onChangeHandler(files);\n }\n }\n }}\n onKeyDown={(e) => {\n if (isKeypress(e, keyboardCodes.Enter) || isKeypress(e, 32)) {\n inputRef.current?.click();\n }\n }}\n >\n <StyledInput\n id={setId(id, \"input-file\")}\n tabIndex={-1}\n className={clsx(classes?.inputArea, dropZoneClasses.inputArea)}\n type=\"file\"\n multiple={multiple}\n disabled={disabled}\n title={!disabled ? `${labels?.drag}\\xa0${labels?.selectFiles}` : \"\"}\n onClick={() => {\n if (inputRef.current) {\n inputRef.current.value = \"\";\n }\n }}\n onChange={() => {\n if (!disabled && inputRef.current?.files) {\n onChangeHandler(inputRef.current.files);\n }\n }}\n ref={inputRef}\n accept={acceptedFiles.join(\",\")}\n {...inputProps}\n />\n <StyledDropArea\n className={clsx(classes?.dropArea, dropZoneClasses.dropArea)}\n >\n {dragState ? (\n <StyledDropAreaLabel\n className={clsx(\n classes?.dropZoneAreaLabels,\n dropZoneClasses.dropZoneAreaLabels\n )}\n >\n <StyledDragText\n className={clsx(classes?.dragText, dropZoneClasses.dragText)}\n >\n {labels?.dropFiles}\n </StyledDragText>\n </StyledDropAreaLabel>\n ) : (\n <>\n <StyledDropAreaIcon\n iconSize=\"M\"\n className={clsx(\n classes?.dropZoneAreaIcon,\n dropZoneClasses.dropZoneAreaIcon\n )}\n color={disabled ? \"secondary_60\" : \"secondary\"}\n />\n <StyledDropAreaLabels\n className={clsx(\n classes?.dropZoneAreaLabels,\n dropZoneClasses.dropZoneAreaLabels\n )}\n >\n <StyledDragText\n className={clsx(\n classes?.dragText,\n dropZoneClasses.dragText\n )}\n >\n {labels?.drag}\n <StyledSelectedFilesText\n className={clsx(\n classes?.selectFilesText,\n dropZoneClasses.selectFilesText\n )}\n >{`\\xa0${labels?.selectFiles}`}</StyledSelectedFilesText>\n </StyledDragText>\n </StyledDropAreaLabels>\n </>\n )}\n </StyledDropArea>\n </StyledDropZoneContainer>\n </>\n );\n }\n);\n"],"names":["HvDropZone","withId","id","classes","labels","acceptedFiles","maxFileSize","inputProps","hideLabels","multiple","disabled","onFilesAdded","dragState","setDrag","useState","inputRef","useRef","leaveDropArea","enterDropArea","onChangeHandler","filesList","filesToProcess","Object","keys","map","e","newFiles","forEach","file","newFile","isSizeAllowed","size","isFileAccepted","length","indexOf","type","split","some","acceptExtension","accept","name","errorMessage","fileTypeError","status","fileSizeError","uniqueId","push","_Fragment","children","StyledDropZoneLabelsGroup","className","clsx","dropZoneLabelsGroup","dropZoneClasses","_jsx","StyledLabel","setId","htmlFor","label","dropzone","dropZoneLabel","$disabled","_jsxs","StyledInfoMessage","Number","isInteger","sizeWarning","convertUnits","join","StyledDropZoneContainer","dropZoneContainer","dragAction","dropZoneContainerDisabled","$drag","role","tabIndex","onDragEnter","event","stopPropagation","preventDefault","onDragLeave","onDropCapture","onDragOver","onDrop","files","dataTransfer","onKeyDown","isKeypress","keyboardCodes","Enter","current","click","StyledInput","inputArea","title","drag","selectFiles","onClick","value","onChange","ref","StyledDropArea","dropArea","StyledDropAreaLabel","dropZoneAreaLabels","StyledDragText","dragText","dropFiles","StyledDropAreaIcon","iconSize","dropZoneAreaIcon","color","StyledDropAreaLabels","StyledSelectedFilesText","selectFilesText"],"mappings":";;;;;;;;;;;;AAqGaA,MAAAA,aAAaC,OACxB,CAAC;AAAA,EACCC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,WAAW;AAAA,EACXC,WAAW;AAAA,EACXC;AACe,MAAM;AACrB,QAAM,CAACC,WAAWC,OAAO,IAAIC,SAAkB,KAAK;AAE9CC,QAAAA,WAAWC,OAAgC,IAAI;AAErD,QAAMC,gBAAgBA,MAAM;AAC1BJ,YAAQ,KAAK;AAAA,EAAA;AAGf,QAAMK,gBAAgBA,MAAM;AAC1BL,YAAQ,IAAI;AAAA,EAAA;AAGRM,QAAAA,kBAAkBA,CAACC,cAAwB;AACzCC,UAAAA,iBAAiBC,OAAOC,KAAKH,SAAS,EAAEI,IAAKC,CAAAA,MAAML,UAAUK,CAAC,CAAC;AAErE,UAAMC,WAAyB,CAAA;AAEhBC,mBAAAA,QAAQ,CAACC,SAAe;AACrC,YAAMC,UAAsBD;AAEtBE,YAAAA,gBAAgBF,KAAKG,QAAQzB;AACnC,YAAM0B,iBACJ,CAAC3B,cAAc4B,UACf5B,cAAc6B,QAAQN,KAAKO,KAAKC,MAAM,GAAG,EAAE,CAAC,CAAC,IAAI,MACjD/B,cAAcgC,KAAMC,qBAClBC,OAAO;AAAA,QAAEC,MAAMZ,KAAKY;AAAAA,QAAML,MAAMP,KAAKO;AAAAA,MAAAA,GAAQG,eAAe,CAAC;AAGj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F;AAAAA,cAAAA,CAAwC,CAAA;AAAA,YAAA,CAAA;AAAA,UAAA,CAEtC,CAAA;AAAA,QAAA,CAAA;AAAA,MAAA,CAGZ,CAAA;AAAA,IAAA,CACO,CAAA;AAAA,EAAA,CACzB;AAEP,CAAC;"}
1
+ {"version":3,"file":"DropZone.js","sources":["../../../../../src/components/FileUploader/DropZone/DropZone.tsx"],"sourcesContent":["import React, { useRef, useState } from \"react\";\nimport uniqueId from \"lodash/uniqueId\";\nimport accept from \"attr-accept\";\nimport { clsx } from \"clsx\";\nimport { isKeypress, keyboardCodes, setId } from \"@core/utils\";\nimport { useUniqueId } from \"@core/hooks\";\nimport { convertUnits } from \"../utils\";\nimport {\n StyledDragText,\n StyledDropArea,\n StyledDropAreaIcon,\n StyledDropAreaLabel,\n StyledDropAreaLabels,\n StyledDropZoneContainer,\n StyledDropZoneLabelsGroup,\n StyledInfoMessage,\n StyledInput,\n StyledLabel,\n StyledSelectedFilesText,\n} from \"./DropZone.styles\";\nimport dropZoneClasses, { HvDropZoneClasses } from \"./dropZoneClasses\";\nimport { HvFileData, HvFilesAddedEvent } from \"../File\";\n\nexport interface HvDropZoneLabels {\n /**\n * Extensions of the accepted file types\n */\n acceptedFiles?: string;\n /**\n * Dropzone area label.\n */\n dropzone?: string;\n /**\n * Size file warning label.\n */\n sizeWarning?: string;\n /**\n * Size file warning label.\n */\n drag?: string;\n /**\n * Size file warning label.\n */\n selectFiles?: string;\n /**\n * Theming sheet used to style components\n * */\n dropFiles?: string;\n /**\n * Message to display when file size is greater than allowed\n * */\n fileSizeError?: string;\n /**\n * Message to display when file type is greater than allowed\n * */\n fileTypeError?: string;\n}\n\nexport interface HvDropZoneProps {\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * Labels to present in FileUploader.\n */\n labels?: HvDropZoneLabels;\n /**\n * Whether the Dropzone should accept multiple files at once.\n */\n multiple?: boolean;\n /**\n * If the input is disabled or not\n */\n disabled?: boolean;\n /**\n * Files extensions accepted for upload.\n */\n acceptedFiles: string[];\n /**\n * Max upload size\n * */\n maxFileSize: number;\n /**\n * Function responsible for processing files added to the drop zone.\n */\n onFilesAdded?: HvFilesAddedEvent;\n /**\n * Whether the DropZone should hide labels or not.\n */\n hideLabels?: boolean;\n /**\n * Attributes applied to the input element.\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n /**\n * A Jss Object used to override or extend the styles applied to the component.\n */\n classes?: HvDropZoneClasses;\n}\n\nexport const HvDropZone = ({\n id: idProp,\n classes,\n labels,\n acceptedFiles,\n maxFileSize,\n inputProps,\n hideLabels,\n multiple = true,\n disabled = false,\n onFilesAdded,\n}: HvDropZoneProps) => {\n const id = useUniqueId(idProp, \"dropzone\");\n const [dragState, setDrag] = useState<boolean>(false);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const leaveDropArea = () => {\n setDrag(false);\n };\n\n const enterDropArea = () => {\n setDrag(true);\n };\n\n const onChangeHandler = (filesList: FileList) => {\n const filesToProcess = Object.keys(filesList).map((e) => filesList[e]);\n\n const newFiles: HvFileData[] = [];\n\n filesToProcess.forEach((file: File) => {\n const newFile: HvFileData = file;\n\n const isSizeAllowed = file.size <= maxFileSize;\n const isFileAccepted =\n !acceptedFiles.length ||\n acceptedFiles.indexOf(file.type.split(\"/\")[1]) > -1 ||\n acceptedFiles.some((acceptExtension) =>\n accept({ name: file.name, type: file.type }, acceptExtension)\n );\n\n if (!isFileAccepted) {\n newFile.errorMessage = labels?.fileTypeError;\n newFile.status = \"fail\";\n } else if (!isSizeAllowed) {\n newFile.errorMessage = labels?.fileSizeError;\n newFile.status = \"fail\";\n }\n\n newFile.id = uniqueId(\"uploaded-file-data-\");\n newFiles.push(newFile);\n });\n\n onFilesAdded?.(newFiles);\n };\n\n return (\n <>\n {!hideLabels && (\n <StyledDropZoneLabelsGroup\n id={id}\n className={clsx(\n classes?.dropZoneLabelsGroup,\n dropZoneClasses.dropZoneLabelsGroup\n )}\n aria-label=\"File Dropzone\"\n >\n <StyledLabel\n id={setId(id, \"input-file-label\")}\n htmlFor={setId(id, \"input-file\")}\n label={labels?.dropzone}\n className={clsx(\n classes?.dropZoneLabel,\n dropZoneClasses.dropZoneLabel\n )}\n $disabled={disabled}\n />\n <StyledInfoMessage $disabled={disabled} id={setId(id, \"description\")}>\n {Number.isInteger(maxFileSize) &&\n `${labels?.sizeWarning} ${convertUnits(maxFileSize)}`}\n {labels?.acceptedFiles && labels.acceptedFiles}\n {!labels?.acceptedFiles &&\n acceptedFiles.length > 0 &&\n `\\u00A0(${acceptedFiles.join(\", \")})`}\n </StyledInfoMessage>\n </StyledDropZoneLabelsGroup>\n )}\n <StyledDropZoneContainer\n id={setId(id, \"button\")}\n className={clsx(\n classes?.dropZoneContainer,\n dropZoneClasses.dropZoneContainer,\n dragState && clsx(classes?.dragAction, dropZoneClasses.dragAction),\n disabled &&\n clsx(\n classes?.dropZoneContainerDisabled,\n dropZoneClasses.dropZoneContainerDisabled\n )\n )}\n $drag={dragState}\n $disabled={disabled}\n role=\"button\"\n tabIndex={0}\n onDragEnter={(event) => {\n if (!disabled) {\n enterDropArea();\n event.stopPropagation();\n event.preventDefault();\n }\n }}\n onDragLeave={leaveDropArea}\n onDropCapture={leaveDropArea}\n onDragOver={(event) => {\n if (!disabled) {\n enterDropArea();\n event.stopPropagation();\n event.preventDefault();\n }\n }}\n onDrop={(event) => {\n if (!disabled) {\n const { files } = event.dataTransfer;\n if (multiple === true || files.length === 1) {\n event.stopPropagation();\n event.preventDefault();\n onChangeHandler(files);\n }\n }\n }}\n onKeyDown={(e) => {\n if (isKeypress(e, keyboardCodes.Enter) || isKeypress(e, 32)) {\n inputRef.current?.click();\n }\n }}\n >\n <StyledInput\n id={setId(id, \"input-file\")}\n tabIndex={-1}\n className={clsx(classes?.inputArea, dropZoneClasses.inputArea)}\n type=\"file\"\n multiple={multiple}\n disabled={disabled}\n title={!disabled ? `${labels?.drag}\\xa0${labels?.selectFiles}` : \"\"}\n onClick={() => {\n if (inputRef.current) {\n inputRef.current.value = \"\";\n }\n }}\n onChange={() => {\n if (!disabled && inputRef.current?.files) {\n onChangeHandler(inputRef.current.files);\n }\n }}\n ref={inputRef}\n accept={acceptedFiles.join(\",\")}\n {...inputProps}\n />\n <StyledDropArea\n className={clsx(classes?.dropArea, dropZoneClasses.dropArea)}\n >\n {dragState ? (\n <StyledDropAreaLabel\n className={clsx(\n classes?.dropZoneAreaLabels,\n dropZoneClasses.dropZoneAreaLabels\n )}\n >\n <StyledDragText\n className={clsx(classes?.dragText, dropZoneClasses.dragText)}\n >\n {labels?.dropFiles}\n </StyledDragText>\n </StyledDropAreaLabel>\n ) : (\n <>\n <StyledDropAreaIcon\n iconSize=\"M\"\n className={clsx(\n classes?.dropZoneAreaIcon,\n dropZoneClasses.dropZoneAreaIcon\n )}\n color={disabled ? \"secondary_60\" : \"secondary\"}\n />\n <StyledDropAreaLabels\n className={clsx(\n classes?.dropZoneAreaLabels,\n dropZoneClasses.dropZoneAreaLabels\n )}\n >\n <StyledDragText\n className={clsx(classes?.dragText, dropZoneClasses.dragText)}\n >\n {labels?.drag}\n <StyledSelectedFilesText\n className={clsx(\n classes?.selectFilesText,\n dropZoneClasses.selectFilesText\n )}\n >{`\\xa0${labels?.selectFiles}`}</StyledSelectedFilesText>\n </StyledDragText>\n </StyledDropAreaLabels>\n </>\n )}\n </StyledDropArea>\n </StyledDropZoneContainer>\n </>\n );\n};\n"],"names":["HvDropZone","id","idProp","classes","labels","acceptedFiles","maxFileSize","inputProps","hideLabels","multiple","disabled","onFilesAdded","useUniqueId","dragState","setDrag","useState","inputRef","useRef","leaveDropArea","enterDropArea","onChangeHandler","filesList","filesToProcess","Object","keys","map","e","newFiles","forEach","file","newFile","isSizeAllowed","size","isFileAccepted","length","indexOf","type","split","some","acceptExtension","accept","name","errorMessage","fileTypeError","status","fileSizeError","uniqueId","push","_Fragment","children","StyledDropZoneLabelsGroup","className","clsx","dropZoneLabelsGroup","dropZoneClasses","_jsx","StyledLabel","setId","htmlFor","label","dropzone","dropZoneLabel","$disabled","_jsxs","StyledInfoMessage","Number","isInteger","sizeWarning","convertUnits","join","StyledDropZoneContainer","dropZoneContainer","dragAction","dropZoneContainerDisabled","$drag","role","tabIndex","onDragEnter","event","stopPropagation","preventDefault","onDragLeave","onDropCapture","onDragOver","onDrop","files","dataTransfer","onKeyDown","isKeypress","keyboardCodes","Enter","current","click","StyledInput","inputArea","title","drag","selectFiles","onClick","value","onChange","ref","StyledDropArea","dropArea","StyledDropAreaLabel","dropZoneAreaLabels","StyledDragText","dragText","dropFiles","StyledDropAreaIcon","iconSize","dropZoneAreaIcon","color","StyledDropAreaLabels","StyledSelectedFilesText","selectFilesText"],"mappings":";;;;;;;;;;;;AAqGO,MAAMA,aAAaA,CAAC;AAAA,EACzBC,IAAIC;AAAAA,EACJC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,WAAW;AAAA,EACXC,WAAW;AAAA,EACXC;AACe,MAAM;AACfV,QAAAA,KAAKW,YAAYV,QAAQ,UAAU;AACzC,QAAM,CAACW,WAAWC,OAAO,IAAIC,SAAkB,KAAK;AAE9CC,QAAAA,WAAWC,OAAgC,IAAI;AAErD,QAAMC,gBAAgBA,MAAM;AAC1BJ,YAAQ,KAAK;AAAA,EAAA;AAGf,QAAMK,gBAAgBA,MAAM;AAC1BL,YAAQ,IAAI;AAAA,EAAA;AAGRM,QAAAA,kBAAkBA,CAACC,cAAwB;AACzCC,UAAAA,iBAAiBC,OAAOC,KAAKH,SAAS,EAAEI,IAAKC,CAAAA,MAAML,UAAUK,CAAC,CAAC;AAErE,UAAMC,WAAyB,CAAA;AAEhBC,mBAAAA,QAAQ,CAACC,SAAe;AACrC,YAAMC,UAAsBD;AAEtBE,YAAAA,gBAAgBF,KAAKG,QAAQ1B;AACnC,YAAM2B,iBACJ,CAAC5B,cAAc6B,UACf7B,cAAc8B,QAAQN,KAAKO,KAAKC,MAAM,GAAG,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