baseui 10.8.0 → 10.9.2

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 (160) 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 +4 -0
  49. package/es/themes/light-theme/color-component-tokens.js +4 -0
  50. package/es/timezonepicker/timezone-picker.js +55 -36
  51. package/es/timezonepicker/tzdata.js +2 -0
  52. package/es/timezonepicker/update-tzdata.js +69 -0
  53. package/esm/a11y/a11y.js +3 -3
  54. package/esm/button/styled-components.js +47 -18
  55. package/esm/combobox/combobox.js +6 -3
  56. package/esm/data-table/column-categorical.js +2 -2
  57. package/esm/data-table/column-numerical.js +2 -2
  58. package/esm/datepicker/styled-components.js +1 -1
  59. package/esm/drawer/drawer.js +3 -1
  60. package/esm/form-control/form-control.js +60 -9
  61. package/esm/form-control/styled-components.js +23 -3
  62. package/esm/index.js +1 -1
  63. package/esm/map-marker/badge-enhancer.js +79 -0
  64. package/esm/map-marker/constants.js +94 -4
  65. package/esm/map-marker/drag-shadow.js +53 -0
  66. package/esm/map-marker/fixed-marker.js +84 -80
  67. package/esm/map-marker/floating-marker.js +22 -13
  68. package/esm/map-marker/index.js +1 -1
  69. package/esm/map-marker/label-enhancer.js +60 -0
  70. package/esm/map-marker/needle.js +43 -0
  71. package/esm/map-marker/pin-head.js +77 -66
  72. package/esm/map-marker/styled-components.js +182 -51
  73. package/esm/map-marker/types.js +1 -1
  74. package/esm/menu/maybe-child-menu.js +0 -2
  75. package/esm/menu/nested-menus.js +66 -5
  76. package/esm/menu/stateful-container.js +15 -13
  77. package/esm/modal/modal.js +3 -1
  78. package/esm/popover/popover.js +4 -2
  79. package/esm/progress-bar/index.js +1 -1
  80. package/esm/progress-bar/progressbar.js +32 -10
  81. package/esm/progress-bar/styled-components.js +9 -4
  82. package/esm/select/select-component.js +2 -11
  83. package/esm/spinner/styled-components.js +35 -16
  84. package/esm/table/filter.js +3 -1
  85. package/esm/themes/dark-theme/color-component-tokens.js +4 -0
  86. package/esm/themes/light-theme/color-component-tokens.js +4 -0
  87. package/esm/timezonepicker/timezone-picker.js +66 -36
  88. package/esm/timezonepicker/tzdata.js +2 -0
  89. package/esm/timezonepicker/update-tzdata.js +160 -0
  90. package/form-control/form-control.js +61 -8
  91. package/form-control/form-control.js.flow +82 -10
  92. package/form-control/index.d.ts +1 -0
  93. package/form-control/styled-components.js +27 -5
  94. package/form-control/styled-components.js.flow +25 -3
  95. package/form-control/types.js.flow +20 -8
  96. package/index.js +6 -0
  97. package/index.js.flow +1 -1
  98. package/map-marker/badge-enhancer.js +90 -0
  99. package/map-marker/badge-enhancer.js.flow +86 -0
  100. package/map-marker/constants.js +103 -5
  101. package/map-marker/constants.js.flow +152 -0
  102. package/map-marker/drag-shadow.js +64 -0
  103. package/map-marker/drag-shadow.js.flow +52 -0
  104. package/map-marker/fixed-marker.js +84 -78
  105. package/map-marker/fixed-marker.js.flow +78 -66
  106. package/map-marker/floating-marker.js +22 -13
  107. package/map-marker/floating-marker.js.flow +30 -17
  108. package/map-marker/index.d.ts +125 -24
  109. package/map-marker/index.js +18 -0
  110. package/map-marker/index.js.flow +3 -0
  111. package/map-marker/label-enhancer.js +71 -0
  112. package/map-marker/label-enhancer.js.flow +63 -0
  113. package/map-marker/needle.js +54 -0
  114. package/map-marker/needle.js.flow +29 -0
  115. package/map-marker/pin-head.js +80 -69
  116. package/map-marker/pin-head.js.flow +122 -84
  117. package/map-marker/styled-components.js +200 -62
  118. package/map-marker/styled-components.js.flow +172 -22
  119. package/map-marker/types.js.flow +69 -20
  120. package/menu/index.d.ts +9 -4
  121. package/menu/maybe-child-menu.js +0 -2
  122. package/menu/maybe-child-menu.js.flow +0 -2
  123. package/menu/nested-menus.js +66 -5
  124. package/menu/nested-menus.js.flow +50 -5
  125. package/menu/stateful-container.js +15 -13
  126. package/menu/stateful-container.js.flow +19 -13
  127. package/menu/types.js.flow +7 -1
  128. package/modal/modal.js +3 -1
  129. package/modal/modal.js.flow +2 -0
  130. package/package.json +4 -4
  131. package/popover/popover.js +4 -2
  132. package/popover/popover.js.flow +3 -1
  133. package/progress-bar/index.d.ts +2 -0
  134. package/progress-bar/index.js +6 -0
  135. package/progress-bar/index.js.flow +1 -0
  136. package/progress-bar/progressbar.js +32 -10
  137. package/progress-bar/progressbar.js.flow +35 -9
  138. package/progress-bar/styled-components.js +9 -4
  139. package/progress-bar/styled-components.js.flow +15 -4
  140. package/progress-bar/types.js.flow +12 -2
  141. package/select/select-component.js +2 -11
  142. package/select/select-component.js.flow +5 -7
  143. package/spinner/styled-components.js +35 -16
  144. package/spinner/styled-components.js.flow +37 -19
  145. package/spinner/types.js.flow +10 -0
  146. package/styles/index.js.flow +1 -1
  147. package/table/filter.js +3 -1
  148. package/table/filter.js.flow +5 -1
  149. package/themes/dark-theme/color-component-tokens.js +4 -0
  150. package/themes/dark-theme/color-component-tokens.js.flow +4 -0
  151. package/themes/light-theme/color-component-tokens.js +4 -0
  152. package/themes/light-theme/color-component-tokens.js.flow +4 -0
  153. package/themes/types.js.flow +4 -0
  154. package/timezonepicker/timezone-picker.js +71 -41
  155. package/timezonepicker/timezone-picker.js.flow +55 -46
  156. package/timezonepicker/types.js.flow +6 -1
  157. package/timezonepicker/tzdata.js +10 -0
  158. package/timezonepicker/tzdata.js.flow +347 -0
  159. package/timezonepicker/update-tzdata.js +164 -0
  160. package/timezonepicker/update-tzdata.js.flow +70 -0
