baseui 10.7.4 → 10.9.1
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 +1 -1
- package/data-table/column-numerical.js.flow +3 -3
- 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 +2 -2
- package/es/datepicker/styled-components.js +1 -1
- package/es/drawer/drawer.js +3 -1
- package/es/form-control/form-control.js +58 -7
- package/es/form-control/styled-components.js +27 -6
- 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 +4 -2
- 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 +2 -2
- package/esm/datepicker/styled-components.js +1 -1
- package/esm/drawer/drawer.js +3 -1
- package/esm/form-control/form-control.js +60 -9
- package/esm/form-control/styled-components.js +23 -3
- 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 +4 -2
- 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/form-control/form-control.js +61 -8
- package/form-control/form-control.js.flow +82 -10
- package/form-control/index.d.ts +1 -0
- package/form-control/styled-components.js +27 -5
- package/form-control/styled-components.js.flow +25 -3
- package/form-control/types.js.flow +20 -8
- 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 +4 -4
- package/popover/popover.js +4 -2
- package/popover/popover.js.flow +3 -1
- 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
|
@@ -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'];
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
+
|
|
3
|
+
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(_e) { throw _e; }, 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(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
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 asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
10
|
+
|
|
11
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
Copyright (c) Uber Technologies, Inc.
|
|
15
|
+
|
|
16
|
+
This source code is licensed under the MIT license found in the
|
|
17
|
+
LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/* eslint-env node */
|
|
21
|
+
var fs = require('fs');
|
|
22
|
+
|
|
23
|
+
var path = require('path');
|
|
24
|
+
|
|
25
|
+
var util = require('util');
|
|
26
|
+
|
|
27
|
+
var exec = util.promisify(require('child_process').exec); // Download tzdata and collect a list of timezones. Baseui previously used a library
|
|
28
|
+
// to do this, but it grew stale and unmaintained. This approach is straightforward
|
|
29
|
+
// enough to update whenever necessary, but future improvements could include building
|
|
30
|
+
// this data set before baseui is published so that the data is always fresh.
|
|
31
|
+
|
|
32
|
+
function main() {
|
|
33
|
+
return _main.apply(this, arguments);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function _main() {
|
|
37
|
+
_main = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
38
|
+
var tmpDir, src, zoneTabPath, content, lines, zones, _iterator, _step, line, parts, file, _i, _zones, zone, tzdataPath;
|
|
39
|
+
|
|
40
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
41
|
+
while (1) {
|
|
42
|
+
switch (_context.prev = _context.next) {
|
|
43
|
+
case 0:
|
|
44
|
+
_context.prev = 0;
|
|
45
|
+
tmpDir = path.join(__dirname, 'tmp'); // $FlowFixMe - flow is not aware of recursive option
|
|
46
|
+
|
|
47
|
+
_context.next = 4;
|
|
48
|
+
return fs.promises.rmdir(tmpDir, {
|
|
49
|
+
recursive: true
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
case 4:
|
|
53
|
+
_context.next = 6;
|
|
54
|
+
return fs.promises.mkdir(tmpDir);
|
|
55
|
+
|
|
56
|
+
case 6:
|
|
57
|
+
src = "https://www.iana.org/time-zones/repository/tzdata-latest.tar.gz";
|
|
58
|
+
_context.next = 9;
|
|
59
|
+
return exec("curl -L ".concat(src, " | gzip -dc | tar -xf - --directory ").concat(tmpDir));
|
|
60
|
+
|
|
61
|
+
case 9:
|
|
62
|
+
zoneTabPath = path.join(tmpDir, 'zone1970.tab');
|
|
63
|
+
_context.next = 12;
|
|
64
|
+
return fs.promises.readFile(zoneTabPath, 'utf-8');
|
|
65
|
+
|
|
66
|
+
case 12:
|
|
67
|
+
content = _context.sent;
|
|
68
|
+
lines = content.split('\n');
|
|
69
|
+
zones = [];
|
|
70
|
+
_iterator = _createForOfIteratorHelper(lines);
|
|
71
|
+
_context.prev = 16;
|
|
72
|
+
|
|
73
|
+
_iterator.s();
|
|
74
|
+
|
|
75
|
+
case 18:
|
|
76
|
+
if ((_step = _iterator.n()).done) {
|
|
77
|
+
_context.next = 26;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
line = _step.value;
|
|
82
|
+
|
|
83
|
+
if (!(line[0] === '#')) {
|
|
84
|
+
_context.next = 22;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return _context.abrupt("continue", 24);
|
|
89
|
+
|
|
90
|
+
case 22:
|
|
91
|
+
parts = line.split(/\s+/);
|
|
92
|
+
|
|
93
|
+
if (parts.length >= 3) {
|
|
94
|
+
zones.push(parts[2]);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
case 24:
|
|
98
|
+
_context.next = 18;
|
|
99
|
+
break;
|
|
100
|
+
|
|
101
|
+
case 26:
|
|
102
|
+
_context.next = 31;
|
|
103
|
+
break;
|
|
104
|
+
|
|
105
|
+
case 28:
|
|
106
|
+
_context.prev = 28;
|
|
107
|
+
_context.t0 = _context["catch"](16);
|
|
108
|
+
|
|
109
|
+
_iterator.e(_context.t0);
|
|
110
|
+
|
|
111
|
+
case 31:
|
|
112
|
+
_context.prev = 31;
|
|
113
|
+
|
|
114
|
+
_iterator.f();
|
|
115
|
+
|
|
116
|
+
return _context.finish(31);
|
|
117
|
+
|
|
118
|
+
case 34:
|
|
119
|
+
file = [];
|
|
120
|
+
file.push('/* eslint-disable header/header */');
|
|
121
|
+
file.push('// @flow');
|
|
122
|
+
file.push('');
|
|
123
|
+
file.push('export const zones = [');
|
|
124
|
+
|
|
125
|
+
for (_i = 0, _zones = zones; _i < _zones.length; _i++) {
|
|
126
|
+
zone = _zones[_i];
|
|
127
|
+
file.push(" '".concat(zone, "',"));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
file.push('];');
|
|
131
|
+
tzdataPath = path.join(__dirname, 'tzdata.js');
|
|
132
|
+
_context.next = 44;
|
|
133
|
+
return fs.promises.writeFile(tzdataPath, file.join('\n'));
|
|
134
|
+
|
|
135
|
+
case 44:
|
|
136
|
+
_context.next = 46;
|
|
137
|
+
return fs.promises.rmdir(tmpDir, {
|
|
138
|
+
recursive: true
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
case 46:
|
|
142
|
+
_context.next = 51;
|
|
143
|
+
break;
|
|
144
|
+
|
|
145
|
+
case 48:
|
|
146
|
+
_context.prev = 48;
|
|
147
|
+
_context.t1 = _context["catch"](0);
|
|
148
|
+
console.error(_context.t1);
|
|
149
|
+
|
|
150
|
+
case 51:
|
|
151
|
+
case "end":
|
|
152
|
+
return _context.stop();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}, _callee, null, [[0, 48], [16, 28, 31, 34]]);
|
|
156
|
+
}));
|
|
157
|
+
return _main.apply(this, arguments);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
main();
|
|
@@ -21,10 +21,18 @@ function getBackgroundColor(kind, type, theme) {
|
|
|
21
21
|
return (_KIND$info$KIND$posit = {}, _defineProperty(_KIND$info$KIND$posit, KIND.info, isInline ? theme.colors.notificationInfoBackground : theme.colors.toastInfoBackground), _defineProperty(_KIND$info$KIND$posit, KIND.positive, isInline ? theme.colors.notificationPositiveBackground : theme.colors.toastPositiveBackground), _defineProperty(_KIND$info$KIND$posit, KIND.warning, isInline ? theme.colors.notificationWarningBackground : theme.colors.toastWarningBackground), _defineProperty(_KIND$info$KIND$posit, KIND.negative, isInline ? theme.colors.notificationNegativeBackground : theme.colors.toastNegativeBackground), _KIND$info$KIND$posit)[kind];
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
function getFontColor(kind, theme) {
|
|
25
|
-
var _KIND$info$KIND$
|
|
24
|
+
function getFontColor(kind, type, theme) {
|
|
25
|
+
var _KIND$info$KIND$posit3;
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
var isInline = type === TYPE.inline;
|
|
28
|
+
|
|
29
|
+
if (isInline) {
|
|
30
|
+
var _KIND$info$KIND$posit2;
|
|
31
|
+
|
|
32
|
+
return (_KIND$info$KIND$posit2 = {}, _defineProperty(_KIND$info$KIND$posit2, KIND.info, theme.colors.notificationInfoText), _defineProperty(_KIND$info$KIND$posit2, KIND.positive, theme.colors.notificationPositiveText), _defineProperty(_KIND$info$KIND$posit2, KIND.warning, theme.colors.notificationWarningText), _defineProperty(_KIND$info$KIND$posit2, KIND.negative, theme.colors.notificationNegativeText), _KIND$info$KIND$posit2)[kind];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (_KIND$info$KIND$posit3 = {}, _defineProperty(_KIND$info$KIND$posit3, KIND.info, theme.colors.toastInfoText), _defineProperty(_KIND$info$KIND$posit3, KIND.positive, theme.colors.toastPositiveText), _defineProperty(_KIND$info$KIND$posit3, KIND.warning, theme.colors.toastWarningText), _defineProperty(_KIND$info$KIND$posit3, KIND.negative, theme.colors.toastNegativeText), _KIND$info$KIND$posit3)[kind];
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
export function getPlacement(placement) {
|
|
@@ -89,9 +97,9 @@ export var Body = styled('div', function (props) {
|
|
|
89
97
|
$type = props.$type,
|
|
90
98
|
$theme = props.$theme;
|
|
91
99
|
var isInline = $type === TYPE.inline;
|
|
92
|
-
return _objectSpread(_objectSpread({}, $theme.typography.
|
|
100
|
+
return _objectSpread(_objectSpread({}, $theme.typography.font300), {}, {
|
|
93
101
|
pointerEvents: 'auto',
|
|
94
|
-
color:
|
|
102
|
+
color: getFontColor($kind, $type, $theme),
|
|
95
103
|
height: 'auto',
|
|
96
104
|
width: '288px',
|
|
97
105
|
paddingTop: $theme.sizing.scale600,
|