@neo4j-ndl/react 4.16.6 → 4.16.8

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 (108) hide show
  1. package/lib/cjs/accordion/Accordion.js +6 -0
  2. package/lib/cjs/accordion/Accordion.js.map +1 -1
  3. package/lib/cjs/accordion/accordion-types.js.map +1 -1
  4. package/lib/cjs/clipboard-button/ClipboardButton.js.map +1 -1
  5. package/lib/cjs/color-picker/ColorPicker.js +3 -1
  6. package/lib/cjs/color-picker/ColorPicker.js.map +1 -1
  7. package/lib/cjs/color-picker/stories/color-picker-dialog.story.js +40 -0
  8. package/lib/cjs/color-picker/stories/color-picker-dialog.story.js.map +1 -0
  9. package/lib/cjs/color-picker/stories/color-picker-popover.story.js +32 -0
  10. package/lib/cjs/color-picker/stories/color-picker-popover.story.js.map +1 -0
  11. package/lib/cjs/color-picker/stories/index.js +9 -1
  12. package/lib/cjs/color-picker/stories/index.js.map +1 -1
  13. package/lib/cjs/data-grid/style-rules/index.js +2 -1
  14. package/lib/cjs/data-grid/style-rules/index.js.map +1 -1
  15. package/lib/cjs/date-picker/DatePicker.js.map +1 -1
  16. package/lib/cjs/drawer/Drawer.js.map +1 -1
  17. package/lib/cjs/dropdown-button/DropdownButton.js.map +1 -1
  18. package/lib/cjs/dropzone/Dropzone.js.map +1 -1
  19. package/lib/cjs/menu/Menu.js +10 -0
  20. package/lib/cjs/menu/Menu.js.map +1 -1
  21. package/lib/cjs/modal/Modal.js.map +1 -1
  22. package/lib/cjs/popover/use-popover.js +1 -1
  23. package/lib/cjs/popover/use-popover.js.map +1 -1
  24. package/lib/cjs/segmented-control/SegmentedControl.js.map +1 -1
  25. package/lib/cjs/select/Select.js +2 -0
  26. package/lib/cjs/select/Select.js.map +1 -1
  27. package/lib/cjs/select/types.js.map +1 -1
  28. package/lib/cjs/slider/Slider.js.map +1 -1
  29. package/lib/cjs/tabs/Tabs.js.map +1 -1
  30. package/lib/cjs/text-area/TextArea.js.map +1 -1
  31. package/lib/cjs/text-input/TextInput.js.map +1 -1
  32. package/lib/cjs/wizard/Wizard.js.map +1 -1
  33. package/lib/esm/accordion/Accordion.js +6 -0
  34. package/lib/esm/accordion/Accordion.js.map +1 -1
  35. package/lib/esm/accordion/accordion-types.js.map +1 -1
  36. package/lib/esm/clipboard-button/ClipboardButton.js.map +1 -1
  37. package/lib/esm/color-picker/ColorPicker.js +3 -1
  38. package/lib/esm/color-picker/ColorPicker.js.map +1 -1
  39. package/lib/esm/color-picker/stories/color-picker-dialog.story.js +38 -0
  40. package/lib/esm/color-picker/stories/color-picker-dialog.story.js.map +1 -0
  41. package/lib/esm/color-picker/stories/color-picker-popover.story.js +30 -0
  42. package/lib/esm/color-picker/stories/color-picker-popover.story.js.map +1 -0
  43. package/lib/esm/color-picker/stories/index.js +6 -0
  44. package/lib/esm/color-picker/stories/index.js.map +1 -1
  45. package/lib/esm/data-grid/style-rules/index.js +1 -1
  46. package/lib/esm/data-grid/style-rules/index.js.map +1 -1
  47. package/lib/esm/date-picker/DatePicker.js.map +1 -1
  48. package/lib/esm/drawer/Drawer.js.map +1 -1
  49. package/lib/esm/dropdown-button/DropdownButton.js.map +1 -1
  50. package/lib/esm/dropzone/Dropzone.js.map +1 -1
  51. package/lib/esm/menu/Menu.js +10 -0
  52. package/lib/esm/menu/Menu.js.map +1 -1
  53. package/lib/esm/modal/Modal.js.map +1 -1
  54. package/lib/esm/popover/use-popover.js +1 -1
  55. package/lib/esm/popover/use-popover.js.map +1 -1
  56. package/lib/esm/segmented-control/SegmentedControl.js.map +1 -1
  57. package/lib/esm/select/Select.js +2 -0
  58. package/lib/esm/select/Select.js.map +1 -1
  59. package/lib/esm/select/types.js.map +1 -1
  60. package/lib/esm/slider/Slider.js.map +1 -1
  61. package/lib/esm/tabs/Tabs.js.map +1 -1
  62. package/lib/esm/text-area/TextArea.js.map +1 -1
  63. package/lib/esm/text-input/TextInput.js.map +1 -1
  64. package/lib/esm/wizard/Wizard.js.map +1 -1
  65. package/lib/types/accordion/Accordion.d.ts +4 -0
  66. package/lib/types/accordion/Accordion.d.ts.map +1 -1
  67. package/lib/types/accordion/accordion-types.d.ts +4 -0
  68. package/lib/types/accordion/accordion-types.d.ts.map +1 -1
  69. package/lib/types/clipboard-button/ClipboardButton.d.ts +4 -0
  70. package/lib/types/clipboard-button/ClipboardButton.d.ts.map +1 -1
  71. package/lib/types/color-picker/ColorPicker.d.ts +17 -0
  72. package/lib/types/color-picker/ColorPicker.d.ts.map +1 -1
  73. package/lib/types/color-picker/stories/color-picker-dialog.story.d.ts +24 -0
  74. package/lib/types/color-picker/stories/color-picker-dialog.story.d.ts.map +1 -0
  75. package/lib/types/color-picker/stories/color-picker-popover.story.d.ts +24 -0
  76. package/lib/types/color-picker/stories/color-picker-popover.story.d.ts.map +1 -0
  77. package/lib/types/color-picker/stories/index.d.ts +4 -0
  78. package/lib/types/color-picker/stories/index.d.ts.map +1 -1
  79. package/lib/types/data-grid/style-rules/index.d.ts +2 -2
  80. package/lib/types/data-grid/style-rules/index.d.ts.map +1 -1
  81. package/lib/types/date-picker/DatePicker.d.ts +7 -0
  82. package/lib/types/date-picker/DatePicker.d.ts.map +1 -1
  83. package/lib/types/drawer/Drawer.d.ts +7 -0
  84. package/lib/types/drawer/Drawer.d.ts.map +1 -1
  85. package/lib/types/dropdown-button/DropdownButton.d.ts +4 -0
  86. package/lib/types/dropdown-button/DropdownButton.d.ts.map +1 -1
  87. package/lib/types/dropzone/Dropzone.d.ts +4 -0
  88. package/lib/types/dropzone/Dropzone.d.ts.map +1 -1
  89. package/lib/types/menu/Menu.d.ts +10 -0
  90. package/lib/types/menu/Menu.d.ts.map +1 -1
  91. package/lib/types/modal/Modal.d.ts +7 -0
  92. package/lib/types/modal/Modal.d.ts.map +1 -1
  93. package/lib/types/segmented-control/SegmentedControl.d.ts +8 -0
  94. package/lib/types/segmented-control/SegmentedControl.d.ts.map +1 -1
  95. package/lib/types/select/Select.d.ts.map +1 -1
  96. package/lib/types/select/types.d.ts +7 -0
  97. package/lib/types/select/types.d.ts.map +1 -1
  98. package/lib/types/slider/Slider.d.ts +4 -0
  99. package/lib/types/slider/Slider.d.ts.map +1 -1
  100. package/lib/types/tabs/Tabs.d.ts +4 -0
  101. package/lib/types/tabs/Tabs.d.ts.map +1 -1
  102. package/lib/types/text-area/TextArea.d.ts +4 -0
  103. package/lib/types/text-area/TextArea.d.ts.map +1 -1
  104. package/lib/types/text-input/TextInput.d.ts +7 -0
  105. package/lib/types/text-input/TextInput.d.ts.map +1 -1
  106. package/lib/types/wizard/Wizard.d.ts +4 -0
  107. package/lib/types/wizard/Wizard.d.ts.map +1 -1
  108. package/package.json +2 -6
@@ -194,6 +194,12 @@ const BaseAccordionItem = ({ itemId, children, title, className = '', arrowPosit
194
194
  '-n-rotate-180': isExpanded,
195
195
  }) })] }) }) }), trailingContent && ((0, jsx_runtime_1.jsx)(typography_1.Typography, { as: "div", variant: "body-medium", children: trailingContent }))] }), (0, jsx_runtime_1.jsx)("div", { id: panelElementId, ref: contentRef, className: contentClasses, "aria-hidden": !isExpanded, "aria-labelledby": buttonElementId, role: "region", children: (0, jsx_runtime_1.jsx)("div", { ref: innerContentRef, className: "ndl-accordion-item-content-inner", onKeyDown: (event) => event.stopPropagation(), children: (0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: "body-medium", className: "n-text-neutral-text-weak", as: "div", children: children }) }) }), hasDivider && (0, jsx_runtime_1.jsx)(divider_1.Divider, {})] })));
196
196
  };
