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.
Files changed (238) hide show
  1. package/a11y/a11y.js +1 -1
  2. package/a11y/a11y.js.flow +1 -1
  3. package/accordion/accordion.js +3 -2
  4. package/accordion/accordion.js.flow +4 -3
  5. package/accordion/panel.js +1 -1
  6. package/accordion/panel.js.flow +1 -1
  7. package/accordion/types.js.flow +2 -1
  8. package/app-nav-bar/types.js.flow +3 -3
  9. package/aspect-ratio-box/aspect-ratio-box.js +1 -1
  10. package/aspect-ratio-box/aspect-ratio-box.js.flow +2 -2
  11. package/block/block.js +1 -1
  12. package/block/block.js.flow +1 -1
  13. package/block/styled-components.js.flow +3 -2
  14. package/button/button.js.flow +3 -4
  15. package/button/types.js.flow +4 -2
  16. package/button-group/button-group.js.flow +1 -1
  17. package/checkbox/stateful-checkbox-container.js.flow +3 -3
  18. package/checkbox/stateful-checkbox.js.flow +5 -2
  19. package/checkbox/types.js.flow +22 -4
  20. package/combobox/combobox.js +4 -4
  21. package/combobox/combobox.js.flow +4 -4
  22. package/combobox/types.js.flow +3 -1
  23. package/data-table/column-datetime.js +6 -6
  24. package/data-table/column-datetime.js.flow +7 -7
  25. package/data-table/data-table.js +4 -4
  26. package/data-table/data-table.js.flow +4 -4
  27. package/data-table/filter-menu.js.flow +2 -2
  28. package/data-table/types.js.flow +3 -3
  29. package/datepicker/calendar-header.js +1 -1
  30. package/datepicker/calendar-header.js.flow +1 -1
  31. package/datepicker/calendar.js.flow +2 -2
  32. package/datepicker/day.js.flow +1 -1
  33. package/datepicker/styled-components.js +2 -2
  34. package/datepicker/styled-components.js.flow +2 -2
  35. package/datepicker/types.js.flow +2 -2
  36. package/datepicker/utils/date-helpers.js.flow +9 -9
  37. package/datepicker/utils/index.js +1 -1
  38. package/datepicker/utils/index.js.flow +1 -1
  39. package/drawer/drawer.js +1 -1
  40. package/drawer/drawer.js.flow +1 -1
  41. package/drawer/types.js.flow +1 -1
  42. package/es/a11y/a11y.js +1 -1
  43. package/es/accordion/accordion.js +2 -1
  44. package/es/accordion/panel.js +1 -1
  45. package/es/aspect-ratio-box/aspect-ratio-box.js +1 -1
  46. package/es/block/block.js +1 -1
  47. package/es/checkbox/stateful-checkbox-container.js +0 -3
  48. package/es/combobox/combobox.js +4 -4
  49. package/es/data-table/column-datetime.js +6 -6
  50. package/es/data-table/data-table.js +4 -4
  51. package/es/datepicker/calendar-header.js +1 -1
  52. package/es/datepicker/styled-components.js +2 -2
  53. package/es/datepicker/utils/index.js +1 -1
  54. package/es/drawer/drawer.js +1 -1
  55. package/es/flex-grid/flex-grid-item.js +5 -3
  56. package/es/flex-grid/flex-grid.js +1 -1
  57. package/es/form-control/form-control.js +4 -4
  58. package/es/helpers/overrides.js +7 -7
  59. package/es/icon/omit-dollar-prefixed-keys.js +1 -1
  60. package/es/input/stateful-container.js +0 -1
  61. package/es/layer/layer.js +4 -2
  62. package/es/list/list-heading.js +3 -3
  63. package/es/list/list-item.js +1 -1
  64. package/es/menu/option-profile.js +2 -0
  65. package/es/menu/stateful-container.js +2 -4
  66. package/es/menu/types.js +1 -1
  67. package/es/modal/modal.js +1 -1
  68. package/es/pagination/stateful-container.js +1 -0
  69. package/es/pagination/stateful-pagination.js +1 -0
  70. package/es/phone-input/country-select-dropdown.js +5 -4
  71. package/es/popover/popover.js +4 -6
  72. package/es/radio/radiogroup.js +1 -1
  73. package/es/rating/emoticon-rating.js +1 -1
  74. package/es/rating/star-rating.js +1 -1
  75. package/es/select/dropdown.js +1 -1
  76. package/es/select/multi-value.js +1 -1
  77. package/es/select/select-component.js +3 -3
  78. package/es/select/value.js +1 -1
  79. package/es/slider/slider.js +2 -2
  80. package/es/snackbar/snackbar-element.js +1 -1
  81. package/es/styles/__mocks__/styled.js +1 -1
  82. package/es/styles/styled.js +7 -7
  83. package/es/tabs/tabs.js +2 -2
  84. package/es/tag/tag.js +1 -1
  85. package/es/toast/toaster.js +1 -1
  86. package/es/tree-view/tree-node.js +1 -1
  87. package/es/tree-view/tree-view.js +6 -6
  88. package/es/utils/deep-merge.js +2 -2
  89. package/es/utils/deprecated-component.js +5 -3
  90. package/esm/a11y/a11y.js +1 -1
  91. package/esm/accordion/accordion.js +3 -2
  92. package/esm/accordion/panel.js +1 -1
  93. package/esm/aspect-ratio-box/aspect-ratio-box.js +1 -1
  94. package/esm/block/block.js +1 -1
  95. package/esm/combobox/combobox.js +4 -4
  96. package/esm/data-table/column-datetime.js +6 -6
  97. package/esm/data-table/data-table.js +4 -4
  98. package/esm/datepicker/calendar-header.js +1 -1
  99. package/esm/datepicker/styled-components.js +2 -2
  100. package/esm/datepicker/utils/index.js +1 -1
  101. package/esm/drawer/drawer.js +1 -1
  102. package/esm/flex-grid/flex-grid-item.js +4 -2
  103. package/esm/flex-grid/flex-grid.js +1 -1
  104. package/esm/form-control/form-control.js +4 -4
  105. package/esm/helpers/overrides.js +7 -7
  106. package/esm/icon/omit-dollar-prefixed-keys.js +1 -1
  107. package/esm/input/stateful-container.js +0 -1
  108. package/esm/layer/layer.js +4 -2
  109. package/esm/list/list-heading.js +3 -3
  110. package/esm/list/list-item.js +1 -1
  111. package/esm/menu/option-profile.js +2 -0
  112. package/esm/menu/stateful-container.js +2 -4
  113. package/esm/menu/types.js +1 -1
  114. package/esm/modal/modal.js +1 -1
  115. package/esm/pagination/stateful-container.js +1 -0
  116. package/esm/pagination/stateful-pagination.js +1 -0
  117. package/esm/phone-input/country-select-dropdown.js +5 -4
  118. package/esm/popover/popover.js +4 -6
  119. package/esm/radio/radiogroup.js +1 -1
  120. package/esm/rating/emoticon-rating.js +1 -1
  121. package/esm/rating/star-rating.js +1 -1
  122. package/esm/select/dropdown.js +1 -1
  123. package/esm/select/multi-value.js +1 -1
  124. package/esm/select/select-component.js +3 -3
  125. package/esm/select/value.js +1 -1
  126. package/esm/slider/slider.js +2 -2
  127. package/esm/snackbar/snackbar-element.js +1 -1
  128. package/esm/styles/__mocks__/styled.js +1 -1
  129. package/esm/styles/styled.js +7 -7
  130. package/esm/tabs/tabs.js +2 -2
  131. package/esm/tag/tag.js +1 -1
  132. package/esm/toast/toaster.js +1 -1
  133. package/esm/tree-view/tree-node.js +1 -1
  134. package/esm/tree-view/tree-view.js +6 -6
  135. package/esm/utils/deep-merge.js +2 -2
  136. package/esm/utils/deprecated-component.js +5 -3
  137. package/file-uploader/types.js.flow +2 -2
  138. package/flex-grid/flex-grid-item.js +4 -2
  139. package/flex-grid/flex-grid-item.js.flow +5 -4
  140. package/flex-grid/flex-grid.js +1 -1
  141. package/flex-grid/flex-grid.js.flow +1 -1
  142. package/form-control/form-control.js +4 -4
  143. package/form-control/form-control.js.flow +4 -4
  144. package/helpers/overrides.js +7 -7
  145. package/helpers/overrides.js.flow +10 -10
  146. package/helpers/react-helpers.js.flow +1 -1
  147. package/icon/omit-dollar-prefixed-keys.js +1 -1
  148. package/icon/omit-dollar-prefixed-keys.js.flow +1 -1
  149. package/input/base-input.js.flow +1 -1
  150. package/input/stateful-container.js +0 -1
  151. package/input/stateful-container.js.flow +0 -1
  152. package/input/stateful-input.js.flow +2 -2
  153. package/input/types.js.flow +15 -9
  154. package/input/utils.js.flow +7 -2
  155. package/layer/layer.js +4 -2
  156. package/layer/layer.js.flow +3 -2
  157. package/layer/layers-manager.js.flow +2 -2
  158. package/layer/types.js.flow +1 -1
  159. package/list/index.d.ts +4 -13
  160. package/list/list-heading.js +3 -3
  161. package/list/list-heading.js.flow +3 -3
  162. package/list/list-item.js +1 -1
  163. package/list/list-item.js.flow +1 -1
  164. package/list/types.js.flow +1 -1
  165. package/menu/maybe-child-menu.js.flow +3 -2
  166. package/menu/option-list.js.flow +4 -1
  167. package/menu/option-profile.js +2 -0
  168. package/menu/option-profile.js.flow +3 -1
  169. package/menu/stateful-container.js +2 -4
  170. package/menu/stateful-container.js.flow +9 -8
  171. package/menu/types.js.flow +8 -7
  172. package/modal/modal.js +1 -1
  173. package/modal/modal.js.flow +1 -1
  174. package/modal/types.js.flow +1 -1
  175. package/package.json +1 -1
  176. package/pagination/stateful-container.js +1 -0
  177. package/pagination/stateful-container.js.flow +2 -2
  178. package/pagination/stateful-pagination.js +1 -0
  179. package/pagination/stateful-pagination.js.flow +2 -2
  180. package/pagination/types.js.flow +8 -4
  181. package/payment-card/stateful-payment-card.js.flow +2 -1
  182. package/phone-input/country-select-dropdown.js +4 -4
  183. package/phone-input/country-select-dropdown.js.flow +8 -5
  184. package/phone-input/types.js.flow +4 -5
  185. package/popover/popover.js +4 -2
  186. package/popover/popover.js.flow +19 -8
  187. package/popover/types.js.flow +3 -4
  188. package/progress-bar/progressbar.js.flow +1 -1
  189. package/radio/radio.js.flow +2 -2
  190. package/radio/radiogroup.js +1 -1
  191. package/radio/radiogroup.js.flow +4 -1
  192. package/radio/types.js.flow +2 -1
  193. package/rating/emoticon-rating.js +1 -1
  194. package/rating/emoticon-rating.js.flow +1 -1
  195. package/rating/star-rating.js +1 -1
  196. package/rating/star-rating.js.flow +1 -1
  197. package/select/dropdown.js +1 -1
  198. package/select/dropdown.js.flow +1 -1
  199. package/select/multi-value.js +1 -1
  200. package/select/multi-value.js.flow +1 -1
  201. package/select/select-component.js +3 -4
  202. package/select/select-component.js.flow +8 -7
  203. package/select/types.js.flow +6 -5
  204. package/select/utils/index.js.flow +1 -5
  205. package/select/value.js +1 -1
  206. package/select/value.js.flow +1 -1
  207. package/side-navigation/stateful-container.js.flow +2 -2
  208. package/side-navigation/types.js.flow +4 -4
  209. package/slider/index.js.flow +1 -0
  210. package/slider/slider.js +2 -2
  211. package/slider/slider.js.flow +4 -2
  212. package/slider/types.js.flow +1 -1
  213. package/snackbar/snackbar-element.js +1 -1
  214. package/snackbar/snackbar-element.js.flow +1 -1
  215. package/styles/as-primary-export-hoc.js.flow +1 -1
  216. package/styles/styled.js +7 -7
  217. package/styles/styled.js.flow +9 -9
  218. package/tabs/tabs.js +2 -2
  219. package/tabs/tabs.js.flow +2 -2
  220. package/tabs/types.js.flow +1 -1
  221. package/tag/styled-components.js.flow +0 -1
  222. package/tag/tag.js +1 -1
  223. package/tag/tag.js.flow +1 -1
  224. package/textarea/types.js.flow +4 -2
  225. package/toast/styled-components.js.flow +1 -1
  226. package/toast/toaster.js +1 -1
  227. package/toast/toaster.js.flow +1 -1
  228. package/tree-view/tree-node.js +1 -1
  229. package/tree-view/tree-node.js.flow +1 -1
  230. package/tree-view/tree-view.js +6 -6
  231. package/tree-view/tree-view.js.flow +13 -11
  232. package/tree-view/types.js.flow +5 -3
  233. package/tree-view/utils.js.flow +1 -1
  234. package/utils/deep-merge.js +2 -2
  235. package/utils/deep-merge.js.flow +2 -2
  236. package/utils/deprecated-component.js +5 -3
  237. package/utils/deprecated-component.js.flow +5 -3
  238. package/utils/focusVisible.js.flow +2 -2
