@neo4j-ndl/react 4.16.5 → 4.16.7

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 (112) hide show
  1. package/lib/cjs/_generated/style-rules/date-utils.js +55 -0
  2. package/lib/cjs/_generated/style-rules/date-utils.js.map +1 -1
  3. package/lib/cjs/_generated/style-rules/index.js +3 -1
  4. package/lib/cjs/_generated/style-rules/index.js.map +1 -1
  5. package/lib/cjs/_generated/style-rules/literal-schemas.js +19 -1
  6. package/lib/cjs/_generated/style-rules/literal-schemas.js.map +1 -1
  7. package/lib/cjs/accordion/Accordion.js +6 -0
  8. package/lib/cjs/accordion/Accordion.js.map +1 -1
  9. package/lib/cjs/accordion/accordion-types.js.map +1 -1
  10. package/lib/cjs/clipboard-button/ClipboardButton.js.map +1 -1
  11. package/lib/cjs/color-picker/ColorPicker.js.map +1 -1
  12. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +9 -9
  13. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -1
  14. package/lib/cjs/data-grid/style-rules/evaluate.js +3 -0
  15. package/lib/cjs/data-grid/style-rules/evaluate.js.map +1 -1
  16. package/lib/cjs/data-grid/style-rules/index.js +2 -1
  17. package/lib/cjs/data-grid/style-rules/index.js.map +1 -1
  18. package/lib/cjs/data-grid/style-rules/types.js +16 -2
  19. package/lib/cjs/data-grid/style-rules/types.js.map +1 -1
  20. package/lib/cjs/date-picker/DatePicker.js.map +1 -1
  21. package/lib/cjs/drawer/Drawer.js.map +1 -1
  22. package/lib/cjs/dropdown-button/DropdownButton.js.map +1 -1
  23. package/lib/cjs/dropzone/Dropzone.js.map +1 -1
  24. package/lib/cjs/menu/Menu.js +10 -0
  25. package/lib/cjs/menu/Menu.js.map +1 -1
  26. package/lib/cjs/modal/Modal.js.map +1 -1
  27. package/lib/cjs/segmented-control/SegmentedControl.js.map +1 -1
  28. package/lib/cjs/select/types.js.map +1 -1
  29. package/lib/cjs/slider/Slider.js.map +1 -1
  30. package/lib/cjs/tabs/Tabs.js.map +1 -1
  31. package/lib/cjs/text-area/TextArea.js.map +1 -1
  32. package/lib/cjs/text-input/TextInput.js.map +1 -1
  33. package/lib/cjs/wizard/Wizard.js.map +1 -1
  34. package/lib/esm/_generated/style-rules/date-utils.js +54 -0
  35. package/lib/esm/_generated/style-rules/date-utils.js.map +1 -1
  36. package/lib/esm/_generated/style-rules/index.js +2 -2
  37. package/lib/esm/_generated/style-rules/index.js.map +1 -1
  38. package/lib/esm/_generated/style-rules/literal-schemas.js +19 -1
  39. package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -1
  40. package/lib/esm/accordion/Accordion.js +6 -0
  41. package/lib/esm/accordion/Accordion.js.map +1 -1
  42. package/lib/esm/accordion/accordion-types.js.map +1 -1
  43. package/lib/esm/clipboard-button/ClipboardButton.js.map +1 -1
  44. package/lib/esm/color-picker/ColorPicker.js.map +1 -1
  45. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +9 -9
  46. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -1
  47. package/lib/esm/data-grid/style-rules/evaluate.js +4 -1
  48. package/lib/esm/data-grid/style-rules/evaluate.js.map +1 -1
  49. package/lib/esm/data-grid/style-rules/index.js +1 -1
  50. package/lib/esm/data-grid/style-rules/index.js.map +1 -1
  51. package/lib/esm/data-grid/style-rules/types.js +16 -2
  52. package/lib/esm/data-grid/style-rules/types.js.map +1 -1
  53. package/lib/esm/date-picker/DatePicker.js.map +1 -1
  54. package/lib/esm/drawer/Drawer.js.map +1 -1
  55. package/lib/esm/dropdown-button/DropdownButton.js.map +1 -1
  56. package/lib/esm/dropzone/Dropzone.js.map +1 -1
  57. package/lib/esm/menu/Menu.js +10 -0
  58. package/lib/esm/menu/Menu.js.map +1 -1
  59. package/lib/esm/modal/Modal.js.map +1 -1
  60. package/lib/esm/segmented-control/SegmentedControl.js.map +1 -1
  61. package/lib/esm/select/types.js.map +1 -1
  62. package/lib/esm/slider/Slider.js.map +1 -1
  63. package/lib/esm/tabs/Tabs.js.map +1 -1
  64. package/lib/esm/text-area/TextArea.js.map +1 -1
  65. package/lib/esm/text-input/TextInput.js.map +1 -1
  66. package/lib/esm/wizard/Wizard.js.map +1 -1
  67. package/lib/types/_generated/style-rules/date-utils.d.ts +20 -0
  68. package/lib/types/_generated/style-rules/date-utils.d.ts.map +1 -1
  69. package/lib/types/_generated/style-rules/index.d.ts +3 -3
  70. package/lib/types/_generated/style-rules/index.d.ts.map +1 -1
  71. package/lib/types/_generated/style-rules/literal-schemas.d.ts +17 -0
  72. package/lib/types/_generated/style-rules/literal-schemas.d.ts.map +1 -1
  73. package/lib/types/accordion/Accordion.d.ts +4 -0
  74. package/lib/types/accordion/Accordion.d.ts.map +1 -1
  75. package/lib/types/accordion/accordion-types.d.ts +4 -0
  76. package/lib/types/accordion/accordion-types.d.ts.map +1 -1
  77. package/lib/types/clipboard-button/ClipboardButton.d.ts +4 -0
  78. package/lib/types/clipboard-button/ClipboardButton.d.ts.map +1 -1
  79. package/lib/types/color-picker/ColorPicker.d.ts +13 -0
  80. package/lib/types/color-picker/ColorPicker.d.ts.map +1 -1
  81. package/lib/types/data-grid/style-rules/evaluate.d.ts.map +1 -1
  82. package/lib/types/data-grid/style-rules/index.d.ts +2 -2
  83. package/lib/types/data-grid/style-rules/index.d.ts.map +1 -1
  84. package/lib/types/data-grid/style-rules/types.d.ts +20 -2
  85. package/lib/types/data-grid/style-rules/types.d.ts.map +1 -1
  86. package/lib/types/date-picker/DatePicker.d.ts +7 -0
  87. package/lib/types/date-picker/DatePicker.d.ts.map +1 -1
  88. package/lib/types/drawer/Drawer.d.ts +7 -0
  89. package/lib/types/drawer/Drawer.d.ts.map +1 -1
  90. package/lib/types/dropdown-button/DropdownButton.d.ts +4 -0
  91. package/lib/types/dropdown-button/DropdownButton.d.ts.map +1 -1
  92. package/lib/types/dropzone/Dropzone.d.ts +4 -0
  93. package/lib/types/dropzone/Dropzone.d.ts.map +1 -1
  94. package/lib/types/menu/Menu.d.ts +10 -0
  95. package/lib/types/menu/Menu.d.ts.map +1 -1
  96. package/lib/types/modal/Modal.d.ts +7 -0
  97. package/lib/types/modal/Modal.d.ts.map +1 -1
  98. package/lib/types/segmented-control/SegmentedControl.d.ts +8 -0
  99. package/lib/types/segmented-control/SegmentedControl.d.ts.map +1 -1
  100. package/lib/types/select/types.d.ts +7 -0
  101. package/lib/types/select/types.d.ts.map +1 -1
  102. package/lib/types/slider/Slider.d.ts +4 -0
  103. package/lib/types/slider/Slider.d.ts.map +1 -1
  104. package/lib/types/tabs/Tabs.d.ts +4 -0
  105. package/lib/types/tabs/Tabs.d.ts.map +1 -1
  106. package/lib/types/text-area/TextArea.d.ts +4 -0
  107. package/lib/types/text-area/TextArea.d.ts.map +1 -1
  108. package/lib/types/text-input/TextInput.d.ts +7 -0
  109. package/lib/types/text-input/TextInput.d.ts.map +1 -1
  110. package/lib/types/wizard/Wizard.d.ts +4 -0
  111. package/lib/types/wizard/Wizard.d.ts.map +1 -1
  112. package/package.json +2 -6
