baseui 10.4.0 → 10.7.1
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.
- package/app-nav-bar/user-menu.js +1 -0
- package/app-nav-bar/user-menu.js.flow +1 -0
- package/button/styled-components.js +1 -1
- package/button/styled-components.js.flow +4 -1
- package/card/styled-components.js +0 -1
- package/card/styled-components.js.flow +0 -1
- package/combobox/combobox.js +5 -1
- package/combobox/combobox.js.flow +4 -0
- package/combobox/index.d.ts +6 -3
- package/data-table/column-datetime.js +2 -0
- package/data-table/column-datetime.js.flow +2 -0
- package/datepicker/calendar-header.js +255 -109
- package/datepicker/calendar-header.js.flow +282 -145
- package/datepicker/calendar.js +6 -1
- package/datepicker/calendar.js.flow +5 -1
- package/datepicker/constants.js +9 -2
- package/datepicker/constants.js.flow +7 -0
- package/datepicker/datepicker.js +135 -73
- package/datepicker/datepicker.js.flow +161 -62
- package/datepicker/day.js +2 -0
- package/datepicker/day.js.flow +2 -0
- package/datepicker/index.d.ts +8 -0
- package/datepicker/month.js +4 -0
- package/datepicker/month.js.flow +3 -0
- package/datepicker/styled-components.js +116 -56
- package/datepicker/styled-components.js.flow +101 -36
- package/datepicker/types.js.flow +18 -1
- package/datepicker/utils/calendar-header-helpers.js +51 -0
- package/datepicker/utils/calendar-header-helpers.js.flow +53 -0
- package/datepicker/utils/date-helpers.js +1 -1
- package/datepicker/utils/date-helpers.js.flow +1 -1
- package/datepicker/week.js +1 -0
- package/datepicker/week.js.flow +1 -0
- package/dnd-list/index.js.flow +2 -1
- package/dnd-list/list.js +1 -2
- package/dnd-list/list.js.flow +1 -1
- package/dnd-list/styled-components.js +1 -1
- package/dnd-list/styled-components.js.flow +1 -0
- package/drawer/drawer.js +2 -1
- package/drawer/drawer.js.flow +1 -1
- package/es/app-nav-bar/user-menu.js +1 -0
- package/es/button/styled-components.js +1 -1
- package/es/card/styled-components.js +0 -1
- package/es/combobox/combobox.js +5 -1
- package/es/data-table/column-datetime.js +2 -0
- package/es/datepicker/calendar-header.js +204 -93
- package/es/datepicker/calendar.js +7 -2
- package/es/datepicker/constants.js +6 -1
- package/es/datepicker/datepicker.js +70 -42
- package/es/datepicker/day.js +2 -0
- package/es/datepicker/month.js +3 -0
- package/es/datepicker/styled-components.js +98 -37
- package/es/datepicker/types.js +1 -1
- package/es/datepicker/utils/calendar-header-helpers.js +34 -0
- package/es/datepicker/utils/date-helpers.js +1 -1
- package/es/datepicker/week.js +1 -0
- package/es/dnd-list/index.js +2 -1
- package/es/dnd-list/list.js +1 -2
- package/es/dnd-list/styled-components.js +1 -0
- package/es/drawer/drawer.js +2 -1
- package/es/helper/helper.js +1 -0
- package/es/layer/layer.js +8 -0
- package/es/map-marker/constants.js +69 -0
- package/es/map-marker/fixed-marker.js +98 -0
- package/es/map-marker/floating-marker.js +65 -0
- package/es/map-marker/index.js +9 -0
- package/es/map-marker/pin-head.js +108 -0
- package/es/map-marker/styled-components.js +156 -0
- package/es/map-marker/types.js +8 -0
- package/es/menu/maybe-child-menu.js +1 -0
- package/es/popover/popover.js +6 -5
- package/es/popover/stateful-container.js +8 -2
- package/es/rating/emoticon-rating.js +3 -1
- package/es/rating/star-rating.js +3 -1
- package/es/select/select-component.js +20 -5
- package/es/select/styled-components.js +34 -4
- package/es/snackbar/snackbar-context.js +16 -4
- package/es/table-semantic/styled-components.js +6 -4
- package/es/table-semantic/table-builder.js +3 -0
- package/es/themes/dark-theme/color-component-tokens.js +1 -1
- package/es/themes/light-theme/color-component-tokens.js +9 -9
- package/es/themes/shared/lighting.js +5 -1
- package/es/timepicker/timepicker.js +16 -11
- package/es/tooltip/styled-components.js +8 -0
- package/es/tooltip/tooltip.js +1 -0
- package/esm/app-nav-bar/user-menu.js +1 -0
- package/esm/button/styled-components.js +1 -1
- package/esm/card/styled-components.js +0 -1
- package/esm/combobox/combobox.js +5 -1
- package/esm/data-table/column-datetime.js +2 -0
- package/esm/datepicker/calendar-header.js +255 -110
- package/esm/datepicker/calendar.js +7 -2
- package/esm/datepicker/constants.js +6 -1
- package/esm/datepicker/datepicker.js +136 -74
- package/esm/datepicker/day.js +2 -0
- package/esm/datepicker/month.js +3 -0
- package/esm/datepicker/styled-components.js +112 -55
- package/esm/datepicker/types.js +1 -1
- package/esm/datepicker/utils/calendar-header-helpers.js +45 -0
- package/esm/datepicker/utils/date-helpers.js +1 -1
- package/esm/datepicker/week.js +1 -0
- package/esm/dnd-list/index.js +2 -1
- package/esm/dnd-list/list.js +1 -2
- package/esm/dnd-list/styled-components.js +1 -1
- package/esm/drawer/drawer.js +2 -1
- package/esm/helper/helper.js +1 -0
- package/esm/layer/layer.js +8 -0
- package/esm/map-marker/constants.js +62 -0
- package/esm/map-marker/fixed-marker.js +137 -0
- package/esm/map-marker/floating-marker.js +94 -0
- package/esm/map-marker/index.js +9 -0
- package/esm/map-marker/pin-head.js +144 -0
- package/esm/map-marker/styled-components.js +168 -0
- package/esm/map-marker/types.js +8 -0
- package/esm/menu/maybe-child-menu.js +1 -0
- package/esm/popover/popover.js +6 -5
- package/esm/popover/stateful-container.js +8 -2
- package/esm/rating/emoticon-rating.js +2 -2
- package/esm/rating/star-rating.js +2 -2
- package/esm/select/select-component.js +19 -5
- package/esm/select/styled-components.js +28 -4
- package/esm/snackbar/snackbar-context.js +16 -4
- package/esm/table-semantic/styled-components.js +6 -4
- package/esm/table-semantic/table-builder.js +3 -0
- package/esm/themes/dark-theme/color-component-tokens.js +1 -1
- package/esm/themes/light-theme/color-component-tokens.js +9 -9
- package/esm/themes/shared/lighting.js +5 -1
- package/esm/timepicker/timepicker.js +17 -11
- package/esm/tooltip/styled-components.js +8 -0
- package/esm/tooltip/tooltip.js +1 -0
- package/helper/helper.js +1 -0
- package/helper/helper.js.flow +1 -0
- package/layer/layer.js +8 -0
- package/layer/layer.js.flow +9 -0
- package/link/index.d.ts +1 -0
- package/map-marker/constants.js +82 -0
- package/map-marker/constants.js.flow +74 -0
- package/map-marker/fixed-marker.js +152 -0
- package/map-marker/fixed-marker.js.flow +137 -0
- package/map-marker/floating-marker.js +109 -0
- package/map-marker/floating-marker.js.flow +102 -0
- package/map-marker/index.d.ts +105 -0
- package/map-marker/index.js +55 -0
- package/map-marker/index.js.flow +23 -0
- package/map-marker/package.json +4 -0
- package/map-marker/pin-head.js +159 -0
- package/map-marker/pin-head.js.flow +155 -0
- package/map-marker/styled-components.js +184 -0
- package/map-marker/styled-components.js.flow +177 -0
- package/map-marker/types.js +11 -0
- package/map-marker/types.js.flow +114 -0
- package/menu/index.d.ts +7 -0
- package/menu/maybe-child-menu.js +1 -0
- package/menu/maybe-child-menu.js.flow +1 -0
- package/menu/types.js.flow +12 -0
- package/modal/index.d.ts +1 -1
- package/modal/types.js.flow +4 -1
- package/package.json +5 -3
- package/popover/index.d.ts +2 -1
- package/popover/popover.js +6 -5
- package/popover/popover.js.flow +11 -4
- package/popover/stateful-container.js +8 -2
- package/popover/stateful-container.js.flow +5 -0
- package/popover/types.js.flow +6 -1
- package/rating/emoticon-rating.js +2 -2
- package/rating/emoticon-rating.js.flow +4 -1
- package/rating/star-rating.js +2 -2
- package/rating/star-rating.js.flow +4 -1
- package/select/select-component.js +19 -5
- package/select/select-component.js.flow +19 -5
- package/select/styled-components.js +28 -4
- package/select/styled-components.js.flow +30 -2
- package/select/types.js.flow +9 -0
- package/snackbar/index.d.ts +21 -16
- package/snackbar/snackbar-context.js +15 -4
- package/snackbar/snackbar-context.js.flow +15 -3
- package/table-semantic/styled-components.js +6 -4
- package/table-semantic/styled-components.js.flow +6 -4
- package/table-semantic/table-builder.js +3 -0
- package/table-semantic/table-builder.js.flow +3 -0
- package/themes/dark-theme/color-component-tokens.js +1 -1
- package/themes/dark-theme/color-component-tokens.js.flow +1 -1
- package/themes/light-theme/color-component-tokens.js +9 -9
- package/themes/light-theme/color-component-tokens.js.flow +9 -9
- package/themes/shared/lighting.js +5 -1
- package/themes/shared/lighting.js.flow +4 -0
- package/themes/types.js.flow +4 -0
- package/timepicker/index.d.ts +1 -0
- package/timepicker/timepicker.js +17 -11
- package/timepicker/timepicker.js.flow +31 -12
- package/timepicker/types.js.flow +10 -0
- package/tooltip/styled-components.js +8 -0
- package/tooltip/styled-components.js.flow +8 -0
- package/tooltip/tooltip.js +1 -0
- package/tooltip/tooltip.js.flow +6 -1
|
@@ -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";
|
|
@@ -0,0 +1,177 @@
|
|
|
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 {styled} from '../styles/index.js';
|
|
9
|
+
import {
|
|
10
|
+
FLOATING_MARKER_ANCHOR_POSITIONS,
|
|
11
|
+
xSmallPinheadDimension,
|
|
12
|
+
} from './constants.js';
|
|
13
|
+
|
|
14
|
+
import type {AnchorPositionsT} from './types.js';
|
|
15
|
+
|
|
16
|
+
export const getAnchorTransform = (
|
|
17
|
+
anchor: AnchorPositionsT,
|
|
18
|
+
anchorSize: number,
|
|
19
|
+
) =>
|
|
20
|
+
({
|
|
21
|
+
[FLOATING_MARKER_ANCHOR_POSITIONS.none]: ``,
|
|
22
|
+
[FLOATING_MARKER_ANCHOR_POSITIONS.topLeft]: `translate(${anchorSize}px, ${anchorSize}px)`,
|
|
23
|
+
[FLOATING_MARKER_ANCHOR_POSITIONS.topRight]: `translate(-100%, ${anchorSize}px)`,
|
|
24
|
+
[FLOATING_MARKER_ANCHOR_POSITIONS.bottomLeft]: `translate(${anchorSize}px, -100%)`,
|
|
25
|
+
[FLOATING_MARKER_ANCHOR_POSITIONS.bottomRight]: `translate(-100%, -100%)`,
|
|
26
|
+
}[anchor]);
|
|
27
|
+
|
|
28
|
+
export const DragShadowContainer = styled<{
|
|
29
|
+
$height: number,
|
|
30
|
+
$width: number,
|
|
31
|
+
$dragging: boolean,
|
|
32
|
+
}>('div', ({$theme, $height, $width, $dragging}) => ({
|
|
33
|
+
width: `${$width}px`,
|
|
34
|
+
height: `${$height}px`,
|
|
35
|
+
opacity: $dragging ? 1 : 0,
|
|
36
|
+
visibility: $dragging ? 'visible' : 'hidden',
|
|
37
|
+
transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
|
|
38
|
+
position: 'relative',
|
|
39
|
+
boxShadow: $theme.lighting.shadow600,
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
export const DragShadow = styled<{
|
|
43
|
+
$background: string,
|
|
44
|
+
$width: number,
|
|
45
|
+
}>('div', ({$theme, $background, $width}) => ({
|
|
46
|
+
background: $background,
|
|
47
|
+
borderRadius: '50%',
|
|
48
|
+
width: `${$width}px`,
|
|
49
|
+
height: `${4}px`,
|
|
50
|
+
position: 'absolute',
|
|
51
|
+
bottom: 0,
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
export const Needle = styled<{
|
|
55
|
+
$background?: string,
|
|
56
|
+
$height: number,
|
|
57
|
+
}>('div', ({$theme, $background, $height}) => ({
|
|
58
|
+
background: $background,
|
|
59
|
+
width: '4px',
|
|
60
|
+
height: `${$height}px`,
|
|
61
|
+
boxShadow: $theme.lighting.shadow600,
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
export const FloatingMarkerRoot = styled<{}>('div', () => ({
|
|
65
|
+
position: 'relative',
|
|
66
|
+
height: `${xSmallPinheadDimension.height}px`,
|
|
67
|
+
width: `${xSmallPinheadDimension.height}px`,
|
|
68
|
+
}));
|
|
69
|
+
|
|
70
|
+
export const FloatingMarkerPinHeadContainer = styled<{
|
|
71
|
+
$anchor: AnchorPositionsT,
|
|
72
|
+
$anchorSize: number,
|
|
73
|
+
}>('div', ({$theme, $anchor, $anchorSize}) => ({
|
|
74
|
+
position: 'absolute',
|
|
75
|
+
transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
|
|
76
|
+
transform: getAnchorTransform($anchor, $anchorSize),
|
|
77
|
+
}));
|
|
78
|
+
|
|
79
|
+
export const FloatingMarkerAnchorContainer = styled<{}>('div', () => ({
|
|
80
|
+
position: 'absolute',
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
export const FixedMarkerRoot = styled<{}>('div', () => ({
|
|
84
|
+
display: 'flex',
|
|
85
|
+
alignItems: 'center',
|
|
86
|
+
flexDirection: 'column',
|
|
87
|
+
}));
|
|
88
|
+
|
|
89
|
+
export const FixedMarkerDragContainer = styled<{
|
|
90
|
+
$translateAmount: number,
|
|
91
|
+
$performTranslate: boolean,
|
|
92
|
+
}>('div', ({$theme, $translateAmount, $performTranslate}) => {
|
|
93
|
+
return {
|
|
94
|
+
transform: `translateY(${
|
|
95
|
+
$performTranslate ? '0px' : `${$translateAmount}px`
|
|
96
|
+
})`,
|
|
97
|
+
transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
|
|
98
|
+
display: 'flex',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
flexDirection: 'column',
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
export const OuterXSmallAnchor = styled<{
|
|
105
|
+
$round: boolean,
|
|
106
|
+
$background: string,
|
|
107
|
+
$size: number,
|
|
108
|
+
}>('div', ({$theme, $round, $background, $size}) => ({
|
|
109
|
+
background: $background,
|
|
110
|
+
display: 'flex',
|
|
111
|
+
alignItems: 'center',
|
|
112
|
+
justifyContent: 'center',
|
|
113
|
+
height: `${$size}px`,
|
|
114
|
+
width: `${$size}px`,
|
|
115
|
+
borderRadius: $round ? '50%' : 0,
|
|
116
|
+
boxShadow: $theme.lighting.shadow600,
|
|
117
|
+
}));
|
|
118
|
+
|
|
119
|
+
export const InnerXSmallAnchor = styled<{
|
|
120
|
+
$round: boolean,
|
|
121
|
+
$color: string,
|
|
122
|
+
$size: number,
|
|
123
|
+
}>('div', ({$round, $color, $size}) => ({
|
|
124
|
+
background: $color,
|
|
125
|
+
height: `${$size}px`,
|
|
126
|
+
width: `${$size}px`,
|
|
127
|
+
borderRadius: $round ? '50%' : 0,
|
|
128
|
+
}));
|
|
129
|
+
|
|
130
|
+
export const PinHead = styled<{
|
|
131
|
+
$height: number,
|
|
132
|
+
$background: string,
|
|
133
|
+
$gridTemplateColumns: string,
|
|
134
|
+
$type: string,
|
|
135
|
+
$forceCircle: boolean,
|
|
136
|
+
}>(
|
|
137
|
+
'div',
|
|
138
|
+
({
|
|
139
|
+
$theme,
|
|
140
|
+
$height,
|
|
141
|
+
$background,
|
|
142
|
+
$gridTemplateColumns,
|
|
143
|
+
$type,
|
|
144
|
+
$forceCircle,
|
|
145
|
+
}) => {
|
|
146
|
+
const sharedStyles = {
|
|
147
|
+
fixed: {
|
|
148
|
+
padding: '0px 12px',
|
|
149
|
+
borderRadius: `${$height}px`,
|
|
150
|
+
},
|
|
151
|
+
floating: {
|
|
152
|
+
padding: '0px 8px',
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
return {
|
|
157
|
+
background: $background,
|
|
158
|
+
height: `${$height}px`,
|
|
159
|
+
display: 'grid',
|
|
160
|
+
gridTemplateColumns: $gridTemplateColumns,
|
|
161
|
+
gap: '8px',
|
|
162
|
+
boxShadow: $theme.lighting.shadow600,
|
|
163
|
+
whiteSpace: 'nowrap',
|
|
164
|
+
...sharedStyles[$type],
|
|
165
|
+
...($forceCircle && {
|
|
166
|
+
width: `${$height}px`,
|
|
167
|
+
display: 'flex',
|
|
168
|
+
justifyContent: 'center',
|
|
169
|
+
boxSizing: 'border-box',
|
|
170
|
+
}),
|
|
171
|
+
};
|
|
172
|
+
},
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
declare var __DEV__: boolean;
|
|
176
|
+
declare var __NODE__: boolean;
|
|
177
|
+
declare var __BROWSER__: boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
var React = _interopRequireWildcard(require("react"));
|
|
6
|
+
|
|
7
|
+
var _constants = require("./constants.js");
|
|
8
|
+
|
|
9
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
10
|
+
|
|
11
|
+
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; }
|