@neo4j-ndl/react 4.14.4 → 4.14.6
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.
- package/lib/cjs/ai/preview/Preview.js +5 -0
- package/lib/cjs/ai/preview/Preview.js.map +1 -1
- package/lib/cjs/ai/preview/stories/index.js +9 -1
- package/lib/cjs/ai/preview/stories/index.js.map +1 -1
- package/lib/cjs/ai/preview/stories/preview-simple-with-content.story.js +34 -0
- package/lib/cjs/ai/preview/stories/preview-simple-with-content.story.js.map +1 -0
- package/lib/cjs/ai/preview/stories/preview-simple.story.js +33 -0
- package/lib/cjs/ai/preview/stories/preview-simple.story.js.map +1 -0
- package/lib/cjs/ai/prompt/Prompt.js +4 -14
- package/lib/cjs/ai/prompt/Prompt.js.map +1 -1
- package/lib/cjs/ai/prompt/stories/index.js +5 -1
- package/lib/cjs/ai/prompt/stories/index.js.map +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-header.story.js +39 -0
- package/lib/cjs/ai/prompt/stories/prompt-header.story.js.map +1 -0
- package/lib/cjs/ai/response/Response.js +23 -22
- package/lib/cjs/ai/response/Response.js.map +1 -1
- package/lib/cjs/ai/response/stories/response-all-components.story.js +2 -0
- package/lib/cjs/ai/response/stories/response-all-components.story.js.map +1 -1
- package/lib/cjs/date-picker/DatePicker.js +12 -7
- package/lib/cjs/date-picker/DatePicker.js.map +1 -1
- package/lib/cjs/date-picker/stories/date-picker-clearable.story.js +47 -0
- package/lib/cjs/date-picker/stories/date-picker-clearable.story.js.map +1 -0
- package/lib/cjs/date-picker/stories/index.js +5 -1
- package/lib/cjs/date-picker/stories/index.js.map +1 -1
- package/lib/esm/ai/preview/Preview.js +5 -0
- package/lib/esm/ai/preview/Preview.js.map +1 -1
- package/lib/esm/ai/preview/stories/index.js +6 -0
- package/lib/esm/ai/preview/stories/index.js.map +1 -1
- package/lib/esm/ai/preview/stories/preview-simple-with-content.story.js +32 -0
- package/lib/esm/ai/preview/stories/preview-simple-with-content.story.js.map +1 -0
- package/lib/esm/ai/preview/stories/preview-simple.story.js +31 -0
- package/lib/esm/ai/preview/stories/preview-simple.story.js.map +1 -0
- package/lib/esm/ai/prompt/Prompt.js +6 -16
- package/lib/esm/ai/prompt/Prompt.js.map +1 -1
- package/lib/esm/ai/prompt/stories/index.js +3 -0
- package/lib/esm/ai/prompt/stories/index.js.map +1 -1
- package/lib/esm/ai/prompt/stories/prompt-advanced.story.js +1 -1
- package/lib/esm/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
- package/lib/esm/ai/prompt/stories/prompt-header.story.js +37 -0
- package/lib/esm/ai/prompt/stories/prompt-header.story.js.map +1 -0
- package/lib/esm/ai/response/Response.js +23 -22
- package/lib/esm/ai/response/Response.js.map +1 -1
- package/lib/esm/ai/response/stories/response-all-components.story.js +2 -0
- package/lib/esm/ai/response/stories/response-all-components.story.js.map +1 -1
- package/lib/esm/date-picker/DatePicker.js +12 -7
- package/lib/esm/date-picker/DatePicker.js.map +1 -1
- package/lib/esm/date-picker/stories/date-picker-clearable.story.js +43 -0
- package/lib/esm/date-picker/stories/date-picker-clearable.story.js.map +1 -0
- package/lib/esm/date-picker/stories/index.js +3 -0
- package/lib/esm/date-picker/stories/index.js.map +1 -1
- package/lib/types/ai/preview/Preview.d.ts +4 -0
- package/lib/types/ai/preview/Preview.d.ts.map +1 -1
- package/lib/types/ai/preview/stories/index.d.ts +4 -0
- package/lib/types/ai/preview/stories/index.d.ts.map +1 -1
- package/lib/types/ai/preview/stories/preview-simple-with-content.story.d.ts +24 -0
- package/lib/types/ai/preview/stories/preview-simple-with-content.story.d.ts.map +1 -0
- package/lib/types/ai/preview/stories/preview-simple.story.d.ts +24 -0
- package/lib/types/ai/preview/stories/preview-simple.story.d.ts.map +1 -0
- package/lib/types/ai/prompt/Prompt.d.ts +6 -2
- package/lib/types/ai/prompt/Prompt.d.ts.map +1 -1
- package/lib/types/ai/prompt/stories/index.d.ts +2 -0
- package/lib/types/ai/prompt/stories/index.d.ts.map +1 -1
- package/lib/types/ai/prompt/stories/prompt-advanced.story.d.ts.map +1 -1
- package/lib/types/{_common/component-docs-page.d.ts → ai/prompt/stories/prompt-header.story.d.ts} +4 -3
- package/lib/types/ai/prompt/stories/prompt-header.story.d.ts.map +1 -0
- package/lib/types/ai/response/Response.d.ts.map +1 -1
- package/lib/types/ai/response/stories/response-all-components.story.d.ts.map +1 -1
- package/lib/types/date-picker/DatePicker.d.ts +6 -1
- package/lib/types/date-picker/DatePicker.d.ts.map +1 -1
- package/lib/types/date-picker/stories/date-picker-clearable.story.d.ts +24 -0
- package/lib/types/date-picker/stories/date-picker-clearable.story.d.ts.map +1 -0
- package/lib/types/date-picker/stories/index.d.ts +2 -0
- package/lib/types/date-picker/stories/index.d.ts.map +1 -1
- package/package.json +3 -2
- package/lib/cjs/_common/component-docs-page.js +0 -72
- package/lib/cjs/_common/component-docs-page.js.map +0 -1
- package/lib/esm/_common/component-docs-page.js +0 -69
- package/lib/esm/_common/component-docs-page.js.map +0 -1
- package/lib/types/_common/component-docs-page.d.ts.map +0 -1
|
@@ -30,6 +30,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
30
30
|
* You should have received a copy of the GNU General Public License
|
|
31
31
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
32
32
|
*/
|
|
33
|
+
// oxlint-disable sort-keys
|
|
33
34
|
import { Code, TextLink, Typography } from '@neo4j-ndl/react';
|
|
34
35
|
import classNames from 'classnames';
|
|
35
36
|
import { memo, useMemo, useRef } from 'react';
|
|
@@ -51,32 +52,32 @@ const Response = memo((_a) => {
|
|
|
51
52
|
const components = useMemo(() => ({
|
|
52
53
|
// oxlint-disable-next-line no-unused-vars
|
|
53
54
|
ol: (_a) => {
|
|
54
|
-
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
55
|
+
var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
|
|
55
56
|
return (_jsx("ol", Object.assign({ className: className }, props, { children: children })));
|
|
56
57
|
},
|
|
57
58
|
// oxlint-disable-next-line no-unused-vars
|
|
58
59
|
ul: (_a) => {
|
|
59
|
-
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
60
|
+
var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
|
|
60
61
|
return (_jsx("ul", Object.assign({ className: classNames(className) }, props, { children: children })));
|
|
61
62
|
},
|
|
62
63
|
// oxlint-disable-next-line no-unused-vars
|
|
63
64
|
li: (_a) => {
|
|
64
|
-
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
65
|
+
var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
|
|
65
66
|
return (_jsx("li", Object.assign({ className: className }, props, { children: children })));
|
|
66
67
|
},
|
|
67
68
|
// oxlint-disable-next-line no-unused-vars
|
|
68
69
|
hr: (_a) => {
|
|
69
|
-
var { node, className } = _a, props = __rest(_a, ["node", "className"]);
|
|
70
|
+
var { node, className, ref: _ref } = _a, props = __rest(_a, ["node", "className", "ref"]);
|
|
70
71
|
return (_jsx("hr", Object.assign({ className: classNames(className) }, props)));
|
|
71
72
|
},
|
|
72
73
|
// oxlint-disable-next-line no-unused-vars
|
|
73
74
|
strong: (_a) => {
|
|
74
|
-
var { node, children, className, style } = _a, props = __rest(_a, ["node", "children", "className", "style"]);
|
|
75
|
+
var { node: _node, children, className, style, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "style", "ref"]);
|
|
75
76
|
return (_jsx(Typography, Object.assign({ as: "strong", variant: "body-medium", className: className, style: Object.assign(Object.assign({}, style), { fontWeight: 'bold' }) }, props, { children: children })));
|
|
76
77
|
},
|
|
77
78
|
// oxlint-disable-next-line no-unused-vars
|
|
78
79
|
em: (_a) => {
|
|
79
|
-
var { node, children, className, style } = _a, props = __rest(_a, ["node", "children", "className", "style"]);
|
|
80
|
+
var { node, children, className, style, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "style", "ref"]);
|
|
80
81
|
return (_jsx(Typography, Object.assign({ as: "em", variant: "body-medium", className: className, style: Object.assign(Object.assign({}, style), { fontStyle: 'italic' }) }, props, { children: children })));
|
|
81
82
|
},
|
|
82
83
|
// oxlint-disable-next-line no-unused-vars
|
|
@@ -87,66 +88,66 @@ const Response = memo((_a) => {
|
|
|
87
88
|
// oxlint-disable-next-line no-unused-vars
|
|
88
89
|
h1: (_a) => {
|
|
89
90
|
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
90
|
-
return (_jsx(
|
|
91
|
+
return (_jsx("h1", Object.assign({ className: className }, props, { children: children })));
|
|
91
92
|
},
|
|
92
93
|
// oxlint-disable-next-line no-unused-vars
|
|
93
94
|
h2: (_a) => {
|
|
94
95
|
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
95
|
-
return (_jsx(
|
|
96
|
+
return (_jsx("h2", Object.assign({ className: className }, props, { children: children })));
|
|
96
97
|
},
|
|
97
98
|
// oxlint-disable-next-line no-unused-vars
|
|
98
99
|
h3: (_a) => {
|
|
99
100
|
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
100
|
-
return (_jsx(
|
|
101
|
+
return (_jsx("h3", Object.assign({ className: className }, props, { children: children })));
|
|
101
102
|
},
|
|
102
103
|
// oxlint-disable-next-line no-unused-vars
|
|
103
104
|
h4: (_a) => {
|
|
104
105
|
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
105
|
-
return (_jsx(
|
|
106
|
+
return (_jsx("h4", Object.assign({ className: className }, props, { children: children })));
|
|
106
107
|
},
|
|
107
108
|
// oxlint-disable-next-line no-unused-vars
|
|
108
109
|
h5: (_a) => {
|
|
109
110
|
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
110
|
-
return (_jsx(
|
|
111
|
+
return (_jsx("h5", Object.assign({ className: className }, props, { children: children })));
|
|
111
112
|
},
|
|
112
113
|
// oxlint-disable-next-line no-unused-vars
|
|
113
114
|
h6: (_a) => {
|
|
114
115
|
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
115
|
-
return (_jsx(
|
|
116
|
+
return (_jsx("h6", Object.assign({ className: className }, props, { children: children })));
|
|
116
117
|
},
|
|
117
118
|
// oxlint-disable-next-line no-unused-vars
|
|
118
119
|
table: (_a) => {
|
|
119
|
-
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
120
|
+
var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
|
|
120
121
|
return (_jsx("div", { className: "ndl-ai-response-table-wrapper", children: _jsx("table", Object.assign({ className: className }, props, { children: children })) }));
|
|
121
122
|
},
|
|
122
123
|
// oxlint-disable-next-line no-unused-vars
|
|
123
124
|
thead: (_a) => {
|
|
124
|
-
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
125
|
+
var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
|
|
125
126
|
return (_jsx("thead", Object.assign({ className: className }, props, { children: children })));
|
|
126
127
|
},
|
|
127
128
|
// oxlint-disable-next-line no-unused-vars
|
|
128
129
|
tbody: (_a) => {
|
|
129
|
-
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
130
|
+
var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
|
|
130
131
|
return (_jsx("tbody", Object.assign({ className: className }, props, { children: children })));
|
|
131
132
|
},
|
|
132
133
|
// oxlint-disable-next-line no-unused-vars
|
|
133
134
|
tr: (_a) => {
|
|
134
|
-
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
135
|
+
var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
|
|
135
136
|
return (_jsx("tr", Object.assign({ className: className }, props, { children: children })));
|
|
136
137
|
},
|
|
137
138
|
// oxlint-disable-next-line no-unused-vars
|
|
138
139
|
th: (_a) => {
|
|
139
|
-
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
140
|
+
var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
|
|
140
141
|
return (_jsx("th", Object.assign({ className: className }, props, { children: children })));
|
|
141
142
|
},
|
|
142
143
|
// oxlint-disable-next-line no-unused-vars
|
|
143
144
|
td: (_a) => {
|
|
144
|
-
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
145
|
+
var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
|
|
145
146
|
return (_jsx("td", Object.assign({ className: className }, props, { children: children })));
|
|
146
147
|
},
|
|
147
148
|
// oxlint-disable-next-line no-unused-vars
|
|
148
149
|
blockquote: (_a) => {
|
|
149
|
-
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
150
|
+
var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
|
|
150
151
|
return (_jsx("blockquote", Object.assign({ className: classNames(className) }, props, { children: children })));
|
|
151
152
|
},
|
|
152
153
|
code: (_a) => {
|
|
@@ -189,17 +190,17 @@ const Response = memo((_a) => {
|
|
|
189
190
|
},
|
|
190
191
|
// oxlint-disable-next-line no-unused-vars
|
|
191
192
|
pre: (_a) => {
|
|
192
|
-
var { node, className, children } = _a, props = __rest(_a, ["node", "className", "children"]);
|
|
193
|
+
var { node, className, children, ref: _ref } = _a, props = __rest(_a, ["node", "className", "children", "ref"]);
|
|
193
194
|
return (_jsx("pre", Object.assign({ className: className }, props, { children: children })));
|
|
194
195
|
},
|
|
195
196
|
// oxlint-disable-next-line no-unused-vars
|
|
196
197
|
p: (_a) => {
|
|
197
|
-
var { node, children, className } = _a, props = __rest(_a, ["node", "children", "className"]);
|
|
198
|
+
var { node, children, className, ref: _ref } = _a, props = __rest(_a, ["node", "children", "className", "ref"]);
|
|
198
199
|
return (_jsx(Typography, Object.assign({ as: "p", variant: "body-medium", className: classNames(className) }, props, { children: children })));
|
|
199
200
|
},
|
|
200
201
|
// oxlint-disable-next-line no-unused-vars
|
|
201
202
|
img: (_a) => {
|
|
202
|
-
var { node, className, src, alt } = _a, props = __rest(_a, ["node", "className", "src", "alt"]);
|
|
203
|
+
var { node, className, src, alt, ref: _ref } = _a, props = __rest(_a, ["node", "className", "src", "alt", "ref"]);
|
|
203
204
|
return (_jsx("img", Object.assign({ className: classNames(className), src: src, alt: alt }, props)));
|
|
204
205
|
},
|
|
205
206
|
}), []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Response.js","sourceRoot":"","sources":["../../../../src/ai/response/Response.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,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,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,OAAO,EAAqB,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAS9C;;;;;GAKG;AACH,MAAM,QAAQ,GAAG,IAAI,CACnB,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,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,WAAW,C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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,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;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\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,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,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,OAAO,EAAqB,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAS9C;;;;;GAKG;AACH,MAAM,QAAQ,GAAG,IAAI,CACnB,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,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IAE/B,MAAM,UAAU,GACd,OAAO,CACL,GAAG,EAAE,CAAC,CAAC;QACL,0CAA0C;QAC1C,EAAE,EAAE,CAAC,EAAkD,EAAE,EAAE;gBAAtD,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,IA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AS,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 { 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"]}
|
|
@@ -52,6 +52,7 @@ Combine them: **bold and *italic* together**.
|
|
|
52
52
|
- Nested item 1
|
|
53
53
|
- Nested item 2
|
|
54
54
|
- Deeply nested item
|
|
55
|
+
- <h1>Nested nested heading</h1>
|
|
55
56
|
|
|
56
57
|
### Ordered Lists
|
|
57
58
|
|
|
@@ -60,6 +61,7 @@ Combine them: **bold and *italic* together**.
|
|
|
60
61
|
3. Third item
|
|
61
62
|
1. Nested numbered item
|
|
62
63
|
2. Another nested item
|
|
64
|
+
3. <h2>Nested nested heading</h2>
|
|
63
65
|
|
|
64
66
|
## Code
|
|
65
67
|
|
|
@@ -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
|
|
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\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"]}
|
|
@@ -49,16 +49,21 @@ import { daysInMonth, getYearsPeriodString } from './utils';
|
|
|
49
49
|
// into the custom input component on root level, since we use htmlAttributes
|
|
50
50
|
// we need to help spread them there instead of the root level
|
|
51
51
|
const DatePickerTextInputWrapper = (_a) => {
|
|
52
|
-
var { textInputProps, isDisabled, value, placeholder } = _a, restProps = __rest(_a, ["textInputProps", "isDisabled", "value", "placeholder"]);
|
|
52
|
+
var { textInputProps, isDisabled, isClearable, value, placeholder } = _a, restProps = __rest(_a, ["textInputProps", "isDisabled", "isClearable", "value", "placeholder"]);
|
|
53
53
|
// deconstruct textInputProps to avoid bugs with react-datepicker injecting props
|
|
54
|
-
const _b = textInputProps !== null && textInputProps !== void 0 ? textInputProps : {}, { placeholder: textInputPlaceholder, htmlAttributes: textInputHtmlAttributes, ref } = _b, restTextInputProps = __rest(_b, ["placeholder", "htmlAttributes", "ref"]);
|
|
55
|
-
|
|
54
|
+
const _b = textInputProps !== null && textInputProps !== void 0 ? textInputProps : {}, { placeholder: textInputPlaceholder, htmlAttributes: textInputHtmlAttributes, onChange: textInputOnChange, ref } = _b, restTextInputProps = __rest(_b, ["placeholder", "htmlAttributes", "onChange", "ref"]);
|
|
55
|
+
const { onChange: injectedOnChange } = restProps, restInjectedProps = __rest(restProps, ["onChange"]);
|
|
56
|
+
const handleChange = (event) => {
|
|
57
|
+
injectedOnChange === null || injectedOnChange === void 0 ? void 0 : injectedOnChange(event);
|
|
58
|
+
textInputOnChange === null || textInputOnChange === void 0 ? void 0 : textInputOnChange(event);
|
|
59
|
+
};
|
|
60
|
+
return (_jsx(TextInput, Object.assign({ ref: ref, trailingElement: _jsx(CalendarDaysIconOutline, {}), value: value, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : textInputPlaceholder, isDisabled: isDisabled, isClearable: isClearable, onChange: handleChange,
|
|
56
61
|
// react-datepicker injects html attributes into the custom input
|
|
57
|
-
htmlAttributes: Object.assign(Object.assign({}, textInputHtmlAttributes),
|
|
62
|
+
htmlAttributes: Object.assign(Object.assign({}, textInputHtmlAttributes), restInjectedProps) }, restTextInputProps)));
|
|
58
63
|
};
|
|
59
64
|
export const DatePicker = (_a) => {
|
|
60
65
|
var _b;
|
|
61
|
-
var { reactDatePickerProps, textInputProps, timePickerProps, timeZonePickerProps, isDisabled, ref, className, style, htmlAttributes } = _a, restProps = __rest(_a, ["reactDatePickerProps", "textInputProps", "timePickerProps", "timeZonePickerProps", "isDisabled", "ref", "className", "style", "htmlAttributes"]);
|
|
66
|
+
var { reactDatePickerProps, textInputProps, timePickerProps, timeZonePickerProps, isDisabled, isClearable = false, ref, className, style, htmlAttributes } = _a, restProps = __rest(_a, ["reactDatePickerProps", "textInputProps", "timePickerProps", "timeZonePickerProps", "isDisabled", "isClearable", "ref", "className", "style", "htmlAttributes"]);
|
|
62
67
|
const classes = classNames(`ndl-datepicker`, className, {});
|
|
63
68
|
const datetimeRef = useRef(null);
|
|
64
69
|
const [picker, setPicker] = useState('day');
|
|
@@ -179,8 +184,8 @@ export const DatePicker = (_a) => {
|
|
|
179
184
|
(_a = reactDatePickerProps === null || reactDatePickerProps === void 0 ? void 0 : reactDatePickerProps.onChangeRaw) === null || _a === void 0 ? void 0 : _a.call(reactDatePickerProps, event);
|
|
180
185
|
}, [reactDatePickerProps]);
|
|
181
186
|
const datePickerProps = Object.assign(Object.assign({}, reactDatePickerProps), { onCalendarClose: interceptedOnCalendarClose, onChange: interceptedChange, onChangeRaw: interceptedOnChangeRaw, onMonthChange: handleMonthChange });
|
|
182
|
-
return (_jsx("div", Object.assign({ className: classes, ref: ref, style: style }, restProps, htmlAttributes, { children: _jsx(ReactDatePicker, Object.assign({ ref: datetimeRef, customInput: _jsx(DatePickerTextInputWrapper, { isDisabled: isDisabled, textInputProps: textInputProps }), customTimeInput: _jsxs("span", { className: "ndl-time-picker-wrapper", children: [_jsx(Divider, {}), _jsx(TimePicker, Object.assign({ isFluid: true, value: preSelectedDate
|
|
187
|
+
return (_jsx("div", Object.assign({ className: classes, ref: ref, style: style }, restProps, htmlAttributes, { children: _jsx(ReactDatePicker, Object.assign({ ref: datetimeRef, customInput: _jsx(DatePickerTextInputWrapper, { isDisabled: isDisabled, isClearable: isClearable, textInputProps: textInputProps }), customTimeInput: _jsxs("span", { className: "ndl-time-picker-wrapper", children: [_jsx(Divider, {}), _jsx(TimePicker, Object.assign({ isFluid: true, value: preSelectedDate
|
|
183
188
|
? new NeedleTime(preSelectedDate.getHours(), preSelectedDate.getMinutes())
|
|
184
|
-
: undefined, onChange: handleTimeChange }, timePickerProps, { floatingStrategy: "absolute", isPortaled: false })), timeZonePickerProps && (_jsx(TimeZonePicker, Object.assign({ isFluid: true, value: selectedTimeZone, onChange: handleTimeZoneChange, referenceDate: preSelectedDate || undefined }, timeZonePickerProps, { floatingStrategy: "absolute", isPortaled: false })))] }), disabled: isDisabled, showPopperArrow: false, showMonthYearPicker: picker === 'month', showYearPicker: picker === 'year', shouldCloseOnSelect: picker === 'day' && !((_b = reactDatePickerProps.showTimeInput) !== null && _b !== void 0 ? _b : false), dayClassName: () => 'ndl-datepicker-day', renderCustomHeader: CustomHeader }, datePickerProps, { popperClassName: classNames('ndl-datepicker-popper', reactDatePickerProps.popperClassName), popperProps: Object.assign({ strategy: isInsideDialog ? 'fixed' : 'absolute' }, reactDatePickerProps.popperProps) })) })));
|
|
189
|
+
: undefined, onChange: handleTimeChange }, timePickerProps, { floatingStrategy: "absolute", isPortaled: false })), timeZonePickerProps && (_jsx(TimeZonePicker, Object.assign({ isFluid: true, value: selectedTimeZone, onChange: handleTimeZoneChange, referenceDate: preSelectedDate || undefined }, timeZonePickerProps, { floatingStrategy: "absolute", isPortaled: false })))] }), disabled: isDisabled, showPopperArrow: false, showMonthYearPicker: picker === 'month', showYearPicker: picker === 'year', shouldCloseOnSelect: picker === 'day' && !((_b = reactDatePickerProps.showTimeInput) !== null && _b !== void 0 ? _b : false), dayClassName: () => 'ndl-datepicker-day', renderCustomHeader: CustomHeader }, datePickerProps, { isClearable: isClearable, popperClassName: classNames('ndl-datepicker-popper', reactDatePickerProps.popperClassName), popperProps: Object.assign({ strategy: isInsideDialog ? 'fixed' : 'absolute' }, reactDatePickerProps.popperProps) })) })));
|
|
185
190
|
};
|
|
186
191
|
//# sourceMappingURL=DatePicker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../src/date-picker/DatePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAiC;AACjC,yDAAyD;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,eAEN,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAwB,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAS5D,2EAA2E;AAC3E,6EAA6E;AAC7E,8DAA8D;AAC9D,MAA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AAQ,EAAE,oBAAoB,EAC9B,aAAa,EAAE,eAAe,IAAI,SAAS,IACvC,mBAAmB,IACvB,gBAAgB,EAAC,UAAU,EAC3B,UAAU,EAAE,KAAK,IACjB,CACH,IACI,EAET,QAAQ,EAAE,UAAU,EACpB,eAAe,EAAE,KAAK,EACtB,mBAAmB,EAAE,MAAM,KAAK,OAAO,EACvC,cAAc,EAAE,MAAM,KAAK,MAAM,EACjC,mBAAmB,EACjB,MAAM,KAAK,KAAK,IAAI,CAAC,CAAC,MAAA,oBAAoB,CAAC,aAAa,mCAAI,KAAK,CAAC,EAEpE,YAAY,EAAE,GAAG,EAAE,CAAC,oBAAoB,EACxC,kBAAkB,EAAE,YAAY,IAC5B,eAAe,IACnB,eAAe,EAAE,UAAU,CACzB,uBAAuB,EACvB,oBAAoB,CAAC,eAAe,CACrC,EACD,WAAW,kBACT,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,IAC5C,oBAAoB,CAAC,WAAW,KAErC,IACE,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// TODO: try to fix as some point\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport { format } from 'date-fns';\nimport { useCallback, useRef, useState } from 'react';\nimport ReactDatePicker, {\n type ReactDatePickerCustomHeaderProps,\n} from 'react-datepicker';\n\nimport type { CommonProps, HtmlAttributes } from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { Divider } from '../divider';\nimport {\n ArrowLeftIconOutline,\n ArrowRightIconOutline,\n CalendarDaysIconOutline,\n ChevronDownIconOutline,\n} from '../icons';\nimport { TextInput } from '../text-input';\nimport { NeedleTime, TimePicker, type TimePickerProps } from '../time-picker';\nimport { TimeZonePicker } from '../timezone-picker';\nimport { Typography } from '../typography';\nimport { daysInMonth, getYearsPeriodString } from './utils';\n\ntype DatePickerTextInputWrapperProps = React.ComponentProps<'input'> & {\n textInputProps?: React.ComponentProps<typeof TextInput>;\n isDisabled?: boolean;\n value?: string;\n ariaLabel?: string;\n};\n\n// This wrapper is needed due to react-datepicker injecting html attributes\n// into the custom input component on root level, since we use htmlAttributes\n// we need to help spread them there instead of the root level\nconst DatePickerTextInputWrapper = ({\n textInputProps,\n isDisabled,\n value,\n placeholder,\n ...restProps\n}: DatePickerTextInputWrapperProps) => {\n // deconstruct textInputProps to avoid bugs with react-datepicker injecting props\n const {\n placeholder: textInputPlaceholder,\n htmlAttributes: textInputHtmlAttributes,\n ref,\n ...restTextInputProps\n } = textInputProps ?? {};\n\n return (\n <TextInput\n ref={ref}\n trailingElement={<CalendarDaysIconOutline />}\n value={value}\n placeholder={placeholder ?? textInputPlaceholder}\n isDisabled={isDisabled}\n // react-datepicker injects html attributes into the custom input\n htmlAttributes={{\n ...textInputHtmlAttributes,\n ...restProps,\n }}\n {...restTextInputProps}\n />\n );\n};\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype PickerType = 'day' | 'month' | 'year';\n\n// Define a more flexible type for onChange\ntype DatePickerChangeHandler = (\n date: Date | null | [Date | null, Date | null] | Date[],\n event?: React.SyntheticEvent | undefined,\n) => void;\n\ninterface DatePickerProps {\n /** Props for the embedded `TextInput` component. */\n textInputProps?: React.ComponentProps<typeof TextInput>;\n /** Whether the date picker is disabled. */\n isDisabled?: boolean;\n /** Props for the embedded `TimePicker` component. */\n timePickerProps?: TimePickerProps;\n /** Props for the embedded `TimeZonePicker` component. */\n timeZonePickerProps?: React.ComponentProps<typeof TimeZonePicker>;\n /** Props forwarded to underlying `react-datepicker` component. */\n reactDatePickerProps: React.ComponentProps<typeof ReactDatePicker>;\n /**\n * WARNING: these attributes do not apply to the underlying input element currently. This will be fixed in a future version.\n */\n htmlAttributes?: HtmlAttributes<'div'>;\n}\n\nexport const DatePicker = ({\n reactDatePickerProps,\n textInputProps,\n timePickerProps,\n timeZonePickerProps,\n isDisabled,\n ref,\n className,\n style,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', DatePickerProps>) => {\n const classes = classNames(`ndl-datepicker`, className, {});\n const datetimeRef = useRef<ReactDatePicker>(null);\n const [picker, setPicker] = useState<PickerType>('day');\n const [preSelectedDate, setPreSelectedDate] = useState<Date | null>(\n (reactDatePickerProps.selected as Date | null) ||\n (reactDatePickerProps.startDate as Date | null),\n );\n const [selectedTimeZone, setSelectedTimeZone] = useState<string | undefined>(\n timeZonePickerProps?.value,\n );\n\n const isInsideDialog = useIsInsideDialog();\n\n const headerAction = useCallback(\n (action: PickerType) => {\n setPicker(picker === action ? 'day' : action);\n },\n [picker],\n );\n\n const CustomHeader = useCallback(\n (props: ReactDatePickerCustomHeaderProps) => {\n const {\n decreaseMonth,\n increaseMonth,\n increaseYear,\n decreaseYear,\n nextMonthButtonDisabled,\n nextYearButtonDisabled,\n prevMonthButtonDisabled,\n prevYearButtonDisabled,\n } = props;\n\n const prevCallback = picker === 'year' ? decreaseYear : decreaseMonth;\n const nextCallback = picker === 'year' ? increaseYear : increaseMonth;\n const prevDisabled =\n picker === 'year' ? prevYearButtonDisabled : prevMonthButtonDisabled;\n const nextDisabled =\n picker === 'year' ? nextYearButtonDisabled : nextMonthButtonDisabled;\n\n return (\n <div className=\"ndl-datepicker-header\">\n <div className=\"ndl-datepicker-selects\">\n {picker !== 'year' && (\n <button\n type=\"button\"\n aria-label={`${picker === 'month' ? 'Close' : 'Open'} month picker`}\n aria-pressed={picker === 'month'}\n onClick={() => headerAction('month')}\n >\n <div className=\"n-flex n-items-center n-gap-token-4\">\n <Typography variant=\"subheading-small\">\n {format(props.date, 'MMM')}\n </Typography>\n <ChevronDownIconOutline\n className={classNames('ndl-datepicker-chevron', {\n 'n-rotate-180': picker === 'month',\n })}\n aria-label=\"Chevron icon\"\n />\n </div>\n </button>\n )}\n {picker !== 'month' && (\n <button\n type=\"button\"\n aria-label={`${picker === 'year' ? 'Close' : 'Open'} year picker`}\n onClick={() => headerAction('year')}\n >\n <div className=\"n-flex n-items-center n-gap-token-4\">\n <Typography variant=\"subheading-small\">\n {picker === 'year'\n ? getYearsPeriodString(\n props.date,\n reactDatePickerProps?.yearItemNumber,\n )\n : format(props.date, 'yyyy')}\n </Typography>\n <ChevronDownIconOutline\n className={classNames('ndl-datepicker-chevron', {\n 'n-rotate-180': picker === 'year',\n })}\n aria-label=\"Chevron icon\"\n />\n </div>\n </button>\n )}\n </div>\n {picker !== 'month' && (\n <div className=\"n-flex n-justify-center n-gap-token-16\">\n <CleanIconButton\n description={\n picker === 'year' ? 'Previous period' : 'Previous month'\n }\n onClick={prevCallback}\n isDisabled={prevDisabled}\n className=\"n-text-neutral-text-weak\"\n size=\"small\"\n >\n <ArrowLeftIconOutline />\n </CleanIconButton>\n <CleanIconButton\n description={picker === 'year' ? 'Next period' : 'Next month'}\n onClick={nextCallback}\n isDisabled={nextDisabled}\n className=\"n-text-neutral-text-weak\"\n size=\"small\"\n >\n <ArrowRightIconOutline />\n </CleanIconButton>\n </div>\n )}\n </div>\n );\n },\n [picker, headerAction, reactDatePickerProps?.yearItemNumber],\n );\n\n const handleTimeChange = (newTime: NeedleTime) => {\n if (\n reactDatePickerProps.selectsRange ||\n reactDatePickerProps.selectsMultiple\n ) {\n // this is consistent with the behavior of react-datepicker\n return;\n }\n\n if (!preSelectedDate) {\n return;\n }\n\n const newDate = new Date(preSelectedDate);\n newDate.setHours(newTime.hour, newTime.minute, 0, 0);\n setPreSelectedDate(newDate);\n\n if (reactDatePickerProps.onChange) {\n // For single date selection\n reactDatePickerProps.onChange(newDate, undefined);\n }\n };\n\n const handleTimeZoneChange = (timezone: string) => {\n setSelectedTimeZone(timezone);\n if (timeZonePickerProps?.onChange) {\n timeZonePickerProps.onChange(timezone);\n }\n };\n\n /**\n * Intercept onChange so we can work with\n * Month and Year pickers\n */\n const interceptedChange: DatePickerChangeHandler = useCallback(\n (\n date: Date | null | [Date | null, Date | null] | Date[],\n event?: React.SyntheticEvent,\n ) => {\n if (picker !== 'day') {\n // setTimeout to prevent picker change before the handleMonthChange logic\n setTimeout(() => {\n setPicker('day');\n });\n } else if (picker === 'day') {\n if (date instanceof Date) {\n setPreSelectedDate(date);\n } else if (\n Array.isArray(date) &&\n date.length > 0 &&\n date[0] instanceof Date\n ) {\n setPreSelectedDate(date[0]);\n } else if (date === null) {\n setPreSelectedDate(null);\n }\n\n if (reactDatePickerProps.onChange && date !== null) {\n (reactDatePickerProps.onChange as DatePickerChangeHandler)(\n date,\n event,\n );\n }\n }\n },\n [picker, reactDatePickerProps],\n );\n\n /**\n * Intercept onCalendarClose so we can\n * switch to \"day\" picker if we close on \"month\" or \"year\"\n * view\n */\n const interceptedOnCalendarClose = useCallback(() => {\n if (picker !== 'day') {\n setPicker('day');\n }\n reactDatePickerProps?.onCalendarClose?.();\n }, [picker, reactDatePickerProps]);\n\n const handleMonthChange = useCallback(\n (date: Date) => {\n if (picker === 'month') {\n const selectedDay = preSelectedDate?.getDate() ?? 1;\n const daysInNewMonth = daysInMonth(date.getMonth(), date.getFullYear());\n date.setDate(Math.min(selectedDay, daysInNewMonth));\n reactDatePickerProps?.onMonthChange?.(date);\n } else if (picker === 'year') {\n const selectedDay = preSelectedDate?.getDate() ?? 1;\n const selectedMonth = preSelectedDate?.getMonth() ?? 0;\n const daysInNewMonth = daysInMonth(selectedMonth, date.getFullYear());\n date.setMonth(selectedMonth, Math.min(selectedDay, daysInNewMonth));\n reactDatePickerProps?.onMonthChange?.(date);\n }\n setPreSelectedDate(date);\n },\n [picker, preSelectedDate, reactDatePickerProps],\n );\n\n /**\n * Intercept onChangeRaw to handle clearing the input\n * When the user clears the text input, set the date to null\n */\n const interceptedOnChangeRaw = useCallback(\n (\n event?:\n | React.KeyboardEvent<HTMLElement>\n | React.MouseEvent<HTMLElement, MouseEvent>,\n ) => {\n const target = event?.target as HTMLInputElement | undefined;\n if (target?.value === '') {\n setPreSelectedDate(null);\n if (reactDatePickerProps.onChange) {\n (reactDatePickerProps.onChange as DatePickerChangeHandler)(\n null,\n event,\n );\n }\n }\n reactDatePickerProps?.onChangeRaw?.(event);\n },\n [reactDatePickerProps],\n );\n\n const datePickerProps = {\n ...reactDatePickerProps,\n onCalendarClose: interceptedOnCalendarClose,\n onChange: interceptedChange,\n onChangeRaw: interceptedOnChangeRaw,\n onMonthChange: handleMonthChange,\n };\n\n return (\n <div\n className={classes}\n ref={ref}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {/** TODO v5: Remove the div wrapper, type the component as an input, and apply all root props to the TextInput */}\n <ReactDatePicker\n ref={datetimeRef}\n customInput={\n <DatePickerTextInputWrapper\n isDisabled={isDisabled}\n textInputProps={textInputProps}\n />\n }\n customTimeInput={\n <span className=\"ndl-time-picker-wrapper\">\n <Divider />\n <TimePicker\n isFluid\n value={\n preSelectedDate\n ? new NeedleTime(\n preSelectedDate.getHours(),\n preSelectedDate.getMinutes(),\n )\n : undefined\n }\n onChange={handleTimeChange}\n {...timePickerProps}\n floatingStrategy=\"absolute\"\n isPortaled={false}\n />\n {timeZonePickerProps && (\n <TimeZonePicker\n isFluid\n value={selectedTimeZone}\n onChange={handleTimeZoneChange}\n referenceDate={preSelectedDate || undefined}\n {...timeZonePickerProps}\n floatingStrategy=\"absolute\"\n isPortaled={false}\n />\n )}\n </span>\n }\n disabled={isDisabled}\n showPopperArrow={false}\n showMonthYearPicker={picker === 'month'}\n showYearPicker={picker === 'year'}\n shouldCloseOnSelect={\n picker === 'day' && !(reactDatePickerProps.showTimeInput ?? false)\n }\n dayClassName={() => 'ndl-datepicker-day'}\n renderCustomHeader={CustomHeader}\n {...datePickerProps}\n popperClassName={classNames(\n 'ndl-datepicker-popper',\n reactDatePickerProps.popperClassName,\n )}\n popperProps={{\n strategy: isInsideDialog ? 'fixed' : 'absolute',\n ...reactDatePickerProps.popperProps,\n }}\n />\n </div>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../src/date-picker/DatePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAiC;AACjC,yDAAyD;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,eAEN,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAwB,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAU5D,2EAA2E;AAC3E,6EAA6E;AAC7E,8DAA8D;AAC9D,MAAM,0BAA0B,GAAG,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AE,cAAc,GAC9B,EAEJ,eAAe,EACb,gBAAM,SAAS,EAAC,yBAAyB,aACvC,KAAC,OAAO,KAAG,EACX,KAAC,UAAU,kBACT,OAAO,QACP,KAAK,EACH,eAAe;4BACb,CAAC,CAAC,IAAI,UAAU,CACZ,eAAe,CAAC,QAAQ,EAAE,EAC1B,eAAe,CAAC,UAAU,EAAE,CAC7B;4BACH,CAAC,CAAC,SAAS,EAEf,QAAQ,EAAE,gBAAgB,IACtB,eAAe,IACnB,gBAAgB,EAAC,UAAU,EAC3B,UAAU,EAAE,KAAK,IACjB,EACD,mBAAmB,IAAI,CACtB,KAAC,cAAc,kBACb,OAAO,QACP,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,oBAAoB,EAC9B,aAAa,EAAE,eAAe,IAAI,SAAS,IACvC,mBAAmB,IACvB,gBAAgB,EAAC,UAAU,EAC3B,UAAU,EAAE,KAAK,IACjB,CACH,IACI,EAET,QAAQ,EAAE,UAAU,EACpB,eAAe,EAAE,KAAK,EACtB,mBAAmB,EAAE,MAAM,KAAK,OAAO,EACvC,cAAc,EAAE,MAAM,KAAK,MAAM,EACjC,mBAAmB,EACjB,MAAM,KAAK,KAAK,IAAI,CAAC,CAAC,MAAA,oBAAoB,CAAC,aAAa,mCAAI,KAAK,CAAC,EAEpE,YAAY,EAAE,GAAG,EAAE,CAAC,oBAAoB,EACxC,kBAAkB,EAAE,YAAY,IAC5B,eAAe,IACnB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,UAAU,CACzB,uBAAuB,EACvB,oBAAoB,CAAC,eAAe,CACrC,EACD,WAAW,kBACT,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,IAC5C,oBAAoB,CAAC,WAAW,KAErC,IACE,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// TODO: try to fix as some point\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport { format } from 'date-fns';\nimport { useCallback, useRef, useState } from 'react';\nimport ReactDatePicker, {\n type ReactDatePickerCustomHeaderProps,\n} from 'react-datepicker';\n\nimport type { CommonProps, HtmlAttributes } from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { Divider } from '../divider';\nimport {\n ArrowLeftIconOutline,\n ArrowRightIconOutline,\n CalendarDaysIconOutline,\n ChevronDownIconOutline,\n} from '../icons';\nimport { TextInput } from '../text-input';\nimport { NeedleTime, TimePicker, type TimePickerProps } from '../time-picker';\nimport { TimeZonePicker } from '../timezone-picker';\nimport { Typography } from '../typography';\nimport { daysInMonth, getYearsPeriodString } from './utils';\n\ntype DatePickerTextInputWrapperProps = React.ComponentProps<'input'> & {\n textInputProps?: React.ComponentProps<typeof TextInput>;\n isDisabled?: boolean;\n isClearable?: boolean;\n value?: string;\n ariaLabel?: string;\n};\n\n// This wrapper is needed due to react-datepicker injecting html attributes\n// into the custom input component on root level, since we use htmlAttributes\n// we need to help spread them there instead of the root level\nconst DatePickerTextInputWrapper = ({\n textInputProps,\n isDisabled,\n isClearable,\n value,\n placeholder,\n ...restProps\n}: DatePickerTextInputWrapperProps) => {\n // deconstruct textInputProps to avoid bugs with react-datepicker injecting props\n const {\n placeholder: textInputPlaceholder,\n htmlAttributes: textInputHtmlAttributes,\n onChange: textInputOnChange,\n ref,\n ...restTextInputProps\n } = textInputProps ?? {};\n const { onChange: injectedOnChange, ...restInjectedProps } = restProps;\n\n const handleChange: React.ChangeEventHandler<HTMLInputElement> = (event) => {\n injectedOnChange?.(event);\n textInputOnChange?.(event);\n };\n\n return (\n <TextInput\n ref={ref}\n trailingElement={<CalendarDaysIconOutline />}\n value={value}\n placeholder={placeholder ?? textInputPlaceholder}\n isDisabled={isDisabled}\n isClearable={isClearable}\n onChange={handleChange}\n // react-datepicker injects html attributes into the custom input\n htmlAttributes={{\n ...textInputHtmlAttributes,\n ...restInjectedProps,\n }}\n {...restTextInputProps}\n />\n );\n};\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype PickerType = 'day' | 'month' | 'year';\n\n// Define a more flexible type for onChange\ntype DatePickerChangeHandler = (\n date: Date | null | [Date | null, Date | null] | Date[],\n event?: React.SyntheticEvent | undefined,\n) => void;\n\ninterface DatePickerProps {\n /** Props for the embedded `TextInput` component. */\n textInputProps?: React.ComponentProps<typeof TextInput>;\n /** Whether the date picker is disabled. */\n isDisabled?: boolean;\n /**\n * Whether to show the clear button.\n * @default false\n */\n isClearable?: boolean;\n /** Props for the embedded `TimePicker` component. */\n timePickerProps?: TimePickerProps;\n /** Props for the embedded `TimeZonePicker` component. */\n timeZonePickerProps?: React.ComponentProps<typeof TimeZonePicker>;\n /** Props forwarded to underlying `react-datepicker` component. */\n reactDatePickerProps: React.ComponentProps<typeof ReactDatePicker>;\n /**\n * WARNING: these attributes do not apply to the underlying input element currently. This will be fixed in a future version.\n */\n htmlAttributes?: HtmlAttributes<'div'>;\n}\n\nexport const DatePicker = ({\n reactDatePickerProps,\n textInputProps,\n timePickerProps,\n timeZonePickerProps,\n isDisabled,\n isClearable = false,\n ref,\n className,\n style,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', DatePickerProps>) => {\n const classes = classNames(`ndl-datepicker`, className, {});\n const datetimeRef = useRef<ReactDatePicker>(null);\n const [picker, setPicker] = useState<PickerType>('day');\n const [preSelectedDate, setPreSelectedDate] = useState<Date | null>(\n (reactDatePickerProps.selected as Date | null) ||\n (reactDatePickerProps.startDate as Date | null),\n );\n const [selectedTimeZone, setSelectedTimeZone] = useState<string | undefined>(\n timeZonePickerProps?.value,\n );\n\n const isInsideDialog = useIsInsideDialog();\n\n const headerAction = useCallback(\n (action: PickerType) => {\n setPicker(picker === action ? 'day' : action);\n },\n [picker],\n );\n\n const CustomHeader = useCallback(\n (props: ReactDatePickerCustomHeaderProps) => {\n const {\n decreaseMonth,\n increaseMonth,\n increaseYear,\n decreaseYear,\n nextMonthButtonDisabled,\n nextYearButtonDisabled,\n prevMonthButtonDisabled,\n prevYearButtonDisabled,\n } = props;\n\n const prevCallback = picker === 'year' ? decreaseYear : decreaseMonth;\n const nextCallback = picker === 'year' ? increaseYear : increaseMonth;\n const prevDisabled =\n picker === 'year' ? prevYearButtonDisabled : prevMonthButtonDisabled;\n const nextDisabled =\n picker === 'year' ? nextYearButtonDisabled : nextMonthButtonDisabled;\n\n return (\n <div className=\"ndl-datepicker-header\">\n <div className=\"ndl-datepicker-selects\">\n {picker !== 'year' && (\n <button\n type=\"button\"\n aria-label={`${picker === 'month' ? 'Close' : 'Open'} month picker`}\n aria-pressed={picker === 'month'}\n onClick={() => headerAction('month')}\n >\n <div className=\"n-flex n-items-center n-gap-token-4\">\n <Typography variant=\"subheading-small\">\n {format(props.date, 'MMM')}\n </Typography>\n <ChevronDownIconOutline\n className={classNames('ndl-datepicker-chevron', {\n 'n-rotate-180': picker === 'month',\n })}\n aria-label=\"Chevron icon\"\n />\n </div>\n </button>\n )}\n {picker !== 'month' && (\n <button\n type=\"button\"\n aria-label={`${picker === 'year' ? 'Close' : 'Open'} year picker`}\n onClick={() => headerAction('year')}\n >\n <div className=\"n-flex n-items-center n-gap-token-4\">\n <Typography variant=\"subheading-small\">\n {picker === 'year'\n ? getYearsPeriodString(\n props.date,\n reactDatePickerProps?.yearItemNumber,\n )\n : format(props.date, 'yyyy')}\n </Typography>\n <ChevronDownIconOutline\n className={classNames('ndl-datepicker-chevron', {\n 'n-rotate-180': picker === 'year',\n })}\n aria-label=\"Chevron icon\"\n />\n </div>\n </button>\n )}\n </div>\n {picker !== 'month' && (\n <div className=\"n-flex n-justify-center n-gap-token-16\">\n <CleanIconButton\n description={\n picker === 'year' ? 'Previous period' : 'Previous month'\n }\n onClick={prevCallback}\n isDisabled={prevDisabled}\n className=\"n-text-neutral-text-weak\"\n size=\"small\"\n >\n <ArrowLeftIconOutline />\n </CleanIconButton>\n <CleanIconButton\n description={picker === 'year' ? 'Next period' : 'Next month'}\n onClick={nextCallback}\n isDisabled={nextDisabled}\n className=\"n-text-neutral-text-weak\"\n size=\"small\"\n >\n <ArrowRightIconOutline />\n </CleanIconButton>\n </div>\n )}\n </div>\n );\n },\n [picker, headerAction, reactDatePickerProps?.yearItemNumber],\n );\n\n const handleTimeChange = (newTime: NeedleTime) => {\n if (\n reactDatePickerProps.selectsRange ||\n reactDatePickerProps.selectsMultiple\n ) {\n // this is consistent with the behavior of react-datepicker\n return;\n }\n\n if (!preSelectedDate) {\n return;\n }\n\n const newDate = new Date(preSelectedDate);\n newDate.setHours(newTime.hour, newTime.minute, 0, 0);\n setPreSelectedDate(newDate);\n\n if (reactDatePickerProps.onChange) {\n // For single date selection\n reactDatePickerProps.onChange(newDate, undefined);\n }\n };\n\n const handleTimeZoneChange = (timezone: string) => {\n setSelectedTimeZone(timezone);\n if (timeZonePickerProps?.onChange) {\n timeZonePickerProps.onChange(timezone);\n }\n };\n\n /**\n * Intercept onChange so we can work with\n * Month and Year pickers\n */\n const interceptedChange: DatePickerChangeHandler = useCallback(\n (\n date: Date | null | [Date | null, Date | null] | Date[],\n event?: React.SyntheticEvent,\n ) => {\n if (picker !== 'day') {\n // setTimeout to prevent picker change before the handleMonthChange logic\n setTimeout(() => {\n setPicker('day');\n });\n } else if (picker === 'day') {\n if (date instanceof Date) {\n setPreSelectedDate(date);\n } else if (\n Array.isArray(date) &&\n date.length > 0 &&\n date[0] instanceof Date\n ) {\n setPreSelectedDate(date[0]);\n } else if (date === null) {\n setPreSelectedDate(null);\n }\n\n if (reactDatePickerProps.onChange && date !== null) {\n (reactDatePickerProps.onChange as DatePickerChangeHandler)(\n date,\n event,\n );\n }\n }\n },\n [picker, reactDatePickerProps],\n );\n\n /**\n * Intercept onCalendarClose so we can\n * switch to \"day\" picker if we close on \"month\" or \"year\"\n * view\n */\n const interceptedOnCalendarClose = useCallback(() => {\n if (picker !== 'day') {\n setPicker('day');\n }\n reactDatePickerProps?.onCalendarClose?.();\n }, [picker, reactDatePickerProps]);\n\n const handleMonthChange = useCallback(\n (date: Date) => {\n if (picker === 'month') {\n const selectedDay = preSelectedDate?.getDate() ?? 1;\n const daysInNewMonth = daysInMonth(date.getMonth(), date.getFullYear());\n date.setDate(Math.min(selectedDay, daysInNewMonth));\n reactDatePickerProps?.onMonthChange?.(date);\n } else if (picker === 'year') {\n const selectedDay = preSelectedDate?.getDate() ?? 1;\n const selectedMonth = preSelectedDate?.getMonth() ?? 0;\n const daysInNewMonth = daysInMonth(selectedMonth, date.getFullYear());\n date.setMonth(selectedMonth, Math.min(selectedDay, daysInNewMonth));\n reactDatePickerProps?.onMonthChange?.(date);\n }\n setPreSelectedDate(date);\n },\n [picker, preSelectedDate, reactDatePickerProps],\n );\n\n /**\n * Intercept onChangeRaw to handle clearing the input\n * When the user clears the text input, set the date to null\n */\n const interceptedOnChangeRaw = useCallback(\n (\n event?:\n | React.KeyboardEvent<HTMLElement>\n | React.MouseEvent<HTMLElement, MouseEvent>,\n ) => {\n const target = event?.target as HTMLInputElement | undefined;\n if (target?.value === '') {\n setPreSelectedDate(null);\n if (reactDatePickerProps.onChange) {\n (reactDatePickerProps.onChange as DatePickerChangeHandler)(\n null,\n event,\n );\n }\n }\n reactDatePickerProps?.onChangeRaw?.(event);\n },\n [reactDatePickerProps],\n );\n\n const datePickerProps = {\n ...reactDatePickerProps,\n onCalendarClose: interceptedOnCalendarClose,\n onChange: interceptedChange,\n onChangeRaw: interceptedOnChangeRaw,\n onMonthChange: handleMonthChange,\n };\n\n return (\n <div\n className={classes}\n ref={ref}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {/** TODO v5: Remove the div wrapper, type the component as an input, and apply all root props to the TextInput */}\n <ReactDatePicker\n ref={datetimeRef}\n customInput={\n <DatePickerTextInputWrapper\n isDisabled={isDisabled}\n isClearable={isClearable}\n textInputProps={textInputProps}\n />\n }\n customTimeInput={\n <span className=\"ndl-time-picker-wrapper\">\n <Divider />\n <TimePicker\n isFluid\n value={\n preSelectedDate\n ? new NeedleTime(\n preSelectedDate.getHours(),\n preSelectedDate.getMinutes(),\n )\n : undefined\n }\n onChange={handleTimeChange}\n {...timePickerProps}\n floatingStrategy=\"absolute\"\n isPortaled={false}\n />\n {timeZonePickerProps && (\n <TimeZonePicker\n isFluid\n value={selectedTimeZone}\n onChange={handleTimeZoneChange}\n referenceDate={preSelectedDate || undefined}\n {...timeZonePickerProps}\n floatingStrategy=\"absolute\"\n isPortaled={false}\n />\n )}\n </span>\n }\n disabled={isDisabled}\n showPopperArrow={false}\n showMonthYearPicker={picker === 'month'}\n showYearPicker={picker === 'year'}\n shouldCloseOnSelect={\n picker === 'day' && !(reactDatePickerProps.showTimeInput ?? false)\n }\n dayClassName={() => 'ndl-datepicker-day'}\n renderCustomHeader={CustomHeader}\n {...datePickerProps}\n isClearable={isClearable}\n popperClassName={classNames(\n 'ndl-datepicker-popper',\n reactDatePickerProps.popperClassName,\n )}\n popperProps={{\n strategy: isInsideDialog ? 'fixed' : 'absolute',\n ...reactDatePickerProps.popperProps,\n }}\n />\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) "Neo4j"
|
|
5
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
6
|
+
*
|
|
7
|
+
* This file is part of Neo4j.
|
|
8
|
+
*
|
|
9
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
*/
|
|
22
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
23
|
+
import { DatePicker } from '@neo4j-ndl/react';
|
|
24
|
+
import { useState } from 'react';
|
|
25
|
+
export const Component = () => {
|
|
26
|
+
const [selectedDate, setSelectedDate] = useState(new Date('2023-05-27'));
|
|
27
|
+
const handleOnChange = (date) => {
|
|
28
|
+
setSelectedDate(date);
|
|
29
|
+
};
|
|
30
|
+
return (_jsx(DatePicker, { isClearable: true, reactDatePickerProps: {
|
|
31
|
+
onChange: handleOnChange,
|
|
32
|
+
popperProps: {
|
|
33
|
+
strategy: 'fixed',
|
|
34
|
+
},
|
|
35
|
+
selected: selectedDate,
|
|
36
|
+
}, textInputProps: {
|
|
37
|
+
htmlAttributes: {
|
|
38
|
+
'aria-label': 'Clearable date picker input',
|
|
39
|
+
},
|
|
40
|
+
} }));
|
|
41
|
+
};
|
|
42
|
+
export default Component;
|
|
43
|
+
//# sourceMappingURL=date-picker-clearable.story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker-clearable.story.js","sourceRoot":"","sources":["../../../../src/date-picker/stories/date-picker-clearable.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAC9C,IAAI,IAAI,CAAC,YAAY,CAAC,CACvB,CAAC;IAEF,MAAM,cAAc,GAAG,CAAC,IAAiB,EAAE,EAAE;QAC3C,eAAe,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,UAAU,IACT,WAAW,QACX,oBAAoB,EAAE;YACpB,QAAQ,EAAE,cAAc;YACxB,WAAW,EAAE;gBACX,QAAQ,EAAE,OAAO;aAClB;YACD,QAAQ,EAAE,YAAY;SACvB,EACD,cAAc,EAAE;YACd,cAAc,EAAE;gBACd,YAAY,EAAE,6BAA6B;aAC5C;SACF,GACD,CACH,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 { DatePicker } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nexport const Component = () => {\n const [selectedDate, setSelectedDate] = useState<Date | null>(\n new Date('2023-05-27'),\n );\n\n const handleOnChange = (date: Date | null) => {\n setSelectedDate(date);\n };\n\n return (\n <DatePicker\n isClearable\n reactDatePickerProps={{\n onChange: handleOnChange,\n popperProps: {\n strategy: 'fixed',\n },\n selected: selectedDate,\n }}\n textInputProps={{\n htmlAttributes: {\n 'aria-label': 'Clearable date picker input',\n },\n }}\n />\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
export { default as DatePickerDefault } from './date-picker-default.story';
|
|
22
|
+
export { default as DatePickerClearable } from './date-picker-clearable.story';
|
|
22
23
|
export { default as DatePickerStartsOnMonday } from './date-picker-starts-on-monday.story';
|
|
23
24
|
export { default as DatePickerMinMaxDate } from './date-picker-min-max-date.story';
|
|
24
25
|
export { default as DatePickerOpensToDate } from './date-picker-opens-to-date.story';
|
|
@@ -32,6 +33,7 @@ export { default as DatePickerFull } from './date-picker-full.story';
|
|
|
32
33
|
export { default as DatePickerPortaled } from './date-picker-portaled.story';
|
|
33
34
|
export { default as DatePickerRange } from './date-picker-range.story';
|
|
34
35
|
import { removeLicenseHeader } from '../../_common/export-stories-utils';
|
|
36
|
+
import DatePickerClearableSourceRaw from './date-picker-clearable.story.tsx?raw';
|
|
35
37
|
import DatePickerDefaultSourceRaw from './date-picker-default.story.tsx?raw';
|
|
36
38
|
import DatePickerDisabledSourceRaw from './date-picker-disabled.story.tsx?raw';
|
|
37
39
|
import DatePickerFullSourceRaw from './date-picker-full.story.tsx?raw';
|
|
@@ -46,6 +48,7 @@ import DatePickerWithTimePickerSourceRaw from './date-picker-with-time-picker.st
|
|
|
46
48
|
import DatePickerWithTimeZoneSourceRaw from './date-picker-with-timezone.story.tsx?raw';
|
|
47
49
|
import DatePickerWithTimeZoneBothModeSourceRaw from './date-picker-with-timezone-both-mode.story.tsx?raw';
|
|
48
50
|
export const DatePickerDefaultSource = removeLicenseHeader(DatePickerDefaultSourceRaw);
|
|
51
|
+
export const DatePickerClearableSource = removeLicenseHeader(DatePickerClearableSourceRaw);
|
|
49
52
|
export const DatePickerStartsOnMondaySource = removeLicenseHeader(DatePickerStartsOnMondaySourceRaw);
|
|
50
53
|
export const DatePickerMinMaxDateSource = removeLicenseHeader(DatePickerMinMaxDateSourceRaw);
|
|
51
54
|
export const DatePickerOpensToDateSource = removeLicenseHeader(DatePickerOpensToDateSourceRaw);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/date-picker/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AACxG,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEvE,O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2B,CAC5B,CAAC;AACF,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CACzD,2BAA2B,CAC5B,CAAC;AACF,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CACrD,uBAAuB,CACxB,CAAC;AACF,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CACzD,2BAA2B,CAC5B,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CACtD,wBAAwB,CACzB,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { default as DatePickerDefault } from './date-picker-default.story';\nexport { default as DatePickerStartsOnMonday } from './date-picker-starts-on-monday.story';\nexport { default as DatePickerMinMaxDate } from './date-picker-min-max-date.story';\nexport { default as DatePickerOpensToDate } from './date-picker-opens-to-date.story';\nexport { default as DatePickerTextInputProps } from './date-picker-text-input-props.story';\nexport { default as DatePickerWithTimePicker } from './date-picker-with-time-picker.story';\nexport { default as DatePickerWithTimeZone } from './date-picker-with-timezone.story';\nexport { default as DatePickerWithTimeZoneBothMode } from './date-picker-with-timezone-both-mode.story';\nexport { default as DatePickerDisabled } from './date-picker-disabled.story';\nexport { default as DatePickerInDialog } from './date-picker-in-dialog.story';\nexport { default as DatePickerFull } from './date-picker-full.story';\nexport { default as DatePickerPortaled } from './date-picker-portaled.story';\nexport { default as DatePickerRange } from './date-picker-range.story';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\nimport DatePickerDefaultSourceRaw from './date-picker-default.story.tsx?raw';\nimport DatePickerDisabledSourceRaw from './date-picker-disabled.story.tsx?raw';\nimport DatePickerFullSourceRaw from './date-picker-full.story.tsx?raw';\nimport DatePickerInDialogSourceRaw from './date-picker-in-dialog.story.tsx?raw';\nimport DatePickerMinMaxDateSourceRaw from './date-picker-min-max-date.story.tsx?raw';\nimport DatePickerOpensToDateSourceRaw from './date-picker-opens-to-date.story.tsx?raw';\nimport DatePickerPortaledSourceRaw from './date-picker-portaled.story.tsx?raw';\nimport DatePickerRangeSourceRaw from './date-picker-range.story.tsx?raw';\nimport DatePickerStartsOnMondaySourceRaw from './date-picker-starts-on-monday.story.tsx?raw';\nimport DatePickerTextInputPropsSourceRaw from './date-picker-text-input-props.story.tsx?raw';\nimport DatePickerWithTimePickerSourceRaw from './date-picker-with-time-picker.story.tsx?raw';\nimport DatePickerWithTimeZoneSourceRaw from './date-picker-with-timezone.story.tsx?raw';\nimport DatePickerWithTimeZoneBothModeSourceRaw from './date-picker-with-timezone-both-mode.story.tsx?raw';\n\nexport const DatePickerDefaultSource = removeLicenseHeader(\n DatePickerDefaultSourceRaw,\n);\nexport const DatePickerStartsOnMondaySource = removeLicenseHeader(\n DatePickerStartsOnMondaySourceRaw,\n);\nexport const DatePickerMinMaxDateSource = removeLicenseHeader(\n DatePickerMinMaxDateSourceRaw,\n);\nexport const DatePickerOpensToDateSource = removeLicenseHeader(\n DatePickerOpensToDateSourceRaw,\n);\nexport const DatePickerTextInputPropsSource = removeLicenseHeader(\n DatePickerTextInputPropsSourceRaw,\n);\nexport const DatePickerWithTimePickerSource = removeLicenseHeader(\n DatePickerWithTimePickerSourceRaw,\n);\nexport const DatePickerWithTimeZoneSource = removeLicenseHeader(\n DatePickerWithTimeZoneSourceRaw,\n);\nexport const DatePickerWithTimeZoneBothModeSource = removeLicenseHeader(\n DatePickerWithTimeZoneBothModeSourceRaw,\n);\nexport const DatePickerDisabledSource = removeLicenseHeader(\n DatePickerDisabledSourceRaw,\n);\nexport const DatePickerInDialogSource = removeLicenseHeader(\n DatePickerInDialogSourceRaw,\n);\nexport const DatePickerFullSource = removeLicenseHeader(\n DatePickerFullSourceRaw,\n);\nexport const DatePickerPortaledSource = removeLicenseHeader(\n DatePickerPortaledSourceRaw,\n);\nexport const DatePickerRangeSource = removeLicenseHeader(\n DatePickerRangeSourceRaw,\n);\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/date-picker/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AACxG,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC7E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M,4BAA4B,GAAG,mBAAmB,CAC7D,+BAA+B,CAChC,CAAC;AACF,MAAM,CAAC,MAAM,oCAAoC,GAAG,mBAAmB,CACrE,uCAAuC,CACxC,CAAC;AACF,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CACzD,2BAA2B,CAC5B,CAAC;AACF,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CACzD,2BAA2B,CAC5B,CAAC;AACF,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CACrD,uBAAuB,CACxB,CAAC;AACF,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CACzD,2BAA2B,CAC5B,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CACtD,wBAAwB,CACzB,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { default as DatePickerDefault } from './date-picker-default.story';\nexport { default as DatePickerClearable } from './date-picker-clearable.story';\nexport { default as DatePickerStartsOnMonday } from './date-picker-starts-on-monday.story';\nexport { default as DatePickerMinMaxDate } from './date-picker-min-max-date.story';\nexport { default as DatePickerOpensToDate } from './date-picker-opens-to-date.story';\nexport { default as DatePickerTextInputProps } from './date-picker-text-input-props.story';\nexport { default as DatePickerWithTimePicker } from './date-picker-with-time-picker.story';\nexport { default as DatePickerWithTimeZone } from './date-picker-with-timezone.story';\nexport { default as DatePickerWithTimeZoneBothMode } from './date-picker-with-timezone-both-mode.story';\nexport { default as DatePickerDisabled } from './date-picker-disabled.story';\nexport { default as DatePickerInDialog } from './date-picker-in-dialog.story';\nexport { default as DatePickerFull } from './date-picker-full.story';\nexport { default as DatePickerPortaled } from './date-picker-portaled.story';\nexport { default as DatePickerRange } from './date-picker-range.story';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\nimport DatePickerClearableSourceRaw from './date-picker-clearable.story.tsx?raw';\nimport DatePickerDefaultSourceRaw from './date-picker-default.story.tsx?raw';\nimport DatePickerDisabledSourceRaw from './date-picker-disabled.story.tsx?raw';\nimport DatePickerFullSourceRaw from './date-picker-full.story.tsx?raw';\nimport DatePickerInDialogSourceRaw from './date-picker-in-dialog.story.tsx?raw';\nimport DatePickerMinMaxDateSourceRaw from './date-picker-min-max-date.story.tsx?raw';\nimport DatePickerOpensToDateSourceRaw from './date-picker-opens-to-date.story.tsx?raw';\nimport DatePickerPortaledSourceRaw from './date-picker-portaled.story.tsx?raw';\nimport DatePickerRangeSourceRaw from './date-picker-range.story.tsx?raw';\nimport DatePickerStartsOnMondaySourceRaw from './date-picker-starts-on-monday.story.tsx?raw';\nimport DatePickerTextInputPropsSourceRaw from './date-picker-text-input-props.story.tsx?raw';\nimport DatePickerWithTimePickerSourceRaw from './date-picker-with-time-picker.story.tsx?raw';\nimport DatePickerWithTimeZoneSourceRaw from './date-picker-with-timezone.story.tsx?raw';\nimport DatePickerWithTimeZoneBothModeSourceRaw from './date-picker-with-timezone-both-mode.story.tsx?raw';\n\nexport const DatePickerDefaultSource = removeLicenseHeader(\n DatePickerDefaultSourceRaw,\n);\nexport const DatePickerClearableSource = removeLicenseHeader(\n DatePickerClearableSourceRaw,\n);\nexport const DatePickerStartsOnMondaySource = removeLicenseHeader(\n DatePickerStartsOnMondaySourceRaw,\n);\nexport const DatePickerMinMaxDateSource = removeLicenseHeader(\n DatePickerMinMaxDateSourceRaw,\n);\nexport const DatePickerOpensToDateSource = removeLicenseHeader(\n DatePickerOpensToDateSourceRaw,\n);\nexport const DatePickerTextInputPropsSource = removeLicenseHeader(\n DatePickerTextInputPropsSourceRaw,\n);\nexport const DatePickerWithTimePickerSource = removeLicenseHeader(\n DatePickerWithTimePickerSourceRaw,\n);\nexport const DatePickerWithTimeZoneSource = removeLicenseHeader(\n DatePickerWithTimeZoneSourceRaw,\n);\nexport const DatePickerWithTimeZoneBothModeSource = removeLicenseHeader(\n DatePickerWithTimeZoneBothModeSourceRaw,\n);\nexport const DatePickerDisabledSource = removeLicenseHeader(\n DatePickerDisabledSourceRaw,\n);\nexport const DatePickerInDialogSource = removeLicenseHeader(\n DatePickerInDialogSourceRaw,\n);\nexport const DatePickerFullSource = removeLicenseHeader(\n DatePickerFullSourceRaw,\n);\nexport const DatePickerPortaledSource = removeLicenseHeader(\n DatePickerPortaledSourceRaw,\n);\nexport const DatePickerRangeSource = removeLicenseHeader(\n DatePickerRangeSourceRaw,\n);\n"]}
|