react-select-datepicker 1.1.2 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,301 +0,0 @@
1
- import React, { useState, useMemo, useCallback, useEffect } from 'react';
2
-
3
- function _extends() {
4
- _extends = Object.assign || function (target) {
5
- for (var i = 1; i < arguments.length; i++) {
6
- var source = arguments[i];
7
-
8
- for (var key in source) {
9
- if (Object.prototype.hasOwnProperty.call(source, key)) {
10
- target[key] = source[key];
11
- }
12
- }
13
- }
14
-
15
- return target;
16
- };
17
-
18
- return _extends.apply(this, arguments);
19
- }
20
-
21
- var buildDateFromInput = function buildDateFromInput(day, month, year) {
22
- var date = new Date(Number(year), Number(month) - 1, Number(day));
23
- return date;
24
- };
25
-
26
- var isValidDateObject = function isValidDateObject(date, day, month, year) {
27
- var isDate = Object.prototype.toString.call(date) === '[object Date]';
28
- var dayMatch = date.getDate() === Number(day);
29
- var monthMatch = date.getMonth() === Number(month) - 1;
30
- var yearMatch = date.getFullYear() === Number(year);
31
- return isDate && dayMatch && monthMatch && yearMatch;
32
- };
33
-
34
- var isValidDate = function isValidDate(day, month, year, props) {
35
- var userDate = buildDateFromInput(day, month, year);
36
-
37
- if (!isValidDateObject(userDate, day, month, year)) {
38
- return props.invalidMessage || 'Not a valid date';
39
- }
40
-
41
- if (props.maxDate) {
42
- var maxDate = props.maxDate;
43
-
44
- if (userDate > maxDate) {
45
- var maxDatePlusOne = new Date(maxDate);
46
- maxDatePlusOne.setDate(maxDatePlusOne.getDate() + 1);
47
- return props.maxDateMessage || "Date must be less than " + maxDatePlusOne.toDateString().substring(3);
48
- }
49
- }
50
-
51
- if (props.minDate) {
52
- var minDate = props.minDate;
53
-
54
- if (userDate < minDate) {
55
- var minDateMinusOne = new Date(minDate);
56
- minDateMinusOne.setDate(minDateMinusOne.getDate() - 1);
57
- return props.minDateMessage || "Date must be greater than " + minDateMinusOne.toDateString().substring(3);
58
- }
59
- }
60
-
61
- return '';
62
- };
63
-
64
- var MONTHMAP = {
65
- 1: 'January',
66
- 2: 'February',
67
- 3: 'March',
68
- 4: 'April',
69
- 5: 'May',
70
- 6: 'June',
71
- 7: 'July',
72
- 8: 'August',
73
- 9: 'September',
74
- 10: 'October',
75
- 11: 'November',
76
- 12: 'December'
77
- };
78
-
79
- var getDays = function getDays(showPlaceholder, dayLabel) {
80
- var days = [];
81
- days.push(React.createElement("option", {
82
- value: "",
83
- disabled: true
84
- }, showPlaceholder ? dayLabel || 'Day' : ''));
85
-
86
- for (var i = 1; i <= 31; i += 1) {
87
- days.push(React.createElement("option", {
88
- value: "" + i
89
- }, i));
90
- }
91
-
92
- return days;
93
- };
94
-
95
- var getMonths = function getMonths(showPlaceholder, monthLabel, monthNames) {
96
- var months = [];
97
- months.push(React.createElement("option", {
98
- value: "",
99
- disabled: true
100
- }, showPlaceholder ? monthLabel || 'Month' : ''));
101
-
102
- for (var i = 1; i <= 12; i += 1) {
103
- months.push(React.createElement("option", {
104
- value: "" + i
105
- }, monthNames ? monthNames[i - 1] : MONTHMAP[i]));
106
- }
107
-
108
- return months;
109
- };
110
-
111
- var getYears = function getYears(max, min, showPlaceholder, value, yearLabel) {
112
- var years = [];
113
- var maxYear;
114
- var minYear;
115
-
116
- if (max !== undefined) {
117
- maxYear = max.getFullYear();
118
- } else {
119
- maxYear = new Date().getFullYear();
120
- }
121
-
122
- if (min !== undefined) {
123
- minYear = min.getFullYear();
124
- } else {
125
- minYear = 1900;
126
- }
127
-
128
- if (value) {
129
- if (Number(value) > maxYear) {
130
- maxYear = Number(value);
131
- }
132
-
133
- if (Number(value) < minYear) {
134
- minYear = Number(value);
135
- }
136
- }
137
-
138
- years.push(React.createElement("option", {
139
- value: "",
140
- disabled: true
141
- }, showPlaceholder ? yearLabel || 'Year' : ''));
142
-
143
- for (var i = maxYear; i >= minYear; i -= 1) {
144
- years.push(React.createElement("option", {
145
- value: "" + i
146
- }, i));
147
- }
148
-
149
- return years;
150
- };
151
-
152
- var spreadDateToObject = function spreadDateToObject(dateValue) {
153
- return {
154
- day: dateValue ? "" + dateValue.getDate() : '',
155
- month: dateValue ? "" + (dateValue.getMonth() + 1) : '',
156
- year: dateValue ? "" + dateValue.getFullYear() : ''
157
- };
158
- };
159
-
160
- var flex = {
161
- display: 'flex'
162
- };
163
- var flexColumn = {
164
- display: 'flex',
165
- flexDirection: 'column'
166
- };
167
-
168
- var SelectDatepicker = function SelectDatepicker(props) {
169
- var _useState = useState(true),
170
- isDirty = _useState[0],
171
- setIsDirty = _useState[1];
172
-
173
- var _useState2 = useState(false),
174
- hasError = _useState2[0],
175
- setHasError = _useState2[1];
176
-
177
- var _useState3 = useState(),
178
- error = _useState3[0],
179
- setError = _useState3[1];
180
-
181
- var _useState4 = useState(spreadDateToObject(props.value)),
182
- date = _useState4[0],
183
- setDate = _useState4[1];
184
-
185
- var orderArray = useMemo(function () {
186
- return props.format.split('/');
187
- }, [props.format]);
188
- var onDateChange = useCallback(function (newDate) {
189
- props.onDateChange(newDate);
190
- }, [props]);
191
- var validDateChange = useCallback(function () {
192
- var newDate = buildDateFromInput(date.day, date.month, date.year);
193
- onDateChange(newDate);
194
- }, [date.day, date.month, date.year, onDateChange]);
195
- var renderError = useCallback(function (err, hasErr) {
196
- setError(err);
197
- setHasError(hasErr);
198
- onDateChange(null);
199
- }, [onDateChange]);
200
- var validate = useCallback(function () {
201
- var day = date.day,
202
- month = date.month,
203
- year = date.year;
204
-
205
- if (!day || !month || !year) {
206
- onDateChange(null);
207
- return;
208
- }
209
-
210
- var errorString = isValidDate(day, month, year, props);
211
-
212
- if (errorString !== '') {
213
- renderError(errorString, true);
214
- return;
215
- }
216
-
217
- validDateChange();
218
- }, [date, onDateChange, props, renderError, validDateChange]);
219
- var onInputChange = useCallback(function (e) {
220
- var _extends2;
221
-
222
- setDate(_extends({}, date, (_extends2 = {}, _extends2[e.target.name] = e.target.value, _extends2)));
223
- setIsDirty(true);
224
- }, [date]);
225
- var inputField = useCallback(function (id, label, value, options) {
226
- var className = "rsd_" + id + "-container";
227
- return React.createElement("div", {
228
- className: "" + className,
229
- style: flexColumn
230
- }, props.showLabels ? React.createElement("label", {
231
- htmlFor: id
232
- }, label) : null, React.createElement("select", {
233
- className: "" + (hasError ? 'has-error' : ''),
234
- id: id,
235
- name: id,
236
- value: value,
237
- onChange: onInputChange
238
- }, options.map(function (option, i) {
239
- return React.createElement(React.Fragment, {
240
- key: option + "-" + i
241
- }, option);
242
- })));
243
- }, [hasError, onInputChange, props.showLabels]);
244
- var dateField = useMemo(function () {
245
- var showPlaceholders = props.showPlaceholders,
246
- monthNames = props.monthNames,
247
- maxDate = props.maxDate,
248
- minDate = props.minDate,
249
- labels = props.labels;
250
- var dayLabel = labels && labels.day || 'Day';
251
- var monthLabel = labels && labels.month || 'Month';
252
- var yearLabel = labels && labels.year || 'Year';
253
- var fields = {
254
- day: inputField('day', dayLabel, date.day, getDays(showPlaceholders, dayLabel)),
255
- month: inputField('month', monthLabel, date.month, getMonths(showPlaceholders, monthLabel, monthNames)),
256
- year: inputField('year', yearLabel, date.year, getYears(maxDate, minDate, showPlaceholders, date.year, yearLabel))
257
- };
258
- return fields;
259
- }, [date.day, date.month, date.year, inputField, props]);
260
- useEffect(function () {
261
- if (isDirty) {
262
- setError('');
263
- setHasError(false);
264
- validate();
265
- setIsDirty(false);
266
- }
267
- }, [isDirty]);
268
- useEffect(function () {
269
- var value = props.value;
270
- var day = date.day,
271
- month = date.month,
272
- year = date.year;
273
-
274
- if (value !== null && value !== buildDateFromInput(day, month, year)) {
275
- setDate(spreadDateToObject(value));
276
- }
277
- }, [props]);
278
- return React.createElement("div", {
279
- className: "rsd " + props.className
280
- }, React.createElement("div", {
281
- className: "rsd_date-container",
282
- style: flex
283
- }, orderArray.map(function (key, i) {
284
- return React.createElement(React.Fragment, {
285
- key: key + "-" + i
286
- }, dateField[key]);
287
- })), props.showErrors && hasError && React.createElement("div", {
288
- className: "error-message"
289
- }, error));
290
- };
291
- SelectDatepicker.defaultProps = {
292
- value: null,
293
- showLabels: true,
294
- showPlaceholders: true,
295
- showErrors: true,
296
- format: 'month/day/year',
297
- className: ''
298
- };
299
-
300
- export default SelectDatepicker;
301
- //# sourceMappingURL=index.modern.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.modern.js","sources":["../src/dateValidation.ts","../src/dateMap.tsx","../src/helpers.ts","../src/styles.ts","../src/index.tsx"],"sourcesContent":["/**\n * Build a date from input\n * @param {string} day\n * @param {string} month\n * @param {string} year\n */\nconst buildDateFromInput = (day: string, month: string, year: string) => {\n const date = new Date(Number(year), Number(month) - 1, Number(day));\n return date;\n};\n\n/**\n * Check if the date value is a valid Date object and that it matches the values it was created from\n * @param date Date\n * @param day string\n * @param month string\n * @param year string\n */\nconst isValidDateObject = (\n date: Date,\n day: string,\n month: string,\n year: string,\n) => {\n const isDate = Object.prototype.toString.call(date) === '[object Date]';\n const dayMatch = date.getDate() === Number(day);\n const monthMatch = date.getMonth() === Number(month) - 1;\n const yearMatch = date.getFullYear() === Number(year);\n\n return isDate && dayMatch && monthMatch && yearMatch;\n};\n\n/**\n * Determine if provided date is a valid date and falls between date range\n * @param {string} day\n * @param {string} month\n * @param {string} year\n * @param {object} props\n */\nconst isValidDate = (day: string, month: string, year: string, props: any) => {\n const userDate = buildDateFromInput(day, month, year);\n\n // Must be a valid date\n if (!isValidDateObject(userDate, day, month, year)) {\n return props.invalidMessage || 'Not a valid date';\n }\n\n // Must be same or before max date\n if (props.maxDate) {\n const { maxDate } = props;\n if (userDate > maxDate) {\n const maxDatePlusOne = new Date(maxDate);\n maxDatePlusOne.setDate(maxDatePlusOne.getDate() + 1);\n\n return (\n props.maxDateMessage ||\n `Date must be less than ${maxDatePlusOne.toDateString().substring(3)}`\n );\n }\n }\n\n // Must be same or after min date\n if (props.minDate) {\n const { minDate } = props;\n if (userDate < minDate) {\n const minDateMinusOne = new Date(minDate);\n minDateMinusOne.setDate(minDateMinusOne.getDate() - 1);\n\n return (\n props.minDateMessage ||\n `Date must be greater than ${minDateMinusOne\n .toDateString()\n .substring(3)}`\n );\n }\n }\n\n return '';\n};\n\nexport { isValidDate, buildDateFromInput };\n","import React from 'react';\n\nconst MONTHMAP = {\n 1: 'January',\n 2: 'February',\n 3: 'March',\n 4: 'April',\n 5: 'May',\n 6: 'June',\n 7: 'July',\n 8: 'August',\n 9: 'September',\n 10: 'October',\n 11: 'November',\n 12: 'December',\n};\n\nconst getDays = (showPlaceholder: boolean, dayLabel: string) => {\n const days = [];\n\n days.push(\n <option value=\"\" disabled>\n {showPlaceholder ? dayLabel || 'Day' : ''}\n </option>,\n );\n\n for (let i = 1; i <= 31; i += 1) {\n days.push(<option value={`${i}`}>{i}</option>);\n }\n\n return days;\n};\n\nconst getMonths = (\n showPlaceholder: boolean,\n monthLabel: string,\n monthNames: Array<string> | undefined,\n) => {\n const months = [];\n\n months.push(\n <option value=\"\" disabled>\n {showPlaceholder ? monthLabel || 'Month' : ''}\n </option>,\n );\n\n for (let i = 1; i <= 12; i += 1) {\n months.push(\n <option value={`${i}`}>\n {monthNames ? monthNames[i - 1] : MONTHMAP[i]}\n </option>,\n );\n }\n\n return months;\n};\n\nconst getYears = (\n max: Date | undefined,\n min: Date | undefined,\n showPlaceholder: boolean,\n value: string,\n yearLabel: string,\n) => {\n const years = [];\n let maxYear;\n let minYear;\n\n if (max !== undefined) {\n maxYear = max.getFullYear();\n } else {\n maxYear = new Date().getFullYear();\n }\n\n if (min !== undefined) {\n minYear = min.getFullYear();\n } else {\n minYear = 1900;\n }\n\n if (value) {\n if (Number(value) > maxYear) {\n maxYear = Number(value);\n }\n\n if (Number(value) < minYear) {\n minYear = Number(value);\n }\n }\n\n years.push(\n <option value=\"\" disabled>\n {showPlaceholder ? yearLabel || 'Year' : ''}\n </option>,\n );\n\n for (let i = maxYear; i >= minYear; i -= 1) {\n years.push(<option value={`${i}`}>{i}</option>);\n }\n\n return years;\n};\n\nexport { getDays, getMonths, getYears };\n","import { IDate } from './interfaces';\n\n/**\n * Parse date object into day, month, year state\n */\nexport const spreadDateToObject = (dateValue: Date | null): IDate => {\n return {\n day: dateValue ? `${dateValue.getDate()}` : '',\n month: dateValue ? `${dateValue.getMonth() + 1}` : '',\n year: dateValue ? `${dateValue.getFullYear()}` : '',\n };\n};\n","export const flex: React.CSSProperties = {\n display: 'flex',\n};\n\nexport const flexColumn: React.CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n};\n","/* eslint-disable react/no-array-index-key */\nimport React, {\n useState,\n useCallback,\n ChangeEvent,\n useMemo,\n useEffect,\n} from 'react';\nimport { isValidDate, buildDateFromInput } from './dateValidation';\nimport { getDays, getMonths, getYears } from './dateMap';\nimport { IDate, ISelectDatePicker } from './interfaces';\nimport { spreadDateToObject } from './helpers';\nimport { flex, flexColumn } from './styles';\n\nconst SelectDatepicker: React.FC<ISelectDatePicker> = (props) => {\n const [isDirty, setIsDirty] = useState<boolean>(true);\n const [hasError, setHasError] = useState<boolean>(false);\n const [error, setError] = useState<string>();\n const [date, setDate] = useState<IDate>(spreadDateToObject(props.value));\n\n const orderArray = useMemo(() => props.format!.split('/'), [props.format]);\n\n /**\n * Call onDateChange prop with the provided date object\n */\n const onDateChange = useCallback(\n (newDate) => {\n props.onDateChange(newDate);\n },\n [props],\n );\n\n /**\n * Build a Date object and call the onDateChange function\n */\n const validDateChange = useCallback(() => {\n const newDate = buildDateFromInput(date.day, date.month, date.year);\n onDateChange(newDate);\n }, [date.day, date.month, date.year, onDateChange]);\n\n /**\n * Sets the error state and calls the onDateChange function with a null value\n */\n const renderError = useCallback(\n (err, hasErr) => {\n setError(err);\n setHasError(hasErr);\n onDateChange(null);\n },\n [onDateChange],\n );\n\n /**\n * Validates if a the inputs form a valid date\n * Returns null if values are not set\n * Returns null and errors if date is not valid\n * Returns a valid date object when everything passes\n */\n const validate = useCallback(() => {\n const { day, month, year } = date;\n\n // Must contain values\n if (!day || !month || !year) {\n onDateChange(null);\n return;\n }\n\n // Validate date input\n const errorString = isValidDate(day, month, year, props);\n if (errorString !== '') {\n renderError(errorString, true);\n return;\n }\n\n validDateChange();\n }, [date, onDateChange, props, renderError, validDateChange]);\n\n /**\n * Sets the date state when an input value changes\n */\n const onInputChange = useCallback(\n (e: ChangeEvent<HTMLSelectElement>) => {\n setDate({ ...date, [e.target.name]: e.target.value });\n setIsDirty(true);\n },\n [date],\n );\n\n /**\n * Create an input field with a form label\n */\n const inputField = useCallback(\n (id, label, value, options) => {\n const className = `rsd_${id}-container`;\n\n return (\n <div className={`${className}`} style={flexColumn}>\n {props.showLabels ? <label htmlFor={id}>{label}</label> : null}\n <select\n className={`${hasError ? 'has-error' : ''}`}\n id={id}\n name={id}\n value={value}\n onChange={onInputChange}>\n {options.map((option: string, i: number) => {\n return (\n <React.Fragment key={`${option}-${i}`}>{option}</React.Fragment>\n );\n })}\n </select>\n </div>\n );\n },\n [hasError, onInputChange, props.showLabels],\n );\n\n /**\n * Creates an object with all input field elements\n */\n const dateField = useMemo(() => {\n const { showPlaceholders, monthNames, maxDate, minDate, labels } = props;\n\n const dayLabel = (labels && labels.day) || 'Day';\n const monthLabel = (labels && labels.month) || 'Month';\n const yearLabel = (labels && labels.year) || 'Year';\n\n const fields = {\n day: inputField(\n 'day',\n dayLabel,\n date.day,\n getDays(showPlaceholders!, dayLabel),\n ),\n month: inputField(\n 'month',\n monthLabel,\n date.month,\n getMonths(showPlaceholders!, monthLabel, monthNames),\n ),\n year: inputField(\n 'year',\n yearLabel,\n date.year,\n getYears(maxDate, minDate, showPlaceholders!, date.year, yearLabel),\n ),\n };\n\n return fields;\n }, [date.day, date.month, date.year, inputField, props]);\n\n /**\n * When ever the date state changes then clear errors and validate the date\n */\n useEffect(() => {\n if (isDirty) {\n setError('');\n setHasError(false);\n validate();\n setIsDirty(false);\n }\n }, [isDirty]);\n\n useEffect(() => {\n const { value } = props;\n const { day, month, year } = date;\n\n if (value !== null && value !== buildDateFromInput(day, month, year)) {\n setDate(spreadDateToObject(value));\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props]);\n\n return (\n <div className={`rsd ${props.className}`}>\n <div className=\"rsd_date-container\" style={flex}>\n {orderArray.map((key, i) => {\n return (\n <React.Fragment key={`${key}-${i}`}>\n {dateField[key]}\n </React.Fragment>\n );\n })}\n </div>\n {props.showErrors && hasError && (\n <div className=\"error-message\">{error}</div>\n )}\n </div>\n );\n};\n\nexport default SelectDatepicker;\n\nSelectDatepicker.defaultProps = {\n value: null,\n showLabels: true,\n showPlaceholders: true,\n showErrors: true,\n format: 'month/day/year',\n className: '',\n};\n"],"names":["buildDateFromInput","day","month","year","date","Date","Number","isValidDateObject","isDate","Object","prototype","toString","call","dayMatch","getDate","monthMatch","getMonth","yearMatch","getFullYear","isValidDate","props","userDate","invalidMessage","maxDate","maxDatePlusOne","setDate","maxDateMessage","toDateString","substring","minDate","minDateMinusOne","minDateMessage","MONTHMAP","getDays","showPlaceholder","dayLabel","days","push","React","value","disabled","i","getMonths","monthLabel","monthNames","months","getYears","max","min","yearLabel","years","maxYear","minYear","undefined","spreadDateToObject","dateValue","flex","display","flexColumn","flexDirection","SelectDatepicker","useState","isDirty","setIsDirty","hasError","setHasError","error","setError","orderArray","useMemo","format","split","onDateChange","useCallback","newDate","validDateChange","renderError","err","hasErr","validate","errorString","onInputChange","e","target","name","inputField","id","label","options","className","style","showLabels","htmlFor","onChange","map","option","Fragment","key","dateField","showPlaceholders","labels","fields","useEffect","showErrors","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;AAMA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAqB,CAACC,GAAD,EAAcC,KAAd,EAA6BC,IAA7B;AACzB,MAAMC,IAAI,GAAG,IAAIC,IAAJ,CAASC,MAAM,CAACH,IAAD,CAAf,EAAuBG,MAAM,CAACJ,KAAD,CAAN,GAAgB,CAAvC,EAA0CI,MAAM,CAACL,GAAD,CAAhD,CAAb;AACA,SAAOG,IAAP;AACD,CAHD;;AAYA,IAAMG,iBAAiB,GAAG,SAApBA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IAJkB;AAK9BjC,EAAAA,MAAM,EAAE,gBALsB;AAM9BmB,EAAAA,SAAS,EAAE;AANmB,CAAhC;;;;"}
@@ -1,26 +0,0 @@
1
- export interface ISelectDatePicker {
2
- value: Date | null;
3
- minDate?: Date;
4
- maxDate?: Date;
5
- maxDateMessage?: string;
6
- minDateMessage?: string;
7
- invalidMessage?: string;
8
- showLabels?: boolean;
9
- showPlaceholders?: boolean;
10
- showErrors?: boolean;
11
- onDateChange: (date: Date) => void;
12
- className?: string;
13
- format?: 'day/month/year' | 'day/year/month' | 'month/day/year' | 'month/year/day' | 'year/month/day' | 'year/day/month';
14
- labels?: ILabels;
15
- monthNames?: Array<string>;
16
- }
17
- export interface IDate {
18
- day: string;
19
- month: string;
20
- year: string;
21
- }
22
- export interface ILabels {
23
- year: string;
24
- month: string;
25
- day: string;
26
- }
package/dist/og.d.ts DELETED
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { ILabels } from './interfaces';
3
- interface IProps {
4
- value: Date | null;
5
- minDate?: Date;
6
- maxDate?: Date;
7
- maxDateMessage?: string;
8
- minDateMessage?: string;
9
- invalidMessage?: string;
10
- showLabels?: boolean;
11
- showErrors?: boolean;
12
- onDateChange: (date: Date) => void;
13
- className?: string;
14
- format?: 'day/month/year' | 'day/year/month' | 'month/day/year' | 'month/year/day' | 'year/month/day' | 'year/day/month';
15
- labels?: ILabels;
16
- monthNames?: Array<string>;
17
- }
18
- declare const SelectDatepicker: React.FC<IProps>;
19
- export default SelectDatepicker;
@@ -1 +0,0 @@
1
- export {};
package/dist/styles.d.ts DELETED
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const flex: React.CSSProperties;
3
- export declare const flexColumn: React.CSSProperties;
@@ -1 +0,0 @@
1
- export {};