@@ -1 +1 @@
1
- {"version":3,"file":"Dropzone.js","sourceRoot":"","sources":["../../../src/dropzone/Dropzone.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAkB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAIL,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,0BAA0B,EAAE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ChD,kBAAkB,EAAE,mCAAmC;CACxD,CAAC,CAAC;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { useMergeRefs } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { detect } from 'detect-browser';\nimport { type RefObject, useMemo, useRef, useState } from 'react';\nimport {\n type DropEvent,\n type DropzoneOptions,\n type FileRejection,\n useDropzone,\n} from 'react-dropzone';\nimport { useResizeObserver } from 'usehooks-ts';\n\nimport { type CommonProps } from '../_common/types';\nimport { Banner } from '../banner';\nimport { DocumentArrowUpIconOutline } from '../icons/generated/heroIcons/DocumentArrowUpIconOutline';\nimport { DocumentArrowUpIconSolid } from '../icons/generated/heroIcons/DocumentArrowUpIconSolid';\nimport { XCircleIconSolid } from '../icons/generated/heroIcons/XCircleIconSolid';\nimport { ProgressBar } from '../progress-bar';\nimport { Typography } from '../typography';\n\n/**\n *\n *\n * Types\n *\n *\n */\ntype DropzoneProps = {\n /** Props for the underlying `react-dropzone` component. Don't use `accept`. If using custom file extensions as this option is broken. Instead use the `acceptedFileExtensions` property. */\n dropZoneOptions: DropzoneOptions;\n\n /** Informational text that highlights the supported file types, will be displayed in the footer. */\n supportedFilesDescription?: React.ReactNode;\n\n /** Element to display when uploading the file.*/\n loadingElement?: React.ReactNode;\n\n /** Use when wanting a custom heading. */\n heading?: React.ReactNode;\n\n /** Message to be shown when file is rejected. */\n rejectedText?: React.ReactNode;\n\n /** The accepted file extensions for the Drag-and-Drop. */\n acceptedFileExtensions?: string[];\n};\n\ntype DropzoneLoadingProgressBarProps = {\n /** The percentage of the progress bar. */\n progressBarPrecentage: number;\n\n /** The time in minute left to upload the file. */\n progressBarMinute?: number;\n};\n\n/**\n *\n *\n * Helpers\n *\n *\n */\n\nconst browser = detect();\n\nconst isSafari = browser?.name === 'safari';\n\nconst DropzoneComponent = ({\n dropZoneOptions,\n supportedFilesDescription,\n loadingElement,\n heading,\n rejectedText,\n acceptedFileExtensions,\n htmlAttributes,\n style,\n className,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneProps>) => {\n /**\n * We intercept the onDrop function in order to enforce\n * custom file extensions. Before calling the onDrop props we check\n * if the custom file extensions is acceptable. If the extension\n * conforms to acceptedFileExtensions, we call onDrop. Otherwise, we\n * present an error message.\n */\n function onDropInterceptor<T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ) {\n if (acceptedFileExtensions && acceptedFileExtensions.length > 0) {\n for (const file of acceptedFiles) {\n const isAccepted = acceptedFileExtensions.some((extension) => {\n if (file.name.endsWith(extension)) {\n return true;\n }\n });\n if (!isAccepted) {\n setIsRejected(true);\n return;\n }\n }\n }\n setIsRejected(false);\n dropZoneOptions.onDrop?.(acceptedFiles, fileRejections, event);\n }\n\n const [isRejected, setIsRejected] = useState(false);\n const dropZoneRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs([dropZoneRef, ref]);\n const isDisabled = dropZoneOptions?.disabled || Boolean(loadingElement);\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isDragAccept,\n isDragReject,\n open,\n } = useDropzone({\n ...dropZoneOptions,\n disabled: isDisabled,\n noClick: true,\n onDrop: onDropInterceptor,\n });\n\n const { width } = useResizeObserver({\n ref: dropZoneRef as RefObject<HTMLElement>,\n });\n\n const isUploading = Boolean(loadingElement);\n\n const titleText =\n isDragActive && isDragReject\n ? 'Format not supported'\n : isDragActive && !isDragReject\n ? 'Drop file'\n : null;\n\n const computedFileImage =\n (isDragActive && isDragAccept) || isUploading ? (\n <DocumentArrowUpIconSolid className=\"n-size-token-48 n-text-primary-bg-strong\" />\n ) : (\n <XCircleIconSolid className=\"n-size-token-48 n-text-danger-bg-strong\" />\n );\n\n const wrapperClasses = classNames('ndl-dropzone', className, {\n 'ndl-drag-active': isDragActive,\n 'ndl-drag-disabled': dropZoneOptions?.disabled,\n 'ndl-file-invalid': isDragActive && isDragReject,\n });\n\n useMemo(() => {\n if (isDragActive && isRejected) {\n setIsRejected(false);\n }\n }, [isDragActive, isRejected]);\n\n return (\n <>\n {isRejected && (\n <Banner className=\"ndl-dropzone-error-alert\" variant=\"danger\">\n <Banner.Header>Error</Banner.Header>\n <Banner.Description>\n {Boolean(rejectedText) || 'File extension not supported.'}\n </Banner.Description>\n </Banner>\n )}\n <div\n ref={mergedRef}\n className={wrapperClasses}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-dropzone-inner-wrapper\" {...getRootProps()}>\n <input aria-label=\"Drag and drop area\" {...getInputProps()} />\n <div className=\"ndl-dropzone-inner\">\n {/* Illustration should be visible only after arbitrary width */}\n {width !== undefined && width > 230 && (\n <>\n {isDragActive && !isSafari ? (\n computedFileImage\n ) : (\n <DocumentArrowUpIconOutline className=\"ndl-dropzone-upload-icon\" />\n )}\n </>\n )}\n {!isUploading && (\n <div className=\"ndl-dnd-title-container\">\n <Typography variant=\"subheading-medium\">\n {titleText ||\n (heading ?? (\n <>\n Drag <span className=\"n-font-light\">&</span> Drop\n </>\n ))}\n </Typography>\n {!isDragReject && (\n <div className=\"ndl-dnd-subtitle\">\n <Typography variant=\"body-medium\">or</Typography>{' '}\n <button\n className=\"ndl-dnd-browse-link\"\n onClick={() => open()}\n disabled={isDisabled}\n type=\"button\"\n >\n Browse\n </button>\n </div>\n )}\n </div>\n )}\n <div className=\"ndl-dropzone-footer\">\n {isUploading && <>{loadingElement}</>}\n {!isUploading && (\n <div className=\"ndl-file-support-text\">\n {supportedFilesDescription}\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n </>\n );\n};\n\nconst DropzoneLoadingProgressBarComponent = ({\n progressBarPrecentage,\n progressBarMinute,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneLoadingProgressBarProps>) => {\n return (\n <div className=\"ndl-dropzone-loading-progress-bar-wrapper\">\n <div className=\"ndl-dropzone-loading-progress-bar-indicators\">\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-precentage\"\n variant=\"subheading-small\"\n >\n {`${progressBarPrecentage}%`}\n </Typography>\n {Boolean(progressBarMinute) && (\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-minute\"\n variant=\"body-medium\"\n >{`(${progressBarMinute} minutes left)`}</Typography>\n )}\n </div>\n <ProgressBar\n className={classNames('ndl-dropzone-loading-progress-bar', className)}\n value={progressBarPrecentage}\n size=\"large\"\n htmlAttributes={htmlAttributes}\n ref={ref}\n style={style}\n {...restProps}\n />\n </div>\n );\n};\n\nconst Dropzone = Object.assign(DropzoneComponent, {\n LoadingProgressBar: DropzoneLoadingProgressBarComponent,\n});\n\nexport { Dropzone };\n"]}
1
+ {"version":3,"file":"Dropzone.js","sourceRoot":"","sources":["../../../src/dropzone/Dropzone.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAkB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAIL,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,MAAM,EAA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AQ,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE;IAChD,kBAAkB,EAAE,mCAAmC;CACxD,CAAC,CAAC;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { useMergeRefs } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { detect } from 'detect-browser';\nimport { type RefObject, useMemo, useRef, useState } from 'react';\nimport {\n type DropEvent,\n type DropzoneOptions,\n type FileRejection,\n useDropzone,\n} from 'react-dropzone';\nimport { useResizeObserver } from 'usehooks-ts';\n\nimport { type CommonProps } from '../_common/types';\nimport { Banner } from '../banner';\nimport { DocumentArrowUpIconOutline } from '../icons/generated/heroIcons/DocumentArrowUpIconOutline';\nimport { DocumentArrowUpIconSolid } from '../icons/generated/heroIcons/DocumentArrowUpIconSolid';\nimport { XCircleIconSolid } from '../icons/generated/heroIcons/XCircleIconSolid';\nimport { ProgressBar } from '../progress-bar';\nimport { Typography } from '../typography';\n\n/**\n *\n *\n * Types\n *\n *\n */\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 to be shown when file is rejected. */\n rejectedText?: React.ReactNode;\n\n /** The accepted file extensions for the Drag-and-Drop. */\n acceptedFileExtensions?: string[];\n};\n\ntype DropzoneLoadingProgressBarProps = {\n /** The percentage of the progress bar. */\n progressBarPrecentage: number;\n\n /** The time in minute left to upload the file. */\n progressBarMinute?: number;\n};\n\n/**\n *\n *\n * Helpers\n *\n *\n */\n\nconst browser = detect();\n\nconst isSafari = browser?.name === 'safari';\n\nconst DropzoneComponent = ({\n dropZoneOptions,\n supportedFilesDescription,\n loadingElement,\n heading,\n rejectedText,\n acceptedFileExtensions,\n htmlAttributes,\n style,\n className,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneProps>) => {\n /**\n * We intercept the onDrop function in order to enforce\n * custom file extensions. Before calling the onDrop props we check\n * if the custom file extensions is acceptable. If the extension\n * conforms to acceptedFileExtensions, we call onDrop. Otherwise, we\n * present an error message.\n */\n function onDropInterceptor<T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ) {\n if (acceptedFileExtensions && acceptedFileExtensions.length > 0) {\n for (const file of acceptedFiles) {\n const isAccepted = acceptedFileExtensions.some((extension) => {\n if (file.name.endsWith(extension)) {\n return true;\n }\n });\n if (!isAccepted) {\n setIsRejected(true);\n return;\n }\n }\n }\n setIsRejected(false);\n dropZoneOptions.onDrop?.(acceptedFiles, fileRejections, event);\n }\n\n const [isRejected, setIsRejected] = useState(false);\n const dropZoneRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs([dropZoneRef, ref]);\n const isDisabled = dropZoneOptions?.disabled || Boolean(loadingElement);\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isDragAccept,\n isDragReject,\n open,\n } = useDropzone({\n ...dropZoneOptions,\n disabled: isDisabled,\n noClick: true,\n onDrop: onDropInterceptor,\n });\n\n const { width } = useResizeObserver({\n ref: dropZoneRef as RefObject<HTMLElement>,\n });\n\n const isUploading = Boolean(loadingElement);\n\n const titleText =\n isDragActive && isDragReject\n ? 'Format not supported'\n : isDragActive && !isDragReject\n ? 'Drop file'\n : null;\n\n const computedFileImage =\n (isDragActive && isDragAccept) || isUploading ? (\n <DocumentArrowUpIconSolid className=\"n-size-token-48 n-text-primary-bg-strong\" />\n ) : (\n <XCircleIconSolid className=\"n-size-token-48 n-text-danger-bg-strong\" />\n );\n\n const wrapperClasses = classNames('ndl-dropzone', className, {\n 'ndl-drag-active': isDragActive,\n 'ndl-drag-disabled': dropZoneOptions?.disabled,\n 'ndl-file-invalid': isDragActive && isDragReject,\n });\n\n useMemo(() => {\n if (isDragActive && isRejected) {\n setIsRejected(false);\n }\n }, [isDragActive, isRejected]);\n\n return (\n <>\n {isRejected && (\n <Banner className=\"ndl-dropzone-error-alert\" variant=\"danger\">\n <Banner.Header>Error</Banner.Header>\n <Banner.Description>\n {Boolean(rejectedText) || 'File extension not supported.'}\n </Banner.Description>\n </Banner>\n )}\n <div\n ref={mergedRef}\n className={wrapperClasses}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-dropzone-inner-wrapper\" {...getRootProps()}>\n <input aria-label=\"Drag and drop area\" {...getInputProps()} />\n <div className=\"ndl-dropzone-inner\">\n {/* Illustration should be visible only after arbitrary width */}\n {width !== undefined && width > 230 && (\n <>\n {isDragActive && !isSafari ? (\n computedFileImage\n ) : (\n <DocumentArrowUpIconOutline className=\"ndl-dropzone-upload-icon\" />\n )}\n </>\n )}\n {!isUploading && (\n <div className=\"ndl-dnd-title-container\">\n <Typography variant=\"subheading-medium\">\n {titleText ||\n (heading ?? (\n <>\n Drag <span className=\"n-font-light\">&</span> Drop\n </>\n ))}\n </Typography>\n {!isDragReject && (\n <div className=\"ndl-dnd-subtitle\">\n <Typography variant=\"body-medium\">or</Typography>{' '}\n <button\n className=\"ndl-dnd-browse-link\"\n onClick={() => open()}\n disabled={isDisabled}\n type=\"button\"\n >\n Browse\n </button>\n </div>\n )}\n </div>\n )}\n <div className=\"ndl-dropzone-footer\">\n {isUploading && <>{loadingElement}</>}\n {!isUploading && (\n <div className=\"ndl-file-support-text\">\n {supportedFilesDescription}\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n </>\n );\n};\n\nconst DropzoneLoadingProgressBarComponent = ({\n progressBarPrecentage,\n progressBarMinute,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneLoadingProgressBarProps>) => {\n return (\n <div className=\"ndl-dropzone-loading-progress-bar-wrapper\">\n <div className=\"ndl-dropzone-loading-progress-bar-indicators\">\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-precentage\"\n variant=\"subheading-small\"\n >\n {`${progressBarPrecentage}%`}\n </Typography>\n {Boolean(progressBarMinute) && (\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-minute\"\n variant=\"body-medium\"\n >{`(${progressBarMinute} minutes left)`}</Typography>\n )}\n </div>\n <ProgressBar\n className={classNames('ndl-dropzone-loading-progress-bar', className)}\n value={progressBarPrecentage}\n size=\"large\"\n htmlAttributes={htmlAttributes}\n ref={ref}\n style={style}\n {...restProps}\n />\n </div>\n );\n};\n\nconst Dropzone = Object.assign(DropzoneComponent, {\n LoadingProgressBar: DropzoneLoadingProgressBarComponent,\n});\n\nexport { Dropzone };\n"]}
@@ -343,6 +343,16 @@ const MenuGroup = (_a) => {
343
343
  const [hasLabel, setHasLabel] = useState(false);
344
344
  return (_jsx(MenuGroupContext.Provider, { value: { labelId, setHasLabel }, children: _jsx("div", Object.assign({ className: classes, style: style, ref: ref, role: "group", "aria-labelledby": hasLabel ? labelId : undefined }, restProps, htmlAttributes, { children: children })) }));
345
345
  };