package/a11y/a11y.js CHANGED
@@ -182,7 +182,7 @@ function A11y(props) {
182
182
 
183
183
  return (
184
184
  /*#__PURE__*/
185
- // eslint-disable-next-line flowtype/no-weak-types
185
+ // flowlint-next-line unclear-type:off
186
186
  React.createElement(Violation, {
187
187
  target: node,
188
188
  violations: violations,
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
- // eslint-disable-next-line flowtype/no-weak-types
139
+ // flowlint-next-line unclear-type:off
140
140
  <Violation target={node} violations={(violations: any)} key={index} />
141
141
  ))}
142
142
  </div>
@@ -92,7 +92,8 @@ var Accordion = /*#__PURE__*/function (_React$Component) {
92
92
 
93
93
  _createClass(Accordion, [{
94
94
  key: "onPanelChange",
95
- value: function onPanelChange(key, onChange) {
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; // eslint-disable-next-line flowtype/no-weak-types
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
- onPanelChange(key: React.Key, onChange: () => {}, ...args: *) {
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
- // eslint-disable-next-line flowtype/no-weak-types
81
- return React.Children.map(children, (child: *, index) => {
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);
@@ -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]); // eslint-disable-next-line flowtype/no-weak-types
119
+ }, [expanded, disabled, onChange, onKeyDown]); // flowlint-next-line unclear-type:off
120
120
 
121
121
  var _animateRef = React.useRef(null);
122
122
 
@@ -84,7 +84,7 @@ const Panel = ({
84
84
  },
85
85
  [expanded, disabled, onChange, onKeyDown],
86
86
  );
87
- // eslint-disable-next-line flowtype/no-weak-types
87
+ // flowlint-next-line unclear-type:off
88
88
  const _animateRef = React.useRef<any>(null);
89
89
 
90
90
  React.useEffect(() => {
@@ -57,7 +57,8 @@ export type AccordionOnChangeHandlerT = ({
57
57
  expanded: Array<React.Key>,
58
58
  }) => mixed;
59
59
 
60
- type ChildrenT = React.ChildrenArray<React.Element<*>>;
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
- // eslint-disable-next-line flowtype/no-weak-types
38
+ // flowlint-next-line unclear-type:off
39
39
  icon?: React.AbstractComponent<any>,
40
- // eslint-disable-next-line flowtype/no-weak-types
40
+ // flowlint-next-line unclear-type:off
41
41
  info?: any,
42
42
  label: string,
43
43
  children?: NavItemT[],
44
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- }: // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
119
+ // flowlint-next-line unclear-type:off
120
120
  , _extends({
121
121
  ref: forwardedRef,
122
122
  $as: as,
@@ -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
- // eslint-disable-next-line flowtype/no-weak-types
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
- value?: * | Array<*>,
26
- // eslint-disable-next-line flowtype/no-weak-types
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
 
@@ -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
- // eslint-disable-next-line flowtype/no-weak-types
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();
@@ -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
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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: // eslint-disable-next-line flowtype/no-weak-types
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, // eslint-disable-line no-unused-vars
85
- initialState, // eslint-disable-line no-unused-vars
86
- stateReducer, // eslint-disable-line no-unused-vars
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 {PropsT, StatefulCheckboxPropsT} from './types.js';
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: PropsT) => (
22
+ {(childrenProps: StatefulContainerChildPropsT) => (
20
23
  <Checkbox {...childrenProps}>{props.children}</Checkbox>
21
24
  )}
22
25
  </StatefulContainer>
@@ -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: {current: HTMLInputElement | null},
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: {current: HTMLInputElement | null},
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?: (*) => React$Node,
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?: (*) => React$Node,
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. */
@@ -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
- // eslint-disable-next-line flowtype/no-weak-types
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 // eslint-disable-next-line flowtype/no-weak-types
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 // eslint-disable-next-line flowtype/no-weak-types
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
- } // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
290
+ // flowlint-next-line unclear-type:off
291
291
  ref={isSelected ? (selectedOptionRef: any) : null}
292
292
  role="option"
293
293
  $isSelected={isSelected}
@@ -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?: React.ElementRef<*>,
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]; // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- } // eslint-disable-next-line flowtype/no-weak-types
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 // eslint-disable-next-line flowtype/no-weak-types
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
- }) // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
499
+ // flowlint-next-line unclear-type:off
500
500
  mountNode={(mountNode.current: any)}
501
501
  size="compact"
502
502
  clearable={false}
@@ -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]; // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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 // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
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
- // eslint-disable-next-line flowtype/no-weak-types
204
+ // flowlint-next-line unclear-type:off
205
205
  filters: Map<string, any>,
206
- // eslint-disable-next-line flowtype/no-weak-types
206
+ // flowlint-next-line unclear-type:off
207
207
  rows: any[],
208
208
  onSetFilter: (
209
209
  columnTitle: string,