@neo4j-ndl/react 4.5.3 → 4.5.5

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 (35) hide show
  1. package/lib/cjs/accordion/Accordion.js +3 -3
  2. package/lib/cjs/accordion/Accordion.js.map +1 -1
  3. package/lib/cjs/ai/reasoning/Reasoning.js +13 -7
  4. package/lib/cjs/ai/reasoning/Reasoning.js.map +1 -1
  5. package/lib/cjs/ai/reasoning/stories/index.js +5 -1
  6. package/lib/cjs/ai/reasoning/stories/index.js.map +1 -1
  7. package/lib/cjs/ai/reasoning/stories/reasoning-controlled.story.js +34 -0
  8. package/lib/cjs/ai/reasoning/stories/reasoning-controlled.story.js.map +1 -0
  9. package/lib/cjs/ai/reasoning/stories/reasoning-full.story.js +1 -1
  10. package/lib/cjs/ai/reasoning/stories/reasoning-full.story.js.map +1 -1
  11. package/lib/cjs/ai/reasoning/stories/reasoning.stories.js +14 -1
  12. package/lib/cjs/ai/reasoning/stories/reasoning.stories.js.map +1 -1
  13. package/lib/esm/accordion/Accordion.js +3 -3
  14. package/lib/esm/accordion/Accordion.js.map +1 -1
  15. package/lib/esm/ai/reasoning/Reasoning.js +13 -7
  16. package/lib/esm/ai/reasoning/Reasoning.js.map +1 -1
  17. package/lib/esm/ai/reasoning/stories/index.js +3 -0
  18. package/lib/esm/ai/reasoning/stories/index.js.map +1 -1
  19. package/lib/esm/ai/reasoning/stories/reasoning-controlled.story.js +32 -0
  20. package/lib/esm/ai/reasoning/stories/reasoning-controlled.story.js.map +1 -0
  21. package/lib/esm/ai/reasoning/stories/reasoning-full.story.js +1 -1
  22. package/lib/esm/ai/reasoning/stories/reasoning-full.story.js.map +1 -1
  23. package/lib/esm/ai/reasoning/stories/reasoning.stories.js +14 -1
  24. package/lib/esm/ai/reasoning/stories/reasoning.stories.js.map +1 -1
  25. package/lib/types/accordion/Accordion.d.ts.map +1 -1
  26. package/lib/types/ai/reasoning/Reasoning.d.ts +7 -1
  27. package/lib/types/ai/reasoning/Reasoning.d.ts.map +1 -1
  28. package/lib/types/ai/reasoning/stories/index.d.ts +2 -0
  29. package/lib/types/ai/reasoning/stories/index.d.ts.map +1 -1
  30. package/lib/types/ai/reasoning/stories/reasoning-controlled.story.d.ts +24 -0
  31. package/lib/types/ai/reasoning/stories/reasoning-controlled.story.d.ts.map +1 -0
  32. package/lib/types/ai/reasoning/stories/reasoning-full.story.d.ts.map +1 -1
  33. package/lib/types/ai/reasoning/stories/reasoning.stories.d.ts +1 -0
  34. package/lib/types/ai/reasoning/stories/reasoning.stories.d.ts.map +1 -1
  35. package/package.json +1 -1
@@ -101,8 +101,8 @@ const AccordionComponent = function AccordionComponent(_a) {
101
101
  }
102
102
  };
103
103
  const classes = (0, classnames_1.default)('ndl-accordion', className);
104
- const { expandedItemIds } = restProps;
105
- const { expandedItemId } = restProps;
104
+ // Destructure and omit keys from DOM spread
105
+ const _b = restProps, { expandedItemIds, expandedItemId } = _b, restAccordionProps = __rest(_b, ["expandedItemIds", "expandedItemId"]);
106
106
  const contextValue = isMultiple
107
107
  ? {
108
108
  expandedItemIds,
@@ -114,7 +114,7 @@ const AccordionComponent = function AccordionComponent(_a) {
114
114
  isMultiple,
115
115
  onChange,
116
116
  };
117
- return ((0, jsx_runtime_1.jsx)(Component, Object.assign({ className: classes, style: style, ref: accordionRef, onKeyDown: handleKeyDown, role: "presentation" }, restProps, htmlAttributes, { children: (0, jsx_runtime_1.jsx)(accordion_context_1.AccordionContext.Provider, { value: contextValue, children: children }) })));
117
+ return ((0, jsx_runtime_1.jsx)(Component, Object.assign({ className: classes, style: style, ref: accordionRef, onKeyDown: handleKeyDown, role: "presentation" }, restAccordionProps, htmlAttributes, { children: (0, jsx_runtime_1.jsx)(accordion_context_1.AccordionContext.Provider, { value: contextValue, children: children }) })));
118
118
  };
119
119
  const createItemId = (type, id) => `ndl-accordionitem${type}id-${id}`;
120
120
  const BaseAccordionItem = ({ itemId, children, title, className = '', arrowPosition = 'leading', isDisabled = false, onExpandedChange, htmlAttributes, style, as, titleTypographyVariant = 'subheading-medium', hasDivider = true, trailingContent, }) => {
@@ -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,oCAAkD;AAClD,8CAA2C;AAC3C,2DAA4E;AAY5E,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,aA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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';\nimport { Typography } from '../typography';\nimport { AccordionContext, useAccordionContext } from './accordion-context';\nimport {\n type AccordionIsMultiple,\n type AccordionIsNotMultiple,\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 const { expandedItemIds } = restProps as AccordionIsMultiple<T>;\n const { expandedItemId } = restProps as AccordionIsNotMultiple<T>;\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 {...restProps}\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}: 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 <button\n id={buttonElementId}\n onClick={handleOnClick}\n className={buttonClasses}\n aria-expanded={isExpanded}\n aria-disabled={isDisabled}\n aria-label={title}\n aria-controls={panelElementId}\n disabled={isDisabled}\n >\n <span className={iconClasses}>\n <Typography\n variant={titleTypographyVariant}\n className={titleClasses}\n htmlAttributes={{\n 'aria-level': 2,\n role: 'heading',\n }}\n >\n {title}\n </Typography>\n\n <ChevronDownIconOutline\n className={classNames('ndl-accordion-item-header-icon', {\n '-n-rotate-180': isExpanded,\n })}\n />\n </span>\n </button>\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,oCAAkD;AAClD,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;A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BAA0B,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';\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}: 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 <button\n id={buttonElementId}\n onClick={handleOnClick}\n className={buttonClasses}\n aria-expanded={isExpanded}\n aria-disabled={isDisabled}\n aria-label={title}\n aria-controls={panelElementId}\n disabled={isDisabled}\n >\n <span className={iconClasses}>\n <Typography\n variant={titleTypographyVariant}\n className={titleClasses}\n htmlAttributes={{\n 'aria-level': 2,\n role: 'heading',\n }}\n >\n {title}\n </Typography>\n\n <ChevronDownIconOutline\n className={classNames('ndl-accordion-item-header-icon', {\n '-n-rotate-180': isExpanded,\n })}\n />\n </span>\n </button>\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"]}
@@ -40,6 +40,7 @@ const react_1 = require("@neo4j-ndl/react");
40
40
  const icons_1 = require("@neo4j-ndl/react/icons");
41
41
  const classnames_1 = __importDefault(require("classnames"));
42
42
  const react_2 = require("react");
43
+ const use_semi_controlled_state_1 = require("../../_common/use-semi-controlled-state");
43
44
  const presence_1 = require("../presence");
44
45
  const thinking_duration_formatter_1 = require("../thinking/thinking-duration-formatter");
