baseui 10.3.0 → 10.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app-nav-bar/user-menu.js +1 -0
- package/app-nav-bar/user-menu.js.flow +1 -0
- package/button/styled-components.js +1 -1
- package/button/styled-components.js.flow +4 -1
- package/card/styled-components.js +0 -1
- package/card/styled-components.js.flow +0 -1
- package/combobox/combobox.js +5 -1
- package/combobox/combobox.js.flow +4 -0
- package/combobox/index.d.ts +6 -3
- package/data-table/column-datetime.js +2 -0
- package/data-table/column-datetime.js.flow +2 -0
- package/data-table/data-table.js +13 -3
- package/data-table/data-table.js.flow +20 -4
- package/data-table/types.js.flow +2 -1
- package/datepicker/calendar-header.js +255 -109
- package/datepicker/calendar-header.js.flow +282 -145
- package/datepicker/calendar.js +6 -1
- package/datepicker/calendar.js.flow +5 -1
- package/datepicker/constants.js +9 -2
- package/datepicker/constants.js.flow +7 -0
- package/datepicker/datepicker.js +135 -73
- package/datepicker/datepicker.js.flow +161 -62
- package/datepicker/day.js +2 -0
- package/datepicker/day.js.flow +2 -0
- package/datepicker/index.d.ts +8 -0
- package/datepicker/month.js +4 -0
- package/datepicker/month.js.flow +3 -0
- package/datepicker/styled-components.js +116 -56
- package/datepicker/styled-components.js.flow +101 -36
- package/datepicker/types.js.flow +18 -1
- package/datepicker/utils/calendar-header-helpers.js +51 -0
- package/datepicker/utils/calendar-header-helpers.js.flow +53 -0
- package/datepicker/utils/date-helpers.js +1 -1
- package/datepicker/utils/date-helpers.js.flow +1 -1
- package/datepicker/week.js +1 -0
- package/datepicker/week.js.flow +1 -0
- package/dnd-list/index.js.flow +2 -1
- package/dnd-list/list.js +1 -2
- package/dnd-list/list.js.flow +1 -1
- package/dnd-list/styled-components.js +1 -1
- package/dnd-list/styled-components.js.flow +1 -0
- package/drawer/close-icon.js +3 -2
- package/drawer/close-icon.js.flow +2 -2
- package/drawer/drawer.js +5 -2
- package/drawer/drawer.js.flow +2 -2
- package/es/app-nav-bar/user-menu.js +1 -0
- package/es/button/styled-components.js +1 -1
- package/es/card/styled-components.js +0 -1
- package/es/combobox/combobox.js +5 -1
- package/es/data-table/column-datetime.js +2 -0
- package/es/data-table/data-table.js +13 -3
- package/es/datepicker/calendar-header.js +204 -93
- package/es/datepicker/calendar.js +7 -2
- package/es/datepicker/constants.js +6 -1
- package/es/datepicker/datepicker.js +70 -42
- package/es/datepicker/day.js +2 -0
- package/es/datepicker/month.js +3 -0
- package/es/datepicker/styled-components.js +98 -37
- package/es/datepicker/types.js +1 -1
- package/es/datepicker/utils/calendar-header-helpers.js +34 -0
- package/es/datepicker/utils/date-helpers.js +1 -1
- package/es/datepicker/week.js +1 -0
- package/es/dnd-list/index.js +2 -1
- package/es/dnd-list/list.js +1 -2
- package/es/dnd-list/styled-components.js +1 -0
- package/es/drawer/close-icon.js +3 -2
- package/es/drawer/drawer.js +5 -2
- package/es/helper/helper.js +1 -0
- package/es/layer/layer.js +8 -0
- package/es/list/list-heading.js +17 -6
- package/es/map-marker/constants.js +69 -0
- package/es/map-marker/fixed-marker.js +98 -0
- package/es/map-marker/floating-marker.js +65 -0
- package/es/map-marker/index.js +9 -0
- package/es/map-marker/pin-head.js +108 -0
- package/es/map-marker/styled-components.js +156 -0
- package/es/map-marker/types.js +8 -0
- package/es/menu/maybe-child-menu.js +1 -0
- package/es/popover/popover.js +6 -5
- package/es/popover/stateful-container.js +8 -2
- package/es/rating/emoticon-rating.js +3 -1
- package/es/rating/star-rating.js +3 -1
- package/es/select/select-component.js +20 -5
- package/es/select/styled-components.js +34 -4
- package/es/snackbar/snackbar-context.js +16 -4
- package/es/spinner/styled-components.js +1 -1
- package/es/table-semantic/styled-components.js +6 -4
- package/es/table-semantic/table-builder.js +3 -0
- package/es/themes/dark-theme/color-component-tokens.js +1 -1
- package/es/themes/light-theme/color-component-tokens.js +9 -9
- package/es/themes/shared/lighting.js +5 -1
- package/es/timepicker/timepicker.js +16 -11
- package/es/tooltip/styled-components.js +8 -0
- package/es/tooltip/tooltip.js +1 -0
- package/esm/app-nav-bar/user-menu.js +1 -0
- package/esm/button/styled-components.js +1 -1
- package/esm/card/styled-components.js +0 -1
- package/esm/combobox/combobox.js +5 -1
- package/esm/data-table/column-datetime.js +2 -0
- package/esm/data-table/data-table.js +13 -3
- package/esm/datepicker/calendar-header.js +255 -110
- package/esm/datepicker/calendar.js +7 -2
- package/esm/datepicker/constants.js +6 -1
- package/esm/datepicker/datepicker.js +136 -74
- package/esm/datepicker/day.js +2 -0
- package/esm/datepicker/month.js +3 -0
- package/esm/datepicker/styled-components.js +112 -55
- package/esm/datepicker/types.js +1 -1
- package/esm/datepicker/utils/calendar-header-helpers.js +45 -0
- package/esm/datepicker/utils/date-helpers.js +1 -1
- package/esm/datepicker/week.js +1 -0
- package/esm/dnd-list/index.js +2 -1
- package/esm/dnd-list/list.js +1 -2
- package/esm/dnd-list/styled-components.js +1 -1
- package/esm/drawer/close-icon.js +3 -2
- package/esm/drawer/drawer.js +5 -2
- package/esm/helper/helper.js +1 -0
- package/esm/layer/layer.js +8 -0
- package/esm/list/list-heading.js +17 -6
- package/esm/map-marker/constants.js +62 -0
- package/esm/map-marker/fixed-marker.js +137 -0
- package/esm/map-marker/floating-marker.js +94 -0
- package/esm/map-marker/index.js +9 -0
- package/esm/map-marker/pin-head.js +144 -0
- package/esm/map-marker/styled-components.js +168 -0
- package/esm/map-marker/types.js +8 -0
- package/esm/menu/maybe-child-menu.js +1 -0
- package/esm/popover/popover.js +6 -5
- package/esm/popover/stateful-container.js +8 -2
- package/esm/rating/emoticon-rating.js +2 -2
- package/esm/rating/star-rating.js +2 -2
- package/esm/select/select-component.js +19 -5
- package/esm/select/styled-components.js +28 -4
- package/esm/snackbar/snackbar-context.js +16 -4
- package/esm/spinner/styled-components.js +1 -1
- package/esm/table-semantic/styled-components.js +6 -4
- package/esm/table-semantic/table-builder.js +3 -0
- package/esm/themes/dark-theme/color-component-tokens.js +1 -1
- package/esm/themes/light-theme/color-component-tokens.js +9 -9
- package/esm/themes/shared/lighting.js +5 -1
- package/esm/timepicker/timepicker.js +17 -11
- package/esm/tooltip/styled-components.js +8 -0
- package/esm/tooltip/tooltip.js +1 -0
- package/helper/helper.js +1 -0
- package/helper/helper.js.flow +1 -0
- package/layer/layer.js +8 -0
- package/layer/layer.js.flow +9 -0
- package/link/index.d.ts +1 -0
- package/list/index.d.ts +36 -0
- package/list/list-heading.js +24 -7
- package/list/list-heading.js.flow +17 -8
- package/map-marker/constants.js +82 -0
- package/map-marker/constants.js.flow +74 -0
- package/map-marker/fixed-marker.js +152 -0
- package/map-marker/fixed-marker.js.flow +137 -0
- package/map-marker/floating-marker.js +109 -0
- package/map-marker/floating-marker.js.flow +102 -0
- package/map-marker/index.d.ts +105 -0
- package/map-marker/index.js +55 -0
- package/map-marker/index.js.flow +23 -0
- package/map-marker/package.json +4 -0
- package/map-marker/pin-head.js +159 -0
- package/map-marker/pin-head.js.flow +155 -0
- package/map-marker/styled-components.js +184 -0
- package/map-marker/styled-components.js.flow +177 -0
- package/map-marker/types.js +11 -0
- package/map-marker/types.js.flow +114 -0
- package/menu/index.d.ts +7 -0
- package/menu/maybe-child-menu.js +1 -0
- package/menu/maybe-child-menu.js.flow +1 -0
- package/menu/types.js.flow +12 -0
- package/modal/index.d.ts +1 -1
- package/modal/types.js.flow +4 -1
- package/package.json +5 -3
- package/popover/index.d.ts +2 -1
- package/popover/popover.js +6 -5
- package/popover/popover.js.flow +11 -4
- package/popover/stateful-container.js +8 -2
- package/popover/stateful-container.js.flow +5 -0
- package/popover/types.js.flow +6 -1
- package/rating/emoticon-rating.js +2 -2
- package/rating/emoticon-rating.js.flow +4 -1
- package/rating/star-rating.js +2 -2
- package/rating/star-rating.js.flow +4 -1
- package/select/select-component.js +19 -5
- package/select/select-component.js.flow +19 -5
- package/select/styled-components.js +28 -4
- package/select/styled-components.js.flow +30 -2
- package/select/types.js.flow +9 -0
- package/snackbar/index.d.ts +21 -16
- package/snackbar/snackbar-context.js +15 -4
- package/snackbar/snackbar-context.js.flow +15 -3
- package/spinner/styled-components.js +1 -1
- package/spinner/styled-components.js.flow +1 -1
- package/table-semantic/styled-components.js +6 -4
- package/table-semantic/styled-components.js.flow +6 -4
- package/table-semantic/table-builder.js +3 -0
- package/table-semantic/table-builder.js.flow +3 -0
- package/themes/dark-theme/color-component-tokens.js +1 -1
- package/themes/dark-theme/color-component-tokens.js.flow +1 -1
- package/themes/light-theme/color-component-tokens.js +9 -9
- package/themes/light-theme/color-component-tokens.js.flow +9 -9
- package/themes/shared/lighting.js +5 -1
- package/themes/shared/lighting.js.flow +4 -0
- package/themes/types.js.flow +4 -0
- package/timepicker/index.d.ts +1 -0
- package/timepicker/timepicker.js +17 -11
- package/timepicker/timepicker.js.flow +31 -12
- package/timepicker/types.js.flow +10 -0
- package/tooltip/styled-components.js +8 -0
- package/tooltip/styled-components.js.flow +8 -0
- package/tooltip/tooltip.js +1 -0
- package/tooltip/tooltip.js.flow +6 -1
|
@@ -14,18 +14,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
14
14
|
|
|
15
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
16
16
|
|
|
17
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
-
|
|
19
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
|
-
|
|
21
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
22
|
-
|
|
23
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
24
|
-
|
|
25
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
26
|
-
|
|
27
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
|
-
|
|
29
17
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
30
18
|
|
|
31
19
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -48,6 +36,18 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
48
36
|
|
|
49
37
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
50
38
|
|
|
39
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
40
|
+
|
|
41
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
42
|
+
|
|
43
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
44
|
+
|
|
45
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
46
|
+
|
|
47
|
+
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
48
|
+
|
|
49
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
50
|
+
|
|
51
51
|
/*
|
|
52
52
|
Copyright (c) Uber Technologies, Inc.
|
|
53
53
|
|
|
@@ -61,10 +61,34 @@ import Calendar from './calendar.js';
|
|
|
61
61
|
import { getOverrides } from '../helpers/overrides.js';
|
|
62
62
|
import getInterpolatedString from '../helpers/i18n-interpolation.js';
|
|
63
63
|
import { LocaleContext } from '../locale/index.js';
|
|
64
|
-
import { StyledInputWrapper } from './styled-components.js';
|
|
64
|
+
import { StyledInputWrapper, StyledInputLabel, StyledStartDate, StyledEndDate } from './styled-components.js';
|
|
65
65
|
import DateHelpers from './utils/date-helpers.js';
|
|
66
66
|
import dateFnsAdapter from './utils/date-fns-adapter.js';
|
|
67
67
|
export var DEFAULT_DATE_FORMAT = 'yyyy/MM/dd';
|
|
68
|
+
var INPUT_DELIMITER = ' – ';
|
|
69
|
+
|
|
70
|
+
var combineSeparatedInputs = function combineSeparatedInputs(newInputValue) {
|
|
71
|
+
var prevCombinedInputValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
72
|
+
var separatedInput = arguments.length > 2 ? arguments[2] : undefined;
|
|
73
|
+
var inputValue = newInputValue;
|
|
74
|
+
|
|
75
|
+
var _prevCombinedInputVal = prevCombinedInputValue.split(INPUT_DELIMITER),
|
|
76
|
+
_prevCombinedInputVal2 = _slicedToArray(_prevCombinedInputVal, 2),
|
|
77
|
+
_prevCombinedInputVal3 = _prevCombinedInputVal2[0],
|
|
78
|
+
prevStartDate = _prevCombinedInputVal3 === void 0 ? '' : _prevCombinedInputVal3,
|
|
79
|
+
_prevCombinedInputVal4 = _prevCombinedInputVal2[1],
|
|
80
|
+
prevEndDate = _prevCombinedInputVal4 === void 0 ? '' : _prevCombinedInputVal4;
|
|
81
|
+
|
|
82
|
+
if (separatedInput === 'startDate' && prevEndDate) {
|
|
83
|
+
inputValue = "".concat(inputValue, " \u2013 ").concat(prevEndDate);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (separatedInput === 'endDate') {
|
|
87
|
+
inputValue = "".concat(prevStartDate, " \u2013 ").concat(inputValue);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return inputValue;
|
|
91
|
+
};
|
|
68
92
|
|
|
69
93
|
var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
70
94
|
_inherits(Datepicker, _React$Component);
|
|
@@ -197,7 +221,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
197
221
|
isOpen: true,
|
|
198
222
|
isPseudoFocused: true,
|
|
199
223
|
calendarFocused: false
|
|
200
|
-
});
|
|
224
|
+
}, _this.props.onOpen);
|
|
201
225
|
});
|
|
202
226
|
|
|
203
227
|
_defineProperty(_assertThisInitialized(_this), "close", function () {
|
|
@@ -228,9 +252,10 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
228
252
|
var _this$props2 = _this.props,
|
|
229
253
|
formatString = _this$props2.formatString,
|
|
230
254
|
mask = _this$props2.mask,
|
|
231
|
-
range = _this$props2.range
|
|
255
|
+
range = _this$props2.range,
|
|
256
|
+
separateRangeInputs = _this$props2.separateRangeInputs;
|
|
232
257
|
|
|
233
|
-
if (mask === null) {
|
|
258
|
+
if (mask === null || mask === undefined && formatString !== DEFAULT_DATE_FORMAT) {
|
|
234
259
|
return null;
|
|
235
260
|
}
|
|
236
261
|
|
|
@@ -238,28 +263,20 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
238
263
|
return _this.normalizeDashes(mask);
|
|
239
264
|
}
|
|
240
265
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (formatString) {
|
|
244
|
-
if (range) {
|
|
245
|
-
return "".concat(normalizedFormatString, " \u2013 ").concat(normalizedFormatString).replace(/[a-z]/gi, '9');
|
|
246
|
-
} else {
|
|
247
|
-
return normalizedFormatString.replace(/[a-z]/gi, '9');
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (range) {
|
|
266
|
+
if (range && !separateRangeInputs) {
|
|
252
267
|
return '9999/99/99 – 9999/99/99';
|
|
253
268
|
}
|
|
254
269
|
|
|
255
270
|
return '9999/99/99';
|
|
256
271
|
});
|
|
257
272
|
|
|
258
|
-
_defineProperty(_assertThisInitialized(_this), "handleInputChange", function (event) {
|
|
259
|
-
var inputValue = event.currentTarget.value;
|
|
273
|
+
_defineProperty(_assertThisInitialized(_this), "handleInputChange", function (event, separatedInput) {
|
|
274
|
+
var inputValue = _this.props.range && _this.props.separateRangeInputs ? combineSeparatedInputs(event.currentTarget.value, _this.state.inputValue, separatedInput) : event.currentTarget.value;
|
|
260
275
|
|
|
261
276
|
var mask = _this.getMask();
|
|
262
277
|
|
|
278
|
+
var formatString = _this.normalizeDashes(_this.props.formatString);
|
|
279
|
+
|
|
263
280
|
if (typeof mask === 'string' && inputValue === mask.replace(/9/g, ' ') || inputValue.length === 0) {
|
|
264
281
|
if (_this.props.onChange) {
|
|
265
282
|
if (_this.props.range) {
|
|
@@ -278,8 +295,6 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
278
295
|
inputValue: inputValue
|
|
279
296
|
});
|
|
280
297
|
|
|
281
|
-
var formatString = _this.normalizeDashes(_this.props.formatString);
|
|
282
|
-
|
|
283
298
|
var parseDateString = function parseDateString(dateString) {
|
|
284
299
|
if (formatString === DEFAULT_DATE_FORMAT) {
|
|
285
300
|
return _this.dateHelpers.parse(dateString, 'slashDate', _this.props.locale);
|
|
@@ -289,7 +304,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
289
304
|
};
|
|
290
305
|
|
|
291
306
|
if (_this.props.range && typeof _this.props.displayValueAtRangeIndex !== 'number') {
|
|
292
|
-
var _this$normalizeDashes = _this.normalizeDashes(inputValue).split(
|
|
307
|
+
var _this$normalizeDashes = _this.normalizeDashes(inputValue).split(INPUT_DELIMITER),
|
|
293
308
|
_this$normalizeDashes2 = _slicedToArray(_this$normalizeDashes, 2),
|
|
294
309
|
left = _this$normalizeDashes2[0],
|
|
295
310
|
right = _this$normalizeDashes2[1];
|
|
@@ -455,7 +470,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
455
470
|
} else if (Array.isArray(date)) {
|
|
456
471
|
return date.map(function (day) {
|
|
457
472
|
return format(day);
|
|
458
|
-
}).join(
|
|
473
|
+
}).join(INPUT_DELIMITER);
|
|
459
474
|
} else {
|
|
460
475
|
return format(date);
|
|
461
476
|
}
|
|
@@ -470,8 +485,8 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
470
485
|
}
|
|
471
486
|
}
|
|
472
487
|
}, {
|
|
473
|
-
key: "
|
|
474
|
-
value: function
|
|
488
|
+
key: "renderInputComponent",
|
|
489
|
+
value: function renderInputComponent(locale, separatedInput) {
|
|
475
490
|
var _this3 = this;
|
|
476
491
|
|
|
477
492
|
var _this$props$overrides = this.props.overrides,
|
|
@@ -482,6 +497,55 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
482
497
|
InputComponent = _getOverrides2[0],
|
|
483
498
|
inputProps = _getOverrides2[1];
|
|
484
499
|
|
|
500
|
+
var placeholder = this.props.placeholder || this.props.placeholder === '' ? this.props.placeholder : this.props.range && !this.props.separateRangeInputs ? 'YYYY/MM/DD – YYYY/MM/DD' : 'YYYY/MM/DD';
|
|
501
|
+
|
|
502
|
+
var _split = (this.state.inputValue || '').split(INPUT_DELIMITER),
|
|
503
|
+
_split2 = _slicedToArray(_split, 2),
|
|
504
|
+
_split2$ = _split2[0],
|
|
505
|
+
startDate = _split2$ === void 0 ? '' : _split2$,
|
|
506
|
+
_split2$2 = _split2[1],
|
|
507
|
+
endDate = _split2$2 === void 0 ? '' : _split2$2;
|
|
508
|
+
|
|
509
|
+
var value = separatedInput === 'startDate' ? startDate : separatedInput === 'endDate' ? endDate : this.state.inputValue;
|
|
510
|
+
|
|
511
|
+
var onChange = function onChange(event) {
|
|
512
|
+
return _this3.handleInputChange(event, separatedInput);
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
return /*#__PURE__*/React.createElement(InputComponent, _extends({
|
|
516
|
+
"aria-disabled": this.props.disabled,
|
|
517
|
+
"aria-label": this.props['aria-label'] || (this.props.range ? locale.datepicker.ariaLabelRange : locale.datepicker.ariaLabel),
|
|
518
|
+
error: this.props.error,
|
|
519
|
+
positive: this.props.positive,
|
|
520
|
+
"aria-describedby": this.props['aria-describedby'],
|
|
521
|
+
"aria-labelledby": this.props['aria-labelledby'],
|
|
522
|
+
"aria-required": this.props.required || null,
|
|
523
|
+
disabled: this.props.disabled,
|
|
524
|
+
size: this.props.size,
|
|
525
|
+
value: value,
|
|
526
|
+
onFocus: this.open,
|
|
527
|
+
onBlur: this.handleInputBlur,
|
|
528
|
+
onKeyDown: this.handleKeyDown,
|
|
529
|
+
onChange: onChange,
|
|
530
|
+
placeholder: placeholder,
|
|
531
|
+
mask: this.getMask(),
|
|
532
|
+
required: this.props.required,
|
|
533
|
+
clearable: this.props.clearable
|
|
534
|
+
}, inputProps));
|
|
535
|
+
}
|
|
536
|
+
}, {
|
|
537
|
+
key: "render",
|
|
538
|
+
value: function render() {
|
|
539
|
+
var _this4 = this;
|
|
540
|
+
|
|
541
|
+
var _this$props4 = this.props,
|
|
542
|
+
_this$props4$override = _this$props4.overrides,
|
|
543
|
+
overrides = _this$props4$override === void 0 ? {} : _this$props4$override,
|
|
544
|
+
_this$props4$startDat = _this$props4.startDateLabel,
|
|
545
|
+
startDateLabel = _this$props4$startDat === void 0 ? 'Start Date' : _this$props4$startDat,
|
|
546
|
+
_this$props4$endDateL = _this$props4.endDateLabel,
|
|
547
|
+
endDateLabel = _this$props4$endDateL === void 0 ? 'End Date' : _this$props4$endDateL;
|
|
548
|
+
|
|
485
549
|
var _getOverrides3 = getOverrides(overrides.Popover, Popover),
|
|
486
550
|
_getOverrides4 = _slicedToArray(_getOverrides3, 2),
|
|
487
551
|
PopoverComponent = _getOverrides4[0],
|
|
@@ -492,44 +556,42 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
492
556
|
InputWrapper = _getOverrides6[0],
|
|
493
557
|
inputWrapperProps = _getOverrides6[1];
|
|
494
558
|
|
|
495
|
-
var
|
|
559
|
+
var _getOverrides7 = getOverrides(overrides.StartDate, StyledStartDate),
|
|
560
|
+
_getOverrides8 = _slicedToArray(_getOverrides7, 2),
|
|
561
|
+
StartDate = _getOverrides8[0],
|
|
562
|
+
startDateProps = _getOverrides8[1];
|
|
563
|
+
|
|
564
|
+
var _getOverrides9 = getOverrides(overrides.EndDate, StyledEndDate),
|
|
565
|
+
_getOverrides10 = _slicedToArray(_getOverrides9, 2),
|
|
566
|
+
EndDate = _getOverrides10[0],
|
|
567
|
+
endDateProps = _getOverrides10[1];
|
|
568
|
+
|
|
569
|
+
var _getOverrides11 = getOverrides(overrides.InputLabel, StyledInputLabel),
|
|
570
|
+
_getOverrides12 = _slicedToArray(_getOverrides11, 2),
|
|
571
|
+
InputLabel = _getOverrides12[0],
|
|
572
|
+
inputLabelProps = _getOverrides12[1];
|
|
573
|
+
|
|
496
574
|
return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, function (locale) {
|
|
497
575
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PopoverComponent, _extends({
|
|
498
576
|
focusLock: false,
|
|
499
|
-
|
|
577
|
+
autoFocus: false,
|
|
578
|
+
mountNode: _this4.props.mountNode,
|
|
500
579
|
placement: PLACEMENT.bottom,
|
|
501
|
-
isOpen:
|
|
502
|
-
onClickOutside:
|
|
503
|
-
onEsc:
|
|
580
|
+
isOpen: _this4.state.isOpen,
|
|
581
|
+
onClickOutside: _this4.close,
|
|
582
|
+
onEsc: _this4.handleEsc,
|
|
504
583
|
content: /*#__PURE__*/React.createElement(Calendar, _extends({
|
|
505
|
-
adapter:
|
|
506
|
-
autoFocusCalendar:
|
|
584
|
+
adapter: _this4.props.adapter,
|
|
585
|
+
autoFocusCalendar: _this4.state.calendarFocused,
|
|
507
586
|
trapTabbing: true,
|
|
508
|
-
value:
|
|
509
|
-
},
|
|
510
|
-
onChange:
|
|
587
|
+
value: _this4.props.value
|
|
588
|
+
}, _this4.props, {
|
|
589
|
+
onChange: _this4.onChange
|
|
511
590
|
}))
|
|
512
|
-
}, popoverProps), /*#__PURE__*/React.createElement(InputWrapper,
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
positive: _this3.props.positive,
|
|
517
|
-
"aria-describedby": _this3.props['aria-describedby'],
|
|
518
|
-
"aria-labelledby": _this3.props['aria-labelledby'],
|
|
519
|
-
"aria-required": _this3.props.required || null,
|
|
520
|
-
disabled: _this3.props.disabled,
|
|
521
|
-
size: _this3.props.size,
|
|
522
|
-
value: _this3.state.inputValue,
|
|
523
|
-
onFocus: _this3.open,
|
|
524
|
-
onBlur: _this3.handleInputBlur,
|
|
525
|
-
onKeyDown: _this3.handleKeyDown,
|
|
526
|
-
onChange: _this3.handleInputChange,
|
|
527
|
-
placeholder: placeholder,
|
|
528
|
-
mask: _this3.getMask(),
|
|
529
|
-
required: _this3.props.required,
|
|
530
|
-
clearable: _this3.props.clearable
|
|
531
|
-
}, inputProps)))), /*#__PURE__*/React.createElement("p", {
|
|
532
|
-
id: _this3.props['aria-describedby'],
|
|
591
|
+
}, popoverProps), /*#__PURE__*/React.createElement(InputWrapper, _extends({}, inputWrapperProps, {
|
|
592
|
+
$separateRangeInputs: _this4.props.range && _this4.props.separateRangeInputs
|
|
593
|
+
}), _this4.props.range && _this4.props.separateRangeInputs ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StartDate, startDateProps, /*#__PURE__*/React.createElement(InputLabel, inputLabelProps, startDateLabel), _this4.renderInputComponent(locale, 'startDate')), /*#__PURE__*/React.createElement(EndDate, endDateProps, /*#__PURE__*/React.createElement(InputLabel, inputLabelProps, endDateLabel), _this4.renderInputComponent(locale, 'endDate'))) : /*#__PURE__*/React.createElement(React.Fragment, null, _this4.renderInputComponent(locale)))), /*#__PURE__*/React.createElement("p", {
|
|
594
|
+
id: _this4.props['aria-describedby'],
|
|
533
595
|
style: {
|
|
534
596
|
position: 'fixed',
|
|
535
597
|
width: '0px',
|
|
@@ -559,17 +621,17 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
559
621
|
clipPath: 'inset(100%)'
|
|
560
622
|
}
|
|
561
623
|
}, // No date selected
|
|
562
|
-
!
|
|
563
|
-
!Array.isArray(
|
|
564
|
-
date:
|
|
624
|
+
!_this4.props.value || Array.isArray(_this4.props.value) && !_this4.props.value.length ? '' : // Date selected in a non-range picker
|
|
625
|
+
!Array.isArray(_this4.props.value) ? getInterpolatedString(locale.datepicker.selectedDate, {
|
|
626
|
+
date: _this4.state.inputValue || ''
|
|
565
627
|
}) : // Start and end dates are selected in a range picker
|
|
566
|
-
|
|
567
|
-
startDate:
|
|
568
|
-
endDate:
|
|
569
|
-
|
|
628
|
+
_this4.props.value.length > 1 ? getInterpolatedString(locale.datepicker.selectedDateRange, {
|
|
629
|
+
startDate: _this4.formatDisplayValue(_this4.props.value[0]),
|
|
630
|
+
endDate: _this4.formatDisplayValue( // $FlowFixMe
|
|
631
|
+
_this4.props.value[1])
|
|
570
632
|
}) : // A single date selected in a range picker
|
|
571
633
|
"".concat(getInterpolatedString(locale.datepicker.selectedDate, {
|
|
572
|
-
date:
|
|
634
|
+
date: _this4.formatDisplayValue(_this4.props.value[0])
|
|
573
635
|
}), " ").concat(locale.datepicker.selectSecondDatePrompt)));
|
|
574
636
|
});
|
|
575
637
|
}
|
package/esm/datepicker/day.js
CHANGED
|
@@ -332,6 +332,7 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
332
332
|
var $outsideMonthWithinRange = !!(Array.isArray(value) && range && $outsideMonth && !this.props.peekNextMonth && this.isOutsideOfMonthButWithinRange());
|
|
333
333
|
return {
|
|
334
334
|
$date: date,
|
|
335
|
+
$density: this.props.density,
|
|
335
336
|
$disabled: this.props.disabled,
|
|
336
337
|
$endDate: Array.isArray(value) && this.props.range && $selected && this.dateHelpers.isSameDay(date, value[1]) || false,
|
|
337
338
|
$hasDateLabel: !!this.props.dateLabel,
|
|
@@ -344,6 +345,7 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
344
345
|
$isFocusVisible: this.state.isFocusVisible,
|
|
345
346
|
$startOfMonth: this.dateHelpers.isStartOfMonth(date),
|
|
346
347
|
$endOfMonth: this.dateHelpers.isEndOfMonth(date),
|
|
348
|
+
$month: this.getMonthProp(),
|
|
347
349
|
$outsideMonth: $outsideMonth,
|
|
348
350
|
$outsideMonthWithinRange: $outsideMonthWithinRange,
|
|
349
351
|
$peekNextMonth: this.props.peekNextMonth,
|
package/esm/datepicker/month.js
CHANGED
|
@@ -46,8 +46,10 @@ import { StyledMonth } from './styled-components.js';
|
|
|
46
46
|
import dateFnsAdapter from './utils/date-fns-adapter.js';
|
|
47
47
|
import DateHelpers from './utils/date-helpers.js';
|
|
48
48
|
import { getOverrides } from '../helpers/overrides.js';
|
|
49
|
+
import { DENSITY } from './constants.js';
|
|
49
50
|
var defaultProps = {
|
|
50
51
|
dateLabel: null,
|
|
52
|
+
density: DENSITY.high,
|
|
51
53
|
excludeDates: null,
|
|
52
54
|
filterDate: null,
|
|
53
55
|
highlightDates: null,
|
|
@@ -107,6 +109,7 @@ var CalendarMonth = /*#__PURE__*/function (_React$Component) {
|
|
|
107
109
|
adapter: _this.props.adapter,
|
|
108
110
|
date: currentWeekStart,
|
|
109
111
|
dateLabel: _this.props.dateLabel,
|
|
112
|
+
density: _this.props.density,
|
|
110
113
|
excludeDates: _this.props.excludeDates,
|
|
111
114
|
filterDate: _this.props.filterDate,
|
|
112
115
|
highlightedDate: _this.props.highlightedDate,
|