baseui 10.8.0 → 10.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/a11y.js +2 -2
- package/a11y/a11y.js.flow +3 -3
- package/button/styled-components.js +47 -18
- package/button/styled-components.js.flow +25 -5
- package/combobox/combobox.js +6 -3
- package/combobox/combobox.js.flow +4 -2
- package/combobox/types.js.flow +2 -0
- package/data-table/column-categorical.js +1 -1
- package/data-table/column-categorical.js.flow +2 -2
- package/data-table/column-numerical.js +1 -1
- package/data-table/column-numerical.js.flow +3 -3
- package/datepicker/styled-components.js +1 -1
- package/datepicker/styled-components.js.flow +4 -1
- package/drawer/drawer.js +3 -1
- package/drawer/drawer.js.flow +7 -1
- package/es/a11y/a11y.js +2 -2
- package/es/button/styled-components.js +32 -2
- package/es/combobox/combobox.js +6 -3
- package/es/data-table/column-categorical.js +2 -2
- package/es/data-table/column-numerical.js +2 -2
- package/es/datepicker/styled-components.js +1 -1
- package/es/drawer/drawer.js +3 -1
- package/es/form-control/form-control.js +58 -7
- package/es/form-control/styled-components.js +27 -6
- package/es/index.js +1 -1
- package/es/map-marker/badge-enhancer.js +61 -0
- package/es/map-marker/constants.js +146 -2
- package/es/map-marker/drag-shadow.js +32 -0
- package/es/map-marker/fixed-marker.js +54 -48
- package/es/map-marker/floating-marker.js +21 -12
- package/es/map-marker/index.js +1 -1
- package/es/map-marker/label-enhancer.js +39 -0
- package/es/map-marker/needle.js +26 -0
- package/es/map-marker/pin-head.js +42 -40
- package/es/map-marker/styled-components.js +177 -32
- package/es/map-marker/types.js +1 -1
- package/es/menu/maybe-child-menu.js +0 -2
- package/es/menu/nested-menus.js +49 -3
- package/es/menu/stateful-container.js +13 -12
- package/es/modal/modal.js +3 -1
- package/es/popover/popover.js +4 -2
- package/es/progress-bar/index.js +1 -1
- package/es/progress-bar/progressbar.js +25 -10
- package/es/progress-bar/styled-components.js +9 -5
- package/es/select/select-component.js +2 -10
- package/es/spinner/styled-components.js +34 -16
- package/es/table/filter.js +3 -1
- package/es/themes/dark-theme/color-component-tokens.js +4 -0
- package/es/themes/light-theme/color-component-tokens.js +4 -0
- package/es/timezonepicker/timezone-picker.js +55 -36
- package/es/timezonepicker/tzdata.js +2 -0
- package/es/timezonepicker/update-tzdata.js +69 -0
- package/esm/a11y/a11y.js +3 -3
- package/esm/button/styled-components.js +47 -18
- package/esm/combobox/combobox.js +6 -3
- package/esm/data-table/column-categorical.js +2 -2
- package/esm/data-table/column-numerical.js +2 -2
- package/esm/datepicker/styled-components.js +1 -1
- package/esm/drawer/drawer.js +3 -1
- package/esm/form-control/form-control.js +60 -9
- package/esm/form-control/styled-components.js +23 -3
- package/esm/index.js +1 -1
- package/esm/map-marker/badge-enhancer.js +79 -0
- package/esm/map-marker/constants.js +94 -4
- package/esm/map-marker/drag-shadow.js +53 -0
- package/esm/map-marker/fixed-marker.js +84 -80
- package/esm/map-marker/floating-marker.js +22 -13
- package/esm/map-marker/index.js +1 -1
- package/esm/map-marker/label-enhancer.js +60 -0
- package/esm/map-marker/needle.js +43 -0
- package/esm/map-marker/pin-head.js +77 -66
- package/esm/map-marker/styled-components.js +182 -51
- package/esm/map-marker/types.js +1 -1
- package/esm/menu/maybe-child-menu.js +0 -2
- package/esm/menu/nested-menus.js +66 -5
- package/esm/menu/stateful-container.js +15 -13
- package/esm/modal/modal.js +3 -1
- package/esm/popover/popover.js +4 -2
- package/esm/progress-bar/index.js +1 -1
- package/esm/progress-bar/progressbar.js +32 -10
- package/esm/progress-bar/styled-components.js +9 -4
- package/esm/select/select-component.js +2 -11
- package/esm/spinner/styled-components.js +35 -16
- package/esm/table/filter.js +3 -1
- package/esm/themes/dark-theme/color-component-tokens.js +4 -0
- package/esm/themes/light-theme/color-component-tokens.js +4 -0
- package/esm/timezonepicker/timezone-picker.js +66 -36
- package/esm/timezonepicker/tzdata.js +2 -0
- package/esm/timezonepicker/update-tzdata.js +160 -0
- package/form-control/form-control.js +61 -8
- package/form-control/form-control.js.flow +82 -10
- package/form-control/index.d.ts +1 -0
- package/form-control/styled-components.js +27 -5
- package/form-control/styled-components.js.flow +25 -3
- package/form-control/types.js.flow +20 -8
- package/index.js +6 -0
- package/index.js.flow +1 -1
- package/map-marker/badge-enhancer.js +90 -0
- package/map-marker/badge-enhancer.js.flow +86 -0
- package/map-marker/constants.js +103 -5
- package/map-marker/constants.js.flow +152 -0
- package/map-marker/drag-shadow.js +64 -0
- package/map-marker/drag-shadow.js.flow +52 -0
- package/map-marker/fixed-marker.js +84 -78
- package/map-marker/fixed-marker.js.flow +78 -66
- package/map-marker/floating-marker.js +22 -13
- package/map-marker/floating-marker.js.flow +30 -17
- package/map-marker/index.d.ts +125 -24
- package/map-marker/index.js +18 -0
- package/map-marker/index.js.flow +3 -0
- package/map-marker/label-enhancer.js +71 -0
- package/map-marker/label-enhancer.js.flow +63 -0
- package/map-marker/needle.js +54 -0
- package/map-marker/needle.js.flow +29 -0
- package/map-marker/pin-head.js +80 -69
- package/map-marker/pin-head.js.flow +122 -84
- package/map-marker/styled-components.js +200 -62
- package/map-marker/styled-components.js.flow +172 -22
- package/map-marker/types.js.flow +69 -20
- package/menu/index.d.ts +9 -4
- package/menu/maybe-child-menu.js +0 -2
- package/menu/maybe-child-menu.js.flow +0 -2
- package/menu/nested-menus.js +66 -5
- package/menu/nested-menus.js.flow +50 -5
- package/menu/stateful-container.js +15 -13
- package/menu/stateful-container.js.flow +19 -13
- package/menu/types.js.flow +7 -1
- package/modal/modal.js +3 -1
- package/modal/modal.js.flow +2 -0
- package/package.json +4 -4
- package/popover/popover.js +4 -2
- package/popover/popover.js.flow +3 -1
- package/progress-bar/index.d.ts +2 -0
- package/progress-bar/index.js +6 -0
- package/progress-bar/index.js.flow +1 -0
- package/progress-bar/progressbar.js +32 -10
- package/progress-bar/progressbar.js.flow +35 -9
- package/progress-bar/styled-components.js +9 -4
- package/progress-bar/styled-components.js.flow +15 -4
- package/progress-bar/types.js.flow +12 -2
- package/select/select-component.js +2 -11
- package/select/select-component.js.flow +5 -7
- package/spinner/styled-components.js +35 -16
- package/spinner/styled-components.js.flow +37 -19
- package/spinner/types.js.flow +10 -0
- package/styles/index.js.flow +1 -1
- package/table/filter.js +3 -1
- package/table/filter.js.flow +5 -1
- package/themes/dark-theme/color-component-tokens.js +4 -0
- package/themes/dark-theme/color-component-tokens.js.flow +4 -0
- package/themes/light-theme/color-component-tokens.js +4 -0
- package/themes/light-theme/color-component-tokens.js.flow +4 -0
- package/themes/types.js.flow +4 -0
- package/timezonepicker/timezone-picker.js +71 -41
- package/timezonepicker/timezone-picker.js.flow +55 -46
- package/timezonepicker/types.js.flow +6 -1
- package/timezonepicker/tzdata.js +10 -0
- package/timezonepicker/tzdata.js.flow +347 -0
- package/timezonepicker/update-tzdata.js +164 -0
- package/timezonepicker/update-tzdata.js.flow +70 -0
|
@@ -21,6 +21,8 @@ export const NEEDLE_HEIGHTS = Object.freeze({
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
export const PINHEAD_SIZES_SHAPES = Object.freeze({
|
|
24
|
+
xxSmallCircle: 'xx-small-circle',
|
|
25
|
+
xxSmallSquare: 'xx-small-square',
|
|
24
26
|
xSmallCircle: 'x-small-circle',
|
|
25
27
|
xSmallSquare: 'x-small-square',
|
|
26
28
|
small: 'small',
|
|
@@ -32,7 +34,14 @@ export const xSmallPinheadDimension = {
|
|
|
32
34
|
height: 16,
|
|
33
35
|
icon: 4,
|
|
34
36
|
};
|
|
37
|
+
|
|
38
|
+
export const xxSmallPinheadDimension = {
|
|
39
|
+
height: 8,
|
|
40
|
+
icon: 4,
|
|
41
|
+
};
|
|
35
42
|
export const PINHEAD_DIMENSIONS = Object.freeze({
|
|
43
|
+
[PINHEAD_SIZES_SHAPES.xxSmallSquare]: xxSmallPinheadDimension,
|
|
44
|
+
[PINHEAD_SIZES_SHAPES.xxSmallCircle]: xxSmallPinheadDimension,
|
|
36
45
|
[PINHEAD_SIZES_SHAPES.xSmallSquare]: xSmallPinheadDimension,
|
|
37
46
|
[PINHEAD_SIZES_SHAPES.xSmallCircle]: xSmallPinheadDimension,
|
|
38
47
|
[PINHEAD_SIZES_SHAPES.small]: {height: 24, icon: 16},
|
|
@@ -62,6 +71,8 @@ export const FLOATING_MARKER_ANCHOR_POSITIONS = Object.freeze({
|
|
|
62
71
|
export const FLOATING_MARKER_ANCHOR_TYPES = Object.freeze({
|
|
63
72
|
circle: 'circle',
|
|
64
73
|
square: 'square',
|
|
74
|
+
xxSmallCircle: 'xx-small-circle',
|
|
75
|
+
xxSmallSquare: 'xx-small-square',
|
|
65
76
|
});
|
|
66
77
|
|
|
67
78
|
export const dragShadowHeight = 4;
|
|
@@ -69,6 +80,147 @@ export const dragShadowMarginTop = 6;
|
|
|
69
80
|
export const dragShadowWidth = 6;
|
|
70
81
|
export const anchorSize = 16;
|
|
71
82
|
|
|
83
|
+
const labelSmall = 'LabelSmall';
|
|
84
|
+
export const LABEL_SIZES = {
|
|
85
|
+
[PINHEAD_SIZES_SHAPES.xxSmallCircle]: labelSmall,
|
|
86
|
+
[PINHEAD_SIZES_SHAPES.xxSmallSquare]: labelSmall,
|
|
87
|
+
[PINHEAD_SIZES_SHAPES.xSmallCircle]: labelSmall,
|
|
88
|
+
[PINHEAD_SIZES_SHAPES.xSmallSquare]: labelSmall,
|
|
89
|
+
[PINHEAD_SIZES_SHAPES.small]: labelSmall,
|
|
90
|
+
[PINHEAD_SIZES_SHAPES.medium]: 'LabelMedium',
|
|
91
|
+
[PINHEAD_SIZES_SHAPES.large]: 'LabelLarge',
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const LABEL_ENHANCER_POSITIONS = Object.freeze({
|
|
95
|
+
none: 'none',
|
|
96
|
+
top: 'top',
|
|
97
|
+
left: 'left',
|
|
98
|
+
right: 'right',
|
|
99
|
+
bottom: 'bottom',
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
export const BADGE_ENHANCER_SIZES = Object.freeze({
|
|
103
|
+
none: 'none',
|
|
104
|
+
xSmall: 'x-small',
|
|
105
|
+
small: 'small',
|
|
106
|
+
mediumText: 'medium-text',
|
|
107
|
+
mediumIcon: 'medium-icon',
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const xSmallPinheadBadge = {
|
|
111
|
+
[BADGE_ENHANCER_SIZES.none]: null,
|
|
112
|
+
[BADGE_ENHANCER_SIZES.xSmall]: {
|
|
113
|
+
x: -5,
|
|
114
|
+
y: -3,
|
|
115
|
+
},
|
|
116
|
+
[BADGE_ENHANCER_SIZES.small]: null,
|
|
117
|
+
[BADGE_ENHANCER_SIZES.mediumText]: null,
|
|
118
|
+
[BADGE_ENHANCER_SIZES.mediumIcon]: null,
|
|
119
|
+
};
|
|
120
|
+
export const BADGE_ENHANCER_POSITIONS = {
|
|
121
|
+
[PINHEAD_SIZES_SHAPES.xxSmallSquare]: null,
|
|
122
|
+
[PINHEAD_SIZES_SHAPES.xxSmallCircle]: null,
|
|
123
|
+
[PINHEAD_SIZES_SHAPES.xSmallSquare]: xSmallPinheadBadge,
|
|
124
|
+
[PINHEAD_SIZES_SHAPES.xSmallCircle]: xSmallPinheadBadge,
|
|
125
|
+
[PINHEAD_SIZES_SHAPES.small]: {
|
|
126
|
+
[BADGE_ENHANCER_SIZES.none]: null,
|
|
127
|
+
[BADGE_ENHANCER_SIZES.xSmall]: {
|
|
128
|
+
x: -7,
|
|
129
|
+
y: -1,
|
|
130
|
+
},
|
|
131
|
+
[BADGE_ENHANCER_SIZES.small]: {
|
|
132
|
+
x: -8,
|
|
133
|
+
y: -8,
|
|
134
|
+
},
|
|
135
|
+
[BADGE_ENHANCER_SIZES.mediumText]: null,
|
|
136
|
+
[BADGE_ENHANCER_SIZES.mediumIcon]: null,
|
|
137
|
+
},
|
|
138
|
+
[PINHEAD_SIZES_SHAPES.medium]: {
|
|
139
|
+
[BADGE_ENHANCER_SIZES.none]: null,
|
|
140
|
+
[BADGE_ENHANCER_SIZES.xSmall]: {
|
|
141
|
+
x: -9,
|
|
142
|
+
y: 1,
|
|
143
|
+
},
|
|
144
|
+
[BADGE_ENHANCER_SIZES.small]: {
|
|
145
|
+
x: -10,
|
|
146
|
+
y: -4,
|
|
147
|
+
},
|
|
148
|
+
[BADGE_ENHANCER_SIZES.mediumText]: {
|
|
149
|
+
x: -12,
|
|
150
|
+
y: -8,
|
|
151
|
+
},
|
|
152
|
+
[BADGE_ENHANCER_SIZES.mediumIcon]: {
|
|
153
|
+
x: -12,
|
|
154
|
+
y: -8,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
[PINHEAD_SIZES_SHAPES.large]: {
|
|
158
|
+
[BADGE_ENHANCER_SIZES.none]: null,
|
|
159
|
+
[BADGE_ENHANCER_SIZES.xSmall]: {
|
|
160
|
+
x: -11,
|
|
161
|
+
y: 3,
|
|
162
|
+
},
|
|
163
|
+
[BADGE_ENHANCER_SIZES.small]: null,
|
|
164
|
+
[BADGE_ENHANCER_SIZES.mediumText]: {
|
|
165
|
+
x: -14,
|
|
166
|
+
y: -6,
|
|
167
|
+
},
|
|
168
|
+
[BADGE_ENHANCER_SIZES.mediumIcon]: {
|
|
169
|
+
x: -14,
|
|
170
|
+
y: -6,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const BADGE_ENHANCER_STYLES = {
|
|
176
|
+
[BADGE_ENHANCER_SIZES.none]: {},
|
|
177
|
+
[BADGE_ENHANCER_SIZES.xSmall]: {
|
|
178
|
+
height: '8px',
|
|
179
|
+
width: '8px',
|
|
180
|
+
borderRadius: '50%',
|
|
181
|
+
},
|
|
182
|
+
[BADGE_ENHANCER_SIZES.small]: {
|
|
183
|
+
height: '16px',
|
|
184
|
+
width: '16px',
|
|
185
|
+
borderRadius: '50%',
|
|
186
|
+
display: 'flex',
|
|
187
|
+
alignItems: 'center',
|
|
188
|
+
justifyContent: 'center',
|
|
189
|
+
fontSize: '10px',
|
|
190
|
+
},
|
|
191
|
+
[BADGE_ENHANCER_SIZES.mediumText]: {
|
|
192
|
+
borderRadius: '10px',
|
|
193
|
+
height: '20px',
|
|
194
|
+
padding: '0px 8px',
|
|
195
|
+
display: 'flex',
|
|
196
|
+
alignItems: 'center',
|
|
197
|
+
boxSizing: 'border-box',
|
|
198
|
+
},
|
|
199
|
+
[BADGE_ENHANCER_SIZES.mediumIcon]: {
|
|
200
|
+
height: '20px',
|
|
201
|
+
width: '20px',
|
|
202
|
+
borderRadius: '50%',
|
|
203
|
+
display: 'flex',
|
|
204
|
+
alignItems: 'center',
|
|
205
|
+
justifyContent: 'center',
|
|
206
|
+
boxSizing: 'border-box',
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export const BADGE_ENHANCER_CONTENT_SIZE = {
|
|
211
|
+
[BADGE_ENHANCER_SIZES.none]: 0,
|
|
212
|
+
[BADGE_ENHANCER_SIZES.xSmall]: 0,
|
|
213
|
+
[BADGE_ENHANCER_SIZES.small]: 10,
|
|
214
|
+
[BADGE_ENHANCER_SIZES.mediumText]: 12,
|
|
215
|
+
[BADGE_ENHANCER_SIZES.mediumIcon]: 12,
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export const KIND = Object.freeze({
|
|
219
|
+
default: 'default',
|
|
220
|
+
accent: 'accent',
|
|
221
|
+
negative: 'negative',
|
|
222
|
+
});
|
|
223
|
+
|
|
72
224
|
declare var __DEV__: boolean;
|
|
73
225
|
declare var __NODE__: boolean;
|
|
74
226
|
declare var __BROWSER__: boolean;
|
|
@@ -0,0 +1,64 @@
|
|
|
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 _overrides = require("../helpers/overrides.js");
|
|
13
|
+
|
|
14
|
+
var _constants = require("./constants.js");
|
|
15
|
+
|
|
16
|
+
var _styledComponents = require("./styled-components.js");
|
|
17
|
+
|
|
18
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
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); }
|
|
23
|
+
|
|
24
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
|
+
|
|
26
|
+
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."); }
|
|
27
|
+
|
|
28
|
+
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); }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
35
|
+
|
|
36
|
+
var DragShadow = function DragShadow(_ref) {
|
|
37
|
+
var background = _ref.background,
|
|
38
|
+
dragging = _ref.dragging,
|
|
39
|
+
height = _ref.height,
|
|
40
|
+
_ref$overrides = _ref.overrides,
|
|
41
|
+
overrides = _ref$overrides === void 0 ? {} : _ref$overrides;
|
|
42
|
+
|
|
43
|
+
var _getOverrides = (0, _overrides.getOverrides)(overrides.DragShadowContainer, _styledComponents.StyledDragShadowContainer),
|
|
44
|
+
_getOverrides2 = _slicedToArray(_getOverrides, 2),
|
|
45
|
+
DragShadowContainer = _getOverrides2[0],
|
|
46
|
+
dragShadowContainerProps = _getOverrides2[1];
|
|
47
|
+
|
|
48
|
+
var _getOverrides3 = (0, _overrides.getOverrides)(overrides.DragShadow, _styledComponents.StyledDragShadow),
|
|
49
|
+
_getOverrides4 = _slicedToArray(_getOverrides3, 2),
|
|
50
|
+
DragShadow = _getOverrides4[0],
|
|
51
|
+
dragShadowProps = _getOverrides4[1];
|
|
52
|
+
|
|
53
|
+
return /*#__PURE__*/React.createElement(DragShadowContainer, _extends({
|
|
54
|
+
$width: _constants.dragShadowWidth,
|
|
55
|
+
$height: height,
|
|
56
|
+
$dragging: dragging
|
|
57
|
+
}, dragShadowContainerProps), /*#__PURE__*/React.createElement(DragShadow, _extends({
|
|
58
|
+
$width: _constants.dragShadowWidth,
|
|
59
|
+
$background: background
|
|
60
|
+
}, dragShadowProps)));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
var _default = DragShadow;
|
|
64
|
+
exports.default = _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 {getOverrides} from '../helpers/overrides.js';
|
|
10
|
+
import {dragShadowWidth} from './constants.js';
|
|
11
|
+
import {
|
|
12
|
+
StyledDragShadow,
|
|
13
|
+
StyledDragShadowContainer,
|
|
14
|
+
} from './styled-components.js';
|
|
15
|
+
import type {DragShadowPropsT} from './types.js';
|
|
16
|
+
|
|
17
|
+
const DragShadow = ({
|
|
18
|
+
background,
|
|
19
|
+
dragging,
|
|
20
|
+
height,
|
|
21
|
+
overrides = {},
|
|
22
|
+
}: DragShadowPropsT) => {
|
|
23
|
+
const [DragShadowContainer, dragShadowContainerProps] = getOverrides(
|
|
24
|
+
overrides.DragShadowContainer,
|
|
25
|
+
StyledDragShadowContainer,
|
|
26
|
+
);
|
|
27
|
+
const [DragShadow, dragShadowProps] = getOverrides(
|
|
28
|
+
overrides.DragShadow,
|
|
29
|
+
StyledDragShadow,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<DragShadowContainer
|
|
34
|
+
$width={dragShadowWidth}
|
|
35
|
+
$height={height}
|
|
36
|
+
$dragging={dragging}
|
|
37
|
+
{...dragShadowContainerProps}
|
|
38
|
+
>
|
|
39
|
+
<DragShadow
|
|
40
|
+
$width={dragShadowWidth}
|
|
41
|
+
$background={background}
|
|
42
|
+
{...dragShadowProps}
|
|
43
|
+
/>
|
|
44
|
+
</DragShadowContainer>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default DragShadow;
|
|
49
|
+
|
|
50
|
+
declare var __DEV__: boolean;
|
|
51
|
+
declare var __NODE__: boolean;
|
|
52
|
+
declare var __BROWSER__: boolean;
|
|
@@ -17,6 +17,10 @@ var _constants = require("./constants.js");
|
|
|
17
17
|
|
|
18
18
|
var _pinHead = _interopRequireDefault(require("./pin-head.js"));
|
|
19
19
|
|
|
20
|
+
var _needle = _interopRequireDefault(require("./needle.js"));
|
|
21
|
+
|
|
22
|
+
var _dragShadow = _interopRequireDefault(require("./drag-shadow.js"));
|
|
23
|
+
|
|
20
24
|
var _styledComponents = require("./styled-components.js");
|
|
21
25
|
|
|
22
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -39,91 +43,88 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
|
|
|
39
43
|
|
|
40
44
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
41
45
|
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
47
|
+
|
|
48
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
49
|
+
|
|
50
|
+
function getColors(kind, theme) {
|
|
51
|
+
if (kind === _constants.KIND.accent) {
|
|
52
|
+
return {
|
|
53
|
+
color: theme.colors.contentInversePrimary,
|
|
54
|
+
backgroundColor: theme.colors.backgroundAccent
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (kind === _constants.KIND.negative) {
|
|
59
|
+
return {
|
|
60
|
+
color: theme.colors.contentInversePrimary,
|
|
61
|
+
backgroundColor: theme.colors.backgroundNegative
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
color: theme.colors.contentInversePrimary,
|
|
67
|
+
backgroundColor: theme.colors.backgroundInversePrimary
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var FixedMarker = function FixedMarker(_ref) {
|
|
72
|
+
var _ref$size = _ref.size,
|
|
73
|
+
size = _ref$size === void 0 ? _constants.PINHEAD_SIZES_SHAPES.medium : _ref$size,
|
|
74
|
+
_ref$needle = _ref.needle,
|
|
75
|
+
needle = _ref$needle === void 0 ? _constants.NEEDLE_SIZES.medium : _ref$needle,
|
|
76
|
+
label = _ref.label,
|
|
77
|
+
startEnhancer = _ref.startEnhancer,
|
|
78
|
+
endEnhancer = _ref.endEnhancer,
|
|
79
|
+
_ref$kind = _ref.kind,
|
|
80
|
+
kind = _ref$kind === void 0 ? _constants.KIND.default : _ref$kind,
|
|
81
|
+
_ref$dragging = _ref.dragging,
|
|
82
|
+
dragging = _ref$dragging === void 0 ? false : _ref$dragging,
|
|
45
83
|
_ref$overrides = _ref.overrides,
|
|
46
|
-
overrides = _ref$overrides === void 0 ? {} : _ref$overrides
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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;
|
|
84
|
+
overrides = _ref$overrides === void 0 ? {} : _ref$overrides,
|
|
85
|
+
_ref$labelEnhancerCon = _ref.labelEnhancerContent,
|
|
86
|
+
labelEnhancerContent = _ref$labelEnhancerCon === void 0 ? null : _ref$labelEnhancerCon,
|
|
87
|
+
_ref$labelEnhancerPos = _ref.labelEnhancerPosition,
|
|
88
|
+
labelEnhancerPosition = _ref$labelEnhancerPos === void 0 ? _constants.LABEL_ENHANCER_POSITIONS.bottom : _ref$labelEnhancerPos,
|
|
89
|
+
_ref$badgeEnhancerSiz = _ref.badgeEnhancerSize,
|
|
90
|
+
badgeEnhancerSize = _ref$badgeEnhancerSiz === void 0 ? null : _ref$badgeEnhancerSiz,
|
|
91
|
+
_ref$badgeEnhancerCon = _ref.badgeEnhancerContent,
|
|
92
|
+
badgeEnhancerContent = _ref$badgeEnhancerCon === void 0 ? null : _ref$badgeEnhancerCon,
|
|
93
|
+
restProps = _objectWithoutProperties(_ref, ["size", "needle", "label", "startEnhancer", "endEnhancer", "kind", "dragging", "overrides", "labelEnhancerContent", "labelEnhancerPosition", "badgeEnhancerSize", "badgeEnhancerContent"]);
|
|
100
94
|
|
|
101
95
|
var _useStyletron = (0, _index.useStyletron)(),
|
|
102
96
|
_useStyletron2 = _slicedToArray(_useStyletron, 2),
|
|
103
97
|
theme = _useStyletron2[1];
|
|
104
98
|
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
99
|
+
var _getColors = getColors(kind, theme),
|
|
100
|
+
color = _getColors.color,
|
|
101
|
+
backgroundColor = _getColors.backgroundColor;
|
|
102
|
+
|
|
103
|
+
var doesPinHeadTransformOnDrag = needle !== _constants.NEEDLE_SIZES.none && size !== _constants.PINHEAD_SIZES_SHAPES.xxSmallCircle && size !== _constants.PINHEAD_SIZES_SHAPES.xxSmallSquare;
|
|
104
|
+
|
|
105
|
+
var _getOverrides = (0, _overrides.getOverrides)(overrides.Root, _styledComponents.StyledFixedMarkerRoot),
|
|
106
|
+
_getOverrides2 = _slicedToArray(_getOverrides, 2),
|
|
107
|
+
Root = _getOverrides2[0],
|
|
108
|
+
rootProps = _getOverrides2[1];
|
|
109
|
+
|
|
110
|
+
var _getOverrides3 = (0, _overrides.getOverrides)(overrides.DragContainer, _styledComponents.StyledFixedMarkerDragContainer),
|
|
111
|
+
_getOverrides4 = _slicedToArray(_getOverrides3, 2),
|
|
112
|
+
FixedMarkerDragContainer = _getOverrides4[0],
|
|
113
|
+
fixedMarkerDragContainerProps = _getOverrides4[1];
|
|
111
114
|
|
|
112
|
-
var
|
|
113
|
-
_getOverrides8 = _slicedToArray(_getOverrides7, 2),
|
|
114
|
-
Root = _getOverrides8[0],
|
|
115
|
-
rootProps = _getOverrides8[1];
|
|
115
|
+
var renderNeedle = needle !== _constants.NEEDLE_SIZES.none && ![_constants.PINHEAD_SIZES_SHAPES.xxSmallCircle, _constants.PINHEAD_SIZES_SHAPES.xxSmallSquare].includes(size);
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
if (process.env.NODE_ENV !== "production") {
|
|
118
|
+
if (needle !== _constants.NEEDLE_SIZES.none && [_constants.PINHEAD_SIZES_SHAPES.xxSmallCircle, _constants.PINHEAD_SIZES_SHAPES.xxSmallSquare].includes(size)) {
|
|
119
|
+
console.warn("Needles cannot be rendered with ".concat(_constants.PINHEAD_SIZES_SHAPES.xxSmallCircle, " or ").concat(_constants.PINHEAD_SIZES_SHAPES.xxSmallSquare, " pin heads"));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
121
122
|
|
|
122
123
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
|
123
124
|
"data-baseweb": "fixed-map-marker"
|
|
124
125
|
}, rootProps), /*#__PURE__*/React.createElement(FixedMarkerDragContainer, _extends({
|
|
125
126
|
$translateAmount: _constants.dragShadowMarginTop + _constants.dragShadowHeight,
|
|
126
|
-
$performTranslate: doesPinHeadTransformOnDrag && dragging
|
|
127
|
+
$performTranslate: doesPinHeadTransformOnDrag && !dragging
|
|
127
128
|
}, fixedMarkerDragContainerProps), /*#__PURE__*/React.createElement(_pinHead.default, _extends({
|
|
128
129
|
size: size,
|
|
129
130
|
label: label
|
|
@@ -133,15 +134,20 @@ var FixedMarker = function FixedMarker(_ref3) {
|
|
|
133
134
|
endEnhancer: endEnhancer
|
|
134
135
|
} : {}, {
|
|
135
136
|
color: color,
|
|
136
|
-
background:
|
|
137
|
+
background: backgroundColor,
|
|
137
138
|
type: _constants.PINHEAD_TYPES.fixed,
|
|
138
|
-
overrides: overrides
|
|
139
|
-
|
|
139
|
+
overrides: overrides,
|
|
140
|
+
badgeEnhancerSize: badgeEnhancerSize,
|
|
141
|
+
badgeEnhancerContent: badgeEnhancerContent,
|
|
142
|
+
labelEnhancerContent: labelEnhancerContent,
|
|
143
|
+
labelEnhancerPosition: labelEnhancerPosition,
|
|
144
|
+
needle: needle
|
|
145
|
+
})), renderNeedle && /*#__PURE__*/React.createElement(_needle.default, {
|
|
140
146
|
size: needle,
|
|
141
|
-
background:
|
|
147
|
+
background: backgroundColor,
|
|
142
148
|
overrides: overrides
|
|
143
|
-
})), doesPinHeadTransformOnDrag && /*#__PURE__*/React.createElement(
|
|
144
|
-
background:
|
|
149
|
+
})), doesPinHeadTransformOnDrag && /*#__PURE__*/React.createElement(_dragShadow.default, {
|
|
150
|
+
background: backgroundColor,
|
|
145
151
|
dragging: dragging,
|
|
146
152
|
height: _constants.dragShadowMarginTop + _constants.dragShadowHeight,
|
|
147
153
|
overrides: overrides
|