baseui 10.8.0 → 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 (170) 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 +3 -1
  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 +4 -0
  62. package/es/themes/light-theme/color-component-tokens.js +4 -0
  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/esm/a11y/a11y.js +3 -3
  67. package/esm/button/styled-components.js +47 -18
  68. package/esm/combobox/combobox.js +6 -3
  69. package/esm/data-table/column-categorical.js +2 -2
  70. package/esm/data-table/column-numerical.js +304 -353
  71. package/esm/data-table/constants.js +12 -8
  72. package/esm/data-table/data-table.js +53 -50
  73. package/esm/data-table/filter-shell.js +26 -4
  74. package/esm/data-table/locale.js +4 -2
  75. package/esm/data-table/measure-column-widths.js +83 -121
  76. package/esm/datepicker/styled-components.js +1 -1
  77. package/esm/drawer/drawer.js +3 -1
  78. package/esm/index.js +1 -1
  79. package/esm/map-marker/badge-enhancer.js +79 -0
  80. package/esm/map-marker/constants.js +94 -4
  81. package/esm/map-marker/drag-shadow.js +53 -0
  82. package/esm/map-marker/fixed-marker.js +84 -80
  83. package/esm/map-marker/floating-marker.js +22 -13
  84. package/esm/map-marker/index.js +1 -1
  85. package/esm/map-marker/label-enhancer.js +60 -0
  86. package/esm/map-marker/needle.js +43 -0
  87. package/esm/map-marker/pin-head.js +77 -66
  88. package/esm/map-marker/styled-components.js +182 -51
  89. package/esm/map-marker/types.js +1 -1
  90. package/esm/menu/maybe-child-menu.js +0 -2
  91. package/esm/menu/nested-menus.js +66 -5
  92. package/esm/menu/stateful-container.js +15 -13
  93. package/esm/modal/modal.js +3 -1
  94. package/esm/popover/popover.js +3 -1
  95. package/esm/progress-bar/index.js +1 -1
  96. package/esm/progress-bar/progressbar.js +32 -10
  97. package/esm/progress-bar/styled-components.js +9 -4
  98. package/esm/select/select-component.js +2 -11
  99. package/esm/spinner/styled-components.js +35 -16
  100. package/esm/table/filter.js +3 -1
  101. package/esm/themes/dark-theme/color-component-tokens.js +4 -0
  102. package/esm/themes/light-theme/color-component-tokens.js +4 -0
  103. package/esm/timezonepicker/timezone-picker.js +64 -36
  104. package/esm/timezonepicker/tzdata.js +2 -0
  105. package/esm/timezonepicker/update-tzdata.js +160 -0
  106. package/index.js +6 -0
  107. package/index.js.flow +1 -1
  108. package/map-marker/badge-enhancer.js +90 -0
  109. package/map-marker/badge-enhancer.js.flow +86 -0
  110. package/map-marker/constants.js +103 -5
  111. package/map-marker/constants.js.flow +152 -0
  112. package/map-marker/drag-shadow.js +64 -0
  113. package/map-marker/drag-shadow.js.flow +52 -0
  114. package/map-marker/fixed-marker.js +84 -78
  115. package/map-marker/fixed-marker.js.flow +78 -66
  116. package/map-marker/floating-marker.js +22 -13
  117. package/map-marker/floating-marker.js.flow +30 -17
  118. package/map-marker/index.d.ts +125 -24
  119. package/map-marker/index.js +18 -0
  120. package/map-marker/index.js.flow +3 -0
  121. package/map-marker/label-enhancer.js +71 -0
  122. package/map-marker/label-enhancer.js.flow +63 -0
  123. package/map-marker/needle.js +54 -0
  124. package/map-marker/needle.js.flow +29 -0
  125. package/map-marker/pin-head.js +80 -69
  126. package/map-marker/pin-head.js.flow +122 -84
  127. package/map-marker/styled-components.js +200 -62
  128. package/map-marker/styled-components.js.flow +172 -22
  129. package/map-marker/types.js.flow +69 -20
  130. package/menu/index.d.ts +9 -4
  131. package/menu/maybe-child-menu.js +0 -2
  132. package/menu/maybe-child-menu.js.flow +0 -2
  133. package/menu/nested-menus.js +66 -5
  134. package/menu/nested-menus.js.flow +50 -5
  135. package/menu/stateful-container.js +15 -13
  136. package/menu/stateful-container.js.flow +19 -13
  137. package/menu/types.js.flow +7 -1
  138. package/modal/modal.js +3 -1
  139. package/modal/modal.js.flow +2 -0
  140. package/package.json +5 -4
  141. package/popover/popover.js +3 -1
  142. package/popover/popover.js.flow +2 -0
  143. package/progress-bar/index.d.ts +2 -0
  144. package/progress-bar/index.js +6 -0
  145. package/progress-bar/index.js.flow +1 -0
  146. package/progress-bar/progressbar.js +32 -10
  147. package/progress-bar/progressbar.js.flow +35 -9
  148. package/progress-bar/styled-components.js +9 -4
  149. package/progress-bar/styled-components.js.flow +15 -4
  150. package/progress-bar/types.js.flow +12 -2
  151. package/select/select-component.js +2 -11
  152. package/select/select-component.js.flow +5 -7
  153. package/spinner/styled-components.js +35 -16
  154. package/spinner/styled-components.js.flow +37 -19
  155. package/spinner/types.js.flow +10 -0
  156. package/styles/index.js.flow +1 -1
  157. package/table/filter.js +3 -1
  158. package/table/filter.js.flow +5 -1
  159. package/themes/dark-theme/color-component-tokens.js +4 -0
  160. package/themes/dark-theme/color-component-tokens.js.flow +4 -0
  161. package/themes/light-theme/color-component-tokens.js +4 -0
  162. package/themes/light-theme/color-component-tokens.js.flow +4 -0
  163. package/themes/types.js.flow +4 -0
  164. package/timezonepicker/timezone-picker.js +69 -41
  165. package/timezonepicker/timezone-picker.js.flow +52 -46
  166. package/timezonepicker/types.js.flow +1 -1
  167. package/timezonepicker/tzdata.js +10 -0
  168. package/timezonepicker/tzdata.js.flow +347 -0
  169. package/timezonepicker/update-tzdata.js +164 -0
  170. package/timezonepicker/update-tzdata.js.flow +70 -0
