baseui 10.3.0 → 10.7.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 (213) hide show
  1. package/app-nav-bar/user-menu.js +1 -0
  2. package/app-nav-bar/user-menu.js.flow +1 -0
  3. package/button/styled-components.js +1 -1
  4. package/button/styled-components.js.flow +4 -1
  5. package/card/styled-components.js +0 -1
  6. package/card/styled-components.js.flow +0 -1
  7. package/combobox/combobox.js +5 -1
  8. package/combobox/combobox.js.flow +4 -0
  9. package/combobox/index.d.ts +6 -3
  10. package/data-table/column-datetime.js +2 -0
  11. package/data-table/column-datetime.js.flow +2 -0
  12. package/data-table/data-table.js +13 -3
  13. package/data-table/data-table.js.flow +20 -4
  14. package/data-table/types.js.flow +2 -1
  15. package/datepicker/calendar-header.js +255 -109
  16. package/datepicker/calendar-header.js.flow +282 -145
  17. package/datepicker/calendar.js +6 -1
  18. package/datepicker/calendar.js.flow +5 -1
  19. package/datepicker/constants.js +9 -2
  20. package/datepicker/constants.js.flow +7 -0
  21. package/datepicker/datepicker.js +135 -73
  22. package/datepicker/datepicker.js.flow +161 -62
  23. package/datepicker/day.js +2 -0
  24. package/datepicker/day.js.flow +2 -0
  25. package/datepicker/index.d.ts +8 -0
  26. package/datepicker/month.js +4 -0
  27. package/datepicker/month.js.flow +3 -0
  28. package/datepicker/styled-components.js +116 -56
  29. package/datepicker/styled-components.js.flow +101 -36
  30. package/datepicker/types.js.flow +18 -1
  31. package/datepicker/utils/calendar-header-helpers.js +51 -0
  32. package/datepicker/utils/calendar-header-helpers.js.flow +53 -0
  33. package/datepicker/utils/date-helpers.js +1 -1
  34. package/datepicker/utils/date-helpers.js.flow +1 -1
  35. package/datepicker/week.js +1 -0
  36. package/datepicker/week.js.flow +1 -0
  37. package/dnd-list/index.js.flow +2 -1
  38. package/dnd-list/list.js +1 -2
  39. package/dnd-list/list.js.flow +1 -1
  40. package/dnd-list/styled-components.js +1 -1
  41. package/dnd-list/styled-components.js.flow +1 -0
  42. package/drawer/close-icon.js +3 -2
  43. package/drawer/close-icon.js.flow +2 -2
  44. package/drawer/drawer.js +5 -2
  45. package/drawer/drawer.js.flow +2 -2
  46. package/es/app-nav-bar/user-menu.js +1 -0
  47. package/es/button/styled-components.js +1 -1
  48. package/es/card/styled-components.js +0 -1
  49. package/es/combobox/combobox.js +5 -1
  50. package/es/data-table/column-datetime.js +2 -0
  51. package/es/data-table/data-table.js +13 -3
  52. package/es/datepicker/calendar-header.js +204 -93
  53. package/es/datepicker/calendar.js +7 -2
  54. package/es/datepicker/constants.js +6 -1
  55. package/es/datepicker/datepicker.js +70 -42
  56. package/es/datepicker/day.js +2 -0
  57. package/es/datepicker/month.js +3 -0
  58. package/es/datepicker/styled-components.js +98 -37
  59. package/es/datepicker/types.js +1 -1
  60. package/es/datepicker/utils/calendar-header-helpers.js +34 -0
  61. package/es/datepicker/utils/date-helpers.js +1 -1
  62. package/es/datepicker/week.js +1 -0
  63. package/es/dnd-list/index.js +2 -1
  64. package/es/dnd-list/list.js +1 -2
  65. package/es/dnd-list/styled-components.js +1 -0
  66. package/es/drawer/close-icon.js +3 -2
  67. package/es/drawer/drawer.js +5 -2
  68. package/es/helper/helper.js +1 -0
  69. package/es/layer/layer.js +8 -0
  70. package/es/list/list-heading.js +17 -6
  71. package/es/map-marker/constants.js +69 -0
  72. package/es/map-marker/fixed-marker.js +98 -0
  73. package/es/map-marker/floating-marker.js +65 -0
  74. package/es/map-marker/index.js +9 -0
  75. package/es/map-marker/pin-head.js +108 -0
  76. package/es/map-marker/styled-components.js +156 -0
  77. package/es/map-marker/types.js +8 -0
  78. package/es/menu/maybe-child-menu.js +1 -0
  79. package/es/popover/popover.js +6 -5
  80. package/es/popover/stateful-container.js +8 -2
  81. package/es/rating/emoticon-rating.js +3 -1
  82. package/es/rating/star-rating.js +3 -1
  83. package/es/select/select-component.js +20 -5
  84. package/es/select/styled-components.js +34 -4
  85. package/es/snackbar/snackbar-context.js +16 -4
  86. package/es/spinner/styled-components.js +1 -1
  87. package/es/table-semantic/styled-components.js +6 -4
  88. package/es/table-semantic/table-builder.js +3 -0
  89. package/es/themes/dark-theme/color-component-tokens.js +1 -1
  90. package/es/themes/light-theme/color-component-tokens.js +9 -9
  91. package/es/themes/shared/lighting.js +5 -1
  92. package/es/timepicker/timepicker.js +16 -11
  93. package/es/tooltip/styled-components.js +8 -0
  94. package/es/tooltip/tooltip.js +1 -0
  95. package/esm/app-nav-bar/user-menu.js +1 -0
  96. package/esm/button/styled-components.js +1 -1
  97. package/esm/card/styled-components.js +0 -1
  98. package/esm/combobox/combobox.js +5 -1
  99. package/esm/data-table/column-datetime.js +2 -0
  100. package/esm/data-table/data-table.js +13 -3
  101. package/esm/datepicker/calendar-header.js +255 -110
  102. package/esm/datepicker/calendar.js +7 -2
  103. package/esm/datepicker/constants.js +6 -1
  104. package/esm/datepicker/datepicker.js +136 -74
  105. package/esm/datepicker/day.js +2 -0
  106. package/esm/datepicker/month.js +3 -0
  107. package/esm/datepicker/styled-components.js +112 -55
  108. package/esm/datepicker/types.js +1 -1
  109. package/esm/datepicker/utils/calendar-header-helpers.js +45 -0
  110. package/esm/datepicker/utils/date-helpers.js +1 -1
  111. package/esm/datepicker/week.js +1 -0
  112. package/esm/dnd-list/index.js +2 -1
  113. package/esm/dnd-list/list.js +1 -2
  114. package/esm/dnd-list/styled-components.js +1 -1
  115. package/esm/drawer/close-icon.js +3 -2
  116. package/esm/drawer/drawer.js +5 -2
  117. package/esm/helper/helper.js +1 -0
  118. package/esm/layer/layer.js +8 -0
  119. package/esm/list/list-heading.js +17 -6
  120. package/esm/map-marker/constants.js +62 -0
  121. package/esm/map-marker/fixed-marker.js +137 -0
  122. package/esm/map-marker/floating-marker.js +94 -0
  123. package/esm/map-marker/index.js +9 -0
  124. package/esm/map-marker/pin-head.js +144 -0
  125. package/esm/map-marker/styled-components.js +168 -0
  126. package/esm/map-marker/types.js +8 -0
  127. package/esm/menu/maybe-child-menu.js +1 -0
  128. package/esm/popover/popover.js +6 -5
  129. package/esm/popover/stateful-container.js +8 -2
  130. package/esm/rating/emoticon-rating.js +2 -2
  131. package/esm/rating/star-rating.js +2 -2
  132. package/esm/select/select-component.js +19 -5
  133. package/esm/select/styled-components.js +28 -4
  134. package/esm/snackbar/snackbar-context.js +16 -4
  135. package/esm/spinner/styled-components.js +1 -1
  136. package/esm/table-semantic/styled-components.js +6 -4
  137. package/esm/table-semantic/table-builder.js +3 -0
  138. package/esm/themes/dark-theme/color-component-tokens.js +1 -1
  139. package/esm/themes/light-theme/color-component-tokens.js +9 -9
  140. package/esm/themes/shared/lighting.js +5 -1
  141. package/esm/timepicker/timepicker.js +17 -11
  142. package/esm/tooltip/styled-components.js +8 -0
  143. package/esm/tooltip/tooltip.js +1 -0
  144. package/helper/helper.js +1 -0
  145. package/helper/helper.js.flow +1 -0
  146. package/layer/layer.js +8 -0
  147. package/layer/layer.js.flow +9 -0
  148. package/link/index.d.ts +1 -0
  149. package/list/index.d.ts +36 -0
  150. package/list/list-heading.js +24 -7
  151. package/list/list-heading.js.flow +17 -8
  152. package/map-marker/constants.js +82 -0
  153. package/map-marker/constants.js.flow +74 -0
  154. package/map-marker/fixed-marker.js +152 -0
  155. package/map-marker/fixed-marker.js.flow +137 -0
  156. package/map-marker/floating-marker.js +109 -0
  157. package/map-marker/floating-marker.js.flow +102 -0
  158. package/map-marker/index.d.ts +105 -0
  159. package/map-marker/index.js +55 -0
  160. package/map-marker/index.js.flow +23 -0
  161. package/map-marker/package.json +4 -0
  162. package/map-marker/pin-head.js +159 -0
  163. package/map-marker/pin-head.js.flow +155 -0
  164. package/map-marker/styled-components.js +184 -0
  165. package/map-marker/styled-components.js.flow +177 -0
  166. package/map-marker/types.js +11 -0
  167. package/map-marker/types.js.flow +114 -0
  168. package/menu/index.d.ts +7 -0
  169. package/menu/maybe-child-menu.js +1 -0
  170. package/menu/maybe-child-menu.js.flow +1 -0
  171. package/menu/types.js.flow +12 -0
  172. package/modal/index.d.ts +1 -1
  173. package/modal/types.js.flow +4 -1
  174. package/package.json +5 -3
  175. package/popover/index.d.ts +2 -1
  176. package/popover/popover.js +6 -5
  177. package/popover/popover.js.flow +11 -4
  178. package/popover/stateful-container.js +8 -2
  179. package/popover/stateful-container.js.flow +5 -0
  180. package/popover/types.js.flow +6 -1
  181. package/rating/emoticon-rating.js +2 -2
  182. package/rating/emoticon-rating.js.flow +4 -1
  183. package/rating/star-rating.js +2 -2
  184. package/rating/star-rating.js.flow +4 -1
  185. package/select/select-component.js +19 -5
  186. package/select/select-component.js.flow +19 -5
  187. package/select/styled-components.js +28 -4
  188. package/select/styled-components.js.flow +30 -2
  189. package/select/types.js.flow +9 -0
  190. package/snackbar/index.d.ts +21 -16
  191. package/snackbar/snackbar-context.js +15 -4
  192. package/snackbar/snackbar-context.js.flow +15 -3
  193. package/spinner/styled-components.js +1 -1
  194. package/spinner/styled-components.js.flow +1 -1
  195. package/table-semantic/styled-components.js +6 -4
  196. package/table-semantic/styled-components.js.flow +6 -4
  197. package/table-semantic/table-builder.js +3 -0
  198. package/table-semantic/table-builder.js.flow +3 -0
  199. package/themes/dark-theme/color-component-tokens.js +1 -1
  200. package/themes/dark-theme/color-component-tokens.js.flow +1 -1
  201. package/themes/light-theme/color-component-tokens.js +9 -9
  202. package/themes/light-theme/color-component-tokens.js.flow +9 -9
  203. package/themes/shared/lighting.js +5 -1
  204. package/themes/shared/lighting.js.flow +4 -0
  205. package/themes/types.js.flow +4 -0
  206. package/timepicker/index.d.ts +1 -0
  207. package/timepicker/timepicker.js +17 -11
  208. package/timepicker/timepicker.js.flow +31 -12
  209. package/timepicker/types.js.flow +10 -0
  210. package/tooltip/styled-components.js +8 -0
  211. package/tooltip/styled-components.js.flow +8 -0
  212. package/tooltip/tooltip.js +1 -0
  213. package/tooltip/tooltip.js.flow +6 -1
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.anchorSize = exports.dragShadowWidth = exports.dragShadowMarginTop = exports.dragShadowHeight = exports.FLOATING_MARKER_ANCHOR_TYPES = exports.FLOATING_MARKER_ANCHOR_POSITIONS = exports.FLOATING_MARKER_SIZES = exports.PINHEAD_TYPES = exports.PINHEAD_DIMENSIONS = exports.xSmallPinheadDimension = exports.PINHEAD_SIZES_SHAPES = exports.NEEDLE_HEIGHTS = exports.NEEDLE_SIZES = void 0;
7
+
8
+ var _Object$freeze, _Object$freeze2;
9
+
10
+ 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; }
11
+
12
+ /*
13
+ Copyright (c) Uber Technologies, Inc.
14
+
15
+ This source code is licensed under the MIT license found in the
16
+ LICENSE file in the root directory of this source tree.
17
+ */
18
+ var NEEDLE_SIZES = Object.freeze({
19
+ none: 'none',
20
+ short: 'short',
21
+ medium: 'medium',
22
+ tall: 'tall'
23
+ });
24
+ exports.NEEDLE_SIZES = NEEDLE_SIZES;
25
+ var NEEDLE_HEIGHTS = Object.freeze((_Object$freeze = {}, _defineProperty(_Object$freeze, NEEDLE_SIZES.none, 0), _defineProperty(_Object$freeze, NEEDLE_SIZES.short, 4), _defineProperty(_Object$freeze, NEEDLE_SIZES.medium, 12), _defineProperty(_Object$freeze, NEEDLE_SIZES.tall, 20), _Object$freeze));
26
+ exports.NEEDLE_HEIGHTS = NEEDLE_HEIGHTS;
27
+ var PINHEAD_SIZES_SHAPES = Object.freeze({
28
+ xSmallCircle: 'x-small-circle',
29
+ xSmallSquare: 'x-small-square',
30
+ small: 'small',
31
+ medium: 'medium',
32
+ large: 'large'
33
+ });
34
+ exports.PINHEAD_SIZES_SHAPES = PINHEAD_SIZES_SHAPES;
35
+ var xSmallPinheadDimension = {
36
+ height: 16,
37
+ icon: 4
38
+ };
39
+ exports.xSmallPinheadDimension = xSmallPinheadDimension;
40
+ var PINHEAD_DIMENSIONS = Object.freeze((_Object$freeze2 = {}, _defineProperty(_Object$freeze2, PINHEAD_SIZES_SHAPES.xSmallSquare, xSmallPinheadDimension), _defineProperty(_Object$freeze2, PINHEAD_SIZES_SHAPES.xSmallCircle, xSmallPinheadDimension), _defineProperty(_Object$freeze2, PINHEAD_SIZES_SHAPES.small, {
41
+ height: 24,
42
+ icon: 16
43
+ }), _defineProperty(_Object$freeze2, PINHEAD_SIZES_SHAPES.medium, {
44
+ height: 36,
45
+ icon: 16
46
+ }), _defineProperty(_Object$freeze2, PINHEAD_SIZES_SHAPES.large, {
47
+ height: 48,
48
+ icon: 24
49
+ }), _Object$freeze2));
50
+ exports.PINHEAD_DIMENSIONS = PINHEAD_DIMENSIONS;
51
+ var PINHEAD_TYPES = Object.freeze({
52
+ floating: 'floating',
53
+ fixed: 'fixed'
54
+ });
55
+ exports.PINHEAD_TYPES = PINHEAD_TYPES;
56
+ var FLOATING_MARKER_SIZES = Object.freeze({
57
+ small: 'small',
58
+ medium: 'medium',
59
+ large: 'large'
60
+ });
61
+ exports.FLOATING_MARKER_SIZES = FLOATING_MARKER_SIZES;
62
+ var FLOATING_MARKER_ANCHOR_POSITIONS = Object.freeze({
63
+ none: 'none',
64
+ topLeft: 'top-left',
65
+ topRight: 'top-right',
66
+ bottomRight: 'bottom-right',
67
+ bottomLeft: 'bottom-left'
68
+ });
69
+ exports.FLOATING_MARKER_ANCHOR_POSITIONS = FLOATING_MARKER_ANCHOR_POSITIONS;
70
+ var FLOATING_MARKER_ANCHOR_TYPES = Object.freeze({
71
+ circle: 'circle',
72
+ square: 'square'
73
+ });
74
+ exports.FLOATING_MARKER_ANCHOR_TYPES = FLOATING_MARKER_ANCHOR_TYPES;
75
+ var dragShadowHeight = 4;
76
+ exports.dragShadowHeight = dragShadowHeight;
77
+ var dragShadowMarginTop = 6;
78
+ exports.dragShadowMarginTop = dragShadowMarginTop;
79
+ var dragShadowWidth = 6;
80
+ exports.dragShadowWidth = dragShadowWidth;
81
+ var anchorSize = 16;
82
+ exports.anchorSize = anchorSize;
@@ -0,0 +1,74 @@
1
+ /*
2
+ Copyright (c) Uber Technologies, Inc.
3
+
4
+ This source code is licensed under the MIT license found in the
5
+ LICENSE file in the root directory of this source tree.
6
+ */
7
+ // @flow
8
+
9
+ export const NEEDLE_SIZES = Object.freeze({
10
+ none: 'none',
11
+ short: 'short',
12
+ medium: 'medium',
13
+ tall: 'tall',
14
+ });
15
+
16
+ export const NEEDLE_HEIGHTS = Object.freeze({
17
+ [NEEDLE_SIZES.none]: 0,
18
+ [NEEDLE_SIZES.short]: 4,
19
+ [NEEDLE_SIZES.medium]: 12,
20
+ [NEEDLE_SIZES.tall]: 20,
21
+ });
22
+
23
+ export const PINHEAD_SIZES_SHAPES = Object.freeze({
24
+ xSmallCircle: 'x-small-circle',
25
+ xSmallSquare: 'x-small-square',
26
+ small: 'small',
27
+ medium: 'medium',
28
+ large: 'large',
29
+ });
30
+
31
+ export const xSmallPinheadDimension = {
32
+ height: 16,
33
+ icon: 4,
34
+ };
35
+ export const PINHEAD_DIMENSIONS = Object.freeze({
36
+ [PINHEAD_SIZES_SHAPES.xSmallSquare]: xSmallPinheadDimension,
37
+ [PINHEAD_SIZES_SHAPES.xSmallCircle]: xSmallPinheadDimension,
38
+ [PINHEAD_SIZES_SHAPES.small]: {height: 24, icon: 16},
39
+ [PINHEAD_SIZES_SHAPES.medium]: {height: 36, icon: 16},
40
+ [PINHEAD_SIZES_SHAPES.large]: {height: 48, icon: 24},
41
+ });
42
+
43
+ export const PINHEAD_TYPES = Object.freeze({
44
+ floating: 'floating',
45
+ fixed: 'fixed',
46
+ });
47
+
48
+ export const FLOATING_MARKER_SIZES = Object.freeze({
49
+ small: 'small',
50
+ medium: 'medium',
51
+ large: 'large',
52
+ });
53
+
54
+ export const FLOATING_MARKER_ANCHOR_POSITIONS = Object.freeze({
55
+ none: 'none',
56
+ topLeft: 'top-left',
57
+ topRight: 'top-right',
58
+ bottomRight: 'bottom-right',
59
+ bottomLeft: 'bottom-left',
60
+ });
61
+
62
+ export const FLOATING_MARKER_ANCHOR_TYPES = Object.freeze({
63
+ circle: 'circle',
64
+ square: 'square',
65
+ });
66
+
67
+ export const dragShadowHeight = 4;
68
+ export const dragShadowMarginTop = 6;
69
+ export const dragShadowWidth = 6;
70
+ export const anchorSize = 16;
71
+
72
+ declare var __DEV__: boolean;
73
+ declare var __NODE__: boolean;
74
+ declare var __BROWSER__: boolean;
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+
3
+ 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); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var React = _interopRequireWildcard(require("react"));
11
+
12
+ var _index = require("../styles/index.js");
13
+
14
+ var _overrides = require("../helpers/overrides.js");
15
+
16
+ var _constants = require("./constants.js");
17
+
18
+ var _pinHead = _interopRequireDefault(require("./pin-head.js"));
19
+
20
+ var _styledComponents = require("./styled-components.js");
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
24
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
25
+
26
+ 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; }
27
+
28
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
29
+
30
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
31
+
32
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
33
+
34
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
35
+
36
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
37
+
38
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
39
+
40
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
41
+
42
+ var Needle = function Needle(_ref) {
43
+ var size = _ref.size,
44
+ background = _ref.background,
45
+ _ref$overrides = _ref.overrides,
46
+ overrides = _ref$overrides === void 0 ? {} : _ref$overrides;
47
+
48
+ var _getOverrides = (0, _overrides.getOverrides)(overrides.Needle, _styledComponents.Needle),
49
+ _getOverrides2 = _slicedToArray(_getOverrides, 2),
50
+ Needle = _getOverrides2[0],
51
+ needleProps = _getOverrides2[1];
52
+
53
+ return /*#__PURE__*/React.createElement(Needle, _extends({
54
+ $background: background,
55
+ $height: _constants.NEEDLE_HEIGHTS[size]
56
+ }, needleProps));
57
+ };
58
+
59
+ var DragShadow = function DragShadow(_ref2) {
60
+ var background = _ref2.background,
61
+ dragging = _ref2.dragging,
62
+ height = _ref2.height,
63
+ _ref2$overrides = _ref2.overrides,
64
+ overrides = _ref2$overrides === void 0 ? {} : _ref2$overrides;
65
+
66
+ var _getOverrides3 = (0, _overrides.getOverrides)(overrides.DragShadowContainer, _styledComponents.DragShadowContainer),
67
+ _getOverrides4 = _slicedToArray(_getOverrides3, 2),
68
+ DragShadowContainer = _getOverrides4[0],
69
+ dragShadowContainerProps = _getOverrides4[1];
70
+
71
+ var _getOverrides5 = (0, _overrides.getOverrides)(overrides.DragShadow, _styledComponents.DragShadow),
72
+ _getOverrides6 = _slicedToArray(_getOverrides5, 2),
73
+ DragShadow = _getOverrides6[0],
74
+ dragShadowProps = _getOverrides6[1];
75
+
76
+ return /*#__PURE__*/React.createElement(DragShadowContainer, _extends({
77
+ $width: _constants.dragShadowWidth,
78
+ $height: height,
79
+ $dragging: dragging
80
+ }, dragShadowContainerProps), /*#__PURE__*/React.createElement(DragShadow, _extends({
81
+ $width: _constants.dragShadowWidth,
82
+ $background: background
83
+ }, dragShadowProps)));
84
+ };
85
+
86
+ var FixedMarker = function FixedMarker(_ref3) {
87
+ var _ref3$size = _ref3.size,
88
+ size = _ref3$size === void 0 ? _constants.PINHEAD_SIZES_SHAPES.medium : _ref3$size,
89
+ _ref3$needle = _ref3.needle,
90
+ needle = _ref3$needle === void 0 ? _constants.NEEDLE_SIZES.medium : _ref3$needle,
91
+ label = _ref3.label,
92
+ startEnhancer = _ref3.startEnhancer,
93
+ endEnhancer = _ref3.endEnhancer,
94
+ color = _ref3.color,
95
+ background = _ref3.background,
96
+ _ref3$dragging = _ref3.dragging,
97
+ dragging = _ref3$dragging === void 0 ? false : _ref3$dragging,
98
+ _ref3$overrides = _ref3.overrides,
99
+ overrides = _ref3$overrides === void 0 ? {} : _ref3$overrides;
100
+
101
+ var _useStyletron = (0, _index.useStyletron)(),
102
+ _useStyletron2 = _slicedToArray(_useStyletron, 2),
103
+ theme = _useStyletron2[1];
104
+
105
+ var _theme$colors = theme.colors,
106
+ backgroundInversePrimary = _theme$colors.backgroundInversePrimary,
107
+ primaryB = _theme$colors.primaryB;
108
+ color = color || primaryB;
109
+ background = background || backgroundInversePrimary;
110
+ var doesPinHeadTransformOnDrag = needle !== _constants.NEEDLE_SIZES.none;
111
+
112
+ var _getOverrides7 = (0, _overrides.getOverrides)(overrides.Root, _styledComponents.FixedMarkerRoot),
113
+ _getOverrides8 = _slicedToArray(_getOverrides7, 2),
114
+ Root = _getOverrides8[0],
115
+ rootProps = _getOverrides8[1];
116
+
117
+ var _getOverrides9 = (0, _overrides.getOverrides)(overrides.DragContainer, _styledComponents.FixedMarkerDragContainer),
118
+ _getOverrides10 = _slicedToArray(_getOverrides9, 2),
119
+ FixedMarkerDragContainer = _getOverrides10[0],
120
+ fixedMarkerDragContainerProps = _getOverrides10[1];
121
+
122
+ return /*#__PURE__*/React.createElement(Root, _extends({
123
+ "data-baseweb": "fixed-map-marker"
124
+ }, rootProps), /*#__PURE__*/React.createElement(FixedMarkerDragContainer, _extends({
125
+ $translateAmount: _constants.dragShadowMarginTop + _constants.dragShadowHeight,
126
+ $performTranslate: doesPinHeadTransformOnDrag && dragging
127
+ }, fixedMarkerDragContainerProps), /*#__PURE__*/React.createElement(_pinHead.default, _extends({
128
+ size: size,
129
+ label: label
130
+ }, startEnhancer ? {
131
+ startEnhancer: startEnhancer
132
+ } : {}, endEnhancer ? {
133
+ endEnhancer: endEnhancer
134
+ } : {}, {
135
+ color: color,
136
+ background: background,
137
+ type: _constants.PINHEAD_TYPES.fixed,
138
+ overrides: overrides
139
+ })), /*#__PURE__*/React.createElement(Needle, {
140
+ size: needle,
141
+ background: background,
142
+ overrides: overrides
143
+ })), doesPinHeadTransformOnDrag && /*#__PURE__*/React.createElement(DragShadow, {
144
+ background: background,
145
+ dragging: dragging,
146
+ height: _constants.dragShadowMarginTop + _constants.dragShadowHeight,
147
+ overrides: overrides
148
+ }));
149
+ };
150
+
151
+ var _default = FixedMarker;
152
+ exports.default = _default;
@@ -0,0 +1,137 @@
1
+ /*
2
+ Copyright (c) Uber Technologies, Inc.
3
+
4
+ This source code is licensed under the MIT license found in the
5
+ LICENSE file in the root directory of this source tree.
6
+ */
7
+ // @flow
8
+ import * as React from 'react';
9
+ import {useStyletron} from '../styles/index.js';
10
+ import {getOverrides} from '../helpers/overrides.js';
11
+ import {
12
+ PINHEAD_TYPES,
13
+ NEEDLE_SIZES,
14
+ NEEDLE_HEIGHTS,
15
+ PINHEAD_SIZES_SHAPES,
16
+ dragShadowHeight,
17
+ dragShadowMarginTop,
18
+ dragShadowWidth,
19
+ } from './constants.js';
20
+ import PinHead from './pin-head.js';
21
+ import {
22
+ FixedMarkerDragContainer as StyledFixedMarkerDragContainer,
23
+ FixedMarkerRoot as StyledRoot,
24
+ Needle as StyledNeedle,
25
+ DragShadow as StyledDragShadow,
26
+ DragShadowContainer as StyledDragShadowContainer,
27
+ } from './styled-components.js';
28
+ import type {
29
+ FixedMarkerPropsT,
30
+ NeedlePropsT,
31
+ DragShadowPropsT,
32
+ } from './types.js';
33
+
34
+ const Needle = ({size, background, overrides = {}}: NeedlePropsT) => {
35
+ const [Needle, needleProps] = getOverrides(overrides.Needle, StyledNeedle);
36
+ return (
37
+ <Needle
38
+ $background={background}
39
+ $height={NEEDLE_HEIGHTS[size]}
40
+ {...needleProps}
41
+ />
42
+ );
43
+ };
44
+
45
+ const DragShadow = ({
46
+ background,
47
+ dragging,
48
+ height,
49
+ overrides = {},
50
+ }: DragShadowPropsT) => {
51
+ const [DragShadowContainer, dragShadowContainerProps] = getOverrides(
52
+ overrides.DragShadowContainer,
53
+ StyledDragShadowContainer,
54
+ );
55
+ const [DragShadow, dragShadowProps] = getOverrides(
56
+ overrides.DragShadow,
57
+ StyledDragShadow,
58
+ );
59
+
60
+ return (
61
+ <DragShadowContainer
62
+ $width={dragShadowWidth}
63
+ $height={height}
64
+ $dragging={dragging}
65
+ {...dragShadowContainerProps}
66
+ >
67
+ <DragShadow
68
+ $width={dragShadowWidth}
69
+ $background={background}
70
+ {...dragShadowProps}
71
+ />
72
+ </DragShadowContainer>
73
+ );
74
+ };
75
+
76
+ const FixedMarker = ({
77
+ size = PINHEAD_SIZES_SHAPES.medium,
78
+ needle = NEEDLE_SIZES.medium,
79
+ label,
80
+ startEnhancer,
81
+ endEnhancer,
82
+ color,
83
+ background,
84
+ dragging = false,
85
+ overrides = {},
86
+ }: FixedMarkerPropsT) => {
87
+ const [, theme] = useStyletron();
88
+ const {
89
+ colors: {backgroundInversePrimary, primaryB},
90
+ } = theme;
91
+
92
+ color = color || primaryB;
93
+ background = background || backgroundInversePrimary;
94
+
95
+ const doesPinHeadTransformOnDrag = needle !== NEEDLE_SIZES.none;
96
+
97
+ const [Root, rootProps] = getOverrides(overrides.Root, StyledRoot);
98
+ const [
99
+ FixedMarkerDragContainer,
100
+ fixedMarkerDragContainerProps,
101
+ ] = getOverrides(overrides.DragContainer, StyledFixedMarkerDragContainer);
102
+ return (
103
+ <Root data-baseweb="fixed-map-marker" {...rootProps}>
104
+ <FixedMarkerDragContainer
105
+ $translateAmount={dragShadowMarginTop + dragShadowHeight}
106
+ $performTranslate={doesPinHeadTransformOnDrag && dragging}
107
+ {...fixedMarkerDragContainerProps}
108
+ >
109
+ <PinHead
110
+ size={size}
111
+ label={label}
112
+ {...(startEnhancer ? {startEnhancer} : {})}
113
+ {...(endEnhancer ? {endEnhancer} : {})}
114
+ color={color}
115
+ background={background}
116
+ type={PINHEAD_TYPES.fixed}
117
+ overrides={overrides}
118
+ />
119
+ <Needle size={needle} background={background} overrides={overrides} />
120
+ </FixedMarkerDragContainer>
121
+ {doesPinHeadTransformOnDrag && (
122
+ <DragShadow
123
+ background={background}
124
+ dragging={dragging}
125
+ height={dragShadowMarginTop + dragShadowHeight}
126
+ overrides={overrides}
127
+ />
128
+ )}
129
+ </Root>
130
+ );
131
+ };
132
+
133
+ export default FixedMarker;
134
+
135
+ declare var __DEV__: boolean;
136
+ declare var __NODE__: boolean;
137
+ declare var __BROWSER__: boolean;
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+
3
+ 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); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var React = _interopRequireWildcard(require("react"));
11
+
12
+ var _index = require("../styles/index.js");
13
+
14
+ var _pinHead = _interopRequireDefault(require("./pin-head.js"));
15
+
16
+ var _overrides = require("../helpers/overrides.js");
17
+
18
+ var _styledComponents = require("./styled-components.js");
19
+
20
+ var _constants = require("./constants.js");
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
24
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
25
+
26
+ 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; }
27
+
28
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
29
+
30
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
31
+
32
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
33
+
34
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
35
+
36
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
37
+
38
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
39
+
40
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
41
+
42
+ var FloatingMarker = function FloatingMarker(_ref) {
43
+ var color = _ref.color,
44
+ background = _ref.background,
45
+ label = _ref.label,
46
+ _ref$size = _ref.size,
47
+ size = _ref$size === void 0 ? _constants.PINHEAD_SIZES_SHAPES.medium : _ref$size,
48
+ _ref$anchor = _ref.anchor,
49
+ anchor = _ref$anchor === void 0 ? _constants.FLOATING_MARKER_ANCHOR_POSITIONS.bottomLeft : _ref$anchor,
50
+ endEnhancer = _ref.endEnhancer,
51
+ startEnhancer = _ref.startEnhancer,
52
+ _ref$anchorType = _ref.anchorType,
53
+ anchorType = _ref$anchorType === void 0 ? _constants.FLOATING_MARKER_ANCHOR_TYPES.circle : _ref$anchorType,
54
+ _ref$overrides = _ref.overrides,
55
+ overrides = _ref$overrides === void 0 ? {} : _ref$overrides;
56
+
57
+ var _useStyletron = (0, _index.useStyletron)(),
58
+ _useStyletron2 = _slicedToArray(_useStyletron, 2),
59
+ theme = _useStyletron2[1];
60
+
61
+ var _theme$colors = theme.colors,
62
+ backgroundPrimary = _theme$colors.backgroundPrimary,
63
+ backgroundInversePrimary = _theme$colors.backgroundInversePrimary,
64
+ primaryA = _theme$colors.primaryA,
65
+ primaryB = _theme$colors.primaryB;
66
+ color = color || primaryA;
67
+ background = background || backgroundPrimary;
68
+ var anchorPinHeadSize = anchorType === _constants.FLOATING_MARKER_ANCHOR_TYPES.circle ? _constants.PINHEAD_SIZES_SHAPES.xSmallCircle : _constants.PINHEAD_SIZES_SHAPES.xSmallSquare;
69
+
70
+ var _getOverrides = (0, _overrides.getOverrides)(overrides.Root, _styledComponents.FloatingMarkerRoot),
71
+ _getOverrides2 = _slicedToArray(_getOverrides, 2),
72
+ Root = _getOverrides2[0],
73
+ rootProps = _getOverrides2[1];
74
+
75
+ var _getOverrides3 = (0, _overrides.getOverrides)(overrides.PinHeadContainer, _styledComponents.FloatingMarkerPinHeadContainer),
76
+ _getOverrides4 = _slicedToArray(_getOverrides3, 2),
77
+ FloatingMarkerPinHeadContainer = _getOverrides4[0],
78
+ floatingMarkerPinHeadContainerProps = _getOverrides4[1];
79
+
80
+ var _getOverrides5 = (0, _overrides.getOverrides)(overrides.AnchorContainer, _styledComponents.FloatingMarkerAnchorContainer),
81
+ _getOverrides6 = _slicedToArray(_getOverrides5, 2),
82
+ FloatingMarkerAnchorContainer = _getOverrides6[0],
83
+ floatingMarkerAnchorContainerProps = _getOverrides6[1];
84
+
85
+ return /*#__PURE__*/React.createElement(Root, _extends({
86
+ "data-baseweb": "floating-map-marker"
87
+ }, rootProps), /*#__PURE__*/React.createElement(FloatingMarkerPinHeadContainer, _extends({
88
+ $anchor: anchor,
89
+ $anchorSize: _constants.anchorSize
90
+ }, floatingMarkerPinHeadContainerProps), /*#__PURE__*/React.createElement(_pinHead.default, {
91
+ size: size,
92
+ color: color,
93
+ background: background,
94
+ type: _constants.PINHEAD_TYPES.floating,
95
+ label: label,
96
+ startEnhancer: startEnhancer,
97
+ endEnhancer: endEnhancer,
98
+ overrides: overrides
99
+ })), anchor !== _constants.FLOATING_MARKER_ANCHOR_POSITIONS.none && /*#__PURE__*/React.createElement(FloatingMarkerAnchorContainer, floatingMarkerAnchorContainerProps, /*#__PURE__*/React.createElement(_pinHead.default, {
100
+ size: anchorPinHeadSize,
101
+ color: primaryB,
102
+ background: backgroundInversePrimary,
103
+ type: _constants.PINHEAD_TYPES.fixed,
104
+ overrides: overrides
105
+ })));
106
+ };
107
+
108
+ var _default = FloatingMarker;
109
+ exports.default = _default;
@@ -0,0 +1,102 @@
1
+ /*
2
+ Copyright (c) Uber Technologies, Inc.
3
+
4
+ This source code is licensed under the MIT license found in the
5
+ LICENSE file in the root directory of this source tree.
6
+ */
7
+ // @flow
8
+ import * as React from 'react';
9
+ import {useStyletron} from '../styles/index.js';
10
+ import PinHead from './pin-head.js';
11
+ import {getOverrides} from '../helpers/overrides.js';
12
+ import {
13
+ FloatingMarkerRoot as StyledRoot,
14
+ FloatingMarkerAnchorContainer as StyledFloatingMarkerAnchorContainer,
15
+ FloatingMarkerPinHeadContainer as StyledFloatingMarkerPinHeadContainer,
16
+ } from './styled-components.js';
17
+ import type {FloatingMarkerPropsT} from './types.js';
18
+ import {
19
+ FLOATING_MARKER_ANCHOR_POSITIONS,
20
+ PINHEAD_SIZES_SHAPES,
21
+ PINHEAD_TYPES,
22
+ FLOATING_MARKER_ANCHOR_TYPES,
23
+ anchorSize,
24
+ } from './constants.js';
25
+
26
+ const FloatingMarker = ({
27
+ color,
28
+ background,
29
+ label,
30
+ size = PINHEAD_SIZES_SHAPES.medium,
31
+ anchor = FLOATING_MARKER_ANCHOR_POSITIONS.bottomLeft,
32
+ endEnhancer,
33
+ startEnhancer,
34
+ anchorType = FLOATING_MARKER_ANCHOR_TYPES.circle,
35
+ overrides = {},
36
+ }: FloatingMarkerPropsT) => {
37
+ const [, theme] = useStyletron();
38
+ const {
39
+ colors: {backgroundPrimary, backgroundInversePrimary, primaryA, primaryB},
40
+ } = theme;
41
+ color = color || primaryA;
42
+ background = background || backgroundPrimary;
43
+
44
+ const anchorPinHeadSize =
45
+ anchorType === FLOATING_MARKER_ANCHOR_TYPES.circle
46
+ ? PINHEAD_SIZES_SHAPES.xSmallCircle
47
+ : PINHEAD_SIZES_SHAPES.xSmallSquare;
48
+
49
+ const [Root, rootProps] = getOverrides(overrides.Root, StyledRoot);
50
+ const [
51
+ FloatingMarkerPinHeadContainer,
52
+ floatingMarkerPinHeadContainerProps,
53
+ ] = getOverrides(
54
+ overrides.PinHeadContainer,
55
+ StyledFloatingMarkerPinHeadContainer,
56
+ );
57
+
58
+ const [
59
+ FloatingMarkerAnchorContainer,
60
+ floatingMarkerAnchorContainerProps,
61
+ ] = getOverrides(
62
+ overrides.AnchorContainer,
63
+ StyledFloatingMarkerAnchorContainer,
64
+ );
65
+ return (
66
+ <Root data-baseweb="floating-map-marker" {...rootProps}>
67
+ <FloatingMarkerPinHeadContainer
68
+ $anchor={anchor}
69
+ $anchorSize={anchorSize}
70
+ {...floatingMarkerPinHeadContainerProps}
71
+ >
72
+ <PinHead
73
+ size={size}
74
+ color={color}
75
+ background={background}
76
+ type={PINHEAD_TYPES.floating}
77
+ label={label}
78
+ startEnhancer={startEnhancer}
79
+ endEnhancer={endEnhancer}
80
+ overrides={overrides}
81
+ />
82
+ </FloatingMarkerPinHeadContainer>
83
+ {anchor !== FLOATING_MARKER_ANCHOR_POSITIONS.none && (
84
+ <FloatingMarkerAnchorContainer {...floatingMarkerAnchorContainerProps}>
85
+ <PinHead
86
+ size={anchorPinHeadSize}
87
+ color={primaryB}
88
+ background={backgroundInversePrimary}
89
+ type={PINHEAD_TYPES.fixed}
90
+ overrides={overrides}
91
+ />
92
+ </FloatingMarkerAnchorContainer>
93
+ )}
94
+ </Root>
95
+ );
96
+ };
97
+
98
+ export default FloatingMarker;
99
+
100
+ declare var __DEV__: boolean;
101
+ declare var __NODE__: boolean;
102
+ declare var __BROWSER__: boolean;