@neo4j-ndl/react 4.0.18 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/lib/cjs/date-picker/DatePicker.js +11 -3
  2. package/lib/cjs/date-picker/DatePicker.js.map +1 -1
  3. package/lib/cjs/date-picker/stories/date-picker-with-timezone-both-mode.story.js +57 -0
  4. package/lib/cjs/date-picker/stories/date-picker-with-timezone-both-mode.story.js.map +1 -0
  5. package/lib/cjs/date-picker/stories/date-picker-with-timezone.story.js +52 -0
  6. package/lib/cjs/date-picker/stories/date-picker-with-timezone.story.js.map +1 -0
  7. package/lib/cjs/date-picker/stories/date-picker.stories.js +27 -1
  8. package/lib/cjs/date-picker/stories/date-picker.stories.js.map +1 -1
  9. package/lib/cjs/date-picker/stories/index.js +9 -1
  10. package/lib/cjs/date-picker/stories/index.js.map +1 -1
  11. package/lib/cjs/dropzone/Dropzone.js +1 -1
  12. package/lib/cjs/dropzone/Dropzone.js.map +1 -1
  13. package/lib/cjs/icon-button-base/IconButtonBase.js +4 -1
  14. package/lib/cjs/icon-button-base/IconButtonBase.js.map +1 -1
  15. package/lib/cjs/index.js +4 -2
  16. package/lib/cjs/index.js.map +1 -1
  17. package/lib/cjs/timezone-picker/TimeZonePicker.js +330 -0
  18. package/lib/cjs/timezone-picker/TimeZonePicker.js.map +1 -0
  19. package/lib/cjs/timezone-picker/generate-timezone-options.js +256 -0
  20. package/lib/cjs/timezone-picker/generate-timezone-options.js.map +1 -0
  21. package/lib/cjs/timezone-picker/index.js +39 -0
  22. package/lib/cjs/timezone-picker/index.js.map +1 -0
  23. package/lib/cjs/timezone-picker/stories/index.js +60 -0
  24. package/lib/cjs/timezone-picker/stories/index.js.map +1 -0
  25. package/lib/cjs/timezone-picker/stories/timezone-picker-both-mode.story.js +41 -0
  26. package/lib/cjs/timezone-picker/stories/timezone-picker-both-mode.story.js.map +1 -0
  27. package/lib/cjs/timezone-picker/stories/timezone-picker-default.story.js +35 -0
  28. package/lib/cjs/timezone-picker/stories/timezone-picker-default.story.js.map +1 -0
  29. package/lib/cjs/timezone-picker/stories/timezone-picker-disabled.story.js +30 -0
  30. package/lib/cjs/timezone-picker/stories/timezone-picker-disabled.story.js.map +1 -0
  31. package/lib/cjs/timezone-picker/stories/timezone-picker-dst-aware.story.js +54 -0
  32. package/lib/cjs/timezone-picker/stories/timezone-picker-dst-aware.story.js.map +1 -0
  33. package/lib/cjs/timezone-picker/stories/timezone-picker-fluid.story.js +30 -0
  34. package/lib/cjs/timezone-picker/stories/timezone-picker-fluid.story.js.map +1 -0
  35. package/lib/cjs/timezone-picker/stories/timezone-picker-in-dialog.story.js +47 -0
  36. package/lib/cjs/timezone-picker/stories/timezone-picker-in-dialog.story.js.map +1 -0
  37. package/lib/cjs/timezone-picker/stories/timezone-picker-sizes.story.js +32 -0
  38. package/lib/cjs/timezone-picker/stories/timezone-picker-sizes.story.js.map +1 -0
  39. package/lib/cjs/timezone-picker/stories/timezone-picker-utc-only.story.js +49 -0
  40. package/lib/cjs/timezone-picker/stories/timezone-picker-utc-only.story.js.map +1 -0
  41. package/lib/cjs/timezone-picker/stories/timezone-picker.stories.js +145 -0
  42. package/lib/cjs/timezone-picker/stories/timezone-picker.stories.js.map +1 -0
  43. package/lib/cjs/timezone-picker/timezone-picker-hooks.js +52 -0
  44. package/lib/cjs/timezone-picker/timezone-picker-hooks.js.map +1 -0
  45. package/lib/esm/date-picker/DatePicker.js +11 -3
  46. package/lib/esm/date-picker/DatePicker.js.map +1 -1
  47. package/lib/esm/date-picker/stories/date-picker-with-timezone-both-mode.story.js +53 -0
  48. package/lib/esm/date-picker/stories/date-picker-with-timezone-both-mode.story.js.map +1 -0
  49. package/lib/esm/date-picker/stories/date-picker-with-timezone.story.js +50 -0
  50. package/lib/esm/date-picker/stories/date-picker-with-timezone.story.js.map +1 -0
  51. package/lib/esm/date-picker/stories/date-picker.stories.js +27 -1
  52. package/lib/esm/date-picker/stories/date-picker.stories.js.map +1 -1
  53. package/lib/esm/date-picker/stories/index.js +6 -0
  54. package/lib/esm/date-picker/stories/index.js.map +1 -1
  55. package/lib/esm/dropzone/Dropzone.js +1 -1
  56. package/lib/esm/dropzone/Dropzone.js.map +1 -1
  57. package/lib/esm/icon-button-base/IconButtonBase.js +4 -1
  58. package/lib/esm/icon-button-base/IconButtonBase.js.map +1 -1
  59. package/lib/esm/index.js +1 -0
  60. package/lib/esm/index.js.map +1 -1
  61. package/lib/esm/timezone-picker/TimeZonePicker.js +323 -0
  62. package/lib/esm/timezone-picker/TimeZonePicker.js.map +1 -0
  63. package/lib/esm/timezone-picker/generate-timezone-options.js +247 -0
  64. package/lib/esm/timezone-picker/generate-timezone-options.js.map +1 -0
  65. package/lib/esm/timezone-picker/index.js +23 -0
  66. package/lib/esm/timezone-picker/index.js.map +1 -0
  67. package/lib/esm/timezone-picker/stories/index.js +46 -0
  68. package/lib/esm/timezone-picker/stories/index.js.map +1 -0
  69. package/lib/esm/timezone-picker/stories/timezone-picker-both-mode.story.js +37 -0
  70. package/lib/esm/timezone-picker/stories/timezone-picker-both-mode.story.js.map +1 -0
  71. package/lib/esm/timezone-picker/stories/timezone-picker-default.story.js +33 -0
  72. package/lib/esm/timezone-picker/stories/timezone-picker-default.story.js.map +1 -0
  73. package/lib/esm/timezone-picker/stories/timezone-picker-disabled.story.js +28 -0
  74. package/lib/esm/timezone-picker/stories/timezone-picker-disabled.story.js.map +1 -0
  75. package/lib/esm/timezone-picker/stories/timezone-picker-dst-aware.story.js +52 -0
  76. package/lib/esm/timezone-picker/stories/timezone-picker-dst-aware.story.js.map +1 -0
  77. package/lib/esm/timezone-picker/stories/timezone-picker-fluid.story.js +28 -0
  78. package/lib/esm/timezone-picker/stories/timezone-picker-fluid.story.js.map +1 -0
  79. package/lib/esm/timezone-picker/stories/timezone-picker-in-dialog.story.js +45 -0
  80. package/lib/esm/timezone-picker/stories/timezone-picker-in-dialog.story.js.map +1 -0
  81. package/lib/esm/timezone-picker/stories/timezone-picker-sizes.story.js +30 -0
  82. package/lib/esm/timezone-picker/stories/timezone-picker-sizes.story.js.map +1 -0
  83. package/lib/esm/timezone-picker/stories/timezone-picker-utc-only.story.js +47 -0
  84. package/lib/esm/timezone-picker/stories/timezone-picker-utc-only.story.js.map +1 -0
  85. package/lib/esm/timezone-picker/stories/timezone-picker.stories.js +142 -0
  86. package/lib/esm/timezone-picker/stories/timezone-picker.stories.js.map +1 -0
  87. package/lib/esm/timezone-picker/timezone-picker-hooks.js +47 -0
  88. package/lib/esm/timezone-picker/timezone-picker-hooks.js.map +1 -0
  89. package/lib/types/date-picker/DatePicker.d.ts +4 -1
  90. package/lib/types/date-picker/DatePicker.d.ts.map +1 -1
  91. package/lib/types/date-picker/stories/date-picker-with-timezone-both-mode.story.d.ts +23 -0
  92. package/lib/types/date-picker/stories/date-picker-with-timezone-both-mode.story.d.ts.map +1 -0
  93. package/lib/types/date-picker/stories/date-picker-with-timezone.story.d.ts +24 -0
  94. package/lib/types/date-picker/stories/date-picker-with-timezone.story.d.ts.map +1 -0
  95. package/lib/types/date-picker/stories/date-picker.stories.d.ts +2 -0
  96. package/lib/types/date-picker/stories/date-picker.stories.d.ts.map +1 -1
  97. package/lib/types/date-picker/stories/index.d.ts +4 -0
  98. package/lib/types/date-picker/stories/index.d.ts.map +1 -1
  99. package/lib/types/dropzone/Dropzone.d.ts.map +1 -1
  100. package/lib/types/icon-button-base/IconButtonBase.d.ts.map +1 -1
  101. package/lib/types/index.d.ts +1 -0
  102. package/lib/types/index.d.ts.map +1 -1
  103. package/lib/types/timezone-picker/TimeZonePicker.d.ts +68 -0
  104. package/lib/types/timezone-picker/TimeZonePicker.d.ts.map +1 -0
  105. package/lib/types/timezone-picker/generate-timezone-options.d.ts +61 -0
  106. package/lib/types/timezone-picker/generate-timezone-options.d.ts.map +1 -0
  107. package/lib/types/timezone-picker/index.d.ts +23 -0
  108. package/lib/types/timezone-picker/index.d.ts.map +1 -0
  109. package/lib/types/timezone-picker/stories/index.d.ts +37 -0
  110. package/lib/types/timezone-picker/stories/index.d.ts.map +1 -0
  111. package/lib/types/timezone-picker/stories/timezone-picker-both-mode.story.d.ts +23 -0
  112. package/lib/types/timezone-picker/stories/timezone-picker-both-mode.story.d.ts.map +1 -0
  113. package/lib/types/timezone-picker/stories/timezone-picker-default.story.d.ts +24 -0
  114. package/lib/types/timezone-picker/stories/timezone-picker-default.story.d.ts.map +1 -0
  115. package/lib/types/timezone-picker/stories/timezone-picker-disabled.story.d.ts +24 -0
  116. package/lib/types/timezone-picker/stories/timezone-picker-disabled.story.d.ts.map +1 -0
  117. package/lib/types/timezone-picker/stories/timezone-picker-dst-aware.story.d.ts +24 -0
  118. package/lib/types/timezone-picker/stories/timezone-picker-dst-aware.story.d.ts.map +1 -0
  119. package/lib/types/timezone-picker/stories/timezone-picker-fluid.story.d.ts +24 -0
  120. package/lib/types/timezone-picker/stories/timezone-picker-fluid.story.d.ts.map +1 -0
  121. package/lib/types/timezone-picker/stories/timezone-picker-in-dialog.story.d.ts +24 -0
  122. package/lib/types/timezone-picker/stories/timezone-picker-in-dialog.story.d.ts.map +1 -0
  123. package/lib/types/timezone-picker/stories/timezone-picker-sizes.story.d.ts +24 -0
  124. package/lib/types/timezone-picker/stories/timezone-picker-sizes.story.d.ts.map +1 -0
  125. package/lib/types/timezone-picker/stories/timezone-picker-utc-only.story.d.ts +24 -0
  126. package/lib/types/timezone-picker/stories/timezone-picker-utc-only.story.d.ts.map +1 -0
  127. package/lib/types/timezone-picker/stories/timezone-picker.stories.d.ts +34 -0
  128. package/lib/types/timezone-picker/stories/timezone-picker.stories.d.ts.map +1 -0
  129. package/lib/types/timezone-picker/timezone-picker-hooks.d.ts +31 -0
  130. package/lib/types/timezone-picker/timezone-picker-hooks.d.ts.map +1 -0
  131. package/package.json +2 -2