45
46
  /**
@@ -61,14 +62,19 @@ const ReasoningComponent = (_a) => {
61
62
  }), inert: !shouldShowChildren, children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-reasoning-content-inner", children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-reasoning-content-inner-2", children: children }) }) })] })));
62
63
  };
63
64
  const Section = (_a) => {
64
- var { heading, leadingVisual, children, className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["heading", "leadingVisual", "children", "className", "style", "htmlAttributes", "ref"]);
65
+ var _b;
66
+ var { heading, leadingVisual, children, className, style, htmlAttributes, ref, isExpanded, isDefaultExpanded, onExpandChange } = _a, restProps = __rest(_a, ["heading", "leadingVisual", "children", "className", "style", "htmlAttributes", "ref", "isExpanded", "isDefaultExpanded", "onExpandChange"]);
65
67
  const classes = (0, classnames_1.default)('ndl-ai-reasoning-section', className);
66
- const [isExpanded, setIsExpanded] = (0, react_2.useState)(false);
67
- return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-reasoning-section-header", children: [(0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-reasoning-section-leading", children: leadingVisual }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "subheading-small", children: heading }), (0, jsx_runtime_1.jsx)(react_1.CleanIconButton, { description: isExpanded ? 'Collapse' : 'Expand', size: "small", variant: "neutral", className: (0, classnames_1.default)('ndl-ai-reasoning-expand-button', {
68
- 'ndl-expanded': isExpanded,
69
- }), onClick: () => setIsExpanded(!isExpanded), children: (0, jsx_runtime_1.jsx)(icons_1.ChevronDownIconOutline, {}) })] }), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ndl-ai-reasoning-section-content', {
70
- 'ndl-expanded': isExpanded,
71
- }), inert: !isExpanded, children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-reasoning-section-content-inner", children: (0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-reasoning-section-content-inner-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-reasoning-section-content-line-container", children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-reasoning-section-content-line" }) }), (0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-reasoning-section-content-children", children: children })] }) }) })] })));
68
+ const [isExpandedState, setIsExpandedState] = (0, use_semi_controlled_state_1.useSemicontrolledState)({
69
+ isControlled: isExpanded !== undefined,
70
+ onChange: onExpandChange,
71
+ state: (_b = isExpanded !== null && isExpanded !== void 0 ? isExpanded : isDefaultExpanded) !== null && _b !== void 0 ? _b : false,
72
+ });
73
+ return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-reasoning-section-header", children: [(0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-reasoning-section-leading", children: leadingVisual }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "subheading-small", children: heading }), (0, jsx_runtime_1.jsx)(react_1.CleanIconButton, { description: isExpandedState ? 'Collapse' : 'Expand', size: "small", variant: "neutral", className: (0, classnames_1.default)('ndl-ai-reasoning-expand-button', {
74
+ 'ndl-expanded': isExpandedState,
75
+ }), onClick: () => setIsExpandedState((prev) => !prev), children: (0, jsx_runtime_1.jsx)(icons_1.ChevronDownIconOutline, {}) })] }), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ndl-ai-reasoning-section-content', {
76
+ 'ndl-expanded': isExpandedState,
77
+ }), inert: !isExpandedState, children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-reasoning-section-content-inner", children: (0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-reasoning-section-content-inner-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-reasoning-section-content-line-container", children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-reasoning-section-content-line" }) }), (0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-reasoning-section-content-children", children: children })] }) }) })] })));
72
78
  };
73
79
  const Reasoning = Object.assign(ReasoningComponent, {
74
80
  Section,
@@ -1 +1 @@
1
- {"version":3,"file":"Reasoning.js","sourceRoot":"","sources":["../../../../src/ai/reasoning/Reasoning.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4CAA+D;AAC/D,kDAAgE;AAChE,4DAAoC;AACpC,iCAAiC;AAGjC,0CAAuC;AACvC,yFAAiF;AAajF;;;;;GAKG;AACH,MAAM,kBAAkB,GAAG,CAAC,EAUS,EAAE,EAAE;QAVb,EAC1B,UAAU,GAAG,IAAI,EACjB,UAAU,GAAG,IAAI,EACjB,aAAa,GAAG,UAAU,EAC1B,QAAQ,EACR,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,OAEgC,EADhC,SAAS,cATc,wGAU3B,CADa;IAEZ,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;IAC1D,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IACpD,MAAM,kBAAkB,GAAG,UAAU,IAAI,UAAU,KAAK,KAAK,CAAC;IAE9D,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,IAAA,oDAAsB,EAAC,UAAU,CAAC,CAAC;IAE7E,OAAO,CACL,+CACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,IACR,SAAS,EACT,cAAc,eAElB,uBAAC,kBAAU,IAAC,OAAO,EAAC,OAAO,EAAC,SAAS,EAAC,yBAAyB,YAC5D,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,CACrB,6DACE,uBAAC,mBAAQ,IAAC,UAAU,E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AK,SAAS,EAAC,iCAAiC,aAC9C,gCAAK,SAAS,EAAC,kCAAkC,YAAE,aAAa,GAAO,EACvE,uBAAC,kBAAU,IAAC,OAAO,EAAC,kBAAkB,YAAE,OAAO,GAAc,EAC7D,uBAAC,uBAAe,IACd,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,EAC/C,IAAI,EAAC,OAAO,EACZ,OAAO,EAAC,SAAS,EACjB,SAAS,EAAE,IAAA,oBAAU,EAAC,gCAAgC,EAAE;4BACtD,cAAc,EAAE,UAAU;yBAC3B,CAAC,EACF,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,UAAU,CAAC,YAEzC,uBAAC,8BAAsB,KAAG,GACV,IACd,EACN,gCACE,SAAS,EAAE,IAAA,oBAAU,EAAC,kCAAkC,EAAE;oBACxD,cAAc,EAAE,UAAU;iBAC3B,CAAC,EACF,KAAK,EAAE,CAAC,UAAU,YAElB,gCAAK,SAAS,EAAC,wCAAwC,YACrD,iCAAK,SAAS,EAAC,0CAA0C,aACvD,gCAAK,SAAS,EAAC,iDAAiD,YAC9D,gCAAK,SAAS,EAAC,uCAAuC,GAAG,GACrD,EACN,gCAAK,SAAS,EAAC,2CAA2C,YACvD,QAAQ,GACL,IACF,GACF,GACF,KACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE;IAClD,OAAO;CACR,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 */\n\nimport { CleanIconButton, Typography } from '@neo4j-ndl/react';\nimport { ChevronDownIconOutline } from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport { useState } from 'react';\n\nimport { type CommonProps } from '../../_common/types';\nimport { Presence } from '../presence';\nimport { formatThinkingDuration } from '../thinking/thinking-duration-formatter';\n\ntype ReasoningProps = {\n /** What should be displayed inside the reasoning component. */\n children?: React.ReactNode;\n /** Whether the AI is thinking */\n isThinking?: boolean;\n /** The duration of the thinking in milliseconds */\n thinkingMs?: number;\n /** The current action the AI is performing */\n currentAction?: string;\n};\n\n/**\n * The component is used to display the reasoning state of an LLM.\n * It has an accordion like behavior to show the reasoning steps.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst ReasoningComponent = ({\n isThinking = true,\n thinkingMs = 1000,\n currentAction = 'Thinking',\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', ReasoningProps>) => {\n const classes = classNames('ndl-ai-reasoning', className);\n const [isExpanded, setIsExpanded] = useState(false);\n const shouldShowChildren = isExpanded && isThinking === false;\n\n const { value: thinkingDuration, unit } = formatThinkingDuration(thinkingMs);\n\n return (\n <div\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <Typography variant=\"label\" className=\"ndl-ai-reasoning-header\">\n {isThinking === true ? (\n <>\n <Presence isThinking={isThinking} className=\"n-size-token-24\" />\n <span className=\"ndl-ai-reasoning-header-text\">\n {currentAction}...\n </span>\n </>\n ) : (\n <>\n <span>\n Thought for {thinkingDuration} {unit}\n </span>\n <CleanIconButton\n size=\"small\"\n variant=\"neutral\"\n onClick={() => setIsExpanded(!isExpanded)}\n description={isExpanded ? 'Collapse' : 'Expand'}\n className={classNames('ndl-ai-reasoning-expand-button', {\n 'ndl-expanded': isExpanded,\n })}\n >\n <ChevronDownIconOutline />\n </CleanIconButton>\n </>\n )}\n </Typography>\n <div\n className={classNames('ndl-ai-reasoning-content', {\n 'ndl-expanded': shouldShowChildren,\n })}\n inert={!shouldShowChildren}\n >\n <div className=\"ndl-ai-reasoning-content-inner\">\n <div className=\"ndl-ai-reasoning-content-inner-2\">{children}</div>\n </div>\n </div>\n </div>\n );\n};\n\ntype SectionProps = {\n /** The heading of the section */\n heading?: React.ReactNode;\n /** The children of the section */\n children?: React.ReactNode;\n /** The visual leading the section */\n leadingVisual?: React.ReactNode;\n};\n\nconst Section = ({\n heading,\n leadingVisual,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', SectionProps>) => {\n const classes = classNames('ndl-ai-reasoning-section', className);\n const [isExpanded, setIsExpanded] = useState(false);\n\n return (\n <div\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-ai-reasoning-section-header\">\n <div className=\"ndl-ai-reasoning-section-leading\">{leadingVisual}</div>\n <Typography variant=\"subheading-small\">{heading}</Typography>\n <CleanIconButton\n description={isExpanded ? 'Collapse' : 'Expand'}\n size=\"small\"\n variant=\"neutral\"\n className={classNames('ndl-ai-reasoning-expand-button', {\n 'ndl-expanded': isExpanded,\n })}\n onClick={() => setIsExpanded(!isExpanded)}\n >\n <ChevronDownIconOutline />\n </CleanIconButton>\n </div>\n <div\n className={classNames('ndl-ai-reasoning-section-content', {\n 'ndl-expanded': isExpanded,\n })}\n inert={!isExpanded}\n >\n <div className=\"ndl-ai-reasoning-section-content-inner\">\n <div className=\"ndl-ai-reasoning-section-content-inner-2\">\n <div className=\"ndl-ai-reasoning-section-content-line-container\">\n <div className=\"ndl-ai-reasoning-section-content-line\" />\n </div>\n <div className=\"ndl-ai-reasoning-section-content-children\">\n {children}\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nconst Reasoning = Object.assign(ReasoningComponent, {\n Section,\n});\n\nexport { Reasoning };\n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AE,KAAK,IACR,SAAS,EACT,cAAc,eAElB,iCAAK,SAAS,EAAC,iCAAiC,aAC9C,gCAAK,SAAS,EAAC,kCAAkC,YAAE,aAAa,GAAO,EACvE,uBAAC,kBAAU,IAAC,OAAO,EAAC,kBAAkB,YAAE,OAAO,GAAc,EAC7D,uBAAC,uBAAe,IACd,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,EACpD,IAAI,EAAC,OAAO,EACZ,OAAO,EAAC,SAAS,EACjB,SAAS,EAAE,IAAA,oBAAU,EAAC,gCAAgC,EAAE;4BACtD,cAAc,EAAE,eAAe;yBAChC,CAAC,EACF,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,YAElD,uBAAC,8BAAsB,KAAG,GACV,IACd,EACN,gCACE,SAAS,EAAE,IAAA,oBAAU,EAAC,kCAAkC,EAAE;oBACxD,cAAc,EAAE,eAAe;iBAChC,CAAC,EACF,KAAK,EAAE,CAAC,eAAe,YAEvB,gCAAK,SAAS,EAAC,wCAAwC,YACrD,iCAAK,SAAS,EAAC,0CAA0C,aACvD,gCAAK,SAAS,EAAC,iDAAiD,YAC9D,gCAAK,SAAS,EAAC,uCAAuC,GAAG,GACrD,EACN,gCAAK,SAAS,EAAC,2CAA2C,YACvD,QAAQ,GACL,IACF,GACF,GACF,KACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE;IAClD,OAAO;CACR,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 */\n\nimport { CleanIconButton, Typography } from '@neo4j-ndl/react';\nimport { ChevronDownIconOutline } from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport { useState } from 'react';\n\nimport { type CommonProps } from '../../_common/types';\nimport { useSemicontrolledState } from '../../_common/use-semi-controlled-state';\nimport { Presence } from '../presence';\nimport { formatThinkingDuration } from '../thinking/thinking-duration-formatter';\n\ntype ReasoningProps = {\n /** What should be displayed inside the reasoning component. */\n children?: React.ReactNode;\n /** Whether the AI is thinking */\n isThinking?: boolean;\n /** The duration of the thinking in milliseconds */\n thinkingMs?: number;\n /** The current action the AI is performing */\n currentAction?: string;\n};\n\n/**\n * The component is used to display the reasoning state of an LLM.\n * It has an accordion like behavior to show the reasoning steps.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst ReasoningComponent = ({\n isThinking = true,\n thinkingMs = 1000,\n currentAction = 'Thinking',\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', ReasoningProps>) => {\n const classes = classNames('ndl-ai-reasoning', className);\n const [isExpanded, setIsExpanded] = useState(false);\n const shouldShowChildren = isExpanded && isThinking === false;\n\n const { value: thinkingDuration, unit } = formatThinkingDuration(thinkingMs);\n\n return (\n <div\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <Typography variant=\"label\" className=\"ndl-ai-reasoning-header\">\n {isThinking === true ? (\n <>\n <Presence isThinking={isThinking} className=\"n-size-token-24\" />\n <span className=\"ndl-ai-reasoning-header-text\">\n {currentAction}...\n </span>\n </>\n ) : (\n <>\n <span>\n Thought for {thinkingDuration} {unit}\n </span>\n <CleanIconButton\n size=\"small\"\n variant=\"neutral\"\n onClick={() => setIsExpanded(!isExpanded)}\n description={isExpanded ? 'Collapse' : 'Expand'}\n className={classNames('ndl-ai-reasoning-expand-button', {\n 'ndl-expanded': isExpanded,\n })}\n >\n <ChevronDownIconOutline />\n </CleanIconButton>\n </>\n )}\n </Typography>\n <div\n className={classNames('ndl-ai-reasoning-content', {\n 'ndl-expanded': shouldShowChildren,\n })}\n inert={!shouldShowChildren}\n >\n <div className=\"ndl-ai-reasoning-content-inner\">\n <div className=\"ndl-ai-reasoning-content-inner-2\">{children}</div>\n </div>\n </div>\n </div>\n );\n};\n\ntype SectionProps = {\n /** The heading of the section */\n heading?: React.ReactNode;\n /** The children of the section */\n children?: React.ReactNode;\n /** The visual leading the section */\n leadingVisual?: React.ReactNode;\n /** Whether the section is expanded */\n isExpanded?: boolean;\n /** The default value of the section is expanded */\n isDefaultExpanded?: boolean;\n /** Callback function triggered when the section is expanded */\n onExpandChange?: (isExpanded: boolean) => void;\n};\n\nconst Section = ({\n heading,\n leadingVisual,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n isExpanded,\n isDefaultExpanded,\n onExpandChange,\n ...restProps\n}: CommonProps<'div', SectionProps>) => {\n const classes = classNames('ndl-ai-reasoning-section', className);\n const [isExpandedState, setIsExpandedState] = useSemicontrolledState({\n isControlled: isExpanded !== undefined,\n onChange: onExpandChange,\n state: isExpanded ?? isDefaultExpanded ?? false,\n });\n\n return (\n <div\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-ai-reasoning-section-header\">\n <div className=\"ndl-ai-reasoning-section-leading\">{leadingVisual}</div>\n <Typography variant=\"subheading-small\">{heading}</Typography>\n <CleanIconButton\n description={isExpandedState ? 'Collapse' : 'Expand'}\n size=\"small\"\n variant=\"neutral\"\n className={classNames('ndl-ai-reasoning-expand-button', {\n 'ndl-expanded': isExpandedState,\n })}\n onClick={() => setIsExpandedState((prev) => !prev)}\n >\n <ChevronDownIconOutline />\n </CleanIconButton>\n </div>\n <div\n className={classNames('ndl-ai-reasoning-section-content', {\n 'ndl-expanded': isExpandedState,\n })}\n inert={!isExpandedState}\n >\n <div className=\"ndl-ai-reasoning-section-content-inner\">\n <div className=\"ndl-ai-reasoning-section-content-inner-2\">\n <div className=\"ndl-ai-reasoning-section-content-line-container\">\n <div className=\"ndl-ai-reasoning-section-content-line\" />\n </div>\n <div className=\"ndl-ai-reasoning-section-content-children\">\n {children}\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nconst Reasoning = Object.assign(ReasoningComponent, {\n Section,\n});\n\nexport { Reasoning };\n"]}
@@ -23,10 +23,14 @@ 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.ReasoningFullSrc = exports.ReasoningFull = void 0;
26
+ exports.ReasoningControlledSrc = exports.ReasoningFullSrc = exports.ReasoningControlled = exports.ReasoningFull = void 0;
27
27
  var reasoning_full_story_1 = require("./reasoning-full.story");
28
28
  Object.defineProperty(exports, "ReasoningFull", { enumerable: true, get: function () { return __importDefault(reasoning_full_story_1).default; } });
29
+ var reasoning_controlled_story_1 = require("./reasoning-controlled.story");
30
+ Object.defineProperty(exports, "ReasoningControlled", { enumerable: true, get: function () { return __importDefault(reasoning_controlled_story_1).default; } });
29
31
  const export_stories_utils_1 = require("../../../_common/export-stories-utils");
32
+ const reasoning_controlled_story_raw_1 = __importDefault(require("./reasoning-controlled.story?raw"));
30
33
  const reasoning_full_story_raw_1 = __importDefault(require("./reasoning-full.story?raw"));
31
34
  exports.ReasoningFullSrc = (0, export_stories_utils_1.removeLicenseHeader)(reasoning_full_story_raw_1.default);
35
+ exports.ReasoningControlledSrc = (0, export_stories_utils_1.removeLicenseHeader)(reasoning_controlled_story_raw_1.default);
32
36
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,+DAAkE;AAAzD,sIAAA,OAAO,OAAiB;AAEjC,gFAA4E;AAC5E,0FAA6D;AAEhD,QAAA,gBAAgB,GAAG,IAAA,0CAAmB,EAAC,kCAAmB,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 */\n\nexport { default as ReasoningFull } from './reasoning-full.story';\n\nimport { removeLicenseHeader } from '../../../_common/export-stories-utils';\nimport ReasoningFullSrcRaw from './reasoning-full.story?raw';\n\nexport const ReasoningFullSrc = removeLicenseHeader(ReasoningFullSrcRaw);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,+DAAkE;AAAzD,sIAAA,OAAO,OAAiB;AACjC,2EAA8E;AAArE,kJAAA,OAAO,OAAuB;AAEvC,gFAA4E;AAC5E,sGAAyE;AACzE,0FAA6D;AAEhD,QAAA,gBAAgB,GAAG,IAAA,0CAAmB,EAAC,kCAAmB,CAAC,CAAC;AAC5D,QAAA,sBAAsB,GAAG,IAAA,0CAAmB,EACvD,wCAAyB,CAC1B,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 ReasoningFull } from './reasoning-full.story';\nexport { default as ReasoningControlled } from './reasoning-controlled.story';\n\nimport { removeLicenseHeader } from '../../../_common/export-stories-utils';\nimport ReasoningControlledSrcRaw from './reasoning-controlled.story?raw';\nimport ReasoningFullSrcRaw from './reasoning-full.story?raw';\n\nexport const ReasoningFullSrc = removeLicenseHeader(ReasoningFullSrcRaw);\nexport const ReasoningControlledSrc = removeLicenseHeader(\n ReasoningControlledSrcRaw,\n);\n"]}
@@ -0,0 +1,34 @@
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 ai_1 = require("@neo4j-ndl/react/ai");
26
+ const icons_1 = require("@neo4j-ndl/react/icons");
27
+ const react_1 = require("react");
28
+ const Component = () => {
29
+ const [isFirstSectionExpanded, setIsFirstSectionExpanded] = (0, react_1.useState)(false);
30
+ const [isSecondSectionExpanded, setIsSecondSectionExpanded] = (0, react_1.useState)(false);
31
+ return ((0, jsx_runtime_1.jsxs)(ai_1.Reasoning, { isThinking: false, thinkingMs: 1400, children: [(0, jsx_runtime_1.jsx)(ai_1.Reasoning.Section, { leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.PencilSquareIconOutline, {}), heading: "Creating an action plan", isExpanded: isFirstSectionExpanded, onExpandChange: (isExpanded) => setIsFirstSectionExpanded(isExpanded), children: "Step 1 content" }), (0, jsx_runtime_1.jsx)(ai_1.Reasoning.Section, { leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.WrenchIconOutline, {}), heading: "Applying agent tools", isExpanded: isSecondSectionExpanded, onExpandChange: (isExpanded) => setIsSecondSectionExpanded(isExpanded), children: "Step 2 content" })] }));
32
+ };
33
+ exports.default = Component;
34
+ //# sourceMappingURL=reasoning-controlled.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reasoning-controlled.story.js","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/reasoning-controlled.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAAgD;AAChD,kDAGgC;AAChC,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAC5E,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE9E,OAAO,CACL,wBAAC,cAAS,IAAC,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,aAC5C,uBAAC,cAAS,CAAC,OAAO,IAChB,aAAa,EAAE,uBAAC,+BAAuB,KAAG,EAC1C,OAAO,EAAC,yBAAyB,EACjC,UAAU,EAAE,sBAAsB,EAClC,cAAc,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,yBAAyB,CAAC,UAAU,CAAC,+BAGnD,EACpB,uBAAC,cAAS,CAAC,OAAO,IAChB,aAAa,EAAE,uBAAC,yBAAiB,KAAG,EACpC,OAAO,EAAC,sBAAsB,EAC9B,UAAU,EAAE,uBAAuB,EACnC,cAAc,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,0BAA0B,CAAC,UAAU,CAAC,+BAGpD,IACV,CACb,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 { Reasoning } from '@neo4j-ndl/react/ai';\nimport {\n PencilSquareIconOutline,\n WrenchIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [isFirstSectionExpanded, setIsFirstSectionExpanded] = useState(false);\n const [isSecondSectionExpanded, setIsSecondSectionExpanded] = useState(false);\n\n return (\n <Reasoning isThinking={false} thinkingMs={1400}>\n <Reasoning.Section\n leadingVisual={<PencilSquareIconOutline />}\n heading=\"Creating an action plan\"\n isExpanded={isFirstSectionExpanded}\n onExpandChange={(isExpanded) => setIsFirstSectionExpanded(isExpanded)}\n >\n Step 1 content\n </Reasoning.Section>\n <Reasoning.Section\n leadingVisual={<WrenchIconOutline />}\n heading=\"Applying agent tools\"\n isExpanded={isSecondSectionExpanded}\n onExpandChange={(isExpanded) => setIsSecondSectionExpanded(isExpanded)}\n >\n Step 2 content\n </Reasoning.Section>\n </Reasoning>\n );\n};\n\nexport default Component;\n"]}
@@ -28,7 +28,7 @@ const icons_1 = require("@neo4j-ndl/react/icons");
28
28
  const react_2 = require("react");
