@neo4j-ndl/react 4.14.5 → 4.15.0

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 (84) hide show
  1. package/lib/cjs/ai/preview/Preview.js +5 -0
  2. package/lib/cjs/ai/preview/Preview.js.map +1 -1
  3. package/lib/cjs/ai/preview/stories/index.js +9 -1
  4. package/lib/cjs/ai/preview/stories/index.js.map +1 -1
  5. package/lib/cjs/ai/preview/stories/preview-simple-with-content.story.js +34 -0
  6. package/lib/cjs/ai/preview/stories/preview-simple-with-content.story.js.map +1 -0
  7. package/lib/cjs/ai/preview/stories/preview-simple.story.js +33 -0
  8. package/lib/cjs/ai/preview/stories/preview-simple.story.js.map +1 -0
  9. package/lib/cjs/ai/prompt/Prompt.js +4 -14
  10. package/lib/cjs/ai/prompt/Prompt.js.map +1 -1
  11. package/lib/cjs/ai/prompt/stories/index.js +5 -1
  12. package/lib/cjs/ai/prompt/stories/index.js.map +1 -1
  13. package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js +1 -1
  14. package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
  15. package/lib/cjs/ai/prompt/stories/prompt-header.story.js +39 -0
  16. package/lib/cjs/ai/prompt/stories/prompt-header.story.js.map +1 -0
  17. package/lib/cjs/ai/response/Response.js +23 -22
  18. package/lib/cjs/ai/response/Response.js.map +1 -1
  19. package/lib/cjs/ai/response/stories/response-all-components.story.js +2 -0
  20. package/lib/cjs/ai/response/stories/response-all-components.story.js.map +1 -1
  21. package/lib/cjs/data-grid/Components.js +25 -10
  22. package/lib/cjs/data-grid/Components.js.map +1 -1
  23. package/lib/cjs/data-grid/datagrid-types.js.map +1 -1
  24. package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js +1 -0
  25. package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
  26. package/lib/cjs/data-grid/stories/datagrid-using-editable-cells.story.js +145 -52
  27. package/lib/cjs/data-grid/stories/datagrid-using-editable-cells.story.js.map +1 -1
  28. package/lib/esm/ai/preview/Preview.js +5 -0
  29. package/lib/esm/ai/preview/Preview.js.map +1 -1
  30. package/lib/esm/ai/preview/stories/index.js +6 -0
  31. package/lib/esm/ai/preview/stories/index.js.map +1 -1
  32. package/lib/esm/ai/preview/stories/preview-simple-with-content.story.js +32 -0
  33. package/lib/esm/ai/preview/stories/preview-simple-with-content.story.js.map +1 -0
  34. package/lib/esm/ai/preview/stories/preview-simple.story.js +31 -0
  35. package/lib/esm/ai/preview/stories/preview-simple.story.js.map +1 -0
  36. package/lib/esm/ai/prompt/Prompt.js +6 -16
  37. package/lib/esm/ai/prompt/Prompt.js.map +1 -1
  38. package/lib/esm/ai/prompt/stories/index.js +3 -0
  39. package/lib/esm/ai/prompt/stories/index.js.map +1 -1
  40. package/lib/esm/ai/prompt/stories/prompt-advanced.story.js +1 -1
  41. package/lib/esm/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
  42. package/lib/esm/ai/prompt/stories/prompt-header.story.js +37 -0
  43. package/lib/esm/ai/prompt/stories/prompt-header.story.js.map +1 -0
  44. package/lib/esm/ai/response/Response.js +23 -22
  45. package/lib/esm/ai/response/Response.js.map +1 -1
  46. package/lib/esm/ai/response/stories/response-all-components.story.js +2 -0
  47. package/lib/esm/ai/response/stories/response-all-components.story.js.map +1 -1
  48. package/lib/esm/data-grid/Components.js +25 -10
  49. package/lib/esm/data-grid/Components.js.map +1 -1
  50. package/lib/esm/data-grid/datagrid-types.js.map +1 -1
  51. package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js +1 -0
  52. package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
  53. package/lib/esm/data-grid/stories/datagrid-using-editable-cells.story.js +147 -54
  54. package/lib/esm/data-grid/stories/datagrid-using-editable-cells.story.js.map +1 -1
  55. package/lib/types/ai/preview/Preview.d.ts +4 -0
  56. package/lib/types/ai/preview/Preview.d.ts.map +1 -1
  57. package/lib/types/ai/preview/stories/index.d.ts +4 -0
  58. package/lib/types/ai/preview/stories/index.d.ts.map +1 -1
  59. package/lib/types/ai/preview/stories/preview-simple-with-content.story.d.ts +24 -0
  60. package/lib/types/ai/preview/stories/preview-simple-with-content.story.d.ts.map +1 -0
  61. package/lib/types/ai/preview/stories/preview-simple.story.d.ts +24 -0
  62. package/lib/types/ai/preview/stories/preview-simple.story.d.ts.map +1 -0
  63. package/lib/types/ai/prompt/Prompt.d.ts +6 -2
  64. package/lib/types/ai/prompt/Prompt.d.ts.map +1 -1
  65. package/lib/types/ai/prompt/stories/index.d.ts +2 -0
  66. package/lib/types/ai/prompt/stories/index.d.ts.map +1 -1
  67. package/lib/types/ai/prompt/stories/prompt-advanced.story.d.ts.map +1 -1
  68. package/lib/types/ai/prompt/stories/prompt-header.story.d.ts +24 -0
  69. package/lib/types/ai/prompt/stories/prompt-header.story.d.ts.map +1 -0
  70. package/lib/types/ai/response/Response.d.ts.map +1 -1
  71. package/lib/types/ai/response/stories/response-all-components.story.d.ts.map +1 -1
  72. package/lib/types/data-grid/Components.d.ts +16 -1
  73. package/lib/types/data-grid/Components.d.ts.map +1 -1
  74. package/lib/types/data-grid/DataGrid.d.ts +10 -1
  75. package/lib/types/data-grid/DataGrid.d.ts.map +1 -1
  76. package/lib/types/data-grid/datagrid-types.d.ts +11 -1
  77. package/lib/types/data-grid/datagrid-types.d.ts.map +1 -1
  78. package/lib/types/data-grid/stories/datagrid-in-dialog.story.d.ts.map +1 -1
  79. package/lib/types/data-grid/stories/datagrid-pinned-columns.stories.d.ts +10 -1
  80. package/lib/types/data-grid/stories/datagrid-pinned-columns.stories.d.ts.map +1 -1
  81. package/lib/types/data-grid/stories/datagrid-search-and-filters.stories.d.ts +10 -1
  82. package/lib/types/data-grid/stories/datagrid-search-and-filters.stories.d.ts.map +1 -1
  83. package/lib/types/data-grid/stories/datagrid-using-editable-cells.story.d.ts.map +1 -1
  84. package/package.json +2 -2
