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
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) Uber Technologies, Inc.
|
|
3
|
+
|
|
4
|
+
This source code is licensed under the MIT license found in the
|
|
5
|
+
LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
// @flow
|
|
8
|
+
import {styled} from '../styles/index.js';
|
|
9
|
+
import {
|
|
10
|
+
FLOATING_MARKER_ANCHOR_POSITIONS,
|
|
11
|
+
xSmallPinheadDimension,
|
|
12
|
+
} from './constants.js';
|
|
13
|
+
|
|
14
|
+
import type {AnchorPositionsT} from './types.js';
|
|
15
|
+
|
|
16
|
+
export const getAnchorTransform = (
|
|
17
|
+
anchor: AnchorPositionsT,
|
|
18
|
+
anchorSize: number,
|
|
19
|
+
) =>
|
|
20
|
+
({
|
|
21
|
+
[FLOATING_MARKER_ANCHOR_POSITIONS.none]: ``,
|
|
22
|
+
[FLOATING_MARKER_ANCHOR_POSITIONS.topLeft]: `translate(${anchorSize}px, ${anchorSize}px)`,
|
|
23
|
+
[FLOATING_MARKER_ANCHOR_POSITIONS.topRight]: `translate(-100%, ${anchorSize}px)`,
|
|
24
|
+
[FLOATING_MARKER_ANCHOR_POSITIONS.bottomLeft]: `translate(${anchorSize}px, -100%)`,
|
|
25
|
+
[FLOATING_MARKER_ANCHOR_POSITIONS.bottomRight]: `translate(-100%, -100%)`,
|
|
26
|
+
}[anchor]);
|
|
27
|
+
|
|
28
|
+
export const DragShadowContainer = styled<{
|
|
29
|
+
$height: number,
|
|
30
|
+
$width: number,
|
|
31
|
+
$dragging: boolean,
|
|
32
|
+
}>('div', ({$theme, $height, $width, $dragging}) => ({
|
|
33
|
+
width: `${$width}px`,
|
|
34
|
+
height: `${$height}px`,
|
|
35
|
+
opacity: $dragging ? 1 : 0,
|
|
36
|
+
visibility: $dragging ? 'visible' : 'hidden',
|
|
37
|
+
transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
|
|
38
|
+
position: 'relative',
|
|
39
|
+
boxShadow: $theme.lighting.shadow600,
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
export const DragShadow = styled<{
|
|
43
|
+
$background: string,
|
|
44
|
+
$width: number,
|
|
45
|
+
}>('div', ({$theme, $background, $width}) => ({
|
|
46
|
+
background: $background,
|
|
47
|
+
borderRadius: '50%',
|
|
48
|
+
width: `${$width}px`,
|
|
49
|
+
height: `${4}px`,
|
|
50
|
+
position: 'absolute',
|
|
51
|
+
bottom: 0,
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
export const Needle = styled<{
|
|
55
|
+
$background?: string,
|
|
56
|
+
$height: number,
|
|
57
|
+
}>('div', ({$theme, $background, $height}) => ({
|
|
58
|
+
background: $background,
|
|
59
|
+
width: '4px',
|
|
60
|
+
height: `${$height}px`,
|
|
61
|
+
boxShadow: $theme.lighting.shadow600,
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
export const FloatingMarkerRoot = styled<{}>('div', () => ({
|
|
65
|
+
position: 'relative',
|
|
66
|
+
height: `${xSmallPinheadDimension.height}px`,
|
|
67
|
+
width: `${xSmallPinheadDimension.height}px`,
|
|
68
|
+
}));
|
|
69
|
+
|
|
70
|
+
export const FloatingMarkerPinHeadContainer = styled<{
|
|
71
|
+
$anchor: AnchorPositionsT,
|
|
72
|
+
$anchorSize: number,
|
|
73
|
+
}>('div', ({$theme, $anchor, $anchorSize}) => ({
|
|
74
|
+
position: 'absolute',
|
|
75
|
+
transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
|
|
76
|
+
transform: getAnchorTransform($anchor, $anchorSize),
|
|
77
|
+
}));
|
|
78
|
+
|
|
79
|
+
export const FloatingMarkerAnchorContainer = styled<{}>('div', () => ({
|
|
80
|
+
position: 'absolute',
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
export const FixedMarkerRoot = styled<{}>('div', () => ({
|
|
84
|
+
display: 'flex',
|
|
85
|
+
alignItems: 'center',
|
|
86
|
+
flexDirection: 'column',
|
|
87
|
+
}));
|
|
88
|
+
|
|
89
|
+
export const FixedMarkerDragContainer = styled<{
|
|
90
|
+
$translateAmount: number,
|
|
91
|
+
$performTranslate: boolean,
|
|
92
|
+
}>('div', ({$theme, $translateAmount, $performTranslate}) => {
|
|
93
|
+
return {
|
|
94
|
+
transform: `translateY(${
|
|
95
|
+
$performTranslate ? '0px' : `${$translateAmount}px`
|
|
96
|
+
})`,
|
|
97
|
+
transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
|
|
98
|
+
display: 'flex',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
flexDirection: 'column',
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
export const OuterXSmallAnchor = styled<{
|
|
105
|
+
$round: boolean,
|
|
106
|
+
$background: string,
|
|
107
|
+
$size: number,
|
|
108
|
+
}>('div', ({$theme, $round, $background, $size}) => ({
|
|
109
|
+
background: $background,
|
|
110
|
+
display: 'flex',
|
|
111
|
+
alignItems: 'center',
|
|
112
|
+
justifyContent: 'center',
|
|
113
|
+
height: `${$size}px`,
|
|
114
|
+
width: `${$size}px`,
|
|
115
|
+
borderRadius: $round ? '50%' : 0,
|
|
116
|
+
boxShadow: $theme.lighting.shadow600,
|
|
117
|
+
}));
|
|
118
|
+
|
|
119
|
+
export const InnerXSmallAnchor = styled<{
|
|
120
|
+
$round: boolean,
|
|
121
|
+
$color: string,
|
|
122
|
+
$size: number,
|
|
123
|
+
}>('div', ({$round, $color, $size}) => ({
|
|
124
|
+
background: $color,
|
|
125
|
+
height: `${$size}px`,
|
|
126
|
+
width: `${$size}px`,
|
|
127
|
+
borderRadius: $round ? '50%' : 0,
|
|
128
|
+
}));
|
|
129
|
+
|
|
130
|
+
export const PinHead = styled<{
|
|
131
|
+
$height: number,
|
|
132
|
+
$background: string,
|
|
133
|
+
$gridTemplateColumns: string,
|
|
134
|
+
$type: string,
|
|
135
|
+
$forceCircle: boolean,
|
|
136
|
+
}>(
|
|
137
|
+
'div',
|
|
138
|
+
({
|
|
139
|
+
$theme,
|
|
140
|
+
$height,
|
|
141
|
+
$background,
|
|
142
|
+
$gridTemplateColumns,
|
|
143
|
+
$type,
|
|
144
|
+
$forceCircle,
|
|
145
|
+
}) => {
|
|
146
|
+
const sharedStyles = {
|
|
147
|
+
fixed: {
|
|
148
|
+
padding: '0px 12px',
|
|
149
|
+
borderRadius: `${$height}px`,
|
|
150
|
+
},
|
|
151
|
+
floating: {
|
|
152
|
+
padding: '0px 8px',
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
return {
|
|
157
|
+
background: $background,
|
|
158
|
+
height: `${$height}px`,
|
|
159
|
+
display: 'grid',
|
|
160
|
+
gridTemplateColumns: $gridTemplateColumns,
|
|
161
|
+
gap: '8px',
|
|
162
|
+
boxShadow: $theme.lighting.shadow600,
|
|
163
|
+
whiteSpace: 'nowrap',
|
|
164
|
+
...sharedStyles[$type],
|
|
165
|
+
...($forceCircle && {
|
|
166
|
+
width: `${$height}px`,
|
|
167
|
+
display: 'flex',
|
|
168
|
+
justifyContent: 'center',
|
|
169
|
+
boxSizing: 'border-box',
|
|
170
|
+
}),
|
|
171
|
+
};
|
|
172
|
+
},
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
declare var __DEV__: boolean;
|
|
176
|
+
declare var __NODE__: boolean;
|
|
177
|
+
declare var __BROWSER__: boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
var React = _interopRequireWildcard(require("react"));
|
|
6
|
+
|
|
7
|
+
var _constants = require("./constants.js");
|
|
8
|
+
|
|
9
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
10
|
+
|
|
11
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -0,0 +1,114 @@
|
|
|
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 {
|
|
10
|
+
FLOATING_MARKER_ANCHOR_POSITIONS,
|
|
11
|
+
NEEDLE_SIZES,
|
|
12
|
+
PINHEAD_SIZES_SHAPES,
|
|
13
|
+
FLOATING_MARKER_SIZES,
|
|
14
|
+
PINHEAD_TYPES,
|
|
15
|
+
FLOATING_MARKER_ANCHOR_TYPES,
|
|
16
|
+
} from './constants.js';
|
|
17
|
+
import type {OverrideT} from '../helpers/overrides.js';
|
|
18
|
+
|
|
19
|
+
export type PinHeadT = $Values<typeof PINHEAD_TYPES>;
|
|
20
|
+
|
|
21
|
+
export type AnchorPositionsT = $Values<typeof FLOATING_MARKER_ANCHOR_POSITIONS>;
|
|
22
|
+
|
|
23
|
+
export type NeedleSizeT = $Values<typeof NEEDLE_SIZES>;
|
|
24
|
+
|
|
25
|
+
export type PinHeadSizeT = $Values<typeof PINHEAD_SIZES_SHAPES>;
|
|
26
|
+
|
|
27
|
+
export type FloatingMarkerSizeT = $Values<typeof FLOATING_MARKER_SIZES>;
|
|
28
|
+
|
|
29
|
+
/* eslint-disable flowtype/generic-spacing*/
|
|
30
|
+
export type FloatingMarkerAnchorTypeT = $Values<
|
|
31
|
+
typeof FLOATING_MARKER_ANCHOR_TYPES,
|
|
32
|
+
>;
|
|
33
|
+
|
|
34
|
+
export type NeedlePropsT = {
|
|
35
|
+
size: NeedleSizeT,
|
|
36
|
+
background?: string,
|
|
37
|
+
overrides: FixedMarkerOverridesT,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type ItemPropsT = {
|
|
41
|
+
children?: React.Node,
|
|
42
|
+
color?: string,
|
|
43
|
+
size?: number,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type FixedMarkerOverridesT = {
|
|
47
|
+
Root?: OverrideT,
|
|
48
|
+
InnerAnchor?: OverrideT,
|
|
49
|
+
OuterAnchor?: OverrideT,
|
|
50
|
+
PinHead?: OverrideT,
|
|
51
|
+
PinHeadContent?: OverrideT,
|
|
52
|
+
PinHeadContainer?: OverrideT,
|
|
53
|
+
Needle?: OverrideT,
|
|
54
|
+
DragShadow?: OverrideT,
|
|
55
|
+
DragShadowContainer?: OverrideT,
|
|
56
|
+
DragContainer?: OverrideT,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export type FixedMarkerPropsT = {
|
|
60
|
+
size?: PinHeadSizeT,
|
|
61
|
+
needle?: NeedleSizeT,
|
|
62
|
+
label?: string,
|
|
63
|
+
startEnhancer?: React.AbstractComponent<{|size: number|}>,
|
|
64
|
+
endEnhancer?: React.AbstractComponent<{|size: number|}>,
|
|
65
|
+
color?: string,
|
|
66
|
+
background?: string,
|
|
67
|
+
dragging?: boolean,
|
|
68
|
+
overrides?: FixedMarkerOverridesT,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export type FloatingMarkerOverridesT = {
|
|
72
|
+
Root?: OverrideT,
|
|
73
|
+
InnerAnchor?: OverrideT,
|
|
74
|
+
OuterAnchor?: OverrideT,
|
|
75
|
+
PinHead?: OverrideT,
|
|
76
|
+
PinHeadContent?: OverrideT,
|
|
77
|
+
PinHeadContainer?: OverrideT,
|
|
78
|
+
AnchorContainer?: OverrideT,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export type FloatingMarkerPropsT = {
|
|
82
|
+
color?: string,
|
|
83
|
+
background?: string,
|
|
84
|
+
label?: string,
|
|
85
|
+
anchor?: AnchorPositionsT,
|
|
86
|
+
endEnhancer?: React.AbstractComponent<{|size: number|}>,
|
|
87
|
+
startEnhancer?: React.AbstractComponent<{|size: number|}>,
|
|
88
|
+
anchorType?: FloatingMarkerAnchorTypeT,
|
|
89
|
+
size?: FloatingMarkerSizeT,
|
|
90
|
+
overrides?: FloatingMarkerOverridesT,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export type PinHeadPropsT = {
|
|
94
|
+
size?: PinHeadSizeT,
|
|
95
|
+
label?: string,
|
|
96
|
+
endEnhancer?: React.AbstractComponent<{|size: number|}>,
|
|
97
|
+
startEnhancer?: React.AbstractComponent<{|size: number|}>,
|
|
98
|
+
color?: string,
|
|
99
|
+
background?: string,
|
|
100
|
+
type?: PinHeadT,
|
|
101
|
+
anchorType?: FloatingMarkerAnchorTypeT,
|
|
102
|
+
overrides?: FloatingMarkerOverridesT | FixedMarkerOverridesT,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export type DragShadowPropsT = {
|
|
106
|
+
background: string,
|
|
107
|
+
dragging: boolean,
|
|
108
|
+
height: number,
|
|
109
|
+
overrides: FixedMarkerOverridesT,
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
declare var __DEV__: boolean;
|
|
113
|
+
declare var __NODE__: boolean;
|
|
114
|
+
declare var __BROWSER__: boolean;
|
package/menu/index.d.ts
CHANGED
|
@@ -123,6 +123,7 @@ export interface OptionListProps extends BaseMenuPropsT {
|
|
|
123
123
|
item: any;
|
|
124
124
|
getItemLabel: (item: any) => React.ReactNode;
|
|
125
125
|
getChildMenu?: (item: any) => React.ReactNode;
|
|
126
|
+
onMouseDown?: (event: MouseEvent) => any;
|
|
126
127
|
onMouseEnter?: (event: MouseEvent) => any;
|
|
127
128
|
size?: OPTION_LIST_SIZE[keyof OPTION_LIST_SIZE];
|
|
128
129
|
overrides?: {
|
|
@@ -133,6 +134,12 @@ export interface OptionListProps extends BaseMenuPropsT {
|
|
|
133
134
|
resetMenu?: () => void;
|
|
134
135
|
$isHighlighted?: boolean;
|
|
135
136
|
$isFocused?: boolean;
|
|
137
|
+
renderAll?: boolean;
|
|
138
|
+
$disabled?: boolean;
|
|
139
|
+
'aria-disabled'?: boolean;
|
|
140
|
+
'aria-selected'?: boolean;
|
|
141
|
+
id?: string;
|
|
142
|
+
role?: string;
|
|
136
143
|
}
|
|
137
144
|
export const OptionList: React.FC<OptionListProps>;
|
|
138
145
|
|
package/menu/maybe-child-menu.js
CHANGED
|
@@ -55,6 +55,7 @@ function MaybeChildMenu(props) {
|
|
|
55
55
|
return /*#__PURE__*/React.createElement(_nestedMenus.NestedMenuContext.Consumer, null, function (ctx) {
|
|
56
56
|
return /*#__PURE__*/React.createElement(PopoverOverride, _extends({
|
|
57
57
|
focusLock: false,
|
|
58
|
+
autoFocus: false,
|
|
58
59
|
isOpen: props.isOpen,
|
|
59
60
|
renderAll: props.renderAll,
|
|
60
61
|
content: ChildMenu,
|
package/menu/types.js.flow
CHANGED
|
@@ -234,6 +234,8 @@ export type OptionListPropsT = {
|
|
|
234
234
|
getChildMenu?: (item: ItemT) => React.Node,
|
|
235
235
|
onClick?: (event: MouseEvent) => mixed,
|
|
236
236
|
/** Callback used to change highlighted index in stateful menu. */
|
|
237
|
+
onMouseDown?: (event: MouseEvent) => mixed,
|
|
238
|
+
/** Callback used to change highlighted index in stateful menu. */
|
|
237
239
|
onMouseEnter?: (event: MouseEvent) => mixed,
|
|
238
240
|
/** Renders UI in defined scale. */
|
|
239
241
|
size?: $Keys<typeof OPTION_LIST_SIZE>,
|
|
@@ -251,6 +253,16 @@ export type OptionListPropsT = {
|
|
|
251
253
|
$isFocused?: boolean,
|
|
252
254
|
/** Renders all menu content for SEO purposes regardless of menu state */
|
|
253
255
|
renderAll?: boolean,
|
|
256
|
+
/** Is the item disabled */
|
|
257
|
+
$disabled?: boolean,
|
|
258
|
+
/** Is the item disabled */
|
|
259
|
+
'aria-disabled'?: boolean,
|
|
260
|
+
/** Is the item selected */
|
|
261
|
+
'aria-selected'?: boolean,
|
|
262
|
+
/** Id of the item */
|
|
263
|
+
id?: string,
|
|
264
|
+
/** Accessibility role of the item */
|
|
265
|
+
role?: string,
|
|
254
266
|
};
|
|
255
267
|
|
|
256
268
|
export type OptionProfilePropsT = {
|
package/modal/index.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export interface ModalProps {
|
|
|
47
47
|
autofocus?: boolean;
|
|
48
48
|
autoFocus?: boolean;
|
|
49
49
|
focusLock?: boolean;
|
|
50
|
-
returnFocus?: boolean | FocusOptions;
|
|
50
|
+
returnFocus?: boolean | FocusOptions | ((returnTo: Element) => boolean | FocusOptions);
|
|
51
51
|
children?: React.ReactNode;
|
|
52
52
|
closeable?: boolean;
|
|
53
53
|
isOpen?: boolean;
|
package/modal/types.js.flow
CHANGED
|
@@ -48,7 +48,10 @@ export type ModalPropsT = {
|
|
|
48
48
|
* Optionally, can pass focus options instead of `true` to control the focus
|
|
49
49
|
* more precisely (ie. `{ preventScroll: true }`)
|
|
50
50
|
*/
|
|
51
|
-
returnFocus?:
|
|
51
|
+
returnFocus?:
|
|
52
|
+
| boolean
|
|
53
|
+
| FocusOptions
|
|
54
|
+
| ((returnTo: Element) => boolean | FocusOptions),
|
|
52
55
|
/** Modal content. The children-as-function API may be preferable
|
|
53
56
|
* for performance reasons (wont render until opened) */
|
|
54
57
|
children?: React.Node | (() => React.Node),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baseui",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.7.0",
|
|
4
4
|
"description": "A React Component library implementing the Base design language",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@commitlint/config-conventional": "^8.0.0",
|
|
82
82
|
"@date-io/luxon": "^2.7.0",
|
|
83
83
|
"@date-io/moment": "^2.7.0",
|
|
84
|
-
"@ladle/react": "^0.
|
|
84
|
+
"@ladle/react": "^0.3.0",
|
|
85
85
|
"@mdx-js/tag": "^0.20.0",
|
|
86
86
|
"@octokit/rest": "^16.33.1",
|
|
87
87
|
"@svgr/cli": "^4.3.2",
|
|
@@ -170,6 +170,7 @@
|
|
|
170
170
|
"react-dom": "^16.9.0",
|
|
171
171
|
"react-hook-form": "^7.9.0",
|
|
172
172
|
"react-icons": "^3.8.0",
|
|
173
|
+
"react-map-gl": "^6.1.17",
|
|
173
174
|
"react-markdown": "^4.0.3",
|
|
174
175
|
"react-twitter-embed": "^2.0.8",
|
|
175
176
|
"react-view": "^2.3.3",
|
|
@@ -196,10 +197,11 @@
|
|
|
196
197
|
"glob": "^7.1.6",
|
|
197
198
|
"just-extend": "^4.0.2",
|
|
198
199
|
"memoize-one": "^5.1.1",
|
|
200
|
+
"mockdate": "^3.0.5",
|
|
199
201
|
"polished": "^3.2.0",
|
|
200
202
|
"popper.js": "^1.16.0",
|
|
201
203
|
"react-dropzone": "^9.0.0",
|
|
202
|
-
"react-focus-lock": "^2.
|
|
204
|
+
"react-focus-lock": "^2.7.1",
|
|
203
205
|
"react-input-mask": "^2.0.4",
|
|
204
206
|
"react-is": "^16.8.6",
|
|
205
207
|
"react-movable": "^2.5.4",
|
package/popover/index.d.ts
CHANGED
|
@@ -96,7 +96,8 @@ export interface BasePopoverProps {
|
|
|
96
96
|
accessibilityType?: ACCESSIBILITY_TYPE[keyof ACCESSIBILITY_TYPE];
|
|
97
97
|
focusLock?: boolean;
|
|
98
98
|
autoFocus?: boolean;
|
|
99
|
-
|
|
99
|
+
focusOptions?: FocusOptions;
|
|
100
|
+
returnFocus?: boolean | FocusOptions | ((returnTo: Element) => (boolean | FocusOptions));
|
|
100
101
|
'data-baseweb'?: string;
|
|
101
102
|
id?: string;
|
|
102
103
|
ignoreBoundary?: boolean;
|
package/popover/popover.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
-
var _reactFocusLock =
|
|
10
|
+
var _reactFocusLock = _interopRequireWildcard(require("react-focus-lock"));
|
|
11
11
|
|
|
12
12
|
var _overrides = require("../helpers/overrides.js");
|
|
13
13
|
|
|
@@ -213,7 +213,7 @@ var PopoverInner = /*#__PURE__*/function (_React$Component) {
|
|
|
213
213
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
214
214
|
this.init(prevProps, prevState);
|
|
215
215
|
|
|
216
|
-
if (this.props.autoFocus &&
|
|
216
|
+
if (this.props.autoFocus && !this.state.autoFocusAfterPositioning && this.popperRef.current !== null && this.popperRef.current.getBoundingClientRect().top > 0) {
|
|
217
217
|
this.setState({
|
|
218
218
|
autoFocusAfterPositioning: true
|
|
219
219
|
});
|
|
@@ -529,9 +529,10 @@ var PopoverInner = /*#__PURE__*/function (_React$Component) {
|
|
|
529
529
|
disabled: !this.props.focusLock,
|
|
530
530
|
noFocusGuards: false // see popover-focus-loop.scenario.js for why hover cannot return focus
|
|
531
531
|
,
|
|
532
|
-
returnFocus: this.
|
|
533
|
-
autoFocus: this.state.autoFocusAfterPositioning
|
|
534
|
-
|
|
532
|
+
returnFocus: !this.isHoverTrigger() && this.props.returnFocus,
|
|
533
|
+
autoFocus: this.state.autoFocusAfterPositioning,
|
|
534
|
+
focusOptions: this.props.focusOptions
|
|
535
|
+
}, !this.props.focusLock && this.state.autoFocusAfterPositioning ? /*#__PURE__*/React.createElement(_reactFocusLock.MoveFocusInside, null, this.renderPopover(renderedContent)) : this.renderPopover(renderedContent)))));
|
|
535
536
|
} else {
|
|
536
537
|
rendered.push( /*#__PURE__*/React.createElement(_styledComponents.Hidden, {
|
|
537
538
|
key: "hidden-layer"
|
package/popover/popover.js.flow
CHANGED
|
@@ -8,7 +8,7 @@ LICENSE file in the root directory of this source tree.
|
|
|
8
8
|
/* eslint-disable react/no-find-dom-node */
|
|
9
9
|
/* eslint-disable cup/no-undef */
|
|
10
10
|
import * as React from 'react';
|
|
11
|
-
import FocusLock from 'react-focus-lock';
|
|
11
|
+
import FocusLock, {MoveFocusInside} from 'react-focus-lock';
|
|
12
12
|
|
|
13
13
|
import {getOverride, getOverrideProps} from '../helpers/overrides.js';
|
|
14
14
|
import {
|
|
@@ -73,7 +73,6 @@ class PopoverInner extends React.Component<
|
|
|
73
73
|
this.init(prevProps, prevState);
|
|
74
74
|
if (
|
|
75
75
|
this.props.autoFocus &&
|
|
76
|
-
this.props.focusLock &&
|
|
77
76
|
!this.state.autoFocusAfterPositioning &&
|
|
78
77
|
this.popperRef.current !== null &&
|
|
79
78
|
this.popperRef.current.getBoundingClientRect().top > 0
|
|
@@ -475,10 +474,18 @@ class PopoverInner extends React.Component<
|
|
|
475
474
|
disabled={!this.props.focusLock}
|
|
476
475
|
noFocusGuards={false}
|
|
477
476
|
// see popover-focus-loop.scenario.js for why hover cannot return focus
|
|
478
|
-
returnFocus={this.
|
|
477
|
+
returnFocus={!this.isHoverTrigger() && this.props.returnFocus}
|
|
479
478
|
autoFocus={this.state.autoFocusAfterPositioning}
|
|
479
|
+
focusOptions={this.props.focusOptions}
|
|
480
480
|
>
|
|
481
|
-
{this.
|
|
481
|
+
{!this.props.focusLock &&
|
|
482
|
+
this.state.autoFocusAfterPositioning ? (
|
|
483
|
+
<MoveFocusInside>
|
|
484
|
+
{this.renderPopover(renderedContent)}
|
|
485
|
+
</MoveFocusInside>
|
|
486
|
+
) : (
|
|
487
|
+
this.renderPopover(renderedContent)
|
|
488
|
+
)}
|
|
482
489
|
</FocusLock>
|
|
483
490
|
</TetherBehavior>
|
|
484
491
|
</Layer>,
|
|
@@ -70,6 +70,10 @@ var StatefulContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
70
70
|
_this.props.onBlur(e);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
if (_this.props.focusLock || _this.props.autoFocus) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
73
77
|
_this.close();
|
|
74
78
|
});
|
|
75
79
|
|
|
@@ -208,7 +212,8 @@ var StatefulContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
208
212
|
returnFocus = _this$props.returnFocus,
|
|
209
213
|
showArrow = _this$props.showArrow,
|
|
210
214
|
triggerType = _this$props.triggerType,
|
|
211
|
-
popoverMargin = _this$props.popoverMargin
|
|
215
|
+
popoverMargin = _this$props.popoverMargin,
|
|
216
|
+
focusOptions = _this$props.focusOptions;
|
|
212
217
|
var popoverProps = {
|
|
213
218
|
accessibilityType: accessibilityType,
|
|
214
219
|
autoFocus: autoFocus,
|
|
@@ -231,7 +236,8 @@ var StatefulContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
231
236
|
returnFocus: returnFocus,
|
|
232
237
|
showArrow: showArrow,
|
|
233
238
|
triggerType: triggerType,
|
|
234
|
-
popoverMargin: popoverMargin
|
|
239
|
+
popoverMargin: popoverMargin,
|
|
240
|
+
focusOptions: focusOptions
|
|
235
241
|
};
|
|
236
242
|
|
|
237
243
|
if (dismissOnClickOutside) {
|
|
@@ -52,6 +52,9 @@ class StatefulContainer extends React.Component<
|
|
|
52
52
|
if (this.props.onBlur) {
|
|
53
53
|
this.props.onBlur(e);
|
|
54
54
|
}
|
|
55
|
+
if (this.props.focusLock || this.props.autoFocus) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
55
58
|
this.close();
|
|
56
59
|
};
|
|
57
60
|
|
|
@@ -168,6 +171,7 @@ class StatefulContainer extends React.Component<
|
|
|
168
171
|
showArrow,
|
|
169
172
|
triggerType,
|
|
170
173
|
popoverMargin,
|
|
174
|
+
focusOptions,
|
|
171
175
|
} = this.props;
|
|
172
176
|
|
|
173
177
|
const popoverProps: PopoverPropsWithoutChildrenT = {
|
|
@@ -193,6 +197,7 @@ class StatefulContainer extends React.Component<
|
|
|
193
197
|
showArrow,
|
|
194
198
|
triggerType,
|
|
195
199
|
popoverMargin,
|
|
200
|
+
focusOptions,
|
|
196
201
|
};
|
|
197
202
|
|
|
198
203
|
if (dismissOnClickOutside) {
|
package/popover/types.js.flow
CHANGED
|
@@ -83,6 +83,8 @@ export type BasePopoverPropsT = {
|
|
|
83
83
|
onClick?: (e: Event) => mixed,
|
|
84
84
|
/** Handler for 'Esc' keypress events */
|
|
85
85
|
onFocus?: (e: Event) => mixed,
|
|
86
|
+
/** Pass FocusOptions for focusing (used as `HtmlElement.focus(focusOptions)`) */
|
|
87
|
+
focusOptions?: FocusOptions,
|
|
86
88
|
/** Handler for mouseenter events on trigger element. */
|
|
87
89
|
onMouseEnter?: (e: Event) => mixed,
|
|
88
90
|
/** Number of milliseconds to wait before showing the popover after mouse enters the trigger element (for triggerType `hover`). */
|
|
@@ -104,7 +106,10 @@ export type BasePopoverPropsT = {
|
|
|
104
106
|
/** If true, focus will shift back to the original element that triggered the popover
|
|
105
107
|
* Be careful with elements that open the popover on focus (e.g. input) this will cause the popover to reopen on close!
|
|
106
108
|
*/
|
|
107
|
-
returnFocus?:
|
|
109
|
+
returnFocus?:
|
|
110
|
+
| boolean
|
|
111
|
+
| FocusOptions
|
|
112
|
+
| ((returnTo: Element) => boolean | FocusOptions),
|
|
108
113
|
/** Whether or not to show the arrow pointing from the popover to the trigger. */
|
|
109
114
|
showArrow?: boolean,
|
|
110
115
|
/** Whether to toggle the popover when trigger is clicked or hovered. */
|
|
@@ -222,8 +222,8 @@ var EmoticonRating = /*#__PURE__*/function (_React$Component) {
|
|
|
222
222
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
|
223
223
|
"data-baseweb": "emoticon-rating",
|
|
224
224
|
role: "radiogroup",
|
|
225
|
-
onBlur: function onBlur() {
|
|
226
|
-
|
|
225
|
+
onBlur: function onBlur(e) {
|
|
226
|
+
if (!e.currentTarget.contains(e.relatedTarget)) _this2.updatePreview(undefined);
|
|
227
227
|
},
|
|
228
228
|
onMouseLeave: function onMouseLeave() {
|
|
229
229
|
return _this2.updatePreview(undefined);
|
|
@@ -135,7 +135,10 @@ class EmoticonRating extends React.Component<
|
|
|
135
135
|
<Root
|
|
136
136
|
data-baseweb="emoticon-rating"
|
|
137
137
|
role="radiogroup"
|
|
138
|
-
onBlur={
|
|
138
|
+
onBlur={e => {
|
|
139
|
+
if (!e.currentTarget.contains(e.relatedTarget))
|
|
140
|
+
this.updatePreview(undefined);
|
|
141
|
+
}}
|
|
139
142
|
onMouseLeave={() => this.updatePreview(undefined)}
|
|
140
143
|
{...rootProps}
|
|
141
144
|
>
|
package/rating/star-rating.js
CHANGED
|
@@ -225,8 +225,8 @@ var StarRating = /*#__PURE__*/function (_React$Component) {
|
|
|
225
225
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
|
226
226
|
"data-baseweb": "star-rating",
|
|
227
227
|
role: "radiogroup",
|
|
228
|
-
onBlur: function onBlur() {
|
|
229
|
-
|
|
228
|
+
onBlur: function onBlur(e) {
|
|
229
|
+
if (!e.currentTarget.contains(e.relatedTarget)) _this2.updatePreview(undefined);
|
|
230
230
|
},
|
|
231
231
|
onMouseLeave: function onMouseLeave() {
|
|
232
232
|
return _this2.updatePreview(undefined);
|
|
@@ -133,7 +133,10 @@ class StarRating extends React.Component<StarRatingPropsT, RatingStateT> {
|
|
|
133
133
|
<Root
|
|
134
134
|
data-baseweb="star-rating"
|
|
135
135
|
role="radiogroup"
|
|
136
|
-
onBlur={
|
|
136
|
+
onBlur={e => {
|
|
137
|
+
if (!e.currentTarget.contains(e.relatedTarget))
|
|
138
|
+
this.updatePreview(undefined);
|
|
139
|
+
}}
|
|
137
140
|
onMouseLeave={() => this.updatePreview(undefined)}
|
|
138
141
|
{...rootProps}
|
|
139
142
|
>
|