@neo4j-ndl/react 4.16.1 → 4.16.2

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 (191) hide show
  1. package/lib/cjs/accordion/Accordion.js +2 -2
  2. package/lib/cjs/accordion/Accordion.js.map +1 -1
  3. package/lib/cjs/ai/file-tag/FileTag.js +2 -2
  4. package/lib/cjs/ai/file-tag/FileTag.js.map +1 -1
  5. package/lib/cjs/ai/image-tag/ImageTag.js +2 -2
  6. package/lib/cjs/ai/image-tag/ImageTag.js.map +1 -1
  7. package/lib/cjs/ai/presence/Presence.js +2 -2
  8. package/lib/cjs/ai/presence/Presence.js.map +1 -1
  9. package/lib/cjs/ai/preview/Preview.js +3 -2
  10. package/lib/cjs/ai/preview/Preview.js.map +1 -1
  11. package/lib/cjs/ai/prompt/Prompt.js +6 -3
  12. package/lib/cjs/ai/prompt/Prompt.js.map +1 -1
  13. package/lib/cjs/ai/reasoning/Reasoning.js +2 -2
  14. package/lib/cjs/ai/reasoning/Reasoning.js.map +1 -1
  15. package/lib/cjs/ai/tool-call/ToolCall.js +2 -2
  16. package/lib/cjs/ai/tool-call/ToolCall.js.map +1 -1
  17. package/lib/cjs/avatar/Avatar.js +2 -2
  18. package/lib/cjs/avatar/Avatar.js.map +1 -1
  19. package/lib/cjs/banner/Banner.js +12 -7
  20. package/lib/cjs/banner/Banner.js.map +1 -1
  21. package/lib/cjs/breadcrumbs/Breadcrumbs.js +2 -2
  22. package/lib/cjs/breadcrumbs/Breadcrumbs.js.map +1 -1
  23. package/lib/cjs/clipboard-button/ClipboardButton.js +2 -2
  24. package/lib/cjs/clipboard-button/ClipboardButton.js.map +1 -1
  25. package/lib/cjs/code-block/CodeBlock.js +3 -2
  26. package/lib/cjs/code-block/CodeBlock.js.map +1 -1
  27. package/lib/cjs/color-picker/ColorPicker.js +2 -2
  28. package/lib/cjs/color-picker/ColorPicker.js.map +1 -1
  29. package/lib/cjs/data-grid/Components.js +18 -11
  30. package/lib/cjs/data-grid/Components.js.map +1 -1
  31. package/lib/cjs/date-picker/DatePicker.js +8 -5
  32. package/lib/cjs/date-picker/DatePicker.js.map +1 -1
  33. package/lib/cjs/dialog/Dialog.js +8 -5
  34. package/lib/cjs/dialog/Dialog.js.map +1 -1
  35. package/lib/cjs/dismissible-tag/DismissibleTag.js +2 -2
  36. package/lib/cjs/dismissible-tag/DismissibleTag.js.map +1 -1
  37. package/lib/cjs/drawer/Drawer.js +2 -2
  38. package/lib/cjs/drawer/Drawer.js.map +1 -1
  39. package/lib/cjs/dropdown-button/DropdownButton.js +2 -2
  40. package/lib/cjs/dropdown-button/DropdownButton.js.map +1 -1
  41. package/lib/cjs/dropzone/Dropzone.js +5 -3
  42. package/lib/cjs/dropzone/Dropzone.js.map +1 -1
  43. package/lib/cjs/icon-button-array/IconButtonArray.js +6 -3
  44. package/lib/cjs/icon-button-array/IconButtonArray.js.map +1 -1
  45. package/lib/cjs/inline-edit/InlineEdit.js +6 -4
  46. package/lib/cjs/inline-edit/InlineEdit.js.map +1 -1
  47. package/lib/cjs/menu/Menu.js +4 -3
  48. package/lib/cjs/menu/Menu.js.map +1 -1
  49. package/lib/cjs/next/tree-view/TreeView.js +4 -3
  50. package/lib/cjs/next/tree-view/TreeView.js.map +1 -1
  51. package/lib/cjs/select/Overrides.js +4 -3
  52. package/lib/cjs/select/Overrides.js.map +1 -1
  53. package/lib/cjs/select/Select.js +2 -2
  54. package/lib/cjs/select/Select.js.map +1 -1
  55. package/lib/cjs/select-icon-button/SelectIconButton.js +2 -2
  56. package/lib/cjs/select-icon-button/SelectIconButton.js.map +1 -1
  57. package/lib/cjs/side-navigation/SideNavigation.js +4 -3
  58. package/lib/cjs/side-navigation/SideNavigation.js.map +1 -1
  59. package/lib/cjs/status-label/StatusLabel.js +10 -7
  60. package/lib/cjs/status-label/StatusLabel.js.map +1 -1
  61. package/lib/cjs/tabs/Tabs.js +4 -3
  62. package/lib/cjs/tabs/Tabs.js.map +1 -1
  63. package/lib/cjs/tag/Tag.js +2 -2
  64. package/lib/cjs/tag/Tag.js.map +1 -1
  65. package/lib/cjs/text-area/TextArea.js +3 -2
  66. package/lib/cjs/text-area/TextArea.js.map +1 -1
  67. package/lib/cjs/text-input/TextInput.js +6 -4
  68. package/lib/cjs/text-input/TextInput.js.map +1 -1
  69. package/lib/cjs/text-link/TextLink.js +3 -2
  70. package/lib/cjs/text-link/TextLink.js.map +1 -1
  71. package/lib/cjs/time-picker/TimePicker.js +3 -2
  72. package/lib/cjs/time-picker/TimePicker.js.map +1 -1
  73. package/lib/cjs/timezone-picker/TimeZonePicker.js +2 -2
  74. package/lib/cjs/timezone-picker/TimeZonePicker.js.map +1 -1
  75. package/lib/cjs/toast/Toast.js +6 -4
  76. package/lib/cjs/toast/Toast.js.map +1 -1
  77. package/lib/cjs/tree-view/TreeItemWrapper.js +2 -2
  78. package/lib/cjs/tree-view/TreeItemWrapper.js.map +1 -1
  79. package/lib/cjs/tree-view/TreeViewTextItem.js +3 -2
  80. package/lib/cjs/tree-view/TreeViewTextItem.js.map +1 -1
  81. package/lib/esm/accordion/Accordion.js +1 -1
  82. package/lib/esm/accordion/Accordion.js.map +1 -1
  83. package/lib/esm/ai/file-tag/FileTag.js +1 -1
  84. package/lib/esm/ai/file-tag/FileTag.js.map +1 -1
  85. package/lib/esm/ai/image-tag/ImageTag.js +1 -1
  86. package/lib/esm/ai/image-tag/ImageTag.js.map +1 -1
  87. package/lib/esm/ai/presence/Presence.js +1 -1
  88. package/lib/esm/ai/presence/Presence.js.map +1 -1
  89. package/lib/esm/ai/preview/Preview.js +2 -1
  90. package/lib/esm/ai/preview/Preview.js.map +1 -1
  91. package/lib/esm/ai/prompt/Prompt.js +4 -1
  92. package/lib/esm/ai/prompt/Prompt.js.map +1 -1
  93. package/lib/esm/ai/reasoning/Reasoning.js +1 -1
  94. package/lib/esm/ai/reasoning/Reasoning.js.map +1 -1
  95. package/lib/esm/ai/tool-call/ToolCall.js +1 -1
  96. package/lib/esm/ai/tool-call/ToolCall.js.map +1 -1
  97. package/lib/esm/avatar/Avatar.js +1 -1
  98. package/lib/esm/avatar/Avatar.js.map +1 -1
  99. package/lib/esm/banner/Banner.js +6 -1
  100. package/lib/esm/banner/Banner.js.map +1 -1
  101. package/lib/esm/breadcrumbs/Breadcrumbs.js +1 -1
  102. package/lib/esm/breadcrumbs/Breadcrumbs.js.map +1 -1
  103. package/lib/esm/clipboard-button/ClipboardButton.js +1 -1
  104. package/lib/esm/clipboard-button/ClipboardButton.js.map +1 -1
  105. package/lib/esm/code-block/CodeBlock.js +2 -1
  106. package/lib/esm/code-block/CodeBlock.js.map +1 -1
  107. package/lib/esm/color-picker/ColorPicker.js +1 -1
  108. package/lib/esm/color-picker/ColorPicker.js.map +1 -1
  109. package/lib/esm/data-grid/Components.js +8 -1
  110. package/lib/esm/data-grid/Components.js.map +1 -1
  111. package/lib/esm/date-picker/DatePicker.js +4 -1
  112. package/lib/esm/date-picker/DatePicker.js.map +1 -1
  113. package/lib/esm/dialog/Dialog.js +4 -1
  114. package/lib/esm/dialog/Dialog.js.map +1 -1
  115. package/lib/esm/dismissible-tag/DismissibleTag.js +1 -1
  116. package/lib/esm/dismissible-tag/DismissibleTag.js.map +1 -1
  117. package/lib/esm/drawer/Drawer.js +1 -1
  118. package/lib/esm/drawer/Drawer.js.map +1 -1
  119. package/lib/esm/dropdown-button/DropdownButton.js +1 -1
  120. package/lib/esm/dropdown-button/DropdownButton.js.map +1 -1
  121. package/lib/esm/dropzone/Dropzone.js +3 -1
  122. package/lib/esm/dropzone/Dropzone.js.map +1 -1
  123. package/lib/esm/icon-button-array/IconButtonArray.js +4 -1
  124. package/lib/esm/icon-button-array/IconButtonArray.js.map +1 -1
  125. package/lib/esm/inline-edit/InlineEdit.js +3 -1
  126. package/lib/esm/inline-edit/InlineEdit.js.map +1 -1
  127. package/lib/esm/menu/Menu.js +2 -1
  128. package/lib/esm/menu/Menu.js.map +1 -1
  129. package/lib/esm/next/tree-view/TreeView.js +2 -1
  130. package/lib/esm/next/tree-view/TreeView.js.map +1 -1
  131. package/lib/esm/select/Overrides.js +2 -1
  132. package/lib/esm/select/Overrides.js.map +1 -1
  133. package/lib/esm/select/Select.js +1 -1
  134. package/lib/esm/select/Select.js.map +1 -1
  135. package/lib/esm/select-icon-button/SelectIconButton.js +1 -1
  136. package/lib/esm/select-icon-button/SelectIconButton.js.map +1 -1
  137. package/lib/esm/side-navigation/SideNavigation.js +2 -1
  138. package/lib/esm/side-navigation/SideNavigation.js.map +1 -1
  139. package/lib/esm/status-label/StatusLabel.js +4 -1
  140. package/lib/esm/status-label/StatusLabel.js.map +1 -1
  141. package/lib/esm/tabs/Tabs.js +2 -1
  142. package/lib/esm/tabs/Tabs.js.map +1 -1
  143. package/lib/esm/tag/Tag.js +1 -1
  144. package/lib/esm/tag/Tag.js.map +1 -1
  145. package/lib/esm/text-area/TextArea.js +2 -1
  146. package/lib/esm/text-area/TextArea.js.map +1 -1
  147. package/lib/esm/text-input/TextInput.js +3 -1
  148. package/lib/esm/text-input/TextInput.js.map +1 -1
  149. package/lib/esm/text-link/TextLink.js +2 -1
  150. package/lib/esm/text-link/TextLink.js.map +1 -1
  151. package/lib/esm/time-picker/TimePicker.js +2 -1
  152. package/lib/esm/time-picker/TimePicker.js.map +1 -1
  153. package/lib/esm/timezone-picker/TimeZonePicker.js +1 -1
  154. package/lib/esm/timezone-picker/TimeZonePicker.js.map +1 -1
  155. package/lib/esm/toast/Toast.js +3 -1
  156. package/lib/esm/toast/Toast.js.map +1 -1
  157. package/lib/esm/tree-view/TreeItemWrapper.js +1 -1
  158. package/lib/esm/tree-view/TreeItemWrapper.js.map +1 -1
  159. package/lib/esm/tree-view/TreeViewTextItem.js +2 -1
  160. package/lib/esm/tree-view/TreeViewTextItem.js.map +1 -1
  161. package/lib/types/ai/file-tag/FileTag.d.ts.map +1 -1
  162. package/lib/types/ai/image-tag/ImageTag.d.ts.map +1 -1
  163. package/lib/types/ai/presence/Presence.d.ts.map +1 -1
  164. package/lib/types/ai/preview/Preview.d.ts.map +1 -1
  165. package/lib/types/ai/prompt/Prompt.d.ts.map +1 -1
  166. package/lib/types/ai/reasoning/Reasoning.d.ts.map +1 -1
  167. package/lib/types/ai/tool-call/ToolCall.d.ts.map +1 -1
  168. package/lib/types/banner/Banner.d.ts.map +1 -1
  169. package/lib/types/breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  170. package/lib/types/code-block/CodeBlock.d.ts.map +1 -1
  171. package/lib/types/data-grid/Components.d.ts +1 -1
  172. package/lib/types/data-grid/Components.d.ts.map +1 -1
  173. package/lib/types/date-picker/DatePicker.d.ts.map +1 -1
  174. package/lib/types/dialog/Dialog.d.ts.map +1 -1
  175. package/lib/types/dropzone/Dropzone.d.ts.map +1 -1
  176. package/lib/types/icon-button-array/IconButtonArray.d.ts.map +1 -1
  177. package/lib/types/inline-edit/InlineEdit.d.ts.map +1 -1
  178. package/lib/types/menu/Menu.d.ts.map +1 -1
  179. package/lib/types/next/tree-view/TreeView.d.ts.map +1 -1
  180. package/lib/types/select/Overrides.d.ts.map +1 -1
  181. package/lib/types/side-navigation/SideNavigation.d.ts.map +1 -1
  182. package/lib/types/status-label/StatusLabel.d.ts.map +1 -1
  183. package/lib/types/tabs/Tabs.d.ts.map +1 -1
  184. package/lib/types/text-area/TextArea.d.ts.map +1 -1
  185. package/lib/types/text-input/TextInput.d.ts.map +1 -1
  186. package/lib/types/text-link/TextLink.d.ts.map +1 -1
  187. package/lib/types/time-picker/TimePicker.d.ts.map +1 -1
  188. package/lib/types/toast/Toast.d.ts.map +1 -1
  189. package/lib/types/tree-view/TreeView.d.ts.map +1 -1
  190. package/lib/types/tree-view/TreeViewTextItem.d.ts.map +1 -1
  191. package/package.json +1 -1
