@elliemae/ds-date-time-picker 3.27.0-next.1 → 3.27.0-next.12

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.
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/DateTimePickerImpl.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable indent */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable no-empty-pattern */\n/* eslint-disable import/no-unresolved */\n/* eslint-disable max-lines */\n/* eslint-disable react/prop-types */\nimport React, { useState, useEffect, useMemo, useRef } from 'react';\nimport moment from 'moment';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { DSDatePickerController, DatePickerDropdown, SingleDatePickerPhrases } from '@elliemae/ds-date-picker';\nimport { DSInput, DSInputGroup, DateInputsV2Impl, TimeInputImpl } from '@elliemae/ds-form';\nimport { getVisibleTimeByFormat } from '@elliemae/ds-utilities';\nimport { DSTimePickerMenu, convertTimeString } from '@elliemae/ds-time-picker';\nimport { updateDateAndTime } from '../utils.js';\n\nconst blockName = 'date-time-picker';\n\nconst DateTimePickerWrapper = aggregatedClasses('div')(blockName, 'wrapper');\nconst TimePicker = aggregatedClasses(DSTimePickerMenu)(blockName, 'time-picker');\nconst TimePickerWrapper = aggregatedClasses('div')(blockName, 'time-picker-wrapper');\n// const DateInput = aggregatedClasses(DateInputsV2Impl)(blockName, 'date-input');\nconst formatDate = 'MMDDYYYY';\n\nconst DSDateTimePickerImpl = ({\n onBlur = () => null,\n placeholder,\n date,\n clearable,\n datePickerProps: {\n disabled = false,\n numberOfMonths = 1,\n readOnly = false,\n enableOutsideDays = false,\n transitionDuration = 0,\n firstDayOfWeek = 0,\n keepOpenOnDateSelect = true,\n hideKeyboardShortcutsPanel = true,\n onPrevMonthClick = () => null,\n onNextMonthClick = () => null,\n onClose = () => null,\n onChange: onDatePickerChange = () => null,\n onDateChange = () => null,\n onError: onErrorDate = () => null,\n phrases = SingleDatePickerPhrases,\n displayFormatDay = 'D',\n isDayBlocked = () => false,\n isOutsideRange = () => false,\n isDayHighlighted = () => false,\n zIndex = 11,\n },\n timePickerProps: {\n format = 'hh:mm A',\n onChange: onChangeTimePicker = () => null,\n disabledTimes = undefined,\n onError: onErrorTime = () => null,\n minutesInterval = 1,\n },\n dateInputProps: { onDateInputDateChange = () => null },\n}) => {\n const [selectedDate, setSelectedDate] = useState(undefined);\n const [incompleteInput, setIncompleteInput] = useState(undefined);\n const [isOpen, setIsOpen] = useState(false);\n\n const disabledTimeRange = disabledTimes && {\n from: convertTimeString(disabledTimes.from),\n to: convertTimeString(disabledTimes.to),\n };\n\n const dateTimePickerWrapperRef = useRef();\n const fullFormat = `${formatDate} ${format}`;\n\n useEffect(() => {\n if (date) {\n setSelectedDate(moment(date));\n } else if (date === null) setSelectedDate(undefined);\n }, [date]);\n\n const visiblePanels = useMemo(() => getVisibleTimeByFormat(format), []);\n\n const currentYear = moment().year();\n\n const handleDatePickerChange = (dateSelected) => {\n const splittedDate = updateDateAndTime(dateSelected, selectedDate);\n if (!readOnly) {\n setSelectedDate(splittedDate);\n onDateChange(splittedDate);\n }\n };\n\n const onTimeChange = (pickerTime) => {\n const splittedDate = updateDateAndTime(selectedDate, pickerTime);\n onChangeTimePicker(splittedDate);\n setSelectedDate(splittedDate);\n };\n\n const handleInputChange = (inputValue, type) => {\n onDatePickerChange(inputValue);\n let timeBlocked = false;\n const inputMoment = moment(inputValue, fullFormat);\n setIncompleteInput(inputValue);\n if (type === 'date') {\n const splittedDate = updateDateAndTime(inputMoment, selectedDate);\n if (inputValue.length < 8) {\n onErrorDate({ message: 'date incomplete', inputValue });\n if (clearable) onDateChange('error');\n return;\n }\n if (inputValue.length === 8 && inputMoment.isValid()) {\n setSelectedDate(splittedDate);\n onChangeTimePicker(splittedDate);\n }\n onDateChange(splittedDate);\n return;\n }\n\n if (disabledTimeRange) {\n const hour = inputValue.hour();\n const min = inputValue.minutes();\n const { from, to } = disabledTimeRange;\n\n if ((hour > from.hour && hour < to.hour) || (hour === to.hour && min < to.min)) {\n timeBlocked = true;\n }\n }\n if (timeBlocked) onErrorTime({ message: 'time blocked', inputValue });\n const dateBlocked = isDayBlocked(inputMoment);\n if (dateBlocked) onErrorDate({ message: 'date blocked', inputValue });\n if (!timeBlocked && !dateBlocked) {\n onDateChange(inputValue);\n }\n };\n\n const handleOutsideClick = (event) => {\n if (!dateTimePickerWrapperRef.current.contains(event.target)) {\n setIsOpen(false);\n }\n };\n\n const handleClickEscape = () => setIsOpen(false);\n const handleOpen = () => setIsOpen(true);\n\n const handleContainerBlur = (event) => {\n if (!isOpen && !event.currentTarget.contains(event.relatedTarget)) {\n onBlur(\n event,\n selectedDate?.isValid()\n ? selectedDate\n : {\n error: true,\n message: 'incomplete input',\n input: incompleteInput,\n },\n );\n if (clearable && !selectedDate && !!incompleteInput) {\n const inputMoment = moment(incompleteInput, fullFormat);\n const splittedDate = updateDateAndTime(inputMoment, selectedDate);\n\n setSelectedDate(splittedDate);\n onDateChange(splittedDate);\n }\n }\n };\n\n useEffect(() => {\n if (!isOpen)\n onBlur(\n {},\n selectedDate?.isValid()\n ? selectedDate\n : {\n error: true,\n message: 'incomplete input',\n input: incompleteInput,\n },\n );\n }, [isOpen]);\n\n const hasSelectedDate = !!selectedDate;\n return (\n <DSInputGroup\n containerProps={{\n onBlur: handleContainerBlur,\n }}\n rightAddon={\n <DatePickerDropdown\n disabled={disabled}\n isOpen={isOpen}\n zIndex={zIndex}\n menu={\n <DateTimePickerWrapper ref={dateTimePickerWrapperRef} data-testid=\"date-time-picker\">\n <div\n className={hasSelectedDate ? 'has-selected-date' : 'without-selected-date'}\n data-testid=\"date-time-picker-portal-wrapper\"\n >\n <DSDatePickerController\n date={selectedDate}\n displayFormatDay={displayFormatDay}\n enableOutsideDays={enableOutsideDays}\n firstDayOfWeek={firstDayOfWeek}\n hideKeyboardShortcutsPanel={hideKeyboardShortcutsPanel}\n isDayBlocked={isDayBlocked}\n isDayHighlighted={isDayHighlighted}\n isOutsideRange={isOutsideRange}\n keepOpenOnDateSelect={keepOpenOnDateSelect}\n numberOfMonths={numberOfMonths}\n onClickEscape={handleClickEscape}\n onClose={onClose}\n onDateChange={handleDatePickerChange}\n onNextMonthClick={onNextMonthClick}\n onOutsideClick={(event) => handleOutsideClick(event)}\n onPrevMonthClick={onPrevMonthClick}\n phrases={phrases}\n transitionDuration={transitionDuration}\n />\n </div>\n <TimePickerWrapper>\n <TimePicker\n disabled={disabled}\n disabledTimes={disabledTimeRange}\n format={format}\n hasHeader\n hasHeaderDisplay\n onTimeChange={onTimeChange}\n showSeconds={false}\n minutesInterval={minutesInterval}\n time={selectedDate}\n {...visiblePanels}\n />\n </TimePickerWrapper>\n </DateTimePickerWrapper>\n }\n onClick={handleOpen}\n readOnly={readOnly}\n />\n }\n >\n <DSInput\n customInputType={({ onChange: handleChange, ...restInputProps }) => (\n <>\n <div style={{ display: 'flex' }}>\n <DateInputsV2Impl\n disabled={disabled}\n onChange={(input) => handleChange(input, 'date')}\n {...restInputProps}\n onDateChange={onDateInputDateChange}\n yearMaxRange={currentYear + 100}\n yearMinRange={currentYear - 100}\n time={\n restInputProps.value && restInputProps.value.hour && restInputProps.value.isValid()\n ? restInputProps.value.format(formatDate)\n : restInputProps.value\n }\n />\n </div>\n <TimeInputImpl\n disabled={disabled}\n format={format}\n onChange={(time) => handleChange(time, 'time')}\n {...restInputProps}\n />\n </>\n )}\n isShowElipsisActive={false}\n disabled={disabled}\n onChange={handleInputChange}\n placeholder={placeholder}\n value={selectedDate}\n />\n </DSInputGroup>\n );\n};\n\nexport { DSDateTimePickerImpl };\nexport default DSDateTimePickerImpl;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD8LX;AAvLZ,mBAA4D;AAC5D,oBAAmB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AG;AAAA,gBACJ,cAAc;AAAA,gBACd,cAAc,cAAc;AAAA,gBAC5B,cAAc,cAAc;AAAA,gBAC5B,MACE,eAAe,SAAS,eAAe,MAAM,QAAQ,eAAe,MAAM,QAAQ,IAC9E,eAAe,MAAM,OAAO,UAAU,IACtC,eAAe;AAAA;AAAA,YAEvB,GACF;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC;AAAA,gBACA;AAAA,gBACA,UAAU,CAAC,SAAS,aAAa,MAAM,MAAM;AAAA,gBAC5C,GAAG;AAAA;AAAA,YACN;AAAA,aACF;AAAA,UAEF,qBAAqB;AAAA,UACrB;AAAA,UACA,UAAU;AAAA,UACV;AAAA,UACA,OAAO;AAAA;AAAA,MACT;AAAA;AAAA,EACF;AAEJ;AAGA,IAAO,6BAAQ;",
6
- "names": ["moment"]
7
- }
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var english_exports = {};
30
- __export(english_exports, {
31
- default: () => english_default
32
- });
33
- module.exports = __toCommonJS(english_exports);
34
- var React = __toESM(require("react"));
35
- var english_default = {
36
- placeholder: "Select date and time",
37
- className: "",
38
- id: ""
39
- };
40
- //# sourceMappingURL=english.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/lang/english.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export default {\n placeholder: 'Select date and time',\n className: '',\n id: '',\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,IAAO,kBAAQ;AAAA,EACb,aAAa;AAAA,EACb,WAAW;AAAA,EACX,IAAI;AACN;",
6
- "names": []
7
- }
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var utils_exports = {};
30
- __export(utils_exports, {
31
- themeProviderHOC: () => themeProviderHOC
32
- });
33
- module.exports = __toCommonJS(utils_exports);
34
- var React = __toESM(require("react"));
35
- var import_jsx_runtime = require("react/jsx-runtime");
36
- var import_react = __toESM(require("react"));
37
- var import_styled_components = require("styled-components");
38
- var import_ds_system = require("@elliemae/ds-system");
39
- const themeProviderHOC = (Component) => function(props) {
40
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled_components.ThemeProvider, { theme: import_ds_system.DSTheme, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...props }) });
41
- };
42
- //# sourceMappingURL=utils.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/tests/utils.js", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React from 'react';\nimport { ThemeProvider } from 'styled-components';\nimport { DSTheme } from '@elliemae/ds-system';\n\nexport const themeProviderHOC = (Component) =>\n function (props) {\n return (\n <ThemeProvider theme={DSTheme}>\n <Component {...props} />\n </ThemeProvider>\n );\n };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADQf;AARR,mBAAkB;AAClB,+BAA8B;AAC9B,uBAAwB;AAEjB,MAAM,mBAAmB,CAAC,cAC/B,SAAU,OAAO;AACf,SACE,4CAAC,0CAAc,OAAO,0BACpB,sDAAC,aAAW,GAAG,OAAO,GACxB;AAEJ;",
6
- "names": []
7
- }
package/dist/cjs/utils.js DELETED
@@ -1,46 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var utils_exports = {};
30
- __export(utils_exports, {
31
- updateDateAndTime: () => updateDateAndTime
32
- });
33
- module.exports = __toCommonJS(utils_exports);
34
- var React = __toESM(require("react"));
35
- var import_moment = __toESM(require("moment"));
36
- const updateDateAndTime = (date, time) => {
37
- const splittedDate = (0, import_moment.default)();
38
- splittedDate.month(date?.get("month"));
39
- splittedDate.year(date?.get("year"));
40
- splittedDate.date(date?.get("date"));
41
- splittedDate.hour(time?.get("hour"));
42
- splittedDate.minute(time?.get("minute"));
43
- splittedDate.second(time?.get("second"));
44
- return splittedDate;
45
- };
46
- //# sourceMappingURL=utils.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/utils.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import moment from 'moment';\n\nexport const updateDateAndTime = (date, time) => {\n const splittedDate = moment();\n splittedDate.month(date?.get('month'));\n splittedDate.year(date?.get('year'));\n splittedDate.date(date?.get('date'));\n splittedDate.hour(time?.get('hour'));\n splittedDate.minute(time?.get('minute'));\n splittedDate.second(time?.get('second'));\n\n return splittedDate;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,oBAAmB;AAEZ,MAAM,oBAAoB,CAAC,MAAM,SAAS;AAC/C,QAAM,mBAAe,cAAAA,SAAO;AAC5B,eAAa,MAAM,MAAM,IAAI,OAAO,CAAC;AACrC,eAAa,KAAK,MAAM,IAAI,MAAM,CAAC;AACnC,eAAa,KAAK,MAAM,IAAI,MAAM,CAAC;AACnC,eAAa,KAAK,MAAM,IAAI,MAAM,CAAC;AACnC,eAAa,OAAO,MAAM,IAAI,QAAQ,CAAC;AACvC,eAAa,OAAO,MAAM,IAAI,QAAQ,CAAC;AAEvC,SAAO;AACT;",
6
- "names": ["moment"]
7
- }
@@ -1,163 +0,0 @@
1
- import * as React from "react";
2
- import { jsx } from "react/jsx-runtime";
3
- import { useDeprecateComponent } from "@elliemae/ds-utilities";
4
- import { PropTypes, describe } from "@elliemae/ds-props-helpers";
5
- import moment from "moment";
6
- import { convertPropToCssClassName } from "@elliemae/ds-classnames";
7
- import { SingleDatePickerPhrases } from "@elliemae/ds-date-picker";
8
- import { DSDateTimePickerImpl } from "./components/DateTimePickerImpl.js";
9
- import english from "./lang/english.js";
10
- const { placeholder: placeholderDefault, className: classNameDefault, id: idDefault } = english;
11
- const DSDateTimePicker = ({
12
- containerProps = {},
13
- className = classNameDefault,
14
- id = idDefault,
15
- placeholder = placeholderDefault,
16
- date,
17
- clearable = false,
18
- onBlur = () => null,
19
- datePickerProps = {
20
- disabled: false,
21
- numberOfMonths: 1,
22
- readOnly: false,
23
- enableOutsideDays: false,
24
- transitionDuration: 0,
25
- firstDayOfWeek: 0,
26
- keepOpenOnDateSelect: true,
27
- hideKeyboardShortcutsPanel: true,
28
- onPrevMonthClick: () => null,
29
- onNextMonthClick: () => null,
30
- onClose: () => null,
31
- onchange: () => null,
32
- onDateChange: () => null,
33
- phrases: SingleDatePickerPhrases,
34
- displayFormatDay: "D",
35
- isDayBlocked: () => false,
36
- isOutsideRange: () => false,
37
- isDayHighlighted: () => false,
38
- zIndex: 11
39
- },
40
- timePickerProps = {
41
- format: "hh:mm A",
42
- onChange: () => null,
43
- disabledTimes: void 0,
44
- minutesInterval: 1
45
- },
46
- dateInputProps = {
47
- onDateInputDateChange: () => null
48
- }
49
- }) => {
50
- useDeprecateComponent({ componentName: "ds-date-time-picker", version: "3.x Date: 2023 Q1" });
51
- const { cssClassName } = convertPropToCssClassName("datetimepicker", className, {
52
- id
53
- });
54
- return /* @__PURE__ */ jsx("div", { className: cssClassName, ...containerProps, children: /* @__PURE__ */ jsx(
55
- DSDateTimePickerImpl,
56
- {
57
- clearable,
58
- date,
59
- datePickerProps,
60
- onBlur,
61
- placeholder,
62
- timePickerProps,
63
- dateInputProps
64
- }
65
- ) });
66
- };
67
- const dateTimePickerProps = {
68
- containerProps: PropTypes.object.description("Set of Properties attached to the main container"),
69
- className: PropTypes.string.description("html class attribute"),
70
- id: PropTypes.string.description("components id"),
71
- /**
72
- * on blur callback
73
- */
74
- onBlur: PropTypes.func.description("on blur callback"),
75
- /**
76
- * Initial date, by default current date
77
- */
78
- date: PropTypes.instanceOf(Date, moment).description("Initial date, by default current date"),
79
- /**
80
- * Flag to trigger onDateChange on error
81
- */
82
- clearable: PropTypes.bool.description("Flag to trigger onDateChange on error"),
83
- /**
84
- * DatePicker properties
85
- */
86
- datePickerProps: PropTypes.shape({
87
- disabled: PropTypes.bool,
88
- numberOfMonths: PropTypes.number,
89
- readOnly: PropTypes.bool,
90
- enableOutsideDays: PropTypes.bool,
91
- transitionDuration: PropTypes.number,
92
- firstDayOfWeek: PropTypes.number,
93
- keepOpenOnDateSelect: PropTypes.bool,
94
- hideKeyboardShortcutsPanel: PropTypes.bool,
95
- onPrevMonthClick: PropTypes.func,
96
- onNextMonthClick: PropTypes.func,
97
- onClose: PropTypes.func,
98
- onDateChange: PropTypes.func,
99
- phrases: PropTypes.shape({
100
- calendarLabel: PropTypes.string,
101
- closeDatePicker: PropTypes.string,
102
- clearDates: PropTypes.string,
103
- focusStartDate: PropTypes.string,
104
- jumpToPrevMonth: PropTypes.string,
105
- jumpToNextMonth: PropTypes.string,
106
- keyboardShortcuts: PropTypes.string,
107
- showKeyboardShortcutsPanel: PropTypes.string,
108
- hideKeyboardShortcutsPanel: PropTypes.string,
109
- openThisPanel: PropTypes.string,
110
- enterKey: PropTypes.string,
111
- leftArrowRightArrow: PropTypes.string,
112
- upArrowDownArrow: PropTypes.string,
113
- pageUpPageDown: PropTypes.string,
114
- homeEnd: PropTypes.string,
115
- escape: PropTypes.string,
116
- questionMark: PropTypes.string,
117
- selectFocusedDate: PropTypes.string,
118
- moveFocusByOneDay: PropTypes.string,
119
- moveFocusByOneWeek: PropTypes.string,
120
- moveFocusByOneMonth: PropTypes.string,
121
- moveFocustoStartAndEndOfWeek: PropTypes.string,
122
- returnFocusToInput: PropTypes.string,
123
- keyboardNavigationInstructions: PropTypes.string,
124
- chooseAvailableStartDate: PropTypes.func,
125
- chooseAvailableEndDate: PropTypes.func,
126
- dateIsUnavailable: PropTypes.func,
127
- dateIsSelected: PropTypes.func,
128
- /**
129
- * ZIndex for the picker popup
130
- */
131
- zIndex: PropTypes.number
132
- }),
133
- displayFormatDay: PropTypes.string,
134
- isDayBlocked: PropTypes.func,
135
- isOutsideRange: PropTypes.func,
136
- isDayHighlighted: PropTypes.func
137
- }).description("DatePicker properties"),
138
- /**
139
- * Input placeholder
140
- */
141
- placeholder: PropTypes.string.description("Input placeholder"),
142
- /**
143
- * TimePicker properties
144
- */
145
- timePickerProps: PropTypes.shape({
146
- format: PropTypes.string,
147
- onChange: PropTypes.func
148
- }).description("TimePicker properties"),
149
- dateInputProps: PropTypes.shape({
150
- onDateInputDateChange: PropTypes.func
151
- }).description("DateInputProperties")
152
- };
153
- DSDateTimePicker.propTypes = dateTimePickerProps;
154
- DSDateTimePicker.displayName = "DSDateTimePicker";
155
- const DateTimePickerWithSchema = describe(DSDateTimePicker);
156
- DateTimePickerWithSchema.propTypes = dateTimePickerProps;
157
- var DSDateTimePicker_default = DSDateTimePicker;
158
- export {
159
- DSDateTimePicker,
160
- DateTimePickerWithSchema,
161
- DSDateTimePicker_default as default
162
- };
163
- //# sourceMappingURL=DSDateTimePicker.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSDateTimePicker.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React from 'react';\nimport { useDeprecateComponent } from '@elliemae/ds-utilities';\nimport { PropTypes, describe } from '@elliemae/ds-props-helpers';\nimport moment from 'moment';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { SingleDatePickerPhrases } from '@elliemae/ds-date-picker';\nimport { DSDateTimePickerImpl } from './components/DateTimePickerImpl.js';\nimport english from './lang/english.js';\n\nconst { placeholder: placeholderDefault, className: classNameDefault, id: idDefault } = english;\n\nconst DSDateTimePicker = ({\n containerProps = {},\n className = classNameDefault,\n id = idDefault,\n placeholder = placeholderDefault,\n date,\n clearable = false,\n onBlur = () => null,\n datePickerProps = {\n disabled: false,\n numberOfMonths: 1,\n readOnly: false,\n enableOutsideDays: false,\n transitionDuration: 0,\n firstDayOfWeek: 0,\n keepOpenOnDateSelect: true,\n hideKeyboardShortcutsPanel: true,\n onPrevMonthClick: () => null,\n onNextMonthClick: () => null,\n onClose: () => null,\n onchange: () => null,\n onDateChange: () => null,\n phrases: SingleDatePickerPhrases,\n displayFormatDay: 'D',\n isDayBlocked: () => false,\n isOutsideRange: () => false,\n isDayHighlighted: () => false,\n zIndex: 11,\n },\n timePickerProps = {\n format: 'hh:mm A',\n onChange: () => null,\n disabledTimes: undefined,\n minutesInterval: 1,\n },\n dateInputProps = {\n onDateInputDateChange: () => null,\n },\n}) => {\n useDeprecateComponent({ componentName: 'ds-date-time-picker', version: '3.x Date: 2023 Q1' });\n\n const { cssClassName } = convertPropToCssClassName('datetimepicker', className, {\n id,\n });\n return (\n <div className={cssClassName} {...containerProps}>\n <DSDateTimePickerImpl\n clearable={clearable}\n date={date}\n datePickerProps={datePickerProps}\n onBlur={onBlur}\n placeholder={placeholder}\n timePickerProps={timePickerProps}\n dateInputProps={dateInputProps}\n />\n </div>\n );\n};\n\nconst dateTimePickerProps = {\n containerProps: PropTypes.object.description('Set of Properties attached to the main container'),\n className: PropTypes.string.description('html class attribute'),\n id: PropTypes.string.description('components id'),\n /**\n * on blur callback\n */\n onBlur: PropTypes.func.description('on blur callback'),\n /**\n * Initial date, by default current date\n */\n date: PropTypes.instanceOf(Date, moment).description('Initial date, by default current date'),\n /**\n * Flag to trigger onDateChange on error\n */\n clearable: PropTypes.bool.description('Flag to trigger onDateChange on error'),\n /**\n * DatePicker properties\n */\n datePickerProps: PropTypes.shape({\n disabled: PropTypes.bool,\n numberOfMonths: PropTypes.number,\n readOnly: PropTypes.bool,\n enableOutsideDays: PropTypes.bool,\n transitionDuration: PropTypes.number,\n firstDayOfWeek: PropTypes.number,\n keepOpenOnDateSelect: PropTypes.bool,\n hideKeyboardShortcutsPanel: PropTypes.bool,\n onPrevMonthClick: PropTypes.func,\n onNextMonthClick: PropTypes.func,\n onClose: PropTypes.func,\n onDateChange: PropTypes.func,\n phrases: PropTypes.shape({\n calendarLabel: PropTypes.string,\n closeDatePicker: PropTypes.string,\n clearDates: PropTypes.string,\n focusStartDate: PropTypes.string,\n jumpToPrevMonth: PropTypes.string,\n jumpToNextMonth: PropTypes.string,\n keyboardShortcuts: PropTypes.string,\n showKeyboardShortcutsPanel: PropTypes.string,\n hideKeyboardShortcutsPanel: PropTypes.string,\n openThisPanel: PropTypes.string,\n enterKey: PropTypes.string,\n leftArrowRightArrow: PropTypes.string,\n upArrowDownArrow: PropTypes.string,\n pageUpPageDown: PropTypes.string,\n homeEnd: PropTypes.string,\n escape: PropTypes.string,\n questionMark: PropTypes.string,\n selectFocusedDate: PropTypes.string,\n moveFocusByOneDay: PropTypes.string,\n moveFocusByOneWeek: PropTypes.string,\n moveFocusByOneMonth: PropTypes.string,\n moveFocustoStartAndEndOfWeek: PropTypes.string,\n returnFocusToInput: PropTypes.string,\n keyboardNavigationInstructions: PropTypes.string,\n chooseAvailableStartDate: PropTypes.func,\n chooseAvailableEndDate: PropTypes.func,\n dateIsUnavailable: PropTypes.func,\n dateIsSelected: PropTypes.func,\n /**\n * ZIndex for the picker popup\n */\n zIndex: PropTypes.number,\n }),\n displayFormatDay: PropTypes.string,\n isDayBlocked: PropTypes.func,\n isOutsideRange: PropTypes.func,\n isDayHighlighted: PropTypes.func,\n }).description('DatePicker properties'),\n /**\n * Input placeholder\n */\n placeholder: PropTypes.string.description('Input placeholder'),\n /**\n * TimePicker properties\n */\n timePickerProps: PropTypes.shape({\n format: PropTypes.string,\n onChange: PropTypes.func,\n }).description('TimePicker properties'),\n dateInputProps: PropTypes.shape({\n onDateInputDateChange: PropTypes.func,\n }).description('DateInputProperties'),\n};\n\nDSDateTimePicker.propTypes = dateTimePickerProps;\nDSDateTimePicker.displayName = 'DSDateTimePicker';\nconst DateTimePickerWithSchema = describe(DSDateTimePicker);\nDateTimePickerWithSchema.propTypes = dateTimePickerProps;\n\nexport { DateTimePickerWithSchema, DSDateTimePicker };\nexport default DSDateTimePicker;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;AC0DjB;AAxDN,SAAS,6BAA6B;AACtC,SAAS,WAAW,gBAAgB;AACpC,OAAO,YAAY;A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AmB,UAAU;AAAA,MAC7B,mBAAmB,UAAU;AAAA,MAC7B,oBAAoB,UAAU;AAAA,MAC9B,qBAAqB,UAAU;AAAA,MAC/B,8BAA8B,UAAU;AAAA,MACxC,oBAAoB,UAAU;AAAA,MAC9B,gCAAgC,UAAU;AAAA,MAC1C,0BAA0B,UAAU;AAAA,MACpC,wBAAwB,UAAU;AAAA,MAClC,mBAAmB,UAAU;AAAA,MAC7B,gBAAgB,UAAU;AAAA;AAAA;AAAA;AAAA,MAI1B,QAAQ,UAAU;AAAA,IACpB,CAAC;AAAA,IACD,kBAAkB,UAAU;AAAA,IAC5B,cAAc,UAAU;AAAA,IACxB,gBAAgB,UAAU;AAAA,IAC1B,kBAAkB,UAAU;AAAA,EAC9B,CAAC,EAAE,YAAY,uBAAuB;AAAA;AAAA;AAAA;AAAA,EAItC,aAAa,UAAU,OAAO,YAAY,mBAAmB;AAAA;AAAA;AAAA;AAAA,EAI7D,iBAAiB,UAAU,MAAM;AAAA,IAC/B,QAAQ,UAAU;AAAA,IAClB,UAAU,UAAU;AAAA,EACtB,CAAC,EAAE,YAAY,uBAAuB;AAAA,EACtC,gBAAgB,UAAU,MAAM;AAAA,IAC9B,uBAAuB,UAAU;AAAA,EACnC,CAAC,EAAE,YAAY,qBAAqB;AACtC;AAEA,iBAAiB,YAAY;AAC7B,iBAAiB,cAAc;AAC/B,MAAM,2BAA2B,SAAS,gBAAgB;AAC1D,yBAAyB,YAAY;AAGrC,IAAO,2BAAQ;",
6
- "names": []
7
- }
@@ -1,259 +0,0 @@
1
- import * as React from "react";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useState, useEffect, useMemo, useRef } from "react";
4
- import moment from "moment";
5
- import { aggregatedClasses } from "@elliemae/ds-classnames";
6
- import { DSDatePickerController, DatePickerDropdown, SingleDatePickerPhrases } from "@elliemae/ds-date-picker";
7
- import { DSInput, DSInputGroup, DateInputsV2Impl, TimeInputImpl } from "@elliemae/ds-form";
8
- import { getVisibleTimeByFormat } from "@elliemae/ds-utilities";
9
- import { DSTimePickerMenu, convertTimeString } from "@elliemae/ds-time-picker";
10
- import { updateDateAndTime } from "../utils.js";
11
- const blockName = "date-time-picker";
12
- const DateTimePickerWrapper = aggregatedClasses("div")(blockName, "wrapper");
13
- const TimePicker = aggregatedClasses(DSTimePickerMenu)(blockName, "time-picker");
14
- const TimePickerWrapper = aggregatedClasses("div")(blockName, "time-picker-wrapper");
15
- const formatDate = "MMDDYYYY";
16
- const DSDateTimePickerImpl = ({
17
- onBlur = () => null,
18
- placeholder,
19
- date,
20
- clearable,
21
- datePickerProps: {
22
- disabled = false,
23
- numberOfMonths = 1,
24
- readOnly = false,
25
- enableOutsideDays = false,
26
- transitionDuration = 0,
27
- firstDayOfWeek = 0,
28
- keepOpenOnDateSelect = true,
29
- hideKeyboardShortcutsPanel = true,
30
- onPrevMonthClick = () => null,
31
- onNextMonthClick = () => null,
32
- onClose = () => null,
33
- onChange: onDatePickerChange = () => null,
34
- onDateChange = () => null,
35
- onError: onErrorDate = () => null,
36
- phrases = SingleDatePickerPhrases,
37
- displayFormatDay = "D",
38
- isDayBlocked = () => false,
39
- isOutsideRange = () => false,
40
- isDayHighlighted = () => false,
41
- zIndex = 11
42
- },
43
- timePickerProps: {
44
- format = "hh:mm A",
45
- onChange: onChangeTimePicker = () => null,
46
- disabledTimes = void 0,
47
- onError: onErrorTime = () => null,
48
- minutesInterval = 1
49
- },
50
- dateInputProps: { onDateInputDateChange = () => null }
51
- }) => {
52
- const [selectedDate, setSelectedDate] = useState(void 0);
53
- const [incompleteInput, setIncompleteInput] = useState(void 0);
54
- const [isOpen, setIsOpen] = useState(false);
55
- const disabledTimeRange = disabledTimes && {
56
- from: convertTimeString(disabledTimes.from),
57
- to: convertTimeString(disabledTimes.to)
58
- };
59
- const dateTimePickerWrapperRef = useRef();
60
- const fullFormat = `${formatDate} ${format}`;
61
- useEffect(() => {
62
- if (date) {
63
- setSelectedDate(moment(date));
64
- } else if (date === null)
65
- setSelectedDate(void 0);
66
- }, [date]);
67
- const visiblePanels = useMemo(() => getVisibleTimeByFormat(format), []);
68
- const currentYear = moment().year();
69
- const handleDatePickerChange = (dateSelected) => {
70
- const splittedDate = updateDateAndTime(dateSelected, selectedDate);
71
- if (!readOnly) {
72
- setSelectedDate(splittedDate);
73
- onDateChange(splittedDate);
74
- }
75
- };
76
- const onTimeChange = (pickerTime) => {
77
- const splittedDate = updateDateAndTime(selectedDate, pickerTime);
78
- onChangeTimePicker(splittedDate);
79
- setSelectedDate(splittedDate);
80
- };
81
- const handleInputChange = (inputValue, type) => {
82
- onDatePickerChange(inputValue);
83
- let timeBlocked = false;
84
- const inputMoment = moment(inputValue, fullFormat);
85
- setIncompleteInput(inputValue);
86
- if (type === "date") {
87
- const splittedDate = updateDateAndTime(inputMoment, selectedDate);
88
- if (inputValue.length < 8) {
89
- onErrorDate({ message: "date incomplete", inputValue });
90
- if (clearable)
91
- onDateChange("error");
92
- return;
93
- }
94
- if (inputValue.length === 8 && inputMoment.isValid()) {
95
- setSelectedDate(splittedDate);
96
- onChangeTimePicker(splittedDate);
97
- }
98
- onDateChange(splittedDate);
99
- return;
100
- }
101
- if (disabledTimeRange) {
102
- const hour = inputValue.hour();
103
- const min = inputValue.minutes();
104
- const { from, to } = disabledTimeRange;
105
- if (hour > from.hour && hour < to.hour || hour === to.hour && min < to.min) {
106
- timeBlocked = true;
107
- }
108
- }
109
- if (timeBlocked)
110
- onErrorTime({ message: "time blocked", inputValue });
111
- const dateBlocked = isDayBlocked(inputMoment);
112
- if (dateBlocked)
113
- onErrorDate({ message: "date blocked", inputValue });
114
- if (!timeBlocked && !dateBlocked) {
115
- onDateChange(inputValue);
116
- }
117
- };
118
- const handleOutsideClick = (event) => {
119
- if (!dateTimePickerWrapperRef.current.contains(event.target)) {
120
- setIsOpen(false);
121
- }
122
- };
123
- const handleClickEscape = () => setIsOpen(false);
124
- const handleOpen = () => setIsOpen(true);
125
- const handleContainerBlur = (event) => {
126
- if (!isOpen && !event.currentTarget.contains(event.relatedTarget)) {
127
- onBlur(
128
- event,
129
- selectedDate?.isValid() ? selectedDate : {
130
- error: true,
131
- message: "incomplete input",
132
- input: incompleteInput
133
- }
134
- );
135
- if (clearable && !selectedDate && !!incompleteInput) {
136
- const inputMoment = moment(incompleteInput, fullFormat);
137
- const splittedDate = updateDateAndTime(inputMoment, selectedDate);
138
- setSelectedDate(splittedDate);
139
- onDateChange(splittedDate);
140
- }
141
- }
142
- };
143
- useEffect(() => {
144
- if (!isOpen)
145
- onBlur(
146
- {},
147
- selectedDate?.isValid() ? selectedDate : {
148
- error: true,
149
- message: "incomplete input",
150
- input: incompleteInput
151
- }
152
- );
153
- }, [isOpen]);
154
- const hasSelectedDate = !!selectedDate;
155
- return /* @__PURE__ */ jsx(
156
- DSInputGroup,
157
- {
158
- containerProps: {
159
- onBlur: handleContainerBlur
160
- },
161
- rightAddon: /* @__PURE__ */ jsx(
162
- DatePickerDropdown,
163
- {
164
- disabled,
165
- isOpen,
166
- zIndex,
167
- menu: /* @__PURE__ */ jsxs(DateTimePickerWrapper, { ref: dateTimePickerWrapperRef, "data-testid": "date-time-picker", children: [
168
- /* @__PURE__ */ jsx(
169
- "div",
170
- {
171
- className: hasSelectedDate ? "has-selected-date" : "without-selected-date",
172
- "data-testid": "date-time-picker-portal-wrapper",
173
- children: /* @__PURE__ */ jsx(
174
- DSDatePickerController,
175
- {
176
- date: selectedDate,
177
- displayFormatDay,
178
- enableOutsideDays,
179
- firstDayOfWeek,
180
- hideKeyboardShortcutsPanel,
181
- isDayBlocked,
182
- isDayHighlighted,
183
- isOutsideRange,
184
- keepOpenOnDateSelect,
185
- numberOfMonths,
186
- onClickEscape: handleClickEscape,
187
- onClose,
188
- onDateChange: handleDatePickerChange,
189
- onNextMonthClick,
190
- onOutsideClick: (event) => handleOutsideClick(event),
191
- onPrevMonthClick,
192
- phrases,
193
- transitionDuration
194
- }
195
- )
196
- }
197
- ),
198
- /* @__PURE__ */ jsx(TimePickerWrapper, { children: /* @__PURE__ */ jsx(
199
- TimePicker,
200
- {
201
- disabled,
202
- disabledTimes: disabledTimeRange,
203
- format,
204
- hasHeader: true,
205
- hasHeaderDisplay: true,
206
- onTimeChange,
207
- showSeconds: false,
208
- minutesInterval,
209
- time: selectedDate,
210
- ...visiblePanels
211
- }
212
- ) })
213
- ] }),
214
- onClick: handleOpen,
215
- readOnly
216
- }
217
- ),
218
- children: /* @__PURE__ */ jsx(
219
- DSInput,
220
- {
221
- customInputType: ({ onChange: handleChange, ...restInputProps }) => /* @__PURE__ */ jsxs(Fragment, { children: [
222
- /* @__PURE__ */ jsx("div", { style: { display: "flex" }, children: /* @__PURE__ */ jsx(
223
- DateInputsV2Impl,
224
- {
225
- disabled,
226
- onChange: (input) => handleChange(input, "date"),
227
- ...restInputProps,
228
- onDateChange: onDateInputDateChange,
229
- yearMaxRange: currentYear + 100,
230
- yearMinRange: currentYear - 100,
231
- time: restInputProps.value && restInputProps.value.hour && restInputProps.value.isValid() ? restInputProps.value.format(formatDate) : restInputProps.value
232
- }
233
- ) }),
234
- /* @__PURE__ */ jsx(
235
- TimeInputImpl,
236
- {
237
- disabled,
238
- format,
239
- onChange: (time) => handleChange(time, "time"),
240
- ...restInputProps
241
- }
242
- )
243
- ] }),
244
- isShowElipsisActive: false,
245
- disabled,
246
- onChange: handleInputChange,
247
- placeholder,
248
- value: selectedDate
249
- }
250
- )
251
- }
252
- );
253
- };
254
- var DateTimePickerImpl_default = DSDateTimePickerImpl;
255
- export {
256
- DSDateTimePickerImpl,
257
- DateTimePickerImpl_default as default
258
- };
259
- //# sourceMappingURL=DateTimePickerImpl.js.map