@neo4j-ndl/react 5.1.1 → 5.1.3

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 (76) hide show
  1. package/lib/cjs/ai/response/Response.js +127 -3
  2. package/lib/cjs/ai/response/Response.js.map +1 -1
  3. package/lib/cjs/ai/response/safe-href.js +108 -0
  4. package/lib/cjs/ai/response/safe-href.js.map +1 -0
  5. package/lib/cjs/ai/response/stories/response-all-components.story.js +10 -3
  6. package/lib/cjs/ai/response/stories/response-all-components.story.js.map +1 -1
  7. package/lib/cjs/ai/response/stories/response-lists.story.js +6 -1
  8. package/lib/cjs/ai/response/stories/response-lists.story.js.map +1 -1
  9. package/lib/cjs/button/stories/button-disabled.story.js +1 -1
  10. package/lib/cjs/button/stories/button-disabled.story.js.map +1 -1
  11. package/lib/cjs/button/stories/button-floating.story.js +1 -1
  12. package/lib/cjs/button/stories/button-floating.story.js.map +1 -1
  13. package/lib/cjs/button/stories/button-fluid.story.js +1 -1
  14. package/lib/cjs/button/stories/button-fluid.story.js.map +1 -1
  15. package/lib/cjs/button/stories/button-loading.story.js +1 -1
  16. package/lib/cjs/button/stories/button-loading.story.js.map +1 -1
  17. package/lib/cjs/button/stories/button-running-cancel.story.js +3 -4
  18. package/lib/cjs/button/stories/button-running-cancel.story.js.map +1 -1
  19. package/lib/cjs/checkbox/Checkbox.js +1 -0
  20. package/lib/cjs/checkbox/Checkbox.js.map +1 -1
  21. package/lib/cjs/clipboard-button/ClipboardButton.js +1 -1
  22. package/lib/cjs/clipboard-button/ClipboardButton.js.map +1 -1
  23. package/lib/cjs/dropzone/Dropzone.js +2 -6
  24. package/lib/cjs/dropzone/Dropzone.js.map +1 -1
  25. package/lib/cjs/switch/Switch.js +1 -0
  26. package/lib/cjs/switch/Switch.js.map +1 -1
  27. package/lib/cjs/toast/Toast.js +4 -4
  28. package/lib/cjs/toast/Toast.js.map +1 -1
  29. package/lib/esm/ai/response/Response.js +127 -3
  30. package/lib/esm/ai/response/Response.js.map +1 -1
  31. package/lib/esm/ai/response/safe-href.js +104 -0
  32. package/lib/esm/ai/response/safe-href.js.map +1 -0
  33. package/lib/esm/ai/response/stories/response-all-components.story.js +10 -3
  34. package/lib/esm/ai/response/stories/response-all-components.story.js.map +1 -1
  35. package/lib/esm/ai/response/stories/response-lists.story.js +6 -1
  36. package/lib/esm/ai/response/stories/response-lists.story.js.map +1 -1
  37. package/lib/esm/button/stories/button-disabled.story.js +3 -3
  38. package/lib/esm/button/stories/button-disabled.story.js.map +1 -1
  39. package/lib/esm/button/stories/button-floating.story.js +3 -3
  40. package/lib/esm/button/stories/button-floating.story.js.map +1 -1
  41. package/lib/esm/button/stories/button-fluid.story.js +3 -3
  42. package/lib/esm/button/stories/button-fluid.story.js.map +1 -1
  43. package/lib/esm/button/stories/button-loading.story.js +3 -3
  44. package/lib/esm/button/stories/button-loading.story.js.map +1 -1
  45. package/lib/esm/button/stories/button-running-cancel.story.js +3 -4
  46. package/lib/esm/button/stories/button-running-cancel.story.js.map +1 -1
  47. package/lib/esm/checkbox/Checkbox.js +1 -0
  48. package/lib/esm/checkbox/Checkbox.js.map +1 -1
  49. package/lib/esm/clipboard-button/ClipboardButton.js +1 -1
  50. package/lib/esm/clipboard-button/ClipboardButton.js.map +1 -1
  51. package/lib/esm/dropzone/Dropzone.js +2 -6
  52. package/lib/esm/dropzone/Dropzone.js.map +1 -1
  53. package/lib/esm/switch/Switch.js +1 -0
  54. package/lib/esm/switch/Switch.js.map +1 -1
  55. package/lib/esm/toast/Toast.js +4 -4
  56. package/lib/esm/toast/Toast.js.map +1 -1
  57. package/lib/types/ai/response/Response.d.ts +15 -1
  58. package/lib/types/ai/response/Response.d.ts.map +1 -1
  59. package/lib/types/ai/response/safe-href.d.ts +26 -0
  60. package/lib/types/ai/response/safe-href.d.ts.map +1 -0
  61. package/lib/types/ai/response/stories/response-all-components.story.d.ts.map +1 -1
  62. package/lib/types/ai/response/stories/response-lists.story.d.ts.map +1 -1
  63. package/lib/types/button/stories/button-disabled.story.d.ts.map +1 -1
  64. package/lib/types/button/stories/button-floating.story.d.ts.map +1 -1
  65. package/lib/types/button/stories/button-fluid.story.d.ts.map +1 -1
  66. package/lib/types/button/stories/button-loading.story.d.ts.map +1 -1
  67. package/lib/types/button/stories/button-running-cancel.story.d.ts.map +1 -1
  68. package/lib/types/checkbox/Checkbox.d.ts.map +1 -1
  69. package/lib/types/clipboard-button/ClipboardButton.d.ts.map +1 -1
  70. package/lib/types/dropzone/Dropzone.d.ts +1 -1
  71. package/lib/types/dropzone/Dropzone.d.ts.map +1 -1
  72. package/lib/types/switch/Switch.d.ts.map +1 -1
  73. package/package.json +5 -5
  74. package/skills/ndl-react/SKILL.md +2 -2
  75. package/skills/ndl-react/components/ai/response.md +36 -5
  76. package/skills/ndl-react/components/dropzone.md +1 -1
@@ -37,6 +37,7 @@ import { memo, useMemo, useRef } from 'react';
37
37
  import { defaultRehypePlugins, Streamdown } from 'streamdown';
38
38
  import { Languages } from '../../code-block/code-languages';
39
39
  import { CodePreview } from '../code-preview';
40
+ import { safeHref } from './safe-href';
40
41
  const STREAMDOWN_PLACEHOLDER_PROTOCOL = 'streamdown:';
41
42
  const CLOBBER_PREFIX = 'user-content-';
