baseui 11.0.1 → 11.1.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/a11y/index.d.ts +1 -1
- package/accordion/index.d.ts +25 -28
- package/app-nav-bar/app-nav-bar.js +33 -40
- package/app-nav-bar/app-nav-bar.js.flow +46 -62
- package/app-nav-bar/index.d.ts +9 -8
- package/app-nav-bar/styled-components.js +49 -29
- package/app-nav-bar/styled-components.js.flow +25 -8
- package/app-nav-bar/types.js.flow +2 -0
- package/aspect-ratio-box/index.d.ts +2 -4
- package/avatar/index.d.ts +6 -12
- package/badge/badge.js +109 -0
- package/badge/badge.js.flow +91 -0
- package/badge/constants.js +54 -0
- package/badge/constants.js.flow +52 -0
- package/badge/hint-dot.js +96 -0
- package/badge/hint-dot.js.flow +68 -0
- package/badge/index.d.ts +97 -0
- package/badge/index.js +80 -0
- package/badge/index.js.flow +20 -0
- package/badge/notification-circle.js +103 -0
- package/badge/notification-circle.js.flow +81 -0
- package/badge/package.json +4 -0
- package/badge/styled-components.js +242 -0
- package/badge/styled-components.js.flow +325 -0
- package/badge/types.js +11 -0
- package/badge/types.js.flow +59 -0
- package/badge/utils.js +33 -0
- package/badge/utils.js.flow +23 -0
- package/banner/banner.js +283 -0
- package/banner/banner.js.flow +253 -0
- package/banner/constants.js +35 -0
- package/banner/constants.js.flow +33 -0
- package/banner/index.d.ts +75 -0
- package/banner/index.js +44 -0
- package/banner/index.js.flow +16 -0
- package/banner/package.json +4 -0
- package/banner/styled-components.js +131 -0
- package/banner/styled-components.js.flow +119 -0
- package/banner/types.js +11 -0
- package/banner/types.js.flow +66 -0
- package/block/index.d.ts +4 -4
- package/breadcrumbs/breadcrumbs.js +5 -1
- package/breadcrumbs/breadcrumbs.js.flow +2 -2
- package/breadcrumbs/index.d.ts +5 -5
- package/button/button.js +2 -1
- package/button/button.js.flow +1 -0
- package/button/index.d.ts +19 -29
- package/button-group/index.d.ts +18 -24
- package/card/index.d.ts +16 -14
- package/checkbox/index.d.ts +17 -21
- package/combobox/index.d.ts +7 -11
- package/data-table/index.d.ts +7 -10
- package/datepicker/calendar.js +16 -11
- package/datepicker/calendar.js.flow +12 -9
- package/datepicker/datepicker.js +58 -58
- package/datepicker/datepicker.js.flow +51 -34
- package/datepicker/index.d.ts +42 -63
- package/datepicker/stateful-calendar.js +6 -1
- package/datepicker/stateful-calendar.js.flow +8 -1
- package/datepicker/stateful-container.js +23 -2
- package/datepicker/stateful-container.js.flow +17 -4
- package/datepicker/stateful-datepicker.js +6 -1
- package/datepicker/stateful-datepicker.js.flow +7 -1
- package/datepicker/types.js.flow +21 -43
- package/datepicker/utils/date-helpers.js +1 -1
- package/datepicker/utils/date-helpers.js.flow +1 -1
- package/dnd-list/index.d.ts +22 -35
- package/drawer/index.d.ts +22 -27
- package/es/app-nav-bar/app-nav-bar.js +9 -19
- package/es/app-nav-bar/styled-components.js +32 -13
- package/es/badge/badge.js +70 -0
- package/es/badge/constants.js +42 -0
- package/es/badge/hint-dot.js +55 -0
- package/es/badge/index.js +11 -0
- package/es/badge/notification-circle.js +65 -0
- package/es/badge/styled-components.js +296 -0
- package/es/badge/types.js +8 -0
- package/es/badge/utils.js +17 -0
- package/es/banner/banner.js +213 -0
- package/es/banner/constants.js +24 -0
- package/es/banner/index.js +9 -0
- package/es/banner/styled-components.js +122 -0
- package/es/banner/types.js +8 -0
- package/es/breadcrumbs/breadcrumbs.js +5 -1
- package/es/button/button.js +1 -0
- package/es/datepicker/calendar.js +15 -10
- package/es/datepicker/datepicker.js +52 -52
- package/es/datepicker/stateful-calendar.js +6 -1
- package/es/datepicker/stateful-container.js +22 -2
- package/es/datepicker/stateful-datepicker.js +6 -1
- package/es/datepicker/utils/date-helpers.js +1 -1
- package/es/helper/helper-steps.js +3 -1
- package/es/input/base-input.js +18 -11
- package/es/input/input.js +15 -10
- package/es/input/masked-input.js +5 -2
- package/es/input/utils.js +4 -2
- package/es/locale/tr_TR.js +115 -0
- package/es/notification/notification.js +16 -1
- package/es/payment-card/custom-cards.config.js +22 -0
- package/es/payment-card/icons/uatp.js +52 -0
- package/es/payment-card/payment-card.js +8 -3
- package/es/popover/popover.js +2 -1
- package/es/popover/stateful-container.js +2 -0
- package/es/popover/styled-components.js +2 -1
- package/es/progress-steps/numbered-step.js +2 -2
- package/es/select/select-component.js +48 -23
- package/es/select/utils/default-filter-options.js +1 -1
- package/es/snackbar/snackbar-context.js +1 -1
- package/es/table-semantic/styled-components.js +14 -0
- package/es/table-semantic/table-builder.js +12 -5
- package/es/textarea/textarea.js +15 -9
- package/es/themes/dark-theme/color-component-tokens.js +8 -0
- package/es/themes/light-theme/color-component-tokens.js +8 -0
- package/es/tree-view/tree-label.js +9 -1
- package/esm/app-nav-bar/app-nav-bar.js +32 -38
- package/esm/app-nav-bar/styled-components.js +46 -28
- package/esm/badge/badge.js +97 -0
- package/esm/badge/constants.js +42 -0
- package/esm/badge/hint-dot.js +83 -0
- package/esm/badge/index.js +11 -0
- package/esm/badge/notification-circle.js +91 -0
- package/esm/badge/styled-components.js +235 -0
- package/esm/badge/types.js +8 -0
- package/esm/badge/utils.js +17 -0
- package/esm/banner/banner.js +271 -0
- package/esm/banner/constants.js +24 -0
- package/esm/banner/index.js +9 -0
- package/esm/banner/styled-components.js +113 -0
- package/esm/banner/types.js +8 -0
- package/esm/breadcrumbs/breadcrumbs.js +5 -1
- package/esm/button/button.js +2 -1
- package/esm/datepicker/calendar.js +16 -11
- package/esm/datepicker/datepicker.js +58 -58
- package/esm/datepicker/stateful-calendar.js +6 -1
- package/esm/datepicker/stateful-container.js +23 -2
- package/esm/datepicker/stateful-datepicker.js +6 -1
- package/esm/datepicker/utils/date-helpers.js +1 -1
- package/esm/helper/helper-steps.js +3 -1
- package/esm/input/base-input.js +18 -11
- package/esm/input/input.js +15 -10
- package/esm/input/masked-input.js +6 -3
- package/esm/input/utils.js +4 -2
- package/esm/locale/tr_TR.js +115 -0
- package/esm/notification/notification.js +17 -1
- package/esm/payment-card/custom-cards.config.js +22 -0
- package/esm/payment-card/icons/uatp.js +53 -0
- package/esm/payment-card/payment-card.js +9 -7
- package/esm/popover/popover.js +2 -1
- package/esm/popover/stateful-container.js +2 -0
- package/esm/popover/styled-components.js +3 -2
- package/esm/progress-steps/numbered-step.js +2 -2
- package/esm/select/select-component.js +85 -59
- package/esm/select/utils/default-filter-options.js +1 -1
- package/esm/snackbar/snackbar-context.js +1 -1
- package/esm/table-semantic/styled-components.js +31 -18
- package/esm/table-semantic/table-builder.js +34 -23
- package/esm/textarea/textarea.js +15 -9
- package/esm/themes/dark-theme/color-component-tokens.js +8 -0
- package/esm/themes/light-theme/color-component-tokens.js +8 -0
- package/esm/tree-view/tree-label.js +10 -2
- package/file-uploader/index.d.ts +11 -11
- package/flex-grid/index.d.ts +3 -3
- package/form-control/index.d.ts +7 -19
- package/header-navigation/index.d.ts +8 -9
- package/heading/index.d.ts +3 -4
- package/helper/helper-steps.js +19 -13
- package/helper/helper-steps.js.flow +3 -1
- package/helper/index.d.ts +7 -7
- package/helpers/base-provider.d.ts +16 -0
- package/helpers/overrides.d.ts +23 -0
- package/icon/index.d.ts +32 -32
- package/index.d.ts +34 -114
- package/input/base-input.js +18 -11
- package/input/base-input.js.flow +18 -6
- package/input/index.d.ts +29 -32
- package/input/input.js +15 -10
- package/input/input.js.flow +10 -5
- package/input/masked-input.js +6 -3
- package/input/masked-input.js.flow +3 -0
- package/input/types.js.flow +4 -0
- package/input/utils.js +4 -2
- package/input/utils.js.flow +2 -1
- package/layer/index.d.ts +6 -11
- package/layout-grid/index.d.ts +25 -7
- package/link/index.d.ts +2 -2
- package/list/index.d.ts +26 -31
- package/{locale.ts → locale/index.d.ts} +8 -0
- package/locale/tr_TR.js +123 -0
- package/locale/tr_TR.js.flow +124 -0
- package/map-marker/index.d.ts +41 -47
- package/menu/index.d.ts +27 -37
- package/modal/index.d.ts +28 -38
- package/notification/index.d.ts +2 -3
- package/notification/notification.js +18 -1
- package/notification/notification.js.flow +15 -1
- package/overrides.ts +2 -22
- package/package.json +26 -17
- package/pagination/index.d.ts +22 -26
- package/payment-card/custom-cards.config.js +30 -0
- package/payment-card/custom-cards.config.js.flow +29 -0
- package/payment-card/icons/uatp.js +67 -0
- package/payment-card/icons/uatp.js.flow +62 -0
- package/payment-card/index.d.ts +8 -8
- package/payment-card/payment-card.js +12 -7
- package/payment-card/payment-card.js.flow +12 -0
- package/phone-input/index.d.ts +261 -269
- package/pin-code/index.d.ts +11 -18
- package/popover/index.d.ts +39 -55
- package/popover/popover.js +2 -1
- package/popover/popover.js.flow +2 -1
- package/popover/stateful-container.js +2 -0
- package/popover/stateful-container.js.flow +2 -0
- package/popover/styled-components.js +3 -2
- package/popover/styled-components.js.flow +2 -1
- package/popover/types.js.flow +1 -0
- package/progress-bar/index.d.ts +11 -12
- package/progress-steps/index.d.ts +16 -16
- package/progress-steps/numbered-step.js.flow +2 -2
- package/radio/index.d.ts +12 -15
- package/rating/index.d.ts +9 -12
- package/select/index.d.ts +34 -36
- package/select/select-component.js +82 -56
- package/select/select-component.js.flow +46 -34
- package/select/types.js.flow +1 -0
- package/select/utils/default-filter-options.js +1 -1
- package/select/utils/default-filter-options.js.flow +1 -1
- package/side-navigation/index.d.ts +11 -13
- package/skeleton/index.d.ts +1 -1
- package/slider/index.d.ts +17 -26
- package/snackbar/index.d.ts +8 -8
- package/snackbar/snackbar-context.js +1 -1
- package/snackbar/snackbar-context.js.flow +1 -1
- package/spinner/index.d.ts +4 -3
- package/styles/index.d.ts +82 -2
- package/table/index.d.ts +16 -16
- package/table-grid/index.d.ts +6 -8
- package/table-semantic/index.d.ts +26 -32
- package/table-semantic/styled-components.js +33 -19
- package/table-semantic/styled-components.js.flow +12 -0
- package/table-semantic/table-builder.js +38 -22
- package/table-semantic/table-builder.js.flow +32 -17
- package/table-semantic/types.js.flow +1 -0
- package/tabs/index.d.ts +20 -23
- package/tabs-motion/index.d.ts +23 -23
- package/tag/index.d.ts +14 -18
- package/tag/types.js.flow +1 -1
- package/textarea/index.d.ts +11 -14
- package/textarea/textarea.js +15 -9
- package/textarea/textarea.js.flow +11 -5
- package/textarea/types.js.flow +1 -0
- package/theme.ts +36 -777
- package/themes/dark-theme/color-component-tokens.js +8 -0
- package/themes/dark-theme/color-component-tokens.js.flow +9 -0
- package/themes/index.d.ts +765 -0
- package/themes/light-theme/color-component-tokens.js +8 -0
- package/themes/light-theme/color-component-tokens.js.flow +9 -0
- package/themes/types.js.flow +9 -0
- package/timepicker/index.d.ts +5 -8
- package/timezonepicker/index.d.ts +5 -8
- package/toast/index.d.ts +26 -40
- package/tokens/index.d.ts +1 -1
- package/tooltip/index.d.ts +7 -9
- package/tree-view/index.d.ts +15 -19
- package/tree-view/tree-label.js +10 -2
- package/tree-view/tree-label.js.flow +4 -4
- package/typography/index.d.ts +37 -37
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) Uber Technologies, Inc.
|
|
3
|
+
|
|
4
|
+
This source code is licensed under the MIT license found in the
|
|
5
|
+
LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { ACTION_POSITION, ARTWORK_TYPE, HIERARCHY, KIND } from './constants.js';
|
|
@@ -76,7 +76,11 @@ export function Breadcrumbs(props) {
|
|
|
76
76
|
}, baseListItemProps), child, (showTrailingSeparator || index !== childrenArray.length - 1) && /*#__PURE__*/React.createElement(Separator, _extends({}, baseSeparatorProps, {
|
|
77
77
|
key: "separator-".concat(index)
|
|
78
78
|
}), /*#__PURE__*/React.createElement(ThemeContext.Consumer, null, function (theme) {
|
|
79
|
-
return theme.direction === 'rtl' ? /*#__PURE__*/React.createElement(Left,
|
|
79
|
+
return theme.direction === 'rtl' ? /*#__PURE__*/React.createElement(Left, _extends({
|
|
80
|
+
size: 16
|
|
81
|
+
}, baseIconProps)) : /*#__PURE__*/React.createElement(Right, _extends({
|
|
82
|
+
size: 16
|
|
83
|
+
}, baseIconProps));
|
|
80
84
|
}))));
|
|
81
85
|
});
|
|
82
86
|
return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, function (locale) {
|
package/esm/button/button.js
CHANGED
|
@@ -131,7 +131,8 @@ var Button = /*#__PURE__*/function (_React$Component) {
|
|
|
131
131
|
endEnhancer = _this$props2.endEnhancer,
|
|
132
132
|
children = _this$props2.children,
|
|
133
133
|
forwardedRef = _this$props2.forwardedRef,
|
|
134
|
-
|
|
134
|
+
colors = _this$props2.colors,
|
|
135
|
+
restProps = _objectWithoutProperties(_this$props2, ["overrides", "size", "kind", "shape", "isLoading", "isSelected", "startEnhancer", "endEnhancer", "children", "forwardedRef", "colors"]); // Get overrides
|
|
135
136
|
|
|
136
137
|
|
|
137
138
|
var _getOverrides = getOverrides( // adding both (1) BaseButton and (2) Root
|
|
@@ -315,12 +315,12 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
315
315
|
_defineProperty(_assertThisInitialized(_this), "handleDateChange", function (data) {
|
|
316
316
|
var _this$props$onChange = _this.props.onChange,
|
|
317
317
|
onChange = _this$props$onChange === void 0 ? function (params) {} : _this$props$onChange;
|
|
318
|
-
var updatedDate = data.date; //
|
|
319
|
-
|
|
320
|
-
var newTimeState = _toConsumableArray(_this.state.time); // Apply the currently selected time values (saved in state) to the updated date
|
|
321
|
-
|
|
318
|
+
var updatedDate = data.date; // Apply the currently selected time values (saved in state) to the updated date
|
|
322
319
|
|
|
323
320
|
if (Array.isArray(data.date)) {
|
|
321
|
+
// We'll need to update the date in time values of internal state
|
|
322
|
+
var newTimeState = _toConsumableArray(_this.state.time);
|
|
323
|
+
|
|
324
324
|
var start = data.date[0] ? _this.dateHelpers.applyDateToTime(newTimeState[0], data.date[0]) : null;
|
|
325
325
|
var end = data.date[1] ? _this.dateHelpers.applyDateToTime(newTimeState[1], data.date[1]) : null;
|
|
326
326
|
newTimeState[0] = start;
|
|
@@ -330,16 +330,21 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
330
330
|
newTimeState[1] = end;
|
|
331
331
|
} else {
|
|
332
332
|
updatedDate = [start];
|
|
333
|
-
}
|
|
333
|
+
} // Update the date in time values of internal state
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
_this.setState({
|
|
337
|
+
time: newTimeState
|
|
338
|
+
});
|
|
334
339
|
} else if (!Array.isArray(_this.props.value) && data.date) {
|
|
335
|
-
|
|
336
|
-
updatedDate = newTimeState[0];
|
|
337
|
-
} // Update the date in time values of internal state
|
|
340
|
+
var _newTimeState = _this.dateHelpers.applyDateToTime(_this.state.time[0], data.date);
|
|
338
341
|
|
|
342
|
+
updatedDate = _newTimeState; // Update the date in time values of internal state
|
|
339
343
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
344
|
+
_this.setState({
|
|
345
|
+
time: [_newTimeState]
|
|
346
|
+
});
|
|
347
|
+
}
|
|
343
348
|
|
|
344
349
|
onChange({
|
|
345
350
|
date: updatedDate
|
|
@@ -2,6 +2,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || 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); }
|
|
4
4
|
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
5
9
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
10
|
|
|
7
11
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -10,10 +14,6 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.it
|
|
|
10
14
|
|
|
11
15
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12
16
|
|
|
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; }
|
|
14
|
-
|
|
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
|
-
|
|
17
17
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
18
18
|
|
|
19
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); } }
|
|
@@ -107,7 +107,39 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
107
107
|
|
|
108
108
|
_defineProperty(_assertThisInitialized(_this), "dateHelpers", void 0);
|
|
109
109
|
|
|
110
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
110
|
+
_defineProperty(_assertThisInitialized(_this), "handleChange", function (date) {
|
|
111
|
+
var onChange = _this.props.onChange;
|
|
112
|
+
var onRangeChange = _this.props.onRangeChange;
|
|
113
|
+
|
|
114
|
+
if (Array.isArray(date)) {
|
|
115
|
+
if (onChange && date.every(Boolean)) {
|
|
116
|
+
// flowlint-next-line unclear-type:off
|
|
117
|
+
onChange({
|
|
118
|
+
date: date
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (onRangeChange) {
|
|
123
|
+
onRangeChange({
|
|
124
|
+
date: _toConsumableArray(date)
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
if (onChange) {
|
|
129
|
+
onChange({
|
|
130
|
+
date: date
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (onRangeChange) {
|
|
135
|
+
onRangeChange({
|
|
136
|
+
date: date
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
_defineProperty(_assertThisInitialized(_this), "onCalendarSelect", function (data) {
|
|
111
143
|
var isOpen = false;
|
|
112
144
|
var isPseudoFocused = false;
|
|
113
145
|
var calendarFocused = false;
|
|
@@ -184,9 +216,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
184
216
|
inputValue: _this.formatDisplayValue(nextDate)
|
|
185
217
|
}));
|
|
186
218
|
|
|
187
|
-
_this.
|
|
188
|
-
date: nextDate
|
|
189
|
-
});
|
|
219
|
+
_this.handleChange(nextDate);
|
|
190
220
|
});
|
|
191
221
|
|
|
192
222
|
_defineProperty(_assertThisInitialized(_this), "formatDisplayValue", function (date) {
|
|
@@ -290,16 +320,10 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
290
320
|
var formatString = _this.normalizeDashes(_this.props.formatString);
|
|
291
321
|
|
|
292
322
|
if (typeof mask === 'string' && inputValue === mask.replace(/9/g, ' ') || inputValue.length === 0) {
|
|
293
|
-
if (_this.props.
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
});
|
|
298
|
-
} else {
|
|
299
|
-
_this.props.onChange({
|
|
300
|
-
date: null
|
|
301
|
-
});
|
|
302
|
-
}
|
|
323
|
+
if (_this.props.range) {
|
|
324
|
+
_this.handleChange([]);
|
|
325
|
+
} else {
|
|
326
|
+
_this.handleChange(null);
|
|
303
327
|
}
|
|
304
328
|
}
|
|
305
329
|
|
|
@@ -330,19 +354,13 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
330
354
|
endDate = parseDateString(right);
|
|
331
355
|
}
|
|
332
356
|
|
|
333
|
-
var
|
|
334
|
-
|
|
335
|
-
if (onChange) {
|
|
336
|
-
var datesValid = _this.dateHelpers.isValid(startDate) && _this.dateHelpers.isValid(endDate); // added equal case so that times within the same day can be expressed
|
|
357
|
+
var datesValid = _this.dateHelpers.isValid(startDate) && _this.dateHelpers.isValid(endDate); // added equal case so that times within the same day can be expressed
|
|
337
358
|
|
|
338
359
|
|
|
339
|
-
|
|
360
|
+
var rangeValid = _this.dateHelpers.isAfter(endDate, startDate) || _this.dateHelpers.isEqual(startDate, endDate);
|
|
340
361
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
date: [startDate, endDate]
|
|
344
|
-
});
|
|
345
|
-
}
|
|
362
|
+
if (datesValid && rangeValid) {
|
|
363
|
+
_this.handleChange([startDate, endDate]);
|
|
346
364
|
}
|
|
347
365
|
} else {
|
|
348
366
|
var dateString = _this.normalizeDashes(inputValue);
|
|
@@ -360,11 +378,10 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
360
378
|
|
|
361
379
|
var _this$props3 = _this.props,
|
|
362
380
|
displayValueAtRangeIndex = _this$props3.displayValueAtRangeIndex,
|
|
363
|
-
_onChange = _this$props3.onChange,
|
|
364
381
|
range = _this$props3.range,
|
|
365
382
|
value = _this$props3.value;
|
|
366
383
|
|
|
367
|
-
if (date && _this.dateHelpers.isValid(date)
|
|
384
|
+
if (date && _this.dateHelpers.isValid(date)) {
|
|
368
385
|
if (range && Array.isArray(value) && typeof displayValueAtRangeIndex === 'number') {
|
|
369
386
|
var _value = _slicedToArray(value, 2),
|
|
370
387
|
_left = _value[0],
|
|
@@ -374,22 +391,16 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
374
391
|
_left = date;
|
|
375
392
|
|
|
376
393
|
if (!_right) {
|
|
377
|
-
|
|
378
|
-
date: [_left]
|
|
379
|
-
});
|
|
394
|
+
_this.handleChange([_left]);
|
|
380
395
|
} else {
|
|
381
396
|
if (_this.dateHelpers.isAfter(_right, _left) || _this.dateHelpers.isEqual(_left, _right)) {
|
|
382
|
-
|
|
383
|
-
date: [_left, _right]
|
|
384
|
-
});
|
|
397
|
+
_this.handleChange([_left, _right]);
|
|
385
398
|
} else {
|
|
386
399
|
// Is resetting back to previous value appropriate? Invalid range is not
|
|
387
400
|
// communicated to the user, but if it was not reset the text value would
|
|
388
401
|
// show one value and date value another. This seems a bit better but clearly
|
|
389
402
|
// has a downside.
|
|
390
|
-
|
|
391
|
-
date: _toConsumableArray(value)
|
|
392
|
-
});
|
|
403
|
+
_this.handleChange(_toConsumableArray(value));
|
|
393
404
|
}
|
|
394
405
|
}
|
|
395
406
|
} else if (displayValueAtRangeIndex === 1) {
|
|
@@ -397,26 +408,18 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
397
408
|
|
|
398
409
|
if (!_left) {
|
|
399
410
|
// If start value is not defined, set start/end to the same day.
|
|
400
|
-
|
|
401
|
-
date: [_right, _right]
|
|
402
|
-
});
|
|
411
|
+
_this.handleChange([_right, _right]);
|
|
403
412
|
} else {
|
|
404
413
|
if (_this.dateHelpers.isAfter(_right, _left) || _this.dateHelpers.isEqual(_left, _right)) {
|
|
405
|
-
|
|
406
|
-
date: [_left, _right]
|
|
407
|
-
});
|
|
414
|
+
_this.handleChange([_left, _right]);
|
|
408
415
|
} else {
|
|
409
416
|
// See comment above about resetting dates on invalid range
|
|
410
|
-
|
|
411
|
-
date: _toConsumableArray(value)
|
|
412
|
-
});
|
|
417
|
+
_this.handleChange(_toConsumableArray(value));
|
|
413
418
|
}
|
|
414
419
|
}
|
|
415
420
|
}
|
|
416
421
|
} else {
|
|
417
|
-
|
|
418
|
-
date: date
|
|
419
|
-
});
|
|
422
|
+
_this.handleChange(date);
|
|
420
423
|
}
|
|
421
424
|
}
|
|
422
425
|
}
|
|
@@ -533,11 +536,6 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
533
536
|
endDate = _split2$2 === void 0 ? '' : _split2$2;
|
|
534
537
|
|
|
535
538
|
var value = inputRole === INPUT_ROLE.startDate ? startDate : inputRole === INPUT_ROLE.endDate ? endDate : this.state.inputValue;
|
|
536
|
-
|
|
537
|
-
var onChange = function onChange(event) {
|
|
538
|
-
return _this3.handleInputChange(event, inputRole);
|
|
539
|
-
};
|
|
540
|
-
|
|
541
539
|
return /*#__PURE__*/React.createElement(InputComponent, _extends({
|
|
542
540
|
"aria-disabled": this.props.disabled,
|
|
543
541
|
"aria-label": this.props['aria-label'] || (this.props.range ? locale.datepicker.ariaLabelRange : locale.datepicker.ariaLabel),
|
|
@@ -554,7 +552,9 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
554
552
|
},
|
|
555
553
|
onBlur: this.handleInputBlur,
|
|
556
554
|
onKeyDown: this.handleKeyDown,
|
|
557
|
-
onChange: onChange
|
|
555
|
+
onChange: function onChange(event) {
|
|
556
|
+
return _this3.handleInputChange(event, inputRole);
|
|
557
|
+
},
|
|
558
558
|
placeholder: placeholder,
|
|
559
559
|
mask: this.getMask(),
|
|
560
560
|
required: this.props.required,
|
|
@@ -614,7 +614,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
614
614
|
trapTabbing: true,
|
|
615
615
|
value: _this4.props.value
|
|
616
616
|
}, _this4.props, {
|
|
617
|
-
onChange: _this4.
|
|
617
|
+
onChange: _this4.onCalendarSelect,
|
|
618
618
|
selectedInput: _this4.state.selectedInput,
|
|
619
619
|
hasLockedBehavior: _this4.hasLockedBehavior()
|
|
620
620
|
}))
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
2
|
|
|
3
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
4
|
+
|
|
3
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
6
|
|
|
5
7
|
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); } }
|
|
@@ -47,7 +49,10 @@ var StatefulComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
47
49
|
key: "render",
|
|
48
50
|
value: function render() {
|
|
49
51
|
return /*#__PURE__*/React.createElement(StatefulContainer, this.props, function (extendedProps) {
|
|
50
|
-
return /*#__PURE__*/React.createElement(Calendar, extendedProps
|
|
52
|
+
return /*#__PURE__*/React.createElement(Calendar, _extends({}, extendedProps, {
|
|
53
|
+
// flowlint-next-line unclear-type:off
|
|
54
|
+
onChange: extendedProps.onChange
|
|
55
|
+
}));
|
|
51
56
|
});
|
|
52
57
|
}
|
|
53
58
|
}]);
|
|
@@ -58,8 +58,29 @@ var StatefulContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
58
58
|
value: date
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
var onChange = _this.props.onChange;
|
|
62
|
+
|
|
63
|
+
if (onChange) {
|
|
64
|
+
if (Array.isArray(date)) {
|
|
65
|
+
if (date.every(Boolean)) {
|
|
66
|
+
// flowlint-next-line unclear-type:off
|
|
67
|
+
onChange({
|
|
68
|
+
date: date
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
onChange({
|
|
73
|
+
date: date
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
var onRangeChange = _this.props.onRangeChange;
|
|
79
|
+
|
|
80
|
+
if (onRangeChange) {
|
|
81
|
+
onRangeChange({
|
|
82
|
+
date: date
|
|
83
|
+
});
|
|
63
84
|
}
|
|
64
85
|
});
|
|
65
86
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
2
|
|
|
3
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
4
|
+
|
|
3
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
6
|
|
|
5
7
|
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); } }
|
|
@@ -47,7 +49,10 @@ var StatefulComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
47
49
|
key: "render",
|
|
48
50
|
value: function render() {
|
|
49
51
|
return /*#__PURE__*/React.createElement(StatefulContainer, this.props, function (extendedProps) {
|
|
50
|
-
return /*#__PURE__*/React.createElement(Datepicker, extendedProps
|
|
52
|
+
return /*#__PURE__*/React.createElement(Datepicker, _extends({}, extendedProps, {
|
|
53
|
+
// flowlint-next-line unclear-type:off
|
|
54
|
+
onChange: extendedProps.onChange
|
|
55
|
+
}));
|
|
51
56
|
});
|
|
52
57
|
}
|
|
53
58
|
}]);
|
|
@@ -86,7 +86,7 @@ var DateHelpers = function DateHelpers(_adapter) {
|
|
|
86
86
|
var UtilsClass = adapter.constructor;
|
|
87
87
|
var className = adapter.constructor.name; // This ensures that if the adapter class isn't
|
|
88
88
|
// supported it just falls back the default formats
|
|
89
|
-
// NOTE: in e2e tests
|
|
89
|
+
// NOTE: in e2e tests playwright seems to add
|
|
90
90
|
// a JSHandle wrapping class to all objects
|
|
91
91
|
// so className always resolves to JSHandle:e
|
|
92
92
|
// and if falls back to the default
|
|
@@ -17,7 +17,9 @@ This source code is licensed under the MIT license found in the
|
|
|
17
17
|
LICENSE file in the root directory of this source tree.
|
|
18
18
|
*/
|
|
19
19
|
import * as React from 'react';
|
|
20
|
-
import
|
|
20
|
+
import ArrowLeft from '../icon/arrow-left.js';
|
|
21
|
+
import ArrowRight from '../icon/arrow-right.js';
|
|
22
|
+
import Check from '../icon/check.js';
|
|
21
23
|
import { Button, KIND, SHAPE } from '../button/index.js';
|
|
22
24
|
import { useStyletron } from '../styles/index.js';
|
|
23
25
|
export function HelperSteps(_ref) {
|
package/esm/input/base-input.js
CHANGED
|
@@ -85,7 +85,7 @@ var BaseInput = /*#__PURE__*/function (_React$Component) {
|
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
_defineProperty(_assertThisInitialized(_this), "onInputKeyDown", function (e) {
|
|
88
|
-
if (_this.props.clearOnEscape && e.key === 'Escape' && _this.inputRef.current) {
|
|
88
|
+
if (_this.props.clearOnEscape && e.key === 'Escape' && _this.inputRef.current && !_this.props.readOnly) {
|
|
89
89
|
_this.clearValue(); // prevent event from closing modal or doing something unexpected
|
|
90
90
|
|
|
91
91
|
|
|
@@ -100,19 +100,23 @@ var BaseInput = /*#__PURE__*/function (_React$Component) {
|
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
_defineProperty(_assertThisInitialized(_this), "onFocus", function (e) {
|
|
103
|
-
_this.
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
if (!_this.props.readOnly) {
|
|
104
|
+
_this.setState({
|
|
105
|
+
isFocused: true
|
|
106
|
+
});
|
|
106
107
|
|
|
107
|
-
|
|
108
|
+
_this.props.onFocus(e);
|
|
109
|
+
}
|
|
108
110
|
});
|
|
109
111
|
|
|
110
112
|
_defineProperty(_assertThisInitialized(_this), "onBlur", function (e) {
|
|
111
|
-
_this.
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
if (!_this.props.readOnly) {
|
|
114
|
+
_this.setState({
|
|
115
|
+
isFocused: false
|
|
116
|
+
});
|
|
114
117
|
|
|
115
|
-
|
|
118
|
+
_this.props.onBlur(e);
|
|
119
|
+
}
|
|
116
120
|
});
|
|
117
121
|
|
|
118
122
|
_defineProperty(_assertThisInitialized(_this), "handleFocusForMaskToggle", function (event) {
|
|
@@ -267,10 +271,11 @@ var BaseInput = /*#__PURE__*/function (_React$Component) {
|
|
|
267
271
|
clearable = _this$props2.clearable,
|
|
268
272
|
value = _this$props2.value,
|
|
269
273
|
disabled = _this$props2.disabled,
|
|
274
|
+
readOnly = _this$props2.readOnly,
|
|
270
275
|
_this$props2$override = _this$props2.overrides,
|
|
271
276
|
overrides = _this$props2$override === void 0 ? {} : _this$props2$override;
|
|
272
277
|
|
|
273
|
-
if (disabled || !clearable || value == null || typeof value === 'string' && value.length === 0) {
|
|
278
|
+
if (disabled || readOnly || !clearable || value == null || typeof value === 'string' && value.length === 0) {
|
|
274
279
|
return null;
|
|
275
280
|
}
|
|
276
281
|
|
|
@@ -360,6 +365,7 @@ var BaseInput = /*#__PURE__*/function (_React$Component) {
|
|
|
360
365
|
"aria-required": this.props.required,
|
|
361
366
|
autoComplete: autoComplete,
|
|
362
367
|
disabled: this.props.disabled,
|
|
368
|
+
readOnly: this.props.readOnly,
|
|
363
369
|
id: this.props.id,
|
|
364
370
|
inputMode: this.props.inputMode,
|
|
365
371
|
maxLength: this.props.maxLength,
|
|
@@ -419,7 +425,8 @@ _defineProperty(BaseInput, "defaultProps", {
|
|
|
419
425
|
required: false,
|
|
420
426
|
role: null,
|
|
421
427
|
size: SIZE.default,
|
|
422
|
-
type: 'text'
|
|
428
|
+
type: 'text',
|
|
429
|
+
readOnly: false
|
|
423
430
|
});
|
|
424
431
|
|
|
425
432
|
export default BaseInput;
|
package/esm/input/input.js
CHANGED
|
@@ -70,23 +70,27 @@ var Input = /*#__PURE__*/function (_React$Component) {
|
|
|
70
70
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
71
71
|
|
|
72
72
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
73
|
-
isFocused: _this.props.autoFocus || false
|
|
73
|
+
isFocused: _this.props.autoFocus && !_this.props.readOnly || false
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
_defineProperty(_assertThisInitialized(_this), "onFocus", function (e) {
|
|
77
|
-
_this.
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
if (!_this.props.readOnly) {
|
|
78
|
+
_this.setState({
|
|
79
|
+
isFocused: true
|
|
80
|
+
});
|
|
80
81
|
|
|
81
|
-
|
|
82
|
+
_this.props.onFocus(e);
|
|
83
|
+
}
|
|
82
84
|
});
|
|
83
85
|
|
|
84
86
|
_defineProperty(_assertThisInitialized(_this), "onBlur", function (e) {
|
|
85
|
-
_this.
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
if (!_this.props.readOnly) {
|
|
88
|
+
_this.setState({
|
|
89
|
+
isFocused: false
|
|
90
|
+
});
|
|
88
91
|
|
|
89
|
-
|
|
92
|
+
_this.props.onBlur(e);
|
|
93
|
+
}
|
|
90
94
|
});
|
|
91
95
|
|
|
92
96
|
return _this;
|
|
@@ -163,7 +167,8 @@ _defineProperty(Input, "defaultProps", {
|
|
|
163
167
|
startEnhancer: null,
|
|
164
168
|
endEnhancer: null,
|
|
165
169
|
clearable: false,
|
|
166
|
-
type: 'text'
|
|
170
|
+
type: 'text',
|
|
171
|
+
readOnly: false
|
|
167
172
|
});
|
|
168
173
|
|
|
169
174
|
function getAdjoinedProp(startEnhancer, endEnhancer) {
|
|
@@ -32,14 +32,16 @@ var MaskOverride = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
32
32
|
onBlur = _ref.onBlur,
|
|
33
33
|
value = _ref.value,
|
|
34
34
|
disabled = _ref.disabled,
|
|
35
|
-
|
|
35
|
+
readOnly = _ref.readOnly,
|
|
36
|
+
restProps = _objectWithoutProperties(_ref, ["startEnhancer", "endEnhancer", "error", "positive", "onChange", "onFocus", "onBlur", "value", "disabled", "readOnly"]);
|
|
36
37
|
|
|
37
38
|
return /*#__PURE__*/React.createElement(InputMask, _extends({
|
|
38
39
|
onChange: onChange,
|
|
39
40
|
onFocus: onFocus,
|
|
40
41
|
onBlur: onBlur,
|
|
41
42
|
value: value,
|
|
42
|
-
disabled: disabled
|
|
43
|
+
disabled: disabled,
|
|
44
|
+
readOnly: readOnly
|
|
43
45
|
}, restProps), function (props) {
|
|
44
46
|
return /*#__PURE__*/React.createElement(StyledInput, _extends({
|
|
45
47
|
ref: ref,
|
|
@@ -47,7 +49,8 @@ var MaskOverride = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
47
49
|
onFocus: onFocus,
|
|
48
50
|
onBlur: onBlur,
|
|
49
51
|
value: value,
|
|
50
|
-
disabled: disabled
|
|
52
|
+
disabled: disabled,
|
|
53
|
+
readOnly: readOnly
|
|
51
54
|
}, props));
|
|
52
55
|
});
|
|
53
56
|
});
|
package/esm/input/utils.js
CHANGED
|
@@ -10,7 +10,8 @@ export function getSharedProps(props, state) {
|
|
|
10
10
|
positive = props.positive,
|
|
11
11
|
adjoined = props.adjoined,
|
|
12
12
|
size = props.size,
|
|
13
|
-
required = props.required
|
|
13
|
+
required = props.required,
|
|
14
|
+
readOnly = props.readOnly;
|
|
14
15
|
var isFocused = state.isFocused;
|
|
15
16
|
return {
|
|
16
17
|
$isFocused: isFocused,
|
|
@@ -19,6 +20,7 @@ export function getSharedProps(props, state) {
|
|
|
19
20
|
$positive: positive,
|
|
20
21
|
$adjoined: adjoined,
|
|
21
22
|
$size: size,
|
|
22
|
-
$required: required
|
|
23
|
+
$required: required,
|
|
24
|
+
$isReadOnly: readOnly
|
|
23
25
|
};
|
|
24
26
|
}
|