@neo4j-ndl/react 5.6.4 → 6.0.0-alpha.0.d77a467

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 (118) 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/preview/Preview.js +1 -1
  4. package/lib/cjs/ai/preview/Preview.js.map +1 -1
  5. package/lib/cjs/ai/reasoning/Reasoning.js +2 -2
  6. package/lib/cjs/ai/reasoning/Reasoning.js.map +1 -1
  7. package/lib/cjs/ai/thinking/Thinking.js +2 -2
  8. package/lib/cjs/ai/thinking/Thinking.js.map +1 -1
  9. package/lib/cjs/avatar/Avatar.js +1 -1
  10. package/lib/cjs/avatar/Avatar.js.map +1 -1
  11. package/lib/cjs/banner/Banner.js +1 -1
  12. package/lib/cjs/banner/Banner.js.map +1 -1
  13. package/lib/cjs/data-grid/Components.js +1 -1
  14. package/lib/cjs/data-grid/Components.js.map +1 -1
  15. package/lib/cjs/date-picker/DatePicker.js +2 -2
  16. package/lib/cjs/date-picker/DatePicker.js.map +1 -1
  17. package/lib/cjs/dialog/Dialog.js +1 -1
  18. package/lib/cjs/dialog/Dialog.js.map +1 -1
  19. package/lib/cjs/drawer/Drawer.js +1 -1
  20. package/lib/cjs/drawer/Drawer.js.map +1 -1
  21. package/lib/cjs/dropzone/Dropzone.js +2 -2
  22. package/lib/cjs/dropzone/Dropzone.js.map +1 -1
  23. package/lib/cjs/icons/index.js +1 -1
  24. package/lib/cjs/index.js +4 -2
  25. package/lib/cjs/index.js.map +1 -1
  26. package/lib/cjs/inline-edit/InlineEdit.js +1 -1
  27. package/lib/cjs/inline-edit/InlineEdit.js.map +1 -1
  28. package/lib/cjs/inline-edit/utils.js +2 -4
  29. package/lib/cjs/inline-edit/utils.js.map +1 -1
  30. package/lib/cjs/search-field/SearchField.js +94 -0
  31. package/lib/cjs/search-field/SearchField.js.map +1 -0
  32. package/lib/cjs/search-field/index.js +30 -0
  33. package/lib/cjs/search-field/index.js.map +1 -0
  34. package/lib/cjs/side-navigation/SideNavigation.js +2 -2
  35. package/lib/cjs/side-navigation/SideNavigation.js.map +1 -1
  36. package/lib/cjs/spotlight/Spotlight.js +1 -1
  37. package/lib/cjs/spotlight/Spotlight.js.map +1 -1
  38. package/lib/cjs/tabs/Tabs.js +1 -1
  39. package/lib/cjs/tabs/Tabs.js.map +1 -1
  40. package/lib/cjs/text-input/TextInput.js +1 -1
  41. package/lib/cjs/text-input/TextInput.js.map +1 -1
  42. package/lib/cjs/tooltip/Tooltip.js +1 -1
  43. package/lib/cjs/tooltip/Tooltip.js.map +1 -1
  44. package/lib/cjs/tree-view/TreeViewTextItem.js +1 -1
  45. package/lib/cjs/tree-view/TreeViewTextItem.js.map +1 -1
  46. package/lib/esm/accordion/Accordion.mjs +2 -2
  47. package/lib/esm/accordion/Accordion.mjs.map +1 -1
  48. package/lib/esm/ai/preview/Preview.mjs +1 -1
  49. package/lib/esm/ai/preview/Preview.mjs.map +1 -1
  50. package/lib/esm/ai/reasoning/Reasoning.mjs +2 -2
  51. package/lib/esm/ai/reasoning/Reasoning.mjs.map +1 -1
  52. package/lib/esm/ai/thinking/Thinking.mjs +2 -2
  53. package/lib/esm/ai/thinking/Thinking.mjs.map +1 -1
  54. package/lib/esm/avatar/Avatar.mjs +1 -1
  55. package/lib/esm/avatar/Avatar.mjs.map +1 -1
  56. package/lib/esm/banner/Banner.mjs +1 -1
  57. package/lib/esm/banner/Banner.mjs.map +1 -1
  58. package/lib/esm/data-grid/Components.mjs +1 -1
  59. package/lib/esm/data-grid/Components.mjs.map +1 -1
  60. package/lib/esm/date-picker/DatePicker.mjs +2 -2
  61. package/lib/esm/date-picker/DatePicker.mjs.map +1 -1
  62. package/lib/esm/dialog/Dialog.mjs +1 -1
  63. package/lib/esm/dialog/Dialog.mjs.map +1 -1
  64. package/lib/esm/drawer/Drawer.mjs +1 -1
  65. package/lib/esm/drawer/Drawer.mjs.map +1 -1
  66. package/lib/esm/dropzone/Dropzone.mjs +2 -2
  67. package/lib/esm/dropzone/Dropzone.mjs.map +1 -1
  68. package/lib/esm/icons/index.mjs +1 -1
  69. package/lib/esm/index.mjs +4 -3
  70. package/lib/esm/index.mjs.map +1 -1
  71. package/lib/esm/inline-edit/InlineEdit.mjs +1 -1
  72. package/lib/esm/inline-edit/InlineEdit.mjs.map +1 -1
  73. package/lib/esm/inline-edit/utils.mjs +2 -4
  74. package/lib/esm/inline-edit/utils.mjs.map +1 -1
  75. package/lib/esm/search-field/SearchField.mjs +89 -0
  76. package/lib/esm/search-field/SearchField.mjs.map +1 -0
  77. package/lib/esm/search-field/index.mjs +24 -0
  78. package/lib/esm/search-field/index.mjs.map +1 -0
  79. package/lib/esm/side-navigation/SideNavigation.mjs +2 -2
  80. package/lib/esm/side-navigation/SideNavigation.mjs.map +1 -1
  81. package/lib/esm/spotlight/Spotlight.mjs +1 -1
  82. package/lib/esm/spotlight/Spotlight.mjs.map +1 -1
  83. package/lib/esm/tabs/Tabs.mjs +1 -1
  84. package/lib/esm/tabs/Tabs.mjs.map +1 -1
  85. package/lib/esm/text-input/TextInput.mjs +1 -1
  86. package/lib/esm/text-input/TextInput.mjs.map +1 -1
  87. package/lib/esm/tooltip/Tooltip.mjs +1 -1
  88. package/lib/esm/tooltip/Tooltip.mjs.map +1 -1
  89. package/lib/esm/tree-view/TreeViewTextItem.mjs +1 -1
  90. package/lib/esm/tree-view/TreeViewTextItem.mjs.map +1 -1
  91. package/lib/types/ai/thinking/Thinking.d.ts.map +1 -1
  92. package/lib/types/index.d.ts +1 -0
  93. package/lib/types/index.d.ts.map +1 -1
  94. package/lib/types/inline-edit/InlineEdit.d.ts +1 -1
  95. package/lib/types/inline-edit/utils.d.ts.map +1 -1
  96. package/lib/types/search-field/SearchField.d.ts +52 -0
  97. package/lib/types/search-field/SearchField.d.ts.map +1 -0
  98. package/lib/types/search-field/index.d.ts +22 -0
  99. package/lib/types/search-field/index.d.ts.map +1 -0
  100. package/package.json +9 -3
  101. package/skills/ndl-react/SKILL.md +3 -2
  102. package/skills/ndl-react/components/accordion.md +3 -3
  103. package/skills/ndl-react/components/clean-icon-button.md +5 -5
  104. package/skills/ndl-react/components/date-picker.md +2 -2
  105. package/skills/ndl-react/components/dropzone.md +2 -2
  106. package/skills/ndl-react/components/icon-button.md +5 -5
  107. package/skills/ndl-react/components/inline-edit.md +1 -1
  108. package/skills/ndl-react/components/radio.md +1 -1
  109. package/skills/ndl-react/components/search-field.md +254 -0
  110. package/skills/ndl-react/components/select-icon-button.md +6 -6
  111. package/skills/ndl-react/components/side-navigation.md +4 -4
  112. package/skills/ndl-react/components/skeleton.md +3 -3
  113. package/skills/ndl-react/components/status-indicator.md +5 -5
  114. package/skills/ndl-react/components/tabs.md +4 -4
  115. package/skills/ndl-react/components/timezone-picker.md +1 -1
  116. package/skills/ndl-react/components/tooltip.md +1 -1
  117. package/skills/ndl-react/components/typography.md +2 -2
  118. package/skills/ndl-react/references/styling.md +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.js","names":["useCallback","useRef","useState","useFloating","useDismiss","useRole","useInteractions","useMergeRefs","classNames","useMemo","CleanIconButton","XMarkIconOutline","Resizable","FloatingPortal","FloatingOverlay","FloatingFocusManager","ConditionalWrap","Typography"],"sources":["../../../src/drawer/Drawer.tsx"],"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\n/**\n * @remarks\n * Where `ResizableProps` is the props for the `re-resizable` library. For more information, see the [re-resizable documentation](https://github.com/bokuweb/re-resizable).\n *\n * @remarks\n * Where `FloatingPortalProps` is the props for the `@floating-ui/react` library. For more information, see the [FloatingPortal documentation](https://floating-ui.com/docs/floatingportal).\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 /**\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 true.\n * - When type is \"push\", no effect.\n */\n shouldCloseOnEscape?: boolean;\n\n // TODO: 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 shouldCloseOnClickOutside?: 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` is optional on this branch so that omitting it types as 'overlay' which matches the default value and requires `ariaLabel`.\n type?: 'modal' | 'overlay';\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';\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 (event: React.KeyboardEvent<HTMLDivElement>) => {\n const isArrowKey =\n event.key === 'ArrowLeft' || event.key === 'ArrowRight';\n if (isArrowKey) {\n event.preventDefault();\n const delta =\n handleSide === 'right'\n ? event.key === 'ArrowRight'\n ? KEYBOARD_RESIZE_STEP_PX\n : -KEYBOARD_RESIZE_STEP_PX\n : event.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 shouldCloseOnEscape = type === 'push' ? false : true,\n shouldCloseOnClickOutside = 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: shouldCloseOnEscape && type !== 'push',\n outsidePress: shouldCloseOnClickOutside && 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};\n\nconst DrawerHeader = <T extends React.ElementType = 'div'>({\n as,\n children,\n className = '',\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DrawerHeaderProps>) => {\n const classes = classNames('ndl-drawer-header', className);\n const Component: React.ElementType = as ?? 'div';\n\n if (typeof children === 'string' || typeof children === 'number') {\n return (\n <Typography\n as={Component}\n className={classes}\n ref={ref}\n style={style}\n variant=\"title-3\"\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n }\n\n return (\n <Component\n className={classes}\n ref={ref}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgOE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CA4QA;CACA;CACA;CACA;CACA;CACA;;;CA0CA;CACA;CACA;;;CAmBA;CACA;CACA;;AAncF,MA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AO,OAAO,iBAAiB;CAC5C,SAAS;CACT,MAAM;CACN,QAAQ;AACV,CAAC"}