42
43
  const CLOBBERABLE_PROPERTIES = [
@@ -69,14 +70,124 @@ const prefixClobberableProperties = (node) => {
69
70
  * Prefixing after sanitization keeps already prefixed footnote ids intact.
70
71
  */
71
72
  const rehypePrefixClobberableProperties = () => prefixClobberableProperties;
73
+ /**
74
+ * Strip unsafe `href`/`src` before rehype-harden. Harden 1.1.x with wildcard
75
+ * prefixes rewrites network-path URLs (e.g. `//evil.example/path` → `/path`),
76
+ * which would bypass `safeHref` in the React overrides.
77
+ */
78
+ const stripUnsafeUrlProperty = (properties, key) => {
79
+ const value = properties[key];
80
+ if (typeof value !== 'string') {
81
+ return;
82
+ }
83
+ // Leave streaming placeholders for harden / the React override.
84
+ if (value.startsWith(STREAMDOWN_PLACEHOLDER_PROTOCOL)) {
85
+ return;
86
+ }
87
+ if (safeHref(value) === undefined) {
88
+ delete properties[key];
89
+ }
90
+ };
91
+ /**
92
+ * A `srcSet` is safe only when every comma-separated URL candidate is safe.
93
+ * Descriptors (`1x`, `2x`, `480w`, etc.) do not affect the URL check.
94
+ */
95
+ const stripUnsafeSrcSet = (properties) => {
96
+ const value = properties.srcSet;
97
+ if (typeof value !== 'string') {
98
+ delete properties.srcSet;
99
+ return;
100
+ }
101
+ const candidates = value.split(',');
102
+ const isSafe = candidates.length > 0 &&
103
+ candidates.every((candidate) => {
104
+ const [url] = candidate.trim().split(/\s+/, 1);
105
+ return url !== undefined && safeHref(url) !== undefined;
106
+ });
107
+ if (!isSafe) {
108
+ delete properties.srcSet;
109
+ }
110
+ };
111
+ const rejectUnsafeUrls = (node) => {
112
+ var _a;
113
+ if (node.type === 'element' && node.properties !== undefined) {
114
+ if (node.tagName === 'a') {
115
+ stripUnsafeUrlProperty(node.properties, 'href');
116
+ }
117
+ else if (node.tagName === 'img') {
118
+ stripUnsafeUrlProperty(node.properties, 'src');
119
+ }
120
+ else if (node.tagName === 'source') {
121
+ stripUnsafeSrcSet(node.properties);
122
+ }
123
+ }
124
+ (_a = node.children) === null || _a === void 0 ? void 0 : _a.forEach(rejectUnsafeUrls);
125
+ };
126
+ const rehypeRejectUnsafeUrls = () => rejectUnsafeUrls;
127
+ const withPluginOptions = (plugin, options) => {
128
+ if (Array.isArray(plugin)) {
129
+ const existingOptions = typeof plugin[1] === 'object' &&
130
+ plugin[1] !== null &&
131
+ !Array.isArray(plugin[1])
132
+ ? plugin[1]
133
+ : {};
134
+ return [plugin[0], Object.assign(Object.assign({}, existingOptions), options)];
135
+ }
136
+ return [plugin, options];
137
+ };
138
+ // Streamdown 2.7 defaults: raw, sanitize, harden (katex is no longer included).
72
139
  const rehypePlugins = [
73
- ...Object.values(defaultRehypePlugins),
140
+ defaultRehypePlugins.raw,
141
+ defaultRehypePlugins.sanitize,
142
+ // Must run before harden so network-path URLs are not rewritten to paths.
143
+ rehypeRejectUnsafeUrls,
144
+ // text-only: incomplete streamdown: URLs that harden rejects must not surface
145
+ // as visible " [blocked]" markers from the default indicator policy.
146
+ withPluginOptions(defaultRehypePlugins.harden, {
147
+ linkBlockPolicy: 'text-only',
148
+ imageBlockPolicy: 'text-only',
149
+ }),
74
150
  rehypePrefixClobberableProperties,
75
151
  ];
152
+ const ALLOWED_PROP = /^(className|id|name|title|aria-|data-|role)/;
153
+ const pickSafeProps = (props) => Object.fromEntries(Object.entries(props).filter(([key]) => ALLOWED_PROP.test(key)));
154
+ /**
155
+ * Absolute `http:` and `https:` URLs are external when their origin differs
156
+ * from the page. Same-origin absolute URLs, relative paths, fragments, and
157
+ * `mailto:` stay internal. Visual only — both still open in a new tab.
158
+ */
159
+ const isExternalHref = (href) => {
160
+ if (!/^https?:/i.test(href)) {
161
+ return false;
162
+ }
163
+ if (typeof window === 'undefined') {
164
+ return true;
165
+ }
166
+ try {
167
+ return new URL(href).origin !== window.location.origin;
168
+ }
169
+ catch (_a) {
170
+ return true;
171
+ }
172
+ };
76
173
  /**
77
174
  * The component is used to display the response from an LLM.
78
175
  * It handles markdown rendering and streaming.
79
176
  *
177
+ * @remarks
178
+ * Treat `children` as untrusted. Link and image URLs are limited to `http:`,
179
+ * `https:`, `mailto:`, and same-origin relative or fragment paths. Unsafe
180
+ * schemes (for example `javascript:`) and network-path URLs (for example
181
+ * `//evil.example`) render as plain text for links and are omitted for images.
182
+ * Markdown attributes are allow-listed so event handlers cannot reach the DOM.
183
+ * Allowed links open in a new tab with a fixed `rel="noopener noreferrer"`
184
+ * (`target` and `rel` from markdown are ignored). Absolute `http:` and
185
+ * `https:` links use `TextLink` `type="external"` when their origin differs
186
+ * from the page, and `type="internal"` when it matches. Relative, fragment,
187
+ * and `mailto:` links use `type="internal"`.
188
+ * Ids and related attributes from model output are prefixed with
189
+ * `user-content-` to avoid colliding with the host document.
190
+ *
80
191
  * @alpha - Changes to this component may be breaking.
81
192
  */
82
193
  const Response = memo((_a) => {
@@ -123,7 +234,16 @@ const Response = memo((_a) => {
123
234
  if ((href === null || href === void 0 ? void 0 : href.startsWith(STREAMDOWN_PLACEHOLDER_PROTOCOL)) === true) {
124
235
  return _jsx("span", { className: className, children: children });
125
236
  }
126
- return (_jsx(TextLink, { type: "internal", className: className, href: href, htmlAttributes: props, children: children }));
237
+ const cleanHref = safeHref(href);
238
+ if (cleanHref === undefined) {
239
+ // Unsafe or unknown scheme: render text, not a clickable link.
240
+ return _jsx("span", { className: className, children: children });
241
+ }
242
+ return (_jsx(TextLink, { type: isExternalHref(cleanHref) ? 'external' : 'internal', className: className, href: cleanHref,
243
+ // Harden sets target="_blank" on every allowed link. Re-apply
244
+ // it here: TextLink's internal type defaults to the same tab,
245
+ // and the allow-list drops `target` and `rel` from markdown.
246
+ target: "_blank", htmlAttributes: Object.assign(Object.assign({}, pickSafeProps(props)), { rel: 'noopener noreferrer' }), children: children }));
127
247
  },
128
248
  // oxlint-disable-next-line no-unused-vars
129
249
  h1: (_a) => {
@@ -255,7 +375,11 @@ const Response = memo((_a) => {
255
375
  src.startsWith(STREAMDOWN_PLACEHOLDER_PROTOCOL)) {
256
376
  return null;
257
377
  }
258
- return (_jsx("img", Object.assign({ className: classNames(className), src: src, alt: alt }, props)));
378
+ const cleanSrc = safeHref(src);
379
+ if (cleanSrc === undefined) {
380
+ return null;
381
+ }
382
+ return (_jsx("img", Object.assign({ className: classNames(className), src: cleanSrc, alt: alt }, pickSafeProps(props))));
259
383
  },
260
384
  }), []);
261
385
  return (_jsx("div", Object.assign({ ref: ref, style: style, className: classNames('ndl-ai-response', className) }, restProps, htmlAttributes, { children: _jsx(Streamdown, { isAnimating: isAnimating, parseIncompleteMarkdown: isAnimating, components: components, rehypePlugins: rehypePlugins, children: children }) })));
@@ -1 +1 @@
1
- {"version":3,"file":"Response.js","sourceRoot":"","sources":["../../../../src/ai/response/Response.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;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,CAAC,EAC/C,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,CACL,4BACE,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,EAChC,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,IACJ,KAAK,EACT,CACH,CAAC;QACJ,CAAC;KACF,CAAC,EACF,EAAE,CACH,CAAC;IAEJ,OAAO,CACL,4BACE,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,IAC/C,SAAS,EACT,cAAc,cAElB,KAAC,UAAU,IACT,WAAW,EAAE,WAAW,EACxB,uBAAuB,EAAE,WAAW,EACpC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,YAE3B,QAAQ,GACE,IACT,CACP,CAAC;AACJ,CAAC,EACD,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,CACpE,CAAC;AAEF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\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 { defaultRehypePlugins, 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\nconst STREAMDOWN_PLACEHOLDER_PROTOCOL = 'streamdown:';\n\nconst CLOBBER_PREFIX = 'user-content-';\nconst CLOBBERABLE_PROPERTIES = [\n 'id',\n 'name',\n 'ariaDescribedBy',\n 'ariaLabelledBy',\n];\n\ntype HastNode = {\n type: string;\n properties?: Record<string, unknown>;\n children?: HastNode[];\n};\n\nconst prefixClobberValue = (value: unknown) =>\n typeof value === 'string' && !value.startsWith(CLOBBER_PREFIX)\n ? `${CLOBBER_PREFIX}${value}`\n : value;\n\nconst prefixClobberableProperties = (node: HastNode) => {\n if (node.type === 'element' && node.properties !== undefined) {\n for (const key of CLOBBERABLE_PROPERTIES) {\n const value = node.properties[key];\n if (value === undefined || value === null) {\n continue;\n }\n node.properties[key] = Array.isArray(value)\n ? value.map(prefixClobberValue)\n : prefixClobberValue(value);\n }\n }\n node.children?.forEach(prefixClobberableProperties);\n};\n\n/**\n * Streamdown 2 sanitizes with an empty `clobberPrefix`, which lets ids and\n * names from model output collide with the host document (DOM clobbering).\n * Prefixing after sanitization keeps already prefixed footnote ids intact.\n */\nconst rehypePrefixClobberableProperties = () => prefixClobberableProperties;\n\nconst rehypePlugins = [\n ...Object.values(defaultRehypePlugins),\n rehypePrefixClobberableProperties,\n];\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, id-length\n a: ({ node: _node, children, className, href, ...props }) => {\n // Streamdown marks links whose URL is still streaming with a placeholder href\n if (href?.startsWith(STREAMDOWN_PLACEHOLDER_PROTOCOL) === true) {\n return <span className={className}>{children}</span>;\n }\n return (\n <TextLink\n type=\"internal\"\n className={className}\n href={href}\n htmlAttributes={props}\n >\n {children}\n </TextLink>\n );\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 sup: ({ node, children, className, ref: _ref, ...props }) => (\n <sup className={className} {...props}>\n {children}\n </sup>\n ),\n // oxlint-disable-next-line no-unused-vars\n sub: ({ node, children, className, ref: _ref, ...props }) => (\n <sub className={className} {...props}>\n {children}\n </sub>\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, id-length\n p: ({ node: _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 if (\n typeof src === 'string' &&\n src.startsWith(STREAMDOWN_PLACEHOLDER_PROTOCOL)\n ) {\n return null;\n }\n return (\n <img\n className={classNames(className)}\n src={src}\n alt={alt}\n {...props}\n />\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 rehypePlugins={rehypePlugins}\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,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG9D,OAAO,EAAqB,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,+BAA+B,GAAG,aAAa,CAAC;AAEtD,MAAM,cAAc,GAAG,eAAe,CAAC;AACvC,MAAM,sBAAsB,GAAG;IAC7B,IAAI;IACJ,MAAM;IACN,iBAAiB;IACjB,gBAAgB;CACjB,CAAC;AASF,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAAE,EAAE,CAC5C,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,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,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,CACpE,CAAC;AAEF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\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 { defaultRehypePlugins, Streamdown } from 'streamdown';\n\nimport { type CommonProps, type HtmlAttributes } from '../../_common/types';\nimport { type LanguageProp, Languages } from '../../code-block/code-languages';\nimport { CodePreview } from '../code-preview';\nimport { safeHref } from './safe-href';\n\nconst STREAMDOWN_PLACEHOLDER_PROTOCOL = 'streamdown:';\n\nconst CLOBBER_PREFIX = 'user-content-';\nconst CLOBBERABLE_PROPERTIES = [\n 'id',\n 'name',\n 'ariaDescribedBy',\n 'ariaLabelledBy',\n];\n\ntype HastNode = {\n type: string;\n tagName?: string;\n properties?: Record<string, unknown>;\n children?: HastNode[];\n};\n\nconst prefixClobberValue = (value: unknown) =>\n typeof value === 'string' && !value.startsWith(CLOBBER_PREFIX)\n ? `${CLOBBER_PREFIX}${value}`\n : value;\n\nconst prefixClobberableProperties = (node: HastNode) => {\n if (node.type === 'element' && node.properties !== undefined) {\n for (const key of CLOBBERABLE_PROPERTIES) {\n const value = node.properties[key];\n if (value === undefined || value === null) {\n continue;\n }\n node.properties[key] = Array.isArray(value)\n ? value.map(prefixClobberValue)\n : prefixClobberValue(value);\n }\n }\n node.children?.forEach(prefixClobberableProperties);\n};\n\n/**\n * Streamdown 2 sanitizes with an empty `clobberPrefix`, which lets ids and\n * names from model output collide with the host document (DOM clobbering).\n * Prefixing after sanitization keeps already prefixed footnote ids intact.\n */\nconst rehypePrefixClobberableProperties = () => prefixClobberableProperties;\n\n/**\n * Strip unsafe `href`/`src` before rehype-harden. Harden 1.1.x with wildcard\n * prefixes rewrites network-path URLs (e.g. `//evil.example/path` → `/path`),\n * which would bypass `safeHref` in the React overrides.\n */\nconst stripUnsafeUrlProperty = (\n properties: Record<string, unknown>,\n key: 'href' | 'src',\n) => {\n const value = properties[key];\n if (typeof value !== 'string') {\n return;\n }\n // Leave streaming placeholders for harden / the React override.\n if (value.startsWith(STREAMDOWN_PLACEHOLDER_PROTOCOL)) {\n return;\n }\n if (safeHref(value) === undefined) {\n delete properties[key];\n }\n};\n\n/**\n * A `srcSet` is safe only when every comma-separated URL candidate is safe.\n * Descriptors (`1x`, `2x`, `480w`, etc.) do not affect the URL check.\n */\nconst stripUnsafeSrcSet = (properties: Record<string, unknown>) => {\n const value = properties.srcSet;\n if (typeof value !== 'string') {\n delete properties.srcSet;\n return;\n }\n\n const candidates = value.split(',');\n const isSafe =\n candidates.length > 0 &&\n candidates.every((candidate) => {\n const [url] = candidate.trim().split(/\\s+/, 1);\n return url !== undefined && safeHref(url) !== undefined;\n });\n\n if (!isSafe) {\n delete properties.srcSet;\n }\n};\n\nconst rejectUnsafeUrls = (node: HastNode) => {\n if (node.type === 'element' && node.properties !== undefined) {\n if (node.tagName === 'a') {\n stripUnsafeUrlProperty(node.properties, 'href');\n } else if (node.tagName === 'img') {\n stripUnsafeUrlProperty(node.properties, 'src');\n } else if (node.tagName === 'source') {\n stripUnsafeSrcSet(node.properties);\n }\n }\n node.children?.forEach(rejectUnsafeUrls);\n};\n\nconst rehypeRejectUnsafeUrls = () => rejectUnsafeUrls;\n\nconst withPluginOptions = (\n plugin: (typeof defaultRehypePlugins)[string],\n options: Record<string, unknown>,\n): NonNullable<\n React.ComponentProps<typeof Streamdown>['rehypePlugins']\n>[number] => {\n if (Array.isArray(plugin)) {\n const existingOptions =\n typeof plugin[1] === 'object' &&\n plugin[1] !== null &&\n !Array.isArray(plugin[1])\n ? plugin[1]\n : {};\n return [plugin[0], { ...existingOptions, ...options }] as NonNullable<\n React.ComponentProps<typeof Streamdown>['rehypePlugins']\n >[number];\n }\n return [plugin, options] as NonNullable<\n React.ComponentProps<typeof Streamdown>['rehypePlugins']\n >[number];\n};\n\n// Streamdown 2.7 defaults: raw, sanitize, harden (katex is no longer included).\nconst rehypePlugins: NonNullable<\n React.ComponentProps<typeof Streamdown>['rehypePlugins']\n> = [\n defaultRehypePlugins.raw,\n defaultRehypePlugins.sanitize,\n // Must run before harden so network-path URLs are not rewritten to paths.\n rehypeRejectUnsafeUrls,\n // text-only: incomplete streamdown: URLs that harden rejects must not surface\n // as visible \" [blocked]\" markers from the default indicator policy.\n withPluginOptions(defaultRehypePlugins.harden, {\n linkBlockPolicy: 'text-only',\n imageBlockPolicy: 'text-only',\n }),\n rehypePrefixClobberableProperties,\n];\n\ntype ResponseProps = {\n /** Markdown content from the AI. URLs and attributes are sanitized before render. */\n children: string;\n /** Whether the response is animating */\n isAnimating?: React.ComponentProps<typeof Streamdown>['isAnimating'];\n};\n\nconst ALLOWED_PROP = /^(className|id|name|title|aria-|data-|role)/;\n\nconst pickSafeProps = <T extends React.ElementType>(\n props: Record<string, unknown>,\n): HtmlAttributes<T> =>\n Object.fromEntries(\n Object.entries(props).filter(([key]) => ALLOWED_PROP.test(key)),\n ) as HtmlAttributes<T>;\n\n/**\n * Absolute `http:` and `https:` URLs are external when their origin differs\n * from the page. Same-origin absolute URLs, relative paths, fragments, and\n * `mailto:` stay internal. Visual only — both still open in a new tab.\n */\nconst isExternalHref = (href: string): boolean => {\n if (!/^https?:/i.test(href)) {\n return false;\n }\n if (typeof window === 'undefined') {\n return true;\n }\n try {\n return new URL(href).origin !== window.location.origin;\n } catch {\n return true;\n }\n};\n\n/**\n * The component is used to display the response from an LLM.\n * It handles markdown rendering and streaming.\n *\n * @remarks\n * Treat `children` as untrusted. Link and image URLs are limited to `http:`,\n * `https:`, `mailto:`, and same-origin relative or fragment paths. Unsafe\n * schemes (for example `javascript:`) and network-path URLs (for example\n * `//evil.example`) render as plain text for links and are omitted for images.\n * Markdown attributes are allow-listed so event handlers cannot reach the DOM.\n * Allowed links open in a new tab with a fixed `rel=\"noopener noreferrer\"`\n * (`target` and `rel` from markdown are ignored). Absolute `http:` and\n * `https:` links use `TextLink` `type=\"external\"` when their origin differs\n * from the page, and `type=\"internal\"` when it matches. Relative, fragment,\n * and `mailto:` links use `type=\"internal\"`.\n * Ids and related attributes from model output are prefixed with\n * `user-content-` to avoid colliding with the host document.\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, id-length\n a: ({ node: _node, children, className, href, ...props }) => {\n // Streamdown marks links whose URL is still streaming with a placeholder href\n if (href?.startsWith(STREAMDOWN_PLACEHOLDER_PROTOCOL) === true) {\n return <span className={className}>{children}</span>;\n }\n const cleanHref = safeHref(href);\n if (cleanHref === undefined) {\n // Unsafe or unknown scheme: render text, not a clickable link.\n return <span className={className}>{children}</span>;\n }\n return (\n <TextLink\n type={isExternalHref(cleanHref) ? 'external' : 'internal'}\n className={className}\n href={cleanHref}\n // Harden sets target=\"_blank\" on every allowed link. Re-apply\n // it here: TextLink's internal type defaults to the same tab,\n // and the allow-list drops `target` and `rel` from markdown.\n target=\"_blank\"\n htmlAttributes={{\n ...pickSafeProps<'a'>(props),\n rel: 'noopener noreferrer',\n }}\n >\n {children}\n </TextLink>\n );\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 sup: ({ node, children, className, ref: _ref, ...props }) => (\n <sup className={className} {...props}>\n {children}\n </sup>\n ),\n // oxlint-disable-next-line no-unused-vars\n sub: ({ node, children, className, ref: _ref, ...props }) => (\n <sub className={className} {...props}>\n {children}\n </sub>\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, id-length\n p: ({ node: _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 if (\n typeof src === 'string' &&\n src.startsWith(STREAMDOWN_PLACEHOLDER_PROTOCOL)\n ) {\n return null;\n }\n const cleanSrc = safeHref(src);\n if (cleanSrc === undefined) {\n return null;\n }\n return (\n <img\n className={classNames(className)}\n src={cleanSrc}\n alt={alt}\n {...pickSafeProps<'img'>(props)}\n />\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 rehypePlugins={rehypePlugins}\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"]}
@@ -0,0 +1,104 @@
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
+ const SAFE_PROTOCOLS = new Set(['http:', 'https:', 'mailto:']);
22
+ /** Dummy https origin used only to classify relative vs absolute URLs. */
23
+ const DUMMY_BASE = 'https://safe.invalid/';
24
+ /** True when the string contains C0 controls or DEL (can obfuscate schemes). */
25
+ const hasControlCharacter = (value) => {
26
+ for (let index = 0; index < value.length; index++) {
27
+ const code = value.charCodeAt(index);
28
+ if (code <= 0x1f || code === 0x7f) {
29
+ return true;
30
+ }
31
+ }
32
+ return false;
33
+ };
34
+ /** Scheme / path / host only — excludes query and fragment. */
35
+ const structuralPrefix = (value) => {
36
+ const queryIndex = value.indexOf('?');
37
+ const fragmentIndex = value.indexOf('#');
38
+ let end = value.length;
39
+ if (queryIndex !== -1) {
40
+ end = Math.min(end, queryIndex);
41
+ }
42
+ if (fragmentIndex !== -1) {
43
+ end = Math.min(end, fragmentIndex);
44
+ }
45
+ return value.slice(0, end);
46
+ };
47
+ const tryDecode = (value) => {
48
+ try {
49
+ return decodeURIComponent(value);
50
+ }
51
+ catch (_a) {
52
+ return value;
53
+ }
54
+ };
55
+ /**
56
+ * Returns a URL safe to use as an anchor `href` or image `src`, or `undefined`
57
+ * when the value must not be rendered as a navigable/fetchable URL.
58
+ */
59
+ export const safeHref = (href) => {
60
+ if (!href) {
61
+ return undefined;
62
+ }
63
+ const trimmed = href.trim();
64
+ if (!trimmed) {
65
+ return undefined;
66
+ }
67
+ // Control characters can obfuscate schemes (e.g. java\nscript:).
68
+ if (hasControlCharacter(trimmed)) {
69
+ return undefined;
70
+ }
71
+ // Decode only the structural prefix so query/body percent-encoding (e.g.
72
+ // mailto ?body=…%0D%0A… or ?q=%5C) is not treated as URL structure.
73
+ const structure = structuralPrefix(trimmed);
74
+ const decodedStructure = tryDecode(structure);
75
+ if (hasControlCharacter(decodedStructure)) {
76
+ return undefined;
77
+ }
78
+ // Network-path / backslash forms resolve or normalize cross-origin.
79
+ if (/^[/\\]{2}/.test(trimmed) ||
80
+ /^[/\\]{2}/.test(structure) ||
81
+ /^[/\\]{2}/.test(decodedStructure) ||
82
+ structure.includes('\\') ||
83
+ decodedStructure.includes('\\')) {
84
+ return undefined;
85
+ }
86
+ let parsed;
87
+ try {
88
+ parsed = new URL(trimmed, DUMMY_BASE);
89
+ }
90
+ catch (_a) {
91
+ return undefined;
92
+ }
93
+ const hasExplicitScheme = /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(trimmed);
94
+ if (hasExplicitScheme) {
95
+ return SAFE_PROTOCOLS.has(parsed.protocol) ? trimmed : undefined;
96
+ }
97
+ // Path-/query-/fragment-relative (including bare paths like docs/page):
98
+ // must resolve against the dummy origin, not a different host.
99
+ if (parsed.origin !== new URL(DUMMY_BASE).origin) {
100
+ return undefined;
101
+ }
102
+ return trimmed;
103
+ };
104
+ //# sourceMappingURL=safe-href.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safe-href.js","sourceRoot":"","sources":["../../../../src/ai/response/safe-href.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAC/D,0EAA0E;AAC1E,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAE3C,gFAAgF;AAChF,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAW,EAAE;IACrD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClD,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,+DAA+D;AAC/D,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAU,EAAE;IACjD,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;IACvB,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;QACtB,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAClC,CAAC;IACD,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE,CAAC;QACzB,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,CAAC,C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AM,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACxC,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,iBAAiB,GAAG,2BAA2B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEpE,IAAI,iBAAiB,EAAE,CAAC;QACtB,OAAO,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,CAAC;IAED,wEAAwE;IACxE,+DAA+D;IAC/D,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,CAAC;QACjD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,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\nconst SAFE_PROTOCOLS = new Set(['http:', 'https:', 'mailto:']);\n/** Dummy https origin used only to classify relative vs absolute URLs. */\nconst DUMMY_BASE = 'https://safe.invalid/';\n\n/** True when the string contains C0 controls or DEL (can obfuscate schemes). */\nconst hasControlCharacter = (value: string): boolean => {\n for (let index = 0; index < value.length; index++) {\n const code = value.charCodeAt(index);\n if (code <= 0x1f || code === 0x7f) {\n return true;\n }\n }\n return false;\n};\n\n/** Scheme / path / host only — excludes query and fragment. */\nconst structuralPrefix = (value: string): string => {\n const queryIndex = value.indexOf('?');\n const fragmentIndex = value.indexOf('#');\n let end = value.length;\n if (queryIndex !== -1) {\n end = Math.min(end, queryIndex);\n }\n if (fragmentIndex !== -1) {\n end = Math.min(end, fragmentIndex);\n }\n return value.slice(0, end);\n};\n\nconst tryDecode = (value: string): string => {\n try {\n return decodeURIComponent(value);\n } catch {\n return value;\n }\n};\n\n/**\n * Returns a URL safe to use as an anchor `href` or image `src`, or `undefined`\n * when the value must not be rendered as a navigable/fetchable URL.\n */\nexport const safeHref = (href?: string): string | undefined => {\n if (!href) {\n return undefined;\n }\n const trimmed = href.trim();\n if (!trimmed) {\n return undefined;\n }\n\n // Control characters can obfuscate schemes (e.g. java\\nscript:).\n if (hasControlCharacter(trimmed)) {\n return undefined;\n }\n\n // Decode only the structural prefix so query/body percent-encoding (e.g.\n // mailto ?body=…%0D%0A… or ?q=%5C) is not treated as URL structure.\n const structure = structuralPrefix(trimmed);\n const decodedStructure = tryDecode(structure);\n if (hasControlCharacter(decodedStructure)) {\n return undefined;\n }\n\n // Network-path / backslash forms resolve or normalize cross-origin.\n if (\n /^[/\\\\]{2}/.test(trimmed) ||\n /^[/\\\\]{2}/.test(structure) ||\n /^[/\\\\]{2}/.test(decodedStructure) ||\n structure.includes('\\\\') ||\n decodedStructure.includes('\\\\')\n ) {\n return undefined;\n }\n\n let parsed: URL;\n try {\n parsed = new URL(trimmed, DUMMY_BASE);\n } catch {\n return undefined;\n }\n\n const hasExplicitScheme = /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(trimmed);\n\n if (hasExplicitScheme) {\n return SAFE_PROTOCOLS.has(parsed.protocol) ? trimmed : undefined;\n }\n\n // Path-/query-/fragment-relative (including bare paths like docs/page):\n // must resolve against the dummy origin, not a different host.\n if (parsed.origin !== new URL(DUMMY_BASE).origin) {\n return undefined;\n }\n\n return trimmed;\n};\n"]}
@@ -122,9 +122,13 @@ without syntax highlighting
122
122
 
123
123
  ## Links
124
124
 
125
- Visit [Neo4j](https://neo4j.com) for more information.
125
+ Visit [Needle AI Response All Components](/?path=/story/components-ai-response--all-components) to see a full demo of the story. — This link has the href \`/?path=/story/components-ai-response--all-components\`, which is relative to the current origin.
126
126
 
127
- Multiple links: [Documentation](https://neo4j.com/docs) and [Community](https://community.neo4j.com)
127
+ Visit [Needle on this origin](https://needle.neo4j.design/?path=/story/components-ai-response--all-components) — This link has the href \`https://needle.neo4j.design/?path=/story/components-ai-response--all-components\`, which is an absolute URL. It is internal when the page origin is \`https://needle.neo4j.design\`.
128
+
129
+ Visit [Neo4j](https://neo4j.com) for more information. — This link has the href \`https://neo4j.com\`, which is an absolute URL on a different origin.
130
+
131
+ Multiple links: [Documentation](https://neo4j.com/docs) and [Community](https://community.neo4j.com). — These links have the hrefs \`https://neo4j.com/docs\` and \`https://community.neo4j.com\`, which are absolute URLs.
128
132
 
129
133
  ## Blockquotes
130
134
 
@@ -221,7 +225,10 @@ Use code blocks for preformatted text with preserved spacing:
221
225
  | Codecademy Hoodie | False | 42.99 |
222
226
  `;
223
227
  export const Component = () => {
224
- return (_jsx("div", { className: "max-w-4xl", children: _jsx(Response, { children: comprehensiveMarkdown }) }));
228
+ // Keep the live example on the current origin so it renders as internal
229
+ // both locally and on the published Storybook.
230
+ const markdown = comprehensiveMarkdown.replaceAll('https://needle.neo4j.design', window.location.origin);
231
+ return (_jsx("div", { className: "max-w-4xl", children: _jsx(Response, { children: markdown }) }));
225
232
  };
226
233
  export default Component;
227
234
  //# sourceMappingURL=response-all-components.story.js.map
@@ -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,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuM7B,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,OAAO,CACL,cAAK,SAAS,EAAC,WAAW,YACxB,KAAC,QAAQ,cAAE,qBAAqB,GAAY,GACxC,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 */\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"]}
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,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2M7B,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,wEAAwE;IACxE,+CAA+C;IAC/C,MAAM,QAAQ,GAAG,qBAAqB,CAAC,UAAU,CAC/C,6BAA6B,EAC7B,MAAM,CAAC,QAAQ,CAAC,MAAM,CACvB,CAAC;IACF,OAAO,CACL,cAAK,SAAS,EAAC,WAAW,YACxB,KAAC,QAAQ,cAAE,QAAQ,GAAY,GAC3B,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 */\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 [Needle AI Response All Components](/?path=/story/components-ai-response--all-components) to see a full demo of the story. — This link has the href \\`/?path=/story/components-ai-response--all-components\\`, which is relative to the current origin.\n\nVisit [Needle on this origin](https://needle.neo4j.design/?path=/story/components-ai-response--all-components) — This link has the href \\`https://needle.neo4j.design/?path=/story/components-ai-response--all-components\\`, which is an absolute URL. It is internal when the page origin is \\`https://needle.neo4j.design\\`.\n\nVisit [Neo4j](https://neo4j.com) for more information. — This link has the href \\`https://neo4j.com\\`, which is an absolute URL on a different origin.\n\nMultiple links: [Documentation](https://neo4j.com/docs) and [Community](https://community.neo4j.com). — These links have the hrefs \\`https://neo4j.com/docs\\` and \\`https://community.neo4j.com\\`, which are absolute URLs.\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 // Keep the live example on the current origin so it renders as internal\n // both locally and on the published Storybook.\n const markdown = comprehensiveMarkdown.replaceAll(\n 'https://needle.neo4j.design',\n window.location.origin,\n );\n return (\n <div className=\"max-w-4xl\">\n <Response>{markdown}</Response>\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -150,6 +150,8 @@ const listsMarkdown = `
150
150
  - Neo4j Desktop
151
151
  - Neo4j Browser
152
152
  - Neo4j Bloom
153
+ 4. Needle
154
+ - [Needle](https://needle.neo4j.design)
153
155
 
154
156
  ## Lists with Inline Formatting
155
157
 
@@ -160,7 +162,10 @@ const listsMarkdown = `
160
162
  - Combination: **bold and *italic* text** together
161
163
  `;
162
164
  export const Component = () => {
163
- return (_jsx("div", { className: "max-w-4xl", children: _jsx(Response, { children: listsMarkdown }) }));
165
+ // Keep the live example on the current origin so it renders as internal
166
+ // both locally and on the published Storybook.
167
+ const markdown = listsMarkdown.replaceAll('https://needle.neo4j.design', window.location.origin);
168
+ return (_jsx("div", { className: "max-w-4xl", children: _jsx(Response, { children: markdown }) }));
164
169
  };
165
170
  export default Component;
166
171
  //# sourceMappingURL=response-lists.story.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"response-lists.story.js","sourceRoot":"","sources":["../../../../../src/ai/response/stories/response-lists.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0IrB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,OAAO,CACL,cAAK,SAAS,EAAC,WAAW,YACxB,KAAC,QAAQ,cAAE,aAAa,GAAY,GAChC,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 */\nimport { Response } from '@neo4j-ndl/react/ai';\n\nconst listsMarkdown = `\n# Lists Examples\n\n## Simple Unordered List\n\n- Apple\n- Banana\n- Cherry\n- Date\n- Elderberry\n\n## Simple Ordered List\n\n1. First step\n2. Second step\n3. Third step\n4. Fourth step\n5. Fifth step\n\n## Nested Unordered Lists\n\n- Fruits\n - Apples\n - Granny Smith\n - Honeycrisp\n - Fuji\n - Oranges\n - Navel\n - Blood Orange\n - Berries\n - Strawberry\n - Blueberry\n - Raspberry\n- Vegetables\n - Leafy Greens\n - Spinach\n - Kale\n - Root Vegetables\n - Carrot\n - Potato\n\n## Nested Ordered Lists\n\n1. Introduction\n 1. Overview\n 2. Purpose\n 3. Scope\n2. Main Content\n 1. Chapter 1\n 1. Section 1.1\n 2. Section 1.2\n 3. Section 1.3\n 2. Chapter 2\n 1. Section 2.1\n 2. Section 2.2\n3. Conclusion\n 1. Summary\n 2. Recommendations\n\n## Mixed Lists\n\n1. Install dependencies\n - Node.js\n - npm or yarn\n - Git\n2. Clone repository\n - \\`git clone <url>\\`\n - \\`cd project-name\\`\n3. Configure settings\n 1. Copy \\`.env.example\\` to \\`.env\\`\n 2. Update configuration values:\n - Database URL\n - API keys\n - Port number\n4. Start development server\n - Run \\`npm install\\`\n - Run \\`npm start\\`\n\n## Lists with Paragraphs\n\n- **First Item**\n \n This is a detailed explanation of the first item. It can contain multiple sentences and provide context.\n\n- **Second Item**\n \n The second item also has a detailed explanation. This helps provide more information to the reader.\n\n- **Third Item**\n \n Each item can have as much detail as needed.\n\n## Lists with Code\n\n- JavaScript example:\n \n \\`\\`\\`javascript\n const items = ['a', 'b', 'c'];\n items.forEach(item => console.log(item));\n \\`\\`\\`\n\n- Python example:\n \n \\`\\`\\`python\n items = ['a', 'b', 'c']\n for item in items:\n print(item)\n \\`\\`\\`\n\n## Task Lists Representation\n\n- [x] Complete feature A\n- [x] Write tests\n- [ ] Review code\n- [ ] Deploy to production\n- [ ] Monitor metrics\n\n## Lists with Links\n\n1. Official Resources\n - [Neo4j Documentation](https://neo4j.com/docs)\n - [Neo4j Community](https://community.neo4j.com)\n - [Neo4j GitHub](https://github.com/neo4j)\n2. Tutorials\n - [Getting Started Guide](https://neo4j.com/start)\n - [Cypher Query Language](https://neo4j.com/cypher)\n3. Tools\n - Neo4j Desktop\n - Neo4j Browser\n - Neo4j Bloom\n\n## Lists with Inline Formatting\n\n- **Bold item** with regular text\n- *Italic item* with regular text\n- \\`Code item\\` with regular text\n- Regular text with **bold**, *italic*, and \\`code\\`\n- Combination: **bold and *italic* text** together\n`;\n\nexport const Component = () => {\n return (\n <div className=\"max-w-4xl\">\n <Response>{listsMarkdown}</Response>\n </div>\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"response-lists.story.js","sourceRoot":"","sources":["../../../../../src/ai/response/stories/response-lists.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4IrB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,wEAAwE;IACxE,+CAA+C;IAC/C,MAAM,QAAQ,GAAG,aAAa,CAAC,UAAU,CACvC,6BAA6B,EAC7B,MAAM,CAAC,QAAQ,CAAC,MAAM,CACvB,CAAC;IACF,OAAO,CACL,cAAK,SAAS,EAAC,WAAW,YACxB,KAAC,QAAQ,cAAE,QAAQ,GAAY,GAC3B,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 */\nimport { Response } from '@neo4j-ndl/react/ai';\n\nconst listsMarkdown = `\n# Lists Examples\n\n## Simple Unordered List\n\n- Apple\n- Banana\n- Cherry\n- Date\n- Elderberry\n\n## Simple Ordered List\n\n1. First step\n2. Second step\n3. Third step\n4. Fourth step\n5. Fifth step\n\n## Nested Unordered Lists\n\n- Fruits\n - Apples\n - Granny Smith\n - Honeycrisp\n - Fuji\n - Oranges\n - Navel\n - Blood Orange\n - Berries\n - Strawberry\n - Blueberry\n - Raspberry\n- Vegetables\n - Leafy Greens\n - Spinach\n - Kale\n - Root Vegetables\n - Carrot\n - Potato\n\n## Nested Ordered Lists\n\n1. Introduction\n 1. Overview\n 2. Purpose\n 3. Scope\n2. Main Content\n 1. Chapter 1\n 1. Section 1.1\n 2. Section 1.2\n 3. Section 1.3\n 2. Chapter 2\n 1. Section 2.1\n 2. Section 2.2\n3. Conclusion\n 1. Summary\n 2. Recommendations\n\n## Mixed Lists\n\n1. Install dependencies\n - Node.js\n - npm or yarn\n - Git\n2. Clone repository\n - \\`git clone <url>\\`\n - \\`cd project-name\\`\n3. Configure settings\n 1. Copy \\`.env.example\\` to \\`.env\\`\n 2. Update configuration values:\n - Database URL\n - API keys\n - Port number\n4. Start development server\n - Run \\`npm install\\`\n - Run \\`npm start\\`\n\n## Lists with Paragraphs\n\n- **First Item**\n \n This is a detailed explanation of the first item. It can contain multiple sentences and provide context.\n\n- **Second Item**\n \n The second item also has a detailed explanation. This helps provide more information to the reader.\n\n- **Third Item**\n \n Each item can have as much detail as needed.\n\n## Lists with Code\n\n- JavaScript example:\n \n \\`\\`\\`javascript\n const items = ['a', 'b', 'c'];\n items.forEach(item => console.log(item));\n \\`\\`\\`\n\n- Python example:\n \n \\`\\`\\`python\n items = ['a', 'b', 'c']\n for item in items:\n print(item)\n \\`\\`\\`\n\n## Task Lists Representation\n\n- [x] Complete feature A\n- [x] Write tests\n- [ ] Review code\n- [ ] Deploy to production\n- [ ] Monitor metrics\n\n## Lists with Links\n\n1. Official Resources\n - [Neo4j Documentation](https://neo4j.com/docs)\n - [Neo4j Community](https://community.neo4j.com)\n - [Neo4j GitHub](https://github.com/neo4j)\n2. Tutorials\n - [Getting Started Guide](https://neo4j.com/start)\n - [Cypher Query Language](https://neo4j.com/cypher)\n3. Tools\n - Neo4j Desktop\n - Neo4j Browser\n - Neo4j Bloom\n4. Needle\n - [Needle](https://needle.neo4j.design)\n\n## Lists with Inline Formatting\n\n- **Bold item** with regular text\n- *Italic item* with regular text\n- \\`Code item\\` with regular text\n- Regular text with **bold**, *italic*, and \\`code\\`\n- Combination: **bold and *italic* text** together\n`;\n\nexport const Component = () => {\n // Keep the live example on the current origin so it renders as internal\n // both locally and on the published Storybook.\n const markdown = listsMarkdown.replaceAll(\n 'https://needle.neo4j.design',\n window.location.origin,\n );\n return (\n <div className=\"max-w-4xl\">\n <Response>{markdown}</Response>\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /*!
3
3
  *
4
4
  * Copyright (c) "Neo4j"
@@ -20,9 +20,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
20
20
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
21
  */
22
22
  import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
- import { FilledButton } from '@neo4j-ndl/react';
23
+ import { FilledButton, OutlinedButton, TextButton } from '@neo4j-ndl/react';
24
24
  const Component = () => {
25
- return _jsx(FilledButton, { isDisabled: true, children: "Disabled" });
25
+ return (_jsxs("div", { className: "flex flex-row gap-token-8", children: [_jsx(FilledButton, { isDisabled: true, children: "Filled" }), _jsx(OutlinedButton, { isDisabled: true, children: "Outlined" }), _jsx(TextButton, { isDisabled: true, children: "Text" })] }));
26
26
  };
27
27
  export default Component;
28
28
  //# sourceMappingURL=button-disabled.story.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"button-disabled.story.js","sourceRoot":"","sources":["../../../../src/button/stories/button-disabled.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,KAAC,YAAY,IAAC,UAAU,+BAAwB,CAAC;AAC1D,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';\n\nconst Component = () => {\n return <FilledButton isDisabled>Disabled</FilledButton>;\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"button-disabled.story.js","sourceRoot":"","sources":["../../../../src/button/stories/button-disabled.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE5E,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,eAAK,SAAS,EAAC,2BAA2B,aACxC,KAAC,YAAY,IAAC,UAAU,6BAAsB,EAC9C,KAAC,cAAc,IAAC,UAAU,+BAA0B,EACpD,KAAC,UAAU,IAAC,UAAU,2BAAkB,IACpC,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, OutlinedButton, TextButton } from '@neo4j-ndl/react';\n\nconst Component = () => {\n return (\n <div className=\"flex flex-row gap-token-8\">\n <FilledButton isDisabled>Filled</FilledButton>\n <OutlinedButton isDisabled>Outlined</OutlinedButton>\n <TextButton isDisabled>Text</TextButton>\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /*!
3
3
  *
4
4
  * Copyright (c) "Neo4j"
@@ -20,9 +20,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
20
20
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
21
  */
22
22
  import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
- import { FilledButton } from '@neo4j-ndl/react';
23
+ import { FilledButton, OutlinedButton } from '@neo4j-ndl/react';
24
24
  const Component = () => {
25
- return _jsx(FilledButton, { isFloating: true, children: "Floating" });
25
+ return (_jsxs("div", { className: "flex flex-row gap-token-8", children: [_jsx(FilledButton, { isFloating: true, children: "Filled" }), _jsx(OutlinedButton, { isFloating: true, children: "Outlined" })] }));
26
26
  };
27
27
  export default Component;
28
28
  //# sourceMappingURL=button-floating.story.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"button-floating.story.js","sourceRoot":"","sources":["../../../../src/button/stories/button-floating.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,KAAC,YAAY,IAAC,UAAU,+BAAwB,CAAC;AAC1D,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';\n\nconst Component = () => {\n return <FilledButton isFloating>Floating</FilledButton>;\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"button-floating.story.js","sourceRoot":"","sources":["../../../../src/button/stories/button-floating.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEhE,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,eAAK,SAAS,EAAC,2BAA2B,aACxC,KAAC,YAAY,IAAC,UAAU,6BAAsB,EAC9C,KAAC,cAAc,IAAC,UAAU,+BAA0B,IAChD,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, OutlinedButton } from '@neo4j-ndl/react';\n\nconst Component = () => {\n return (\n <div className=\"flex flex-row gap-token-8\">\n <FilledButton isFloating>Filled</FilledButton>\n <OutlinedButton isFloating>Outlined</OutlinedButton>\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /*!
3
3
  *
4
4
  * Copyright (c) "Neo4j"
@@ -20,9 +20,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
20
20
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
21
  */
22
22
  import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
- import { FilledButton } from '@neo4j-ndl/react';
23
+ import { FilledButton, OutlinedButton, TextButton } from '@neo4j-ndl/react';
24
24
  const Component = () => {
25
- return _jsx(FilledButton, { isFluid: true, children: "Fluid width" });
25
+ return (_jsxs("div", { className: "flex flex-col gap-token-8", children: [_jsx(FilledButton, { isFluid: true, children: "Filled" }), _jsx(OutlinedButton, { isFluid: true, children: "Outlined" }), _jsx(TextButton, { isFluid: true, children: "Text" })] }));
26
26
  };
27
27
  export default Component;
28
28
  //# sourceMappingURL=button-fluid.story.js.map