@@ -13,15 +13,18 @@ import {
13
13
  FLOATING_MARKER_SIZES,
14
14
  PINHEAD_TYPES,
15
15
  FLOATING_MARKER_ANCHOR_TYPES,
16
+ BADGE_ENHANCER_SIZES,
17
+ LABEL_ENHANCER_POSITIONS,
18
+ KIND,
16
19
  } from './constants.js';
17
20
  import type {OverrideT} from '../helpers/overrides.js';
18
21
 
19
- export type PinHeadT = $Values<typeof PINHEAD_TYPES>;
20
-
21
22
  export type AnchorPositionsT = $Values<typeof FLOATING_MARKER_ANCHOR_POSITIONS>;
22
23
 
23
24
  export type NeedleSizeT = $Values<typeof NEEDLE_SIZES>;
24
25
 
26
+ export type PinHeadT = $Values<typeof PINHEAD_TYPES>;
27
+
25
28
  export type PinHeadSizeT = $Values<typeof PINHEAD_SIZES_SHAPES>;
26
29
 
27
30
  export type FloatingMarkerSizeT = $Values<typeof FLOATING_MARKER_SIZES>;
@@ -31,17 +34,11 @@ export type FloatingMarkerAnchorTypeT = $Values<
31
34
  typeof FLOATING_MARKER_ANCHOR_TYPES,
32
35
  >;
33
36
 
34
- export type NeedlePropsT = {
35
- size: NeedleSizeT,
36
- background?: string,
37
- overrides: FixedMarkerOverridesT,
38
- };
37
+ export type BadgeEnhancerSizeT = $Values<typeof BADGE_ENHANCER_SIZES>;
39
38
 
40
- export type ItemPropsT = {
41
- children?: React.Node,
42
- color?: string,
43
- size?: number,
44
- };
39
+ export type LabelEnhancerPositionT = $Values<typeof LABEL_ENHANCER_POSITIONS>;
40
+
41
+ export type KindT = $Values<typeof KIND>;
45
42
 