@@ -12,12 +12,6 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
12
12
 
13
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
14
 
15
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
16
-
17
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
18
-
19
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
20
-
21
15
  /*
22
16
  Copyright (c) Uber Technologies, Inc.
23
17
 
@@ -25,53 +19,32 @@ This source code is licensed under the MIT license found in the
25
19
  LICENSE file in the root directory of this source tree.
26
20
  */
27
21
  import * as React from 'react';
28
- import { useStyletron, styled } from '../styles/index.js';
29
22
  import { getOverrides } from '../helpers/overrides.js';
30
- import { InnerXSmallAnchor as StyledInnerXSmallAnchor, OuterXSmallAnchor as StyledOuterXSmallAnchor, PinHead as StyledPinHead } from './styled-components.js';
31
- import { PINHEAD_DIMENSIONS, PINHEAD_TYPES, PINHEAD_SIZES_SHAPES } from './constants.js';
32
- export var _ContentItem = styled('div', function (_ref) {
33
- var _match;
34
-
35
- var $theme = _ref.$theme,
36
- $color = _ref.$color,
37
- $height = _ref.$height,
38
- $size = _ref.$size;
39
- var match = (_match = {}, _defineProperty(_match, PINHEAD_SIZES_SHAPES.xSmallCircle, 'LabelSmall'), _defineProperty(_match, PINHEAD_SIZES_SHAPES.xSmallSquare, 'LabelSmall'), _defineProperty(_match, PINHEAD_SIZES_SHAPES.small, 'LabelSmall'), _defineProperty(_match, PINHEAD_SIZES_SHAPES.medium, 'LabelMedium'), _defineProperty(_match, PINHEAD_SIZES_SHAPES.large, 'LabelLarge'), _match);
40
- return _objectSpread(_objectSpread({}, $theme.typography[match[$size]]), {}, {
41
- display: 'flex',
42
- alignItems: 'center',
43
- textAlign: 'center',
44
- lineHeight: "".concat($height, "px"),
45
- height: "".concat($height, "px"),
46
- color: $color
47
- });
48
- });
49
- _ContentItem.displayName = "_ContentItem";
50
-
51
- var PinHead = function PinHead(_ref2) {
52
- var _ref2$size = _ref2.size,
53
- size = _ref2$size === void 0 ? PINHEAD_SIZES_SHAPES.medium : _ref2$size,
54
- _ref2$label = _ref2.label,
55
- label = _ref2$label === void 0 ? '' : _ref2$label,
56
- StartEnhancer = _ref2.startEnhancer,
57
- EndEnhancer = _ref2.endEnhancer,
58
- color = _ref2.color,
59
- background = _ref2.background,
60
- _ref2$type = _ref2.type,
61
- type = _ref2$type === void 0 ? PINHEAD_TYPES.fixed : _ref2$type,
62
- anchorType = _ref2.anchorType,
63
- _ref2$overrides = _ref2.overrides,
64
- overrides = _ref2$overrides === void 0 ? {} : _ref2$overrides;
65
-
66
- var _useStyletron = useStyletron(),
67
- _useStyletron2 = _slicedToArray(_useStyletron, 2),
68
- theme = _useStyletron2[1];
69
-
70
- var _theme$colors = theme.colors,
71
- backgroundPrimary = _theme$colors.backgroundPrimary,
72
- primaryA = _theme$colors.primaryA;
73
- color = color || backgroundPrimary;
74
- background = background || primaryA;
23
+ import { StyledInnerXXSmallAnchor, StyledOuterXXSmallAnchor, StyledInnerXSmallAnchor, StyledOuterXSmallAnchor, StyledPinHead, RelativeContainer, StyledContentItem } from './styled-components.js';
24
+ import { PINHEAD_DIMENSIONS, PINHEAD_TYPES, PINHEAD_SIZES_SHAPES, NEEDLE_HEIGHTS, NEEDLE_SIZES } from './constants.js';
25
+ import BadgeEnhancer from './badge-enhancer.js';
26
+ import LabelEnhancer from './label-enhancer.js';
27
+
28
+ var PinHead = function PinHead(_ref) {
29
+ var _ref$size = _ref.size,
30
+ size = _ref$size === void 0 ? PINHEAD_SIZES_SHAPES.medium : _ref$size,
31
+ _ref$label = _ref.label,
32
+ label = _ref$label === void 0 ? '' : _ref$label,
33
+ StartEnhancer = _ref.startEnhancer,
34
+ EndEnhancer = _ref.endEnhancer,
35
+ color = _ref.color,
36
+ background = _ref.background,
37
+ _ref$type = _ref.type,
38
+ type = _ref$type === void 0 ? PINHEAD_TYPES.fixed : _ref$type,
39
+ anchorType = _ref.anchorType,
40
+ _ref$needle = _ref.needle,
41
+ needle = _ref$needle === void 0 ? NEEDLE_SIZES.none : _ref$needle,
42
+ labelEnhancerContent = _ref.labelEnhancerContent,
43
+ labelEnhancerPosition = _ref.labelEnhancerPosition,
44
+ badgeEnhancerSize = _ref.badgeEnhancerSize,
45
+ badgeEnhancerContent = _ref.badgeEnhancerContent,
46
+ _ref$overrides = _ref.overrides,
47
+ overrides = _ref$overrides === void 0 ? {} : _ref$overrides;
75
48
  var activeElements = [label, StartEnhancer, EndEnhancer].filter(function (x) {
76
49
  return x;
77
50
  });
@@ -88,35 +61,73 @@ var PinHead = function PinHead(_ref2) {
88
61
  PinHead = _getOverrides2[0],
89
62
  pinHeadProps = _getOverrides2[1];
90
63
 
91
- var _getOverrides3 = getOverrides(overrides.PinHeadContent, _ContentItem),
64
+ var _getOverrides3 = getOverrides(overrides.PinHeadContent, StyledContentItem),
92
65
  _getOverrides4 = _slicedToArray(_getOverrides3, 2),
93
66
  ContentItem = _getOverrides4[0],
94
67
  contentItemProps = _getOverrides4[1];
95
68
 
96
- var _getOverrides5 = getOverrides(overrides.InnerAnchor, StyledInnerXSmallAnchor),
69
+ var _getOverrides5 = getOverrides(overrides.InnerAnchor, StyledInnerXXSmallAnchor),
97
70
  _getOverrides6 = _slicedToArray(_getOverrides5, 2),
98
- InnerXSmallAnchor = _getOverrides6[0],
99
- innerXSmallAnchorProps = _getOverrides6[1];
71
+ InnerXXSmallAnchor = _getOverrides6[0],
72
+ innerXXSmallAnchorProps = _getOverrides6[1];
100
73
 
101
- var _getOverrides7 = getOverrides(overrides.OuterAnchor, StyledOuterXSmallAnchor),
74
+ var _getOverrides7 = getOverrides(overrides.OuterAnchor, StyledOuterXXSmallAnchor),
102
75
  _getOverrides8 = _slicedToArray(_getOverrides7, 2),
103
- OuterXSmallAnchor = _getOverrides8[0],
104
- outerXSmallAnchorProps = _getOverrides8[1];
76
+ OuterXXSmallAnchor = _getOverrides8[0],
77
+ outerXXSmallAnchorProps = _getOverrides8[1];
78
+
79
+ var _getOverrides9 = getOverrides(overrides.InnerAnchor, StyledInnerXSmallAnchor),
80
+ _getOverrides10 = _slicedToArray(_getOverrides9, 2),
81
+ InnerXSmallAnchor = _getOverrides10[0],
82
+ innerXSmallAnchorProps = _getOverrides10[1];
83
+
84
+ var _getOverrides11 = getOverrides(overrides.OuterAnchor, StyledOuterXSmallAnchor),
85
+ _getOverrides12 = _slicedToArray(_getOverrides11, 2),
86
+ OuterXSmallAnchor = _getOverrides12[0],
87
+ outerXSmallAnchorProps = _getOverrides12[1];
88
+
89
+ var badge = /*#__PURE__*/React.createElement(BadgeEnhancer, {
90
+ markerType: type,
91
+ pinHeadSize: size,
92
+ badgeEnhancerSize: badgeEnhancerSize,
93
+ badgeEnhancerContent: badgeEnhancerContent,
94
+ overrides: overrides
95
+ });
105
96
 
106
- if (type === PINHEAD_TYPES.fixed && (size === PINHEAD_SIZES_SHAPES.xSmallSquare || size === PINHEAD_SIZES_SHAPES.xSmallCircle)) {
107
- var round = size === PINHEAD_SIZES_SHAPES.xSmallCircle;
108
- return /*#__PURE__*/React.createElement(OuterXSmallAnchor, _extends({
97
+ if (type === PINHEAD_TYPES.fixed && (size === PINHEAD_SIZES_SHAPES.xxSmallCircle || size === PINHEAD_SIZES_SHAPES.xxSmallSquare)) {
98
+ var round = size === PINHEAD_SIZES_SHAPES.xxSmallCircle;
99
+ return /*#__PURE__*/React.createElement(OuterXXSmallAnchor, _extends({
109
100
  $round: round,
110
101
  $background: background,
111
102
  $size: height
112
- }, outerXSmallAnchorProps), /*#__PURE__*/React.createElement(InnerXSmallAnchor, _extends({
103
+ }, outerXXSmallAnchorProps), /*#__PURE__*/React.createElement(InnerXXSmallAnchor, _extends({
113
104
  $color: color,
114
105
  $round: round,
115
106
  $size: icon
116
- }, innerXSmallAnchorProps)));
107
+ }, innerXXSmallAnchorProps)));
108
+ }
109
+
110
+ if (type === PINHEAD_TYPES.fixed && (size === PINHEAD_SIZES_SHAPES.xSmallSquare || size === PINHEAD_SIZES_SHAPES.xSmallCircle)) {
111
+ var _round = size === PINHEAD_SIZES_SHAPES.xSmallCircle;
112
+
113
+ return /*#__PURE__*/React.createElement(RelativeContainer, null, badge, /*#__PURE__*/React.createElement(OuterXSmallAnchor, _extends({
114
+ $round: _round,
115
+ $background: background,
116
+ $size: height
117
+ }, outerXSmallAnchorProps), /*#__PURE__*/React.createElement(InnerXSmallAnchor, _extends({
118
+ $color: color,
119
+ $round: _round,
120
+ $size: icon
121
+ }, innerXSmallAnchorProps))));
117
122
  }
118
123
 
119
- return /*#__PURE__*/React.createElement(PinHead, _extends({
124
+ return /*#__PURE__*/React.createElement(RelativeContainer, null, /*#__PURE__*/React.createElement(LabelEnhancer, {
125
+ labelEnhancerContent: labelEnhancerContent,
126
+ labelEnhancerPosition: labelEnhancerPosition,
127
+ needleHeight: NEEDLE_HEIGHTS[needle],
128
+ size: size,
129
+ overrides: overrides
130
+ }), badge, /*#__PURE__*/React.createElement(PinHead, _extends({
120
131
  $background: background,
121
132
  $height: height,
122
133
  $gridTemplateColumns: gridTemplateColumns,
@@ -138,7 +149,7 @@ var PinHead = function PinHead(_ref2) {
138
149
  $size: size
139
150
  }, contentItemProps), /*#__PURE__*/React.createElement(EndEnhancer, {
140
151
  size: icon
141
- })));
152
+ }))));
142
153
  };
143
154
 
144
155
  export default PinHead;
@@ -11,13 +11,13 @@ This source code is licensed under the MIT license found in the
11
11
  LICENSE file in the root directory of this source tree.
12
12
  */
13
13
  import { styled } from '../styles/index.js';
14
- import { FLOATING_MARKER_ANCHOR_POSITIONS, xSmallPinheadDimension } from './constants.js';
14
+ import { BADGE_ENHANCER_STYLES, FLOATING_MARKER_ANCHOR_POSITIONS, LABEL_SIZES } from './constants.js';
15
15
  export var getAnchorTransform = function getAnchorTransform(anchor, anchorSize) {
16
16
  var _FLOATING_MARKER_ANCH;
17
17
 
18
18
  return (_FLOATING_MARKER_ANCH = {}, _defineProperty(_FLOATING_MARKER_ANCH, FLOATING_MARKER_ANCHOR_POSITIONS.none, ""), _defineProperty(_FLOATING_MARKER_ANCH, FLOATING_MARKER_ANCHOR_POSITIONS.topLeft, "translate(".concat(anchorSize, "px, ").concat(anchorSize, "px)")), _defineProperty(_FLOATING_MARKER_ANCH, FLOATING_MARKER_ANCHOR_POSITIONS.topRight, "translate(-100%, ".concat(anchorSize, "px)")), _defineProperty(_FLOATING_MARKER_ANCH, FLOATING_MARKER_ANCHOR_POSITIONS.bottomLeft, "translate(".concat(anchorSize, "px, -100%)")), _defineProperty(_FLOATING_MARKER_ANCH, FLOATING_MARKER_ANCHOR_POSITIONS.bottomRight, "translate(-100%, -100%)"), _FLOATING_MARKER_ANCH)[anchor];
19
19
  };
20
- export var DragShadowContainer = styled('div', function (_ref) {
20
+ export var StyledDragShadowContainer = styled('div', function (_ref) {
21
21
  var $theme = _ref.$theme,
22
22
  $height = _ref.$height,
23
23
  $width = _ref.$width,
@@ -32,86 +32,87 @@ export var DragShadowContainer = styled('div', function (_ref) {
32
32
  boxShadow: $theme.lighting.shadow600
33
33
  };
34
34
  });
35
- DragShadowContainer.displayName = "DragShadowContainer";
36
- export var DragShadow = styled('div', function (_ref2) {
35
+ StyledDragShadowContainer.displayName = "StyledDragShadowContainer";
36
+ export var StyledDragShadow = styled('div', function (_ref2) {
37
37
  var $theme = _ref2.$theme,
38
38
  $background = _ref2.$background,
39
39
  $width = _ref2.$width;
40
40
  return {
41
- background: $background,
41
+ backgroundColor: $background,
42
42
  borderRadius: '50%',
43
43
  width: "".concat($width, "px"),
44
- height: "".concat(4, "px"),
44
+ height: '4px',
45
45
  position: 'absolute',
46
46
  bottom: 0
47
47
  };
48
48
  });
49
- DragShadow.displayName = "DragShadow";
50
- export var Needle = styled('div', function (_ref3) {
49
+ StyledDragShadow.displayName = "StyledDragShadow";
50
+ export var StyledNeedle = styled('div', function (_ref3) {
51
51
  var $theme = _ref3.$theme,
52
52
  $background = _ref3.$background,
53
53
  $height = _ref3.$height;
54
54
  return {
55
- background: $background,
55
+ backgroundColor: $background,
56
56
  width: '4px',
57
57
  height: "".concat($height, "px"),
58
58
  boxShadow: $theme.lighting.shadow600
59
59
  };
60
60
  });
61
- Needle.displayName = "Needle";
62
- export var FloatingMarkerRoot = styled('div', function () {
61
+ StyledNeedle.displayName = "StyledNeedle";
62
+ export var StyledFloatingMarkerRoot = styled('div', function (_ref4) {
63
+ var $size = _ref4.$size;
63
64
  return {
64
65
  position: 'relative',
65
- height: "".concat(xSmallPinheadDimension.height, "px"),
66
- width: "".concat(xSmallPinheadDimension.height, "px")
66
+ height: "".concat($size, "px"),
67
+ width: "".concat($size, "px")
67
68
  };
68
69
  });
69
- FloatingMarkerRoot.displayName = "FloatingMarkerRoot";
70
- export var FloatingMarkerPinHeadContainer = styled('div', function (_ref4) {
71
- var $theme = _ref4.$theme,
72
- $anchor = _ref4.$anchor,
73
- $anchorSize = _ref4.$anchorSize;
70
+ StyledFloatingMarkerRoot.displayName = "StyledFloatingMarkerRoot";
71
+ export var StyledFloatingMarkerPinHeadContainer = styled('div', function (_ref5) {
72
+ var $theme = _ref5.$theme,
73
+ $anchor = _ref5.$anchor,
74
+ $anchorSize = _ref5.$anchorSize;
74
75
  return {
75
76
  position: 'absolute',
76
77
  transition: "".concat($theme.animation.timing300, " ").concat($theme.animation.easeOutCurve, " all"),
77
78
  transform: getAnchorTransform($anchor, $anchorSize)
78
79
  };
79
80
  });
80
- FloatingMarkerPinHeadContainer.displayName = "FloatingMarkerPinHeadContainer";
81
- export var FloatingMarkerAnchorContainer = styled('div', function () {
81
+ StyledFloatingMarkerPinHeadContainer.displayName = "StyledFloatingMarkerPinHeadContainer";
82
+ export var StyledFloatingMarkerAnchorContainer = styled('div', function () {
82
83
  return {
83
84
  position: 'absolute'
84
85
  };
85
86
  });
86
- FloatingMarkerAnchorContainer.displayName = "FloatingMarkerAnchorContainer";
87
- export var FixedMarkerRoot = styled('div', function () {
87
+ StyledFloatingMarkerAnchorContainer.displayName = "StyledFloatingMarkerAnchorContainer";
88
+ export var StyledFixedMarkerRoot = styled('div', function () {
88
89
  return {
89
90
  display: 'flex',
90
91
  alignItems: 'center',
91
92
  flexDirection: 'column'
92
93
  };
93
94
  });
94
- FixedMarkerRoot.displayName = "FixedMarkerRoot";
95
- export var FixedMarkerDragContainer = styled('div', function (_ref5) {
96
- var $theme = _ref5.$theme,
97
- $translateAmount = _ref5.$translateAmount,
98
- $performTranslate = _ref5.$performTranslate;
95
+ StyledFixedMarkerRoot.displayName = "StyledFixedMarkerRoot";
96
+ export var StyledFixedMarkerDragContainer = styled('div', function (_ref6) {
97
+ var $theme = _ref6.$theme,
98
+ $translateAmount = _ref6.$translateAmount,
99
+ $performTranslate = _ref6.$performTranslate;
99
100
  return {
100
- transform: "translateY(".concat($performTranslate ? '0px' : "".concat($translateAmount, "px"), ")"),
101
+ transform: "translateY(".concat($performTranslate ? "".concat($translateAmount, "px") : '0px', ")"),
101
102
  transition: "".concat($theme.animation.timing300, " ").concat($theme.animation.easeOutCurve, " all"),
102
103
  display: 'flex',
103
104
  alignItems: 'center',
104
105
  flexDirection: 'column'
105
106
  };
106
107
  });
107
- FixedMarkerDragContainer.displayName = "FixedMarkerDragContainer";
108
- export var OuterXSmallAnchor = styled('div', function (_ref6) {
109
- var $theme = _ref6.$theme,
110
- $round = _ref6.$round,
111
- $background = _ref6.$background,
112
- $size = _ref6.$size;
108
+ StyledFixedMarkerDragContainer.displayName = "StyledFixedMarkerDragContainer";
109
+ export var StyledOuterXXSmallAnchor = styled('div', function (_ref7) {
110
+ var $theme = _ref7.$theme,
111
+ $round = _ref7.$round,
112
+ $background = _ref7.$background,
113
+ $size = _ref7.$size;
113
114
  return {
114
- background: $background,
115
+ backgroundColor: $background,
115
116
  display: 'flex',
116
117
  alignItems: 'center',
117
118
  justifyContent: 'center',
@@ -121,26 +122,55 @@ export var OuterXSmallAnchor = styled('div', function (_ref6) {
121
122
  boxShadow: $theme.lighting.shadow600
122
123
  };
123
124
  });
124
- OuterXSmallAnchor.displayName = "OuterXSmallAnchor";
125
- export var InnerXSmallAnchor = styled('div', function (_ref7) {
126
- var $round = _ref7.$round,
127
- $color = _ref7.$color,
128
- $size = _ref7.$size;
125
+ StyledOuterXXSmallAnchor.displayName = "StyledOuterXXSmallAnchor";
126
+ export var StyledInnerXXSmallAnchor = styled('div', function (_ref8) {
127
+ var $round = _ref8.$round,
128
+ $color = _ref8.$color,
129
+ $size = _ref8.$size;
130
+ return {
131
+ backgroundColor: $color,
132
+ height: "".concat($size, "px"),
133
+ width: "".concat($size, "px"),
134
+ borderRadius: $round ? '50%' : 0
135
+ };
136
+ });
137
+ StyledInnerXXSmallAnchor.displayName = "StyledInnerXXSmallAnchor";
138
+ export var StyledOuterXSmallAnchor = styled('div', function (_ref9) {
139
+ var $theme = _ref9.$theme,
140
+ $round = _ref9.$round,
141
+ $background = _ref9.$background,
142
+ $size = _ref9.$size;
143
+ return {
144
+ backgroundColor: $background,
145
+ display: 'flex',
146
+ alignItems: 'center',
147
+ justifyContent: 'center',
148
+ height: "".concat($size, "px"),
149
+ width: "".concat($size, "px"),
150
+ borderRadius: $round ? '50%' : 0,
151
+ boxShadow: $theme.lighting.shadow600
152
+ };
153
+ });
154
+ StyledOuterXSmallAnchor.displayName = "StyledOuterXSmallAnchor";
155
+ export var StyledInnerXSmallAnchor = styled('div', function (_ref10) {
156
+ var $round = _ref10.$round,
157
+ $color = _ref10.$color,
158
+ $size = _ref10.$size;
129
159
  return {
130
- background: $color,
160
+ backgroundColor: $color,
131
161
  height: "".concat($size, "px"),
132
162
  width: "".concat($size, "px"),
133
163
  borderRadius: $round ? '50%' : 0
134
164
  };
135
165
  });
136
- InnerXSmallAnchor.displayName = "InnerXSmallAnchor";
137
- export var PinHead = styled('div', function (_ref8) {
138
- var $theme = _ref8.$theme,
139
- $height = _ref8.$height,
140
- $background = _ref8.$background,
141
- $gridTemplateColumns = _ref8.$gridTemplateColumns,
142
- $type = _ref8.$type,
143
- $forceCircle = _ref8.$forceCircle;
166
+ StyledInnerXSmallAnchor.displayName = "StyledInnerXSmallAnchor";
167
+ export var StyledPinHead = styled('div', function (_ref11) {
168
+ var $theme = _ref11.$theme,
169
+ $height = _ref11.$height,
170
+ $background = _ref11.$background,
171
+ $gridTemplateColumns = _ref11.$gridTemplateColumns,
172
+ $type = _ref11.$type,
173
+ $forceCircle = _ref11.$forceCircle;
144
174
  var sharedStyles = {
145
175
  fixed: {
146
176
  padding: '0px 12px',
@@ -151,7 +181,7 @@ export var PinHead = styled('div', function (_ref8) {
151
181
  }
152
182
  };
153
183
  return _objectSpread(_objectSpread({
154
- background: $background,
184
+ backgroundColor: $background,
155
185
  height: "".concat($height, "px"),
156
186
  display: 'grid',
157
187
  gridTemplateColumns: $gridTemplateColumns,
@@ -165,4 +195,105 @@ export var PinHead = styled('div', function (_ref8) {
165
195
  boxSizing: 'border-box'
166
196
  });
167
197
  });
168
- PinHead.displayName = "PinHead";
198
+ StyledPinHead.displayName = "StyledPinHead";
199
+ export var StyledStrokedLabelContainer = styled('div', function (_ref12) {
200
+ var $position = _ref12.$position,
201
+ $theme = _ref12.$theme,
202
+ $labelOffset = _ref12.$labelOffset;
203
+ var staticLabelOffset = 4;
204
+ var positions = {
205
+ top: {
206
+ left: "calc(50% + ".concat(staticLabelOffset, "px)"),
207
+ bottom: '100%',
208
+ alignItems: 'flex-end',
209
+ justifyContent: 'center',
210
+ textAlign: 'center'
211
+ },
212
+ bottom: {
213
+ left: '50%',
214
+ top: "calc(100% + ".concat(staticLabelOffset, "px + ").concat($labelOffset, "px)"),
215
+ alignItems: 'flex-start',
216
+ justifyContent: 'center',
217
+ textAlign: 'center'
218
+ },
219
+ right: {
220
+ left: "calc(100% + ".concat(staticLabelOffset, "px)"),
221
+ top: '50%',
222
+ alignItems: 'center',
223
+ justifyContent: 'flex-start'
224
+ },
225
+ left: {
226
+ right: "calc(100% + ".concat(staticLabelOffset, "px)"),
227
+ top: '50%',
228
+ alignItems: 'center',
229
+ justifyContent: 'flex-end',
230
+ textAlign: 'right'
231
+ },
232
+ none: {}
233
+ };
234
+ return _objectSpread({
235
+ position: 'absolute',
236
+ width: '0px',
237
+ height: '0px',
238
+ pointerEvents: 'none',
239
+ display: 'flex'
240
+ }, positions[$position]);
241
+ });
242
+ StyledStrokedLabelContainer.displayName = "StyledStrokedLabelContainer";
243
+ export var StyledStrokedLabel = styled('div', function (_ref13) {
244
+ var $theme = _ref13.$theme,
245
+ $size = _ref13.$size;
246
+ var strokeWidth = 1.5;
247
+ var strokeColor = $theme.colors.backgroundPrimary;
248
+ var textShadow = "-".concat(strokeWidth, "px -").concat(strokeWidth, "px 0 ").concat(strokeColor, ",\n 0 -").concat(strokeWidth, "px 0 ").concat(strokeColor, ",\n ").concat(strokeWidth, "px -").concat(strokeWidth, "px 0 ").concat(strokeColor, ",\n ").concat(strokeWidth, "px 0 0 ").concat(strokeColor, ",\n ").concat(strokeWidth, "px ").concat(strokeWidth, "px 0 ").concat(strokeColor, ",\n 0 ").concat(strokeWidth, "px 0 ").concat(strokeColor, ",\n -").concat(strokeWidth, "px ").concat(strokeWidth, "px 0 ").concat(strokeColor, ",\n -").concat(strokeWidth, "px 0 0 ").concat(strokeColor);
249
+ return _objectSpread(_objectSpread({
250
+ display: 'flex'
251
+ }, $theme.typography[LABEL_SIZES[$size]]), {}, {
252
+ color: $theme.colors.primaryA,
253
+ transition: "".concat($theme.animation.timing300, " ").concat($theme.animation.easeOutCurve, " all"),
254
+ textShadow: textShadow,
255
+ pointerEvents: 'auto',
256
+ width: 'max-content',
257
+ maxWidth: '200px'
258
+ });
259
+ });
260
+ StyledStrokedLabel.displayName = "StyledStrokedLabel";
261
+ export var StyledBadgeEnhancerRoot = styled('div', function (_ref14) {
262
+ var $theme = _ref14.$theme,
263
+ $size = _ref14.$size,
264
+ $position = _ref14.$position;
265
+ var x = $position.x,
266
+ y = $position.y;
267
+ return _objectSpread(_objectSpread({
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% + ".concat(x, "px), ").concat(y, "px)"),
275
+ transition: "".concat($theme.animation.timing300, " ").concat($theme.animation.easeOutCurve, " all")
276
+ }, BADGE_ENHANCER_STYLES[$size]);
277
+ });
278
+ StyledBadgeEnhancerRoot.displayName = "StyledBadgeEnhancerRoot";
279
+ export var RelativeContainer = styled('div', function () {
280
+ return {
281
+ position: 'relative'
282
+ };
283
+ });
284
+ RelativeContainer.displayName = "RelativeContainer";
285
+ export var StyledContentItem = styled('div', function (_ref15) {
286
+ var $theme = _ref15.$theme,
287
+ $color = _ref15.$color,
288
+ $height = _ref15.$height,
289
+ $size = _ref15.$size;
290
+ return _objectSpread(_objectSpread({}, $theme.typography[LABEL_SIZES[$size]]), {}, {
291
+ display: 'flex',
292
+ alignItems: 'center',
293
+ textAlign: 'center',
294
+ lineHeight: "".concat($height, "px"),
295
+ height: "".concat($height, "px"),
296
+ color: $color
297
+ });
298
+ });
299
+ 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';
@@ -59,8 +59,6 @@ export default function MaybeChildMenu(props) {
59
59
  overrides: mergeOverrides({
60
60
  Body: {
61
61
  props: {
62
- // Adds mouseleave to popover body so that child menu closes when user mouses out.
63
- onMouseLeave: props.resetParentMenu,
64
62
  // Trap tabbing when focused on a child menu. Popover mounts the element at the end of
65
63
  // the html body by default. If a user was to tab to the next element it would navigate
66
64
  // to elements not within the immediate area surrounding the menu.
@@ -1,5 +1,7 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
2
 
3
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4
+
3
5
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
6
 
5
7
  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."); }
@@ -46,6 +48,10 @@ export var NestedMenuContext = /*#__PURE__*/React.createContext({
46
48
  removeMenuFromNesting: function removeMenuFromNesting() {},
47
49
  getParentMenu: function getParentMenu() {},
48
50
  getChildMenu: function getChildMenu() {},
51
+ nestedMenuHoverIndex: -1,
52
+ isNestedMenuVisible: function isNestedMenuVisible() {
53
+ return false;
54
+ },
49
55
  mountRef: {
50
56
  current: null
51
57
  }
@@ -76,16 +82,46 @@ var NestedMenus = /*#__PURE__*/function (_React$Component) {
76
82
  _this = _super.call.apply(_super, [this].concat(args));
77
83
 
78
84
  _defineProperty(_assertThisInitialized(_this), "state", {
79
- menus: []
85
+ menus: [],
86
+ nestedMenuHoverIndex: -1
80
87
  });
81
88
 
82
89
  _defineProperty(_assertThisInitialized(_this), "mountRef", /*#__PURE__*/React.createRef());
83
90
 
91
+ _defineProperty(_assertThisInitialized(_this), "mouseLeaveTimeoueId", null);
92
+
93
+ _defineProperty(_assertThisInitialized(_this), "handleMenuMouseLeave", function (event) {
94
+ _this.mouseLeaveTimeoueId = setTimeout(function () {
95
+ _this.setState({
96
+ nestedMenuHoverIndex: -1
97
+ });
98
+ }, 200);
99
+ });
100
+
101
+ _defineProperty(_assertThisInitialized(_this), "handleMenuMouseEnter", function (event) {
102
+ if (typeof document !== 'undefined') {
103
+ clearTimeout(_this.mouseLeaveTimeoueId);
104
+
105
+ var index = _this.state.menus.findIndex(function (m) {
106
+ return m.current && event.currentTarget instanceof Node && m.current.contains(event.currentTarget);
107
+ });
108
+
109
+ _this.setState({
110
+ nestedMenuHoverIndex: index
111
+ });
112
+ }
113
+ });
114
+
84
115
  _defineProperty(_assertThisInitialized(_this), "addMenuToNesting", function (ref) {
85
116
  // check offsetHeight to determine if component is visible in the dom (0 means hidden)
86
117
  // we need to do this so that when we renderAll, the hidden seo-only child-menus don't
87
118
  // register themselves which would break the nesting logic
88
- if (ref.current && ref.current.offsetHeight) {
119
+ var element = ref.current;
120
+
121
+ if (element && element.offsetHeight) {
122
+ element.addEventListener('mouseenter', _this.handleMenuMouseEnter);
123
+ element.addEventListener('mouseleave', _this.handleMenuMouseLeave);
124
+
89
125
  _this.setState(function (state) {
90
126
  return {
91
127
  menus: [].concat(_toConsumableArray(state.menus), [ref])
@@ -96,10 +132,27 @@ var NestedMenus = /*#__PURE__*/function (_React$Component) {
96
132
 
97
133
  _defineProperty(_assertThisInitialized(_this), "removeMenuFromNesting", function (ref) {
98
134
  _this.setState(function (state) {
135
+ var _iterator = _createForOfIteratorHelper(_this.state.menus),
136
+ _step;
137
+
138
+ try {
139
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
140
+ var r = _step.value;
141
+
142
+ if (r.current && isSame(r.current, ref.current)) {
143
+ var element = r.current;
144
+ element.removeEventListener('mouseenter', _this.handleMenuMouseEnter);
145
+ element.removeEventListener('mouseleave', _this.handleMenuMouseLeave);
146
+ }
147
+ }
148
+ } catch (err) {
149
+ _iterator.e(err);
150
+ } finally {
151
+ _iterator.f();
152
+ }
153
+
99
154
  var nextMenus = state.menus.filter(function (r) {
100
- return r.current;
101
- }).filter(function (r) {
102
- return !isSame(r.current, ref.current);
155
+ return r.current && !isSame(r.current, ref.current);
103
156
  });
104
157
  return {
105
158
  menus: nextMenus
@@ -123,6 +176,12 @@ var NestedMenus = /*#__PURE__*/function (_React$Component) {
123
176
  return _this.state.menus[index];
124
177
  });
125
178
 
179
+ _defineProperty(_assertThisInitialized(_this), "isNestedMenuVisible", function (ref) {
180
+ var index = _this.findMenuIndexByRef(ref);
181
+
182
+ return index <= _this.state.nestedMenuHoverIndex;
183
+ });
184
+
126
185
  return _this;
127
186
  }
128
187
 
@@ -135,6 +194,8 @@ var NestedMenus = /*#__PURE__*/function (_React$Component) {
135
194
  removeMenuFromNesting: this.removeMenuFromNesting,
136
195
  getParentMenu: this.getParentMenu,
137
196
  getChildMenu: this.getChildMenu,
197
+ isNestedMenuVisible: this.isNestedMenuVisible,
198
+ nestedMenuHoverIndex: this.state.nestedMenuHoverIndex,
138
199
  mountRef: this.mountRef
139
200
  }
140
201
  }, /*#__PURE__*/React.createElement(React.Fragment, null, this.props.children, /*#__PURE__*/React.createElement("span", {