baseui 10.11.0 → 10.11.1

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.
@@ -10,7 +10,7 @@ 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 |};
13
+ export type ReactRefT<T> = { current: null | T } | {| current: null | T |};
14
14
 
15
15
  export type OverridesT = {
16
16
  Root?: OverrideT,
@@ -11,7 +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
+ export type ReactRefT<T> = { current: null | T } | {| current: null | T |};
15
15
 
16
16
  export type OverridesT = {
17
17
  Checkmark?: OverrideT,
@@ -11,7 +11,7 @@ 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 |};
14
+ export type ReactRefT<T> = { current: null | T } | {| current: null | T |};
15
15
 
16
16
  export type PropsT<OptionT = mixed> = {|
17
17
  // Controls if the input value will be updated while keyboard navigating. Defaults to true.
package/es/radio/radio.js CHANGED
@@ -61,7 +61,7 @@ class Radio extends React.Component {
61
61
  }
62
62
 
63
63
  componentDidMount() {
64
- if (this.props.autoFocus && this.props.inputRef.current) {
64
+ if (this.props.autoFocus && this.props.inputRef?.current) {
65
65
  this.props.inputRef.current.focus();
66
66
  }
67
67
 
@@ -117,7 +117,9 @@ var Radio = /*#__PURE__*/function (_React$Component) {
117
117
  _createClass(Radio, [{
118
118
  key: "componentDidMount",
119
119
  value: function componentDidMount() {
120
- if (this.props.autoFocus && this.props.inputRef.current) {
120
+ var _this$props$inputRef;
121
+
122
+ if (this.props.autoFocus && (_this$props$inputRef = this.props.inputRef) !== null && _this$props$inputRef !== void 0 && _this$props$inputRef.current) {
121
123
  this.props.inputRef.current.focus();
122
124
  }
123
125
 
@@ -27,7 +27,10 @@ import { isFocusVisible, forkFocus, forkBlur } from '../utils/focusVisible.js';
27
27
 
28
28
  const NullComponent = () => null;
29
29
 
30
- class BaseInput<T: EventTarget> extends React.Component<BaseInputPropsT<T>, InternalStateT> {
30
+ class BaseInput<T: HTMLInputElement | HTMLTextAreaElement> extends React.Component<
31
+ BaseInputPropsT<T>,
32
+ InternalStateT
33
+ > {
31
34
  static defaultProps = {
32
35
  'aria-activedescendant': null,
33
36
  'aria-autocomplete': null,
@@ -63,8 +66,7 @@ class BaseInput<T: EventTarget> extends React.Component<BaseInputPropsT<T>, Inte
63
66
  type: 'text',
64
67
  };
65
68
 
66
- // flowlint-next-line unclear-type:off
67
- inputRef = this.props.inputRef || React.createRef<any>();
69
+ inputRef = this.props.inputRef || React.createRef<T>();
68
70
 
69
71
  state = {
70
72
  isFocused: this.props.autoFocus || false,
@@ -13,7 +13,7 @@ import Input from './input.js';
13
13
  import { Input as StyledInput } from './styled-components.js';
14
14
  import type { MaskedInputPropsT } from './types.js';
15
15
 
16
- const MaskOverride = React.forwardRef<MaskedInputPropsT, HTMLElement>(
16
+ const MaskOverride = React.forwardRef<MaskedInputPropsT, HTMLInputElement>(
17
17
  (
18
18
  {
19
19
  // do nothing with these - we just don't want to pass it to the InputMask, as
@@ -12,7 +12,7 @@ import { STATE_CHANGE_TYPE, ADJOINED, SIZE, ENHANCER_POSITION } from './constant
12
12
  export type AdjoinedT = $Keys<typeof ADJOINED>;
13
13
  export type SizeT = $Keys<typeof SIZE>;
14
14
  export type StateTypeT = $Keys<typeof STATE_CHANGE_TYPE>;
15
- export type ReactRefT<T> = {| current: null | T |};
15
+ export type ReactRefT<T> = {| current: null | T |} | { current: null | T };
16
16
 
17
17
  export type InternalStateT = {
18
18
  /** Renders UI in 'focus' state */
@@ -108,7 +108,7 @@ export type BaseInputPropsT<T> = {|
108
108
  /** A hint as to the type of data that might be entered by the user while editing the element or its contents. */
109
109
  inputMode?: string,
110
110
  /** A ref to access an input element. */
111
- inputRef?: ReactRefT<HTMLElement>,
111
+ inputRef?: ReactRefT<T>,
112
112
  name: string,
113
113
  onBlur: (e: SyntheticFocusEvent<T>) => mixed,
114
114
  onChange?: (e: SyntheticInputEvent<T>) => mixed,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baseui",
3
- "version": "10.11.0",
3
+ "version": "10.11.1",
4
4
  "description": "A React Component library implementing the Base design language",
5
5
  "keywords": [
6
6
  "react",
@@ -10,7 +10,7 @@ import { STATE_CHANGE_TYPE, SIZE, COUNTRIES } from './constants.js';
10
10
  import type { OverrideT } from '../helpers/overrides.js';
11
11
  import type { OnChangeParamsT } from '../select/types.js';
12
12
 
13
- export type ReactRefT<T> = { current: null | T };
13
+ export type ReactRefT<T> = { current: null | T } | {| current: null | T |};
14
14
  export type SizeT = $Keys<typeof SIZE>;
15
15
  export type CountryIsoT = $Keys<typeof COUNTRIES>;
16
16
  export type CountriesT = $ReadOnly<CountryT>;
@@ -16,7 +16,7 @@ export type { PopperDataObjectT, PopperOffsetT, PopperOptionsT } from '../layer/
16
16
  export type PopoverPlacementT = TetherPlacementT;
17
17
  export type TriggerTypeT = $Keys<typeof TRIGGER_TYPE>;
18
18
  export type AccessibilityTypeT = $Keys<typeof ACCESSIBILITY_TYPE>;
19
- export type ReactRefT<T> = {| current: null | T |};
19
+ export type ReactRefT<T> = { current: null | T } | {| current: null | T |};
20
20
 
21
21
  export type StateT = {
22
22
  isOpen: boolean,
package/radio/radio.js CHANGED
@@ -124,7 +124,9 @@ var Radio = /*#__PURE__*/function (_React$Component) {
124
124
  _createClass(Radio, [{
125
125
  key: "componentDidMount",
126
126
  value: function componentDidMount() {
127
- if (this.props.autoFocus && this.props.inputRef.current) {
127
+ var _this$props$inputRef;
128
+
129
+ if (this.props.autoFocus && (_this$props$inputRef = this.props.inputRef) !== null && _this$props$inputRef !== void 0 && _this$props$inputRef.current) {
128
130
  this.props.inputRef.current.focus();
129
131
  }
130
132
 
@@ -56,7 +56,7 @@ class Radio extends React.Component<RadioPropsT, RadioStateT> {
56
56
  };
57
57
 
58
58
  componentDidMount() {
59
- if (this.props.autoFocus && this.props.inputRef.current) {
59
+ if (this.props.autoFocus && this.props.inputRef?.current) {
60
60
  this.props.inputRef.current.focus();
61
61
  }
62
62
  if (__DEV__ && this.props.isError) {
@@ -13,7 +13,7 @@ import { ALIGN } from './constants.js';
13
13
 
14
14
  export type LabelPlacementT = 'top' | 'right' | 'bottom' | 'left';
15
15
  export type AlignT = $Keys<typeof ALIGN>;
16
- export type ReactRefT<T> = {| current: null | T |};
16
+ export type ReactRefT<T> = { current: null | T } | {| current: null | T |};
17
17
 
18
18
  export type RadioOverridesT = {
19
19
  RadioMarkInner?: OverrideT,
@@ -114,7 +114,7 @@ export type RadioPropsT = {
114
114
  /** Disable the checkbox from being changed. */
115
115
  disabled?: boolean,
116
116
  /** Used to get a ref to the input element. Useful for programmatically focusing the input */
117
- inputRef: ReactRefT<HTMLInputElement>,
117
+ inputRef?: ReactRefT<HTMLInputElement>,
118
118
  /** Renders checkbox in errored state. */
119
119
  error?: boolean,
120
120
  /** You should use the error prop instead. */
package/select/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as React from 'react';
2
- import {StyletronComponent} from 'styletron-react';
3
- import {SIZE} from '../input';
4
- import {OnItemSelect} from '../menu';
5
- import {Override} from '../overrides';
6
- import {Locale} from '../locale';
2
+ import { StyletronComponent } from 'styletron-react';
3
+ import { SIZE } from '../input';
4
+ import { OnItemSelect } from '../menu';
5
+ import { Override } from '../overrides';
6
+ import { Locale } from '../locale';
7
7
 
8
- export {SIZE} from '../input';
8
+ export { SIZE } from '../input';
9
9
 
10
10
  export interface TYPE {
11
11
  select: 'select';
@@ -27,7 +27,7 @@ export interface Option {
27
27
  [others: string]: any;
28
28
  }
29
29
  export type Value = ReadonlyArray<Option>;
30
- export type OptgroupsT = {__ungrouped: Value; [key: string]: Value};
30
+ export type OptgroupsT = { __ungrouped: Value; [key: string]: Value };
31
31
  export type OptionsT = Value | OptgroupsT;
32
32
 
33
33
  export type ChangeAction = () => any;
@@ -44,7 +44,7 @@ export type filterOptions = (
44
44
  matchProp?: 'any' | 'label' | 'value';
45
45
  trimFilter?: boolean;
46
46
  valueKey?: string;
47
- },
47
+ }
48
48
  ) => Value;
49
49
 
50
50
  export interface SelectOverrides {
@@ -91,7 +91,7 @@ export interface SelectProps {
91
91
  options: Value,
92
92
  filterValue: string,
93
93
  excludeOptions?: Value,
94
- newProps?: {valueKey: string; labelKey: string},
94
+ newProps?: { valueKey: string; labelKey: string }
95
95
  ) => Value;
96
96
  filterOutSelected?: boolean;
97
97
  getOptionLabel?: (args: {
@@ -102,9 +102,9 @@ export interface SelectProps {
102
102
  $isHighlighted?: boolean;
103
103
  };
104
104
  }) => React.ReactNode;
105
- getValueLabel?: (args: {option: Option}) => React.ReactNode;
105
+ getValueLabel?: (args: { option: Option }) => React.ReactNode;
106
106
  id?: string;
107
- controlRef?: React.Ref<HTMLInputElement | HTMLDivElement>;
107
+ controlRef?: React.Ref<HTMLInputElement>;
108
108
  isLoading?: boolean;
109
109
  labelKey?: string;
110
110
  startOpen?: boolean;
@@ -164,22 +164,18 @@ export class Select extends React.Component<SelectProps, SelectState> {
164
164
  $disabled: boolean;
165
165
  $isHighlighted: boolean;
166
166
  };
167
- },
167
+ }
168
168
  ): React.ReactNode;
169
- getValueLabel({option}: {option: Option}): React.ReactNode;
169
+ getValueLabel({ option }: { option: Option }): React.ReactNode;
170
170
  getValueArray(value: Value): Option[];
171
171
  setValue(value: Value, option: Option, type: ChangeAction): void;
172
- selectValue({item}: {item: Option}): void;
172
+ selectValue({ item }: { item: Option }): void;
173
173
  addValue(item: Option): void;
174
174
  popValue(): void;
175
175
  removeValue(item: Option): void;
176
176
  clearValue(event: KeyboardEvent | MouseEvent | TouchEvent): void;
177
177
  renderLoading(): React.ReactNode;
178
- renderValue(
179
- valueArray: Value,
180
- isOpen: boolean,
181
- locale: Locale,
182
- ): React.ReactNode;
178
+ renderValue(valueArray: Value, isOpen: boolean, locale: Locale): React.ReactNode;
183
179
  renderInput(): React.ReactNode;
184
180
  renderClear(): React.ReactNode;
185
181
  renderArrow(): React.ReactNode;
@@ -219,10 +215,7 @@ export interface AutosizeInputProps {
219
215
  export interface AutosizeInputState {
220
216
  inputWidth: number;
221
217
  }
222
- export class AutosizeInput extends React.Component<
223
- AutosizeInputProps,
224
- AutosizeInputState
225
- > {
218
+ export class AutosizeInput extends React.Component<AutosizeInputProps, AutosizeInputState> {
226
219
  sizerRef(el?: HTMLElement): void;
227
220
  updateInputWidth(): void;
228
221
  }
@@ -276,18 +269,14 @@ export class SelectDropdown extends React.Component<DropdownProps> {
276
269
  $type: TYPE[keyof TYPE];
277
270
  $width: number;
278
271
  };
279
- getItemLabel(option: {[key: string]: any}): React.ReactNode;
272
+ getItemLabel(option: { [key: string]: any }): React.ReactNode;
280
273
  onMouseDown(e: Event): void;
281
274
  }
282
275
 
283
276
  export interface State {
284
277
  value: Value;
285
278
  }
286
- export type StateReducer = (
287
- stateType: string,
288
- nextState: State,
289
- currentState: State,
290
- ) => State;
279
+ export type StateReducer = (stateType: string, nextState: State, currentState: State) => State;
291
280
  export interface OnChangeParams {
292
281
  value: Value;
293
282
  option?: Option;
@@ -306,10 +295,7 @@ export interface StatefulContainerProps {
306
295
  stateReducer?: StateReducer;
307
296
  onChange?: (params: OnChangeParams) => any;
308
297
  }
309
- export class StatefulSelectContainer extends React.Component<
310
- StatefulContainerProps,
311
- State
312
- > {
298
+ export class StatefulSelectContainer extends React.Component<StatefulContainerProps, State> {
313
299
  onChange(params: OnChangeParams): void;
314
300
  internalSetState(params: OnChangeParams): void;
315
301
  }
@@ -15,7 +15,7 @@ import type { OnItemSelectFnT } from '../menu/types.js';
15
15
  export type ChangeActionT = $Keys<typeof STATE_CHANGE_TYPE>;
16
16
  export type SizeT = $Keys<typeof SIZE>;
17
17
  export type TypeT = $Keys<typeof TYPE>;
18
- export type ReactRefT<T> = {| current: null | T |};
18
+ export type ReactRefT<T> = { current: null | T } | {| current: null | T |};
19
19
 
20
20
  export type OptionT = $ReadOnly<{
21
21
  id?: string | number,
@@ -133,7 +133,7 @@ export type PropsT = {
133
133
  /** Defines if the comparison for a new creatable value should be case-insensitive. */
134
134
  ignoreCase?: boolean,
135
135
  /** A ref to access the input element powering the select if it's a search select, or the container div if it isn't. */
136
- controlRef?: ReactRefT<HTMLElement>,
136
+ controlRef?: ReactRefT<HTMLInputElement>,
137
137
  /** Defines if the select is in a loading (async) state. */
138
138
  isLoading: boolean,
139
139
  /** Defines an option key for a default label value. */
@@ -8,7 +8,7 @@ LICENSE file in the root directory of this source tree.
8
8
  import * as React from 'react';
9
9
  import type { OverrideT } from '../helpers/overrides.js';
10
10
 
11
- export type ReactRefT<T> = {| current: null | T |};
11
+ export type ReactRefT<T> = { current: null | T } | {| current: null | T |};
12
12
 
13
13
  export type TreeLabelOverridesT = {
14
14
  TreeItemContent?: OverrideT,