@@ -36,6 +36,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
36
36
  * You should have received a copy of the GNU General Public License
37
37
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
38
38
  */
39
+ // oxlint-disable sort-keys
39
40
  const react_1 = require("@neo4j-ndl/react");
40
41
  const classnames_1 = __importDefault(require("classnames"));
41
42
  const react_2 = require("react");
@@ -57,32 +58,32 @@ const Response = (0, react_2.memo)((_a) => {
57
58
  const components = (0, react_2.useMemo)(() => ({
58
59
  // oxlint-disable-next-line no-unused-vars
59
60
  ol: (_a) => {
60
- var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
61
+ var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
61
62
  return ((0, jsx_runtime_1.jsx)("ol", Object.assign({ className: className }, props, { children: children })));
62
63
  },
63
64
  // oxlint-disable-next-line no-unused-vars
64
65
  ul: (_a) => {
65
- var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
66
+ var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
66
67
  return ((0, jsx_runtime_1.jsx)("ul", Object.assign({ className: (0, classnames_1.default)(className) }, props, { children: children })));
67
68
  },
68
69
  // oxlint-disable-next-line no-unused-vars
69
70
  li: (_a) => {
70
- var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
71
+ var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
71
72
  return ((0, jsx_runtime_1.jsx)("li", Object.assign({ className: className }, props, { children: children })));
72
73
  },
73
74
  // oxlint-disable-next-line no-unused-vars
74
75
  hr: (_a) => {
75
- var { node, className } = _a, props = __rest(_a, ["node", "className"]);
76
+ var { node, className, ref: _ref } = _a, props = __rest(_a, ["node", "className", "ref"]);
76
77
  return ((0, jsx_runtime_1.jsx)("hr", Object.assign({ className: (0, classnames_1.default)(className) }, props)));
77
78
  },
78
79
  // oxlint-disable-next-line no-unused-vars
79
80
  strong: (_a) => {
80
- var { node, children, className, style } = _a, props = __rest(_a, ["node", "children", "className", "style"]);
81
+ var { node: _node, children, className, style, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "style", "ref"]);
81
82
  return ((0, jsx_runtime_1.jsx)(react_1.Typography, Object.assign({ as: "strong", variant: "body-medium", className: className, style: Object.assign(Object.assign({}, style), { fontWeight: 'bold' }) }, props, { children: children })));
82
83
  },
83
84
  // oxlint-disable-next-line no-unused-vars
84
85
  em: (_a) => {
85
- var { node, children, className, style } = _a, props = __rest(_a, ["node", "children", "className", "style"]);
86
+ var { node, children, className, style, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "style", "ref"]);
86
87
  return ((0, jsx_runtime_1.jsx)(react_1.Typography, Object.assign({ as: "em", variant: "body-medium", className: className, style: Object.assign(Object.assign({}, style), { fontStyle: 'italic' }) }, props, { children: children })));
87
88
  },
88
89
  // oxlint-disable-next-line no-unused-vars
@@ -93,66 +94,66 @@ const Response = (0, react_2.memo)((_a) => {
93
94
  // oxlint-disable-next-line no-unused-vars
94
95
  h1: (_a) => {
95
96
  var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
96
- return ((0, jsx_runtime_1.jsx)(react_1.Typography, { as: "h1", variant: "display", className: className, htmlAttributes: Object.assign({}, props), children: children }));
97
+ return ((0, jsx_runtime_1.jsx)("h1", Object.assign({ className: className }, props, { children: children })));
97
98
  },
98
99
  // oxlint-disable-next-line no-unused-vars
99
100
  h2: (_a) => {
100
101
  var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
101
- return ((0, jsx_runtime_1.jsx)(react_1.Typography, { as: "h2", variant: "title-1", className: className, htmlAttributes: Object.assign({}, props), children: children }));
102
+ return ((0, jsx_runtime_1.jsx)("h2", Object.assign({ className: className }, props, { children: children })));
102
103
  },
103
104
  // oxlint-disable-next-line no-unused-vars
104
105
  h3: (_a) => {
105
106
  var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
106
- return ((0, jsx_runtime_1.jsx)(react_1.Typography, { as: "h3", variant: "title-2", className: className, htmlAttributes: Object.assign({}, props), children: children }));
107
+ return ((0, jsx_runtime_1.jsx)("h3", Object.assign({ className: className }, props, { children: children })));
107
108
  },
108
109
  // oxlint-disable-next-line no-unused-vars
109
110
  h4: (_a) => {
110
111
  var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
111
- return ((0, jsx_runtime_1.jsx)(react_1.Typography, { as: "h4", variant: "title-3", className: className, htmlAttributes: Object.assign({}, props), children: children }));
112
+ return ((0, jsx_runtime_1.jsx)("h4", Object.assign({ className: className }, props, { children: children })));
112
113
  },
113
114
  // oxlint-disable-next-line no-unused-vars
114
115
  h5: (_a) => {
115
116
  var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
116
- return ((0, jsx_runtime_1.jsx)(react_1.Typography, { as: "h5", variant: "title-4", className: className, htmlAttributes: Object.assign({}, props), children: children }));
117
+ return ((0, jsx_runtime_1.jsx)("h5", Object.assign({ className: className }, props, { children: children })));
117
118
  },
118
119
  // oxlint-disable-next-line no-unused-vars
119
120
  h6: (_a) => {
120
121
  var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
121
- return ((0, jsx_runtime_1.jsx)(react_1.Typography, { as: "h6", variant: "label", className: className, htmlAttributes: Object.assign({}, props), children: children }));
122
+ return ((0, jsx_runtime_1.jsx)("h6", Object.assign({ className: className }, props, { children: children })));
122
123
  },
123
124
  // oxlint-disable-next-line no-unused-vars
124
125
  table: (_a) => {
125
- var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
126
+ var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
126
127
  return ((0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-response-table-wrapper", children: (0, jsx_runtime_1.jsx)("table", Object.assign({ className: className }, props, { children: children })) }));
127
128
  },
128
129
  // oxlint-disable-next-line no-unused-vars
129
130
  thead: (_a) => {
130
- var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
131
+ var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
131
132
  return ((0, jsx_runtime_1.jsx)("thead", Object.assign({ className: className }, props, { children: children })));
132
133
  },
133
134
  // oxlint-disable-next-line no-unused-vars
134
135
  tbody: (_a) => {
135
- var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
136
+ var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
136
137
  return ((0, jsx_runtime_1.jsx)("tbody", Object.assign({ className: className }, props, { children: children })));
137
138
  },
138
139
  // oxlint-disable-next-line no-unused-vars
139
140
  tr: (_a) => {
140
- var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
141
+ var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
141
142
  return ((0, jsx_runtime_1.jsx)("tr", Object.assign({ className: className }, props, { children: children })));
142
143
  },
143
144
  // oxlint-disable-next-line no-unused-vars
144
145
  th: (_a) => {
145
- var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
146
+ var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
146
147
  return ((0, jsx_runtime_1.jsx)("th", Object.assign({ className: className }, props, { children: children })));
147
148
  },
148
149
  // oxlint-disable-next-line no-unused-vars
149
150
  td: (_a) => {
150
- var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
151
+ var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
151
152
  return ((0, jsx_runtime_1.jsx)("td", Object.assign({ className: className }, props, { children: children })));
152
153
  },
153
154
  // oxlint-disable-next-line no-unused-vars
154
155
  blockquote: (_a) => {
155
- var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
156
+ var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
156
157
  return ((0, jsx_runtime_1.jsx)("blockquote", Object.assign({ className: (0, classnames_1.default)(className) }, props, { children: children })));
157
158
  },
158
159
  code: (_a) => {
@@ -195,17 +196,17 @@ const Response = (0, react_2.memo)((_a) => {
195
196
  },
196
197
  // oxlint-disable-next-line no-unused-vars
197
198
  pre: (_a) => {
198
- var { node, className, children } = _a, props = __rest(_a, ["node", "className", "children"]);
199
+ var { node, className, children, ref: _ref } = _a, props = __rest(_a, ["node", "className", "children", "ref"]);
199
200
  return ((0, jsx_runtime_1.jsx)("pre", Object.assign({ className: className }, props, { children: children })));
200
201
  },
201
202
  // oxlint-disable-next-line no-unused-vars
202
203
  p: (_a) => {
203
- var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
204
+ var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
204
205
  return ((0, jsx_runtime_1.jsx)(react_1.Typography, Object.assign({ as: "p", variant: "body-medium", className: (0, classnames_1.default)(className) }, props, { children: children })));
205
206
  },
206
207
  // oxlint-disable-next-line no-unused-vars
207
208
  img: (_a) => {
208
- var { node, className, src, alt } = _a, props = __rest(_a, ["node", "className", "src", "alt"]);
209
+ var { node, className, src, alt, ref: _ref } = _a, props = __rest(_a, ["node", "className", "src", "alt", "ref"]);
209
210
  return ((0, jsx_runtime_1.jsx)("img", Object.assign({ className: (0, classnames_1.default)(className), src: src, alt: alt }, props)));
210
211
  },
211
212
  }), []);
@@ -1 +1 @@
1
- {"version":3,"file":"Response.js","sourceRoot":"","sources":["../../../../src/ai/response/Response.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4CAA8D;AAC9D,4DAAoC;AACpC,iCAA8C;AAC9C,2CAAwC;AAGxC,oEAA+E;AAC/E,kDAA8C;AAS9C;;;;;GAKG;AACH,MAAM,QAAQ,GAAG,IAAA,YAAI,EACnB,CAAC,EAQmC,EAAE,EAAE;QARvC,EACC,SAAS,EACT,QAAQ,EACR,WAAW,GAAG,KAAK,EACnB,GAAG,EACH,KAAK,EACL,cAAc,OAEoB,EAD/B,SAAS,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oBAAU,EAAC,SAAS,CAAC,EAChC,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,IACJ,KAAK,EACT,CACH,CAAA;SAAA;KACF,CAAC,EACF,EAAE,CACH,CAAC;IAEJ,OAAO,CACL,8CACE,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,IAAA,oBAAU,EAAC,iBAAiB,EAAE,SAAS,CAAC,IAC/C,SAAS,EACT,cAAc,cAElB,uBAAC,uBAAU,IACT,WAAW,EAAE,WAAW,EACxB,uBAAuB,EAAE,WAAW,EACpC,UAAU,EAAE,UAAU,YAErB,QAAQ,GACE,IACT,CACP,CAAC;AACJ,CAAC,EACD,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,CACpE,CAAC;AAIO,4BAAQ;AAFjB,QAAQ,CAAC,WAAW,GAAG,UAAU,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 { Code, TextLink, Typography } from '@neo4j-ndl/react';\nimport classNames from 'classnames';\nimport { memo, useMemo, useRef } from 'react';\nimport { Streamdown } from 'streamdown';\n\nimport { type CommonProps } from '../../_common/types';\nimport { type LanguageProp, Languages } from '../../code-block/code-languages';\nimport { CodePreview } from '../code-preview';\n\ntype ResponseProps = {\n /** The response from the AI */\n children: string;\n /** Whether the response is animating */\n isAnimating?: React.ComponentProps<typeof Streamdown>['isAnimating'];\n};\n\n/**\n * The component is used to display the response from an LLM.\n * It handles markdown rendering and streaming.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst Response = memo(\n ({\n className,\n children,\n isAnimating = false,\n ref,\n style,\n htmlAttributes,\n ...restProps\n }: CommonProps<'div', ResponseProps>) => {\n // Use a ref to store the current markdown content so we can check for unclosed fences\n // without recreating the components object on every render\n const childrenRef = useRef(children);\n childrenRef.current = children;\n\n const components: React.ComponentProps<typeof Streamdown>['components'] =\n useMemo(\n () => ({\n // oxlint-disable-next-line no-unused-vars\n ol: ({ node, children, className, ...props }) => (\n <ol className={className} {...props}>\n {children}\n </ol>\n ),\n // oxlint-disable-next-line no-unused-vars\n ul: ({ node, children, className, ...props }) => (\n <ul className={classNames(className)} {...props}>\n {children}\n </ul>\n ),\n // oxlint-disable-next-line no-unused-vars\n li: ({ node, children, className, ...props }) => (\n <li className={className} {...props}>\n {children}\n </li>\n ),\n // oxlint-disable-next-line no-unused-vars\n hr: ({ node, className, ...props }) => (\n <hr className={classNames(className)} {...props} />\n ),\n // oxlint-disable-next-line no-unused-vars\n strong: ({ node, children, className, style, ...props }) => (\n <Typography\n as=\"strong\"\n variant=\"body-medium\"\n className={className}\n style={{ ...style, fontWeight: 'bold' }}\n {...props}\n >\n {children}\n </Typography>\n ),\n // oxlint-disable-next-line no-unused-vars\n em: ({ node, children, className, style, ...props }) => (\n <Typography\n as=\"em\"\n variant=\"body-medium\"\n className={className}\n style={{ ...style, fontStyle: 'italic' }}\n {...props}\n >\n {children}\n </Typography>\n ),\n // oxlint-disable-next-line no-unused-vars\n a: ({ node, children, className, href, ...props }) => (\n <TextLink\n type=\"internal-underline\"\n className={className}\n href={href}\n htmlAttributes={props}\n >\n {children}\n </TextLink>\n ),\n // oxlint-disable-next-line no-unused-vars\n h1: ({ node, children, className, ...props }) => (\n <Typography\n as=\"h1\"\n variant=\"display\"\n className={className}\n htmlAttributes={{ ...props }}\n >\n {children}\n </Typography>\n ),\n // oxlint-disable-next-line no-unused-vars\n h2: ({ node, children, className, ...props }) => (\n <Typography\n as=\"h2\"\n variant=\"title-1\"\n className={className}\n htmlAttributes={{ ...props }}\n >\n {children}\n </Typography>\n ),\n // oxlint-disable-next-line no-unused-vars\n h3: ({ node, children, className, ...props }) => (\n <Typography\n as=\"h3\"\n variant=\"title-2\"\n className={className}\n htmlAttributes={{ ...props }}\n >\n {children}\n </Typography>\n ),\n // oxlint-disable-next-line no-unused-vars\n h4: ({ node, children, className, ...props }) => (\n <Typography\n as=\"h4\"\n variant=\"title-3\"\n className={className}\n htmlAttributes={{ ...props }}\n >\n {children}\n </Typography>\n ),\n // oxlint-disable-next-line no-unused-vars\n h5: ({ node, children, className, ...props }) => (\n <Typography\n as=\"h5\"\n variant=\"title-4\"\n className={className}\n htmlAttributes={{ ...props }}\n >\n {children}\n </Typography>\n ),\n // oxlint-disable-next-line no-unused-vars\n h6: ({ node, children, className, ...props }) => (\n <Typography\n as=\"h6\"\n variant=\"label\"\n className={className}\n htmlAttributes={{ ...props }}\n >\n {children}\n </Typography>\n ),\n // oxlint-disable-next-line no-unused-vars\n table: ({ node, children, className, ...props }) => (\n <div className=\"ndl-ai-response-table-wrapper\">\n <table className={className} {...props}>\n {children}\n </table>\n </div>\n ),\n // oxlint-disable-next-line no-unused-vars\n thead: ({ node, children, className, ...props }) => (\n <thead className={className} {...props}>\n {children}\n </thead>\n ),\n // oxlint-disable-next-line no-unused-vars\n tbody: ({ node, children, className, ...props }) => (\n <tbody className={className} {...props}>\n {children}\n </tbody>\n ),\n // oxlint-disable-next-line no-unused-vars\n tr: ({ node, children, className, ...props }) => (\n <tr className={className} {...props}>\n {children}\n </tr>\n ),\n // oxlint-disable-next-line no-unused-vars\n th: ({ node, children, className, ...props }) => (\n <th className={className} {...props}>\n {children}\n </th>\n ),\n // oxlint-disable-next-line no-unused-vars\n td: ({ node, children, className, ...props }) => (\n <td className={className} {...props}>\n {children}\n </td>\n ),\n // oxlint-disable-next-line no-unused-vars\n blockquote: ({ node, children, className, ...props }) => (\n <blockquote className={classNames(className)} {...props}>\n {children}\n </blockquote>\n ),\n code: ({ node, className, children: codeChildren, ...props }) => {\n const isInline =\n node?.position?.start.line === node?.position?.end.line;\n\n const nodeClassNamesRaw = node?.properties?.className;\n const nodeClassNamesArray: string[] = [];\n\n if (typeof nodeClassNamesRaw === 'string') {\n nodeClassNamesArray.push.apply(\n nodeClassNamesArray,\n nodeClassNamesRaw.split(' '),\n );\n } else if (Array.isArray(nodeClassNamesRaw)) {\n nodeClassNamesArray.push.apply(\n nodeClassNamesArray,\n nodeClassNamesRaw as string[],\n );\n }\n\n let language: LanguageProp | 'text' = 'text';\n const rawLanguage = nodeClassNamesArray.find((string: string) =>\n string.startsWith('language-'),\n );\n if (rawLanguage !== undefined) {\n language =\n (rawLanguage.replace('language-', '') as LanguageProp) ??\n 'text';\n }\n language = (Languages as readonly string[]).includes(language)\n ? (language as LanguageProp)\n : 'text';\n if (isInline) {\n return (\n <Code\n isRunnable={false}\n className={className}\n htmlAttributes={props}\n >\n {codeChildren}\n </Code>\n );\n }\n if (typeof codeChildren === 'string') {\n // Check if code fences are balanced in the markdown\n // If there are an odd number of fences, it means there's an unclosed code block\n const fenceMatches = childrenRef.current.match(/```/g);\n const fenceCount = fenceMatches ? fenceMatches.length : 0;\n const hasUnclosedFence = fenceCount % 2 !== 0;\n\n // Show loading state when there's an unclosed fence (code block is streaming)\n const isCodeBlockLoading = hasUnclosedFence;\n return (\n <CodePreview\n key={props.key}\n code={codeChildren}\n isLoading={isCodeBlockLoading}\n language={language}\n className={className}\n htmlAttributes={{\n ...props,\n }}\n />\n );\n } else {\n return <code className={className}>{codeChildren}</code>;\n }\n },\n // oxlint-disable-next-line no-unused-vars\n pre: ({ node, className, children, ...props }) => {\n return (\n <pre className={className} {...props}>\n {children}\n </pre>\n );\n },\n // oxlint-disable-next-line no-unused-vars\n p: ({ node, children, className, ...props }) => (\n <Typography\n as=\"p\"\n variant=\"body-medium\"\n className={classNames(className)}\n {...props}\n >\n {children}\n </Typography>\n ),\n // oxlint-disable-next-line no-unused-vars\n img: ({ node, className, src, alt, ...props }) => (\n <img\n className={classNames(className)}\n src={src}\n alt={alt}\n {...props}\n />\n ),\n }),\n [],\n );\n\n return (\n <div\n ref={ref}\n style={style}\n className={classNames('ndl-ai-response', className)}\n {...restProps}\n {...htmlAttributes}\n >\n <Streamdown\n isAnimating={isAnimating}\n parseIncompleteMarkdown={isAnimating}\n components={components}\n >\n {children}\n </Streamdown>\n </div>\n );\n },\n (prevProps, nextProps) => prevProps.children === nextProps.children,\n);\n\nResponse.displayName = 'Response';\n\nexport { Response };\n"]}
1
+ {"version":3,"file":"Response.js","sourceRoot":"","sources":["../../../../src/ai/response/Response.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,2BAA2B;AAC3B,4CAA8D;AAC9D,4DAAoC;AACpC,iCAA8C;AAC9C,2CAAwC;AAGxC,oEAA+E;AAC/E,kDAA8C;AAS9C;;;;;GAKG;AACH,MAAM,QAAQ,GAAG,IAAA,YAAI,EACnB,CAAC,EAQmC,EAAE,EAAE;QARvC,EACC,SAAS,EACT,QAAQ,EACR,WAAW,GAAG,KAAK,EACnB,GAAG,EACH,KAAK,EACL,cAAc,OAEoB,EAD/B,SAAS,cAPb,0EAQA,CADa;IAEZ,sFAAsF;IACtF,2DAA2D;IAC3D,MAAM,WAAW,GAAG,IAAA,cAAM,EAAC,QAAQ,CAAC,CAAC;IACrC,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IAE/B,MAAM,UAAU,GACd,IAAA,eAAO,EACL,GAAG,EAAE,CAAC,CAAC;QACL,0CAA0C;QAC1C,EAAE,EAAE,CAAC,EAAkD,EAAE,EAAE;gBAAtD,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,OAAY,EAAP,KAAK,cAAhD,wCAAkD,CAAF;Y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AAC,EACD,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,CACpE,CAAC;AAIO,4BAAQ;AAFjB,QAAQ,CAAC,WAAW,GAAG,UAAU,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\n// oxlint-disable sort-keys\nimport { Code, TextLink, Typography } from '@neo4j-ndl/react';\nimport classNames from 'classnames';\nimport { memo, useMemo, useRef } from 'react';\nimport { Streamdown } from 'streamdown';\n\nimport { type CommonProps } from '../../_common/types';\nimport { type LanguageProp, Languages } from '../../code-block/code-languages';\nimport { CodePreview } from '../code-preview';\n\ntype ResponseProps = {\n /** The response from the AI */\n children: string;\n /** Whether the response is animating */\n isAnimating?: React.ComponentProps<typeof Streamdown>['isAnimating'];\n};\n\n/**\n * The component is used to display the response from an LLM.\n * It handles markdown rendering and streaming.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst Response = memo(\n ({\n className,\n children,\n isAnimating = false,\n ref,\n style,\n htmlAttributes,\n ...restProps\n }: CommonProps<'div', ResponseProps>) => {\n // Use a ref to store the current markdown content so we can check for unclosed fences\n // without recreating the components object on every render\n const childrenRef = useRef(children);\n childrenRef.current = children;\n\n const components: React.ComponentProps<typeof Streamdown>['components'] =\n useMemo(\n () => ({\n // oxlint-disable-next-line no-unused-vars\n ol: ({ node, children, className, ref: _ref, ...props }) => (\n <ol className={className} {...props}>\n {children}\n </ol>\n ),\n // oxlint-disable-next-line no-unused-vars\n ul: ({ node, children, className, ref: _ref, ...props }) => (\n <ul className={classNames(className)} {...props}>\n {children}\n </ul>\n ),\n // oxlint-disable-next-line no-unused-vars\n li: ({ node, children, className, ref: _ref, ...props }) => (\n <li className={className} {...props}>\n {children}\n </li>\n ),\n // oxlint-disable-next-line no-unused-vars\n hr: ({ node, className, ref: _ref, ...props }) => (\n <hr className={classNames(className)} {...props} />\n ),\n // oxlint-disable-next-line no-unused-vars\n strong: ({\n node: _node,\n children,\n className,\n style,\n ref: _ref,\n ...props\n }) => (\n <Typography\n as=\"strong\"\n variant=\"body-medium\"\n className={className}\n style={{ ...style, fontWeight: 'bold' }}\n {...props}\n >\n {children}\n </Typography>\n ),\n // oxlint-disable-next-line no-unused-vars\n em: ({ node, children, className, style, ref: _ref, ...props }) => (\n <Typography\n as=\"em\"\n variant=\"body-medium\"\n className={className}\n style={{ ...style, fontStyle: 'italic' }}\n {...props}\n >\n {children}\n </Typography>\n ),\n // oxlint-disable-next-line no-unused-vars\n a: ({ node, children, className, href, ...props }) => (\n <TextLink\n type=\"internal-underline\"\n className={className}\n href={href}\n htmlAttributes={props}\n >\n {children}\n </TextLink>\n ),\n // oxlint-disable-next-line no-unused-vars\n h1: ({ node, children, className, ...props }) => (\n <h1 className={className} {...props}>\n {children}\n </h1>\n ),\n // oxlint-disable-next-line no-unused-vars\n h2: ({ node, children, className, ...props }) => (\n <h2 className={className} {...props}>\n {children}\n </h2>\n ),\n // oxlint-disable-next-line no-unused-vars\n h3: ({ node, children, className, ...props }) => (\n <h3 className={className} {...props}>\n {children}\n </h3>\n ),\n // oxlint-disable-next-line no-unused-vars\n h4: ({ node, children, className, ...props }) => (\n <h4 className={className} {...props}>\n {children}\n </h4>\n ),\n // oxlint-disable-next-line no-unused-vars\n h5: ({ node, children, className, ...props }) => (\n <h5 className={className} {...props}>\n {children}\n </h5>\n ),\n // oxlint-disable-next-line no-unused-vars\n h6: ({ node, children, className, ...props }) => (\n <h6 className={className} {...props}>\n {children}\n </h6>\n ),\n // oxlint-disable-next-line no-unused-vars\n table: ({ node, children, className, ref: _ref, ...props }) => (\n <div className=\"ndl-ai-response-table-wrapper\">\n <table className={className} {...props}>\n {children}\n </table>\n </div>\n ),\n // oxlint-disable-next-line no-unused-vars\n thead: ({ node, children, className, ref: _ref, ...props }) => (\n <thead className={className} {...props}>\n {children}\n </thead>\n ),\n // oxlint-disable-next-line no-unused-vars\n tbody: ({ node, children, className, ref: _ref, ...props }) => (\n <tbody className={className} {...props}>\n {children}\n </tbody>\n ),\n // oxlint-disable-next-line no-unused-vars\n tr: ({ node, children, className, ref: _ref, ...props }) => (\n <tr className={className} {...props}>\n {children}\n </tr>\n ),\n // oxlint-disable-next-line no-unused-vars\n th: ({ node, children, className, ref: _ref, ...props }) => (\n <th className={className} {...props}>\n {children}\n </th>\n ),\n // oxlint-disable-next-line no-unused-vars\n td: ({ node, children, className, ref: _ref, ...props }) => (\n <td className={className} {...props}>\n {children}\n </td>\n ),\n // oxlint-disable-next-line no-unused-vars\n blockquote: ({ node, children, className, ref: _ref, ...props }) => (\n <blockquote className={classNames(className)} {...props}>\n {children}\n </blockquote>\n ),\n code: ({ node, className, children: codeChildren, ...props }) => {\n const isInline =\n node?.position?.start.line === node?.position?.end.line;\n\n const nodeClassNamesRaw = node?.properties?.className;\n const nodeClassNamesArray: string[] = [];\n\n if (typeof nodeClassNamesRaw === 'string') {\n nodeClassNamesArray.push.apply(\n nodeClassNamesArray,\n nodeClassNamesRaw.split(' '),\n );\n } else if (Array.isArray(nodeClassNamesRaw)) {\n nodeClassNamesArray.push.apply(\n nodeClassNamesArray,\n nodeClassNamesRaw as string[],\n );\n }\n\n let language: LanguageProp | 'text' = 'text';\n const rawLanguage = nodeClassNamesArray.find((string: string) =>\n string.startsWith('language-'),\n );\n if (rawLanguage !== undefined) {\n language =\n (rawLanguage.replace('language-', '') as LanguageProp) ??\n 'text';\n }\n language = (Languages as readonly string[]).includes(language)\n ? (language as LanguageProp)\n : 'text';\n if (isInline) {\n return (\n <Code\n isRunnable={false}\n className={className}\n htmlAttributes={props}\n >\n {codeChildren}\n </Code>\n );\n }\n if (typeof codeChildren === 'string') {\n // Check if code fences are balanced in the markdown\n // If there are an odd number of fences, it means there's an unclosed code block\n const fenceMatches = childrenRef.current.match(/```/g);\n const fenceCount = fenceMatches ? fenceMatches.length : 0;\n const hasUnclosedFence = fenceCount % 2 !== 0;\n\n // Show loading state when there's an unclosed fence (code block is streaming)\n const isCodeBlockLoading = hasUnclosedFence;\n return (\n <CodePreview\n key={props.key}\n code={codeChildren}\n isLoading={isCodeBlockLoading}\n language={language}\n className={className}\n htmlAttributes={{\n ...props,\n }}\n />\n );\n } else {\n return <code className={className}>{codeChildren}</code>;\n }\n },\n // oxlint-disable-next-line no-unused-vars\n pre: ({ node, className, children, ref: _ref, ...props }) => {\n return (\n <pre className={className} {...props}>\n {children}\n </pre>\n );\n },\n // oxlint-disable-next-line no-unused-vars\n p: ({ node, children, className, ref: _ref, ...props }) => (\n <Typography\n as=\"p\"\n variant=\"body-medium\"\n className={classNames(className)}\n {...props}\n >\n {children}\n </Typography>\n ),\n // oxlint-disable-next-line no-unused-vars\n img: ({ node, className, src, alt, ref: _ref, ...props }) => (\n <img\n className={classNames(className)}\n src={src}\n alt={alt}\n {...props}\n />\n ),\n }),\n [],\n );\n\n return (\n <div\n ref={ref}\n style={style}\n className={classNames('ndl-ai-response', className)}\n {...restProps}\n {...htmlAttributes}\n >\n <Streamdown\n isAnimating={isAnimating}\n parseIncompleteMarkdown={isAnimating}\n components={components}\n >\n {children}\n </Streamdown>\n </div>\n );\n },\n (prevProps, nextProps) => prevProps.children === nextProps.children,\n);\n\nResponse.displayName = 'Response';\n\nexport { Response };\n"]}
@@ -55,6 +55,7 @@ Combine them: **bold and *italic* together**.
55
55
  - Nested item 1
56
56
  - Nested item 2
57
57
  - Deeply nested item
58
+ - <h1>Nested nested heading</h1>
58
59
 
59
60
  ### Ordered Lists
60
61
 
@@ -63,6 +64,7 @@ Combine them: **bold and *italic* together**.
63
64
  3. Third item
64
65
  1. Nested numbered item
65
66
  2. Another nested item
67
+ 3. <h2>Nested nested heading</h2>
66
68
 
67
69
  ## Code
68
70
 
@@ -1 +1 @@
1
- {"version":3,"file":"response-all-components.story.js","sourceRoot":"","sources":["../../../../../src/ai/response/stories/response-all-components.story.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4CAA+C;AAE/C,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqM7B,CAAC;AAEK,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,OAAO,CACL,gCAAK,SAAS,EAAC,WAAW,YACxB,uBAAC,aAAQ,cAAE,qBAAqB,GAAY,GACxC,CACP,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,SAAS,aAMpB;AAEF,kBAAe,iBAAS,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 { Response } from '@neo4j-ndl/react/ai';\n\nconst comprehensiveMarkdown = `\n# All Markdown Components Demo\n\nThis story demonstrates all the markdown components that the Response component can render.\n\n## Headings\n\n# Heading 1\n## Heading 2\n### Heading 3\n#### Heading 4\n##### Heading 5\n###### Heading 6\n\n## Text Formatting\n\nThis is **bold text** and this is *italic text*.\n\nYou can also use __bold__ and _italic_ with underscores.\n\nCombine them: **bold and *italic* together**.\n\n## Lists\n\n### Unordered Lists\n\n- Item 1\n- Item 2\n- Item 3\n - Nested item 1\n - Nested item 2\n - Deeply nested item\n\n### Ordered Lists\n\n1. First item\n2. Second item\n3. Third item\n 1. Nested numbered item\n 2. Another nested item\n\n## Code\n\n### Inline Code\n\nUse \\`const x = 5\\` for inline code.\n\n### Code Blocks\n\n#### JavaScript\n\n\\`\\`\\`javascript\nconst greeting = \"Hello World\";\nconsole.log(greeting);\n\nfunction sayHello(name) {\n return \\`Hello, \\${name}!\\`;\n}\n\\`\\`\\`\n\n#### Python\n\n\\`\\`\\`python\ndef greet(name):\n return f\"Hello, {name}!\"\n\nprint(greet(\"World\"))\n\\`\\`\\`\n\n#### Cypher\n\n\\`\\`\\`cypher\nMATCH (n:Person)-[:KNOWS]->(m:Person)\nWHERE n.name = \"Alice\"\nRETURN m.name\n\\`\\`\\`\n\n#### TypeScript\n\n\\`\\`\\`typescript\ninterface User {\n name: string;\n age: number;\n}\n\nconst user: User = {\n name: \"John\",\n age: 30\n};\n\\`\\`\\`\n\n#### Without Language Specification\n\n\\`\\`\\`\nPlain code block\nwithout syntax highlighting\n\\`\\`\\`\n\n## Links\n\nVisit [Neo4j](https://neo4j.com) for more information.\n\nMultiple links: [Documentation](https://neo4j.com/docs) and [Community](https://community.neo4j.com)\n\n## Blockquotes\n\n> This is a blockquote.\n> It can span multiple lines.\n\n> ### Blockquote with heading\n> \n> You can also include other markdown inside blockquotes.\n> \n> - Like lists\n> - And other elements\n\n### Nested Blockquotes\n\n> Outer quote\n>> Nested quote\n>>> Deeply nested quote\n\n## Horizontal Rules\n\nContent above the rule\n\n---\n\nContent below the rule\n\n## Images\n\n![A smiling man](https://media.istockphoto.com/id/1334716681/photo/a-smiling-man.jpg?s=612x612&w=0&k=20&c=U6rkSDpQMzkcJEqx2hAa63fNLIhqnZb31Xuc_QSi648=)\n\n## Paragraphs\n\nThis is a paragraph with multiple sentences. It demonstrates how regular text is rendered. You can write long-form content that spans multiple lines.\n\nAnother paragraph here. Paragraphs are separated by blank lines in markdown.\n\n## Mixed Content Example\n\nHere's a practical example combining multiple elements:\n\n### Database Query Tutorial\n\nTo query your Neo4j database, follow these steps:\n\n1. **Connect to your database**\n \n Use the following code:\n \n \\`\\`\\`javascript\n const driver = neo4j.driver(\n 'bolt://localhost:7687',\n neo4j.auth.basic('neo4j', 'password')\n );\n \\`\\`\\`\n\n2. **Write your Cypher query**\n \n \\`\\`\\`cypher\n MATCH (n:Movie)\n WHERE n.released > 2000\n RETURN n.title, n.released\n ORDER BY n.released DESC\n LIMIT 10\n \\`\\`\\`\n\n3. **Execute and process results**\n \n > **Note**: Always close your session after use!\n\nFor more information, visit the [Neo4j Documentation](https://neo4j.com/docs).\n\n---\n\n## Special Characters and Escaping\n\nYou can escape special characters: \\\\* \\\\_ \\\\[ \\\\]\n\n## Preformatted Text\n\nUse code blocks for preformatted text with preserved spacing:\n\n\\`\\`\\`\n This text\n has preserved\n indentation\n\\`\\`\\`\n\n| Item | In Stock | Price |\n| :---------------- | :------: | ----: |\n| Python Hat | True | 222222223.99 |\n| SQL Hat | True | 23.99 |\n| Codecademy Tee | False | 19.99 |\n| Codecademy Hoodie | False | 42.99 |\n`;\n\nexport const Component = () => {\n return (\n <div className=\"max-w-4xl\">\n <Response>{comprehensiveMarkdown}</Response>\n </div>\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"response-all-components.story.js","sourceRoot":"","sources":["../../../../../src/ai/response/stories/response-all-components.story.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4CAA+C;AAE/C,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuM7B,CAAC;AAEK,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,OAAO,CACL,gCAAK,SAAS,EAAC,WAAW,YACxB,uBAAC,aAAQ,cAAE,qBAAqB,GAAY,GACxC,CACP,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,SAAS,aAMpB;AAEF,kBAAe,iBAAS,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 { Response } from '@neo4j-ndl/react/ai';\n\nconst comprehensiveMarkdown = `\n# All Markdown Components Demo\n\nThis story demonstrates all the markdown components that the Response component can render.\n\n## Headings\n\n# Heading 1\n## Heading 2\n### Heading 3\n#### Heading 4\n##### Heading 5\n###### Heading 6\n\n## Text Formatting\n\nThis is **bold text** and this is *italic text*.\n\nYou can also use __bold__ and _italic_ with underscores.\n\nCombine them: **bold and *italic* together**.\n\n## Lists\n\n### Unordered Lists\n\n- Item 1\n- Item 2\n- Item 3\n - Nested item 1\n - Nested item 2\n - Deeply nested item\n - <h1>Nested nested heading</h1>\n\n### Ordered Lists\n\n1. First item\n2. Second item\n3. Third item\n 1. Nested numbered item\n 2. Another nested item\n 3. <h2>Nested nested heading</h2>\n\n## Code\n\n### Inline Code\n\nUse \\`const x = 5\\` for inline code.\n\n### Code Blocks\n\n#### JavaScript\n\n\\`\\`\\`javascript\nconst greeting = \"Hello World\";\nconsole.log(greeting);\n\nfunction sayHello(name) {\n return \\`Hello, \\${name}!\\`;\n}\n\\`\\`\\`\n\n#### Python\n\n\\`\\`\\`python\ndef greet(name):\n return f\"Hello, {name}!\"\n\nprint(greet(\"World\"))\n\\`\\`\\`\n\n#### Cypher\n\n\\`\\`\\`cypher\nMATCH (n:Person)-[:KNOWS]->(m:Person)\nWHERE n.name = \"Alice\"\nRETURN m.name\n\\`\\`\\`\n\n#### TypeScript\n\n\\`\\`\\`typescript\ninterface User {\n name: string;\n age: number;\n}\n\nconst user: User = {\n name: \"John\",\n age: 30\n};\n\\`\\`\\`\n\n#### Without Language Specification\n\n\\`\\`\\`\nPlain code block\nwithout syntax highlighting\n\\`\\`\\`\n\n## Links\n\nVisit [Neo4j](https://neo4j.com) for more information.\n\nMultiple links: [Documentation](https://neo4j.com/docs) and [Community](https://community.neo4j.com)\n\n## Blockquotes\n\n> This is a blockquote.\n> It can span multiple lines.\n\n> ### Blockquote with heading\n> \n> You can also include other markdown inside blockquotes.\n> \n> - Like lists\n> - And other elements\n\n### Nested Blockquotes\n\n> Outer quote\n>> Nested quote\n>>> Deeply nested quote\n\n## Horizontal Rules\n\nContent above the rule\n\n---\n\nContent below the rule\n\n## Images\n\n![A smiling man](https://media.istockphoto.com/id/1334716681/photo/a-smiling-man.jpg?s=612x612&w=0&k=20&c=U6rkSDpQMzkcJEqx2hAa63fNLIhqnZb31Xuc_QSi648=)\n\n## Paragraphs\n\nThis is a paragraph with multiple sentences. It demonstrates how regular text is rendered. You can write long-form content that spans multiple lines.\n\nAnother paragraph here. Paragraphs are separated by blank lines in markdown.\n\n## Mixed Content Example\n\nHere's a practical example combining multiple elements:\n\n### Database Query Tutorial\n\nTo query your Neo4j database, follow these steps:\n\n1. **Connect to your database**\n \n Use the following code:\n \n \\`\\`\\`javascript\n const driver = neo4j.driver(\n 'bolt://localhost:7687',\n neo4j.auth.basic('neo4j', 'password')\n );\n \\`\\`\\`\n\n2. **Write your Cypher query**\n \n \\`\\`\\`cypher\n MATCH (n:Movie)\n WHERE n.released > 2000\n RETURN n.title, n.released\n ORDER BY n.released DESC\n LIMIT 10\n \\`\\`\\`\n\n3. **Execute and process results**\n \n > **Note**: Always close your session after use!\n\nFor more information, visit the [Neo4j Documentation](https://neo4j.com/docs).\n\n---\n\n## Special Characters and Escaping\n\nYou can escape special characters: \\\\* \\\\_ \\\\[ \\\\]\n\n## Preformatted Text\n\nUse code blocks for preformatted text with preserved spacing:\n\n\\`\\`\\`\n This text\n has preserved\n indentation\n\\`\\`\\`\n\n| Item | In Stock | Price |\n| :---------------- | :------: | ----: |\n| Python Hat | True | 222222223.99 |\n| SQL Hat | True | 23.99 |\n| Codecademy Tee | False | 19.99 |\n| Codecademy Hoodie | False | 42.99 |\n`;\n\nexport const Component = () => {\n return (\n <div className=\"max-w-4xl\">\n <Response>{comprehensiveMarkdown}</Response>\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -453,24 +453,39 @@ const InlineEditCell = (_a) => {
453
453
  };
454
454
  exports.InlineEditCell = InlineEditCell;
455
455
  const DropDownCell = (_a) => {
456
- var _b;
457
- var { cell, options, portalTarget: portalTargetProp, ariaLabel, className, style, htmlAttributes, ref: forwardRef, isDisabled } = _a, restProps = __rest(_a, ["cell", "options", "portalTarget", "ariaLabel", "className", "style", "htmlAttributes", "ref", "isDisabled"]);
456
+ var _b, _c;
457
+ var { cell, options, portalTarget: portalTargetProp, ariaLabel, className, style, htmlAttributes, ref: forwardRef, isDisabled, errorText, helpText, components } = _a, restProps = __rest(_a, ["cell", "options", "portalTarget", "ariaLabel", "className", "style", "htmlAttributes", "ref", "isDisabled", "errorText", "helpText", "components"]);
458
458
  const { dataGridNav, portalTarget } = (0, data_grid_context_1.useDataGridContext)();
459
459
  const ref = (0, react_2.useRef)(null);
460
460
  const mergedRef = (0, react_1.useMergeRefs)([ref, forwardRef]);
461
- if (!((_b = cell.column.columnDef.meta) === null || _b === void 0 ? void 0 : _b.isDropDownCell)) {
461
+ const dropDownMeta = (_b = cell.column.columnDef.meta) === null || _b === void 0 ? void 0 : _b.isDropDownCell;
462
+ if (!dropDownMeta) {
462
463
  return null;
463
464
  }
464
- const defaultOption = options.find((option) => { var _a; return option.value === ((_a = cell.getValue()) === null || _a === void 0 ? void 0 : _a.toString()); });
465
+ const isMulti = (_c = dropDownMeta.isMulti) !== null && _c !== void 0 ? _c : false;
466
+ const cellValue = cell.getValue();
467
+ const selectedValues = (Array.isArray(cellValue) ? cellValue : [cellValue]).map((value) => value === null || value === void 0 ? void 0 : value.toString());
468
+ const defaultValue = isMulti
469
+ ? options.filter((option) => selectedValues.includes(option.value))
470
+ : options.find((option) => option.value === (cellValue === null || cellValue === void 0 ? void 0 : cellValue.toString()));
465
471
  const menuPortalTarget = portalTargetProp === undefined ? portalTarget : portalTargetProp;
466
- return ((0, jsx_runtime_1.jsx)(select_1.Select, Object.assign({ ref: mergedRef, className: className, isFluid: true, isClean: true, style: Object.assign(Object.assign({}, style), { height: '100%', width: '100%' }), type: "select", size: "medium", ariaLabel: ariaLabel, isDisabled: isDisabled, selectProps: {
467
- defaultValue: defaultOption,
472
+ return ((0, jsx_runtime_1.jsx)(select_1.Select, Object.assign({ ref: mergedRef, className: className, isFluid: true, isClean: true, style: Object.assign(Object.assign({}, style), { height: '100%', width: '100%' }), type: "select", size: "medium", ariaLabel: ariaLabel, isDisabled: isDisabled, errorText: errorText, helpText: helpText, selectProps: {
473
+ components: components,
474
+ defaultValue,
475
+ isMulti,
468
476
  menuPortalTarget: menuPortalTarget,
469
477
  menuPosition: 'fixed',
470
- onChange: (e) => {
471
- var _a, _b;
472
- const value = e === null || e === void 0 ? void 0 : e.value;
473
- (_b = (_a = cell === null || cell === void 0 ? void 0 : cell.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.isDropDownCell) === null || _b === void 0 ? void 0 : _b.onChange(value === null || value === void 0 ? void 0 : value.toString(), cell);
478
+ onChange: (selected) => {
479
+ const selectedOptions = Array.isArray(selected)
480
+ ? selected
481
+ : selected
482
+ ? [selected]
483
+ : [];
484
+ const values = selectedOptions.map((option) => option.value);
485
+ // `TValue` is not known inside the component; cast once at this boundary
486
+ // to invoke onChange with the resolved single/multi value.
487
+ const handleChange = dropDownMeta.onChange;
488
+ handleChange(isMulti ? values : values[0], cell);
474
489
  dataGridNav.enable();
475
490
  if (ref === null || ref === void 0 ? void 0 : ref.current) {
476
491
  dataGridNav.focusParentCell(ref.current);