@neo4j-ndl/react 4.0.19 → 4.1.2
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/date-picker/DatePicker.js +11 -3
- package/lib/cjs/date-picker/DatePicker.js.map +1 -1
- package/lib/cjs/date-picker/stories/date-picker-with-timezone-both-mode.story.js +57 -0
- package/lib/cjs/date-picker/stories/date-picker-with-timezone-both-mode.story.js.map +1 -0
- package/lib/cjs/date-picker/stories/date-picker-with-timezone.story.js +52 -0
- package/lib/cjs/date-picker/stories/date-picker-with-timezone.story.js.map +1 -0
- package/lib/cjs/date-picker/stories/date-picker.stories.js +27 -1
- package/lib/cjs/date-picker/stories/date-picker.stories.js.map +1 -1
- package/lib/cjs/date-picker/stories/index.js +9 -1
- package/lib/cjs/date-picker/stories/index.js.map +1 -1
- package/lib/cjs/dropzone/Dropzone.js +1 -1
- package/lib/cjs/dropzone/Dropzone.js.map +1 -1
- package/lib/cjs/index.js +4 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/time-picker/TimePicker.js.map +1 -1
- package/lib/cjs/timezone-picker/TimeZonePicker.js +330 -0
- package/lib/cjs/timezone-picker/TimeZonePicker.js.map +1 -0
- package/lib/cjs/timezone-picker/generate-timezone-options.js +256 -0
- package/lib/cjs/timezone-picker/generate-timezone-options.js.map +1 -0
- package/lib/cjs/timezone-picker/index.js +39 -0
- package/lib/cjs/timezone-picker/index.js.map +1 -0
- package/lib/cjs/timezone-picker/stories/index.js +60 -0
- package/lib/cjs/timezone-picker/stories/index.js.map +1 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-both-mode.story.js +41 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-both-mode.story.js.map +1 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-default.story.js +35 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-default.story.js.map +1 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-disabled.story.js +30 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-disabled.story.js.map +1 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-dst-aware.story.js +54 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-dst-aware.story.js.map +1 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-fluid.story.js +30 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-fluid.story.js.map +1 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-in-dialog.story.js +47 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-in-dialog.story.js.map +1 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-sizes.story.js +32 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-sizes.story.js.map +1 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-utc-only.story.js +49 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker-utc-only.story.js.map +1 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker.stories.js +145 -0
- package/lib/cjs/timezone-picker/stories/timezone-picker.stories.js.map +1 -0
- package/lib/cjs/timezone-picker/timezone-picker-hooks.js +52 -0
- package/lib/cjs/timezone-picker/timezone-picker-hooks.js.map +1 -0
- package/lib/esm/date-picker/DatePicker.js +11 -3
- package/lib/esm/date-picker/DatePicker.js.map +1 -1
- package/lib/esm/date-picker/stories/date-picker-with-timezone-both-mode.story.js +53 -0
- package/lib/esm/date-picker/stories/date-picker-with-timezone-both-mode.story.js.map +1 -0
- package/lib/esm/date-picker/stories/date-picker-with-timezone.story.js +50 -0
- package/lib/esm/date-picker/stories/date-picker-with-timezone.story.js.map +1 -0
- package/lib/esm/date-picker/stories/date-picker.stories.js +27 -1
- package/lib/esm/date-picker/stories/date-picker.stories.js.map +1 -1
- package/lib/esm/date-picker/stories/index.js +6 -0
- package/lib/esm/date-picker/stories/index.js.map +1 -1
- package/lib/esm/dropzone/Dropzone.js +1 -1
- package/lib/esm/dropzone/Dropzone.js.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/time-picker/TimePicker.js +4 -4
- package/lib/esm/time-picker/TimePicker.js.map +1 -1
- package/lib/esm/timezone-picker/TimeZonePicker.js +323 -0
- package/lib/esm/timezone-picker/TimeZonePicker.js.map +1 -0
- package/lib/esm/timezone-picker/generate-timezone-options.js +247 -0
- package/lib/esm/timezone-picker/generate-timezone-options.js.map +1 -0
- package/lib/esm/timezone-picker/index.js +23 -0
- package/lib/esm/timezone-picker/index.js.map +1 -0
- package/lib/esm/timezone-picker/stories/index.js +46 -0
- package/lib/esm/timezone-picker/stories/index.js.map +1 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-both-mode.story.js +37 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-both-mode.story.js.map +1 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-default.story.js +33 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-default.story.js.map +1 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-disabled.story.js +28 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-disabled.story.js.map +1 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-dst-aware.story.js +52 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-dst-aware.story.js.map +1 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-fluid.story.js +28 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-fluid.story.js.map +1 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-in-dialog.story.js +45 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-in-dialog.story.js.map +1 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-sizes.story.js +30 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-sizes.story.js.map +1 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-utc-only.story.js +47 -0
- package/lib/esm/timezone-picker/stories/timezone-picker-utc-only.story.js.map +1 -0
- package/lib/esm/timezone-picker/stories/timezone-picker.stories.js +142 -0
- package/lib/esm/timezone-picker/stories/timezone-picker.stories.js.map +1 -0
- package/lib/esm/timezone-picker/timezone-picker-hooks.js +47 -0
- package/lib/esm/timezone-picker/timezone-picker-hooks.js.map +1 -0
- package/lib/types/date-picker/DatePicker.d.ts +4 -1
- package/lib/types/date-picker/DatePicker.d.ts.map +1 -1
- package/lib/types/date-picker/stories/date-picker-with-timezone-both-mode.story.d.ts +23 -0
- package/lib/types/date-picker/stories/date-picker-with-timezone-both-mode.story.d.ts.map +1 -0
- package/lib/types/date-picker/stories/date-picker-with-timezone.story.d.ts +24 -0
- package/lib/types/date-picker/stories/date-picker-with-timezone.story.d.ts.map +1 -0
- package/lib/types/date-picker/stories/date-picker.stories.d.ts +2 -0
- package/lib/types/date-picker/stories/date-picker.stories.d.ts.map +1 -1
- package/lib/types/date-picker/stories/index.d.ts +4 -0
- package/lib/types/date-picker/stories/index.d.ts.map +1 -1
- package/lib/types/dropzone/Dropzone.d.ts.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/timezone-picker/TimeZonePicker.d.ts +68 -0
- package/lib/types/timezone-picker/TimeZonePicker.d.ts.map +1 -0
- package/lib/types/timezone-picker/generate-timezone-options.d.ts +61 -0
- package/lib/types/timezone-picker/generate-timezone-options.d.ts.map +1 -0
- package/lib/types/timezone-picker/index.d.ts +23 -0
- package/lib/types/timezone-picker/index.d.ts.map +1 -0
- package/lib/types/timezone-picker/stories/index.d.ts +37 -0
- package/lib/types/timezone-picker/stories/index.d.ts.map +1 -0
- package/lib/types/timezone-picker/stories/timezone-picker-both-mode.story.d.ts +23 -0
- package/lib/types/timezone-picker/stories/timezone-picker-both-mode.story.d.ts.map +1 -0
- package/lib/types/timezone-picker/stories/timezone-picker-default.story.d.ts +24 -0
- package/lib/types/timezone-picker/stories/timezone-picker-default.story.d.ts.map +1 -0
- package/lib/types/timezone-picker/stories/timezone-picker-disabled.story.d.ts +24 -0
- package/lib/types/timezone-picker/stories/timezone-picker-disabled.story.d.ts.map +1 -0
- package/lib/types/timezone-picker/stories/timezone-picker-dst-aware.story.d.ts +24 -0
- package/lib/types/timezone-picker/stories/timezone-picker-dst-aware.story.d.ts.map +1 -0
- package/lib/types/timezone-picker/stories/timezone-picker-fluid.story.d.ts +24 -0
- package/lib/types/timezone-picker/stories/timezone-picker-fluid.story.d.ts.map +1 -0
- package/lib/types/timezone-picker/stories/timezone-picker-in-dialog.story.d.ts +24 -0
- package/lib/types/timezone-picker/stories/timezone-picker-in-dialog.story.d.ts.map +1 -0
- package/lib/types/timezone-picker/stories/timezone-picker-sizes.story.d.ts +24 -0
- package/lib/types/timezone-picker/stories/timezone-picker-sizes.story.d.ts.map +1 -0
- package/lib/types/timezone-picker/stories/timezone-picker-utc-only.story.d.ts +24 -0
- package/lib/types/timezone-picker/stories/timezone-picker-utc-only.story.d.ts.map +1 -0
- package/lib/types/timezone-picker/stories/timezone-picker.stories.d.ts +34 -0
- package/lib/types/timezone-picker/stories/timezone-picker.stories.d.ts.map +1 -0
- package/lib/types/timezone-picker/timezone-picker-hooks.d.ts +31 -0
- package/lib/types/timezone-picker/timezone-picker-hooks.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) "Neo4j"
|
|
5
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
6
|
+
*
|
|
7
|
+
* This file is part of Neo4j.
|
|
8
|
+
*
|
|
9
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
*/
|
|
22
|
+
import { useState } from 'react';
|
|
23
|
+
import { Typography } from '../../typography';
|
|
24
|
+
import { DatePicker } from '../DatePicker';
|
|
25
|
+
export const DatePickerWithTimeZoneBothMode = () => {
|
|
26
|
+
const [selectedDate, setSelectedDate] = useState(new Date());
|
|
27
|
+
const [selectedTimeZone, setSelectedTimeZone] = useState('America/New_York');
|
|
28
|
+
return (_jsxs("div", { style: { maxWidth: '400px', padding: '20px' }, children: [_jsx(Typography, { variant: "title-4", style: { marginBottom: '16px' }, children: "DatePicker with TimeZone (Both Mode)" }), _jsx(Typography, { variant: "body-medium", style: { marginBottom: '24px' }, children: "This example shows the DatePicker with the TimeZonePicker in \"both\" mode, displaying both UTC offsets and city-based timezones in separate sections." }), _jsx(DatePicker, { textInputProps: {
|
|
29
|
+
label: 'Select Date and Time with Timezone',
|
|
30
|
+
}, timePickerProps: {
|
|
31
|
+
format: 'hh:mm',
|
|
32
|
+
}, timeZonePickerProps: {
|
|
33
|
+
mode: 'both',
|
|
34
|
+
onChange: (tz) => {
|
|
35
|
+
setSelectedTimeZone(tz);
|
|
36
|
+
},
|
|
37
|
+
value: selectedTimeZone,
|
|
38
|
+
}, reactDatePickerProps: {
|
|
39
|
+
dateFormat: 'yyyy-MM-dd',
|
|
40
|
+
onChange: (date) => {
|
|
41
|
+
setSelectedDate(date);
|
|
42
|
+
},
|
|
43
|
+
selected: selectedDate,
|
|
44
|
+
showTimeInput: true,
|
|
45
|
+
} }), _jsxs("div", { style: {
|
|
46
|
+
backgroundColor: '#f5f5f5',
|
|
47
|
+
borderRadius: '4px',
|
|
48
|
+
marginTop: '24px',
|
|
49
|
+
padding: '16px',
|
|
50
|
+
}, children: [_jsx(Typography, { variant: "body-small", style: { fontWeight: 600, marginBottom: '8px' }, children: "Selected Values:" }), _jsxs(Typography, { variant: "body-medium", children: [_jsx("strong", { children: "Date:" }), ' ', (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.toISOString()) !== null || 'None'] }), _jsxs(Typography, { variant: "body-medium", style: { marginTop: '8px' }, children: [_jsx("strong", { children: "Timezone:" }), " ", selectedTimeZone || 'None'] })] })] }));
|
|
51
|
+
};
|
|
52
|
+
export default DatePickerWithTimeZoneBothMode;
|
|
53
|
+
//# sourceMappingURL=date-picker-with-timezone-both-mode.story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker-with-timezone-both-mode.story.js","sourceRoot":"","sources":["../../../../src/date-picker/stories/date-picker-with-timezone-both-mode.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,EAAE;IACjD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAc,IAAI,IAAI,EAAE,CAAC,CAAC;IAC1E,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAC3C,QAAQ,CAAS,kBAAkB,CAAC,CAAC;IAEvC,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAChD,KAAC,UAAU,IAAC,OAAO,EAAC,SAAS,EAAC,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,qDAEhD,EACb,KAAC,UAAU,IAAC,OAAO,EAAC,aAAa,EAAC,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,uKAIpD,EAEb,KAAC,UAAU,IACT,cAAc,EAAE;oBACd,KAAK,EAAE,oCAAoC;iBAC5C,EACD,eAAe,EAAE;oBACf,MAAM,EAAE,OAAO;iBAChB,EACD,mBAAmB,EAAE;oBACnB,IAAI,EAAE,MAAM;oBACZ,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE;wBACf,mBAAmB,CAAC,EAAE,CAAC,CAAC;oBAC1B,CAAC;oBACD,KAAK,EAAE,gBAAgB;iBACxB,EACD,oBAAoB,EAAE;oBACpB,UAAU,EAAE,YAAY;oBACxB,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;wBACjB,eAAe,CAAC,IAAI,CAAC,CAAC;oBACxB,CAAC;oBACD,QAAQ,EAAE,YAAY;oBACtB,aAAa,EAAE,IAAI;iBACpB,GACD,EAEF,eACE,KAAK,EAAE;oBACL,eAAe,EAAE,SAAS;oBAC1B,YAAY,EAAE,KAAK;oBACnB,SAAS,EAAE,MAAM;oBACjB,OAAO,EAAE,MAAM;iBAChB,aAED,KAAC,UAAU,IACT,OAAO,EAAC,YAAY,EACpB,KAAK,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,iCAGpC,EACb,MAAC,UAAU,IAAC,OAAO,EAAC,aAAa,aAC/B,qCAAsB,EAAC,GAAG,EACzB,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,WAAW,EAAE,MAAK,IAAI,IAAI,MAAM,IACpC,EACb,MAAC,UAAU,IAAC,OAAO,EAAC,aAAa,EAAC,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,aAC3D,yCAA0B,OAAE,gBAAgB,IAAI,MAAM,IAC3C,IACT,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,8BAA8B,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 { useState } from 'react';\n\nimport { Typography } from '../../typography';\nimport { DatePicker } from '../DatePicker';\n\nexport const DatePickerWithTimeZoneBothMode = () => {\n const [selectedDate, setSelectedDate] = useState<Date | null>(new Date());\n const [selectedTimeZone, setSelectedTimeZone] =\n useState<string>('America/New_York');\n\n return (\n <div style={{ maxWidth: '400px', padding: '20px' }}>\n <Typography variant=\"title-4\" style={{ marginBottom: '16px' }}>\n DatePicker with TimeZone (Both Mode)\n </Typography>\n <Typography variant=\"body-medium\" style={{ marginBottom: '24px' }}>\n This example shows the DatePicker with the TimeZonePicker in\n "both" mode, displaying both UTC offsets and city-based\n timezones in separate sections.\n </Typography>\n\n <DatePicker\n textInputProps={{\n label: 'Select Date and Time with Timezone',\n }}\n timePickerProps={{\n format: 'hh:mm',\n }}\n timeZonePickerProps={{\n mode: 'both',\n onChange: (tz) => {\n setSelectedTimeZone(tz);\n },\n value: selectedTimeZone,\n }}\n reactDatePickerProps={{\n dateFormat: 'yyyy-MM-dd',\n onChange: (date) => {\n setSelectedDate(date);\n },\n selected: selectedDate,\n showTimeInput: true,\n }}\n />\n\n <div\n style={{\n backgroundColor: '#f5f5f5',\n borderRadius: '4px',\n marginTop: '24px',\n padding: '16px',\n }}\n >\n <Typography\n variant=\"body-small\"\n style={{ fontWeight: 600, marginBottom: '8px' }}\n >\n Selected Values:\n </Typography>\n <Typography variant=\"body-medium\">\n <strong>Date:</strong>{' '}\n {selectedDate?.toISOString() !== null || 'None'}\n </Typography>\n <Typography variant=\"body-medium\" style={{ marginTop: '8px' }}>\n <strong>Timezone:</strong> {selectedTimeZone || 'None'}\n </Typography>\n </div>\n </div>\n );\n};\n\nexport default DatePickerWithTimeZoneBothMode;\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) "Neo4j"
|
|
5
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
6
|
+
*
|
|
7
|
+
* This file is part of Neo4j.
|
|
8
|
+
*
|
|
9
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
*/
|
|
22
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
23
|
+
import { DatePicker } from '@neo4j-ndl/react';
|
|
24
|
+
import { useState } from 'react';
|
|
25
|
+
const Component = () => {
|
|
26
|
+
const [selectedDate, setSelectedDate] = useState(new Date('2023-05-27T14:30:00'));
|
|
27
|
+
const [selectedTimeZone, setSelectedTimeZone] = useState('UTC');
|
|
28
|
+
const handleOnChange = (date) => {
|
|
29
|
+
setSelectedDate(date);
|
|
30
|
+
};
|
|
31
|
+
const handleTimeZoneChange = (timezone) => {
|
|
32
|
+
setSelectedTimeZone(timezone);
|
|
33
|
+
};
|
|
34
|
+
return (_jsxs("div", { children: [_jsx(DatePicker, { timePickerProps: {
|
|
35
|
+
format: 'hh:mm',
|
|
36
|
+
timeInterval: 15,
|
|
37
|
+
}, timeZonePickerProps: {
|
|
38
|
+
onChange: handleTimeZoneChange,
|
|
39
|
+
value: selectedTimeZone,
|
|
40
|
+
}, reactDatePickerProps: {
|
|
41
|
+
onChange: handleOnChange,
|
|
42
|
+
popperProps: {
|
|
43
|
+
strategy: 'fixed',
|
|
44
|
+
},
|
|
45
|
+
selected: selectedDate,
|
|
46
|
+
showTimeInput: true,
|
|
47
|
+
} }), _jsxs("div", { style: { marginTop: '1rem' }, children: [_jsxs("p", { children: [_jsx("strong", { children: "Selected Date:" }), ' ', selectedDate ? selectedDate.toISOString() : 'None'] }), _jsxs("p", { children: [_jsx("strong", { children: "Selected Timezone:" }), " ", selectedTimeZone] })] })] }));
|
|
48
|
+
};
|
|
49
|
+
export default Component;
|
|
50
|
+
//# sourceMappingURL=date-picker-with-timezone.story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker-with-timezone.story.js","sourceRoot":"","sources":["../../../../src/date-picker/stories/date-picker-with-timezone.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,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAC9C,IAAI,IAAI,CAAC,qBAAqB,CAAC,CAChC,CAAC;IACF,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAS,KAAK,CAAC,CAAC;IAExE,MAAM,cAAc,GAAG,CAAC,IAAiB,EAAE,EAAE;QAC3C,eAAe,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC,CAAC;IAEF,MAAM,oBAAoB,GAAG,CAAC,QAAgB,EAAE,EAAE;QAChD,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC,CAAC;IAEF,OAAO,CACL,0BACE,KAAC,UAAU,IACT,eAAe,EAAE;oBACf,MAAM,EAAE,OAAO;oBACf,YAAY,EAAE,EAAE;iBACjB,EACD,mBAAmB,EAAE;oBACnB,QAAQ,EAAE,oBAAoB;oBAC9B,KAAK,EAAE,gBAAgB;iBACxB,EACD,oBAAoB,EAAE;oBACpB,QAAQ,EAAE,cAAc;oBACxB,WAAW,EAAE;wBACX,QAAQ,EAAE,OAAO;qBAClB;oBACD,QAAQ,EAAE,YAAY;oBACtB,aAAa,EAAE,IAAI;iBACpB,GACD,EACF,eAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,aAC/B,wBACE,8CAA+B,EAAC,GAAG,EAClC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,MAAM,IACjD,EACJ,wBACE,kDAAmC,OAAE,gBAAgB,IACnD,IACA,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { DatePicker } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [selectedDate, setSelectedDate] = useState<Date | null>(\n new Date('2023-05-27T14:30:00'),\n );\n const [selectedTimeZone, setSelectedTimeZone] = useState<string>('UTC');\n\n const handleOnChange = (date: Date | null) => {\n setSelectedDate(date);\n };\n\n const handleTimeZoneChange = (timezone: string) => {\n setSelectedTimeZone(timezone);\n };\n\n return (\n <div>\n <DatePicker\n timePickerProps={{\n format: 'hh:mm',\n timeInterval: 15,\n }}\n timeZonePickerProps={{\n onChange: handleTimeZoneChange,\n value: selectedTimeZone,\n }}\n reactDatePickerProps={{\n onChange: handleOnChange,\n popperProps: {\n strategy: 'fixed',\n },\n selected: selectedDate,\n showTimeInput: true,\n }}\n />\n <div style={{ marginTop: '1rem' }}>\n <p>\n <strong>Selected Date:</strong>{' '}\n {selectedDate ? selectedDate.toISOString() : 'None'}\n </p>\n <p>\n <strong>Selected Timezone:</strong> {selectedTimeZone}\n </p>\n </div>\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
23
|
import { DatePicker } from '../DatePicker';
|
|
24
|
-
import { DatePickerDefault, DatePickerDefaultSource, DatePickerDisabled, DatePickerDisabledSource, DatePickerFull, DatePickerFullSource, DatePickerInDialog, DatePickerInDialogSource, DatePickerMinMaxDate, DatePickerMinMaxDateSource, DatePickerOpensToDate, DatePickerOpensToDateSource, DatePickerPortaled, DatePickerPortaledSource, DatePickerRange, DatePickerRangeSource, DatePickerStartsOnMonday, DatePickerStartsOnMondaySource, DatePickerTextInputProps, DatePickerTextInputPropsSource, DatePickerWithTimePicker, DatePickerWithTimePickerSource, } from './';
|
|
24
|
+
import { DatePickerDefault, DatePickerDefaultSource, DatePickerDisabled, DatePickerDisabledSource, DatePickerFull, DatePickerFullSource, DatePickerInDialog, DatePickerInDialogSource, DatePickerMinMaxDate, DatePickerMinMaxDateSource, DatePickerOpensToDate, DatePickerOpensToDateSource, DatePickerPortaled, DatePickerPortaledSource, DatePickerRange, DatePickerRangeSource, DatePickerStartsOnMonday, DatePickerStartsOnMondaySource, DatePickerTextInputProps, DatePickerTextInputPropsSource, DatePickerWithTimePicker, DatePickerWithTimePickerSource, DatePickerWithTimeZone, DatePickerWithTimeZoneBothMode, DatePickerWithTimeZoneBothModeSource, DatePickerWithTimeZoneSource, } from './';
|
|
25
25
|
const componentMeta = {
|
|
26
26
|
component: DatePicker,
|
|
27
27
|
decorators: [
|
|
@@ -113,6 +113,19 @@ export const WithTimePicker = {
|
|
|
113
113
|
},
|
|
114
114
|
render: DatePickerWithTimePicker,
|
|
115
115
|
};
|
|
116
|
+
export const WithTimeZone = {
|
|
117
|
+
args: {},
|
|
118
|
+
parameters: {
|
|
119
|
+
docs: {
|
|
120
|
+
source: {
|
|
121
|
+
code: DatePickerWithTimeZoneSource,
|
|
122
|
+
language: 'tsx',
|
|
123
|
+
type: 'code',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
render: DatePickerWithTimeZone,
|
|
128
|
+
};
|
|
116
129
|
export const Disabled = {
|
|
117
130
|
args: {},
|
|
118
131
|
parameters: {
|
|
@@ -178,4 +191,17 @@ export const Portaled = {
|
|
|
178
191
|
},
|
|
179
192
|
render: DatePickerPortaled,
|
|
180
193
|
};
|
|
194
|
+
export const WithTimeZoneBothMode = {
|
|
195
|
+
args: {},
|
|
196
|
+
parameters: {
|
|
197
|
+
docs: {
|
|
198
|
+
source: {
|
|
199
|
+
code: DatePickerWithTimeZoneBothModeSource,
|
|
200
|
+
language: 'tsx',
|
|
201
|
+
type: 'code',
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
render: DatePickerWithTimeZoneBothMode,
|
|
206
|
+
};
|
|
181
207
|
//# sourceMappingURL=date-picker.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.stories.js","sourceRoot":"","sources":["../../../../src/date-picker/stories/date-picker.stories.tsx"],"names":[],"mappings":";AAsBA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,2BAA2B,EAC3B,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,8BAA8B,EAC9B,wBAAwB,EACxB,8BAA8B,EAC9B,wBAAwB,EACxB,8BAA8B,
|
|
1
|
+
{"version":3,"file":"date-picker.stories.js","sourceRoot":"","sources":["../../../../src/date-picker/stories/date-picker.stories.tsx"],"names":[],"mappings":";AAsBA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,2BAA2B,EAC3B,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,8BAA8B,EAC9B,wBAAwB,EACxB,8BAA8B,EAC9B,wBAAwB,EACxB,8BAA8B,EAC9B,sBAAsB,EACtB,8BAA8B,EAC9B,oCAAoC,EACpC,4BAA4B,GAC7B,MAAM,IAAI,CAAC;AAEZ,MAAM,aAAa,GAA4B;IAC7C,SAAS,EAAE,UAAU;IACrB,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,cAAK,SAAS,EAAC,yBAAyB,YACtC,KAAC,KAAK,KAAG,GACL,CACP;KACF;IACD,EAAE,EAAE,wBAAwB;IAC5B,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,uBAAuB;CAC/B,CAAC;AAEF,eAAe,aAAa,CAAC;AAG7B,MAAM,CAAC,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E;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,qBAAqB;gBAC3B,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,eAAe;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC7B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,wBAAwB;gBAC9B,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,kBAAkB;CAC3B,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAU;IACzC,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,oCAAoC;gBAC1C,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,8BAA8B;CACvC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { DatePicker } from '../DatePicker';\nimport {\n DatePickerDefault,\n DatePickerDefaultSource,\n DatePickerDisabled,\n DatePickerDisabledSource,\n DatePickerFull,\n DatePickerFullSource,\n DatePickerInDialog,\n DatePickerInDialogSource,\n DatePickerMinMaxDate,\n DatePickerMinMaxDateSource,\n DatePickerOpensToDate,\n DatePickerOpensToDateSource,\n DatePickerPortaled,\n DatePickerPortaledSource,\n DatePickerRange,\n DatePickerRangeSource,\n DatePickerStartsOnMonday,\n DatePickerStartsOnMondaySource,\n DatePickerTextInputProps,\n DatePickerTextInputPropsSource,\n DatePickerWithTimePicker,\n DatePickerWithTimePickerSource,\n DatePickerWithTimeZone,\n DatePickerWithTimeZoneBothMode,\n DatePickerWithTimeZoneBothModeSource,\n DatePickerWithTimeZoneSource,\n} from './';\n\nconst componentMeta: Meta<typeof DatePicker> = {\n component: DatePicker,\n decorators: [\n (Story) => (\n <div className=\"n-flex n-justify-center\">\n <Story />\n </div>\n ),\n ],\n id: 'components-date-picker',\n parameters: {\n controls: { disable: true },\n },\n tags: ['docsPage'],\n title: 'Components/DatePicker',\n};\n\nexport default componentMeta;\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Default: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: DatePickerDefaultSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: DatePickerDefault,\n};\n\nexport const StartsOnMonday: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: DatePickerStartsOnMondaySource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: DatePickerStartsOnMonday,\n};\n\nexport const MinMaxDate: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: DatePickerMinMaxDateSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: DatePickerMinMaxDate,\n};\n\nexport const OpensToDate: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: DatePickerOpensToDateSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: DatePickerOpensToDate,\n};\n\nexport const TextInputProps: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: DatePickerTextInputPropsSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: DatePickerTextInputProps,\n};\n\nexport const WithTimePicker: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: DatePickerWithTimePickerSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: DatePickerWithTimePicker,\n};\n\nexport const WithTimeZone: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: DatePickerWithTimeZoneSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: DatePickerWithTimeZone,\n};\n\nexport const Disabled: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: DatePickerDisabledSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: DatePickerDisabled,\n};\n\nexport const InDialog: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: DatePickerInDialogSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: DatePickerInDialog,\n};\n\nexport const Full: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: DatePickerFullSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: DatePickerFull,\n};\n\nexport const Range: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: DatePickerRangeSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: DatePickerRange,\n};\n\nexport const Portaled: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: DatePickerPortaledSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: DatePickerPortaled,\n};\n\nexport const WithTimeZoneBothMode: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: DatePickerWithTimeZoneBothModeSource,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: DatePickerWithTimeZoneBothMode,\n};\n"]}
|
|
@@ -24,6 +24,8 @@ export { default as DatePickerMinMaxDate } from './date-picker-min-max-date.stor
|
|
|
24
24
|
export { default as DatePickerOpensToDate } from './date-picker-opens-to-date.story';
|
|
25
25
|
export { default as DatePickerTextInputProps } from './date-picker-text-input-props.story';
|
|
26
26
|
export { default as DatePickerWithTimePicker } from './date-picker-with-time-picker.story';
|
|
27
|
+
export { default as DatePickerWithTimeZone } from './date-picker-with-timezone.story';
|
|
28
|
+
export { default as DatePickerWithTimeZoneBothMode } from './date-picker-with-timezone-both-mode.story';
|
|
27
29
|
export { default as DatePickerDisabled } from './date-picker-disabled.story';
|
|
28
30
|
export { default as DatePickerInDialog } from './date-picker-in-dialog.story';
|
|
29
31
|
export { default as DatePickerFull } from './date-picker-full.story';
|
|
@@ -41,12 +43,16 @@ import DatePickerRangeSourceRaw from './date-picker-range.story.tsx?raw';
|
|
|
41
43
|
import DatePickerStartsOnMondaySourceRaw from './date-picker-starts-on-monday.story.tsx?raw';
|
|
42
44
|
import DatePickerTextInputPropsSourceRaw from './date-picker-text-input-props.story.tsx?raw';
|
|
43
45
|
import DatePickerWithTimePickerSourceRaw from './date-picker-with-time-picker.story.tsx?raw';
|
|
46
|
+
import DatePickerWithTimeZoneSourceRaw from './date-picker-with-timezone.story.tsx?raw';
|
|
47
|
+
import DatePickerWithTimeZoneBothModeSourceRaw from './date-picker-with-timezone-both-mode.story.tsx?raw';
|
|
44
48
|
export const DatePickerDefaultSource = removeLicenseHeader(DatePickerDefaultSourceRaw);
|
|
45
49
|
export const DatePickerStartsOnMondaySource = removeLicenseHeader(DatePickerStartsOnMondaySourceRaw);
|
|
46
50
|
export const DatePickerMinMaxDateSource = removeLicenseHeader(DatePickerMinMaxDateSourceRaw);
|
|
47
51
|
export const DatePickerOpensToDateSource = removeLicenseHeader(DatePickerOpensToDateSourceRaw);
|
|
48
52
|
export const DatePickerTextInputPropsSource = removeLicenseHeader(DatePickerTextInputPropsSourceRaw);
|
|
49
53
|
export const DatePickerWithTimePickerSource = removeLicenseHeader(DatePickerWithTimePickerSourceRaw);
|
|
54
|
+
export const DatePickerWithTimeZoneSource = removeLicenseHeader(DatePickerWithTimeZoneSourceRaw);
|
|
55
|
+
export const DatePickerWithTimeZoneBothModeSource = removeLicenseHeader(DatePickerWithTimeZoneBothModeSourceRaw);
|
|
50
56
|
export const DatePickerDisabledSource = removeLicenseHeader(DatePickerDisabledSourceRaw);
|
|
51
57
|
export const DatePickerInDialogSource = removeLicenseHeader(DatePickerInDialogSourceRaw);
|
|
52
58
|
export const DatePickerFullSource = removeLicenseHeader(DatePickerFullSourceRaw);
|
|
@@ -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,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,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AAEpF,OAAO,0BAA0B,MAAM,qCAAqC,CAAC;AAC7E,OAAO,2BAA2B,MAAM,sCAAsC,CAAC;AAC/E,OAAO,uBAAuB,MAAM,kCAAkC,CAAC;AACvE,OAAO,2BAA2B,MAAM,uCAAuC,CAAC;AAChF,OAAO,6BA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BAAmB,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 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 '@neo4j-ndl/react/_common/export-stories-utils';\n\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"]}
|
|
@@ -101,7 +101,7 @@ const DropzoneComponent = (_a) => {
|
|
|
101
101
|
}
|
|
102
102
|
}, [isDragActive, isRejected]);
|
|
103
103
|
return (_jsxs(_Fragment, { children: [isRejected && (_jsxs(Banner, { className: "ndl-dropzone-error-alert", variant: "danger", children: [_jsx(Banner.Header, { children: "Error" }), _jsx(Banner.Description, { children: Boolean(rejectedText) || 'File extension not supported.' })] })), _jsx("div", Object.assign({ ref: mergedRef, className: wrapperClasses, style: style }, restProps, htmlAttributes, { children: _jsxs("div", Object.assign({ className: "ndl-dropzone-inner-wrapper" }, getRootProps(), { children: [_jsx("input", Object.assign({ "aria-label": "Drag and drop area" }, getInputProps())), _jsxs("div", { className: "ndl-dropzone-inner", children: [width !== undefined && width > 230 && (_jsx(_Fragment, { children: isDragActive && !isSafari ? (computedFileImage) : (_jsx(DocumentArrowUpIconOutline, { className: "ndl-dropzone-upload-icon" })) })), !isUploading && (_jsxs("div", { className: "ndl-dnd-title-container", children: [_jsx(Typography, { variant: "subheading-medium", children: titleText ||
|
|
104
|
-
(heading !== null && heading !== void 0 ? heading : (_jsxs(_Fragment, { children: ["Drag ", _jsx("span", { className: "n-font-light", children: "&" }), " Drop"] }))) }), !isDragReject && (_jsxs("div", { className: "ndl-dnd-subtitle", children: [_jsx(Typography, { variant: "body-medium", children: "or" }), ' ', _jsx("button", { className: "ndl-dnd-browse-link", onClick: () => open(), disabled: isDisabled, children: "Browse" })] }))] })), _jsxs("div", { className: "ndl-dropzone-footer", children: [isUploading && _jsx(_Fragment, { children: loadingElement }), !isUploading && (_jsx("div", { className: "ndl-file-support-text", children: supportedFilesDescription }))] })] })] })) }))] }));
|
|
104
|
+
(heading !== null && heading !== void 0 ? heading : (_jsxs(_Fragment, { children: ["Drag ", _jsx("span", { className: "n-font-light", children: "&" }), " Drop"] }))) }), !isDragReject && (_jsxs("div", { className: "ndl-dnd-subtitle", children: [_jsx(Typography, { variant: "body-medium", children: "or" }), ' ', _jsx("button", { className: "ndl-dnd-browse-link", onClick: () => open(), disabled: isDisabled, type: "button", children: "Browse" })] }))] })), _jsxs("div", { className: "ndl-dropzone-footer", children: [isUploading && _jsx(_Fragment, { children: loadingElement }), !isUploading && (_jsx("div", { className: "ndl-file-support-text", children: supportedFilesDescription }))] })] })] })) }))] }));
|
|
105
105
|
};
|
|
106
106
|
const DropzoneLoadingProgressBarComponent = (_a) => {
|
|
107
107
|
var { progressBarPrecentage, progressBarMinute, htmlAttributes, className, style, ref } = _a, restProps = __rest(_a, ["progressBarPrecentage", "progressBarMinute", "htmlAttributes", "className", "style", "ref"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropzone.js","sourceRoot":"","sources":["../../../src/dropzone/Dropzone.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAkB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAIL,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,gBAAgB,GACj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* 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 { useMergeRefs } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { detect } from 'detect-browser';\nimport { type RefObject, useMemo, useRef, useState } from 'react';\nimport {\n type DropEvent,\n type DropzoneOptions,\n type FileRejection,\n useDropzone,\n} from 'react-dropzone';\nimport { useResizeObserver } from 'usehooks-ts';\n\nimport { type CommonProps } from '../_common/types';\nimport { Banner } from '../banner';\nimport {\n DocumentArrowUpIconOutline,\n DocumentArrowUpIconSolid,\n XCircleIconSolid,\n} from '../icons';\nimport { ProgressBar } from '../progress-bar';\nimport { Typography } from '../typography';\n\n/**\n *\n *\n * Types\n *\n *\n */\ntype DropzoneProps = {\n /** Props for the underlying `react-dropzone` component. Don't use `accept`. If using custom file extensions as this option is broken. Instead use the `acceptedFileExtensions` property. */\n dropZoneOptions: DropzoneOptions;\n\n /** Informational text that highlights the supported file types, will be displayed in the footer. */\n supportedFilesDescription?: React.ReactNode;\n\n /** Element to display when uploading the file.*/\n loadingElement?: React.ReactNode;\n\n /** Use when wanting a custom heading. */\n heading?: React.ReactNode;\n\n /** Message to be shown when file is rejected. */\n rejectedText?: React.ReactNode;\n\n /** The accepted file extensions for the Drag-and-Drop. */\n acceptedFileExtensions?: string[];\n};\n\ntype DropzoneLoadingProgressBarProps = {\n /** The percentage of the progress bar. */\n progressBarPrecentage: number;\n\n /** The time in minute left to upload the file. */\n progressBarMinute?: number;\n};\n\n/**\n *\n *\n * Helpers\n *\n *\n */\n\nconst browser = detect();\n\nconst isSafari = browser?.name === 'safari';\n\nconst DropzoneComponent = ({\n dropZoneOptions,\n supportedFilesDescription,\n loadingElement,\n heading,\n rejectedText,\n acceptedFileExtensions,\n htmlAttributes,\n style,\n className,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneProps>) => {\n /**\n * We intercept the onDrop function in order to enforce\n * custom file extensions. Before calling the onDrop props we check\n * if the custom file extensions is acceptable. If the extension\n * conforms to acceptedFileExtensions, we call onDrop. Otherwise, we\n * present an error message.\n */\n function onDropInterceptor<T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ) {\n if (acceptedFileExtensions && acceptedFileExtensions.length > 0) {\n for (const file of acceptedFiles) {\n const isAccepted = acceptedFileExtensions.some((extension) => {\n if (file.name.endsWith(extension)) return true;\n });\n if (!isAccepted) {\n setIsRejected(true);\n return;\n }\n }\n }\n setIsRejected(false);\n dropZoneOptions.onDrop?.(acceptedFiles, fileRejections, event);\n }\n\n const [isRejected, setIsRejected] = useState(false);\n const dropZoneRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs([dropZoneRef, ref]);\n const isDisabled = dropZoneOptions?.disabled || Boolean(loadingElement);\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isDragAccept,\n isDragReject,\n open,\n } = useDropzone({\n ...dropZoneOptions,\n disabled: isDisabled,\n noClick: true,\n onDrop: onDropInterceptor,\n });\n\n const { width } = useResizeObserver({\n ref: dropZoneRef as RefObject<HTMLElement>,\n });\n\n const isUploading = Boolean(loadingElement);\n\n const titleText =\n isDragActive && isDragReject\n ? 'Format not supported'\n : isDragActive && !isDragReject\n ? 'Drop file'\n : null;\n\n const computedFileImage =\n (isDragActive && isDragAccept) || isUploading ? (\n <DocumentArrowUpIconSolid className=\"n-size-token-48 n-text-primary-bg-strong\" />\n ) : (\n <XCircleIconSolid className=\"n-size-token-48 n-text-danger-bg-strong\" />\n );\n\n const wrapperClasses = classNames('ndl-dropzone', className, {\n 'ndl-drag-active': isDragActive,\n 'ndl-drag-disabled': dropZoneOptions?.disabled,\n 'ndl-file-invalid': isDragActive && isDragReject,\n });\n\n useMemo(() => {\n if (isDragActive && isRejected) {\n setIsRejected(false);\n }\n }, [isDragActive, isRejected]);\n\n return (\n <>\n {isRejected && (\n <Banner className=\"ndl-dropzone-error-alert\" variant=\"danger\">\n <Banner.Header>Error</Banner.Header>\n <Banner.Description>\n {Boolean(rejectedText) || 'File extension not supported.'}\n </Banner.Description>\n </Banner>\n )}\n <div\n ref={mergedRef}\n className={wrapperClasses}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-dropzone-inner-wrapper\" {...getRootProps()}>\n <input aria-label=\"Drag and drop area\" {...getInputProps()} />\n <div className=\"ndl-dropzone-inner\">\n {/* Illustration should be visible only after arbitrary width */}\n {width !== undefined && width > 230 && (\n <>\n {isDragActive && !isSafari ? (\n computedFileImage\n ) : (\n <DocumentArrowUpIconOutline className=\"ndl-dropzone-upload-icon\" />\n )}\n </>\n )}\n {!isUploading && (\n <div className=\"ndl-dnd-title-container\">\n <Typography variant=\"subheading-medium\">\n {titleText ||\n (heading ?? (\n <>\n Drag <span className=\"n-font-light\">&</span> Drop\n </>\n ))}\n </Typography>\n {!isDragReject && (\n <div className=\"ndl-dnd-subtitle\">\n <Typography variant=\"body-medium\">or</Typography>{' '}\n <button\n className=\"ndl-dnd-browse-link\"\n onClick={() => open()}\n disabled={isDisabled}\n >\n Browse\n </button>\n </div>\n )}\n </div>\n )}\n <div className=\"ndl-dropzone-footer\">\n {isUploading && <>{loadingElement}</>}\n {!isUploading && (\n <div className=\"ndl-file-support-text\">\n {supportedFilesDescription}\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n </>\n );\n};\n\nconst DropzoneLoadingProgressBarComponent = ({\n progressBarPrecentage,\n progressBarMinute,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneLoadingProgressBarProps>) => {\n return (\n <div className=\"ndl-dropzone-loading-progress-bar-wrapper\">\n <div className=\"ndl-dropzone-loading-progress-bar-indicators\">\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-precentage\"\n variant=\"subheading-small\"\n >\n {progressBarPrecentage + '%'}\n </Typography>\n {Boolean(progressBarMinute) && (\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-minute\"\n variant=\"body-medium\"\n >{`(${progressBarMinute} minutes left)`}</Typography>\n )}\n </div>\n <ProgressBar\n className={classNames('ndl-dropzone-loading-progress-bar', className)}\n value={progressBarPrecentage}\n size=\"large\"\n htmlAttributes={htmlAttributes}\n ref={ref}\n style={style}\n {...restProps}\n />\n </div>\n );\n};\n\nconst Dropzone = Object.assign(DropzoneComponent, {\n LoadingProgressBar: DropzoneLoadingProgressBarComponent,\n});\n\nexport { Dropzone };\n"]}
|
|
1
|
+
{"version":3,"file":"Dropzone.js","sourceRoot":"","sources":["../../../src/dropzone/Dropzone.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAkB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAIL,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAqC3C;;;;;;GAMG;AAEH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;A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SAAS,EAAC,uBAAuB,YACnC,yBAAyB,GACtB,CACP,IACG,IACF,KACF,IACF,IACL,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,mCAAmC,GAAG,CAAC,EAQS,EAAE,EAAE;QARb,EAC3C,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,KAAK,EACL,GAAG,OAEiD,EADjD,SAAS,cAP+B,6FAQ5C,CADa;IAEZ,OAAO,CACL,eAAK,SAAS,EAAC,2CAA2C,aACxD,eAAK,SAAS,EAAC,8CAA8C,aAC3D,KAAC,UAAU,IACT,SAAS,EAAC,8CAA8C,EACxD,OAAO,EAAC,kBAAkB,YAEzB,qBAAqB,GAAG,GAAG,GACjB,EACZ,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAC7B,KAAC,UAAU,IACT,SAAS,EAAC,0CAA0C,EACpD,OAAO,EAAC,aAAa,YACrB,IAAI,iBAAiB,gBAAgB,GAAc,CACtD,IACG,EACN,KAAC,WAAW,kBACV,SAAS,EAAE,UAAU,CAAC,mCAAmC,EAAE,SAAS,CAAC,EACrE,KAAK,EAAE,qBAAqB,EAC5B,IAAI,EAAC,OAAO,EACZ,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,IACR,SAAS,EACb,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE;IAChD,kBAAkB,EAAE,mCAAmC;CACxD,CAAC,CAAC;AAEH,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 */\nimport { useMergeRefs } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { detect } from 'detect-browser';\nimport { type RefObject, useMemo, useRef, useState } from 'react';\nimport {\n type DropEvent,\n type DropzoneOptions,\n type FileRejection,\n useDropzone,\n} from 'react-dropzone';\nimport { useResizeObserver } from 'usehooks-ts';\n\nimport { type CommonProps } from '../_common/types';\nimport { Banner } from '../banner';\nimport {\n DocumentArrowUpIconOutline,\n DocumentArrowUpIconSolid,\n XCircleIconSolid,\n} from '../icons';\nimport { ProgressBar } from '../progress-bar';\nimport { Typography } from '../typography';\n\n/**\n *\n *\n * Types\n *\n *\n */\ntype DropzoneProps = {\n /** Props for the underlying `react-dropzone` component. Don't use `accept`. If using custom file extensions as this option is broken. Instead use the `acceptedFileExtensions` property. */\n dropZoneOptions: DropzoneOptions;\n\n /** Informational text that highlights the supported file types, will be displayed in the footer. */\n supportedFilesDescription?: React.ReactNode;\n\n /** Element to display when uploading the file.*/\n loadingElement?: React.ReactNode;\n\n /** Use when wanting a custom heading. */\n heading?: React.ReactNode;\n\n /** Message to be shown when file is rejected. */\n rejectedText?: React.ReactNode;\n\n /** The accepted file extensions for the Drag-and-Drop. */\n acceptedFileExtensions?: string[];\n};\n\ntype DropzoneLoadingProgressBarProps = {\n /** The percentage of the progress bar. */\n progressBarPrecentage: number;\n\n /** The time in minute left to upload the file. */\n progressBarMinute?: number;\n};\n\n/**\n *\n *\n * Helpers\n *\n *\n */\n\nconst browser = detect();\n\nconst isSafari = browser?.name === 'safari';\n\nconst DropzoneComponent = ({\n dropZoneOptions,\n supportedFilesDescription,\n loadingElement,\n heading,\n rejectedText,\n acceptedFileExtensions,\n htmlAttributes,\n style,\n className,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneProps>) => {\n /**\n * We intercept the onDrop function in order to enforce\n * custom file extensions. Before calling the onDrop props we check\n * if the custom file extensions is acceptable. If the extension\n * conforms to acceptedFileExtensions, we call onDrop. Otherwise, we\n * present an error message.\n */\n function onDropInterceptor<T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ) {\n if (acceptedFileExtensions && acceptedFileExtensions.length > 0) {\n for (const file of acceptedFiles) {\n const isAccepted = acceptedFileExtensions.some((extension) => {\n if (file.name.endsWith(extension)) return true;\n });\n if (!isAccepted) {\n setIsRejected(true);\n return;\n }\n }\n }\n setIsRejected(false);\n dropZoneOptions.onDrop?.(acceptedFiles, fileRejections, event);\n }\n\n const [isRejected, setIsRejected] = useState(false);\n const dropZoneRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs([dropZoneRef, ref]);\n const isDisabled = dropZoneOptions?.disabled || Boolean(loadingElement);\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isDragAccept,\n isDragReject,\n open,\n } = useDropzone({\n ...dropZoneOptions,\n disabled: isDisabled,\n noClick: true,\n onDrop: onDropInterceptor,\n });\n\n const { width } = useResizeObserver({\n ref: dropZoneRef as RefObject<HTMLElement>,\n });\n\n const isUploading = Boolean(loadingElement);\n\n const titleText =\n isDragActive && isDragReject\n ? 'Format not supported'\n : isDragActive && !isDragReject\n ? 'Drop file'\n : null;\n\n const computedFileImage =\n (isDragActive && isDragAccept) || isUploading ? (\n <DocumentArrowUpIconSolid className=\"n-size-token-48 n-text-primary-bg-strong\" />\n ) : (\n <XCircleIconSolid className=\"n-size-token-48 n-text-danger-bg-strong\" />\n );\n\n const wrapperClasses = classNames('ndl-dropzone', className, {\n 'ndl-drag-active': isDragActive,\n 'ndl-drag-disabled': dropZoneOptions?.disabled,\n 'ndl-file-invalid': isDragActive && isDragReject,\n });\n\n useMemo(() => {\n if (isDragActive && isRejected) {\n setIsRejected(false);\n }\n }, [isDragActive, isRejected]);\n\n return (\n <>\n {isRejected && (\n <Banner className=\"ndl-dropzone-error-alert\" variant=\"danger\">\n <Banner.Header>Error</Banner.Header>\n <Banner.Description>\n {Boolean(rejectedText) || 'File extension not supported.'}\n </Banner.Description>\n </Banner>\n )}\n <div\n ref={mergedRef}\n className={wrapperClasses}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-dropzone-inner-wrapper\" {...getRootProps()}>\n <input aria-label=\"Drag and drop area\" {...getInputProps()} />\n <div className=\"ndl-dropzone-inner\">\n {/* Illustration should be visible only after arbitrary width */}\n {width !== undefined && width > 230 && (\n <>\n {isDragActive && !isSafari ? (\n computedFileImage\n ) : (\n <DocumentArrowUpIconOutline className=\"ndl-dropzone-upload-icon\" />\n )}\n </>\n )}\n {!isUploading && (\n <div className=\"ndl-dnd-title-container\">\n <Typography variant=\"subheading-medium\">\n {titleText ||\n (heading ?? (\n <>\n Drag <span className=\"n-font-light\">&</span> Drop\n </>\n ))}\n </Typography>\n {!isDragReject && (\n <div className=\"ndl-dnd-subtitle\">\n <Typography variant=\"body-medium\">or</Typography>{' '}\n <button\n className=\"ndl-dnd-browse-link\"\n onClick={() => open()}\n disabled={isDisabled}\n type=\"button\"\n >\n Browse\n </button>\n </div>\n )}\n </div>\n )}\n <div className=\"ndl-dropzone-footer\">\n {isUploading && <>{loadingElement}</>}\n {!isUploading && (\n <div className=\"ndl-file-support-text\">\n {supportedFilesDescription}\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n </>\n );\n};\n\nconst DropzoneLoadingProgressBarComponent = ({\n progressBarPrecentage,\n progressBarMinute,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneLoadingProgressBarProps>) => {\n return (\n <div className=\"ndl-dropzone-loading-progress-bar-wrapper\">\n <div className=\"ndl-dropzone-loading-progress-bar-indicators\">\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-precentage\"\n variant=\"subheading-small\"\n >\n {progressBarPrecentage + '%'}\n </Typography>\n {Boolean(progressBarMinute) && (\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-minute\"\n variant=\"body-medium\"\n >{`(${progressBarMinute} minutes left)`}</Typography>\n )}\n </div>\n <ProgressBar\n className={classNames('ndl-dropzone-loading-progress-bar', className)}\n value={progressBarPrecentage}\n size=\"large\"\n htmlAttributes={htmlAttributes}\n ref={ref}\n style={style}\n {...restProps}\n />\n </div>\n );\n};\n\nconst Dropzone = Object.assign(DropzoneComponent, {\n LoadingProgressBar: DropzoneLoadingProgressBarComponent,\n});\n\nexport { Dropzone };\n"]}
|
package/lib/esm/index.js
CHANGED
|
@@ -63,6 +63,7 @@ export { ToasterControlled, Toaster, toast } from './toast';
|
|
|
63
63
|
export { Tooltip } from './tooltip';
|
|
64
64
|
export { Skeleton } from './skeleton';
|
|
65
65
|
export { TimePicker, NeedleTime } from './time-picker';
|
|
66
|
+
export { TimeZonePicker } from './timezone-picker';
|
|
66
67
|
export { Spotlight, SpotlightProvider, SpotlightTarget, SpotlightTour, useSpotlightContext, } from './spotlight';
|
|
67
68
|
export { LoadingBar } from './loading-bar';
|
|
68
69
|
export { IconButton } from './icon-button';
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,eA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E,GAAG,EAAE,MAAM,OAAO,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 { Accordion } from './accordion';\nexport { StatusLabel } from './status-label';\nexport { Banner } from './banner';\nexport { Checkbox } from './checkbox';\nexport { Switch } from './switch';\nexport { Radio } from './radio';\nexport { Menu } from './menu';\nexport { DatePicker } from './date-picker';\nexport { Dialog } from './dialog';\nexport { LoadingSpinner } from './loading-spinner';\nexport { Tabs } from './tabs';\nexport { SegmentedControl } from './segmented-control';\nexport { Popover } from './popover';\nexport { ProgressBar } from './progress-bar';\nexport { Dropzone } from './dropzone';\nexport {\n DataGrid,\n useDataGridContext,\n useTableNav,\n dataGridUtils,\n DataGridNav,\n} from './data-grid';\nexport { TextInput } from './text-input';\nexport { TextArea } from './text-area';\nexport { TextLink } from './text-link';\nexport { Select } from './select';\nexport { Tag } from './tag';\nexport * from './theme';\nexport { Wizard } from './wizard';\nexport { GraphLabel } from './graph-label';\nexport { CodeBlock } from './code-block';\nexport { StatusIndicator } from './status-indicator';\nexport { SideNavigation } from './side-navigation';\nexport { Typography } from './typography';\nexport { Drawer } from './drawer';\nexport { Breadcrumbs } from './breadcrumbs';\nexport * from './hooks';\nexport { Box } from './box';\nexport { Flex } from './flex';\nexport { Avatar } from './avatar';\nexport { Logo } from './logo';\nexport { ClipboardButton } from './clipboard-button';\nexport { Slider } from './slider';\nexport { InlineEdit } from './inline-edit';\nexport { DropdownButton } from './dropdown-button';\nexport { Divider } from './divider';\nexport * from './tree-view';\nexport { ToasterControlled, Toaster, toast, type ToastId } from './toast';\nexport { Tooltip } from './tooltip';\nexport { Skeleton } from './skeleton';\nexport { TimePicker, NeedleTime } from './time-picker';\nexport {\n Spotlight,\n SpotlightProvider,\n SpotlightTarget,\n SpotlightTour,\n useSpotlightContext,\n} from './spotlight';\nexport { LoadingBar } from './loading-bar';\nexport { IconButton } from './icon-button';\nexport { CleanIconButton } from './clean-icon-button';\nexport { IconButtonArray } from './icon-button-array';\nexport { ConditionalWrap } from './conditional-wrap';\nexport { ColorPicker } from './color-picker';\nexport { OutlinedButton } from './outlined-button';\nexport { FilledButton } from './filled-button';\nexport { TextButton } from './text-button';\nexport { Code } from './code';\nexport { Kbd } from './kbd';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW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C;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,mBAAmB,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,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 { Accordion } from './accordion';\nexport { StatusLabel } from './status-label';\nexport { Banner } from './banner';\nexport { Checkbox } from './checkbox';\nexport { Switch } from './switch';\nexport { Radio } from './radio';\nexport { Menu } from './menu';\nexport { DatePicker } from './date-picker';\nexport { Dialog } from './dialog';\nexport { LoadingSpinner } from './loading-spinner';\nexport { Tabs } from './tabs';\nexport { SegmentedControl } from './segmented-control';\nexport { Popover } from './popover';\nexport { ProgressBar } from './progress-bar';\nexport { Dropzone } from './dropzone';\nexport {\n DataGrid,\n useDataGridContext,\n useTableNav,\n dataGridUtils,\n DataGridNav,\n} from './data-grid';\nexport { TextInput } from './text-input';\nexport { TextArea } from './text-area';\nexport { TextLink } from './text-link';\nexport { Select } from './select';\nexport { Tag } from './tag';\nexport * from './theme';\nexport { Wizard } from './wizard';\nexport { GraphLabel } from './graph-label';\nexport { CodeBlock } from './code-block';\nexport { StatusIndicator } from './status-indicator';\nexport { SideNavigation } from './side-navigation';\nexport { Typography } from './typography';\nexport { Drawer } from './drawer';\nexport { Breadcrumbs } from './breadcrumbs';\nexport * from './hooks';\nexport { Box } from './box';\nexport { Flex } from './flex';\nexport { Avatar } from './avatar';\nexport { Logo } from './logo';\nexport { ClipboardButton } from './clipboard-button';\nexport { Slider } from './slider';\nexport { InlineEdit } from './inline-edit';\nexport { DropdownButton } from './dropdown-button';\nexport { Divider } from './divider';\nexport * from './tree-view';\nexport { ToasterControlled, Toaster, toast, type ToastId } from './toast';\nexport { Tooltip } from './tooltip';\nexport { Skeleton } from './skeleton';\nexport { TimePicker, NeedleTime } from './time-picker';\nexport { TimeZonePicker } from './timezone-picker';\nexport {\n Spotlight,\n SpotlightProvider,\n SpotlightTarget,\n SpotlightTour,\n useSpotlightContext,\n} from './spotlight';\nexport { LoadingBar } from './loading-bar';\nexport { IconButton } from './icon-button';\nexport { CleanIconButton } from './clean-icon-button';\nexport { IconButtonArray } from './icon-button-array';\nexport { ConditionalWrap } from './conditional-wrap';\nexport { ColorPicker } from './color-picker';\nexport { OutlinedButton } from './outlined-button';\nexport { FilledButton } from './filled-button';\nexport { TextButton } from './text-button';\nexport { Code } from './code';\nexport { Kbd } from './kbd';\n"]}
|
|
@@ -21,7 +21,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
21
21
|
*/
|
|
22
22
|
import { autoUpdate, flip, FloatingFocusManager, FloatingPortal, offset, shift, useDismiss, useFloating, useInteractions, useMergeRefs, useTransitionStyles, } from '@floating-ui/react';
|
|
23
23
|
import { tokens } from '@neo4j-ndl/base';
|
|
24
|
-
import
|
|
24
|
+
import classNames from 'classnames';
|
|
25
25
|
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState, } from 'react';
|
|
26
26
|
import { ConditionalWrap } from '../conditional-wrap';
|
|
27
27
|
import { useIsInsideDialog } from '../dialog/dialog-context';
|
|
@@ -222,7 +222,7 @@ export const TimePicker = ({ format = 'hh:mm', isDisabled, isFluid, isReadOnly,
|
|
|
222
222
|
duration: (_b = Number.parseInt(tokens.motion.duration.quick)) !== null && _b !== void 0 ? _b : 0,
|
|
223
223
|
});
|
|
224
224
|
const mergedRef = useMergeRefs([refs.setReference, containerRef]);
|
|
225
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", Object.assign({ className:
|
|
225
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", Object.assign({ className: classNames('ndl-time-picker', className, Object.assign({}, classes)), ref: mergedRef }, getReferenceProps(), { style: {
|
|
226
226
|
width: isFluid === true ? '100%' : 'fit-content',
|
|
227
227
|
}, children: [_jsxs("label", { className: "ndl-time-picker-label", children: [label !== undefined && (_jsx(Typography, { variant: size === 'large' ? 'body-large' : 'body-medium', children: label })), _jsxs("div", { className: "ndl-time-picker-input-wrapper", style: Object.assign({ width: inputWidth }, style), children: [_jsx("input", Object.assign({ "aria-label": label, className: "ndl-time-picker-input", type: "text", ref: inputRef, value: inputValue, disabled: isDisabled, readOnly: isReadOnly, required: isRequired, onChange: newHandleInputChange, onKeyDown: handleKeyDown, onClick: () => {
|
|
228
228
|
if (isReadOnly === true || isDisabled === true)
|
|
@@ -251,7 +251,7 @@ export const TimePicker = ({ format = 'hh:mm', isDisabled, isFluid, isReadOnly,
|
|
|
251
251
|
setError(undefined);
|
|
252
252
|
setInputValue(time.toString(is24Hour));
|
|
253
253
|
}
|
|
254
|
-
}, placeholder: format, maxLength: is24Hour ? 5 : 8 }, htmlAttributes)), _jsx(ClockIconOutline, { className: "ndl-icon-svg ndl-time-picker-icon" })] })] }), errorToShow !== undefined && (_jsxs("div", { className: "ndl-time-picker-error-wrapper", children: [_jsx(ExclamationCircleIconSolid, { className: "ndl-time-picker-error-icon" }), _jsx(Typography, { variant: size === 'large' ? 'body-medium' : 'body-small', className: "ndl-time-picker-error-text", children: errorToShow })] }))] })), context.open && (_jsx(ConditionalWrap, { shouldWrap: isPortaled, wrap: (wrapChildren) => (_jsx(FloatingPortal, { children: wrapChildren })), children: _jsx(FloatingFocusManager, { context: context, modal: false, initialFocus: -1, children: _jsx("div", Object.assign({ ref: refs.setFloating, className:
|
|
254
|
+
}, placeholder: format, maxLength: is24Hour ? 5 : 8 }, htmlAttributes)), _jsx(ClockIconOutline, { className: "ndl-icon-svg ndl-time-picker-icon" })] })] }), errorToShow !== undefined && (_jsxs("div", { className: "ndl-time-picker-error-wrapper", children: [_jsx(ExclamationCircleIconSolid, { className: "ndl-time-picker-error-icon" }), _jsx(Typography, { variant: size === 'large' ? 'body-medium' : 'body-small', className: "ndl-time-picker-error-text", children: errorToShow })] }))] })), context.open && (_jsx(ConditionalWrap, { shouldWrap: isPortaled, wrap: (wrapChildren) => (_jsx(FloatingPortal, { children: wrapChildren })), children: _jsx(FloatingFocusManager, { context: context, modal: false, initialFocus: -1, children: _jsx("div", Object.assign({ ref: refs.setFloating, className: classNames(themeClassName, 'ndl-time-picker-popover', Object.assign({}, classes)), style: Object.assign(Object.assign(Object.assign({}, transitionStyles), floatingStyles), { width: isFluid === true
|
|
255
255
|
? (_c = containerRef.current) === null || _c === void 0 ? void 0 : _c.clientWidth
|
|
256
256
|
: undefined }) }, getFloatingProps(), { children: _jsx("ul", { ref: listRef, tabIndex: -1, children: timeOptions.map((time, i) => (_jsx("li", { role: "option", "aria-selected": (value === null || value === void 0 ? void 0 : value.toString(is24Hour)) === time ||
|
|
257
257
|
(editedInput === null || editedInput === void 0 ? void 0 : editedInput.toString(is24Hour)) === time, value: time, onClick: (e) => {
|
|
@@ -262,7 +262,7 @@ export const TimePicker = ({ format = 'hh:mm', isDisabled, isFluid, isReadOnly,
|
|
|
262
262
|
}, onMouseDown: (e) => {
|
|
263
263
|
e.stopPropagation();
|
|
264
264
|
e.preventDefault();
|
|
265
|
-
}, tabIndex: -1, className:
|
|
265
|
+
}, tabIndex: -1, className: classNames(focusedIndex === i ? 'focused' : '', 'ndl-time-picker-popover-item'), onKeyDown: (e) => {
|
|
266
266
|
if (e.key === 'Enter') {
|
|
267
267
|
e.stopPropagation();
|
|
268
268
|
handleOnClick(time);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimePicker.js","sourceRoot":"","sources":["../../../src/time-picker/TimePicker.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EACV,IAAI,EACJ,oBAAoB,EACpB,cAAc,EACd,MAAM,EACN,KAAK,EACL,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,YAAY,CAAC;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,EACX,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;oCACb,CAAC,CAAC,eAAe,EAAE,CAAC;oCACpB,CAAC,CAAC,cAAc,EAAE,CAAC;oCACnB,aAAa,CAAC,IAAI,CAAC,CAAC;oCACpB,gBAAgB,CAAC,KAAK,CAAC,CAAC;gCAC1B,CAAC,EACD,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE;oCACjB,CAAC,CAAC,eAAe,EAAE,CAAC;oCACpB,CAAC,CAAC,cAAc,EAAE,CAAC;gCACrB,CAAC,EACD,QAAQ,EAAE,CAAC,CAAC,EACZ,SAAS,EAAE,EAAE,CACX,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EACnC,8BAA8B,CAC/B,EACD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;oCACf,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;wCACtB,CAAC,CAAC,eAAe,EAAE,CAAC;wCACpB,aAAa,CAAC,IAAI,CAAC,CAAC;oCACtB,CAAC;gCACH,CAAC,YAEA,IAAI,IA7BA,CAAC,CA8BH,CACN,CAAC,GACC,IACD,GACe,GACP,CACnB,IACA,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n autoUpdate,\n flip,\n FloatingFocusManager,\n FloatingPortal,\n offset,\n shift,\n useDismiss,\n useFloating,\n useInteractions,\n useMergeRefs,\n useTransitionStyles,\n} from '@floating-ui/react';\nimport { tokens } from '@neo4j-ndl/base';\nimport cn from 'classnames';\nimport type React from 'react';\nimport {\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { ClockIconOutline, ExclamationCircleIconSolid } from '../icons';\nimport { useNeedleTheme } from '../theme';\nimport { Typography } from '../typography';\nimport { generateTimeOptions } from './generate-time-options';\nimport { NeedleTime } from './needle-time';\nimport {\n useKeyboardNavigation,\n useTimePickerPopover,\n} from './time-picker-hooks';\n\nexport type TimeFormat = 'hh:mm' | 'hh:mm aa';\n\nexport type TimePickerProps = {\n /** The value of the time picker */\n value?: NeedleTime;\n /** The format of the time picker */\n format?: TimeFormat;\n /** Whether the time picker is fluid */\n isFluid?: boolean;\n /** Whether the time picker is read only */\n isReadOnly?: boolean;\n /** Whether the time picker is required */\n isRequired?: boolean;\n /** Whether the time picker is disabled */\n isDisabled?: boolean;\n /** The time interval of the time picker, in minutes */\n timeInterval?: number;\n /** The label of the time picker */\n label?: string;\n /** The size of the time picker */\n size?: 'small' | 'medium' | 'large';\n /** Manually set the error text */\n errorText?: string;\n /** Callback function triggered when the time picker value changes */\n onChange?: (time: NeedleTime) => void;\n /** Callback function triggered when the time picker encounters an error */\n onError?: (error: string, time: NeedleTime) => void;\n /**\n * Strategy for the dropdown floating element.\n * By default it is absolute, but if the component is inside of a needle Dialog, it is set to fixed.\n * If this prop is set, no auto-detection of Dialog is done.\n */\n floatingStrategy?: 'absolute' | 'fixed';\n /** Whether the dropdown element is rendered in a portal. */\n isPortaled?: boolean;\n};\n\nexport const TimePicker = <T extends React.ElementType = 'div'>({\n format = 'hh:mm',\n isDisabled,\n isFluid,\n isReadOnly,\n isRequired,\n value,\n timeInterval = 15,\n label,\n onChange,\n className,\n onError,\n style,\n size = 'medium',\n errorText,\n htmlAttributes,\n floatingStrategy,\n isPortaled: isPortaledProp,\n ref,\n}: PolymorphicCommonProps<T, TimePickerProps>) => {\n const [editedInput, setEditedInput] = useState<NeedleTime | undefined>(value);\n\n const is24Hour = format === 'hh:mm';\n const [inputValue, setInputValue] = useState<string>(\n value?.toString(is24Hour) ?? '',\n );\n const listRef = useRef<HTMLUListElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(ref, () => inputRef.current as HTMLInputElement, []);\n const [lastAction, setLastAction] = useState<'type' | 'arrow'>('type');\n const [error, setError] = useState<string | undefined>(undefined);\n\n const timeOptions = useMemo(\n () => generateTimeOptions(is24Hour, timeInterval),\n [is24Hour, timeInterval],\n );\n\n const { themeClassName } = useNeedleTheme();\n const { isPopoverOpen, setIsPopoverOpen } = useTimePickerPopover(false);\n const { focusedIndex, setFocusedIndex, handleArrowNavigation } =\n useKeyboardNavigation(listRef, timeOptions.length);\n\n const classes = {\n 'ndl-small': size === 'small',\n 'ndl-medium': size === 'medium',\n 'ndl-large': size === 'large',\n 'ndl-error': error !== undefined,\n 'ndl-fluid': isFluid,\n 'ndl-disabled': isDisabled,\n 'ndl-read-only': isReadOnly,\n };\n\n const inputWidth =\n isFluid === true ? '100%' : is24Hour === true ? '6rem' : '9rem';\n\n const errorToShow =\n errorText !== undefined && errorText !== '' ? errorText : error;\n\n const isValidTime = useCallback((hours: number, minutes: number) => {\n if (hours > 23 || hours < 0) {\n return false;\n }\n\n if (minutes > 59 || minutes < 0) {\n return false;\n }\n\n return true;\n }, []);\n\n useEffect(() => {\n if (error !== undefined) {\n onError?.(error, NeedleTime.fromString(inputValue));\n }\n }, [error, inputValue, onError]);\n\n useEffect(() => {\n setEditedInput(value);\n setInputValue(value?.toString(is24Hour) ?? '');\n }, [is24Hour, value]);\n\n useEffect(() => {\n if (isPopoverOpen) {\n setTimeout(() => {\n listRef.current?.children[focusedIndex]?.scrollIntoView({\n block: 'center',\n inline: 'nearest',\n });\n }, 0);\n } else {\n setTimeout(() => {\n inputRef.current?.blur();\n const selectedIndex =\n timeOptions.indexOf(value?.toString(is24Hour) ?? '') ?? 0;\n setFocusedIndex(selectedIndex);\n }, 0);\n }\n }, [\n focusedIndex,\n is24Hour,\n isPopoverOpen,\n value,\n setFocusedIndex,\n timeOptions,\n ]);\n\n const handleOnClick = (timeText: string) => {\n if (onChange) {\n onChange(NeedleTime.fromString(timeText));\n }\n setError(undefined);\n setInputValue(timeText);\n setEditedInput(NeedleTime.fromString(timeText));\n setIsPopoverOpen(false);\n };\n const newHandleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n scrollToTime(e.target.value);\n setInputValue(e.target.value);\n setLastAction('type');\n\n const time = NeedleTime.fromString(e.target.value);\n if (!isValidTime(time.hour, time.minute)) {\n setError('Invalid time');\n } else {\n setError(undefined);\n }\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (isReadOnly === true || isDisabled === true) {\n e.preventDefault();\n return;\n }\n\n if (e.key === 'Escape') {\n setIsPopoverOpen(false);\n }\n\n setIsPopoverOpen(true);\n\n if (e.key === 'Enter') {\n if (lastAction === 'type' && inputValue.length >= (is24Hour ? 5 : 6)) {\n const time = NeedleTime.fromString(inputValue);\n handleOnClick(time.toString(is24Hour));\n } else if (lastAction === 'type' && !inputValue.includes(':')) {\n const time = NeedleTime.fromString(inputValue);\n if (isValidTime(time.hour, time.minute)) {\n handleOnClick(time.toString(is24Hour));\n }\n setIsPopoverOpen(false);\n } else {\n handleOnClick(timeOptions[focusedIndex]);\n }\n } else if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n e.preventDefault();\n setLastAction('arrow');\n handleArrowNavigation(e.key);\n }\n };\n\n const scrollToTime = (startOfTime: string) => {\n const parsedTime = startOfTime.toLowerCase().replace(/[^0-9amp]/g, '');\n let index = -1;\n\n // Handle AM/PM input\n const isPM = parsedTime.includes('p');\n const isAM = parsedTime.includes('a');\n const timeDigits = parsedTime.replace(/[amp]/g, '');\n\n if (timeDigits.length === 1) {\n // Single digit - assume it's an hour\n const hour = `0${timeDigits}`;\n const searchTime = is24Hour\n ? `${hour}:00`\n : `${hour}:00 ${isPM ? 'PM' : 'AM'}`;\n index = timeOptions.indexOf(searchTime);\n } else {\n // Find closest matching time\n const closestTime = timeOptions.find((time) => {\n const timeWithoutSpecialChars = time\n .toLowerCase()\n .replace(/[^0-9amp]/g, '');\n if (isPM || isAM) {\n // If AM/PM specified, match that specifically\n return timeWithoutSpecialChars.startsWith(parsedTime);\n } else {\n // Otherwise just match the numbers\n return timeWithoutSpecialChars\n .replace(/[amp]/g, '')\n .startsWith(timeDigits);\n }\n });\n index = closestTime !== undefined ? timeOptions.indexOf(closestTime) : -1;\n }\n\n if (index !== -1) {\n setFocusedIndex(index);\n }\n\n return index;\n };\n\n /** Custom floating ui solution */\n const isInsideDialog = useIsInsideDialog();\n const isPortaled = isPortaledProp ?? !isInsideDialog;\n const containerRef = useRef<HTMLDivElement>(null);\n const { refs, floatingStyles, context } = useFloating({\n elements: {\n reference: containerRef.current,\n },\n middleware: [\n offset(10),\n flip({\n fallbackPlacements: ['top'],\n fallbackStrategy: 'bestFit',\n }),\n shift({ padding: 5 }),\n ],\n onOpenChange: (open) => {\n setIsPopoverOpen(open);\n },\n open: isDisabled !== true && isReadOnly !== true && isPopoverOpen,\n placement: 'bottom',\n strategy: floatingStrategy ?? (isInsideDialog ? 'fixed' : 'absolute'),\n whileElementsMounted: autoUpdate,\n });\n const dismiss = useDismiss(context);\n const { getReferenceProps, getFloatingProps } = useInteractions([dismiss]);\n const { styles: transitionStyles } = useTransitionStyles(context, {\n duration: Number.parseInt(tokens.motion.duration.quick) ?? 0,\n });\n\n const mergedRef = useMergeRefs([refs.setReference, containerRef]);\n\n return (\n <>\n <div\n className={cn('ndl-time-picker', className, {\n ...classes,\n })}\n ref={mergedRef}\n {...getReferenceProps()}\n style={{\n width: isFluid === true ? '100%' : 'fit-content',\n }}\n >\n <label className=\"ndl-time-picker-label\">\n {label !== undefined && (\n <Typography\n variant={size === 'large' ? 'body-large' : 'body-medium'}\n >\n {label}\n </Typography>\n )}\n <div\n className=\"ndl-time-picker-input-wrapper\"\n style={{\n width: inputWidth,\n ...style,\n }}\n >\n <input\n aria-label={label} // TODO: handle label natively\n className=\"ndl-time-picker-input\"\n type=\"text\"\n ref={inputRef}\n value={inputValue}\n disabled={isDisabled}\n readOnly={isReadOnly}\n required={isRequired}\n onChange={newHandleInputChange}\n onKeyDown={handleKeyDown}\n onClick={() => {\n if (isReadOnly === true || isDisabled === true) return;\n setIsPopoverOpen(true);\n }}\n onBlur={(e) => {\n if (isReadOnly === true || isDisabled === true) return;\n\n if (\n e.relatedTarget?.classList.contains(\n 'ndl-time-picker-popover-item',\n ) === true\n ) {\n return;\n }\n\n if (inputValue.length < 4) {\n setError('Invalid time');\n return;\n }\n\n const time = NeedleTime.fromString(inputValue);\n\n if (time === undefined || time === null) {\n setError('Invalid time');\n return;\n }\n\n if (!isValidTime(time.hour, time.minute)) {\n setError('Invalid time');\n } else {\n setError(undefined);\n setInputValue(time.toString(is24Hour));\n }\n }}\n placeholder={format}\n maxLength={is24Hour ? 5 : 8}\n {...htmlAttributes}\n />\n <ClockIconOutline className=\"ndl-icon-svg ndl-time-picker-icon\" />\n </div>\n </label>\n {errorToShow !== undefined && (\n <div className=\"ndl-time-picker-error-wrapper\">\n <ExclamationCircleIconSolid className=\"ndl-time-picker-error-icon\" />\n <Typography\n variant={size === 'large' ? 'body-medium' : 'body-small'}\n className=\"ndl-time-picker-error-text\"\n >\n {errorToShow}\n </Typography>\n </div>\n )}\n </div>\n\n {context.open && (\n <ConditionalWrap\n shouldWrap={isPortaled}\n wrap={(wrapChildren) => (\n <FloatingPortal>{wrapChildren}</FloatingPortal>\n )}\n >\n <FloatingFocusManager\n context={context}\n modal={false}\n initialFocus={-1}\n >\n <div\n ref={refs.setFloating}\n className={cn(themeClassName, 'ndl-time-picker-popover', {\n ...classes,\n })}\n style={{\n ...transitionStyles,\n ...floatingStyles,\n width:\n isFluid === true\n ? containerRef.current?.clientWidth\n : undefined,\n }}\n {...getFloatingProps()}\n >\n <ul ref={listRef} tabIndex={-1}>\n {timeOptions.map((time, i) => (\n <li\n key={i}\n role=\"option\"\n aria-selected={\n value?.toString(is24Hour) === time ||\n editedInput?.toString(is24Hour) === time\n }\n value={time}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n handleOnClick(time);\n setIsPopoverOpen(false);\n }}\n onMouseDown={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n tabIndex={-1}\n className={cn(\n focusedIndex === i ? 'focused' : '',\n 'ndl-time-picker-popover-item',\n )}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.stopPropagation();\n handleOnClick(time);\n }\n }}\n >\n {time}\n </li>\n ))}\n </ul>\n </div>\n </FloatingFocusManager>\n </ConditionalWrap>\n )}\n </>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"TimePicker.js","sourceRoot":"","sources":["../../../src/time-picker/TimePicker.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EACV,IAAI,EACJ,oBAAoB,EACpB,cAAc,EACd,MAAM,EACN,KAAK,EACL,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EACL,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,E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ACjB,CAAC,CAAC,eAAe,EAAE,CAAC;oCACpB,CAAC,CAAC,cAAc,EAAE,CAAC;gCACrB,CAAC,EACD,QAAQ,EAAE,CAAC,CAAC,EACZ,SAAS,EAAE,UAAU,CACnB,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EACnC,8BAA8B,CAC/B,EACD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;oCACf,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;wCACtB,CAAC,CAAC,eAAe,EAAE,CAAC;wCACpB,aAAa,CAAC,IAAI,CAAC,CAAC;oCACtB,CAAC;gCACH,CAAC,YAEA,IAAI,IA7BA,CAAC,CA8BH,CACN,CAAC,GACC,IACD,GACe,GACP,CACnB,IACA,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n autoUpdate,\n flip,\n FloatingFocusManager,\n FloatingPortal,\n offset,\n shift,\n useDismiss,\n useFloating,\n useInteractions,\n useMergeRefs,\n useTransitionStyles,\n} from '@floating-ui/react';\nimport { tokens } from '@neo4j-ndl/base';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport {\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { ClockIconOutline, ExclamationCircleIconSolid } from '../icons';\nimport { useNeedleTheme } from '../theme';\nimport { Typography } from '../typography';\nimport { generateTimeOptions } from './generate-time-options';\nimport { NeedleTime } from './needle-time';\nimport {\n useKeyboardNavigation,\n useTimePickerPopover,\n} from './time-picker-hooks';\n\nexport type TimeFormat = 'hh:mm' | 'hh:mm aa';\n\nexport type TimePickerProps = {\n /** The value of the time picker */\n value?: NeedleTime;\n /** The format of the time picker */\n format?: TimeFormat;\n /** Whether the time picker is fluid */\n isFluid?: boolean;\n /** Whether the time picker is read only */\n isReadOnly?: boolean;\n /** Whether the time picker is required */\n isRequired?: boolean;\n /** Whether the time picker is disabled */\n isDisabled?: boolean;\n /** The time interval of the time picker, in minutes */\n timeInterval?: number;\n /** The label of the time picker */\n label?: string;\n /** The size of the time picker */\n size?: 'small' | 'medium' | 'large';\n /** Manually set the error text */\n errorText?: string;\n /** Callback function triggered when the time picker value changes */\n onChange?: (time: NeedleTime) => void;\n /** Callback function triggered when the time picker encounters an error */\n onError?: (error: string, time: NeedleTime) => void;\n /**\n * Strategy for the dropdown floating element.\n * By default it is absolute, but if the component is inside of a needle Dialog, it is set to fixed.\n * If this prop is set, no auto-detection of Dialog is done.\n */\n floatingStrategy?: 'absolute' | 'fixed';\n /** Whether the dropdown element is rendered in a portal. */\n isPortaled?: boolean;\n};\n\nexport const TimePicker = <T extends React.ElementType = 'div'>({\n format = 'hh:mm',\n isDisabled,\n isFluid,\n isReadOnly,\n isRequired,\n value,\n timeInterval = 15,\n label,\n onChange,\n className,\n onError,\n style,\n size = 'medium',\n errorText,\n htmlAttributes,\n floatingStrategy,\n isPortaled: isPortaledProp,\n ref,\n}: PolymorphicCommonProps<T, TimePickerProps>) => {\n const [editedInput, setEditedInput] = useState<NeedleTime | undefined>(value);\n\n const is24Hour = format === 'hh:mm';\n const [inputValue, setInputValue] = useState<string>(\n value?.toString(is24Hour) ?? '',\n );\n const listRef = useRef<HTMLUListElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(ref, () => inputRef.current as HTMLInputElement, []);\n const [lastAction, setLastAction] = useState<'type' | 'arrow'>('type');\n const [error, setError] = useState<string | undefined>(undefined);\n\n const timeOptions = useMemo(\n () => generateTimeOptions(is24Hour, timeInterval),\n [is24Hour, timeInterval],\n );\n\n const { themeClassName } = useNeedleTheme();\n const { isPopoverOpen, setIsPopoverOpen } = useTimePickerPopover(false);\n const { focusedIndex, setFocusedIndex, handleArrowNavigation } =\n useKeyboardNavigation(listRef, timeOptions.length);\n\n const classes = {\n 'ndl-small': size === 'small',\n 'ndl-medium': size === 'medium',\n 'ndl-large': size === 'large',\n 'ndl-error': error !== undefined,\n 'ndl-fluid': isFluid,\n 'ndl-disabled': isDisabled,\n 'ndl-read-only': isReadOnly,\n };\n\n const inputWidth =\n isFluid === true ? '100%' : is24Hour === true ? '6rem' : '9rem';\n\n const errorToShow =\n errorText !== undefined && errorText !== '' ? errorText : error;\n\n const isValidTime = useCallback((hours: number, minutes: number) => {\n if (hours > 23 || hours < 0) {\n return false;\n }\n\n if (minutes > 59 || minutes < 0) {\n return false;\n }\n\n return true;\n }, []);\n\n useEffect(() => {\n if (error !== undefined) {\n onError?.(error, NeedleTime.fromString(inputValue));\n }\n }, [error, inputValue, onError]);\n\n useEffect(() => {\n setEditedInput(value);\n setInputValue(value?.toString(is24Hour) ?? '');\n }, [is24Hour, value]);\n\n useEffect(() => {\n if (isPopoverOpen) {\n setTimeout(() => {\n listRef.current?.children[focusedIndex]?.scrollIntoView({\n block: 'center',\n inline: 'nearest',\n });\n }, 0);\n } else {\n setTimeout(() => {\n inputRef.current?.blur();\n const selectedIndex =\n timeOptions.indexOf(value?.toString(is24Hour) ?? '') ?? 0;\n setFocusedIndex(selectedIndex);\n }, 0);\n }\n }, [\n focusedIndex,\n is24Hour,\n isPopoverOpen,\n value,\n setFocusedIndex,\n timeOptions,\n ]);\n\n const handleOnClick = (timeText: string) => {\n if (onChange) {\n onChange(NeedleTime.fromString(timeText));\n }\n setError(undefined);\n setInputValue(timeText);\n setEditedInput(NeedleTime.fromString(timeText));\n setIsPopoverOpen(false);\n };\n const newHandleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n scrollToTime(e.target.value);\n setInputValue(e.target.value);\n setLastAction('type');\n\n const time = NeedleTime.fromString(e.target.value);\n if (!isValidTime(time.hour, time.minute)) {\n setError('Invalid time');\n } else {\n setError(undefined);\n }\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (isReadOnly === true || isDisabled === true) {\n e.preventDefault();\n return;\n }\n\n if (e.key === 'Escape') {\n setIsPopoverOpen(false);\n }\n\n setIsPopoverOpen(true);\n\n if (e.key === 'Enter') {\n if (lastAction === 'type' && inputValue.length >= (is24Hour ? 5 : 6)) {\n const time = NeedleTime.fromString(inputValue);\n handleOnClick(time.toString(is24Hour));\n } else if (lastAction === 'type' && !inputValue.includes(':')) {\n const time = NeedleTime.fromString(inputValue);\n if (isValidTime(time.hour, time.minute)) {\n handleOnClick(time.toString(is24Hour));\n }\n setIsPopoverOpen(false);\n } else {\n handleOnClick(timeOptions[focusedIndex]);\n }\n } else if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n e.preventDefault();\n setLastAction('arrow');\n handleArrowNavigation(e.key);\n }\n };\n\n const scrollToTime = (startOfTime: string) => {\n const parsedTime = startOfTime.toLowerCase().replace(/[^0-9amp]/g, '');\n let index = -1;\n\n // Handle AM/PM input\n const isPM = parsedTime.includes('p');\n const isAM = parsedTime.includes('a');\n const timeDigits = parsedTime.replace(/[amp]/g, '');\n\n if (timeDigits.length === 1) {\n // Single digit - assume it's an hour\n const hour = `0${timeDigits}`;\n const searchTime = is24Hour\n ? `${hour}:00`\n : `${hour}:00 ${isPM ? 'PM' : 'AM'}`;\n index = timeOptions.indexOf(searchTime);\n } else {\n // Find closest matching time\n const closestTime = timeOptions.find((time) => {\n const timeWithoutSpecialChars = time\n .toLowerCase()\n .replace(/[^0-9amp]/g, '');\n if (isPM || isAM) {\n // If AM/PM specified, match that specifically\n return timeWithoutSpecialChars.startsWith(parsedTime);\n } else {\n // Otherwise just match the numbers\n return timeWithoutSpecialChars\n .replace(/[amp]/g, '')\n .startsWith(timeDigits);\n }\n });\n index = closestTime !== undefined ? timeOptions.indexOf(closestTime) : -1;\n }\n\n if (index !== -1) {\n setFocusedIndex(index);\n }\n\n return index;\n };\n\n /** Custom floating ui solution */\n const isInsideDialog = useIsInsideDialog();\n const isPortaled = isPortaledProp ?? !isInsideDialog;\n const containerRef = useRef<HTMLDivElement>(null);\n const { refs, floatingStyles, context } = useFloating({\n elements: {\n reference: containerRef.current,\n },\n middleware: [\n offset(10),\n flip({\n fallbackPlacements: ['top'],\n fallbackStrategy: 'bestFit',\n }),\n shift({ padding: 5 }),\n ],\n onOpenChange: (open) => {\n setIsPopoverOpen(open);\n },\n open: isDisabled !== true && isReadOnly !== true && isPopoverOpen,\n placement: 'bottom',\n strategy: floatingStrategy ?? (isInsideDialog ? 'fixed' : 'absolute'),\n whileElementsMounted: autoUpdate,\n });\n const dismiss = useDismiss(context);\n const { getReferenceProps, getFloatingProps } = useInteractions([dismiss]);\n const { styles: transitionStyles } = useTransitionStyles(context, {\n duration: Number.parseInt(tokens.motion.duration.quick) ?? 0,\n });\n\n const mergedRef = useMergeRefs([refs.setReference, containerRef]);\n\n return (\n <>\n <div\n className={classNames('ndl-time-picker', className, {\n ...classes,\n })}\n ref={mergedRef}\n {...getReferenceProps()}\n style={{\n width: isFluid === true ? '100%' : 'fit-content',\n }}\n >\n <label className=\"ndl-time-picker-label\">\n {label !== undefined && (\n <Typography\n variant={size === 'large' ? 'body-large' : 'body-medium'}\n >\n {label}\n </Typography>\n )}\n <div\n className=\"ndl-time-picker-input-wrapper\"\n style={{\n width: inputWidth,\n ...style,\n }}\n >\n <input\n aria-label={label} // TODO: handle label natively\n className=\"ndl-time-picker-input\"\n type=\"text\"\n ref={inputRef}\n value={inputValue}\n disabled={isDisabled}\n readOnly={isReadOnly}\n required={isRequired}\n onChange={newHandleInputChange}\n onKeyDown={handleKeyDown}\n onClick={() => {\n if (isReadOnly === true || isDisabled === true) return;\n setIsPopoverOpen(true);\n }}\n onBlur={(e) => {\n if (isReadOnly === true || isDisabled === true) return;\n\n if (\n e.relatedTarget?.classList.contains(\n 'ndl-time-picker-popover-item',\n ) === true\n ) {\n return;\n }\n\n if (inputValue.length < 4) {\n setError('Invalid time');\n return;\n }\n\n const time = NeedleTime.fromString(inputValue);\n\n if (time === undefined || time === null) {\n setError('Invalid time');\n return;\n }\n\n if (!isValidTime(time.hour, time.minute)) {\n setError('Invalid time');\n } else {\n setError(undefined);\n setInputValue(time.toString(is24Hour));\n }\n }}\n placeholder={format}\n maxLength={is24Hour ? 5 : 8}\n {...htmlAttributes}\n />\n <ClockIconOutline className=\"ndl-icon-svg ndl-time-picker-icon\" />\n </div>\n </label>\n {errorToShow !== undefined && (\n <div className=\"ndl-time-picker-error-wrapper\">\n <ExclamationCircleIconSolid className=\"ndl-time-picker-error-icon\" />\n <Typography\n variant={size === 'large' ? 'body-medium' : 'body-small'}\n className=\"ndl-time-picker-error-text\"\n >\n {errorToShow}\n </Typography>\n </div>\n )}\n </div>\n\n {context.open && (\n <ConditionalWrap\n shouldWrap={isPortaled}\n wrap={(wrapChildren) => (\n <FloatingPortal>{wrapChildren}</FloatingPortal>\n )}\n >\n <FloatingFocusManager\n context={context}\n modal={false}\n initialFocus={-1}\n >\n <div\n ref={refs.setFloating}\n className={classNames(themeClassName, 'ndl-time-picker-popover', {\n ...classes,\n })}\n style={{\n ...transitionStyles,\n ...floatingStyles,\n width:\n isFluid === true\n ? containerRef.current?.clientWidth\n : undefined,\n }}\n {...getFloatingProps()}\n >\n <ul ref={listRef} tabIndex={-1}>\n {timeOptions.map((time, i) => (\n <li\n key={i}\n role=\"option\"\n aria-selected={\n value?.toString(is24Hour) === time ||\n editedInput?.toString(is24Hour) === time\n }\n value={time}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n handleOnClick(time);\n setIsPopoverOpen(false);\n }}\n onMouseDown={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n tabIndex={-1}\n className={classNames(\n focusedIndex === i ? 'focused' : '',\n 'ndl-time-picker-popover-item',\n )}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.stopPropagation();\n handleOnClick(time);\n }\n }}\n >\n {time}\n </li>\n ))}\n </ul>\n </div>\n </FloatingFocusManager>\n </ConditionalWrap>\n )}\n </>\n );\n};\n"]}
|