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.
Files changed (164) hide show
  1. package/a11y/a11y.js +2 -2
  2. package/a11y/a11y.js.flow +3 -3
  3. package/button/styled-components.js +47 -18
  4. package/button/styled-components.js.flow +25 -5
  5. package/combobox/combobox.js +6 -3
  6. package/combobox/combobox.js.flow +4 -2
  7. package/combobox/types.js.flow +2 -0
  8. package/data-table/column-categorical.js +1 -1
  9. package/data-table/column-categorical.js.flow +2 -2
  10. package/data-table/column-numerical.js +1 -1
  11. package/data-table/column-numerical.js.flow +3 -3
  12. package/datepicker/styled-components.js +1 -1
  13. package/datepicker/styled-components.js.flow +4 -1
  14. package/drawer/drawer.js +3 -1
  15. package/drawer/drawer.js.flow +7 -1
  16. package/es/a11y/a11y.js +2 -2
  17. package/es/button/styled-components.js +32 -2
  18. package/es/combobox/combobox.js +6 -3
  19. package/es/data-table/column-categorical.js +2 -2
  20. package/es/data-table/column-numerical.js +2 -2
  21. package/es/datepicker/styled-components.js +1 -1
  22. package/es/drawer/drawer.js +3 -1
  23. package/es/form-control/form-control.js +58 -7
  24. package/es/form-control/styled-components.js +27 -6
  25. package/es/index.js +1 -1
  26. package/es/map-marker/badge-enhancer.js +61 -0
  27. package/es/map-marker/constants.js +146 -2
  28. package/es/map-marker/drag-shadow.js +32 -0
  29. package/es/map-marker/fixed-marker.js +54 -48
  30. package/es/map-marker/floating-marker.js +21 -12
  31. package/es/map-marker/index.js +1 -1
  32. package/es/map-marker/label-enhancer.js +39 -0
  33. package/es/map-marker/needle.js +26 -0
  34. package/es/map-marker/pin-head.js +42 -40
  35. package/es/map-marker/styled-components.js +177 -32
  36. package/es/map-marker/types.js +1 -1
  37. package/es/menu/maybe-child-menu.js +0 -2
  38. package/es/menu/nested-menus.js +49 -3
  39. package/es/menu/stateful-container.js +13 -12
  40. package/es/modal/modal.js +3 -1
  41. package/es/popover/popover.js +4 -2
  42. package/es/progress-bar/index.js +1 -1
  43. package/es/progress-bar/progressbar.js +25 -10
  44. package/es/progress-bar/styled-components.js +9 -5
  45. package/es/select/select-component.js +2 -10
  46. package/es/spinner/styled-components.js +34 -16
  47. package/es/table/filter.js +3 -1
  48. package/es/themes/dark-theme/color-component-tokens.js +19 -10
  49. package/es/themes/light-theme/color-component-tokens.js +19 -10
  50. package/es/timezonepicker/timezone-picker.js +53 -36
  51. package/es/timezonepicker/tzdata.js +2 -0
  52. package/es/timezonepicker/update-tzdata.js +69 -0
  53. package/es/toast/styled-components.js +18 -7
  54. package/esm/a11y/a11y.js +3 -3
  55. package/esm/button/styled-components.js +47 -18
  56. package/esm/combobox/combobox.js +6 -3
  57. package/esm/data-table/column-categorical.js +2 -2
  58. package/esm/data-table/column-numerical.js +2 -2
  59. package/esm/datepicker/styled-components.js +1 -1
  60. package/esm/drawer/drawer.js +3 -1
  61. package/esm/form-control/form-control.js +60 -9
  62. package/esm/form-control/styled-components.js +23 -3
  63. package/esm/index.js +1 -1
  64. package/esm/map-marker/badge-enhancer.js +79 -0
  65. package/esm/map-marker/constants.js +94 -4
  66. package/esm/map-marker/drag-shadow.js +53 -0
  67. package/esm/map-marker/fixed-marker.js +84 -80
  68. package/esm/map-marker/floating-marker.js +22 -13
  69. package/esm/map-marker/index.js +1 -1
  70. package/esm/map-marker/label-enhancer.js +60 -0
  71. package/esm/map-marker/needle.js +43 -0
  72. package/esm/map-marker/pin-head.js +77 -66
  73. package/esm/map-marker/styled-components.js +182 -51
  74. package/esm/map-marker/types.js +1 -1
  75. package/esm/menu/maybe-child-menu.js +0 -2
  76. package/esm/menu/nested-menus.js +66 -5
  77. package/esm/menu/stateful-container.js +15 -13
  78. package/esm/modal/modal.js +3 -1
  79. package/esm/popover/popover.js +4 -2
  80. package/esm/progress-bar/index.js +1 -1
  81. package/esm/progress-bar/progressbar.js +32 -10
  82. package/esm/progress-bar/styled-components.js +9 -4
  83. package/esm/select/select-component.js +2 -11
  84. package/esm/spinner/styled-components.js +35 -16
  85. package/esm/table/filter.js +3 -1
  86. package/esm/themes/dark-theme/color-component-tokens.js +19 -10
  87. package/esm/themes/light-theme/color-component-tokens.js +19 -10
  88. package/esm/timezonepicker/timezone-picker.js +64 -36
  89. package/esm/timezonepicker/tzdata.js +2 -0
  90. package/esm/timezonepicker/update-tzdata.js +160 -0
  91. package/esm/toast/styled-components.js +13 -5
  92. package/form-control/form-control.js +61 -8
  93. package/form-control/form-control.js.flow +82 -10
  94. package/form-control/index.d.ts +1 -0
  95. package/form-control/styled-components.js +27 -5
  96. package/form-control/styled-components.js.flow +25 -3
  97. package/form-control/types.js.flow +20 -8
  98. package/index.js +6 -0
  99. package/index.js.flow +1 -1
  100. package/map-marker/badge-enhancer.js +90 -0
  101. package/map-marker/badge-enhancer.js.flow +86 -0
  102. package/map-marker/constants.js +103 -5
  103. package/map-marker/constants.js.flow +152 -0
  104. package/map-marker/drag-shadow.js +64 -0
  105. package/map-marker/drag-shadow.js.flow +52 -0
  106. package/map-marker/fixed-marker.js +84 -78
  107. package/map-marker/fixed-marker.js.flow +78 -66
  108. package/map-marker/floating-marker.js +22 -13
  109. package/map-marker/floating-marker.js.flow +30 -17
  110. package/map-marker/index.d.ts +125 -24
  111. package/map-marker/index.js +18 -0
  112. package/map-marker/index.js.flow +3 -0
  113. package/map-marker/label-enhancer.js +71 -0
  114. package/map-marker/label-enhancer.js.flow +63 -0
  115. package/map-marker/needle.js +54 -0
  116. package/map-marker/needle.js.flow +29 -0
  117. package/map-marker/pin-head.js +80 -69
  118. package/map-marker/pin-head.js.flow +122 -84
  119. package/map-marker/styled-components.js +200 -62
  120. package/map-marker/styled-components.js.flow +172 -22
  121. package/map-marker/types.js.flow +69 -20
  122. package/menu/index.d.ts +9 -4
  123. package/menu/maybe-child-menu.js +0 -2
  124. package/menu/maybe-child-menu.js.flow +0 -2
  125. package/menu/nested-menus.js +66 -5
  126. package/menu/nested-menus.js.flow +50 -5
  127. package/menu/stateful-container.js +15 -13
  128. package/menu/stateful-container.js.flow +19 -13
  129. package/menu/types.js.flow +7 -1
  130. package/modal/modal.js +3 -1
  131. package/modal/modal.js.flow +2 -0
  132. package/package.json +4 -4
  133. package/popover/popover.js +4 -2
  134. package/popover/popover.js.flow +3 -1
  135. package/progress-bar/index.d.ts +2 -0
  136. package/progress-bar/index.js +6 -0
  137. package/progress-bar/index.js.flow +1 -0
  138. package/progress-bar/progressbar.js +32 -10
  139. package/progress-bar/progressbar.js.flow +35 -9
  140. package/progress-bar/styled-components.js +9 -4
  141. package/progress-bar/styled-components.js.flow +15 -4
  142. package/progress-bar/types.js.flow +12 -2
  143. package/select/select-component.js +2 -11
  144. package/select/select-component.js.flow +5 -7
  145. package/spinner/styled-components.js +35 -16
  146. package/spinner/styled-components.js.flow +37 -19
  147. package/spinner/types.js.flow +10 -0
  148. package/styles/index.js.flow +1 -1
  149. package/table/filter.js +3 -1
  150. package/table/filter.js.flow +5 -1
  151. package/themes/dark-theme/color-component-tokens.js +19 -10
  152. package/themes/dark-theme/color-component-tokens.js.flow +19 -10
  153. package/themes/light-theme/color-component-tokens.js +19 -10
  154. package/themes/light-theme/color-component-tokens.js.flow +19 -10
  155. package/themes/types.js.flow +9 -0
  156. package/timezonepicker/timezone-picker.js +69 -41
  157. package/timezonepicker/timezone-picker.js.flow +52 -46
  158. package/timezonepicker/types.js.flow +1 -1
  159. package/timezonepicker/tzdata.js +10 -0
  160. package/timezonepicker/tzdata.js.flow +347 -0
  161. package/timezonepicker/update-tzdata.js +164 -0
  162. package/timezonepicker/update-tzdata.js.flow +70 -0
  163. package/toast/styled-components.js +13 -5
  164. package/toast/styled-components.js.flow +17 -7