@@ -48,6 +48,7 @@ const divider_1 = require("../divider");
48
48
  const icons_1 = require("../icons");
49
49
  const text_input_1 = require("../text-input");
50
50
  const time_picker_1 = require("../time-picker");
51
+ const timezone_picker_1 = require("../timezone-picker");
51
52
  const typography_1 = require("../typography");
52
53
  const utils_1 = require("./utils");
53
54
  // This wrapper is needed due to react-datepicker injecting html attributes
@@ -63,12 +64,13 @@ const DatePickerTextInputWrapper = (_a) => {
63
64
  };
64
65
  const DatePicker = (_a) => {
65
66
  var _b;
66
- var { reactDatePickerProps, textInputProps, timePickerProps, isDisabled, ref, className, style, htmlAttributes } = _a, restProps = __rest(_a, ["reactDatePickerProps", "textInputProps", "timePickerProps", "isDisabled", "ref", "className", "style", "htmlAttributes"]);
67
+ var { reactDatePickerProps, textInputProps, timePickerProps, timeZonePickerProps, isDisabled, ref, className, style, htmlAttributes } = _a, restProps = __rest(_a, ["reactDatePickerProps", "textInputProps", "timePickerProps", "timeZonePickerProps", "isDisabled", "ref", "className", "style", "htmlAttributes"]);
67
68
  const classes = (0, classnames_1.default)(`ndl-datepicker`, className, {});
68
69
  const datetimeRef = (0, react_1.useRef)(null);
69
70
  const [picker, setPicker] = (0, react_1.useState)('day');
70
71
  const [preSelectedDate, setPreSelectedDate] = (0, react_1.useState)(reactDatePickerProps.selected ||
71
72
  reactDatePickerProps.startDate);
73
+ const [selectedTimeZone, setSelectedTimeZone] = (0, react_1.useState)(timeZonePickerProps === null || timeZonePickerProps === void 0 ? void 0 : timeZonePickerProps.value);
72
74
  const isInsideDialog = (0, dialog_context_1.useIsInsideDialog)();
73
75
  const headerAction = (0, react_1.useCallback)((action) => {
74
76
  setPicker(picker === action ? 'day' : action);
@@ -103,6 +105,12 @@ const DatePicker = (_a) => {
103
105
  reactDatePickerProps.onChange(newDate, undefined);
104
106
  }
105
107
  };
108
+ const handleTimeZoneChange = (timezone) => {
109
+ setSelectedTimeZone(timezone);
110
+ if (timeZonePickerProps === null || timeZonePickerProps === void 0 ? void 0 : timeZonePickerProps.onChange) {
111
+ timeZonePickerProps.onChange(timezone);
112
+ }
113
+ };
106
114
  /**
107
115
  * Intercept onChange so we can work with
108
116
  * Month and Year pickers
@@ -176,9 +184,9 @@ const DatePicker = (_a) => {
176
184
  (_a = reactDatePickerProps === null || reactDatePickerProps === void 0 ? void 0 : reactDatePickerProps.onChangeRaw) === null || _a === void 0 ? void 0 : _a.call(reactDatePickerProps, event);
177
185
  }, [reactDatePickerProps]);
178
186
  const datePickerProps = Object.assign(Object.assign({}, reactDatePickerProps), { onCalendarClose: interceptedOnCalendarClose, onChange: interceptedChange, onChangeRaw: interceptedOnChangeRaw, onMonthChange: handleMonthChange });
179
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes, ref: ref, style: style }, restProps, htmlAttributes, { children: (0, jsx_runtime_1.jsx)(react_datepicker_1.default, Object.assign({ ref: datetimeRef, customInput: (0, jsx_runtime_1.jsx)(DatePickerTextInputWrapper, { isDisabled: isDisabled, textInputProps: textInputProps }), customTimeInput: (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)(divider_1.Divider, { className: "n-my-4" }), (0, jsx_runtime_1.jsx)(time_picker_1.TimePicker, Object.assign({ isFluid: true, value: preSelectedDate
187
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes, ref: ref, style: style }, restProps, htmlAttributes, { children: (0, jsx_runtime_1.jsx)(react_datepicker_1.default, Object.assign({ ref: datetimeRef, customInput: (0, jsx_runtime_1.jsx)(DatePickerTextInputWrapper, { isDisabled: isDisabled, textInputProps: textInputProps }), customTimeInput: (0, jsx_runtime_1.jsxs)("span", { className: "ndl-time-picker-wrapper", children: [(0, jsx_runtime_1.jsx)(divider_1.Divider, {}), (0, jsx_runtime_1.jsx)(time_picker_1.TimePicker, Object.assign({ isFluid: true, value: preSelectedDate
180
188
  ? new time_picker_1.NeedleTime(preSelectedDate.getHours(), preSelectedDate.getMinutes())
181
- : undefined, onChange: handleTimeChange }, timePickerProps, { floatingStrategy: "absolute", isPortaled: false }))] }), disabled: isDisabled, showPopperArrow: false, showMonthYearPicker: picker === 'month', showYearPicker: picker === 'year', shouldCloseOnSelect: picker === 'day' && !((_b = reactDatePickerProps.showTimeInput) !== null && _b !== void 0 ? _b : false), dayClassName: () => 'ndl-datepicker-day', renderCustomHeader: CustomHeader }, datePickerProps, { popperClassName: (0, classnames_1.default)('ndl-datepicker-popper', reactDatePickerProps.popperClassName), popperProps: Object.assign({ strategy: isInsideDialog ? 'fixed' : 'absolute' }, reactDatePickerProps.popperProps) })) })));
189
+ : undefined, onChange: handleTimeChange }, timePickerProps, { floatingStrategy: "absolute", isPortaled: false })), timeZonePickerProps && ((0, jsx_runtime_1.jsx)(timezone_picker_1.TimeZonePicker, Object.assign({ isFluid: true, value: selectedTimeZone, onChange: handleTimeZoneChange, referenceDate: preSelectedDate || undefined }, timeZonePickerProps, { floatingStrategy: "absolute", isPortaled: false })))] }), disabled: isDisabled, showPopperArrow: false, showMonthYearPicker: picker === 'month', showYearPicker: picker === 'year', shouldCloseOnSelect: picker === 'day' && !((_b = reactDatePickerProps.showTimeInput) !== null && _b !== void 0 ? _b : false), dayClassName: () => 'ndl-datepicker-day', renderCustomHeader: CustomHeader }, datePickerProps, { popperClassName: (0, classnames_1.default)('ndl-datepicker-popper', reactDatePickerProps.popperClassName), popperProps: Object.assign({ strategy: isInsideDialog ? 'fixed' : 'absolute' }, reactDatePickerProps.popperProps) })) })));
182
190
  };
183
191
  exports.DatePicker = DatePicker;
184
192
  //# sourceMappingURL=DatePicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../src/date-picker/DatePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,iCAAiC;AACjC,yDAAyD;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAAoC;AACpC,uCAAkC;AAClC,iCAAsD;AACtD,wEAE0B;AAG1B,4DAAuD;AACvD,6DAA6D;AAC7D,wCAAqC;AACrC,oCAKkB;AAClB,8CAA0C;AAC1C,gDAA8E;AAC9E,8CAA2C;AAC3C,mCAA4D;AAQ5D,2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,IACnB,eAAe,EAAE,IAAA,oBAAU,EACzB,uBAAuB,EACvB,oBAAoB,CAAC,eAAe,CACrC,EACD,WAAW,kBACT,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,IAC5C,oBAAoB,CAAC,WAAW,KAErC,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAhTW,QAAA,UAAU,cAgTrB","sourcesContent":["// TODO: try to fix as some point\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport { format } from 'date-fns';\nimport { useCallback, useRef, useState } from 'react';\nimport ReactDatePicker, {\n type ReactDatePickerCustomHeaderProps,\n} from 'react-datepicker';\n\nimport type { CommonProps } from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { Divider } from '../divider';\nimport {\n ArrowLeftIconOutline,\n ArrowRightIconOutline,\n CalendarDaysIconOutline,\n ChevronDownIconOutline,\n} from '../icons';\nimport { TextInput } from '../text-input';\nimport { NeedleTime, TimePicker, type TimePickerProps } from '../time-picker';\nimport { Typography } from '../typography';\nimport { daysInMonth, getYearsPeriodString } from './utils';\n\ntype DatePickerTextInputWrapperProps = React.ComponentProps<'input'> & {\n textInputProps?: React.ComponentProps<typeof TextInput>;\n isDisabled?: boolean;\n value?: string;\n};\n\n// This wrapper is needed due to react-datepicker injecting html attributes\n// into the custom input component on root level, since we use htmlAttributes\n// we need to help spread them there instead of the root level\nconst DatePickerTextInputWrapper = ({\n textInputProps,\n isDisabled,\n value,\n placeholder,\n ...restProps\n}: DatePickerTextInputWrapperProps) => {\n // deconstruct textInputProps to avoid bugs with react-datepicker injecting props\n const {\n placeholder: textInputPlaceholder,\n htmlAttributes: textInputHtmlAttributes,\n ref,\n ...restTextInputProps\n } = textInputProps ?? {};\n\n return (\n <TextInput\n ref={ref}\n aria-label=\"Date picker input\"\n trailingElement={\n <CalendarDaysIconOutline className=\"ndl-datepicker-icon\" />\n }\n value={value}\n placeholder={placeholder ?? textInputPlaceholder}\n isDisabled={isDisabled}\n // react-datepicker injects html attributes into the custom input\n htmlAttributes={{\n ...textInputHtmlAttributes,\n ...restProps,\n }}\n {...restTextInputProps}\n />\n );\n};\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype PickerType = 'day' | 'month' | 'year';\n\n// Define a more flexible type for onChange\ntype DatePickerChangeHandler = (\n date: Date | null | [Date | null, Date | null] | Date[],\n event?: React.SyntheticEvent | undefined,\n) => void;\n\ninterface DatePickerProps {\n /** Props for the embedded `TextInput` component. */\n textInputProps?: React.ComponentProps<typeof TextInput>;\n /** Whether the date picker is disabled. */\n isDisabled?: boolean;\n /** Props for the embedded `TimePicker` component. */\n timePickerProps?: TimePickerProps;\n /** Props forwarded to underlying `react-datepicker` component. */\n reactDatePickerProps: React.ComponentProps<typeof ReactDatePicker>;\n}\n\nexport const DatePicker = ({\n reactDatePickerProps,\n textInputProps,\n timePickerProps,\n isDisabled,\n ref,\n className,\n style,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', DatePickerProps>) => {\n const classes = classNames(`ndl-datepicker`, className, {});\n const datetimeRef = useRef<ReactDatePicker>(null);\n const [picker, setPicker] = useState<PickerType>('day');\n const [preSelectedDate, setPreSelectedDate] = useState<Date | null>(\n (reactDatePickerProps.selected as Date | null) ||\n (reactDatePickerProps.startDate as Date | null),\n );\n\n const isInsideDialog = useIsInsideDialog();\n\n const headerAction = useCallback(\n (action: PickerType) => {\n setPicker(picker === action ? 'day' : action);\n },\n [picker],\n );\n\n const CustomHeader = useCallback(\n (props: ReactDatePickerCustomHeaderProps) => {\n const {\n decreaseMonth,\n increaseMonth,\n increaseYear,\n decreaseYear,\n nextMonthButtonDisabled,\n nextYearButtonDisabled,\n prevMonthButtonDisabled,\n prevYearButtonDisabled,\n } = props;\n\n const prevCallback = picker === 'year' ? decreaseYear : decreaseMonth;\n const nextCallback = picker === 'year' ? increaseYear : increaseMonth;\n const prevDisabled =\n picker === 'year' ? prevYearButtonDisabled : prevMonthButtonDisabled;\n const nextDisabled =\n picker === 'year' ? nextYearButtonDisabled : nextMonthButtonDisabled;\n\n return (\n <div className=\"ndl-datepicker-header\">\n <div className=\"ndl-datepicker-selects\">\n {picker !== 'year' && (\n <button\n aria-label={`${picker === 'month' ? 'Close' : 'Open'} month picker`}\n aria-pressed={picker === 'month'}\n onClick={() => headerAction('month')}\n >\n <div className=\"n-flex n-items-center n-gap-token-4\">\n <Typography variant=\"subheading-small\">\n {format(props.date, 'MMM')}\n </Typography>\n <ChevronDownIconOutline\n className={classNames('ndl-datepicker-chevron', {\n 'n-rotate-180': picker === 'month',\n })}\n aria-label=\"Chevron icon\"\n />\n </div>\n </button>\n )}\n {picker !== 'month' && (\n <button\n aria-label={`${picker === 'year' ? 'Close' : 'Open'} year picker`}\n onClick={() => headerAction('year')}\n >\n <div className=\"n-flex n-items-center n-gap-token-4\">\n <Typography variant=\"subheading-small\">\n {picker === 'year'\n ? getYearsPeriodString(\n props.date,\n reactDatePickerProps?.yearItemNumber,\n )\n : format(props.date, 'yyyy')}\n </Typography>\n <ChevronDownIconOutline\n className={classNames('ndl-datepicker-chevron', {\n 'n-rotate-180': picker === 'year',\n })}\n aria-label=\"Chevron icon\"\n />\n </div>\n </button>\n )}\n </div>\n {picker !== 'month' && (\n <div className=\"n-flex n-justify-center n-gap-token-16\">\n <CleanIconButton\n description={\n picker === 'year' ? 'Previous period' : 'Previous month'\n }\n onClick={prevCallback}\n isDisabled={prevDisabled}\n className=\"n-text-neutral-text-weak\"\n size=\"small\"\n >\n <ArrowLeftIconOutline />\n </CleanIconButton>\n <CleanIconButton\n description={picker === 'year' ? 'Next period' : 'Next month'}\n onClick={nextCallback}\n isDisabled={nextDisabled}\n className=\"n-text-neutral-text-weak\"\n size=\"small\"\n >\n <ArrowRightIconOutline />\n </CleanIconButton>\n </div>\n )}\n </div>\n );\n },\n [picker, headerAction, reactDatePickerProps?.yearItemNumber],\n );\n\n const handleTimeChange = (newTime: NeedleTime) => {\n if (\n reactDatePickerProps.selectsRange ||\n reactDatePickerProps.selectsMultiple\n ) {\n // this is consistent with the behavior of react-datepicker\n return;\n }\n\n if (!preSelectedDate) return;\n\n const newDate = new Date(preSelectedDate);\n newDate.setHours(newTime.hour, newTime.minute, 0, 0);\n setPreSelectedDate(newDate);\n\n if (reactDatePickerProps.onChange) {\n // For single date selection\n reactDatePickerProps.onChange(newDate, undefined);\n }\n };\n\n /**\n * Intercept onChange so we can work with\n * Month and Year pickers\n */\n const interceptedChange: DatePickerChangeHandler = useCallback(\n (\n date: Date | null | [Date | null, Date | null] | Date[],\n event?: React.SyntheticEvent,\n ) => {\n if (picker !== 'day') {\n // setTimeout to prevent picker change before the handleMonthChange logic\n setTimeout(() => {\n setPicker('day');\n });\n } else if (picker === 'day') {\n if (date instanceof Date) {\n setPreSelectedDate(date);\n } else if (\n Array.isArray(date) &&\n date.length > 0 &&\n date[0] instanceof Date\n ) {\n setPreSelectedDate(date[0]);\n } else if (date === null) {\n setPreSelectedDate(null);\n }\n\n if (reactDatePickerProps.onChange && date !== null) {\n (reactDatePickerProps.onChange as DatePickerChangeHandler)(\n date,\n event,\n );\n }\n }\n },\n [picker, reactDatePickerProps],\n );\n\n /**\n * Intercept onCalendarClose so we can\n * switch to \"day\" picker if we close on \"month\" or \"year\"\n * view\n */\n const interceptedOnCalendarClose = useCallback(() => {\n if (picker !== 'day') {\n setPicker('day');\n }\n reactDatePickerProps?.onCalendarClose?.();\n }, [picker, reactDatePickerProps]);\n\n const handleMonthChange = useCallback(\n (date: Date) => {\n if (picker === 'month') {\n const selectedDay = preSelectedDate?.getDate() ?? 1;\n const daysInNewMonth = daysInMonth(date.getMonth(), date.getFullYear());\n date.setDate(Math.min(selectedDay, daysInNewMonth));\n reactDatePickerProps?.onMonthChange?.(date);\n } else if (picker === 'year') {\n const selectedDay = preSelectedDate?.getDate() ?? 1;\n const selectedMonth = preSelectedDate?.getMonth() ?? 0;\n const daysInNewMonth = daysInMonth(selectedMonth, date.getFullYear());\n date.setMonth(selectedMonth, Math.min(selectedDay, daysInNewMonth));\n reactDatePickerProps?.onMonthChange?.(date);\n }\n setPreSelectedDate(date);\n },\n [picker, preSelectedDate, reactDatePickerProps],\n );\n\n /**\n * Intercept onChangeRaw to handle clearing the input\n * When the user clears the text input, set the date to null\n */\n const interceptedOnChangeRaw = useCallback(\n (\n event?:\n | React.KeyboardEvent<HTMLElement>\n | React.MouseEvent<HTMLElement, MouseEvent>,\n ) => {\n const target = event?.target as HTMLInputElement | undefined;\n if (target?.value === '') {\n setPreSelectedDate(null);\n if (reactDatePickerProps.onChange) {\n (reactDatePickerProps.onChange as DatePickerChangeHandler)(\n null,\n event,\n );\n }\n }\n reactDatePickerProps?.onChangeRaw?.(event);\n },\n [reactDatePickerProps],\n );\n\n const datePickerProps = {\n ...reactDatePickerProps,\n onCalendarClose: interceptedOnCalendarClose,\n onChange: interceptedChange,\n onChangeRaw: interceptedOnChangeRaw,\n onMonthChange: handleMonthChange,\n };\n\n return (\n <div\n className={classes}\n ref={ref}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <ReactDatePicker\n ref={datetimeRef}\n customInput={\n <DatePickerTextInputWrapper\n isDisabled={isDisabled}\n textInputProps={textInputProps}\n />\n }\n customTimeInput={\n <span>\n <Divider className=\"n-my-4\" />\n <TimePicker\n isFluid\n value={\n preSelectedDate\n ? new NeedleTime(\n preSelectedDate.getHours(),\n preSelectedDate.getMinutes(),\n )\n : undefined\n }\n onChange={handleTimeChange}\n {...timePickerProps}\n floatingStrategy=\"absolute\"\n isPortaled={false}\n />\n </span>\n }\n disabled={isDisabled}\n showPopperArrow={false}\n showMonthYearPicker={picker === 'month'}\n showYearPicker={picker === 'year'}\n shouldCloseOnSelect={\n picker === 'day' && !(reactDatePickerProps.showTimeInput ?? false)\n }\n dayClassName={() => 'ndl-datepicker-day'}\n renderCustomHeader={CustomHeader}\n {...datePickerProps}\n popperClassName={classNames(\n 'ndl-datepicker-popper',\n reactDatePickerProps.popperClassName,\n )}\n popperProps={{\n strategy: isInsideDialog ? 'fixed' : 'absolute',\n ...reactDatePickerProps.popperProps,\n }}\n />\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../src/date-picker/DatePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,iCAAiC;AACjC,yDAAyD;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAAoC;AACpC,uCAAkC;AAClC,iCAAsD;AACtD,wEAE0B;AAG1B,4DAAuD;AACvD,6DAA6D;AAC7D,wCAAqC;AACrC,oCAKkB;AAClB,8CAA0C;AAC1C,gDAA8E;AAC9E,wDAAoD;AACpD,8CAA2C;AAC3C,mCAA4D;AAQ5D,2EAA2E;AAC3E,6EAA6E;AAC7E,8DAA8D;AAC9D,MAAM,0BAA0B,GAAG,CAAC,EAMF,EAAE,EAAE;QANF,EAClC,cAAc,EACd,UAAU,EACV,KAAK,EACL,WAAW,OAEqB,EAD7B,SAAS,cALsB,wDAMnC,CADa;IAEZ,iFAAiF;IACjF,MAAM,KAKF,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,EAAE,EALlB,EACJ,WAAW,EAAE,oBAAoB,EACjC,cAAc,EAAE,uBAAuB,EACvC,GAAG,OAEmB,EADnB,kBAAkB,cAJjB,wCAKL,C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,EACtB,mBAAmB,EAAE,MAAM,KAAK,OAAO,EACvC,cAAc,EAAE,MAAM,KAAK,MAAM,EACjC,mBAAmB,EACjB,MAAM,KAAK,KAAK,IAAI,CAAC,CAAC,MAAA,oBAAoB,CAAC,aAAa,mCAAI,KAAK,CAAC,EAEpE,YAAY,EAAE,GAAG,EAAE,CAAC,oBAAoB,EACxC,kBAAkB,EAAE,YAAY,IAC5B,eAAe,IACnB,eAAe,EAAE,IAAA,oBAAU,EACzB,uBAAuB,EACvB,oBAAoB,CAAC,eAAe,CACrC,EACD,WAAW,kBACT,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,IAC5C,oBAAoB,CAAC,WAAW,KAErC,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAtUW,QAAA,UAAU,cAsUrB","sourcesContent":["// TODO: try to fix as some point\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport { format } from 'date-fns';\nimport { useCallback, useRef, useState } from 'react';\nimport ReactDatePicker, {\n type ReactDatePickerCustomHeaderProps,\n} from 'react-datepicker';\n\nimport type { CommonProps } from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { Divider } from '../divider';\nimport {\n ArrowLeftIconOutline,\n ArrowRightIconOutline,\n CalendarDaysIconOutline,\n ChevronDownIconOutline,\n} from '../icons';\nimport { TextInput } from '../text-input';\nimport { NeedleTime, TimePicker, type TimePickerProps } from '../time-picker';\nimport { TimeZonePicker } from '../timezone-picker';\nimport { Typography } from '../typography';\nimport { daysInMonth, getYearsPeriodString } from './utils';\n\ntype DatePickerTextInputWrapperProps = React.ComponentProps<'input'> & {\n textInputProps?: React.ComponentProps<typeof TextInput>;\n isDisabled?: boolean;\n value?: string;\n};\n\n// This wrapper is needed due to react-datepicker injecting html attributes\n// into the custom input component on root level, since we use htmlAttributes\n// we need to help spread them there instead of the root level\nconst DatePickerTextInputWrapper = ({\n textInputProps,\n isDisabled,\n value,\n placeholder,\n ...restProps\n}: DatePickerTextInputWrapperProps) => {\n // deconstruct textInputProps to avoid bugs with react-datepicker injecting props\n const {\n placeholder: textInputPlaceholder,\n htmlAttributes: textInputHtmlAttributes,\n ref,\n ...restTextInputProps\n } = textInputProps ?? {};\n\n return (\n <TextInput\n ref={ref}\n aria-label=\"Date picker input\"\n trailingElement={\n <CalendarDaysIconOutline className=\"ndl-datepicker-icon\" />\n }\n value={value}\n placeholder={placeholder ?? textInputPlaceholder}\n isDisabled={isDisabled}\n // react-datepicker injects html attributes into the custom input\n htmlAttributes={{\n ...textInputHtmlAttributes,\n ...restProps,\n }}\n {...restTextInputProps}\n />\n );\n};\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype PickerType = 'day' | 'month' | 'year';\n\n// Define a more flexible type for onChange\ntype DatePickerChangeHandler = (\n date: Date | null | [Date | null, Date | null] | Date[],\n event?: React.SyntheticEvent | undefined,\n) => void;\n\ninterface DatePickerProps {\n /** Props for the embedded `TextInput` component. */\n textInputProps?: React.ComponentProps<typeof TextInput>;\n /** Whether the date picker is disabled. */\n isDisabled?: boolean;\n /** Props for the embedded `TimePicker` component. */\n timePickerProps?: TimePickerProps;\n /** Props for the embedded `TimeZonePicker` component. */\n timeZonePickerProps?: React.ComponentProps<typeof TimeZonePicker>;\n /** Props forwarded to underlying `react-datepicker` component. */\n reactDatePickerProps: React.ComponentProps<typeof ReactDatePicker>;\n}\n\nexport const DatePicker = ({\n reactDatePickerProps,\n textInputProps,\n timePickerProps,\n timeZonePickerProps,\n isDisabled,\n ref,\n className,\n style,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', DatePickerProps>) => {\n const classes = classNames(`ndl-datepicker`, className, {});\n const datetimeRef = useRef<ReactDatePicker>(null);\n const [picker, setPicker] = useState<PickerType>('day');\n const [preSelectedDate, setPreSelectedDate] = useState<Date | null>(\n (reactDatePickerProps.selected as Date | null) ||\n (reactDatePickerProps.startDate as Date | null),\n );\n const [selectedTimeZone, setSelectedTimeZone] = useState<string | undefined>(\n timeZonePickerProps?.value,\n );\n\n const isInsideDialog = useIsInsideDialog();\n\n const headerAction = useCallback(\n (action: PickerType) => {\n setPicker(picker === action ? 'day' : action);\n },\n [picker],\n );\n\n const CustomHeader = useCallback(\n (props: ReactDatePickerCustomHeaderProps) => {\n const {\n decreaseMonth,\n increaseMonth,\n increaseYear,\n decreaseYear,\n nextMonthButtonDisabled,\n nextYearButtonDisabled,\n prevMonthButtonDisabled,\n prevYearButtonDisabled,\n } = props;\n\n const prevCallback = picker === 'year' ? decreaseYear : decreaseMonth;\n const nextCallback = picker === 'year' ? increaseYear : increaseMonth;\n const prevDisabled =\n picker === 'year' ? prevYearButtonDisabled : prevMonthButtonDisabled;\n const nextDisabled =\n picker === 'year' ? nextYearButtonDisabled : nextMonthButtonDisabled;\n\n return (\n <div className=\"ndl-datepicker-header\">\n <div className=\"ndl-datepicker-selects\">\n {picker !== 'year' && (\n <button\n aria-label={`${picker === 'month' ? 'Close' : 'Open'} month picker`}\n aria-pressed={picker === 'month'}\n onClick={() => headerAction('month')}\n >\n <div className=\"n-flex n-items-center n-gap-token-4\">\n <Typography variant=\"subheading-small\">\n {format(props.date, 'MMM')}\n </Typography>\n <ChevronDownIconOutline\n className={classNames('ndl-datepicker-chevron', {\n 'n-rotate-180': picker === 'month',\n })}\n aria-label=\"Chevron icon\"\n />\n </div>\n </button>\n )}\n {picker !== 'month' && (\n <button\n aria-label={`${picker === 'year' ? 'Close' : 'Open'} year picker`}\n onClick={() => headerAction('year')}\n >\n <div className=\"n-flex n-items-center n-gap-token-4\">\n <Typography variant=\"subheading-small\">\n {picker === 'year'\n ? getYearsPeriodString(\n props.date,\n reactDatePickerProps?.yearItemNumber,\n )\n : format(props.date, 'yyyy')}\n </Typography>\n <ChevronDownIconOutline\n className={classNames('ndl-datepicker-chevron', {\n 'n-rotate-180': picker === 'year',\n })}\n aria-label=\"Chevron icon\"\n />\n </div>\n </button>\n )}\n </div>\n {picker !== 'month' && (\n <div className=\"n-flex n-justify-center n-gap-token-16\">\n <CleanIconButton\n description={\n picker === 'year' ? 'Previous period' : 'Previous month'\n }\n onClick={prevCallback}\n isDisabled={prevDisabled}\n className=\"n-text-neutral-text-weak\"\n size=\"small\"\n >\n <ArrowLeftIconOutline />\n </CleanIconButton>\n <CleanIconButton\n description={picker === 'year' ? 'Next period' : 'Next month'}\n onClick={nextCallback}\n isDisabled={nextDisabled}\n className=\"n-text-neutral-text-weak\"\n size=\"small\"\n >\n <ArrowRightIconOutline />\n </CleanIconButton>\n </div>\n )}\n </div>\n );\n },\n [picker, headerAction, reactDatePickerProps?.yearItemNumber],\n );\n\n const handleTimeChange = (newTime: NeedleTime) => {\n if (\n reactDatePickerProps.selectsRange ||\n reactDatePickerProps.selectsMultiple\n ) {\n // this is consistent with the behavior of react-datepicker\n return;\n }\n\n if (!preSelectedDate) return;\n\n const newDate = new Date(preSelectedDate);\n newDate.setHours(newTime.hour, newTime.minute, 0, 0);\n setPreSelectedDate(newDate);\n\n if (reactDatePickerProps.onChange) {\n // For single date selection\n reactDatePickerProps.onChange(newDate, undefined);\n }\n };\n\n const handleTimeZoneChange = (timezone: string) => {\n setSelectedTimeZone(timezone);\n if (timeZonePickerProps?.onChange) {\n timeZonePickerProps.onChange(timezone);\n }\n };\n\n /**\n * Intercept onChange so we can work with\n * Month and Year pickers\n */\n const interceptedChange: DatePickerChangeHandler = useCallback(\n (\n date: Date | null | [Date | null, Date | null] | Date[],\n event?: React.SyntheticEvent,\n ) => {\n if (picker !== 'day') {\n // setTimeout to prevent picker change before the handleMonthChange logic\n setTimeout(() => {\n setPicker('day');\n });\n } else if (picker === 'day') {\n if (date instanceof Date) {\n setPreSelectedDate(date);\n } else if (\n Array.isArray(date) &&\n date.length > 0 &&\n date[0] instanceof Date\n ) {\n setPreSelectedDate(date[0]);\n } else if (date === null) {\n setPreSelectedDate(null);\n }\n\n if (reactDatePickerProps.onChange && date !== null) {\n (reactDatePickerProps.onChange as DatePickerChangeHandler)(\n date,\n event,\n );\n }\n }\n },\n [picker, reactDatePickerProps],\n );\n\n /**\n * Intercept onCalendarClose so we can\n * switch to \"day\" picker if we close on \"month\" or \"year\"\n * view\n */\n const interceptedOnCalendarClose = useCallback(() => {\n if (picker !== 'day') {\n setPicker('day');\n }\n reactDatePickerProps?.onCalendarClose?.();\n }, [picker, reactDatePickerProps]);\n\n const handleMonthChange = useCallback(\n (date: Date) => {\n if (picker === 'month') {\n const selectedDay = preSelectedDate?.getDate() ?? 1;\n const daysInNewMonth = daysInMonth(date.getMonth(), date.getFullYear());\n date.setDate(Math.min(selectedDay, daysInNewMonth));\n reactDatePickerProps?.onMonthChange?.(date);\n } else if (picker === 'year') {\n const selectedDay = preSelectedDate?.getDate() ?? 1;\n const selectedMonth = preSelectedDate?.getMonth() ?? 0;\n const daysInNewMonth = daysInMonth(selectedMonth, date.getFullYear());\n date.setMonth(selectedMonth, Math.min(selectedDay, daysInNewMonth));\n reactDatePickerProps?.onMonthChange?.(date);\n }\n setPreSelectedDate(date);\n },\n [picker, preSelectedDate, reactDatePickerProps],\n );\n\n /**\n * Intercept onChangeRaw to handle clearing the input\n * When the user clears the text input, set the date to null\n */\n const interceptedOnChangeRaw = useCallback(\n (\n event?:\n | React.KeyboardEvent<HTMLElement>\n | React.MouseEvent<HTMLElement, MouseEvent>,\n ) => {\n const target = event?.target as HTMLInputElement | undefined;\n if (target?.value === '') {\n setPreSelectedDate(null);\n if (reactDatePickerProps.onChange) {\n (reactDatePickerProps.onChange as DatePickerChangeHandler)(\n null,\n event,\n );\n }\n }\n reactDatePickerProps?.onChangeRaw?.(event);\n },\n [reactDatePickerProps],\n );\n\n const datePickerProps = {\n ...reactDatePickerProps,\n onCalendarClose: interceptedOnCalendarClose,\n onChange: interceptedChange,\n onChangeRaw: interceptedOnChangeRaw,\n onMonthChange: handleMonthChange,\n };\n\n return (\n <div\n className={classes}\n ref={ref}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <ReactDatePicker\n ref={datetimeRef}\n customInput={\n <DatePickerTextInputWrapper\n isDisabled={isDisabled}\n textInputProps={textInputProps}\n />\n }\n customTimeInput={\n <span className=\"ndl-time-picker-wrapper\">\n <Divider />\n <TimePicker\n isFluid\n value={\n preSelectedDate\n ? new NeedleTime(\n preSelectedDate.getHours(),\n preSelectedDate.getMinutes(),\n )\n : undefined\n }\n onChange={handleTimeChange}\n {...timePickerProps}\n floatingStrategy=\"absolute\"\n isPortaled={false}\n />\n {timeZonePickerProps && (\n <TimeZonePicker\n isFluid\n value={selectedTimeZone}\n onChange={handleTimeZoneChange}\n referenceDate={preSelectedDate || undefined}\n {...timeZonePickerProps}\n floatingStrategy=\"absolute\"\n isPortaled={false}\n />\n )}\n </span>\n }\n disabled={isDisabled}\n showPopperArrow={false}\n showMonthYearPicker={picker === 'month'}\n showYearPicker={picker === 'year'}\n shouldCloseOnSelect={\n picker === 'day' && !(reactDatePickerProps.showTimeInput ?? false)\n }\n dayClassName={() => 'ndl-datepicker-day'}\n renderCustomHeader={CustomHeader}\n {...datePickerProps}\n popperClassName={classNames(\n 'ndl-datepicker-popper',\n reactDatePickerProps.popperClassName,\n )}\n popperProps={{\n strategy: isInsideDialog ? 'fixed' : 'absolute',\n ...reactDatePickerProps.popperProps,\n }}\n />\n </div>\n );\n};\n"]}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DatePickerWithTimeZoneBothMode = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ /**
6
+ *
7
+ * Copyright (c) "Neo4j"
8
+ * Neo4j Sweden AB [http://neo4j.com]
9
+ *
10
+ * This file is part of Neo4j.
11
+ *
12
+ * Neo4j is free software: you can redistribute it and/or modify
13
+ * it under the terms of the GNU General Public License as published by
14
+ * the Free Software Foundation, either version 3 of the License, or
15
+ * (at your option) any later version.
16
+ *
17
+ * This program is distributed in the hope that it will be useful,
18
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ * GNU General Public License for more details.
21
+ *
22
+ * You should have received a copy of the GNU General Public License
23
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
24
+ */
25
+ const react_1 = require("react");
26
+ const typography_1 = require("../../typography");
27
+ const DatePicker_1 = require("../DatePicker");
28
+ const DatePickerWithTimeZoneBothMode = () => {
29
+ const [selectedDate, setSelectedDate] = (0, react_1.useState)(new Date());
30
+ const [selectedTimeZone, setSelectedTimeZone] = (0, react_1.useState)('America/New_York');
31
+ return ((0, jsx_runtime_1.jsxs)("div", { style: { maxWidth: '400px', padding: '20px' }, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: "title-4", style: { marginBottom: '16px' }, children: "DatePicker with TimeZone (Both Mode)" }), (0, jsx_runtime_1.jsx)(typography_1.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." }), (0, jsx_runtime_1.jsx)(DatePicker_1.DatePicker, { textInputProps: {
32
+ label: 'Select Date and Time with Timezone',
33
+ }, timePickerProps: {
34
+ format: 'hh:mm',
35
+ }, timeZonePickerProps: {
36
+ mode: 'both',
37
+ onChange: (tz) => {
38
+ setSelectedTimeZone(tz);
39
+ },
40
+ value: selectedTimeZone,
41
+ }, reactDatePickerProps: {
42
+ dateFormat: 'yyyy-MM-dd',
43
+ onChange: (date) => {
44
+ setSelectedDate(date);
45
+ },
46
+ selected: selectedDate,
47
+ showTimeInput: true,
48
+ } }), (0, jsx_runtime_1.jsxs)("div", { style: {
49
+ backgroundColor: '#f5f5f5',
50
+ borderRadius: '4px',
51
+ marginTop: '24px',
52
+ padding: '16px',
53
+ }, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: "body-small", style: { fontWeight: 600, marginBottom: '8px' }, children: "Selected Values:" }), (0, jsx_runtime_1.jsxs)(typography_1.Typography, { variant: "body-medium", children: [(0, jsx_runtime_1.jsx)("strong", { children: "Date:" }), ' ', (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.toISOString()) !== null || 'None'] }), (0, jsx_runtime_1.jsxs)(typography_1.Typography, { variant: "body-medium", style: { marginTop: '8px' }, children: [(0, jsx_runtime_1.jsx)("strong", { children: "Timezone:" }), " ", selectedTimeZone || 'None'] })] })] }));
54
+ };
55
+ exports.DatePickerWithTimeZoneBothMode = DatePickerWithTimeZoneBothMode;
56
+ exports.default = exports.DatePickerWithTimeZoneBothMode;
57
+ //# 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,iCAAiC;AAEjC,iDAA8C;AAC9C,8CAA2C;AAEpC,MAAM,8BAA8B,GAAG,GAAG,EAAE;IACjD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAc,IAAI,IAAI,EAAE,CAAC,CAAC;IAC1E,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAC3C,IAAA,gBAAQ,EAAS,kBAAkB,CAAC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BAAU,IAAC,OAAO,EAAC,aAAa,EAAC,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,aAC3D,2DAA0B,OAAE,gBAAgB,IAAI,MAAM,IAC3C,IACT,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAhEW,QAAA,8BAA8B,kCAgEzC;AAEF,kBAAe,sCAA8B,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 &quot;both&quot; 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,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
+ const react_1 = require("@neo4j-ndl/react");
26
+ const react_2 = require("react");
27
+ const Component = () => {
28
+ const [selectedDate, setSelectedDate] = (0, react_2.useState)(new Date('2023-05-27T14:30:00'));
29
+ const [selectedTimeZone, setSelectedTimeZone] = (0, react_2.useState)('UTC');
30
+ const handleOnChange = (date) => {
31
+ setSelectedDate(date);
32
+ };
33
+ const handleTimeZoneChange = (timezone) => {
34
+ setSelectedTimeZone(timezone);
35
+ };
36
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(react_1.DatePicker, { timePickerProps: {
37
+ format: 'hh:mm',
38
+ timeInterval: 15,
39
+ }, timeZonePickerProps: {
40
+ onChange: handleTimeZoneChange,
41
+ value: selectedTimeZone,
42
+ }, reactDatePickerProps: {
43
+ onChange: handleOnChange,
44
+ popperProps: {
45
+ strategy: 'fixed',
46
+ },
47
+ selected: selectedDate,
48
+ showTimeInput: true,
49
+ } }), (0, jsx_runtime_1.jsxs)("div", { style: { marginTop: '1rem' }, children: [(0, jsx_runtime_1.jsxs)("p", { children: [(0, jsx_runtime_1.jsx)("strong", { children: "Selected Date:" }), ' ', selectedDate ? selectedDate.toISOString() : 'None'] }), (0, jsx_runtime_1.jsxs)("p", { children: [(0, jsx_runtime_1.jsx)("strong", { children: "Selected Timezone:" }), " ", selectedTimeZone] })] })] }));
50
+ };
51
+ exports.default = Component;
52
+ //# 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,mDAAiD;AAEjD,4CAA8C;AAC9C,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAC9C,IAAI,IAAI,CAAC,qBAAqB,CAAC,CAChC,CAAC;IACF,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,IAAA,gBAAQ,EAAS,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,4CACE,uBAAC,kBAAU,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,iCAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,aAC/B,0CACE,gEAA+B,EAAC,GAAG,EAClC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,MAAM,IACjD,EACJ,0CACE,oEAAmC,OAAE,gBAAgB,IACnD,IACA,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { 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
  "use strict";
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.Portaled = exports.Range = exports.Full = exports.InDialog = exports.Disabled = exports.WithTimePicker = exports.TextInputProps = exports.OpensToDate = exports.MinMaxDate = exports.StartsOnMonday = exports.Default = void 0;
24
+ exports.WithTimeZoneBothMode = exports.Portaled = exports.Range = exports.Full = exports.InDialog = exports.Disabled = exports.WithTimeZone = exports.WithTimePicker = exports.TextInputProps = exports.OpensToDate = exports.MinMaxDate = exports.StartsOnMonday = exports.Default = void 0;
25
25
  const jsx_runtime_1 = require("react/jsx-runtime");
