baseui 0.0.0-next-831b4fe → 0.0.0-next-2aecb6f
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 +1 -1
- package/a11y/a11y.js.flow +1 -1
- package/accordion/accordion.js +3 -2
- package/accordion/accordion.js.flow +4 -3
- package/accordion/panel.js +1 -1
- package/accordion/panel.js.flow +1 -1
- package/accordion/types.js.flow +2 -1
- package/app-nav-bar/types.js.flow +3 -3
- package/aspect-ratio-box/aspect-ratio-box.js +1 -1
- package/aspect-ratio-box/aspect-ratio-box.js.flow +2 -2
- package/block/block.js +1 -1
- package/block/block.js.flow +1 -1
- package/block/styled-components.js.flow +3 -2
- package/button/button.js.flow +3 -4
- package/button/types.js.flow +4 -2
- package/button-group/button-group.js.flow +1 -1
- package/checkbox/stateful-checkbox-container.js.flow +3 -3
- package/checkbox/stateful-checkbox.js.flow +5 -2
- package/checkbox/types.js.flow +22 -4
- package/combobox/combobox.js +4 -4
- package/combobox/combobox.js.flow +4 -4
- package/combobox/types.js.flow +3 -1
- package/data-table/column-datetime.js +6 -6
- package/data-table/column-datetime.js.flow +7 -7
- package/data-table/data-table.js +4 -4
- package/data-table/data-table.js.flow +4 -4
- package/data-table/filter-menu.js.flow +2 -2
- package/data-table/types.js.flow +3 -3
- package/datepicker/calendar-header.js +1 -1
- package/datepicker/calendar-header.js.flow +1 -1
- package/datepicker/calendar.js.flow +2 -2
- package/datepicker/day.js.flow +1 -1
- package/datepicker/styled-components.js +2 -2
- package/datepicker/styled-components.js.flow +2 -2
- package/datepicker/types.js.flow +2 -2
- package/datepicker/utils/date-helpers.js.flow +9 -9
- package/datepicker/utils/index.js +1 -1
- package/datepicker/utils/index.js.flow +1 -1
- package/drawer/drawer.js +1 -1
- package/drawer/drawer.js.flow +1 -1
- package/drawer/types.js.flow +1 -1
- package/es/a11y/a11y.js +1 -1
- package/es/accordion/accordion.js +2 -1
- package/es/accordion/panel.js +1 -1
- package/es/aspect-ratio-box/aspect-ratio-box.js +1 -1
- package/es/block/block.js +1 -1
- package/es/checkbox/stateful-checkbox-container.js +0 -3
- package/es/combobox/combobox.js +4 -4
- package/es/data-table/column-datetime.js +6 -6
- package/es/data-table/data-table.js +4 -4
- package/es/datepicker/calendar-header.js +1 -1
- package/es/datepicker/styled-components.js +2 -2
- package/es/datepicker/utils/index.js +1 -1
- package/es/drawer/drawer.js +1 -1
- package/es/flex-grid/flex-grid-item.js +5 -3
- package/es/flex-grid/flex-grid.js +1 -1
- package/es/form-control/form-control.js +4 -4
- package/es/helpers/overrides.js +7 -7
- package/es/icon/omit-dollar-prefixed-keys.js +1 -1
- package/es/input/stateful-container.js +0 -1
- package/es/layer/layer.js +4 -2
- package/es/list/list-heading.js +3 -3
- package/es/list/list-item.js +1 -1
- package/es/menu/option-profile.js +2 -0
- package/es/menu/stateful-container.js +2 -4
- package/es/menu/types.js +1 -1
- package/es/modal/modal.js +1 -1
- package/es/pagination/stateful-container.js +1 -0
- package/es/pagination/stateful-pagination.js +1 -0
- package/es/phone-input/country-select-dropdown.js +5 -4
- package/es/popover/popover.js +4 -6
- package/es/radio/radiogroup.js +1 -1
- package/es/rating/emoticon-rating.js +1 -1
- package/es/rating/star-rating.js +1 -1
- package/es/select/dropdown.js +1 -1
- package/es/select/multi-value.js +1 -1
- package/es/select/select-component.js +3 -3
- package/es/select/value.js +1 -1
- package/es/slider/slider.js +2 -2
- package/es/snackbar/snackbar-element.js +1 -1
- package/es/styles/__mocks__/styled.js +1 -1
- package/es/styles/styled.js +7 -7
- package/es/tabs/tabs.js +2 -2
- package/es/tag/tag.js +1 -1
- package/es/toast/toaster.js +1 -1
- package/es/tree-view/tree-node.js +1 -1
- package/es/tree-view/tree-view.js +6 -6
- package/es/utils/deep-merge.js +2 -2
- package/es/utils/deprecated-component.js +5 -3
- package/esm/a11y/a11y.js +1 -1
- package/esm/accordion/accordion.js +3 -2
- package/esm/accordion/panel.js +1 -1
- package/esm/aspect-ratio-box/aspect-ratio-box.js +1 -1
- package/esm/block/block.js +1 -1
- package/esm/combobox/combobox.js +4 -4
- package/esm/data-table/column-datetime.js +6 -6
- package/esm/data-table/data-table.js +4 -4
- package/esm/datepicker/calendar-header.js +1 -1
- package/esm/datepicker/styled-components.js +2 -2
- package/esm/datepicker/utils/index.js +1 -1
- package/esm/drawer/drawer.js +1 -1
- package/esm/flex-grid/flex-grid-item.js +4 -2
- package/esm/flex-grid/flex-grid.js +1 -1
- package/esm/form-control/form-control.js +4 -4
- package/esm/helpers/overrides.js +7 -7
- package/esm/icon/omit-dollar-prefixed-keys.js +1 -1
- package/esm/input/stateful-container.js +0 -1
- package/esm/layer/layer.js +4 -2
- package/esm/list/list-heading.js +3 -3
- package/esm/list/list-item.js +1 -1
- package/esm/menu/option-profile.js +2 -0
- package/esm/menu/stateful-container.js +2 -4
- package/esm/menu/types.js +1 -1
- package/esm/modal/modal.js +1 -1
- package/esm/pagination/stateful-container.js +1 -0
- package/esm/pagination/stateful-pagination.js +1 -0
- package/esm/phone-input/country-select-dropdown.js +5 -4
- package/esm/popover/popover.js +4 -6
- package/esm/radio/radiogroup.js +1 -1
- package/esm/rating/emoticon-rating.js +1 -1
- package/esm/rating/star-rating.js +1 -1
- package/esm/select/dropdown.js +1 -1
- package/esm/select/multi-value.js +1 -1
- package/esm/select/select-component.js +3 -3
- package/esm/select/value.js +1 -1
- package/esm/slider/slider.js +2 -2
- package/esm/snackbar/snackbar-element.js +1 -1
- package/esm/styles/__mocks__/styled.js +1 -1
- package/esm/styles/styled.js +7 -7
- package/esm/tabs/tabs.js +2 -2
- package/esm/tag/tag.js +1 -1
- package/esm/toast/toaster.js +1 -1
- package/esm/tree-view/tree-node.js +1 -1
- package/esm/tree-view/tree-view.js +6 -6
- package/esm/utils/deep-merge.js +2 -2
- package/esm/utils/deprecated-component.js +5 -3
- package/file-uploader/types.js.flow +2 -2
- package/flex-grid/flex-grid-item.js +4 -2
- package/flex-grid/flex-grid-item.js.flow +5 -4
- package/flex-grid/flex-grid.js +1 -1
- package/flex-grid/flex-grid.js.flow +1 -1
- package/form-control/form-control.js +4 -4
- package/form-control/form-control.js.flow +4 -4
- package/helpers/overrides.js +7 -7
- package/helpers/overrides.js.flow +10 -10
- package/helpers/react-helpers.js.flow +1 -1
- package/icon/omit-dollar-prefixed-keys.js +1 -1
- package/icon/omit-dollar-prefixed-keys.js.flow +1 -1
- package/input/base-input.js.flow +1 -1
- package/input/stateful-container.js +0 -1
- package/input/stateful-container.js.flow +0 -1
- package/input/stateful-input.js.flow +2 -2
- package/input/types.js.flow +15 -9
- package/input/utils.js.flow +7 -2
- package/layer/layer.js +4 -2
- package/layer/layer.js.flow +3 -2
- package/layer/layers-manager.js.flow +2 -2
- package/layer/types.js.flow +1 -1
- package/list/index.d.ts +4 -13
- package/list/list-heading.js +3 -3
- package/list/list-heading.js.flow +3 -3
- package/list/list-item.js +1 -1
- package/list/list-item.js.flow +1 -1
- package/list/types.js.flow +1 -1
- package/menu/maybe-child-menu.js.flow +3 -2
- package/menu/option-list.js.flow +4 -1
- package/menu/option-profile.js +2 -0
- package/menu/option-profile.js.flow +3 -1
- package/menu/stateful-container.js +2 -4
- package/menu/stateful-container.js.flow +9 -8
- package/menu/types.js.flow +8 -7
- package/modal/modal.js +1 -1
- package/modal/modal.js.flow +1 -1
- package/modal/types.js.flow +1 -1
- package/package.json +1 -1
- package/pagination/stateful-container.js +1 -0
- package/pagination/stateful-container.js.flow +2 -2
- package/pagination/stateful-pagination.js +1 -0
- package/pagination/stateful-pagination.js.flow +2 -2
- package/pagination/types.js.flow +8 -4
- package/payment-card/stateful-payment-card.js.flow +2 -1
- package/phone-input/country-select-dropdown.js +4 -4
- package/phone-input/country-select-dropdown.js.flow +8 -5
- package/phone-input/types.js.flow +4 -5
- package/popover/popover.js +4 -2
- package/popover/popover.js.flow +19 -8
- package/popover/types.js.flow +3 -4
- package/progress-bar/progressbar.js.flow +1 -1
- package/radio/radio.js.flow +2 -2
- package/radio/radiogroup.js +1 -1
- package/radio/radiogroup.js.flow +4 -1
- package/radio/types.js.flow +2 -1
- package/rating/emoticon-rating.js +1 -1
- package/rating/emoticon-rating.js.flow +1 -1
- package/rating/star-rating.js +1 -1
- package/rating/star-rating.js.flow +1 -1
- package/select/dropdown.js +1 -1
- package/select/dropdown.js.flow +1 -1
- package/select/multi-value.js +1 -1
- package/select/multi-value.js.flow +1 -1
- package/select/select-component.js +3 -4
- package/select/select-component.js.flow +8 -7
- package/select/types.js.flow +6 -5
- package/select/utils/index.js.flow +1 -5
- package/select/value.js +1 -1
- package/select/value.js.flow +1 -1
- package/side-navigation/stateful-container.js.flow +2 -2
- package/side-navigation/types.js.flow +4 -4
- package/slider/index.js.flow +1 -0
- package/slider/slider.js +2 -2
- package/slider/slider.js.flow +4 -2
- package/slider/types.js.flow +1 -1
- package/snackbar/snackbar-element.js +1 -1
- package/snackbar/snackbar-element.js.flow +1 -1
- package/styles/as-primary-export-hoc.js.flow +1 -1
- package/styles/styled.js +7 -7
- package/styles/styled.js.flow +9 -9
- package/tabs/tabs.js +2 -2
- package/tabs/tabs.js.flow +2 -2
- package/tabs/types.js.flow +1 -1
- package/tag/styled-components.js.flow +0 -1
- package/tag/tag.js +1 -1
- package/tag/tag.js.flow +1 -1
- package/textarea/types.js.flow +4 -2
- package/toast/styled-components.js.flow +1 -1
- package/toast/toaster.js +1 -1
- package/toast/toaster.js.flow +1 -1
- package/tree-view/tree-node.js +1 -1
- package/tree-view/tree-node.js.flow +1 -1
- package/tree-view/tree-view.js +6 -6
- package/tree-view/tree-view.js.flow +13 -11
- package/tree-view/types.js.flow +5 -3
- package/tree-view/utils.js.flow +1 -1
- package/utils/deep-merge.js +2 -2
- package/utils/deep-merge.js.flow +2 -2
- package/utils/deprecated-component.js +5 -3
- package/utils/deprecated-component.js.flow +5 -3
- package/utils/focusVisible.js.flow +2 -2
package/a11y/a11y.js
CHANGED
package/a11y/a11y.js.flow
CHANGED
|
@@ -136,7 +136,7 @@ export default function A11y(props: {children: React.Node}) {
|
|
|
136
136
|
<span ref={child}>{props.children}</span>
|
|
137
137
|
<div>
|
|
138
138
|
{violationsByNode.map(([node, violations], index) => (
|
|
139
|
-
//
|
|
139
|
+
// flowlint-next-line unclear-type:off
|
|
140
140
|
<Violation target={node} violations={(violations: any)} key={index} />
|
|
141
141
|
))}
|
|
142
142
|
</div>
|
package/accordion/accordion.js
CHANGED
|
@@ -92,7 +92,8 @@ var Accordion = /*#__PURE__*/function (_React$Component) {
|
|
|
92
92
|
|
|
93
93
|
_createClass(Accordion, [{
|
|
94
94
|
key: "onPanelChange",
|
|
95
|
-
value:
|
|
95
|
+
value: //flowlint-next-line unclear-type:off
|
|
96
|
+
function onPanelChange(key, onChange) {
|
|
96
97
|
var activeKeys = this.state.expanded;
|
|
97
98
|
var accordion = this.props.accordion;
|
|
98
99
|
|
|
@@ -144,7 +145,7 @@ var Accordion = /*#__PURE__*/function (_React$Component) {
|
|
|
144
145
|
children = _this$props2.children,
|
|
145
146
|
renderPanelContent = _this$props2.renderPanelContent,
|
|
146
147
|
renderAll = _this$props2.renderAll,
|
|
147
|
-
overrides = _this$props2.overrides; //
|
|
148
|
+
overrides = _this$props2.overrides; // flowlint-next-line unclear-type:off
|
|
148
149
|
|
|
149
150
|
return React.Children.map(children, function (child, index) {
|
|
150
151
|
if (!child) return; // If there is no key provided use the panel order as a default key
|
|
@@ -38,7 +38,8 @@ export default class Accordion extends React.Component<
|
|
|
38
38
|
...this.props.initialState,
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
//flowlint-next-line unclear-type:off
|
|
42
|
+
onPanelChange(key: React.Key, onChange: () => {}, ...args: Array<any>) {
|
|
42
43
|
let activeKeys = this.state.expanded;
|
|
43
44
|
const {accordion} = this.props;
|
|
44
45
|
if (accordion) {
|
|
@@ -77,8 +78,8 @@ export default class Accordion extends React.Component<
|
|
|
77
78
|
renderAll,
|
|
78
79
|
overrides,
|
|
79
80
|
} = this.props;
|
|
80
|
-
//
|
|
81
|
-
return React.Children.map(children, (child:
|
|
81
|
+
// flowlint-next-line unclear-type:off
|
|
82
|
+
return React.Children.map(children, (child: any, index) => {
|
|
82
83
|
if (!child) return;
|
|
83
84
|
// If there is no key provided use the panel order as a default key
|
|
84
85
|
const key = child.key || String(index);
|
package/accordion/panel.js
CHANGED
|
@@ -116,7 +116,7 @@ var Panel = function Panel(_ref) {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
typeof onKeyDown === 'function' && onKeyDown(e);
|
|
119
|
-
}, [expanded, disabled, onChange, onKeyDown]); //
|
|
119
|
+
}, [expanded, disabled, onChange, onKeyDown]); // flowlint-next-line unclear-type:off
|
|
120
120
|
|
|
121
121
|
var _animateRef = React.useRef(null);
|
|
122
122
|
|
package/accordion/panel.js.flow
CHANGED
package/accordion/types.js.flow
CHANGED
|
@@ -57,7 +57,8 @@ export type AccordionOnChangeHandlerT = ({
|
|
|
57
57
|
expanded: Array<React.Key>,
|
|
58
58
|
}) => mixed;
|
|
59
59
|
|
|
60
|
-
type
|
|
60
|
+
//flowlint-next-line unclear-type:off
|
|
61
|
+
type ChildrenT = React.ChildrenArray<React.Element<any>>;
|
|
61
62
|
|
|
62
63
|
export type AccordionPropsT = {
|
|
63
64
|
/** Determines how many panels may be expanded at a time. If set to
|
|
@@ -35,13 +35,13 @@ export type OverridesT = {|
|
|
|
35
35
|
|
|
36
36
|
export type NavItemT = {|
|
|
37
37
|
active?: boolean,
|
|
38
|
-
//
|
|
38
|
+
// flowlint-next-line unclear-type:off
|
|
39
39
|
icon?: React.AbstractComponent<any>,
|
|
40
|
-
//
|
|
40
|
+
// flowlint-next-line unclear-type:off
|
|
41
41
|
info?: any,
|
|
42
42
|
label: string,
|
|
43
43
|
children?: NavItemT[],
|
|
44
|
-
//
|
|
44
|
+
// flowlint-next-line unclear-type:off
|
|
45
45
|
navExitIcon?: React.AbstractComponent<any>,
|
|
46
46
|
navPosition?: {
|
|
47
47
|
desktop?: $Values<typeof POSITION>,
|
|
@@ -60,7 +60,7 @@ var AspectRatioBox = function AspectRatioBox(_ref2) {
|
|
|
60
60
|
var blockOverrides = (0, _overrides.mergeOverrides)(aspectRatioBoxOverrides, overrides);
|
|
61
61
|
return /*#__PURE__*/React.createElement(_index.Block // coerced to any because of how react components are typed.
|
|
62
62
|
// cannot guarantee an html element
|
|
63
|
-
//
|
|
63
|
+
// flowlint-next-line unclear-type:off
|
|
64
64
|
, _extends({
|
|
65
65
|
ref: forwardedRef,
|
|
66
66
|
overrides: blockOverrides,
|
|
@@ -35,7 +35,7 @@ const AspectRatioBox = ({
|
|
|
35
35
|
aspectRatio = 1,
|
|
36
36
|
overrides = {},
|
|
37
37
|
...restProps
|
|
38
|
-
}: //
|
|
38
|
+
}: // flowlint-next-line unclear-type:off
|
|
39
39
|
AspectRatioBoxPropsT & {forwardedRef: any}): React.Node => {
|
|
40
40
|
const aspectRatioBoxOverrides = {
|
|
41
41
|
Block: {
|
|
@@ -47,7 +47,7 @@ AspectRatioBoxPropsT & {forwardedRef: any}): React.Node => {
|
|
|
47
47
|
<Block
|
|
48
48
|
// coerced to any because of how react components are typed.
|
|
49
49
|
// cannot guarantee an html element
|
|
50
|
-
//
|
|
50
|
+
// flowlint-next-line unclear-type:off
|
|
51
51
|
ref={(forwardedRef: any)}
|
|
52
52
|
overrides={blockOverrides}
|
|
53
53
|
$aspectRatio={aspectRatio}
|
package/block/block.js
CHANGED
|
@@ -116,7 +116,7 @@ function Block(_ref) {
|
|
|
116
116
|
|
|
117
117
|
return /*#__PURE__*/React.createElement(BaseBlock // coerced to any because because of how react components are typed.
|
|
118
118
|
// cannot guarantee an html element
|
|
119
|
-
//
|
|
119
|
+
// flowlint-next-line unclear-type:off
|
|
120
120
|
, _extends({
|
|
121
121
|
ref: forwardedRef,
|
|
122
122
|
$as: as,
|
package/block/block.js.flow
CHANGED
|
@@ -93,7 +93,7 @@ function Block({
|
|
|
93
93
|
<BaseBlock
|
|
94
94
|
// coerced to any because because of how react components are typed.
|
|
95
95
|
// cannot guarantee an html element
|
|
96
|
-
//
|
|
96
|
+
// flowlint-next-line unclear-type:off
|
|
97
97
|
ref={(forwardedRef: any)}
|
|
98
98
|
$as={as}
|
|
99
99
|
$color={color}
|
|
@@ -22,8 +22,9 @@ function constrainToNull(value) {
|
|
|
22
22
|
|
|
23
23
|
type ApplyParams = {
|
|
24
24
|
property: string,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
// flowlint-next-line unclear-type:off
|
|
26
|
+
value?: any | Array<any>,
|
|
27
|
+
// flowlint-next-line unclear-type:off
|
|
27
28
|
transform?: Function,
|
|
28
29
|
};
|
|
29
30
|
|
package/button/button.js.flow
CHANGED
|
@@ -17,17 +17,16 @@ import {defaultProps} from './default-props.js';
|
|
|
17
17
|
import {getOverrides} from '../helpers/overrides.js';
|
|
18
18
|
import {isFocusVisible, forkFocus, forkBlur} from '../utils/focusVisible.js';
|
|
19
19
|
|
|
20
|
-
import type {ButtonPropsT, SharedStylePropsT} from './types.js';
|
|
20
|
+
import type {ButtonPropsT, SharedStylePropsT, ReactRefT} from './types.js';
|
|
21
21
|
|
|
22
22
|
class Button extends React.Component<
|
|
23
|
-
|
|
24
|
-
ButtonPropsT & {forwardedRef: any},
|
|
23
|
+
ButtonPropsT & {forwardedRef: ReactRefT<HTMLElement>},
|
|
25
24
|
{isFocusVisible: boolean},
|
|
26
25
|
> {
|
|
27
26
|
static defaultProps = defaultProps;
|
|
28
27
|
state = {isFocusVisible: false};
|
|
29
28
|
|
|
30
|
-
internalOnClick = (...args
|
|
29
|
+
internalOnClick = (...args) => {
|
|
31
30
|
const {isLoading, onClick} = this.props;
|
|
32
31
|
if (isLoading) {
|
|
33
32
|
args[0].preventDefault();
|
package/button/types.js.flow
CHANGED
|
@@ -10,6 +10,8 @@ import * as React from 'react';
|
|
|
10
10
|
import {KIND, SIZE, SHAPE} from './constants.js';
|
|
11
11
|
import type {OverrideT} from '../helpers/overrides.js';
|
|
12
12
|
|
|
13
|
+
export type ReactRefT<T> = {|current: null | T|};
|
|
14
|
+
|
|
13
15
|
export type OverridesT = {
|
|
14
16
|
Root?: OverrideT,
|
|
15
17
|
BaseButton?: OverrideT,
|
|
@@ -29,7 +31,7 @@ export type ButtonPropsT = {
|
|
|
29
31
|
colors?: CustomColorsT,
|
|
30
32
|
disabled?: boolean,
|
|
31
33
|
/** A helper rendered at the end of the button. */
|
|
32
|
-
//
|
|
34
|
+
// flowlint-next-line unclear-type:off
|
|
33
35
|
endEnhancer?: React.Node | React.AbstractComponent<any>,
|
|
34
36
|
/** Show loading button style and spinner. */
|
|
35
37
|
isLoading?: boolean,
|
|
@@ -44,7 +46,7 @@ export type ButtonPropsT = {
|
|
|
44
46
|
/** Defines the size of the button */
|
|
45
47
|
size?: $Keys<typeof SIZE>,
|
|
46
48
|
/** A helper rendered at the start of the button. */
|
|
47
|
-
//
|
|
49
|
+
// flowlint-next-line unclear-type:off
|
|
48
50
|
startEnhancer?: React.Node | React.AbstractComponent<any>,
|
|
49
51
|
type?: 'submit' | 'reset' | 'button',
|
|
50
52
|
};
|
|
@@ -29,7 +29,7 @@ function isIndexSelected(selected, index) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export default class ButtonGroup extends React.Component<PropsT> {
|
|
32
|
-
childRefs: //
|
|
32
|
+
childRefs: // flowlint-next-line unclear-type:off
|
|
33
33
|
{[key: number]: React.ElementRef<any>} = {};
|
|
34
34
|
static defaultProps = {
|
|
35
35
|
disabled: false,
|
|
@@ -81,9 +81,9 @@ class StatefulCheckboxContainer extends React.Component<
|
|
|
81
81
|
|
|
82
82
|
render() {
|
|
83
83
|
const {
|
|
84
|
-
children = (childProps: {}) => null,
|
|
85
|
-
initialState,
|
|
86
|
-
stateReducer,
|
|
84
|
+
children = (childProps: {}) => null,
|
|
85
|
+
initialState,
|
|
86
|
+
stateReducer,
|
|
87
87
|
...restProps
|
|
88
88
|
} = this.props;
|
|
89
89
|
const {onChange, onMouseEnter, onMouseLeave, onFocus, onBlur} = this;
|
|
@@ -10,13 +10,16 @@ import * as React from 'react';
|
|
|
10
10
|
import {default as StatefulContainer} from './stateful-checkbox-container.js';
|
|
11
11
|
// eslint-disable-next-line import/no-named-default
|
|
12
12
|
import {default as Checkbox} from './checkbox.js';
|
|
13
|
-
import type {
|
|
13
|
+
import type {
|
|
14
|
+
StatefulContainerChildPropsT,
|
|
15
|
+
StatefulCheckboxPropsT,
|
|
16
|
+
} from './types.js';
|
|
14
17
|
// Styled elements
|
|
15
18
|
|
|
16
19
|
const StatefulCheckbox = function (props: StatefulCheckboxPropsT) {
|
|
17
20
|
return (
|
|
18
21
|
<StatefulContainer {...props}>
|
|
19
|
-
{(childrenProps:
|
|
22
|
+
{(childrenProps: StatefulContainerChildPropsT) => (
|
|
20
23
|
<Checkbox {...childrenProps}>{props.children}</Checkbox>
|
|
21
24
|
)}
|
|
22
25
|
</StatefulContainer>
|
package/checkbox/types.js.flow
CHANGED
|
@@ -11,6 +11,7 @@ import {STYLE_TYPE} from './constants.js';
|
|
|
11
11
|
|
|
12
12
|
export type LabelPlacementT = 'top' | 'right' | 'bottom' | 'left';
|
|
13
13
|
export type StyleTypeT = $Keys<typeof STYLE_TYPE>;
|
|
14
|
+
export type ReactRefT<T> = {|current: null | T|};
|
|
14
15
|
|
|
15
16
|
export type OverridesT = {
|
|
16
17
|
Checkmark?: OverrideT,
|
|
@@ -30,7 +31,7 @@ export type DefaultPropsT = {
|
|
|
30
31
|
error: boolean,
|
|
31
32
|
autoFocus: boolean,
|
|
32
33
|
isIndeterminate: boolean,
|
|
33
|
-
inputRef:
|
|
34
|
+
inputRef: ReactRefT<HTMLInputElement>,
|
|
34
35
|
checkmarkType: StyleTypeT,
|
|
35
36
|
onChange: (e: SyntheticInputEvent<HTMLInputElement>) => mixed,
|
|
36
37
|
onMouseEnter: (e: SyntheticInputEvent<HTMLInputElement>) => mixed,
|
|
@@ -65,7 +66,7 @@ export type PropsT = {
|
|
|
65
66
|
/** You should use error instead. */
|
|
66
67
|
isError?: boolean,
|
|
67
68
|
/** Used to get a ref to the input element. Useful for programmatically focusing the input */
|
|
68
|
-
inputRef:
|
|
69
|
+
inputRef: ReactRefT<HTMLInputElement>,
|
|
69
70
|
/** Focus the checkbox on initial render. */
|
|
70
71
|
autoFocus?: boolean,
|
|
71
72
|
/** Passed to the input element type attribute */
|
|
@@ -117,9 +118,26 @@ export type StateReducerT = (
|
|
|
117
118
|
event: SyntheticInputEvent<HTMLInputElement>,
|
|
118
119
|
) => StateT;
|
|
119
120
|
|
|
121
|
+
export type StatefulContainerChildPropsT = {
|
|
122
|
+
...StateT,
|
|
123
|
+
overrides?: OverridesT,
|
|
124
|
+
/** Handler for change events on trigger element. */
|
|
125
|
+
onChange?: (e: SyntheticInputEvent<HTMLInputElement>) => mixed,
|
|
126
|
+
/** Handler for mouseenter events on trigger element. */
|
|
127
|
+
onMouseEnter?: (e: SyntheticInputEvent<HTMLInputElement>) => mixed,
|
|
128
|
+
/** Handler for mouseleave events on trigger element. */
|
|
129
|
+
onMouseLeave?: (e: SyntheticInputEvent<HTMLInputElement>) => mixed,
|
|
130
|
+
/** Handler for focus events on trigger element. */
|
|
131
|
+
onFocus?: (e: SyntheticInputEvent<HTMLInputElement>) => mixed,
|
|
132
|
+
/** Handler for blur events on trigger element. */
|
|
133
|
+
onBlur?: (e: SyntheticInputEvent<HTMLInputElement>) => mixed,
|
|
134
|
+
/** Focus the checkbox on initial render. */
|
|
135
|
+
autoFocus?: boolean,
|
|
136
|
+
};
|
|
137
|
+
|
|
120
138
|
export type DefaultStatefulPropsT = {
|
|
121
139
|
initialState: StateT,
|
|
122
|
-
children?: (
|
|
140
|
+
children?: (StatefulContainerChildPropsT) => React$Node,
|
|
123
141
|
stateReducer: StateReducerT,
|
|
124
142
|
onChange: (e: SyntheticInputEvent<HTMLInputElement>) => mixed,
|
|
125
143
|
onMouseEnter: (e: SyntheticInputEvent<HTMLInputElement>) => mixed,
|
|
@@ -131,7 +149,7 @@ export type DefaultStatefulPropsT = {
|
|
|
131
149
|
export type StatefulContainerPropsT = {
|
|
132
150
|
overrides?: OverridesT,
|
|
133
151
|
/** Component or String value for label of checkbox. */
|
|
134
|
-
children?: (
|
|
152
|
+
children?: (StatefulContainerChildPropsT) => React$Node,
|
|
135
153
|
/** Defines the components initial state value */
|
|
136
154
|
initialState?: StateT,
|
|
137
155
|
/** A state change handler. Used to override default state transitions. */
|
package/combobox/combobox.js
CHANGED
|
@@ -212,7 +212,7 @@ function Combobox(props) {
|
|
|
212
212
|
if (listboxRef.current && event.relatedTarget && // NOTE(chase): Contains method expects a Node type, but relatedTarget is
|
|
213
213
|
// EventTarget which is a super type of Node. Passing an EventTarget seems
|
|
214
214
|
// to work fine, assuming the flow type is too strict.
|
|
215
|
-
//
|
|
215
|
+
// flowlint-next-line unclear-type:off
|
|
216
216
|
listboxRef.current.contains(event.relatedTarget)) {
|
|
217
217
|
return;
|
|
218
218
|
}
|
|
@@ -304,7 +304,7 @@ function Combobox(props) {
|
|
|
304
304
|
popoverOverrides = _getOverrides12$$over === void 0 ? {} : _getOverrides12$$over,
|
|
305
305
|
restPopoverProps = _objectWithoutProperties(_getOverrides12$, ["overrides"]);
|
|
306
306
|
|
|
307
|
-
return /*#__PURE__*/React.createElement(Root //
|
|
307
|
+
return /*#__PURE__*/React.createElement(Root // flowlint-next-line unclear-type:off
|
|
308
308
|
, _extends({
|
|
309
309
|
ref: rootRef
|
|
310
310
|
}, rootProps), /*#__PURE__*/React.createElement(OverriddenPopover // React-focus-lock used in Popover used to skip non-tabbable elements (`tabIndex=-1`) elements for focus, we had ListBox with tabIndex to disable focus on
|
|
@@ -319,7 +319,7 @@ function Combobox(props) {
|
|
|
319
319
|
content: /*#__PURE__*/React.createElement(ListBox // TabIndex attribute exists to exclude option clicks from triggering onBlur event actions.
|
|
320
320
|
, _extends({
|
|
321
321
|
tabIndex: "-1",
|
|
322
|
-
id: listboxId //
|
|
322
|
+
id: listboxId // flowlint-next-line unclear-type:off
|
|
323
323
|
,
|
|
324
324
|
ref: listboxRef,
|
|
325
325
|
role: "listbox",
|
|
@@ -339,7 +339,7 @@ function Combobox(props) {
|
|
|
339
339
|
key: index,
|
|
340
340
|
onClick: function onClick() {
|
|
341
341
|
return handleOptionClick(index);
|
|
342
|
-
} //
|
|
342
|
+
} // flowlint-next-line unclear-type:off
|
|
343
343
|
,
|
|
344
344
|
ref: isSelected ? selectedOptionRef : null,
|
|
345
345
|
role: "option",
|
|
@@ -174,7 +174,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
|
|
|
174
174
|
// NOTE(chase): Contains method expects a Node type, but relatedTarget is
|
|
175
175
|
// EventTarget which is a super type of Node. Passing an EventTarget seems
|
|
176
176
|
// to work fine, assuming the flow type is too strict.
|
|
177
|
-
//
|
|
177
|
+
// flowlint-next-line unclear-type:off
|
|
178
178
|
listboxRef.current.contains((event.relatedTarget: any))
|
|
179
179
|
) {
|
|
180
180
|
return;
|
|
@@ -250,7 +250,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
|
|
|
250
250
|
|
|
251
251
|
return (
|
|
252
252
|
<Root
|
|
253
|
-
//
|
|
253
|
+
// flowlint-next-line unclear-type:off
|
|
254
254
|
ref={(rootRef: any)}
|
|
255
255
|
{...rootProps}
|
|
256
256
|
>
|
|
@@ -268,7 +268,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
|
|
|
268
268
|
// TabIndex attribute exists to exclude option clicks from triggering onBlur event actions.
|
|
269
269
|
tabIndex="-1"
|
|
270
270
|
id={listboxId}
|
|
271
|
-
//
|
|
271
|
+
// flowlint-next-line unclear-type:off
|
|
272
272
|
ref={(listboxRef: any)}
|
|
273
273
|
role="listbox"
|
|
274
274
|
aria-label={listBoxLabel}
|
|
@@ -287,7 +287,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
|
|
|
287
287
|
id={isSelected ? activeDescendantId : null}
|
|
288
288
|
key={index}
|
|
289
289
|
onClick={() => handleOptionClick(index)}
|
|
290
|
-
//
|
|
290
|
+
// flowlint-next-line unclear-type:off
|
|
291
291
|
ref={isSelected ? (selectedOptionRef: any) : null}
|
|
292
292
|
role="option"
|
|
293
293
|
$isSelected={isSelected}
|
package/combobox/types.js.flow
CHANGED
|
@@ -11,6 +11,8 @@ import * as React from 'react';
|
|
|
11
11
|
import type {OverrideT} from '../helpers/overrides.js';
|
|
12
12
|
import {SIZE} from '../input/index.js';
|
|
13
13
|
|
|
14
|
+
export type ReactRefT<T> = {|current: null | T|};
|
|
15
|
+
|
|
14
16
|
export type PropsT<OptionT = mixed> = {|
|
|
15
17
|
// Controls if the input value will be updated while keyboard navigating. Defaults to true.
|
|
16
18
|
autocomplete?: boolean,
|
|
@@ -31,7 +33,7 @@ export type PropsT<OptionT = mixed> = {|
|
|
|
31
33
|
id?: string,
|
|
32
34
|
name?: string,
|
|
33
35
|
// A ref to access the inner Input component.
|
|
34
|
-
inputRef?:
|
|
36
|
+
inputRef?: ReactRefT<HTMLElement>,
|
|
35
37
|
// Called when input loses focus.
|
|
36
38
|
onBlur?: (SyntheticInputEvent<HTMLInputElement>) => mixed,
|
|
37
39
|
// Called when input value changes or option is selected. If user selects a
|
|
@@ -264,7 +264,7 @@ function DatetimeFilter(props) {
|
|
|
264
264
|
var _React$useState7 = React.useState([initialState.categoricalOperator]),
|
|
265
265
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
266
266
|
categoricalOperator = _React$useState8[0],
|
|
267
|
-
setCategoricalOperator = _React$useState8[1]; //
|
|
267
|
+
setCategoricalOperator = _React$useState8[1]; // flowlint-next-line unclear-type:off
|
|
268
268
|
|
|
269
269
|
|
|
270
270
|
var _React$useState9 = React.useState(initialState.rangeDates.length ? initialState.rangeDates : [new Date(datesSorted[0]), new Date(datesSorted[datesSorted.length - 1])]),
|
|
@@ -306,7 +306,7 @@ function DatetimeFilter(props) {
|
|
|
306
306
|
},
|
|
307
307
|
onApply: function onApply() {
|
|
308
308
|
if (isRange) {
|
|
309
|
-
//
|
|
309
|
+
// flowlint-next-line unclear-type:off
|
|
310
310
|
var op = rangeOperator[0].id;
|
|
311
311
|
var description = '';
|
|
312
312
|
|
|
@@ -338,7 +338,7 @@ function DatetimeFilter(props) {
|
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
if (isCategorical) {
|
|
341
|
-
//
|
|
341
|
+
// flowlint-next-line unclear-type:off
|
|
342
342
|
var _op = categoricalOperator[0].id;
|
|
343
343
|
var selection = [];
|
|
344
344
|
var operatorLocaleLabelKey = '';
|
|
@@ -431,7 +431,7 @@ function DatetimeFilter(props) {
|
|
|
431
431
|
value: rangeOperator,
|
|
432
432
|
onChange: function onChange(params) {
|
|
433
433
|
return setRangeOperator(params.value);
|
|
434
|
-
} //
|
|
434
|
+
} // flowlint-next-line unclear-type:off
|
|
435
435
|
,
|
|
436
436
|
mountNode: mountNode.current,
|
|
437
437
|
options: RANGE_OPERATIONS.map(function (op) {
|
|
@@ -446,7 +446,7 @@ function DatetimeFilter(props) {
|
|
|
446
446
|
className: css({
|
|
447
447
|
paddingTop: theme.sizing.scale600
|
|
448
448
|
})
|
|
449
|
-
}, (rangeOperator[0].id === _constants.DATETIME_OPERATIONS.RANGE_DATETIME || rangeOperator[0].id === _constants.DATETIME_OPERATIONS.RANGE_DATE) && /*#__PURE__*/React.createElement(_index14.Datepicker //
|
|
449
|
+
}, (rangeOperator[0].id === _constants.DATETIME_OPERATIONS.RANGE_DATETIME || rangeOperator[0].id === _constants.DATETIME_OPERATIONS.RANGE_DATE) && /*#__PURE__*/React.createElement(_index14.Datepicker // flowlint-next-line unclear-type:off
|
|
450
450
|
, {
|
|
451
451
|
mountNode: mountNode.current,
|
|
452
452
|
value: rangeDates,
|
|
@@ -518,7 +518,7 @@ function DatetimeFilter(props) {
|
|
|
518
518
|
label: locale.datatable[op.localeLabelKey],
|
|
519
519
|
id: op.id
|
|
520
520
|
};
|
|
521
|
-
}) //
|
|
521
|
+
}) // flowlint-next-line unclear-type:off
|
|
522
522
|
,
|
|
523
523
|
mountNode: mountNode.current,
|
|
524
524
|
size: "compact",
|
|
@@ -43,7 +43,7 @@ import {LocaleContext} from '../locale/index.js';
|
|
|
43
43
|
type OptionsT = {|
|
|
44
44
|
...SharedColumnOptionsT<Date>,
|
|
45
45
|
formatString?: string,
|
|
46
|
-
//
|
|
46
|
+
// flowlint-next-line unclear-type:off
|
|
47
47
|
locale?: any,
|
|
48
48
|
|};
|
|
49
49
|
|
|
@@ -241,7 +241,7 @@ function DatetimeFilter(props) {
|
|
|
241
241
|
const [categoricalOperator, setCategoricalOperator] = React.useState<ValueT>([
|
|
242
242
|
initialState.categoricalOperator,
|
|
243
243
|
]);
|
|
244
|
-
//
|
|
244
|
+
// flowlint-next-line unclear-type:off
|
|
245
245
|
const [rangeDates, setRangeDates] = React.useState<any>(
|
|
246
246
|
initialState.rangeDates.length
|
|
247
247
|
? initialState.rangeDates
|
|
@@ -270,7 +270,7 @@ function DatetimeFilter(props) {
|
|
|
270
270
|
onExcludeChange={() => setExclude(!exclude)}
|
|
271
271
|
onApply={() => {
|
|
272
272
|
if (isRange) {
|
|
273
|
-
//
|
|
273
|
+
// flowlint-next-line unclear-type:off
|
|
274
274
|
const op: DatetimeOperationsT = (rangeOperator[0].id: any);
|
|
275
275
|
|
|
276
276
|
let description = '';
|
|
@@ -298,7 +298,7 @@ function DatetimeFilter(props) {
|
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
if (isCategorical) {
|
|
301
|
-
//
|
|
301
|
+
// flowlint-next-line unclear-type:off
|
|
302
302
|
const op: DatetimeOperationsT = (categoricalOperator[0].id: any);
|
|
303
303
|
|
|
304
304
|
let selection: number[] = [];
|
|
@@ -389,7 +389,7 @@ function DatetimeFilter(props) {
|
|
|
389
389
|
<Select
|
|
390
390
|
value={rangeOperator}
|
|
391
391
|
onChange={(params) => setRangeOperator(params.value)}
|
|
392
|
-
//
|
|
392
|
+
// flowlint-next-line unclear-type:off
|
|
393
393
|
mountNode={(mountNode.current: any)}
|
|
394
394
|
options={RANGE_OPERATIONS.map((op) => ({
|
|
395
395
|
label: locale.datatable[op.localeLabelKey],
|
|
@@ -403,7 +403,7 @@ function DatetimeFilter(props) {
|
|
|
403
403
|
{(rangeOperator[0].id === DATETIME_OPERATIONS.RANGE_DATETIME ||
|
|
404
404
|
rangeOperator[0].id === DATETIME_OPERATIONS.RANGE_DATE) && (
|
|
405
405
|
<Datepicker
|
|
406
|
-
//
|
|
406
|
+
// flowlint-next-line unclear-type:off
|
|
407
407
|
mountNode={(mountNode.current: any)}
|
|
408
408
|
value={rangeDates}
|
|
409
409
|
onChange={({date}) => {
|
|
@@ -496,7 +496,7 @@ function DatetimeFilter(props) {
|
|
|
496
496
|
label: locale.datatable[op.localeLabelKey],
|
|
497
497
|
id: op.id,
|
|
498
498
|
}))}
|
|
499
|
-
//
|
|
499
|
+
// flowlint-next-line unclear-type:off
|
|
500
500
|
mountNode={(mountNode.current: any)}
|
|
501
501
|
size="compact"
|
|
502
502
|
clearable={false}
|
package/data-table/data-table.js
CHANGED
|
@@ -86,7 +86,7 @@ function CellPlacement(_ref) {
|
|
|
86
86
|
|
|
87
87
|
var backgroundColor = theme.colors.backgroundPrimary;
|
|
88
88
|
|
|
89
|
-
if (rowIndex % 2 && columnIndex === data.columnHighlightIndex || rowIndex === data.rowHighlightIndex) {
|
|
89
|
+
if (Boolean(rowIndex % 2) && columnIndex === data.columnHighlightIndex || rowIndex === data.rowHighlightIndex) {
|
|
90
90
|
backgroundColor = theme.colors.backgroundTertiary;
|
|
91
91
|
} else if (rowIndex % 2 || columnIndex === data.columnHighlightIndex) {
|
|
92
92
|
backgroundColor = theme.colors.backgroundSecondary;
|
|
@@ -197,7 +197,7 @@ function Header(props) {
|
|
|
197
197
|
var _React$useState3 = React.useState(0),
|
|
198
198
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
199
199
|
endResizePos = _React$useState4[0],
|
|
200
|
-
setEndResizePos = _React$useState4[1]; //
|
|
200
|
+
setEndResizePos = _React$useState4[1]; // flowlint-next-line unclear-type:off
|
|
201
201
|
|
|
202
202
|
|
|
203
203
|
var headerCellRef = React.useRef(null);
|
|
@@ -569,7 +569,7 @@ function DataTable(_ref2) {
|
|
|
569
569
|
|
|
570
570
|
return rowHeight;
|
|
571
571
|
}, [rowHeight]); // We use state for our ref, to allow hooks to update when the ref changes.
|
|
572
|
-
//
|
|
572
|
+
// flowlint-next-line unclear-type:off
|
|
573
573
|
|
|
574
574
|
var _React$useState7 = React.useState(null),
|
|
575
575
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
@@ -952,7 +952,7 @@ function DataTable(_ref2) {
|
|
|
952
952
|
tableHeight: height,
|
|
953
953
|
widths: normalizedWidths
|
|
954
954
|
}
|
|
955
|
-
}, /*#__PURE__*/React.createElement(_reactWindow.VariableSizeGrid //
|
|
955
|
+
}, /*#__PURE__*/React.createElement(_reactWindow.VariableSizeGrid // flowlint-next-line unclear-type:off
|
|
956
956
|
, {
|
|
957
957
|
ref: setGridRef,
|
|
958
958
|
overscanRowCount: 10,
|
|
@@ -99,7 +99,7 @@ function CellPlacement({columnIndex, rowIndex, data, style}) {
|
|
|
99
99
|
|
|
100
100
|
let backgroundColor = theme.colors.backgroundPrimary;
|
|
101
101
|
if (
|
|
102
|
-
(rowIndex % 2 && columnIndex === data.columnHighlightIndex) ||
|
|
102
|
+
(Boolean(rowIndex % 2) && columnIndex === data.columnHighlightIndex) ||
|
|
103
103
|
rowIndex === data.rowHighlightIndex
|
|
104
104
|
) {
|
|
105
105
|
backgroundColor = theme.colors.backgroundTertiary;
|
|
@@ -260,7 +260,7 @@ function Header(props: HeaderProps) {
|
|
|
260
260
|
const [css, theme] = useStyletron();
|
|
261
261
|
const [startResizePos, setStartResizePos] = React.useState(0);
|
|
262
262
|
const [endResizePos, setEndResizePos] = React.useState(0);
|
|
263
|
-
//
|
|
263
|
+
// flowlint-next-line unclear-type:off
|
|
264
264
|
const headerCellRef = React.useRef<any>(null);
|
|
265
265
|
|
|
266
266
|
const RULER_OFFSET = 2;
|
|
@@ -700,7 +700,7 @@ export function DataTable({
|
|
|
700
700
|
);
|
|
701
701
|
|
|
702
702
|
// We use state for our ref, to allow hooks to update when the ref changes.
|
|
703
|
-
//
|
|
703
|
+
// flowlint-next-line unclear-type:off
|
|
704
704
|
const [gridRef, setGridRef] = React.useState<?VariableSizeGrid<any>>(null);
|
|
705
705
|
const [measuredWidths, setMeasuredWidths] = React.useState(
|
|
706
706
|
columns.map(() => 0),
|
|
@@ -1056,7 +1056,7 @@ export function DataTable({
|
|
|
1056
1056
|
}}
|
|
1057
1057
|
>
|
|
1058
1058
|
<VariableSizeGrid
|
|
1059
|
-
//
|
|
1059
|
+
// flowlint-next-line unclear-type:off
|
|
1060
1060
|
ref={(setGridRef: any)}
|
|
1061
1061
|
overscanRowCount={10}
|
|
1062
1062
|
overscanColumnCount={5}
|
|
@@ -201,9 +201,9 @@ function Options(props: OptionsPropsT) {
|
|
|
201
201
|
|
|
202
202
|
type PropsT = {
|
|
203
203
|
columns: ColumnT<>[],
|
|
204
|
-
//
|
|
204
|
+
// flowlint-next-line unclear-type:off
|
|
205
205
|
filters: Map<string, any>,
|
|
206
|
-
//
|
|
206
|
+
// flowlint-next-line unclear-type:off
|
|
207
207
|
rows: any[],
|
|
208
208
|
onSetFilter: (
|
|
209
209
|
columnTitle: string,
|