@@ -32,10 +32,16 @@ class ProgressBar extends React.Component {
32
32
  size,
33
33
  steps,
34
34
  successValue,
35
+ minValue,
36
+ maxValue,
35
37
  showLabel,
36
38
  infinite,
37
- errorMessage
38
- } = this.props;
39
+ errorMessage,
40
+ forwardedRef,
41
+ ...restProps
42
+ } = this.props; // fallback on successValue (and it's default) if maxValue is not set by user
43
+
44
+ const maximumValue = maxValue !== 100 ? maxValue : successValue;
39
45
  const [Root, rootProps] = getOverrides(overrides.Root, StyledRoot);
40
46
  const [BarContainer, barContainerProps] = getOverrides(overrides.BarContainer, StyledBarContainer);
41
47
  const [Bar, barProps] = getOverrides(overrides.Bar, StyledBar);
@@ -46,7 +52,9 @@ class ProgressBar extends React.Component {
46
52
  $infinite: infinite,
47
53
  $size: size,
48
54
  $steps: steps,
49
- $successValue: successValue,
55
+ $successValue: maximumValue,
56
+ $minValue: minValue,
57
+ $maxValue: maximumValue,
50
58
  $value: value
51
59
  };
52
60
 
@@ -68,34 +76,41 @@ class ProgressBar extends React.Component {
68
76
  /*#__PURE__*/
69
77
  // eslint-disable-next-line jsx-a11y/role-supports-aria-props
70
78
  React.createElement(Root, _extends({
79
+ ref: forwardedRef,
71
80
  "data-baseweb": "progress-bar",
72
81
  role: "progressbar",
73
- "aria-label": ariaLabel || getProgressLabel(value, successValue),
82
+ "aria-label": ariaLabel || getProgressLabel(value, maximumValue, minValue),
74
83
  "aria-valuenow": infinite ? null : value,
75
- "aria-valuemin": infinite ? null : 0,
76
- "aria-valuemax": infinite ? null : successValue,
84
+ "aria-valuemin": infinite ? null : minValue,
85
+ "aria-valuemax": infinite ? null : maximumValue,
77
86
  "aria-invalid": errorMessage ? true : null,
78
87
  "aria-errormessage": errorMessage
79
- }, sharedProps, rootProps), /*#__PURE__*/React.createElement(BarContainer, _extends({}, sharedProps, barContainerProps), infinite ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfiniteBar, _extends({
88
+ }, restProps, sharedProps, rootProps), /*#__PURE__*/React.createElement(BarContainer, _extends({}, sharedProps, barContainerProps), infinite ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfiniteBar, _extends({
80
89
  $isLeft: true,
81
90
  $size: sharedProps.$size
82
91
  }, infiniteBarProps)), /*#__PURE__*/React.createElement(InfiniteBar, _extends({
83
92
  $size: sharedProps.$size
84
- }, infiniteBarProps))) : renderProgressBar()), showLabel && /*#__PURE__*/React.createElement(Label, _extends({}, sharedProps, labelProps), getProgressLabel(value, successValue)))
93
+ }, infiniteBarProps))) : renderProgressBar()), showLabel && /*#__PURE__*/React.createElement(Label, _extends({}, sharedProps, labelProps), getProgressLabel(value, maximumValue, minValue)))
85
94
  );