26
26
  const DatePicker_1 = require("../DatePicker");
27
27
  const _1 = require("./");
@@ -116,6 +116,19 @@ exports.WithTimePicker = {
116
116
  },
117
117
  render: _1.DatePickerWithTimePicker,
118
118
  };
119
+ exports.WithTimeZone = {
120
+ args: {},
121
+ parameters: {
122
+ docs: {
123
+ source: {
124
+ code: _1.DatePickerWithTimeZoneSource,
125
+ language: 'tsx',
126
+ type: 'code',
127
+ },
128
+ },
129
+ },
130
+ render: _1.DatePickerWithTimeZone,
131
+ };
119
132
  exports.Disabled = {
120
133
  args: {},
121
134
  parameters: {
@@ -181,4 +194,17 @@ exports.Portaled = {
181
194
  },
182
195
  render: _1.DatePickerPortaled,
183
196
  };
197
+ exports.WithTimeZoneBothMode = {
198
+ args: {},
199
+ parameters: {
200
+ docs: {
201
+ source: {
202
+ code: _1.DatePickerWithTimeZoneBothModeSource,
203
+ language: 'tsx',
204
+ type: 'code',
205
+ },
206
+ },
207
+ },
208
+ render: _1.DatePickerWithTimeZoneBothMode,
209
+ };
184
210
  //# 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,8CAA2C;AAC3C,yBAuBY;AAEZ,MAAM,aAAa,GAA4B;IAC7C,SAAS,EAAE,uBAAU;IACrB,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,gCAAK,SAAS,EAAC,yBAAyB,YACtC,uBAAC,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,kBAAe,aAAa,CAAC;AAGhB,QAAA,OAAO,GAAU;IAC5B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,0BAAuB;gBAC7B,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,oBAAiB;CAC1B,CAAC;AAEW,QAAA,cAAc,GAAU;IACnC,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QAC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AK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,qBAAkB;CAC3B,CAAC;AAEW,QAAA,QAAQ,GAAU;IAC7B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,2BAAwB;gBAC9B,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,qBAAkB;CAC3B,CAAC;AAEW,QAAA,IAAI,GAAU;IACzB,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,uBAAoB;gBAC1B,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,iBAAc;CACvB,CAAC;AAEW,QAAA,KAAK,GAAU;IAC1B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,wBAAqB;gBAC3B,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,kBAAe;CACxB,CAAC;AAEW,QAAA,QAAQ,GAAU;IAC7B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,2BAAwB;gBAC9B,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,qBAAkB;CAC3B,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} 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 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"]}
1
+ {"version":3,"file":"date-picker.stories.js","sourceRoot":"","sources":["../../../../src/date-picker/stories/date-picker.stories.tsx"],"names":[],"mappings":";;;;AAsBA,8CAA2C;AAC3C,yBA2BY;AAEZ,MAAM,aAAa,GAA4B;IAC7C,SAAS,EAAE,uBAAU;IACrB,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,gCAAK,SAAS,EAAC,yBAAyB,YACtC,uB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ACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,iBAAc;CACvB,CAAC;AAEW,QAAA,KAAK,GAAU;IAC1B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,wBAAqB;gBAC3B,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,kBAAe;CACxB,CAAC;AAEW,QAAA,QAAQ,GAAU;IAC7B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,2BAAwB;gBAC9B,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,qBAAkB;CAC3B,CAAC;AAEW,QAAA,oBAAoB,GAAU;IACzC,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,uCAAoC;gBAC1C,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,iCAA8B;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"]}
@@ -23,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.DatePickerRangeSource = exports.DatePickerPortaledSource = exports.DatePickerFullSource = exports.DatePickerInDialogSource = exports.DatePickerDisabledSource = exports.DatePickerWithTimePickerSource = exports.DatePickerTextInputPropsSource = exports.DatePickerOpensToDateSource = exports.DatePickerMinMaxDateSource = exports.DatePickerStartsOnMondaySource = exports.DatePickerDefaultSource = exports.DatePickerRange = exports.DatePickerPortaled = exports.DatePickerFull = exports.DatePickerInDialog = exports.DatePickerDisabled = exports.DatePickerWithTimePicker = exports.DatePickerTextInputProps = exports.DatePickerOpensToDate = exports.DatePickerMinMaxDate = exports.DatePickerStartsOnMonday = exports.DatePickerDefault = void 0;
26
+ exports.DatePickerRangeSource = exports.DatePickerPortaledSource = exports.DatePickerFullSource = exports.DatePickerInDialogSource = exports.DatePickerDisabledSource = exports.DatePickerWithTimeZoneBothModeSource = exports.DatePickerWithTimeZoneSource = exports.DatePickerWithTimePickerSource = exports.DatePickerTextInputPropsSource = exports.DatePickerOpensToDateSource = exports.DatePickerMinMaxDateSource = exports.DatePickerStartsOnMondaySource = exports.DatePickerDefaultSource = exports.DatePickerRange = exports.DatePickerPortaled = exports.DatePickerFull = exports.DatePickerInDialog = exports.DatePickerDisabled = exports.DatePickerWithTimeZoneBothMode = exports.DatePickerWithTimeZone = exports.DatePickerWithTimePicker = exports.DatePickerTextInputProps = exports.DatePickerOpensToDate = exports.DatePickerMinMaxDate = exports.DatePickerStartsOnMonday = exports.DatePickerDefault = void 0;
27
27
  var date_picker_default_story_1 = require("./date-picker-default.story");
