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
@@ -5,7 +5,7 @@ This source code is licensed under the MIT license found in the
5
5
  LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { styled } from '../styles/index.js';
8
- import { FLOATING_MARKER_ANCHOR_POSITIONS, xSmallPinheadDimension } from './constants.js';
8
+ import { BADGE_ENHANCER_STYLES, FLOATING_MARKER_ANCHOR_POSITIONS, LABEL_SIZES } from './constants.js';
9
9
  export const getAnchorTransform = (anchor, anchorSize) => ({
10
10
  [FLOATING_MARKER_ANCHOR_POSITIONS.none]: ``,
11
11
  [FLOATING_MARKER_ANCHOR_POSITIONS.topLeft]: `translate(${anchorSize}px, ${anchorSize}px)`,
@@ -13,7 +13,7 @@ export const getAnchorTransform = (anchor, anchorSize) => ({
13
13
  [FLOATING_MARKER_ANCHOR_POSITIONS.bottomLeft]: `translate(${anchorSize}px, -100%)`,
14
14
  [FLOATING_MARKER_ANCHOR_POSITIONS.bottomRight]: `translate(-100%, -100%)`
15
15
  })[anchor];
16
- export const DragShadowContainer = styled('div', ({
16
+ export const StyledDragShadowContainer = styled('div', ({
17
17
  $theme,
18
18
  $height,
19
19
  $width,
@@ -27,38 +27,40 @@ export const DragShadowContainer = styled('div', ({
27
27
  position: 'relative',
28
28
  boxShadow: $theme.lighting.shadow600
29
29
  }));
30
- DragShadowContainer.displayName = "DragShadowContainer";
31
- export const DragShadow = styled('div', ({
30
+ StyledDragShadowContainer.displayName = "StyledDragShadowContainer";
31
+ export const StyledDragShadow = styled('div', ({
32
32
  $theme,
33
33
  $background,
34
34
  $width
35
35
  }) => ({
36
- background: $background,
36
+ backgroundColor: $background,
37
37
  borderRadius: '50%',
38
38
  width: `${$width}px`,
39
- height: `${4}px`,
39
+ height: '4px',
40
40
  position: 'absolute',
41
41
  bottom: 0
42
42
  }));
43
- DragShadow.displayName = "DragShadow";
44
- export const Needle = styled('div', ({
43
+ StyledDragShadow.displayName = "StyledDragShadow";
44
+ export const StyledNeedle = styled('div', ({
45
45
  $theme,
46
46
  $background,
47
47
  $height
48
48
  }) => ({
49
- background: $background,
49
+ backgroundColor: $background,
50
50
  width: '4px',
51
51
  height: `${$height}px`,
52
52
  boxShadow: $theme.lighting.shadow600
53
53
  }));
54
- Needle.displayName = "Needle";
55
- export const FloatingMarkerRoot = styled('div', () => ({
54
+ StyledNeedle.displayName = "StyledNeedle";
55
+ export const StyledFloatingMarkerRoot = styled('div', ({
56
+ $size
57
+ }) => ({
56
58
  position: 'relative',
57
- height: `${xSmallPinheadDimension.height}px`,
58
- width: `${xSmallPinheadDimension.height}px`
59
+ height: `${$size}px`,
60
+ width: `${$size}px`
59
61
  }));
60
- FloatingMarkerRoot.displayName = "FloatingMarkerRoot";
61
- export const FloatingMarkerPinHeadContainer = styled('div', ({
62
+ StyledFloatingMarkerRoot.displayName = "StyledFloatingMarkerRoot";
63
+ export const StyledFloatingMarkerPinHeadContainer = styled('div', ({
62
64
  $theme,
63
65
  $anchor,
64
66
  $anchorSize
@@ -67,38 +69,65 @@ export const FloatingMarkerPinHeadContainer = styled('div', ({
67
69
  transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
68
70
  transform: getAnchorTransform($anchor, $anchorSize)
69
71
  }));
70
- FloatingMarkerPinHeadContainer.displayName = "FloatingMarkerPinHeadContainer";
71
- export const FloatingMarkerAnchorContainer = styled('div', () => ({
72
+ StyledFloatingMarkerPinHeadContainer.displayName = "StyledFloatingMarkerPinHeadContainer";
73
+ export const StyledFloatingMarkerAnchorContainer = styled('div', () => ({
72
74
  position: 'absolute'
73
75
  }));
74
- FloatingMarkerAnchorContainer.displayName = "FloatingMarkerAnchorContainer";
75
- export const FixedMarkerRoot = styled('div', () => ({
76
+ StyledFloatingMarkerAnchorContainer.displayName = "StyledFloatingMarkerAnchorContainer";
77
+ export const StyledFixedMarkerRoot = styled('div', () => ({
76
78
  display: 'flex',
77
79
  alignItems: 'center',
78
80
  flexDirection: 'column'
79
81
  }));
80
- FixedMarkerRoot.displayName = "FixedMarkerRoot";
81
- export const FixedMarkerDragContainer = styled('div', ({
82
+ StyledFixedMarkerRoot.displayName = "StyledFixedMarkerRoot";
83
+ export const StyledFixedMarkerDragContainer = styled('div', ({
82
84
  $theme,
83
85
  $translateAmount,
84
86
  $performTranslate
85
87
  }) => {
86
88
  return {
87
- transform: `translateY(${$performTranslate ? '0px' : `${$translateAmount}px`})`,
89
+ transform: `translateY(${$performTranslate ? `${$translateAmount}px` : '0px'})`,
88
90
  transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
89
91
  display: 'flex',
90
92
  alignItems: 'center',
91
93
  flexDirection: 'column'
92
94
  };
93
95
  });
94
- FixedMarkerDragContainer.displayName = "FixedMarkerDragContainer";
95
- export const OuterXSmallAnchor = styled('div', ({
96
+ StyledFixedMarkerDragContainer.displayName = "StyledFixedMarkerDragContainer";
97
+ export const StyledOuterXXSmallAnchor = styled('div', ({
98
+ $theme,
99
+ $round,
100
+ $background,
101
+ $size
102
+ }) => ({
103
+ backgroundColor: $background,
104
+ display: 'flex',
105
+ alignItems: 'center',
106
+ justifyContent: 'center',
107
+ height: `${$size}px`,
108
+ width: `${$size}px`,
109
+ borderRadius: $round ? '50%' : 0,
110
+ boxShadow: $theme.lighting.shadow600
111
+ }));
112
+ StyledOuterXXSmallAnchor.displayName = "StyledOuterXXSmallAnchor";
113
+ export const StyledInnerXXSmallAnchor = styled('div', ({
114
+ $round,
115
+ $color,
116
+ $size
117
+ }) => ({
118
+ backgroundColor: $color,
119
+ height: `${$size}px`,
120
+ width: `${$size}px`,
121
+ borderRadius: $round ? '50%' : 0
122
+ }));
123
+ StyledInnerXXSmallAnchor.displayName = "StyledInnerXXSmallAnchor";
124
+ export const StyledOuterXSmallAnchor = styled('div', ({
96
125
  $theme,
97
126
  $round,
98
127
  $background,
99
128
  $size
100
129
  }) => ({
101
- background: $background,
130
+ backgroundColor: $background,
102
131
  display: 'flex',
103
132
  alignItems: 'center',
104
133
  justifyContent: 'center',
@@ -107,19 +136,19 @@ export const OuterXSmallAnchor = styled('div', ({
107
136
  borderRadius: $round ? '50%' : 0,
108
137
  boxShadow: $theme.lighting.shadow600
109
138
  }));
110
- OuterXSmallAnchor.displayName = "OuterXSmallAnchor";
111
- export const InnerXSmallAnchor = styled('div', ({
139
+ StyledOuterXSmallAnchor.displayName = "StyledOuterXSmallAnchor";
140
+ export const StyledInnerXSmallAnchor = styled('div', ({
112
141
  $round,
113
142
  $color,
114
143
  $size
115
144
  }) => ({
116
- background: $color,
145
+ backgroundColor: $color,
117
146
  height: `${$size}px`,
118
147
  width: `${$size}px`,
119
148
  borderRadius: $round ? '50%' : 0
120
149
  }));
121
- InnerXSmallAnchor.displayName = "InnerXSmallAnchor";
122
- export const PinHead = styled('div', ({
150
+ StyledInnerXSmallAnchor.displayName = "StyledInnerXSmallAnchor";
151
+ export const StyledPinHead = styled('div', ({
123
152
  $theme,
124
153
  $height,
125
154
  $background,
@@ -137,7 +166,7 @@ export const PinHead = styled('div', ({
137
166
  }
138
167
  };
139
168
  return {
140
- background: $background,
169
+ backgroundColor: $background,
141
170
  height: `${$height}px`,
142
171
  display: 'grid',
143
172
  gridTemplateColumns: $gridTemplateColumns,
@@ -153,4 +182,120 @@ export const PinHead = styled('div', ({
153
182
  })
154
183
  };
155
184
  });
156
- PinHead.displayName = "PinHead";
185
+ StyledPinHead.displayName = "StyledPinHead";
186
+ export const StyledStrokedLabelContainer = styled('div', ({
187
+ $position,
188
+ $theme,
189
+ $labelOffset
190
+ }) => {
191
+ const staticLabelOffset = 4;
192
+ const positions = {
193
+ top: {
194
+ left: `calc(50% + ${staticLabelOffset}px)`,
195
+ bottom: '100%',
196
+ alignItems: 'flex-end',
197
+ justifyContent: 'center',
198
+ textAlign: 'center'
199
+ },
200
+ bottom: {
201
+ left: '50%',
202
+ top: `calc(100% + ${staticLabelOffset}px + ${$labelOffset}px)`,
203
+ alignItems: 'flex-start',
204
+ justifyContent: 'center',
205
+ textAlign: 'center'
206
+ },
207
+ right: {
208
+ left: `calc(100% + ${staticLabelOffset}px)`,
209
+ top: '50%',
210
+ alignItems: 'center',
211
+ justifyContent: 'flex-start'
212
+ },
213
+ left: {
214
+ right: `calc(100% + ${staticLabelOffset}px)`,
215
+ top: '50%',
216
+ alignItems: 'center',
217
+ justifyContent: 'flex-end',
218
+ textAlign: 'right'
219
+ },
220
+ none: {}
221
+ };
222
+ return {
223
+ position: 'absolute',
224
+ width: '0px',
225
+ height: '0px',
226
+ pointerEvents: 'none',
227
+ display: 'flex',
228
+ ...positions[$position]
229
+ };
230
+ });
231
+ StyledStrokedLabelContainer.displayName = "StyledStrokedLabelContainer";
232
+ export const StyledStrokedLabel = styled('div', ({
233
+ $theme,
234
+ $size
235
+ }) => {
236
+ const strokeWidth = 1.5;
237
+ const strokeColor = $theme.colors.backgroundPrimary;
238
+ const textShadow = `-${strokeWidth}px -${strokeWidth}px 0 ${strokeColor},
239
+ 0 -${strokeWidth}px 0 ${strokeColor},
240
+ ${strokeWidth}px -${strokeWidth}px 0 ${strokeColor},
241
+ ${strokeWidth}px 0 0 ${strokeColor},
242
+ ${strokeWidth}px ${strokeWidth}px 0 ${strokeColor},
243
+ 0 ${strokeWidth}px 0 ${strokeColor},
244
+ -${strokeWidth}px ${strokeWidth}px 0 ${strokeColor},
245
+ -${strokeWidth}px 0 0 ${strokeColor}`;
246
+ return {
247
+ display: 'flex',
248
+ ...$theme.typography[LABEL_SIZES[$size]],
249
+ color: $theme.colors.primaryA,
250
+ transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
251
+ textShadow,
252
+ pointerEvents: 'auto',
253
+ width: 'max-content',
254
+ maxWidth: '200px'
255
+ };
256
+ });
257
+ StyledStrokedLabel.displayName = "StyledStrokedLabel";
258
+ export const StyledBadgeEnhancerRoot = styled('div', ({
259
+ $theme,
260
+ $size,
261
+ $position
262
+ }) => {
263
+ const {
264
+ x,
265
+ y
266
+ } = $position;
267
+ return {
268
+ position: 'absolute',
269
+ ...$theme.typography.LabelSmall,
270
+ backgroundColor: $theme.colors.backgroundAccent,
271
+ color: $theme.colors.primaryB,
272
+ boxSizing: 'border-box',
273
+ right: 0,
274
+ transform: `translate(calc(100% + ${x}px), ${y}px)`,
275
+ transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
276
+ ...BADGE_ENHANCER_STYLES[$size]
277
+ };
278
+ });
279
+ StyledBadgeEnhancerRoot.displayName = "StyledBadgeEnhancerRoot";
280
+ export const RelativeContainer = styled('div', () => {
281
+ return {
282
+ position: 'relative'
283
+ };
284
+ });
285
+ RelativeContainer.displayName = "RelativeContainer";
286
+ export const StyledContentItem = styled('div', ({
287
+ $theme,
288
+ $color,
289
+ $height,
290
+ $size
291
+ }) => {
292
+ return { ...$theme.typography[LABEL_SIZES[$size]],
293
+ display: 'flex',
294
+ alignItems: 'center',
295
+ textAlign: 'center',
296
+ lineHeight: `${$height}px`,
297
+ height: `${$height}px`,
298
+ color: $color
299
+ };
300
+ });
301
+ StyledContentItem.displayName = "StyledContentItem";
@@ -5,4 +5,4 @@ This source code is licensed under the MIT license found in the
5
5
  LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import * as React from 'react';
8
- import { FLOATING_MARKER_ANCHOR_POSITIONS, NEEDLE_SIZES, PINHEAD_SIZES_SHAPES, FLOATING_MARKER_SIZES, PINHEAD_TYPES, FLOATING_MARKER_ANCHOR_TYPES } from './constants.js';
8
+ import { FLOATING_MARKER_ANCHOR_POSITIONS, NEEDLE_SIZES, PINHEAD_SIZES_SHAPES, FLOATING_MARKER_SIZES, PINHEAD_TYPES, FLOATING_MARKER_ANCHOR_TYPES, BADGE_ENHANCER_SIZES, LABEL_ENHANCER_POSITIONS, KIND } from './constants.js';
@@ -43,8 +43,6 @@ export default function MaybeChildMenu(props) {
43
43
  overrides: mergeOverrides({
44
44
  Body: {
45
45
  props: {
46
- // Adds mouseleave to popover body so that child menu closes when user mouses out.
47
- onMouseLeave: props.resetParentMenu,
48
46
  // Trap tabbing when focused on a child menu. Popover mounts the element at the end of
49
47
  // the html body by default. If a user was to tab to the next element it would navigate
50
48
  // to elements not within the immediate area surrounding the menu.
@@ -12,6 +12,8 @@ export const NestedMenuContext = /*#__PURE__*/React.createContext({
12
12
  removeMenuFromNesting: () => {},
13
13
  getParentMenu: () => {},
14
14
  getChildMenu: () => {},
15
+ nestedMenuHoverIndex: -1,
16
+ isNestedMenuVisible: () => false,
15
17
  mountRef: {
16
18
  current: null
17
19
  }
@@ -30,16 +32,43 @@ export default class NestedMenus extends React.Component {
30
32
  super(...args);
31
33
 
32
34
  _defineProperty(this, "state", {
33
- menus: []
35
+ menus: [],
36
+ nestedMenuHoverIndex: -1
34
37
  });
35
38
 
36
39
  _defineProperty(this, "mountRef", /*#__PURE__*/React.createRef());
37
40
 
41
+ _defineProperty(this, "mouseLeaveTimeoueId", null);
42
+
43
+ _defineProperty(this, "handleMenuMouseLeave", event => {
44
+ this.mouseLeaveTimeoueId = setTimeout(() => {
45
+ this.setState({
46
+ nestedMenuHoverIndex: -1
47
+ });
48
+ }, 200);
49
+ });
50
+
51
+ _defineProperty(this, "handleMenuMouseEnter", event => {
52
+ if (typeof document !== 'undefined') {
53
+ clearTimeout(this.mouseLeaveTimeoueId);
54
+ const index = this.state.menus.findIndex(m => {
55
+ return m.current && event.currentTarget instanceof Node && m.current.contains(event.currentTarget);
56
+ });
57
+ this.setState({
58
+ nestedMenuHoverIndex: index
59
+ });
60
+ }
61
+ });
62
+
38
63
  _defineProperty(this, "addMenuToNesting", ref => {
39
64
  // check offsetHeight to determine if component is visible in the dom (0 means hidden)
40
65
  // we need to do this so that when we renderAll, the hidden seo-only child-menus don't
41
66
  // register themselves which would break the nesting logic
42
- if (ref.current && ref.current.offsetHeight) {
67
+ const element = ref.current;
68
+
69
+ if (element && element.offsetHeight) {
70
+ element.addEventListener('mouseenter', this.handleMenuMouseEnter);
71
+ element.addEventListener('mouseleave', this.handleMenuMouseLeave);
43
72
  this.setState(state => {
44
73
  return {
45
74
  menus: [...state.menus, ref]
@@ -50,7 +79,17 @@ export default class NestedMenus extends React.Component {
50
79
 
51
80
  _defineProperty(this, "removeMenuFromNesting", ref => {
52
81
  this.setState(state => {
53
- const nextMenus = state.menus.filter(r => r.current).filter(r => !isSame(r.current, ref.current));
82
+ for (const r of this.state.menus) {
83
+ if (r.current && isSame(r.current, ref.current)) {
84
+ const element = r.current;
85
+ element.removeEventListener('mouseenter', this.handleMenuMouseEnter);
86
+ element.removeEventListener('mouseleave', this.handleMenuMouseLeave);
87
+ }
88
+ }
89
+
90
+ const nextMenus = state.menus.filter(r => {
91
+ return r.current && !isSame(r.current, ref.current);
92
+ });
54
93
  return {
55
94
  menus: nextMenus
56
95
  };
@@ -70,6 +109,11 @@ export default class NestedMenus extends React.Component {
70
109
  const index = this.findMenuIndexByRef(ref) + 1;
71
110
  return this.state.menus[index];
72
111
  });
112
+
113
+ _defineProperty(this, "isNestedMenuVisible", ref => {
114
+ const index = this.findMenuIndexByRef(ref);
115
+ return index <= this.state.nestedMenuHoverIndex;
116
+ });
73
117
  }
74
118
 
75
119
  render() {
@@ -79,6 +123,8 @@ export default class NestedMenus extends React.Component {
79
123
  removeMenuFromNesting: this.removeMenuFromNesting,
80
124
  getParentMenu: this.getParentMenu,
81
125
  getChildMenu: this.getChildMenu,
126
+ isNestedMenuVisible: this.isNestedMenuVisible,
127
+ nestedMenuHoverIndex: this.state.nestedMenuHoverIndex,
82
128
  mountRef: this.mountRef
83
129
  }
84
130
  }, /*#__PURE__*/React.createElement(React.Fragment, null, this.props.children, /*#__PURE__*/React.createElement("span", {
@@ -34,6 +34,8 @@ const DEFAULT_PROPS = {
34
34
  removeMenuFromNesting: () => {},
35
35
  getParentMenu: () => {},
36
36
  getChildMenu: () => {},
37
+ nestedMenuHoverIndex: -1,
38
+ isNestedMenuVisible: () => false,
37
39
  forceHighlight: false
38
40
  };
39
41
 
@@ -223,16 +225,7 @@ class MenuStatefulContainerInner extends React.Component {
223
225
  });
224
226
  });
225
227
 
226
- _defineProperty(this, "handleMouseLeave", () => {
227
- const rootRef = this.props.rootRef ? this.props.rootRef : this.rootRef;
228
- const childMenu = this.props.getChildMenu && this.props.getChildMenu(rootRef);
229
-
230
- if (!this.props.forceHighlight && !childMenu) {
231
- this.internalSetState(STATE_CHANGE_TYPES.mouseLeave, {
232
- highlightedIndex: -1
233
- });
234
- }
235
- });
228
+ _defineProperty(this, "handleMouseLeave", event => {});
236
229
 
237
230
  _defineProperty(this, "getRequiredItemProps", (item, index) => {
238
231
  let itemRef = this.refList[index];
@@ -339,10 +332,12 @@ class MenuStatefulContainerInner extends React.Component {
339
332
  if (this.keyboardControlNode) this.keyboardControlNode.removeEventListener('keydown', this.onKeyDown);
340
333
  }
341
334
 
342
- this.props.removeMenuFromNesting && this.props.removeMenuFromNesting(rootRef);
335
+ if (this.props.removeMenuFromNesting) {
336
+ this.props.removeMenuFromNesting(rootRef);
337
+ }
343
338
  }
344
339
 
345
- componentDidUpdate(_, prevState) {
340
+ componentDidUpdate(prevProps, prevState) {
346
341
  if (typeof document !== 'undefined') {
347
342
  if (!prevState.isFocused && this.state.isFocused) {
348
343
  if (this.keyboardControlNode) this.keyboardControlNode.addEventListener('keydown', this.onKeyDown);
@@ -368,6 +363,12 @@ class MenuStatefulContainerInner extends React.Component {
368
363
  highlightedIndex: 0
369
364
  });
370
365
  }
366
+
367
+ if (this.props.isNestedMenuVisible && this.props.nestedMenuHoverIndex !== prevProps.nestedMenuHoverIndex && !this.props.isNestedMenuVisible(this.rootRef) && !this.props.forceHighlight) {
368
+ this.setState({
369
+ highlightedIndex: -1
370
+ });
371
+ }
371
372
  } // One array to hold all of list item refs
372
373
 
373
374
 
package/es/modal/modal.js CHANGED
@@ -300,7 +300,9 @@ class Modal extends React.Component {
300
300
  ref: this.getRef('DialogContainer')
301
301
  } : {};
302
302
  return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, locale => /*#__PURE__*/React.createElement(FocusLock, {
303
- disabled: !focusLock,
303
+ disabled: !focusLock // Allow focus to escape when UI is within an iframe
304
+ ,
305
+ crossFrame: false,
304
306
  returnFocus: returnFocus,
305
307
  autoFocus: autofocus !== null ? autofocus : autoFocus
306
308
  }, /*#__PURE__*/React.createElement(Root, _extends({
@@ -447,14 +447,18 @@ class PopoverInner extends React.Component {
447
447
  },
448
448
  onPopperUpdate: this.onPopperUpdate,
449
449
  placement: this.state.placement
450
- }, /*#__PURE__*/React.createElement(FocusLock, {
450
+ }, this.props.focusLock ? /*#__PURE__*/React.createElement(FocusLock, {
451
451
  disabled: !this.props.focusLock,
452
452
  noFocusGuards: false // see popover-focus-loop.scenario.js for why hover cannot return focus
453
453
  ,
454
454
  returnFocus: !this.isHoverTrigger() && this.props.returnFocus,
455
- autoFocus: this.state.autoFocusAfterPositioning,
455
+ autoFocus: this.state.autoFocusAfterPositioning // Allow focus to escape when UI is within an iframe
456
+ ,
457
+ crossFrame: false,
456
458
  focusOptions: this.props.focusOptions
457
- }, !this.props.focusLock && this.state.autoFocusAfterPositioning ? /*#__PURE__*/React.createElement(MoveFocusInside, null, this.renderPopover(renderedContent)) : this.renderPopover(renderedContent)))));
459
+ }, this.renderPopover(renderedContent)) : /*#__PURE__*/React.createElement(MoveFocusInside, {
460
+ disabled: !this.props.autoFocus && !this.state.autoFocusAfterPositioning
461
+ }, this.renderPopover(renderedContent)))));
458
462
  } else {
459
463
  rendered.push( /*#__PURE__*/React.createElement(Hidden, {
460
464
  key: "hidden-layer"
@@ -8,4 +8,4 @@ export { default as ProgressBar } from './progressbar.js';
8
8
  export { default as ProgressBarRounded } from './progressbar-rounded.js';
9
9
  export { SIZE } from './constants.js'; // Styled elements
10
10
 
11
- export { StyledRoot, StyledBarContainer, StyledBar, StyledBarProgress, StyledLabel, StyledProgressBarRoundedRoot, StyledProgressBarRoundedSvg, StyledProgressBarRoundedTrackBackground, StyledProgressBarRoundedTrackForeground, StyledProgressBarRoundedText } from './styled-components.js'; // Flow
11
+ export { StyledRoot, StyledBarContainer, StyledBar, StyledBarProgress, StyledInfiniteBar, StyledLabel, StyledProgressBarRoundedRoot, StyledProgressBarRoundedSvg, StyledProgressBarRoundedTrackBackground, StyledProgressBarRoundedTrackForeground, StyledProgressBarRoundedText } from './styled-components.js'; // Flow
@@ -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: {