86
95
  }
87
96
 
88
97
  }
89
98
 
90
99
  _defineProperty(ProgressBar, "defaultProps", {
91
- getProgressLabel: (value, successValue) => `${Math.round(value / successValue * 100)}% Loaded`,
100
+ getProgressLabel: (value, maxValue, minValue) => `${Math.round((value - minValue) / (maxValue - minValue) * 100)}% Loaded`,
92
101
  infinite: false,
93
102
  overrides: {},
94
103
  showLabel: false,
95
104
  size: SIZE.medium,
96
105
  steps: 1,
97
106
  successValue: 100,
107
+ minValue: 0,
108
+ maxValue: 100,
98
109
  value: 0
99
110
  });
100
111
 
101
- export default ProgressBar;
112
+ const ForwardedProgressBar = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(ProgressBar, _extends({
113
+ forwardedRef: ref
114
+ }, props)));
115
+ ForwardedProgressBar.displayName = 'ProgressBar';
116
+ export default ForwardedProgressBar;
@@ -76,14 +76,18 @@ export const StyledBarProgress = styled('div', props => {
76
76
  $value,
77
77
  $successValue,
78
78
  $steps,
79
- $index
80
- } = props;
79
+ $index,
80
+ $maxValue,
81
+ $minValue = 0
82
+ } = props; // making sure this doesn't break existing use that use StyledBarProgress directly
83
+
84
+ const maxValue = $maxValue ? $maxValue : $successValue;
81
85
  const {
82
86
  colors,
83
87
  sizing,
84
88
  borders
85
89
  } = $theme;
