baseui 10.0.0 → 10.3.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/index.d.ts +24 -0
- package/app-nav-bar/mobile-menu.js +5 -3
- package/app-nav-bar/mobile-menu.js.flow +3 -2
- package/app-nav-bar/user-menu.js +5 -3
- package/app-nav-bar/user-menu.js.flow +3 -2
- package/block/index.d.ts +7 -0
- package/combobox/combobox.js +4 -9
- package/combobox/combobox.js.flow +4 -3
- package/combobox/index.d.ts +1 -1
- package/data-table/filter-menu.js +5 -3
- package/data-table/filter-menu.js.flow +3 -2
- package/data-table/header-cell.js +1 -1
- package/data-table/header-cell.js.flow +1 -1
- package/datepicker/calendar.js +6 -1
- package/datepicker/calendar.js.flow +4 -0
- package/datepicker/datepicker.js +1 -1
- package/datepicker/datepicker.js.flow +5 -2
- package/datepicker/index.d.ts +9 -1
- package/datepicker/month.js +2 -1
- package/datepicker/month.js.flow +8 -1
- package/datepicker/types.js.flow +13 -6
- package/es/app-nav-bar/mobile-menu.js +5 -5
- package/es/app-nav-bar/user-menu.js +5 -5
- package/es/combobox/combobox.js +4 -3
- package/es/data-table/filter-menu.js +3 -2
- package/es/data-table/header-cell.js +1 -1
- package/es/datepicker/calendar.js +6 -1
- package/es/datepicker/datepicker.js +1 -1
- package/es/datepicker/month.js +2 -1
- package/es/form-control/form-control.js +6 -14
- package/es/helper/helper.js +10 -6
- package/es/helpers/base-provider.js +4 -1
- package/es/input/input.js +9 -5
- package/es/layer/layer.js +5 -1
- package/es/layout-grid/grid.js +16 -10
- package/es/layout-grid/styled-components.js +24 -12
- package/es/list/index.js +1 -0
- package/es/list/list-heading.js +77 -0
- package/es/list/list-item.js +1 -1
- package/es/list/menu-adapter.js +4 -2
- package/es/list/styled-components.js +101 -4
- package/es/menu/stateful-container.js +41 -27
- package/es/phone-input/base-country-picker.js +2 -0
- package/es/popover/popover.js +21 -10
- package/es/select/select-component.js +34 -22
- package/es/table-semantic/styled-components.js +8 -10
- package/es/table-semantic/table-builder.js +3 -2
- package/es/table-semantic/table.js +1 -0
- package/es/tag/index.js +1 -1
- package/es/tag/styled-components.js +2 -4
- package/es/tag/tag.js +16 -16
- package/es/textarea/textarea.js +1 -2
- package/es/themes/dark-theme/color-semantic-tokens.js +18 -8
- package/es/themes/light-theme/color-semantic-tokens.js +14 -4
- package/es/tokens/colors.js +3 -3
- package/es/tree-view/tree-view.js +0 -2
- package/esm/app-nav-bar/mobile-menu.js +5 -3
- package/esm/app-nav-bar/user-menu.js +5 -3
- package/esm/combobox/combobox.js +4 -7
- package/esm/data-table/filter-menu.js +4 -3
- package/esm/data-table/header-cell.js +1 -1
- package/esm/datepicker/calendar.js +6 -1
- package/esm/datepicker/datepicker.js +1 -1
- package/esm/datepicker/month.js +2 -1
- package/esm/form-control/form-control.js +21 -33
- package/esm/helper/helper.js +10 -6
- package/esm/helpers/base-provider.js +4 -1
- package/esm/input/input.js +9 -5
- package/esm/layer/layer.js +5 -1
- package/esm/layout-grid/grid.js +20 -10
- package/esm/layout-grid/styled-components.js +52 -35
- package/esm/list/index.js +1 -0
- package/esm/list/list-heading.js +116 -0
- package/esm/list/list-item.js +1 -1
- package/esm/list/menu-adapter.js +4 -2
- package/esm/list/styled-components.js +99 -3
- package/esm/menu/stateful-container.js +56 -40
- package/esm/phone-input/base-country-picker.js +2 -0
- package/esm/popover/popover.js +25 -16
- package/esm/select/select-component.js +87 -79
- package/esm/table-semantic/styled-components.js +8 -10
- package/esm/table-semantic/table-builder.js +3 -2
- package/esm/table-semantic/table.js +1 -0
- package/esm/tag/index.js +1 -1
- package/esm/tag/styled-components.js +2 -4
- package/esm/tag/tag.js +18 -16
- package/esm/textarea/textarea.js +1 -2
- package/esm/themes/dark-theme/color-semantic-tokens.js +18 -8
- package/esm/themes/light-theme/color-semantic-tokens.js +14 -4
- package/esm/tokens/colors.js +3 -3
- package/esm/tree-view/tree-view.js +0 -2
- package/form-control/form-control.js +21 -35
- package/form-control/form-control.js.flow +37 -35
- package/helper/helper.js +10 -6
- package/helper/helper.js.flow +1 -0
- package/helpers/base-provider.js +5 -1
- package/helpers/base-provider.js.flow +4 -1
- package/index.d.ts +1 -0
- package/input/input.js +9 -5
- package/input/input.js.flow +9 -5
- package/layer/layer.js +5 -1
- package/layer/layer.js.flow +3 -1
- package/layer/types.js.flow +4 -0
- package/layout-grid/grid.js +19 -9
- package/layout-grid/grid.js.flow +52 -26
- package/layout-grid/index.d.ts +1 -0
- package/layout-grid/styled-components.js +54 -36
- package/layout-grid/styled-components.js.flow +48 -24
- package/layout-grid/types.js.flow +12 -0
- package/list/index.js +9 -0
- package/list/index.js.flow +1 -0
- package/list/list-heading.js +124 -0
- package/list/list-heading.js.flow +138 -0
- package/list/list-item.js +1 -1
- package/list/list-item.js.flow +1 -1
- package/list/menu-adapter.js +5 -2
- package/list/menu-adapter.js.flow +21 -11
- package/list/styled-components.js +108 -5
- package/list/styled-components.js.flow +103 -2
- package/list/types.js.flow +22 -0
- package/menu/stateful-container.js +57 -42
- package/menu/stateful-container.js.flow +38 -26
- package/package.json +1 -1
- package/phone-input/base-country-picker.js +2 -0
- package/phone-input/base-country-picker.js.flow +2 -0
- package/popover/popover.js +26 -17
- package/popover/popover.js.flow +19 -7
- package/select/select-component.js +87 -79
- package/select/select-component.js.flow +119 -103
- package/snackbar/index.d.ts +3 -3
- package/snackbar/types.js.flow +1 -1
- package/table-semantic/index.d.ts +1 -0
- package/table-semantic/styled-components.js +8 -10
- package/table-semantic/styled-components.js.flow +20 -20
- package/table-semantic/table-builder.js +3 -2
- package/table-semantic/table-builder.js.flow +3 -2
- package/table-semantic/table.js +1 -0
- package/table-semantic/table.js.flow +1 -0
- package/tag/index.d.ts +0 -1
- package/tag/index.js +0 -6
- package/tag/index.js.flow +0 -1
- package/tag/styled-components.js +3 -6
- package/tag/styled-components.js.flow +0 -2
- package/tag/tag.js +19 -14
- package/tag/tag.js.flow +13 -19
- package/textarea/textarea.js +1 -2
- package/textarea/textarea.js.flow +0 -1
- package/theme.ts +12 -0
- package/themes/dark-theme/color-semantic-tokens.js +18 -8
- package/themes/dark-theme/color-semantic-tokens.js.flow +18 -7
- package/themes/light-theme/color-semantic-tokens.js +14 -4
- package/themes/light-theme/color-semantic-tokens.js.flow +14 -3
- package/themes/types.js.flow +11 -0
- package/toast/index.d.ts +1 -0
- package/tokens/colors.js +3 -3
- package/tokens/colors.js.flow +3 -3
- package/tree-view/tree-view.js +0 -2
- package/tree-view/tree-view.js.flow +0 -1
- package/es/utils/get-bui-id.js +0 -33
- package/esm/utils/get-bui-id.js +0 -33
- package/utils/get-bui-id.js +0 -41
- package/utils/get-bui-id.js.flow +0 -39
package/app-nav-bar/index.d.ts
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import {Override} from '../overrides';
|
|
3
|
+
|
|
4
|
+
export interface AppNavBarOverridesT {
|
|
5
|
+
Root?: Override<any>;
|
|
6
|
+
AppName?: Override<any>;
|
|
7
|
+
MainMenuItem?: Override<any>;
|
|
8
|
+
PrimaryMenuContainer?: Override<any>;
|
|
9
|
+
ProfileTileContainer?: Override<any>;
|
|
10
|
+
SecondaryMenuContainer?: Override<any>;
|
|
11
|
+
Spacing?: Override<any>;
|
|
12
|
+
SubnavContainer?: Override<any>;
|
|
13
|
+
UserMenuProfileListItem?: Override<any>;
|
|
14
|
+
UserProfileInfoContainer?: Override<any>;
|
|
15
|
+
UserProfilePictureContainer?: Override<any>;
|
|
16
|
+
UserProfileTileContainer?: Override<any>;
|
|
17
|
+
|
|
18
|
+
// nested overrides
|
|
19
|
+
MobileDrawer?: Override<any>;
|
|
20
|
+
MobileMenu?: Override<any>;
|
|
21
|
+
SideMenuButton?: Override<any>;
|
|
22
|
+
UserMenuButton?: Override<any>;
|
|
23
|
+
UserMenu?: Override<any>;
|
|
24
|
+
}
|
|
2
25
|
|
|
3
26
|
export type NavItemT = {
|
|
4
27
|
active?: boolean;
|
|
@@ -26,6 +49,7 @@ export type AppNavBarPropsT = UserMenuPropsT & {
|
|
|
26
49
|
mainItems?: NavItemT[];
|
|
27
50
|
mapItemToNode?: (item: NavItemT) => React.ReactNode;
|
|
28
51
|
onMainItemSelect?: (item: NavItemT) => any;
|
|
52
|
+
overrides?: AppNavBarOverridesT;
|
|
29
53
|
title?: React.ReactNode;
|
|
30
54
|
};
|
|
31
55
|
|
|
@@ -200,12 +200,14 @@ function MobileMenu(props) {
|
|
|
200
200
|
boxShadow: 'none'
|
|
201
201
|
}
|
|
202
202
|
},
|
|
203
|
-
ListItem: function
|
|
204
|
-
return /*#__PURE__*/React.createElement(MobileNavMenuItem, _extends({
|
|
203
|
+
ListItem: /*#__PURE__*/React.forwardRef(function (listItemProps, ref) {
|
|
204
|
+
return /*#__PURE__*/React.createElement(MobileNavMenuItem, _extends({
|
|
205
|
+
ref: ref
|
|
206
|
+
}, listItemProps, {
|
|
205
207
|
mapItemToNode: mapItemToNode,
|
|
206
208
|
overrides: overrides
|
|
207
209
|
}));
|
|
208
|
-
}
|
|
210
|
+
})
|
|
209
211
|
}, // $FlowFixMe
|
|
210
212
|
menuProps.overrides);
|
|
211
213
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SideMenuButton, _extends({
|
|
@@ -164,15 +164,16 @@ export default function MobileMenu(props: AppNavBarPropsT) {
|
|
|
164
164
|
boxShadow: 'none',
|
|
165
165
|
},
|
|
166
166
|
},
|
|
167
|
-
ListItem(listItemProps) {
|
|
167
|
+
ListItem: React.forwardRef((listItemProps, ref) => {
|
|
168
168
|
return (
|
|
169
169
|
<MobileNavMenuItem
|
|
170
|
+
ref={ref}
|
|
170
171
|
{...listItemProps}
|
|
171
172
|
mapItemToNode={mapItemToNode}
|
|
172
173
|
overrides={overrides}
|
|
173
174
|
/>
|
|
174
175
|
);
|
|
175
|
-
},
|
|
176
|
+
}),
|
|
176
177
|
},
|
|
177
178
|
// $FlowFixMe
|
|
178
179
|
menuProps.overrides,
|
package/app-nav-bar/user-menu.js
CHANGED
|
@@ -132,11 +132,13 @@ function UserMenuComponent(props) {
|
|
|
132
132
|
width: MENU_ITEM_WIDTH
|
|
133
133
|
}
|
|
134
134
|
},
|
|
135
|
-
ListItem: function
|
|
136
|
-
return /*#__PURE__*/React.createElement(UserMenuListItem, _extends({
|
|
135
|
+
ListItem: /*#__PURE__*/React.forwardRef(function (listItemProps, ref) {
|
|
136
|
+
return /*#__PURE__*/React.createElement(UserMenuListItem, _extends({
|
|
137
|
+
ref: ref
|
|
138
|
+
}, listItemProps, {
|
|
137
139
|
mapItemToNode: props.mapItemToNode
|
|
138
140
|
}));
|
|
139
|
-
}
|
|
141
|
+
})
|
|
140
142
|
}, // $FlowFixMe
|
|
141
143
|
userMenuProps.overrides);
|
|
142
144
|
return /*#__PURE__*/React.createElement(_index5.StatefulPopover, {
|
|
@@ -94,14 +94,15 @@ export default function UserMenuComponent(props: {|
|
|
|
94
94
|
)),
|
|
95
95
|
style: {width: MENU_ITEM_WIDTH},
|
|
96
96
|
},
|
|
97
|
-
ListItem(listItemProps) {
|
|
97
|
+
ListItem: React.forwardRef((listItemProps, ref) => {
|
|
98
98
|
return (
|
|
99
99
|
<UserMenuListItem
|
|
100
|
+
ref={ref}
|
|
100
101
|
{...listItemProps}
|
|
101
102
|
mapItemToNode={props.mapItemToNode}
|
|
102
103
|
/>
|
|
103
104
|
);
|
|
104
|
-
},
|
|
105
|
+
}),
|
|
105
106
|
},
|
|
106
107
|
// $FlowFixMe
|
|
107
108
|
userMenuProps.overrides,
|
package/block/index.d.ts
CHANGED
|
@@ -219,7 +219,14 @@ export interface BlockProps {
|
|
|
219
219
|
$style?: $StyleProp<BlockProps>;
|
|
220
220
|
overrides?: BlockOverrides;
|
|
221
221
|
color?: Responsive<string>;
|
|
222
|
+
backgroundAttachment?: Responsive<string>;
|
|
223
|
+
backgroundClip?: Responsive<string>;
|
|
222
224
|
backgroundColor?: Responsive<string>;
|
|
225
|
+
backgroundImage?: Responsive<string>;
|
|
226
|
+
backgroundOrigin?: Responsive<string>;
|
|
227
|
+
backgroundPosition?: Responsive<string>;
|
|
228
|
+
backgroundRepeat?: Responsive<string>;
|
|
229
|
+
backgroundSize?: Responsive<string>;
|
|
223
230
|
font?: string | string[];
|
|
224
231
|
src?: string;
|
|
225
232
|
ref?: React.Ref<any>;
|
package/combobox/combobox.js
CHANGED
|
@@ -17,12 +17,10 @@ var _overrides = require("../helpers/overrides.js");
|
|
|
17
17
|
|
|
18
18
|
var _index2 = require("../popover/index.js");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _reactUid = require("react-uid");
|
|
21
21
|
|
|
22
22
|
var _styledComponents = require("./styled-components.js");
|
|
23
23
|
|
|
24
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
24
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
27
25
|
|
|
28
26
|
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; }
|
|
@@ -95,12 +93,9 @@ function Combobox(props) {
|
|
|
95
93
|
var inputRef = React.useRef(null);
|
|
96
94
|
var listboxRef = React.useRef(null);
|
|
97
95
|
var selectedOptionRef = React.useRef(null);
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
var listboxId = React.useMemo(function () {
|
|
102
|
-
return (0, _getBuiId.default)();
|
|
103
|
-
}, []); // Handles case where an application wants to update the value in the input element
|
|
96
|
+
var seed = (0, _reactUid.useUIDSeed)();
|
|
97
|
+
var activeDescendantId = seed('descendant');
|
|
98
|
+
var listboxId = seed('listbox'); // Handles case where an application wants to update the value in the input element
|
|
104
99
|
// from outside of the combobox component.
|
|
105
100
|
|
|
106
101
|
React.useEffect(function () {
|
|
@@ -12,7 +12,7 @@ import {Input, SIZE} from '../input/index.js';
|
|
|
12
12
|
import {scrollItemIntoView} from '../menu/utils.js';
|
|
13
13
|
import {getOverrides} from '../helpers/overrides.js';
|
|
14
14
|
import {Popover, PLACEMENT} from '../popover/index.js';
|
|
15
|
-
import
|
|
15
|
+
import {useUIDSeed} from 'react-uid';
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
18
|
StyledRoot,
|
|
@@ -59,8 +59,9 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
|
|
|
59
59
|
const listboxRef = React.useRef(null);
|
|
60
60
|
const selectedOptionRef = React.useRef(null);
|
|
61
61
|
|
|
62
|
-
const
|
|
63
|
-
const
|
|
62
|
+
const seed = useUIDSeed();
|
|
63
|
+
const activeDescendantId = seed('descendant');
|
|
64
|
+
const listboxId = seed('listbox');
|
|
64
65
|
|
|
65
66
|
// Handles case where an application wants to update the value in the input element
|
|
66
67
|
// from outside of the combobox component.
|
package/combobox/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export type PropsT<OptionT = unknown> = {
|
|
|
29
29
|
onChange?: (value: string, option: OptionT | null) => any;
|
|
30
30
|
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => any;
|
|
31
31
|
onSubmit?: (params: {closeListbox: () => void; value: string}) => any;
|
|
32
|
-
options: OptionT;
|
|
32
|
+
options: OptionT[];
|
|
33
33
|
overrides?: ComboboxOverrides;
|
|
34
34
|
size?: SIZE[keyof SIZE];
|
|
35
35
|
value: string;
|
|
@@ -17,7 +17,7 @@ var _index4 = require("../popover/index.js");
|
|
|
17
17
|
|
|
18
18
|
var _index5 = require("../styles/index.js");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _reactUid = require("react-uid");
|
|
21
21
|
|
|
22
22
|
var _constants = require("./constants.js");
|
|
23
23
|
|
|
@@ -88,8 +88,10 @@ function Options(props) {
|
|
|
88
88
|
focusVisible = _React$useState2[0],
|
|
89
89
|
setFocusVisible = _React$useState2[1];
|
|
90
90
|
|
|
91
|
-
var
|
|
92
|
-
|
|
91
|
+
var seed = (0, _reactUid.useUIDSeed)();
|
|
92
|
+
|
|
93
|
+
var buiRef = _react.default.useRef(props.columns.map(function (col) {
|
|
94
|
+
return seed(col);
|
|
93
95
|
}));
|
|
94
96
|
|
|
95
97
|
var handleFocus = function handleFocus(event) {
|
|
@@ -12,7 +12,7 @@ import {Filter as FilterIcon} from '../icon/index.js';
|
|
|
12
12
|
import {Input, SIZE as INPUT_SIZE} from '../input/index.js';
|
|
13
13
|
import {Popover, PLACEMENT} from '../popover/index.js';
|
|
14
14
|
import {useStyletron} from '../styles/index.js';
|
|
15
|
-
import
|
|
15
|
+
import {useUIDSeed} from 'react-uid';
|
|
16
16
|
|
|
17
17
|
import {COLUMNS} from './constants.js';
|
|
18
18
|
import {matchesQuery} from './text-search.js';
|
|
@@ -63,7 +63,8 @@ function Options(props: OptionsPropsT) {
|
|
|
63
63
|
}, [inputRef.current]);
|
|
64
64
|
|
|
65
65
|
const [focusVisible, setFocusVisible] = React.useState(false);
|
|
66
|
-
const
|
|
66
|
+
const seed = useUIDSeed();
|
|
67
|
+
const buiRef = React.useRef(props.columns.map(col => seed(col)));
|
|
67
68
|
|
|
68
69
|
const handleFocus = (event: SyntheticEvent<>) => {
|
|
69
70
|
if (isFocusVisible(event)) {
|
|
@@ -75,7 +75,7 @@ var HeaderCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
75
75
|
ref: ref,
|
|
76
76
|
role: "button",
|
|
77
77
|
tabIndex: "0",
|
|
78
|
-
className: css(_objectSpread(_objectSpread({}, theme.typography.
|
|
78
|
+
className: css(_objectSpread(_objectSpread({}, theme.typography.font350), {}, {
|
|
79
79
|
alignItems: 'center',
|
|
80
80
|
backgroundColor: backgroundColor,
|
|
81
81
|
boxSizing: 'border-box',
|
|
@@ -62,7 +62,7 @@ const HeaderCell = React.forwardRef<HeaderCellPropsT, HTMLDivElement>(
|
|
|
62
62
|
role="button"
|
|
63
63
|
tabIndex="0"
|
|
64
64
|
className={css({
|
|
65
|
-
...theme.typography.
|
|
65
|
+
...theme.typography.font350,
|
|
66
66
|
alignItems: 'center',
|
|
67
67
|
backgroundColor,
|
|
68
68
|
boxSizing: 'border-box',
|
package/datepicker/calendar.js
CHANGED
|
@@ -448,7 +448,8 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
448
448
|
onChange: _this.handleDateChange,
|
|
449
449
|
overrides: overrides,
|
|
450
450
|
value: _this.props.value,
|
|
451
|
-
peekNextMonth: _this.props.peekNextMonth
|
|
451
|
+
peekNextMonth: _this.props.peekNextMonth,
|
|
452
|
+
fixedHeight: _this.props.fixedHeight
|
|
452
453
|
})));
|
|
453
454
|
monthList.push( /*#__PURE__*/React.createElement("div", {
|
|
454
455
|
key: "month-component-".concat(i)
|
|
@@ -552,6 +553,10 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
552
553
|
}
|
|
553
554
|
}
|
|
554
555
|
}
|
|
556
|
+
|
|
557
|
+
if (_this.props.onQuickSelectChange) {
|
|
558
|
+
_this.props.onQuickSelectChange(params.option);
|
|
559
|
+
}
|
|
555
560
|
},
|
|
556
561
|
options: _this.props.quickSelectOptions || [{
|
|
557
562
|
id: locale.datepicker.pastWeek,
|
|
@@ -466,6 +466,7 @@ export default class Calendar<T = Date> extends React.Component<
|
|
|
466
466
|
overrides={overrides}
|
|
467
467
|
value={this.props.value}
|
|
468
468
|
peekNextMonth={this.props.peekNextMonth}
|
|
469
|
+
fixedHeight={this.props.fixedHeight}
|
|
469
470
|
/>
|
|
470
471
|
</CalendarContainer>,
|
|
471
472
|
);
|
|
@@ -578,6 +579,9 @@ export default class Calendar<T = Date> extends React.Component<
|
|
|
578
579
|
}
|
|
579
580
|
}
|
|
580
581
|
}
|
|
582
|
+
if (this.props.onQuickSelectChange) {
|
|
583
|
+
this.props.onQuickSelectChange(params.option);
|
|
584
|
+
}
|
|
581
585
|
}}
|
|
582
586
|
options={
|
|
583
587
|
this.props.quickSelectOptions || [
|
package/datepicker/datepicker.js
CHANGED
|
@@ -510,7 +510,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
510
510
|
InputWrapper = _getOverrides6[0],
|
|
511
511
|
inputWrapperProps = _getOverrides6[1];
|
|
512
512
|
|
|
513
|
-
var placeholder = this.props.placeholder ||
|
|
513
|
+
var placeholder = this.props.placeholder || this.props.placeholder === '' ? this.props.placeholder : this.props.range ? 'YYYY/MM/DD – YYYY/MM/DD' : 'YYYY/MM/DD';
|
|
514
514
|
return /*#__PURE__*/React.createElement(_index3.LocaleContext.Consumer, null, function (locale) {
|
|
515
515
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PopoverComponent, _extends({
|
|
516
516
|
focusLock: false,
|
|
@@ -407,8 +407,11 @@ export default class Datepicker<T = Date> extends React.Component<
|
|
|
407
407
|
);
|
|
408
408
|
|
|
409
409
|
const placeholder =
|
|
410
|
-
this.props.placeholder ||
|
|
411
|
-
|
|
410
|
+
this.props.placeholder || this.props.placeholder === ''
|
|
411
|
+
? this.props.placeholder
|
|
412
|
+
: this.props.range
|
|
413
|
+
? 'YYYY/MM/DD – YYYY/MM/DD'
|
|
414
|
+
: 'YYYY/MM/DD';
|
|
412
415
|
|
|
413
416
|
return (
|
|
414
417
|
<LocaleContext.Consumer>
|
package/datepicker/index.d.ts
CHANGED
|
@@ -49,12 +49,18 @@ export class StatefulContainer extends React.Component<
|
|
|
49
49
|
): void;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
export interface QuickSelectOption {
|
|
53
|
+
id: string;
|
|
54
|
+
beginDate: Date;
|
|
55
|
+
endDate?: Date;
|
|
56
|
+
}
|
|
57
|
+
|
|
52
58
|
export interface CalendarProps {
|
|
53
59
|
autoFocusCalendar?: boolean;
|
|
54
60
|
dateLabel?: (day: Date) => React.ReactNode;
|
|
55
61
|
excludeDates?: Date[];
|
|
56
62
|
quickSelect?: boolean;
|
|
57
|
-
quickSelectOptions?: Array<
|
|
63
|
+
quickSelectOptions?: Array<QuickSelectOption>;
|
|
58
64
|
filterDate?: (day: Date) => boolean;
|
|
59
65
|
highlightedDate?: Date;
|
|
60
66
|
includeDates?: Date[];
|
|
@@ -70,6 +76,7 @@ export interface CalendarProps {
|
|
|
70
76
|
onMonthChange?: (args: {date: Date}) => any;
|
|
71
77
|
onYearChange?: (args: {date: Date}) => any;
|
|
72
78
|
onChange?: onChange;
|
|
79
|
+
onQuickSelectChange?: (option?: QuickSelectOption) => any;
|
|
73
80
|
orientation?: ORIENTATION[keyof ORIENTATION];
|
|
74
81
|
overrides?: DatepickerOverrides<SharedStylePropsT>;
|
|
75
82
|
peekNextMonth?: boolean;
|
|
@@ -77,6 +84,7 @@ export interface CalendarProps {
|
|
|
77
84
|
timeSelectEnd?: boolean;
|
|
78
85
|
trapTabbing?: boolean;
|
|
79
86
|
value?: Date | Date[] | null;
|
|
87
|
+
fixedHeight?: boolean;
|
|
80
88
|
}
|
|
81
89
|
export interface CalendarState {
|
|
82
90
|
highlightedDate: Date;
|
package/datepicker/month.js
CHANGED
|
@@ -79,6 +79,7 @@ var defaultProps = {
|
|
|
79
79
|
peekNextMonth: false,
|
|
80
80
|
value: null
|
|
81
81
|
};
|
|
82
|
+
var CALENDAR_MAX_ROWS = 6;
|
|
82
83
|
|
|
83
84
|
var CalendarMonth = /*#__PURE__*/function (_React$Component) {
|
|
84
85
|
_inherits(CalendarMonth, _React$Component);
|
|
@@ -114,7 +115,7 @@ var CalendarMonth = /*#__PURE__*/function (_React$Component) {
|
|
|
114
115
|
var i = 0;
|
|
115
116
|
var isWithinMonth = true;
|
|
116
117
|
|
|
117
|
-
while (isWithinMonth) {
|
|
118
|
+
while (isWithinMonth || _this.props.fixedHeight && _this.props.peekNextMonth && i < CALENDAR_MAX_ROWS) {
|
|
118
119
|
weeks.push( /*#__PURE__*/React.createElement(_week.default, {
|
|
119
120
|
adapter: _this.props.adapter,
|
|
120
121
|
date: currentWeekStart,
|
package/datepicker/month.js.flow
CHANGED
|
@@ -34,6 +34,8 @@ const defaultProps = {
|
|
|
34
34
|
value: null,
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
const CALENDAR_MAX_ROWS = 6;
|
|
38
|
+
|
|
37
39
|
export default class CalendarMonth<T = Date> extends React.Component<
|
|
38
40
|
MonthPropsT<T>,
|
|
39
41
|
> {
|
|
@@ -68,7 +70,12 @@ export default class CalendarMonth<T = Date> extends React.Component<
|
|
|
68
70
|
let i = 0;
|
|
69
71
|
let isWithinMonth = true;
|
|
70
72
|
|
|
71
|
-
while (
|
|
73
|
+
while (
|
|
74
|
+
isWithinMonth ||
|
|
75
|
+
(this.props.fixedHeight &&
|
|
76
|
+
this.props.peekNextMonth &&
|
|
77
|
+
i < CALENDAR_MAX_ROWS)
|
|
78
|
+
) {
|
|
72
79
|
weeks.push(
|
|
73
80
|
<Week
|
|
74
81
|
adapter={this.props.adapter}
|
package/datepicker/types.js.flow
CHANGED
|
@@ -116,7 +116,9 @@ export type WeekPropsT<T = Date> = {
|
|
|
116
116
|
value: ?T | Array<T>,
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
-
export type MonthPropsT<T = Date> = WeekPropsT<T
|
|
119
|
+
export type MonthPropsT<T = Date> = WeekPropsT<T> & {
|
|
120
|
+
fixedHeight?: boolean,
|
|
121
|
+
};
|
|
120
122
|
|
|
121
123
|
export type CalendarInternalState<T = Date> = {
|
|
122
124
|
highlightedDate: T,
|
|
@@ -135,11 +137,7 @@ export type CalendarPropsT<T = Date> = {
|
|
|
135
137
|
/** Display select for quickly choosing date ranges. `range` must be true as well. */
|
|
136
138
|
quickSelect?: boolean,
|
|
137
139
|
/** Array of custom options displayed in the quick select. Overrides default options if provided. */
|
|
138
|
-
quickSelectOptions?: Array<
|
|
139
|
-
id: string,
|
|
140
|
-
beginDate: T,
|
|
141
|
-
endDate?: T,
|
|
142
|
-
}>,
|
|
140
|
+
quickSelectOptions?: Array<QuickSelectOption<T>>,
|
|
143
141
|
/** A filter function that is called to check the disabled state of a day. If `false` is returned the day is considered to be disabled. */
|
|
144
142
|
filterDate?: ?(day: T) => boolean,
|
|
145
143
|
/** A function that is called with the current date to render the label text under that day on the calendar. */
|
|
@@ -173,6 +171,8 @@ export type CalendarPropsT<T = Date> = {
|
|
|
173
171
|
onYearChange?: ({date: T}) => mixed,
|
|
174
172
|
/** Event handler that is called when a new date is selected. */
|
|
175
173
|
onChange?: onChangeT<T>,
|
|
174
|
+
/** Event handler that is called when a selection is made using the quick select menu. */
|
|
175
|
+
onQuickSelectChange?: (option?: QuickSelectOption<T>) => mixed,
|
|
176
176
|
/** Sets the orientation of the calendar when multiple months are displayed */
|
|
177
177
|
orientation?: $Values<typeof ORIENTATION>,
|
|
178
178
|
overrides?: DatepickerOverridesT,
|
|
@@ -186,6 +186,7 @@ export type CalendarPropsT<T = Date> = {
|
|
|
186
186
|
trapTabbing?: boolean,
|
|
187
187
|
/** Currently selected date. */
|
|
188
188
|
value?: ?T | Array<T>,
|
|
189
|
+
fixedHeight?: boolean,
|
|
189
190
|
};
|
|
190
191
|
|
|
191
192
|
export type HeaderPropsT<T = Date> = CalendarPropsT<T> & {
|
|
@@ -193,6 +194,12 @@ export type HeaderPropsT<T = Date> = CalendarPropsT<T> & {
|
|
|
193
194
|
order: number,
|
|
194
195
|
};
|
|
195
196
|
|
|
197
|
+
export type QuickSelectOption<T> = {
|
|
198
|
+
id: string,
|
|
199
|
+
beginDate: T,
|
|
200
|
+
endDate?: T,
|
|
201
|
+
};
|
|
202
|
+
|
|
196
203
|
export type DatepickerPropsT<T = Date> = CalendarPropsT<T> & {
|
|
197
204
|
'aria-label'?: string,
|
|
198
205
|
'aria-labelledby'?: string,
|
|
@@ -119,14 +119,14 @@ export default function MobileMenu(props) {
|
|
|
119
119
|
boxShadow: 'none'
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
ListItem: /*#__PURE__*/React.forwardRef((listItemProps, ref) => {
|
|
123
|
+
return /*#__PURE__*/React.createElement(MobileNavMenuItem, _extends({
|
|
124
|
+
ref: ref
|
|
125
|
+
}, listItemProps, {
|
|
125
126
|
mapItemToNode: mapItemToNode,
|
|
126
127
|
overrides: overrides
|
|
127
128
|
}));
|
|
128
|
-
}
|
|
129
|
-
|
|
129
|
+
})
|
|
130
130
|
}, // $FlowFixMe
|
|
131
131
|
menuProps.overrides);
|
|
132
132
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SideMenuButton, _extends({
|
|
@@ -75,13 +75,13 @@ export default function UserMenuComponent(props) {
|
|
|
75
75
|
width: MENU_ITEM_WIDTH
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
ListItem: /*#__PURE__*/React.forwardRef((listItemProps, ref) => {
|
|
79
|
+
return /*#__PURE__*/React.createElement(UserMenuListItem, _extends({
|
|
80
|
+
ref: ref
|
|
81
|
+
}, listItemProps, {
|
|
81
82
|
mapItemToNode: props.mapItemToNode
|
|
82
83
|
}));
|
|
83
|
-
}
|
|
84
|
-
|
|
84
|
+
})
|
|
85
85
|
}, // $FlowFixMe
|
|
86
86
|
userMenuProps.overrides);
|
|
87
87
|
return /*#__PURE__*/React.createElement(StatefulPopover, {
|
package/es/combobox/combobox.js
CHANGED
|
@@ -11,7 +11,7 @@ import { Input, SIZE } from '../input/index.js';
|
|
|
11
11
|
import { scrollItemIntoView } from '../menu/utils.js';
|
|
12
12
|
import { getOverrides } from '../helpers/overrides.js';
|
|
13
13
|
import { Popover, PLACEMENT } from '../popover/index.js';
|
|
14
|
-
import
|
|
14
|
+
import { useUIDSeed } from 'react-uid';
|
|
15
15
|
import { StyledRoot, StyledInputContainer, StyledListBox, StyledListItem } from './styled-components.js';
|
|
16
16
|
const ENTER = 13;
|
|
17
17
|
const ESCAPE = 27;
|
|
@@ -46,8 +46,9 @@ function Combobox(props) {
|
|
|
46
46
|
const inputRef = React.useRef(null);
|
|
47
47
|
const listboxRef = React.useRef(null);
|
|
48
48
|
const selectedOptionRef = React.useRef(null);
|
|
49
|
-
const
|
|
50
|
-
const
|
|
49
|
+
const seed = useUIDSeed();
|
|
50
|
+
const activeDescendantId = seed('descendant');
|
|
51
|
+
const listboxId = seed('listbox'); // Handles case where an application wants to update the value in the input element
|
|
51
52
|
// from outside of the combobox component.
|
|
52
53
|
|
|
53
54
|
React.useEffect(() => {
|
|
@@ -10,7 +10,7 @@ import { Filter as FilterIcon } from '../icon/index.js';
|
|
|
10
10
|
import { Input, SIZE as INPUT_SIZE } from '../input/index.js';
|
|
11
11
|
import { Popover, PLACEMENT } from '../popover/index.js';
|
|
12
12
|
import { useStyletron } from '../styles/index.js';
|
|
13
|
-
import
|
|
13
|
+
import { useUIDSeed } from 'react-uid';
|
|
14
14
|
import { COLUMNS } from './constants.js';
|
|
15
15
|
import { matchesQuery } from './text-search.js';
|
|
16
16
|
import { LocaleContext } from '../locale/index.js';
|
|
@@ -46,7 +46,8 @@ function Options(props) {
|
|
|
46
46
|
}
|
|
47
47
|
}, [inputRef.current]);
|
|
48
48
|
const [focusVisible, setFocusVisible] = React.useState(false);
|
|
49
|
-
const
|
|
49
|
+
const seed = useUIDSeed();
|
|
50
|
+
const buiRef = React.useRef(props.columns.map(col => seed(col)));
|
|
50
51
|
|
|
51
52
|
const handleFocus = event => {
|
|
52
53
|
if (isFocusVisible(event)) {
|
|
@@ -33,7 +33,7 @@ const HeaderCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
33
33
|
ref: ref,
|
|
34
34
|
role: "button",
|
|
35
35
|
tabIndex: "0",
|
|
36
|
-
className: css({ ...theme.typography.
|
|
36
|
+
className: css({ ...theme.typography.font350,
|
|
37
37
|
alignItems: 'center',
|
|
38
38
|
backgroundColor,
|
|
39
39
|
boxSizing: 'border-box',
|
|
@@ -351,7 +351,8 @@ export default class Calendar extends React.Component {
|
|
|
351
351
|
onChange: this.handleDateChange,
|
|
352
352
|
overrides: overrides,
|
|
353
353
|
value: this.props.value,
|
|
354
|
-
peekNextMonth: this.props.peekNextMonth
|
|
354
|
+
peekNextMonth: this.props.peekNextMonth,
|
|
355
|
+
fixedHeight: this.props.fixedHeight
|
|
355
356
|
})));
|
|
356
357
|
monthList.push( /*#__PURE__*/React.createElement("div", {
|
|
357
358
|
key: `month-component-${i}`
|
|
@@ -431,6 +432,10 @@ export default class Calendar extends React.Component {
|
|
|
431
432
|
}
|
|
432
433
|
}
|
|
433
434
|
}
|
|
435
|
+
|
|
436
|
+
if (this.props.onQuickSelectChange) {
|
|
437
|
+
this.props.onQuickSelectChange(params.option);
|
|
438
|
+
}
|
|
434
439
|
},
|
|
435
440
|
options: this.props.quickSelectOptions || [{
|
|
436
441
|
id: locale.datepicker.pastWeek,
|
|
@@ -393,7 +393,7 @@ export default class Datepicker extends React.Component {
|
|
|
393
393
|
const [InputComponent, inputProps] = getOverrides(overrides.Input, MaskedInput);
|
|
394
394
|
const [PopoverComponent, popoverProps] = getOverrides(overrides.Popover, Popover);
|
|
395
395
|
const [InputWrapper, inputWrapperProps] = getOverrides(overrides.InputWrapper, StyledInputWrapper);
|
|
396
|
-
const placeholder = this.props.placeholder ||
|
|
396
|
+
const placeholder = this.props.placeholder || this.props.placeholder === '' ? this.props.placeholder : this.props.range ? 'YYYY/MM/DD – YYYY/MM/DD' : 'YYYY/MM/DD';
|
|
397
397
|
return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, locale => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PopoverComponent, _extends({
|
|
398
398
|
focusLock: false,
|
|
399
399
|
mountNode: this.props.mountNode,
|
package/es/datepicker/month.js
CHANGED
|
@@ -32,6 +32,7 @@ const defaultProps = {
|
|
|
32
32
|
peekNextMonth: false,
|
|
33
33
|
value: null
|
|
34
34
|
};
|
|
35
|
+
const CALENDAR_MAX_ROWS = 6;
|
|
35
36
|
export default class CalendarMonth extends React.Component {
|
|
36
37
|
constructor(props) {
|
|
37
38
|
super(props);
|
|
@@ -54,7 +55,7 @@ export default class CalendarMonth extends React.Component {
|
|
|
54
55
|
let i = 0;
|
|
55
56
|
let isWithinMonth = true;
|
|
56
57
|
|
|
57
|
-
while (isWithinMonth) {
|
|
58
|
+
while (isWithinMonth || this.props.fixedHeight && this.props.peekNextMonth && i < CALENDAR_MAX_ROWS) {
|
|
58
59
|
weeks.push( /*#__PURE__*/React.createElement(Week, {
|
|
59
60
|
adapter: this.props.adapter,
|
|
60
61
|
date: currentWeekStart,
|
|
@@ -10,7 +10,7 @@ LICENSE file in the root directory of this source tree.
|
|
|
10
10
|
*/
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
import { getOverride, getOverrideProps } from '../helpers/overrides.js';
|
|
13
|
-
import
|
|
13
|
+
import { UIDConsumer } from 'react-uid';
|
|
14
14
|
import { Label as StyledLabel, Caption as StyledCaption, ControlContainer as StyledControlContainer } from './styled-components.js';
|
|
15
15
|
|
|
16
16
|
function chooseRenderedHint(caption, error, positive, sharedProps) {
|
|
@@ -30,14 +30,6 @@ function chooseRenderedHint(caption, error, positive, sharedProps) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export default class FormControl extends React.Component {
|
|
33
|
-
constructor(...args) {
|
|
34
|
-
super(...args);
|
|
35
|
-
|
|
36
|
-
_defineProperty(this, "state", {
|
|
37
|
-
captionId: getBuiId()
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
33
|
render() {
|
|
42
34
|
const {
|
|
43
35
|
overrides: {
|
|
@@ -74,23 +66,23 @@ export default class FormControl extends React.Component {
|
|
|
74
66
|
return /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(Label, _extends({
|
|
75
67
|
"data-baseweb": "form-control-label",
|
|
76
68
|
htmlFor: htmlFor || onlyChildProps.id
|
|
77
|
-
}, sharedProps, getOverrideProps(LabelOverride)), typeof label === 'function' ? label(sharedProps) : label), /*#__PURE__*/React.createElement(ControlContainer, _extends({
|
|
69
|
+
}, sharedProps, getOverrideProps(LabelOverride)), typeof label === 'function' ? label(sharedProps) : label), /*#__PURE__*/React.createElement(UIDConsumer, null, captionId => /*#__PURE__*/React.createElement(ControlContainer, _extends({
|
|
78
70
|
"data-baseweb": "form-control-container"
|
|
79
71
|
}, sharedProps, getOverrideProps(ControlContainerOverride)), React.Children.map(children, (child, index) => {
|
|
80
72
|
if (!child) return;
|
|
81
73
|
const key = child.key || String(index);
|
|
82
74
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
83
75
|
key,
|
|
84
|
-
'aria-errormessage': error ?
|
|
85
|
-
'aria-describedby': caption || positive ?
|
|
76
|
+
'aria-errormessage': error ? captionId : null,
|
|
77
|
+
'aria-describedby': caption || positive ? captionId : null,
|
|
86
78
|
disabled: onlyChildProps.disabled || disabled,
|
|
87
79
|
error: typeof onlyChildProps.error !== 'undefined' ? onlyChildProps.error : error,
|
|
88
80
|
positive: typeof onlyChildProps.positive !== 'undefined' ? onlyChildProps.positive : positive
|
|
89
81
|
});
|
|
90
82
|
}), (caption || error || positive) && /*#__PURE__*/React.createElement(Caption, _extends({
|
|
91
83
|
"data-baseweb": "form-control-caption",
|
|
92
|
-
id:
|
|
93
|
-
}, sharedProps, getOverrideProps(CaptionOverride)), hint)));
|
|
84
|
+
id: captionId
|
|
85
|
+
}, sharedProps, getOverrideProps(CaptionOverride)), hint))));
|
|
94
86
|
}
|
|
95
87
|
|
|
96
88
|
}
|