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
|
@@ -7,33 +7,11 @@ 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 * as React from 'react';
|
|
10
|
-
import { useStyletron, styled } from '../styles/index.js';
|
|
11
10
|
import { getOverrides } from '../helpers/overrides.js';
|
|
12
|
-
import {
|
|
13
|
-
import { PINHEAD_DIMENSIONS, PINHEAD_TYPES, PINHEAD_SIZES_SHAPES } from './constants.js';
|
|
14
|
-
|
|
15
|
-
|
|
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";
|
|
11
|
+
import { StyledInnerXXSmallAnchor, StyledOuterXXSmallAnchor, StyledInnerXSmallAnchor, StyledOuterXSmallAnchor, StyledPinHead, RelativeContainer, StyledContentItem } from './styled-components.js';
|
|
12
|
+
import { PINHEAD_DIMENSIONS, PINHEAD_TYPES, PINHEAD_SIZES_SHAPES, NEEDLE_HEIGHTS, NEEDLE_SIZES } from './constants.js';
|
|
13
|
+
import BadgeEnhancer from './badge-enhancer.js';
|
|
14
|
+
import LabelEnhancer from './label-enhancer.js';
|
|
37
15
|
|
|
38
16
|
const PinHead = ({
|
|
39
17
|
size = PINHEAD_SIZES_SHAPES.medium,
|
|
@@ -44,17 +22,13 @@ const PinHead = ({
|
|
|
44
22
|
background,
|
|
45
23
|
type = PINHEAD_TYPES.fixed,
|
|
46
24
|
anchorType,
|
|
25
|
+
needle = NEEDLE_SIZES.none,
|
|
26
|
+
labelEnhancerContent,
|
|
27
|
+
labelEnhancerPosition,
|
|
28
|
+
badgeEnhancerSize,
|
|
29
|
+
badgeEnhancerContent,
|
|
47
30
|
overrides = {}
|
|
48
31
|
}) => {
|
|
49
|
-
const [, theme] = useStyletron();
|
|
50
|
-
const {
|
|
51
|
-
colors: {
|
|
52
|
-
backgroundPrimary,
|
|
53
|
-
primaryA
|
|
54
|
-
}
|
|
55
|
-
} = theme;
|
|
56
|
-
color = color || backgroundPrimary;
|
|
57
|
-
background = background || primaryA;
|
|
58
32
|
const activeElements = [label, StartEnhancer, EndEnhancer].filter(x => x);
|
|
59
33
|
const gridTemplateColumns = activeElements.map(() => 'auto').join(' ');
|
|
60
34
|
const forceCircle = activeElements.length === 1 && !label;
|
|
@@ -63,13 +37,35 @@ const PinHead = ({
|
|
|
63
37
|
icon
|
|
64
38
|
} = PINHEAD_DIMENSIONS[size];
|
|
65
39
|
const [PinHead, pinHeadProps] = getOverrides(overrides.PinHead, StyledPinHead);
|
|
66
|
-
const [ContentItem, contentItemProps] = getOverrides(overrides.PinHeadContent,
|
|
40
|
+
const [ContentItem, contentItemProps] = getOverrides(overrides.PinHeadContent, StyledContentItem);
|
|
41
|
+
const [InnerXXSmallAnchor, innerXXSmallAnchorProps] = getOverrides(overrides.InnerAnchor, StyledInnerXXSmallAnchor);
|
|
42
|
+
const [OuterXXSmallAnchor, outerXXSmallAnchorProps] = getOverrides(overrides.OuterAnchor, StyledOuterXXSmallAnchor);
|
|
67
43
|
const [InnerXSmallAnchor, innerXSmallAnchorProps] = getOverrides(overrides.InnerAnchor, StyledInnerXSmallAnchor);
|
|
68
44
|
const [OuterXSmallAnchor, outerXSmallAnchorProps] = getOverrides(overrides.OuterAnchor, StyledOuterXSmallAnchor);
|
|
45
|
+
const badge = /*#__PURE__*/React.createElement(BadgeEnhancer, {
|
|
46
|
+
markerType: type,
|
|
47
|
+
pinHeadSize: size,
|
|
48
|
+
badgeEnhancerSize: badgeEnhancerSize,
|
|
49
|
+
badgeEnhancerContent: badgeEnhancerContent,
|
|
50
|
+
overrides: overrides
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (type === PINHEAD_TYPES.fixed && (size === PINHEAD_SIZES_SHAPES.xxSmallCircle || size === PINHEAD_SIZES_SHAPES.xxSmallSquare)) {
|
|
54
|
+
const round = size === PINHEAD_SIZES_SHAPES.xxSmallCircle;
|
|
55
|
+
return /*#__PURE__*/React.createElement(OuterXXSmallAnchor, _extends({
|
|
56
|
+
$round: round,
|
|
57
|
+
$background: background,
|
|
58
|
+
$size: height
|
|
59
|
+
}, outerXXSmallAnchorProps), /*#__PURE__*/React.createElement(InnerXXSmallAnchor, _extends({
|
|
60
|
+
$color: color,
|
|
61
|
+
$round: round,
|
|
62
|
+
$size: icon
|
|
63
|
+
}, innerXXSmallAnchorProps)));
|
|
64
|
+
}
|
|
69
65
|
|
|
70
66
|
if (type === PINHEAD_TYPES.fixed && (size === PINHEAD_SIZES_SHAPES.xSmallSquare || size === PINHEAD_SIZES_SHAPES.xSmallCircle)) {
|
|
71
67
|
const round = size === PINHEAD_SIZES_SHAPES.xSmallCircle;
|
|
72
|
-
return /*#__PURE__*/React.createElement(OuterXSmallAnchor, _extends({
|
|
68
|
+
return /*#__PURE__*/React.createElement(RelativeContainer, null, badge, /*#__PURE__*/React.createElement(OuterXSmallAnchor, _extends({
|
|
73
69
|
$round: round,
|
|
74
70
|
$background: background,
|
|
75
71
|
$size: height
|
|
@@ -77,10 +73,16 @@ const PinHead = ({
|
|
|
77
73
|
$color: color,
|
|
78
74
|
$round: round,
|
|
79
75
|
$size: icon
|
|
80
|
-
}, innerXSmallAnchorProps)));
|
|
76
|
+
}, innerXSmallAnchorProps))));
|
|
81
77
|
}
|
|
82
78
|
|
|
83
|
-
return /*#__PURE__*/React.createElement(
|
|
79
|
+
return /*#__PURE__*/React.createElement(RelativeContainer, null, /*#__PURE__*/React.createElement(LabelEnhancer, {
|
|
80
|
+
labelEnhancerContent: labelEnhancerContent,
|
|
81
|
+
labelEnhancerPosition: labelEnhancerPosition,
|
|
82
|
+
needleHeight: NEEDLE_HEIGHTS[needle],
|
|
83
|
+
size: size,
|
|
84
|
+
overrides: overrides
|
|
85
|
+
}), badge, /*#__PURE__*/React.createElement(PinHead, _extends({
|
|
84
86
|
$background: background,
|
|
85
87
|
$height: height,
|
|
86
88
|
$gridTemplateColumns: gridTemplateColumns,
|
|
@@ -102,7 +104,7 @@ const PinHead = ({
|
|
|
102
104
|
$size: size
|
|
103
105
|
}, contentItemProps), /*#__PURE__*/React.createElement(EndEnhancer, {
|
|
104
106
|
size: icon
|
|
105
|
-
})));
|
|
107
|
+
}))));
|
|
106
108
|
};
|
|
107
109
|
|
|
108
110
|
export default PinHead;
|
|
@@ -5,7 +5,7 @@ This source code is licensed under the MIT license found in the
|
|
|
5
5
|
LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { styled } from '../styles/index.js';
|
|
8
|
-
import { FLOATING_MARKER_ANCHOR_POSITIONS,
|
|
8
|
+
import { BADGE_ENHANCER_STYLES, FLOATING_MARKER_ANCHOR_POSITIONS, LABEL_SIZES } from './constants.js';
|
|
9
9
|
export const getAnchorTransform = (anchor, anchorSize) => ({
|
|
10
10
|
[FLOATING_MARKER_ANCHOR_POSITIONS.none]: ``,
|
|
11
11
|
[FLOATING_MARKER_ANCHOR_POSITIONS.topLeft]: `translate(${anchorSize}px, ${anchorSize}px)`,
|
|
@@ -13,7 +13,7 @@ export const getAnchorTransform = (anchor, anchorSize) => ({
|
|
|
13
13
|
[FLOATING_MARKER_ANCHOR_POSITIONS.bottomLeft]: `translate(${anchorSize}px, -100%)`,
|
|
14
14
|
[FLOATING_MARKER_ANCHOR_POSITIONS.bottomRight]: `translate(-100%, -100%)`
|
|
15
15
|
})[anchor];
|
|
16
|
-
export const
|
|
16
|
+
export const StyledDragShadowContainer = styled('div', ({
|
|
17
17
|
$theme,
|
|
18
18
|
$height,
|
|
19
19
|
$width,
|
|
@@ -27,38 +27,40 @@ export const DragShadowContainer = styled('div', ({
|
|
|
27
27
|
position: 'relative',
|
|
28
28
|
boxShadow: $theme.lighting.shadow600
|
|
29
29
|
}));
|
|
30
|
-
|
|
31
|
-
export const
|
|
30
|
+
StyledDragShadowContainer.displayName = "StyledDragShadowContainer";
|
|
31
|
+
export const StyledDragShadow = styled('div', ({
|
|
32
32
|
$theme,
|
|
33
33
|
$background,
|
|
34
34
|
$width
|
|
35
35
|
}) => ({
|
|
36
|
-
|
|
36
|
+
backgroundColor: $background,
|
|
37
37
|
borderRadius: '50%',
|
|
38
38
|
width: `${$width}px`,
|
|
39
|
-
height:
|
|
39
|
+
height: '4px',
|
|
40
40
|
position: 'absolute',
|
|
41
41
|
bottom: 0
|
|
42
42
|
}));
|
|
43
|
-
|
|
44
|
-
export const
|
|
43
|
+
StyledDragShadow.displayName = "StyledDragShadow";
|
|
44
|
+
export const StyledNeedle = styled('div', ({
|
|
45
45
|
$theme,
|
|
46
46
|
$background,
|
|
47
47
|
$height
|
|
48
48
|
}) => ({
|
|
49
|
-
|
|
49
|
+
backgroundColor: $background,
|
|
50
50
|
width: '4px',
|
|
51
51
|
height: `${$height}px`,
|
|
52
52
|
boxShadow: $theme.lighting.shadow600
|
|
53
53
|
}));
|
|
54
|
-
|
|
55
|
-
export const
|
|
54
|
+
StyledNeedle.displayName = "StyledNeedle";
|
|
55
|
+
export const StyledFloatingMarkerRoot = styled('div', ({
|
|
56
|
+
$size
|
|
57
|
+
}) => ({
|
|
56
58
|
position: 'relative',
|
|
57
|
-
height: `${
|
|
58
|
-
width: `${
|
|
59
|
+
height: `${$size}px`,
|
|
60
|
+
width: `${$size}px`
|
|
59
61
|
}));
|
|
60
|
-
|
|
61
|
-
export const
|
|
62
|
+
StyledFloatingMarkerRoot.displayName = "StyledFloatingMarkerRoot";
|
|
63
|
+
export const StyledFloatingMarkerPinHeadContainer = styled('div', ({
|
|
62
64
|
$theme,
|
|
63
65
|
$anchor,
|
|
64
66
|
$anchorSize
|
|
@@ -67,38 +69,65 @@ export const FloatingMarkerPinHeadContainer = styled('div', ({
|
|
|
67
69
|
transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
|
|
68
70
|
transform: getAnchorTransform($anchor, $anchorSize)
|
|
69
71
|
}));
|
|
70
|
-
|
|
71
|
-
export const
|
|
72
|
+
StyledFloatingMarkerPinHeadContainer.displayName = "StyledFloatingMarkerPinHeadContainer";
|
|
73
|
+
export const StyledFloatingMarkerAnchorContainer = styled('div', () => ({
|
|
72
74
|
position: 'absolute'
|
|
73
75
|
}));
|
|
74
|
-
|
|
75
|
-
export const
|
|
76
|
+
StyledFloatingMarkerAnchorContainer.displayName = "StyledFloatingMarkerAnchorContainer";
|
|
77
|
+
export const StyledFixedMarkerRoot = styled('div', () => ({
|
|
76
78
|
display: 'flex',
|
|
77
79
|
alignItems: 'center',
|
|
78
80
|
flexDirection: 'column'
|
|
79
81
|
}));
|
|
80
|
-
|
|
81
|
-
export const
|
|
82
|
+
StyledFixedMarkerRoot.displayName = "StyledFixedMarkerRoot";
|
|
83
|
+
export const StyledFixedMarkerDragContainer = styled('div', ({
|
|
82
84
|
$theme,
|
|
83
85
|
$translateAmount,
|
|
84
86
|
$performTranslate
|
|
85
87
|
}) => {
|
|
86
88
|
return {
|
|
87
|
-
transform: `translateY(${$performTranslate ?
|
|
89
|
+
transform: `translateY(${$performTranslate ? `${$translateAmount}px` : '0px'})`,
|
|
88
90
|
transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
|
|
89
91
|
display: 'flex',
|
|
90
92
|
alignItems: 'center',
|
|
91
93
|
flexDirection: 'column'
|
|
92
94
|
};
|
|
93
95
|
});
|
|
94
|
-
|
|
95
|
-
export const
|
|
96
|
+
StyledFixedMarkerDragContainer.displayName = "StyledFixedMarkerDragContainer";
|
|
97
|
+
export const StyledOuterXXSmallAnchor = styled('div', ({
|
|
98
|
+
$theme,
|
|
99
|
+
$round,
|
|
100
|
+
$background,
|
|
101
|
+
$size
|
|
102
|
+
}) => ({
|
|
103
|
+
backgroundColor: $background,
|
|
104
|
+
display: 'flex',
|
|
105
|
+
alignItems: 'center',
|
|
106
|
+
justifyContent: 'center',
|
|
107
|
+
height: `${$size}px`,
|
|
108
|
+
width: `${$size}px`,
|
|
109
|
+
borderRadius: $round ? '50%' : 0,
|
|
110
|
+
boxShadow: $theme.lighting.shadow600
|
|
111
|
+
}));
|
|
112
|
+
StyledOuterXXSmallAnchor.displayName = "StyledOuterXXSmallAnchor";
|
|
113
|
+
export const StyledInnerXXSmallAnchor = styled('div', ({
|
|
114
|
+
$round,
|
|
115
|
+
$color,
|
|
116
|
+
$size
|
|
117
|
+
}) => ({
|
|
118
|
+
backgroundColor: $color,
|
|
119
|
+
height: `${$size}px`,
|
|
120
|
+
width: `${$size}px`,
|
|
121
|
+
borderRadius: $round ? '50%' : 0
|
|
122
|
+
}));
|
|
123
|
+
StyledInnerXXSmallAnchor.displayName = "StyledInnerXXSmallAnchor";
|
|
124
|
+
export const StyledOuterXSmallAnchor = styled('div', ({
|
|
96
125
|
$theme,
|
|
97
126
|
$round,
|
|
98
127
|
$background,
|
|
99
128
|
$size
|
|
100
129
|
}) => ({
|
|
101
|
-
|
|
130
|
+
backgroundColor: $background,
|
|
102
131
|
display: 'flex',
|
|
103
132
|
alignItems: 'center',
|
|
104
133
|
justifyContent: 'center',
|
|
@@ -107,19 +136,19 @@ export const OuterXSmallAnchor = styled('div', ({
|
|
|
107
136
|
borderRadius: $round ? '50%' : 0,
|
|
108
137
|
boxShadow: $theme.lighting.shadow600
|
|
109
138
|
}));
|
|
110
|
-
|
|
111
|
-
export const
|
|
139
|
+
StyledOuterXSmallAnchor.displayName = "StyledOuterXSmallAnchor";
|
|
140
|
+
export const StyledInnerXSmallAnchor = styled('div', ({
|
|
112
141
|
$round,
|
|
113
142
|
$color,
|
|
114
143
|
$size
|
|
115
144
|
}) => ({
|
|
116
|
-
|
|
145
|
+
backgroundColor: $color,
|
|
117
146
|
height: `${$size}px`,
|
|
118
147
|
width: `${$size}px`,
|
|
119
148
|
borderRadius: $round ? '50%' : 0
|
|
120
149
|
}));
|
|
121
|
-
|
|
122
|
-
export const
|
|
150
|
+
StyledInnerXSmallAnchor.displayName = "StyledInnerXSmallAnchor";
|
|
151
|
+
export const StyledPinHead = styled('div', ({
|
|
123
152
|
$theme,
|
|
124
153
|
$height,
|
|
125
154
|
$background,
|
|
@@ -137,7 +166,7 @@ export const PinHead = styled('div', ({
|
|
|
137
166
|
}
|
|
138
167
|
};
|
|
139
168
|
return {
|
|
140
|
-
|
|
169
|
+
backgroundColor: $background,
|
|
141
170
|
height: `${$height}px`,
|
|
142
171
|
display: 'grid',
|
|
143
172
|
gridTemplateColumns: $gridTemplateColumns,
|
|
@@ -153,4 +182,120 @@ export const PinHead = styled('div', ({
|
|
|
153
182
|
})
|
|
154
183
|
};
|
|
155
184
|
});
|
|
156
|
-
|
|
185
|
+
StyledPinHead.displayName = "StyledPinHead";
|
|
186
|
+
export const StyledStrokedLabelContainer = styled('div', ({
|
|
187
|
+
$position,
|
|
188
|
+
$theme,
|
|
189
|
+
$labelOffset
|
|
190
|
+
}) => {
|
|
191
|
+
const staticLabelOffset = 4;
|
|
192
|
+
const positions = {
|
|
193
|
+
top: {
|
|
194
|
+
left: `calc(50% + ${staticLabelOffset}px)`,
|
|
195
|
+
bottom: '100%',
|
|
196
|
+
alignItems: 'flex-end',
|
|
197
|
+
justifyContent: 'center',
|
|
198
|
+
textAlign: 'center'
|
|
199
|
+
},
|
|
200
|
+
bottom: {
|
|
201
|
+
left: '50%',
|
|
202
|
+
top: `calc(100% + ${staticLabelOffset}px + ${$labelOffset}px)`,
|
|
203
|
+
alignItems: 'flex-start',
|
|
204
|
+
justifyContent: 'center',
|
|
205
|
+
textAlign: 'center'
|
|
206
|
+
},
|
|
207
|
+
right: {
|
|
208
|
+
left: `calc(100% + ${staticLabelOffset}px)`,
|
|
209
|
+
top: '50%',
|
|
210
|
+
alignItems: 'center',
|
|
211
|
+
justifyContent: 'flex-start'
|
|
212
|
+
},
|
|
213
|
+
left: {
|
|
214
|
+
right: `calc(100% + ${staticLabelOffset}px)`,
|
|
215
|
+
top: '50%',
|
|
216
|
+
alignItems: 'center',
|
|
217
|
+
justifyContent: 'flex-end',
|
|
218
|
+
textAlign: 'right'
|
|
219
|
+
},
|
|
220
|
+
none: {}
|
|
221
|
+
};
|
|
222
|
+
return {
|
|
223
|
+
position: 'absolute',
|
|
224
|
+
width: '0px',
|
|
225
|
+
height: '0px',
|
|
226
|
+
pointerEvents: 'none',
|
|
227
|
+
display: 'flex',
|
|
228
|
+
...positions[$position]
|
|
229
|
+
};
|
|
230
|
+
});
|
|
231
|
+
StyledStrokedLabelContainer.displayName = "StyledStrokedLabelContainer";
|
|
232
|
+
export const StyledStrokedLabel = styled('div', ({
|
|
233
|
+
$theme,
|
|
234
|
+
$size
|
|
235
|
+
}) => {
|
|
236
|
+
const strokeWidth = 1.5;
|
|
237
|
+
const strokeColor = $theme.colors.backgroundPrimary;
|
|
238
|
+
const textShadow = `-${strokeWidth}px -${strokeWidth}px 0 ${strokeColor},
|
|
239
|
+
0 -${strokeWidth}px 0 ${strokeColor},
|
|
240
|
+
${strokeWidth}px -${strokeWidth}px 0 ${strokeColor},
|
|
241
|
+
${strokeWidth}px 0 0 ${strokeColor},
|
|
242
|
+
${strokeWidth}px ${strokeWidth}px 0 ${strokeColor},
|
|
243
|
+
0 ${strokeWidth}px 0 ${strokeColor},
|
|
244
|
+
-${strokeWidth}px ${strokeWidth}px 0 ${strokeColor},
|
|
245
|
+
-${strokeWidth}px 0 0 ${strokeColor}`;
|
|
246
|
+
return {
|
|
247
|
+
display: 'flex',
|
|
248
|
+
...$theme.typography[LABEL_SIZES[$size]],
|
|
249
|
+
color: $theme.colors.primaryA,
|
|
250
|
+
transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
|
|
251
|
+
textShadow,
|
|
252
|
+
pointerEvents: 'auto',
|
|
253
|
+
width: 'max-content',
|
|
254
|
+
maxWidth: '200px'
|
|
255
|
+
};
|
|
256
|
+
});
|
|
257
|
+
StyledStrokedLabel.displayName = "StyledStrokedLabel";
|
|
258
|
+
export const StyledBadgeEnhancerRoot = styled('div', ({
|
|
259
|
+
$theme,
|
|
260
|
+
$size,
|
|
261
|
+
$position
|
|
262
|
+
}) => {
|
|
263
|
+
const {
|
|
264
|
+
x,
|
|
265
|
+
y
|
|
266
|
+
} = $position;
|
|
267
|
+
return {
|
|
268
|
+
position: 'absolute',
|
|
269
|
+
...$theme.typography.LabelSmall,
|
|
270
|
+
backgroundColor: $theme.colors.backgroundAccent,
|
|
271
|
+
color: $theme.colors.primaryB,
|
|
272
|
+
boxSizing: 'border-box',
|
|
273
|
+
right: 0,
|
|
274
|
+
transform: `translate(calc(100% + ${x}px), ${y}px)`,
|
|
275
|
+
transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
|
|
276
|
+
...BADGE_ENHANCER_STYLES[$size]
|
|
277
|
+
};
|
|
278
|
+
});
|
|
279
|
+
StyledBadgeEnhancerRoot.displayName = "StyledBadgeEnhancerRoot";
|
|
280
|
+
export const RelativeContainer = styled('div', () => {
|
|
281
|
+
return {
|
|
282
|
+
position: 'relative'
|
|
283
|
+
};
|
|
284
|
+
});
|
|
285
|
+
RelativeContainer.displayName = "RelativeContainer";
|
|
286
|
+
export const StyledContentItem = styled('div', ({
|
|
287
|
+
$theme,
|
|
288
|
+
$color,
|
|
289
|
+
$height,
|
|
290
|
+
$size
|
|
291
|
+
}) => {
|
|
292
|
+
return { ...$theme.typography[LABEL_SIZES[$size]],
|
|
293
|
+
display: 'flex',
|
|
294
|
+
alignItems: 'center',
|
|
295
|
+
textAlign: 'center',
|
|
296
|
+
lineHeight: `${$height}px`,
|
|
297
|
+
height: `${$height}px`,
|
|
298
|
+
color: $color
|
|
299
|
+
};
|
|
300
|
+
});
|
|
301
|
+
StyledContentItem.displayName = "StyledContentItem";
|
package/es/map-marker/types.js
CHANGED
|
@@ -5,4 +5,4 @@ This source code is licensed under the MIT license found in the
|
|
|
5
5
|
LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
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';
|
|
8
|
+
import { FLOATING_MARKER_ANCHOR_POSITIONS, NEEDLE_SIZES, PINHEAD_SIZES_SHAPES, FLOATING_MARKER_SIZES, PINHEAD_TYPES, FLOATING_MARKER_ANCHOR_TYPES, BADGE_ENHANCER_SIZES, LABEL_ENHANCER_POSITIONS, KIND } from './constants.js';
|
|
@@ -43,8 +43,6 @@ export default function MaybeChildMenu(props) {
|
|
|
43
43
|
overrides: mergeOverrides({
|
|
44
44
|
Body: {
|
|
45
45
|
props: {
|
|
46
|
-
// Adds mouseleave to popover body so that child menu closes when user mouses out.
|
|
47
|
-
onMouseLeave: props.resetParentMenu,
|
|
48
46
|
// Trap tabbing when focused on a child menu. Popover mounts the element at the end of
|
|
49
47
|
// the html body by default. If a user was to tab to the next element it would navigate
|
|
50
48
|
// to elements not within the immediate area surrounding the menu.
|
package/es/menu/nested-menus.js
CHANGED
|
@@ -12,6 +12,8 @@ export const NestedMenuContext = /*#__PURE__*/React.createContext({
|
|
|
12
12
|
removeMenuFromNesting: () => {},
|
|
13
13
|
getParentMenu: () => {},
|
|
14
14
|
getChildMenu: () => {},
|
|
15
|
+
nestedMenuHoverIndex: -1,
|
|
16
|
+
isNestedMenuVisible: () => false,
|
|
15
17
|
mountRef: {
|
|
16
18
|
current: null
|
|
17
19
|
}
|
|
@@ -30,16 +32,43 @@ export default class NestedMenus extends React.Component {
|
|
|
30
32
|
super(...args);
|
|
31
33
|
|
|
32
34
|
_defineProperty(this, "state", {
|
|
33
|
-
menus: []
|
|
35
|
+
menus: [],
|
|
36
|
+
nestedMenuHoverIndex: -1
|
|
34
37
|
});
|
|
35
38
|
|
|
36
39
|
_defineProperty(this, "mountRef", /*#__PURE__*/React.createRef());
|
|
37
40
|
|
|
41
|
+
_defineProperty(this, "mouseLeaveTimeoueId", null);
|
|
42
|
+
|
|
43
|
+
_defineProperty(this, "handleMenuMouseLeave", event => {
|
|
44
|
+
this.mouseLeaveTimeoueId = setTimeout(() => {
|
|
45
|
+
this.setState({
|
|
46
|
+
nestedMenuHoverIndex: -1
|
|
47
|
+
});
|
|
48
|
+
}, 200);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
_defineProperty(this, "handleMenuMouseEnter", event => {
|
|
52
|
+
if (typeof document !== 'undefined') {
|
|
53
|
+
clearTimeout(this.mouseLeaveTimeoueId);
|
|
54
|
+
const index = this.state.menus.findIndex(m => {
|
|
55
|
+
return m.current && event.currentTarget instanceof Node && m.current.contains(event.currentTarget);
|
|
56
|
+
});
|
|
57
|
+
this.setState({
|
|
58
|
+
nestedMenuHoverIndex: index
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
38
63
|
_defineProperty(this, "addMenuToNesting", ref => {
|
|
39
64
|
// check offsetHeight to determine if component is visible in the dom (0 means hidden)
|
|
40
65
|
// we need to do this so that when we renderAll, the hidden seo-only child-menus don't
|
|
41
66
|
// register themselves which would break the nesting logic
|
|
42
|
-
|
|
67
|
+
const element = ref.current;
|
|
68
|
+
|
|
69
|
+
if (element && element.offsetHeight) {
|
|
70
|
+
element.addEventListener('mouseenter', this.handleMenuMouseEnter);
|
|
71
|
+
element.addEventListener('mouseleave', this.handleMenuMouseLeave);
|
|
43
72
|
this.setState(state => {
|
|
44
73
|
return {
|
|
45
74
|
menus: [...state.menus, ref]
|
|
@@ -50,7 +79,17 @@ export default class NestedMenus extends React.Component {
|
|
|
50
79
|
|
|
51
80
|
_defineProperty(this, "removeMenuFromNesting", ref => {
|
|
52
81
|
this.setState(state => {
|
|
53
|
-
const
|
|
82
|
+
for (const r of this.state.menus) {
|
|
83
|
+
if (r.current && isSame(r.current, ref.current)) {
|
|
84
|
+
const element = r.current;
|
|
85
|
+
element.removeEventListener('mouseenter', this.handleMenuMouseEnter);
|
|
86
|
+
element.removeEventListener('mouseleave', this.handleMenuMouseLeave);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const nextMenus = state.menus.filter(r => {
|
|
91
|
+
return r.current && !isSame(r.current, ref.current);
|
|
92
|
+
});
|
|
54
93
|
return {
|
|
55
94
|
menus: nextMenus
|
|
56
95
|
};
|
|
@@ -70,6 +109,11 @@ export default class NestedMenus extends React.Component {
|
|
|
70
109
|
const index = this.findMenuIndexByRef(ref) + 1;
|
|
71
110
|
return this.state.menus[index];
|
|
72
111
|
});
|
|
112
|
+
|
|
113
|
+
_defineProperty(this, "isNestedMenuVisible", ref => {
|
|
114
|
+
const index = this.findMenuIndexByRef(ref);
|
|
115
|
+
return index <= this.state.nestedMenuHoverIndex;
|
|
116
|
+
});
|
|
73
117
|
}
|
|
74
118
|
|
|
75
119
|
render() {
|
|
@@ -79,6 +123,8 @@ export default class NestedMenus extends React.Component {
|
|
|
79
123
|
removeMenuFromNesting: this.removeMenuFromNesting,
|
|
80
124
|
getParentMenu: this.getParentMenu,
|
|
81
125
|
getChildMenu: this.getChildMenu,
|
|
126
|
+
isNestedMenuVisible: this.isNestedMenuVisible,
|
|
127
|
+
nestedMenuHoverIndex: this.state.nestedMenuHoverIndex,
|
|
82
128
|
mountRef: this.mountRef
|
|
83
129
|
}
|
|
84
130
|
}, /*#__PURE__*/React.createElement(React.Fragment, null, this.props.children, /*#__PURE__*/React.createElement("span", {
|
|
@@ -34,6 +34,8 @@ const DEFAULT_PROPS = {
|
|
|
34
34
|
removeMenuFromNesting: () => {},
|
|
35
35
|
getParentMenu: () => {},
|
|
36
36
|
getChildMenu: () => {},
|
|
37
|
+
nestedMenuHoverIndex: -1,
|
|
38
|
+
isNestedMenuVisible: () => false,
|
|
37
39
|
forceHighlight: false
|
|
38
40
|
};
|
|
39
41
|
|
|
@@ -223,16 +225,7 @@ class MenuStatefulContainerInner extends React.Component {
|
|
|
223
225
|
});
|
|
224
226
|
});
|
|
225
227
|
|
|
226
|
-
_defineProperty(this, "handleMouseLeave",
|
|
227
|
-
const rootRef = this.props.rootRef ? this.props.rootRef : this.rootRef;
|
|
228
|
-
const childMenu = this.props.getChildMenu && this.props.getChildMenu(rootRef);
|
|
229
|
-
|
|
230
|
-
if (!this.props.forceHighlight && !childMenu) {
|
|
231
|
-
this.internalSetState(STATE_CHANGE_TYPES.mouseLeave, {
|
|
232
|
-
highlightedIndex: -1
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
});
|
|
228
|
+
_defineProperty(this, "handleMouseLeave", event => {});
|
|
236
229
|
|
|
237
230
|
_defineProperty(this, "getRequiredItemProps", (item, index) => {
|
|
238
231
|
let itemRef = this.refList[index];
|
|
@@ -339,10 +332,12 @@ class MenuStatefulContainerInner extends React.Component {
|
|
|
339
332
|
if (this.keyboardControlNode) this.keyboardControlNode.removeEventListener('keydown', this.onKeyDown);
|
|
340
333
|
}
|
|
341
334
|
|
|
342
|
-
|
|
335
|
+
if (this.props.removeMenuFromNesting) {
|
|
336
|
+
this.props.removeMenuFromNesting(rootRef);
|
|
337
|
+
}
|
|
343
338
|
}
|
|
344
339
|
|
|
345
|
-
componentDidUpdate(
|
|
340
|
+
componentDidUpdate(prevProps, prevState) {
|
|
346
341
|
if (typeof document !== 'undefined') {
|
|
347
342
|
if (!prevState.isFocused && this.state.isFocused) {
|
|
348
343
|
if (this.keyboardControlNode) this.keyboardControlNode.addEventListener('keydown', this.onKeyDown);
|
|
@@ -368,6 +363,12 @@ class MenuStatefulContainerInner extends React.Component {
|
|
|
368
363
|
highlightedIndex: 0
|
|
369
364
|
});
|
|
370
365
|
}
|
|
366
|
+
|
|
367
|
+
if (this.props.isNestedMenuVisible && this.props.nestedMenuHoverIndex !== prevProps.nestedMenuHoverIndex && !this.props.isNestedMenuVisible(this.rootRef) && !this.props.forceHighlight) {
|
|
368
|
+
this.setState({
|
|
369
|
+
highlightedIndex: -1
|
|
370
|
+
});
|
|
371
|
+
}
|
|
371
372
|
} // One array to hold all of list item refs
|
|
372
373
|
|
|
373
374
|
|
package/es/modal/modal.js
CHANGED
|
@@ -300,7 +300,9 @@ class Modal extends React.Component {
|
|
|
300
300
|
ref: this.getRef('DialogContainer')
|
|
301
301
|
} : {};
|
|
302
302
|
return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, locale => /*#__PURE__*/React.createElement(FocusLock, {
|
|
303
|
-
disabled: !focusLock
|
|
303
|
+
disabled: !focusLock // Allow focus to escape when UI is within an iframe
|
|
304
|
+
,
|
|
305
|
+
crossFrame: false,
|
|
304
306
|
returnFocus: returnFocus,
|
|
305
307
|
autoFocus: autofocus !== null ? autofocus : autoFocus
|
|
306
308
|
}, /*#__PURE__*/React.createElement(Root, _extends({
|
package/es/popover/popover.js
CHANGED
|
@@ -452,10 +452,12 @@ class PopoverInner extends React.Component {
|
|
|
452
452
|
noFocusGuards: false // see popover-focus-loop.scenario.js for why hover cannot return focus
|
|
453
453
|
,
|
|
454
454
|
returnFocus: !this.isHoverTrigger() && this.props.returnFocus,
|
|
455
|
-
autoFocus: this.state.autoFocusAfterPositioning
|
|
455
|
+
autoFocus: this.state.autoFocusAfterPositioning // Allow focus to escape when UI is within an iframe
|
|
456
|
+
,
|
|
457
|
+
crossFrame: false,
|
|
456
458
|
focusOptions: this.props.focusOptions
|
|
457
459
|
}, this.renderPopover(renderedContent)) : /*#__PURE__*/React.createElement(MoveFocusInside, {
|
|
458
|
-
disabled: !this.props.autoFocus
|
|
460
|
+
disabled: !this.props.autoFocus || !this.state.autoFocusAfterPositioning
|
|
459
461
|
}, this.renderPopover(renderedContent)))));
|
|
460
462
|
} else {
|
|
461
463
|
rendered.push( /*#__PURE__*/React.createElement(Hidden, {
|
package/es/progress-bar/index.js
CHANGED
|
@@ -8,4 +8,4 @@ export { default as ProgressBar } from './progressbar.js';
|
|
|
8
8
|
export { default as ProgressBarRounded } from './progressbar-rounded.js';
|
|
9
9
|
export { SIZE } from './constants.js'; // Styled elements
|
|
10
10
|
|
|
11
|
-
export { StyledRoot, StyledBarContainer, StyledBar, StyledBarProgress, StyledLabel, StyledProgressBarRoundedRoot, StyledProgressBarRoundedSvg, StyledProgressBarRoundedTrackBackground, StyledProgressBarRoundedTrackForeground, StyledProgressBarRoundedText } from './styled-components.js'; // Flow
|
|
11
|
+
export { StyledRoot, StyledBarContainer, StyledBar, StyledBarProgress, StyledInfiniteBar, StyledLabel, StyledProgressBarRoundedRoot, StyledProgressBarRoundedSvg, StyledProgressBarRoundedTrackBackground, StyledProgressBarRoundedTrackForeground, StyledProgressBarRoundedText } from './styled-components.js'; // Flow
|