197
+ /**
198
+ * @remarks
199
+ * Where `T` is of the type `string | number | undefined`.
200
+ *
201
+ * `TypographyVariants` is of the type `'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'subheading-large' | 'subheading-medium' | 'subheading-small' | 'body-large' | 'body-medium' | 'body-small' | 'code' | 'label'`.
202
+ */
197
203
  const AccordionItem = (_a) => {
198
204
  var { className } = _a, restProps = __rest(_a, ["className"]);
199
205
  const classes = (0, classnames_1.default)('ndl-accordion-item-classic', className);
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../../src/accordion/Accordion.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAAoC;AAEpC,iCAAiE;AAGjE,4CAA6C;AAC7C,wCAAqC;AACrC,gGAA6F;AAC7F,8CAA2C;AAC3C,2DAA4E;AAU5E,IAAK,iBAGJ;AAHD,WAAK,iBAAiB;IACpB,iDAA4B,CAAA;IAC5B,8FAAyE,CAAA;AAC3E,CAAC,EAHI,iBAAiB,KAAjB,iBAAiB,QAGrB;AAED,MAAM,gBAAgB,GAAG,CACvB,gBAAyB,EACzB,QAAgB,EAChB,YAA6B,MAAM,EACnB,EAAE;IAClB,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACpE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,IAAA,iBAAS,EAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,SAAS,kBAAkB,CAGpD,EAU6C;QAV7C,EACA,QAAQ,EACR,EAAE,EACF,UAAU,EACV,QAAQ,EACR,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,OAE0C,EAD1C,SAAS,cATZ,2FAUD,CADa;IAEZ,MAAM,YAAY,GAAG,IAAA,cAAM,EAAI,IAAI,CAAC,CAAC;IAErC,IAAA,2BAAmB,EAAC,GAAG,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,OAAQ,CAAC,CAAC;IAEtD,MAAM,SAAS,GAAsB,EAAE,IAAI,KAAK,CAAC;IAEjD,oDAAoD;IACpD,kDAAkD;IAClD,MAAM,aAAa,GAAG,CAAC,KAA0C,EAAE,EAAE;QACnE,MAAM,gBAAgB,GAAG,YAAY,CAAC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B,SAAS,EAAC,kCAAkC,EAC5C,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE,YAE7C,uBAAC,uBAAU,IACT,OAAO,EAAC,aAAa,EACrB,SAAS,EAAC,0BAA0B,EACpC,EAAE,EAAC,KAAK,YAEP,QAAQ,GACE,GACT,GACF,EACL,UAAU,IAAI,uBAAC,iBAAO,KAAG,KAChB,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAGpB,EAG+C,EAAE,EAAE;QAHnD,EACA,SAAS,OAEsC,EAD5C,SAAS,cAFZ,aAGD,CADa;IAEZ,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,4BAA4B,EAAE,SAAS,CAAC,CAAC;IAEpE,OAAO,uBAAC,iBAAiB,oBAAK,SAAS,IAAE,SAAS,EAAE,OAAO,IAAI,CAAC;AAClE,CAAC,CAAC;AACF,aAAa,CAAC,WAAW,GAAG,gBAAgB,CAAC;AAO7C,MAAM,SAAS,GAAG,CAGhB,EAG6C,EAAE,EAAE;QAHjD,EACA,SAAS,OAEoC,EAD1C,SAAS,cAFZ,aAGD,CADa;IAEZ,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,0BAA0B,EAAE,SAAS,CAAC,CAAC;IAElE,OAAO,CACL,uBAAC,iBAAiB,oBAAK,SAAS,IAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,CAC5E,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,CAAC,WAAW,GAAG,qBAAqB,CAAC;AAE9C,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE;IAClD,SAAS,EAAE,SAAS;IACpB,IAAI,EAAE,aAAa;CACpB,CAAC,CAAC;AAEM,8BAAS","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { useCallback, useImperativeHandle, useRef } from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { findUntil } from '../_common/utils';\nimport { Divider } from '../divider';\nimport { ChevronDownIconOutline } from '../icons/generated/heroIcons/ChevronDownIconOutline';\nimport { Typography } from '../typography';\nimport { AccordionContext, useAccordionContext } from './accordion-context';\nimport {\n type AccordionItemId,\n type AccordionItemProps,\n type AccordionProps,\n type ClassicItemProps,\n type IsMultiple,\n type IsNotMultiple,\n} from './accordion-types';\n\nenum AccordionSelector {\n Item = '.ndl-accordion-item',\n ItemNotDisabled = '.ndl-accordion-item:not(.ndl-accordion-item-disabled)',\n}\n\nconst getAccordionItem = (\n accordionElement: Element,\n selector: string,\n direction: 'next' | 'prev' = 'next',\n): Element | null => {\n const itemParent = accordionElement.closest(AccordionSelector.Item);\n if (!itemParent) {\n return null;\n }\n\n return findUntil(direction, itemParent, selector);\n};\n\nconst AccordionComponent = function AccordionComponent<\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n children,\n as,\n isMultiple,\n onChange,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<U, AccordionProps<T>>) {\n const accordionRef = useRef<U>(null);\n\n useImperativeHandle(ref, () => accordionRef.current!);\n\n const Component: React.ElementType = as || 'div';\n\n // The following function includes code needed to be\n // able to navigate with the arrow keys (not tab).\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const accordionElement = accordionRef.current;\n if (!accordionElement) {\n return;\n }\n const activeElement = document.activeElement as HTMLElement;\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n event.stopPropagation();\n const newFocusedElement = getAccordionItem(\n activeElement,\n AccordionSelector.ItemNotDisabled,\n 'next',\n );\n const newHeader = newFocusedElement?.firstElementChild;\n\n if (newHeader && newHeader instanceof HTMLElement) {\n focusAccordionItem(newHeader as HTMLElement);\n }\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n event.stopPropagation();\n const newFocusedElement = getAccordionItem(\n activeElement,\n AccordionSelector.ItemNotDisabled,\n 'prev',\n );\n const newHeader = newFocusedElement?.firstElementChild;\n\n if (newHeader && newHeader instanceof HTMLElement) {\n focusAccordionItem(newHeader as HTMLElement);\n }\n } else if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n activeElement.click();\n }\n };\n\n const focusAccordionItem = (accordionHtmlElement: HTMLElement) => {\n const accordionButton = accordionHtmlElement\n .getElementsByClassName('ndl-accordion-item-header-button')\n .item(0);\n\n if (accordionButton !== null && accordionButton instanceof HTMLElement) {\n accordionButton.focus();\n }\n };\n\n const classes = classNames('ndl-accordion', className);\n\n // Destructure and omit keys from DOM spread\n const { expandedItemIds, expandedItemId, ...restAccordionProps } =\n restProps as Record<string, unknown> as {\n expandedItemIds?: T[];\n expandedItemId?: T | null;\n [key: string]: unknown;\n };\n\n const contextValue = isMultiple\n ? ({\n expandedItemIds,\n isMultiple,\n onChange,\n } as IsMultiple<T>)\n : ({\n expandedItemId,\n isMultiple,\n onChange,\n } as IsNotMultiple<T>);\n\n return (\n <Component\n className={classes}\n style={style}\n ref={accordionRef}\n onKeyDown={handleKeyDown}\n role=\"presentation\"\n {...restAccordionProps}\n {...htmlAttributes}\n >\n <AccordionContext.Provider value={contextValue}>\n {children}\n </AccordionContext.Provider>\n </Component>\n );\n};\n\nconst createItemId = (type: string, id: AccordionItemId) =>\n `ndl-accordionitem${type}id-${id}`;\n\nconst BaseAccordionItem = <\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n itemId,\n children,\n title,\n className = '',\n arrowPosition = 'leading',\n isDisabled = false,\n onExpandedChange,\n htmlAttributes,\n style,\n as,\n titleTypographyVariant = 'subheading-medium',\n hasDivider = true,\n trailingContent,\n headingLevel = 2,\n}: PolymorphicCommonProps<U, AccordionItemProps<T>>) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const innerContentRef = useRef<HTMLDivElement>(null);\n const itemElementId = createItemId('item', itemId);\n const headerElementId = createItemId('header', itemId);\n const buttonElementId = createItemId('button', itemId);\n const panelElementId = createItemId('panel', itemId);\n const Component: React.ElementType = as || 'div';\n\n const context = useAccordionContext();\n const { isMultiple } = context;\n\n const isExpanded = isMultiple\n ? context.expandedItemIds.includes(itemId)\n : context.expandedItemId === itemId;\n\n const handleOnClick = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n // Custom callback to call.\n if (onExpandedChange !== undefined) {\n onExpandedChange(!isExpanded);\n }\n\n if (isMultiple) {\n const { expandedItemIds, onChange }: IsMultiple<T> = context;\n // Multiple expanded.\n if (isExpanded) {\n // Remove from list.\n const newArray: T[] = expandedItemIds.filter(\n (activeId) => activeId !== itemId,\n );\n onChange(newArray);\n } else if (!isExpanded) {\n // Add to list.\n const newArray = [...expandedItemIds];\n newArray.push(itemId);\n onChange(newArray);\n }\n } else {\n const { onChange }: IsNotMultiple<T> = context;\n // Single expanded.\n if (isExpanded) {\n // Set null.\n onChange(null);\n } else if (!isExpanded) {\n // Set to id.\n onChange(itemId);\n }\n }\n\n // The W3 WAI-ARIA states that focus can only happen on the header not the header button.\n document.activeElement?.parentElement?.focus();\n }, [isExpanded, isMultiple, isDisabled, itemId, onExpandedChange, context]);\n\n const classes = classNames('ndl-accordion-item', className, {\n 'ndl-accordion-item-disabled': isDisabled,\n 'ndl-accordion-item-expanded': isExpanded,\n });\n\n const headerClasses = classNames('ndl-accordion-item-header', {\n 'ndl-accordion-item-header-disabled': isDisabled,\n });\n\n const iconClasses = classNames('ndl-accordion-item-header-icon-wrapper', {\n 'ndl-accordion-item-header-icon-wrapper-leading':\n arrowPosition === 'leading',\n });\n\n const buttonClasses = classNames('ndl-accordion-item-header-button', {\n 'ndl-accordion-item-header-button-disabled': isDisabled,\n });\n\n const titleClasses = classNames('ndl-accordion-item-header-button-title', {\n 'ndl-accordion-item-header-button-title': isDisabled,\n 'ndl-accordion-item-header-button-title-leading':\n arrowPosition === 'leading',\n });\n\n const contentClasses = classNames('ndl-accordion-item-content', {\n 'ndl-accordion-item-content-expanded': isExpanded,\n 'ndl-accordion-item-content-leading': arrowPosition === 'leading',\n });\n\n return (\n <Component\n className={classes}\n style={style}\n id={itemElementId}\n {...htmlAttributes}\n >\n <div className={headerClasses} id={headerElementId}>\n <Typography\n as={`h${headingLevel}`}\n variant={titleTypographyVariant}\n className=\"ndl-accordion-item-heading\"\n >\n <button\n type=\"button\"\n id={buttonElementId}\n onClick={handleOnClick}\n className={buttonClasses}\n aria-expanded={isExpanded}\n aria-disabled={isDisabled}\n aria-controls={panelElementId}\n disabled={isDisabled}\n >\n <span className={iconClasses}>\n <span className={titleClasses}>{title}</span>\n\n <ChevronDownIconOutline\n className={classNames('ndl-accordion-item-header-icon', {\n '-n-rotate-180': isExpanded,\n })}\n />\n </span>\n </button>\n </Typography>\n {trailingContent && (\n <Typography as=\"div\" variant=\"body-medium\">\n {trailingContent}\n </Typography>\n )}\n </div>\n\n <div\n id={panelElementId}\n ref={contentRef}\n className={contentClasses}\n aria-hidden={!isExpanded}\n aria-labelledby={buttonElementId}\n role=\"region\"\n >\n {/* The <div> element has a child <button> element that allows keyboard interaction */}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div\n ref={innerContentRef}\n className=\"ndl-accordion-item-content-inner\"\n onKeyDown={(event) => event.stopPropagation()}\n >\n <Typography\n variant=\"body-medium\"\n className=\"n-text-neutral-text-weak\"\n as=\"div\"\n >\n {children}\n </Typography>\n </div>\n </div>\n {hasDivider && <Divider />}\n </Component>\n );\n};\n\nconst AccordionItem = <\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n className,\n ...restProps\n}: PolymorphicCommonProps<U, ClassicItemProps<T>>) => {\n const classes = classNames('ndl-accordion-item-classic', className);\n\n return <BaseAccordionItem {...restProps} className={classes} />;\n};\nAccordionItem.displayName = 'Accordion.Item';\n\ntype CleanItemProps<T extends AccordionItemId> = Omit<\n AccordionItemProps<T>,\n 'hasDivider'\n>;\n\nconst CleanItem = <\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n className,\n ...restProps\n}: PolymorphicCommonProps<U, CleanItemProps<T>>) => {\n const classes = classNames('ndl-accordion-item-clean', className);\n\n return (\n <BaseAccordionItem {...restProps} className={classes} hasDivider={false} />\n );\n};\n\nCleanItem.displayName = 'Accordion.CleanItem';\n\nconst Accordion = Object.assign(AccordionComponent, {\n CleanItem: CleanItem,\n Item: AccordionItem,\n});\n\nexport { Accordion };\n"]}
1
+ {"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../../src/accordion/Accordion.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAAoC;AAEpC,iCAAiE;AAGjE,4CAA6C;AAC7C,wCAAqC;AACrC,gGAA6F;AAC7F,8CAA2C;AAC3C,2DAA4E;AAU5E,IAAK,iBAGJ;AAHD,WAAK,iBAAiB;IACpB,iDAA4B,CAAA;IAC5B,8FAAyE,CAAA;AAC3E,CAAC,EAHI,iBAAiB,KAAjB,iBAAiB,QAGrB;AAED,MAAM,gBAAgB,GAAG,CACvB,gBAAyB,EACzB,QAAgB,EAChB,YAA6B,MAAM,EACnB,EAAE;IAClB,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACpE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,IAAA,iBAAS,EAAC,S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G6C,EAAE,EAAE;QAHjD,EACA,SAAS,OAEoC,EAD1C,SAAS,cAFZ,aAGD,CADa;IAEZ,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,0BAA0B,EAAE,SAAS,CAAC,CAAC;IAElE,OAAO,CACL,uBAAC,iBAAiB,oBAAK,SAAS,IAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,CAC5E,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,CAAC,WAAW,GAAG,qBAAqB,CAAC;AAE9C,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE;IAClD,SAAS,EAAE,SAAS;IACpB,IAAI,EAAE,aAAa;CACpB,CAAC,CAAC;AAEM,8BAAS","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { useCallback, useImperativeHandle, useRef } from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { findUntil } from '../_common/utils';\nimport { Divider } from '../divider';\nimport { ChevronDownIconOutline } from '../icons/generated/heroIcons/ChevronDownIconOutline';\nimport { Typography } from '../typography';\nimport { AccordionContext, useAccordionContext } from './accordion-context';\nimport {\n type AccordionItemId,\n type AccordionItemProps,\n type AccordionProps,\n type ClassicItemProps,\n type IsMultiple,\n type IsNotMultiple,\n} from './accordion-types';\n\nenum AccordionSelector {\n Item = '.ndl-accordion-item',\n ItemNotDisabled = '.ndl-accordion-item:not(.ndl-accordion-item-disabled)',\n}\n\nconst getAccordionItem = (\n accordionElement: Element,\n selector: string,\n direction: 'next' | 'prev' = 'next',\n): Element | null => {\n const itemParent = accordionElement.closest(AccordionSelector.Item);\n if (!itemParent) {\n return null;\n }\n\n return findUntil(direction, itemParent, selector);\n};\n\nconst AccordionComponent = function AccordionComponent<\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n children,\n as,\n isMultiple,\n onChange,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<U, AccordionProps<T>>) {\n const accordionRef = useRef<U>(null);\n\n useImperativeHandle(ref, () => accordionRef.current!);\n\n const Component: React.ElementType = as || 'div';\n\n // The following function includes code needed to be\n // able to navigate with the arrow keys (not tab).\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const accordionElement = accordionRef.current;\n if (!accordionElement) {\n return;\n }\n const activeElement = document.activeElement as HTMLElement;\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n event.stopPropagation();\n const newFocusedElement = getAccordionItem(\n activeElement,\n AccordionSelector.ItemNotDisabled,\n 'next',\n );\n const newHeader = newFocusedElement?.firstElementChild;\n\n if (newHeader && newHeader instanceof HTMLElement) {\n focusAccordionItem(newHeader as HTMLElement);\n }\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n event.stopPropagation();\n const newFocusedElement = getAccordionItem(\n activeElement,\n AccordionSelector.ItemNotDisabled,\n 'prev',\n );\n const newHeader = newFocusedElement?.firstElementChild;\n\n if (newHeader && newHeader instanceof HTMLElement) {\n focusAccordionItem(newHeader as HTMLElement);\n }\n } else if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n activeElement.click();\n }\n };\n\n const focusAccordionItem = (accordionHtmlElement: HTMLElement) => {\n const accordionButton = accordionHtmlElement\n .getElementsByClassName('ndl-accordion-item-header-button')\n .item(0);\n\n if (accordionButton !== null && accordionButton instanceof HTMLElement) {\n accordionButton.focus();\n }\n };\n\n const classes = classNames('ndl-accordion', className);\n\n // Destructure and omit keys from DOM spread\n const { expandedItemIds, expandedItemId, ...restAccordionProps } =\n restProps as Record<string, unknown> as {\n expandedItemIds?: T[];\n expandedItemId?: T | null;\n [key: string]: unknown;\n };\n\n const contextValue = isMultiple\n ? ({\n expandedItemIds,\n isMultiple,\n onChange,\n } as IsMultiple<T>)\n : ({\n expandedItemId,\n isMultiple,\n onChange,\n } as IsNotMultiple<T>);\n\n return (\n <Component\n className={classes}\n style={style}\n ref={accordionRef}\n onKeyDown={handleKeyDown}\n role=\"presentation\"\n {...restAccordionProps}\n {...htmlAttributes}\n >\n <AccordionContext.Provider value={contextValue}>\n {children}\n </AccordionContext.Provider>\n </Component>\n );\n};\n\nconst createItemId = (type: string, id: AccordionItemId) =>\n `ndl-accordionitem${type}id-${id}`;\n\nconst BaseAccordionItem = <\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n itemId,\n children,\n title,\n className = '',\n arrowPosition = 'leading',\n isDisabled = false,\n onExpandedChange,\n htmlAttributes,\n style,\n as,\n titleTypographyVariant = 'subheading-medium',\n hasDivider = true,\n trailingContent,\n headingLevel = 2,\n}: PolymorphicCommonProps<U, AccordionItemProps<T>>) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const innerContentRef = useRef<HTMLDivElement>(null);\n const itemElementId = createItemId('item', itemId);\n const headerElementId = createItemId('header', itemId);\n const buttonElementId = createItemId('button', itemId);\n const panelElementId = createItemId('panel', itemId);\n const Component: React.ElementType = as || 'div';\n\n const context = useAccordionContext();\n const { isMultiple } = context;\n\n const isExpanded = isMultiple\n ? context.expandedItemIds.includes(itemId)\n : context.expandedItemId === itemId;\n\n const handleOnClick = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n // Custom callback to call.\n if (onExpandedChange !== undefined) {\n onExpandedChange(!isExpanded);\n }\n\n if (isMultiple) {\n const { expandedItemIds, onChange }: IsMultiple<T> = context;\n // Multiple expanded.\n if (isExpanded) {\n // Remove from list.\n const newArray: T[] = expandedItemIds.filter(\n (activeId) => activeId !== itemId,\n );\n onChange(newArray);\n } else if (!isExpanded) {\n // Add to list.\n const newArray = [...expandedItemIds];\n newArray.push(itemId);\n onChange(newArray);\n }\n } else {\n const { onChange }: IsNotMultiple<T> = context;\n // Single expanded.\n if (isExpanded) {\n // Set null.\n onChange(null);\n } else if (!isExpanded) {\n // Set to id.\n onChange(itemId);\n }\n }\n\n // The W3 WAI-ARIA states that focus can only happen on the header not the header button.\n document.activeElement?.parentElement?.focus();\n }, [isExpanded, isMultiple, isDisabled, itemId, onExpandedChange, context]);\n\n const classes = classNames('ndl-accordion-item', className, {\n 'ndl-accordion-item-disabled': isDisabled,\n 'ndl-accordion-item-expanded': isExpanded,\n });\n\n const headerClasses = classNames('ndl-accordion-item-header', {\n 'ndl-accordion-item-header-disabled': isDisabled,\n });\n\n const iconClasses = classNames('ndl-accordion-item-header-icon-wrapper', {\n 'ndl-accordion-item-header-icon-wrapper-leading':\n arrowPosition === 'leading',\n });\n\n const buttonClasses = classNames('ndl-accordion-item-header-button', {\n 'ndl-accordion-item-header-button-disabled': isDisabled,\n });\n\n const titleClasses = classNames('ndl-accordion-item-header-button-title', {\n 'ndl-accordion-item-header-button-title': isDisabled,\n 'ndl-accordion-item-header-button-title-leading':\n arrowPosition === 'leading',\n });\n\n const contentClasses = classNames('ndl-accordion-item-content', {\n 'ndl-accordion-item-content-expanded': isExpanded,\n 'ndl-accordion-item-content-leading': arrowPosition === 'leading',\n });\n\n return (\n <Component\n className={classes}\n style={style}\n id={itemElementId}\n {...htmlAttributes}\n >\n <div className={headerClasses} id={headerElementId}>\n <Typography\n as={`h${headingLevel}`}\n variant={titleTypographyVariant}\n className=\"ndl-accordion-item-heading\"\n >\n <button\n type=\"button\"\n id={buttonElementId}\n onClick={handleOnClick}\n className={buttonClasses}\n aria-expanded={isExpanded}\n aria-disabled={isDisabled}\n aria-controls={panelElementId}\n disabled={isDisabled}\n >\n <span className={iconClasses}>\n <span className={titleClasses}>{title}</span>\n\n <ChevronDownIconOutline\n className={classNames('ndl-accordion-item-header-icon', {\n '-n-rotate-180': isExpanded,\n })}\n />\n </span>\n </button>\n </Typography>\n {trailingContent && (\n <Typography as=\"div\" variant=\"body-medium\">\n {trailingContent}\n </Typography>\n )}\n </div>\n\n <div\n id={panelElementId}\n ref={contentRef}\n className={contentClasses}\n aria-hidden={!isExpanded}\n aria-labelledby={buttonElementId}\n role=\"region\"\n >\n {/* The <div> element has a child <button> element that allows keyboard interaction */}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div\n ref={innerContentRef}\n className=\"ndl-accordion-item-content-inner\"\n onKeyDown={(event) => event.stopPropagation()}\n >\n <Typography\n variant=\"body-medium\"\n className=\"n-text-neutral-text-weak\"\n as=\"div\"\n >\n {children}\n </Typography>\n </div>\n </div>\n {hasDivider && <Divider />}\n </Component>\n );\n};\n\n/**\n * @remarks\n * Where `T` is of the type `string | number | undefined`.\n *\n * `TypographyVariants` is of the type `'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'subheading-large' | 'subheading-medium' | 'subheading-small' | 'body-large' | 'body-medium' | 'body-small' | 'code' | 'label'`.\n */\nconst AccordionItem = <\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n className,\n ...restProps\n}: PolymorphicCommonProps<U, ClassicItemProps<T>>) => {\n const classes = classNames('ndl-accordion-item-classic', className);\n\n return <BaseAccordionItem {...restProps} className={classes} />;\n};\nAccordionItem.displayName = 'Accordion.Item';\n\n/**\n * @remarks\n * Where `T` is of the type `string | number | undefined`.\n */\ntype CleanItemProps<T extends AccordionItemId> = Omit<\n AccordionItemProps<T>,\n 'hasDivider'\n>;\n\nconst CleanItem = <\n T extends AccordionItemId,\n U extends React.ElementType = 'div',\n>({\n className,\n ...restProps\n}: PolymorphicCommonProps<U, CleanItemProps<T>>) => {\n const classes = classNames('ndl-accordion-item-clean', className);\n\n return (\n <BaseAccordionItem {...restProps} className={classes} hasDivider={false} />\n );\n};\n\nCleanItem.displayName = 'Accordion.CleanItem';\n\nconst Accordion = Object.assign(AccordionComponent, {\n CleanItem: CleanItem,\n Item: AccordionItem,\n});\n\nexport { Accordion };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"accordion-types.js","sourceRoot":"","sources":["../../../src/accordion/accordion-types.ts"],"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 HtmlAttributes } from '../_common/types';\nimport { type TypographyVariants } from '../typography';\n\nexport type AccordionItemId = string | number | undefined;\n\n/** Semantic heading level for the accordion item title (`h1`–`h6`). */\nexport type AccordionHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\ninterface AccordionBase {\n /** The content to display inside the accordion. Should only be `<Accordion.Item>` or `<Accordion.CleanItem>`. */\n children: React.ReactNode;\n}\n\nexport interface IsNotMultiple<T extends AccordionItemId> {\n /** Whether multiple accordion items can be open at the same time. */\n isMultiple: false | undefined;\n /** The id of the expanded accordion item. Only applicable if `isMultiple` is `false`. */\n expandedItemId: T | null;\n /** Callback function on component item expand/collapse change. */\n onChange: (expandedItemId: T | null) => void;\n}\n\nexport interface IsMultiple<T extends AccordionItemId> {\n /** Whether multiple accordion items can be open at the same time. */\n isMultiple: true;\n /** The ids of the expanded accordion items. Only applicable if `isMultiple` is `true`. */\n expandedItemIds: T[];\n /** Callback function on component item expand/collapse change. */\n onChange: (expandedItemIds: T[]) => void;\n}\n\nexport type AccordionIsMultiple<T extends AccordionItemId> = AccordionBase &\n IsMultiple<T>;\nexport type AccordionIsNotMultiple<T extends AccordionItemId> = AccordionBase &\n IsNotMultiple<T>;\n\nexport type AccordionProps<T extends AccordionItemId> =\n | AccordionIsMultiple<T>\n | AccordionIsNotMultiple<T>;\n\nexport interface AccordionItemProps<T extends AccordionItemId> {\n /** The id of the accordion item. */\n itemId: T;\n /** The title of the accordion item. */\n title: string;\n /** Callback function on accordion item expand/collapse change. */\n onExpandedChange?: (expanded: boolean) => void;\n /** The position of the arrow. */\n arrowPosition?: 'leading' | 'trailing';\n /** Whether the accordion item is disabled. */\n isDisabled?: boolean;\n htmlAttributes?: HtmlAttributes<'div'>;\n children?: React.ReactNode;\n className?: string;\n /** The typography variant for the title. */\n titleTypographyVariant?: TypographyVariants;\n /** Whether the accordion item has a divider. */\n hasDivider?: boolean;\n /** The content to display on the trailing side of accordion item. */\n trailingContent?: React.ReactNode;\n /** The heading level for the accordion item title (1–6). Defaults to 2. */\n headingLevel?: AccordionHeadingLevel;\n}\n\nexport type ClassicItemProps<T extends AccordionItemId> = Omit<\n AccordionItemProps<T>,\n 'hasDivider' | 'trailingContent' | 'titleTypographyVariant'\n>;\n"]}
1
+ {"version":3,"file":"accordion-types.js","sourceRoot":"","sources":["../../../src/accordion/accordion-types.ts"],"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 HtmlAttributes } from '../_common/types';\nimport { type TypographyVariants } from '../typography';\n\nexport type AccordionItemId = string | number | undefined;\n\n/** Semantic heading level for the accordion item title (`h1`–`h6`). */\nexport type AccordionHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\ninterface AccordionBase {\n /** The content to display inside the accordion. Should only be `<Accordion.Item>` or `<Accordion.CleanItem>`. */\n children: React.ReactNode;\n}\n\nexport interface IsNotMultiple<T extends AccordionItemId> {\n /** Whether multiple accordion items can be open at the same time. */\n isMultiple: false | undefined;\n /** The id of the expanded accordion item. Only applicable if `isMultiple` is `false`. */\n expandedItemId: T | null;\n /** Callback function on component item expand/collapse change. */\n onChange: (expandedItemId: T | null) => void;\n}\n\nexport interface IsMultiple<T extends AccordionItemId> {\n /** Whether multiple accordion items can be open at the same time. */\n isMultiple: true;\n /** The ids of the expanded accordion items. Only applicable if `isMultiple` is `true`. */\n expandedItemIds: T[];\n /** Callback function on component item expand/collapse change. */\n onChange: (expandedItemIds: T[]) => void;\n}\n\nexport type AccordionIsMultiple<T extends AccordionItemId> = AccordionBase &\n IsMultiple<T>;\nexport type AccordionIsNotMultiple<T extends AccordionItemId> = AccordionBase &\n IsNotMultiple<T>;\n\n/**\n * @remarks\n * Where `T` is of the type `string | number | undefined`.\n */\nexport type AccordionProps<T extends AccordionItemId> =\n | AccordionIsMultiple<T>\n | AccordionIsNotMultiple<T>;\n\nexport interface AccordionItemProps<T extends AccordionItemId> {\n /** The id of the accordion item. */\n itemId: T;\n /** The title of the accordion item. */\n title: string;\n /** Callback function on accordion item expand/collapse change. */\n onExpandedChange?: (expanded: boolean) => void;\n /** The position of the arrow. */\n arrowPosition?: 'leading' | 'trailing';\n /** Whether the accordion item is disabled. */\n isDisabled?: boolean;\n htmlAttributes?: HtmlAttributes<'div'>;\n children?: React.ReactNode;\n className?: string;\n /** The typography variant for the title. */\n titleTypographyVariant?: TypographyVariants;\n /** Whether the accordion item has a divider. */\n hasDivider?: boolean;\n /** The content to display on the trailing side of accordion item. */\n trailingContent?: React.ReactNode;\n /** The heading level for the accordion item title (1–6). Defaults to 2. */\n headingLevel?: AccordionHeadingLevel;\n}\n\nexport type ClassicItemProps<T extends AccordionItemId> = Omit<\n AccordionItemProps<T>,\n 'hasDivider' | 'trailingContent' | 'titleTypographyVariant'\n>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ClipboardButton.js","sourceRoot":"","sources":["../../../src/clipboard-button/ClipboardButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,kDAA0B;AAG1B,4DAAuD;AACvD,oCAA8C;AAC9C,gDAA4C;AAC5C,kGAA+F;AAC/F,gCAA6B;AAC7B,wDAAoD;AACpD,wCAAqC;AAoCrC,MAAM,kBAAkB,GAAG,CAAC,EAWF,EAAE,EAAE;QAXF,EAC1B,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,cAAc,EACd,YAAY,EACZ,IAAI,GAAG,mBAAmB,OAEF,EADrB,SAAS,cAVc,qIAW3B,CADa;IAEZ,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACtE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElD,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;YACvB,YAAY,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC;QAED,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE;YAC1C,YAAY,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC,EAAE,IAAI,CAAC,CAAC;QAET,YAAY,CAAC,YAAY,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF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e,EACzB,IAAI,EAAE,uBAAC,iDAAuB,IAAC,SAAS,EAAC,cAAc,GAAG,EAC1D,cAAc,kBACZ,WAAW,EAAE,QAAQ,IAClB,cAAc,aAGlB,IAAI,KAAK,iBAAiB,IAAI,MAAM,IAClB,CACtB,CAAC;AACJ,CAAC,CAAC;AA1DW,QAAA,eAAe,mBA0D1B","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 React from 'react';\n\nimport { type ButtonSizes } from '../button';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { useCopyToClipboard } from '../hooks';\nimport { IconButton } from '../icon-button';\nimport { Square2StackIconOutline } from '../icons/generated/heroIcons/Square2StackIconOutline';\nimport { Kbd } from '../kbd';\nimport { OutlinedButton } from '../outlined-button';\nimport { Tooltip } from '../tooltip';\n\ntype ConfirmationButtonProps = {\n description: string;\n descriptionKbdProps?: React.ComponentProps<typeof Kbd>;\n actionFeedbackText: string;\n tooltipProps?: Omit<React.ComponentProps<typeof Tooltip>, 'children'>;\n onClick?: React.ComponentPropsWithoutRef<'button'>['onClick'];\n children: React.ReactNode;\n className?: string;\n icon: React.ReactNode;\n htmlAttributes?: React.ComponentPropsWithoutRef<'button'>;\n} & (\n | {\n type: 'clean-icon-button';\n cleanIconButtonProps?: Omit<\n React.ComponentProps<typeof CleanIconButton>,\n 'children' | 'onClick' | 'tooltip'\n >;\n }\n | {\n type: 'icon-button';\n iconButtonProps?: Omit<\n React.ComponentProps<typeof IconButton>,\n 'children' | 'onClick' | 'tooltip'\n >;\n }\n | {\n type: 'outlined-button';\n outlinedButtonProps?: Omit<\n React.ComponentProps<typeof OutlinedButton>,\n 'children' | 'onClick' | 'tooltip'\n >;\n }\n);\n\nconst ConfirmationButton = ({\n descriptionKbdProps,\n description,\n actionFeedbackText,\n icon,\n children,\n onClick,\n htmlAttributes,\n tooltipProps,\n type = 'clean-icon-button',\n ...restProps\n}: ConfirmationButtonProps) => {\n const [timeoutId, setTimeoutId] = React.useState<number | null>(null);\n const [isOpen, setIsOpen] = React.useState(false);\n\n const handleClick = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n const newTimeoutId = window.setTimeout(() => {\n setTimeoutId(null);\n }, 2000);\n\n setTimeoutId(newTimeoutId);\n };\n\n const handleCloseTooltip = () => {\n setIsOpen(false);\n };\n\n const handleOpenTooltip = () => {\n setIsOpen(true);\n };\n\n const content = timeoutId === null ? description : actionFeedbackText;\n /* Controlling the tip to make it disappear in a timely manner*/\n\n if (type === 'clean-icon-button') {\n return (\n <CleanIconButton\n {...(\n restProps as {\n cleanIconButtonProps: React.ComponentProps<typeof CleanIconButton>;\n }\n ).cleanIconButtonProps}\n description={content}\n descriptionKbdProps={descriptionKbdProps}\n tooltipProps={{\n root: {\n ...tooltipProps,\n isOpen: isOpen || timeoutId !== null,\n },\n trigger: {\n htmlAttributes: {\n onBlur: handleCloseTooltip,\n onFocus: handleOpenTooltip,\n onMouseEnter: handleOpenTooltip,\n onMouseLeave: handleCloseTooltip,\n },\n },\n }}\n onClick={(event) => {\n if (onClick) {\n onClick(event);\n }\n handleClick();\n }}\n className={restProps.className}\n htmlAttributes={htmlAttributes}\n >\n {icon}\n </CleanIconButton>\n );\n } else if (type === 'icon-button') {\n return (\n <IconButton\n {...(\n restProps as {\n iconButtonProps: React.ComponentProps<typeof IconButton>;\n }\n ).iconButtonProps}\n description={content}\n tooltipProps={{\n root: {\n ...tooltipProps,\n isOpen: isOpen || timeoutId !== null,\n },\n trigger: {\n htmlAttributes: {\n onBlur: handleCloseTooltip,\n onFocus: handleOpenTooltip,\n onMouseEnter: handleOpenTooltip,\n onMouseLeave: handleCloseTooltip,\n },\n },\n }}\n onClick={(event) => {\n if (onClick) {\n onClick(event);\n }\n handleClick();\n }}\n className={restProps.className}\n htmlAttributes={htmlAttributes}\n >\n {icon}\n </IconButton>\n );\n } else if (type === 'outlined-button') {\n return (\n <Tooltip\n type=\"simple\"\n isOpen={isOpen || timeoutId !== null}\n {...tooltipProps}\n onOpenChange={(open) => {\n if (open) {\n handleOpenTooltip();\n } else {\n handleCloseTooltip();\n }\n tooltipProps?.onOpenChange?.(open);\n }}\n >\n <Tooltip.Trigger\n hasButtonWrapper\n htmlAttributes={{\n 'aria-label': content,\n onBlur: handleCloseTooltip,\n onFocus: handleOpenTooltip,\n onMouseEnter: handleOpenTooltip,\n onMouseLeave: handleCloseTooltip,\n }}\n >\n <OutlinedButton\n variant=\"neutral\"\n {...(\n restProps as {\n buttonProps: React.ComponentProps<typeof OutlinedButton>;\n }\n ).buttonProps}\n onClick={(event) => {\n if (onClick) {\n onClick(event);\n }\n handleClick();\n }}\n leadingVisual={icon}\n className={restProps.className}\n htmlAttributes={htmlAttributes}\n >\n {children}\n </OutlinedButton>\n </Tooltip.Trigger>\n <Tooltip.Content>\n {content}\n {descriptionKbdProps && <Kbd {...descriptionKbdProps} />}\n </Tooltip.Content>\n </Tooltip>\n );\n }\n};\n\ninterface ClipboardButtonProps {\n /** The text that should be set to users clipboard */\n textToCopy: string;\n descriptionKbdProps?: React.ComponentProps<typeof Kbd>;\n tooltipProps?: Omit<React.ComponentProps<typeof Tooltip>, 'children'>;\n isDisabled?: boolean;\n size?: ButtonSizes;\n htmlAttributes?: React.ComponentPropsWithoutRef<'button'>;\n type?: 'outlined-button' | 'clean-icon-button' | 'icon-button';\n}\n\nexport const ClipboardButton = ({\n textToCopy,\n descriptionKbdProps,\n isDisabled,\n size,\n tooltipProps,\n htmlAttributes,\n type,\n}: ClipboardButtonProps) => {\n const [, copyFunction] = useCopyToClipboard();\n\n const isOutlinedButton = type === 'outlined-button';\n const isIconButton = type === 'icon-button';\n\n const props = isOutlinedButton\n ? {\n outlinedButtonProps: {\n isDisabled,\n size,\n },\n type: 'outlined-button' as const,\n }\n : isIconButton\n ? {\n iconButtonProps: {\n description: 'Copy to clipboard',\n isDisabled,\n size,\n },\n type: 'icon-button' as const,\n }\n : {\n cleanIconButtonProps: {\n description: 'Copy to clipboard',\n isDisabled,\n size,\n },\n type: 'clean-icon-button' as const,\n };\n\n return (\n <ConfirmationButton\n onClick={() => copyFunction(textToCopy)}\n description=\"Copy to clipboard\"\n actionFeedbackText=\"Copied\"\n descriptionKbdProps={descriptionKbdProps}\n {...props}\n tooltipProps={tooltipProps}\n className=\"n-gap-token-8\"\n icon={<Square2StackIconOutline className=\"ndl-icon-svg\" />}\n htmlAttributes={{\n 'aria-live': 'polite',\n ...htmlAttributes,\n }}\n >\n {type === 'outlined-button' && 'Copy'}\n </ConfirmationButton>\n );\n};\n"]}
1
+ {"version":3,"file":"ClipboardButton.js","sourceRoot":"","sources":["../../../src/clipboard-button/ClipboardButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,kDAA0B;AAG1B,4DAAuD;AACvD,oCAA8C;AAC9C,gDAA4C;AAC5C,kGAA+F;AAC/F,gCAA6B;AAC7B,wDAAoD;AACpD,wCAAqC;AAoCrC,MAAM,kBAAkB,GAAG,CAAC,EAWF,EAAE,EAAE;QAXF,EAC1B,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,cAAc,EACd,YAAY,EACZ,IAAI,GAAG,mBAAmB,OAEF,EADrB,SAAS,cAVc,qIAW3B,CADa;IAEZ,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAgB,IAAI,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U;oBACV,IAAI;iBACL;gBACD,IAAI,EAAE,aAAsB;aAC7B;YACH,CAAC,CAAC;gBACE,oBAAoB,EAAE;oBACpB,WAAW,EAAE,mBAAmB;oBAChC,UAAU;oBACV,IAAI;iBACL;gBACD,IAAI,EAAE,mBAA4B;aACnC,CAAC;IAER,OAAO,CACL,uBAAC,kBAAkB,kBACjB,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,EACvC,WAAW,EAAC,mBAAmB,EAC/B,kBAAkB,EAAC,QAAQ,EAC3B,mBAAmB,EAAE,mBAAmB,IACpC,KAAK,IACT,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAC,eAAe,EACzB,IAAI,EAAE,uBAAC,iDAAuB,IAAC,SAAS,EAAC,cAAc,GAAG,EAC1D,cAAc,kBACZ,WAAW,EAAE,QAAQ,IAClB,cAAc,aAGlB,IAAI,KAAK,iBAAiB,IAAI,MAAM,IAClB,CACtB,CAAC;AACJ,CAAC,CAAC;AA1DW,QAAA,eAAe,mBA0D1B","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 React from 'react';\n\nimport { type ButtonSizes } from '../button';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { useCopyToClipboard } from '../hooks';\nimport { IconButton } from '../icon-button';\nimport { Square2StackIconOutline } from '../icons/generated/heroIcons/Square2StackIconOutline';\nimport { Kbd } from '../kbd';\nimport { OutlinedButton } from '../outlined-button';\nimport { Tooltip } from '../tooltip';\n\ntype ConfirmationButtonProps = {\n description: string;\n descriptionKbdProps?: React.ComponentProps<typeof Kbd>;\n actionFeedbackText: string;\n tooltipProps?: Omit<React.ComponentProps<typeof Tooltip>, 'children'>;\n onClick?: React.ComponentPropsWithoutRef<'button'>['onClick'];\n children: React.ReactNode;\n className?: string;\n icon: React.ReactNode;\n htmlAttributes?: React.ComponentPropsWithoutRef<'button'>;\n} & (\n | {\n type: 'clean-icon-button';\n cleanIconButtonProps?: Omit<\n React.ComponentProps<typeof CleanIconButton>,\n 'children' | 'onClick' | 'tooltip'\n >;\n }\n | {\n type: 'icon-button';\n iconButtonProps?: Omit<\n React.ComponentProps<typeof IconButton>,\n 'children' | 'onClick' | 'tooltip'\n >;\n }\n | {\n type: 'outlined-button';\n outlinedButtonProps?: Omit<\n React.ComponentProps<typeof OutlinedButton>,\n 'children' | 'onClick' | 'tooltip'\n >;\n }\n);\n\nconst ConfirmationButton = ({\n descriptionKbdProps,\n description,\n actionFeedbackText,\n icon,\n children,\n onClick,\n htmlAttributes,\n tooltipProps,\n type = 'clean-icon-button',\n ...restProps\n}: ConfirmationButtonProps) => {\n const [timeoutId, setTimeoutId] = React.useState<number | null>(null);\n const [isOpen, setIsOpen] = React.useState(false);\n\n const handleClick = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n const newTimeoutId = window.setTimeout(() => {\n setTimeoutId(null);\n }, 2000);\n\n setTimeoutId(newTimeoutId);\n };\n\n const handleCloseTooltip = () => {\n setIsOpen(false);\n };\n\n const handleOpenTooltip = () => {\n setIsOpen(true);\n };\n\n const content = timeoutId === null ? description : actionFeedbackText;\n /* Controlling the tip to make it disappear in a timely manner*/\n\n if (type === 'clean-icon-button') {\n return (\n <CleanIconButton\n {...(\n restProps as {\n cleanIconButtonProps: React.ComponentProps<typeof CleanIconButton>;\n }\n ).cleanIconButtonProps}\n description={content}\n descriptionKbdProps={descriptionKbdProps}\n tooltipProps={{\n root: {\n ...tooltipProps,\n isOpen: isOpen || timeoutId !== null,\n },\n trigger: {\n htmlAttributes: {\n onBlur: handleCloseTooltip,\n onFocus: handleOpenTooltip,\n onMouseEnter: handleOpenTooltip,\n onMouseLeave: handleCloseTooltip,\n },\n },\n }}\n onClick={(event) => {\n if (onClick) {\n onClick(event);\n }\n handleClick();\n }}\n className={restProps.className}\n htmlAttributes={htmlAttributes}\n >\n {icon}\n </CleanIconButton>\n );\n } else if (type === 'icon-button') {\n return (\n <IconButton\n {...(\n restProps as {\n iconButtonProps: React.ComponentProps<typeof IconButton>;\n }\n ).iconButtonProps}\n description={content}\n tooltipProps={{\n root: {\n ...tooltipProps,\n isOpen: isOpen || timeoutId !== null,\n },\n trigger: {\n htmlAttributes: {\n onBlur: handleCloseTooltip,\n onFocus: handleOpenTooltip,\n onMouseEnter: handleOpenTooltip,\n onMouseLeave: handleCloseTooltip,\n },\n },\n }}\n onClick={(event) => {\n if (onClick) {\n onClick(event);\n }\n handleClick();\n }}\n className={restProps.className}\n htmlAttributes={htmlAttributes}\n >\n {icon}\n </IconButton>\n );\n } else if (type === 'outlined-button') {\n return (\n <Tooltip\n type=\"simple\"\n isOpen={isOpen || timeoutId !== null}\n {...tooltipProps}\n onOpenChange={(open) => {\n if (open) {\n handleOpenTooltip();\n } else {\n handleCloseTooltip();\n }\n tooltipProps?.onOpenChange?.(open);\n }}\n >\n <Tooltip.Trigger\n hasButtonWrapper\n htmlAttributes={{\n 'aria-label': content,\n onBlur: handleCloseTooltip,\n onFocus: handleOpenTooltip,\n onMouseEnter: handleOpenTooltip,\n onMouseLeave: handleCloseTooltip,\n }}\n >\n <OutlinedButton\n variant=\"neutral\"\n {...(\n restProps as {\n buttonProps: React.ComponentProps<typeof OutlinedButton>;\n }\n ).buttonProps}\n onClick={(event) => {\n if (onClick) {\n onClick(event);\n }\n handleClick();\n }}\n leadingVisual={icon}\n className={restProps.className}\n htmlAttributes={htmlAttributes}\n >\n {children}\n </OutlinedButton>\n </Tooltip.Trigger>\n <Tooltip.Content>\n {content}\n {descriptionKbdProps && <Kbd {...descriptionKbdProps} />}\n </Tooltip.Content>\n </Tooltip>\n );\n }\n};\n\n/**\n * @remarks\n * For more information of the `TooltipProps` type, see the Tooltip component documentation.\n */\ninterface ClipboardButtonProps {\n /** The text that should be set to users clipboard */\n textToCopy: string;\n descriptionKbdProps?: React.ComponentProps<typeof Kbd>;\n tooltipProps?: Omit<React.ComponentProps<typeof Tooltip>, 'children'>;\n isDisabled?: boolean;\n size?: ButtonSizes;\n htmlAttributes?: React.ComponentPropsWithoutRef<'button'>;\n type?: 'outlined-button' | 'clean-icon-button' | 'icon-button';\n}\n\nexport const ClipboardButton = ({\n textToCopy,\n descriptionKbdProps,\n isDisabled,\n size,\n tooltipProps,\n htmlAttributes,\n type,\n}: ClipboardButtonProps) => {\n const [, copyFunction] = useCopyToClipboard();\n\n const isOutlinedButton = type === 'outlined-button';\n const isIconButton = type === 'icon-button';\n\n const props = isOutlinedButton\n ? {\n outlinedButtonProps: {\n isDisabled,\n size,\n },\n type: 'outlined-button' as const,\n }\n : isIconButton\n ? {\n iconButtonProps: {\n description: 'Copy to clipboard',\n isDisabled,\n size,\n },\n type: 'icon-button' as const,\n }\n : {\n cleanIconButtonProps: {\n description: 'Copy to clipboard',\n isDisabled,\n size,\n },\n type: 'clean-icon-button' as const,\n };\n\n return (\n <ConfirmationButton\n onClick={() => copyFunction(textToCopy)}\n description=\"Copy to clipboard\"\n actionFeedbackText=\"Copied\"\n descriptionKbdProps={descriptionKbdProps}\n {...props}\n tooltipProps={tooltipProps}\n className=\"n-gap-token-8\"\n icon={<Square2StackIconOutline className=\"ndl-icon-svg\" />}\n htmlAttributes={{\n 'aria-live': 'polite',\n ...htmlAttributes,\n }}\n >\n {type === 'outlined-button' && 'Copy'}\n </ConfirmationButton>\n );\n};\n"]}
@@ -45,7 +45,7 @@ const clean_icon_button_1 = require("../clean-icon-button");
45
45
  const EyeDropperIconOutline_1 = require("../icons/generated/heroIcons/EyeDropperIconOutline");
46
46
  const select_1 = require("../select");
47
47
  const text_input_1 = require("../text-input");
48
- exports.ColorPicker = (0, react_1.forwardRef)(function ColorPicker({ color, onChange, swatches = Object.values(base_1.tokens.graph).filter(react_color_1.validHex), shouldShowEyeDropper = true, className, style, }, ref) {
48
+ exports.ColorPicker = (0, react_1.forwardRef)(function ColorPicker({ color, onChange, swatches = Object.values(base_1.tokens.graph).filter(react_color_1.validHex), shouldShowEyeDropper = true, className, style, portalTarget, floatingStrategy = 'absolute', }, ref) {
49
49
  const [isEyeDropperActiveState, setIsEyeDropperActiveState] = (0, react_1.useState)(false);
50
50
  const derivedHsva = (0, react_1.useMemo)(() => {
51
51
  if (typeof color === 'string') {
@@ -108,6 +108,8 @@ exports.ColorPicker = (0, react_1.forwardRef)(function ColorPicker({ color, onCh
108
108
  flexShrink: 0,
109
109
  }, selectProps: {
110
110
  isSearchable: false,
111
+ menuPortalTarget: portalTarget,
112
+ menuPosition: floatingStrategy,
111
113
  onChange: (newFormat) => {
112
114
  if (!newFormat) {
113
115
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/color-picker/ColorPicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,+BAA6B;AAE7B,0CAAyC;AACzC,kDAa0B;AAC1B,4DAAoC;AACpC,iCAAiE;AAEjE,4DAAuD;AACvD,8FAA2F;AAC3F,sCAAmC;AACnC,8CAA0C;AAqB7B,QAAA,WAAW,GAAG,IAAA,kBAAU,EACnC,SAAS,WAAW,CAClB,EACE,KAAK,EACL,QAAQ,EACR,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,aAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,sBAAQ,CAAC,EACvD,oBAAoB,GAAG,IAAI,EAC3B,SAAS,EACT,KAAK,GACN,EACD,GAAG;IAEH,MAAM,CAAC,uBAAuB,EAAE,0BAA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AAI,CAAC,CAAC;IAC9B,OAAO,CACL,gCACE,KAAK,EAAE;YACL,eAAe,EAAE,QAAQ,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG;YACnE,IAAI;YACJ,GAAG;SACJ,EACD,SAAS,EAAE,IAAA,oBAAU,EAAC,SAAS,EAAE,0BAA0B,CAAC,GAC5D,CACH,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 'eyedropper-polyfill';\n\nimport { tokens } from '@neo4j-ndl/base';\nimport {\n type HexColor,\n hexToHsva,\n type HsvaColor,\n hsvaToHex,\n hsvaToRgba,\n Hue,\n type PointerProps,\n type RgbaColor,\n rgbaToHex,\n rgbaToHsva,\n Saturation,\n validHex,\n} from '@uiw/react-color';\nimport classNames from 'classnames';\nimport { forwardRef, useEffect, useMemo, useState } from 'react';\n\nimport { CleanIconButton } from '../clean-icon-button';\nimport { EyeDropperIconOutline } from '../icons/generated/heroIcons/EyeDropperIconOutline';\nimport { Select } from '../select';\nimport { TextInput } from '../text-input';\n\ntype ColorPickerProps = {\n /** The current color value. Can be provided in HSVA, RGBA, or Hex format. The component will automatically convert between formats as needed. */\n color: HsvaColor | RgbaColor | HexColor;\n /** Optional array of predefined color swatches for quick selection. Each swatch can be in HSVA, RGBA, or Hex format. */\n swatches?: (HsvaColor | RgbaColor | HexColor)[];\n /** Whether to display the eye dropper tool that allows users to sample colors from anywhere on the screen. */\n shouldShowEyeDropper?: boolean;\n /** Callback function triggered when the color value changes. Receives an object containing the new color in all three formats (hex, rgb, hsva) for convenience. */\n onChange: (newColor: {\n hex: HexColor;\n rgb: RgbaColor;\n hsva: HsvaColor;\n }) => void;\n /** Additional class name to apply to the root color picker container. */\n className?: string;\n /** Additional inline styles to apply to the root color picker container. */\n style?: React.CSSProperties;\n};\n\nexport const ColorPicker = forwardRef<HTMLDivElement, ColorPickerProps>(\n function ColorPicker(\n {\n color,\n onChange,\n swatches = Object.values(tokens.graph).filter(validHex),\n shouldShowEyeDropper = true,\n className,\n style,\n },\n ref,\n ) {\n const [isEyeDropperActiveState, setIsEyeDropperActiveState] =\n useState(false);\n\n const derivedHsva = useMemo(() => {\n if (typeof color === 'string') {\n return hexToHsva(color);\n }\n if (typeof color === 'object' && 'r' in color) {\n return rgbaToHsva(color);\n }\n return { h: 0, s: 0, v: 0, ...(color as object), a: 1 } as HsvaColor;\n }, [color]);\n\n const [hsva, setHsva] = useState<HsvaColor>(derivedHsva);\n\n const [format, setFormat] = useState<{\n label: string;\n value: string;\n }>({\n label: 'Hex',\n value: 'hex',\n });\n\n const isEyeDropperActive = 'EyeDropper' in window && shouldShowEyeDropper;\n\n const handleChange = (hsva: HsvaColor) => {\n setHsva(hsva);\n const hex = hsvaToHex(hsva);\n const rgb = hsvaToRgba(hsva);\n onChange({\n // used since typescript cannot infer the type of the color\n hex: `#${hex.split('#')[1]}`,\n hsva,\n rgb,\n });\n };\n\n return (\n <div\n ref={ref}\n className={classNames('ndl-color-picker', className)}\n style={style}\n >\n <Saturation\n hsva={hsva}\n className=\"ndl-color-picker-saturation\"\n onChange={(newColor) => {\n handleChange({ ...hsva, ...newColor, a: hsva.a });\n }}\n pointer={({ left, top, ...props }) => (\n <Pointer\n left={left?.toString()}\n top={top?.toString()}\n {...props}\n hsva={hsva}\n />\n )}\n radius={tokens.borderRadius['lg']}\n />\n <Swatch\n colors={swatches}\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(newColor);\n }}\n />\n\n <div className=\"ndl-color-picker-hue-container\">\n {isEyeDropperActive && (\n <CleanIconButton\n size=\"small\"\n isActive={isEyeDropperActiveState}\n onClick={() => {\n setIsEyeDropperActiveState(true);\n // TODO: Remove the any casting when polyfiller is not needed anymore. https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper\n // Type assertion to handle the unknown type\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n const eyeDropper = new (window as any).EyeDropper();\n eyeDropper\n .open()\n .then((result: { sRGBHex: string }) => {\n handleChange(hexToHsva(result.sRGBHex));\n })\n .catch((err: Error) => {\n console.error(err);\n })\n .finally(() => {\n setIsEyeDropperActiveState(false);\n });\n }}\n description=\"Pick color from the screen with eye dropper tool\"\n >\n <EyeDropperIconOutline />\n </CleanIconButton>\n )}\n <Hue\n className=\"ndl-color-picker-hue\"\n hue={hsva.h}\n onChange={(newHue) => {\n handleChange({ ...hsva, h: newHue.h });\n }}\n radius={tokens.borderRadius['lg']}\n pointer={(props) => (\n <Pointer\n {...props}\n hsva={{\n a: 1,\n h: hsva.h,\n s: 100,\n v: 100,\n }}\n />\n )}\n />\n </div>\n\n <div className=\"ndl-color-picker-inputs\">\n <Select\n size=\"small\"\n type=\"select\"\n ariaLabel=\"Color format\"\n style={{\n flexShrink: 0,\n }}\n selectProps={{\n isSearchable: false,\n onChange: (newFormat) => {\n if (!newFormat) {\n return;\n }\n setFormat({\n label: newFormat.label,\n value: newFormat.value,\n });\n },\n options: [\n {\n label: 'Hex',\n value: 'hex',\n },\n {\n label: 'RGB',\n value: 'rgb',\n },\n ],\n value: { label: format.label, value: format.value },\n }}\n />\n {format.value === 'hex' && (\n <HexInput\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(hexToHsva(newColor));\n }}\n />\n )}\n {format.value === 'rgb' && (\n <RgbInput\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(hexToHsva(newColor));\n }}\n />\n )}\n </div>\n </div>\n );\n },\n);\n\nconst removeHashPrefix = (hex: string): string => hex.replace('#', '');\n\nconst HexInput = ({\n hsva,\n onChange,\n}: {\n hsva: HsvaColor;\n onChange: (newColor: string) => void;\n}) => {\n const [inputValue, setInputValue] = useState<string>(() =>\n removeHashPrefix(hsvaToHex(hsva)),\n );\n\n // Update input value when hsva changes from outside\n useEffect(() => {\n setInputValue(removeHashPrefix(hsvaToHex(hsva)));\n }, [hsva]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const value = removeHashPrefix(e.target.value);\n\n // Always update the input value for immediate feedback\n setInputValue(value);\n\n // Check if the input is a valid hex color (only 6 characters)\n const isValidHex = /^[0-9A-Fa-f]{6}$/.test(value);\n\n if (isValidHex) {\n onChange(`#${value}`);\n }\n };\n\n const hexValue = hsvaToHex(hsva);\n\n return (\n <TextInput\n size=\"small\"\n value={inputValue}\n leadingElement={\n <div className=\"ndl-color-picker-hex-input-prefix\">#</div>\n }\n onChange={handleChange}\n isFluid\n htmlAttributes={{\n 'aria-label': 'Hex color code',\n maxLength: 6,\n onCopy: (e) => {\n e.preventDefault();\n navigator.clipboard.writeText(hexValue);\n },\n }}\n />\n );\n};\n\nconst RgbInput = ({\n hsva,\n onChange,\n}: {\n hsva: HsvaColor;\n onChange: (newColor: string) => void;\n}) => {\n const rgba = hsvaToRgba(hsva);\n const [rgbValues, setRgbValues] = useState({\n b: rgba.b,\n g: rgba.g,\n r: rgba.r,\n });\n\n // Update input values when hsva changes from outside\n useEffect(() => {\n const newRgba = hsvaToRgba(hsva);\n setRgbValues({\n b: newRgba.b,\n g: newRgba.g,\n r: newRgba.r,\n });\n }, [hsva]);\n\n const handleChange = (\n channel: 'r' | 'g' | 'b',\n e: React.ChangeEvent<HTMLInputElement>,\n ) => {\n const value = parseInt(e.target.value, 10);\n\n // Validate the input is a number between 0-255\n const validValue = isNaN(value) ? 0 : Math.max(0, Math.min(255, value));\n\n const newRgbValues = {\n ...rgbValues,\n [channel]: validValue,\n };\n\n setRgbValues(newRgbValues);\n\n // Convert RGB to hex and call onChange\n const hexColor = `#${newRgbValues.r.toString(16).padStart(2, '0')}${newRgbValues.g.toString(16).padStart(2, '0')}${newRgbValues.b.toString(16).padStart(2, '0')}`;\n onChange(hexColor);\n };\n\n return (\n <div className=\"ndl-color-picker-rgb-inputs\">\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.r.toString()}\n onChange={(e) => handleChange('r', e)}\n htmlAttributes={{\n 'aria-label': 'Red',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.g.toString()}\n onChange={(e) => handleChange('g', e)}\n htmlAttributes={{\n 'aria-label': 'Green',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.b.toString()}\n onChange={(e) => handleChange('b', e)}\n htmlAttributes={{\n 'aria-label': 'Blue',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n </div>\n );\n};\n\nconst Swatch = ({\n colors,\n onChange,\n hsva,\n}: {\n colors: (HsvaColor | RgbaColor | HexColor)[];\n hsva: HsvaColor;\n onChange: (newColor: HsvaColor) => void;\n}) => {\n return (\n <div className=\"ndl-color-picker-swatch\">\n {colors.map((color) => {\n const hexColor =\n typeof color === 'string'\n ? color\n : typeof color === 'object' && 'r' in color\n ? rgbaToHex(color)\n : hsvaToHex(color);\n const hsvaColor =\n typeof color === 'string'\n ? hexToHsva(color)\n : 'r' in color\n ? rgbaToHsva(color)\n : color;\n\n const isActive =\n hsva.h === hsvaColor.h &&\n hsva.s === hsvaColor.s &&\n hsva.v === hsvaColor.v;\n\n return (\n <button\n type=\"button\"\n key={hexColor}\n aria-label={hexColor}\n className={classNames('ndl-color-picker-swatch-color', {\n 'ndl-color-picker-swatch-color-active': isActive,\n })}\n style={{ backgroundColor: hsvaToHex(hsvaColor) }}\n onClick={() => onChange(hsvaColor)}\n />\n );\n })}\n </div>\n );\n};\nconst Pointer = ({\n prefixCls,\n left,\n top,\n hsva,\n}: PointerProps & { hsva: HsvaColor }) => {\n const rgba = hsvaToRgba(hsva);\n return (\n <div\n style={{\n backgroundColor: `rgba(${rgba.r}, ${rgba.g}, ${rgba.b}, ${rgba.a})`,\n left,\n top,\n }}\n className={classNames(prefixCls, 'ndl-color-picker-pointer')}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/color-picker/ColorPicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,+BAA6B;AAE7B,0CAAyC;AACzC,kDAa0B;AAC1B,4DAAoC;AACpC,iCAAiE;AAEjE,4DAAuD;AACvD,8FAA2F;AAC3F,sCAAmC;AACnC,8CAA0C;AAuC7B,QAAA,WAAW,GAAG,IAAA,kBAAU,EACnC,SAAS,WAAW,CAClB,EACE,KAAK,EACL,QAAQ,EACR,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,aAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,sBAAQ,CAAC,EACvD,oBAAoB,GAAG,IAAI,EAC3B,SAAS,EACT,KAAK,EACL,YAAY,EACZ,gBAAgB,GAAG,UAAU,GAC9B,EACD,GAAG;IAEH,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,GACzD,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAElB,MAAM,WAAW,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC/B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,IAAA,uBAAS,EAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,GAAG,IAAI,KAAK,EAAE,CAAC;YAC9C,OAAO,IAAA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A0B,CAAC,GAC5D,CACH,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 'eyedropper-polyfill';\n\nimport { tokens } from '@neo4j-ndl/base';\nimport {\n type HexColor,\n hexToHsva,\n type HsvaColor,\n hsvaToHex,\n hsvaToRgba,\n Hue,\n type PointerProps,\n type RgbaColor,\n rgbaToHex,\n rgbaToHsva,\n Saturation,\n validHex,\n} from '@uiw/react-color';\nimport classNames from 'classnames';\nimport { forwardRef, useEffect, useMemo, useState } from 'react';\n\nimport { CleanIconButton } from '../clean-icon-button';\nimport { EyeDropperIconOutline } from '../icons/generated/heroIcons/EyeDropperIconOutline';\nimport { Select } from '../select';\nimport { TextInput } from '../text-input';\n\n/**\n * @remarks\n * By default the `swatches` prop is set to the available graph colors (`tokens.graph`) from `@neo4j-ndl/base`.\n *\n * @remarks\n * Where `HsvaColor`, `RgbaColor`, and `HexColor` types are from `@uiw/react-color`, and represent different color formats:\n *\n * - `HexColor`: A string in the format `#RRGGBB` (e.g., `#ff0000`).\n * - `RgbaColor`: An object with numeric properties `{ r, g, b, a }` for red, green, blue (0–255), and alpha (0–1).\n * - `HsvaColor`: An object with numeric properties `{ h, s, v, a }` for hue (0–360), saturation (0–100), value (0–100), and alpha (0–1).\n *\n * Visit [react-color](https://uiwjs.github.io/react-color/#/) for more information.\n */\ntype ColorPickerProps = {\n /** The current color value. Can be provided in HSVA, RGBA, or Hex format. The component will automatically convert between formats as needed. */\n color: HsvaColor | RgbaColor | HexColor;\n /** Optional array of predefined color swatches for quick selection. Each swatch can be in HSVA, RGBA, or Hex format. */\n swatches?: (HsvaColor | RgbaColor | HexColor)[];\n /** Whether to display the eye dropper tool that allows users to sample colors from anywhere on the screen. */\n shouldShowEyeDropper?: boolean;\n /** Callback function triggered when the color value changes. Receives an object containing the new color in all three formats (hex, rgb, hsva) for convenience. */\n onChange: (newColor: {\n hex: HexColor;\n rgb: RgbaColor;\n hsva: HsvaColor;\n }) => void;\n /** Additional class name to apply to the root color picker container. */\n className?: string;\n /** Additional inline styles to apply to the root color picker container. */\n style?: React.CSSProperties;\n\n /** The target element to portal the menu to. If not provided, the menu will not be portaled. */\n portalTarget?: HTMLElement | null;\n /** The floating strategy to use for the menu. If not provided, the menu will be positioned absolutely. */\n floatingStrategy?: 'absolute' | 'fixed';\n};\n\nexport const ColorPicker = forwardRef<HTMLDivElement, ColorPickerProps>(\n function ColorPicker(\n {\n color,\n onChange,\n swatches = Object.values(tokens.graph).filter(validHex),\n shouldShowEyeDropper = true,\n className,\n style,\n portalTarget,\n floatingStrategy = 'absolute',\n },\n ref,\n ) {\n const [isEyeDropperActiveState, setIsEyeDropperActiveState] =\n useState(false);\n\n const derivedHsva = useMemo(() => {\n if (typeof color === 'string') {\n return hexToHsva(color);\n }\n if (typeof color === 'object' && 'r' in color) {\n return rgbaToHsva(color);\n }\n return { h: 0, s: 0, v: 0, ...(color as object), a: 1 } as HsvaColor;\n }, [color]);\n\n const [hsva, setHsva] = useState<HsvaColor>(derivedHsva);\n\n const [format, setFormat] = useState<{\n label: string;\n value: string;\n }>({\n label: 'Hex',\n value: 'hex',\n });\n\n const isEyeDropperActive = 'EyeDropper' in window && shouldShowEyeDropper;\n\n const handleChange = (hsva: HsvaColor) => {\n setHsva(hsva);\n const hex = hsvaToHex(hsva);\n const rgb = hsvaToRgba(hsva);\n onChange({\n // used since typescript cannot infer the type of the color\n hex: `#${hex.split('#')[1]}`,\n hsva,\n rgb,\n });\n };\n\n return (\n <div\n ref={ref}\n className={classNames('ndl-color-picker', className)}\n style={style}\n >\n <Saturation\n hsva={hsva}\n className=\"ndl-color-picker-saturation\"\n onChange={(newColor) => {\n handleChange({ ...hsva, ...newColor, a: hsva.a });\n }}\n pointer={({ left, top, ...props }) => (\n <Pointer\n left={left?.toString()}\n top={top?.toString()}\n {...props}\n hsva={hsva}\n />\n )}\n radius={tokens.borderRadius['lg']}\n />\n <Swatch\n colors={swatches}\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(newColor);\n }}\n />\n\n <div className=\"ndl-color-picker-hue-container\">\n {isEyeDropperActive && (\n <CleanIconButton\n size=\"small\"\n isActive={isEyeDropperActiveState}\n onClick={() => {\n setIsEyeDropperActiveState(true);\n // TODO: Remove the any casting when polyfiller is not needed anymore. https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper\n // Type assertion to handle the unknown type\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n const eyeDropper = new (window as any).EyeDropper();\n eyeDropper\n .open()\n .then((result: { sRGBHex: string }) => {\n handleChange(hexToHsva(result.sRGBHex));\n })\n .catch((err: Error) => {\n console.error(err);\n })\n .finally(() => {\n setIsEyeDropperActiveState(false);\n });\n }}\n description=\"Pick color from the screen with eye dropper tool\"\n >\n <EyeDropperIconOutline />\n </CleanIconButton>\n )}\n <Hue\n className=\"ndl-color-picker-hue\"\n hue={hsva.h}\n onChange={(newHue) => {\n handleChange({ ...hsva, h: newHue.h });\n }}\n radius={tokens.borderRadius['lg']}\n pointer={(props) => (\n <Pointer\n {...props}\n hsva={{\n a: 1,\n h: hsva.h,\n s: 100,\n v: 100,\n }}\n />\n )}\n />\n </div>\n\n <div className=\"ndl-color-picker-inputs\">\n <Select\n size=\"small\"\n type=\"select\"\n ariaLabel=\"Color format\"\n style={{\n flexShrink: 0,\n }}\n selectProps={{\n isSearchable: false,\n menuPortalTarget: portalTarget,\n menuPosition: floatingStrategy,\n onChange: (newFormat) => {\n if (!newFormat) {\n return;\n }\n setFormat({\n label: newFormat.label,\n value: newFormat.value,\n });\n },\n options: [\n {\n label: 'Hex',\n value: 'hex',\n },\n {\n label: 'RGB',\n value: 'rgb',\n },\n ],\n value: { label: format.label, value: format.value },\n }}\n />\n {format.value === 'hex' && (\n <HexInput\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(hexToHsva(newColor));\n }}\n />\n )}\n {format.value === 'rgb' && (\n <RgbInput\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(hexToHsva(newColor));\n }}\n />\n )}\n </div>\n </div>\n );\n },\n);\n\nconst removeHashPrefix = (hex: string): string => hex.replace('#', '');\n\nconst HexInput = ({\n hsva,\n onChange,\n}: {\n hsva: HsvaColor;\n onChange: (newColor: string) => void;\n}) => {\n const [inputValue, setInputValue] = useState<string>(() =>\n removeHashPrefix(hsvaToHex(hsva)),\n );\n\n // Update input value when hsva changes from outside\n useEffect(() => {\n setInputValue(removeHashPrefix(hsvaToHex(hsva)));\n }, [hsva]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const value = removeHashPrefix(e.target.value);\n\n // Always update the input value for immediate feedback\n setInputValue(value);\n\n // Check if the input is a valid hex color (only 6 characters)\n const isValidHex = /^[0-9A-Fa-f]{6}$/.test(value);\n\n if (isValidHex) {\n onChange(`#${value}`);\n }\n };\n\n const hexValue = hsvaToHex(hsva);\n\n return (\n <TextInput\n size=\"small\"\n value={inputValue}\n leadingElement={\n <div className=\"ndl-color-picker-hex-input-prefix\">#</div>\n }\n onChange={handleChange}\n isFluid\n htmlAttributes={{\n 'aria-label': 'Hex color code',\n maxLength: 6,\n onCopy: (e) => {\n e.preventDefault();\n navigator.clipboard.writeText(hexValue);\n },\n }}\n />\n );\n};\n\nconst RgbInput = ({\n hsva,\n onChange,\n}: {\n hsva: HsvaColor;\n onChange: (newColor: string) => void;\n}) => {\n const rgba = hsvaToRgba(hsva);\n const [rgbValues, setRgbValues] = useState({\n b: rgba.b,\n g: rgba.g,\n r: rgba.r,\n });\n\n // Update input values when hsva changes from outside\n useEffect(() => {\n const newRgba = hsvaToRgba(hsva);\n setRgbValues({\n b: newRgba.b,\n g: newRgba.g,\n r: newRgba.r,\n });\n }, [hsva]);\n\n const handleChange = (\n channel: 'r' | 'g' | 'b',\n e: React.ChangeEvent<HTMLInputElement>,\n ) => {\n const value = parseInt(e.target.value, 10);\n\n // Validate the input is a number between 0-255\n const validValue = isNaN(value) ? 0 : Math.max(0, Math.min(255, value));\n\n const newRgbValues = {\n ...rgbValues,\n [channel]: validValue,\n };\n\n setRgbValues(newRgbValues);\n\n // Convert RGB to hex and call onChange\n const hexColor = `#${newRgbValues.r.toString(16).padStart(2, '0')}${newRgbValues.g.toString(16).padStart(2, '0')}${newRgbValues.b.toString(16).padStart(2, '0')}`;\n onChange(hexColor);\n };\n\n return (\n <div className=\"ndl-color-picker-rgb-inputs\">\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.r.toString()}\n onChange={(e) => handleChange('r', e)}\n htmlAttributes={{\n 'aria-label': 'Red',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.g.toString()}\n onChange={(e) => handleChange('g', e)}\n htmlAttributes={{\n 'aria-label': 'Green',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.b.toString()}\n onChange={(e) => handleChange('b', e)}\n htmlAttributes={{\n 'aria-label': 'Blue',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n </div>\n );\n};\n\nconst Swatch = ({\n colors,\n onChange,\n hsva,\n}: {\n colors: (HsvaColor | RgbaColor | HexColor)[];\n hsva: HsvaColor;\n onChange: (newColor: HsvaColor) => void;\n}) => {\n return (\n <div className=\"ndl-color-picker-swatch\">\n {colors.map((color) => {\n const hexColor =\n typeof color === 'string'\n ? color\n : typeof color === 'object' && 'r' in color\n ? rgbaToHex(color)\n : hsvaToHex(color);\n const hsvaColor =\n typeof color === 'string'\n ? hexToHsva(color)\n : 'r' in color\n ? rgbaToHsva(color)\n : color;\n\n const isActive =\n hsva.h === hsvaColor.h &&\n hsva.s === hsvaColor.s &&\n hsva.v === hsvaColor.v;\n\n return (\n <button\n type=\"button\"\n key={hexColor}\n aria-label={hexColor}\n className={classNames('ndl-color-picker-swatch-color', {\n 'ndl-color-picker-swatch-color-active': isActive,\n })}\n style={{ backgroundColor: hsvaToHex(hsvaColor) }}\n onClick={() => onChange(hsvaColor)}\n />\n );\n })}\n </div>\n );\n};\nconst Pointer = ({\n prefixCls,\n left,\n top,\n hsva,\n}: PointerProps & { hsva: HsvaColor }) => {\n const rgba = hsvaToRgba(hsva);\n return (\n <div\n style={{\n backgroundColor: `rgba(${rgba.r}, ${rgba.g}, ${rgba.b}, ${rgba.a})`,\n left,\n top,\n }}\n className={classNames(prefixCls, 'ndl-color-picker-pointer')}\n />\n );\n};\n"]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
+ const react_1 = require("@neo4j-ndl/react");
26
+ const react_2 = require("react");
27
+ const Component = () => {
28
+ const [isOpen, setIsOpen] = (0, react_2.useState)(false);
29
+ const handleClick = () => setIsOpen((prev) => !prev);
30
+ const handleClose = () => setIsOpen(false);
31
+ const [color, setColor] = (0, react_2.useState)({
32
+ a: 1,
33
+ b: 0,
34
+ g: 0,
35
+ r: 0,
36
+ });
37
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-items-center n-justify-centern-w-full", children: [(0, jsx_runtime_1.jsx)(react_1.FilledButton, { onClick: handleClick, htmlAttributes: { 'aria-haspopup': 'dialog' }, children: "Open Dialog" }), (0, jsx_runtime_1.jsxs)(react_1.Dialog, { onClose: handleClose, isOpen: isOpen, children: [(0, jsx_runtime_1.jsx)(react_1.Dialog.Header, { children: "Header" }), (0, jsx_runtime_1.jsx)(react_1.Dialog.Content, { className: "n-max-h-96 n-overflow-y-auto", children: (0, jsx_runtime_1.jsx)(react_1.ColorPicker, { color: color, onChange: (newColor) => setColor(newColor.rgb), floatingStrategy: "fixed" }) })] })] }));
38
+ };
39
+ exports.default = Component;
40
+ //# sourceMappingURL=color-picker-dialog.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-picker-dialog.story.js","sourceRoot":"","sources":["../../../../src/color-picker/stories/color-picker-dialog.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAAqE;AACrE,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAE3C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC;QACjC,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;KACL,CAAC,CAAC;IAEH,OAAO,CACL,iCAAK,SAAS,EAAC,gDAAgD,aAC7D,uBAAC,oBAAY,IACX,OAAO,EAAE,WAAW,EACpB,cAAc,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,4BAGhC,EACf,wBAAC,cAAM,IAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,aAC1C,uBAAC,cAAM,CAAC,MAAM,yBAAuB,EACrC,uBAAC,cAAM,CAAC,OAAO,IAAC,SAAS,EAAC,8BAA8B,YACtD,uBAAC,mBAAW,IACV,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAC9C,gBAAgB,EAAC,OAAO,GACxB,GACa,IACV,IACL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,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 */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { ColorPicker, Dialog, FilledButton } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [isOpen, setIsOpen] = useState<boolean>(false);\n const handleClick = () => setIsOpen((prev) => !prev);\n const handleClose = () => setIsOpen(false);\n\n const [color, setColor] = useState({\n a: 1,\n b: 0,\n g: 0,\n r: 0,\n });\n\n return (\n <div className=\"n-flex n-items-center n-justify-centern-w-full\">\n <FilledButton\n onClick={handleClick}\n htmlAttributes={{ 'aria-haspopup': 'dialog' }}\n >\n Open Dialog\n </FilledButton>\n <Dialog onClose={handleClose} isOpen={isOpen}>\n <Dialog.Header>Header</Dialog.Header>\n <Dialog.Content className=\"n-max-h-96 n-overflow-y-auto\">\n <ColorPicker\n color={color}\n onChange={(newColor) => setColor(newColor.rgb)}\n floatingStrategy=\"fixed\"\n />\n </Dialog.Content>\n </Dialog>\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
+ const react_1 = require("@neo4j-ndl/react");
26
+ const Component = () => {
27
+ return ((0, jsx_runtime_1.jsxs)(react_1.Popover, { children: [(0, jsx_runtime_1.jsx)(react_1.Popover.Trigger, { hasButtonWrapper: true, children: (0, jsx_runtime_1.jsx)(react_1.FilledButton, { children: "Open Popover" }) }), (0, jsx_runtime_1.jsxs)(react_1.Popover.Content, { className: "n-overflow-y-auto n-overflow-x-hidden n-p-4 n-max-h-64", children: ["Popover content", (0, jsx_runtime_1.jsx)(react_1.ColorPicker, { color: "#ff0000", onChange: () => {
28
+ console.info('color changed');
29
+ }, floatingStrategy: "fixed", portalTarget: document.body })] })] }));
30
+ };
31
+ exports.default = Component;
32
+ //# sourceMappingURL=color-picker-popover.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-picker-popover.story.js","sourceRoot":"","sources":["../../../../src/color-picker/stories/color-picker-popover.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAAsE;AAEtE,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,wBAAC,eAAO,eACN,uBAAC,eAAO,CAAC,OAAO,IAAC,gBAAgB,kBAC/B,uBAAC,oBAAY,+BAA4B,GACzB,EAClB,wBAAC,eAAO,CAAC,OAAO,IAAC,SAAS,EAAC,wDAAwD,gCAEjF,uBAAC,mBAAW,IACV,KAAK,EAAC,SAAS,EACf,QAAQ,EAAE,GAAG,EAAE;4BACb,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;wBAChC,CAAC,EACD,gBAAgB,EAAC,OAAO,EACxB,YAAY,EAAE,QAAQ,CAAC,IAAI,GAC3B,IACc,IACV,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,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 */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { ColorPicker, FilledButton, Popover } from '@neo4j-ndl/react';\n\nconst Component = () => {\n return (\n <Popover>\n <Popover.Trigger hasButtonWrapper>\n <FilledButton>Open Popover</FilledButton>\n </Popover.Trigger>\n <Popover.Content className=\"n-overflow-y-auto n-overflow-x-hidden n-p-4 n-max-h-64\">\n Popover content\n <ColorPicker\n color=\"#ff0000\"\n onChange={() => {\n console.info('color changed');\n }}\n floatingStrategy=\"fixed\"\n portalTarget={document.body}\n />\n </Popover.Content>\n </Popover>\n );\n};\n\nexport default Component;\n"]}
@@ -23,18 +23,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ColorPickerCustomSwatchesSource = exports.ColorPickerWithoutEyeDropperSource = exports.ColorPickerDefaultSource = exports.ColorPickerCustomSwatches = exports.ColorPickerWithoutEyeDropper = exports.ColorPickerDefault = void 0;
26
+ exports.ColorPickerPopoverSource = exports.ColorPickerDialogSource = exports.ColorPickerCustomSwatchesSource = exports.ColorPickerWithoutEyeDropperSource = exports.ColorPickerDefaultSource = exports.ColorPickerPopover = exports.ColorPickerDialog = exports.ColorPickerCustomSwatches = exports.ColorPickerWithoutEyeDropper = exports.ColorPickerDefault = void 0;
27
27
  var color_picker_default_story_1 = require("./color-picker-default.story");
28
28
  Object.defineProperty(exports, "ColorPickerDefault", { enumerable: true, get: function () { return __importDefault(color_picker_default_story_1).default; } });
29
29
  var color_picker_without_eyedropper_story_1 = require("./color-picker-without-eyedropper.story");
30
30
  Object.defineProperty(exports, "ColorPickerWithoutEyeDropper", { enumerable: true, get: function () { return __importDefault(color_picker_without_eyedropper_story_1).default; } });
31
31
  var color_picker_custom_swatches_story_1 = require("./color-picker-custom-swatches.story");
32
32
  Object.defineProperty(exports, "ColorPickerCustomSwatches", { enumerable: true, get: function () { return __importDefault(color_picker_custom_swatches_story_1).default; } });
33
+ var color_picker_dialog_story_1 = require("./color-picker-dialog.story");
34
+ Object.defineProperty(exports, "ColorPickerDialog", { enumerable: true, get: function () { return __importDefault(color_picker_dialog_story_1).default; } });
35
+ var color_picker_popover_story_1 = require("./color-picker-popover.story");
36
+ Object.defineProperty(exports, "ColorPickerPopover", { enumerable: true, get: function () { return __importDefault(color_picker_popover_story_1).default; } });
33
37
  const export_stories_utils_1 = require("../../_common/export-stories-utils");
34
38
  const color_picker_custom_swatches_story_tsx_raw_1 = __importDefault(require("./color-picker-custom-swatches.story.tsx?raw"));
35
39
  const color_picker_default_story_tsx_raw_1 = __importDefault(require("./color-picker-default.story.tsx?raw"));
40
+ const color_picker_dialog_story_tsx_raw_1 = __importDefault(require("./color-picker-dialog.story.tsx?raw"));
41
+ const color_picker_popover_story_tsx_raw_1 = __importDefault(require("./color-picker-popover.story.tsx?raw"));
36
42
  const color_picker_without_eyedropper_story_tsx_raw_1 = __importDefault(require("./color-picker-without-eyedropper.story.tsx?raw"));
37
43
  exports.ColorPickerDefaultSource = (0, export_stories_utils_1.removeLicenseHeader)(color_picker_default_story_tsx_raw_1.default);
38
44
  exports.ColorPickerWithoutEyeDropperSource = (0, export_stories_utils_1.removeLicenseHeader)(color_picker_without_eyedropper_story_tsx_raw_1.default);
39
45
  exports.ColorPickerCustomSwatchesSource = (0, export_stories_utils_1.removeLicenseHeader)(color_picker_custom_swatches_story_tsx_raw_1.default);
46
+ exports.ColorPickerDialogSource = (0, export_stories_utils_1.removeLicenseHeader)(color_picker_dialog_story_tsx_raw_1.default);
47
+ exports.ColorPickerPopoverSource = (0, export_stories_utils_1.removeLicenseHeader)(color_picker_popover_story_tsx_raw_1.default);
40
48
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/color-picker/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,2EAA6E;AAApE,iJAAA,OAAO,OAAsB;AACtC,iGAAkG;AAAzF,sKAAA,OAAO,OAAgC;AAChD,2FAA4F;AAAnF,gKAAA,OAAO,OAA6B;AAE7C,6EAAyE;AACzE,8HAA8F;AAC9F,8GAA+E;AAC/E,oIAAoG;AAEvF,QAAA,wBAAwB,GAAG,IAAA,0CAAmB,EACzD,4CAA2B,CAC5B,CAAC;AACW,QAAA,kCAAkC,GAAG,IAAA,0CAAmB,EACnE,uDAAqC,CACtC,CAAC;AACW,QAAA,+BAA+B,GAAG,IAAA,0CAAmB,EAChE,oDAAkC,CACnC,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 */\n\nexport { default as ColorPickerDefault } from './color-picker-default.story';\nexport { default as ColorPickerWithoutEyeDropper } from './color-picker-without-eyedropper.story';\nexport { default as ColorPickerCustomSwatches } from './color-picker-custom-swatches.story';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\nimport ColorPickerCustomSwatchesSourceRaw from './color-picker-custom-swatches.story.tsx?raw';\nimport ColorPickerDefaultSourceRaw from './color-picker-default.story.tsx?raw';\nimport ColorPickerWithoutEyeDropperSourceRaw from './color-picker-without-eyedropper.story.tsx?raw';\n\nexport const ColorPickerDefaultSource = removeLicenseHeader(\n ColorPickerDefaultSourceRaw,\n);\nexport const ColorPickerWithoutEyeDropperSource = removeLicenseHeader(\n ColorPickerWithoutEyeDropperSourceRaw,\n);\nexport const ColorPickerCustomSwatchesSource = removeLicenseHeader(\n ColorPickerCustomSwatchesSourceRaw,\n);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/color-picker/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,2EAA6E;AAApE,iJAAA,OAAO,OAAsB;AACtC,iGAAkG;AAAzF,sKAAA,OAAO,OAAgC;AAChD,2FAA4F;AAAnF,gKAAA,OAAO,OAA6B;AAC7C,yEAA2E;AAAlE,+IAAA,OAAO,OAAqB;AACrC,2EAA6E;AAApE,iJAAA,OAAO,OAAsB;AAEtC,6EAAyE;AACzE,8HAA8F;AAC9F,8GAA+E;AAC/E,4GAA6E;AAC7E,8GAA+E;AAC/E,oIAAoG;AAEvF,QAAA,wBAAwB,GAAG,IAAA,0CAAmB,EACzD,4CAA2B,CAC5B,CAAC;AACW,QAAA,kCAAkC,GAAG,IAAA,0CAAmB,EACnE,uDAAqC,CACtC,CAAC;AACW,QAAA,+BAA+B,GAAG,IAAA,0CAAmB,EAChE,oDAAkC,CACnC,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,0CAAmB,EACxD,2CAA0B,CAC3B,CAAC;AACW,QAAA,wBAAwB,GAAG,IAAA,0CAAmB,EACzD,4CAA2B,CAC5B,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 */\n\nexport { default as ColorPickerDefault } from './color-picker-default.story';\nexport { default as ColorPickerWithoutEyeDropper } from './color-picker-without-eyedropper.story';\nexport { default as ColorPickerCustomSwatches } from './color-picker-custom-swatches.story';\nexport { default as ColorPickerDialog } from './color-picker-dialog.story';\nexport { default as ColorPickerPopover } from './color-picker-popover.story';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\nimport ColorPickerCustomSwatchesSourceRaw from './color-picker-custom-swatches.story.tsx?raw';\nimport ColorPickerDefaultSourceRaw from './color-picker-default.story.tsx?raw';\nimport ColorPickerDialogSourceRaw from './color-picker-dialog.story.tsx?raw';\nimport ColorPickerPopoverSourceRaw from './color-picker-popover.story.tsx?raw';\nimport ColorPickerWithoutEyeDropperSourceRaw from './color-picker-without-eyedropper.story.tsx?raw';\n\nexport const ColorPickerDefaultSource = removeLicenseHeader(\n ColorPickerDefaultSourceRaw,\n);\nexport const ColorPickerWithoutEyeDropperSource = removeLicenseHeader(\n ColorPickerWithoutEyeDropperSourceRaw,\n);\nexport const ColorPickerCustomSwatchesSource = removeLicenseHeader(\n ColorPickerCustomSwatchesSourceRaw,\n);\nexport const ColorPickerDialogSource = removeLicenseHeader(\n ColorPickerDialogSourceRaw,\n);\nexport const ColorPickerPopoverSource = removeLicenseHeader(\n ColorPickerPopoverSourceRaw,\n);\n"]}
@@ -20,7 +20,7 @@
20
20
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
21
  */
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.DataGridTimeLiteralSchema = exports.DataGridStyleRuleWhereSchema = exports.DataGridStyleRuleSchema = exports.DataGridStyleRuleOperandSchema = exports.DataGridStyleRuleLiteralSchema = exports.DataGridDisableableColorSchema = exports.DataGridDatetimeLiteralSchema = exports.DataGridColumnRefSchema = exports.DataGridColorRangeSchema = exports.DataGridCellStyleSchema = exports.isDataGridStyleRule = exports.useDataGridCellStyle = exports.evaluateDataGridStyleRules = void 0;
23
+ exports.DataGridLocalDatetimeLiteralSchema = exports.DataGridTimeLiteralSchema = exports.DataGridStyleRuleWhereSchema = exports.DataGridStyleRuleSchema = exports.DataGridStyleRuleOperandSchema = exports.DataGridStyleRuleLiteralSchema = exports.DataGridDisableableColorSchema = exports.DataGridDatetimeLiteralSchema = exports.DataGridColumnRefSchema = exports.DataGridColorRangeSchema = exports.DataGridCellStyleSchema = exports.isDataGridStyleRule = exports.useDataGridCellStyle = exports.evaluateDataGridStyleRules = void 0;
24
24
  var evaluate_1 = require("./evaluate");
25
25
  Object.defineProperty(exports, "evaluateDataGridStyleRules", { enumerable: true, get: function () { return evaluate_1.evaluateDataGridStyleRules; } });
26
26
  var hooks_1 = require("./hooks");
@@ -39,4 +39,5 @@ Object.defineProperty(exports, "DataGridStyleRuleOperandSchema", { enumerable: t
39
39
  Object.defineProperty(exports, "DataGridStyleRuleSchema", { enumerable: true, get: function () { return types_2.DataGridStyleRuleSchema; } });
40
40
  Object.defineProperty(exports, "DataGridStyleRuleWhereSchema", { enumerable: true, get: function () { return types_2.DataGridStyleRuleWhereSchema; } });
41
41
  Object.defineProperty(exports, "DataGridTimeLiteralSchema", { enumerable: true, get: function () { return types_2.DataGridTimeLiteralSchema; } });
42
+ Object.defineProperty(exports, "DataGridLocalDatetimeLiteralSchema", { enumerable: true, get: function () { return types_2.DataGridLocalDatetimeLiteralSchema; } });
42
43
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,uCAAwD;AAA/C,sHAAA,0BAA0B,OAAA;AACnC,iCAA+C;AAAtC,6GAAA,oBAAoB,OAAA;AAC7B,iCAA8C;AAArC,4GAAA,mBAAmB,OAAA;AAC5B,iCAAiC;AACjC,iCAWiB;AAVf,gHAAA,uBAAuB,OAAA;AACvB,iHAAA,wBAAwB,OAAA;AACxB,gHAAA,uBAAuB,OAAA;AACvB,sHAAA,6BAA6B,OAAA;AAC7B,uHAAA,8BAA8B,OAAA;AAC9B,uHAAA,8BAA8B,OAAA;AAC9B,uHAAA,8BAA8B,OAAA;AAC9B,gHAAA,uBAAuB,OAAA;AACvB,qHAAA,4BAA4B,OAAA;AAC5B,kHAAA,yBAAyB,OAAA","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { evaluateDataGridStyleRules } from './evaluate';\nexport { useDataGridCellStyle } from './hooks';\nexport { isDataGridStyleRule } from './types';\n// TODO v5: remove schema exports\nexport {\n DataGridCellStyleSchema,\n DataGridColorRangeSchema,\n DataGridColumnRefSchema,\n DataGridDatetimeLiteralSchema,\n DataGridDisableableColorSchema,\n DataGridStyleRuleLiteralSchema,\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleSchema,\n DataGridStyleRuleWhereSchema,\n DataGridTimeLiteralSchema,\n} from './types';\nexport type {\n DataGridCellStyle,\n DataGridColorRange,\n DataGridColumnRef,\n DataGridDatetimeLiteral,\n DataGridDisableableColor,\n DataGridStyleRuleLiteral,\n DataGridStyleRuleOperand,\n DataGridStyleRule,\n DataGridStyleRuleWhere,\n DataGridStyleRuleValueConverter,\n DataGridStyleRuleValueConverters,\n DataGridTimeLiteral,\n} from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,uCAAwD;AAA/C,sHAAA,0BAA0B,OAAA;AACnC,iCAA+C;AAAtC,6GAAA,oBAAoB,OAAA;AAC7B,iCAA8C;AAArC,4GAAA,mBAAmB,OAAA;AAC5B,iCAAiC;AACjC,iCAYiB;AAXf,gHAAA,uBAAuB,OAAA;AACvB,iHAAA,wBAAwB,OAAA;AACxB,gHAAA,uBAAuB,OAAA;AACvB,sHAAA,6BAA6B,OAAA;AAC7B,uHAAA,8BAA8B,OAAA;AAC9B,uHAAA,8BAA8B,OAAA;AAC9B,uHAAA,8BAA8B,OAAA;AAC9B,gHAAA,uBAAuB,OAAA;AACvB,qHAAA,4BAA4B,OAAA;AAC5B,kHAAA,yBAAyB,OAAA;AACzB,2HAAA,kCAAkC,OAAA","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { evaluateDataGridStyleRules } from './evaluate';\nexport { useDataGridCellStyle } from './hooks';\nexport { isDataGridStyleRule } from './types';\n// TODO v5: remove schema exports\nexport {\n DataGridCellStyleSchema,\n DataGridColorRangeSchema,\n DataGridColumnRefSchema,\n DataGridDatetimeLiteralSchema,\n DataGridDisableableColorSchema,\n DataGridStyleRuleLiteralSchema,\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleSchema,\n DataGridStyleRuleWhereSchema,\n DataGridTimeLiteralSchema,\n DataGridLocalDatetimeLiteralSchema,\n} from './types';\nexport type {\n DataGridCellStyle,\n DataGridColorRange,\n DataGridColumnRef,\n DataGridDatetimeLiteral,\n DataGridDisableableColor,\n DataGridStyleRuleLiteral,\n DataGridStyleRuleOperand,\n DataGridStyleRule,\n DataGridStyleRuleWhere,\n DataGridStyleRuleValueConverter,\n DataGridStyleRuleValueConverters,\n DataGridTimeLiteral,\n DataGridLocalDatetimeLiteral,\n} from './types';\n"]}