86
- const width = `${100 - $value / $successValue * 100}%`;
90
+ const width = `${100 - ($value - $minValue) * 100 / (maxValue - $minValue)}%`;
87
91
  const stepStates = {
88
92
  default: 'default',
89
93
  awaits: 'awaits',
@@ -93,8 +97,8 @@ export const StyledBarProgress = styled('div', props => {
93
97
  let stepState = stepStates.default;
94
98
 
95
99
  if ($steps > 1) {
96
- const stepValue = $successValue / $steps;
97
- const currentValue = $value / $successValue * 100;
100
+ const stepValue = (maxValue - $minValue) / $steps;
101
+ const currentValue = ($value - $minValue) / (maxValue - $minValue) * 100;
98
102
  const completedSteps = Math.floor(currentValue / stepValue);
99
103
 
100
104
  if ($index < completedSteps) {
@@ -124,11 +124,6 @@ class Select extends React.Component {
124
124
  this.handleClick(event);
125
125
  });
126
126
 
127
- _defineProperty(this, "handleTouchEndClearValue", event => {
128
- if (this.dragging) return;
129
- this.clearValue(event);
130
- });
131
-
132
127
  _defineProperty(this, "handleClick", event => {
133
128
  if (this.props.disabled || !isClick(event) && !isLeftClick(event)) {
134
129
  return;
@@ -741,7 +736,7 @@ class Select extends React.Component {
741
736
  "aria-required": this.props.required || null,
742
737
  onFocus: this.handleInputFocus,
743
738
  tabIndex: 0
744
- }, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement("input", {
739
+ }, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement("input", _extends({
745
740
  "aria-hidden": true,
746
741
  id: this.props.id || null,
747
742
  ref: this.handleInputRef,
@@ -753,7 +748,7 @@ class Select extends React.Component {
753
748
  padding: 0
754
749
  },
755
750
  tabIndex: -1
756
- }));
751
+ }, overrides.Input ? overrides.Input.props ? overrides.Input.props : {} : {})));
757
752
  }
758
753
 
759
754
  return /*#__PURE__*/React.createElement(InputContainer, _extends({}, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement(AutosizeInput, _extends({
@@ -800,9 +795,6 @@ class Select extends React.Component {
800
795
  title: ariaLabel,
801
796
  "aria-label": ariaLabel,
802
797
  onClick: this.clearValue,
803
- onTouchEnd: this.handleTouchEndClearValue,
804
- onTouchMove: this.handleTouchMove,
805
- onTouchStart: this.handleTouchStart,
806
798
  role: "button",
807
799
  overrides: {
808
800
  Svg: {
@@ -46,13 +46,39 @@ export const StyledActivePath = styled('path', props => ({
46
46
  StyledActivePath.displayName = "StyledActivePath";
47
47
  export const StyledSpinnerNext = styled('i', ({
48
48
  $theme,
49
+ $color = $theme.colors.contentAccent,
50
+ $borderWidth,
49
51
  $size = SIZE.medium
50
52
  }) => {
51
- const borderWidth = {
53
+ //$FlowFixMe
54
+ let borderSize = {
52
55
  large: $theme.sizing.scale300,
53
56
  medium: $theme.sizing.scale100,
54
57
  small: $theme.sizing.scale0
58
+ }[$borderWidth || $size];
59
+ let boxSize = {
60
+ large: $theme.sizing.scale1000,
61
+ medium: $theme.sizing.scale900,
62
+ small: $theme.sizing.scale800
55
63
  }[$size];
64
+
65
+ if (!borderSize) {
66
+ borderSize = $theme.sizing[$borderWidth];
67
+
68
+ if (!borderSize) {
69
+ borderSize = `${parseInt($borderWidth)}px`;
70
+ }
71
+ }
72
+
73
+ if (!boxSize) {
74
+ //$FlowFixMe
75
+ boxSize = $theme.sizing[$size];
76
+
77
+ if (!boxSize) {
78
+ boxSize = `${parseInt($size)}px`;
79
+ }
80
+ }
81
+
56
82
  return {
57
83
  display: 'block',
58
84
  animationName: spin,
@@ -64,24 +90,16 @@ export const StyledSpinnerNext = styled('i', ({
64
90
  borderTopStyle: 'solid',
65
91
  borderBottomStyle: 'solid',
66
92
  borderRadius: '50%',
67
- borderTopColor: $theme.colors.contentAccent,
93
+ borderTopColor: $color,
68
94
  borderRightColor: $theme.colors.backgroundTertiary,
69
95
  borderBottomColor: $theme.colors.backgroundTertiary,
70
96
  borderLeftColor: $theme.colors.backgroundTertiary,
71
- borderLeftWidth: borderWidth,
72
- borderRightWidth: borderWidth,
73
- borderTopWidth: borderWidth,
74
- borderBottomWidth: borderWidth,
75
- width: {
76
- large: $theme.sizing.scale1000,
77
- medium: $theme.sizing.scale900,
78
- small: $theme.sizing.scale800
79
- }[$size],
80
- height: {
81
- large: $theme.sizing.scale1000,
82
- medium: $theme.sizing.scale900,
83
- small: $theme.sizing.scale800
84
- }[$size],
97
+ borderLeftWidth: borderSize,
98
+ borderRightWidth: borderSize,
99
+ borderTopWidth: borderSize,
100
+ borderBottomWidth: borderSize,
101
+ width: boxSize,
102
+ height: boxSize,
85
103
  cursor: 'wait'
86
104
  };
87
105
  });
@@ -39,7 +39,9 @@ export default function Filter(props) {
39
39
  content: ({
40
40
  close
41
41
  }) => /*#__PURE__*/React.createElement(FocusLock, {
42
- autoFocus: false
42
+ autoFocus: false // Allow focus to escape when UI is within an iframe
43
+ ,
44
+ crossFrame: false
43
45
  }, /*#__PURE__*/React.createElement(Heading, headingProps, "Filter Column"), /*#__PURE__*/React.createElement(Content, contentProps, props.children), /*#__PURE__*/React.createElement(Footer, footerProps, /*#__PURE__*/React.createElement(Button, {
44
46
  kind: KIND.minimal,
45
47
  size: SIZE.compact,
@@ -36,6 +36,8 @@ export default ((themePrimitives = colorTokens) => ({
36
36
  buttonTertiaryActive: themePrimitives.primary600,
37
37
  buttonTertiarySelectedText: themePrimitives.primary,
38
38
  buttonTertiarySelectedFill: themePrimitives.primary600,
39
+ buttonTertiaryDisabledActiveFill: themePrimitives.primary700,
40
+ buttonTertiaryDisabledActiveText: themePrimitives.mono300,
39
41
  buttonTertiarySpinnerForeground: themePrimitives.primary50,
40
42
  buttonTertiarySpinnerBackground: themePrimitives.primary500,
41
43
  buttonMinimalFill: 'transparent',
@@ -48,6 +50,8 @@ export default ((themePrimitives = colorTokens) => ({
48
50
  buttonMinimalSpinnerBackground: themePrimitives.primary500,
49
51
  buttonDisabledFill: themePrimitives.mono600,
50
52
  buttonDisabledText: themePrimitives.mono300,
53
+ buttonDisabledActiveFill: themePrimitives.mono200,
54
+ buttonDisabledActiveText: themePrimitives.primary500,
51
55
  buttonDisabledSpinnerForeground: themePrimitives.mono200,
52
56
  buttonDisabledSpinnerBackground: themePrimitives.mono400,
53
57
  // Breadcrumbs
@@ -106,15 +110,15 @@ export default ((themePrimitives = colorTokens) => ({
106
110
  modalCloseColorFocus: themePrimitives.mono400,
107
111
  // Notification
108
112
  notificationPrimaryBackground: themePrimitives.primary700,
109
- notificationPrimaryText: themePrimitives.primary200,
113
+ notificationPrimaryText: themePrimitives.primaryA,
110
114
  notificationInfoBackground: themePrimitives.accent700,
111
- notificationInfoText: themePrimitives.accent200,
115
+ notificationInfoText: themePrimitives.primaryA,
112
116
  notificationPositiveBackground: themePrimitives.positive700,
113
- notificationPositiveText: themePrimitives.positive200,
117
+ notificationPositiveText: themePrimitives.primaryA,
114
118
  notificationWarningBackground: themePrimitives.warning700,
115
- notificationWarningText: themePrimitives.warning200,
119
+ notificationWarningText: themePrimitives.primaryA,
116
120
  notificationNegativeBackground: themePrimitives.negative700,
117
- notificationNegativeText: themePrimitives.negative200,
121
+ notificationNegativeText: themePrimitives.primaryA,
118
122
  // Tag
119
123
  // Custom ramps
120
124
  tagFontDisabledRampUnit: '600',
@@ -274,11 +278,16 @@ export default ((themePrimitives = colorTokens) => ({
274
278
  tableFilterFooterBackground: themePrimitives.mono800,
275
279
  // Toast
276
280
  toastText: themePrimitives.white,
277
- toastPrimaryBackground: themePrimitives.primary500,
278
- toastInfoBackground: themePrimitives.accent500,
279
- toastPositiveBackground: themePrimitives.positive500,
280
- toastWarningBackground: themePrimitives.warning500,
281
- toastNegativeBackground: themePrimitives.negative500,
281
+ toastPrimaryBackground: themePrimitives.primary400,
282
+ toastPrimaryText: themePrimitives.white,
283
+ toastInfoBackground: themePrimitives.accent400,
284
+ toastInfoText: themePrimitives.white,
285
+ toastPositiveBackground: themePrimitives.positive400,
286
+ toastPositiveText: themePrimitives.white,
287
+ toastWarningBackground: themePrimitives.warning400,
288
+ toastWarningText: themePrimitives.black,
289
+ toastNegativeBackground: themePrimitives.negative400,
290
+ toastNegativeText: themePrimitives.white,
282
291
  // Toggle
283
292
  toggleFill: themePrimitives.mono300,
284
293
  toggleFillChecked: themePrimitives.primary,
@@ -36,6 +36,8 @@ export default ((themePrimitives = colorTokens) => ({
36
36
  buttonTertiaryActive: themePrimitives.primary100,
37
37
  buttonTertiarySelectedFill: themePrimitives.primary100,
38
38
  buttonTertiarySelectedText: themePrimitives.primary,
39
+ buttonTertiaryDisabledActiveFill: themePrimitives.primary50,
40
+ buttonTertiaryDisabledActiveText: themePrimitives.mono600,
39
41
  buttonTertiarySpinnerForeground: themePrimitives.accent,
40
42
  buttonTertiarySpinnerBackground: themePrimitives.primary100,
41
43
  buttonMinimalFill: 'transparent',
@@ -48,6 +50,8 @@ export default ((themePrimitives = colorTokens) => ({
48
50
  buttonMinimalSpinnerBackground: themePrimitives.primary100,
49
51
  buttonDisabledFill: themePrimitives.mono200,
50
52
  buttonDisabledText: themePrimitives.mono600,
53
+ buttonDisabledActiveFill: themePrimitives.mono700,
54
+ buttonDisabledActiveText: themePrimitives.mono100,
51
55
  buttonDisabledSpinnerForeground: themePrimitives.mono600,
52
56
  buttonDisabledSpinnerBackground: themePrimitives.mono400,
53
57
  // Breadcrumbs
@@ -182,15 +186,15 @@ export default ((themePrimitives = colorTokens) => ({
182
186
  tabColor: themePrimitives.mono800,
183
187
  // Notification
184
188
  notificationPrimaryBackground: themePrimitives.primary50,
185
- notificationPrimaryText: themePrimitives.primary500,
189
+ notificationPrimaryText: themePrimitives.primaryA,
186
190
  notificationInfoBackground: themePrimitives.accent50,
187
- notificationInfoText: themePrimitives.accent500,
191
+ notificationInfoText: themePrimitives.primaryA,
188
192
  notificationPositiveBackground: themePrimitives.positive50,
189
- notificationPositiveText: themePrimitives.positive500,
193
+ notificationPositiveText: themePrimitives.primaryA,
190
194
  notificationWarningBackground: themePrimitives.warning50,
191
- notificationWarningText: themePrimitives.warning500,
195
+ notificationWarningText: themePrimitives.primaryA,
192
196
  notificationNegativeBackground: themePrimitives.negative50,
193
- notificationNegativeText: themePrimitives.negative500,
197
+ notificationNegativeText: themePrimitives.primaryA,
194
198
  // Tag
195
199
  // Custom ramps
196
200
  tagFontDisabledRampUnit: '100',
@@ -349,11 +353,16 @@ export default ((themePrimitives = colorTokens) => ({
349
353
  tableFilterFooterBackground: themePrimitives.mono200,
350
354
  // Toast
351
355
  toastText: themePrimitives.white,
352
- toastPrimaryBackground: themePrimitives.primary500,
353
- toastInfoBackground: themePrimitives.accent500,
354
- toastPositiveBackground: themePrimitives.positive500,
355
- toastWarningBackground: themePrimitives.warning500,
356
- toastNegativeBackground: themePrimitives.negative500,
356
+ toastPrimaryBackground: themePrimitives.primary400,
357
+ toastPrimaryText: themePrimitives.white,
358
+ toastInfoBackground: themePrimitives.accent400,
359
+ toastInfoText: themePrimitives.white,
360
+ toastPositiveBackground: themePrimitives.positive400,
361
+ toastPositiveText: themePrimitives.white,
362
+ toastWarningBackground: themePrimitives.warning400,
363
+ toastWarningText: themePrimitives.black,
364
+ toastNegativeBackground: themePrimitives.negative400,
365
+ toastNegativeText: themePrimitives.white,
357
366
  // Spinner
358
367
  spinnerTrackFill: themePrimitives.mono900,
359
368
  // Progress bar
@@ -10,11 +10,11 @@ LICENSE file in the root directory of this source tree.
10
10
  */
11
11
  // global Intl
12
12
  import * as React from 'react';
13
- import { findTimeZone, getZonedTime, listTimeZones } from 'timezone-support/dist/index-1900-2050.js';
14
- import { formatZonedTime } from 'timezone-support/dist/parse-format.js';
13
+ import { format, getTimezoneOffset } from 'date-fns-tz';
15
14
  import { getOverrides, mergeOverrides } from '../helpers/overrides.js';
16
15
  import { LocaleContext } from '../locale/index.js';
17
16
  import { Select } from '../select/index.js';
17
+ import { zones } from './tzdata.js';
18
18
 
19
19
  class TimezonePicker extends React.Component {
20
20
  constructor(...args) {
@@ -25,42 +25,49 @@ class TimezonePicker extends React.Component {
25
25
  value: null
26
26
  });
27
27
 
28
- _defineProperty(this, "buildTimezones", compareDate => listTimeZones().map(zone => {
29
- const timezone = findTimeZone(zone);
30
- const zonedTime = getZonedTime(compareDate, timezone);
31
- const offsetTime = (zonedTime.zone.offset < 0 ? '+' : '-') + Math.abs(zonedTime.zone.offset / 60);
32
- const abbreviation = formatZonedTime(zonedTime, 'z');
33
- const formatted = `(GMT ${offsetTime}) ${zone}${this.props.includeAbbreviations ? ` - ${abbreviation}` : ''}`.replace('_', ' ');
34
- const option = {
35
- id: zone,
36
- label: formatted,
37
- offset: zonedTime.zone.offset
38
- };
39
-
40
- if (this.props.mapLabels) {
41
- option.label = this.props.mapLabels(option);
42
- }
28
+ _defineProperty(this, "buildTimezones", compareDate => {
29
+ const timezones = [];
30
+
31
+ for (const zoneName of zones) {
32
+ try {
33
+ const offset = getTimezoneOffset(zoneName, compareDate) / 3_600_000;
34
+ const offsetFormatted = `${offset >= 0 ? '+' : '-'}${Math.abs(offset)}`;
35
+ let label = `(GMT${offsetFormatted}) ${zoneName.replace('_', ' ')}`;
36
+
37
+ if (this.props.includeAbbreviations) {
38
+ const abbreviation = format(compareDate, 'zzz', {
39
+ timeZone: zoneName
40
+ });
41
+
42
+ if (abbreviation) {
43
+ label += ` - ${abbreviation}`;
44
+ }
45
+ }
46
+
47
+ timezones.push({
48
+ id: zoneName,
49
+ label,
50
+ offset
51
+ });
52
+ } catch (error) {
53
+ // Ignores timezones that are not available within a user's browser/operating system
54
+ console.error(`failed to format zone name ${zoneName}`);
55
+ }
56
+ } // Sorts W -> E, prioritizes america. could be more nuanced based on system tz but simple for now
43
57
 
44
- return option;
45
- }) // Formats 'noisy' timezones without a letter acronym.
46
- .map(option => {
47
- const rgx = /(\s-\s(\+|-)\d\d\d?\d?)$/;
48
- const matches = option.label.match(rgx);
49
58
 
50
- if (matches) {
51
- const prefix = matches[0];
52
- option.label = option.label.split(prefix)[0];
53
- }
59
+ return timezones.sort((a, b) => {
60
+ const offsetDelta = b.offset - a.offset;
61
+ if (offsetDelta !== 0) return offsetDelta;
62
+
63
+ if (typeof a.label === 'string' && typeof b.label === 'string') {
64
+ if (a.label < b.label) return -1;
65
+ if (a.label > b.label) return 1;
66
+ }
54
67
 
55
- return option;
56
- }) // Sorts W -> E, prioritizes america. could be more nuanced based on system tz but simple for now
57
- .sort((a, b) => {
58
- const offsetDelta = b.offset - a.offset;
59
- if (offsetDelta !== 0) return offsetDelta;
60
- if (a.label < b.label) return -1;
61
- if (a.label > b.label) return 1;
62
- return 0;
63
- }));
68
+ return 0;
69
+ });
70
+ });
64
71
  }
65
72
 
66
73
  componentDidMount() {
@@ -116,9 +123,19 @@ class TimezonePicker extends React.Component {
116
123
  selectProps.overrides); // $FlowFixMe
117
124
 
118
125
  selectProps.overrides = selectOverrides;
126
+ let options = this.state.timezones;
127
+
128
+ if (this.props.mapLabels) {
129
+ options = options.map(option => {
130
+ // $FlowFixMe - TimezoneT.label is a string, but mapLabels can return a React.Node
131
+ option.label = this.props.mapLabels(option);
132
+ return option;
133
+ });
134
+ }
135
+
119
136
  return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, locale => /*#__PURE__*/React.createElement(OverriddenSelect, _extends({
120
137
  "aria-label": locale.datepicker.timezonePickerAriaLabel,
121
- options: this.state.timezones,
138
+ options: options,
122
139
  clearable: false,
123
140
  disabled: this.props.disabled,
124
141
  error: this.props.error,
@@ -0,0 +1,2 @@
1
+ /* eslint-disable header/header */
2
+ export const 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,69 @@
1
+ /*
2
+ Copyright (c) Uber Technologies, Inc.
3
+
4
+ This source code is licensed under the MIT license found in the
5
+ LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ /* eslint-env node */
9
+ const fs = require('fs');
10
+
11
+ const path = require('path');
12
+
13
+ const util = require('util');
14
+
15
+ const exec = util.promisify(require('child_process').exec); // Download tzdata and collect a list of timezones. Baseui previously used a library
16
+ // to do this, but it grew stale and unmaintained. This approach is straightforward
17
+ // enough to update whenever necessary, but future improvements could include building
18
+ // this data set before baseui is published so that the data is always fresh.
19
+
20
+ async function main() {
21
+ try {
22
+ const tmpDir = path.join(__dirname, 'tmp'); // $FlowFixMe - flow is not aware of recursive option
23
+
24
+ await fs.promises.rmdir(tmpDir, {
25
+ recursive: true
26
+ });
27
+ await fs.promises.mkdir(tmpDir);
28
+ const src = `https://www.iana.org/time-zones/repository/tzdata-latest.tar.gz`;
29
+ await exec(`curl -L ${src} | gzip -dc | tar -xf - --directory ${tmpDir}`);
30
+ const zoneTabPath = path.join(tmpDir, 'zone1970.tab');
31
+ const content = await fs.promises.readFile(zoneTabPath, 'utf-8');
32
+ const lines = content.split('\n');
33
+ const zones = [];
34
+
35
+ for (const line of lines) {
36
+ if (line[0] === '#') {
37
+ continue;
38
+ }
39
+
40
+ const parts = line.split(/\s+/);
41
+
42
+ if (parts.length >= 3) {
43
+ zones.push(parts[2]);
44
+ }
45
+ }
46
+
47
+ const file = [];
48
+ file.push('/* eslint-disable header/header */');
49
+ file.push('// @flow');
50
+ file.push('');
51
+ file.push('export const zones = [');
52
+
53
+ for (const zone of zones) {
54
+ file.push(` '${zone}',`);
55
+ }
56
+
57
+ file.push('];');
58
+ const tzdataPath = path.join(__dirname, 'tzdata.js');
59
+ await fs.promises.writeFile(tzdataPath, file.join('\n')); // $FlowFixMe - flow is not aware of recursive option
60
+
61
+ await fs.promises.rmdir(tmpDir, {
62
+ recursive: true
63
+ });
64
+ } catch (error) {
65
+ console.error(error);
66
+ }
67
+ }
68
+
69
+ main();
@@ -18,12 +18,23 @@ function getBackgroundColor(kind, type, theme) {
18
18
  }[kind];
19
19
  }
20
20
 
21
- function getFontColor(kind, theme) {
21
+ function getFontColor(kind, type, theme) {
22
+ const isInline = type === TYPE.inline;
23
+
24
+ if (isInline) {
25
+ return {
26
+ [KIND.info]: theme.colors.notificationInfoText,
27
+ [KIND.positive]: theme.colors.notificationPositiveText,
28
+ [KIND.warning]: theme.colors.notificationWarningText,
29
+ [KIND.negative]: theme.colors.notificationNegativeText
30
+ }[kind];
31
+ }
32
+
22
33
  return {
23
- [KIND.info]: theme.colors.notificationInfoText,
24
- [KIND.positive]: theme.colors.notificationPositiveText,
25
- [KIND.warning]: theme.colors.notificationWarningText,
26
- [KIND.negative]: theme.colors.notificationNegativeText
34
+ [KIND.info]: theme.colors.toastInfoText,
35
+ [KIND.positive]: theme.colors.toastPositiveText,
36
+ [KIND.warning]: theme.colors.toastWarningText,
37
+ [KIND.negative]: theme.colors.toastNegativeText
27
38
  }[kind];
28
39
  }
29
40
 
@@ -99,9 +110,9 @@ export const Body = styled('div', props => {
99
110
  $theme
100
111
  } = props;
101
112
  const isInline = $type === TYPE.inline;
102
- return { ...$theme.typography.font250,
113
+ return { ...$theme.typography.font300,
103
114
  pointerEvents: 'auto',
104
- color: isInline ? getFontColor($kind, $theme) : $theme.colors.toastText,
115
+ color: getFontColor($kind, $type, $theme),
105
116
  height: 'auto',
106
117
  width: '288px',
107
118
  paddingTop: $theme.sizing.scale600,
package/esm/a11y/a11y.js CHANGED
@@ -21,7 +21,7 @@ LICENSE file in the root directory of this source tree.
21
21
  import * as React from 'react';
22
22
  import axe from 'axe-core';
23
23
  import { Layer, TetherBehavior, TETHER_PLACEMENT } from '../layer/index.js';
24
- import { Paragraph3, Caption1 } from '../typography/index.js';
24
+ import { ParagraphSmall, ParagraphXSmall } from '../typography/index.js';
25
25
  import { styled } from '../styles/index.js';
26
26
  import { ThemeContext } from '../styles/theme-provider.js';
27
27
 
@@ -128,8 +128,8 @@ function Violation(props) {
128
128
  ref: setPopper,
129
129
  $top: "".concat(offset.top, "px") || '0px',
130
130
  $left: "".concat(offset.left, "px") || '0px'
131
- }, /*#__PURE__*/React.createElement(Caption1, null, props.target), props.violations.map(function (violation, index) {
132
- return /*#__PURE__*/React.createElement(Paragraph3, {
131
+ }, /*#__PURE__*/React.createElement(ParagraphXSmall, null, props.target), props.violations.map(function (violation, index) {
132
+ return /*#__PURE__*/React.createElement(ParagraphSmall, {
133
133
  key: index
134
134
  }, violation.description);
135
135
  }))));