@uncinc/uncinc-react-kitchen-sink 2.11.7 → 2.11.9

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,9 +1,11 @@
1
- var _excluded = ["title", "required", "description", "placeholder", "fieldName", "validation", "className", "wrapperClassName", "disabled", "minDate", "maxDate", "onChange", "includeFieldSet"];
1
+ var _excluded = ["title", "required", "description", "placeholder", "fieldName", "validation", "className", "wrapperClassName", "disabled", "minDate", "maxDate", "onChange", "includeFieldSet", "calendarStartDay", "locale"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
5
  import React from 'react';
6
- import ReactDatePicker from 'react-datepicker';
6
+ import ReactDatePicker, { registerLocale, setDefaultLocale } from 'react-datepicker';
7
+ import enUS from 'date-fns/locale/en-US';
8
+ import nl from 'date-fns/locale/nl';
7
9
  import { Field } from 'formik';
8
10
  import c from 'classnames';
9
11
  import { useTranslation } from 'react-i18next';
@@ -26,6 +28,10 @@ var DatePicker = function DatePicker(props) {
26
28
  maxDate = props.maxDate,
27
29
  _onChange = props.onChange,
28
30
  includeFieldSet = props.includeFieldSet,
31
+ _props$calendarStartD = props.calendarStartDay,
32
+ calendarStartDay = _props$calendarStartD === void 0 ? 1 : _props$calendarStartD,
33
+ _props$locale = props.locale,
34
+ locale = _props$locale === void 0 ? 'nl' : _props$locale,
29
35
  restProps = _objectWithoutProperties(props, _excluded);
30
36
  var _useExtendedFormikCon = useExtendedFormikContext(),
31
37
  values = _useExtendedFormikCon.values,
@@ -60,6 +66,13 @@ var DatePicker = function DatePicker(props) {
60
66
  });
61
67
  }
62
68
  };
69
+ registerLocale('en', enUS);
70
+ registerLocale('nl', nl);
71
+
72
+ // Changing locales breaks the test suite in horrible ways
73
+ if (process.env.NODE_ENV !== 'test') {
74
+ setDefaultLocale(locale);
75
+ }
63
76
  return /*#__PURE__*/React.createElement(GenericFormElement, {
64
77
  className: c('DatePicker', wrapperClassName),
65
78
  title: title,
@@ -96,7 +109,8 @@ var DatePicker = function DatePicker(props) {
96
109
  className: className,
97
110
  disabled: disabled,
98
111
  required: required,
99
- placeholderText: placeholder
112
+ placeholderText: placeholder,
113
+ calendarStartDay: calendarStartDay
100
114
  }, restProps));
101
115
  }));
102
116
  };
@@ -46,12 +46,7 @@ var SelectInput = function SelectInput(props) {
46
46
  setFieldValue = _useExtendedFormikCon.setFieldValue;
47
47
  var _useTranslation = useTranslation(),
48
48
  t = _useTranslation.t;
49
-
50
- // Because Object.keys doesn't respect integers:
51
- // When using integers as keys for your select options (for example, when using Taxonomy IDs)
52
- // below logic would fail to find your initialValue, and your Select would not be pre-filled.
53
- var value = values[fieldName] && values[fieldName].toString();
54
- var defaultValueString = defaultValue && defaultValue.toString();
49
+ var value = values[fieldName];
55
50
 
56
51
  // Check if options is [{value, label}] or {value: label}.
57
52
  var optionsTransformed = options;
@@ -68,12 +63,12 @@ var SelectInput = function SelectInput(props) {
68
63
  // If the selected option is not set, find the currently selected option by value.
69
64
  if (!selectedOption) {
70
65
  if (multiple) {
71
- var _value = value !== undefined ? value : defaultValueString || [];
66
+ var _value = value !== undefined ? value : defaultValue || [];
72
67
  selectedOption = optionsTransformed.filter(function (option) {
73
68
  return _value.includes(option.value);
74
69
  });
75
70
  } else {
76
- var _value2 = value !== undefined ? value : defaultValueString || '';
71
+ var _value2 = value !== undefined ? value : defaultValue || '';
77
72
  selectedOption = optionsTransformed.filter(function (option) {
78
73
  return option.value === _value2;
79
74
  });
@@ -99,7 +94,7 @@ var SelectInput = function SelectInput(props) {
99
94
  className: c('Select__select', className),
100
95
  classNamePrefix: c('Select__inner', wrapperClassName),
101
96
  value: selectedOption,
102
- defaultValue: defaultValueString,
97
+ defaultValue: defaultValue,
103
98
  disabled: disabled,
104
99
  onChange: function onChange(e) {
105
100
  var value = '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uncinc/uncinc-react-kitchen-sink",
3
- "version": "2.11.7",
3
+ "version": "2.11.9",
4
4
  "description": "Default React components that are easily extended.",
5
5
  "author": "uncinc",
6
6
  "license": "MIT",
@@ -72,7 +72,7 @@
72
72
  "react": "^16 || ^17 || ^18",
73
73
  "react-animate-height": "^2.0.23",
74
74
  "react-autosuggest": "^10.0.2",
75
- "react-datepicker": "^3.0.0",
75
+ "react-datepicker": "^7.0.0",
76
76
  "react-dom": "^16 || ^17 || ^18",
77
77
  "react-global-configuration": "^1.4.0",
78
78
  "react-hook-videojs": "^3.0.2",