29
29
  const Component = () => {
30
30
  const [isThinking, setThinking] = (0, react_2.useState)(true);
31
- return ((0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-col n-gap-token-12", children: [(0, jsx_runtime_1.jsx)(react_1.FilledButton, { onClick: () => setThinking(!isThinking), children: isThinking ? 'Stop Thinking' : 'Start Thinking' }), (0, jsx_runtime_1.jsxs)(ai_1.Reasoning, { isThinking: isThinking, thinkingMs: 1400, currentAction: "Creating an action plan", children: [(0, jsx_runtime_1.jsx)(ai_1.Reasoning.Section, { leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.PencilSquareIconOutline, {}), heading: "Creating an action plan", children: "Step 1 content" }), (0, jsx_runtime_1.jsx)(ai_1.Reasoning.Section, { leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.WrenchIconOutline, {}), heading: "Applying agent tools", children: "Step 2 content" })] })] }));
31
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-col n-gap-token-12", children: [(0, jsx_runtime_1.jsx)(react_1.FilledButton, { onClick: () => setThinking(!isThinking), children: isThinking ? 'Stop Thinking' : 'Start Thinking' }), (0, jsx_runtime_1.jsxs)(ai_1.Reasoning, { isThinking: isThinking, thinkingMs: 1400, currentAction: "Creating an action plan", children: [(0, jsx_runtime_1.jsx)(ai_1.Reasoning.Section, { leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.PencilSquareIconOutline, {}), heading: "Creating an action plan", isDefaultExpanded: true, children: "Step 1 content" }), (0, jsx_runtime_1.jsx)(ai_1.Reasoning.Section, { leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.WrenchIconOutline, {}), heading: "Applying agent tools", children: "Step 2 content" })] })] }));
32
32
  };
33
33
  exports.default = Component;
34
34
  //# sourceMappingURL=reasoning-full.story.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reasoning-full.story.js","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/reasoning-full.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAAgD;AAChD,4CAAgD;AAChD,kDAGgC;AAChC,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IAEjD,OAAO,CACL,iCAAK,SAAS,EAAC,kCAAkC,aAC/C,uBAAC,oBAAY,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,YAClD,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB,GACnC,EACf,wBAAC,cAAS,IACR,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,IAAI,EAChB,aAAa,EAAC,yBAAyB,aAEvC,uBAAC,cAAS,CAAC,OAAO,IAChB,aAAa,EAAE,uBAAC,+BAAuB,KAAG,EAC1C,OAAO,EAAC,yBAAyB,+BAGf,EACpB,uBAAC,cAAS,CAAC,OAAO,IAChB,aAAa,EAAE,uBAAC,yBAAiB,KAAG,EACpC,OAAO,EAAC,sBAAsB,+BAGZ,IACV,IACR,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 { FilledButton } from '@neo4j-ndl/react';\nimport { Reasoning } from '@neo4j-ndl/react/ai';\nimport {\n PencilSquareIconOutline,\n WrenchIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [isThinking, setThinking] = useState(true);\n\n return (\n <div className=\"n-flex n-flex-col n-gap-token-12\">\n <FilledButton onClick={() => setThinking(!isThinking)}>\n {isThinking ? 'Stop Thinking' : 'Start Thinking'}\n </FilledButton>\n <Reasoning\n isThinking={isThinking}\n thinkingMs={1400}\n currentAction=\"Creating an action plan\"\n >\n <Reasoning.Section\n leadingVisual={<PencilSquareIconOutline />}\n heading=\"Creating an action plan\"\n >\n Step 1 content\n </Reasoning.Section>\n <Reasoning.Section\n leadingVisual={<WrenchIconOutline />}\n heading=\"Applying agent tools\"\n >\n Step 2 content\n </Reasoning.Section>\n </Reasoning>\n </div>\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"reasoning-full.story.js","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/reasoning-full.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAAgD;AAChD,4CAAgD;AAChD,kDAGgC;AAChC,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IAEjD,OAAO,CACL,iCAAK,SAAS,EAAC,kCAAkC,aAC/C,uBAAC,oBAAY,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,YAClD,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB,GACnC,EACf,wBAAC,cAAS,IACR,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,IAAI,EAChB,aAAa,EAAC,yBAAyB,aAEvC,uBAAC,cAAS,CAAC,OAAO,IAChB,aAAa,EAAE,uBAAC,+BAAuB,KAAG,EAC1C,OAAO,EAAC,yBAAyB,EACjC,iBAAiB,EAAE,IAAI,+BAGL,EACpB,uBAAC,cAAS,CAAC,OAAO,IAChB,aAAa,EAAE,uBAAC,yBAAiB,KAAG,EACpC,OAAO,EAAC,sBAAsB,+BAGZ,IACV,IACR,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 { FilledButton } from '@neo4j-ndl/react';\nimport { Reasoning } from '@neo4j-ndl/react/ai';\nimport {\n PencilSquareIconOutline,\n WrenchIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [isThinking, setThinking] = useState(true);\n\n return (\n <div className=\"n-flex n-flex-col n-gap-token-12\">\n <FilledButton onClick={() => setThinking(!isThinking)}>\n {isThinking ? 'Stop Thinking' : 'Start Thinking'}\n </FilledButton>\n <Reasoning\n isThinking={isThinking}\n thinkingMs={1400}\n currentAction=\"Creating an action plan\"\n >\n <Reasoning.Section\n leadingVisual={<PencilSquareIconOutline />}\n heading=\"Creating an action plan\"\n isDefaultExpanded={true}\n >\n Step 1 content\n </Reasoning.Section>\n <Reasoning.Section\n leadingVisual={<WrenchIconOutline />}\n heading=\"Applying agent tools\"\n >\n Step 2 content\n </Reasoning.Section>\n </Reasoning>\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -21,7 +21,7 @@
21
21
 
22
22
  "use strict";
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.Full = void 0;
24
+ exports.Controlled = exports.Full = void 0;
25
25
  const Reasoning_1 = require("../Reasoning");
26
26
  const _1 = require(".");
27
27
  const componentMeta = {
@@ -47,4 +47,17 @@ exports.Full = {
47
47
  },
48
48
  render: _1.ReasoningFull,
49
49
  };
50
+ exports.Controlled = {
51
+ args: {},
52
+ parameters: {
53
+ docs: {
54
+ source: {
55
+ code: _1.ReasoningControlledSrc,
56
+ language: 'tsx',
57
+ type: 'code',
58
+ },
59
+ },
60
+ },
61
+ render: _1.ReasoningControlled,
62
+ };
50
63
  //# sourceMappingURL=reasoning.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reasoning.stories.js","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/reasoning.stories.tsx"],"names":[],"mappings":";;;AAsBA,4CAAyC;AACzC,wBAAoD;AAEpD,MAAM,aAAa,GAA2B;IAC5C,SAAS,EAAE,qBAAS;IACpB,EAAE,EAAE,yBAAyB;IAC7B,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,yBAAyB;CACjC,CAAC;AAEF,kBAAe,aAAa,CAAC;AAIhB,QAAA,IAAI,GAAU;IACzB,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,mBAAgB;gBACtB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,gBAAa;CACtB,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { Reasoning } from '../Reasoning';\nimport { ReasoningFull, ReasoningFullSrc } from '.';\n\nconst componentMeta: Meta<typeof Reasoning> = {\n component: Reasoning,\n id: 'components-ai-reasoning',\n parameters: {\n controls: { disable: true },\n },\n tags: ['docsPage'],\n title: 'Components/AI/Reasoning',\n};\n\nexport default componentMeta;\n\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Full: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ReasoningFullSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ReasoningFull,\n};\n"]}
1
+ {"version":3,"file":"reasoning.stories.js","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/reasoning.stories.tsx"],"names":[],"mappings":";;;AAsBA,4CAAyC;AACzC,wBAKW;AAEX,MAAM,aAAa,GAA2B;IAC5C,SAAS,EAAE,qBAAS;IACpB,EAAE,EAAE,yBAAyB;IAC7B,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,yBAAyB;CACjC,CAAC;AAEF,kBAAe,aAAa,CAAC;AAIhB,QAAA,IAAI,GAAU;IACzB,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,mBAAgB;gBACtB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,gBAAa;CACtB,CAAC;AAEW,QAAA,UAAU,GAAU;IAC/B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,yBAAsB;gBAC5B,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,sBAAmB;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 */\nimport { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { Reasoning } from '../Reasoning';\nimport {\n ReasoningControlled,\n ReasoningControlledSrc,\n ReasoningFull,\n ReasoningFullSrc,\n} from '.';\n\nconst componentMeta: Meta<typeof Reasoning> = {\n component: Reasoning,\n id: 'components-ai-reasoning',\n parameters: {\n controls: { disable: true },\n },\n tags: ['docsPage'],\n title: 'Components/AI/Reasoning',\n};\n\nexport default componentMeta;\n\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Full: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ReasoningFullSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ReasoningFull,\n};\n\nexport const Controlled: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ReasoningControlledSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ReasoningControlled,\n};\n"]}
@@ -95,8 +95,8 @@ const AccordionComponent = function AccordionComponent(_a) {
95
95
  }
