@atlaskit/react-select 3.16.2 → 4.0.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/CHANGELOG.md +26 -0
- package/accessibility/package.json +1 -8
- package/async/package.json +1 -8
- package/async-creatable/package.json +1 -8
- package/base/package.json +1 -8
- package/clear-indicator/package.json +1 -8
- package/components/package.json +1 -8
- package/control/package.json +1 -8
- package/creatable/package.json +1 -8
- package/dist/cjs/components/control.compiled.css +3 -3
- package/dist/cjs/components/control.js +1 -1
- package/dist/es2019/components/control.compiled.css +3 -3
- package/dist/es2019/components/control.js +1 -1
- package/dist/esm/components/control.compiled.css +3 -3
- package/dist/esm/components/control.js +1 -1
- package/dropdown-indicator/package.json +1 -8
- package/filters/package.json +1 -8
- package/group/package.json +1 -8
- package/group-heading/package.json +1 -8
- package/indicators-container/package.json +1 -8
- package/input/package.json +1 -8
- package/loading-indicator/package.json +1 -8
- package/menu/package.json +1 -8
- package/menu-list/package.json +1 -8
- package/menu-portal/package.json +1 -8
- package/multi-value/package.json +1 -8
- package/multi-value-remove/package.json +1 -8
- package/option/package.json +1 -8
- package/package.json +12 -20
- package/placeholder/package.json +1 -8
- package/select-container/package.json +1 -8
- package/single-value/package.json +1 -8
- package/state-manager/package.json +1 -8
- package/styles/package.json +1 -8
- package/types/package.json +1 -8
- package/use-async/package.json +1 -8
- package/use-creatable/package.json +1 -8
- package/use-state-manager/package.json +1 -8
- package/value-container/package.json +1 -8
- package/dist/types-ts4.5/accessibility/index.d.ts +0 -123
- package/dist/types-ts4.5/async-creatable.d.ts +0 -10
- package/dist/types-ts4.5/async.d.ts +0 -8
- package/dist/types-ts4.5/builtins.d.ts +0 -4
- package/dist/types-ts4.5/colors.d.ts +0 -19
- package/dist/types-ts4.5/compiled/components/indicators-container.d.ts +0 -18
- package/dist/types-ts4.5/compiled/components/select-container.d.ts +0 -22
- package/dist/types-ts4.5/compiled/components/value-container.d.ts +0 -22
- package/dist/types-ts4.5/components/containers/indicators-container.d.ts +0 -18
- package/dist/types-ts4.5/components/containers/multi-value-container.d.ts +0 -6
- package/dist/types-ts4.5/components/containers/select-container.d.ts +0 -22
- package/dist/types-ts4.5/components/containers/value-container.d.ts +0 -22
- package/dist/types-ts4.5/components/control.d.ts +0 -40
- package/dist/types-ts4.5/components/dummy-input.d.ts +0 -8
- package/dist/types-ts4.5/components/group-heading.d.ts +0 -19
- package/dist/types-ts4.5/components/group.d.ts +0 -36
- package/dist/types-ts4.5/components/index.d.ts +0 -80
- package/dist/types-ts4.5/components/indicators/clear-indicator.d.ts +0 -29
- package/dist/types-ts4.5/components/indicators/dropdown-indicator.d.ts +0 -26
- package/dist/types-ts4.5/components/indicators/loading-indicator.d.ts +0 -25
- package/dist/types-ts4.5/components/input.d.ts +0 -35
- package/dist/types-ts4.5/components/live-region.d.ts +0 -17
- package/dist/types-ts4.5/components/menu-list.d.ts +0 -29
- package/dist/types-ts4.5/components/menu-loading-message.d.ts +0 -2
- package/dist/types-ts4.5/components/menu-no-options-message.d.ts +0 -2
- package/dist/types-ts4.5/components/menu-placer.d.ts +0 -49
- package/dist/types-ts4.5/components/menu-portal.d.ts +0 -23
- package/dist/types-ts4.5/components/menu.d.ts +0 -22
- package/dist/types-ts4.5/components/multi-value-label.d.ts +0 -6
- package/dist/types-ts4.5/components/multi-value-remove.d.ts +0 -20
- package/dist/types-ts4.5/components/multi-value.d.ts +0 -25
- package/dist/types-ts4.5/components/option.d.ts +0 -47
- package/dist/types-ts4.5/components/placeholder.d.ts +0 -20
- package/dist/types-ts4.5/components/single-value.d.ts +0 -26
- package/dist/types-ts4.5/creatable.d.ts +0 -9
- package/dist/types-ts4.5/diacritics.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/accessibility.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/async-creatable.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/async.d.ts +0 -3
- package/dist/types-ts4.5/entry-points/base.d.ts +0 -3
- package/dist/types-ts4.5/entry-points/clear-indicator.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/components.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/control.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/creatable.d.ts +0 -3
- package/dist/types-ts4.5/entry-points/dropdown-indicator.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/filters.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/group-heading.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/group.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/indicators-container.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/input.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/loading-indicator.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/menu-list.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/menu-portal.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/menu.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/multi-value-remove.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/multi-value.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/option.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/placeholder.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/select-container.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/single-value.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/state-manager.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/styles.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/types.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/use-async.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/use-creatable.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/use-state-manager.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/value-container.d.ts +0 -2
- package/dist/types-ts4.5/filters.d.ts +0 -14
- package/dist/types-ts4.5/format-group-label.d.ts +0 -2
- package/dist/types-ts4.5/get-option-label.d.ts +0 -1
- package/dist/types-ts4.5/get-option-value.d.ts +0 -1
- package/dist/types-ts4.5/get-style-props.d.ts +0 -6
- package/dist/types-ts4.5/index.d.ts +0 -34
- package/dist/types-ts4.5/internal/a11y-text.d.ts +0 -2
- package/dist/types-ts4.5/internal/classnames.d.ts +0 -2
- package/dist/types-ts4.5/internal/clean-common-props.d.ts +0 -2
- package/dist/types-ts4.5/internal/clean-value.d.ts +0 -2
- package/dist/types-ts4.5/internal/is-document-el.d.ts +0 -1
- package/dist/types-ts4.5/internal/multi-value-as-value.d.ts +0 -2
- package/dist/types-ts4.5/internal/notify-open-layer-observer.d.ts +0 -11
- package/dist/types-ts4.5/internal/passive-event-detector.d.ts +0 -1
- package/dist/types-ts4.5/internal/portal-placement-context.d.ts +0 -14
- package/dist/types-ts4.5/internal/required-input.d.ts +0 -10
- package/dist/types-ts4.5/internal/scroll-manager.d.ts +0 -12
- package/dist/types-ts4.5/internal/scroll-to.d.ts +0 -1
- package/dist/types-ts4.5/internal/select-get-styles-context.d.ts +0 -12
- package/dist/types-ts4.5/internal/single-value-as-value.d.ts +0 -2
- package/dist/types-ts4.5/internal/use-scroll-capture.d.ts +0 -12
- package/dist/types-ts4.5/internal/use-scroll-lock.d.ts +0 -9
- package/dist/types-ts4.5/internal/use-select-get-styles.d.ts +0 -1
- package/dist/types-ts4.5/internal/value-ternary.d.ts +0 -2
- package/dist/types-ts4.5/is-option-disabled.d.ts +0 -1
- package/dist/types-ts4.5/select.d.ts +0 -597
- package/dist/types-ts4.5/state-manager.d.ts +0 -16
- package/dist/types-ts4.5/styles.d.ts +0 -50
- package/dist/types-ts4.5/theme.d.ts +0 -6
- package/dist/types-ts4.5/types.d.ts +0 -154
- package/dist/types-ts4.5/use-async.d.ts +0 -31
- package/dist/types-ts4.5/use-creatable.d.ts +0 -46
- package/dist/types-ts4.5/use-state-manager.d.ts +0 -15
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { type IndicatorsContainerProps } from './components/containers/indicators-container';
|
|
2
|
-
import { type ContainerProps } from './components/containers/select-container';
|
|
3
|
-
import { type ValueContainerProps } from './components/containers/value-container';
|
|
4
|
-
import { type ControlProps } from './components/control';
|
|
5
|
-
import { type GroupProps } from './components/group';
|
|
6
|
-
import { type GroupHeadingProps } from './components/group-heading';
|
|
7
|
-
import { type ClearIndicatorProps } from './components/indicators/clear-indicator';
|
|
8
|
-
import { type DropdownIndicatorProps } from './components/indicators/dropdown-indicator';
|
|
9
|
-
import { type LoadingIndicatorProps } from './components/indicators/loading-indicator';
|
|
10
|
-
import { type InputProps } from './components/input';
|
|
11
|
-
import { type MenuProps } from './components/menu';
|
|
12
|
-
import { type MenuListProps } from './components/menu-list';
|
|
13
|
-
import { type PortalStyleArgs } from './components/menu-portal';
|
|
14
|
-
import { type MultiValueProps } from './components/multi-value';
|
|
15
|
-
import { type OptionProps } from './components/option';
|
|
16
|
-
import { type PlaceholderProps } from './components/placeholder';
|
|
17
|
-
import { type SingleValueProps } from './components/single-value';
|
|
18
|
-
import { type CSSObjectWithLabel, type GroupBase, type NoticeProps } from './types';
|
|
19
|
-
export interface StylesProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
|
|
20
|
-
clearIndicator: ClearIndicatorProps<Option, IsMulti, Group>;
|
|
21
|
-
container: ContainerProps<Option, IsMulti, Group>;
|
|
22
|
-
control: ControlProps<Option, IsMulti, Group>;
|
|
23
|
-
dropdownIndicator: DropdownIndicatorProps<Option, IsMulti, Group>;
|
|
24
|
-
group: GroupProps<Option, IsMulti, Group>;
|
|
25
|
-
groupHeading: GroupHeadingProps<Option, IsMulti, Group>;
|
|
26
|
-
indicatorsContainer: IndicatorsContainerProps<Option, IsMulti, Group>;
|
|
27
|
-
input: InputProps<Option, IsMulti, Group>;
|
|
28
|
-
loadingIndicator: LoadingIndicatorProps<Option, IsMulti, Group>;
|
|
29
|
-
loadingMessage: NoticeProps<Option, IsMulti, Group>;
|
|
30
|
-
menu: MenuProps<Option, IsMulti, Group>;
|
|
31
|
-
menuList: MenuListProps<Option, IsMulti, Group>;
|
|
32
|
-
menuPortal: PortalStyleArgs;
|
|
33
|
-
multiValue: MultiValueProps<Option, IsMulti, Group>;
|
|
34
|
-
multiValueLabel: MultiValueProps<Option, IsMulti, Group>;
|
|
35
|
-
multiValueRemove: MultiValueProps<Option, IsMulti, Group>;
|
|
36
|
-
noOptionsMessage: NoticeProps<Option, IsMulti, Group>;
|
|
37
|
-
option: OptionProps<Option, IsMulti, Group>;
|
|
38
|
-
placeholder: PlaceholderProps<Option, IsMulti, Group>;
|
|
39
|
-
singleValue: SingleValueProps<Option, IsMulti, Group>;
|
|
40
|
-
valueContainer: ValueContainerProps<Option, IsMulti, Group>;
|
|
41
|
-
}
|
|
42
|
-
export type StylesConfig<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> = {
|
|
43
|
-
[K in keyof StylesProps<Option, IsMulti, Group>]?: (base: CSSObjectWithLabel, props: StylesProps<Option, IsMulti, Group>[K]) => CSSObjectWithLabel;
|
|
44
|
-
};
|
|
45
|
-
export type ClassNamesConfig<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> = {
|
|
46
|
-
[K in keyof StylesProps<Option, IsMulti, Group>]?: (props: StylesProps<Option, IsMulti, Group>[K]) => string;
|
|
47
|
-
};
|
|
48
|
-
export declare function mergeStyles<Option, IsMulti extends boolean, Group extends GroupBase<Option>>(source: StylesConfig<Option, IsMulti, Group>, target?: StylesConfig<Option, IsMulti, Group>): {
|
|
49
|
-
[K in keyof StylesProps<Option, IsMulti, Group>]?: (base: CSSObjectWithLabel, props: StylesProps<Option, IsMulti, Group>[K]) => CSSObjectWithLabel;
|
|
50
|
-
};
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { CSSProperties, XCSSProp } from '@compiled/react';
|
|
3
|
-
import type { XCSSAllProperties, XCSSAllPseudos } from '@atlaskit/css';
|
|
4
|
-
import type { SelectProps } from './select';
|
|
5
|
-
import type { StylesProps } from './styles';
|
|
6
|
-
export interface GroupBase<Option> {
|
|
7
|
-
readonly options: readonly Option[];
|
|
8
|
-
readonly label?: string;
|
|
9
|
-
}
|
|
10
|
-
export type OptionsOrGroups<Option, Group extends GroupBase<Option>> = readonly (Option | Group)[];
|
|
11
|
-
export type Options<Option> = readonly Option[];
|
|
12
|
-
export type SingleValue<Option> = Option | null;
|
|
13
|
-
export type MultiValue<Option> = readonly Option[];
|
|
14
|
-
export type PropsValue<Option> = MultiValue<Option> | SingleValue<Option>;
|
|
15
|
-
export type OnChangeValue<Option, IsMulti extends boolean> = IsMulti extends true ? MultiValue<Option> : SingleValue<Option>;
|
|
16
|
-
export interface Colors {
|
|
17
|
-
primary: string;
|
|
18
|
-
primary75: string;
|
|
19
|
-
primary50: string;
|
|
20
|
-
primary25: string;
|
|
21
|
-
danger: string;
|
|
22
|
-
dangerLight: string;
|
|
23
|
-
neutral0: string;
|
|
24
|
-
neutral5: string;
|
|
25
|
-
neutral10: string;
|
|
26
|
-
neutral20: string;
|
|
27
|
-
neutral30: string;
|
|
28
|
-
neutral40: string;
|
|
29
|
-
neutral50: string;
|
|
30
|
-
neutral60: string;
|
|
31
|
-
neutral70: string;
|
|
32
|
-
neutral80: string;
|
|
33
|
-
neutral90: string;
|
|
34
|
-
}
|
|
35
|
-
export interface ThemeSpacing {
|
|
36
|
-
baseUnit: number;
|
|
37
|
-
controlHeight: number;
|
|
38
|
-
menuGutter: number;
|
|
39
|
-
}
|
|
40
|
-
export interface Theme {
|
|
41
|
-
borderRadius: number;
|
|
42
|
-
colors: Colors;
|
|
43
|
-
spacing: ThemeSpacing;
|
|
44
|
-
}
|
|
45
|
-
export type ClassNamesState = {
|
|
46
|
-
[key: string]: boolean;
|
|
47
|
-
};
|
|
48
|
-
export type CX = (state: ClassNamesState, ...classNames: (string | undefined)[]) => string;
|
|
49
|
-
export type GetStyles<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = <Key extends keyof StylesProps<Option, IsMulti, Group>>(propertyName: Key, props: StylesProps<Option, IsMulti, Group>[Key]) => CSSObjectWithLabel;
|
|
50
|
-
export interface CommonProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
|
|
51
|
-
clearValue: () => void;
|
|
52
|
-
cx: CX;
|
|
53
|
-
/**
|
|
54
|
-
* Get the styles of a particular part of the select. Pass in the name of the
|
|
55
|
-
* property as the first argument, and the current props as the second argument.
|
|
56
|
-
* See the `styles` object for the properties available.
|
|
57
|
-
*/
|
|
58
|
-
getStyles: GetStyles<Option, IsMulti, Group>;
|
|
59
|
-
getClassNames: <Key extends keyof StylesProps<Option, IsMulti, Group>>(propertyName: Key, props: StylesProps<Option, IsMulti, Group>[Key]) => string | undefined;
|
|
60
|
-
getValue: () => Options<Option>;
|
|
61
|
-
hasValue: boolean;
|
|
62
|
-
isMulti: boolean;
|
|
63
|
-
isRtl: boolean;
|
|
64
|
-
options: OptionsOrGroups<Option, Group>;
|
|
65
|
-
selectOption: (newValue: Option) => void;
|
|
66
|
-
selectProps: SelectProps<Option, IsMulti, Group>;
|
|
67
|
-
setValue: (newValue: OnChangeValue<Option, IsMulti>, action: SetValueAction, option?: Option) => void;
|
|
68
|
-
}
|
|
69
|
-
export interface CommonPropsAndClassName<Option, IsMulti extends boolean, Group extends GroupBase<Option>> extends CommonProps<Option, IsMulti, Group> {
|
|
70
|
-
className?: string | undefined;
|
|
71
|
-
xcss?: XCSSProp<XCSSAllProperties, XCSSAllPseudos> | undefined;
|
|
72
|
-
}
|
|
73
|
-
export interface ActionMetaBase<Option> {
|
|
74
|
-
option?: Option | undefined;
|
|
75
|
-
removedValue?: Option;
|
|
76
|
-
removedValues?: Options<Option>;
|
|
77
|
-
name?: string;
|
|
78
|
-
}
|
|
79
|
-
export interface SelectOptionActionMeta<Option> extends ActionMetaBase<Option> {
|
|
80
|
-
action: 'select-option';
|
|
81
|
-
option: Option | undefined;
|
|
82
|
-
name?: string;
|
|
83
|
-
}
|
|
84
|
-
export interface DeselectOptionActionMeta<Option> extends ActionMetaBase<Option> {
|
|
85
|
-
action: 'deselect-option';
|
|
86
|
-
option: Option | undefined;
|
|
87
|
-
name?: string;
|
|
88
|
-
}
|
|
89
|
-
export interface RemoveValueActionMeta<Option> extends ActionMetaBase<Option> {
|
|
90
|
-
action: 'remove-value';
|
|
91
|
-
removedValue: Option;
|
|
92
|
-
name?: string;
|
|
93
|
-
}
|
|
94
|
-
export interface PopValueActionMeta<Option> extends ActionMetaBase<Option> {
|
|
95
|
-
action: 'pop-value';
|
|
96
|
-
removedValue: Option;
|
|
97
|
-
name?: string;
|
|
98
|
-
}
|
|
99
|
-
export interface ClearActionMeta<Option> extends ActionMetaBase<Option> {
|
|
100
|
-
action: 'clear';
|
|
101
|
-
removedValues: Options<Option>;
|
|
102
|
-
name?: string;
|
|
103
|
-
}
|
|
104
|
-
export interface CreateOptionActionMeta<Option> extends ActionMetaBase<Option> {
|
|
105
|
-
action: 'create-option';
|
|
106
|
-
name?: string;
|
|
107
|
-
option: Option;
|
|
108
|
-
}
|
|
109
|
-
export interface InitialInputFocusedActionMeta<Option, IsMulti extends boolean> extends ActionMetaBase<Option> {
|
|
110
|
-
action: 'initial-input-focus';
|
|
111
|
-
value: OnChangeValue<Option, IsMulti>;
|
|
112
|
-
options?: Options<Option>;
|
|
113
|
-
}
|
|
114
|
-
export type ActionMeta<Option> = SelectOptionActionMeta<Option> | DeselectOptionActionMeta<Option> | RemoveValueActionMeta<Option> | PopValueActionMeta<Option> | ClearActionMeta<Option> | CreateOptionActionMeta<Option>;
|
|
115
|
-
export type SetValueAction = 'select-option' | 'deselect-option';
|
|
116
|
-
export type InputAction = 'set-value' | 'input-change' | 'input-blur' | 'menu-close';
|
|
117
|
-
export interface InputActionMeta {
|
|
118
|
-
action: InputAction;
|
|
119
|
-
/**
|
|
120
|
-
* The previous value of the search input.
|
|
121
|
-
*/
|
|
122
|
-
prevInputValue: string;
|
|
123
|
-
}
|
|
124
|
-
export type MenuPlacement = 'auto' | 'bottom' | 'top';
|
|
125
|
-
export type CoercedMenuPlacement = 'bottom' | 'top';
|
|
126
|
-
export type MenuPosition = 'absolute' | 'fixed';
|
|
127
|
-
export type FocusDirection = 'up' | 'down' | 'pageup' | 'pagedown' | 'first' | 'last';
|
|
128
|
-
export type GetOptionLabel<Option> = (option: Option) => string;
|
|
129
|
-
export type GetOptionValue<Option> = (option: Option) => string;
|
|
130
|
-
export type CSSObjectWithLabel = any;
|
|
131
|
-
export interface MultiValueGenericProps<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> {
|
|
132
|
-
children: ReactNode;
|
|
133
|
-
data: any;
|
|
134
|
-
innerProps: {
|
|
135
|
-
className?: string;
|
|
136
|
-
style?: CSSProperties;
|
|
137
|
-
};
|
|
138
|
-
selectProps: SelectProps<Option, IsMulti, Group>;
|
|
139
|
-
isFocused?: boolean;
|
|
140
|
-
isDisabled?: boolean;
|
|
141
|
-
hasEllipsis?: boolean;
|
|
142
|
-
className?: string | undefined;
|
|
143
|
-
xcss?: XCSSProp<XCSSAllProperties, XCSSAllPseudos> | undefined;
|
|
144
|
-
}
|
|
145
|
-
export interface NoticeProps<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> extends CommonPropsAndClassName<Option, IsMulti, Group> {
|
|
146
|
-
/**
|
|
147
|
-
* The children to be rendered.
|
|
148
|
-
*/
|
|
149
|
-
children: ReactNode;
|
|
150
|
-
/**
|
|
151
|
-
* Props to be passed on to the wrapper.
|
|
152
|
-
*/
|
|
153
|
-
innerProps: JSX.IntrinsicElements['div'];
|
|
154
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { GroupBase, OptionsOrGroups } from './types';
|
|
2
|
-
import type { StateManagerProps } from './use-state-manager';
|
|
3
|
-
type AsyncManagedPropKeys = 'options' | 'isLoading' | 'onInputChange' | 'filterOption';
|
|
4
|
-
export interface AsyncAdditionalProps<Option, Group extends GroupBase<Option>> {
|
|
5
|
-
/**
|
|
6
|
-
* The default set of options to show before the user starts searching. When
|
|
7
|
-
* set to `true`, the results for loadOptions('') will be autoloaded.
|
|
8
|
-
*/
|
|
9
|
-
defaultOptions?: OptionsOrGroups<Option, Group> | boolean;
|
|
10
|
-
/**
|
|
11
|
-
* If cacheOptions is truthy, then the loaded data will be cached. The cache
|
|
12
|
-
* will remain until `cacheOptions` changes value.
|
|
13
|
-
*/
|
|
14
|
-
cacheOptions?: any;
|
|
15
|
-
/**
|
|
16
|
-
* Function that returns a promise, which is the set of options to be used
|
|
17
|
-
* once the promise resolves.
|
|
18
|
-
*/
|
|
19
|
-
loadOptions?: (inputValue: string, callback: (options: OptionsOrGroups<Option, Group>) => void) => Promise<OptionsOrGroups<Option, Group>> | void;
|
|
20
|
-
/**
|
|
21
|
-
* Will cause the select to be displayed in the loading state, even if the
|
|
22
|
-
* Async select is not currently waiting for loadOptions to resolve
|
|
23
|
-
*/
|
|
24
|
-
isLoading?: boolean;
|
|
25
|
-
}
|
|
26
|
-
export type AsyncProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = StateManagerProps<Option, IsMulti, Group> & AsyncAdditionalProps<Option, Group>;
|
|
27
|
-
/**
|
|
28
|
-
* {description}.
|
|
29
|
-
*/
|
|
30
|
-
export default function useAsync<Option, IsMulti extends boolean, Group extends GroupBase<Option>, AdditionalProps>({ defaultOptions: propsDefaultOptions, cacheOptions, loadOptions: propsLoadOptions, options: propsOptions, isLoading: propsIsLoading, onInputChange: propsOnInputChange, filterOption, ...restSelectProps }: AsyncProps<Option, IsMulti, Group> & AdditionalProps): StateManagerProps<Option, IsMulti, Group> & Omit<AdditionalProps, keyof AsyncAdditionalProps<Option, Group> | AsyncManagedPropKeys>;
|
|
31
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
import type { PublicBaseSelectProps } from './select';
|
|
3
|
-
import { type GetOptionLabel, type GetOptionValue, type GroupBase, type Options, type OptionsOrGroups } from './types';
|
|
4
|
-
interface Accessors<Option> {
|
|
5
|
-
getOptionValue: GetOptionValue<Option>;
|
|
6
|
-
getOptionLabel: GetOptionLabel<Option>;
|
|
7
|
-
}
|
|
8
|
-
export interface CreatableAdditionalProps<Option, Group extends GroupBase<Option>> {
|
|
9
|
-
/**
|
|
10
|
-
* Allow options to be created while the `isLoading` prop is true. Useful to
|
|
11
|
-
* prevent the "create new ..." option being displayed while async results are
|
|
12
|
-
* still being loaded.
|
|
13
|
-
*/
|
|
14
|
-
allowCreateWhileLoading?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Sets the position of the createOption element in your options list. Defaults to 'last'
|
|
17
|
-
*/
|
|
18
|
-
createOptionPosition?: 'first' | 'last';
|
|
19
|
-
/**
|
|
20
|
-
* Gets the label for the "create new ..." option in the menu. Is given the
|
|
21
|
-
* current input value.
|
|
22
|
-
*/
|
|
23
|
-
formatCreateLabel?: (inputValue: string) => ReactNode;
|
|
24
|
-
/**
|
|
25
|
-
* Determines whether the "create new ..." option should be displayed based on
|
|
26
|
-
* the current input value, select value and options array.
|
|
27
|
-
*/
|
|
28
|
-
isValidNewOption?: (inputValue: string, value: Options<Option>, options: OptionsOrGroups<Option, Group>, accessors: Accessors<Option>) => boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Returns the data for the new option when it is created. Used to display the
|
|
31
|
-
* value, and is passed to `onChange`.
|
|
32
|
-
*/
|
|
33
|
-
getNewOptionData?: (inputValue: string, optionLabel: ReactNode) => Option;
|
|
34
|
-
/**
|
|
35
|
-
* If provided, this will be called with the input value when a new option is
|
|
36
|
-
* created, and `onChange` will **not** be called. Use this when you need more
|
|
37
|
-
* control over what happens when new options are created.
|
|
38
|
-
*/
|
|
39
|
-
onCreateOption?: (inputValue: string) => void;
|
|
40
|
-
}
|
|
41
|
-
type BaseCreatableProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = PublicBaseSelectProps<Option, IsMulti, Group> & CreatableAdditionalProps<Option, Group>;
|
|
42
|
-
/**
|
|
43
|
-
* {description}.
|
|
44
|
-
*/
|
|
45
|
-
export default function useCreatable<Option, IsMulti extends boolean, Group extends GroupBase<Option>>({ allowCreateWhileLoading, createOptionPosition, formatCreateLabel, isValidNewOption, getNewOptionData, onCreateOption, options: propsOptions, onChange: propsOnChange, ...restSelectProps }: BaseCreatableProps<Option, IsMulti, Group>): PublicBaseSelectProps<Option, IsMulti, Group>;
|
|
46
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { PublicBaseSelectProps } from './select';
|
|
2
|
-
import { type GroupBase, type PropsValue } from './types';
|
|
3
|
-
type StateManagedPropKeys = 'inputValue' | 'menuIsOpen' | 'onChange' | 'onInputChange' | 'onMenuClose' | 'onMenuOpen' | 'value';
|
|
4
|
-
type SelectPropsWithOptionalStateManagedProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = Omit<PublicBaseSelectProps<Option, IsMulti, Group>, StateManagedPropKeys> & Partial<PublicBaseSelectProps<Option, IsMulti, Group>>;
|
|
5
|
-
interface StateManagerAdditionalProps<Option> {
|
|
6
|
-
defaultInputValue?: string;
|
|
7
|
-
defaultMenuIsOpen?: boolean;
|
|
8
|
-
defaultValue?: PropsValue<Option>;
|
|
9
|
-
}
|
|
10
|
-
export type StateManagerProps<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> = SelectPropsWithOptionalStateManagedProps<Option, IsMulti, Group> & StateManagerAdditionalProps<Option>;
|
|
11
|
-
/**
|
|
12
|
-
* {description}.
|
|
13
|
-
*/
|
|
14
|
-
export default function useStateManager<Option, IsMulti extends boolean, Group extends GroupBase<Option>, AdditionalProps>({ defaultInputValue, defaultMenuIsOpen, defaultValue, inputValue: propsInputValue, menuIsOpen: propsMenuIsOpen, onChange: propsOnChange, onInputChange: propsOnInputChange, onMenuClose: propsOnMenuClose, onMenuOpen: propsOnMenuOpen, value: propsValue, ...restSelectProps }: StateManagerProps<Option, IsMulti, Group> & AdditionalProps): PublicBaseSelectProps<Option, IsMulti, Group> & Omit<AdditionalProps, keyof StateManagerAdditionalProps<Option> | StateManagedPropKeys>;
|
|
15
|
-
export {};
|