baseui 10.7.2 → 10.9.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/a11y.js +2 -2
- package/a11y/a11y.js.flow +3 -3
- package/button/styled-components.js +47 -18
- package/button/styled-components.js.flow +25 -5
- package/combobox/combobox.js +6 -3
- package/combobox/combobox.js.flow +4 -2
- package/combobox/types.js.flow +2 -0
- package/data-table/column-categorical.js +1 -1
- package/data-table/column-categorical.js.flow +2 -2
- package/data-table/column-numerical.js +307 -355
- package/data-table/column-numerical.js.flow +273 -287
- package/data-table/constants.js +17 -11
- package/data-table/constants.js.flow +11 -8
- package/data-table/data-table.js +53 -50
- package/data-table/data-table.js.flow +18 -13
- package/data-table/filter-shell.js +27 -4
- package/data-table/filter-shell.js.flow +33 -9
- package/data-table/locale.js +4 -2
- package/data-table/locale.js.flow +6 -2
- package/data-table/measure-column-widths.js +83 -121
- package/data-table/measure-column-widths.js.flow +87 -109
- package/datepicker/styled-components.js +1 -1
- package/datepicker/styled-components.js.flow +4 -1
- package/drawer/drawer.js +3 -1
- package/drawer/drawer.js.flow +7 -1
- package/es/a11y/a11y.js +2 -2
- package/es/button/styled-components.js +32 -2
- package/es/combobox/combobox.js +6 -3
- package/es/data-table/column-categorical.js +2 -2
- package/es/data-table/column-numerical.js +245 -317
- package/es/data-table/constants.js +12 -8
- package/es/data-table/data-table.js +18 -16
- package/es/data-table/filter-shell.js +26 -4
- package/es/data-table/locale.js +4 -2
- package/es/data-table/measure-column-widths.js +75 -86
- package/es/datepicker/styled-components.js +1 -1
- package/es/drawer/drawer.js +3 -1
- package/es/index.js +1 -1
- package/es/map-marker/badge-enhancer.js +61 -0
- package/es/map-marker/constants.js +146 -2
- package/es/map-marker/drag-shadow.js +32 -0
- package/es/map-marker/fixed-marker.js +54 -48
- package/es/map-marker/floating-marker.js +21 -12
- package/es/map-marker/index.js +1 -1
- package/es/map-marker/label-enhancer.js +39 -0
- package/es/map-marker/needle.js +26 -0
- package/es/map-marker/pin-head.js +42 -40
- package/es/map-marker/styled-components.js +177 -32
- package/es/map-marker/types.js +1 -1
- package/es/menu/maybe-child-menu.js +0 -2
- package/es/menu/nested-menus.js +49 -3
- package/es/menu/stateful-container.js +13 -12
- package/es/modal/modal.js +3 -1
- package/es/popover/popover.js +7 -3
- package/es/progress-bar/index.js +1 -1
- package/es/progress-bar/progressbar.js +25 -10
- package/es/progress-bar/styled-components.js +9 -5
- package/es/select/select-component.js +2 -10
- package/es/spinner/styled-components.js +34 -16
- package/es/table/filter.js +3 -1
- package/es/themes/dark-theme/color-component-tokens.js +19 -10
- package/es/themes/light-theme/color-component-tokens.js +19 -10
- package/es/timezonepicker/timezone-picker.js +53 -36
- package/es/timezonepicker/tzdata.js +2 -0
- package/es/timezonepicker/update-tzdata.js +69 -0
- package/es/toast/styled-components.js +18 -7
- package/esm/a11y/a11y.js +3 -3
- package/esm/button/styled-components.js +47 -18
- package/esm/combobox/combobox.js +6 -3
- package/esm/data-table/column-categorical.js +2 -2
- package/esm/data-table/column-numerical.js +304 -353
- package/esm/data-table/constants.js +12 -8
- package/esm/data-table/data-table.js +53 -50
- package/esm/data-table/filter-shell.js +26 -4
- package/esm/data-table/locale.js +4 -2
- package/esm/data-table/measure-column-widths.js +83 -121
- package/esm/datepicker/styled-components.js +1 -1
- package/esm/drawer/drawer.js +3 -1
- package/esm/index.js +1 -1
- package/esm/map-marker/badge-enhancer.js +79 -0
- package/esm/map-marker/constants.js +94 -4
- package/esm/map-marker/drag-shadow.js +53 -0
- package/esm/map-marker/fixed-marker.js +84 -80
- package/esm/map-marker/floating-marker.js +22 -13
- package/esm/map-marker/index.js +1 -1
- package/esm/map-marker/label-enhancer.js +60 -0
- package/esm/map-marker/needle.js +43 -0
- package/esm/map-marker/pin-head.js +77 -66
- package/esm/map-marker/styled-components.js +182 -51
- package/esm/map-marker/types.js +1 -1
- package/esm/menu/maybe-child-menu.js +0 -2
- package/esm/menu/nested-menus.js +66 -5
- package/esm/menu/stateful-container.js +15 -13
- package/esm/modal/modal.js +3 -1
- package/esm/popover/popover.js +7 -3
- package/esm/progress-bar/index.js +1 -1
- package/esm/progress-bar/progressbar.js +32 -10
- package/esm/progress-bar/styled-components.js +9 -4
- package/esm/select/select-component.js +2 -11
- package/esm/spinner/styled-components.js +35 -16
- package/esm/table/filter.js +3 -1
- package/esm/themes/dark-theme/color-component-tokens.js +19 -10
- package/esm/themes/light-theme/color-component-tokens.js +19 -10
- package/esm/timezonepicker/timezone-picker.js +64 -36
- package/esm/timezonepicker/tzdata.js +2 -0
- package/esm/timezonepicker/update-tzdata.js +160 -0
- package/esm/toast/styled-components.js +13 -5
- package/index.js +6 -0
- package/index.js.flow +1 -1
- package/map-marker/badge-enhancer.js +90 -0
- package/map-marker/badge-enhancer.js.flow +86 -0
- package/map-marker/constants.js +103 -5
- package/map-marker/constants.js.flow +152 -0
- package/map-marker/drag-shadow.js +64 -0
- package/map-marker/drag-shadow.js.flow +52 -0
- package/map-marker/fixed-marker.js +84 -78
- package/map-marker/fixed-marker.js.flow +78 -66
- package/map-marker/floating-marker.js +22 -13
- package/map-marker/floating-marker.js.flow +30 -17
- package/map-marker/index.d.ts +125 -24
- package/map-marker/index.js +18 -0
- package/map-marker/index.js.flow +3 -0
- package/map-marker/label-enhancer.js +71 -0
- package/map-marker/label-enhancer.js.flow +63 -0
- package/map-marker/needle.js +54 -0
- package/map-marker/needle.js.flow +29 -0
- package/map-marker/pin-head.js +80 -69
- package/map-marker/pin-head.js.flow +122 -84
- package/map-marker/styled-components.js +200 -62
- package/map-marker/styled-components.js.flow +172 -22
- package/map-marker/types.js.flow +69 -20
- package/menu/index.d.ts +9 -4
- package/menu/maybe-child-menu.js +0 -2
- package/menu/maybe-child-menu.js.flow +0 -2
- package/menu/nested-menus.js +66 -5
- package/menu/nested-menus.js.flow +50 -5
- package/menu/stateful-container.js +15 -13
- package/menu/stateful-container.js.flow +19 -13
- package/menu/types.js.flow +7 -1
- package/modal/modal.js +3 -1
- package/modal/modal.js.flow +2 -0
- package/package.json +5 -4
- package/popover/popover.js +7 -3
- package/popover/popover.js.flow +23 -17
- package/progress-bar/index.d.ts +2 -0
- package/progress-bar/index.js +6 -0
- package/progress-bar/index.js.flow +1 -0
- package/progress-bar/progressbar.js +32 -10
- package/progress-bar/progressbar.js.flow +35 -9
- package/progress-bar/styled-components.js +9 -4
- package/progress-bar/styled-components.js.flow +15 -4
- package/progress-bar/types.js.flow +12 -2
- package/select/select-component.js +2 -11
- package/select/select-component.js.flow +5 -7
- package/spinner/styled-components.js +35 -16
- package/spinner/styled-components.js.flow +37 -19
- package/spinner/types.js.flow +10 -0
- package/styles/index.js.flow +1 -1
- package/table/filter.js +3 -1
- package/table/filter.js.flow +5 -1
- package/themes/dark-theme/color-component-tokens.js +19 -10
- package/themes/dark-theme/color-component-tokens.js.flow +19 -10
- package/themes/light-theme/color-component-tokens.js +19 -10
- package/themes/light-theme/color-component-tokens.js.flow +19 -10
- package/themes/types.js.flow +9 -0
- package/timezonepicker/timezone-picker.js +69 -41
- package/timezonepicker/timezone-picker.js.flow +52 -46
- package/timezonepicker/types.js.flow +1 -1
- package/timezonepicker/tzdata.js +10 -0
- package/timezonepicker/tzdata.js.flow +347 -0
- package/timezonepicker/update-tzdata.js +164 -0
- package/timezonepicker/update-tzdata.js.flow +70 -0
- package/toast/styled-components.js +13 -5
- package/toast/styled-components.js.flow +17 -7
|
@@ -70,6 +70,10 @@ var DEFAULT_PROPS = {
|
|
|
70
70
|
removeMenuFromNesting: function removeMenuFromNesting() {},
|
|
71
71
|
getParentMenu: function getParentMenu() {},
|
|
72
72
|
getChildMenu: function getChildMenu() {},
|
|
73
|
+
nestedMenuHoverIndex: -1,
|
|
74
|
+
isNestedMenuVisible: function isNestedMenuVisible() {
|
|
75
|
+
return false;
|
|
76
|
+
},
|
|
73
77
|
forceHighlight: false
|
|
74
78
|
};
|
|
75
79
|
|
|
@@ -276,17 +280,7 @@ var MenuStatefulContainerInner = /*#__PURE__*/function (_React$Component) {
|
|
|
276
280
|
});
|
|
277
281
|
});
|
|
278
282
|
|
|
279
|
-
_defineProperty(_assertThisInitialized(_this), "handleMouseLeave", function () {
|
|
280
|
-
var rootRef = _this.props.rootRef ? _this.props.rootRef : _this.rootRef;
|
|
281
|
-
|
|
282
|
-
var childMenu = _this.props.getChildMenu && _this.props.getChildMenu(rootRef);
|
|
283
|
-
|
|
284
|
-
if (!_this.props.forceHighlight && !childMenu) {
|
|
285
|
-
_this.internalSetState(STATE_CHANGE_TYPES.mouseLeave, {
|
|
286
|
-
highlightedIndex: -1
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
});
|
|
283
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseLeave", function (event) {});
|
|
290
284
|
|
|
291
285
|
_defineProperty(_assertThisInitialized(_this), "getRequiredItemProps", function (item, index) {
|
|
292
286
|
var itemRef = _this.refList[index];
|
|
@@ -397,11 +391,13 @@ var MenuStatefulContainerInner = /*#__PURE__*/function (_React$Component) {
|
|
|
397
391
|
if (this.keyboardControlNode) this.keyboardControlNode.removeEventListener('keydown', this.onKeyDown);
|
|
398
392
|
}
|
|
399
393
|
|
|
400
|
-
|
|
394
|
+
if (this.props.removeMenuFromNesting) {
|
|
395
|
+
this.props.removeMenuFromNesting(rootRef);
|
|
396
|
+
}
|
|
401
397
|
}
|
|
402
398
|
}, {
|
|
403
399
|
key: "componentDidUpdate",
|
|
404
|
-
value: function componentDidUpdate(
|
|
400
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
405
401
|
if (typeof document !== 'undefined') {
|
|
406
402
|
if (!prevState.isFocused && this.state.isFocused) {
|
|
407
403
|
if (this.keyboardControlNode) this.keyboardControlNode.addEventListener('keydown', this.onKeyDown);
|
|
@@ -427,6 +423,12 @@ var MenuStatefulContainerInner = /*#__PURE__*/function (_React$Component) {
|
|
|
427
423
|
highlightedIndex: 0
|
|
428
424
|
});
|
|
429
425
|
}
|
|
426
|
+
|
|
427
|
+
if (this.props.isNestedMenuVisible && this.props.nestedMenuHoverIndex !== prevProps.nestedMenuHoverIndex && !this.props.isNestedMenuVisible(this.rootRef) && !this.props.forceHighlight) {
|
|
428
|
+
this.setState({
|
|
429
|
+
highlightedIndex: -1
|
|
430
|
+
});
|
|
431
|
+
}
|
|
430
432
|
} // One array to hold all of list item refs
|
|
431
433
|
|
|
432
434
|
}, {
|
package/esm/modal/modal.js
CHANGED
|
@@ -372,7 +372,9 @@ var Modal = /*#__PURE__*/function (_React$Component) {
|
|
|
372
372
|
} : {};
|
|
373
373
|
return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, function (locale) {
|
|
374
374
|
return /*#__PURE__*/React.createElement(FocusLock, {
|
|
375
|
-
disabled: !focusLock
|
|
375
|
+
disabled: !focusLock // Allow focus to escape when UI is within an iframe
|
|
376
|
+
,
|
|
377
|
+
crossFrame: false,
|
|
376
378
|
returnFocus: returnFocus,
|
|
377
379
|
autoFocus: autofocus !== null ? autofocus : autoFocus
|
|
378
380
|
}, /*#__PURE__*/React.createElement(Root, _extends({
|
package/esm/popover/popover.js
CHANGED
|
@@ -510,14 +510,18 @@ var PopoverInner = /*#__PURE__*/function (_React$Component) {
|
|
|
510
510
|
popperOptions: _objectSpread(_objectSpread({}, defaultPopperOptions), this.props.popperOptions),
|
|
511
511
|
onPopperUpdate: this.onPopperUpdate,
|
|
512
512
|
placement: this.state.placement
|
|
513
|
-
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
513
|
+
}, this.props.focusLock ? /*#__PURE__*/React.createElement(FocusLock, {
|
|
514
514
|
disabled: !this.props.focusLock,
|
|
515
515
|
noFocusGuards: false // see popover-focus-loop.scenario.js for why hover cannot return focus
|
|
516
516
|
,
|
|
517
517
|
returnFocus: !this.isHoverTrigger() && this.props.returnFocus,
|
|
518
|
-
autoFocus: this.state.autoFocusAfterPositioning
|
|
518
|
+
autoFocus: this.state.autoFocusAfterPositioning // Allow focus to escape when UI is within an iframe
|
|
519
|
+
,
|
|
520
|
+
crossFrame: false,
|
|
519
521
|
focusOptions: this.props.focusOptions
|
|
520
|
-
},
|
|
522
|
+
}, this.renderPopover(renderedContent)) : /*#__PURE__*/React.createElement(MoveFocusInside, {
|
|
523
|
+
disabled: !this.props.autoFocus && !this.state.autoFocusAfterPositioning
|
|
524
|
+
}, this.renderPopover(renderedContent)))));
|
|
521
525
|
} else {
|
|
522
526
|
rendered.push( /*#__PURE__*/React.createElement(Hidden, {
|
|
523
527
|
key: "hidden-layer"
|
|
@@ -8,4 +8,4 @@ export { default as ProgressBar } from './progressbar.js';
|
|
|
8
8
|
export { default as ProgressBarRounded } from './progressbar-rounded.js';
|
|
9
9
|
export { SIZE } from './constants.js'; // Styled elements
|
|
10
10
|
|
|
11
|
-
export { StyledRoot, StyledBarContainer, StyledBar, StyledBarProgress, StyledLabel, StyledProgressBarRoundedRoot, StyledProgressBarRoundedSvg, StyledProgressBarRoundedTrackBackground, StyledProgressBarRoundedTrackForeground, StyledProgressBarRoundedText } from './styled-components.js'; // Flow
|
|
11
|
+
export { StyledRoot, StyledBarContainer, StyledBar, StyledBarProgress, StyledInfiniteBar, StyledLabel, StyledProgressBarRoundedRoot, StyledProgressBarRoundedSvg, StyledProgressBarRoundedTrackBackground, StyledProgressBarRoundedTrackForeground, StyledProgressBarRoundedText } from './styled-components.js'; // Flow
|
|
@@ -14,6 +14,10 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
|
|
|
14
14
|
|
|
15
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
16
|
|
|
17
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
18
|
+
|
|
19
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
|
+
|
|
17
21
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
18
22
|
|
|
19
23
|
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); } }
|
|
@@ -80,9 +84,16 @@ var ProgressBar = /*#__PURE__*/function (_React$Component) {
|
|
|
80
84
|
size = _this$props.size,
|
|
81
85
|
steps = _this$props.steps,
|
|
82
86
|
successValue = _this$props.successValue,
|
|
87
|
+
minValue = _this$props.minValue,
|
|
88
|
+
maxValue = _this$props.maxValue,
|
|
83
89
|
showLabel = _this$props.showLabel,
|
|
84
90
|
infinite = _this$props.infinite,
|
|
85
|
-
errorMessage = _this$props.errorMessage
|
|
91
|
+
errorMessage = _this$props.errorMessage,
|
|
92
|
+
forwardedRef = _this$props.forwardedRef,
|
|
93
|
+
restProps = _objectWithoutProperties(_this$props, ["ariaLabel", "overrides", "getProgressLabel", "value", "size", "steps", "successValue", "minValue", "maxValue", "showLabel", "infinite", "errorMessage", "forwardedRef"]); // fallback on successValue (and it's default) if maxValue is not set by user
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
var maximumValue = maxValue !== 100 ? maxValue : successValue;
|
|
86
97
|
|
|
87
98
|
var _getOverrides = getOverrides(overrides.Root, StyledRoot),
|
|
88
99
|
_getOverrides2 = _slicedToArray(_getOverrides, 2),
|
|
@@ -118,7 +129,9 @@ var ProgressBar = /*#__PURE__*/function (_React$Component) {
|
|
|
118
129
|
$infinite: infinite,
|
|
119
130
|
$size: size,
|
|
120
131
|
$steps: steps,
|
|
121
|
-
$successValue:
|
|
132
|
+
$successValue: maximumValue,
|
|
133
|
+
$minValue: minValue,
|
|
134
|
+
$maxValue: maximumValue,
|
|
122
135
|
$value: value
|
|
123
136
|
};
|
|
124
137
|
|
|
@@ -140,20 +153,21 @@ var ProgressBar = /*#__PURE__*/function (_React$Component) {
|
|
|
140
153
|
/*#__PURE__*/
|
|
141
154
|
// eslint-disable-next-line jsx-a11y/role-supports-aria-props
|
|
142
155
|
React.createElement(Root, _extends({
|
|
156
|
+
ref: forwardedRef,
|
|
143
157
|
"data-baseweb": "progress-bar",
|
|
144
158
|
role: "progressbar",
|
|
145
|
-
"aria-label": ariaLabel || getProgressLabel(value,
|
|
159
|
+
"aria-label": ariaLabel || getProgressLabel(value, maximumValue, minValue),
|
|
146
160
|
"aria-valuenow": infinite ? null : value,
|
|
147
|
-
"aria-valuemin": infinite ? null :
|
|
148
|
-
"aria-valuemax": infinite ? null :
|
|
161
|
+
"aria-valuemin": infinite ? null : minValue,
|
|
162
|
+
"aria-valuemax": infinite ? null : maximumValue,
|
|
149
163
|
"aria-invalid": errorMessage ? true : null,
|
|
150
164
|
"aria-errormessage": errorMessage
|
|
151
|
-
}, sharedProps, rootProps), /*#__PURE__*/React.createElement(BarContainer, _extends({}, sharedProps, barContainerProps), infinite ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfiniteBar, _extends({
|
|
165
|
+
}, restProps, sharedProps, rootProps), /*#__PURE__*/React.createElement(BarContainer, _extends({}, sharedProps, barContainerProps), infinite ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfiniteBar, _extends({
|
|
152
166
|
$isLeft: true,
|
|
153
167
|
$size: sharedProps.$size
|
|
154
168
|
}, infiniteBarProps)), /*#__PURE__*/React.createElement(InfiniteBar, _extends({
|
|
155
169
|
$size: sharedProps.$size
|
|
156
|
-
}, infiniteBarProps))) : renderProgressBar()), showLabel && /*#__PURE__*/React.createElement(Label, _extends({}, sharedProps, labelProps), getProgressLabel(value,
|
|
170
|
+
}, infiniteBarProps))) : renderProgressBar()), showLabel && /*#__PURE__*/React.createElement(Label, _extends({}, sharedProps, labelProps), getProgressLabel(value, maximumValue, minValue)))
|
|
157
171
|
);
|
|
158
172
|
}
|
|
159
173
|
}]);
|
|
@@ -162,8 +176,8 @@ var ProgressBar = /*#__PURE__*/function (_React$Component) {
|
|
|
162
176
|
}(React.Component);
|
|
163
177
|
|
|
164
178
|
_defineProperty(ProgressBar, "defaultProps", {
|
|
165
|
-
getProgressLabel: function getProgressLabel(value,
|
|
166
|
-
return "".concat(Math.round(value /
|
|
179
|
+
getProgressLabel: function getProgressLabel(value, maxValue, minValue) {
|
|
180
|
+
return "".concat(Math.round((value - minValue) / (maxValue - minValue) * 100), "% Loaded");
|
|
167
181
|
},
|
|
168
182
|
infinite: false,
|
|
169
183
|
overrides: {},
|
|
@@ -171,7 +185,15 @@ _defineProperty(ProgressBar, "defaultProps", {
|
|
|
171
185
|
size: SIZE.medium,
|
|
172
186
|
steps: 1,
|
|
173
187
|
successValue: 100,
|
|
188
|
+
minValue: 0,
|
|
189
|
+
maxValue: 100,
|
|
174
190
|
value: 0
|
|
175
191
|
});
|
|
176
192
|
|
|
177
|
-
|
|
193
|
+
var ForwardedProgressBar = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
194
|
+
return /*#__PURE__*/React.createElement(ProgressBar, _extends({
|
|
195
|
+
forwardedRef: ref
|
|
196
|
+
}, props));
|
|
197
|
+
});
|
|
198
|
+
ForwardedProgressBar.displayName = 'ProgressBar';
|
|
199
|
+
export default ForwardedProgressBar;
|
|
@@ -72,11 +72,16 @@ export var StyledBarProgress = styled('div', function (props) {
|
|
|
72
72
|
$value = props.$value,
|
|
73
73
|
$successValue = props.$successValue,
|
|
74
74
|
$steps = props.$steps,
|
|
75
|
-
$index = props.$index
|
|
75
|
+
$index = props.$index,
|
|
76
|
+
$maxValue = props.$maxValue,
|
|
77
|
+
_props$$minValue = props.$minValue,
|
|
78
|
+
$minValue = _props$$minValue === void 0 ? 0 : _props$$minValue; // making sure this doesn't break existing use that use StyledBarProgress directly
|
|
79
|
+
|
|
80
|
+
var maxValue = $maxValue ? $maxValue : $successValue;
|
|
76
81
|
var colors = $theme.colors,
|
|
77
82
|
sizing = $theme.sizing,
|
|
78
83
|
borders = $theme.borders;
|
|
79
|
-
var width = "".concat(100 - $value
|
|
84
|
+
var width = "".concat(100 - ($value - $minValue) * 100 / (maxValue - $minValue), "%");
|
|
80
85
|
var stepStates = {
|
|
81
86
|
default: 'default',
|
|
82
87
|
awaits: 'awaits',
|
|
@@ -86,8 +91,8 @@ export var StyledBarProgress = styled('div', function (props) {
|
|
|
86
91
|
var stepState = stepStates.default;
|
|
87
92
|
|
|
88
93
|
if ($steps > 1) {
|
|
89
|
-
var stepValue = $
|
|
90
|
-
var currentValue = $value / $
|
|
94
|
+
var stepValue = (maxValue - $minValue) / $steps;
|
|
95
|
+
var currentValue = ($value - $minValue) / (maxValue - $minValue) * 100;
|
|
91
96
|
var completedSteps = Math.floor(currentValue / stepValue);
|
|
92
97
|
|
|
93
98
|
if ($index < completedSteps) {
|
|
@@ -183,12 +183,6 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
183
183
|
_this.handleClick(event);
|
|
184
184
|
});
|
|
185
185
|
|
|
186
|
-
_defineProperty(_assertThisInitialized(_this), "handleTouchEndClearValue", function (event) {
|
|
187
|
-
if (_this.dragging) return;
|
|
188
|
-
|
|
189
|
-
_this.clearValue(event);
|
|
190
|
-
});
|
|
191
|
-
|
|
192
186
|
_defineProperty(_assertThisInitialized(_this), "handleClick", function (event) {
|
|
193
187
|
if (_this.props.disabled || !isClick(event) && !isLeftClick(event)) {
|
|
194
188
|
return;
|
|
@@ -865,7 +859,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
865
859
|
"aria-required": this.props.required || null,
|
|
866
860
|
onFocus: this.handleInputFocus,
|
|
867
861
|
tabIndex: 0
|
|
868
|
-
}, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement("input", {
|
|
862
|
+
}, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement("input", _extends({
|
|
869
863
|
"aria-hidden": true,
|
|
870
864
|
id: this.props.id || null,
|
|
871
865
|
ref: this.handleInputRef,
|
|
@@ -877,7 +871,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
877
871
|
padding: 0
|
|
878
872
|
},
|
|
879
873
|
tabIndex: -1
|
|
880
|
-
}));
|
|
874
|
+
}, overrides.Input ? overrides.Input.props ? overrides.Input.props : {} : {})));
|
|
881
875
|
}
|
|
882
876
|
|
|
883
877
|
return /*#__PURE__*/React.createElement(InputContainer, _extends({}, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement(AutosizeInput, _extends({
|
|
@@ -929,9 +923,6 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
929
923
|
title: ariaLabel,
|
|
930
924
|
"aria-label": ariaLabel,
|
|
931
925
|
onClick: this.clearValue,
|
|
932
|
-
onTouchEnd: this.handleTouchEndClearValue,
|
|
933
|
-
onTouchMove: this.handleTouchMove,
|
|
934
|
-
onTouchStart: this.handleTouchStart,
|
|
935
926
|
role: "button",
|
|
936
927
|
overrides: {
|
|
937
928
|
Svg: {
|
|
@@ -54,13 +54,40 @@ export var StyledActivePath = styled('path', function (props) {
|
|
|
54
54
|
StyledActivePath.displayName = "StyledActivePath";
|
|
55
55
|
export var StyledSpinnerNext = styled('i', function (_ref) {
|
|
56
56
|
var $theme = _ref.$theme,
|
|
57
|
+
_ref$$color = _ref.$color,
|
|
58
|
+
$color = _ref$$color === void 0 ? $theme.colors.contentAccent : _ref$$color,
|
|
59
|
+
$borderWidth = _ref.$borderWidth,
|
|
57
60
|
_ref$$size = _ref.$size,
|
|
58
61
|
$size = _ref$$size === void 0 ? SIZE.medium : _ref$$size;
|
|
59
|
-
|
|
62
|
+
//$FlowFixMe
|
|
63
|
+
var borderSize = {
|
|
60
64
|
large: $theme.sizing.scale300,
|
|
61
65
|
medium: $theme.sizing.scale100,
|
|
62
66
|
small: $theme.sizing.scale0
|
|
67
|
+
}[$borderWidth || $size];
|
|
68
|
+
var boxSize = {
|
|
69
|
+
large: $theme.sizing.scale1000,
|
|
70
|
+
medium: $theme.sizing.scale900,
|
|
71
|
+
small: $theme.sizing.scale800
|
|
63
72
|
}[$size];
|
|
73
|
+
|
|
74
|
+
if (!borderSize) {
|
|
75
|
+
borderSize = $theme.sizing[$borderWidth];
|
|
76
|
+
|
|
77
|
+
if (!borderSize) {
|
|
78
|
+
borderSize = "".concat(parseInt($borderWidth), "px");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!boxSize) {
|
|
83
|
+
//$FlowFixMe
|
|
84
|
+
boxSize = $theme.sizing[$size];
|
|
85
|
+
|
|
86
|
+
if (!boxSize) {
|
|
87
|
+
boxSize = "".concat(parseInt($size), "px");
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
64
91
|
return {
|
|
65
92
|
display: 'block',
|
|
66
93
|
animationName: spin,
|
|
@@ -72,24 +99,16 @@ export var StyledSpinnerNext = styled('i', function (_ref) {
|
|
|
72
99
|
borderTopStyle: 'solid',
|
|
73
100
|
borderBottomStyle: 'solid',
|
|
74
101
|
borderRadius: '50%',
|
|
75
|
-
borderTopColor: $
|
|
102
|
+
borderTopColor: $color,
|
|
76
103
|
borderRightColor: $theme.colors.backgroundTertiary,
|
|
77
104
|
borderBottomColor: $theme.colors.backgroundTertiary,
|
|
78
105
|
borderLeftColor: $theme.colors.backgroundTertiary,
|
|
79
|
-
borderLeftWidth:
|
|
80
|
-
borderRightWidth:
|
|
81
|
-
borderTopWidth:
|
|
82
|
-
borderBottomWidth:
|
|
83
|
-
width:
|
|
84
|
-
|
|
85
|
-
medium: $theme.sizing.scale900,
|
|
86
|
-
small: $theme.sizing.scale800
|
|
87
|
-
}[$size],
|
|
88
|
-
height: {
|
|
89
|
-
large: $theme.sizing.scale1000,
|
|
90
|
-
medium: $theme.sizing.scale900,
|
|
91
|
-
small: $theme.sizing.scale800
|
|
92
|
-
}[$size],
|
|
106
|
+
borderLeftWidth: borderSize,
|
|
107
|
+
borderRightWidth: borderSize,
|
|
108
|
+
borderTopWidth: borderSize,
|
|
109
|
+
borderBottomWidth: borderSize,
|
|
110
|
+
width: boxSize,
|
|
111
|
+
height: boxSize,
|
|
93
112
|
cursor: 'wait'
|
|
94
113
|
};
|
|
95
114
|
});
|
package/esm/table/filter.js
CHANGED
|
@@ -75,7 +75,9 @@ export default function Filter(props) {
|
|
|
75
75
|
content: function content(_ref) {
|
|
76
76
|
var close = _ref.close;
|
|
77
77
|
return /*#__PURE__*/React.createElement(FocusLock, {
|
|
78
|
-
autoFocus: false
|
|
78
|
+
autoFocus: false // Allow focus to escape when UI is within an iframe
|
|
79
|
+
,
|
|
80
|
+
crossFrame: false
|
|
79
81
|
}, /*#__PURE__*/React.createElement(Heading, headingProps, "Filter Column"), /*#__PURE__*/React.createElement(Content, contentProps, props.children), /*#__PURE__*/React.createElement(Footer, footerProps, /*#__PURE__*/React.createElement(Button, {
|
|
80
82
|
kind: KIND.minimal,
|
|
81
83
|
size: SIZE.compact,
|
|
@@ -38,6 +38,8 @@ export default (function () {
|
|
|
38
38
|
buttonTertiaryActive: themePrimitives.primary600,
|
|
39
39
|
buttonTertiarySelectedText: themePrimitives.primary,
|
|
40
40
|
buttonTertiarySelectedFill: themePrimitives.primary600,
|
|
41
|
+
buttonTertiaryDisabledActiveFill: themePrimitives.primary700,
|
|
42
|
+
buttonTertiaryDisabledActiveText: themePrimitives.mono300,
|
|
41
43
|
buttonTertiarySpinnerForeground: themePrimitives.primary50,
|
|
42
44
|
buttonTertiarySpinnerBackground: themePrimitives.primary500,
|
|
43
45
|
buttonMinimalFill: 'transparent',
|
|
@@ -50,6 +52,8 @@ export default (function () {
|
|
|
50
52
|
buttonMinimalSpinnerBackground: themePrimitives.primary500,
|
|
51
53
|
buttonDisabledFill: themePrimitives.mono600,
|
|
52
54
|
buttonDisabledText: themePrimitives.mono300,
|
|
55
|
+
buttonDisabledActiveFill: themePrimitives.mono200,
|
|
56
|
+
buttonDisabledActiveText: themePrimitives.primary500,
|
|
53
57
|
buttonDisabledSpinnerForeground: themePrimitives.mono200,
|
|
54
58
|
buttonDisabledSpinnerBackground: themePrimitives.mono400,
|
|
55
59
|
// Breadcrumbs
|
|
@@ -108,15 +112,15 @@ export default (function () {
|
|
|
108
112
|
modalCloseColorFocus: themePrimitives.mono400,
|
|
109
113
|
// Notification
|
|
110
114
|
notificationPrimaryBackground: themePrimitives.primary700,
|
|
111
|
-
notificationPrimaryText: themePrimitives.
|
|
115
|
+
notificationPrimaryText: themePrimitives.primaryA,
|
|
112
116
|
notificationInfoBackground: themePrimitives.accent700,
|
|
113
|
-
notificationInfoText: themePrimitives.
|
|
117
|
+
notificationInfoText: themePrimitives.primaryA,
|
|
114
118
|
notificationPositiveBackground: themePrimitives.positive700,
|
|
115
|
-
notificationPositiveText: themePrimitives.
|
|
119
|
+
notificationPositiveText: themePrimitives.primaryA,
|
|
116
120
|
notificationWarningBackground: themePrimitives.warning700,
|
|
117
|
-
notificationWarningText: themePrimitives.
|
|
121
|
+
notificationWarningText: themePrimitives.primaryA,
|
|
118
122
|
notificationNegativeBackground: themePrimitives.negative700,
|
|
119
|
-
notificationNegativeText: themePrimitives.
|
|
123
|
+
notificationNegativeText: themePrimitives.primaryA,
|
|
120
124
|
// Tag
|
|
121
125
|
// Custom ramps
|
|
122
126
|
tagFontDisabledRampUnit: '600',
|
|
@@ -276,11 +280,16 @@ export default (function () {
|
|
|
276
280
|
tableFilterFooterBackground: themePrimitives.mono800,
|
|
277
281
|
// Toast
|
|
278
282
|
toastText: themePrimitives.white,
|
|
279
|
-
toastPrimaryBackground: themePrimitives.
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
283
|
+
toastPrimaryBackground: themePrimitives.primary400,
|
|
284
|
+
toastPrimaryText: themePrimitives.white,
|
|
285
|
+
toastInfoBackground: themePrimitives.accent400,
|
|
286
|
+
toastInfoText: themePrimitives.white,
|
|
287
|
+
toastPositiveBackground: themePrimitives.positive400,
|
|
288
|
+
toastPositiveText: themePrimitives.white,
|
|
289
|
+
toastWarningBackground: themePrimitives.warning400,
|
|
290
|
+
toastWarningText: themePrimitives.black,
|
|
291
|
+
toastNegativeBackground: themePrimitives.negative400,
|
|
292
|
+
toastNegativeText: themePrimitives.white,
|
|
284
293
|
// Toggle
|
|
285
294
|
toggleFill: themePrimitives.mono300,
|
|
286
295
|
toggleFillChecked: themePrimitives.primary,
|
|
@@ -38,6 +38,8 @@ export default (function () {
|
|
|
38
38
|
buttonTertiaryActive: themePrimitives.primary100,
|
|
39
39
|
buttonTertiarySelectedFill: themePrimitives.primary100,
|
|
40
40
|
buttonTertiarySelectedText: themePrimitives.primary,
|
|
41
|
+
buttonTertiaryDisabledActiveFill: themePrimitives.primary50,
|
|
42
|
+
buttonTertiaryDisabledActiveText: themePrimitives.mono600,
|
|
41
43
|
buttonTertiarySpinnerForeground: themePrimitives.accent,
|
|
42
44
|
buttonTertiarySpinnerBackground: themePrimitives.primary100,
|
|
43
45
|
buttonMinimalFill: 'transparent',
|
|
@@ -50,6 +52,8 @@ export default (function () {
|
|
|
50
52
|
buttonMinimalSpinnerBackground: themePrimitives.primary100,
|
|
51
53
|
buttonDisabledFill: themePrimitives.mono200,
|
|
52
54
|
buttonDisabledText: themePrimitives.mono600,
|
|
55
|
+
buttonDisabledActiveFill: themePrimitives.mono700,
|
|
56
|
+
buttonDisabledActiveText: themePrimitives.mono100,
|
|
53
57
|
buttonDisabledSpinnerForeground: themePrimitives.mono600,
|
|
54
58
|
buttonDisabledSpinnerBackground: themePrimitives.mono400,
|
|
55
59
|
// Breadcrumbs
|
|
@@ -184,15 +188,15 @@ export default (function () {
|
|
|
184
188
|
tabColor: themePrimitives.mono800,
|
|
185
189
|
// Notification
|
|
186
190
|
notificationPrimaryBackground: themePrimitives.primary50,
|
|
187
|
-
notificationPrimaryText: themePrimitives.
|
|
191
|
+
notificationPrimaryText: themePrimitives.primaryA,
|
|
188
192
|
notificationInfoBackground: themePrimitives.accent50,
|
|
189
|
-
notificationInfoText: themePrimitives.
|
|
193
|
+
notificationInfoText: themePrimitives.primaryA,
|
|
190
194
|
notificationPositiveBackground: themePrimitives.positive50,
|
|
191
|
-
notificationPositiveText: themePrimitives.
|
|
195
|
+
notificationPositiveText: themePrimitives.primaryA,
|
|
192
196
|
notificationWarningBackground: themePrimitives.warning50,
|
|
193
|
-
notificationWarningText: themePrimitives.
|
|
197
|
+
notificationWarningText: themePrimitives.primaryA,
|
|
194
198
|
notificationNegativeBackground: themePrimitives.negative50,
|
|
195
|
-
notificationNegativeText: themePrimitives.
|
|
199
|
+
notificationNegativeText: themePrimitives.primaryA,
|
|
196
200
|
// Tag
|
|
197
201
|
// Custom ramps
|
|
198
202
|
tagFontDisabledRampUnit: '100',
|
|
@@ -351,11 +355,16 @@ export default (function () {
|
|
|
351
355
|
tableFilterFooterBackground: themePrimitives.mono200,
|
|
352
356
|
// Toast
|
|
353
357
|
toastText: themePrimitives.white,
|
|
354
|
-
toastPrimaryBackground: themePrimitives.
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
358
|
+
toastPrimaryBackground: themePrimitives.primary400,
|
|
359
|
+
toastPrimaryText: themePrimitives.white,
|
|
360
|
+
toastInfoBackground: themePrimitives.accent400,
|
|
361
|
+
toastInfoText: themePrimitives.white,
|
|
362
|
+
toastPositiveBackground: themePrimitives.positive400,
|
|
363
|
+
toastPositiveText: themePrimitives.white,
|
|
364
|
+
toastWarningBackground: themePrimitives.warning400,
|
|
365
|
+
toastWarningText: themePrimitives.black,
|
|
366
|
+
toastNegativeBackground: themePrimitives.negative400,
|
|
367
|
+
toastNegativeText: themePrimitives.white,
|
|
359
368
|
// Spinner
|
|
360
369
|
spinnerTrackFill: themePrimitives.mono900,
|
|
361
370
|
// Progress bar
|
|
@@ -6,14 +6,16 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
6
6
|
|
|
7
7
|
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."); }
|
|
8
8
|
|
|
9
|
-
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); }
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
13
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; }
|
|
14
10
|
|
|
15
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
12
|
|
|
13
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
14
|
+
|
|
15
|
+
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); }
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
|
|
17
19
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
18
20
|
|
|
19
21
|
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); } }
|
|
@@ -44,11 +46,11 @@ LICENSE file in the root directory of this source tree.
|
|
|
44
46
|
*/
|
|
45
47
|
// global Intl
|
|
46
48
|
import * as React from 'react';
|
|
47
|
-
import {
|
|
48
|
-
import { formatZonedTime } from 'timezone-support/dist/parse-format.js';
|
|
49
|
+
import { format, getTimezoneOffset } from 'date-fns-tz';
|
|
49
50
|
import { getOverrides, mergeOverrides } from '../helpers/overrides.js';
|
|
50
51
|
import { LocaleContext } from '../locale/index.js';
|
|
51
52
|
import { Select } from '../select/index.js';
|
|
53
|
+
import { zones } from './tzdata.js';
|
|
52
54
|
|
|
53
55
|
var TimezonePicker = /*#__PURE__*/function (_React$Component) {
|
|
54
56
|
_inherits(TimezonePicker, _React$Component);
|
|
@@ -72,40 +74,56 @@ var TimezonePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
72
74
|
});
|
|
73
75
|
|
|
74
76
|
_defineProperty(_assertThisInitialized(_this), "buildTimezones", function (compareDate) {
|
|
75
|
-
|
|
76
|
-
var timezone = findTimeZone(zone);
|
|
77
|
-
var zonedTime = getZonedTime(compareDate, timezone);
|
|
78
|
-
var offsetTime = (zonedTime.zone.offset < 0 ? '+' : '-') + Math.abs(zonedTime.zone.offset / 60);
|
|
79
|
-
var abbreviation = formatZonedTime(zonedTime, 'z');
|
|
80
|
-
var formatted = "(GMT ".concat(offsetTime, ") ").concat(zone).concat(_this.props.includeAbbreviations ? " - ".concat(abbreviation) : '').replace('_', ' ');
|
|
81
|
-
var option = {
|
|
82
|
-
id: zone,
|
|
83
|
-
label: formatted,
|
|
84
|
-
offset: zonedTime.zone.offset
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
if (_this.props.mapLabels) {
|
|
88
|
-
option.label = _this.props.mapLabels(option);
|
|
89
|
-
}
|
|
77
|
+
var timezones = [];
|
|
90
78
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
.map(function (option) {
|
|
94
|
-
var rgx = /(\s-\s(\+|-)\d\d\d?\d?)$/;
|
|
95
|
-
var matches = option.label.match(rgx);
|
|
79
|
+
var _iterator = _createForOfIteratorHelper(zones),
|
|
80
|
+
_step;
|
|
96
81
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
82
|
+
try {
|
|
83
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
84
|
+
var zoneName = _step.value;
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
var offset = getTimezoneOffset(zoneName, compareDate) / 3600000;
|
|
88
|
+
var offsetFormatted = "".concat(offset >= 0 ? '+' : '-').concat(Math.abs(offset));
|
|
89
|
+
var label = "(GMT".concat(offsetFormatted, ") ").concat(zoneName.replace('_', ' '));
|
|
90
|
+
|
|
91
|
+
if (_this.props.includeAbbreviations) {
|
|
92
|
+
var abbreviation = format(compareDate, 'zzz', {
|
|
93
|
+
timeZone: zoneName
|
|
94
|
+
});
|
|
101
95
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
96
|
+
if (abbreviation) {
|
|
97
|
+
label += " - ".concat(abbreviation);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
timezones.push({
|
|
102
|
+
id: zoneName,
|
|
103
|
+
label: label,
|
|
104
|
+
offset: offset
|
|
105
|
+
});
|
|
106
|
+
} catch (error) {
|
|
107
|
+
// Ignores timezones that are not available within a user's browser/operating system
|
|
108
|
+
console.error("failed to format zone name ".concat(zoneName));
|
|
109
|
+
}
|
|
110
|
+
} // Sorts W -> E, prioritizes america. could be more nuanced based on system tz but simple for now
|
|
111
|
+
|
|
112
|
+
} catch (err) {
|
|
113
|
+
_iterator.e(err);
|
|
114
|
+
} finally {
|
|
115
|
+
_iterator.f();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return timezones.sort(function (a, b) {
|
|
105
119
|
var offsetDelta = b.offset - a.offset;
|
|
106
120
|
if (offsetDelta !== 0) return offsetDelta;
|
|
107
|
-
|
|
108
|
-
if (a.label
|
|
121
|
+
|
|
122
|
+
if (typeof a.label === 'string' && typeof b.label === 'string') {
|
|
123
|
+
if (a.label < b.label) return -1;
|
|
124
|
+
if (a.label > b.label) return 1;
|
|
125
|
+
}
|
|
126
|
+
|
|
109
127
|
return 0;
|
|
110
128
|
});
|
|
111
129
|
});
|
|
@@ -182,10 +200,20 @@ var TimezonePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
182
200
|
selectProps.overrides); // $FlowFixMe
|
|
183
201
|
|
|
184
202
|
selectProps.overrides = selectOverrides;
|
|
203
|
+
var options = this.state.timezones;
|
|
204
|
+
|
|
205
|
+
if (this.props.mapLabels) {
|
|
206
|
+
options = options.map(function (option) {
|
|
207
|
+
// $FlowFixMe - TimezoneT.label is a string, but mapLabels can return a React.Node
|
|
208
|
+
option.label = _this3.props.mapLabels(option);
|
|
209
|
+
return option;
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
|
|
185
213
|
return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, function (locale) {
|
|
186
214
|
return /*#__PURE__*/React.createElement(OverriddenSelect, _extends({
|
|
187
215
|
"aria-label": locale.datepicker.timezonePickerAriaLabel,
|
|
188
|
-
options:
|
|
216
|
+
options: options,
|
|
189
217
|
clearable: false,
|
|
190
218
|
disabled: _this3.props.disabled,
|
|
191
219
|
error: _this3.props.error,
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* eslint-disable header/header */
|
|
2
|
+
export var zones = ['Europe/Andorra', 'Asia/Dubai', 'Asia/Kabul', 'Europe/Tirane', 'Asia/Yerevan', 'Antarctica/Casey', 'Antarctica/Davis', 'Antarctica/Mawson', 'Antarctica/Palmer', 'Antarctica/Rothera', 'Antarctica/Troll', 'Antarctica/Vostok', 'America/Argentina/Buenos_Aires', 'America/Argentina/Cordoba', 'America/Argentina/Salta', 'America/Argentina/Jujuy', 'America/Argentina/Tucuman', 'America/Argentina/Catamarca', 'America/Argentina/La_Rioja', 'America/Argentina/San_Juan', 'America/Argentina/Mendoza', 'America/Argentina/San_Luis', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Ushuaia', 'Pacific/Pago_Pago', 'Europe/Vienna', 'Australia/Lord_Howe', 'Antarctica/Macquarie', 'Australia/Hobart', 'Australia/Melbourne', 'Australia/Sydney', 'Australia/Broken_Hill', 'Australia/Brisbane', 'Australia/Lindeman', 'Australia/Adelaide', 'Australia/Darwin', 'Australia/Perth', 'Australia/Eucla', 'Asia/Baku', 'America/Barbados', 'Asia/Dhaka', 'Europe/Brussels', 'Europe/Sofia', 'Atlantic/Bermuda', 'Asia/Brunei', 'America/La_Paz', 'America/Noronha', 'America/Belem', 'America/Fortaleza', 'America/Recife', 'America/Araguaina', 'America/Maceio', 'America/Bahia', 'America/Sao_Paulo', 'America/Campo_Grande', 'America/Cuiaba', 'America/Santarem', 'America/Porto_Velho', 'America/Boa_Vista', 'America/Manaus', 'America/Eirunepe', 'America/Rio_Branco', 'Asia/Thimphu', 'Europe/Minsk', 'America/Belize', 'America/St_Johns', 'America/Halifax', 'America/Glace_Bay', 'America/Moncton', 'America/Goose_Bay', 'America/Toronto', 'America/Nipigon', 'America/Thunder_Bay', 'America/Iqaluit', 'America/Pangnirtung', 'America/Winnipeg', 'America/Rainy_River', 'America/Resolute', 'America/Rankin_Inlet', 'America/Regina', 'America/Swift_Current', 'America/Edmonton', 'America/Cambridge_Bay', 'America/Yellowknife', 'America/Inuvik', 'America/Dawson_Creek', 'America/Fort_Nelson', 'America/Whitehorse', 'America/Dawson', 'America/Vancouver', 'Indian/Cocos', 'Europe/Zurich', 'Africa/Abidjan', 'Pacific/Rarotonga', 'America/Santiago', 'America/Punta_Arenas', 'Pacific/Easter', 'Asia/Shanghai', 'Asia/Urumqi', 'America/Bogota', 'America/Costa_Rica', 'America/Havana', 'Atlantic/Cape_Verde', 'Indian/Christmas', 'Asia/Nicosia', 'Asia/Famagusta', 'Europe/Prague', 'Europe/Berlin', 'Europe/Copenhagen', 'America/Santo_Domingo', 'Africa/Algiers', 'America/Guayaquil', 'Pacific/Galapagos', 'Europe/Tallinn', 'Africa/Cairo', 'Africa/El_Aaiun', 'Europe/Madrid', 'Africa/Ceuta', 'Atlantic/Canary', 'Europe/Helsinki', 'Pacific/Fiji', 'Atlantic/Stanley', 'Pacific/Chuuk', 'Pacific/Pohnpei', 'Pacific/Kosrae', 'Atlantic/Faroe', 'Europe/Paris', 'Europe/London', 'Asia/Tbilisi', 'America/Cayenne', 'Europe/Gibraltar', 'America/Nuuk', 'America/Danmarkshavn', 'America/Scoresbysund', 'America/Thule', 'Europe/Athens', 'Atlantic/South_Georgia', 'America/Guatemala', 'Pacific/Guam', 'Africa/Bissau', 'America/Guyana', 'Asia/Hong_Kong', 'America/Tegucigalpa', 'America/Port-au-Prince', 'Europe/Budapest', 'Asia/Jakarta', 'Asia/Pontianak', 'Asia/Makassar', 'Asia/Jayapura', 'Europe/Dublin', 'Asia/Jerusalem', 'Asia/Kolkata', 'Indian/Chagos', 'Asia/Baghdad', 'Asia/Tehran', 'Atlantic/Reykjavik', 'Europe/Rome', 'America/Jamaica', 'Asia/Amman', 'Asia/Tokyo', 'Africa/Nairobi', 'Asia/Bishkek', 'Pacific/Tarawa', 'Pacific/Kanton', 'Pacific/Kiritimati', 'Asia/Pyongyang', 'Asia/Seoul', 'Asia/Almaty', 'Asia/Qyzylorda', 'Asia/Qostanay', 'Asia/Aqtobe', 'Asia/Aqtau', 'Asia/Atyrau', 'Asia/Oral', 'Asia/Beirut', 'Asia/Colombo', 'Africa/Monrovia', 'Europe/Vilnius', 'Europe/Luxembourg', 'Europe/Riga', 'Africa/Tripoli', 'Africa/Casablanca', 'Europe/Monaco', 'Europe/Chisinau', 'Pacific/Majuro', 'Pacific/Kwajalein', 'Asia/Yangon', 'Asia/Ulaanbaatar', 'Asia/Hovd', 'Asia/Choibalsan', 'Asia/Macau', 'America/Martinique', 'Europe/Malta', 'Indian/Mauritius', 'Indian/Maldives', 'America/Mexico_City', 'America/Cancun', 'America/Merida', 'America/Monterrey', 'America/Matamoros', 'America/Mazatlan', 'America/Chihuahua', 'America/Ojinaga', 'America/Hermosillo', 'America/Tijuana', 'America/Bahia_Banderas', 'Asia/Kuala_Lumpur', 'Asia/Kuching', 'Africa/Maputo', 'Africa/Windhoek', 'Pacific/Noumea', 'Pacific/Norfolk', 'Africa/Lagos', 'America/Managua', 'Europe/Amsterdam', 'Europe/Oslo', 'Asia/Kathmandu', 'Pacific/Nauru', 'Pacific/Niue', 'Pacific/Auckland', 'Pacific/Chatham', 'America/Panama', 'America/Lima', 'Pacific/Tahiti', 'Pacific/Marquesas', 'Pacific/Gambier', 'Pacific/Port_Moresby', 'Pacific/Bougainville', 'Asia/Manila', 'Asia/Karachi', 'Europe/Warsaw', 'America/Miquelon', 'Pacific/Pitcairn', 'America/Puerto_Rico', 'Asia/Gaza', 'Asia/Hebron', 'Europe/Lisbon', 'Atlantic/Madeira', 'Atlantic/Azores', 'Pacific/Palau', 'America/Asuncion', 'Asia/Qatar', 'Indian/Reunion', 'Europe/Bucharest', 'Europe/Belgrade', 'Europe/Kaliningrad', 'Europe/Moscow', 'Europe/Simferopol', 'Europe/Kirov', 'Europe/Volgograd', 'Europe/Astrakhan', 'Europe/Saratov', 'Europe/Ulyanovsk', 'Europe/Samara', 'Asia/Yekaterinburg', 'Asia/Omsk', 'Asia/Novosibirsk', 'Asia/Barnaul', 'Asia/Tomsk', 'Asia/Novokuznetsk', 'Asia/Krasnoyarsk', 'Asia/Irkutsk', 'Asia/Chita', 'Asia/Yakutsk', 'Asia/Khandyga', 'Asia/Vladivostok', 'Asia/Ust-Nera', 'Asia/Magadan', 'Asia/Sakhalin', 'Asia/Srednekolymsk', 'Asia/Kamchatka', 'Asia/Anadyr', 'Asia/Riyadh', 'Pacific/Guadalcanal', 'Indian/Mahe', 'Africa/Khartoum', 'Europe/Stockholm', 'Asia/Singapore', 'America/Paramaribo', 'Africa/Juba', 'Africa/Sao_Tome', 'America/El_Salvador', 'Asia/Damascus', 'America/Grand_Turk', 'Africa/Ndjamena', 'Indian/Kerguelen', 'Asia/Bangkok', 'Asia/Dushanbe', 'Pacific/Fakaofo', 'Asia/Dili', 'Asia/Ashgabat', 'Africa/Tunis', 'Pacific/Tongatapu', 'Europe/Istanbul', 'Pacific/Funafuti', 'Asia/Taipei', 'Europe/Kiev', 'Europe/Uzhgorod', 'Europe/Zaporozhye', 'Pacific/Wake', 'America/New_York', 'America/Detroit', 'America/Kentucky/Louisville', 'America/Kentucky/Monticello', 'America/Indiana/Indianapolis', 'America/Indiana/Vincennes', 'America/Indiana/Winamac', 'America/Indiana/Marengo', 'America/Indiana/Petersburg', 'America/Indiana/Vevay', 'America/Chicago', 'America/Indiana/Tell_City', 'America/Indiana/Knox', 'America/Menominee', 'America/North_Dakota/Center', 'America/North_Dakota/New_Salem', 'America/North_Dakota/Beulah', 'America/Denver', 'America/Boise', 'America/Phoenix', 'America/Los_Angeles', 'America/Anchorage', 'America/Juneau', 'America/Sitka', 'America/Metlakatla', 'America/Yakutat', 'America/Nome', 'America/Adak', 'Pacific/Honolulu', 'America/Montevideo', 'Asia/Samarkand', 'Asia/Tashkent', 'America/Caracas', 'Asia/Ho_Chi_Minh', 'Pacific/Efate', 'Pacific/Wallis', 'Pacific/Apia', 'Africa/Johannesburg'];
|