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.
Files changed (174) 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 +307 -355
  11. package/data-table/column-numerical.js.flow +273 -287
  12. package/data-table/constants.js +17 -11
  13. package/data-table/constants.js.flow +11 -8
  14. package/data-table/data-table.js +53 -50
  15. package/data-table/data-table.js.flow +18 -13
  16. package/data-table/filter-shell.js +27 -4
  17. package/data-table/filter-shell.js.flow +33 -9
  18. package/data-table/locale.js +4 -2
  19. package/data-table/locale.js.flow +6 -2
  20. package/data-table/measure-column-widths.js +83 -121
  21. package/data-table/measure-column-widths.js.flow +87 -109
  22. package/datepicker/styled-components.js +1 -1
  23. package/datepicker/styled-components.js.flow +4 -1
  24. package/drawer/drawer.js +3 -1
  25. package/drawer/drawer.js.flow +7 -1
  26. package/es/a11y/a11y.js +2 -2
  27. package/es/button/styled-components.js +32 -2
  28. package/es/combobox/combobox.js +6 -3
  29. package/es/data-table/column-categorical.js +2 -2
  30. package/es/data-table/column-numerical.js +245 -317
  31. package/es/data-table/constants.js +12 -8
  32. package/es/data-table/data-table.js +18 -16
  33. package/es/data-table/filter-shell.js +26 -4
  34. package/es/data-table/locale.js +4 -2
  35. package/es/data-table/measure-column-widths.js +75 -86
  36. package/es/datepicker/styled-components.js +1 -1
  37. package/es/drawer/drawer.js +3 -1
  38. package/es/index.js +1 -1
  39. package/es/map-marker/badge-enhancer.js +61 -0
  40. package/es/map-marker/constants.js +146 -2
  41. package/es/map-marker/drag-shadow.js +32 -0
  42. package/es/map-marker/fixed-marker.js +54 -48
  43. package/es/map-marker/floating-marker.js +21 -12
  44. package/es/map-marker/index.js +1 -1
  45. package/es/map-marker/label-enhancer.js +39 -0
  46. package/es/map-marker/needle.js +26 -0
  47. package/es/map-marker/pin-head.js +42 -40
  48. package/es/map-marker/styled-components.js +177 -32
  49. package/es/map-marker/types.js +1 -1
  50. package/es/menu/maybe-child-menu.js +0 -2
  51. package/es/menu/nested-menus.js +49 -3
  52. package/es/menu/stateful-container.js +13 -12
  53. package/es/modal/modal.js +3 -1
  54. package/es/popover/popover.js +7 -3
  55. package/es/progress-bar/index.js +1 -1
  56. package/es/progress-bar/progressbar.js +25 -10
  57. package/es/progress-bar/styled-components.js +9 -5
  58. package/es/select/select-component.js +2 -10
  59. package/es/spinner/styled-components.js +34 -16
  60. package/es/table/filter.js +3 -1
  61. package/es/themes/dark-theme/color-component-tokens.js +19 -10
  62. package/es/themes/light-theme/color-component-tokens.js +19 -10
  63. package/es/timezonepicker/timezone-picker.js +53 -36
  64. package/es/timezonepicker/tzdata.js +2 -0
  65. package/es/timezonepicker/update-tzdata.js +69 -0
  66. package/es/toast/styled-components.js +18 -7
  67. package/esm/a11y/a11y.js +3 -3
  68. package/esm/button/styled-components.js +47 -18
  69. package/esm/combobox/combobox.js +6 -3
  70. package/esm/data-table/column-categorical.js +2 -2
  71. package/esm/data-table/column-numerical.js +304 -353
  72. package/esm/data-table/constants.js +12 -8
  73. package/esm/data-table/data-table.js +53 -50
  74. package/esm/data-table/filter-shell.js +26 -4
  75. package/esm/data-table/locale.js +4 -2
  76. package/esm/data-table/measure-column-widths.js +83 -121
  77. package/esm/datepicker/styled-components.js +1 -1
  78. package/esm/drawer/drawer.js +3 -1
  79. package/esm/index.js +1 -1
  80. package/esm/map-marker/badge-enhancer.js +79 -0
  81. package/esm/map-marker/constants.js +94 -4
  82. package/esm/map-marker/drag-shadow.js +53 -0
  83. package/esm/map-marker/fixed-marker.js +84 -80
  84. package/esm/map-marker/floating-marker.js +22 -13
  85. package/esm/map-marker/index.js +1 -1
  86. package/esm/map-marker/label-enhancer.js +60 -0
  87. package/esm/map-marker/needle.js +43 -0
  88. package/esm/map-marker/pin-head.js +77 -66
  89. package/esm/map-marker/styled-components.js +182 -51
  90. package/esm/map-marker/types.js +1 -1
  91. package/esm/menu/maybe-child-menu.js +0 -2
  92. package/esm/menu/nested-menus.js +66 -5
  93. package/esm/menu/stateful-container.js +15 -13
  94. package/esm/modal/modal.js +3 -1
  95. package/esm/popover/popover.js +7 -3
  96. package/esm/progress-bar/index.js +1 -1
  97. package/esm/progress-bar/progressbar.js +32 -10
  98. package/esm/progress-bar/styled-components.js +9 -4
  99. package/esm/select/select-component.js +2 -11
  100. package/esm/spinner/styled-components.js +35 -16
  101. package/esm/table/filter.js +3 -1
  102. package/esm/themes/dark-theme/color-component-tokens.js +19 -10
  103. package/esm/themes/light-theme/color-component-tokens.js +19 -10
  104. package/esm/timezonepicker/timezone-picker.js +64 -36
  105. package/esm/timezonepicker/tzdata.js +2 -0
  106. package/esm/timezonepicker/update-tzdata.js +160 -0
  107. package/esm/toast/styled-components.js +13 -5
  108. package/index.js +6 -0
  109. package/index.js.flow +1 -1
  110. package/map-marker/badge-enhancer.js +90 -0
  111. package/map-marker/badge-enhancer.js.flow +86 -0
  112. package/map-marker/constants.js +103 -5
  113. package/map-marker/constants.js.flow +152 -0
  114. package/map-marker/drag-shadow.js +64 -0
  115. package/map-marker/drag-shadow.js.flow +52 -0
  116. package/map-marker/fixed-marker.js +84 -78
  117. package/map-marker/fixed-marker.js.flow +78 -66
  118. package/map-marker/floating-marker.js +22 -13
  119. package/map-marker/floating-marker.js.flow +30 -17
  120. package/map-marker/index.d.ts +125 -24
  121. package/map-marker/index.js +18 -0
  122. package/map-marker/index.js.flow +3 -0
  123. package/map-marker/label-enhancer.js +71 -0
  124. package/map-marker/label-enhancer.js.flow +63 -0
  125. package/map-marker/needle.js +54 -0
  126. package/map-marker/needle.js.flow +29 -0
  127. package/map-marker/pin-head.js +80 -69
  128. package/map-marker/pin-head.js.flow +122 -84
  129. package/map-marker/styled-components.js +200 -62
  130. package/map-marker/styled-components.js.flow +172 -22
  131. package/map-marker/types.js.flow +69 -20
  132. package/menu/index.d.ts +9 -4
  133. package/menu/maybe-child-menu.js +0 -2
  134. package/menu/maybe-child-menu.js.flow +0 -2
  135. package/menu/nested-menus.js +66 -5
  136. package/menu/nested-menus.js.flow +50 -5
  137. package/menu/stateful-container.js +15 -13
  138. package/menu/stateful-container.js.flow +19 -13
  139. package/menu/types.js.flow +7 -1
  140. package/modal/modal.js +3 -1
  141. package/modal/modal.js.flow +2 -0
  142. package/package.json +5 -4
  143. package/popover/popover.js +7 -3
  144. package/popover/popover.js.flow +23 -17
  145. package/progress-bar/index.d.ts +2 -0
  146. package/progress-bar/index.js +6 -0
  147. package/progress-bar/index.js.flow +1 -0
  148. package/progress-bar/progressbar.js +32 -10
  149. package/progress-bar/progressbar.js.flow +35 -9
  150. package/progress-bar/styled-components.js +9 -4
  151. package/progress-bar/styled-components.js.flow +15 -4
  152. package/progress-bar/types.js.flow +12 -2
  153. package/select/select-component.js +2 -11
  154. package/select/select-component.js.flow +5 -7
  155. package/spinner/styled-components.js +35 -16
  156. package/spinner/styled-components.js.flow +37 -19
  157. package/spinner/types.js.flow +10 -0
  158. package/styles/index.js.flow +1 -1
  159. package/table/filter.js +3 -1
  160. package/table/filter.js.flow +5 -1
  161. package/themes/dark-theme/color-component-tokens.js +19 -10
  162. package/themes/dark-theme/color-component-tokens.js.flow +19 -10
  163. package/themes/light-theme/color-component-tokens.js +19 -10
  164. package/themes/light-theme/color-component-tokens.js.flow +19 -10
  165. package/themes/types.js.flow +9 -0
  166. package/timezonepicker/timezone-picker.js +69 -41
  167. package/timezonepicker/timezone-picker.js.flow +52 -46
  168. package/timezonepicker/types.js.flow +1 -1
  169. package/timezonepicker/tzdata.js +10 -0
  170. package/timezonepicker/tzdata.js.flow +347 -0
  171. package/timezonepicker/update-tzdata.js +164 -0
  172. package/timezonepicker/update-tzdata.js.flow +70 -0
  173. package/toast/styled-components.js +13 -5
  174. package/toast/styled-components.js.flow +17 -7