28
28
  Object.defineProperty(exports, "DatePickerDefault", { enumerable: true, get: function () { return __importDefault(date_picker_default_story_1).default; } });
29
29
  var date_picker_starts_on_monday_story_1 = require("./date-picker-starts-on-monday.story");
@@ -36,6 +36,10 @@ var date_picker_text_input_props_story_1 = require("./date-picker-text-input-pro
36
36
  Object.defineProperty(exports, "DatePickerTextInputProps", { enumerable: true, get: function () { return __importDefault(date_picker_text_input_props_story_1).default; } });
37
37
  var date_picker_with_time_picker_story_1 = require("./date-picker-with-time-picker.story");
38
38
  Object.defineProperty(exports, "DatePickerWithTimePicker", { enumerable: true, get: function () { return __importDefault(date_picker_with_time_picker_story_1).default; } });
39
+ var date_picker_with_timezone_story_1 = require("./date-picker-with-timezone.story");
40
+ Object.defineProperty(exports, "DatePickerWithTimeZone", { enumerable: true, get: function () { return __importDefault(date_picker_with_timezone_story_1).default; } });
41
+ var date_picker_with_timezone_both_mode_story_1 = require("./date-picker-with-timezone-both-mode.story");
42
+ Object.defineProperty(exports, "DatePickerWithTimeZoneBothMode", { enumerable: true, get: function () { return __importDefault(date_picker_with_timezone_both_mode_story_1).default; } });
39
43
  var date_picker_disabled_story_1 = require("./date-picker-disabled.story");
40
44
  Object.defineProperty(exports, "DatePickerDisabled", { enumerable: true, get: function () { return __importDefault(date_picker_disabled_story_1).default; } });
41
45
  var date_picker_in_dialog_story_1 = require("./date-picker-in-dialog.story");
@@ -58,12 +62,16 @@ const date_picker_range_story_tsx_raw_1 = __importDefault(require("./date-picker
58
62
  const date_picker_starts_on_monday_story_tsx_raw_1 = __importDefault(require("./date-picker-starts-on-monday.story.tsx?raw"));
59
63
  const date_picker_text_input_props_story_tsx_raw_1 = __importDefault(require("./date-picker-text-input-props.story.tsx?raw"));
60
64
  const date_picker_with_time_picker_story_tsx_raw_1 = __importDefault(require("./date-picker-with-time-picker.story.tsx?raw"));
65
+ const date_picker_with_timezone_story_tsx_raw_1 = __importDefault(require("./date-picker-with-timezone.story.tsx?raw"));
66
+ const date_picker_with_timezone_both_mode_story_tsx_raw_1 = __importDefault(require("./date-picker-with-timezone-both-mode.story.tsx?raw"));
61
67
  exports.DatePickerDefaultSource = (0, export_stories_utils_1.removeLicenseHeader)(date_picker_default_story_tsx_raw_1.default);
62
68
  exports.DatePickerStartsOnMondaySource = (0, export_stories_utils_1.removeLicenseHeader)(date_picker_starts_on_monday_story_tsx_raw_1.default);
63
69
  exports.DatePickerMinMaxDateSource = (0, export_stories_utils_1.removeLicenseHeader)(date_picker_min_max_date_story_tsx_raw_1.default);
64
70
  exports.DatePickerOpensToDateSource = (0, export_stories_utils_1.removeLicenseHeader)(date_picker_opens_to_date_story_tsx_raw_1.default);
65
71
  exports.DatePickerTextInputPropsSource = (0, export_stories_utils_1.removeLicenseHeader)(date_picker_text_input_props_story_tsx_raw_1.default);
66
72
  exports.DatePickerWithTimePickerSource = (0, export_stories_utils_1.removeLicenseHeader)(date_picker_with_time_picker_story_tsx_raw_1.default);
73
+ exports.DatePickerWithTimeZoneSource = (0, export_stories_utils_1.removeLicenseHeader)(date_picker_with_timezone_story_tsx_raw_1.default);
74
+ exports.DatePickerWithTimeZoneBothModeSource = (0, export_stories_utils_1.removeLicenseHeader)(date_picker_with_timezone_both_mode_story_tsx_raw_1.default);
67
75
  exports.DatePickerDisabledSource = (0, export_stories_utils_1.removeLicenseHeader)(date_picker_disabled_story_tsx_raw_1.default);
68
76
  exports.DatePickerInDialogSource = (0, export_stories_utils_1.removeLicenseHeader)(date_picker_in_dialog_story_tsx_raw_1.default);
69
77
  exports.DatePickerFullSource = (0, export_stories_utils_1.removeLicenseHeader)(date_picker_full_story_tsx_raw_1.default);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/date-picker/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,yEAA2E;AAAlE,+IAAA,OAAO,OAAqB;AACrC,2FAA2F;AAAlF,+JAAA,OAAO,OAA4B;AAC5C,mFAAmF;AAA1E,uJAAA,OAAO,OAAwB;AACxC,qFAAqF;AAA5E,yJAAA,OAAO,OAAyB;AACzC,2FAA2F;AAAlF,+JAAA,OAAO,OAA4B;AAC5C,2FAA2F;AAAlF,+JAAA,OAAO,OAA4B;AAC5C,2EAA6E;AAApE,iJAAA,OAAO,OAAsB;AACtC,6EAA8E;AAArE,kJAAA,OAAO,OAAsB;AACtC,mEAAqE;AAA5D,yIAAA,OAAO,OAAkB;AAClC,2EAA6E;AAApE,iJAAA,OAAO,OAAsB;AACtC,qEAAuE;AAA9D,2IAAA,OAAO,OAAmB;AAEnC,wFAAoF;AAEpF,4GAA6E;AAC7E,8GAA+E;AAC/E,sGAAuE;AACvE,gHAAgF;AAChF,sHAAqF;AACrF,wHAAuF;AACvF,8GAA+E;AAC/E,wGAAyE;AACzE,8HAA6F;AAC7F,8HAA6F;AAC7F,8HAA6F;AAEhF,QAAA,uBAAuB,GAAG,IAAA,0CAAmB,EACxD,2CAA0B,CAC3B,CAAC;AACW,QAAA,8BAA8B,GAAG,IAAA,0CAAmB,EAC/D,oDAAiC,CAClC,CAAC;AACW,QAAA,0BAA0B,GAAG,IAAA,0CAAmB,EAC3D,gDAA6B,CAC9B,CAAC;AACW,QAAA,2BAA2B,GAAG,IAAA,0CAAmB,EAC5D,iDAA8B,CAC/B,CAAC;AACW,QAAA,8BAA8B,GAAG,IAAA,0CAAmB,EAC/D,oDAAiC,CAClC,CAAC;AACW,QAAA,8BAA8B,GAAG,IAAA,0CAAmB,EAC/D,oDAAiC,CAClC,CAAC;AACW,QAAA,wBAAwB,GAAG,IAAA,0CAAmB,EACzD,4CAA2B,CAC5B,CAAC;AACW,QAAA,wBAAwB,GAAG,IAAA,0CAAmB,EACzD,6CAA2B,CAC5B,CAAC;AACW,QAAA,oBAAoB,GAAG,IAAA,0CAAmB,EACrD,wCAAuB,CACxB,CAAC;AACW,QAAA,wBAAwB,GAAG,IAAA,0CAAmB,EACzD,4CAA2B,CAC5B,CAAC;AACW,QAAA,qBAAqB,GAAG,IAAA,0CAAmB,EACtD,yCAAwB,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 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';\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 DatePickerDisabledSource = removeLicenseHeader(\n DatePickerDisabledSourceRaw,\n);\nexport const DatePickerInDialogSource = removeLicenseHeader(\n DatePickerInDialogSourceRaw,\n);\nexport const DatePickerFullSource = removeLicenseHeader(\n DatePickerFullSourceRaw,\n);\nexport const DatePickerPortaledSource = removeLicenseHeader(\n DatePickerPortaledSourceRaw,\n);\nexport const DatePickerRangeSource = removeLicenseHeader(\n DatePickerRangeSourceRaw,\n);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/date-picker/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,yEAA2E;AAAlE,+IAAA,OAAO,OAAqB;AACrC,2FAA2F;AAAlF,+JAAA,OAAO,OAA4B;AAC5C,mFAAmF;AAA1E,uJAAA,OAAO,OAAwB;AACxC,qFAAqF;AAA5E,yJAAA,OAAO,OAAyB;AACzC,2FAA2F;AAAlF,+JAAA,OAAO,OAA4B;AAC5C,2FAA2F;AAAlF,+JAAA,OAAO,OAA4B;AAC5C,qFAAsF;AAA7E,0JAAA,OAAO,OAA0B;AAC1C,yGAAwG;AAA/F,4KAAA,OAAO,OAAkC;AAClD,2EAA6E;AAApE,iJAAA,OAAO,OAAsB;AACtC,6EAA8E;AAArE,kJAAA,OAAO,OAAsB;AACtC,mEAAqE;AAA5D,yIAAA,OAAO,OAAkB;AAClC,2EAA6E;AAApE,iJAAA,OAAO,OAAsB;AACtC,qEAAuE;AAA9D,2IAAA,OAAO,OAAmB;AAEnC,wFAAoF;AAEpF,4GAA6E;AAC7E,8GAA+E;AAC/E,sGAAuE;AACvE,gHAAgF;AAChF,sHAAqF;AACrF,wHAAuF;AACvF,8GAA+E;AAC/E,wGAAyE;AACzE,8HAA6F;AAC7F,8HAA6F;AAC7F,8HAA6F;AAC7F,wHAAwF;AACxF,4IAA0G;AAE7F,QAAA,uBAAuB,GAAG,IAAA,0CAAmB,EACxD,2CAA0B,CAC3B,CAAC;AACW,QAAA,8BAA8B,GAAG,IAAA,0CAAmB,EAC/D,oDAAiC,CAClC,CAAC;AACW,QAAA,0BAA0B,GAAG,IAAA,0CAAmB,EAC3D,gDAA6B,CAC9B,CAAC;AACW,QAAA,2BAA2B,GAAG,IAAA,0CAAmB,EAC5D,iDAA8B,CAC/B,CAAC;AACW,QAAA,8BAA8B,GAAG,IAAA,0CAAmB,EAC/D,oDAAiC,CAClC,CAAC;AACW,QAAA,8BAA8B,GAAG,IAAA,0CAAmB,EAC/D,oDAAiC,CAClC,CAAC;AACW,QAAA,4BAA4B,GAAG,IAAA,0CAAmB,EAC7D,iDAA+B,CAChC,CAAC;AACW,QAAA,oCAAoC,GAAG,IAAA,0CAAmB,EACrE,2DAAuC,CACxC,CAAC;AACW,QAAA,wBAAwB,GAAG,IAAA,0CAAmB,EACzD,4CAA2B,CAC5B,CAAC;AACW,QAAA,wBAAwB,GAAG,IAAA,0CAAmB,EACzD,6CAA2B,CAC5B,CAAC;AACW,QAAA,oBAAoB,GAAG,IAAA,0CAAmB,EACrD,wCAAuB,CACxB,CAAC;AACW,QAAA,wBAAwB,GAAG,IAAA,0CAAmB,EACzD,4CAA2B,CAC5B,CAAC;AACW,QAAA,qBAAqB,GAAG,IAAA,0CAAmB,EACtD,yCAAwB,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"]}
@@ -107,7 +107,7 @@ const DropzoneComponent = (_a) => {
107
107
  }
108
108
  }, [isDragActive, isRejected]);
109
109
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isRejected && ((0, jsx_runtime_1.jsxs)(banner_1.Banner, { className: "ndl-dropzone-error-alert", variant: "danger", children: [(0, jsx_runtime_1.jsx)(banner_1.Banner.Header, { children: "Error" }), (0, jsx_runtime_1.jsx)(banner_1.Banner.Description, { children: Boolean(rejectedText) || 'File extension not supported.' })] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ ref: mergedRef, className: wrapperClasses, style: style }, restProps, htmlAttributes, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "ndl-dropzone-inner-wrapper" }, getRootProps(), { children: [(0, jsx_runtime_1.jsx)("input", Object.assign({ "aria-label": "Drag and drop area" }, getInputProps())), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-dropzone-inner", children: [width !== undefined && width > 230 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isDragActive && !isSafari ? (computedFileImage) : ((0, jsx_runtime_1.jsx)(icons_1.DocumentArrowUpIconOutline, { className: "ndl-dropzone-upload-icon" })) })), !isUploading && ((0, jsx_runtime_1.jsxs)("div", { className: "ndl-dnd-title-container", children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: "subheading-medium", children: titleText ||
110
- (heading !== null && heading !== void 0 ? heading : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Drag ", (0, jsx_runtime_1.jsx)("span", { className: "n-font-light", children: "&" }), " Drop"] }))) }), !isDragReject && ((0, jsx_runtime_1.jsxs)("div", { className: "ndl-dnd-subtitle", children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: "body-medium", children: "or" }), ' ', (0, jsx_runtime_1.jsx)("button", { className: "ndl-dnd-browse-link", onClick: () => open(), disabled: isDisabled, children: "Browse" })] }))] })), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-dropzone-footer", children: [isUploading && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: loadingElement }), !isUploading && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-file-support-text", children: supportedFilesDescription }))] })] })] })) }))] }));
110
+ (heading !== null && heading !== void 0 ? heading : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Drag ", (0, jsx_runtime_1.jsx)("span", { className: "n-font-light", children: "&" }), " Drop"] }))) }), !isDragReject && ((0, jsx_runtime_1.jsxs)("div", { className: "ndl-dnd-subtitle", children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: "body-medium", children: "or" }), ' ', (0, jsx_runtime_1.jsx)("button", { className: "ndl-dnd-browse-link", onClick: () => open(), disabled: isDisabled, type: "button", children: "Browse" })] }))] })), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-dropzone-footer", children: [isUploading && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: loadingElement }), !isUploading && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-file-support-text", children: supportedFilesDescription }))] })] })] })) }))] }));
111
111
  };
112
112
  const DropzoneLoadingProgressBarComponent = (_a) => {
113
113
  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,8CAAkD;AAClD,4DAAoC;AACpC,mDAAwC;AACxC,iCAAkE;AAClE,mDAKwB;AACxB,6CAAgD;AAGhD,sCAAmC;AACnC,oCAIkB;AAClB,kDAA8C;AAC9C,8CAA2C;AAqC3C;;;;;;GAMG;AAEH,MAAM,OAAO,GAAG,IAAA,uBAAM,GAAE,CAAC;AAEzB,MAAM,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,MAAK,QAAQ,CAAC;AAE5C,MAAM,iBAAiB,GAAG,CAAC,EAYS,EAAE,EAAE;QAZb,EACzB,eAAe,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AG,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,iCAAK,SAAS,EAAC,2CAA2C,aACxD,iCAAK,SAAS,EAAC,8CAA8C,aAC3D,uBAAC,uBAAU,IACT,SAAS,EAAC,8CAA8C,EACxD,OAAO,EAAC,kBAAkB,YAEzB,qBAAqB,GAAG,GAAG,GACjB,EACZ,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAC7B,uBAAC,uBAAU,IACT,SAAS,EAAC,0CAA0C,EACpD,OAAO,EAAC,aAAa,YACrB,IAAI,iBAAiB,gBAAgB,GAAc,CACtD,IACG,EACN,uBAAC,0BAAW,kBACV,SAAS,EAAE,IAAA,oBAAU,EAAC,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;AAEM,4BAAQ","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 >\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,8CAAkD;AAClD,4DAAoC;AACpC,mDAAwC;AACxC,iCAAkE;AAClE,mDAKwB;AACxB,6CAAgD;AAGhD,sCAAmC;AACnC,oCAIkB;AAClB,kDAA8C;AAC9C,8CAA2C;AAqC3C;;;;;;GAMG;AAEH,MAAM,OAAO,GAAG,IAAA,uBAAM,GAAE,CAAC;AAEzB,MAAM,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,MAAK,QAAQ,CAAC;AAE5C,MAAM,iBAAiB,GAAG,CAAC,EAYS,EAAE,EAAE;QAZb,EACzB,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,OAAO,EACP,YAAY,EACZ,sBAAsB,EACtB,cAAc,EACd,KAAK,EACL,SAAS,EACT,GAAG,OAE+B,EAD/B,SAAS,cAXa,sKAY1B,CADa;IAEZ;;;;;;OAMG;IACH,SAAS,iBAAiB,CACxB,aAAkB,EAClB,cAA+B,EAC/B,KAAgB;;QAEhB,IAAI,sBAAsB,IAAI,sBAAsB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChE,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;gBACjC,MAAM,UAAU,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;oBAC3D,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;wBAAE,OAAO,IAAI,CAAC;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ACG,EACN,uBAAC,0BAAW,kBACV,SAAS,EAAE,IAAA,oBAAU,EAAC,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;AAEM,4BAAQ","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"]}
@@ -77,7 +77,10 @@ const IconButtonBase = (_a) => {
77
77
  onClick(e);
78
78
  }
79
79
  };
80
- return ((0, jsx_runtime_1.jsxs)(tooltip_1.Tooltip, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.root, { type: "simple", isDisabled: description === null || isDisabled, children: [(0, jsx_runtime_1.jsx)(tooltip_1.Tooltip.Trigger, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.trigger, { hasButtonWrapper: true, children: (0, jsx_runtime_1.jsx)(Component, Object.assign({ onClick: handleClick, disabled: isDisabled, "aria-disabled": !isInteractable, "aria-label": description, "aria-pressed": isActive, className: classes, style: style, ref: ref }, restProps, htmlAttributes, { children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-icon-btn-inner", children: isLoading ? ((0, jsx_runtime_1.jsx)(loading_spinner_1.LoadingSpinner, { size: "small" })) : ((0, jsx_runtime_1.jsx)("div", { className: "ndl-icon", children: children })) }) })) })), (0, jsx_runtime_1.jsx)(tooltip_1.Tooltip.Content, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.content, { children: description }))] })));
80
+ return ((0, jsx_runtime_1.jsxs)(tooltip_1.Tooltip, Object.assign({ hoverDelay: {
81
+ close: 0,
82
+ open: 500,
83
+ } }, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.root, { type: "simple", isDisabled: description === null || isDisabled, children: [(0, jsx_runtime_1.jsx)(tooltip_1.Tooltip.Trigger, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.trigger, { hasButtonWrapper: true, children: (0, jsx_runtime_1.jsx)(Component, Object.assign({ onClick: handleClick, disabled: isDisabled, "aria-disabled": !isInteractable, "aria-label": description, "aria-pressed": isActive, className: classes, style: style, ref: ref }, restProps, htmlAttributes, { children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-icon-btn-inner", children: isLoading ? ((0, jsx_runtime_1.jsx)(loading_spinner_1.LoadingSpinner, { size: "small" })) : ((0, jsx_runtime_1.jsx)("div", { className: "ndl-icon", children: children })) }) })) })), (0, jsx_runtime_1.jsx)(tooltip_1.Tooltip.Content, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.content, { children: description }))] })));
81
84
  };
82
85
  exports.IconButtonBase = IconButtonBase;
83
86
  //# sourceMappingURL=IconButtonBase.js.map