baseui 10.12.1 → 11.0.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/README.md +3 -3
- package/accordion/accordion.js +60 -13
- package/accordion/accordion.js.flow +49 -12
- package/accordion/index.d.ts +0 -3
- package/accordion/panel.js +7 -6
- package/accordion/panel.js.flow +20 -20
- package/accordion/stateless-accordion.js +2 -4
- package/accordion/stateless-accordion.js.flow +0 -2
- package/accordion/types.js.flow +0 -5
- package/button/constants.js +1 -2
- package/button/constants.js.flow +0 -1
- package/button/index.d.ts +0 -1
- package/button/styled-components.js +2 -29
- package/button/styled-components.js.flow +2 -30
- package/checkbox/checkbox.js +6 -30
- package/checkbox/checkbox.js.flow +7 -38
- package/checkbox/constants.js +2 -1
- package/checkbox/constants.js.flow +2 -1
- package/checkbox/index.d.ts +4 -6
- package/checkbox/index.js +0 -6
- package/checkbox/index.js.flow +0 -1
- package/checkbox/styled-components.js +52 -149
- package/checkbox/styled-components.js.flow +59 -165
- package/checkbox/types.js.flow +0 -5
- package/data-table/column-categorical.js +1 -1
- package/data-table/column-categorical.js.flow +1 -1
- package/data-table/column-datetime.js +1 -1
- package/data-table/column-datetime.js.flow +3 -1
- package/data-table/column.js +6 -2
- package/data-table/column.js.flow +9 -7
- package/data-table/data-table.js +1 -1
- package/data-table/data-table.js.flow +1 -1
- package/data-table/header-cell.js +3 -0
- package/data-table/header-cell.js.flow +1 -1
- package/datepicker/calendar.js +15 -7
- package/datepicker/calendar.js.flow +23 -9
- package/datepicker/constants.js +12 -2
- package/datepicker/constants.js.flow +10 -0
- package/datepicker/datepicker.js +61 -30
- package/datepicker/datepicker.js.flow +77 -37
- package/datepicker/day.js +85 -34
- package/datepicker/day.js.flow +118 -54
- package/datepicker/locale.js.flow +0 -1
- package/datepicker/month.js +3 -1
- package/datepicker/month.js.flow +2 -0
- package/datepicker/stateful-container.js.flow +2 -1
- package/datepicker/styled-components.js +23 -1
- package/datepicker/styled-components.js.flow +12 -2
- package/datepicker/types.js.flow +35 -10
- package/datepicker/utils/date-helpers.js +30 -0
- package/datepicker/utils/date-helpers.js.flow +12 -0
- package/datepicker/week.js +3 -1
- package/datepicker/week.js.flow +2 -0
- package/es/accordion/accordion.js +52 -12
- package/es/accordion/panel.js +7 -5
- package/es/accordion/stateless-accordion.js +2 -4
- package/es/button/constants.js +1 -2
- package/es/button/styled-components.js +2 -29
- package/es/checkbox/checkbox.js +7 -32
- package/es/checkbox/constants.js +2 -1
- package/es/checkbox/index.js +1 -1
- package/es/checkbox/styled-components.js +51 -146
- package/es/data-table/column-categorical.js +1 -1
- package/es/data-table/column-datetime.js +1 -1
- package/es/data-table/column.js +6 -2
- package/es/data-table/data-table.js +1 -1
- package/es/data-table/header-cell.js +3 -0
- package/es/datepicker/calendar.js +15 -7
- package/es/datepicker/constants.js +8 -0
- package/es/datepicker/datepicker.js +56 -29
- package/es/datepicker/day.js +77 -34
- package/es/datepicker/month.js +3 -1
- package/es/datepicker/styled-components.js +8 -2
- package/es/datepicker/types.js +1 -1
- package/es/datepicker/utils/date-helpers.js +16 -0
- package/es/datepicker/week.js +3 -1
- package/es/file-uploader/file-uploader.js +4 -4
- package/es/header-navigation/styled-components.js +3 -3
- package/es/helpers/overrides.js +1 -2
- package/es/input/styled-components.js +4 -4
- package/es/layer/layer.js +4 -4
- package/es/locale/index.js +0 -7
- package/es/menu/stateful-container.js +0 -1
- package/es/menu/styled-components.js +1 -1
- package/es/modal/index.js +1 -1
- package/es/modal/modal.js +19 -65
- package/es/modal/styled-components.js +12 -48
- package/es/phone-input/default-props.js +1 -1
- package/es/phone-input/index.js +0 -4
- package/es/phone-input/phone-input-lite.js +55 -31
- package/es/radio/radio.js +1 -7
- package/es/radio/radiogroup.js +3 -28
- package/es/radio/styled-components.js +4 -5
- package/es/rating/styled-components.js +3 -3
- package/es/select/index.js +1 -2
- package/es/select/select-component.js +4 -8
- package/es/select/styled-components.js +4 -4
- package/es/snackbar/styled-components.js +2 -2
- package/es/spinner/index.js +3 -9
- package/es/spinner/styled-components.js +2 -32
- package/es/table/filter.js +3 -3
- package/es/tag/styled-components.js +1 -1
- package/es/themes/dark-theme/color-component-tokens.js +0 -38
- package/es/themes/dark-theme/color-tokens.js +0 -2
- package/es/themes/dark-theme/create-dark-theme.js +0 -2
- package/es/themes/dark-theme/dark-theme.js +0 -2
- package/es/themes/light-theme/color-component-tokens.js +0 -38
- package/es/themes/light-theme/color-tokens.js +0 -2
- package/es/themes/light-theme/create-light-theme.js +0 -2
- package/es/themes/light-theme/light-theme.js +0 -2
- package/es/timepicker/timepicker.js +1 -8
- package/es/typography/index.js +1 -31
- package/esm/accordion/accordion.js +60 -13
- package/esm/accordion/panel.js +7 -6
- package/esm/accordion/stateless-accordion.js +2 -4
- package/esm/button/constants.js +1 -2
- package/esm/button/styled-components.js +2 -29
- package/esm/checkbox/checkbox.js +7 -30
- package/esm/checkbox/constants.js +2 -1
- package/esm/checkbox/index.js +1 -1
- package/esm/checkbox/styled-components.js +52 -147
- package/esm/data-table/column-categorical.js +1 -1
- package/esm/data-table/column-datetime.js +1 -1
- package/esm/data-table/column.js +6 -2
- package/esm/data-table/data-table.js +1 -1
- package/esm/data-table/header-cell.js +3 -0
- package/esm/datepicker/calendar.js +15 -7
- package/esm/datepicker/constants.js +8 -0
- package/esm/datepicker/datepicker.js +60 -30
- package/esm/datepicker/day.js +84 -34
- package/esm/datepicker/month.js +3 -1
- package/esm/datepicker/styled-components.js +24 -2
- package/esm/datepicker/types.js +1 -1
- package/esm/datepicker/utils/date-helpers.js +30 -0
- package/esm/datepicker/week.js +3 -1
- package/esm/file-uploader/file-uploader.js +4 -4
- package/esm/header-navigation/styled-components.js +3 -3
- package/esm/helpers/overrides.js +1 -2
- package/esm/input/styled-components.js +4 -4
- package/esm/layer/layer.js +4 -4
- package/esm/locale/index.js +0 -7
- package/esm/menu/stateful-container.js +0 -1
- package/esm/menu/styled-components.js +1 -1
- package/esm/modal/index.js +1 -1
- package/esm/modal/modal.js +28 -71
- package/esm/modal/styled-components.js +6 -38
- package/esm/phone-input/default-props.js +1 -1
- package/esm/phone-input/index.js +0 -4
- package/esm/phone-input/phone-input-lite.js +60 -37
- package/esm/radio/radio.js +1 -7
- package/esm/radio/radiogroup.js +3 -28
- package/esm/radio/styled-components.js +4 -5
- package/esm/rating/styled-components.js +3 -3
- package/esm/select/index.js +1 -2
- package/esm/select/select-component.js +4 -8
- package/esm/select/styled-components.js +4 -4
- package/esm/snackbar/styled-components.js +2 -2
- package/esm/spinner/index.js +3 -9
- package/esm/spinner/styled-components.js +2 -40
- package/esm/table/filter.js +3 -3
- package/esm/tag/styled-components.js +1 -1
- package/esm/themes/dark-theme/color-component-tokens.js +0 -38
- package/esm/themes/dark-theme/color-tokens.js +0 -2
- package/esm/themes/dark-theme/create-dark-theme.js +1 -2
- package/esm/themes/dark-theme/dark-theme.js +1 -2
- package/esm/themes/light-theme/color-component-tokens.js +0 -38
- package/esm/themes/light-theme/color-tokens.js +0 -2
- package/esm/themes/light-theme/create-light-theme.js +1 -2
- package/esm/themes/light-theme/light-theme.js +1 -2
- package/esm/timepicker/timepicker.js +1 -8
- package/esm/typography/index.js +1 -35
- package/file-uploader/file-uploader.js +3 -3
- package/file-uploader/file-uploader.js.flow +4 -4
- package/header-navigation/styled-components.js +3 -3
- package/header-navigation/styled-components.js.flow +3 -3
- package/helpers/overrides.js +1 -2
- package/helpers/overrides.js.flow +1 -1
- package/input/index.d.ts +5 -9
- package/input/styled-components.js +4 -4
- package/input/styled-components.js.flow +4 -4
- package/layer/layer.js +4 -4
- package/layer/layer.js.flow +4 -3
- package/locale/index.js +0 -7
- package/locale/index.js.flow +0 -7
- package/locale.ts +0 -1
- package/menu/index.d.ts +1 -3
- package/menu/stateful-container.js +0 -1
- package/menu/stateful-container.js.flow +0 -1
- package/menu/styled-components.js +1 -1
- package/menu/styled-components.js.flow +1 -1
- package/modal/index.d.ts +4 -6
- package/modal/index.js +0 -6
- package/modal/index.js.flow +0 -1
- package/modal/modal.js +27 -70
- package/modal/modal.js.flow +17 -83
- package/modal/styled-components.js +7 -40
- package/modal/styled-components.js.flow +12 -44
- package/modal/types.js.flow +1 -10
- package/package.json +2 -2
- package/phone-input/default-props.js +1 -1
- package/phone-input/default-props.js.flow +1 -1
- package/phone-input/index.d.ts +0 -1
- package/phone-input/index.js +0 -36
- package/phone-input/index.js.flow +0 -4
- package/phone-input/phone-input-lite.js +63 -38
- package/phone-input/phone-input-lite.js.flow +66 -44
- package/radio/index.d.ts +4 -9
- package/radio/radio.js +1 -7
- package/radio/radio.js.flow +1 -8
- package/radio/radiogroup.js +3 -28
- package/radio/radiogroup.js.flow +2 -26
- package/radio/styled-components.js +4 -5
- package/radio/styled-components.js.flow +3 -4
- package/radio/types.js.flow +4 -15
- package/rating/styled-components.js +3 -3
- package/rating/styled-components.js.flow +3 -3
- package/select/index.d.ts +0 -2
- package/select/index.js +0 -6
- package/select/index.js.flow +0 -2
- package/select/select-component.js +4 -8
- package/select/select-component.js.flow +2 -3
- package/select/styled-components.js +4 -4
- package/select/styled-components.js.flow +4 -4
- package/snackbar/styled-components.js +1 -1
- package/snackbar/styled-components.js.flow +11 -11
- package/spinner/index.d.ts +5 -18
- package/spinner/index.js +2 -68
- package/spinner/index.js.flow +2 -27
- package/spinner/styled-components.js +9 -45
- package/spinner/styled-components.js.flow +2 -34
- package/spinner/types.js.flow +1 -19
- package/styles/types.js.flow +0 -2
- package/table/filter.js +3 -3
- package/table/filter.js.flow +3 -3
- package/tag/styled-components.js +1 -1
- package/tag/styled-components.js.flow +1 -1
- package/theme.ts +0 -81
- package/themes/dark-theme/color-component-tokens.js +0 -38
- package/themes/dark-theme/color-component-tokens.js.flow +0 -42
- package/themes/dark-theme/color-tokens.js +0 -2
- package/themes/dark-theme/color-tokens.js.flow +0 -2
- package/themes/dark-theme/create-dark-theme.js +1 -3
- package/themes/dark-theme/create-dark-theme.js.flow +0 -2
- package/themes/dark-theme/dark-theme.js +1 -3
- package/themes/dark-theme/dark-theme.js.flow +0 -2
- package/themes/light-theme/color-component-tokens.js +0 -38
- package/themes/light-theme/color-component-tokens.js.flow +0 -43
- package/themes/light-theme/color-tokens.js +0 -2
- package/themes/light-theme/color-tokens.js.flow +0 -2
- package/themes/light-theme/create-light-theme.js +1 -3
- package/themes/light-theme/create-light-theme.js.flow +0 -2
- package/themes/light-theme/light-theme.js +1 -3
- package/themes/light-theme/light-theme.js.flow +0 -2
- package/themes/types.js.flow +0 -68
- package/timepicker/timepicker.js +1 -8
- package/timepicker/timepicker.js.flow +4 -10
- package/typography/index.d.ts +0 -23
- package/typography/index.js +2 -57
- package/typography/index.js.flow +0 -31
- package/es/spinner/spinner.js +0 -68
- package/es/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -35
- package/es/themes/light-theme/color-deprecated-semantic-tokens.js +0 -35
- package/esm/spinner/spinner.js +0 -125
- package/esm/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -38
- package/esm/themes/light-theme/color-deprecated-semantic-tokens.js +0 -38
- package/spinner/spinner.js +0 -136
- package/spinner/spinner.js.flow +0 -75
- package/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -50
- package/themes/dark-theme/color-deprecated-semantic-tokens.js.flow +0 -42
- package/themes/light-theme/color-deprecated-semantic-tokens.js +0 -50
- package/themes/light-theme/color-deprecated-semantic-tokens.js.flow +0 -42
|
@@ -64,27 +64,28 @@ import { LocaleContext } from '../locale/index.js';
|
|
|
64
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
|
+
import { INPUT_ROLE, RANGED_CALENDAR_BEHAVIOR } from './constants.js';
|
|
67
68
|
export var DEFAULT_DATE_FORMAT = 'yyyy/MM/dd';
|
|
68
|
-
var INPUT_DELIMITER = '
|
|
69
|
+
var INPUT_DELIMITER = '–';
|
|
69
70
|
|
|
70
71
|
var combineSeparatedInputs = function combineSeparatedInputs(newInputValue) {
|
|
71
72
|
var prevCombinedInputValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
72
|
-
var
|
|
73
|
+
var inputRole = arguments.length > 2 ? arguments[2] : undefined;
|
|
73
74
|
var inputValue = newInputValue;
|
|
74
75
|
|
|
75
|
-
var _prevCombinedInputVal = prevCombinedInputValue.split(INPUT_DELIMITER),
|
|
76
|
+
var _prevCombinedInputVal = prevCombinedInputValue.split(" ".concat(INPUT_DELIMITER, " ")),
|
|
76
77
|
_prevCombinedInputVal2 = _slicedToArray(_prevCombinedInputVal, 2),
|
|
77
78
|
_prevCombinedInputVal3 = _prevCombinedInputVal2[0],
|
|
78
79
|
prevStartDate = _prevCombinedInputVal3 === void 0 ? '' : _prevCombinedInputVal3,
|
|
79
80
|
_prevCombinedInputVal4 = _prevCombinedInputVal2[1],
|
|
80
81
|
prevEndDate = _prevCombinedInputVal4 === void 0 ? '' : _prevCombinedInputVal4;
|
|
81
82
|
|
|
82
|
-
if (
|
|
83
|
-
inputValue = "".concat(inputValue, "
|
|
83
|
+
if (inputRole === INPUT_ROLE.startDate && prevEndDate) {
|
|
84
|
+
inputValue = "".concat(inputValue, " ").concat(INPUT_DELIMITER, " ").concat(prevEndDate);
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
if (
|
|
87
|
-
inputValue = "".concat(prevStartDate, "
|
|
87
|
+
if (inputRole === INPUT_ROLE.endDate) {
|
|
88
|
+
inputValue = "".concat(prevStartDate, " ").concat(INPUT_DELIMITER, " ").concat(inputValue);
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
return inputValue;
|
|
@@ -100,7 +101,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
100
101
|
|
|
101
102
|
_classCallCheck(this, Datepicker);
|
|
102
103
|
|
|
103
|
-
_this = _super.call(this, props); //$FlowFixMe
|
|
104
|
+
_this = _super.call(this, props); //$FlowFixMe[incompatible-call]
|
|
104
105
|
|
|
105
106
|
_defineProperty(_assertThisInitialized(_this), "calendar", void 0);
|
|
106
107
|
|
|
@@ -113,18 +114,27 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
113
114
|
var nextDate = data.date;
|
|
114
115
|
|
|
115
116
|
if (Array.isArray(nextDate) && _this.props.range) {
|
|
116
|
-
if (nextDate
|
|
117
|
+
if (!nextDate[0] || !nextDate[1]) {
|
|
117
118
|
isOpen = true;
|
|
118
119
|
isPseudoFocused = true;
|
|
119
120
|
calendarFocused = null;
|
|
120
|
-
} else if (nextDate
|
|
121
|
+
} else if (nextDate[0] && nextDate[1]) {
|
|
121
122
|
var _nextDate = nextDate,
|
|
122
123
|
_nextDate2 = _slicedToArray(_nextDate, 2),
|
|
123
124
|
start = _nextDate2[0],
|
|
124
125
|
end = _nextDate2[1];
|
|
125
126
|
|
|
126
127
|
if (_this.dateHelpers.isAfter(start, end)) {
|
|
127
|
-
|
|
128
|
+
if (_this.hasLockedBehavior()) {
|
|
129
|
+
nextDate = _this.props.value;
|
|
130
|
+
isOpen = true;
|
|
131
|
+
} else {
|
|
132
|
+
nextDate = [start, start];
|
|
133
|
+
}
|
|
134
|
+
} else if (_this.dateHelpers.dateRangeIncludesDates( // $FlowFixMe Cannot call `this.dateHelpers.dateRangeIncludesDates` with `nextDate` bound to the first parameter because read-only array type [1] is incompatible with array type [2]
|
|
135
|
+
nextDate, _this.props.excludeDates)) {
|
|
136
|
+
nextDate = _this.props.value;
|
|
137
|
+
isOpen = true;
|
|
128
138
|
}
|
|
129
139
|
|
|
130
140
|
if (_this.state.lastActiveElm) {
|
|
@@ -216,11 +226,12 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
216
226
|
return _this.formatDate(date, formatString);
|
|
217
227
|
});
|
|
218
228
|
|
|
219
|
-
_defineProperty(_assertThisInitialized(_this), "open", function () {
|
|
229
|
+
_defineProperty(_assertThisInitialized(_this), "open", function (inputRole) {
|
|
220
230
|
_this.setState({
|
|
221
231
|
isOpen: true,
|
|
222
232
|
isPseudoFocused: true,
|
|
223
|
-
calendarFocused: false
|
|
233
|
+
calendarFocused: false,
|
|
234
|
+
selectedInput: inputRole
|
|
224
235
|
}, _this.props.onOpen);
|
|
225
236
|
});
|
|
226
237
|
|
|
@@ -229,6 +240,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
229
240
|
|
|
230
241
|
_this.setState({
|
|
231
242
|
isOpen: false,
|
|
243
|
+
selectedInput: null,
|
|
232
244
|
isPseudoFocused: isPseudoFocused,
|
|
233
245
|
calendarFocused: false
|
|
234
246
|
}, _this.props.onClose);
|
|
@@ -264,14 +276,14 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
264
276
|
}
|
|
265
277
|
|
|
266
278
|
if (range && !separateRangeInputs) {
|
|
267
|
-
return
|
|
279
|
+
return "9999/99/99 ".concat(INPUT_DELIMITER, " 9999/99/99");
|
|
268
280
|
}
|
|
269
281
|
|
|
270
282
|
return '9999/99/99';
|
|
271
283
|
});
|
|
272
284
|
|
|
273
|
-
_defineProperty(_assertThisInitialized(_this), "handleInputChange", function (event,
|
|
274
|
-
var inputValue = _this.props.range && _this.props.separateRangeInputs ? combineSeparatedInputs(event.currentTarget.value, _this.state.inputValue,
|
|
285
|
+
_defineProperty(_assertThisInitialized(_this), "handleInputChange", function (event, inputRole) {
|
|
286
|
+
var inputValue = _this.props.range && _this.props.separateRangeInputs ? combineSeparatedInputs(event.currentTarget.value, _this.state.inputValue, inputRole) : event.currentTarget.value;
|
|
275
287
|
|
|
276
288
|
var mask = _this.getMask();
|
|
277
289
|
|
|
@@ -304,7 +316,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
304
316
|
};
|
|
305
317
|
|
|
306
318
|
if (_this.props.range && typeof _this.props.displayValueAtRangeIndex !== 'number') {
|
|
307
|
-
var _this$normalizeDashes = _this.normalizeDashes(inputValue).split(INPUT_DELIMITER),
|
|
319
|
+
var _this$normalizeDashes = _this.normalizeDashes(inputValue).split(" ".concat(INPUT_DELIMITER, " ")),
|
|
308
320
|
_this$normalizeDashes2 = _slicedToArray(_this$normalizeDashes, 2),
|
|
309
321
|
left = _this$normalizeDashes2[0],
|
|
310
322
|
right = _this$normalizeDashes2[1];
|
|
@@ -436,13 +448,18 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
436
448
|
|
|
437
449
|
_defineProperty(_assertThisInitialized(_this), "normalizeDashes", function (inputValue) {
|
|
438
450
|
// replacing both hyphens and em-dashes with en-dashes
|
|
439
|
-
return inputValue.replace(/-/g,
|
|
451
|
+
return inputValue.replace(/-/g, INPUT_DELIMITER).replace(/—/g, INPUT_DELIMITER);
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
_defineProperty(_assertThisInitialized(_this), "hasLockedBehavior", function () {
|
|
455
|
+
return _this.props.rangedCalendarBehavior === RANGED_CALENDAR_BEHAVIOR.locked && _this.props.range && _this.props.separateRangeInputs;
|
|
440
456
|
});
|
|
441
457
|
|
|
442
458
|
_this.dateHelpers = new DateHelpers(props.adapter);
|
|
443
459
|
_this.state = {
|
|
444
460
|
calendarFocused: false,
|
|
445
461
|
isOpen: false,
|
|
462
|
+
selectedInput: null,
|
|
446
463
|
isPseudoFocused: false,
|
|
447
464
|
lastActiveElm: null,
|
|
448
465
|
inputValue: _this.formatDisplayValue(props.value) || ''
|
|
@@ -451,6 +468,11 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
451
468
|
}
|
|
452
469
|
|
|
453
470
|
_createClass(Datepicker, [{
|
|
471
|
+
key: "getNullDatePlaceholder",
|
|
472
|
+
value: function getNullDatePlaceholder(formatString) {
|
|
473
|
+
return (this.getMask() || formatString).split(INPUT_DELIMITER)[0].replace(/[0-9]|[a-z]/g, ' ');
|
|
474
|
+
}
|
|
475
|
+
}, {
|
|
454
476
|
key: "formatDate",
|
|
455
477
|
value: function formatDate(date, formatString) {
|
|
456
478
|
var _this2 = this;
|
|
@@ -467,10 +489,14 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
467
489
|
return '';
|
|
468
490
|
} else if (Array.isArray(date) && !date[0] && !date[1]) {
|
|
469
491
|
return '';
|
|
492
|
+
} else if (Array.isArray(date) && !date[0] && date[1]) {
|
|
493
|
+
var endDate = format(date[1]);
|
|
494
|
+
var startDate = this.getNullDatePlaceholder(formatString);
|
|
495
|
+
return [startDate, endDate].join(" ".concat(INPUT_DELIMITER, " "));
|
|
470
496
|
} else if (Array.isArray(date)) {
|
|
471
497
|
return date.map(function (day) {
|
|
472
|
-
return format(day);
|
|
473
|
-
}).join(INPUT_DELIMITER);
|
|
498
|
+
return day ? format(day) : '';
|
|
499
|
+
}).join(" ".concat(INPUT_DELIMITER, " "));
|
|
474
500
|
} else {
|
|
475
501
|
return format(date);
|
|
476
502
|
}
|
|
@@ -486,7 +512,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
486
512
|
}
|
|
487
513
|
}, {
|
|
488
514
|
key: "renderInputComponent",
|
|
489
|
-
value: function renderInputComponent(locale,
|
|
515
|
+
value: function renderInputComponent(locale, inputRole) {
|
|
490
516
|
var _this3 = this;
|
|
491
517
|
|
|
492
518
|
var _this$props$overrides = this.props.overrides,
|
|
@@ -497,19 +523,19 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
497
523
|
InputComponent = _getOverrides2[0],
|
|
498
524
|
inputProps = _getOverrides2[1];
|
|
499
525
|
|
|
500
|
-
var placeholder = this.props.placeholder || this.props.placeholder === '' ? this.props.placeholder : this.props.range && !this.props.separateRangeInputs ?
|
|
526
|
+
var placeholder = this.props.placeholder || this.props.placeholder === '' ? this.props.placeholder : this.props.range && !this.props.separateRangeInputs ? "YYYY/MM/DD ".concat(INPUT_DELIMITER, " YYYY/MM/DD") : 'YYYY/MM/DD';
|
|
501
527
|
|
|
502
|
-
var _split = (this.state.inputValue || '').split(INPUT_DELIMITER),
|
|
528
|
+
var _split = (this.state.inputValue || '').split(" ".concat(INPUT_DELIMITER, " ")),
|
|
503
529
|
_split2 = _slicedToArray(_split, 2),
|
|
504
530
|
_split2$ = _split2[0],
|
|
505
531
|
startDate = _split2$ === void 0 ? '' : _split2$,
|
|
506
532
|
_split2$2 = _split2[1],
|
|
507
533
|
endDate = _split2$2 === void 0 ? '' : _split2$2;
|
|
508
534
|
|
|
509
|
-
var value =
|
|
535
|
+
var value = inputRole === INPUT_ROLE.startDate ? startDate : inputRole === INPUT_ROLE.endDate ? endDate : this.state.inputValue;
|
|
510
536
|
|
|
511
537
|
var onChange = function onChange(event) {
|
|
512
|
-
return _this3.handleInputChange(event,
|
|
538
|
+
return _this3.handleInputChange(event, inputRole);
|
|
513
539
|
};
|
|
514
540
|
|
|
515
541
|
return /*#__PURE__*/React.createElement(InputComponent, _extends({
|
|
@@ -523,7 +549,9 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
523
549
|
disabled: this.props.disabled,
|
|
524
550
|
size: this.props.size,
|
|
525
551
|
value: value,
|
|
526
|
-
onFocus:
|
|
552
|
+
onFocus: function onFocus() {
|
|
553
|
+
return _this3.open(inputRole);
|
|
554
|
+
},
|
|
527
555
|
onBlur: this.handleInputBlur,
|
|
528
556
|
onKeyDown: this.handleKeyDown,
|
|
529
557
|
onChange: onChange,
|
|
@@ -586,11 +614,13 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
586
614
|
trapTabbing: true,
|
|
587
615
|
value: _this4.props.value
|
|
588
616
|
}, _this4.props, {
|
|
589
|
-
onChange: _this4.onChange
|
|
617
|
+
onChange: _this4.onChange,
|
|
618
|
+
selectedInput: _this4.state.selectedInput,
|
|
619
|
+
hasLockedBehavior: _this4.hasLockedBehavior()
|
|
590
620
|
}))
|
|
591
621
|
}, popoverProps), /*#__PURE__*/React.createElement(InputWrapper, _extends({}, inputWrapperProps, {
|
|
592
622
|
$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,
|
|
623
|
+
}), _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, INPUT_ROLE.startDate)), /*#__PURE__*/React.createElement(EndDate, endDateProps, /*#__PURE__*/React.createElement(InputLabel, inputLabelProps, endDateLabel), _this4.renderInputComponent(locale, INPUT_ROLE.endDate))) : /*#__PURE__*/React.createElement(React.Fragment, null, _this4.renderInputComponent(locale)))), /*#__PURE__*/React.createElement("p", {
|
|
594
624
|
id: _this4.props['aria-describedby'],
|
|
595
625
|
style: {
|
|
596
626
|
position: 'fixed',
|
|
@@ -621,11 +651,11 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
621
651
|
clipPath: 'inset(100%)'
|
|
622
652
|
}
|
|
623
653
|
}, // No date selected
|
|
624
|
-
!_this4.props.value || Array.isArray(_this4.props.value) && !_this4.props.value.
|
|
654
|
+
!_this4.props.value || Array.isArray(_this4.props.value) && !_this4.props.value[0] && !_this4.props.value[1] ? '' : // Date selected in a non-range picker
|
|
625
655
|
!Array.isArray(_this4.props.value) ? getInterpolatedString(locale.datepicker.selectedDate, {
|
|
626
656
|
date: _this4.state.inputValue || ''
|
|
627
657
|
}) : // Start and end dates are selected in a range picker
|
|
628
|
-
_this4.props.value
|
|
658
|
+
_this4.props.value[0] && _this4.props.value[1] ? getInterpolatedString(locale.datepicker.selectedDateRange, {
|
|
629
659
|
startDate: _this4.formatDisplayValue(_this4.props.value[0]),
|
|
630
660
|
endDate: _this4.formatDisplayValue( // $FlowFixMe
|
|
631
661
|
_this4.props.value[1])
|
package/esm/datepicker/day.js
CHANGED
|
@@ -49,6 +49,7 @@ import DateHelpers from './utils/date-helpers.js';
|
|
|
49
49
|
import { getOverrides } from '../helpers/overrides.js';
|
|
50
50
|
import { LocaleContext } from '../locale/index.js';
|
|
51
51
|
import { isFocusVisible } from '../utils/focusVisible.js';
|
|
52
|
+
import { INPUT_ROLE } from './constants.js';
|
|
52
53
|
|
|
53
54
|
var Day = /*#__PURE__*/function (_React$Component) {
|
|
54
55
|
_inherits(Day, _React$Component);
|
|
@@ -83,22 +84,49 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
83
84
|
var _this$props = _this.props,
|
|
84
85
|
range = _this$props.range,
|
|
85
86
|
value = _this$props.value;
|
|
86
|
-
var
|
|
87
|
+
var nextDate;
|
|
88
|
+
|
|
89
|
+
if (Array.isArray(value) && range && _this.props.hasLockedBehavior) {
|
|
90
|
+
var currentDate = _this.props.value;
|
|
91
|
+
var nextStartDate = null;
|
|
92
|
+
var nextEndDate = null;
|
|
93
|
+
|
|
94
|
+
if (_this.props.selectedInput === INPUT_ROLE.startDate) {
|
|
95
|
+
nextStartDate = selectedDate;
|
|
96
|
+
nextEndDate = Array.isArray(currentDate) && currentDate[1] ? currentDate[1] : null;
|
|
97
|
+
} else if (_this.props.selectedInput === INPUT_ROLE.endDate) {
|
|
98
|
+
nextStartDate = Array.isArray(currentDate) && currentDate[0] ? currentDate[0] : null;
|
|
99
|
+
nextEndDate = selectedDate;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
nextDate = [nextStartDate];
|
|
87
103
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
104
|
+
if (nextEndDate) {
|
|
105
|
+
nextDate.push(nextEndDate);
|
|
106
|
+
}
|
|
107
|
+
} else if (Array.isArray(value) && range && !_this.props.hasLockedBehavior) {
|
|
108
|
+
var _value = _slicedToArray(value, 2),
|
|
109
|
+
start = _value[0],
|
|
110
|
+
end = _value[1]; // Starting a new range
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
if (!start && !end || start && end) {
|
|
114
|
+
nextDate = [selectedDate, null]; // EndDate needs a StartDate, SelectedDate comes before EndDate
|
|
115
|
+
} else if (!start && end && _this.dateHelpers.isAfter(end, selectedDate)) {
|
|
116
|
+
nextDate = [selectedDate, end]; // EndDate needs a StartDate, but SelectedDate comes after EndDate
|
|
117
|
+
} else if (!start && end && _this.dateHelpers.isAfter(selectedDate, end)) {
|
|
118
|
+
nextDate = [end, selectedDate]; // StartDate needs an EndDate, SelectedDate comes after StartDate
|
|
119
|
+
} else if (start && !end && _this.dateHelpers.isAfter(selectedDate, start)) {
|
|
120
|
+
nextDate = [start, selectedDate];
|
|
93
121
|
} else {
|
|
94
|
-
|
|
122
|
+
nextDate = [selectedDate, start];
|
|
95
123
|
}
|
|
96
124
|
} else {
|
|
97
|
-
|
|
125
|
+
nextDate = selectedDate;
|
|
98
126
|
}
|
|
99
127
|
|
|
100
128
|
_this.props.onSelect({
|
|
101
|
-
date:
|
|
129
|
+
date: nextDate
|
|
102
130
|
});
|
|
103
131
|
});
|
|
104
132
|
|
|
@@ -285,13 +313,18 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
285
313
|
var date = this.getDateProp();
|
|
286
314
|
var value = this.props.value;
|
|
287
315
|
|
|
288
|
-
if (Array.isArray(value)
|
|
289
|
-
|
|
290
|
-
|
|
316
|
+
if (Array.isArray(value)) {
|
|
317
|
+
var _value2 = _slicedToArray(value, 2),
|
|
318
|
+
start = _value2[0],
|
|
319
|
+
end = _value2[1];
|
|
291
320
|
|
|
321
|
+
if (!start && !end) {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
292
324
|
|
|
293
|
-
|
|
294
|
-
|
|
325
|
+
if (start && end) {
|
|
326
|
+
return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(start), this.clampToDayStart(end));
|
|
327
|
+
}
|
|
295
328
|
}
|
|
296
329
|
} // calculated for range case only
|
|
297
330
|
|
|
@@ -303,16 +336,29 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
303
336
|
value = _this$props4.value,
|
|
304
337
|
highlightedDate = _this$props4.highlightedDate;
|
|
305
338
|
|
|
306
|
-
if (Array.isArray(value)
|
|
307
|
-
|
|
308
|
-
|
|
339
|
+
if (Array.isArray(value)) {
|
|
340
|
+
var _value3 = _slicedToArray(value, 2),
|
|
341
|
+
start = _value3[0],
|
|
342
|
+
end = _value3[1];
|
|
343
|
+
|
|
344
|
+
if (!start && !end) {
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
309
347
|
|
|
348
|
+
if (highlightedDate && start && !end) {
|
|
349
|
+
if (this.dateHelpers.isAfter(highlightedDate, start)) {
|
|
350
|
+
return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(start), this.clampToDayStart(highlightedDate));
|
|
351
|
+
} else {
|
|
352
|
+
return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(highlightedDate), this.clampToDayStart(start));
|
|
353
|
+
}
|
|
354
|
+
}
|
|
310
355
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
356
|
+
if (highlightedDate && !start && end) {
|
|
357
|
+
if (this.dateHelpers.isAfter(highlightedDate, end)) {
|
|
358
|
+
return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(end), this.clampToDayStart(highlightedDate));
|
|
359
|
+
} else {
|
|
360
|
+
return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(highlightedDate), this.clampToDayStart(end));
|
|
361
|
+
}
|
|
316
362
|
}
|
|
317
363
|
}
|
|
318
364
|
}
|
|
@@ -324,21 +370,22 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
324
370
|
value = _this$props5.value,
|
|
325
371
|
highlightedDate = _this$props5.highlightedDate,
|
|
326
372
|
range = _this$props5.range,
|
|
327
|
-
highlighted = _this$props5.highlighted
|
|
373
|
+
highlighted = _this$props5.highlighted,
|
|
374
|
+
peekNextMonth = _this$props5.peekNextMonth;
|
|
328
375
|
var $isHighlighted = highlighted;
|
|
329
376
|
var $selected = this.isSelected();
|
|
330
|
-
var $hasRangeHighlighted = !!(Array.isArray(value) && range && value
|
|
331
|
-
var $outsideMonth = !
|
|
332
|
-
var $outsideMonthWithinRange = !!(Array.isArray(value) && range && $outsideMonth && !
|
|
377
|
+
var $hasRangeHighlighted = !!(Array.isArray(value) && range && highlightedDate && (value[0] && !value[1] && !this.dateHelpers.isSameDay(value[0], highlightedDate) || !value[0] && value[1] && !this.dateHelpers.isSameDay(value[1], highlightedDate)));
|
|
378
|
+
var $outsideMonth = !peekNextMonth && this.isOutsideMonth();
|
|
379
|
+
var $outsideMonthWithinRange = !!(Array.isArray(value) && range && $outsideMonth && !peekNextMonth && this.isOutsideOfMonthButWithinRange());
|
|
333
380
|
return {
|
|
334
381
|
$date: date,
|
|
335
382
|
$density: this.props.density,
|
|
336
383
|
$disabled: this.props.disabled,
|
|
337
|
-
$endDate: Array.isArray(value) &&
|
|
384
|
+
$endDate: Array.isArray(value) && !!(value[0] && value[1]) && range && $selected && this.dateHelpers.isSameDay(date, value[1]) || false,
|
|
338
385
|
$hasDateLabel: !!this.props.dateLabel,
|
|
339
386
|
$hasRangeHighlighted: $hasRangeHighlighted,
|
|
340
|
-
$hasRangeOnRight: Array.isArray(value) && $hasRangeHighlighted && highlightedDate && value[0] && this.dateHelpers.isAfter(highlightedDate, value[0]),
|
|
341
|
-
$hasRangeSelected: Array.isArray(value) ? value
|
|
387
|
+
$hasRangeOnRight: Array.isArray(value) && $hasRangeHighlighted && highlightedDate && (value[0] && this.dateHelpers.isAfter(highlightedDate, value[0]) || value[1] && this.dateHelpers.isAfter(highlightedDate, value[1])),
|
|
388
|
+
$hasRangeSelected: Array.isArray(value) ? !!(value[0] && value[1]) : false,
|
|
342
389
|
$highlightedDate: highlightedDate,
|
|
343
390
|
$isHighlighted: $isHighlighted,
|
|
344
391
|
$isHovered: this.state.isHovered,
|
|
@@ -348,12 +395,15 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
348
395
|
$month: this.getMonthProp(),
|
|
349
396
|
$outsideMonth: $outsideMonth,
|
|
350
397
|
$outsideMonthWithinRange: $outsideMonthWithinRange,
|
|
351
|
-
$peekNextMonth:
|
|
352
|
-
$pseudoHighlighted:
|
|
353
|
-
$pseudoSelected:
|
|
354
|
-
$range:
|
|
398
|
+
$peekNextMonth: peekNextMonth,
|
|
399
|
+
$pseudoHighlighted: range && !$isHighlighted && !$selected ? this.isPseudoHighlighted() : false,
|
|
400
|
+
$pseudoSelected: range && !$selected ? this.isPseudoSelected() : false,
|
|
401
|
+
$range: range,
|
|
355
402
|
$selected: $selected,
|
|
356
|
-
$startDate: Array.isArray(
|
|
403
|
+
$startDate: Array.isArray(value) && value[0] && value[1] && range && $selected ? this.dateHelpers.isSameDay(date, value[0]) : false,
|
|
404
|
+
$hasLockedBehavior: this.props.hasLockedBehavior,
|
|
405
|
+
$selectedInput: this.props.selectedInput,
|
|
406
|
+
$value: this.props.value
|
|
357
407
|
};
|
|
358
408
|
}
|
|
359
409
|
}, {
|
package/esm/datepicker/month.js
CHANGED
|
@@ -129,7 +129,9 @@ var CalendarMonth = /*#__PURE__*/function (_React$Component) {
|
|
|
129
129
|
onChange: _this.props.onChange,
|
|
130
130
|
overrides: _this.props.overrides,
|
|
131
131
|
peekNextMonth: _this.props.peekNextMonth,
|
|
132
|
-
value: _this.props.value
|
|
132
|
+
value: _this.props.value,
|
|
133
|
+
hasLockedBehavior: _this.props.hasLockedBehavior,
|
|
134
|
+
selectedInput: _this.props.selectedInput
|
|
133
135
|
}));
|
|
134
136
|
i++;
|
|
135
137
|
currentWeekStart = _this.dateHelpers.addWeeks(currentWeekStart, 1); // It will break on the next week if the week is out of the month
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
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."); }
|
|
4
|
+
|
|
5
|
+
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); }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
1
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
2
14
|
|
|
3
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; }
|
|
@@ -12,7 +24,7 @@ LICENSE file in the root directory of this source tree.
|
|
|
12
24
|
*/
|
|
13
25
|
import { styled } from '../styles/index.js';
|
|
14
26
|
import getDayStateCode from './utils/day-state.js';
|
|
15
|
-
import { ORIENTATION, DENSITY } from './constants.js';
|
|
27
|
+
import { ORIENTATION, DENSITY, INPUT_ROLE } from './constants.js';
|
|
16
28
|
/**
|
|
17
29
|
* Main component container element
|
|
18
30
|
*/
|
|
@@ -427,6 +439,9 @@ export var StyledDay = styled('div', function (props) {
|
|
|
427
439
|
$outsideMonthWithinRange = props.$outsideMonthWithinRange,
|
|
428
440
|
$hasDateLabel = props.$hasDateLabel,
|
|
429
441
|
$density = props.$density,
|
|
442
|
+
$hasLockedBehavior = props.$hasLockedBehavior,
|
|
443
|
+
$selectedInput = props.$selectedInput,
|
|
444
|
+
$value = props.$value,
|
|
430
445
|
_props$$theme4 = props.$theme,
|
|
431
446
|
colors = _props$$theme4.colors,
|
|
432
447
|
typography = _props$$theme4.typography,
|
|
@@ -448,6 +463,13 @@ export var StyledDay = styled('div', function (props) {
|
|
|
448
463
|
}
|
|
449
464
|
}
|
|
450
465
|
|
|
466
|
+
var _ref9 = Array.isArray($value) ? $value : [$value, null],
|
|
467
|
+
_ref10 = _slicedToArray(_ref9, 2),
|
|
468
|
+
startDate = _ref10[0],
|
|
469
|
+
endDate = _ref10[1];
|
|
470
|
+
|
|
471
|
+
var oppositeInputIsPopulated = $selectedInput === INPUT_ROLE.startDate ? endDate !== null && typeof endDate !== 'undefined' : startDate !== null && typeof startDate !== 'undefined';
|
|
472
|
+
var shouldHighlightRange = $range && !($hasLockedBehavior && !oppositeInputIsPopulated);
|
|
451
473
|
return _objectSpread(_objectSpread(_objectSpread({}, $density === DENSITY.high ? typography.ParagraphSmall : typography.ParagraphMedium), {}, {
|
|
452
474
|
boxSizing: 'border-box',
|
|
453
475
|
position: 'relative',
|
|
@@ -509,7 +531,7 @@ export var StyledDay = styled('div', function (props) {
|
|
|
509
531
|
}, getDayStyles(code, props.$theme)[':after'] || {}), $outsideMonthWithinRange ? {
|
|
510
532
|
content: null
|
|
511
533
|
} : {})
|
|
512
|
-
},
|
|
534
|
+
}, shouldHighlightRange ? {
|
|
513
535
|
// :before pseudo element defines a grey background style that extends
|
|
514
536
|
// the selected/highlighted day's circle and spans through a range
|
|
515
537
|
':before': _objectSpread(_objectSpread({
|
package/esm/datepicker/types.js
CHANGED
|
@@ -7,4 +7,4 @@ LICENSE file in the root directory of this source tree.
|
|
|
7
7
|
|
|
8
8
|
/* eslint-disable flowtype/generic-spacing */
|
|
9
9
|
import * as React from 'react';
|
|
10
|
-
import { ORIENTATION, STATE_CHANGE_TYPE, DENSITY } from './constants.js';
|
|
10
|
+
import { INPUT_ROLE, ORIENTATION, RANGED_CALENDAR_BEHAVIOR, STATE_CHANGE_TYPE, DENSITY } from './constants.js';
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
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."); }
|
|
4
|
+
|
|
5
|
+
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); }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
1
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
2
14
|
|
|
3
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; }
|
|
@@ -223,6 +235,24 @@ var DateHelpers = function DateHelpers(_adapter) {
|
|
|
223
235
|
return false;
|
|
224
236
|
});
|
|
225
237
|
|
|
238
|
+
_defineProperty(this, "dateRangeIncludesDates", function (dateRange, dates) {
|
|
239
|
+
var _dateRange = _slicedToArray(dateRange, 2),
|
|
240
|
+
startDate = _dateRange[0],
|
|
241
|
+
endDate = _dateRange[1];
|
|
242
|
+
|
|
243
|
+
if (startDate && endDate && Array.isArray(dates) && dates.length) {
|
|
244
|
+
for (var i = 0; i < dates.length; i++) {
|
|
245
|
+
var _day = dates[i];
|
|
246
|
+
|
|
247
|
+
if (_this.isDayInRange(_day, startDate, endDate)) {
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return false;
|
|
254
|
+
});
|
|
255
|
+
|
|
226
256
|
_defineProperty(this, "subDays", function (date, days) {
|
|
227
257
|
return _this.adapter.addDays(date, days * -1);
|
|
228
258
|
});
|
package/esm/datepicker/week.js
CHANGED
|
@@ -101,7 +101,9 @@ var Week = /*#__PURE__*/function (_React$Component) {
|
|
|
101
101
|
onMouseLeave: _this.props.onDayMouseLeave,
|
|
102
102
|
overrides: _this.props.overrides,
|
|
103
103
|
peekNextMonth: _this.props.peekNextMonth,
|
|
104
|
-
value: _this.props.value
|
|
104
|
+
value: _this.props.value,
|
|
105
|
+
hasLockedBehavior: _this.props.hasLockedBehavior,
|
|
106
|
+
selectedInput: _this.props.selectedInput
|
|
105
107
|
})
|
|
106
108
|
);
|
|
107
109
|
}));
|
|
@@ -35,7 +35,7 @@ import { useStyletron } from '../styles/index.js';
|
|
|
35
35
|
import { Button, KIND, SHAPE, SIZE as BUTTON_SIZE } from '../button/index.js';
|
|
36
36
|
import { getOverrides } from '../helpers/overrides.js';
|
|
37
37
|
import { ProgressBar } from '../progress-bar/index.js';
|
|
38
|
-
import {
|
|
38
|
+
import { Spinner, SIZE as SPINNER_SIZE } from '../spinner/index.js';
|
|
39
39
|
import { StyledRoot, StyledFileDragAndDrop, StyledContentMessage, StyledContentSeparator, StyledErrorMessage, StyledHiddenInput } from './styled-components.js';
|
|
40
40
|
|
|
41
41
|
function prependStyleProps(styleProps) {
|
|
@@ -88,7 +88,7 @@ function FileUploader(props) {
|
|
|
88
88
|
ButtonComponent = _getOverrides14[0],
|
|
89
89
|
buttonProps = _getOverrides14[1];
|
|
90
90
|
|
|
91
|
-
var _getOverrides15 = getOverrides(overrides.Spinner,
|
|
91
|
+
var _getOverrides15 = getOverrides(overrides.Spinner, Spinner),
|
|
92
92
|
_getOverrides16 = _slicedToArray(_getOverrides15, 2),
|
|
93
93
|
SpinnerComponent = _getOverrides16[0],
|
|
94
94
|
spinnerProps = _getOverrides16[1];
|
|
@@ -153,7 +153,7 @@ function FileUploader(props) {
|
|
|
153
153
|
marginBottom: theme.sizing.scale300
|
|
154
154
|
}
|
|
155
155
|
}, spinnerProps)), (props.errorMessage || props.progressMessage) && props.errorMessage ? /*#__PURE__*/React.createElement(ErrorMessage, _extends({}, prefixedStyledProps, errorMessageProps), props.errorMessage) : /*#__PURE__*/React.createElement(ContentMessage, _extends({}, prefixedStyledProps, contentMessageProps), props.progressMessage), props.errorMessage ? /*#__PURE__*/React.createElement(ButtonComponent, {
|
|
156
|
-
kind: KIND.
|
|
156
|
+
kind: KIND.tertiary,
|
|
157
157
|
onClick: function onClick() {
|
|
158
158
|
props.onRetry && props.onRetry();
|
|
159
159
|
},
|
|
@@ -161,7 +161,7 @@ function FileUploader(props) {
|
|
|
161
161
|
"aria-describedby": props['aria-describedby'],
|
|
162
162
|
"aria-errormessage": props.errorMessage
|
|
163
163
|
}, locale.fileuploader.retry) : /*#__PURE__*/React.createElement(ButtonComponent, {
|
|
164
|
-
kind: KIND.
|
|
164
|
+
kind: KIND.tertiary,
|
|
165
165
|
onClick: function onClick() {
|
|
166
166
|
props.onCancel && props.onCancel();
|
|
167
167
|
},
|
|
@@ -16,15 +16,15 @@ export var Root = styled('nav', function (props) {
|
|
|
16
16
|
var $theme = props.$theme;
|
|
17
17
|
var scale500 = $theme.sizing.scale500,
|
|
18
18
|
font300 = $theme.typography.font300,
|
|
19
|
-
|
|
19
|
+
borderOpaque = $theme.colors.borderOpaque;
|
|
20
20
|
return _objectSpread(_objectSpread({}, font300), {}, {
|
|
21
21
|
display: 'flex',
|
|
22
22
|
paddingBottom: scale500,
|
|
23
23
|
paddingTop: scale500,
|
|
24
24
|
borderBottomWidth: '1px',
|
|
25
25
|
borderBottomStyle: 'solid',
|
|
26
|
-
borderBottomColor: "".concat(
|
|
27
|
-
backgroundColor: $theme.colors.
|
|
26
|
+
borderBottomColor: "".concat(borderOpaque),
|
|
27
|
+
backgroundColor: $theme.colors.backgroundPrimary
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
Root.displayName = "Root";
|
package/esm/helpers/overrides.js
CHANGED
|
@@ -85,8 +85,7 @@ export function toObjectOverride(override) {
|
|
|
85
85
|
/**
|
|
86
86
|
* Get a convenient override array that will always have [component, props]
|
|
87
87
|
*/
|
|
88
|
-
|
|
89
|
-
/* flowlint unclear-type:off */
|
|
88
|
+
// flowlint unclear-type:off
|
|
90
89
|
|
|
91
90
|
export function getOverrides(override, defaultComponent) {
|
|
92
91
|
var Component = getOverride(override) || defaultComponent;
|
|
@@ -120,10 +120,10 @@ function getRootColors($disabled, $isFocused, $error) {
|
|
|
120
120
|
|
|
121
121
|
if ($isFocused) {
|
|
122
122
|
return {
|
|
123
|
-
borderLeftColor: colors.
|
|
124
|
-
borderRightColor: colors.
|
|
125
|
-
borderTopColor: colors.
|
|
126
|
-
borderBottomColor: colors.
|
|
123
|
+
borderLeftColor: colors.borderSelected,
|
|
124
|
+
borderRightColor: colors.borderSelected,
|
|
125
|
+
borderTopColor: colors.borderSelected,
|
|
126
|
+
borderBottomColor: colors.borderSelected,
|
|
127
127
|
backgroundColor: colors.inputFillActive
|
|
128
128
|
};
|
|
129
129
|
}
|