baseui 10.3.0 → 10.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/data-table/data-table.js +13 -3
- package/data-table/data-table.js.flow +20 -4
- package/data-table/types.js.flow +2 -1
- 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/close-icon.js +3 -2
- package/drawer/close-icon.js.flow +2 -2
- package/drawer/drawer.js +5 -2
- package/drawer/drawer.js.flow +2 -2
- 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/data-table/data-table.js +13 -3
- 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/close-icon.js +3 -2
- package/es/drawer/drawer.js +5 -2
- package/es/helper/helper.js +1 -0
- package/es/layer/layer.js +8 -0
- package/es/list/list-heading.js +17 -6
- 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/spinner/styled-components.js +1 -1
- 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/data-table/data-table.js +13 -3
- 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/close-icon.js +3 -2
- package/esm/drawer/drawer.js +5 -2
- package/esm/helper/helper.js +1 -0
- package/esm/layer/layer.js +8 -0
- package/esm/list/list-heading.js +17 -6
- 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/spinner/styled-components.js +1 -1
- 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/list/index.d.ts +36 -0
- package/list/list-heading.js +24 -7
- package/list/list-heading.js.flow +17 -8
- 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/spinner/styled-components.js +1 -1
- package/spinner/styled-components.js.flow +1 -1
- 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
package/es/list/list-heading.js
CHANGED
|
@@ -7,7 +7,7 @@ This source code is licensed under the MIT license found in the
|
|
|
7
7
|
LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import ReactIs from 'react-is';
|
|
10
|
+
import * as ReactIs from 'react-is';
|
|
11
11
|
import { getOverrides } from '../helpers/overrides.js';
|
|
12
12
|
import { StyledHeadingRoot, StyledHeadingContent, StyledHeadingContentRow, StyledHeadingEndEnhancerContainer, StyledHeadingEndEnhancerDescriptionContainer, StyledHeadingMainHeading, StyledHeadingSubHeading } from './styled-components.js';
|
|
13
13
|
|
|
@@ -35,9 +35,14 @@ function RenderNode(props) {
|
|
|
35
35
|
return Component;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
function isMaxLinesValid(maxLines) {
|
|
39
|
+
return maxLines === 1 || maxLines === 2;
|
|
40
|
+
}
|
|
41
|
+
|
|
38
42
|
const ListHeading = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
39
43
|
const {
|
|
40
|
-
overrides = {}
|
|
44
|
+
overrides = {},
|
|
45
|
+
maxLines
|
|
41
46
|
} = props;
|
|
42
47
|
const EndEnhancer = props.endEnhancer;
|
|
43
48
|
const EndEnhancerDescription = props.endEnhancerDescription;
|
|
@@ -50,15 +55,21 @@ const ListHeading = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
50
55
|
const [EndEnhancerDescriptionContainer, endEnhancerDescriptionContainerProps] = getOverrides(overrides.EndEnhancerDescriptionContainer, StyledHeadingEndEnhancerDescriptionContainer);
|
|
51
56
|
const isEndEnhancerString = typeof EndEnhancer === 'string';
|
|
52
57
|
|
|
53
|
-
if (
|
|
54
|
-
|
|
58
|
+
if (process.env.NODE_ENV !== "production") {
|
|
59
|
+
if (isEndEnhancerString && EndEnhancerDescription) {
|
|
60
|
+
console.warn('endEnhancerDescription will not be rendered if endEnhancer is not a string');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (maxLines && !isMaxLinesValid(maxLines)) {
|
|
64
|
+
console.warn('maxLines must be 1 or 2.');
|
|
65
|
+
}
|
|
55
66
|
}
|
|
56
67
|
|
|
57
68
|
return /*#__PURE__*/React.createElement(Root // eslint-disable-next-line flowtype/no-weak-types
|
|
58
69
|
, _extends({
|
|
59
70
|
ref: ref
|
|
60
71
|
}, rootProps), /*#__PURE__*/React.createElement(Content, contentProps, /*#__PURE__*/React.createElement(StyledHeadingContentRow, null, /*#__PURE__*/React.createElement(HeadingContainer, _extends({
|
|
61
|
-
$maxLines:
|
|
72
|
+
$maxLines: isMaxLinesValid(maxLines) ? maxLines : 1
|
|
62
73
|
}, headingContainerProps), /*#__PURE__*/React.createElement(RenderNode, {
|
|
63
74
|
component: props.heading
|
|
64
75
|
})), EndEnhancer && /*#__PURE__*/React.createElement(EndEnhancerContainer, _extends({
|
|
@@ -66,7 +77,7 @@ const ListHeading = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
66
77
|
}, endEnhancerContainerProps), /*#__PURE__*/React.createElement(RenderNode, {
|
|
67
78
|
component: EndEnhancer
|
|
68
79
|
}))), (SubHeading || EndEnhancerDescription) && /*#__PURE__*/React.createElement(StyledHeadingContentRow, null, /*#__PURE__*/React.createElement(SubHeadingContainer, _extends({
|
|
69
|
-
$maxLines:
|
|
80
|
+
$maxLines: isMaxLinesValid(maxLines) ? maxLines : 1
|
|
70
81
|
}, subHeadingContainerProps), /*#__PURE__*/React.createElement(RenderNode, {
|
|
71
82
|
component: SubHeading
|
|
72
83
|
})), EndEnhancerDescription && isEndEnhancerString && /*#__PURE__*/React.createElement(EndEnhancerDescriptionContainer, endEnhancerDescriptionContainerProps, /*#__PURE__*/React.createElement(RenderNode, {
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
export const NEEDLE_SIZES = Object.freeze({
|
|
8
|
+
none: 'none',
|
|
9
|
+
short: 'short',
|
|
10
|
+
medium: 'medium',
|
|
11
|
+
tall: 'tall'
|
|
12
|
+
});
|
|
13
|
+
export const NEEDLE_HEIGHTS = Object.freeze({
|
|
14
|
+
[NEEDLE_SIZES.none]: 0,
|
|
15
|
+
[NEEDLE_SIZES.short]: 4,
|
|
16
|
+
[NEEDLE_SIZES.medium]: 12,
|
|
17
|
+
[NEEDLE_SIZES.tall]: 20
|
|
18
|
+
});
|
|
19
|
+
export const PINHEAD_SIZES_SHAPES = Object.freeze({
|
|
20
|
+
xSmallCircle: 'x-small-circle',
|
|
21
|
+
xSmallSquare: 'x-small-square',
|
|
22
|
+
small: 'small',
|
|
23
|
+
medium: 'medium',
|
|
24
|
+
large: 'large'
|
|
25
|
+
});
|
|
26
|
+
export const xSmallPinheadDimension = {
|
|
27
|
+
height: 16,
|
|
28
|
+
icon: 4
|
|
29
|
+
};
|
|
30
|
+
export const PINHEAD_DIMENSIONS = Object.freeze({
|
|
31
|
+
[PINHEAD_SIZES_SHAPES.xSmallSquare]: xSmallPinheadDimension,
|
|
32
|
+
[PINHEAD_SIZES_SHAPES.xSmallCircle]: xSmallPinheadDimension,
|
|
33
|
+
[PINHEAD_SIZES_SHAPES.small]: {
|
|
34
|
+
height: 24,
|
|
35
|
+
icon: 16
|
|
36
|
+
},
|
|
37
|
+
[PINHEAD_SIZES_SHAPES.medium]: {
|
|
38
|
+
height: 36,
|
|
39
|
+
icon: 16
|
|
40
|
+
},
|
|
41
|
+
[PINHEAD_SIZES_SHAPES.large]: {
|
|
42
|
+
height: 48,
|
|
43
|
+
icon: 24
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
export const PINHEAD_TYPES = Object.freeze({
|
|
47
|
+
floating: 'floating',
|
|
48
|
+
fixed: 'fixed'
|
|
49
|
+
});
|
|
50
|
+
export const FLOATING_MARKER_SIZES = Object.freeze({
|
|
51
|
+
small: 'small',
|
|
52
|
+
medium: 'medium',
|
|
53
|
+
large: 'large'
|
|
54
|
+
});
|
|
55
|
+
export const FLOATING_MARKER_ANCHOR_POSITIONS = Object.freeze({
|
|
56
|
+
none: 'none',
|
|
57
|
+
topLeft: 'top-left',
|
|
58
|
+
topRight: 'top-right',
|
|
59
|
+
bottomRight: 'bottom-right',
|
|
60
|
+
bottomLeft: 'bottom-left'
|
|
61
|
+
});
|
|
62
|
+
export const FLOATING_MARKER_ANCHOR_TYPES = Object.freeze({
|
|
63
|
+
circle: 'circle',
|
|
64
|
+
square: 'square'
|
|
65
|
+
});
|
|
66
|
+
export const dragShadowHeight = 4;
|
|
67
|
+
export const dragShadowMarginTop = 6;
|
|
68
|
+
export const dragShadowWidth = 6;
|
|
69
|
+
export const anchorSize = 16;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Copyright (c) Uber Technologies, Inc.
|
|
5
|
+
|
|
6
|
+
This source code is licensed under the MIT license found in the
|
|
7
|
+
LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import { useStyletron } from '../styles/index.js';
|
|
11
|
+
import { getOverrides } from '../helpers/overrides.js';
|
|
12
|
+
import { PINHEAD_TYPES, NEEDLE_SIZES, NEEDLE_HEIGHTS, PINHEAD_SIZES_SHAPES, dragShadowHeight, dragShadowMarginTop, dragShadowWidth } from './constants.js';
|
|
13
|
+
import PinHead from './pin-head.js';
|
|
14
|
+
import { FixedMarkerDragContainer as StyledFixedMarkerDragContainer, FixedMarkerRoot as StyledRoot, Needle as StyledNeedle, DragShadow as StyledDragShadow, DragShadowContainer as StyledDragShadowContainer } from './styled-components.js';
|
|
15
|
+
|
|
16
|
+
const Needle = ({
|
|
17
|
+
size,
|
|
18
|
+
background,
|
|
19
|
+
overrides = {}
|
|
20
|
+
}) => {
|
|
21
|
+
const [Needle, needleProps] = getOverrides(overrides.Needle, StyledNeedle);
|
|
22
|
+
return /*#__PURE__*/React.createElement(Needle, _extends({
|
|
23
|
+
$background: background,
|
|
24
|
+
$height: NEEDLE_HEIGHTS[size]
|
|
25
|
+
}, needleProps));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const DragShadow = ({
|
|
29
|
+
background,
|
|
30
|
+
dragging,
|
|
31
|
+
height,
|
|
32
|
+
overrides = {}
|
|
33
|
+
}) => {
|
|
34
|
+
const [DragShadowContainer, dragShadowContainerProps] = getOverrides(overrides.DragShadowContainer, StyledDragShadowContainer);
|
|
35
|
+
const [DragShadow, dragShadowProps] = getOverrides(overrides.DragShadow, StyledDragShadow);
|
|
36
|
+
return /*#__PURE__*/React.createElement(DragShadowContainer, _extends({
|
|
37
|
+
$width: dragShadowWidth,
|
|
38
|
+
$height: height,
|
|
39
|
+
$dragging: dragging
|
|
40
|
+
}, dragShadowContainerProps), /*#__PURE__*/React.createElement(DragShadow, _extends({
|
|
41
|
+
$width: dragShadowWidth,
|
|
42
|
+
$background: background
|
|
43
|
+
}, dragShadowProps)));
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const FixedMarker = ({
|
|
47
|
+
size = PINHEAD_SIZES_SHAPES.medium,
|
|
48
|
+
needle = NEEDLE_SIZES.medium,
|
|
49
|
+
label,
|
|
50
|
+
startEnhancer,
|
|
51
|
+
endEnhancer,
|
|
52
|
+
color,
|
|
53
|
+
background,
|
|
54
|
+
dragging = false,
|
|
55
|
+
overrides = {}
|
|
56
|
+
}) => {
|
|
57
|
+
const [, theme] = useStyletron();
|
|
58
|
+
const {
|
|
59
|
+
colors: {
|
|
60
|
+
backgroundInversePrimary,
|
|
61
|
+
primaryB
|
|
62
|
+
}
|
|
63
|
+
} = theme;
|
|
64
|
+
color = color || primaryB;
|
|
65
|
+
background = background || backgroundInversePrimary;
|
|
66
|
+
const doesPinHeadTransformOnDrag = needle !== NEEDLE_SIZES.none;
|
|
67
|
+
const [Root, rootProps] = getOverrides(overrides.Root, StyledRoot);
|
|
68
|
+
const [FixedMarkerDragContainer, fixedMarkerDragContainerProps] = getOverrides(overrides.DragContainer, StyledFixedMarkerDragContainer);
|
|
69
|
+
return /*#__PURE__*/React.createElement(Root, _extends({
|
|
70
|
+
"data-baseweb": "fixed-map-marker"
|
|
71
|
+
}, rootProps), /*#__PURE__*/React.createElement(FixedMarkerDragContainer, _extends({
|
|
72
|
+
$translateAmount: dragShadowMarginTop + dragShadowHeight,
|
|
73
|
+
$performTranslate: doesPinHeadTransformOnDrag && dragging
|
|
74
|
+
}, fixedMarkerDragContainerProps), /*#__PURE__*/React.createElement(PinHead, _extends({
|
|
75
|
+
size: size,
|
|
76
|
+
label: label
|
|
77
|
+
}, startEnhancer ? {
|
|
78
|
+
startEnhancer
|
|
79
|
+
} : {}, endEnhancer ? {
|
|
80
|
+
endEnhancer
|
|
81
|
+
} : {}, {
|
|
82
|
+
color: color,
|
|
83
|
+
background: background,
|
|
84
|
+
type: PINHEAD_TYPES.fixed,
|
|
85
|
+
overrides: overrides
|
|
86
|
+
})), /*#__PURE__*/React.createElement(Needle, {
|
|
87
|
+
size: needle,
|
|
88
|
+
background: background,
|
|
89
|
+
overrides: overrides
|
|
90
|
+
})), doesPinHeadTransformOnDrag && /*#__PURE__*/React.createElement(DragShadow, {
|
|
91
|
+
background: background,
|
|
92
|
+
dragging: dragging,
|
|
93
|
+
height: dragShadowMarginTop + dragShadowHeight,
|
|
94
|
+
overrides: overrides
|
|
95
|
+
}));
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default FixedMarker;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Copyright (c) Uber Technologies, Inc.
|
|
5
|
+
|
|
6
|
+
This source code is licensed under the MIT license found in the
|
|
7
|
+
LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import { useStyletron } from '../styles/index.js';
|
|
11
|
+
import PinHead from './pin-head.js';
|
|
12
|
+
import { getOverrides } from '../helpers/overrides.js';
|
|
13
|
+
import { FloatingMarkerRoot as StyledRoot, FloatingMarkerAnchorContainer as StyledFloatingMarkerAnchorContainer, FloatingMarkerPinHeadContainer as StyledFloatingMarkerPinHeadContainer } from './styled-components.js';
|
|
14
|
+
import { FLOATING_MARKER_ANCHOR_POSITIONS, PINHEAD_SIZES_SHAPES, PINHEAD_TYPES, FLOATING_MARKER_ANCHOR_TYPES, anchorSize } from './constants.js';
|
|
15
|
+
|
|
16
|
+
const FloatingMarker = ({
|
|
17
|
+
color,
|
|
18
|
+
background,
|
|
19
|
+
label,
|
|
20
|
+
size = PINHEAD_SIZES_SHAPES.medium,
|
|
21
|
+
anchor = FLOATING_MARKER_ANCHOR_POSITIONS.bottomLeft,
|
|
22
|
+
endEnhancer,
|
|
23
|
+
startEnhancer,
|
|
24
|
+
anchorType = FLOATING_MARKER_ANCHOR_TYPES.circle,
|
|
25
|
+
overrides = {}
|
|
26
|
+
}) => {
|
|
27
|
+
const [, theme] = useStyletron();
|
|
28
|
+
const {
|
|
29
|
+
colors: {
|
|
30
|
+
backgroundPrimary,
|
|
31
|
+
backgroundInversePrimary,
|
|
32
|
+
primaryA,
|
|
33
|
+
primaryB
|
|
34
|
+
}
|
|
35
|
+
} = theme;
|
|
36
|
+
color = color || primaryA;
|
|
37
|
+
background = background || backgroundPrimary;
|
|
38
|
+
const anchorPinHeadSize = anchorType === FLOATING_MARKER_ANCHOR_TYPES.circle ? PINHEAD_SIZES_SHAPES.xSmallCircle : PINHEAD_SIZES_SHAPES.xSmallSquare;
|
|
39
|
+
const [Root, rootProps] = getOverrides(overrides.Root, StyledRoot);
|
|
40
|
+
const [FloatingMarkerPinHeadContainer, floatingMarkerPinHeadContainerProps] = getOverrides(overrides.PinHeadContainer, StyledFloatingMarkerPinHeadContainer);
|
|
41
|
+
const [FloatingMarkerAnchorContainer, floatingMarkerAnchorContainerProps] = getOverrides(overrides.AnchorContainer, StyledFloatingMarkerAnchorContainer);
|
|
42
|
+
return /*#__PURE__*/React.createElement(Root, _extends({
|
|
43
|
+
"data-baseweb": "floating-map-marker"
|
|
44
|
+
}, rootProps), /*#__PURE__*/React.createElement(FloatingMarkerPinHeadContainer, _extends({
|
|
45
|
+
$anchor: anchor,
|
|
46
|
+
$anchorSize: anchorSize
|
|
47
|
+
}, floatingMarkerPinHeadContainerProps), /*#__PURE__*/React.createElement(PinHead, {
|
|
48
|
+
size: size,
|
|
49
|
+
color: color,
|
|
50
|
+
background: background,
|
|
51
|
+
type: PINHEAD_TYPES.floating,
|
|
52
|
+
label: label,
|
|
53
|
+
startEnhancer: startEnhancer,
|
|
54
|
+
endEnhancer: endEnhancer,
|
|
55
|
+
overrides: overrides
|
|
56
|
+
})), anchor !== FLOATING_MARKER_ANCHOR_POSITIONS.none && /*#__PURE__*/React.createElement(FloatingMarkerAnchorContainer, floatingMarkerAnchorContainerProps, /*#__PURE__*/React.createElement(PinHead, {
|
|
57
|
+
size: anchorPinHeadSize,
|
|
58
|
+
color: primaryB,
|
|
59
|
+
background: backgroundInversePrimary,
|
|
60
|
+
type: PINHEAD_TYPES.fixed,
|
|
61
|
+
overrides: overrides
|
|
62
|
+
})));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default FloatingMarker;
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
export { default as FixedMarker } from './fixed-marker.js';
|
|
8
|
+
export { default as FloatingMarker } from './floating-marker.js';
|
|
9
|
+
export { FLOATING_MARKER_ANCHOR_POSITIONS, FLOATING_MARKER_SIZES, FLOATING_MARKER_ANCHOR_TYPES, NEEDLE_SIZES, PINHEAD_SIZES_SHAPES } from './constants.js';
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Copyright (c) Uber Technologies, Inc.
|
|
5
|
+
|
|
6
|
+
This source code is licensed under the MIT license found in the
|
|
7
|
+
LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import { useStyletron, styled } from '../styles/index.js';
|
|
11
|
+
import { getOverrides } from '../helpers/overrides.js';
|
|
12
|
+
import { InnerXSmallAnchor as StyledInnerXSmallAnchor, OuterXSmallAnchor as StyledOuterXSmallAnchor, PinHead as StyledPinHead } from './styled-components.js';
|
|
13
|
+
import { PINHEAD_DIMENSIONS, PINHEAD_TYPES, PINHEAD_SIZES_SHAPES } from './constants.js';
|
|
14
|
+
export const _ContentItem = styled('div', ({
|
|
15
|
+
$theme,
|
|
16
|
+
$color,
|
|
17
|
+
$height,
|
|
18
|
+
$size
|
|
19
|
+
}) => {
|
|
20
|
+
const match = {
|
|
21
|
+
[PINHEAD_SIZES_SHAPES.xSmallCircle]: 'LabelSmall',
|
|
22
|
+
[PINHEAD_SIZES_SHAPES.xSmallSquare]: 'LabelSmall',
|
|
23
|
+
[PINHEAD_SIZES_SHAPES.small]: 'LabelSmall',
|
|
24
|
+
[PINHEAD_SIZES_SHAPES.medium]: 'LabelMedium',
|
|
25
|
+
[PINHEAD_SIZES_SHAPES.large]: 'LabelLarge'
|
|
26
|
+
};
|
|
27
|
+
return { ...$theme.typography[match[$size]],
|
|
28
|
+
display: 'flex',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
textAlign: 'center',
|
|
31
|
+
lineHeight: `${$height}px`,
|
|
32
|
+
height: `${$height}px`,
|
|
33
|
+
color: $color
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
_ContentItem.displayName = "_ContentItem";
|
|
37
|
+
|
|
38
|
+
const PinHead = ({
|
|
39
|
+
size = PINHEAD_SIZES_SHAPES.medium,
|
|
40
|
+
label = '',
|
|
41
|
+
startEnhancer: StartEnhancer,
|
|
42
|
+
endEnhancer: EndEnhancer,
|
|
43
|
+
color,
|
|
44
|
+
background,
|
|
45
|
+
type = PINHEAD_TYPES.fixed,
|
|
46
|
+
anchorType,
|
|
47
|
+
overrides = {}
|
|
48
|
+
}) => {
|
|
49
|
+
const [, theme] = useStyletron();
|
|
50
|
+
const {
|
|
51
|
+
colors: {
|
|
52
|
+
backgroundPrimary,
|
|
53
|
+
primaryA
|
|
54
|
+
}
|
|
55
|
+
} = theme;
|
|
56
|
+
color = color || backgroundPrimary;
|
|
57
|
+
background = background || primaryA;
|
|
58
|
+
const activeElements = [label, StartEnhancer, EndEnhancer].filter(x => x);
|
|
59
|
+
const gridTemplateColumns = activeElements.map(() => 'auto').join(' ');
|
|
60
|
+
const forceCircle = activeElements.length === 1 && !label;
|
|
61
|
+
const {
|
|
62
|
+
height,
|
|
63
|
+
icon
|
|
64
|
+
} = PINHEAD_DIMENSIONS[size];
|
|
65
|
+
const [PinHead, pinHeadProps] = getOverrides(overrides.PinHead, StyledPinHead);
|
|
66
|
+
const [ContentItem, contentItemProps] = getOverrides(overrides.PinHeadContent, _ContentItem);
|
|
67
|
+
const [InnerXSmallAnchor, innerXSmallAnchorProps] = getOverrides(overrides.InnerAnchor, StyledInnerXSmallAnchor);
|
|
68
|
+
const [OuterXSmallAnchor, outerXSmallAnchorProps] = getOverrides(overrides.OuterAnchor, StyledOuterXSmallAnchor);
|
|
69
|
+
|
|
70
|
+
if (type === PINHEAD_TYPES.fixed && (size === PINHEAD_SIZES_SHAPES.xSmallSquare || size === PINHEAD_SIZES_SHAPES.xSmallCircle)) {
|
|
71
|
+
const round = size === PINHEAD_SIZES_SHAPES.xSmallCircle;
|
|
72
|
+
return /*#__PURE__*/React.createElement(OuterXSmallAnchor, _extends({
|
|
73
|
+
$round: round,
|
|
74
|
+
$background: background,
|
|
75
|
+
$size: height
|
|
76
|
+
}, outerXSmallAnchorProps), /*#__PURE__*/React.createElement(InnerXSmallAnchor, _extends({
|
|
77
|
+
$color: color,
|
|
78
|
+
$round: round,
|
|
79
|
+
$size: icon
|
|
80
|
+
}, innerXSmallAnchorProps)));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return /*#__PURE__*/React.createElement(PinHead, _extends({
|
|
84
|
+
$background: background,
|
|
85
|
+
$height: height,
|
|
86
|
+
$gridTemplateColumns: gridTemplateColumns,
|
|
87
|
+
$forceCircle: forceCircle,
|
|
88
|
+
$type: type
|
|
89
|
+
}, pinHeadProps), StartEnhancer && /*#__PURE__*/React.createElement(ContentItem, _extends({
|
|
90
|
+
$height: height,
|
|
91
|
+
$color: color,
|
|
92
|
+
$size: size
|
|
93
|
+
}, contentItemProps), /*#__PURE__*/React.createElement(StartEnhancer, {
|
|
94
|
+
size: icon
|
|
95
|
+
})), label && /*#__PURE__*/React.createElement(ContentItem, _extends({
|
|
96
|
+
$height: height,
|
|
97
|
+
$color: color,
|
|
98
|
+
$size: size
|
|
99
|
+
}, contentItemProps), label), EndEnhancer && /*#__PURE__*/React.createElement(ContentItem, _extends({
|
|
100
|
+
$height: height,
|
|
101
|
+
$color: color,
|
|
102
|
+
$size: size
|
|
103
|
+
}, contentItemProps), /*#__PURE__*/React.createElement(EndEnhancer, {
|
|
104
|
+
size: icon
|
|
105
|
+
})));
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export default PinHead;
|
|
@@ -0,0 +1,156 @@
|
|
|
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
|
+
import { styled } from '../styles/index.js';
|
|
8
|
+
import { FLOATING_MARKER_ANCHOR_POSITIONS, xSmallPinheadDimension } from './constants.js';
|
|
9
|
+
export const getAnchorTransform = (anchor, anchorSize) => ({
|
|
10
|
+
[FLOATING_MARKER_ANCHOR_POSITIONS.none]: ``,
|
|
11
|
+
[FLOATING_MARKER_ANCHOR_POSITIONS.topLeft]: `translate(${anchorSize}px, ${anchorSize}px)`,
|
|
12
|
+
[FLOATING_MARKER_ANCHOR_POSITIONS.topRight]: `translate(-100%, ${anchorSize}px)`,
|
|
13
|
+
[FLOATING_MARKER_ANCHOR_POSITIONS.bottomLeft]: `translate(${anchorSize}px, -100%)`,
|
|
14
|
+
[FLOATING_MARKER_ANCHOR_POSITIONS.bottomRight]: `translate(-100%, -100%)`
|
|
15
|
+
})[anchor];
|
|
16
|
+
export const DragShadowContainer = styled('div', ({
|
|
17
|
+
$theme,
|
|
18
|
+
$height,
|
|
19
|
+
$width,
|
|
20
|
+
$dragging
|
|
21
|
+
}) => ({
|
|
22
|
+
width: `${$width}px`,
|
|
23
|
+
height: `${$height}px`,
|
|
24
|
+
opacity: $dragging ? 1 : 0,
|
|
25
|
+
visibility: $dragging ? 'visible' : 'hidden',
|
|
26
|
+
transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
|
|
27
|
+
position: 'relative',
|
|
28
|
+
boxShadow: $theme.lighting.shadow600
|
|
29
|
+
}));
|
|
30
|
+
DragShadowContainer.displayName = "DragShadowContainer";
|
|
31
|
+
export const DragShadow = styled('div', ({
|
|
32
|
+
$theme,
|
|
33
|
+
$background,
|
|
34
|
+
$width
|
|
35
|
+
}) => ({
|
|
36
|
+
background: $background,
|
|
37
|
+
borderRadius: '50%',
|
|
38
|
+
width: `${$width}px`,
|
|
39
|
+
height: `${4}px`,
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
bottom: 0
|
|
42
|
+
}));
|
|
43
|
+
DragShadow.displayName = "DragShadow";
|
|
44
|
+
export const Needle = styled('div', ({
|
|
45
|
+
$theme,
|
|
46
|
+
$background,
|
|
47
|
+
$height
|
|
48
|
+
}) => ({
|
|
49
|
+
background: $background,
|
|
50
|
+
width: '4px',
|
|
51
|
+
height: `${$height}px`,
|
|
52
|
+
boxShadow: $theme.lighting.shadow600
|
|
53
|
+
}));
|
|
54
|
+
Needle.displayName = "Needle";
|
|
55
|
+
export const FloatingMarkerRoot = styled('div', () => ({
|
|
56
|
+
position: 'relative',
|
|
57
|
+
height: `${xSmallPinheadDimension.height}px`,
|
|
58
|
+
width: `${xSmallPinheadDimension.height}px`
|
|
59
|
+
}));
|
|
60
|
+
FloatingMarkerRoot.displayName = "FloatingMarkerRoot";
|
|
61
|
+
export const FloatingMarkerPinHeadContainer = styled('div', ({
|
|
62
|
+
$theme,
|
|
63
|
+
$anchor,
|
|
64
|
+
$anchorSize
|
|
65
|
+
}) => ({
|
|
66
|
+
position: 'absolute',
|
|
67
|
+
transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
|
|
68
|
+
transform: getAnchorTransform($anchor, $anchorSize)
|
|
69
|
+
}));
|
|
70
|
+
FloatingMarkerPinHeadContainer.displayName = "FloatingMarkerPinHeadContainer";
|
|
71
|
+
export const FloatingMarkerAnchorContainer = styled('div', () => ({
|
|
72
|
+
position: 'absolute'
|
|
73
|
+
}));
|
|
74
|
+
FloatingMarkerAnchorContainer.displayName = "FloatingMarkerAnchorContainer";
|
|
75
|
+
export const FixedMarkerRoot = styled('div', () => ({
|
|
76
|
+
display: 'flex',
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
flexDirection: 'column'
|
|
79
|
+
}));
|
|
80
|
+
FixedMarkerRoot.displayName = "FixedMarkerRoot";
|
|
81
|
+
export const FixedMarkerDragContainer = styled('div', ({
|
|
82
|
+
$theme,
|
|
83
|
+
$translateAmount,
|
|
84
|
+
$performTranslate
|
|
85
|
+
}) => {
|
|
86
|
+
return {
|
|
87
|
+
transform: `translateY(${$performTranslate ? '0px' : `${$translateAmount}px`})`,
|
|
88
|
+
transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
|
|
89
|
+
display: 'flex',
|
|
90
|
+
alignItems: 'center',
|
|
91
|
+
flexDirection: 'column'
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
FixedMarkerDragContainer.displayName = "FixedMarkerDragContainer";
|
|
95
|
+
export const OuterXSmallAnchor = styled('div', ({
|
|
96
|
+
$theme,
|
|
97
|
+
$round,
|
|
98
|
+
$background,
|
|
99
|
+
$size
|
|
100
|
+
}) => ({
|
|
101
|
+
background: $background,
|
|
102
|
+
display: 'flex',
|
|
103
|
+
alignItems: 'center',
|
|
104
|
+
justifyContent: 'center',
|
|
105
|
+
height: `${$size}px`,
|
|
106
|
+
width: `${$size}px`,
|
|
107
|
+
borderRadius: $round ? '50%' : 0,
|
|
108
|
+
boxShadow: $theme.lighting.shadow600
|
|
109
|
+
}));
|
|
110
|
+
OuterXSmallAnchor.displayName = "OuterXSmallAnchor";
|
|
111
|
+
export const InnerXSmallAnchor = styled('div', ({
|
|
112
|
+
$round,
|
|
113
|
+
$color,
|
|
114
|
+
$size
|
|
115
|
+
}) => ({
|
|
116
|
+
background: $color,
|
|
117
|
+
height: `${$size}px`,
|
|
118
|
+
width: `${$size}px`,
|
|
119
|
+
borderRadius: $round ? '50%' : 0
|
|
120
|
+
}));
|
|
121
|
+
InnerXSmallAnchor.displayName = "InnerXSmallAnchor";
|
|
122
|
+
export const PinHead = styled('div', ({
|
|
123
|
+
$theme,
|
|
124
|
+
$height,
|
|
125
|
+
$background,
|
|
126
|
+
$gridTemplateColumns,
|
|
127
|
+
$type,
|
|
128
|
+
$forceCircle
|
|
129
|
+
}) => {
|
|
130
|
+
const sharedStyles = {
|
|
131
|
+
fixed: {
|
|
132
|
+
padding: '0px 12px',
|
|
133
|
+
borderRadius: `${$height}px`
|
|
134
|
+
},
|
|
135
|
+
floating: {
|
|
136
|
+
padding: '0px 8px'
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
return {
|
|
140
|
+
background: $background,
|
|
141
|
+
height: `${$height}px`,
|
|
142
|
+
display: 'grid',
|
|
143
|
+
gridTemplateColumns: $gridTemplateColumns,
|
|
144
|
+
gap: '8px',
|
|
145
|
+
boxShadow: $theme.lighting.shadow600,
|
|
146
|
+
whiteSpace: 'nowrap',
|
|
147
|
+
...sharedStyles[$type],
|
|
148
|
+
...($forceCircle && {
|
|
149
|
+
width: `${$height}px`,
|
|
150
|
+
display: 'flex',
|
|
151
|
+
justifyContent: 'center',
|
|
152
|
+
boxSizing: 'border-box'
|
|
153
|
+
})
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
PinHead.displayName = "PinHead";
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
import * as React from 'react';
|
|
8
|
+
import { FLOATING_MARKER_ANCHOR_POSITIONS, NEEDLE_SIZES, PINHEAD_SIZES_SHAPES, FLOATING_MARKER_SIZES, PINHEAD_TYPES, FLOATING_MARKER_ANCHOR_TYPES } from './constants.js';
|
|
@@ -28,6 +28,7 @@ export default function MaybeChildMenu(props) {
|
|
|
28
28
|
return /*#__PURE__*/React.createElement(NestedMenuContext.Consumer, null, ctx => {
|
|
29
29
|
return /*#__PURE__*/React.createElement(PopoverOverride, _extends({
|
|
30
30
|
focusLock: false,
|
|
31
|
+
autoFocus: false,
|
|
31
32
|
isOpen: props.isOpen,
|
|
32
33
|
renderAll: props.renderAll,
|
|
33
34
|
content: ChildMenu,
|
package/es/popover/popover.js
CHANGED
|
@@ -13,7 +13,7 @@ LICENSE file in the root directory of this source tree.
|
|
|
13
13
|
|
|
14
14
|
/* eslint-disable cup/no-undef */
|
|
15
15
|
import * as React from 'react';
|
|
16
|
-
import FocusLock from 'react-focus-lock';
|
|
16
|
+
import FocusLock, { MoveFocusInside } from 'react-focus-lock';
|
|
17
17
|
import { getOverride, getOverrideProps } from '../helpers/overrides.js';
|
|
18
18
|
import { ACCESSIBILITY_TYPE, PLACEMENT, TRIGGER_TYPE, ANIMATE_OUT_TIME, ANIMATE_IN_TIME, POPOVER_MARGIN } from './constants.js';
|
|
19
19
|
import { Layer, TetherBehavior } from '../layer/index.js';
|
|
@@ -156,7 +156,7 @@ class PopoverInner extends React.Component {
|
|
|
156
156
|
componentDidUpdate(prevProps, prevState) {
|
|
157
157
|
this.init(prevProps, prevState);
|
|
158
158
|
|
|
159
|
-
if (this.props.autoFocus &&
|
|
159
|
+
if (this.props.autoFocus && !this.state.autoFocusAfterPositioning && this.popperRef.current !== null && this.popperRef.current.getBoundingClientRect().top > 0) {
|
|
160
160
|
this.setState({
|
|
161
161
|
autoFocusAfterPositioning: true
|
|
162
162
|
});
|
|
@@ -451,9 +451,10 @@ class PopoverInner extends React.Component {
|
|
|
451
451
|
disabled: !this.props.focusLock,
|
|
452
452
|
noFocusGuards: false // see popover-focus-loop.scenario.js for why hover cannot return focus
|
|
453
453
|
,
|
|
454
|
-
returnFocus: this.
|
|
455
|
-
autoFocus: this.state.autoFocusAfterPositioning
|
|
456
|
-
|
|
454
|
+
returnFocus: !this.isHoverTrigger() && this.props.returnFocus,
|
|
455
|
+
autoFocus: this.state.autoFocusAfterPositioning,
|
|
456
|
+
focusOptions: this.props.focusOptions
|
|
457
|
+
}, !this.props.focusLock && this.state.autoFocusAfterPositioning ? /*#__PURE__*/React.createElement(MoveFocusInside, null, this.renderPopover(renderedContent)) : this.renderPopover(renderedContent)))));
|
|
457
458
|
} else {
|
|
458
459
|
rendered.push( /*#__PURE__*/React.createElement(Hidden, {
|
|
459
460
|
key: "hidden-layer"
|
|
@@ -25,6 +25,10 @@ class StatefulContainer extends React.Component {
|
|
|
25
25
|
this.props.onBlur(e);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
if (this.props.focusLock || this.props.autoFocus) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
28
32
|
this.close();
|
|
29
33
|
});
|
|
30
34
|
|
|
@@ -158,7 +162,8 @@ class StatefulContainer extends React.Component {
|
|
|
158
162
|
returnFocus,
|
|
159
163
|
showArrow,
|
|
160
164
|
triggerType,
|
|
161
|
-
popoverMargin
|
|
165
|
+
popoverMargin,
|
|
166
|
+
focusOptions
|
|
162
167
|
} = this.props;
|
|
163
168
|
const popoverProps = {
|
|
164
169
|
accessibilityType,
|
|
@@ -182,7 +187,8 @@ class StatefulContainer extends React.Component {
|
|
|
182
187
|
returnFocus,
|
|
183
188
|
showArrow,
|
|
184
189
|
triggerType,
|
|
185
|
-
popoverMargin
|
|
190
|
+
popoverMargin,
|
|
191
|
+
focusOptions
|
|
186
192
|
};
|
|
187
193
|
|
|
188
194
|
if (dismissOnClickOutside) {
|
|
@@ -144,7 +144,9 @@ class EmoticonRating extends React.Component {
|
|
|
144
144
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
|
145
145
|
"data-baseweb": "emoticon-rating",
|
|
146
146
|
role: "radiogroup",
|
|
147
|
-
onBlur:
|
|
147
|
+
onBlur: e => {
|
|
148
|
+
if (!e.currentTarget.contains(e.relatedTarget)) this.updatePreview(undefined);
|
|
149
|
+
},
|
|
148
150
|
onMouseLeave: () => this.updatePreview(undefined)
|
|
149
151
|
}, rootProps), this.renderRatingContents());
|
|
150
152
|
}
|
package/es/rating/star-rating.js
CHANGED
|
@@ -147,7 +147,9 @@ class StarRating extends React.Component {
|
|
|
147
147
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
|
148
148
|
"data-baseweb": "star-rating",
|
|
149
149
|
role: "radiogroup",
|
|
150
|
-
onBlur:
|
|
150
|
+
onBlur: e => {
|
|
151
|
+
if (!e.currentTarget.contains(e.relatedTarget)) this.updatePreview(undefined);
|
|
152
|
+
},
|
|
151
153
|
onMouseLeave: () => this.updatePreview(undefined)
|
|
152
154
|
}, rootProps), this.renderRatingContents());
|
|
153
155
|
}
|