@@ -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
  }))));
@@ -43,11 +43,14 @@ export var BaseButton = styled('button', function (_ref) {
43
43
  transitionDuration: $theme.animation.timing200,
44
44
  transitionTimingFunction: $theme.animation.linearCurve,
45
45
  cursor: 'pointer',
46
- ':disabled': {
47
- cursor: 'not-allowed',
48
- backgroundColor: $kind === KIND.minimal || $kind === KIND.tertiary ? 'transparent' : $theme.colors.buttonDisabledFill,
49
- color: $theme.colors.buttonDisabledText
50
- },
46
+ ':disabled': _objectSpread({
47
+ cursor: 'not-allowed'
48
+ }, getDisabledStyles({
49
+ $theme: $theme,
50
+ $kind: $kind,
51
+ $disabled: $disabled,
52
+ $isSelected: $isSelected
53
+ })),
51
54
  marginLeft: 0,
52
55
  marginTop: 0,
53
56
  marginRight: 0,
@@ -267,10 +270,36 @@ function getFontStyles(_ref10) {
267
270
  }
268
271
  }
269
272
 
270
- function getPaddingStyles(_ref11) {
273
+ function getDisabledStyles(_ref11) {
271
274
  var $theme = _ref11.$theme,
272
- $size = _ref11.$size,
273
- $shape = _ref11.$shape;
275
+ $kind = _ref11.$kind,
276
+ $isSelected = _ref11.$isSelected,
277
+ $disabled = _ref11.$disabled;
278
+
279
+ if ($disabled && $isSelected) {
280
+ if ($kind === KIND.primary || $kind === KIND.secondary) {
281
+ return {
282
+ color: $theme.colors.buttonDisabledActiveText,
283
+ backgroundColor: $theme.colors.buttonDisabledActiveFill
284
+ };
285
+ } else if ($kind === KIND.minimal || $kind === KIND.tertiary) {
286
+ return {
287
+ backgroundColor: $theme.colors.buttonTertiaryDisabledActiveFill,
288
+ color: $theme.colors.buttonTertiaryDisabledActiveText
289
+ };
290
+ }
291
+ }
292
+
293
+ return {
294
+ backgroundColor: $kind === KIND.minimal || $kind === KIND.tertiary ? 'transparent' : $theme.colors.buttonDisabledFill,
295
+ color: $theme.colors.buttonDisabledText
296
+ };
297
+ }
298
+
299
+ function getPaddingStyles(_ref12) {
300
+ var $theme = _ref12.$theme,
301
+ $size = _ref12.$size,
302
+ $shape = _ref12.$shape;
274
303
  var iconShape = $shape === SHAPE.square || $shape === SHAPE.circle || $shape === SHAPE.round;
275
304
 
276
305
  switch ($size) {
@@ -308,12 +337,12 @@ function getPaddingStyles(_ref11) {
308
337
  }
309
338
  }
310
339
 
311
- function getKindStyles(_ref12) {
312
- var $theme = _ref12.$theme,
313
- $isLoading = _ref12.$isLoading,
314
- $isSelected = _ref12.$isSelected,
315
- $kind = _ref12.$kind,
316
- $disabled = _ref12.$disabled;
340
+ function getKindStyles(_ref13) {
341
+ var $theme = _ref13.$theme,
342
+ $isLoading = _ref13.$isLoading,
343
+ $isSelected = _ref13.$isSelected,
344
+ $kind = _ref13.$kind,
345
+ $disabled = _ref13.$disabled;
317
346
 
318
347
  if ($disabled) {
319
348
  return Object.freeze({});
@@ -401,10 +430,10 @@ function getKindStyles(_ref12) {
401
430
  }
402
431
  }
403
432
 
404
- function getShapeStyles(_ref13) {
405
- var $theme = _ref13.$theme,
406
- $shape = _ref13.$shape,
407
- $size = _ref13.$size;
433
+ function getShapeStyles(_ref14) {
434
+ var $theme = _ref14.$theme,
435
+ $shape = _ref14.$shape,
436
+ $size = _ref14.$size;
408
437
 
409
438
  if ($shape === SHAPE.circle || $shape === SHAPE.square) {
410
439
  var height, width;
@@ -46,6 +46,7 @@ function Combobox(props) {
46
46
  onChange = props.onChange,
47
47
  onFocus = props.onFocus,
48
48
  onSubmit = props.onSubmit,
49
+ listBoxLabel = props.listBoxLabel,
49
50
  mapOptionToNode = props.mapOptionToNode,
50
51
  mapOptionToString = props.mapOptionToString,
51
52
  id = props.id,
@@ -308,6 +309,7 @@ function Combobox(props) {
308
309
  ,
309
310
  ref: listboxRef,
310
311
  role: "listbox",
312
+ "aria-label": listBoxLabel,
311
313
  $width: listboxWidth
312
314
  }, listBoxProps), options.map(function (option, index) {
313
315
  var isSelected = selectionIndex === index;
@@ -346,9 +348,8 @@ function Combobox(props) {
346
348
  role: "combobox"
347
349
  }, inputContainerProps), /*#__PURE__*/React.createElement(OverriddenInput, _extends({
348
350
  inputRef: handleInputRef,
349
- "aria-activedescendant": selectionIndex >= 0 ? activeDescendantId : undefined,
351
+ "aria-activedescendant": isOpen && selectionIndex >= 0 ? activeDescendantId : undefined,
350
352
  "aria-autocomplete": "list",
351
- "aria-controls": listboxId,
352
353
  disabled: disabled,
353
354
  error: error,
354
355
  name: name,
@@ -361,7 +362,9 @@ function Combobox(props) {
361
362
  positive: positive,
362
363
  size: size,
363
364
  value: tempValue ? tempValue : value
364
- }, restInputProps)))));
365
+ }, isOpen ? {
366
+ 'aria-controls': listboxId
367
+ } : {}, restInputProps)))));
365
368
  }