@@ -32,7 +32,7 @@ var __rest = (this && this.__rest) || function (s, e) {
32
32
  };
33
33
  import { jsx as _jsx } from "react/jsx-runtime";
34
34
  import { useId } from 'react';
35
- import { XMarkIconOutline } from '../icons';
35
+ import { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';
36
36
  import { TagBase } from '../tag-base';
37
37
  export const DismissibleTag = (_a) => {
38
38
  var { size = 'medium', color, children, htmlAttributes, leadingVisual, onRemove } = _a, restProps = __rest(_a, ["size", "color", "children", "htmlAttributes", "leadingVisual", "onRemove"]);
@@ -1 +1 @@
1
- {"version":3,"file":"DismissibleTag.js","sourceRoot":"","sources":["../../../src/dismissible-tag/DismissibleTag.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAqBA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAG9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAetC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAQW,EAAE,EAAE;QARf,EAC7B,IAAI,GAAG,QAAQ,EACf,KAAK,EACL,QAAQ,EACR,cAAc,EACd,aAAa,EACb,QAAQ,OAEgC,EADrC,SAAS,cAPiB,4EAQ9B,CADa;IAEZ,MAAM,SAAS,GAAG,KAAK,EAAE,CAAC;IAE1B,OAAO,CACL,KAAC,OAAO,kBACN,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,IAAI,EACV,eAAe,EACb,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,iBAAiB,EAC3B,OAAO,EAAE,QAAQ,sBACC,SAAS,gBAChB,QAAQ,YAEnB,KAAC,gBAAgB,KAAG,GACb,IAEP,SAAS,cAEZ,QAAQ,IACD,CACX,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport type React from 'react';\nimport { useId } from 'react';\n\nimport { type CommonProps } from '../_common/types';\nimport { XMarkIconOutline } from '../icons';\nimport type { TagColor, TagSize } from '../tag-base';\nimport { TagBase } from '../tag-base';\n\ninterface DismissibleTagProps {\n /** Categorical color for the background */\n color?: TagColor;\n /** The content of the tag */\n children?: React.ReactNode;\n /** Icon to display before the content */\n leadingVisual?: React.ReactNode;\n /** Size of the tag */\n size?: TagSize;\n /** Callback function triggered when tag should be removed. */\n onRemove: React.MouseEventHandler<HTMLButtonElement>;\n}\n\nexport const DismissibleTag = ({\n size = 'medium',\n color,\n children,\n htmlAttributes,\n leadingVisual,\n onRemove,\n ...restProps\n}: CommonProps<'div', DismissibleTagProps>) => {\n const contentId = useId();\n\n return (\n <TagBase\n color={color}\n contentId={contentId}\n htmlAttributes={htmlAttributes}\n leadingVisual={leadingVisual}\n size={size}\n trailingContent={\n <button\n type=\"button\"\n className=\"ndl-remove-icon\"\n onClick={onRemove}\n aria-describedby={contentId}\n aria-label=\"Remove\"\n >\n <XMarkIconOutline />\n </button>\n }\n {...restProps}\n >\n {children}\n </TagBase>\n );\n};\n"]}
1
+ {"version":3,"file":"DismissibleTag.js","sourceRoot":"","sources":["../../../src/dismissible-tag/DismissibleTag.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAqBA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAG9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AAEjF,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAetC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAQW,EAAE,EAAE;QARf,EAC7B,IAAI,GAAG,QAAQ,EACf,KAAK,EACL,QAAQ,EACR,cAAc,EACd,aAAa,EACb,QAAQ,OAEgC,EADrC,SAAS,cAPiB,4EAQ9B,CADa;IAEZ,MAAM,SAAS,GAAG,KAAK,EAAE,CAAC;IAE1B,OAAO,CACL,KAAC,OAAO,kBACN,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,IAAI,EACV,eAAe,EACb,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,iBAAiB,EAC3B,OAAO,EAAE,QAAQ,sBACC,SAAS,gBAChB,QAAQ,YAEnB,KAAC,gBAAgB,KAAG,GACb,IAEP,SAAS,cAEZ,QAAQ,IACD,CACX,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport type React from 'react';\nimport { useId } from 'react';\n\nimport { type CommonProps } from '../_common/types';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport type { TagColor, TagSize } from '../tag-base';\nimport { TagBase } from '../tag-base';\n\ninterface DismissibleTagProps {\n /** Categorical color for the background */\n color?: TagColor;\n /** The content of the tag */\n children?: React.ReactNode;\n /** Icon to display before the content */\n leadingVisual?: React.ReactNode;\n /** Size of the tag */\n size?: TagSize;\n /** Callback function triggered when tag should be removed. */\n onRemove: React.MouseEventHandler<HTMLButtonElement>;\n}\n\nexport const DismissibleTag = ({\n size = 'medium',\n color,\n children,\n htmlAttributes,\n leadingVisual,\n onRemove,\n ...restProps\n}: CommonProps<'div', DismissibleTagProps>) => {\n const contentId = useId();\n\n return (\n <TagBase\n color={color}\n contentId={contentId}\n htmlAttributes={htmlAttributes}\n leadingVisual={leadingVisual}\n size={size}\n trailingContent={\n <button\n type=\"button\"\n className=\"ndl-remove-icon\"\n onClick={onRemove}\n aria-describedby={contentId}\n aria-label=\"Remove\"\n >\n <XMarkIconOutline />\n </button>\n }\n {...restProps}\n >\n {children}\n </TagBase>\n );\n};\n"]}
@@ -37,7 +37,7 @@ import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
37
37
  import { needleWarningMessage } from '../_common/utils';
38
38
  import { CleanIconButton } from '../clean-icon-button';
39
39
  import { ConditionalWrap } from '../conditional-wrap';
40
- import { XMarkIconOutline } from '../icons';
40
+ import { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';
41
41
  import { Typography } from '../typography';
42
42
  const KEYBOARD_RESIZE_STEP_PX = 16;
43
43
  function parsePixelSize(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/drawer/Drawer.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,OAAO,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAC;AAE9D,OAAO,EAEL,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE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OAAO,EAClB,OAAO,EAAC,SAAS,IACb,SAAS,EACT,cAAc,cAEjB,QAAQ,IACE,CACd,CAAC;IACJ,CAAC;IAED,OAAO,CACL,4BAAK,SAAS,EAAE,OAAO,IAAM,SAAS,EAAM,cAAc,cACvD,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC;AAQF,MAAM,aAAa,GAAG,CAAC,EAKF,EAAE,EAAE;QALF,EACrB,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,cAAc,OAEK,EADhB,SAAS,cAJS,2CAKtB,CADa;IAEZ,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;IAE5D,OAAO,CACL,4BAAK,SAAS,EAAE,OAAO,IAAM,SAAS,EAAM,cAAc,cACvD,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC;AAQF,MAAM,UAAU,GAAG,CAAC,EAKF,EAAE,EAAE;QALF,EAClB,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,cAAc,OAEE,EADb,SAAS,cAJM,2CAKnB,CADa;IAEZ,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;IAEzD,OAAO,CACL,cAAK,SAAS,EAAC,yBAAyB,YACtC,4BAAK,SAAS,EAAE,OAAO,IAAM,SAAS,EAAM,cAAc,cACvD,QAAQ,IACL,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;IAC5C,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n FloatingFocusManager,\n FloatingOverlay,\n FloatingPortal,\n useDismiss,\n useFloating,\n useInteractions,\n useMergeRefs,\n useRole,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { Resizable, type ResizableProps } from 're-resizable';\nimport type React from 'react';\nimport {\n type ComponentProps,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { needleWarningMessage } from '../_common/utils';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { XMarkIconOutline } from '../icons';\nimport { Typography } from '../typography';\n\ntype DrawerPosition = 'left' | 'right';\n\ntype DrawerType = 'overlay' | 'push' | 'modal';\n\ntype DrawerProps = {\n /** Controls whether the drawer is open (expanded) or closed (collapsed). */\n isExpanded: boolean;\n\n /** Callback fired when the drawer's expanded state changes (close button, Escape, click outside, or programmatic change). */\n onExpandedChange?: (expanded: boolean) => void;\n\n /** Position where the drawer appears on screen. By default, it appears from the left. */\n position?: DrawerPosition;\n\n /** How the drawer affects the layout of sibling content. By default, it overlays content. */\n type?: DrawerType;\n\n /** Enables horizontal resizing of the drawer, by default it is not resizable. */\n isResizeable?: boolean;\n\n /** To use this prop the isResizeable prop must be set to true. For overriding the third party library props: https://github.com/bokuweb/re-resizable\n * The property enable has default values set for bottom, bottomLeft etc based on the position prop.\n */\n resizeableProps?: ResizableProps;\n\n /** Whether a close button (X) is displayed in the drawer. */\n isCloseable?: boolean;\n\n /** Whether to portal the content. Only applies when type is \"overlay\". Type \"modal\" is always portaled.*/\n isPortaled?: boolean;\n\n // TODO v5: this should maybe be default on portaled in the future\n /**\n * Whether pressing Escape closes the drawer. Should be set to true for overlay drawers.\n * - When type is \"modal\", this defaults to true.\n * - When type is \"overlay\", this defaults to false.\n * - When type is \"push\", no effect.\n */\n closeOnEscape?: boolean;\n\n // TODO v5: this should maybe be default on overlay in the future\n /**\n * When type is \"overlay\", whether clicking outside the drawer closes it. Should be set to true for overlay drawers.\n * - When type is \"overlay\" or \"modal\", this defaults to false.\n * - When type is \"push\", no effect.\n */\n closeOnClickOutside?: boolean;\n\n // TODO v5: remove this prop\n /**\n * @deprecated overlay are now focus trapped by default, this prop has no effect anymore.\n */\n closeOnFocusOut?: boolean;\n\n /** The content to display within the drawer. */\n children: React.ReactNode;\n\n /**\n * Props to pass to the portal from @floating-ui/react FloatingPortal\n * Only applies when type is \"overlay\" and isPortaled is true, or if type is \"modal\".\n * @see https://floating-ui.com/docs/floatingportal\n */\n portalProps?: ComponentProps<typeof FloatingPortal>;\n} & (\n | {\n type: 'modal';\n /** The aria-label to apply to the drawer. Required for accessibility when type is \"modal\" or \"overlay\".*/\n ariaLabel: string;\n }\n | {\n type?: 'push' | 'overlay';\n // TODO v5: aria label should be required when type is \"overlay\" too.\n ariaLabel?: string;\n }\n);\n\nconst KEYBOARD_RESIZE_STEP_PX = 16;\n\nfunction parsePixelSize(\n value: string | number | undefined,\n): number | undefined {\n if (value === undefined) {\n return undefined;\n }\n if (typeof value === 'number') {\n return value;\n }\n if (/^\\d+(\\.\\d+)?px$/i.test(value)) {\n return parseFloat(value);\n }\n return undefined;\n}\n\nfunction parsePercentage(\n value: string | number | undefined,\n referenceWidth: number | undefined,\n): number | undefined {\n if (\n typeof value !== 'string' ||\n !value.endsWith('%') ||\n referenceWidth === undefined\n ) {\n return undefined;\n }\n const percent = parseFloat(value);\n return Number.isNaN(percent) ? undefined : (percent / 100) * referenceWidth;\n}\n\ntype DrawerResizeHandleProps = {\n /** Which edge this handle resizes (right = drawer’s right edge, left = drawer’s left edge). */\n handleSide: 'left' | 'right';\n /** Called with a pixel delta to apply to the drawer width (positive = wider). */\n onResizeBy: (delta: number) => void;\n onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;\n /** Current width in pixels (for aria-valuenow). */\n valueNow?: number;\n /** Minimum width in pixels (for aria-valuemin). */\n valueMin?: number;\n /** Maximum width in pixels (for aria-valuemax). */\n valueMax?: number;\n};\n\nfunction DrawerResizeHandle({\n handleSide,\n onResizeBy,\n valueMax,\n valueMin,\n valueNow,\n}: DrawerResizeHandleProps) {\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n const isArrowKey = e.key === 'ArrowLeft' || e.key === 'ArrowRight';\n if (isArrowKey) {\n e.preventDefault();\n const delta =\n handleSide === 'right'\n ? e.key === 'ArrowRight'\n ? KEYBOARD_RESIZE_STEP_PX\n : -KEYBOARD_RESIZE_STEP_PX\n : e.key === 'ArrowLeft'\n ? KEYBOARD_RESIZE_STEP_PX\n : -KEYBOARD_RESIZE_STEP_PX;\n onResizeBy(delta);\n }\n },\n [handleSide, onResizeBy],\n );\n\n return (\n /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- Resize handle is focusable for keyboard resize. */\n <div\n aria-label={`Resize drawer with arrow keys. Handle on ${handleSide}.`}\n aria-orientation=\"vertical\"\n aria-valuemax={valueMax}\n aria-valuemin={valueMin}\n aria-valuenow={valueNow ?? 0}\n aria-valuetext={`drawer width ${valueNow ?? 0}px`}\n className=\"ndl-drawer-resize-handle\"\n data-drawer-handle={handleSide}\n onKeyDown={handleKeyDown}\n role=\"separator\"\n style={{ height: '100%', width: '100%' }}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- Resize handle is focusable for keyboard resize.\n tabIndex={0}\n />\n );\n}\n\nconst DrawerComponent = function DrawerComponent<\n T extends React.ElementType = 'div',\n>({\n children,\n className = '',\n isExpanded,\n onExpandedChange,\n position = 'left',\n type = 'overlay',\n isResizeable = false,\n resizeableProps,\n isCloseable = true,\n isPortaled = false,\n portalProps = {},\n closeOnEscape = type === 'modal' ? true : false,\n closeOnClickOutside = false,\n ariaLabel,\n htmlAttributes,\n style,\n ref,\n as,\n ...restProps\n}: PolymorphicCommonProps<T, DrawerProps>) {\n const resizableRef = useRef<Resizable | null>(null);\n const [resizeWidth, setResizeWidth] = useState<number>(0);\n\n if ((type === 'modal' || type === 'overlay') && !ariaLabel) {\n needleWarningMessage(\n 'A Drawer should have an aria-label when type is \"modal\" or \"overlay\" to be accessible.',\n );\n }\n\n const { refs, context } = useFloating({\n onOpenChange: onExpandedChange,\n open: isExpanded,\n });\n\n /** Dismiss (escape + click outside) applies to portaled overlay and to non-portaled overlay. */\n const shouldUseDismiss =\n type === 'modal' ||\n (type === 'overlay' && !isPortaled && isExpanded) ||\n (type === 'overlay' && isPortaled);\n\n const dismiss = useDismiss(context, {\n enabled: shouldUseDismiss,\n escapeKey: closeOnEscape && type !== 'push',\n outsidePress: closeOnClickOutside && type !== 'push',\n });\n const role = useRole(context, {\n enabled: type === 'modal' || type === 'overlay',\n role: 'dialog',\n });\n const { getFloatingProps } = useInteractions([dismiss, role]);\n\n const resizableMergedRef = useMergeRefs([resizableRef, ref]);\n\n const handleResizeBy = useCallback(\n (delta: number) => {\n if (!resizableRef.current) {\n return;\n }\n const current = resizableRef.current.size;\n const parentWidth =\n resizableRef.current.resizable?.parentElement?.offsetWidth;\n const min =\n parsePixelSize(resizeableProps?.minWidth) ??\n parsePercentage(resizeableProps?.minWidth, parentWidth);\n const max =\n parsePixelSize(resizeableProps?.maxWidth) ??\n parsePercentage(resizeableProps?.maxWidth, parentWidth);\n const newWidth = Math.max(\n min ?? 0,\n Math.min(max ?? Number.POSITIVE_INFINITY, current.width + delta),\n );\n resizableRef.current.updateSize({\n height: '100%',\n width: newWidth,\n });\n setResizeWidth(newWidth);\n },\n [resizeableProps?.minWidth, resizeableProps?.maxWidth],\n );\n\n const handleResize = useCallback(\n (\n event: MouseEvent | TouchEvent,\n direction: Parameters<NonNullable<ResizableProps['onResize']>>[1],\n elementRef: HTMLElement,\n delta: { width: number; height: number },\n ) => {\n setResizeWidth(elementRef.offsetWidth);\n resizeableProps?.onResize?.(event, direction, elementRef, delta);\n },\n [resizeableProps],\n );\n\n useEffect(() => {\n if (!isResizeable || !resizableRef.current) {\n return;\n }\n const width = resizableRef.current.size.width;\n if (width > 0) {\n setResizeWidth(width);\n }\n }, [isResizeable]);\n\n const classes = classNames('ndl-drawer', className, {\n 'ndl-drawer-expanded': isExpanded,\n 'ndl-drawer-left': position === 'left',\n 'ndl-drawer-modal': type === 'modal',\n 'ndl-drawer-overlay': type === 'overlay',\n 'ndl-drawer-portaled': isPortaled && type === 'overlay',\n 'ndl-drawer-push': type === 'push',\n 'ndl-drawer-right': position === 'right',\n });\n\n const resizableStylePosition = type === 'overlay' ? 'absolute' : 'relative';\n const Component = as ?? 'div';\n\n const handleClose = useCallback(() => {\n onExpandedChange?.(false);\n }, [onExpandedChange]);\n\n const closeButton = useMemo(\n () =>\n isCloseable || type === 'modal' ? (\n <CleanIconButton\n className=\"ndl-drawer-close-button\"\n onClick={handleClose}\n description={null}\n size=\"medium\"\n htmlAttributes={{\n 'aria-label': 'Close',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n ) : null,\n [handleClose, isCloseable, type],\n );\n\n const resizableContent = (\n <Resizable\n as={Component}\n defaultSize={{\n height: '100%',\n width: 'auto',\n }}\n {...resizeableProps}\n className={classes}\n style={{\n position: resizableStylePosition,\n ...style,\n ...resizeableProps?.style,\n }}\n boundsByDirection={true}\n bounds={resizeableProps?.bounds ?? 'parent'}\n handleStyles={{\n /*\n * Small offset so the handle is easier to hit when the drawer content is scrollable.\n */\n ...(position === 'left' && { right: { right: '-8px' } }),\n ...(position === 'right' && { left: { left: '-8px' } }),\n }}\n enable={{\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: position === 'right',\n right: position === 'left',\n top: false,\n topLeft: false,\n topRight: false,\n }}\n handleComponent={\n position === 'left'\n ? {\n right: (\n <DrawerResizeHandle\n handleSide=\"right\"\n onResizeBy={handleResizeBy}\n valueMax={parsePixelSize(resizeableProps?.maxWidth)}\n valueMin={parsePixelSize(resizeableProps?.minWidth)}\n valueNow={resizeWidth}\n />\n ),\n }\n : {\n left: (\n <DrawerResizeHandle\n handleSide=\"left\"\n onResizeBy={handleResizeBy}\n valueMax={parsePixelSize(resizeableProps?.maxWidth)}\n valueMin={parsePixelSize(resizeableProps?.minWidth)}\n valueNow={resizeWidth}\n />\n ),\n }\n }\n onResize={handleResize}\n ref={resizableMergedRef}\n {...restProps}\n {...htmlAttributes}\n >\n {closeButton}\n {children}\n </Resizable>\n );\n\n const regularContent = (\n <Component\n className={classNames(classes)}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {closeButton}\n {children}\n </Component>\n );\n\n /** what content to render*/\n const content = isResizeable ? resizableContent : regularContent;\n\n // const floatingRefs = useMergeRefs([refs.setFloating, refs.setReference]);\n\n /** modal behavior */\n if (type === 'modal' && isExpanded) {\n return (\n <FloatingPortal {...portalProps}>\n <FloatingOverlay\n className=\"ndl-drawer-overlay-root\"\n lockScroll={true}\n />\n <FloatingFocusManager context={context} modal={true} returnFocus={true}>\n <div\n ref={refs.setFloating}\n {...getFloatingProps()}\n aria-label={ariaLabel}\n aria-modal=\"true\"\n >\n {content}\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n );\n }\n\n if (type === 'overlay' && isExpanded) {\n return (\n <ConditionalWrap\n shouldWrap={isPortaled}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <FloatingFocusManager\n disabled={!isExpanded}\n context={context}\n modal={true}\n returnFocus={true}\n >\n <div\n ref={refs.setFloating}\n {...getFloatingProps()}\n aria-label={ariaLabel}\n aria-modal=\"true\"\n >\n {content}\n </div>\n </FloatingFocusManager>\n </ConditionalWrap>\n );\n }\n\n return content;\n};\n\nDrawerComponent.displayName = 'Drawer';\n\ntype DrawerHeaderProps = {\n children: React.ReactNode;\n className?: string;\n // TODO v5: fix the typing on the Drawer subcomponents to use the common props type. Also, this is not an h5 haha. Should be polymorphic I guess, maybe default to h2 as we've recommended.\n htmlAttributes?: HtmlAttributes<'h5'>;\n};\n\nconst DrawerHeader = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerHeaderProps) => {\n const classes = classNames('ndl-drawer-header', className);\n\n if (typeof children === 'string' || typeof children === 'number') {\n return (\n <Typography\n className={classes}\n variant=\"title-3\"\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n }\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerActionsProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerActions = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerActionsProps) => {\n const classes = classNames('ndl-drawer-actions', className);\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerBodyProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerBody = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerBodyProps) => {\n const classes = classNames('ndl-drawer-body', className);\n\n return (\n <div className=\"ndl-drawer-body-wrapper\">\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n </div>\n );\n};\n\nconst Drawer = Object.assign(DrawerComponent, {\n Actions: DrawerActions,\n Body: DrawerBody,\n Header: DrawerHeader,\n});\n\nexport { Drawer };\n"]}
1
+ {"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/drawer/Drawer.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,oBAAoB,EACpB,eA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EF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;IAC5C,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n FloatingFocusManager,\n FloatingOverlay,\n FloatingPortal,\n useDismiss,\n useFloating,\n useInteractions,\n useMergeRefs,\n useRole,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { Resizable, type ResizableProps } from 're-resizable';\nimport type React from 'react';\nimport {\n type ComponentProps,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { needleWarningMessage } from '../_common/utils';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { Typography } from '../typography';\n\ntype DrawerPosition = 'left' | 'right';\n\ntype DrawerType = 'overlay' | 'push' | 'modal';\n\ntype DrawerProps = {\n /** Controls whether the drawer is open (expanded) or closed (collapsed). */\n isExpanded: boolean;\n\n /** Callback fired when the drawer's expanded state changes (close button, Escape, click outside, or programmatic change). */\n onExpandedChange?: (expanded: boolean) => void;\n\n /** Position where the drawer appears on screen. By default, it appears from the left. */\n position?: DrawerPosition;\n\n /** How the drawer affects the layout of sibling content. By default, it overlays content. */\n type?: DrawerType;\n\n /** Enables horizontal resizing of the drawer, by default it is not resizable. */\n isResizeable?: boolean;\n\n /** To use this prop the isResizeable prop must be set to true. For overriding the third party library props: https://github.com/bokuweb/re-resizable\n * The property enable has default values set for bottom, bottomLeft etc based on the position prop.\n */\n resizeableProps?: ResizableProps;\n\n /** Whether a close button (X) is displayed in the drawer. */\n isCloseable?: boolean;\n\n /** Whether to portal the content. Only applies when type is \"overlay\". Type \"modal\" is always portaled.*/\n isPortaled?: boolean;\n\n // TODO v5: this should maybe be default on portaled in the future\n /**\n * Whether pressing Escape closes the drawer. Should be set to true for overlay drawers.\n * - When type is \"modal\", this defaults to true.\n * - When type is \"overlay\", this defaults to false.\n * - When type is \"push\", no effect.\n */\n closeOnEscape?: boolean;\n\n // TODO v5: this should maybe be default on overlay in the future\n /**\n * When type is \"overlay\", whether clicking outside the drawer closes it. Should be set to true for overlay drawers.\n * - When type is \"overlay\" or \"modal\", this defaults to false.\n * - When type is \"push\", no effect.\n */\n closeOnClickOutside?: boolean;\n\n // TODO v5: remove this prop\n /**\n * @deprecated overlay are now focus trapped by default, this prop has no effect anymore.\n */\n closeOnFocusOut?: boolean;\n\n /** The content to display within the drawer. */\n children: React.ReactNode;\n\n /**\n * Props to pass to the portal from @floating-ui/react FloatingPortal\n * Only applies when type is \"overlay\" and isPortaled is true, or if type is \"modal\".\n * @see https://floating-ui.com/docs/floatingportal\n */\n portalProps?: ComponentProps<typeof FloatingPortal>;\n} & (\n | {\n type: 'modal';\n /** The aria-label to apply to the drawer. Required for accessibility when type is \"modal\" or \"overlay\".*/\n ariaLabel: string;\n }\n | {\n type?: 'push' | 'overlay';\n // TODO v5: aria label should be required when type is \"overlay\" too.\n ariaLabel?: string;\n }\n);\n\nconst KEYBOARD_RESIZE_STEP_PX = 16;\n\nfunction parsePixelSize(\n value: string | number | undefined,\n): number | undefined {\n if (value === undefined) {\n return undefined;\n }\n if (typeof value === 'number') {\n return value;\n }\n if (/^\\d+(\\.\\d+)?px$/i.test(value)) {\n return parseFloat(value);\n }\n return undefined;\n}\n\nfunction parsePercentage(\n value: string | number | undefined,\n referenceWidth: number | undefined,\n): number | undefined {\n if (\n typeof value !== 'string' ||\n !value.endsWith('%') ||\n referenceWidth === undefined\n ) {\n return undefined;\n }\n const percent = parseFloat(value);\n return Number.isNaN(percent) ? undefined : (percent / 100) * referenceWidth;\n}\n\ntype DrawerResizeHandleProps = {\n /** Which edge this handle resizes (right = drawer’s right edge, left = drawer’s left edge). */\n handleSide: 'left' | 'right';\n /** Called with a pixel delta to apply to the drawer width (positive = wider). */\n onResizeBy: (delta: number) => void;\n onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;\n /** Current width in pixels (for aria-valuenow). */\n valueNow?: number;\n /** Minimum width in pixels (for aria-valuemin). */\n valueMin?: number;\n /** Maximum width in pixels (for aria-valuemax). */\n valueMax?: number;\n};\n\nfunction DrawerResizeHandle({\n handleSide,\n onResizeBy,\n valueMax,\n valueMin,\n valueNow,\n}: DrawerResizeHandleProps) {\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n const isArrowKey = e.key === 'ArrowLeft' || e.key === 'ArrowRight';\n if (isArrowKey) {\n e.preventDefault();\n const delta =\n handleSide === 'right'\n ? e.key === 'ArrowRight'\n ? KEYBOARD_RESIZE_STEP_PX\n : -KEYBOARD_RESIZE_STEP_PX\n : e.key === 'ArrowLeft'\n ? KEYBOARD_RESIZE_STEP_PX\n : -KEYBOARD_RESIZE_STEP_PX;\n onResizeBy(delta);\n }\n },\n [handleSide, onResizeBy],\n );\n\n return (\n /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- Resize handle is focusable for keyboard resize. */\n <div\n aria-label={`Resize drawer with arrow keys. Handle on ${handleSide}.`}\n aria-orientation=\"vertical\"\n aria-valuemax={valueMax}\n aria-valuemin={valueMin}\n aria-valuenow={valueNow ?? 0}\n aria-valuetext={`drawer width ${valueNow ?? 0}px`}\n className=\"ndl-drawer-resize-handle\"\n data-drawer-handle={handleSide}\n onKeyDown={handleKeyDown}\n role=\"separator\"\n style={{ height: '100%', width: '100%' }}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- Resize handle is focusable for keyboard resize.\n tabIndex={0}\n />\n );\n}\n\nconst DrawerComponent = function DrawerComponent<\n T extends React.ElementType = 'div',\n>({\n children,\n className = '',\n isExpanded,\n onExpandedChange,\n position = 'left',\n type = 'overlay',\n isResizeable = false,\n resizeableProps,\n isCloseable = true,\n isPortaled = false,\n portalProps = {},\n closeOnEscape = type === 'modal' ? true : false,\n closeOnClickOutside = false,\n ariaLabel,\n htmlAttributes,\n style,\n ref,\n as,\n ...restProps\n}: PolymorphicCommonProps<T, DrawerProps>) {\n const resizableRef = useRef<Resizable | null>(null);\n const [resizeWidth, setResizeWidth] = useState<number>(0);\n\n if ((type === 'modal' || type === 'overlay') && !ariaLabel) {\n needleWarningMessage(\n 'A Drawer should have an aria-label when type is \"modal\" or \"overlay\" to be accessible.',\n );\n }\n\n const { refs, context } = useFloating({\n onOpenChange: onExpandedChange,\n open: isExpanded,\n });\n\n /** Dismiss (escape + click outside) applies to portaled overlay and to non-portaled overlay. */\n const shouldUseDismiss =\n type === 'modal' ||\n (type === 'overlay' && !isPortaled && isExpanded) ||\n (type === 'overlay' && isPortaled);\n\n const dismiss = useDismiss(context, {\n enabled: shouldUseDismiss,\n escapeKey: closeOnEscape && type !== 'push',\n outsidePress: closeOnClickOutside && type !== 'push',\n });\n const role = useRole(context, {\n enabled: type === 'modal' || type === 'overlay',\n role: 'dialog',\n });\n const { getFloatingProps } = useInteractions([dismiss, role]);\n\n const resizableMergedRef = useMergeRefs([resizableRef, ref]);\n\n const handleResizeBy = useCallback(\n (delta: number) => {\n if (!resizableRef.current) {\n return;\n }\n const current = resizableRef.current.size;\n const parentWidth =\n resizableRef.current.resizable?.parentElement?.offsetWidth;\n const min =\n parsePixelSize(resizeableProps?.minWidth) ??\n parsePercentage(resizeableProps?.minWidth, parentWidth);\n const max =\n parsePixelSize(resizeableProps?.maxWidth) ??\n parsePercentage(resizeableProps?.maxWidth, parentWidth);\n const newWidth = Math.max(\n min ?? 0,\n Math.min(max ?? Number.POSITIVE_INFINITY, current.width + delta),\n );\n resizableRef.current.updateSize({\n height: '100%',\n width: newWidth,\n });\n setResizeWidth(newWidth);\n },\n [resizeableProps?.minWidth, resizeableProps?.maxWidth],\n );\n\n const handleResize = useCallback(\n (\n event: MouseEvent | TouchEvent,\n direction: Parameters<NonNullable<ResizableProps['onResize']>>[1],\n elementRef: HTMLElement,\n delta: { width: number; height: number },\n ) => {\n setResizeWidth(elementRef.offsetWidth);\n resizeableProps?.onResize?.(event, direction, elementRef, delta);\n },\n [resizeableProps],\n );\n\n useEffect(() => {\n if (!isResizeable || !resizableRef.current) {\n return;\n }\n const width = resizableRef.current.size.width;\n if (width > 0) {\n setResizeWidth(width);\n }\n }, [isResizeable]);\n\n const classes = classNames('ndl-drawer', className, {\n 'ndl-drawer-expanded': isExpanded,\n 'ndl-drawer-left': position === 'left',\n 'ndl-drawer-modal': type === 'modal',\n 'ndl-drawer-overlay': type === 'overlay',\n 'ndl-drawer-portaled': isPortaled && type === 'overlay',\n 'ndl-drawer-push': type === 'push',\n 'ndl-drawer-right': position === 'right',\n });\n\n const resizableStylePosition = type === 'overlay' ? 'absolute' : 'relative';\n const Component = as ?? 'div';\n\n const handleClose = useCallback(() => {\n onExpandedChange?.(false);\n }, [onExpandedChange]);\n\n const closeButton = useMemo(\n () =>\n isCloseable || type === 'modal' ? (\n <CleanIconButton\n className=\"ndl-drawer-close-button\"\n onClick={handleClose}\n description={null}\n size=\"medium\"\n htmlAttributes={{\n 'aria-label': 'Close',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n ) : null,\n [handleClose, isCloseable, type],\n );\n\n const resizableContent = (\n <Resizable\n as={Component}\n defaultSize={{\n height: '100%',\n width: 'auto',\n }}\n {...resizeableProps}\n className={classes}\n style={{\n position: resizableStylePosition,\n ...style,\n ...resizeableProps?.style,\n }}\n boundsByDirection={true}\n bounds={resizeableProps?.bounds ?? 'parent'}\n handleStyles={{\n /*\n * Small offset so the handle is easier to hit when the drawer content is scrollable.\n */\n ...(position === 'left' && { right: { right: '-8px' } }),\n ...(position === 'right' && { left: { left: '-8px' } }),\n }}\n enable={{\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: position === 'right',\n right: position === 'left',\n top: false,\n topLeft: false,\n topRight: false,\n }}\n handleComponent={\n position === 'left'\n ? {\n right: (\n <DrawerResizeHandle\n handleSide=\"right\"\n onResizeBy={handleResizeBy}\n valueMax={parsePixelSize(resizeableProps?.maxWidth)}\n valueMin={parsePixelSize(resizeableProps?.minWidth)}\n valueNow={resizeWidth}\n />\n ),\n }\n : {\n left: (\n <DrawerResizeHandle\n handleSide=\"left\"\n onResizeBy={handleResizeBy}\n valueMax={parsePixelSize(resizeableProps?.maxWidth)}\n valueMin={parsePixelSize(resizeableProps?.minWidth)}\n valueNow={resizeWidth}\n />\n ),\n }\n }\n onResize={handleResize}\n ref={resizableMergedRef}\n {...restProps}\n {...htmlAttributes}\n >\n {closeButton}\n {children}\n </Resizable>\n );\n\n const regularContent = (\n <Component\n className={classNames(classes)}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {closeButton}\n {children}\n </Component>\n );\n\n /** what content to render*/\n const content = isResizeable ? resizableContent : regularContent;\n\n // const floatingRefs = useMergeRefs([refs.setFloating, refs.setReference]);\n\n /** modal behavior */\n if (type === 'modal' && isExpanded) {\n return (\n <FloatingPortal {...portalProps}>\n <FloatingOverlay\n className=\"ndl-drawer-overlay-root\"\n lockScroll={true}\n />\n <FloatingFocusManager context={context} modal={true} returnFocus={true}>\n <div\n ref={refs.setFloating}\n {...getFloatingProps()}\n aria-label={ariaLabel}\n aria-modal=\"true\"\n >\n {content}\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n );\n }\n\n if (type === 'overlay' && isExpanded) {\n return (\n <ConditionalWrap\n shouldWrap={isPortaled}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <FloatingFocusManager\n disabled={!isExpanded}\n context={context}\n modal={true}\n returnFocus={true}\n >\n <div\n ref={refs.setFloating}\n {...getFloatingProps()}\n aria-label={ariaLabel}\n aria-modal=\"true\"\n >\n {content}\n </div>\n </FloatingFocusManager>\n </ConditionalWrap>\n );\n }\n\n return content;\n};\n\nDrawerComponent.displayName = 'Drawer';\n\ntype DrawerHeaderProps = {\n children: React.ReactNode;\n className?: string;\n // TODO v5: fix the typing on the Drawer subcomponents to use the common props type. Also, this is not an h5 haha. Should be polymorphic I guess, maybe default to h2 as we've recommended.\n htmlAttributes?: HtmlAttributes<'h5'>;\n};\n\nconst DrawerHeader = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerHeaderProps) => {\n const classes = classNames('ndl-drawer-header', className);\n\n if (typeof children === 'string' || typeof children === 'number') {\n return (\n <Typography\n className={classes}\n variant=\"title-3\"\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n }\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerActionsProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerActions = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerActionsProps) => {\n const classes = classNames('ndl-drawer-actions', className);\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerBodyProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerBody = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerBodyProps) => {\n const classes = classNames('ndl-drawer-body', className);\n\n return (\n <div className=\"ndl-drawer-body-wrapper\">\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n </div>\n );\n};\n\nconst Drawer = Object.assign(DrawerComponent, {\n Actions: DrawerActions,\n Body: DrawerBody,\n Header: DrawerHeader,\n});\n\nexport { Drawer };\n"]}
@@ -32,7 +32,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
32
32
  */
33
33
  import classNames from 'classnames';
34
34
  import { ButtonSpinner } from '../_common/ButtonSpinner';
35
- import { ChevronDownIconOutline } from '../icons';
35
+ import { ChevronDownIconOutline } from '../icons/generated/heroIcons/ChevronDownIconOutline';
36
36
  /**
37
37
  *
38
38
  *
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownButton.js","sourceRoot":"","sources":["../../../src/dropdown-button/DropdownButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAiClD;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,cAAc,CAEnD,EAgB+C;QAhB/C,EACA,EAAE,EACF,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,UAAU,GAAG,KAAK,EAClB,UAAU,GAAG,KAAK,EAClB,cAAc,EACd,MAAM,GAAG,KAAK,EACd,OAAO,EACP,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,EACH,SAAS,GAAG,KAAK,EACjB,cAAc,GAAG,SAAS,OAEqB,EAD5C,SAAS,cAfZ,2KAgBD,CADa;IAEZ,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,QAAQ,CAAC;IACpD,MAAM,OAAO,GAAG,UAAU,CAAC,kBAAkB,EAAE,SAAS,EA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.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\n\nimport { ButtonSpinner } from '../_common/ButtonSpinner';\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { ChevronDownIconOutline } from '../icons';\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype DropdownButtonProps = {\n /** Content displayed in the button */\n children?: React.ReactNode;\n /** Size of button */\n size?: 'small' | 'medium' | 'large';\n /** Whether the button is in floating state */\n isFloating?: boolean;\n /** Whether the button is in disabled state */\n isDisabled?: boolean;\n /** Element that is shown before the button content */\n leadingElement?: React.ReactNode;\n /** If the dropdown is activated */\n isOpen?: boolean;\n /** Callback function to be called when the button is clicked */\n onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Additional classnames */\n className?: string;\n /** If the button is loading. Will display a loading spinner*/\n isLoading?: boolean;\n /** Accessible message for screen readers when the button is in a loading state */\n loadingMessage?: string;\n};\n\n/**\n *\n *\n * DropdownButton Component\n *\n *\n */\n\nexport const DropdownButton = function DropdownButton<\n T extends React.ElementType = 'button',\n>({\n as,\n children,\n size = 'medium',\n isDisabled = false,\n isFloating = false,\n leadingElement,\n isOpen = false,\n onClick,\n className,\n style,\n htmlAttributes,\n ref,\n isLoading = false,\n loadingMessage = 'Loading',\n ...restProps\n}: PolymorphicCommonProps<T, DropdownButtonProps>) {\n const Component: React.ElementType = as ?? 'button';\n const classes = classNames('ndl-dropdown-btn', className, {\n 'ndl-disabled': isDisabled,\n 'ndl-floating-btn': isFloating,\n 'ndl-large': size === 'large',\n 'ndl-loading': isLoading,\n 'ndl-medium': size === 'medium',\n 'ndl-open': isOpen,\n 'ndl-small': size === 'small',\n });\n\n const isInteractable = !isDisabled && !isLoading;\n\n const handleClick = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n // If the button is disabled or loading, we don't want to call the onClick handler. The loading is only aria-disabled, so we need this.\n if (!isInteractable) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n\n if (onClick) {\n onClick(e);\n }\n };\n\n return (\n <Component\n className={classes}\n disabled={isDisabled}\n aria-disabled={!isInteractable}\n onClick={handleClick}\n aria-expanded={isOpen}\n ref={ref}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-dropdown-btn-inner\">\n <div className=\"ndl-dropdown-btn-leading-wrapper\">\n {leadingElement}\n <span className=\"ndl-dropdown-btn-content\">{children}</span>\n </div>\n\n <ChevronDownIconOutline\n className={classNames('ndl-dropdown-button-icon', {\n 'ndl-dropdown-button-icon-open': isOpen,\n })}\n />\n {isLoading && (\n <ButtonSpinner loadingMessage={loadingMessage} size={size} />\n )}\n </div>\n </Component>\n );\n};\n"]}
1
+ {"version":3,"file":"DropdownButton.js","sourceRoot":"","sources":["../../../src/dropdown-button/DropdownButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAiC7F;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,cAAc,CAEnD,EAgB+C;QAhB/C,EACA,EAAE,EACF,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,UAAU,GAAG,KAAK,EAClB,UAAU,GAAG,KAAK,EAClB,cAAc,EACd,MAAM,GAAG,KAAK,EACd,OAAO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U,CAAC,0BAA0B,EAAE;wBAChD,+BAA+B,EAAE,MAAM;qBACxC,CAAC,GACF,EACD,SAAS,IAAI,CACZ,KAAC,aAAa,IAAC,cAAc,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,GAAI,CAC9D,IACG,IACI,CACb,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\n\nimport { ButtonSpinner } from '../_common/ButtonSpinner';\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { ChevronDownIconOutline } from '../icons/generated/heroIcons/ChevronDownIconOutline';\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype DropdownButtonProps = {\n /** Content displayed in the button */\n children?: React.ReactNode;\n /** Size of button */\n size?: 'small' | 'medium' | 'large';\n /** Whether the button is in floating state */\n isFloating?: boolean;\n /** Whether the button is in disabled state */\n isDisabled?: boolean;\n /** Element that is shown before the button content */\n leadingElement?: React.ReactNode;\n /** If the dropdown is activated */\n isOpen?: boolean;\n /** Callback function to be called when the button is clicked */\n onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Additional classnames */\n className?: string;\n /** If the button is loading. Will display a loading spinner*/\n isLoading?: boolean;\n /** Accessible message for screen readers when the button is in a loading state */\n loadingMessage?: string;\n};\n\n/**\n *\n *\n * DropdownButton Component\n *\n *\n */\n\nexport const DropdownButton = function DropdownButton<\n T extends React.ElementType = 'button',\n>({\n as,\n children,\n size = 'medium',\n isDisabled = false,\n isFloating = false,\n leadingElement,\n isOpen = false,\n onClick,\n className,\n style,\n htmlAttributes,\n ref,\n isLoading = false,\n loadingMessage = 'Loading',\n ...restProps\n}: PolymorphicCommonProps<T, DropdownButtonProps>) {\n const Component: React.ElementType = as ?? 'button';\n const classes = classNames('ndl-dropdown-btn', className, {\n 'ndl-disabled': isDisabled,\n 'ndl-floating-btn': isFloating,\n 'ndl-large': size === 'large',\n 'ndl-loading': isLoading,\n 'ndl-medium': size === 'medium',\n 'ndl-open': isOpen,\n 'ndl-small': size === 'small',\n });\n\n const isInteractable = !isDisabled && !isLoading;\n\n const handleClick = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n // If the button is disabled or loading, we don't want to call the onClick handler. The loading is only aria-disabled, so we need this.\n if (!isInteractable) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n\n if (onClick) {\n onClick(e);\n }\n };\n\n return (\n <Component\n className={classes}\n disabled={isDisabled}\n aria-disabled={!isInteractable}\n onClick={handleClick}\n aria-expanded={isOpen}\n ref={ref}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-dropdown-btn-inner\">\n <div className=\"ndl-dropdown-btn-leading-wrapper\">\n {leadingElement}\n <span className=\"ndl-dropdown-btn-content\">{children}</span>\n </div>\n\n <ChevronDownIconOutline\n className={classNames('ndl-dropdown-button-icon', {\n 'ndl-dropdown-button-icon-open': isOpen,\n })}\n />\n {isLoading && (\n <ButtonSpinner loadingMessage={loadingMessage} size={size} />\n )}\n </div>\n </Component>\n );\n};\n"]}
@@ -37,7 +37,9 @@ import { useMemo, useRef, useState } from 'react';
37
37
  import { useDropzone, } from 'react-dropzone';
38
38
  import { useResizeObserver } from 'usehooks-ts';
39
39
  import { Banner } from '../banner';
40
- import { DocumentArrowUpIconOutline, DocumentArrowUpIconSolid, XCircleIconSolid, } from '../icons';
40
+ import { DocumentArrowUpIconOutline } from '../icons/generated/heroIcons/DocumentArrowUpIconOutline';
41
+ import { DocumentArrowUpIconSolid } from '../icons/generated/heroIcons/DocumentArrowUpIconSolid';
42
+ import { XCircleIconSolid } from '../icons/generated/heroIcons/XCircleIconSolid';
41
43
  import { ProgressBar } from '../progress-bar';
42
44
  import { Typography } from '../typography';
43
45
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Dropzone.js","sourceRoot":"","sources":["../../../src/dropzone/Dropzone.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAkB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAIL,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAqC3C;;;;;;GAMG;AAEH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;AAEzB,MAAM,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,MAAK,QAAQ,CAAC;AAE5C,MAAM,iBAAiB,GAAG,CAAC,EAYS,EAAE,EAAE;QAZb,EACzB,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,OAAO,EACP,YAAY,EACZ,sBAAsB,EACtB,cAAc,EACd,KAAK,EACL,SAAS,EACT,GAAG,OA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cAP+B,6FAQ5C,CADa;IAEZ,OAAO,CACL,eAAK,SAAS,EAAC,2CAA2C,aACxD,eAAK,SAAS,EAAC,8CAA8C,aAC3D,KAAC,UAAU,IACT,SAAS,EAAC,8CAA8C,EACxD,OAAO,EAAC,kBAAkB,YAEzB,GAAG,qBAAqB,GAAG,GACjB,EACZ,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAC7B,KAAC,UAAU,IACT,SAAS,EAAC,0CAA0C,EACpD,OAAO,EAAC,aAAa,YACrB,IAAI,iBAAiB,gBAAgB,GAAc,CACtD,IACG,EACN,KAAC,WAAW,kBACV,SAAS,EAAE,UAAU,CAAC,mCAAmC,EAAE,SAAS,CAAC,EACrE,KAAK,EAAE,qBAAqB,EAC5B,IAAI,EAAC,OAAO,EACZ,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,IACR,SAAS,EACb,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE;IAChD,kBAAkB,EAAE,mCAAmC;CACxD,CAAC,CAAC;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { useMergeRefs } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { detect } from 'detect-browser';\nimport { type RefObject, useMemo, useRef, useState } from 'react';\nimport {\n type DropEvent,\n type DropzoneOptions,\n type FileRejection,\n useDropzone,\n} from 'react-dropzone';\nimport { useResizeObserver } from 'usehooks-ts';\n\nimport { type CommonProps } from '../_common/types';\nimport { Banner } from '../banner';\nimport {\n DocumentArrowUpIconOutline,\n DocumentArrowUpIconSolid,\n XCircleIconSolid,\n} from '../icons';\nimport { ProgressBar } from '../progress-bar';\nimport { Typography } from '../typography';\n\n/**\n *\n *\n * Types\n *\n *\n */\ntype DropzoneProps = {\n /** Props for the underlying `react-dropzone` component. Don't use `accept`. If using custom file extensions as this option is broken. Instead use the `acceptedFileExtensions` property. */\n dropZoneOptions: DropzoneOptions;\n\n /** Informational text that highlights the supported file types, will be displayed in the footer. */\n supportedFilesDescription?: React.ReactNode;\n\n /** Element to display when uploading the file.*/\n loadingElement?: React.ReactNode;\n\n /** Use when wanting a custom heading. */\n heading?: React.ReactNode;\n\n /** Message to be shown when file is rejected. */\n rejectedText?: React.ReactNode;\n\n /** The accepted file extensions for the Drag-and-Drop. */\n acceptedFileExtensions?: string[];\n};\n\ntype DropzoneLoadingProgressBarProps = {\n /** The percentage of the progress bar. */\n progressBarPrecentage: number;\n\n /** The time in minute left to upload the file. */\n progressBarMinute?: number;\n};\n\n/**\n *\n *\n * Helpers\n *\n *\n */\n\nconst browser = detect();\n\nconst isSafari = browser?.name === 'safari';\n\nconst DropzoneComponent = ({\n dropZoneOptions,\n supportedFilesDescription,\n loadingElement,\n heading,\n rejectedText,\n acceptedFileExtensions,\n htmlAttributes,\n style,\n className,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneProps>) => {\n /**\n * We intercept the onDrop function in order to enforce\n * custom file extensions. Before calling the onDrop props we check\n * if the custom file extensions is acceptable. If the extension\n * conforms to acceptedFileExtensions, we call onDrop. Otherwise, we\n * present an error message.\n */\n function onDropInterceptor<T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ) {\n if (acceptedFileExtensions && acceptedFileExtensions.length > 0) {\n for (const file of acceptedFiles) {\n const isAccepted = acceptedFileExtensions.some((extension) => {\n if (file.name.endsWith(extension)) {\n return true;\n }\n });\n if (!isAccepted) {\n setIsRejected(true);\n return;\n }\n }\n }\n setIsRejected(false);\n dropZoneOptions.onDrop?.(acceptedFiles, fileRejections, event);\n }\n\n const [isRejected, setIsRejected] = useState(false);\n const dropZoneRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs([dropZoneRef, ref]);\n const isDisabled = dropZoneOptions?.disabled || Boolean(loadingElement);\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isDragAccept,\n isDragReject,\n open,\n } = useDropzone({\n ...dropZoneOptions,\n disabled: isDisabled,\n noClick: true,\n onDrop: onDropInterceptor,\n });\n\n const { width } = useResizeObserver({\n ref: dropZoneRef as RefObject<HTMLElement>,\n });\n\n const isUploading = Boolean(loadingElement);\n\n const titleText =\n isDragActive && isDragReject\n ? 'Format not supported'\n : isDragActive && !isDragReject\n ? 'Drop file'\n : null;\n\n const computedFileImage =\n (isDragActive && isDragAccept) || isUploading ? (\n <DocumentArrowUpIconSolid className=\"n-size-token-48 n-text-primary-bg-strong\" />\n ) : (\n <XCircleIconSolid className=\"n-size-token-48 n-text-danger-bg-strong\" />\n );\n\n const wrapperClasses = classNames('ndl-dropzone', className, {\n 'ndl-drag-active': isDragActive,\n 'ndl-drag-disabled': dropZoneOptions?.disabled,\n 'ndl-file-invalid': isDragActive && isDragReject,\n });\n\n useMemo(() => {\n if (isDragActive && isRejected) {\n setIsRejected(false);\n }\n }, [isDragActive, isRejected]);\n\n return (\n <>\n {isRejected && (\n <Banner className=\"ndl-dropzone-error-alert\" variant=\"danger\">\n <Banner.Header>Error</Banner.Header>\n <Banner.Description>\n {Boolean(rejectedText) || 'File extension not supported.'}\n </Banner.Description>\n </Banner>\n )}\n <div\n ref={mergedRef}\n className={wrapperClasses}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-dropzone-inner-wrapper\" {...getRootProps()}>\n <input aria-label=\"Drag and drop area\" {...getInputProps()} />\n <div className=\"ndl-dropzone-inner\">\n {/* Illustration should be visible only after arbitrary width */}\n {width !== undefined && width > 230 && (\n <>\n {isDragActive && !isSafari ? (\n computedFileImage\n ) : (\n <DocumentArrowUpIconOutline className=\"ndl-dropzone-upload-icon\" />\n )}\n </>\n )}\n {!isUploading && (\n <div className=\"ndl-dnd-title-container\">\n <Typography variant=\"subheading-medium\">\n {titleText ||\n (heading ?? (\n <>\n Drag <span className=\"n-font-light\">&</span> Drop\n </>\n ))}\n </Typography>\n {!isDragReject && (\n <div className=\"ndl-dnd-subtitle\">\n <Typography variant=\"body-medium\">or</Typography>{' '}\n <button\n className=\"ndl-dnd-browse-link\"\n onClick={() => open()}\n disabled={isDisabled}\n type=\"button\"\n >\n Browse\n </button>\n </div>\n )}\n </div>\n )}\n <div className=\"ndl-dropzone-footer\">\n {isUploading && <>{loadingElement}</>}\n {!isUploading && (\n <div className=\"ndl-file-support-text\">\n {supportedFilesDescription}\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n </>\n );\n};\n\nconst DropzoneLoadingProgressBarComponent = ({\n progressBarPrecentage,\n progressBarMinute,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneLoadingProgressBarProps>) => {\n return (\n <div className=\"ndl-dropzone-loading-progress-bar-wrapper\">\n <div className=\"ndl-dropzone-loading-progress-bar-indicators\">\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-precentage\"\n variant=\"subheading-small\"\n >\n {`${progressBarPrecentage}%`}\n </Typography>\n {Boolean(progressBarMinute) && (\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-minute\"\n variant=\"body-medium\"\n >{`(${progressBarMinute} minutes left)`}</Typography>\n )}\n </div>\n <ProgressBar\n className={classNames('ndl-dropzone-loading-progress-bar', className)}\n value={progressBarPrecentage}\n size=\"large\"\n htmlAttributes={htmlAttributes}\n ref={ref}\n style={style}\n {...restProps}\n />\n </div>\n );\n};\n\nconst Dropzone = Object.assign(DropzoneComponent, {\n LoadingProgressBar: DropzoneLoadingProgressBarComponent,\n});\n\nexport { Dropzone };\n"]}
1
+ {"version":3,"file":"Dropzone.js","sourceRoot":"","sources":["../../../src/dropzone/Dropzone.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAkB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAIL,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,0BAA0B,EAAE,MAAM,yDAAyD,CAAC;AACrG,OAAO,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAqC3C;;;;;;GAMG;AAEH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;AAEzB,MAAM,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,MAAK,QAAQ,CAAC;AAE5C,MAAM,iBAAiB,GAAG,CAAC,EAYS,EAAE,EAAE;QAZb,EACzB,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,OAAO,EACP,YAAY,EACZ,sBAAsB,EACtB,cAAc,EACd,KAAK,EACL,SAAS,EACT,GAAG,OAE+B,EAD/B,SAAS,cAXa,sKAY1B,CADa;IAEZ;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,SAAS,EAAC,2CAA2C,aACxD,eAAK,SAAS,EAAC,8CAA8C,aAC3D,KAAC,UAAU,IACT,SAAS,EAAC,8CAA8C,EACxD,OAAO,EAAC,kBAAkB,YAEzB,GAAG,qBAAqB,GAAG,GACjB,EACZ,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAC7B,KAAC,UAAU,IACT,SAAS,EAAC,0CAA0C,EACpD,OAAO,EAAC,aAAa,YACrB,IAAI,iBAAiB,gBAAgB,GAAc,CACtD,IACG,EACN,KAAC,WAAW,kBACV,SAAS,EAAE,UAAU,CAAC,mCAAmC,EAAE,SAAS,CAAC,EACrE,KAAK,EAAE,qBAAqB,EAC5B,IAAI,EAAC,OAAO,EACZ,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,IACR,SAAS,EACb,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE;IAChD,kBAAkB,EAAE,mCAAmC;CACxD,CAAC,CAAC;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { useMergeRefs } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { detect } from 'detect-browser';\nimport { type RefObject, useMemo, useRef, useState } from 'react';\nimport {\n type DropEvent,\n type DropzoneOptions,\n type FileRejection,\n useDropzone,\n} from 'react-dropzone';\nimport { useResizeObserver } from 'usehooks-ts';\n\nimport { type CommonProps } from '../_common/types';\nimport { Banner } from '../banner';\nimport { DocumentArrowUpIconOutline } from '../icons/generated/heroIcons/DocumentArrowUpIconOutline';\nimport { DocumentArrowUpIconSolid } from '../icons/generated/heroIcons/DocumentArrowUpIconSolid';\nimport { XCircleIconSolid } from '../icons/generated/heroIcons/XCircleIconSolid';\nimport { ProgressBar } from '../progress-bar';\nimport { Typography } from '../typography';\n\n/**\n *\n *\n * Types\n *\n *\n */\ntype DropzoneProps = {\n /** Props for the underlying `react-dropzone` component. Don't use `accept`. If using custom file extensions as this option is broken. Instead use the `acceptedFileExtensions` property. */\n dropZoneOptions: DropzoneOptions;\n\n /** Informational text that highlights the supported file types, will be displayed in the footer. */\n supportedFilesDescription?: React.ReactNode;\n\n /** Element to display when uploading the file.*/\n loadingElement?: React.ReactNode;\n\n /** Use when wanting a custom heading. */\n heading?: React.ReactNode;\n\n /** Message to be shown when file is rejected. */\n rejectedText?: React.ReactNode;\n\n /** The accepted file extensions for the Drag-and-Drop. */\n acceptedFileExtensions?: string[];\n};\n\ntype DropzoneLoadingProgressBarProps = {\n /** The percentage of the progress bar. */\n progressBarPrecentage: number;\n\n /** The time in minute left to upload the file. */\n progressBarMinute?: number;\n};\n\n/**\n *\n *\n * Helpers\n *\n *\n */\n\nconst browser = detect();\n\nconst isSafari = browser?.name === 'safari';\n\nconst DropzoneComponent = ({\n dropZoneOptions,\n supportedFilesDescription,\n loadingElement,\n heading,\n rejectedText,\n acceptedFileExtensions,\n htmlAttributes,\n style,\n className,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneProps>) => {\n /**\n * We intercept the onDrop function in order to enforce\n * custom file extensions. Before calling the onDrop props we check\n * if the custom file extensions is acceptable. If the extension\n * conforms to acceptedFileExtensions, we call onDrop. Otherwise, we\n * present an error message.\n */\n function onDropInterceptor<T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ) {\n if (acceptedFileExtensions && acceptedFileExtensions.length > 0) {\n for (const file of acceptedFiles) {\n const isAccepted = acceptedFileExtensions.some((extension) => {\n if (file.name.endsWith(extension)) {\n return true;\n }\n });\n if (!isAccepted) {\n setIsRejected(true);\n return;\n }\n }\n }\n setIsRejected(false);\n dropZoneOptions.onDrop?.(acceptedFiles, fileRejections, event);\n }\n\n const [isRejected, setIsRejected] = useState(false);\n const dropZoneRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs([dropZoneRef, ref]);\n const isDisabled = dropZoneOptions?.disabled || Boolean(loadingElement);\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isDragAccept,\n isDragReject,\n open,\n } = useDropzone({\n ...dropZoneOptions,\n disabled: isDisabled,\n noClick: true,\n onDrop: onDropInterceptor,\n });\n\n const { width } = useResizeObserver({\n ref: dropZoneRef as RefObject<HTMLElement>,\n });\n\n const isUploading = Boolean(loadingElement);\n\n const titleText =\n isDragActive && isDragReject\n ? 'Format not supported'\n : isDragActive && !isDragReject\n ? 'Drop file'\n : null;\n\n const computedFileImage =\n (isDragActive && isDragAccept) || isUploading ? (\n <DocumentArrowUpIconSolid className=\"n-size-token-48 n-text-primary-bg-strong\" />\n ) : (\n <XCircleIconSolid className=\"n-size-token-48 n-text-danger-bg-strong\" />\n );\n\n const wrapperClasses = classNames('ndl-dropzone', className, {\n 'ndl-drag-active': isDragActive,\n 'ndl-drag-disabled': dropZoneOptions?.disabled,\n 'ndl-file-invalid': isDragActive && isDragReject,\n });\n\n useMemo(() => {\n if (isDragActive && isRejected) {\n setIsRejected(false);\n }\n }, [isDragActive, isRejected]);\n\n return (\n <>\n {isRejected && (\n <Banner className=\"ndl-dropzone-error-alert\" variant=\"danger\">\n <Banner.Header>Error</Banner.Header>\n <Banner.Description>\n {Boolean(rejectedText) || 'File extension not supported.'}\n </Banner.Description>\n </Banner>\n )}\n <div\n ref={mergedRef}\n className={wrapperClasses}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-dropzone-inner-wrapper\" {...getRootProps()}>\n <input aria-label=\"Drag and drop area\" {...getInputProps()} />\n <div className=\"ndl-dropzone-inner\">\n {/* Illustration should be visible only after arbitrary width */}\n {width !== undefined && width > 230 && (\n <>\n {isDragActive && !isSafari ? (\n computedFileImage\n ) : (\n <DocumentArrowUpIconOutline className=\"ndl-dropzone-upload-icon\" />\n )}\n </>\n )}\n {!isUploading && (\n <div className=\"ndl-dnd-title-container\">\n <Typography variant=\"subheading-medium\">\n {titleText ||\n (heading ?? (\n <>\n Drag <span className=\"n-font-light\">&</span> Drop\n </>\n ))}\n </Typography>\n {!isDragReject && (\n <div className=\"ndl-dnd-subtitle\">\n <Typography variant=\"body-medium\">or</Typography>{' '}\n <button\n className=\"ndl-dnd-browse-link\"\n onClick={() => open()}\n disabled={isDisabled}\n type=\"button\"\n >\n Browse\n </button>\n </div>\n )}\n </div>\n )}\n <div className=\"ndl-dropzone-footer\">\n {isUploading && <>{loadingElement}</>}\n {!isUploading && (\n <div className=\"ndl-file-support-text\">\n {supportedFilesDescription}\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n </>\n );\n};\n\nconst DropzoneLoadingProgressBarComponent = ({\n progressBarPrecentage,\n progressBarMinute,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneLoadingProgressBarProps>) => {\n return (\n <div className=\"ndl-dropzone-loading-progress-bar-wrapper\">\n <div className=\"ndl-dropzone-loading-progress-bar-indicators\">\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-precentage\"\n variant=\"subheading-small\"\n >\n {`${progressBarPrecentage}%`}\n </Typography>\n {Boolean(progressBarMinute) && (\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-minute\"\n variant=\"body-medium\"\n >{`(${progressBarMinute} minutes left)`}</Typography>\n )}\n </div>\n <ProgressBar\n className={classNames('ndl-dropzone-loading-progress-bar', className)}\n value={progressBarPrecentage}\n size=\"large\"\n htmlAttributes={htmlAttributes}\n ref={ref}\n style={style}\n {...restProps}\n />\n </div>\n );\n};\n\nconst Dropzone = Object.assign(DropzoneComponent, {\n LoadingProgressBar: DropzoneLoadingProgressBarComponent,\n});\n\nexport { Dropzone };\n"]}
@@ -33,7 +33,10 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
33
33
  import classNames from 'classnames';
34
34
  import React from 'react';
35
35
  import { CleanIconButton } from '../clean-icon-button';
36
- import { ChevronDownIconOutline, ChevronLeftIconOutline, ChevronRightIconOutline, ChevronUpIconOutline, } from '../icons';
36
+ import { ChevronDownIconOutline } from '../icons/generated/heroIcons/ChevronDownIconOutline';
37
+ import { ChevronLeftIconOutline } from '../icons/generated/heroIcons/ChevronLeftIconOutline';
38
+ import { ChevronRightIconOutline } from '../icons/generated/heroIcons/ChevronRightIconOutline';
39
+ import { ChevronUpIconOutline } from '../icons/generated/heroIcons/ChevronUpIconOutline';
37
40
  const CollapsibleButtonWrapper = ({ children, }) => {
38
41
  return _jsx(_Fragment, { children: children });
39
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"IconButtonArray.js","sourceRoot":"","sources":["../../../src/icon-button-array/IconButtonArray.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,UAAU,CAAC;AAyBlB,MAAM,wBAAwB,GAA4C,CAAC,EACzE,QAAQ,GACT,EAAE,EAAE;IACH,OAAO,4BAAG,QAAQ,GAAI,CAAC;AACzB,CAAC,CAAC;AACF,wBAAwB,CAAC,WAAW,GAAG,0BAA0B,CAAC;AAElE,MAAM,CAAC,MAAM,wBAAwB,GA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,CAAC;YACjC,OAAO,WAAW,CAAC,CAAC,CAAC,CACnB,KAAC,uBAAuB,KAAG,CAC5B,CAAC,CAAC,CAAC,CACF,KAAC,sBAAsB,KAAG,CAC3B,CAAC;QACJ,CAAC;QACD,OAAO,WAAW,CAAC,CAAC,CAAC,KAAC,sBAAsB,KAAG,CAAC,CAAC,CAAC,KAAC,oBAAoB,KAAG,CAAC;IAC7E,CAAC,CAAC;IAEF,OAAO,CACL,MAAC,SAAS,kBACR,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,OAAO,EAClB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,IACR,SAAS,EACT,cAAc,eAEjB,YAAY,EACZ,2BAA2B,IAAI,CAC9B,8BACG,CAAC,WAAW,IAAI,2BAA2B,EAC5C,KAAC,eAAe,IACd,OAAO,EAAE,GAAG,EAAE;4BACZ,cAAc,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;wBAClC,CAAC,EACD,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,EACpD,YAAY,EAAE;4BACZ,IAAI,EAAE;gCACJ,2BAA2B,EAAE,IAAI;6BAClC;yBACF,EACD,cAAc,EAAE;4BACd,eAAe,EAAE,CAAC,WAAW;yBAC9B,YAEA,iBAAiB,EAAE,GACJ,IACjB,CACJ,KACS,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,wBAAwB,EAAE;IAC9D,wBAAwB,EAAE,wBAAwB;CACnD,CAAC,CAAC;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport React from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport {\n ChevronDownIconOutline,\n ChevronLeftIconOutline,\n ChevronRightIconOutline,\n ChevronUpIconOutline,\n} from '../icons';\n\n/**\n * Types\n */\ntype IconButtonArrayProps = {\n /** Content displayed in the icon button array */\n children: React.ReactNode;\n /** Orientation of the icon button array */\n orientation?: 'vertical' | 'horizontal';\n /** Whether the icon button array is floating */\n isFloating?: boolean;\n /** Size of the icon button array */\n size?: 'small' | 'medium' | 'large';\n /** Additional class name*/\n className?: string;\n};\n\ntype CollapsibleButtonWrapperProps = {\n /** Icon buttons to be displayed in the collapsible button wrapper */\n children:\n | React.ReactElement<React.ComponentProps<typeof CleanIconButton>>\n | React.ReactElement<React.ComponentProps<typeof CleanIconButton>>[];\n};\n\nconst CollapsibleButtonWrapper: React.FC<CollapsibleButtonWrapperProps> = ({\n children,\n}) => {\n return <>{children}</>;\n};\nCollapsibleButtonWrapper.displayName = 'CollapsibleButtonWrapper';\n\nexport const IconButtonArrayComponent = <T extends React.ElementType = 'div'>({\n children,\n as,\n isFloating = false,\n orientation = 'horizontal',\n size = 'medium',\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, IconButtonArrayProps>) => {\n const [isCollapsed, setIsCollapsed] = React.useState(true);\n\n const classes = classNames('ndl-icon-btn-array', className, {\n 'ndl-array-floating': isFloating,\n 'ndl-col': orientation === 'vertical',\n 'ndl-row': orientation === 'horizontal',\n [`ndl-${size}`]: size,\n });\n\n const Component: React.ElementType = as || 'div';\n\n const childrenArray = React.Children.toArray(\n children,\n ) as React.ReactElement[];\n\n const fixedButtons = childrenArray.filter(\n (child) =>\n !React.isValidElement(child) ||\n (child.type as React.ComponentType).displayName !==\n 'CollapsibleButtonWrapper',\n );\n\n const collapsibleButtonWrapper = childrenArray.find(\n (child) =>\n React.isValidElement(child) &&\n (child.type as React.ComponentType).displayName ===\n 'CollapsibleButtonWrapper',\n );\n\n const collapsibleButtonsWithProps = collapsibleButtonWrapper\n ? (\n collapsibleButtonWrapper as React.ReactElement<CollapsibleButtonWrapperProps>\n ).props.children\n : null;\n\n const renderChevronIcon = () => {\n if (orientation === 'horizontal') {\n return isCollapsed ? (\n <ChevronRightIconOutline />\n ) : (\n <ChevronLeftIconOutline />\n );\n }\n return isCollapsed ? <ChevronDownIconOutline /> : <ChevronUpIconOutline />;\n };\n\n return (\n <Component\n role=\"group\"\n className={classes}\n ref={ref}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {fixedButtons}\n {collapsibleButtonsWithProps && (\n <>\n {!isCollapsed && collapsibleButtonsWithProps}\n <CleanIconButton\n onClick={() => {\n setIsCollapsed((prev) => !prev);\n }}\n size={size}\n description={isCollapsed ? 'Show more' : 'Show less'}\n tooltipProps={{\n root: {\n shouldCloseOnReferenceClick: true,\n },\n }}\n htmlAttributes={{\n 'aria-expanded': !isCollapsed,\n }}\n >\n {renderChevronIcon()}\n </CleanIconButton>\n </>\n )}\n </Component>\n );\n};\n\nconst IconButtonArray = Object.assign(IconButtonArrayComponent, {\n CollapsibleButtonWrapper: CollapsibleButtonWrapper,\n});\n\nexport { IconButtonArray };\n"]}
1
+ {"version":3,"file":"IconButtonArray.js","sourceRoot":"","sources":["../../../src/icon-button-array/IconButtonArray.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,eAAe,EAAE,MA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AAc,EAAE;4BACd,eAAe,EAAE,CAAC,WAAW;yBAC9B,YAEA,iBAAiB,EAAE,GACJ,IACjB,CACJ,KACS,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,wBAAwB,EAAE;IAC9D,wBAAwB,EAAE,wBAAwB;CACnD,CAAC,CAAC;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport React from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ChevronDownIconOutline } from '../icons/generated/heroIcons/ChevronDownIconOutline';\nimport { ChevronLeftIconOutline } from '../icons/generated/heroIcons/ChevronLeftIconOutline';\nimport { ChevronRightIconOutline } from '../icons/generated/heroIcons/ChevronRightIconOutline';\nimport { ChevronUpIconOutline } from '../icons/generated/heroIcons/ChevronUpIconOutline';\n\n/**\n * Types\n */\ntype IconButtonArrayProps = {\n /** Content displayed in the icon button array */\n children: React.ReactNode;\n /** Orientation of the icon button array */\n orientation?: 'vertical' | 'horizontal';\n /** Whether the icon button array is floating */\n isFloating?: boolean;\n /** Size of the icon button array */\n size?: 'small' | 'medium' | 'large';\n /** Additional class name*/\n className?: string;\n};\n\ntype CollapsibleButtonWrapperProps = {\n /** Icon buttons to be displayed in the collapsible button wrapper */\n children:\n | React.ReactElement<React.ComponentProps<typeof CleanIconButton>>\n | React.ReactElement<React.ComponentProps<typeof CleanIconButton>>[];\n};\n\nconst CollapsibleButtonWrapper: React.FC<CollapsibleButtonWrapperProps> = ({\n children,\n}) => {\n return <>{children}</>;\n};\nCollapsibleButtonWrapper.displayName = 'CollapsibleButtonWrapper';\n\nexport const IconButtonArrayComponent = <T extends React.ElementType = 'div'>({\n children,\n as,\n isFloating = false,\n orientation = 'horizontal',\n size = 'medium',\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, IconButtonArrayProps>) => {\n const [isCollapsed, setIsCollapsed] = React.useState(true);\n\n const classes = classNames('ndl-icon-btn-array', className, {\n 'ndl-array-floating': isFloating,\n 'ndl-col': orientation === 'vertical',\n 'ndl-row': orientation === 'horizontal',\n [`ndl-${size}`]: size,\n });\n\n const Component: React.ElementType = as || 'div';\n\n const childrenArray = React.Children.toArray(\n children,\n ) as React.ReactElement[];\n\n const fixedButtons = childrenArray.filter(\n (child) =>\n !React.isValidElement(child) ||\n (child.type as React.ComponentType).displayName !==\n 'CollapsibleButtonWrapper',\n );\n\n const collapsibleButtonWrapper = childrenArray.find(\n (child) =>\n React.isValidElement(child) &&\n (child.type as React.ComponentType).displayName ===\n 'CollapsibleButtonWrapper',\n );\n\n const collapsibleButtonsWithProps = collapsibleButtonWrapper\n ? (\n collapsibleButtonWrapper as React.ReactElement<CollapsibleButtonWrapperProps>\n ).props.children\n : null;\n\n const renderChevronIcon = () => {\n if (orientation === 'horizontal') {\n return isCollapsed ? (\n <ChevronRightIconOutline />\n ) : (\n <ChevronLeftIconOutline />\n );\n }\n return isCollapsed ? <ChevronDownIconOutline /> : <ChevronUpIconOutline />;\n };\n\n return (\n <Component\n role=\"group\"\n className={classes}\n ref={ref}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {fixedButtons}\n {collapsibleButtonsWithProps && (\n <>\n {!isCollapsed && collapsibleButtonsWithProps}\n <CleanIconButton\n onClick={() => {\n setIsCollapsed((prev) => !prev);\n }}\n size={size}\n description={isCollapsed ? 'Show more' : 'Show less'}\n tooltipProps={{\n root: {\n shouldCloseOnReferenceClick: true,\n },\n }}\n htmlAttributes={{\n 'aria-expanded': !isCollapsed,\n }}\n >\n {renderChevronIcon()}\n </CleanIconButton>\n </>\n )}\n </Component>\n );\n};\n\nconst IconButtonArray = Object.assign(IconButtonArrayComponent, {\n CollapsibleButtonWrapper: CollapsibleButtonWrapper,\n});\n\nexport { IconButtonArray };\n"]}
@@ -45,7 +45,9 @@ import { useFocusWithin } from 'react-aria';
45
45
  import { useSemicontrolledState } from '../_common/use-semi-controlled-state';
46
46
  import { needleWarningMessage, randomId } from '../_common/utils';
47
47
  import { IconButton } from '../icon-button';
48
- import { CheckIconOutline, PencilIconOutline, XMarkIconOutline, } from '../icons';
48
+ import { CheckIconOutline } from '../icons/generated/heroIcons/CheckIconOutline';
49
+ import { PencilIconOutline } from '../icons/generated/heroIcons/PencilIconOutline';
50
+ import { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';
49
51
  import { Typography } from '../typography';
50
52
  import { getIconStyle, getMinHeight } from './utils';
51
53
  // The input should not be less than this (it does shrink if container is smaller though).
@@ -1 +1 @@
1
- {"version":3,"file":"InlineEdit.js","sourceRoot":"","sources":["../../../src/inline-edit/InlineEdit.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAEL,WAAW,EACX,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAM5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EA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C,OAAO,GAAG,IAAI,CAAC;oCAC/B,CAAC;iCACF,YAED,KAAC,gBAAgB,KAAG,GACT,EACb,KAAC,UAAU,IACT,WAAW,EAAC,QAAQ,EACpB,YAAY,EAAE;oCACZ,IAAI,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE;iCAC9B,EACD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,EAC1C,IAAI,EAAC,OAAO,EACZ,UAAU,EAAE,IAAI,EAChB,cAAc,EAAE;oCACd,WAAW,EAAE,GAAG,EAAE;wCAChB,aAAa,CAAC,OAAO,GAAG,IAAI,CAAC;oCAC/B,CAAC;iCACF,YAED,KAAC,gBAAgB,KAAG,GACT,IACT,KACF,CACP,CAAC,CAAC,CAAC,CACF,kBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,UAAU,CAAC,2BAA2B,EAAE;oBACjD,4BAA4B,EAAE,WAAW,KAAK,WAAW;oBACzD,cAAc,EAAE,UAAU;oBAC1B,mBAAmB,EAAE,WAAW;iBACjC,CAAC,mBACa,UAAU,gBACb,eAAe,EAC3B,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE;oBACL,SAAS,EAAE,YAAY,CAAC,iBAAiB,CAAC;iBAC3C,aAED,eAAM,SAAS,EAAC,sBAAsB,YAAE,WAAW,GAAQ,EAC1D,WAAW,IAAI,CACd,KAAC,iBAAiB,IAChB,SAAS,EAAC,6BAA6B,EACvC,KAAK,EAAE,YAAY,CAAC,iBAAiB,CAAC,GACtC,CACH,IACM,CACV,KACU,CACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\nimport {\n type ReactNode,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useFocusWithin } from 'react-aria';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { useSemicontrolledState } from '../_common/use-semi-controlled-state';\nimport { needleWarningMessage, randomId } from '../_common/utils';\nimport { IconButton } from '../icon-button';\nimport {\n CheckIconOutline,\n PencilIconOutline,\n XMarkIconOutline,\n} from '../icons';\nimport { Typography } from '../typography';\nimport { type TypographyVariants } from '../typography';\nimport { getIconStyle, getMinHeight } from './utils';\n\ntype InlineEditProps = {\n /** Label text */\n label?: ReactNode;\n\n /**\n * The typographyVariant of the component applied to Typography as its variant.\n * @default subheading-medium\n */\n typographyVariant?: TypographyVariants;\n\n /**\n * The default input value. Use for an uncontrolled component.\n */\n defaultValue?: string;\n\n /**\n * The input value. Makes the component controlled.\n */\n value?: string;\n\n /**\n * Callback when the input value changes. Must be used when the component is controlled.\n */\n onChange?: (value: string) => void;\n\n /**\n * Placeholder text displayed when the input is empty.\n */\n placeholder: string;\n\n /**\n * @default false\n */\n isDisabled?: boolean;\n\n /**\n * If edit pencil icon should be visible on hover\n * @default false\n */\n hasEditIcon?: boolean;\n\n /**\n * If the input is in editing mode\n * Used in a stateless inline edit\n * @default undefined\n */\n isEditing?: boolean;\n\n /** Callback when confirm icon button is pressed */\n onConfirm?: (\n value: string,\n event?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n\n /** Callback when cancel icon button is pressed */\n onCancel?: (\n event?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n\n /**\n * What the input should do on blur\n * - \"confirm\" will confirm the value\n * - \"cancel\" will cancel the value\n * - \"none\" will do nothing\n * @default \"confirm\"\n */\n blurBehavior?: 'confirm' | 'cancel' | 'none';\n\n /** props applied to the internal input element */\n inputProps?: HtmlAttributes<'input'>;\n\n /**\n * If the input is fluid\n * @default false\n */\n isFluid?: boolean;\n};\n\n// The input should not be less than this (it does shrink if container is smaller though).\nconst MINIMUM_WIDTH = 320;\n\nexport const InlineEdit = <T extends React.ElementType = 'div'>({\n as,\n className,\n defaultValue,\n htmlAttributes,\n label,\n onChange,\n onCancel,\n onConfirm,\n ref,\n style,\n value,\n hasEditIcon = false,\n inputProps,\n isDisabled = false,\n isEditing,\n blurBehavior = 'confirm',\n isFluid = false,\n typographyVariant = 'subheading-medium',\n placeholder,\n ...restProps\n}: PolymorphicCommonProps<T, InlineEditProps>) => {\n const [hasEditMode, setEditMode] = useState(false);\n\n const [currentValue, setCurrentValue] = useSemicontrolledState({\n isControlled: value !== undefined,\n onChange,\n state: value ?? defaultValue ?? '',\n });\n const [previousConfirmedValue, setPreviousConfirmedValue] =\n useState(currentValue);\n\n const mirrorRef = useRef<HTMLSpanElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n /**\n * This ref is used to prevent the blur behavior from being triggered on mouse down events\n * on the confirm and cancel buttons. So when true, the blur behavior is not triggered.\n * This is needed due to Webkit browsers (like Safari) triggering blur on mouse down events.\n *\n * It is also used to prevent the blur behavior from being triggered after the component exits edit mode without blur.\n * This bug caused the handler to be called when something was focused after confirming.\n */\n const blurWithinRef = useRef(false);\n\n // Validate controlled mode requirements\n useEffect(() => {\n if (value !== undefined && onChange === undefined) {\n needleWarningMessage(\n 'onChange prop should be supplied when using controlled mode (value prop is provided).',\n );\n }\n }, [value, onChange]);\n\n const { focusWithinProps } = useFocusWithin({\n onBlurWithin: () => {\n if (blurWithinRef.current) {\n return;\n }\n\n if (blurBehavior === 'confirm') {\n onConfirmHandler();\n return;\n }\n if (blurBehavior === 'cancel') {\n onCancelHandler();\n return;\n }\n },\n });\n\n const resetToDefaults = useCallback(() => {\n // In controlled mode, don't reset the value - let the parent manage it\n // In uncontrolled mode, reset to default value\n if (value === undefined) {\n setCurrentValue(previousConfirmedValue ?? '');\n }\n // Only reset edit mode if isEditing is not controlled (undefined)\n if (isEditing === undefined) {\n blurWithinRef.current = true;\n setEditMode(false);\n }\n }, [previousConfirmedValue, isEditing, setCurrentValue, value]);\n\n const resetEditState = useCallback(() => {\n // Only reset edit mode if isEditing is not controlled (undefined)\n if (isEditing === undefined) {\n blurWithinRef.current = true;\n setEditMode(false);\n }\n }, [isEditing]);\n\n const onConfirmHandler = useCallback(\n async (\n event?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => {\n setPreviousConfirmedValue(currentValue);\n onConfirm?.(currentValue, event);\n resetEditState();\n },\n [onConfirm, currentValue, resetEditState],\n );\n\n const onCancelHandler = useCallback(\n (\n event?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => {\n onCancel?.(event);\n resetToDefaults();\n },\n [onCancel, resetToDefaults],\n );\n\n const inputID = useMemo(() => {\n return inputProps?.id ?? randomId(12);\n }, [inputProps?.id]);\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (['Enter', 'Escape'].includes(e.key)) {\n if (e.key === 'Enter') {\n onConfirmHandler();\n }\n if (e.key === 'Escape') {\n onCancelHandler();\n }\n e.preventDefault();\n e.stopPropagation();\n }\n },\n [onConfirmHandler, onCancelHandler],\n );\n\n const handleInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n setCurrentValue(newValue);\n },\n [setCurrentValue],\n );\n\n const isInEditMode = isEditing ?? hasEditMode;\n\n const handleEditClick = useCallback(() => {\n if (isDisabled === false) {\n setEditMode(true);\n blurWithinRef.current = false;\n }\n }, [isDisabled]);\n\n const updateInputWidth = useCallback(() => {\n if (mirrorRef.current && containerRef.current && !isFluid) {\n const mirrorWidth = mirrorRef.current.offsetWidth;\n const newWidth = Math.max(mirrorWidth, MINIMUM_WIDTH);\n containerRef.current.style.width = `${newWidth}px`;\n }\n }, [mirrorRef, containerRef, isFluid]);\n\n // Width calculation effect\n useLayoutEffect(() => {\n updateInputWidth();\n }, [updateInputWidth, isInEditMode, currentValue]);\n\n const displayText = currentValue || placeholder;\n const buttonAriaLabel = `${displayText}, edit`;\n\n return (\n <Typography\n as={as ?? 'div'}\n variant={typographyVariant}\n className={classNames('ndl-inline-edit', className, {\n 'ndl-disabled': isDisabled,\n 'ndl-fluid': isFluid,\n })}\n style={style}\n ref={ref}\n htmlAttributes={htmlAttributes}\n {...restProps}\n >\n {Boolean(label) && <label htmlFor={inputID}>{label}</label>}\n {isInEditMode === true ? (\n <div\n className=\"ndl-inline-edit-container\"\n ref={containerRef}\n {...focusWithinProps}\n >\n {/* Mirror span for measuring width */}\n <span\n aria-hidden={true}\n className=\"ndl-inline-edit-mirror\"\n ref={mirrorRef}\n >\n {displayText}\n </span>\n <input\n {...inputProps}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n // TODO v5: use ariaLabel variable\n aria-label={typeof label === 'string' ? label : 'Inline edit input'}\n className={classNames(\n 'ndl-inline-edit-input',\n inputProps?.className,\n )}\n id={inputID}\n value={currentValue}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n />\n <div className=\"ndl-inline-edit-buttons\">\n <IconButton\n description=\"Accept\"\n tooltipProps={{\n root: { placement: 'bottom' },\n }}\n onClick={onConfirmHandler}\n size=\"small\"\n isFloating={true}\n htmlAttributes={{\n onMouseDown: () => {\n blurWithinRef.current = true;\n },\n }}\n >\n <CheckIconOutline />\n </IconButton>\n <IconButton\n description=\"Cancel\"\n tooltipProps={{\n root: { placement: 'bottom' },\n }}\n onClick={(event) => onCancelHandler(event)}\n size=\"small\"\n isFloating={true}\n htmlAttributes={{\n onMouseDown: () => {\n blurWithinRef.current = true;\n },\n }}\n >\n <XMarkIconOutline />\n </IconButton>\n </div>\n </div>\n ) : (\n <button\n type=\"button\"\n className={classNames('ndl-inline-idle-container', {\n 'n-text-neutral-text-weaker': displayText === placeholder,\n 'ndl-disabled': isDisabled,\n 'ndl-has-edit-icon': hasEditIcon,\n })}\n aria-disabled={isDisabled}\n aria-label={buttonAriaLabel}\n disabled={isDisabled}\n onClick={handleEditClick}\n style={{\n minHeight: getMinHeight(typographyVariant),\n }}\n >\n <span className=\"ndl-inline-edit-text\">{displayText}</span>\n {hasEditIcon && (\n <PencilIconOutline\n className=\"ndl-inline-edit-pencil-icon\"\n style={getIconStyle(typographyVariant)}\n />\n )}\n </button>\n )}\n </Typography>\n );\n};\n"]}
1
+ {"version":3,"file":"InlineEdit.js","sourceRoot":"","sources":["../../../src/inline-edit/InlineEdit.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAEL,WAAW,EACX,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAM5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAA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,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,EAC1C,IAAI,EAAC,OAAO,EACZ,UAAU,EAAE,IAAI,EAChB,cAAc,EAAE;oCACd,WAAW,EAAE,GAAG,EAAE;wCAChB,aAAa,CAAC,OAAO,GAAG,IAAI,CAAC;oCAC/B,CAAC;iCACF,YAED,KAAC,gBAAgB,KAAG,GACT,IACT,KACF,CACP,CAAC,CAAC,CAAC,CACF,kBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,UAAU,CAAC,2BAA2B,EAAE;oBACjD,4BAA4B,EAAE,WAAW,KAAK,WAAW;oBACzD,cAAc,EAAE,UAAU;oBAC1B,mBAAmB,EAAE,WAAW;iBACjC,CAAC,mBACa,UAAU,gBACb,eAAe,EAC3B,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE;oBACL,SAAS,EAAE,YAAY,CAAC,iBAAiB,CAAC;iBAC3C,aAED,eAAM,SAAS,EAAC,sBAAsB,YAAE,WAAW,GAAQ,EAC1D,WAAW,IAAI,CACd,KAAC,iBAAiB,IAChB,SAAS,EAAC,6BAA6B,EACvC,KAAK,EAAE,YAAY,CAAC,iBAAiB,CAAC,GACtC,CACH,IACM,CACV,KACU,CACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\nimport {\n type ReactNode,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useFocusWithin } from 'react-aria';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { useSemicontrolledState } from '../_common/use-semi-controlled-state';\nimport { needleWarningMessage, randomId } from '../_common/utils';\nimport { IconButton } from '../icon-button';\nimport { CheckIconOutline } from '../icons/generated/heroIcons/CheckIconOutline';\nimport { PencilIconOutline } from '../icons/generated/heroIcons/PencilIconOutline';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { Typography } from '../typography';\nimport { type TypographyVariants } from '../typography';\nimport { getIconStyle, getMinHeight } from './utils';\n\ntype InlineEditProps = {\n /** Label text */\n label?: ReactNode;\n\n /**\n * The typographyVariant of the component applied to Typography as its variant.\n * @default subheading-medium\n */\n typographyVariant?: TypographyVariants;\n\n /**\n * The default input value. Use for an uncontrolled component.\n */\n defaultValue?: string;\n\n /**\n * The input value. Makes the component controlled.\n */\n value?: string;\n\n /**\n * Callback when the input value changes. Must be used when the component is controlled.\n */\n onChange?: (value: string) => void;\n\n /**\n * Placeholder text displayed when the input is empty.\n */\n placeholder: string;\n\n /**\n * @default false\n */\n isDisabled?: boolean;\n\n /**\n * If edit pencil icon should be visible on hover\n * @default false\n */\n hasEditIcon?: boolean;\n\n /**\n * If the input is in editing mode\n * Used in a stateless inline edit\n * @default undefined\n */\n isEditing?: boolean;\n\n /** Callback when confirm icon button is pressed */\n onConfirm?: (\n value: string,\n event?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n\n /** Callback when cancel icon button is pressed */\n onCancel?: (\n event?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n\n /**\n * What the input should do on blur\n * - \"confirm\" will confirm the value\n * - \"cancel\" will cancel the value\n * - \"none\" will do nothing\n * @default \"confirm\"\n */\n blurBehavior?: 'confirm' | 'cancel' | 'none';\n\n /** props applied to the internal input element */\n inputProps?: HtmlAttributes<'input'>;\n\n /**\n * If the input is fluid\n * @default false\n */\n isFluid?: boolean;\n};\n\n// The input should not be less than this (it does shrink if container is smaller though).\nconst MINIMUM_WIDTH = 320;\n\nexport const InlineEdit = <T extends React.ElementType = 'div'>({\n as,\n className,\n defaultValue,\n htmlAttributes,\n label,\n onChange,\n onCancel,\n onConfirm,\n ref,\n style,\n value,\n hasEditIcon = false,\n inputProps,\n isDisabled = false,\n isEditing,\n blurBehavior = 'confirm',\n isFluid = false,\n typographyVariant = 'subheading-medium',\n placeholder,\n ...restProps\n}: PolymorphicCommonProps<T, InlineEditProps>) => {\n const [hasEditMode, setEditMode] = useState(false);\n\n const [currentValue, setCurrentValue] = useSemicontrolledState({\n isControlled: value !== undefined,\n onChange,\n state: value ?? defaultValue ?? '',\n });\n const [previousConfirmedValue, setPreviousConfirmedValue] =\n useState(currentValue);\n\n const mirrorRef = useRef<HTMLSpanElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n /**\n * This ref is used to prevent the blur behavior from being triggered on mouse down events\n * on the confirm and cancel buttons. So when true, the blur behavior is not triggered.\n * This is needed due to Webkit browsers (like Safari) triggering blur on mouse down events.\n *\n * It is also used to prevent the blur behavior from being triggered after the component exits edit mode without blur.\n * This bug caused the handler to be called when something was focused after confirming.\n */\n const blurWithinRef = useRef(false);\n\n // Validate controlled mode requirements\n useEffect(() => {\n if (value !== undefined && onChange === undefined) {\n needleWarningMessage(\n 'onChange prop should be supplied when using controlled mode (value prop is provided).',\n );\n }\n }, [value, onChange]);\n\n const { focusWithinProps } = useFocusWithin({\n onBlurWithin: () => {\n if (blurWithinRef.current) {\n return;\n }\n\n if (blurBehavior === 'confirm') {\n onConfirmHandler();\n return;\n }\n if (blurBehavior === 'cancel') {\n onCancelHandler();\n return;\n }\n },\n });\n\n const resetToDefaults = useCallback(() => {\n // In controlled mode, don't reset the value - let the parent manage it\n // In uncontrolled mode, reset to default value\n if (value === undefined) {\n setCurrentValue(previousConfirmedValue ?? '');\n }\n // Only reset edit mode if isEditing is not controlled (undefined)\n if (isEditing === undefined) {\n blurWithinRef.current = true;\n setEditMode(false);\n }\n }, [previousConfirmedValue, isEditing, setCurrentValue, value]);\n\n const resetEditState = useCallback(() => {\n // Only reset edit mode if isEditing is not controlled (undefined)\n if (isEditing === undefined) {\n blurWithinRef.current = true;\n setEditMode(false);\n }\n }, [isEditing]);\n\n const onConfirmHandler = useCallback(\n async (\n event?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => {\n setPreviousConfirmedValue(currentValue);\n onConfirm?.(currentValue, event);\n resetEditState();\n },\n [onConfirm, currentValue, resetEditState],\n );\n\n const onCancelHandler = useCallback(\n (\n event?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => {\n onCancel?.(event);\n resetToDefaults();\n },\n [onCancel, resetToDefaults],\n );\n\n const inputID = useMemo(() => {\n return inputProps?.id ?? randomId(12);\n }, [inputProps?.id]);\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (['Enter', 'Escape'].includes(e.key)) {\n if (e.key === 'Enter') {\n onConfirmHandler();\n }\n if (e.key === 'Escape') {\n onCancelHandler();\n }\n e.preventDefault();\n e.stopPropagation();\n }\n },\n [onConfirmHandler, onCancelHandler],\n );\n\n const handleInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n setCurrentValue(newValue);\n },\n [setCurrentValue],\n );\n\n const isInEditMode = isEditing ?? hasEditMode;\n\n const handleEditClick = useCallback(() => {\n if (isDisabled === false) {\n setEditMode(true);\n blurWithinRef.current = false;\n }\n }, [isDisabled]);\n\n const updateInputWidth = useCallback(() => {\n if (mirrorRef.current && containerRef.current && !isFluid) {\n const mirrorWidth = mirrorRef.current.offsetWidth;\n const newWidth = Math.max(mirrorWidth, MINIMUM_WIDTH);\n containerRef.current.style.width = `${newWidth}px`;\n }\n }, [mirrorRef, containerRef, isFluid]);\n\n // Width calculation effect\n useLayoutEffect(() => {\n updateInputWidth();\n }, [updateInputWidth, isInEditMode, currentValue]);\n\n const displayText = currentValue || placeholder;\n const buttonAriaLabel = `${displayText}, edit`;\n\n return (\n <Typography\n as={as ?? 'div'}\n variant={typographyVariant}\n className={classNames('ndl-inline-edit', className, {\n 'ndl-disabled': isDisabled,\n 'ndl-fluid': isFluid,\n })}\n style={style}\n ref={ref}\n htmlAttributes={htmlAttributes}\n {...restProps}\n >\n {Boolean(label) && <label htmlFor={inputID}>{label}</label>}\n {isInEditMode === true ? (\n <div\n className=\"ndl-inline-edit-container\"\n ref={containerRef}\n {...focusWithinProps}\n >\n {/* Mirror span for measuring width */}\n <span\n aria-hidden={true}\n className=\"ndl-inline-edit-mirror\"\n ref={mirrorRef}\n >\n {displayText}\n </span>\n <input\n {...inputProps}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n // TODO v5: use ariaLabel variable\n aria-label={typeof label === 'string' ? label : 'Inline edit input'}\n className={classNames(\n 'ndl-inline-edit-input',\n inputProps?.className,\n )}\n id={inputID}\n value={currentValue}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n />\n <div className=\"ndl-inline-edit-buttons\">\n <IconButton\n description=\"Accept\"\n tooltipProps={{\n root: { placement: 'bottom' },\n }}\n onClick={onConfirmHandler}\n size=\"small\"\n isFloating={true}\n htmlAttributes={{\n onMouseDown: () => {\n blurWithinRef.current = true;\n },\n }}\n >\n <CheckIconOutline />\n </IconButton>\n <IconButton\n description=\"Cancel\"\n tooltipProps={{\n root: { placement: 'bottom' },\n }}\n onClick={(event) => onCancelHandler(event)}\n size=\"small\"\n isFloating={true}\n htmlAttributes={{\n onMouseDown: () => {\n blurWithinRef.current = true;\n },\n }}\n >\n <XMarkIconOutline />\n </IconButton>\n </div>\n </div>\n ) : (\n <button\n type=\"button\"\n className={classNames('ndl-inline-idle-container', {\n 'n-text-neutral-text-weaker': displayText === placeholder,\n 'ndl-disabled': isDisabled,\n 'ndl-has-edit-icon': hasEditIcon,\n })}\n aria-disabled={isDisabled}\n aria-label={buttonAriaLabel}\n disabled={isDisabled}\n onClick={handleEditClick}\n style={{\n minHeight: getMinHeight(typographyVariant),\n }}\n >\n <span className=\"ndl-inline-edit-text\">{displayText}</span>\n {hasEditIcon && (\n <PencilIconOutline\n className=\"ndl-inline-edit-pencil-icon\"\n style={getIconStyle(typographyVariant)}\n />\n )}\n </button>\n )}\n </Typography>\n );\n};\n"]}
@@ -36,7 +36,8 @@ import { createContext, useCallback, useContext, useEffect, useId, useRef, useSt
36
36
  import { ConditionalWrap } from '../conditional-wrap';
37
37
  import { useIsInsideDialog } from '../dialog/dialog-context';
38
38
  import { Divider } from '../divider';
39
- import { CheckIconOutline, ChevronRightIconOutline } from '../icons';
39
+ import { CheckIconOutline } from '../icons/generated/heroIcons/CheckIconOutline';
40
+ import { ChevronRightIconOutline } from '../icons/generated/heroIcons/ChevronRightIconOutline';
40
41
  import { placementTranslation } from '../popover';
41
42
  import { useNeedleTheme } from '../theme';
42
43
  const MenuContext = createContext({