46
43
  export type FixedMarkerOverridesT = {
47
44
  Root?: OverrideT,
@@ -54,19 +51,63 @@ export type FixedMarkerOverridesT = {
54
51
  DragShadow?: OverrideT,
55
52
  DragShadowContainer?: OverrideT,
56
53
  DragContainer?: OverrideT,
54
+ BadgeEnhancer?: OverrideT,
55
+ LabelEnhancer?: OverrideT,
56
+ LabelEnhancerContainer?: OverrideT,
57
+ };
58
+
59
+ export type NeedlePropsT = {
60
+ size: NeedleSizeT,
61
+ background?: string,
62
+ overrides: FixedMarkerOverridesT,
57
63
  };
58
64
 
59
- export type FixedMarkerPropsT = {
65
+ export type ItemPropsT = {
66
+ children?: React.Node,
67
+ color?: string,
68
+ size?: number,
69
+ };
70
+
71
+ export type LabelEnhancerT = {|
72
+ labelEnhancerContent?: string,
73
+ labelEnhancerPosition?: LabelEnhancerPositionT,
74
+ |};
75
+
76
+ export type LabelEhancerComponentT = {
77
+ ...LabelEnhancerT,
78
+ needleHeight: number,
79
+ size: PinHeadSizeT,
80
+ overrides?: FixedMarkerOverridesT,
81
+ };
82
+
83
+ export type BadgeEnhancerT = {|
84
+ badgeEnhancerSize?: BadgeEnhancerSizeT | null,
85
+ badgeEnhancerContent?: React.AbstractComponent<{|size: number|}>,
86
+ |};
87
+
88
+ export type BadgeEnhancerComponentT = {
89
+ ...BadgeEnhancerT,
90
+ pinHeadSize: PinHeadSizeT,
91
+ markerType: PinHeadT,
92
+ overrides: FixedMarkerOverridesT,
93
+ };
94
+ export type BadgePositionT = {
95
+ x: number,
96
+ y: number,
97
+ };
98
+
99
+ export type FixedMarkerPropsT = {|
60
100
  size?: PinHeadSizeT,
61
101
  needle?: NeedleSizeT,
62
102
  label?: string,
63
103
  startEnhancer?: React.AbstractComponent<{|size: number|}>,
64
104
  endEnhancer?: React.AbstractComponent<{|size: number|}>,
65
- color?: string,
66
- background?: string,
105
+ kind?: KindT,
67
106
  dragging?: boolean,
68
107
  overrides?: FixedMarkerOverridesT,
69
- };
108
+ ...BadgeEnhancerT,
109
+ ...LabelEnhancerT,
110
+ |};
70
111
 
71
112
  export type FloatingMarkerOverridesT = {
72
113
  Root?: OverrideT,
@@ -76,11 +117,16 @@ export type FloatingMarkerOverridesT = {
76
117
  PinHeadContent?: OverrideT,
77
118
  PinHeadContainer?: OverrideT,
78
119
  AnchorContainer?: OverrideT,
120
+ Needle?: OverrideT,
121
+ DragShadow?: OverrideT,
122
+ DragShadowContainer?: OverrideT,
123
+ DragContainer?: OverrideT,
124
+ BadgeEnhancer?: OverrideT,
125
+ LabelEnhancer?: OverrideT,
126
+ LabelEnhancerContainer?: OverrideT,
79
127
  };
80
128
 
81
129
  export type FloatingMarkerPropsT = {
82
- color?: string,
83
- background?: string,
84
130
  label?: string,
85
131
  anchor?: AnchorPositionsT,
86
132
  endEnhancer?: React.AbstractComponent<{|size: number|}>,
@@ -95,11 +141,14 @@ export type PinHeadPropsT = {
95
141
  label?: string,
96
142
  endEnhancer?: React.AbstractComponent<{|size: number|}>,
97
143
  startEnhancer?: React.AbstractComponent<{|size: number|}>,
98
- color?: string,
99
- background?: string,
144
+ color: string,
145
+ background: string,
100
146
  type?: PinHeadT,
101
147
  anchorType?: FloatingMarkerAnchorTypeT,
148
+ needle?: NeedleSizeT,
102
149
  overrides?: FloatingMarkerOverridesT | FixedMarkerOverridesT,
150
+ ...BadgeEnhancerT,
151
+ ...LabelEnhancerT,
103
152
  };
104
153
 
105
154
  export type DragShadowPropsT = {
package/menu/index.d.ts CHANGED
@@ -69,7 +69,6 @@ export interface RenderItemProps {
69
69
  id?: string;
70
70
  isFocused?: boolean;
71
71
  isHighlighted?: boolean;
72
- resetMenu?: () => any;
73
72
  }
74
73
 
75
74
  export type OnItemSelect = (args: {
@@ -108,6 +107,8 @@ export interface StatefulContainerProps {
108
107
  removeMenuFromNesting?: (ref: React.Ref<HTMLElement>) => void;
109
108
  getParentMenu?: (ref: React.Ref<HTMLElement>) => void;
110
109
  getChildMenu?: (ref: React.Ref<HTMLElement>) => void;
110
+ nestedMenuHoverIndex?: nubmer;
111
+ isNestedMenuVisible?: (ref: React.Ref<HTMLElement>) => boolean;
111
112
  }
112
113
  export interface StatefulContainerState {
113
114
  activedescendantId?: string;
@@ -131,7 +132,6 @@ export interface OptionListProps extends BaseMenuPropsT {
131
132
  ChildMenuPopover?: Override<any>;
132
133
  };
133
134
  renderHrefAsAnchor?: boolean;
134
- resetMenu?: () => void;
135
135
  $isHighlighted?: boolean;
136
136
  $isFocused?: boolean;
137
137
  renderAll?: boolean;
@@ -148,7 +148,11 @@ export interface OptionProfileProps extends BaseMenuPropsT {
148
148
  getChildMenu?: (item: any) => React.ReactNode;
149
149
  getProfileItemLabels: (
150
150
  item: any,
151
- ) => {title?: string; subtitle?: string; body?: string};
151
+ ) => {
152
+ title?: string;
153
+ subtitle?: string;
154
+ body?: string;
155
+ };
152
156
  getProfileItemImg: (item: any) => string | React.ComponentType<any>;
153
157
  getProfileItemImgText: (item: any) => string;
154
158
  overrides?: {
@@ -161,7 +165,6 @@ export interface OptionProfileProps extends BaseMenuPropsT {
161
165
  ProfileBody?: Override<any>;
162
166
  ChildMenuPopover?: Override<any>;
163
167
  };
164
- resetMenu?: () => void;
165
168
  $isHighlighted?: boolean;
166
169
  }
167
170
  export const OptionProfile: React.FC<OptionProfileProps>;
@@ -200,6 +203,8 @@ export class NestedMenus extends React.Component<
200
203
  findMenuIndexByRef(ref: React.Ref<HTMLElement>): number;
201
204
  getParentMenu(ref: React.Ref<HTMLElement>): React.Ref<HTMLElement>;
202
205
  getChildMenu(ref: React.Ref<HTMLElement>): React.Ref<HTMLElement>;
206
+ nestedMenuHoverIndex: number;
207
+ isNestedMenuVisible(ref: React.Ref<HTMLElement>): boolean;
203
208
  }
204
209
 
205
210
  export const StyledEmptyState: StyletronComponent<any>;
@@ -70,8 +70,6 @@ function MaybeChildMenu(props) {
70
70
  overrides: (0, _overrides.mergeOverrides)({
71
71
  Body: {
72
72
  props: {
73
- // Adds mouseleave to popover body so that child menu closes when user mouses out.
74
- onMouseLeave: props.resetParentMenu,
75
73
  // Trap tabbing when focused on a child menu. Popover mounts the element at the end of
76
74
  // the html body by default. If a user was to tab to the next element it would navigate
77
75
  // to elements not within the immediate area surrounding the menu.
@@ -64,8 +64,6 @@ export default function MaybeChildMenu(props: PropsT) {
64
64
  {
65
65
  Body: {
66
66
  props: {
67
- // Adds mouseleave to popover body so that child menu closes when user mouses out.
68
- onMouseLeave: props.resetParentMenu,
69
67
  // Trap tabbing when focused on a child menu. Popover mounts the element at the end of
70
68
  // the html body by default. If a user was to tab to the next element it would navigate
71
69
  // to elements not within the immediate area surrounding the menu.
@@ -13,6 +13,8 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
13
13
 
14
14
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
15
 
16
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
17
+
16
18
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
17
19
 
18
20
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -52,6 +54,10 @@ var NestedMenuContext = /*#__PURE__*/React.createContext({
52
54
  removeMenuFromNesting: function removeMenuFromNesting() {},
53
55
  getParentMenu: function getParentMenu() {},
54
56
  getChildMenu: function getChildMenu() {},
57
+ nestedMenuHoverIndex: -1,
58
+ isNestedMenuVisible: function isNestedMenuVisible() {
59
+ return false;
60
+ },
55
61
  mountRef: {
56
62
  current: null
57
63
  }
@@ -83,16 +89,46 @@ var NestedMenus = /*#__PURE__*/function (_React$Component) {
83
89
  _this = _super.call.apply(_super, [this].concat(args));
84
90
 
85
91
  _defineProperty(_assertThisInitialized(_this), "state", {
86
- menus: []
92
+ menus: [],
93
+ nestedMenuHoverIndex: -1
87
94
  });
88
95
 
89
96
  _defineProperty(_assertThisInitialized(_this), "mountRef", /*#__PURE__*/React.createRef());
90
97
 
98
+ _defineProperty(_assertThisInitialized(_this), "mouseLeaveTimeoueId", null);
99
+
100
+ _defineProperty(_assertThisInitialized(_this), "handleMenuMouseLeave", function (event) {
101
+ _this.mouseLeaveTimeoueId = setTimeout(function () {
102
+ _this.setState({
103
+ nestedMenuHoverIndex: -1
104
+ });
105
+ }, 200);
106
+ });
107
+
108
+ _defineProperty(_assertThisInitialized(_this), "handleMenuMouseEnter", function (event) {
109
+ if (typeof document !== 'undefined') {
110
+ clearTimeout(_this.mouseLeaveTimeoueId);
111
+
112
+ var index = _this.state.menus.findIndex(function (m) {
113
+ return m.current && event.currentTarget instanceof Node && m.current.contains(event.currentTarget);
114
+ });
115
+
116
+ _this.setState({
117
+ nestedMenuHoverIndex: index
118
+ });
119
+ }
120
+ });
121
+
91
122
  _defineProperty(_assertThisInitialized(_this), "addMenuToNesting", function (ref) {
92
123
  // check offsetHeight to determine if component is visible in the dom (0 means hidden)
93
124
  // we need to do this so that when we renderAll, the hidden seo-only child-menus don't
94
125
  // register themselves which would break the nesting logic
95
- if (ref.current && ref.current.offsetHeight) {
126
+ var element = ref.current;
127
+
128
+ if (element && element.offsetHeight) {
129
+ element.addEventListener('mouseenter', _this.handleMenuMouseEnter);
130
+ element.addEventListener('mouseleave', _this.handleMenuMouseLeave);
131
+
96
132
  _this.setState(function (state) {
97
133
  return {
98
134
  menus: [].concat(_toConsumableArray(state.menus), [ref])
@@ -103,10 +139,27 @@ var NestedMenus = /*#__PURE__*/function (_React$Component) {
103
139
 
104
140
  _defineProperty(_assertThisInitialized(_this), "removeMenuFromNesting", function (ref) {
105
141
  _this.setState(function (state) {
142
+ var _iterator = _createForOfIteratorHelper(_this.state.menus),
143
+ _step;
144
+
145
+ try {
146
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
147
+ var r = _step.value;
148
+
149
+ if (r.current && isSame(r.current, ref.current)) {
150
+ var element = r.current;
151
+ element.removeEventListener('mouseenter', _this.handleMenuMouseEnter);
152
+ element.removeEventListener('mouseleave', _this.handleMenuMouseLeave);
153
+ }
154
+ }
155
+ } catch (err) {
156
+ _iterator.e(err);
157
+ } finally {
158
+ _iterator.f();
159
+ }
160
+
106
161
  var nextMenus = state.menus.filter(function (r) {
107
- return r.current;
108
- }).filter(function (r) {
109
- return !isSame(r.current, ref.current);
162
+ return r.current && !isSame(r.current, ref.current);
110
163
  });
111
164
  return {
112
165
  menus: nextMenus
@@ -130,6 +183,12 @@ var NestedMenus = /*#__PURE__*/function (_React$Component) {
130
183
  return _this.state.menus[index];
131
184
  });
132
185
 
186
+ _defineProperty(_assertThisInitialized(_this), "isNestedMenuVisible", function (ref) {
187
+ var index = _this.findMenuIndexByRef(ref);
188
+
189
+ return index <= _this.state.nestedMenuHoverIndex;
190
+ });
191
+
133
192
  return _this;
134
193
  }
135
194
 
@@ -142,6 +201,8 @@ var NestedMenus = /*#__PURE__*/function (_React$Component) {
142
201
  removeMenuFromNesting: this.removeMenuFromNesting,
143
202
  getParentMenu: this.getParentMenu,
144
203
  getChildMenu: this.getChildMenu,
204
+ isNestedMenuVisible: this.isNestedMenuVisible,
205
+ nestedMenuHoverIndex: this.state.nestedMenuHoverIndex,
145
206
  mountRef: this.mountRef
146
207
  }
147
208
  }, /*#__PURE__*/React.createElement(React.Fragment, null, this.props.children, /*#__PURE__*/React.createElement("span", {
@@ -12,6 +12,7 @@ import * as React from 'react';
12
12
  import type {NestedMenuRefT, NestedMenuContextT} from './types.js';
13
13
 
14
14
  type StateT = {
15
+ nestedMenuHoverIndex: number,
15
16
  menus: NestedMenuRefT[],
16
17
  };
17
18
  type PropsT = {
@@ -24,6 +25,8 @@ export const NestedMenuContext: React.Context<NestedMenuContextT> = React.create
24
25
  removeMenuFromNesting: () => {},
25
26
  getParentMenu: () => {},
26
27
  getChildMenu: () => {},
28
+ nestedMenuHoverIndex: -1,
29
+ isNestedMenuVisible: () => false,
27
30
  mountRef: {current: null},
28
31
  },
29
32
  );
@@ -37,14 +40,40 @@ function isSame(a: ?HTMLElement, b: ?HTMLElement) {
37
40
  }
38
41
 
39
42
  export default class NestedMenus extends React.Component<PropsT, StateT> {
40
- state = {menus: []};
43
+ state = {menus: [], nestedMenuHoverIndex: -1};
41
44
  mountRef = (React.createRef(): {current: HTMLElement | null});
45
+ mouseLeaveTimeoueId = null;
46
+
47
+ handleMenuMouseLeave = (event: MouseEvent) => {
48
+ this.mouseLeaveTimeoueId = setTimeout(() => {
49
+ this.setState({nestedMenuHoverIndex: -1});
50
+ }, 200);
51
+ };
52
+
53
+ handleMenuMouseEnter = (event: MouseEvent) => {
54
+ if (__BROWSER__) {
55
+ clearTimeout(this.mouseLeaveTimeoueId);
56
+ const index = this.state.menus.findIndex(m => {
57
+ return (
58
+ m.current &&
59
+ event.currentTarget instanceof Node &&
60
+ m.current.contains(event.currentTarget)
61
+ );
62
+ });
63
+
64
+ this.setState({nestedMenuHoverIndex: index});
65
+ }
66
+ };
42
67
 
43
68
  addMenuToNesting = (ref: NestedMenuRefT) => {
44
69
  // check offsetHeight to determine if component is visible in the dom (0 means hidden)
45
70
  // we need to do this so that when we renderAll, the hidden seo-only child-menus don't
46
71
  // register themselves which would break the nesting logic
47
- if (ref.current && ref.current.offsetHeight) {
72
+ const element = ref.current;
73
+ if (element && element.offsetHeight) {
74
+ element.addEventListener('mouseenter', this.handleMenuMouseEnter);
75
+ element.addEventListener('mouseleave', this.handleMenuMouseLeave);
76
+
48
77
  this.setState(state => {
49
78
  return {menus: [...state.menus, ref]};
50
79
  });
@@ -53,9 +82,18 @@ export default class NestedMenus extends React.Component<PropsT, StateT> {
53
82
 
54
83
  removeMenuFromNesting = (ref: NestedMenuRefT) => {
55
84
  this.setState(state => {
56
- const nextMenus = state.menus
57
- .filter(r => r.current)
58
- .filter(r => !isSame(r.current, ref.current));
85
+ for (const r of this.state.menus) {
86
+ if (r.current && isSame(r.current, ref.current)) {
87
+ const element = r.current;
88
+ element.removeEventListener('mouseenter', this.handleMenuMouseEnter);
89
+ element.removeEventListener('mouseleave', this.handleMenuMouseLeave);
90
+ }
91
+ }
92
+
93
+ const nextMenus = state.menus.filter(r => {
94
+ return r.current && !isSame(r.current, ref.current);
95
+ });
96
+
59
97
  return {menus: nextMenus};
60
98
  });
61
99
  };
@@ -74,6 +112,11 @@ export default class NestedMenus extends React.Component<PropsT, StateT> {
74
112
  return this.state.menus[index];
75
113
  };
76
114
 
115
+ isNestedMenuVisible = (ref: NestedMenuRefT): boolean => {
116
+ const index = this.findMenuIndexByRef(ref);
117
+ return index <= this.state.nestedMenuHoverIndex;
118
+ };
119
+
77
120
  render() {
78
121
  return (
79
122
  <NestedMenuContext.Provider
@@ -82,6 +125,8 @@ export default class NestedMenus extends React.Component<PropsT, StateT> {
82
125
  removeMenuFromNesting: this.removeMenuFromNesting,
83
126
  getParentMenu: this.getParentMenu,
84
127
  getChildMenu: this.getChildMenu,
128
+ isNestedMenuVisible: this.isNestedMenuVisible,
129
+ nestedMenuHoverIndex: this.state.nestedMenuHoverIndex,
85
130
  mountRef: this.mountRef,
86
131
  }}
87
132
  >
@@ -77,6 +77,10 @@ var DEFAULT_PROPS = {
77
77
  removeMenuFromNesting: function removeMenuFromNesting() {},
78
78
  getParentMenu: function getParentMenu() {},
79
79
  getChildMenu: function getChildMenu() {},
80
+ nestedMenuHoverIndex: -1,
81
+ isNestedMenuVisible: function isNestedMenuVisible() {
82
+ return false;
83
+ },
80
84
  forceHighlight: false
81
85
  };
82
86
 
@@ -283,17 +287,7 @@ var MenuStatefulContainerInner = /*#__PURE__*/function (_React$Component) {
283
287
  });
284
288
  });
285
289
 
286
- _defineProperty(_assertThisInitialized(_this), "handleMouseLeave", function () {
287
- var rootRef = _this.props.rootRef ? _this.props.rootRef : _this.rootRef;
288
-
289
- var childMenu = _this.props.getChildMenu && _this.props.getChildMenu(rootRef);
290
-
291
- if (!_this.props.forceHighlight && !childMenu) {
292
- _this.internalSetState(_constants.STATE_CHANGE_TYPES.mouseLeave, {
293
- highlightedIndex: -1
294
- });
295
- }
296
- });
290
+ _defineProperty(_assertThisInitialized(_this), "handleMouseLeave", function (event) {});
297
291
 
298
292
  _defineProperty(_assertThisInitialized(_this), "getRequiredItemProps", function (item, index) {
299
293
  var itemRef = _this.refList[index];
@@ -404,11 +398,13 @@ var MenuStatefulContainerInner = /*#__PURE__*/function (_React$Component) {
404
398
  if (this.keyboardControlNode) this.keyboardControlNode.removeEventListener('keydown', this.onKeyDown);
405
399
  }
406
400
 
407
- this.props.removeMenuFromNesting && this.props.removeMenuFromNesting(rootRef);
401
+ if (this.props.removeMenuFromNesting) {
402
+ this.props.removeMenuFromNesting(rootRef);
403
+ }
408
404
  }
409
405
  }, {
410
406
  key: "componentDidUpdate",
411
- value: function componentDidUpdate(_, prevState) {
407
+ value: function componentDidUpdate(prevProps, prevState) {
412
408
  if (typeof document !== 'undefined') {
413
409
  if (!prevState.isFocused && this.state.isFocused) {
414
410
  if (this.keyboardControlNode) this.keyboardControlNode.addEventListener('keydown', this.onKeyDown);
@@ -434,6 +430,12 @@ var MenuStatefulContainerInner = /*#__PURE__*/function (_React$Component) {
434
430
  highlightedIndex: 0
435
431
  });
436
432
  }
433
+
434
+ if (this.props.isNestedMenuVisible && this.props.nestedMenuHoverIndex !== prevProps.nestedMenuHoverIndex && !this.props.isNestedMenuVisible(this.rootRef) && !this.props.forceHighlight) {
435
+ this.setState({
436
+ highlightedIndex: -1
437
+ });
438
+ }
437
439
  } // One array to hold all of list item refs
438
440
 
439
441
  }, {
@@ -37,6 +37,8 @@ const DEFAULT_PROPS = {
37
37
  removeMenuFromNesting: () => {},
38
38
  getParentMenu: () => {},
39
39
  getChildMenu: () => {},
40
+ nestedMenuHoverIndex: -1,
41
+ isNestedMenuVisible: () => false,
40
42
  forceHighlight: false,
41
43
  };
42
44
 
@@ -99,11 +101,16 @@ class MenuStatefulContainerInner extends React.Component<
99
101
  if (this.keyboardControlNode)
100
102
  this.keyboardControlNode.removeEventListener('keydown', this.onKeyDown);
101
103
  }
102
- this.props.removeMenuFromNesting &&
104
+
105
+ if (this.props.removeMenuFromNesting) {
103
106
  this.props.removeMenuFromNesting(rootRef);
107
+ }
104
108
  }
105
109
 
106
- componentDidUpdate(_: mixed, prevState: StatefulContainerStateT) {
110
+ componentDidUpdate(
111
+ prevProps: StatefulContainerPropsT,
112
+ prevState: StatefulContainerStateT,
113
+ ) {
107
114
  if (__BROWSER__) {
108
115
  if (!prevState.isFocused && this.state.isFocused) {
109
116
  if (this.keyboardControlNode)
@@ -135,6 +142,15 @@ class MenuStatefulContainerInner extends React.Component<
135
142
  highlightedIndex: 0,
136
143
  });
137
144
  }
145
+
146
+ if (
147
+ this.props.isNestedMenuVisible &&
148
+ this.props.nestedMenuHoverIndex !== prevProps.nestedMenuHoverIndex &&
149
+ !this.props.isNestedMenuVisible(this.rootRef) &&
150
+ !this.props.forceHighlight
151
+ ) {
152
+ this.setState({highlightedIndex: -1});
153
+ }
138
154
  }
139
155
 
140
156
  // One array to hold all of list item refs
@@ -342,17 +358,7 @@ class MenuStatefulContainerInner extends React.Component<
342
358
  });
343
359
  };
344
360
 
345
- handleMouseLeave = () => {
346
- const rootRef = this.props.rootRef ? this.props.rootRef : this.rootRef;
347
- const childMenu =
348
- this.props.getChildMenu && this.props.getChildMenu(rootRef);
349
-
350
- if (!this.props.forceHighlight && !childMenu) {
351
- this.internalSetState(STATE_CHANGE_TYPES.mouseLeave, {
352
- highlightedIndex: -1,
353
- });
354
- }
355
- };
361
+ handleMouseLeave = (event: SyntheticMouseEvent<HTMLElement>) => {};
356
362
 
357
363
  getRequiredItemProps: GetRequiredItemPropsFnT = (item, index) => {
358
364
  let itemRef = this.refList[index];
@@ -136,6 +136,8 @@ export type StatefulContainerPropsT = {
136
136
  getChildMenu?: (ref: {current: HTMLElement | null}) => ?{
137
137
  current: HTMLElement | null,
138
138
  },
139
+ nestedMenuHoverIndex?: number,
140
+ isNestedMenuVisible?: (ref: {current: HTMLElement | null}) => boolean,
139
141
  forceHighlight: boolean,
140
142
  };
141
143
 
@@ -171,7 +173,7 @@ export type SharedStatelessPropsT = {
171
173
  ariaLabel?: string,
172
174
  getRequiredItemProps?: GetRequiredItemPropsFnT,
173
175
  isFocused?: boolean,
174
- handleMouseLeave?: () => mixed,
176
+ handleMouseLeave?: (event: SyntheticMouseEvent<HTMLElement>) => mixed,
175
177
  /** Index of highlighted menu item. */
176
178
  highlightedIndex?: number,
177
179
  /** List of menu items. */
@@ -215,6 +217,8 @@ export type StatefulMenuPropsT = {
215
217
  getChildMenu?: (ref: {current: HTMLElement | null}) => ?{
216
218
  current: HTMLElement | null,
217
219
  },
220
+ nestedMenuHoverIndex?: number,
221
+ isNestedMenuVisible?: (ref: {current: HTMLElement | null}) => boolean,
218
222
  } & MenuPropsT;
219
223
 
220
224
  export type StatefulMenuProfilePropsT = StatefulContainerPropsT &
@@ -300,6 +304,8 @@ export type NestedMenuContextT = {|
300
304
  removeMenuFromNesting: (ref: NestedMenuRefT) => void,
301
305
  getParentMenu: (ref: NestedMenuRefT) => ?NestedMenuRefT,
302
306
  getChildMenu: (ref: NestedMenuRefT) => ?NestedMenuRefT,
307
+ nestedMenuHoverIndex: number,
308
+ isNestedMenuVisible: (ref: NestedMenuRefT) => boolean,
303
309
  mountRef: NestedMenuRefT,
304
310
  |};
305
311
 
package/modal/modal.js CHANGED
@@ -383,7 +383,9 @@ var Modal = /*#__PURE__*/function (_React$Component) {
383
383
  } : {};
384
384
  return /*#__PURE__*/React.createElement(_index.LocaleContext.Consumer, null, function (locale) {
385
385
  return /*#__PURE__*/React.createElement(_reactFocusLock.default, {
386
- disabled: !focusLock,
386
+ disabled: !focusLock // Allow focus to escape when UI is within an iframe
387
+ ,
388
+ crossFrame: false,
387
389
  returnFocus: returnFocus,
388
390
  autoFocus: autofocus !== null ? autofocus : autoFocus
389
391
  }, /*#__PURE__*/React.createElement(Root, _extends({
@@ -321,6 +321,8 @@ class Modal extends React.Component<ModalPropsT, ModalStateT> {
321
321
  {locale => (
322
322
  <FocusLock
323
323
  disabled={!focusLock}
324
+ // Allow focus to escape when UI is within an iframe
325
+ crossFrame={false}
324
326
  returnFocus={returnFocus}
325
327
  autoFocus={autofocus !== null ? autofocus : autoFocus}
326
328
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baseui",
3
- "version": "10.8.0",
3
+ "version": "10.9.2",
4
4
  "description": "A React Component library implementing the Base design language",
5
5
  "keywords": [
6
6
  "react",
@@ -170,7 +170,7 @@
170
170
  "react-dom": "^16.9.0",
171
171
  "react-hook-form": "^7.9.0",
172
172
  "react-icons": "^3.8.0",
173
- "react-map-gl": "^6.1.17",
173
+ "react-map-gl": "^5.3.19",
174
174
  "react-markdown": "^4.0.3",
175
175
  "react-twitter-embed": "^2.0.8",
176
176
  "react-view": "^2.3.3",
@@ -194,6 +194,7 @@
194
194
  "@date-io/date-fns": "^2.6.2",
195
195
  "card-validator": "^6.2.0",
196
196
  "date-fns": "^2.6.0",
197
+ "date-fns-tz": "^1.2.2",
197
198
  "glob": "^7.1.6",
198
199
  "just-extend": "^4.0.2",
199
200
  "memoize-one": "^5.1.1",
@@ -211,8 +212,7 @@
211
212
  "react-virtualized": "^9.21.1",
212
213
  "react-virtualized-auto-sizer": "^1.0.2",
213
214
  "react-window": "^1.8.5",
214
- "resize-observer-polyfill": "^1.5.1",
215
- "timezone-support": "^2.0.2"
215
+ "resize-observer-polyfill": "^1.5.1"
216
216
  },
217
217
  "peerDependencies": {
218
218
  "react": ">= 16.8.0 < 18",
@@ -530,10 +530,12 @@ var PopoverInner = /*#__PURE__*/function (_React$Component) {
530
530
  noFocusGuards: false // see popover-focus-loop.scenario.js for why hover cannot return focus
531
531
  ,
532
532
  returnFocus: !this.isHoverTrigger() && this.props.returnFocus,
533
- autoFocus: this.state.autoFocusAfterPositioning,
533
+ autoFocus: this.state.autoFocusAfterPositioning // Allow focus to escape when UI is within an iframe
534
+ ,
535
+ crossFrame: false,
534
536
  focusOptions: this.props.focusOptions
535
537
  }, this.renderPopover(renderedContent)) : /*#__PURE__*/React.createElement(_reactFocusLock.MoveFocusInside, {
536
- disabled: !this.props.autoFocus && !this.state.autoFocusAfterPositioning
538
+ disabled: !this.props.autoFocus || !this.state.autoFocusAfterPositioning
537
539
  }, this.renderPopover(renderedContent)))));
538
540
  } else {
539
541
  rendered.push( /*#__PURE__*/React.createElement(_styledComponents.Hidden, {