366
369
 
367
370
  export default Combobox;
@@ -29,7 +29,7 @@ import { Checkbox, StyledLabel } from '../checkbox/index.js';
29
29
  import Search from '../icon/search.js';
30
30
  import { Input, SIZE as INPUT_SIZE } from '../input/index.js';
31
31
  import { useStyletron, withStyle } from '../styles/index.js';
32
- import { Label3 } from '../typography/index.js';
32
+ import { LabelSmall } from '../typography/index.js';
33
33
  import Column from './column.js';
34
34
  import { COLUMNS } from './constants.js';
35
35
  import { LocaleContext } from '../locale/index.js';
@@ -186,7 +186,7 @@ export function CategoricalFilter(props) {
186
186
  overflowY: 'auto',
187
187
  marginTop: theme.sizing.scale600
188
188
  })
189
- }, !filteredCategories.length && /*#__PURE__*/React.createElement(Label3, null, locale.datatable.categoricalFilterEmpty), Boolean(filteredCategories.length) && filteredCategories.map(function (category, i) {
189
+ }, !filteredCategories.length && /*#__PURE__*/React.createElement(LabelSmall, null, locale.datatable.categoricalFilterEmpty), Boolean(filteredCategories.length) && filteredCategories.map(function (category, i) {
190
190
  return /*#__PURE__*/React.createElement("div", {
191
191
  className: checkboxStyles,
192
192
  key: i