346
+ /**
347
+ * @remarks
348
+ * `isRoot` is determined internally by checking for a parent context menu. If no parent exists, the component renders as the root menu; otherwise, a nested menu item trigger is rendered. When `isRoot` is `false`, the `title`, `description`, `icon`, and `isDisabled` props are forwarded to the nested menu item trigger component.
349
+ *
350
+ * @remarks
351
+ * The `placement` prop defaults to `bottom-start` when it is the root menu and `right-start` when it is a nested menu item trigger.
352
+ *
353
+ * @remarks
354
+ * The `strategy` prop is set to `fixed` when the context menu is inside a `Dialog` otherwise it is set to `absolute`.
355
+ */
346
356
  const Menu = Object.assign(MenuWrapper, {
347
357
  CategoryItem: CategoryItem,
348
358
  Divider: Divider,
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../src/menu/Menu.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EACV,IAAI,EACJ,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,MAAM,EACN,WAAW,EACX,KAAK,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,EACf,QAAQ,EACR,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,OAAO,EACP,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,sDAAsD,CAAC;AAC/F,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,cAAc,EAA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,EACjB,QAAQ,EACR,SAAS,EACT,cAAc,EACd,KAAK,EACL,GAAG,OAEgC,EADhC,SAAS,cANK,2DAOlB,CADa;IAEZ,MAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;IACxB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEhD,OAAO,CACL,KAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,YACxD,4BACE,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,OAAO,qBACK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,IAC3C,SAAS,EACT,cAAc,cAEjB,QAAQ,IACL,GACoB,CAC7B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE;IACtC,YAAY,EAAE,YAAY;IAC1B,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,QAAQ;IACd;;OAEG;IACH,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,SAAS;CACrB,CAAC,CAAC;AACH,OAAO,EAAE,IAAI,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n autoUpdate,\n flip,\n FloatingFocusManager,\n FloatingList,\n FloatingNode,\n FloatingPortal,\n FloatingTree,\n offset,\n safePolygon,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useFloatingNodeId,\n useFloatingParentNodeId,\n useFloatingTree,\n useHover,\n useInteractions,\n useListItem,\n useListNavigation,\n useMergeRefs,\n useRole,\n useTypeahead,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { Divider } from '../divider';\nimport { CheckIconOutline } from '../icons/generated/heroIcons/CheckIconOutline';\nimport { ChevronRightIconOutline } from '../icons/generated/heroIcons/ChevronRightIconOutline';\nimport { placementTranslation } from '../popover';\nimport { useNeedleTheme } from '../theme';\nimport type {\n CategoryItemProps,\n MenuGroupProps,\n MenuItemComponentProps,\n MenuItemProps,\n MenuItemsProps,\n MenuProps,\n NestedMenuItemProps,\n RadioItemProps,\n} from './menu-types';\n\nconst MenuContext = createContext<{\n getItemProps: (\n userProps?: React.HTMLProps<HTMLElement>,\n ) => Record<string, unknown>;\n activeIndex: number | null;\n setActiveIndex: React.Dispatch<React.SetStateAction<number | null>>;\n setHasFocusInside: React.Dispatch<React.SetStateAction<boolean>>;\n isOpen: boolean;\n}>({\n activeIndex: null,\n getItemProps: () => ({}),\n isOpen: false,\n // oxlint-disable-next-line @typescript-eslint/no-empty-function\n setActiveIndex: () => {},\n // oxlint-disable-next-line @typescript-eslint/no-empty-function\n setHasFocusInside: () => {},\n});\n\nconst MenuGroupContext = createContext<{\n labelId: string;\n setHasLabel: React.Dispatch<React.SetStateAction<boolean>>;\n} | null>(null);\n\nconst MenuWrapper = (props: React.ComponentProps<typeof MenuComponent>) => {\n const parentId = useFloatingParentNodeId();\n\n if (parentId === null) {\n return (\n <FloatingTree>\n <MenuComponent {...props} isRoot />\n </FloatingTree>\n );\n }\n\n return <MenuComponent {...props} />;\n};\n\nconst MenuComponent = <T extends React.ElementType = 'div'>({\n children,\n isOpen: controlledOpen,\n onClose,\n isRoot,\n anchorRef,\n as,\n className,\n placement,\n minWidth,\n title,\n isDisabled,\n description,\n icon,\n isPortaled = true,\n portalTarget,\n htmlAttributes,\n strategy,\n ref: forwardedRef,\n style,\n}: PolymorphicCommonProps<T, MenuProps>) => {\n const [isOpen, setIsOpen] = useState(false);\n const [hasFocusInside, setHasFocusInside] = useState(false);\n const [activeIndex, setActiveIndex] = useState<number | null>(null);\n\n const elementsRef = useRef<Array<HTMLButtonElement | null>>([]);\n const labelsRef = useRef<Array<string | null>>([]);\n const parent = useContext(MenuContext);\n\n const isInsideDialog = useIsInsideDialog();\n const tree = useFloatingTree();\n const nodeId = useFloatingNodeId();\n const parentId = useFloatingParentNodeId();\n const item = useListItem();\n const { themeClassName } = useNeedleTheme();\n useEffect(() => {\n if (controlledOpen === undefined) {\n return;\n }\n setIsOpen(controlledOpen);\n }, [controlledOpen]);\n\n useEffect(() => {\n if (isOpen) {\n setActiveIndex(0);\n }\n }, [isOpen]);\n\n const Component = as ?? 'div';\n\n const isNested = parentId !== null;\n\n const defaultPlacement = isNested ? 'right-start' : 'bottom-start';\n\n const { floatingStyles, refs, context } = useFloating<HTMLButtonElement>({\n elements: {\n reference: anchorRef?.current,\n },\n middleware: [\n offset({\n alignmentAxis: isNested ? -4 : 0,\n mainAxis: isNested ? 0 : 4,\n }),\n ...(isNested ? [shift()] : []),\n flip(\n isNested\n ? {\n fallbackPlacements: ['left-start', 'bottom-start', 'top-start'],\n fallbackStrategy: 'bestFit',\n }\n : { fallbackPlacements: ['left-start', 'right-start'] },\n ),\n shift(),\n ],\n nodeId,\n onOpenChange: (open, event) => {\n if (isDisabled) {\n return;\n }\n\n if (controlledOpen === undefined) {\n setIsOpen(open);\n }\n\n if (!open) {\n if (event instanceof PointerEvent) {\n onClose?.(event, { type: 'backdropClick' });\n } else if (event instanceof KeyboardEvent) {\n onClose?.(event, { type: 'escapeKeyDown' });\n } else if (event instanceof FocusEvent) {\n onClose?.(event, { type: 'focusOut' });\n }\n }\n },\n open: isOpen,\n placement: placement ? placementTranslation[placement] : defaultPlacement,\n strategy: strategy ?? (isInsideDialog ? 'fixed' : 'absolute'),\n whileElementsMounted: autoUpdate,\n });\n\n const hover = useHover(context, {\n delay: { open: 75 },\n enabled: isNested,\n handleClose: safePolygon({ blockPointerEvents: true }),\n });\n const click = useClick(context, {\n event: 'mousedown',\n ignoreMouse: isNested,\n toggle: !isNested,\n });\n const role = useRole(context, { role: 'menu' });\n const dismiss = useDismiss(context, { bubbles: true });\n const listNavigation = useListNavigation(context, {\n activeIndex,\n // Don't disable indices; that way disabled items are still focusable. See: https://www.w3.org/WAI/ARIA/apg/patterns/menubar/\n disabledIndices: [],\n listRef: elementsRef,\n nested: isNested,\n onNavigate: setActiveIndex,\n });\n const typeahead = useTypeahead(context, {\n activeIndex,\n listRef: labelsRef,\n onMatch: isOpen ? setActiveIndex : undefined,\n });\n\n const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions(\n [hover, click, role, dismiss, listNavigation, typeahead],\n );\n\n // Event emitter allows you to communicate across tree components.\n // This effect closes all menus when an item gets clicked anywhere\n // in the tree.\n useEffect(() => {\n if (!tree) {\n return;\n }\n\n function handleTreeClick(data: { id?: string }) {\n if (controlledOpen === undefined) {\n setIsOpen(false);\n }\n onClose?.(undefined, { id: data?.id, type: 'itemClick' });\n }\n\n function onSubMenuOpen(event: { nodeId: string; parentId: string }) {\n if (event.nodeId !== nodeId && event.parentId === parentId) {\n if (controlledOpen === undefined) {\n setIsOpen(false);\n }\n onClose?.(undefined, { type: 'itemClick' });\n }\n }\n\n tree.events.on('click', handleTreeClick);\n tree.events.on('menuopen', onSubMenuOpen);\n\n return () => {\n tree.events.off('click', handleTreeClick);\n tree.events.off('menuopen', onSubMenuOpen);\n };\n }, [tree, nodeId, parentId, onClose, controlledOpen]);\n\n useEffect(() => {\n if (isOpen && tree) {\n tree.events.emit('menuopen', { nodeId, parentId });\n }\n }, [tree, isOpen, nodeId, parentId]);\n\n // Workaround for floating-ui bug where Shift+Tab doesn't trigger\n // closeOnFocusOut.\n // We detect Shift+Tab and check after guards redirect focus whether\n // focus has actually left the floating element.\n // TODO: check every now and then if floating ui addresses this\n const handleShiftTabClose = useCallback(\n (event: React.KeyboardEvent<HTMLElement>) => {\n if (event.key === 'Tab' && event.shiftKey) {\n requestAnimationFrame(() => {\n const floatingEl = refs.floating.current;\n if (floatingEl && !floatingEl.contains(document.activeElement)) {\n if (controlledOpen === undefined) {\n setIsOpen(false);\n }\n onClose?.(undefined, { type: 'focusOut' });\n }\n });\n }\n },\n [controlledOpen, onClose, refs],\n );\n\n const menuClasses = classNames('ndl-menu', themeClassName, className);\n const ref = useMergeRefs([refs.setReference, item.ref, forwardedRef]);\n\n return (\n <FloatingNode id={nodeId}>\n {isRoot !== true && (\n <NestedMenuItem\n ref={ref}\n className={isNested ? 'MenuItem' : 'RootMenu'}\n isDisabled={isDisabled}\n style={style}\n htmlAttributes={{\n 'data-focus-inside': hasFocusInside ? '' : undefined,\n 'data-nested': isNested ? '' : undefined,\n 'data-open': isOpen ? '' : undefined,\n role: isNested ? 'menuitem' : undefined,\n tabIndex: !isNested\n ? undefined\n : parent.activeIndex === item.index\n ? 0\n : -1,\n ...htmlAttributes,\n ...getReferenceProps(\n parent.getItemProps({\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n htmlAttributes?.onFocus?.(event);\n setHasFocusInside(false);\n parent.setHasFocusInside(true);\n },\n }),\n ),\n }}\n title={title}\n description={description}\n leadingVisual={icon}\n />\n )}\n <MenuContext.Provider\n value={{\n activeIndex,\n getItemProps,\n isOpen: isDisabled === true ? false : isOpen,\n setActiveIndex,\n setHasFocusInside,\n }}\n >\n <FloatingList elementsRef={elementsRef} labelsRef={labelsRef}>\n {isOpen && (\n <ConditionalWrap\n shouldWrap={isPortaled}\n wrap={(wrapChildren) => (\n <FloatingPortal root={portalTarget}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <FloatingFocusManager\n context={context}\n modal={false}\n initialFocus={0}\n returnFocus={!isNested}\n closeOnFocusOut={true}\n guards={true}\n >\n <Component\n ref={refs.setFloating}\n className={menuClasses}\n style={{\n minWidth:\n minWidth !== undefined ? `${minWidth}px` : undefined,\n ...floatingStyles,\n ...style,\n }}\n {...getFloatingProps({\n onKeyDown: handleShiftTabClose,\n })}\n >\n {children}\n </Component>\n </FloatingFocusManager>\n </ConditionalWrap>\n )}\n </FloatingList>\n </MenuContext.Provider>\n </FloatingNode>\n );\n};\n\n/**\n * @internal This is used to build the menu item components. Do not export this component.\n */\nconst MenuItemComponent = <T extends React.ElementType = 'button'>({\n title,\n leadingContent,\n trailingContent,\n preLeadingContent,\n description,\n isDisabled,\n as,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, MenuItemComponentProps>) => {\n const classes = classNames(`ndl-menu-item`, className, {\n 'ndl-disabled': isDisabled,\n });\n\n const Component = as ?? 'button';\n\n return (\n <Component\n className={classes}\n ref={ref}\n type=\"button\"\n role=\"menuitem\"\n aria-disabled={isDisabled}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-menu-item-inner\">\n {Boolean(preLeadingContent) && (\n <div className=\"ndl-menu-item-pre-leading-content\">\n {preLeadingContent}\n </div>\n )}\n {Boolean(leadingContent) && (\n <div className=\"ndl-menu-item-leading-content\">{leadingContent}</div>\n )}\n\n <div className=\"ndl-menu-item-title-wrapper\">\n <div className=\"ndl-menu-item-title\">{title}</div>\n {Boolean(description) && (\n <div className=\"ndl-menu-item-description\">{description}</div>\n )}\n </div>\n\n {Boolean(trailingContent) && (\n <div className=\"ndl-menu-item-trailing-content\">\n {trailingContent}\n </div>\n )}\n </div>\n </Component>\n );\n};\n\nconst MenuItem = <T extends React.ElementType = 'button'>({\n title,\n className,\n style,\n leadingVisual,\n trailingContent,\n description,\n isDisabled,\n as,\n onClick,\n onFocus,\n htmlAttributes,\n id,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, MenuItemProps>) => {\n const menu = useContext(MenuContext);\n const itemLabel = typeof title === 'string' ? title : undefined;\n const item = useListItem({ label: itemLabel });\n const tree = useFloatingTree();\n const isActive = item.index === menu.activeIndex;\n\n const mergedRefs = useMergeRefs([item.ref, ref]);\n\n return (\n <MenuItemComponent\n as={as ?? 'button'}\n style={style}\n className={className}\n ref={mergedRefs}\n title={title}\n description={description}\n leadingContent={leadingVisual}\n trailingContent={trailingContent}\n isDisabled={isDisabled}\n htmlAttributes={{\n ...htmlAttributes,\n tabIndex: isActive ? 0 : -1,\n ...menu.getItemProps({\n id: id,\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n if (isDisabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n onClick?.(event);\n tree?.events.emit('click', { id });\n },\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n onFocus?.(event);\n menu.setHasFocusInside(true);\n },\n }),\n }}\n {...restProps}\n />\n );\n};\n\nconst NestedMenuItem = <T extends React.ElementType = 'button'>({\n title,\n isDisabled,\n description,\n leadingVisual,\n as,\n onFocus,\n onClick,\n className,\n style,\n htmlAttributes,\n id,\n ref,\n}: PolymorphicCommonProps<T, NestedMenuItemProps>) => {\n const menu = useContext(MenuContext);\n const itemLabel = typeof title === 'string' ? title : undefined;\n const item = useListItem({ label: itemLabel });\n const isActive = item.index === menu.activeIndex;\n const mergedRefs = useMergeRefs([item.ref, ref]);\n\n return (\n <MenuItemComponent\n as={as ?? 'button'}\n style={style}\n className={className}\n ref={mergedRefs}\n title={title}\n description={description}\n leadingContent={leadingVisual}\n trailingContent={\n <ChevronRightIconOutline className=\"ndl-menu-item-chevron\" />\n }\n isDisabled={isDisabled}\n htmlAttributes={{\n ...htmlAttributes,\n tabIndex: isActive ? 0 : -1,\n ...menu.getItemProps({\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n if (isDisabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n onClick?.(event);\n },\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n onFocus?.(event);\n menu.setHasFocusInside(true);\n },\n onTouchStart() {\n menu.setHasFocusInside(true);\n },\n }),\n id: id,\n }}\n />\n );\n};\n\nconst CategoryItem = <T extends React.ElementType = 'button'>({\n children,\n className,\n style,\n as,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, CategoryItemProps>) => {\n const classes = classNames('ndl-menu-category-item', className);\n const Component: React.ElementType = as ?? 'div';\n const groupContext = useContext(MenuGroupContext);\n\n useEffect(() => {\n if (groupContext) {\n groupContext.setHasLabel(true);\n return () => groupContext.setHasLabel(false);\n }\n }, [groupContext]);\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...(groupContext\n ? { id: groupContext.labelId, role: 'presentation' }\n : { role: 'separator' })}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst RadioItem = <T extends React.ElementType = 'button'>({\n title,\n leadingVisual,\n trailingContent,\n description,\n isDisabled,\n isChecked = false,\n onClick,\n onFocus,\n className,\n style,\n as,\n id,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, RadioItemProps>) => {\n const menu = useContext(MenuContext);\n const itemLabel = typeof title === 'string' ? title : undefined;\n const item = useListItem({ label: itemLabel });\n const tree = useFloatingTree();\n const isActive = item.index === menu.activeIndex;\n\n const mergedRefs = useMergeRefs([item.ref, ref]);\n const classes = classNames('ndl-menu-radio-item', className, {\n 'ndl-checked': isChecked,\n });\n\n return (\n <MenuItemComponent\n as={as ?? 'button'}\n style={style}\n className={classes}\n ref={mergedRefs}\n title={title}\n description={description}\n preLeadingContent={\n isChecked ? (\n <CheckIconOutline className=\"n-size-5 n-shrink-0 n-self-center\" />\n ) : null\n }\n leadingContent={leadingVisual}\n trailingContent={trailingContent}\n isDisabled={isDisabled}\n htmlAttributes={{\n ...htmlAttributes,\n 'aria-checked': isChecked,\n role: 'menuitemradio',\n tabIndex: isActive ? 0 : -1,\n ...menu.getItemProps({\n id: id,\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n if (isDisabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n onClick?.(event);\n tree?.events.emit('click', { id });\n },\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n onFocus?.(event);\n menu.setHasFocusInside(true);\n },\n }),\n }}\n {...restProps}\n />\n );\n};\n\nconst MenuItems = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n htmlAttributes,\n style,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, MenuItemsProps>) => {\n const classes = classNames('ndl-menu-items', className);\n const Component: React.ElementType = as ?? 'div';\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst MenuGroup = ({\n children,\n className,\n htmlAttributes,\n style,\n ref,\n ...restProps\n}: CommonProps<'div', MenuGroupProps>) => {\n const classes = classNames('ndl-menu-group', className);\n const labelId = useId();\n const [hasLabel, setHasLabel] = useState(false);\n\n return (\n <MenuGroupContext.Provider value={{ labelId, setHasLabel }}>\n <div\n className={classes}\n style={style}\n ref={ref}\n role=\"group\"\n aria-labelledby={hasLabel ? labelId : undefined}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n </MenuGroupContext.Provider>\n );\n};\n\nconst Menu = Object.assign(MenuWrapper, {\n CategoryItem: CategoryItem,\n Divider: Divider,\n Group: MenuGroup,\n Item: MenuItem,\n /**\n * @deprecated Use Menu.Group instead if you want to group items together. If not, you can just omit this component in your implementation.\n */\n Items: MenuItems,\n RadioItem: RadioItem,\n});\nexport { Menu };\n"]}
1
+ {"version":3,"file":"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,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,YACxD,4BACE,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,OAAO,qBACK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,IAC3C,SAAS,EACT,cAAc,cAEjB,QAAQ,IACL,GACoB,CAC7B,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE;IACtC,YAAY,EAAE,YAAY;IAC1B,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,QAAQ;IACd;;OAEG;IACH,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,SAAS;CACrB,CAAC,CAAC;AACH,OAAO,EAAE,IAAI,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n autoUpdate,\n flip,\n FloatingFocusManager,\n FloatingList,\n FloatingNode,\n FloatingPortal,\n FloatingTree,\n offset,\n safePolygon,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useFloatingNodeId,\n useFloatingParentNodeId,\n useFloatingTree,\n useHover,\n useInteractions,\n useListItem,\n useListNavigation,\n useMergeRefs,\n useRole,\n useTypeahead,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { Divider } from '../divider';\nimport { CheckIconOutline } from '../icons/generated/heroIcons/CheckIconOutline';\nimport { ChevronRightIconOutline } from '../icons/generated/heroIcons/ChevronRightIconOutline';\nimport { placementTranslation } from '../popover';\nimport { useNeedleTheme } from '../theme';\nimport type {\n CategoryItemProps,\n MenuGroupProps,\n MenuItemComponentProps,\n MenuItemProps,\n MenuItemsProps,\n MenuProps,\n NestedMenuItemProps,\n RadioItemProps,\n} from './menu-types';\n\nconst MenuContext = createContext<{\n getItemProps: (\n userProps?: React.HTMLProps<HTMLElement>,\n ) => Record<string, unknown>;\n activeIndex: number | null;\n setActiveIndex: React.Dispatch<React.SetStateAction<number | null>>;\n setHasFocusInside: React.Dispatch<React.SetStateAction<boolean>>;\n isOpen: boolean;\n}>({\n activeIndex: null,\n getItemProps: () => ({}),\n isOpen: false,\n // oxlint-disable-next-line @typescript-eslint/no-empty-function\n setActiveIndex: () => {},\n // oxlint-disable-next-line @typescript-eslint/no-empty-function\n setHasFocusInside: () => {},\n});\n\nconst MenuGroupContext = createContext<{\n labelId: string;\n setHasLabel: React.Dispatch<React.SetStateAction<boolean>>;\n} | null>(null);\n\nconst MenuWrapper = (props: React.ComponentProps<typeof MenuComponent>) => {\n const parentId = useFloatingParentNodeId();\n\n if (parentId === null) {\n return (\n <FloatingTree>\n <MenuComponent {...props} isRoot />\n </FloatingTree>\n );\n }\n\n return <MenuComponent {...props} />;\n};\n\nconst MenuComponent = <T extends React.ElementType = 'div'>({\n children,\n isOpen: controlledOpen,\n onClose,\n isRoot,\n anchorRef,\n as,\n className,\n placement,\n minWidth,\n title,\n isDisabled,\n description,\n icon,\n isPortaled = true,\n portalTarget,\n htmlAttributes,\n strategy,\n ref: forwardedRef,\n style,\n}: PolymorphicCommonProps<T, MenuProps>) => {\n const [isOpen, setIsOpen] = useState(false);\n const [hasFocusInside, setHasFocusInside] = useState(false);\n const [activeIndex, setActiveIndex] = useState<number | null>(null);\n\n const elementsRef = useRef<Array<HTMLButtonElement | null>>([]);\n const labelsRef = useRef<Array<string | null>>([]);\n const parent = useContext(MenuContext);\n\n const isInsideDialog = useIsInsideDialog();\n const tree = useFloatingTree();\n const nodeId = useFloatingNodeId();\n const parentId = useFloatingParentNodeId();\n const item = useListItem();\n const { themeClassName } = useNeedleTheme();\n useEffect(() => {\n if (controlledOpen === undefined) {\n return;\n }\n setIsOpen(controlledOpen);\n }, [controlledOpen]);\n\n useEffect(() => {\n if (isOpen) {\n setActiveIndex(0);\n }\n }, [isOpen]);\n\n const Component = as ?? 'div';\n\n const isNested = parentId !== null;\n\n const defaultPlacement = isNested ? 'right-start' : 'bottom-start';\n\n const { floatingStyles, refs, context } = useFloating<HTMLButtonElement>({\n elements: {\n reference: anchorRef?.current,\n },\n middleware: [\n offset({\n alignmentAxis: isNested ? -4 : 0,\n mainAxis: isNested ? 0 : 4,\n }),\n ...(isNested ? [shift()] : []),\n flip(\n isNested\n ? {\n fallbackPlacements: ['left-start', 'bottom-start', 'top-start'],\n fallbackStrategy: 'bestFit',\n }\n : { fallbackPlacements: ['left-start', 'right-start'] },\n ),\n shift(),\n ],\n nodeId,\n onOpenChange: (open, event) => {\n if (isDisabled) {\n return;\n }\n\n if (controlledOpen === undefined) {\n setIsOpen(open);\n }\n\n if (!open) {\n if (event instanceof PointerEvent) {\n onClose?.(event, { type: 'backdropClick' });\n } else if (event instanceof KeyboardEvent) {\n onClose?.(event, { type: 'escapeKeyDown' });\n } else if (event instanceof FocusEvent) {\n onClose?.(event, { type: 'focusOut' });\n }\n }\n },\n open: isOpen,\n placement: placement ? placementTranslation[placement] : defaultPlacement,\n strategy: strategy ?? (isInsideDialog ? 'fixed' : 'absolute'),\n whileElementsMounted: autoUpdate,\n });\n\n const hover = useHover(context, {\n delay: { open: 75 },\n enabled: isNested,\n handleClose: safePolygon({ blockPointerEvents: true }),\n });\n const click = useClick(context, {\n event: 'mousedown',\n ignoreMouse: isNested,\n toggle: !isNested,\n });\n const role = useRole(context, { role: 'menu' });\n const dismiss = useDismiss(context, { bubbles: true });\n const listNavigation = useListNavigation(context, {\n activeIndex,\n // Don't disable indices; that way disabled items are still focusable. See: https://www.w3.org/WAI/ARIA/apg/patterns/menubar/\n disabledIndices: [],\n listRef: elementsRef,\n nested: isNested,\n onNavigate: setActiveIndex,\n });\n const typeahead = useTypeahead(context, {\n activeIndex,\n listRef: labelsRef,\n onMatch: isOpen ? setActiveIndex : undefined,\n });\n\n const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions(\n [hover, click, role, dismiss, listNavigation, typeahead],\n );\n\n // Event emitter allows you to communicate across tree components.\n // This effect closes all menus when an item gets clicked anywhere\n // in the tree.\n useEffect(() => {\n if (!tree) {\n return;\n }\n\n function handleTreeClick(data: { id?: string }) {\n if (controlledOpen === undefined) {\n setIsOpen(false);\n }\n onClose?.(undefined, { id: data?.id, type: 'itemClick' });\n }\n\n function onSubMenuOpen(event: { nodeId: string; parentId: string }) {\n if (event.nodeId !== nodeId && event.parentId === parentId) {\n if (controlledOpen === undefined) {\n setIsOpen(false);\n }\n onClose?.(undefined, { type: 'itemClick' });\n }\n }\n\n tree.events.on('click', handleTreeClick);\n tree.events.on('menuopen', onSubMenuOpen);\n\n return () => {\n tree.events.off('click', handleTreeClick);\n tree.events.off('menuopen', onSubMenuOpen);\n };\n }, [tree, nodeId, parentId, onClose, controlledOpen]);\n\n useEffect(() => {\n if (isOpen && tree) {\n tree.events.emit('menuopen', { nodeId, parentId });\n }\n }, [tree, isOpen, nodeId, parentId]);\n\n // Workaround for floating-ui bug where Shift+Tab doesn't trigger\n // closeOnFocusOut.\n // We detect Shift+Tab and check after guards redirect focus whether\n // focus has actually left the floating element.\n // TODO: check every now and then if floating ui addresses this\n const handleShiftTabClose = useCallback(\n (event: React.KeyboardEvent<HTMLElement>) => {\n if (event.key === 'Tab' && event.shiftKey) {\n requestAnimationFrame(() => {\n const floatingEl = refs.floating.current;\n if (floatingEl && !floatingEl.contains(document.activeElement)) {\n if (controlledOpen === undefined) {\n setIsOpen(false);\n }\n onClose?.(undefined, { type: 'focusOut' });\n }\n });\n }\n },\n [controlledOpen, onClose, refs],\n );\n\n const menuClasses = classNames('ndl-menu', themeClassName, className);\n const ref = useMergeRefs([refs.setReference, item.ref, forwardedRef]);\n\n return (\n <FloatingNode id={nodeId}>\n {isRoot !== true && (\n <NestedMenuItem\n ref={ref}\n className={isNested ? 'MenuItem' : 'RootMenu'}\n isDisabled={isDisabled}\n style={style}\n htmlAttributes={{\n 'data-focus-inside': hasFocusInside ? '' : undefined,\n 'data-nested': isNested ? '' : undefined,\n 'data-open': isOpen ? '' : undefined,\n role: isNested ? 'menuitem' : undefined,\n tabIndex: !isNested\n ? undefined\n : parent.activeIndex === item.index\n ? 0\n : -1,\n ...htmlAttributes,\n ...getReferenceProps(\n parent.getItemProps({\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n htmlAttributes?.onFocus?.(event);\n setHasFocusInside(false);\n parent.setHasFocusInside(true);\n },\n }),\n ),\n }}\n title={title}\n description={description}\n leadingVisual={icon}\n />\n )}\n <MenuContext.Provider\n value={{\n activeIndex,\n getItemProps,\n isOpen: isDisabled === true ? false : isOpen,\n setActiveIndex,\n setHasFocusInside,\n }}\n >\n <FloatingList elementsRef={elementsRef} labelsRef={labelsRef}>\n {isOpen && (\n <ConditionalWrap\n shouldWrap={isPortaled}\n wrap={(wrapChildren) => (\n <FloatingPortal root={portalTarget}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <FloatingFocusManager\n context={context}\n modal={false}\n initialFocus={0}\n returnFocus={!isNested}\n closeOnFocusOut={true}\n guards={true}\n >\n <Component\n ref={refs.setFloating}\n className={menuClasses}\n style={{\n minWidth:\n minWidth !== undefined ? `${minWidth}px` : undefined,\n ...floatingStyles,\n ...style,\n }}\n {...getFloatingProps({\n onKeyDown: handleShiftTabClose,\n })}\n >\n {children}\n </Component>\n </FloatingFocusManager>\n </ConditionalWrap>\n )}\n </FloatingList>\n </MenuContext.Provider>\n </FloatingNode>\n );\n};\n\n/**\n * @internal This is used to build the menu item components. Do not export this component.\n */\nconst MenuItemComponent = <T extends React.ElementType = 'button'>({\n title,\n leadingContent,\n trailingContent,\n preLeadingContent,\n description,\n isDisabled,\n as,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, MenuItemComponentProps>) => {\n const classes = classNames(`ndl-menu-item`, className, {\n 'ndl-disabled': isDisabled,\n });\n\n const Component = as ?? 'button';\n\n return (\n <Component\n className={classes}\n ref={ref}\n type=\"button\"\n role=\"menuitem\"\n aria-disabled={isDisabled}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-menu-item-inner\">\n {Boolean(preLeadingContent) && (\n <div className=\"ndl-menu-item-pre-leading-content\">\n {preLeadingContent}\n </div>\n )}\n {Boolean(leadingContent) && (\n <div className=\"ndl-menu-item-leading-content\">{leadingContent}</div>\n )}\n\n <div className=\"ndl-menu-item-title-wrapper\">\n <div className=\"ndl-menu-item-title\">{title}</div>\n {Boolean(description) && (\n <div className=\"ndl-menu-item-description\">{description}</div>\n )}\n </div>\n\n {Boolean(trailingContent) && (\n <div className=\"ndl-menu-item-trailing-content\">\n {trailingContent}\n </div>\n )}\n </div>\n </Component>\n );\n};\n\nconst MenuItem = <T extends React.ElementType = 'button'>({\n title,\n className,\n style,\n leadingVisual,\n trailingContent,\n description,\n isDisabled,\n as,\n onClick,\n onFocus,\n htmlAttributes,\n id,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, MenuItemProps>) => {\n const menu = useContext(MenuContext);\n const itemLabel = typeof title === 'string' ? title : undefined;\n const item = useListItem({ label: itemLabel });\n const tree = useFloatingTree();\n const isActive = item.index === menu.activeIndex;\n\n const mergedRefs = useMergeRefs([item.ref, ref]);\n\n return (\n <MenuItemComponent\n as={as ?? 'button'}\n style={style}\n className={className}\n ref={mergedRefs}\n title={title}\n description={description}\n leadingContent={leadingVisual}\n trailingContent={trailingContent}\n isDisabled={isDisabled}\n htmlAttributes={{\n ...htmlAttributes,\n tabIndex: isActive ? 0 : -1,\n ...menu.getItemProps({\n id: id,\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n if (isDisabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n onClick?.(event);\n tree?.events.emit('click', { id });\n },\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n onFocus?.(event);\n menu.setHasFocusInside(true);\n },\n }),\n }}\n {...restProps}\n />\n );\n};\n\nconst NestedMenuItem = <T extends React.ElementType = 'button'>({\n title,\n isDisabled,\n description,\n leadingVisual,\n as,\n onFocus,\n onClick,\n className,\n style,\n htmlAttributes,\n id,\n ref,\n}: PolymorphicCommonProps<T, NestedMenuItemProps>) => {\n const menu = useContext(MenuContext);\n const itemLabel = typeof title === 'string' ? title : undefined;\n const item = useListItem({ label: itemLabel });\n const isActive = item.index === menu.activeIndex;\n const mergedRefs = useMergeRefs([item.ref, ref]);\n\n return (\n <MenuItemComponent\n as={as ?? 'button'}\n style={style}\n className={className}\n ref={mergedRefs}\n title={title}\n description={description}\n leadingContent={leadingVisual}\n trailingContent={\n <ChevronRightIconOutline className=\"ndl-menu-item-chevron\" />\n }\n isDisabled={isDisabled}\n htmlAttributes={{\n ...htmlAttributes,\n tabIndex: isActive ? 0 : -1,\n ...menu.getItemProps({\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n if (isDisabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n onClick?.(event);\n },\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n onFocus?.(event);\n menu.setHasFocusInside(true);\n },\n onTouchStart() {\n menu.setHasFocusInside(true);\n },\n }),\n id: id,\n }}\n />\n );\n};\n\nconst CategoryItem = <T extends React.ElementType = 'button'>({\n children,\n className,\n style,\n as,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, CategoryItemProps>) => {\n const classes = classNames('ndl-menu-category-item', className);\n const Component: React.ElementType = as ?? 'div';\n const groupContext = useContext(MenuGroupContext);\n\n useEffect(() => {\n if (groupContext) {\n groupContext.setHasLabel(true);\n return () => groupContext.setHasLabel(false);\n }\n }, [groupContext]);\n\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...(groupContext\n ? { id: groupContext.labelId, role: 'presentation' }\n : { role: 'separator' })}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst RadioItem = <T extends React.ElementType = 'button'>({\n title,\n leadingVisual,\n trailingContent,\n description,\n isDisabled,\n isChecked = false,\n onClick,\n onFocus,\n className,\n style,\n as,\n id,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, RadioItemProps>) => {\n const menu = useContext(MenuContext);\n const itemLabel = typeof title === 'string' ? title : undefined;\n const item = useListItem({ label: itemLabel });\n const tree = useFloatingTree();\n const isActive = item.index === menu.activeIndex;\n\n const mergedRefs = useMergeRefs([item.ref, ref]);\n const classes = classNames('ndl-menu-radio-item', className, {\n 'ndl-checked': isChecked,\n });\n\n return (\n <MenuItemComponent\n as={as ?? 'button'}\n style={style}\n className={classes}\n ref={mergedRefs}\n title={title}\n description={description}\n preLeadingContent={\n isChecked ? (\n <CheckIconOutline className=\"n-size-5 n-shrink-0 n-self-center\" />\n ) : null\n }\n leadingContent={leadingVisual}\n trailingContent={trailingContent}\n isDisabled={isDisabled}\n htmlAttributes={{\n ...htmlAttributes,\n 'aria-checked': isChecked,\n role: 'menuitemradio',\n tabIndex: isActive ? 0 : -1,\n ...menu.getItemProps({\n id: id,\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n if (isDisabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n onClick?.(event);\n tree?.events.emit('click', { id });\n },\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n onFocus?.(event);\n menu.setHasFocusInside(true);\n },\n }),\n }}\n {...restProps}\n />\n );\n};\n\nconst MenuItems = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n htmlAttributes,\n style,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, MenuItemsProps>) => {\n const classes = classNames('ndl-menu-items', className);\n const Component: React.ElementType = as ?? 'div';\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst MenuGroup = ({\n children,\n className,\n htmlAttributes,\n style,\n ref,\n ...restProps\n}: CommonProps<'div', MenuGroupProps>) => {\n const classes = classNames('ndl-menu-group', className);\n const labelId = useId();\n const [hasLabel, setHasLabel] = useState(false);\n\n return (\n <MenuGroupContext.Provider value={{ labelId, setHasLabel }}>\n <div\n className={classes}\n style={style}\n ref={ref}\n role=\"group\"\n aria-labelledby={hasLabel ? labelId : undefined}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n </MenuGroupContext.Provider>\n );\n};\n\n/**\n * @remarks\n * `isRoot` is determined internally by checking for a parent context menu. If no parent exists, the component renders as the root menu; otherwise, a nested menu item trigger is rendered. When `isRoot` is `false`, the `title`, `description`, `icon`, and `isDisabled` props are forwarded to the nested menu item trigger component.\n *\n * @remarks\n * The `placement` prop defaults to `bottom-start` when it is the root menu and `right-start` when it is a nested menu item trigger.\n *\n * @remarks\n * The `strategy` prop is set to `fixed` when the context menu is inside a `Dialog` otherwise it is set to `absolute`.\n */\nconst Menu = Object.assign(MenuWrapper, {\n CategoryItem: CategoryItem,\n Divider: Divider,\n Group: MenuGroup,\n Item: MenuItem,\n /**\n * @deprecated Use Menu.Group instead if you want to group items together. If not, you can just omit this component in your implementation.\n */\n Items: MenuItems,\n RadioItem: RadioItem,\n});\nexport { Menu };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sour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YAE1B,cAAK,SAAS,EAAC,oBAAoB,EAAC,IAAI,EAAC,cAAc,GAAG,GACnD,EACT,KAAC,MAAM,IAAC,SAAS,EAAE,SAAS,YAC1B,KAAC,SAAS,IAAC,kBAAkB,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,YACpD,8BACM,SAAS,IACb,SAAS,EAAE,WAAW,EACtB,IAAI,EAAC,cAAc,EACnB,OAAO,EAAE,mBAAmB,EAC5B,WAAW,EAAE,eAAe,YAE5B,4BACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,QAAQ,gBACF,MAAM,EACjB,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,IACR,SAAS,EACT,cAAc,cAEjB,QAAQ,IACL,IACF,GACI,GACL,IACR,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport React, { useEffect } from 'react';\nimport FocusLock from 'react-focus-lock';\n\nimport { type CommonProps, type HtmlAttributes } from '../_common/types';\nimport { useDocumentScrollToggle } from '../_common/utils';\nimport { Portal } from '../portal';\n\nexport enum ModalCloseReason {\n BACKDROP_CLICK = 'backdropClick',\n ESCAPE_KEY_DOWN = 'escapeKeyDown',\n}\n\nexport interface ModalProps {\n /** Whether the Modal is open. */\n isOpen: boolean;\n /** Content to render inside the Modal. */\n children: React.ReactNode;\n /** Sets the size(max-width) of the Modal, use 'unset' for custom sizing. */\n size?: 'small' | 'medium' | 'large' | 'unset';\n /** The container where the modal will be rendered. */\n container?: Element;\n /** Callback function called when the modal is closed. */\n onClose?: (\n e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n reason?: ModalCloseReason,\n ) => void;\n /** Forwards the props to the modal container's wrapper - use with caution */\n rootProps?: HtmlAttributes<'div'>;\n}\n\nexport const Modal = ({\n isOpen: open,\n size = 'medium',\n onClose,\n children,\n container,\n rootProps,\n style,\n className,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', ModalProps>) => {\n const toggleScrollbar = useDocumentScrollToggle();\n const backdropClick = React.useRef<boolean | null>(null);\n\n const handleMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {\n // We don't want to close the dialog when clicking the dialog content.\n // Make sure the event starts and ends on the same DOM element.\n backdropClick.current = event.target === event.currentTarget;\n };\n\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n onClose?.(\n e as unknown as React.KeyboardEvent<HTMLElement>,\n ModalCloseReason.ESCAPE_KEY_DOWN,\n );\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [onClose]);\n\n const handleBackdropClick = (e: React.MouseEvent<HTMLDivElement>) => {\n if (Boolean(backdropClick.current) === false) {\n return;\n }\n\n backdropClick.current = null;\n onClose?.(e, ModalCloseReason.BACKDROP_CLICK);\n };\n\n useEffect(() => {\n toggleScrollbar(open);\n\n return () => toggleScrollbar(false);\n }, [open, toggleScrollbar]);\n\n if (!open) {\n return null;\n }\n\n const classes = classNames('ndl-modal', className, {\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n const rootClasses = classNames('ndl-modal-root', rootProps?.className, {\n 'ndl-modal-container': container,\n });\n\n return (\n <>\n <Portal container={container}>\n {/** This is to separate the colored backdrop with the blur from the modal. */}\n <div className=\"ndl-modal-backdrop\" role=\"presentation\" />\n </Portal>\n <Portal container={container}>\n <FocusLock hasPositiveIndices={true} returnFocus={true}>\n <div\n {...rootProps}\n className={rootClasses}\n role=\"presentation\"\n onClick={handleBackdropClick}\n onMouseDown={handleMouseDown}\n >\n <div\n ref={ref}\n role=\"dialog\"\n aria-modal=\"true\"\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n </div>\n </FocusLock>\n </Portal>\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/modal/Modal.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAGzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,oDAAgC,CAAA;IAChC,qDAAiC,CAAA;AACnC,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AA2BD,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAYW,EAAE,EAAE;QAZf,EACpB,MAAM,EAAE,IAAI,EACZ,IAAI,GAAG,QAAQ,EACf,OAAO,EACP,QAAQ,EACR,SAAS,EACT,SAAS,EACT,KAAK,EACL,SAAS,EACT,cAAc,EACd,GAAG,OAE4B,EAD5B,SAAS,cAXQ,kHAYrB,CADa;IAEZ,MAAM,eAAe,GAAG,uBAAuB,EAAE,CAAC;IAClD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IAEzD,MAAM,eAAe,GAAG,CAAC,KAAuC,EAAE,EAAE;QAClE,s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EAAE;QACjD,WAAW,EAAE,IAAI,KAAK,OAAO;QAC7B,YAAY,EAAE,IAAI,KAAK,QAAQ;QAC/B,WAAW,EAAE,IAAI,KAAK,OAAO;KAC9B,CAAC,CAAC;IACH,MAAM,WAAW,GAAG,UAAU,CAAC,gBAAgB,EAAE,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,SAAS,EAAE;QACrE,qBAAqB,EAAE,SAAS;KACjC,CAAC,CAAC;IAEH,OAAO,CACL,8BACE,KAAC,MAAM,IAAC,SAAS,EAAE,SAAS,YAE1B,cAAK,SAAS,EAAC,oBAAoB,EAAC,IAAI,EAAC,cAAc,GAAG,GACnD,EACT,KAAC,MAAM,IAAC,SAAS,EAAE,SAAS,YAC1B,KAAC,SAAS,IAAC,kBAAkB,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,YACpD,8BACM,SAAS,IACb,SAAS,EAAE,WAAW,EACtB,IAAI,EAAC,cAAc,EACnB,OAAO,EAAE,mBAAmB,EAC5B,WAAW,EAAE,eAAe,YAE5B,4BACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,QAAQ,gBACF,MAAM,EACjB,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,IACR,SAAS,EACT,cAAc,cAEjB,QAAQ,IACL,IACF,GACI,GACL,IACR,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport React, { useEffect } from 'react';\nimport FocusLock from 'react-focus-lock';\n\nimport { type CommonProps, type HtmlAttributes } from '../_common/types';\nimport { useDocumentScrollToggle } from '../_common/utils';\nimport { Portal } from '../portal';\n\nexport enum ModalCloseReason {\n BACKDROP_CLICK = 'backdropClick',\n ESCAPE_KEY_DOWN = 'escapeKeyDown',\n}\n\n/**\n * @remarks\n * Where `Element` is the most general base class from which all objects in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element.\n *\n * @remarks\n * Where `HtmlAttributes<\"div\">` is a type that includes all standard HTML div element attributes plus any custom data attributes (like data-testid or data-value) that follow the data-* pattern.\n */\nexport interface ModalProps {\n /** Whether the Modal is open. */\n isOpen: boolean;\n /** Content to render inside the Modal. */\n children: React.ReactNode;\n /** Sets the size(max-width) of the Modal, use 'unset' for custom sizing. */\n size?: 'small' | 'medium' | 'large' | 'unset';\n /** The container where the modal will be rendered. */\n container?: Element;\n /** Callback function called when the modal is closed. */\n onClose?: (\n e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n reason?: ModalCloseReason,\n ) => void;\n /** Forwards the props to the modal container's wrapper - use with caution */\n rootProps?: HtmlAttributes<'div'>;\n}\n\nexport const Modal = ({\n isOpen: open,\n size = 'medium',\n onClose,\n children,\n container,\n rootProps,\n style,\n className,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', ModalProps>) => {\n const toggleScrollbar = useDocumentScrollToggle();\n const backdropClick = React.useRef<boolean | null>(null);\n\n const handleMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {\n // We don't want to close the dialog when clicking the dialog content.\n // Make sure the event starts and ends on the same DOM element.\n backdropClick.current = event.target === event.currentTarget;\n };\n\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n onClose?.(\n e as unknown as React.KeyboardEvent<HTMLElement>,\n ModalCloseReason.ESCAPE_KEY_DOWN,\n );\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [onClose]);\n\n const handleBackdropClick = (e: React.MouseEvent<HTMLDivElement>) => {\n if (Boolean(backdropClick.current) === false) {\n return;\n }\n\n backdropClick.current = null;\n onClose?.(e, ModalCloseReason.BACKDROP_CLICK);\n };\n\n useEffect(() => {\n toggleScrollbar(open);\n\n return () => toggleScrollbar(false);\n }, [open, toggleScrollbar]);\n\n if (!open) {\n return null;\n }\n\n const classes = classNames('ndl-modal', className, {\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n const rootClasses = classNames('ndl-modal-root', rootProps?.className, {\n 'ndl-modal-container': container,\n });\n\n return (\n <>\n <Portal container={container}>\n {/** This is to separate the colored backdrop with the blur from the modal. */}\n <div className=\"ndl-modal-backdrop\" role=\"presentation\" />\n </Portal>\n <Portal container={container}>\n <FocusLock hasPositiveIndices={true} returnFocus={true}>\n <div\n {...rootProps}\n className={rootClasses}\n role=\"presentation\"\n onClick={handleBackdropClick}\n onMouseDown={handleMouseDown}\n >\n <div\n ref={ref}\n role=\"dialog\"\n aria-modal=\"true\"\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n </div>\n </FocusLock>\n </Portal>\n </>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControl.js","sourceRoot":"","sources":["../../../src/segmented-control/SegmentedControl.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAM1C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAyB7C,wCAAwC;AACxC,MAAM,uBAAuB;AAC3B,8DAA8D;AAC9D,KAAK,CAAC,aAAa,CAAsC,IAAI,CAAC,CAAC;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oBAAoB,CAAC,WAAW,GAAG,uBAAuB,CAAC;AAE3D,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,yBAAyB,EAAE;IAChE,IAAI,EAAE,oBAAoB;CAC3B,CAAC,CAAC;AAEH,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport React, { useContext } from 'react';\n\nimport {\n type PolymorphicCommonProps,\n type TooltipObjectProps,\n} from '../_common/types';\nimport { Tooltip } from '../tooltip/Tooltip';\n\ntype SegmentedControlID = string | number;\n\ntype SegmentedControlProps<T extends SegmentedControlID> = {\n /** Additional class name */\n className?: string;\n /** Size of the segmented control */\n size?: 'small' | 'medium' | 'large';\n /** If segmented control items will include only icons (makes controls rectangular) */\n hasOnlyIcons?: boolean;\n /** The callback function triggered when the segmented control value changes */\n onChange: (e: T) => void | ((e: React.SetStateAction<T>) => void);\n /** The currently selected option */\n selected: T;\n /** The children component of the segmented control */\n children: React.ReactNode;\n /** Whether the segmented control has a box shadow applied */\n isFloating?: boolean;\n};\n\ntype SegmentedControlContext<T extends SegmentedControlID> = Required<\n Pick<SegmentedControlProps<T>, 'onChange' | 'selected' | 'hasOnlyIcons'>\n>;\n\n// eslint-disable-next-line no-redeclare\nconst SegmentedControlContext =\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n React.createContext<SegmentedControlContext<any> | null>(null);\n\nconst useSelectorContext = () => {\n const context = useContext(SegmentedControlContext);\n\n if (context === null) {\n throw new Error('SegmentedControl used without context');\n }\n\n return context;\n};\n\nconst SegmentedControlComponent = <\n T extends SegmentedControlID,\n U extends React.ElementType = 'div',\n>({\n size = 'medium',\n hasOnlyIcons = false,\n children,\n selected,\n onChange,\n as,\n className,\n style,\n isFloating = false,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<U, SegmentedControlProps<T>>) => {\n const classes = classNames('ndl-segmented-control', className, {\n 'ndl-floating': isFloating,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n\n const Component = as ?? 'div';\n\n return (\n <Component\n className={classes}\n style={style}\n role=\"group\"\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n <SegmentedControlContext.Provider\n value={{ hasOnlyIcons, onChange, selected }}\n >\n {children}\n </SegmentedControlContext.Provider>\n </Component>\n );\n};\n\nSegmentedControlComponent.displayName = 'SegmentedControl';\n\ntype SegmentedControlItemProps = {\n /** Additional class name */\n className?: string;\n /** The children component of the segmented control item */\n children?: React.ReactNode;\n /** The value of the segmented control item */\n value: string;\n /** The description of the segmented control item, will be displayed in the tooltip */\n description?: string;\n /** The tooltip props that will be applied if tooltip is set */\n tooltipProps?: TooltipObjectProps;\n /** Whether the segmented control item is disabled */\n isDisabled?: boolean;\n};\n\nconst SegmentedControlItem = <T extends React.ElementType = 'button'>({\n as,\n children,\n className,\n style,\n value,\n htmlAttributes,\n description,\n tooltipProps,\n isDisabled = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, SegmentedControlItemProps>) => {\n const { onChange, selected, hasOnlyIcons } = useSelectorContext();\n\n const isSelected = value === selected;\n\n const baseClasses = classNames(className, {\n 'ndl-current': isSelected,\n 'ndl-segment-icon': hasOnlyIcons,\n 'ndl-segment-item': !hasOnlyIcons,\n });\n\n const Component: React.ElementType = as ?? 'button';\n\n return (\n <Tooltip\n isPortaled={false}\n isDisabled={Boolean(description) === false}\n {...tooltipProps?.root}\n type=\"simple\"\n >\n <Tooltip.Trigger {...tooltipProps?.trigger} hasButtonWrapper>\n <Component\n aria-pressed={isSelected}\n onClick={() => !isSelected && onChange(value)}\n className={baseClasses}\n style={style}\n ref={ref}\n aria-label={description}\n disabled={isDisabled}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n </Tooltip.Trigger>\n <Tooltip.Content {...tooltipProps?.content}>\n <Tooltip.Body>{description}</Tooltip.Body>\n </Tooltip.Content>\n </Tooltip>\n );\n};\n\nSegmentedControlItem.displayName = 'SegmentedControl.Item';\n\nconst SegmentedControl = Object.assign(SegmentedControlComponent, {\n Item: SegmentedControlItem,\n});\n\nexport { SegmentedControl };\n"]}
1
+ {"version":3,"file":"SegmentedControl.js","sourceRoot":"","sources":["../../../src/segmented-control/SegmentedControl.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAM1C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AA6B7C,wCAAwC;AACxC,MAAM,uBAAuB;AAC3B,8DAA8D;AAC9D,KAAK,CAAC,aAAa,CAAsC,IAAI,CAAC,CAAC;AAEjE,MAAM,kBAAkB,GAAG,GAAG,EAAE;IAC9B,MAAM,OAAO,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAC;IAEpD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,CAGhC,EAaoD,EAAE,EAAE;QAbxD,EACA,IAAI,GAAG,QAAQ,EACf,YAAY,GAAG,KAAK,EACpB,QAAQ,EACR,QAAQ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QAChC,kBAAkB,EAAE,CAAC,YAAY;KAClC,CAAC,CAAC;IAEH,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,QAAQ,CAAC;IAEpD,OAAO,CACL,MAAC,OAAO,kBACN,UAAU,EAAE,KAAK,EACjB,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,KAAK,IACtC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,IACtB,IAAI,EAAC,QAAQ,aAEb,KAAC,OAAO,CAAC,OAAO,oBAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,IAAE,gBAAgB,kBAC1D,KAAC,SAAS,kCACM,UAAU,EACxB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,UAAU,IAAI,QAAQ,CAAC,KAAK,CAAC,EAC7C,SAAS,EAAE,WAAW,EACtB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,gBACI,WAAW,EACvB,QAAQ,EAAE,UAAU,IAChB,SAAS,EACT,cAAc,cAEjB,QAAQ,IACC,IACI,EAClB,KAAC,OAAO,CAAC,OAAO,oBAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,cACxC,KAAC,OAAO,CAAC,IAAI,cAAE,WAAW,GAAgB,IAC1B,KACV,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,oBAAoB,CAAC,WAAW,GAAG,uBAAuB,CAAC;AAE3D,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,yBAAyB,EAAE;IAChE,IAAI,EAAE,oBAAoB;CAC3B,CAAC,CAAC;AAEH,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport React, { useContext } from 'react';\n\nimport {\n type PolymorphicCommonProps,\n type TooltipObjectProps,\n} from '../_common/types';\nimport { Tooltip } from '../tooltip/Tooltip';\n\ntype SegmentedControlID = string | number;\n\n/**\n * @remarks\n * Where type `SegmentedControlID` is defined as: `string | number`.\n */\ntype SegmentedControlProps<T extends SegmentedControlID> = {\n /** Additional class name */\n className?: string;\n /** Size of the segmented control */\n size?: 'small' | 'medium' | 'large';\n /** If segmented control items will include only icons (makes controls rectangular) */\n hasOnlyIcons?: boolean;\n /** The callback function triggered when the segmented control value changes */\n onChange: (e: T) => void | ((e: React.SetStateAction<T>) => void);\n /** The currently selected option */\n selected: T;\n /** The children component of the segmented control */\n children: React.ReactNode;\n /** Whether the segmented control has a box shadow applied */\n isFloating?: boolean;\n};\n\ntype SegmentedControlContext<T extends SegmentedControlID> = Required<\n Pick<SegmentedControlProps<T>, 'onChange' | 'selected' | 'hasOnlyIcons'>\n>;\n\n// eslint-disable-next-line no-redeclare\nconst SegmentedControlContext =\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n React.createContext<SegmentedControlContext<any> | null>(null);\n\nconst useSelectorContext = () => {\n const context = useContext(SegmentedControlContext);\n\n if (context === null) {\n throw new Error('SegmentedControl used without context');\n }\n\n return context;\n};\n\nconst SegmentedControlComponent = <\n T extends SegmentedControlID,\n U extends React.ElementType = 'div',\n>({\n size = 'medium',\n hasOnlyIcons = false,\n children,\n selected,\n onChange,\n as,\n className,\n style,\n isFloating = false,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<U, SegmentedControlProps<T>>) => {\n const classes = classNames('ndl-segmented-control', className, {\n 'ndl-floating': isFloating,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n\n const Component = as ?? 'div';\n\n return (\n <Component\n className={classes}\n style={style}\n role=\"group\"\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n <SegmentedControlContext.Provider\n value={{ hasOnlyIcons, onChange, selected }}\n >\n {children}\n </SegmentedControlContext.Provider>\n </Component>\n );\n};\n\nSegmentedControlComponent.displayName = 'SegmentedControl';\n\n/**\n * @remarks\n * When the `description` prop is set, hovering over the segmented control item will show a tooltip with the text provided in the `description` prop. `tooltipProps` can be used to customize the tooltip appearance. The `TooltipObjectProps` type is defined as: `{ root?: Partial<React.ComponentProps<typeof Tooltip>>; trigger?: Partial<React.ComponentProps<typeof Tooltip.Trigger>>; content?: Partial<React.ComponentProps<typeof Tooltip.Content>>; }`, see the Tooltip component for more details.\n */\ntype SegmentedControlItemProps = {\n /** Additional class name */\n className?: string;\n /** The children component of the segmented control item */\n children?: React.ReactNode;\n /** The value of the segmented control item */\n value: string;\n /** The description of the segmented control item, will be displayed in the tooltip */\n description?: string;\n /** The tooltip props that will be applied if tooltip is set */\n tooltipProps?: TooltipObjectProps;\n /** Whether the segmented control item is disabled */\n isDisabled?: boolean;\n};\n\nconst SegmentedControlItem = <T extends React.ElementType = 'button'>({\n as,\n children,\n className,\n style,\n value,\n htmlAttributes,\n description,\n tooltipProps,\n isDisabled = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, SegmentedControlItemProps>) => {\n const { onChange, selected, hasOnlyIcons } = useSelectorContext();\n\n const isSelected = value === selected;\n\n const baseClasses = classNames(className, {\n 'ndl-current': isSelected,\n 'ndl-segment-icon': hasOnlyIcons,\n 'ndl-segment-item': !hasOnlyIcons,\n });\n\n const Component: React.ElementType = as ?? 'button';\n\n return (\n <Tooltip\n isPortaled={false}\n isDisabled={Boolean(description) === false}\n {...tooltipProps?.root}\n type=\"simple\"\n >\n <Tooltip.Trigger {...tooltipProps?.trigger} hasButtonWrapper>\n <Component\n aria-pressed={isSelected}\n onClick={() => !isSelected && onChange(value)}\n className={baseClasses}\n style={style}\n ref={ref}\n aria-label={description}\n disabled={isDisabled}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n </Tooltip.Trigger>\n <Tooltip.Content {...tooltipProps?.content}>\n <Tooltip.Body>{description}</Tooltip.Body>\n </Tooltip.Content>\n </Tooltip>\n );\n};\n\nSegmentedControlItem.displayName = 'SegmentedControl.Item';\n\nconst SegmentedControl = Object.assign(SegmentedControlComponent, {\n Item: SegmentedControlItem,\n});\n\nexport { SegmentedControl };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/select/types.tsx"],"names":[],"mappings":"","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type ReactNode } from 'react';\nimport { type GroupBase, type Props } from 'react-select';\nimport { type AsyncProps } from 'react-select/async';\nimport { type CreatableProps } from 'react-select/creatable';\n\nexport type SelectCommonProps = {\n /** Error message, if it exists the select will be in error state */\n errorText?: string | ReactNode;\n /** Help text of the select component */\n helpText?: string | ReactNode;\n /** Size of the component */\n size?: 'small' | 'medium' | 'large';\n /** Whether the select component is fluid */\n isFluid?: boolean;\n /** Whether the select component is clean. If true, the select component will have a transparent background, no border and be hug the width of the content. */\n isClean?: boolean;\n /** Whether the select component is disabled */\n isDisabled?: boolean;\n /** Additional class name */\n className?: string;\n /** Additional style */\n style?: React.CSSProperties;\n} & (\n | {\n /** Label of the select component. If not provided, please provide an ariaLabel. */\n label?: undefined;\n /** Aria label of the select component */\n ariaLabel: string;\n }\n | {\n label: React.ReactNode;\n ariaLabel?: string;\n }\n);\n\ntype ReactSelectProps<\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n> = {\n /** Type of the select component */\n type: 'select';\n /** Props of the select component, based of React Select props */\n selectProps: Props<OptionType, IsMulti, GroupType>;\n} & SelectCommonProps;\n\ntype ReactSelectAsyncProps<\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n> = {\n /** Type of the select component */\n type: 'async';\n /** Props of the select component, based of React Select props */\n selectProps: AsyncProps<OptionType, IsMulti, GroupType>;\n} & SelectCommonProps;\n\ntype ReactSelectCreatableProps<\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n> = {\n /** Type of the select component */\n type: 'creatable';\n /** Props of the select component, based of React Select props */\n selectProps: CreatableProps<OptionType, IsMulti, GroupType>;\n} & SelectCommonProps;\n\n/**\n * We will provide a wrapper to the three distinct select components\n * the library provides:\n * 1. Select (the most simple component)\n * 2. Creatable (for creating new values in our options)\n * 3. Async for fetching while typing, useful for cases that we avoid storing things\n * in browser\n */\nexport type SelectProps<\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n> =\n | ReactSelectProps<OptionType, IsMulti, GroupType>\n | ReactSelectCreatableProps<OptionType, IsMulti, GroupType>\n | ReactSelectAsyncProps<OptionType, IsMulti, GroupType>;\n\nexport type SelectOverrideCustomProps<\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n> = Pick<\n SelectProps<OptionType, IsMulti, GroupType>,\n 'size' | 'errorText' | 'helpText' | 'isClean'\n> & {\n errorTextId?: string;\n helpTextId?: string;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/select/types.tsx"],"names":[],"mappings":"","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type ReactNode } from 'react';\nimport { type GroupBase, type Props } from 'react-select';\nimport { type AsyncProps } from 'react-select/async';\nimport { type CreatableProps } from 'react-select/creatable';\n\nexport type SelectCommonProps = {\n /** Error message, if it exists the select will be in error state */\n errorText?: string | ReactNode;\n /** Help text of the select component */\n helpText?: string | ReactNode;\n /** Size of the component */\n size?: 'small' | 'medium' | 'large';\n /** Whether the select component is fluid */\n isFluid?: boolean;\n /** Whether the select component is clean. If true, the select component will have a transparent background, no border and be hug the width of the content. */\n isClean?: boolean;\n /** Whether the select component is disabled */\n isDisabled?: boolean;\n /** Additional class name */\n className?: string;\n /** Additional style */\n style?: React.CSSProperties;\n} & (\n | {\n /** Label of the select component. If not provided, please provide an ariaLabel. */\n label?: undefined;\n /** Aria label of the select component */\n ariaLabel: string;\n }\n | {\n label: React.ReactNode;\n ariaLabel?: string;\n }\n);\n\ntype ReactSelectProps<\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n> = {\n /** Type of the select component */\n type: 'select';\n /** Props of the select component, based of React Select props */\n selectProps: Props<OptionType, IsMulti, GroupType>;\n} & SelectCommonProps;\n\ntype ReactSelectAsyncProps<\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n> = {\n /** Type of the select component */\n type: 'async';\n /** Props of the select component, based of React Select props */\n selectProps: AsyncProps<OptionType, IsMulti, GroupType>;\n} & SelectCommonProps;\n\ntype ReactSelectCreatableProps<\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n> = {\n /** Type of the select component */\n type: 'creatable';\n /** Props of the select component, based of React Select props */\n selectProps: CreatableProps<OptionType, IsMulti, GroupType>;\n} & SelectCommonProps;\n\n/**\n * We will provide a wrapper to the three distinct select components\n * the library provides:\n * 1. Select (the most simple component)\n * 2. Creatable (for creating new values in our options)\n * 3. Async for fetching while typing, useful for cases that we avoid storing things\n * in browser\n */\n/**\n * @remarks\n * The `type` prop is used to specify the type of select component to render, which will be passed to the underlying React Select component.\n *\n * @remarks\n * The `selectProps` prop is dynamically typed based on the `type` prop and can be one of the following: `StateManagerProps`, `CreatableProps`, `AsyncProps`. All select variants will have the `SelectProps` base type from React Select. For more information on the available props, see the [React Select documentation](https://react-select.com/props).\n */\nexport type SelectProps<\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n> =\n | ReactSelectProps<OptionType, IsMulti, GroupType>\n | ReactSelectCreatableProps<OptionType, IsMulti, GroupType>\n | ReactSelectAsyncProps<OptionType, IsMulti, GroupType>;\n\nexport type SelectOverrideCustomProps<\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n> = Pick<\n SelectProps<OptionType, IsMulti, GroupType>,\n 'size' | 'errorText' | 'helpText' | 'isClean'\n> & {\n errorTextId?: string;\n helpTextId?: string;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../../src/slider/Slider.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAA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AmB,IAClC,CACX,CAAC;AACJ,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport React, { useCallback, useEffect } from 'react';\nimport {\n mergeProps,\n useFocusRing,\n useSlider,\n useSliderThumb,\n VisuallyHidden,\n} from 'react-aria';\nimport { type SliderState, useSliderState } from 'react-stately';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { Tooltip } from '../tooltip';\n\ntype SliderPropsBase = {\n /** Input props of the underlying input element */\n inputProps?: HtmlAttributes<'input'>;\n /** Determines the step size that will be added or removed from the current value when moving the slider button */\n step?: number;\n /** Whether the slider is disabled */\n isDisabled?: boolean;\n /** The minimum value possible to choose */\n minValue?: number;\n /** The maximum value possible to choose */\n maxValue?: number;\n /** Whether to display a tooltip with the current value when the slider is being dragged */\n showValues?: boolean;\n /** Whether to display visual indicators for each step in the slider */\n showSteps?: boolean;\n};\n\ntype SingleSlider = SliderPropsBase & {\n /** Type of the slider */\n type?: 'single';\n /** Current value of the single slider. **Only required when the type is 'single'**. */\n value: number;\n /** Callback function triggered when the slider value(s) changes. The function parameter varies depending on the slider type, for single slider, it is a number and for range slider, it is an array of two numbers. */\n onChange: (value: number) => void;\n};\n\ntype RangeSlider = SliderPropsBase & {\n /** Type of the slider */\n type: 'range';\n /** Current values of the range slider as an array of two numbers `[min, max]`. **Only required when the type is 'range'**.*/\n values: [number, number];\n /** Callback function triggered when the slider value(s) changes. The function parameter varies depending on the slider type, for single slider, it is a number and for range slider, it is an array of two numbers. */\n onChange: (value: [number, number]) => void;\n};\n\ntype SliderProps = SingleSlider | RangeSlider;\n\nexport const Slider = <T extends React.ElementType = 'div'>({\n as,\n inputProps = {},\n className,\n style,\n minValue = 0,\n maxValue = 100,\n isDisabled = false,\n showSteps = false,\n showValues = false,\n step = 1,\n type = 'single',\n onChange,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, SliderProps>) => {\n const trackRef = React.useRef<HTMLDivElement | null>(null);\n\n const castedValue =\n type === 'range'\n ? (restProps as RangeSlider).values\n : (restProps as SingleSlider).value;\n\n const castedOnChange =\n type === 'range'\n ? (onChange as RangeSlider['onChange'])\n : (onChange as SingleSlider['onChange']);\n\n const state = useSliderState<typeof castedValue>({\n defaultValue: castedValue,\n isDisabled,\n maxValue,\n minValue,\n numberFormatter: new Intl.NumberFormat('en-US'),\n // oxlint-disable-next-line no-explicit-any\n onChange: castedOnChange as any,\n step,\n });\n\n const { setThumbValue } = state;\n\n const { groupProps, trackProps } = useSlider(\n { 'aria-label': 'slider' },\n state,\n trackRef,\n );\n\n const updatesSliderValue = useCallback(\n (newValue: number | [number, number]) => {\n if (type === 'single' && typeof newValue === 'number') {\n setThumbValue(0, newValue);\n } else if (type === 'range' && Array.isArray(newValue)) {\n setThumbValue(0, newValue[0]);\n setThumbValue(1, newValue[1]);\n }\n },\n [type, setThumbValue],\n );\n\n useEffect(() => {\n updatesSliderValue(castedValue);\n // Needed to make the slider work with controlled values\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [castedValue]);\n\n const Component: React.ElementType = as ?? 'div';\n\n return (\n <Component\n className={classNames('ndl-slider', className)}\n style={style}\n role=\"presentation\"\n ref={ref}\n {...groupProps}\n {...restProps}\n {...htmlAttributes}\n >\n {/* The track element holds the visible track line, the filled track line and the thumb. */}\n <div\n {...trackProps}\n ref={trackRef as React.RefObject<HTMLDivElement>}\n className={classNames('ndl-track', {\n 'ndl-is-disabled': state.isDisabled,\n })}\n >\n {/* Circular marks, acting as indicators for the steps */}\n {showSteps && (\n <TrackMarks state={state} min={minValue} max={maxValue} />\n )}\n <FilledTrack state={state} />\n <Thumb\n index={0}\n state={state}\n trackRef={trackRef as React.RefObject<HTMLDivElement>}\n showValues={showValues}\n inputForwardedProps={inputProps}\n />\n {type === 'range' && (\n <Thumb\n index={1}\n state={state}\n trackRef={trackRef as React.RefObject<HTMLDivElement>}\n showValues={showValues}\n inputForwardedProps={inputProps}\n />\n )}\n </div>\n </Component>\n );\n};\n\nSlider.displayName = 'Slider';\n\nfunction FilledTrack({ state }: { state: SliderState }) {\n let width: number;\n let left: number;\n if (state.values.length === 1) {\n width = state.getValuePercent(state.values[0]) * 100;\n left = 0;\n } else {\n width =\n state.getValuePercent(state.values[1]) * 100 -\n state.getValuePercent(state.values[0]) * 100;\n left = state.getValuePercent(state.values[0]) * 100;\n }\n\n return (\n <div\n className=\"ndl-filled-track\"\n style={{\n left: `${left}%`,\n width: `${width}%`,\n }}\n />\n );\n}\n\nfunction TrackMarks({\n state,\n max,\n min,\n}: {\n state: SliderState;\n max: number;\n min: number;\n}) {\n const markNo = Math.round((max - min) / state.step);\n\n return (\n <div role=\"presentation\" className=\"ndl-track-marks\">\n {Array.from({ length: markNo - 1 }).map((_, index) => {\n const percent = (index / markNo) * 100;\n\n let isFilled;\n if (state.values.length === 1) {\n isFilled = state.getValuePercent(state.values[0]) * 100 > percent;\n } else {\n isFilled =\n state.getValuePercent(state.values[0]) * 100 < percent &&\n state.getValuePercent(state.values[1]) * 100 > percent;\n }\n\n return (\n <div\n key={`track-mark-${index}`}\n className={classNames('ndl-track-mark', {\n 'ndl-on-active-track': isFilled,\n })}\n style={{\n left: `${((index + 1) / markNo) * 100}%`,\n }}\n />\n );\n })}\n </div>\n );\n}\n\nfunction Thumb(props: {\n index: number;\n state: SliderState;\n showValues?: boolean;\n trackRef: React.RefObject<HTMLDivElement>;\n inputForwardedProps: HtmlAttributes<'input'>;\n}) {\n const { state, trackRef, index, inputForwardedProps } = props;\n const inputRef = React.useRef(null);\n const { thumbProps, inputProps, isDragging } = useSliderThumb(\n {\n index,\n inputRef,\n name: 'slider-thumb',\n trackRef,\n },\n state,\n );\n\n const { focusProps, isFocusVisible } = useFocusRing();\n\n /**\n * Solve issue with:\n * Warning: Received NaN for the `value` attribute. If this is expected, cast the value to a string.\n * Receiving NaN for other attributes also, like `max`. Waiting for a fix in react-aria.\n * @see https://github.com/adobe/react-spectrum/issues/5859\n * @see https://github.com/adobe/react-spectrum/pull/5861\n */\n const mergedProps = mergeProps(\n inputProps,\n focusProps,\n // Omitting aria-valuetext double announcements, unless explicitly provided\n { 'aria-valuetext': '' },\n inputForwardedProps,\n );\n const value =\n mergedProps.value !== undefined || mergedProps.value === 0\n ? mergedProps.value\n : '';\n\n return (\n <Tooltip\n isDisabled={props.showValues !== true}\n isOpen={isDragging || undefined}\n placement=\"top\"\n type=\"simple\"\n >\n <Tooltip.Trigger hasButtonWrapper>\n <div\n {...thumbProps}\n className={classNames('ndl-thumb', {\n 'ndl-focus': isFocusVisible,\n 'ndl-is-dragging': isDragging,\n })}\n >\n <VisuallyHidden>\n <input ref={inputRef} {...mergedProps} />\n </VisuallyHidden>\n </div>\n </Tooltip.Trigger>\n <Tooltip.Content>{value}</Tooltip.Content>\n </Tooltip>\n );\n}\n"]}
1
+ {"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../../src/slider/Slider.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EACL,UAAU,EACV,YAAY,EACZ,SAAS,EACT,cAAc,EACd,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAoB,cAAc,EAAE,MAAM,eA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AI,CAAC,CAAC;IACpC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,cAAc,CAC3D;QACE,KAAK;QACL,QAAQ;QACR,IAAI,EAAE,cAAc;QACpB,QAAQ;KACT,EACD,KAAK,CACN,CAAC;IAEF,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,YAAY,EAAE,CAAC;IAEtD;;;;;;OAMG;IACH,MAAM,WAAW,GAAG,UAAU,CAC5B,UAAU,EACV,UAAU;IACV,2EAA2E;IAC3E,EAAE,gBAAgB,EAAE,EAAE,EAAE,EACxB,mBAAmB,CACpB,CAAC;IACF,MAAM,KAAK,GACT,WAAW,CAAC,KAAK,KAAK,SAAS,IAAI,WAAW,CAAC,KAAK,KAAK,CAAC;QACxD,CAAC,CAAC,WAAW,CAAC,KAAK;QACnB,CAAC,CAAC,EAAE,CAAC;IAET,OAAO,CACL,MAAC,OAAO,IACN,UAAU,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,EACrC,MAAM,EAAE,UAAU,IAAI,SAAS,EAC/B,SAAS,EAAC,KAAK,EACf,IAAI,EAAC,QAAQ,aAEb,KAAC,OAAO,CAAC,OAAO,IAAC,gBAAgB,kBAC/B,8BACM,UAAU,IACd,SAAS,EAAE,UAAU,CAAC,WAAW,EAAE;wBACjC,WAAW,EAAE,cAAc;wBAC3B,iBAAiB,EAAE,UAAU;qBAC9B,CAAC,YAEF,KAAC,cAAc,cACb,8BAAO,GAAG,EAAE,QAAQ,IAAM,WAAW,EAAI,GAC1B,IACb,GACU,EAClB,KAAC,OAAO,CAAC,OAAO,cAAE,KAAK,GAAmB,IAClC,CACX,CAAC;AACJ,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport React, { useCallback, useEffect } from 'react';\nimport {\n mergeProps,\n useFocusRing,\n useSlider,\n useSliderThumb,\n VisuallyHidden,\n} from 'react-aria';\nimport { type SliderState, useSliderState } from 'react-stately';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { Tooltip } from '../tooltip';\n\ntype SliderPropsBase = {\n /** Input props of the underlying input element */\n inputProps?: HtmlAttributes<'input'>;\n /** Determines the step size that will be added or removed from the current value when moving the slider button */\n step?: number;\n /** Whether the slider is disabled */\n isDisabled?: boolean;\n /** The minimum value possible to choose */\n minValue?: number;\n /** The maximum value possible to choose */\n maxValue?: number;\n /** Whether to display a tooltip with the current value when the slider is being dragged */\n showValues?: boolean;\n /** Whether to display visual indicators for each step in the slider */\n showSteps?: boolean;\n};\n\ntype SingleSlider = SliderPropsBase & {\n /** Type of the slider */\n type?: 'single';\n /** Current value of the single slider. **Only required when the type is 'single'**. */\n value: number;\n /** Callback function triggered when the slider value(s) changes. The function parameter varies depending on the slider type, for single slider, it is a number and for range slider, it is an array of two numbers. */\n onChange: (value: number) => void;\n};\n\ntype RangeSlider = SliderPropsBase & {\n /** Type of the slider */\n type: 'range';\n /** Current values of the range slider as an array of two numbers `[min, max]`. **Only required when the type is 'range'**.*/\n values: [number, number];\n /** Callback function triggered when the slider value(s) changes. The function parameter varies depending on the slider type, for single slider, it is a number and for range slider, it is an array of two numbers. */\n onChange: (value: [number, number]) => void;\n};\n\n/**\n * @remarks\n * The `type` prop is used to determine the type of the slider. It can be `single` or `range`. The `value` prop is required when the `type` is `single` and `values` is required when the `type` is `range`. It also affects the `onChange` prop type.\n */\ntype SliderProps = SingleSlider | RangeSlider;\n\nexport const Slider = <T extends React.ElementType = 'div'>({\n as,\n inputProps = {},\n className,\n style,\n minValue = 0,\n maxValue = 100,\n isDisabled = false,\n showSteps = false,\n showValues = false,\n step = 1,\n type = 'single',\n onChange,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, SliderProps>) => {\n const trackRef = React.useRef<HTMLDivElement | null>(null);\n\n const castedValue =\n type === 'range'\n ? (restProps as RangeSlider).values\n : (restProps as SingleSlider).value;\n\n const castedOnChange =\n type === 'range'\n ? (onChange as RangeSlider['onChange'])\n : (onChange as SingleSlider['onChange']);\n\n const state = useSliderState<typeof castedValue>({\n defaultValue: castedValue,\n isDisabled,\n maxValue,\n minValue,\n numberFormatter: new Intl.NumberFormat('en-US'),\n // oxlint-disable-next-line no-explicit-any\n onChange: castedOnChange as any,\n step,\n });\n\n const { setThumbValue } = state;\n\n const { groupProps, trackProps } = useSlider(\n { 'aria-label': 'slider' },\n state,\n trackRef,\n );\n\n const updatesSliderValue = useCallback(\n (newValue: number | [number, number]) => {\n if (type === 'single' && typeof newValue === 'number') {\n setThumbValue(0, newValue);\n } else if (type === 'range' && Array.isArray(newValue)) {\n setThumbValue(0, newValue[0]);\n setThumbValue(1, newValue[1]);\n }\n },\n [type, setThumbValue],\n );\n\n useEffect(() => {\n updatesSliderValue(castedValue);\n // Needed to make the slider work with controlled values\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [castedValue]);\n\n const Component: React.ElementType = as ?? 'div';\n\n return (\n <Component\n className={classNames('ndl-slider', className)}\n style={style}\n role=\"presentation\"\n ref={ref}\n {...groupProps}\n {...restProps}\n {...htmlAttributes}\n >\n {/* The track element holds the visible track line, the filled track line and the thumb. */}\n <div\n {...trackProps}\n ref={trackRef as React.RefObject<HTMLDivElement>}\n className={classNames('ndl-track', {\n 'ndl-is-disabled': state.isDisabled,\n })}\n >\n {/* Circular marks, acting as indicators for the steps */}\n {showSteps && (\n <TrackMarks state={state} min={minValue} max={maxValue} />\n )}\n <FilledTrack state={state} />\n <Thumb\n index={0}\n state={state}\n trackRef={trackRef as React.RefObject<HTMLDivElement>}\n showValues={showValues}\n inputForwardedProps={inputProps}\n />\n {type === 'range' && (\n <Thumb\n index={1}\n state={state}\n trackRef={trackRef as React.RefObject<HTMLDivElement>}\n showValues={showValues}\n inputForwardedProps={inputProps}\n />\n )}\n </div>\n </Component>\n );\n};\n\nSlider.displayName = 'Slider';\n\nfunction FilledTrack({ state }: { state: SliderState }) {\n let width: number;\n let left: number;\n if (state.values.length === 1) {\n width = state.getValuePercent(state.values[0]) * 100;\n left = 0;\n } else {\n width =\n state.getValuePercent(state.values[1]) * 100 -\n state.getValuePercent(state.values[0]) * 100;\n left = state.getValuePercent(state.values[0]) * 100;\n }\n\n return (\n <div\n className=\"ndl-filled-track\"\n style={{\n left: `${left}%`,\n width: `${width}%`,\n }}\n />\n );\n}\n\nfunction TrackMarks({\n state,\n max,\n min,\n}: {\n state: SliderState;\n max: number;\n min: number;\n}) {\n const markNo = Math.round((max - min) / state.step);\n\n return (\n <div role=\"presentation\" className=\"ndl-track-marks\">\n {Array.from({ length: markNo - 1 }).map((_, index) => {\n const percent = (index / markNo) * 100;\n\n let isFilled;\n if (state.values.length === 1) {\n isFilled = state.getValuePercent(state.values[0]) * 100 > percent;\n } else {\n isFilled =\n state.getValuePercent(state.values[0]) * 100 < percent &&\n state.getValuePercent(state.values[1]) * 100 > percent;\n }\n\n return (\n <div\n key={`track-mark-${index}`}\n className={classNames('ndl-track-mark', {\n 'ndl-on-active-track': isFilled,\n })}\n style={{\n left: `${((index + 1) / markNo) * 100}%`,\n }}\n />\n );\n })}\n </div>\n );\n}\n\nfunction Thumb(props: {\n index: number;\n state: SliderState;\n showValues?: boolean;\n trackRef: React.RefObject<HTMLDivElement>;\n inputForwardedProps: HtmlAttributes<'input'>;\n}) {\n const { state, trackRef, index, inputForwardedProps } = props;\n const inputRef = React.useRef(null);\n const { thumbProps, inputProps, isDragging } = useSliderThumb(\n {\n index,\n inputRef,\n name: 'slider-thumb',\n trackRef,\n },\n state,\n );\n\n const { focusProps, isFocusVisible } = useFocusRing();\n\n /**\n * Solve issue with:\n * Warning: Received NaN for the `value` attribute. If this is expected, cast the value to a string.\n * Receiving NaN for other attributes also, like `max`. Waiting for a fix in react-aria.\n * @see https://github.com/adobe/react-spectrum/issues/5859\n * @see https://github.com/adobe/react-spectrum/pull/5861\n */\n const mergedProps = mergeProps(\n inputProps,\n focusProps,\n // Omitting aria-valuetext double announcements, unless explicitly provided\n { 'aria-valuetext': '' },\n inputForwardedProps,\n );\n const value =\n mergedProps.value !== undefined || mergedProps.value === 0\n ? mergedProps.value\n : '';\n\n return (\n <Tooltip\n isDisabled={props.showValues !== true}\n isOpen={isDragging || undefined}\n placement=\"top\"\n type=\"simple\"\n >\n <Tooltip.Trigger hasButtonWrapper>\n <div\n {...thumbProps}\n className={classNames('ndl-thumb', {\n 'ndl-focus': isFocusVisible,\n 'ndl-is-dragging': isDragging,\n })}\n >\n <VisuallyHidden>\n <input ref={inputRef} {...mergedProps} />\n </VisuallyHidden>\n </div>\n </Tooltip.Trigger>\n <Tooltip.Content>{value}</Tooltip.Content>\n </Tooltip>\n );\n}\n"]}