96
96
  };
97
97
  const classes = classNames('ndl-accordion', className);
98
- const { expandedItemIds } = restProps;
99
- const { expandedItemId } = restProps;
98
+ // Destructure and omit keys from DOM spread
99
+ const _b = restProps, { expandedItemIds, expandedItemId } = _b, restAccordionProps = __rest(_b, ["expandedItemIds", "expandedItemId"]);
100
100
  const contextValue = isMultiple
101
101
  ? {
102
102
  expandedItemIds,
@@ -108,7 +108,7 @@ const AccordionComponent = function AccordionComponent(_a) {
108
108
  isMultiple,
109
109
  onChange,
110
110
  };
111
- return (_jsx(Component, Object.assign({ className: classes, style: style, ref: accordionRef, onKeyDown: handleKeyDown, role: "presentation" }, restProps, htmlAttributes, { children: _jsx(AccordionContext.Provider, { value: contextValue, children: children }) })));
111
+ return (_jsx(Component, Object.assign({ className: classes, style: style, ref: accordionRef, onKeyDown: handleKeyDown, role: "presentation" }, restAccordionProps, htmlAttributes, { children: _jsx(AccordionContext.Provider, { value: contextValue, children: children }) })));
112
112
  };
113
113
  const createItemId = (type, id) => `ndl-accordionitem${type}id-${id}`;
