baseui 10.2.1 → 10.6.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 (142) hide show
  1. package/button/styled-components.js +1 -1
  2. package/button/styled-components.js.flow +4 -1
  3. package/data-table/data-table.js +13 -3
  4. package/data-table/data-table.js.flow +20 -4
  5. package/data-table/types.js.flow +2 -1
  6. package/datepicker/calendar-header.js +227 -95
  7. package/datepicker/calendar-header.js.flow +270 -139
  8. package/datepicker/constants.js +4 -2
  9. package/datepicker/constants.js.flow +2 -0
  10. package/datepicker/day.js +1 -0
  11. package/datepicker/day.js.flow +1 -0
  12. package/datepicker/index.d.ts +1 -0
  13. package/datepicker/types.js.flow +1 -0
  14. package/datepicker/utils/calendar-header-helpers.js +51 -0
  15. package/datepicker/utils/calendar-header-helpers.js.flow +53 -0
  16. package/dnd-list/index.js.flow +2 -1
  17. package/drawer/close-icon.js +3 -2
  18. package/drawer/close-icon.js.flow +2 -2
  19. package/drawer/drawer.js +5 -2
  20. package/drawer/drawer.js.flow +2 -2
  21. package/es/button/styled-components.js +1 -1
  22. package/es/data-table/data-table.js +13 -3
  23. package/es/datepicker/calendar-header.js +184 -84
  24. package/es/datepicker/constants.js +2 -1
  25. package/es/datepicker/day.js +1 -0
  26. package/es/datepicker/utils/calendar-header-helpers.js +34 -0
  27. package/es/dnd-list/index.js +2 -1
  28. package/es/drawer/close-icon.js +3 -2
  29. package/es/drawer/drawer.js +5 -2
  30. package/es/list/list-heading.js +17 -6
  31. package/es/map-marker/constants.js +69 -0
  32. package/es/map-marker/fixed-marker.js +98 -0
  33. package/es/map-marker/floating-marker.js +65 -0
  34. package/es/map-marker/index.js +9 -0
  35. package/es/map-marker/pin-head.js +108 -0
  36. package/es/map-marker/styled-components.js +156 -0
  37. package/es/map-marker/types.js +8 -0
  38. package/es/popover/stateful-container.js +4 -0
  39. package/es/rating/emoticon-rating.js +3 -1
  40. package/es/rating/star-rating.js +3 -1
  41. package/es/select/select-component.js +20 -6
  42. package/es/select/styled-components.js +34 -4
  43. package/es/snackbar/snackbar-context.js +16 -4
  44. package/es/spinner/styled-components.js +1 -1
  45. package/es/table-semantic/styled-components.js +6 -4
  46. package/es/table-semantic/table-builder.js +3 -0
  47. package/es/themes/dark-theme/color-component-tokens.js +1 -1
  48. package/es/themes/dark-theme/color-semantic-tokens.js +8 -7
  49. package/es/themes/light-theme/color-component-tokens.js +9 -9
  50. package/es/themes/light-theme/color-semantic-tokens.js +3 -2
  51. package/es/tokens/colors.js +2 -2
  52. package/es/tooltip/styled-components.js +8 -0
  53. package/esm/button/styled-components.js +1 -1
  54. package/esm/data-table/data-table.js +13 -3
  55. package/esm/datepicker/calendar-header.js +226 -95
  56. package/esm/datepicker/constants.js +2 -1
  57. package/esm/datepicker/day.js +1 -0
  58. package/esm/datepicker/utils/calendar-header-helpers.js +45 -0
  59. package/esm/dnd-list/index.js +2 -1
  60. package/esm/drawer/close-icon.js +3 -2
  61. package/esm/drawer/drawer.js +5 -2
  62. package/esm/list/list-heading.js +17 -6
  63. package/esm/map-marker/constants.js +62 -0
  64. package/esm/map-marker/fixed-marker.js +137 -0
  65. package/esm/map-marker/floating-marker.js +94 -0
  66. package/esm/map-marker/index.js +9 -0
  67. package/esm/map-marker/pin-head.js +144 -0
  68. package/esm/map-marker/styled-components.js +168 -0
  69. package/esm/map-marker/types.js +8 -0
  70. package/esm/popover/stateful-container.js +4 -0
  71. package/esm/rating/emoticon-rating.js +2 -2
  72. package/esm/rating/star-rating.js +2 -2
  73. package/esm/select/select-component.js +19 -6
  74. package/esm/select/styled-components.js +28 -4
  75. package/esm/snackbar/snackbar-context.js +16 -4
  76. package/esm/spinner/styled-components.js +1 -1
  77. package/esm/table-semantic/styled-components.js +6 -4
  78. package/esm/table-semantic/table-builder.js +3 -0
  79. package/esm/themes/dark-theme/color-component-tokens.js +1 -1
  80. package/esm/themes/dark-theme/color-semantic-tokens.js +8 -7
  81. package/esm/themes/light-theme/color-component-tokens.js +9 -9
  82. package/esm/themes/light-theme/color-semantic-tokens.js +3 -2
  83. package/esm/tokens/colors.js +2 -2
  84. package/esm/tooltip/styled-components.js +8 -0
  85. package/index.d.ts +1 -0
  86. package/link/index.d.ts +1 -0
  87. package/list/index.d.ts +36 -0
  88. package/list/list-heading.js +24 -7
  89. package/list/list-heading.js.flow +17 -8
  90. package/map-marker/constants.js +82 -0
  91. package/map-marker/constants.js.flow +74 -0
  92. package/map-marker/fixed-marker.js +152 -0
  93. package/map-marker/fixed-marker.js.flow +137 -0
  94. package/map-marker/floating-marker.js +109 -0
  95. package/map-marker/floating-marker.js.flow +102 -0
  96. package/map-marker/index.d.ts +104 -0
  97. package/map-marker/index.js +55 -0
  98. package/map-marker/index.js.flow +23 -0
  99. package/map-marker/package.json +4 -0
  100. package/map-marker/pin-head.js +159 -0
  101. package/map-marker/pin-head.js.flow +155 -0
  102. package/map-marker/styled-components.js +184 -0
  103. package/map-marker/styled-components.js.flow +177 -0
  104. package/map-marker/types.js +11 -0
  105. package/map-marker/types.js.flow +114 -0
  106. package/menu/index.d.ts +7 -0
  107. package/menu/types.js.flow +12 -0
  108. package/package.json +3 -2
  109. package/popover/stateful-container.js +4 -0
  110. package/popover/stateful-container.js.flow +3 -0
  111. package/rating/emoticon-rating.js +2 -2
  112. package/rating/emoticon-rating.js.flow +4 -1
  113. package/rating/star-rating.js +2 -2
  114. package/rating/star-rating.js.flow +4 -1
  115. package/select/select-component.js +19 -6
  116. package/select/select-component.js.flow +19 -6
  117. package/select/styled-components.js +28 -4
  118. package/select/styled-components.js.flow +30 -2
  119. package/select/types.js.flow +9 -0
  120. package/snackbar/snackbar-context.js +15 -4
  121. package/snackbar/snackbar-context.js.flow +15 -3
  122. package/spinner/styled-components.js +1 -1
  123. package/spinner/styled-components.js.flow +1 -1
  124. package/table-semantic/index.d.ts +1 -0
  125. package/table-semantic/styled-components.js +6 -4
  126. package/table-semantic/styled-components.js.flow +6 -4
  127. package/table-semantic/table-builder.js +3 -0
  128. package/table-semantic/table-builder.js.flow +3 -0
  129. package/theme.ts +2 -0
  130. package/themes/dark-theme/color-component-tokens.js +1 -1
  131. package/themes/dark-theme/color-component-tokens.js.flow +1 -1
  132. package/themes/dark-theme/color-semantic-tokens.js +8 -7
  133. package/themes/dark-theme/color-semantic-tokens.js.flow +7 -6
  134. package/themes/light-theme/color-component-tokens.js +9 -9
  135. package/themes/light-theme/color-component-tokens.js.flow +9 -9
  136. package/themes/light-theme/color-semantic-tokens.js +3 -2
  137. package/themes/light-theme/color-semantic-tokens.js.flow +2 -1
  138. package/themes/types.js.flow +1 -0
  139. package/tokens/colors.js +2 -2
  140. package/tokens/colors.js.flow +2 -2
  141. package/tooltip/styled-components.js +8 -0
  142. package/tooltip/styled-components.js.flow +8 -0