1
+ {"version":3,"file":"Drawer.js","names":["useCallback","useRef","useState","useFloating","useDismiss","useRole","useInteractions","useMergeRefs","classNames","useMemo","CleanIconButton","XMarkIconOutline","Resizable","FloatingPortal","FloatingOverlay","FloatingFocusManager","ConditionalWrap","Typography"],"sources":["../../../src/drawer/Drawer.tsx"],"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\n/**\n * @remarks\n * Where `ResizableProps` is the props for the `re-resizable` library. For more information, see the [re-resizable documentation](https://github.com/bokuweb/re-resizable).\n *\n * @remarks\n * Where `FloatingPortalProps` is the props for the `@floating-ui/react` library. For more information, see the [FloatingPortal documentation](https://floating-ui.com/docs/floatingportal).\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 /**\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 true.\n * - When type is \"push\", no effect.\n */\n shouldCloseOnEscape?: boolean;\n\n // TODO: 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 shouldCloseOnClickOutside?: 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` is optional on this branch so that omitting it types as 'overlay' which matches the default value and requires `ariaLabel`.\n type?: 'modal' | 'overlay';\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';\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 (event: React.KeyboardEvent<HTMLDivElement>) => {\n const isArrowKey =\n event.key === 'ArrowLeft' || event.key === 'ArrowRight';\n if (isArrowKey) {\n event.preventDefault();\n const delta =\n handleSide === 'right'\n ? event.key === 'ArrowRight'\n ? KEYBOARD_RESIZE_STEP_PX\n : -KEYBOARD_RESIZE_STEP_PX\n : event.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 shouldCloseOnEscape = type === 'push' ? false : true,\n shouldCloseOnClickOutside = 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: shouldCloseOnEscape && type !== 'push',\n outsidePress: shouldCloseOnClickOutside && 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};\n\nconst DrawerHeader = <T extends React.ElementType = 'div'>({\n as,\n children,\n className = '',\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DrawerHeaderProps>) => {\n const classes = classNames('ndl-drawer-header', className);\n const Component: React.ElementType = as ?? 'div';\n\n if (typeof children === 'string' || typeof children === 'number') {\n return (\n <Typography\n as={Component}\n className={classes}\n ref={ref}\n style={style}\n variant=\"title-2\"\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n }\n\n return (\n <Component\n className={classes}\n ref={ref}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgOE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CA4QA;CACA;CACA;CACA;CACA;CACA;;;CA0CA;CACA;CACA;;;CAmBA;CACA;CACA;;AAncF,MAAM,0BAA0B;AAEhC,SAAS,eACP,OACoB;CACpB,IAAI,UAAU,KAAA,GACZ;CAEF,IAAI,OAAO,UAAU,UACnB,OAAO;CAET,IAAI,mBAAmB,KAAK,KAAK,GAC/B,OAAO,WAAW,KAAK;AAG3B;AAEA,SAAS,gBACP,OACA,gBACoB;CACpB,IACE,OAAO,UAAU,YACjB,CAAC,MAAM,SAAS,GAAG,KACnB,mBAAmB,KAAA,GAEnB;CAEF,MAAM,UAAU,WAAW,KAAK;CAChC,OAAO,OAAO,MAAM,OAAO,IAAI,KAAA,IAAa,UAAU,MAAO;AAC/D;AAgBA,SAAS,mBAAmB,EAC1B,YACA,YACA,UACA,UACA,YAC0B;CAC1B,MAAM,iBAAA,GAAgBA,MAAAA,YAAAA,EACnB,UAA+C;EAG9C,IADE,MAAM,QAAQ,eAAe,MAAM,QAAQ,cAC7B;GACd,MAAM,eAAe;GASrB,WAPE,eAAe,UACX,MAAM,QAAQ,e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A,QAAAA,CAAW,sBAAsB,SAAS;CAE1D,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAA,sBAAA,QAAA,sBAAA,QAAA,sBAAA,QAAA,EAAI,WAAW,QAAA,GAAa,SAAA,GAAe,cAAA,GAAA,CAAA,GAAA,EACzC,SAAA,CACE,CAAA;AAET;AAQA,MAAM,cAAc,UAKG;CALH,IAAA,EAClB,UACA,YAAY,IACZ,mBAAA,OACG,YAAA,gCAAA,QAAA,OAAA,UAAA;CAEH,MAAM,WAAA,GAAUA,WAAAA,QAAAA,CAAW,mBAAmB,SAAS;CAEvD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EACb,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAA,sBAAA,QAAA,sBAAA,QAAA,sBAAA,QAAA,EAAI,WAAW,QAAA,GAAa,SAAA,GAAe,cAAA,GAAA,CAAA,GAAA,EACzC,SAAA,CACE,CAAA;CACF,CAAA;AAET;AAEA,MAAM,SAAS,OAAO,OAAO,iBAAiB;CAC5C,SAAS;CACT,MAAM;CACN,QAAQ;AACV,CAAC"}
@@ -125,7 +125,7 @@ const DropzoneComponent = (_ref) => {
125
125
  !isUploading && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
126
126
  className: "ndl-dnd-title-container",
127
127
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_typography_Typography.Typography, {
128
- variant: "subheading-medium",
128
+ variant: "subheading-large",
129
129
  children: titleText || (heading !== null && heading !== void 0 ? heading : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
130
130
  "Drag ",
131
131
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -171,7 +171,7 @@ const DropzoneLoadingProgressBarComponent = (_ref2) => {
171
171
  className: "ndl-dropzone-loading-progress-bar-indicators",
172
172
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_typography_Typography.Typography, {
173
173
  className: "ndl-dropzone-loading-progress-bar-precentage",
174
- variant: "subheading-small",
174
+ variant: "subheading-medium",
175
175
  children: `${progressBarPrecentage}%`
176
176
  }), Boolean(progressBarMinute) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_typography_Typography.Typography, {
177
177
  className: "ndl-dropzone-loading-progress-bar-minute",
@@ -1 +1 @@
1
- {"version":3,"file":"Dropzone.js","names":["useState","useRef","useMergeRefs","useDropzone","useResizeObserver","XCircleSolidIcon","DocumentArrowUpSolidIcon","DocumentArrowUpOutlineIcon","classNames","Banner","Typography","ProgressBar"],"sources":["../../../src/dropzone/Dropzone.tsx"],"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 { 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 DocumentArrowUpOutlineIcon from '../icons/generated/custom/DocumentArrowUpOutline';\nimport DocumentArrowUpSolidIcon from '../icons/generated/custom/DocumentArrowUpSolid';\nimport XCircleSolidIcon from '../icons/generated/custom/XCircleSolid';\nimport { ProgressBar } from '../progress-bar';\nimport { Typography } from '../typography';\n\n/**\n *\n *\n * Types\n *\n *\n */\n/**\n * @remarks\n * Where `DropzoneOptions` is the props for the `react-dropzone` library. For more information, see the [react-dropzone documentation](https://react-dropzone.js.org/#src).\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 shown when a file is rejected. Defaults to \"File extension not supported.\" when omitted. */\n rejectedText?: React.ReactNode;\n\n /** The accepted file extensions for the Drag-and-Drop. */\n acceptedFileExtensions?: string[];\n\n /** Whether to display the dashed border around the dropzone. */\n hasBorder?: boolean;\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 DropzoneComponent = ({\n dropZoneOptions,\n supportedFilesDescription,\n loadingElement,\n heading,\n rejectedText,\n acceptedFileExtensions,\n hasBorder = true,\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 file.name.endsWith(extension),\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 files'\n : null;\n\n const activeDragIcon = isDragReject ? (\n <XCircleSolidIcon className=\"ndl-dropzone-drag-icon ndl-rejected\" />\n ) : isDragAccept ? (\n <DocumentArrowUpSolidIcon className=\"ndl-dropzone-drag-icon ndl-accepted\" />\n ) : (\n <DocumentArrowUpOutlineIcon className=\"ndl-dropzone-upload-icon\" />\n );\n\n const wrapperClasses = classNames('ndl-dropzone', className, {\n 'ndl-drag-active': isDragActive,\n 'ndl-drag-disabled': dropZoneOptions?.disabled,\n 'ndl-dropzone-borderless': !hasBorder,\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 {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 ? (\n activeDragIcon\n ) : (\n <DocumentArrowUpOutlineIcon 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=\"ndl-dnd-title-ampersand\">&</span>{' '}\n Drop\n </>\n ))}\n </Typography>\n {!isDragActive && !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 && !isDragActive && (\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: DropzoneLo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A,kBAAA,KAAA,CAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,eAAe,iBAAA,GAAA,kBAAA,IAAA,CAAA,kBAAA,UAAA,EAAA,UAAG,eAAiB,CAAA,GACnC,CAAC,eAAe,CAAC,gBAChB,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;KAAK,WAAU;KACZ,UAAA;IACE,CAAA,CAEJ;;EACF;CACF,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CACF,CAAA,CACL,EAAA,CAAA;AAEN;AAEA,MAAM,uCAAuC,UAQc;CARd,IAAA,EAC3C,uBACA,mBACA,gBACA,WACA,OACA,QAAA,OACG,YAAA,gCAAA,QAAA,OAAA,UAAA;CAEH,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,8BAAAA,YAAD;IACE,WAAU;IACV,SAAQ;IAEP,UAAA,GAAG,sBAAsB;GAChB,CAAA,GACX,QAAQ,iBAAiB,KACxB,iBAAA,GAAA,kBAAA,IAAA,CAACA,8BAAAA,YAAD;IACE,WAAU;IACV,SAAQ;IACR,UAAA,IAAI,kBAAkB;GAA4B,CAAA,CAEnD;EACL,CAAA,GAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,iCAAAA,aAAAA,sBAAAA,QAAAA;GACC,YAAA,GAAWH,WAAAA,QAAAA,CAAW,qCAAqC,SAAS;GACpE,OAAO;GACP,MAAK;GACW;GACX;GACE;EACH,GAAA,SACL,CAAA,CACE;;AAET;AAEA,MAAM,WAAW,OAAO,OAAO,mBAAmB,EAChD,oBAAoB,oCACtB,CAAC"}
1
+ {"version":3,"file":"Dropzone.js","names":["useState","useRef","useMergeRefs","useDropzone","useResizeObserver","XCircleSolidIcon","DocumentArrowUpSolidIcon","DocumentArrowUpOutlineIcon","classNames","Banner","Typography","ProgressBar"],"sources":["../../../src/dropzone/Dropzone.tsx"],"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 { 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 DocumentArrowUpOutlineIcon from '../icons/generated/custom/DocumentArrowUpOutline';\nimport DocumentArrowUpSolidIcon from '../icons/generated/custom/DocumentArrowUpSolid';\nimport XCircleSolidIcon from '../icons/generated/custom/XCircleSolid';\nimport { ProgressBar } from '../progress-bar';\nimport { Typography } from '../typography';\n\n/**\n *\n *\n * Types\n *\n *\n */\n/**\n * @remarks\n * Where `DropzoneOptions` is the props for the `react-dropzone` library. For more information, see the [react-dropzone documentation](https://react-dropzone.js.org/#src).\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 shown when a file is rejected. Defaults to \"File extension not supported.\" when omitted. */\n rejectedText?: React.ReactNode;\n\n /** The accepted file extensions for the Drag-and-Drop. */\n acceptedFileExtensions?: string[];\n\n /** Whether to display the dashed border around the dropzone. */\n hasBorder?: boolean;\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 DropzoneComponent = ({\n dropZoneOptions,\n supportedFilesDescription,\n loadingElement,\n heading,\n rejectedText,\n acceptedFileExtensions,\n hasBorder = true,\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 file.name.endsWith(extension),\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 files'\n : null;\n\n const activeDragIcon = isDragReject ? (\n <XCircleSolidIcon className=\"ndl-dropzone-drag-icon ndl-rejected\" />\n ) : isDragAccept ? (\n <DocumentArrowUpSolidIcon className=\"ndl-dropzone-drag-icon ndl-accepted\" />\n ) : (\n <DocumentArrowUpOutlineIcon className=\"ndl-dropzone-upload-icon\" />\n );\n\n const wrapperClasses = classNames('ndl-dropzone', className, {\n 'ndl-drag-active': isDragActive,\n 'ndl-drag-disabled': dropZoneOptions?.disabled,\n 'ndl-dropzone-borderless': !hasBorder,\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 {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 ? (\n activeDragIcon\n ) : (\n <DocumentArrowUpOutlineIcon className=\"ndl-dropzone-upload-icon\" />\n )}\n </>\n )}\n {!isUploading && (\n <div className=\"ndl-dnd-title-container\">\n <Typography variant=\"subheading-large\">\n {titleText ||\n (heading ?? (\n <>\n Drag <span className=\"ndl-dnd-title-ampersand\">&</span>{' '}\n Drop\n </>\n ))}\n </Typography>\n {!isDragActive && !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 && !isDragActive && (\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-medium\"\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0FE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CA2JA;CACA;CACA;CACA;CACA;CACA;;;;;;;;;AA3KF,MAAM,qBAAqB,SAac;CAbd,IAAA,EACzB,iBACA,2BACA,gBACA,SACA,cACA,wBACA,YAAY,MACZ,gBACA,OACA,WACA,QAAA,MACG,YAAA,gCAAA,QAAA,MAAA,SAAA;;;;;;;;CASH,S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,IAAA,EAC3C,uBACA,mBACA,gBACA,WACA,OACA,QAAA,OACG,YAAA,gCAAA,QAAA,OAAA,UAAA;CAEH,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,8BAAAA,YAAD;IACE,WAAU;IACV,SAAQ;IAEP,UAAA,GAAG,sBAAsB;GAChB,CAAA,GACX,QAAQ,iBAAiB,KACxB,iBAAA,GAAA,kBAAA,IAAA,CAACA,8BAAAA,YAAD;IACE,WAAU;IACV,SAAQ;IACR,UAAA,IAAI,kBAAkB;GAA4B,CAAA,CAEnD;EACL,CAAA,GAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,iCAAAA,aAAAA,sBAAAA,QAAAA;GACC,YAAA,GAAWH,WAAAA,QAAAA,CAAW,qCAAqC,SAAS;GACpE,OAAO;GACP,MAAK;GACW;GACX;GACE;EACH,GAAA,SACL,CAAA,CACE;;AAET;AAEA,MAAM,WAAW,OAAO,OAAO,mBAAmB,EAChD,oBAAoB,oCACtB,CAAC"}
@@ -34,6 +34,7 @@ const require_icons_generated_heroIcons_BarsArrowUpIconOutline = require("./gene
34
34
  const require_icons_generated_heroIcons_ChevronDownIconSolid = require("./generated/heroIcons/ChevronDownIconSolid.js");
35
35
  const require_icons_generated_heroIcons_ChevronLeftIconOutline = require("./generated/heroIcons/ChevronLeftIconOutline.js");
36
36
  const require_icons_generated_heroIcons_EllipsisHorizontalIconOutline = require("./generated/heroIcons/EllipsisHorizontalIconOutline.js");
37
+ const require_icons_generated_custom_MagnifyingGlassOutline = require("./generated/custom/MagnifyingGlassOutline.js");
37
38
  const require_icons_generated_custom_AcademicCapOutline = require("./generated/custom/AcademicCapOutline.js");
38
39
  const require_icons_generated_custom_AdjustmentsHorizontalOutline = require("./generated/custom/AdjustmentsHorizontalOutline.js");
39
40
  const require_icons_generated_custom_AdjustmentsVerticalOutline = require("./generated/custom/AdjustmentsVerticalOutline.js");
@@ -408,7 +409,6 @@ const require_icons_generated_custom_LockOpenOutline = require("./generated/cust
408
409
  const require_icons_generated_custom_LogOutOutline = require("./generated/custom/LogOutOutline.js");
409
410
  const require_icons_generated_custom_MagnifyingGlassCircleOutline = require("./generated/custom/MagnifyingGlassCircleOutline.js");
410
411
  const require_icons_generated_custom_MagnifyingGlassMinusOutline = require("./generated/custom/MagnifyingGlassMinusOutline.js");
411
- const require_icons_generated_custom_MagnifyingGlassOutline = require("./generated/custom/MagnifyingGlassOutline.js");
412
412
  const require_icons_generated_custom_MagnifyingGlassPlusOutline = require("./generated/custom/MagnifyingGlassPlusOutline.js");
413
413
  const require_icons_generated_custom_MagnifyingGlassResetOutline = require("./generated/custom/MagnifyingGlassResetOutline.js");
414
414
  const require_icons_generated_custom_MagnifyingGlassReset = require("./generated/custom/MagnifyingGlassReset.js");
package/lib/cjs/index.js CHANGED
@@ -25,6 +25,7 @@ const require_popover_Popover = require("./popover/Popover.js");
25
25
  const require_progress_bar_ProgressBar = require("./progress-bar/ProgressBar.js");
26
26
  const require_dropzone_Dropzone = require("./dropzone/Dropzone.js");
27
27
  const require_text_input_TextInput = require("./text-input/TextInput.js");
28
+ const require_search_field_SearchField = require("./search-field/SearchField.js");
28
29
  const require_text_area_TextArea = require("./text-area/TextArea.js");
29
30
  const require_text_link_TextLink = require("./text-link/TextLink.js");
30
31
  const require_select_Select = require("./select/Select.js");
@@ -37,19 +38,19 @@ const require_side_navigation_SideNavigation = require("./side-navigation/SideNa
37
38
  const require_typography_Typography = require("./typography/Typography.js");
38
39
  const require_drawer_Drawer = require("./drawer/Drawer.js");
39
40
  const require_breadcrumbs_Breadcrumbs = require("./breadcrumbs/Breadcrumbs.js");
40
- const require_hooks_index = require("./hooks/index.js");
41
41
  const require_data_grid_data_grid_context = require("./data-grid/data-grid-context.js");
42
42
  const require_data_grid_helpers_index = require("./data-grid/helpers/index.js");
43
43
  const require_hooks_use_debounce_callback_index = require("./hooks/use-debounce-callback/index.js");
44
+ const require_hooks_index = require("./hooks/index.js");
44
45
  const require_box_Box = require("./box/Box.js");
45
46
  const require_flex_Flex = require("./flex/Flex.js");
46
- const require_avatar_Avatar = require("./avatar/Avatar.js");
47
47
  const require_data_grid_style_rules_evaluate = require("./data-grid/style-rules/evaluate.js");
48
48
  const require_data_grid_style_rules_hooks = require("./data-grid/style-rules/hooks.js");
49
49
  const require_data_grid_data_grid_nav_data_grid_nav = require("./data-grid/data-grid-nav/data-grid-nav.js");
50
50
  const require_data_grid_data_grid_nav_index = require("./data-grid/data-grid-nav/index.js");
51
51
  const require_data_grid_DataGrid = require("./data-grid/DataGrid.js");
52
52
  const require_data_grid_style_rules_guard = require("./data-grid/style-rules/guard.js");
53
+ const require_avatar_Avatar = require("./avatar/Avatar.js");
53
54
  const require_logo_Logo = require("./logo/Logo.js");
54
55
  const require_clipboard_button_ClipboardButton = require("./clipboard-button/ClipboardButton.js");
55
56
  const require_slider_Slider = require("./slider/Slider.js");
@@ -152,6 +153,7 @@ exports.ProgressBar = require_progress_bar_ProgressBar.ProgressBar;
152
153
  exports.Radio = require_radio_Radio.Radio;
153
154
  exports.RadioGroup = require_radio_group_RadioGroup.RadioGroup;
154
155
  exports.ReadOnlyTag = require_read_only_tag_ReadOnlyTag.ReadOnlyTag;
156
+ exports.SearchField = require_search_field_SearchField.SearchField;
155
157
  exports.SegmentedControl = require_segmented_control_SegmentedControl.SegmentedControl;
156
158
  exports.Select = require_select_Select.Select;
157
159
  exports.SelectIconButton = require_select_icon_button_SelectIconButton.SelectIconButton;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"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 */\n\nexport { Accordion } from './accordion';\nexport { StatusLabel } from './status-label';\nexport { Banner } from './banner';\nexport { AnnouncementBanner } from './announcement-banner';\nexport { Checkbox } from './checkbox';\nexport { CheckboxGroup } from './checkbox-group';\nexport { Fieldset } from './fieldset';\nexport { Switch } from './switch';\nexport { Radio } from './radio';\nexport { RadioGroup } from './radio-group';\nexport { Menu } from './menu';\nexport { DatePicker } from './date-picker';\nexport { Dialog } from './dialog';\nexport { LoadingSpinner } from './loading-spinner';\nexport { Tabs } from './tabs';\nexport { SegmentedControl } from './segmented-control';\nexport * from './popover';\nexport { ProgressBar } from './progress-bar';\nexport { Dropzone } from './dropzone';\nexport * from './data-grid';\nexport { TextInput } from './text-input';\nexport { TextArea } from './text-area';\nexport { TextLink } from './text-link';\nexport { Select } from './select';\nexport { Tag } from './tag';\nexport * from './theme';\nexport { Wizard } from './wizard';\nexport { GraphLabel } from './graph-label';\nexport { CodeBlock } from './code-block';\nexport { StatusIndicator } from './status-indicator';\nexport { SideNavigation } from './side-navigation';\nexport { Typography } from './typography';\nexport { Drawer } from './drawer';\nexport { Breadcrumbs } from './breadcrumbs';\nexport * from './hooks';\nexport { Box } from './box';\nexport { Flex } from './flex';\nexport { Avatar } from './avatar';\nexport { Logo } from './logo';\nexport { ClipboardButton } from './clipboard-button';\nexport { Slider } from './slider';\nexport { InlineEdit } from './inline-edit';\nexport { DropdownButton } from './dropdown-button';\nexport { Divider } from './divider';\nexport * from './tree-view';\nexport { ToasterControlled, Toaster, toast, type ToastId } from './toast';\nexport { Tooltip } from './tooltip';\nexport { Skeleton } from './skeleton';\nexport { TimePicker, NeedleTime } from './time-picker';\nexport { TimeZonePicker } from './timezone-picker';\nexport {\n Spotlight,\n SpotlightProvider,\n SpotlightTarget,\n SpotlightTour,\n useSpotlightContext,\n} from './spotlight';\nexport { LoadingBar } from './loading-bar';\nexport { IconButton } from './icon-button';\nexport { CleanIconButton } from './clean-icon-button';\nexport { IconButtonArray } from './icon-button-array';\nexport { ConditionalWrap } from './conditional-wrap';\nexport { ColorPicker } from './color-picker';\nexport { OutlinedButton } from './outlined-button';\nexport { FilledButton } from './filled-button';\nexport { TextButton } from './text-button';\nexport { Code } from './code';\nexport { Kbd } from './kbd';\nexport { SelectIconButton } from './select-icon-button';\nexport { ReadOnlyTag } from './read-only-tag';\nexport { DismissibleTag } from './dismissible-tag';\nexport { SelectableTag } from './selectable-tag';\nexport { OperationalTag } from './operational-tag';\nexport * from './combobox';\n"],"mappings":""}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"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 */\n\nexport { Accordion } from './accordion';\nexport { StatusLabel } from './status-label';\nexport { Banner } from './banner';\nexport { AnnouncementBanner } from './announcement-banner';\nexport { Checkbox } from './checkbox';\nexport { CheckboxGroup } from './checkbox-group';\nexport { Fieldset } from './fieldset';\nexport { Switch } from './switch';\nexport { Radio } from './radio';\nexport { RadioGroup } from './radio-group';\nexport { Menu } from './menu';\nexport { DatePicker } from './date-picker';\nexport { Dialog } from './dialog';\nexport { LoadingSpinner } from './loading-spinner';\nexport { Tabs } from './tabs';\nexport { SegmentedControl } from './segmented-control';\nexport * from './popover';\nexport { ProgressBar } from './progress-bar';\nexport { Dropzone } from './dropzone';\nexport * from './data-grid';\nexport { TextInput } from './text-input';\nexport { SearchField } from './search-field';\nexport { TextArea } from './text-area';\nexport { TextLink } from './text-link';\nexport { Select } from './select';\nexport { Tag } from './tag';\nexport * from './theme';\nexport { Wizard } from './wizard';\nexport { GraphLabel } from './graph-label';\nexport { CodeBlock } from './code-block';\nexport { StatusIndicator } from './status-indicator';\nexport { SideNavigation } from './side-navigation';\nexport { Typography } from './typography';\nexport { Drawer } from './drawer';\nexport { Breadcrumbs } from './breadcrumbs';\nexport * from './hooks';\nexport { Box } from './box';\nexport { Flex } from './flex';\nexport { Avatar } from './avatar';\nexport { Logo } from './logo';\nexport { ClipboardButton } from './clipboard-button';\nexport { Slider } from './slider';\nexport { InlineEdit } from './inline-edit';\nexport { DropdownButton } from './dropdown-button';\nexport { Divider } from './divider';\nexport * from './tree-view';\nexport { ToasterControlled, Toaster, toast, type ToastId } from './toast';\nexport { Tooltip } from './tooltip';\nexport { Skeleton } from './skeleton';\nexport { TimePicker, NeedleTime } from './time-picker';\nexport { TimeZonePicker } from './timezone-picker';\nexport {\n Spotlight,\n SpotlightProvider,\n SpotlightTarget,\n SpotlightTour,\n useSpotlightContext,\n} from './spotlight';\nexport { LoadingBar } from './loading-bar';\nexport { IconButton } from './icon-button';\nexport { CleanIconButton } from './clean-icon-button';\nexport { IconButtonArray } from './icon-button-array';\nexport { ConditionalWrap } from './conditional-wrap';\nexport { ColorPicker } from './color-picker';\nexport { OutlinedButton } from './outlined-button';\nexport { FilledButton } from './filled-button';\nexport { TextButton } from './text-button';\nexport { Code } from './code';\nexport { Kbd } from './kbd';\nexport { SelectIconButton } from './select-icon-button';\nexport { ReadOnlyTag } from './read-only-tag';\nexport { DismissibleTag } from './dismissible-tag';\nexport { SelectableTag } from './selectable-tag';\nexport { OperationalTag } from './operational-tag';\nexport * from './combobox';\n"],"mappings":""}
@@ -66,7 +66,7 @@ const _excluded = [
66
66
  const MINIMUM_WIDTH = 320;
67
67
  const InlineEdit = (_ref) => {
68
68
  var _ref2;
69
- let { as, className, defaultValue, htmlAttributes, label, ariaLabel, onChange, onCancel, onConfirm, ref, style, value, hasEditIcon = false, inputProps, isDisabled = false, isEditing, blurBehavior = "confirm", isFluid = false, typographyVariant = "subheading-medium", placeholder } = _ref, restProps = require_objectWithoutProperties.default(_ref, _excluded);
69
+ let { as, className, defaultValue, htmlAttributes, label, ariaLabel, onChange, onCancel, onConfirm, ref, style, value, hasEditIcon = false, inputProps, isDisabled = false, isEditing, blurBehavior = "confirm", isFluid = false, typographyVariant = "subheading-large", placeholder } = _ref, restProps = require_objectWithoutProperties.default(_ref, _excluded);
70
70
  const [hasEditMode, setEditMode] = (0, react.useState)(false);
71
71
  const [currentValue, setCurrentValue] = require__common_use_semi_controlled_state.useSemicontrolledState({
72
72
  isControlled: value !== void 0,
@@ -1 +1 @@
1
- {"version":3,"file":"InlineEdit.js","names":["useState","useSemicontrolledState","useRef","useFocusWithin","useCallback","useMemo","randomId","Typography","classNames","IconButton","CheckIconOutline","XMarkIconOutline","getMinHeight","PencilIconOutline","getIconStyle"],"sources":["../../../src/inline-edit/InlineEdit.tsx"],"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 aria label for the input. If not provided, defaults to the `label` text, or a generic\n * \"Inline edit input\" string as a last resort.\n */\n ariaLabel?: string;\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 ariaLabel,\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 (event: React.KeyboardEvent) => {\n if (['Enter', 'Escape'].includes(event.key)) {\n if (event.key === 'Enter') {\n onConfirmHandler();\n }\n if (event.key === 'Escape') {\n onCancelHandler();\n }\n event.preventDefault();\n event.stopPropagation();\n }\n },\n [onConfirmHandler, onCancelHandler],\n );\n\n const handleInputChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = event.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 const inputAriaLabel =\n ariaLabel ?? (typeof label === 'string' ? label : 'Inline edit input');\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 aria-label={inputAriaLabel}\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 'ndl-disabled': isDisabled,\n 'ndl-has-edit-icon': hasEditIcon,\n 'ndl-placeholder': displayText === placeholder,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuIE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AAtBF,MAAM,gBAAgB;AAEtB,MAAa,cAAmD,SAsBd;;CAtBc,IAAA,EAC9D,IACA,WACA,cACA,gBACA,OACA,WACA,UACA,UACA,WACA,KACA,OACA,OACA,cAAc,OACd,YACA,aAAa,OACb,WACA,eAAe,WACf,UAAU,OACV,oBAAoB,qBACpB,gBAAA,MACG,YAAA,gCAAA,QAAA,MAAA,SAAA;CAEH,MAAM,CAAC,aAAa,gBAAA,GAAeA,MAAAA,SAAAA,CAAS,KAAK;CAEjD,MAAM,CAAC,cAAc,mBAAmBC,0CAAAA,uBAAuB;EAC7D,cAAc,UAAU,KAAA;EACxB;EACA,QAAA,QAAO,UAAA,QAAA,UAAA,KAAA,IAAA,QAAS,kBAAA,QAAA,UAAA,KAAA,IAAA,QAAgB;CAClC,CAAC;CACD,MAAM,CAAC,wBAAwB,8BAAA,GAC7BD,MAAAA,SAAAA,CAAS,YAAY;CAEvB,MAAM,aAAA,GAAYE,MAAAA,OAAAA,CAAwB,IAAI;CAC9C,MAAM,gBA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E,iBAAA,GAAA,kBAAA,IAAA,CAACC,+BAAAA,YAAD;IACE,aAAY;IACZ,cAAc,EACZ,MAAM,EAAE,WAAW,SAAS,EAC9B;IACA,SAAS;IACT,MAAK;IACL,YAAY;IACZ,gBAAgB,EACd,mBAAmB;KACjB,cAAc,UAAU;IAC1B,EACF;IAEA,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,mDAAAA,kBAAD,CAAmB,CAAA;GACT,CAAA,GACZ,iBAAA,GAAA,kBAAA,IAAA,CAACD,+BAAAA,YAAD;IACE,aAAY;IACZ,cAAc,EACZ,MAAM,EAAE,WAAW,SAAS,EAC9B;IACA,UAAU,UAAU,gBAAgB,KAAK;IACzC,MAAK;IACL,YAAY;IACZ,gBAAgB,EACd,mBAAmB;KACjB,cAAc,UAAU;IAC1B,EACF;IAEA,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACE,mDAAAA,kBAAD,CAAmB,CAAA;GACT,CAAA,CACT;;CACF,EAAA,CAAA,CAAA,IAEL,iBAAA,GAAA,kBAAA,KAAA,CAAC,UAAD;EACE,MAAK;EACL,YAAA,GAAWH,WAAAA,QAAAA,CAAW,6BAA6B;GACjD,gBAAgB;GAChB,qBAAqB;GACrB,mBAAmB,gBAAgB;EACrC,CAAC;EACD,iBAAe;EACf,cAAY;EACZ,UAAU;EACV,SAAS;EACT,OAAO,EACL,WAAWI,0BAAAA,aAAa,iBAAiB,EAC3C;EAbF,UAAA,CAeE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,WAAU;GAAwB,UAAA;EAAkB,CAAA,GACzD,eACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,oDAAAA,mBAAD;GACE,WAAU;GACV,OAAOC,0BAAAA,aAAa,iBAAiB;EACtC,CAAA,CAEG;CAEA,CAAA,CAAA,EAAA,CAAA,CAAA;AAEhB"}
1
+ {"version":3,"file":"InlineEdit.js","names":["useState","useSemicontrolledState","useRef","useFocusWithin","useCallback","useMemo","randomId","Typography","classNames","IconButton","CheckIconOutline","XMarkIconOutline","getMinHeight","PencilIconOutline","getIconStyle"],"sources":["../../../src/inline-edit/InlineEdit.tsx"],"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 aria label for the input. If not provided, defaults to the `label` text, or a generic\n * \"Inline edit input\" string as a last resort.\n */\n ariaLabel?: string;\n\n /**\n * The typographyVariant of the component applied to Typography as its variant.\n * @default subheading-large\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 ariaLabel,\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-large',\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 (event: React.KeyboardEvent) => {\n if (['Enter', 'Escape'].includes(event.key)) {\n if (event.key === 'Enter') {\n onConfirmHandler();\n }\n if (event.key === 'Escape') {\n onCancelHandler();\n }\n event.preventDefault();\n event.stopPropagation();\n }\n },\n [onConfirmHandler, onCancelHandler],\n );\n\n const handleInputChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = event.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 const inputAriaLabel =\n ariaLabel ?? (typeof label === 'string' ? label : 'Inline edit input');\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 aria-label={inputAriaLabel}\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 'ndl-disabled': isDisabled,\n 'ndl-has-edit-icon': hasEditIcon,\n 'ndl-placeholder': displayText === placeholder,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuIE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AAtBF,MAAM,gBAAgB;AAEtB,MAAa,cAAmD,SAsBd;;CAtBc,IAAA,EAC9D,IACA,WACA,cACA,gBACA,OACA,WACA,UACA,UACA,WACA,KACA,OAC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;GACjD,gBAAgB;GAChB,qBAAqB;GACrB,mBAAmB,gBAAgB;EACrC,CAAC;EACD,iBAAe;EACf,cAAY;EACZ,UAAU;EACV,SAAS;EACT,OAAO,EACL,WAAWI,0BAAAA,aAAa,iBAAiB,EAC3C;EAbF,UAAA,CAeE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,WAAU;GAAwB,UAAA;EAAkB,CAAA,GACzD,eACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,oDAAAA,mBAAD;GACE,WAAU;GACV,OAAOC,0BAAAA,aAAa,iBAAiB;EACtC,CAAA,CAEG;CAEA,CAAA,CAAA,EAAA,CAAA,CAAA;AAEhB"}
@@ -44,11 +44,9 @@ function _validateValue() {
44
44
  function getIconSizeForVariant(variant) {
45
45
  switch (variant) {
46
46
  case "display":
47
- case "title-1": return 24;
47
+ case "title-1":
48
48
  case "title-2":
49
- case "title-3":
50
- case "title-4":
51
- case "subheading-large": return 20;
49
+ case "title-3": return 20;
52
50
  default: return 16;
53
51
  }
54
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["tokens"],"sources":["../../../src/inline-edit/utils.ts"],"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 */\n\nimport { tokens } from '@neo4j-ndl/base';\n\nimport { type TypographyVariants } from '../typography';\n\ntype ValidationFunction = (\n value: string,\n) => Promise<true | string> | true | string;\n\nexport async function validateValue(\n value: string,\n validate?: ValidationFunction,\n): Promise<string | null> {\n if (!validate) {\n return null;\n }\n\n const validation = validate(value);\n\n let isValid: string | boolean;\n if (validation instanceof Promise) {\n isValid = await validation;\n } else {\n isValid = validation;\n }\n\n if (typeof isValid === 'string') {\n return isValid;\n }\n\n return null;\n}\n\nexport function getIconSizeForVariant(variant: TypographyVariants): number {\n switch (variant) {\n case 'display':\n case 'title-1':\n return 24;\n case 'title-2':\n case 'title-3':\n case 'title-4':\n case 'subheading-large':\n return 20;\n default:\n return 16;\n }\n}\n\nexport const getIconStyle = (\n variant: TypographyVariants,\n): React.CSSProperties => ({\n height: `${getIconSizeForVariant(variant)}px`,\n width: `${getIconSizeForVariant(variant)}px`,\n});\n\nexport const getMinHeight = (variant: TypographyVariants): string => {\n return `${tokens.typography[variant].lineHeight * parseFloat(tokens.typography[variant].fontSize)}rem`;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAsB,cACpB,IACA,KAAA;;;;CADA,iBAAA,yBAAA,QAAA,WAAA,OACA,UACwB;EACxB,IAAI,CAAC,UACH,OAAO;EAGT,MAAM,aAAa,SAAS,KAAK;EAEjC,IAAI;EACJ,IAAI,sBAAsB,SACxB,UAAU,MAAM;OAEhB,UAAU;EAGZ,IAAI,OAAO,YAAY,UACrB,OAAO;EAGT,OAAO;CACT,CAAA;;;AAEA,SAAgB,sBAAsB,SAAqC;CACzE,QAAQ,SAAR;EACE,KAAK;EACL,KAAK,WACH,OAAO;EACT,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,oBACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAEA,MAAa,gBACX,aACyB;CACzB,QAAQ,GAAG,sBAAsB,OAAO,EAAE;CAC1C,OAAO,GAAG,sBAAsB,OAAO,EAAE;AAC3C;AAEA,MAAa,gBAAgB,YAAwC;CACnE,OAAO,GAAGA,gBAAAA,OAAO,WAAW,QAAQ,CAAC,aAAa,WAAWA,gBAAAA,OAAO,WAAW,QAAQ,CAAC,QAAQ,EAAE;AACpG"}
1
+ {"version":3,"file":"utils.js","names":["tokens"],"sources":["../../../src/inline-edit/utils.ts"],"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 */\n\nimport { tokens } from '@neo4j-ndl/base';\n\nimport { type TypographyVariants } from '../typography';\n\ntype ValidationFunction = (\n value: string,\n) => Promise<true | string> | true | string;\n\nexport async function validateValue(\n value: string,\n validate?: ValidationFunction,\n): Promise<string | null> {\n if (!validate) {\n return null;\n }\n\n const validation = validate(value);\n\n let isValid: string | boolean;\n if (validation instanceof Promise) {\n isValid = await validation;\n } else {\n isValid = validation;\n }\n\n if (typeof isValid === 'string') {\n return isValid;\n }\n\n return null;\n}\n\nexport function getIconSizeForVariant(variant: TypographyVariants): number {\n switch (variant) {\n case 'display':\n case 'title-1':\n case 'title-2':\n case 'title-3':\n return 20;\n default:\n return 16;\n }\n}\n\nexport const getIconStyle = (\n variant: TypographyVariants,\n): React.CSSProperties => ({\n height: `${getIconSizeForVariant(variant)}px`,\n width: `${getIconSizeForVariant(variant)}px`,\n});\n\nexport const getMinHeight = (variant: TypographyVariants): string => {\n return `${tokens.typography[variant].lineHeight * parseFloat(tokens.typography[variant].fontSize)}rem`;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAsB,cACpB,IACA,KAAA;;;;CADA,iBAAA,yBAAA,QAAA,WAAA,OACA,UACwB;EACxB,IAAI,CAAC,UACH,OAAO;EAGT,MAAM,aAAa,SAAS,KAAK;EAEjC,IAAI;EACJ,IAAI,sBAAsB,SACxB,UAAU,MAAM;OAEhB,UAAU;EAGZ,IAAI,OAAO,YAAY,UACrB,OAAO;EAGT,OAAO;CACT,CAAA;;;AAEA,SAAgB,sBAAsB,SAAqC;CACzE,QAAQ,SAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,WACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAEA,MAAa,gBACX,aACyB;CACzB,QAAQ,GAAG,sBAAsB,OAAO,EAAE;CAC1C,OAAO,GAAG,sBAAsB,OAAO,EAAE;AAC3C;AAEA,MAAa,gBAAgB,YAAwC;CACnE,OAAO,GAAGA,gBAAAA,OAAO,WAAW,QAAQ,CAAC,aAAa,WAAWA,gBAAAA,OAAO,WAAW,QAAQ,CAAC,QAAQ,EAAE;AACpG"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ const require_hooks_use_debounce_callback_index = require("../hooks/use-debounce-callback/index.js");
7
+ const require_icons_generated_custom_MagnifyingGlassOutline = require("../icons/generated/custom/MagnifyingGlassOutline.js");
8
+ const require_text_input_TextInput = require("../text-input/TextInput.js");
9
+ const require_objectWithoutProperties = require("../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.js");
10
+ const require_objectSpread2 = require("../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.js");
11
+ let react = require("react");
12
+ let react_jsx_runtime = require("react/jsx-runtime");
13
+ // src/search-field/SearchField.tsx
14
+ /*!
15
+ *
16
+ * Copyright (c) "Neo4j"
17
+ * Neo4j Sweden AB [http://neo4j.com]
18
+ *
19
+ * This file is part of Neo4j.
20
+ *
21
+ * Neo4j is free software: you can redistribute it and/or modify
22
+ * it under the terms of the GNU General Public License as published by
23
+ * the Free Software Foundation, either version 3 of the License, or
24
+ * (at your option) any later version.
25
+ *
26
+ * This program is distributed in the hope that it will be useful,
27
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
28
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29
+ * GNU General Public License for more details.
30
+ *
31
+ * You should have received a copy of the GNU General Public License
32
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
33
+ */
34
+ const _excluded = [
35
+ "debounceDelay",
36
+ "htmlAttributes",
37
+ "label",
38
+ "onChange",
39
+ "onSearch"
40
+ ];
41
+ /**
42
+ * A text input for entering search queries.
43
+ *
44
+ * @remarks
45
+ * SearchField renders a fixed search icon and uses the native `search` input
46
+ * type. `onChange` is called immediately, while `onSearch` is debounced until
47
+ * typing pauses. Pressing Enter or clearing the field calls `onSearch`
48
+ * immediately.
49
+ */
50
+ const SearchField = (_ref) => {
51
+ let { debounceDelay = 500, htmlAttributes, label, onChange, onSearch } = _ref, textInputProps = require_objectWithoutProperties.default(_ref, _excluded);
52
+ const debouncedSearch = require_hooks_use_debounce_callback_index.useDebounceCallback((query) => {
53
+ onSearch === null || onSearch === void 0 || onSearch(query);
54
+ }, debounceDelay);
55
+ const handleChange = (0, react.useCallback)((event) => {
56
+ onChange === null || onChange === void 0 || onChange(event);
57
+ const query = event.target.value;
58
+ if (query === "") {
59
+ debouncedSearch.cancel();
60
+ onSearch === null || onSearch === void 0 || onSearch("");
61
+ return;
62
+ }
63
+ debouncedSearch(query);
64
+ }, [
65
+ debouncedSearch,
66
+ onChange,
67
+ onSearch
68
+ ]);
69
+ const handleKeyDown = (0, react.useCallback)((event) => {
70
+ var _htmlAttributes$onKey;
71
+ htmlAttributes === null || htmlAttributes === void 0 || (_htmlAttributes$onKey = htmlAttributes.onKeyDown) === null || _htmlAttributes$onKey === void 0 || _htmlAttributes$onKey.call(htmlAttributes, event);
72
+ if (event.key === "Enter" && !event.defaultPrevented && !event.nativeEvent.isComposing) {
73
+ if (debouncedSearch.isPending()) debouncedSearch.flush();
74
+ else onSearch === null || onSearch === void 0 || onSearch(event.currentTarget.value);
75
+ }
76
+ }, [
77
+ debouncedSearch,
78
+ htmlAttributes,
79
+ onSearch
80
+ ]);
81
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_text_input_TextInput.TextInput, require_objectSpread2.default(require_objectSpread2.default({}, textInputProps), {}, {
82
+ htmlAttributes: require_objectSpread2.default(require_objectSpread2.default({}, htmlAttributes), {}, {
83
+ "aria-label": label,
84
+ onKeyDown: handleKeyDown,
85
+ type: "search"
86
+ }),
87
+ isClearable: true,
88
+ leadingElement: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_generated_custom_MagnifyingGlassOutline.default, {}),
89
+ onChange: handleChange
90
+ }));
91
+ };
92
+ exports.SearchField = SearchField;
93
+
94
+ //# sourceMappingURL=SearchField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchField.js","names":["useDebounceCallback","useCallback","TextInput","MagnifyingGlassOutlineIcon"],"sources":["../../../src/search-field/SearchField.tsx"],"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 */\n\nimport { type ChangeEvent, type ComponentProps, useCallback } from 'react';\n\nimport { useDebounceCallback } from '../hooks/use-debounce-callback';\nimport MagnifyingGlassOutlineIcon from '../icons/generated/custom/MagnifyingGlassOutline';\nimport { TextInput } from '../text-input';\n\ntype SearchFieldTextInputProps = Pick<\n ComponentProps<typeof TextInput>,\n | 'className'\n | 'errorText'\n | 'helpText'\n | 'htmlAttributes'\n | 'isDisabled'\n | 'isFluid'\n | 'isLoading'\n | 'isReadOnly'\n | 'isSkeletonLoading'\n | 'onChange'\n | 'placeholder'\n | 'ref'\n | 'size'\n | 'skeletonProps'\n | 'style'\n | 'value'\n>;\n\nexport type SearchFieldProps = SearchFieldTextInputProps & {\n /**\n * Accessible name for the search field. The label is announced by assistive\n * technologies but is not rendered visually.\n */\n label: string;\n\n /**\n * Called with the search query after typing pauses for `debounceDelay`, and\n * immediately when the user presses Enter or clears the field.\n */\n onSearch?: (query: string) => void;\n\n /**\n * Delay in milliseconds before calling `onSearch` after the query changes.\n * @default 500\n */\n debounceDelay?: number;\n};\n\n/**\n * A text input for entering search queries.\n *\n * @remarks\n * SearchField renders a fixed search icon and uses the native `search` input\n * type. `onChange` is called immediately, while `onSearch` is debounced until\n * typing pauses. Pressing Enter or clearing the field calls `onSearch`\n * immediately.\n */\nexport const SearchField = ({\n debounceDelay = 500,\n htmlAttributes,\n label,\n onChange,\n onSearch,\n ...textInputProps\n}: SearchFieldProps) => {\n const debouncedSearch = useDebounceCallback((query: string) => {\n onSearch?.(query);\n }, debounceDelay);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n\n const query = event.target.value;\n if (query === '') {\n debouncedSearch.cancel();\n onSearch?.('');\n return;\n }\n\n debouncedSearch(query);\n },\n [debouncedSearch, onChange, onSearch],\n );\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n htmlAttributes?.onKeyDown?.(event);\n\n if (\n event.key === 'Enter' &&\n !event.defaultPrevented &&\n !event.nativeEvent.isComposing\n ) {\n if (debouncedSearch.isPending()) {\n debouncedSearch.flush();\n } else {\n onSearch?.(event.currentTarget.value);\n }\n }\n },\n [debouncedSearch, htmlAttributes, onSearch],\n );\n\n return (\n <TextInput\n {...textInputProps}\n htmlAttributes={{\n ...htmlAttributes,\n 'aria-label': label,\n onKeyDown: handleKeyDown,\n type: 'search',\n }}\n isClearable\n leadingElement={<MagnifyingGlassOutlineIcon />}\n onChange={handleChange}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6EE;CACA;CACA;CACA;CACA;;;;;;;;;;;AALF,MAAa,eAAe,SAOJ;CAPI,IAAA,EAC1B,gBAAgB,KAChB,gBACA,OACA,UACA,aAAA,MACG,iBAAA,gCAAA,QAAA,MAAA,SAAA;CAEH,MAAM,kBAAkBA,0CAAAA,qBAAqB,UAAkB;EAC7D,aAAA,QAAA,aAAA,KAAA,KAAA,SAAW,KAAK;CAClB,GAAG,aAAa;CAEhB,MAAM,gBAAA,GAAeC,MAAAA,YAAAA,EAClB,UAAyC;EACxC,aAAA,QAAA,aAAA,KAAA,KAAA,SAAW,KAAK;EAEhB,MAAM,QAAQ,MAAM,OAAO;EAC3B,IAAI,UAAU,IAAI;GAChB,gBAAgB,OAAO;GACvB,aAAA,QAAA,aAAA,KAAA,KAAA,SAAW,EAAE;GACb;EACF;EAEA,gBAAgB,KAAK;CACvB,GACA;EAAC;EAAiB;EAAU;CAAQ,CACtC;CAEA,MAAM,iBAAA,GAAgBA,MAAAA,YAAAA,EACnB,UAAiD;;EAChD,mBAAA,QAAA,mBAAA,KAAA,MAAA,wBAAA,eAAgB,eAAA,QAAA,0BAAA,KAAA,KAAA,sBAAA,KAAA,gBAAY,KAAK;EAEjC,IACE,MAAM,QAAQ,WACd,CAAC,MAAM,oBACP,CAAC,MAAM,YAAY,aACnB;GACA,IAAI,gBAAgB,UAAU,GAC5B,gBAAgB,MAAM;QAEtB,aAAA,QAAA,aAAA,KAAA,KAAA,SAAW,MAAM,cAAc,KAAK;EAExC;CACF,GACA;EAAC;EAAiB;EAAgB;CAAQ,CAC5C;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,WAAAA,sBAAAA,QAAAA,sBAAAA,QAAAA,CAAAA,GACK,cAAA,GAAA,CAAA,GAAA;EACJ,gBAAA,sBAAA,QAAA,sBAAA,QAAA,CAAA,GACK,cAAA,GAAA,CAAA,GAAA;GACH,cAAc;GACd,WAAW;GACX,MAAM;EACR,CAAA;EACA,aAAA;EACA,gBAAgB,iBAAA,GAAA,kBAAA,IAAA,CAACC,sDAAAA,SAAD,CAA6B,CAAA;EAC7C,UAAU;CACX,CAAA,CAAA;AAEL"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ const require_search_field_SearchField = require("./SearchField.js");
7
+ // src/search-field/index.ts
8
+ /*!
9
+ *
10
+ * Copyright (c) "Neo4j"
11
+ * Neo4j Sweden AB [http://neo4j.com]
12
+ *
13
+ * This file is part of Neo4j.
14
+ *
15
+ * Neo4j is free software: you can redistribute it and/or modify
16
+ * it under the terms of the GNU General Public License as published by
17
+ * the Free Software Foundation, either version 3 of the License, or
18
+ * (at your option) any later version.
19
+ *
20
+ * This program is distributed in the hope that it will be useful,
21
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ * GNU General Public License for more details.
24
+ *
25
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
27
+ */
28
+ exports.SearchField = require_search_field_SearchField.SearchField;
29
+
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/search-field/index.ts"],"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 */\n\nexport * from './SearchField';\n"],"mappings":""}