114
114
  const BaseAccordionItem = ({ itemId, children, title, className = '', arrowPosition = 'leading', isDisabled = false, onExpandedChange, htmlAttributes, style, as, titleTypographyVariant = 'subheading-medium', hasDivider = true, trailingContent, }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../../src/accordion/Accordion.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC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AC,UAAU,IACT,OAAO,EAAC,aAAa,EACrB,SAAS,EAAC,0BAA0B,EACpC,EAAE,EAAC,KAAK,YAEP,QAAQ,GACE,GACT,GACF,EACL,UAAU,IAAI,KAAC,OAAO,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,UAAU,CAAC,4BAA4B,EAAE,SAAS,CAAC,CAAC;IAEpE,OAAO,KAAC,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,UAAU,CAAC,0BAA0B,EAAE,SAAS,CAAC,CAAC;IAElE,OAAO,CACL,KAAC,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;AAEH,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport 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';\nimport { Typography } from '../typography';\nimport { AccordionContext, useAccordionContext } from './accordion-context';\nimport {\n type AccordionIsMultiple,\n type AccordionIsNotMultiple,\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 const { expandedItemIds } = restProps as AccordionIsMultiple<T>;\n const { expandedItemId } = restProps as AccordionIsNotMultiple<T>;\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 {...restProps}\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}: 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 <button\n id={buttonElementId}\n onClick={handleOnClick}\n className={buttonClasses}\n aria-expanded={isExpanded}\n aria-disabled={isDisabled}\n aria-label={title}\n aria-controls={panelElementId}\n disabled={isDisabled}\n >\n <span className={iconClasses}>\n <Typography\n variant={titleTypographyVariant}\n className={titleClasses}\n htmlAttributes={{\n 'aria-level': 2,\n role: 'heading',\n }}\n >\n {title}\n </Typography>\n\n <ChevronDownIconOutline\n className={classNames('ndl-accordion-item-header-icon', {\n '-n-rotate-180': isExpanded,\n })}\n />\n </span>\n </button>\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,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGjE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;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,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O,GAAG,UAAU,CAAC,0BAA0B,EAAE,SAAS,CAAC,CAAC;IAElE,OAAO,CACL,KAAC,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;AAEH,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport 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';\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}: 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 <button\n id={buttonElementId}\n onClick={handleOnClick}\n className={buttonClasses}\n aria-expanded={isExpanded}\n aria-disabled={isDisabled}\n aria-label={title}\n aria-controls={panelElementId}\n disabled={isDisabled}\n >\n <span className={iconClasses}>\n <Typography\n variant={titleTypographyVariant}\n className={titleClasses}\n htmlAttributes={{\n 'aria-level': 2,\n role: 'heading',\n }}\n >\n {title}\n </Typography>\n\n <ChevronDownIconOutline\n className={classNames('ndl-accordion-item-header-icon', {\n '-n-rotate-180': isExpanded,\n })}\n />\n </span>\n </button>\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"]}
@@ -34,6 +34,7 @@ import { CleanIconButton, Typography } from '@neo4j-ndl/react';
34
34
  import { ChevronDownIconOutline } from '@neo4j-ndl/react/icons';
35
35
  import classNames from 'classnames';
36
36
  import { useState } from 'react';
37
+ import { useSemicontrolledState } from '../../_common/use-semi-controlled-state';
37
38
  import { Presence } from '../presence';
38
39
  import { formatThinkingDuration } from '../thinking/thinking-duration-formatter';