@@ -0,0 +1,104 @@
1
+ import * as React from 'react';
2
+ import {Override} from '../overrides';
3
+
4
+ export interface FLOATING_MARKER_ANCHOR_POSITIONS {
5
+ none: 'none';
6
+ topLeft: 'top-left';
7
+ topRight: 'top-right';
8
+ bottomRight: 'bottom-right';
9
+ bottomLeft: 'bottom-left';
10
+ }
11
+
12
+ export interface NEEDLE_SIZES {
13
+ none: 'none';
14
+ short: 'short';
15
+ medium: 'medium';
16
+ tall: 'tall';
17
+ }
18
+
19
+ export interface PINHEAD_SIZES_SHAPES {
20
+ xSmallCircle: 'x-small-circle';
21
+ xSmallSquare: 'x-small-square';
22
+ small: 'small';
23
+ medium: 'medium';
24
+ large: 'large';
25
+ }
26
+
27
+ export interface PINHEAD_TYPES {
28
+ floating: 'floating';
29
+ fixed: 'fixed';
30
+ }
31
+
32
+ export interface FLOATING_MARKER_SIZES {
33
+ small: 'small';
34
+ medium: 'medium';
35
+ large: 'large';
36
+ }
37
+
38
+ export interface FLOATING_MARKER_ANCHOR_TYPES {
39
+ round: 'round';
40
+ square: 'square';
41
+ }
42
+
43
+ export type NeedleSizeT = ValueOf<NEEDLE_SIZES>;
44
+ export type PinHeadT = ValueOf<PINHEAD_TYPES>;
45
+ export type PinHeadSizeT = ValueOf<PINHEAD_SIZES_SHAPES>;
46
+ export type AnchorPositionsT = ValueOf<FLOATING_MARKER_ANCHOR_POSITIONS>;
47
+ export type FloatingMarkerSizeT = ValueOf<FLOATING_MARKER_SIZES>;
48
+
49
+ export type FixedMarkerOverridesT = {
50
+ Root?: Override<any>;
51
+ InnerAnchor?: Override<any>;
52
+ OuterAnchor?: Override<any>;
53
+ PinHead?: Override<any>;
54
+ PinHeadContent?: Override<any>;
55
+ PinHeadContainer?: Override<any>;
56
+ Needle?: Override<any>;
57
+ DragShadow?: Override<any>;
58
+ DragShadowContainer?: Override<any>;
59
+ DragContainer?: Override<any>;
60
+ };
61
+
62
+ export type FixedMarkerPropsT = {
63
+ size?: PinHeadSizeT;
64
+ needle?: NeedleSizeT;
65
+ label?: string;
66
+ startEnhancer?: (props: {size: number}) => React.ReactNode;
67
+ endEnhancer?: (props: {size: number}) => React.ReactNode;
68
+ color?: string;
69
+ background?: string;
70
+ dragging?: boolean;
71
+ overrides?: FixedMarkerOverridesT;
72
+ };
73
+
74
+ export type FloatingMarkerOverridesT = {
75
+ Root?: Override<any>;
76
+ InnerAnchor?: Override<any>;
77
+ OuterAnchor?: Override<any>;
78
+ PinHead?: Override<any>;
79
+ PinHeadContent?: Override<any>;
80
+ PinHeadContainer?: Override<any>;
81
+ AnchorContainer?: Override<any>;
82
+ };
83
+
84
+ export type FloatingMarkerPropsT = {
85
+ color?: string;
86
+ background?: string;
87
+ label?: string;
88
+ anchor?: AnchorPositionsT;
89
+ endEnhancer?: (props: {size: number}) => React.ReactNode;
90
+ startEnhancer?: (props: {size: number}) => React.ReactNode;
91
+ anchorType?: FloatingMarkerAnchorTypeT;
92
+ size?: FloatingMarkerSizeT;
93
+ overrides?: FloatingMarkerOverridesT;
94
+ };
95
+
96
+ export const FLOATING_MARKER_ANCHOR_POSITIONS: FLOATING_MARKER_ANCHOR_POSITIONS;
97
+ export const NEEDLE_SIZES: NEEDLE_SIZES;
98
+ export const PINHEAD_SIZES_SHAPES: PINHEAD_SIZES_SHAPES;
99
+ export const PINHEAD_TYPES: PINHEAD_TYPES;
100
+ export const FLOATING_MARKER_ANCHOR_TYPES: FLOATING_MARKER_ANCHOR_TYPES;
101
+ export const FLOATING_MARKER_SIZES: FLOATING_MARKER_SIZES;
102
+
103
+ export const FixedMarker: React.FC<FixedMarkerPropsT>;
104
+ export const FloatingMarker: React.FC<FloatingMarkerPropsT>;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "FixedMarker", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _fixedMarker.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "FloatingMarker", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _floatingMarker.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "FLOATING_MARKER_ANCHOR_POSITIONS", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _constants.FLOATING_MARKER_ANCHOR_POSITIONS;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "FLOATING_MARKER_SIZES", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _constants.FLOATING_MARKER_SIZES;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "FLOATING_MARKER_ANCHOR_TYPES", {
31
+ enumerable: true,
32
+ get: function get() {
33
+ return _constants.FLOATING_MARKER_ANCHOR_TYPES;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "NEEDLE_SIZES", {
37
+ enumerable: true,
38
+ get: function get() {
39
+ return _constants.NEEDLE_SIZES;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "PINHEAD_SIZES_SHAPES", {
43
+ enumerable: true,
44
+ get: function get() {
45
+ return _constants.PINHEAD_SIZES_SHAPES;
46
+ }
47
+ });
48
+
49
+ var _fixedMarker = _interopRequireDefault(require("./fixed-marker.js"));
50
+
51
+ var _floatingMarker = _interopRequireDefault(require("./floating-marker.js"));
52
+
53
+ var _constants = require("./constants.js");
54
+
55
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,23 @@
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
+ export {default as FixedMarker} from './fixed-marker.js';
9
+ export {default as FloatingMarker} from './floating-marker.js';
10
+
11
+ export {
12
+ FLOATING_MARKER_ANCHOR_POSITIONS,
13
+ FLOATING_MARKER_SIZES,
14
+ FLOATING_MARKER_ANCHOR_TYPES,
15
+ NEEDLE_SIZES,
16
+ PINHEAD_SIZES_SHAPES,
17
+ } from './constants.js';
18
+
19
+ export type * from './types.js';
20
+
21
+ declare var __DEV__: boolean;
22
+ declare var __NODE__: boolean;
23
+ declare var __BROWSER__: boolean;
@@ -0,0 +1,4 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "../esm/map-marker/index.js"
4
+ }
@@ -0,0 +1,159 @@
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 = exports._ContentItem = 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 _styledComponents = require("./styled-components.js");
17
+
18
+ var _constants = require("./constants.js");
19
+
20
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
21
+
22
+ 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; }
23
+
24
+ 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); }
25
+
26
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
27
+
28
+ 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."); }
29
+
30
+ 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); }
31
+
32
+ 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; }
33
+
34
+ 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; }
35
+
36
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
37
+
38
+ 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; }
39
+
40
+ 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; }
41
+
42
+ 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; }
43
+
44
+ var _ContentItem = (0, _index.styled)('div', function (_ref) {
45
+ var _match;
46
+
47
+ var $theme = _ref.$theme,
48
+ $color = _ref.$color,
49
+ $height = _ref.$height,
50
+ $size = _ref.$size;
51
+ var match = (_match = {}, _defineProperty(_match, _constants.PINHEAD_SIZES_SHAPES.xSmallCircle, 'LabelSmall'), _defineProperty(_match, _constants.PINHEAD_SIZES_SHAPES.xSmallSquare, 'LabelSmall'), _defineProperty(_match, _constants.PINHEAD_SIZES_SHAPES.small, 'LabelSmall'), _defineProperty(_match, _constants.PINHEAD_SIZES_SHAPES.medium, 'LabelMedium'), _defineProperty(_match, _constants.PINHEAD_SIZES_SHAPES.large, 'LabelLarge'), _match);
52
+ return _objectSpread(_objectSpread({}, $theme.typography[match[$size]]), {}, {
53
+ display: 'flex',
54
+ alignItems: 'center',
55
+ textAlign: 'center',
56
+ lineHeight: "".concat($height, "px"),
57
+ height: "".concat($height, "px"),
58
+ color: $color
59
+ });
60
+ });
61
+
62
+ exports._ContentItem = _ContentItem;
63
+ _ContentItem.displayName = "_ContentItem";
64
+
65
+ var PinHead = function PinHead(_ref2) {
66
+ var _ref2$size = _ref2.size,
67
+ size = _ref2$size === void 0 ? _constants.PINHEAD_SIZES_SHAPES.medium : _ref2$size,
68
+ _ref2$label = _ref2.label,
69
+ label = _ref2$label === void 0 ? '' : _ref2$label,
70
+ StartEnhancer = _ref2.startEnhancer,
71
+ EndEnhancer = _ref2.endEnhancer,
72
+ color = _ref2.color,
73
+ background = _ref2.background,
74
+ _ref2$type = _ref2.type,
75
+ type = _ref2$type === void 0 ? _constants.PINHEAD_TYPES.fixed : _ref2$type,
76
+ anchorType = _ref2.anchorType,
77
+ _ref2$overrides = _ref2.overrides,
78
+ overrides = _ref2$overrides === void 0 ? {} : _ref2$overrides;
79
+
80
+ var _useStyletron = (0, _index.useStyletron)(),
81
+ _useStyletron2 = _slicedToArray(_useStyletron, 2),
82
+ theme = _useStyletron2[1];
83
+
84
+ var _theme$colors = theme.colors,
85
+ backgroundPrimary = _theme$colors.backgroundPrimary,
86
+ primaryA = _theme$colors.primaryA;
87
+ color = color || backgroundPrimary;
88
+ background = background || primaryA;
89
+ var activeElements = [label, StartEnhancer, EndEnhancer].filter(function (x) {
90
+ return x;
91
+ });
92
+ var gridTemplateColumns = activeElements.map(function () {
93
+ return 'auto';
94
+ }).join(' ');
95
+ var forceCircle = activeElements.length === 1 && !label;
96
+ var _PINHEAD_DIMENSIONS$s = _constants.PINHEAD_DIMENSIONS[size],
97
+ height = _PINHEAD_DIMENSIONS$s.height,
98
+ icon = _PINHEAD_DIMENSIONS$s.icon;
99
+
100
+ var _getOverrides = (0, _overrides.getOverrides)(overrides.PinHead, _styledComponents.PinHead),
101
+ _getOverrides2 = _slicedToArray(_getOverrides, 2),
102
+ PinHead = _getOverrides2[0],
103
+ pinHeadProps = _getOverrides2[1];
104
+
105
+ var _getOverrides3 = (0, _overrides.getOverrides)(overrides.PinHeadContent, _ContentItem),
106
+ _getOverrides4 = _slicedToArray(_getOverrides3, 2),
107
+ ContentItem = _getOverrides4[0],
108
+ contentItemProps = _getOverrides4[1];
109
+
110
+ var _getOverrides5 = (0, _overrides.getOverrides)(overrides.InnerAnchor, _styledComponents.InnerXSmallAnchor),
111
+ _getOverrides6 = _slicedToArray(_getOverrides5, 2),
112
+ InnerXSmallAnchor = _getOverrides6[0],
113
+ innerXSmallAnchorProps = _getOverrides6[1];
114
+
115
+ var _getOverrides7 = (0, _overrides.getOverrides)(overrides.OuterAnchor, _styledComponents.OuterXSmallAnchor),
116
+ _getOverrides8 = _slicedToArray(_getOverrides7, 2),
117
+ OuterXSmallAnchor = _getOverrides8[0],
118
+ outerXSmallAnchorProps = _getOverrides8[1];
119
+
120
+ if (type === _constants.PINHEAD_TYPES.fixed && (size === _constants.PINHEAD_SIZES_SHAPES.xSmallSquare || size === _constants.PINHEAD_SIZES_SHAPES.xSmallCircle)) {
121
+ var round = size === _constants.PINHEAD_SIZES_SHAPES.xSmallCircle;
122
+ return /*#__PURE__*/React.createElement(OuterXSmallAnchor, _extends({
123
+ $round: round,
124
+ $background: background,
125
+ $size: height
126
+ }, outerXSmallAnchorProps), /*#__PURE__*/React.createElement(InnerXSmallAnchor, _extends({
127
+ $color: color,
128
+ $round: round,
129
+ $size: icon
130
+ }, innerXSmallAnchorProps)));
131
+ }
132
+
133
+ return /*#__PURE__*/React.createElement(PinHead, _extends({
134
+ $background: background,
135
+ $height: height,
136
+ $gridTemplateColumns: gridTemplateColumns,
137
+ $forceCircle: forceCircle,
138
+ $type: type
139
+ }, pinHeadProps), StartEnhancer && /*#__PURE__*/React.createElement(ContentItem, _extends({
140
+ $height: height,
141
+ $color: color,
142
+ $size: size
143
+ }, contentItemProps), /*#__PURE__*/React.createElement(StartEnhancer, {
144
+ size: icon
145
+ })), label && /*#__PURE__*/React.createElement(ContentItem, _extends({
146
+ $height: height,
147
+ $color: color,
148
+ $size: size
149
+ }, contentItemProps), label), EndEnhancer && /*#__PURE__*/React.createElement(ContentItem, _extends({
150
+ $height: height,
151
+ $color: color,
152
+ $size: size
153
+ }, contentItemProps), /*#__PURE__*/React.createElement(EndEnhancer, {
154
+ size: icon
155
+ })));
156
+ };
157
+
158
+ var _default = PinHead;
159
+ exports.default = _default;
@@ -0,0 +1,155 @@
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, styled} from '../styles/index.js';
10
+ import {getOverrides} from '../helpers/overrides.js';
11
+ import {
12
+ InnerXSmallAnchor as StyledInnerXSmallAnchor,
13
+ OuterXSmallAnchor as StyledOuterXSmallAnchor,
14
+ PinHead as StyledPinHead,
15
+ } from './styled-components.js';
16
+ import {
17
+ PINHEAD_DIMENSIONS,
18
+ PINHEAD_TYPES,
19
+ PINHEAD_SIZES_SHAPES,
20
+ } from './constants.js';
21
+ import type {PinHeadPropsT, PinHeadSizeT} from './types.js';
22
+
23
+ export const _ContentItem = styled<{
24
+ $color: string,
25
+ $height: number,
26
+ $size: PinHeadSizeT,
27
+ }>('div', ({$theme, $color, $height, $size}) => {
28
+ const match = {
29
+ [PINHEAD_SIZES_SHAPES.xSmallCircle]: 'LabelSmall',
30
+ [PINHEAD_SIZES_SHAPES.xSmallSquare]: 'LabelSmall',
31
+ [PINHEAD_SIZES_SHAPES.small]: 'LabelSmall',
32
+ [PINHEAD_SIZES_SHAPES.medium]: 'LabelMedium',
33
+ [PINHEAD_SIZES_SHAPES.large]: 'LabelLarge',
34
+ };
35
+ return {
36
+ ...$theme.typography[match[$size]],
37
+ display: 'flex',
38
+ alignItems: 'center',
39
+ textAlign: 'center',
40
+ lineHeight: `${$height}px`,
41
+ height: `${$height}px`,
42
+ color: $color,
43
+ };
44
+ });
45
+
46
+ const PinHead = ({
47
+ size = PINHEAD_SIZES_SHAPES.medium,
48
+ label = '',
49
+ startEnhancer: StartEnhancer,
50
+ endEnhancer: EndEnhancer,
51
+ color,
52
+ background,
53
+ type = PINHEAD_TYPES.fixed,
54
+ anchorType,
55
+ overrides = {},
56
+ }: PinHeadPropsT) => {
57
+ const [, theme] = useStyletron();
58
+ const {
59
+ colors: {backgroundPrimary, primaryA},
60
+ } = theme;
61
+
62
+ color = color || backgroundPrimary;
63
+ background = background || primaryA;
64
+
65
+ const activeElements = [label, StartEnhancer, EndEnhancer].filter(x => x);
66
+ const gridTemplateColumns = activeElements.map(() => 'auto').join(' ');
67
+ const forceCircle = activeElements.length === 1 && !label;
68
+ const {height, icon} = PINHEAD_DIMENSIONS[size];
69
+
70
+ const [PinHead, pinHeadProps] = getOverrides(
71
+ overrides.PinHead,
72
+ StyledPinHead,
73
+ );
74
+ const [ContentItem, contentItemProps] = getOverrides(
75
+ overrides.PinHeadContent,
76
+ _ContentItem,
77
+ );
78
+ const [InnerXSmallAnchor, innerXSmallAnchorProps] = getOverrides(
79
+ overrides.InnerAnchor,
80
+ StyledInnerXSmallAnchor,
81
+ );
82
+ const [OuterXSmallAnchor, outerXSmallAnchorProps] = getOverrides(
83
+ overrides.OuterAnchor,
84
+ StyledOuterXSmallAnchor,
85
+ );
86
+
87
+ if (
88
+ type === PINHEAD_TYPES.fixed &&
89
+ (size === PINHEAD_SIZES_SHAPES.xSmallSquare ||
90
+ size === PINHEAD_SIZES_SHAPES.xSmallCircle)
91
+ ) {
92
+ const round = size === PINHEAD_SIZES_SHAPES.xSmallCircle;
93
+ return (
94
+ <OuterXSmallAnchor
95
+ $round={round}
96
+ $background={background}
97
+ $size={height}
98
+ {...outerXSmallAnchorProps}
99
+ >
100
+ <InnerXSmallAnchor
101
+ $color={color}
102
+ $round={round}
103
+ $size={icon}
104
+ {...innerXSmallAnchorProps}
105
+ />
106
+ </OuterXSmallAnchor>
107
+ );
108
+ }
109
+ return (
110
+ <PinHead
111
+ $background={background}
112
+ $height={height}
113
+ $gridTemplateColumns={gridTemplateColumns}
114
+ $forceCircle={forceCircle}
115
+ $type={type}
116
+ {...pinHeadProps}
117
+ >
118
+ {StartEnhancer && (
119
+ <ContentItem
120
+ $height={height}
121
+ $color={color}
122
+ $size={size}
123
+ {...contentItemProps}
124
+ >
125
+ <StartEnhancer size={icon} />
126
+ </ContentItem>
127
+ )}
128
+ {label && (
129
+ <ContentItem
130
+ $height={height}
131
+ $color={color}
132
+ $size={size}
133
+ {...contentItemProps}
134
+ >
135
+ {label}
136
+ </ContentItem>
137
+ )}
138
+ {EndEnhancer && (
139
+ <ContentItem
140
+ $height={height}
141
+ $color={color}
142
+ $size={size}
143
+ {...contentItemProps}
144
+ >
145
+ <EndEnhancer size={icon} />
146
+ </ContentItem>
147
+ )}
148
+ </PinHead>
149
+ );
150
+ };
151
+ export default PinHead;
152
+
153
+ declare var __DEV__: boolean;
154
+ declare var __NODE__: boolean;
155
+ declare var __BROWSER__: boolean;
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PinHead = exports.InnerXSmallAnchor = exports.OuterXSmallAnchor = exports.FixedMarkerDragContainer = exports.FixedMarkerRoot = exports.FloatingMarkerAnchorContainer = exports.FloatingMarkerPinHeadContainer = exports.FloatingMarkerRoot = exports.Needle = exports.DragShadow = exports.DragShadowContainer = exports.getAnchorTransform = void 0;
7
+
8
+ var _index = require("../styles/index.js");
9
+
10
+ var _constants = require("./constants.js");
11
+
12
+ 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; }
13
+
14
+ 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; }
15
+
16
+ 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; }
17
+
18
+ var getAnchorTransform = function getAnchorTransform(anchor, anchorSize) {
19
+ var _FLOATING_MARKER_ANCH;
20
+
21
+ return (_FLOATING_MARKER_ANCH = {}, _defineProperty(_FLOATING_MARKER_ANCH, _constants.FLOATING_MARKER_ANCHOR_POSITIONS.none, ""), _defineProperty(_FLOATING_MARKER_ANCH, _constants.FLOATING_MARKER_ANCHOR_POSITIONS.topLeft, "translate(".concat(anchorSize, "px, ").concat(anchorSize, "px)")), _defineProperty(_FLOATING_MARKER_ANCH, _constants.FLOATING_MARKER_ANCHOR_POSITIONS.topRight, "translate(-100%, ".concat(anchorSize, "px)")), _defineProperty(_FLOATING_MARKER_ANCH, _constants.FLOATING_MARKER_ANCHOR_POSITIONS.bottomLeft, "translate(".concat(anchorSize, "px, -100%)")), _defineProperty(_FLOATING_MARKER_ANCH, _constants.FLOATING_MARKER_ANCHOR_POSITIONS.bottomRight, "translate(-100%, -100%)"), _FLOATING_MARKER_ANCH)[anchor];
22
+ };
23
+
24
+ exports.getAnchorTransform = getAnchorTransform;
25
+ var DragShadowContainer = (0, _index.styled)('div', function (_ref) {
26
+ var $theme = _ref.$theme,
27
+ $height = _ref.$height,
28
+ $width = _ref.$width,
29
+ $dragging = _ref.$dragging;
30
+ return {
31
+ width: "".concat($width, "px"),
32
+ height: "".concat($height, "px"),
33
+ opacity: $dragging ? 1 : 0,
34
+ visibility: $dragging ? 'visible' : 'hidden',
35
+ transition: "".concat($theme.animation.timing300, " ").concat($theme.animation.easeOutCurve, " all"),
36
+ position: 'relative',
37
+ boxShadow: $theme.lighting.shadow600
38
+ };
39
+ });
40
+ exports.DragShadowContainer = DragShadowContainer;
41
+ DragShadowContainer.displayName = "DragShadowContainer";
42
+ var DragShadow = (0, _index.styled)('div', function (_ref2) {
43
+ var $theme = _ref2.$theme,
44
+ $background = _ref2.$background,
45
+ $width = _ref2.$width;
46
+ return {
47
+ background: $background,
48
+ borderRadius: '50%',
49
+ width: "".concat($width, "px"),
50
+ height: "".concat(4, "px"),
51
+ position: 'absolute',
52
+ bottom: 0
53
+ };
54
+ });
55
+ exports.DragShadow = DragShadow;
56
+ DragShadow.displayName = "DragShadow";
57
+ var Needle = (0, _index.styled)('div', function (_ref3) {
58
+ var $theme = _ref3.$theme,
59
+ $background = _ref3.$background,
60
+ $height = _ref3.$height;
61
+ return {
62
+ background: $background,
63
+ width: '4px',
64
+ height: "".concat($height, "px"),
65
+ boxShadow: $theme.lighting.shadow600
66
+ };
67
+ });
68
+ exports.Needle = Needle;
69
+ Needle.displayName = "Needle";
70
+ var FloatingMarkerRoot = (0, _index.styled)('div', function () {
71
+ return {
72
+ position: 'relative',
73
+ height: "".concat(_constants.xSmallPinheadDimension.height, "px"),
74
+ width: "".concat(_constants.xSmallPinheadDimension.height, "px")
75
+ };
76
+ });
77
+ exports.FloatingMarkerRoot = FloatingMarkerRoot;
78
+ FloatingMarkerRoot.displayName = "FloatingMarkerRoot";
79
+ var FloatingMarkerPinHeadContainer = (0, _index.styled)('div', function (_ref4) {
80
+ var $theme = _ref4.$theme,
81
+ $anchor = _ref4.$anchor,
82
+ $anchorSize = _ref4.$anchorSize;
83
+ return {
84
+ position: 'absolute',
85
+ transition: "".concat($theme.animation.timing300, " ").concat($theme.animation.easeOutCurve, " all"),
86
+ transform: getAnchorTransform($anchor, $anchorSize)
87
+ };
88
+ });
89
+ exports.FloatingMarkerPinHeadContainer = FloatingMarkerPinHeadContainer;
90
+ FloatingMarkerPinHeadContainer.displayName = "FloatingMarkerPinHeadContainer";
91
+ var FloatingMarkerAnchorContainer = (0, _index.styled)('div', function () {
92
+ return {
93
+ position: 'absolute'
94
+ };
95
+ });
96
+ exports.FloatingMarkerAnchorContainer = FloatingMarkerAnchorContainer;
97
+ FloatingMarkerAnchorContainer.displayName = "FloatingMarkerAnchorContainer";
98
+ var FixedMarkerRoot = (0, _index.styled)('div', function () {
99
+ return {
100
+ display: 'flex',
101
+ alignItems: 'center',
102
+ flexDirection: 'column'
103
+ };
104
+ });
105
+ exports.FixedMarkerRoot = FixedMarkerRoot;
106
+ FixedMarkerRoot.displayName = "FixedMarkerRoot";
107
+ var FixedMarkerDragContainer = (0, _index.styled)('div', function (_ref5) {
108
+ var $theme = _ref5.$theme,
109
+ $translateAmount = _ref5.$translateAmount,
110
+ $performTranslate = _ref5.$performTranslate;
111
+ return {
112
+ transform: "translateY(".concat($performTranslate ? '0px' : "".concat($translateAmount, "px"), ")"),
113
+ transition: "".concat($theme.animation.timing300, " ").concat($theme.animation.easeOutCurve, " all"),
114
+ display: 'flex',
115
+ alignItems: 'center',
116
+ flexDirection: 'column'
117
+ };
118
+ });
119
+ exports.FixedMarkerDragContainer = FixedMarkerDragContainer;
120
+ FixedMarkerDragContainer.displayName = "FixedMarkerDragContainer";
121
+ var OuterXSmallAnchor = (0, _index.styled)('div', function (_ref6) {
122
+ var $theme = _ref6.$theme,
123
+ $round = _ref6.$round,
124
+ $background = _ref6.$background,
125
+ $size = _ref6.$size;
126
+ return {
127
+ background: $background,
128
+ display: 'flex',
129
+ alignItems: 'center',
130
+ justifyContent: 'center',
131
+ height: "".concat($size, "px"),
132
+ width: "".concat($size, "px"),
133
+ borderRadius: $round ? '50%' : 0,
134
+ boxShadow: $theme.lighting.shadow600
135
+ };
136
+ });
137
+ exports.OuterXSmallAnchor = OuterXSmallAnchor;
138
+ OuterXSmallAnchor.displayName = "OuterXSmallAnchor";
139
+ var InnerXSmallAnchor = (0, _index.styled)('div', function (_ref7) {
140
+ var $round = _ref7.$round,
141
+ $color = _ref7.$color,
142
+ $size = _ref7.$size;
143
+ return {
144
+ background: $color,
145
+ height: "".concat($size, "px"),
146
+ width: "".concat($size, "px"),
147
+ borderRadius: $round ? '50%' : 0
148
+ };
149
+ });
150
+ exports.InnerXSmallAnchor = InnerXSmallAnchor;
151
+ InnerXSmallAnchor.displayName = "InnerXSmallAnchor";
152
+ var PinHead = (0, _index.styled)('div', function (_ref8) {
153
+ var $theme = _ref8.$theme,
154
+ $height = _ref8.$height,
155
+ $background = _ref8.$background,
156
+ $gridTemplateColumns = _ref8.$gridTemplateColumns,
157
+ $type = _ref8.$type,
158
+ $forceCircle = _ref8.$forceCircle;
159
+ var sharedStyles = {
160
+ fixed: {
161
+ padding: '0px 12px',
162
+ borderRadius: "".concat($height, "px")
163
+ },
164
+ floating: {
165
+ padding: '0px 8px'
166
+ }
167
+ };
168
+ return _objectSpread(_objectSpread({
169
+ background: $background,
170
+ height: "".concat($height, "px"),
171
+ display: 'grid',
172
+ gridTemplateColumns: $gridTemplateColumns,
173
+ gap: '8px',
174
+ boxShadow: $theme.lighting.shadow600,
175
+ whiteSpace: 'nowrap'
176
+ }, sharedStyles[$type]), $forceCircle && {
177
+ width: "".concat($height, "px"),
178
+ display: 'flex',
179
+ justifyContent: 'center',
180
+ boxSizing: 'border-box'
181
+ });
182
+ });
183
+ exports.PinHead = PinHead;
184
+ PinHead.displayName = "PinHead";