39
40
  /**
@@ -55,14 +56,19 @@ const ReasoningComponent = (_a) => {
55
56
  }), inert: !shouldShowChildren, children: _jsx("div", { className: "ndl-ai-reasoning-content-inner", children: _jsx("div", { className: "ndl-ai-reasoning-content-inner-2", children: children }) }) })] })));
56
57
  };
57
58
  const Section = (_a) => {
58
- var { heading, leadingVisual, children, className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["heading", "leadingVisual", "children", "className", "style", "htmlAttributes", "ref"]);
59
+ var _b;
60
+ var { heading, leadingVisual, children, className, style, htmlAttributes, ref, isExpanded, isDefaultExpanded, onExpandChange } = _a, restProps = __rest(_a, ["heading", "leadingVisual", "children", "className", "style", "htmlAttributes", "ref", "isExpanded", "isDefaultExpanded", "onExpandChange"]);
59
61
  const classes = classNames('ndl-ai-reasoning-section', className);
60
- const [isExpanded, setIsExpanded] = useState(false);
61
- return (_jsxs("div", Object.assign({ ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: [_jsxs("div", { className: "ndl-ai-reasoning-section-header", children: [_jsx("div", { className: "ndl-ai-reasoning-section-leading", children: leadingVisual }), _jsx(Typography, { variant: "subheading-small", children: heading }), _jsx(CleanIconButton, { description: isExpanded ? 'Collapse' : 'Expand', size: "small", variant: "neutral", className: classNames('ndl-ai-reasoning-expand-button', {
62
- 'ndl-expanded': isExpanded,
63
- }), onClick: () => setIsExpanded(!isExpanded), children: _jsx(ChevronDownIconOutline, {}) })] }), _jsx("div", { className: classNames('ndl-ai-reasoning-section-content', {
64
- 'ndl-expanded': isExpanded,
65
- }), inert: !isExpanded, children: _jsx("div", { className: "ndl-ai-reasoning-section-content-inner", children: _jsxs("div", { className: "ndl-ai-reasoning-section-content-inner-2", children: [_jsx("div", { className: "ndl-ai-reasoning-section-content-line-container", children: _jsx("div", { className: "ndl-ai-reasoning-section-content-line" }) }), _jsx("div", { className: "ndl-ai-reasoning-section-content-children", children: children })] }) }) })] })));
62
+ const [isExpandedState, setIsExpandedState] = useSemicontrolledState({
63
+ isControlled: isExpanded !== undefined,
64
+ onChange: onExpandChange,
65
+ state: (_b = isExpanded !== null && isExpanded !== void 0 ? isExpanded : isDefaultExpanded) !== null && _b !== void 0 ? _b : false,
66
+ });
67
+ return (_jsxs("div", Object.assign({ ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: [_jsxs("div", { className: "ndl-ai-reasoning-section-header", children: [_jsx("div", { className: "ndl-ai-reasoning-section-leading", children: leadingVisual }), _jsx(Typography, { variant: "subheading-small", children: heading }), _jsx(CleanIconButton, { description: isExpandedState ? 'Collapse' : 'Expand', size: "small", variant: "neutral", className: classNames('ndl-ai-reasoning-expand-button', {
68
+ 'ndl-expanded': isExpandedState,
69
+ }), onClick: () => setIsExpandedState((prev) => !prev), children: _jsx(ChevronDownIconOutline, {}) })] }), _jsx("div", { className: classNames('ndl-ai-reasoning-section-content', {
70
+ 'ndl-expanded': isExpandedState,
71
+ }), inert: !isExpandedState, children: _jsx("div", { className: "ndl-ai-reasoning-section-content-inner", children: _jsxs("div", { className: "ndl-ai-reasoning-section-content-inner-2", children: [_jsx("div", { className: "ndl-ai-reasoning-section-content-line-container", children: _jsx("div", { className: "ndl-ai-reasoning-section-content-line" }) }), _jsx("div", { className: "ndl-ai-reasoning-section-content-children", children: children })] }) }) })] })));
66
72
  };
67
73
  const Reasoning = Object.assign(ReasoningComponent, {
68
74
  Section,
@@ -1 +1 @@
1
- {"version":3,"file":"Reasoning.js","sourceRoot":"","sources":["../../../../src/ai/reasoning/Reasoning.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,QAAQ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D,cAAc,EAAE,UAAU;yBAC3B,CAAC,EACF,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,UAAU,CAAC,YAEzC,KAAC,sBAAsB,KAAG,GACV,IACd,EACN,cACE,SAAS,EAAE,UAAU,CAAC,kCAAkC,EAAE;oBACxD,cAAc,EAAE,UAAU;iBAC3B,CAAC,EACF,KAAK,EAAE,CAAC,UAAU,YAElB,cAAK,SAAS,EAAC,wCAAwC,YACrD,eAAK,SAAS,EAAC,0CAA0C,aACvD,cAAK,SAAS,EAAC,iDAAiD,YAC9D,cAAK,SAAS,EAAC,uCAAuC,GAAG,GACrD,EACN,cAAK,SAAS,EAAC,2CAA2C,YACvD,QAAQ,GACL,IACF,GACF,GACF,KACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE;IAClD,OAAO;CACR,CAAC,CAAC;AAEH,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { CleanIconButton, Typography } from '@neo4j-ndl/react';\nimport { ChevronDownIconOutline } from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport { useState } from 'react';\n\nimport { type CommonProps } from '../../_common/types';\nimport { Presence } from '../presence';\nimport { formatThinkingDuration } from '../thinking/thinking-duration-formatter';\n\ntype ReasoningProps = {\n /** What should be displayed inside the reasoning component. */\n children?: React.ReactNode;\n /** Whether the AI is thinking */\n isThinking?: boolean;\n /** The duration of the thinking in milliseconds */\n thinkingMs?: number;\n /** The current action the AI is performing */\n currentAction?: string;\n};\n\n/**\n * The component is used to display the reasoning state of an LLM.\n * It has an accordion like behavior to show the reasoning steps.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst ReasoningComponent = ({\n isThinking = true,\n thinkingMs = 1000,\n currentAction = 'Thinking',\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', ReasoningProps>) => {\n const classes = classNames('ndl-ai-reasoning', className);\n const [isExpanded, setIsExpanded] = useState(false);\n const shouldShowChildren = isExpanded && isThinking === false;\n\n const { value: thinkingDuration, unit } = formatThinkingDuration(thinkingMs);\n\n return (\n <div\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <Typography variant=\"label\" className=\"ndl-ai-reasoning-header\">\n {isThinking === true ? (\n <>\n <Presence isThinking={isThinking} className=\"n-size-token-24\" />\n <span className=\"ndl-ai-reasoning-header-text\">\n {currentAction}...\n </span>\n </>\n ) : (\n <>\n <span>\n Thought for {thinkingDuration} {unit}\n </span>\n <CleanIconButton\n size=\"small\"\n variant=\"neutral\"\n onClick={() => setIsExpanded(!isExpanded)}\n description={isExpanded ? 'Collapse' : 'Expand'}\n className={classNames('ndl-ai-reasoning-expand-button', {\n 'ndl-expanded': isExpanded,\n })}\n >\n <ChevronDownIconOutline />\n </CleanIconButton>\n </>\n )}\n </Typography>\n <div\n className={classNames('ndl-ai-reasoning-content', {\n 'ndl-expanded': shouldShowChildren,\n })}\n inert={!shouldShowChildren}\n >\n <div className=\"ndl-ai-reasoning-content-inner\">\n <div className=\"ndl-ai-reasoning-content-inner-2\">{children}</div>\n </div>\n </div>\n </div>\n );\n};\n\ntype SectionProps = {\n /** The heading of the section */\n heading?: React.ReactNode;\n /** The children of the section */\n children?: React.ReactNode;\n /** The visual leading the section */\n leadingVisual?: React.ReactNode;\n};\n\nconst Section = ({\n heading,\n leadingVisual,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', SectionProps>) => {\n const classes = classNames('ndl-ai-reasoning-section', className);\n const [isExpanded, setIsExpanded] = useState(false);\n\n return (\n <div\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-ai-reasoning-section-header\">\n <div className=\"ndl-ai-reasoning-section-leading\">{leadingVisual}</div>\n <Typography variant=\"subheading-small\">{heading}</Typography>\n <CleanIconButton\n description={isExpanded ? 'Collapse' : 'Expand'}\n size=\"small\"\n variant=\"neutral\"\n className={classNames('ndl-ai-reasoning-expand-button', {\n 'ndl-expanded': isExpanded,\n })}\n onClick={() => setIsExpanded(!isExpanded)}\n >\n <ChevronDownIconOutline />\n </CleanIconButton>\n </div>\n <div\n className={classNames('ndl-ai-reasoning-section-content', {\n 'ndl-expanded': isExpanded,\n })}\n inert={!isExpanded}\n >\n <div className=\"ndl-ai-reasoning-section-content-inner\">\n <div className=\"ndl-ai-reasoning-section-content-inner-2\">\n <div className=\"ndl-ai-reasoning-section-content-line-container\">\n <div className=\"ndl-ai-reasoning-section-content-line\" />\n </div>\n <div className=\"ndl-ai-reasoning-section-content-children\">\n {children}\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nconst Reasoning = Object.assign(ReasoningComponent, {\n Section,\n});\n\nexport { Reasoning };\n"]}
1
+ {"version":3,"file":"Reasoning.js","sourceRoot":"","sources":["../../../../src/ai/reasoning/Reasoning.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,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AAC,kBAAkB,YAAE,OAAO,GAAc,EAC7D,KAAC,eAAe,IACd,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,EACpD,IAAI,EAAC,OAAO,EACZ,OAAO,EAAC,SAAS,EACjB,SAAS,EAAE,UAAU,CAAC,gCAAgC,EAAE;4BACtD,cAAc,EAAE,eAAe;yBAChC,CAAC,EACF,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,YAElD,KAAC,sBAAsB,KAAG,GACV,IACd,EACN,cACE,SAAS,EAAE,UAAU,CAAC,kCAAkC,EAAE;oBACxD,cAAc,EAAE,eAAe;iBAChC,CAAC,EACF,KAAK,EAAE,CAAC,eAAe,YAEvB,cAAK,SAAS,EAAC,wCAAwC,YACrD,eAAK,SAAS,EAAC,0CAA0C,aACvD,cAAK,SAAS,EAAC,iDAAiD,YAC9D,cAAK,SAAS,EAAC,uCAAuC,GAAG,GACrD,EACN,cAAK,SAAS,EAAC,2CAA2C,YACvD,QAAQ,GACL,IACF,GACF,GACF,KACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE;IAClD,OAAO;CACR,CAAC,CAAC;AAEH,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { CleanIconButton, Typography } from '@neo4j-ndl/react';\nimport { ChevronDownIconOutline } from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport { useState } from 'react';\n\nimport { type CommonProps } from '../../_common/types';\nimport { useSemicontrolledState } from '../../_common/use-semi-controlled-state';\nimport { Presence } from '../presence';\nimport { formatThinkingDuration } from '../thinking/thinking-duration-formatter';\n\ntype ReasoningProps = {\n /** What should be displayed inside the reasoning component. */\n children?: React.ReactNode;\n /** Whether the AI is thinking */\n isThinking?: boolean;\n /** The duration of the thinking in milliseconds */\n thinkingMs?: number;\n /** The current action the AI is performing */\n currentAction?: string;\n};\n\n/**\n * The component is used to display the reasoning state of an LLM.\n * It has an accordion like behavior to show the reasoning steps.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst ReasoningComponent = ({\n isThinking = true,\n thinkingMs = 1000,\n currentAction = 'Thinking',\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', ReasoningProps>) => {\n const classes = classNames('ndl-ai-reasoning', className);\n const [isExpanded, setIsExpanded] = useState(false);\n const shouldShowChildren = isExpanded && isThinking === false;\n\n const { value: thinkingDuration, unit } = formatThinkingDuration(thinkingMs);\n\n return (\n <div\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <Typography variant=\"label\" className=\"ndl-ai-reasoning-header\">\n {isThinking === true ? (\n <>\n <Presence isThinking={isThinking} className=\"n-size-token-24\" />\n <span className=\"ndl-ai-reasoning-header-text\">\n {currentAction}...\n </span>\n </>\n ) : (\n <>\n <span>\n Thought for {thinkingDuration} {unit}\n </span>\n <CleanIconButton\n size=\"small\"\n variant=\"neutral\"\n onClick={() => setIsExpanded(!isExpanded)}\n description={isExpanded ? 'Collapse' : 'Expand'}\n className={classNames('ndl-ai-reasoning-expand-button', {\n 'ndl-expanded': isExpanded,\n })}\n >\n <ChevronDownIconOutline />\n </CleanIconButton>\n </>\n )}\n </Typography>\n <div\n className={classNames('ndl-ai-reasoning-content', {\n 'ndl-expanded': shouldShowChildren,\n })}\n inert={!shouldShowChildren}\n >\n <div className=\"ndl-ai-reasoning-content-inner\">\n <div className=\"ndl-ai-reasoning-content-inner-2\">{children}</div>\n </div>\n </div>\n </div>\n );\n};\n\ntype SectionProps = {\n /** The heading of the section */\n heading?: React.ReactNode;\n /** The children of the section */\n children?: React.ReactNode;\n /** The visual leading the section */\n leadingVisual?: React.ReactNode;\n /** Whether the section is expanded */\n isExpanded?: boolean;\n /** The default value of the section is expanded */\n isDefaultExpanded?: boolean;\n /** Callback function triggered when the section is expanded */\n onExpandChange?: (isExpanded: boolean) => void;\n};\n\nconst Section = ({\n heading,\n leadingVisual,\n children,\n className,\n style,\n htmlAttributes,\n ref,\n isExpanded,\n isDefaultExpanded,\n onExpandChange,\n ...restProps\n}: CommonProps<'div', SectionProps>) => {\n const classes = classNames('ndl-ai-reasoning-section', className);\n const [isExpandedState, setIsExpandedState] = useSemicontrolledState({\n isControlled: isExpanded !== undefined,\n onChange: onExpandChange,\n state: isExpanded ?? isDefaultExpanded ?? false,\n });\n\n return (\n <div\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-ai-reasoning-section-header\">\n <div className=\"ndl-ai-reasoning-section-leading\">{leadingVisual}</div>\n <Typography variant=\"subheading-small\">{heading}</Typography>\n <CleanIconButton\n description={isExpandedState ? 'Collapse' : 'Expand'}\n size=\"small\"\n variant=\"neutral\"\n className={classNames('ndl-ai-reasoning-expand-button', {\n 'ndl-expanded': isExpandedState,\n })}\n onClick={() => setIsExpandedState((prev) => !prev)}\n >\n <ChevronDownIconOutline />\n </CleanIconButton>\n </div>\n <div\n className={classNames('ndl-ai-reasoning-section-content', {\n 'ndl-expanded': isExpandedState,\n })}\n inert={!isExpandedState}\n >\n <div className=\"ndl-ai-reasoning-section-content-inner\">\n <div className=\"ndl-ai-reasoning-section-content-inner-2\">\n <div className=\"ndl-ai-reasoning-section-content-line-container\">\n <div className=\"ndl-ai-reasoning-section-content-line\" />\n </div>\n <div className=\"ndl-ai-reasoning-section-content-children\">\n {children}\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nconst Reasoning = Object.assign(ReasoningComponent, {\n Section,\n});\n\nexport { Reasoning };\n"]}
@@ -19,7 +19,10 @@
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  */
21
21
  export { default as ReasoningFull } from './reasoning-full.story';
22
+ export { default as ReasoningControlled } from './reasoning-controlled.story';
22
23
  import { removeLicenseHeader } from '../../../_common/export-stories-utils';
24
+ import ReasoningControlledSrcRaw from './reasoning-controlled.story?raw';
23
25
  import ReasoningFullSrcRaw from './reasoning-full.story?raw';
24
26
  export const ReasoningFullSrc = removeLicenseHeader(ReasoningFullSrcRaw);
27
+ export const ReasoningControlledSrc = removeLicenseHeader(ReasoningControlledSrcRaw);
25
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,mBAAmB,MAAM,4BAA4B,CAAC;AAE7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,mBAAmB,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 */\n\nexport { default as ReasoningFull } from './reasoning-full.story';\n\nimport { removeLicenseHeader } from '../../../_common/export-stories-utils';\nimport ReasoningFullSrcRaw from './reasoning-full.story?raw';\n\nexport const ReasoningFullSrc = removeLicenseHeader(ReasoningFullSrcRaw);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAE9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,yBAAyB,MAAM,kCAAkC,CAAC;AACzE,OAAO,mBAAmB,MAAM,4BAA4B,CAAC;AAE7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CACvD,yBAAyB,CAC1B,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 ReasoningFull } from './reasoning-full.story';\nexport { default as ReasoningControlled } from './reasoning-controlled.story';\n\nimport { removeLicenseHeader } from '../../../_common/export-stories-utils';\nimport ReasoningControlledSrcRaw from './reasoning-controlled.story?raw';\nimport ReasoningFullSrcRaw from './reasoning-full.story?raw';\n\nexport const ReasoningFullSrc = removeLicenseHeader(ReasoningFullSrcRaw);\nexport const ReasoningControlledSrc = removeLicenseHeader(\n ReasoningControlledSrcRaw,\n);\n"]}
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ *
4
+ * Copyright (c) "Neo4j"
5
+ * Neo4j Sweden AB [http://neo4j.com]
6
+ *
7
+ * This file is part of Neo4j.
8
+ *
9
+ * Neo4j is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { Reasoning } from '@neo4j-ndl/react/ai';
24
+ import { PencilSquareIconOutline, WrenchIconOutline, } from '@neo4j-ndl/react/icons';
25
+ import { useState } from 'react';
26
+ const Component = () => {
27
+ const [isFirstSectionExpanded, setIsFirstSectionExpanded] = useState(false);
28
+ const [isSecondSectionExpanded, setIsSecondSectionExpanded] = useState(false);
29
+ return (_jsxs(Reasoning, { isThinking: false, thinkingMs: 1400, children: [_jsx(Reasoning.Section, { leadingVisual: _jsx(PencilSquareIconOutline, {}), heading: "Creating an action plan", isExpanded: isFirstSectionExpanded, onExpandChange: (isExpanded) => setIsFirstSectionExpanded(isExpanded), children: "Step 1 content" }), _jsx(Reasoning.Section, { leadingVisual: _jsx(WrenchIconOutline, {}), heading: "Applying agent tools", isExpanded: isSecondSectionExpanded, onExpandChange: (isExpanded) => setIsSecondSectionExpanded(isExpanded), children: "Step 2 content" })] }));
30
+ };
31
+ export default Component;
32
+ //# sourceMappingURL=reasoning-controlled.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reasoning-controlled.story.js","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/reasoning-controlled.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EACL,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5E,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9E,OAAO,CACL,MAAC,SAAS,IAAC,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,aAC5C,KAAC,SAAS,CAAC,OAAO,IAChB,aAAa,EAAE,KAAC,uBAAuB,KAAG,EAC1C,OAAO,EAAC,yBAAyB,EACjC,UAAU,EAAE,sBAAsB,EAClC,cAAc,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,yBAAyB,CAAC,UAAU,CAAC,+BAGnD,EACpB,KAAC,SAAS,CAAC,OAAO,IAChB,aAAa,EAAE,KAAC,iBAAiB,KAAG,EACpC,OAAO,EAAC,sBAAsB,EAC9B,UAAU,EAAE,uBAAuB,EACnC,cAAc,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,0BAA0B,CAAC,UAAU,CAAC,+BAGpD,IACV,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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 { Reasoning } from '@neo4j-ndl/react/ai';\nimport {\n PencilSquareIconOutline,\n WrenchIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [isFirstSectionExpanded, setIsFirstSectionExpanded] = useState(false);\n const [isSecondSectionExpanded, setIsSecondSectionExpanded] = useState(false);\n\n return (\n <Reasoning isThinking={false} thinkingMs={1400}>\n <Reasoning.Section\n leadingVisual={<PencilSquareIconOutline />}\n heading=\"Creating an action plan\"\n isExpanded={isFirstSectionExpanded}\n onExpandChange={(isExpanded) => setIsFirstSectionExpanded(isExpanded)}\n >\n Step 1 content\n </Reasoning.Section>\n <Reasoning.Section\n leadingVisual={<WrenchIconOutline />}\n heading=\"Applying agent tools\"\n isExpanded={isSecondSectionExpanded}\n onExpandChange={(isExpanded) => setIsSecondSectionExpanded(isExpanded)}\n >\n Step 2 content\n </Reasoning.Section>\n </Reasoning>\n );\n};\n\nexport default Component;\n"]}
@@ -26,7 +26,7 @@ import { PencilSquareIconOutline, WrenchIconOutline, } from '@neo4j-ndl/react/ic
26
26
  import { useState } from 'react';
27
27
  const Component = () => {
28
28
  const [isThinking, setThinking] = useState(true);
29
- return (_jsxs("div", { className: "n-flex n-flex-col n-gap-token-12", children: [_jsx(FilledButton, { onClick: () => setThinking(!isThinking), children: isThinking ? 'Stop Thinking' : 'Start Thinking' }), _jsxs(Reasoning, { isThinking: isThinking, thinkingMs: 1400, currentAction: "Creating an action plan", children: [_jsx(Reasoning.Section, { leadingVisual: _jsx(PencilSquareIconOutline, {}), heading: "Creating an action plan", children: "Step 1 content" }), _jsx(Reasoning.Section, { leadingVisual: _jsx(WrenchIconOutline, {}), heading: "Applying agent tools", children: "Step 2 content" })] })] }));
29
+ return (_jsxs("div", { className: "n-flex n-flex-col n-gap-token-12", children: [_jsx(FilledButton, { onClick: () => setThinking(!isThinking), children: isThinking ? 'Stop Thinking' : 'Start Thinking' }), _jsxs(Reasoning, { isThinking: isThinking, thinkingMs: 1400, currentAction: "Creating an action plan", children: [_jsx(Reasoning.Section, { leadingVisual: _jsx(PencilSquareIconOutline, {}), heading: "Creating an action plan", isDefaultExpanded: true, children: "Step 1 content" }), _jsx(Reasoning.Section, { leadingVisual: _jsx(WrenchIconOutline, {}), heading: "Applying agent tools", children: "Step 2 content" })] })] }));
30
30
  };
31
31
  export default Component;
32
32
  //# sourceMappingURL=reasoning-full.story.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reasoning-full.story.js","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/reasoning-full.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EACL,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEjD,OAAO,CACL,eAAK,SAAS,EAAC,kCAAkC,aAC/C,KAAC,YAAY,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,YAClD,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB,GACnC,EACf,MAAC,SAAS,IACR,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,IAAI,EAChB,aAAa,EAAC,yBAAyB,aAEvC,KAAC,SAAS,CAAC,OAAO,IAChB,aAAa,EAAE,KAAC,uBAAuB,KAAG,EAC1C,OAAO,EAAC,yBAAyB,+BAGf,EACpB,KAAC,SAAS,CAAC,OAAO,IAChB,aAAa,EAAE,KAAC,iBAAiB,KAAG,EACpC,OAAO,EAAC,sBAAsB,+BAGZ,IACV,IACR,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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 { FilledButton } from '@neo4j-ndl/react';\nimport { Reasoning } from '@neo4j-ndl/react/ai';\nimport {\n PencilSquareIconOutline,\n WrenchIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [isThinking, setThinking] = useState(true);\n\n return (\n <div className=\"n-flex n-flex-col n-gap-token-12\">\n <FilledButton onClick={() => setThinking(!isThinking)}>\n {isThinking ? 'Stop Thinking' : 'Start Thinking'}\n </FilledButton>\n <Reasoning\n isThinking={isThinking}\n thinkingMs={1400}\n currentAction=\"Creating an action plan\"\n >\n <Reasoning.Section\n leadingVisual={<PencilSquareIconOutline />}\n heading=\"Creating an action plan\"\n >\n Step 1 content\n </Reasoning.Section>\n <Reasoning.Section\n leadingVisual={<WrenchIconOutline />}\n heading=\"Applying agent tools\"\n >\n Step 2 content\n </Reasoning.Section>\n </Reasoning>\n </div>\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"reasoning-full.story.js","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/reasoning-full.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EACL,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEjD,OAAO,CACL,eAAK,SAAS,EAAC,kCAAkC,aAC/C,KAAC,YAAY,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,YAClD,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB,GACnC,EACf,MAAC,SAAS,IACR,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,IAAI,EAChB,aAAa,EAAC,yBAAyB,aAEvC,KAAC,SAAS,CAAC,OAAO,IAChB,aAAa,EAAE,KAAC,uBAAuB,KAAG,EAC1C,OAAO,EAAC,yBAAyB,EACjC,iBAAiB,EAAE,IAAI,+BAGL,EACpB,KAAC,SAAS,CAAC,OAAO,IAChB,aAAa,EAAE,KAAC,iBAAiB,KAAG,EACpC,OAAO,EAAC,sBAAsB,+BAGZ,IACV,IACR,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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 { FilledButton } from '@neo4j-ndl/react';\nimport { Reasoning } from '@neo4j-ndl/react/ai';\nimport {\n PencilSquareIconOutline,\n WrenchIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [isThinking, setThinking] = useState(true);\n\n return (\n <div className=\"n-flex n-flex-col n-gap-token-12\">\n <FilledButton onClick={() => setThinking(!isThinking)}>\n {isThinking ? 'Stop Thinking' : 'Start Thinking'}\n </FilledButton>\n <Reasoning\n isThinking={isThinking}\n thinkingMs={1400}\n currentAction=\"Creating an action plan\"\n >\n <Reasoning.Section\n leadingVisual={<PencilSquareIconOutline />}\n heading=\"Creating an action plan\"\n isDefaultExpanded={true}\n >\n Step 1 content\n </Reasoning.Section>\n <Reasoning.Section\n leadingVisual={<WrenchIconOutline />}\n heading=\"Applying agent tools\"\n >\n Step 2 content\n </Reasoning.Section>\n </Reasoning>\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -20,7 +20,7 @@
20
20
  */
21
21
 
22
22
  import { Reasoning } from '../Reasoning';
23
- import { ReasoningFull, ReasoningFullSrc } from '.';
23
+ import { ReasoningControlled, ReasoningControlledSrc, ReasoningFull, ReasoningFullSrc, } from '.';
24
24
  const componentMeta = {
25
25
  component: Reasoning,
26
26
  id: 'components-ai-reasoning',
@@ -44,4 +44,17 @@ export const Full = {
44
44
  },
45
45
  render: ReasoningFull,
46
46
  };
47
+ export const Controlled = {
48
+ args: {},
49
+ parameters: {
50
+ docs: {
51
+ source: {
52
+ code: ReasoningControlledSrc,
53
+ language: 'tsx',
54
+ type: 'code',
55
+ },
56
+ },
57
+ },
58
+ render: ReasoningControlled,
59
+ };
47
60
  //# sourceMappingURL=reasoning.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reasoning.stories.js","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/reasoning.stories.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,GAAG,CAAC;AAEpD,MAAM,aAAa,GAA2B;IAC5C,SAAS,EAAE,SAAS;IACpB,EAAE,EAAE,yBAAyB;IAC7B,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,yBAAyB;CACjC,CAAC;AAEF,eAAe,aAAa,CAAC;AAI7B,MAAM,CAAC,MAAM,IAAI,GAAU;IACzB,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,gBAAgB;gBACtB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,aAAa;CACtB,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { Reasoning } from '../Reasoning';\nimport { ReasoningFull, ReasoningFullSrc } from '.';\n\nconst componentMeta: Meta<typeof Reasoning> = {\n component: Reasoning,\n id: 'components-ai-reasoning',\n parameters: {\n controls: { disable: true },\n },\n tags: ['docsPage'],\n title: 'Components/AI/Reasoning',\n};\n\nexport default componentMeta;\n\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Full: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ReasoningFullSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ReasoningFull,\n};\n"]}
1
+ {"version":3,"file":"reasoning.stories.js","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/reasoning.stories.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,gBAAgB,GACjB,MAAM,GAAG,CAAC;AAEX,MAAM,aAAa,GAA2B;IAC5C,SAAS,EAAE,SAAS;IACpB,EAAE,EAAE,yBAAyB;IAC7B,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,yBAAyB;CACjC,CAAC;AAEF,eAAe,aAAa,CAAC;AAI7B,MAAM,CAAC,MAAM,IAAI,GAAU;IACzB,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,gBAAgB;gBACtB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,aAAa;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAU;IAC/B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,sBAAsB;gBAC5B,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,mBAAmB;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 */\nimport { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { Reasoning } from '../Reasoning';\nimport {\n ReasoningControlled,\n ReasoningControlledSrc,\n ReasoningFull,\n ReasoningFullSrc,\n} from '.';\n\nconst componentMeta: Meta<typeof Reasoning> = {\n component: Reasoning,\n id: 'components-ai-reasoning',\n parameters: {\n controls: { disable: true },\n },\n tags: ['docsPage'],\n title: 'Components/AI/Reasoning',\n};\n\nexport default componentMeta;\n\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Full: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ReasoningFullSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ReasoningFull,\n};\n\nexport const Controlled: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ReasoningControlledSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ReasoningControlled,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../src/accordion/Accordion.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAM/D,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EAGtB,MAAM,mBAAmB,CAAC;AA6T3B,KAAK,cAAc,CAAC,CAAC,SAAS,eAAe,IAAI,IAAI,CACnD,kBAAkB,CAAC,CAAC,CAAC,EACrB,YAAY,CACb,CAAC;AAkBF,QAAA,MAAM,SAAS,IA7Tb,CAAC,SAAS,eAAe,EACzB,CAAC,SAAS,KAAK,CAAC,WAAW,uGAW1B,sBAAsB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;;SAkS7C,CAAC,SAAS,eAAe,EACzB,CAAC,SAAS,KAAK,CAAC,WAAW,uCAI1B,sBAAsB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;;;;SAvB7C,CAAC,SAAS,eAAe,EACzB,CAAC,SAAS,KAAK,CAAC,WAAW,uCAI1B,sBAAsB,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;;;CA+B/C,CAAC;AAEH,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../src/accordion/Accordion.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAM/D,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EAGtB,MAAM,mBAAmB,CAAC;AAkU3B,KAAK,cAAc,CAAC,CAAC,SAAS,eAAe,IAAI,IAAI,CACnD,kBAAkB,CAAC,CAAC,CAAC,EACrB,YAAY,CACb,CAAC;AAkBF,QAAA,MAAM,SAAS,IAlUb,CAAC,SAAS,eAAe,EACzB,CAAC,SAAS,KAAK,CAAC,WAAW,uGAW1B,sBAAsB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;;SAuS7C,CAAC,SAAS,eAAe,EACzB,CAAC,SAAS,KAAK,CAAC,WAAW,uCAI1B,sBAAsB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;;;;SAvB7C,CAAC,SAAS,eAAe,EACzB,CAAC,SAAS,KAAK,CAAC,WAAW,uCAI1B,sBAAsB,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;;;CA+B/C,CAAC;AAEH,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -36,9 +36,15 @@ type SectionProps = {
36
36
  children?: React.ReactNode;
37
37
  /** The visual leading the section */
38
38
  leadingVisual?: React.ReactNode;
39
+ /** Whether the section is expanded */
40
+ isExpanded?: boolean;
41
+ /** The default value of the section is expanded */
42
+ isDefaultExpanded?: boolean;
43
+ /** Callback function triggered when the section is expanded */
44
+ onExpandChange?: (isExpanded: boolean) => void;
39
45
  };
40
46
  declare const Reasoning: (({ isThinking, thinkingMs, currentAction, children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", ReasoningProps>) => import("react/jsx-runtime").JSX.Element) & {
41
- Section: ({ heading, leadingVisual, children, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", SectionProps>) => import("react/jsx-runtime").JSX.Element;
47
+ Section: ({ heading, leadingVisual, children, className, style, htmlAttributes, ref, isExpanded, isDefaultExpanded, onExpandChange, ...restProps }: CommonProps<"div", SectionProps>) => import("react/jsx-runtime").JSX.Element;
42
48
  };
43
49
  export { Reasoning };
44
50
  //# sourceMappingURL=Reasoning.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Reasoning.d.ts","sourceRoot":"","sources":["../../../../src/ai/reasoning/Reasoning.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAOH,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIvD,KAAK,cAAc,GAAG;IACpB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,iCAAiC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AA0EF,KAAK,YAAY,GAAG;IAClB,iCAAiC;IACjC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,kCAAkC;IAClC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,qCAAqC;IACrC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,CAAC;AA2DF,QAAA,MAAM,SAAS,8GA1HZ,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC;yGA0ElC,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC;CAkDjC,CAAC;AAEH,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"Reasoning.d.ts","sourceRoot":"","sources":["../../../../src/ai/reasoning/Reasoning.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAOH,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKvD,KAAK,cAAc,GAAG;IACpB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,iCAAiC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AA0EF,KAAK,YAAY,GAAG;IAClB,iCAAiC;IACjC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,kCAAkC;IAClC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,qCAAqC;IACrC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,sCAAsC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mDAAmD;IACnD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,+DAA+D;IAC/D,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAChD,CAAC;AAkEF,QAAA,MAAM,SAAS,8GAvIZ,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC;wJAmFlC,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC;CAsDjC,CAAC;AAEH,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -19,5 +19,7 @@
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  */
21
21
  export { default as ReasoningFull } from './reasoning-full.story';
22
+ export { default as ReasoningControlled } from './reasoning-controlled.story';
22
23
  export declare const ReasoningFullSrc: string;
24
+ export declare const ReasoningControlledSrc: string;
23
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKlE,eAAO,MAAM,gBAAgB,QAA2C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAM9E,eAAO,MAAM,gBAAgB,QAA2C,CAAC;AACzE,eAAO,MAAM,sBAAsB,QAElC,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
22
+ declare const Component: () => import("react/jsx-runtime").JSX.Element;
23
+ export default Component;
24
+ //# sourceMappingURL=reasoning-controlled.story.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reasoning-controlled.story.d.ts","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/reasoning-controlled.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AASjD,QAAA,MAAM,SAAS,+CAwBd,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"reasoning-full.story.d.ts","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/reasoning-full.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAUjD,QAAA,MAAM,SAAS,+CA4Bd,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"reasoning-full.story.d.ts","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/reasoning-full.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAUjD,QAAA,MAAM,SAAS,+CA6Bd,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -24,4 +24,5 @@ declare const componentMeta: Meta<typeof Reasoning>;
24
24
  export default componentMeta;
25
25
  type Story = StoryObj<typeof componentMeta>;
26
26
  export declare const Full: Story;
27
+ export declare const Controlled: Story;
27
28
  //# sourceMappingURL=reasoning.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reasoning.stories.d.ts","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/reasoning.stories.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,QAAA,MAAM,aAAa,EAAE,IAAI,CAAC,OAAO,SAAS,CAQzC,CAAC;AAEF,eAAe,aAAa,CAAC;AAE7B,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5C,eAAO,MAAM,IAAI,EAAE,KAYlB,CAAC"}
1
+ {"version":3,"file":"reasoning.stories.d.ts","sourceRoot":"","sources":["../../../../../src/ai/reasoning/stories/reasoning.stories.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQzC,QAAA,MAAM,aAAa,EAAE,IAAI,CAAC,OAAO,SAAS,CAQzC,CAAC;AAEF,eAAe,aAAa,CAAC;AAE7B,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5C,eAAO,MAAM,IAAI,EAAE,KAYlB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAYxB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-ndl/react",
3
- "version": "4.5.3",
3
+ "version": "4.5.5",
4
4
  "sideEffects": false,
5
5
  "description": "React implementation of Neo4j Design System",
6
6
  "keywords": [