@instructure/ui-simple-select 8.14.1-snapshot.21 → 8.14.1-snapshot.31
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/es/SimpleSelect/Group/index.js +2 -3
- package/es/SimpleSelect/Group/props.js +0 -7
- package/es/SimpleSelect/Option/index.js +2 -2
- package/es/SimpleSelect/Option/props.js +0 -23
- package/es/SimpleSelect/SimpleSelectLocator.js +3 -1
- package/es/SimpleSelect/index.js +74 -68
- package/es/SimpleSelect/props.js +0 -130
- package/lib/SimpleSelect/Group/index.js +2 -3
- package/lib/SimpleSelect/Group/props.js +0 -7
- package/lib/SimpleSelect/Option/index.js +2 -2
- package/lib/SimpleSelect/Option/props.js +0 -23
- package/lib/SimpleSelect/SimpleSelectLocator.js +2 -0
- package/lib/SimpleSelect/index.js +73 -70
- package/lib/SimpleSelect/props.js +0 -130
- package/package.json +15 -15
- package/src/SimpleSelect/Group/index.tsx +3 -4
- package/src/SimpleSelect/Group/props.ts +10 -8
- package/src/SimpleSelect/Option/index.tsx +2 -2
- package/src/SimpleSelect/Option/props.ts +35 -21
- package/src/SimpleSelect/index.tsx +92 -111
- package/src/SimpleSelect/props.ts +147 -94
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/SimpleSelect/Group/index.d.ts +4 -5
- package/types/SimpleSelect/Group/index.d.ts.map +1 -1
- package/types/SimpleSelect/Group/props.d.ts +7 -1
- package/types/SimpleSelect/Group/props.d.ts.map +1 -1
- package/types/SimpleSelect/Option/index.d.ts +7 -7
- package/types/SimpleSelect/Option/index.d.ts.map +1 -1
- package/types/SimpleSelect/Option/props.d.ts +30 -4
- package/types/SimpleSelect/Option/props.d.ts.map +1 -1
- package/types/SimpleSelect/index.d.ts +45 -61
- package/types/SimpleSelect/index.d.ts.map +1 -1
- package/types/SimpleSelect/props.d.ts +127 -16
- package/types/SimpleSelect/props.d.ts.map +1 -1
|
@@ -5,20 +5,19 @@ import type { SimpleSelectGroupProps } from './props';
|
|
|
5
5
|
parent: SimpleSelect
|
|
6
6
|
id: SimpleSelect.Group
|
|
7
7
|
---
|
|
8
|
+
@tsProps
|
|
8
9
|
**/
|
|
9
10
|
declare class Group extends Component<SimpleSelectGroupProps> {
|
|
10
11
|
static readonly componentId = "SimpleSelect.Group";
|
|
11
12
|
static allowedProps: readonly (keyof {
|
|
12
|
-
renderLabel: import("react").ReactNode | ((
|
|
13
|
+
renderLabel: import("react").ReactNode | (() => import("react").ReactNode);
|
|
13
14
|
children?: import("react").ReactNode;
|
|
14
15
|
})[];
|
|
15
16
|
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
16
|
-
renderLabel: import("react").ReactNode | ((
|
|
17
|
+
renderLabel: import("react").ReactNode | (() => import("react").ReactNode);
|
|
17
18
|
children?: import("react").ReactNode;
|
|
18
19
|
}>;
|
|
19
|
-
static defaultProps: {
|
|
20
|
-
children: null;
|
|
21
|
-
};
|
|
20
|
+
static defaultProps: {};
|
|
22
21
|
render(): null;
|
|
23
22
|
}
|
|
24
23
|
export default Group;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/SimpleSelect/Group/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGrD
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/SimpleSelect/Group/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGrD;;;;;;GAMG;AACH,cAAM,KAAM,SAAQ,SAAS,CAAC,sBAAsB,CAAC;IACnD,MAAM,CAAC,QAAQ,CAAC,WAAW,wBAAuB;IAElD,MAAM,CAAC,YAAY;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;OAAY;IAC5B,MAAM,CAAC,YAAY,KAAK;IAGxB,MAAM;CAKP;AAED,eAAe,KAAK,CAAA;AACpB,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { OtherHTMLAttributes, PropValidators } from '@instructure/shared-types';
|
|
3
3
|
declare type SimpleSelectGroupOwnProps = {
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The label associated with the group options.
|
|
6
|
+
*/
|
|
7
|
+
renderLabel: React.ReactNode | (() => React.ReactNode);
|
|
8
|
+
/**
|
|
9
|
+
* Children of type `<SimpleSelect.Option />` that will be considered part of the group.
|
|
10
|
+
*/
|
|
5
11
|
children?: React.ReactNode;
|
|
6
12
|
};
|
|
7
13
|
declare type PropKeys = keyof SimpleSelectGroupOwnProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/SimpleSelect/Group/props.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/SimpleSelect/Group/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACf,MAAM,2BAA2B,CAAA;AAElC,aAAK,yBAAyB,GAAG;IAC/B;;OAEG;IACH,WAAW,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,MAAM,KAAK,CAAC,SAAS,CAAC,CAAA;IACtD;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,yBAAyB,CAAA;AAE/C,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,sBAAsB,GAAG,yBAAyB,GACrD,mBAAmB,CAAC,yBAAyB,CAAC,CAAA;AAEhD,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAGvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAA6C,CAAA;AAEjE,YAAY,EAAE,sBAAsB,EAAE,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -5,6 +5,7 @@ import type { SimpleSelectOptionProps } from './props';
|
|
|
5
5
|
parent: SimpleSelect
|
|
6
6
|
id: SimpleSelect.Option
|
|
7
7
|
---
|
|
8
|
+
@tsProps
|
|
8
9
|
**/
|
|
9
10
|
declare class Option extends Component<SimpleSelectOptionProps> {
|
|
10
11
|
static readonly componentId = "SimpleSelect.Option";
|
|
@@ -12,21 +13,20 @@ declare class Option extends Component<SimpleSelectOptionProps> {
|
|
|
12
13
|
id: string;
|
|
13
14
|
value: string | number;
|
|
14
15
|
isDisabled?: boolean | undefined;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
children?: string | undefined;
|
|
17
|
+
renderBeforeLabel?: import("./props").RenderSimpleSelectOptionLabel;
|
|
18
|
+
renderAfterLabel?: import("./props").RenderSimpleSelectOptionLabel;
|
|
18
19
|
})[];
|
|
19
20
|
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
20
21
|
id: string;
|
|
21
22
|
value: string | number;
|
|
22
23
|
isDisabled?: boolean | undefined;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
children?: string | undefined;
|
|
25
|
+
renderBeforeLabel?: import("./props").RenderSimpleSelectOptionLabel;
|
|
26
|
+
renderAfterLabel?: import("./props").RenderSimpleSelectOptionLabel;
|
|
26
27
|
}>;
|
|
27
28
|
static defaultProps: {
|
|
28
29
|
isDisabled: boolean;
|
|
29
|
-
children: null;
|
|
30
30
|
};
|
|
31
31
|
render(): null;
|
|
32
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/SimpleSelect/Option/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAGtD
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/SimpleSelect/Option/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAGtD;;;;;;GAMG;AACH,cAAM,MAAO,SAAQ,SAAS,CAAC,uBAAuB,CAAC;IACrD,MAAM,CAAC,QAAQ,CAAC,WAAW,yBAAwB;IAEnD,MAAM,CAAC,YAAY;;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;MAElB;IAGD,MAAM;CAKP;AAED,eAAe,MAAM,CAAA;AACrB,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -1,18 +1,44 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { OtherHTMLAttributes, PropValidators } from '@instructure/shared-types';
|
|
3
|
+
declare type OptionProps = {
|
|
4
|
+
id: SimpleSelectOptionOwnProps['id'];
|
|
5
|
+
isDisabled: SimpleSelectOptionOwnProps['isDisabled'];
|
|
6
|
+
isSelected: boolean;
|
|
7
|
+
isHighlighted: boolean;
|
|
8
|
+
children: SimpleSelectOptionOwnProps['children'];
|
|
9
|
+
};
|
|
10
|
+
declare type RenderSimpleSelectOptionLabel = React.ReactNode | ((args: OptionProps) => React.ReactNode);
|
|
3
11
|
declare type SimpleSelectOptionOwnProps = {
|
|
12
|
+
/**
|
|
13
|
+
* The id for the option.
|
|
14
|
+
*/
|
|
4
15
|
id: string;
|
|
16
|
+
/**
|
|
17
|
+
* The value for the option.
|
|
18
|
+
*/
|
|
5
19
|
value: string | number;
|
|
20
|
+
/**
|
|
21
|
+
* Whether or not this option is disabled.
|
|
22
|
+
*/
|
|
6
23
|
isDisabled?: boolean;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Content to display as the option label.
|
|
26
|
+
*/
|
|
27
|
+
children?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Content to display before the option label, such as an icon.
|
|
30
|
+
*/
|
|
31
|
+
renderBeforeLabel?: RenderSimpleSelectOptionLabel;
|
|
32
|
+
/**
|
|
33
|
+
* Content to display after the option label, such as an icon.
|
|
34
|
+
*/
|
|
35
|
+
renderAfterLabel?: RenderSimpleSelectOptionLabel;
|
|
10
36
|
};
|
|
11
37
|
declare type PropKeys = keyof SimpleSelectOptionOwnProps;
|
|
12
38
|
declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
|
|
13
39
|
declare type SimpleSelectOptionProps = SimpleSelectOptionOwnProps & OtherHTMLAttributes<SimpleSelectOptionOwnProps>;
|
|
14
40
|
declare const propTypes: PropValidators<PropKeys>;
|
|
15
41
|
declare const allowedProps: AllowedPropKeys;
|
|
16
|
-
export type { SimpleSelectOptionProps };
|
|
42
|
+
export type { SimpleSelectOptionProps, RenderSimpleSelectOptionLabel };
|
|
17
43
|
export { propTypes, allowedProps };
|
|
18
44
|
//# sourceMappingURL=props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/SimpleSelect/Option/props.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/SimpleSelect/Option/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACf,MAAM,2BAA2B,CAAA;AAElC,aAAK,WAAW,GAAG;IACjB,EAAE,EAAE,0BAA0B,CAAC,IAAI,CAAC,CAAA;IACpC,UAAU,EAAE,0BAA0B,CAAC,YAAY,CAAC,CAAA;IACpD,UAAU,EAAE,OAAO,CAAA;IACnB,aAAa,EAAE,OAAO,CAAA;IACtB,QAAQ,EAAE,0BAA0B,CAAC,UAAU,CAAC,CAAA;CACjD,CAAA;AAED,aAAK,6BAA6B,GAC9B,KAAK,CAAC,SAAS,GACf,CAAC,CAAC,IAAI,EAAE,WAAW,KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;AAE5C,aAAK,0BAA0B,GAAG;IAChC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,iBAAiB,CAAC,EAAE,6BAA6B,CAAA;IACjD;;OAEG;IACH,gBAAgB,CAAC,EAAE,6BAA6B,CAAA;CACjD,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,0BAA0B,CAAA;AAEhD,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,uBAAuB,GAAG,0BAA0B,GACvD,mBAAmB,CAAC,0BAA0B,CAAC,CAAA;AAEjD,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAOvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAOnB,CAAA;AAED,YAAY,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,CAAA;AACtE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
+
import { Select } from '@instructure/ui-select';
|
|
2
3
|
import type { SelectProps } from '@instructure/ui-select';
|
|
3
4
|
import { Option } from './Option';
|
|
5
|
+
import type { SimpleSelectOptionProps } from './Option/props';
|
|
4
6
|
import { Group } from './Group';
|
|
7
|
+
import type { SimpleSelectGroupProps } from './Group/props';
|
|
5
8
|
import type { SimpleSelectProps } from './props';
|
|
9
|
+
import { SimpleSelectState } from './props';
|
|
10
|
+
declare type OptionChild = React.ComponentElement<SimpleSelectOptionProps, Option>;
|
|
11
|
+
declare type GroupChild = React.ComponentElement<SimpleSelectGroupProps, Group>;
|
|
12
|
+
declare type GetOption = <F extends 'id' | 'value'>(field: F, value?: SimpleSelectOptionProps[F]) => OptionChild | undefined;
|
|
6
13
|
/**
|
|
7
14
|
---
|
|
8
15
|
category: components
|
|
9
16
|
tags: form, field, dropdown
|
|
10
17
|
---
|
|
18
|
+
@tsProps
|
|
11
19
|
**/
|
|
12
|
-
declare class SimpleSelect extends Component<SimpleSelectProps> {
|
|
20
|
+
declare class SimpleSelect extends Component<SimpleSelectProps, SimpleSelectState> {
|
|
13
21
|
static readonly componentId = "SimpleSelect";
|
|
14
22
|
static Option: typeof Option;
|
|
15
23
|
static Group: typeof Group;
|
|
16
|
-
static allowedProps: readonly (keyof {
|
|
17
|
-
renderLabel: React.ReactNode | ((
|
|
18
|
-
value?: string | number | undefined;
|
|
19
|
-
defaultValue?: string | undefined;
|
|
24
|
+
static allowedProps: readonly ("children" | "value" | "defaultValue" | "onChange" | keyof {
|
|
25
|
+
renderLabel: React.ReactNode | (() => React.ReactNode);
|
|
20
26
|
id?: string | undefined;
|
|
21
27
|
size?: "small" | "medium" | "large" | undefined;
|
|
22
28
|
assistiveText?: string | undefined;
|
|
@@ -31,22 +37,15 @@ declare class SimpleSelect extends Component<SimpleSelectProps> {
|
|
|
31
37
|
placement?: import("@instructure/ui-position").PlacementPropValues | undefined;
|
|
32
38
|
constrain?: import("@instructure/ui-position").PositionConstraint | undefined;
|
|
33
39
|
mountNode?: import("@instructure/ui-position").PositionMountNode | undefined;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
renderAfterInput?: React.ReactNode | ((...args: any[]) => any);
|
|
44
|
-
children?: React.ReactNode;
|
|
45
|
-
})[];
|
|
46
|
-
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
47
|
-
renderLabel: React.ReactNode | ((...args: any[]) => any);
|
|
48
|
-
value?: string | number | undefined;
|
|
49
|
-
defaultValue?: string | undefined;
|
|
40
|
+
inputRef?: ((inputElement: HTMLInputElement | null) => void) | undefined;
|
|
41
|
+
listRef?: ((listElement: HTMLUListElement | null) => void) | undefined;
|
|
42
|
+
renderBeforeInput?: React.ReactNode | (() => React.ReactNode);
|
|
43
|
+
renderAfterInput?: React.ReactNode | (() => React.ReactNode);
|
|
44
|
+
onFocus?: ((event: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
45
|
+
onBlur?: ((event: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
46
|
+
} | "onShowOptions" | "onHideOptions" | "renderEmptyOption")[];
|
|
47
|
+
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<"children" | "value" | "defaultValue" | "onChange" | keyof {
|
|
48
|
+
renderLabel: React.ReactNode | (() => React.ReactNode);
|
|
50
49
|
id?: string | undefined;
|
|
51
50
|
size?: "small" | "medium" | "large" | undefined;
|
|
52
51
|
assistiveText?: string | undefined;
|
|
@@ -61,62 +60,47 @@ declare class SimpleSelect extends Component<SimpleSelectProps> {
|
|
|
61
60
|
placement?: import("@instructure/ui-position").PlacementPropValues | undefined;
|
|
62
61
|
constrain?: import("@instructure/ui-position").PositionConstraint | undefined;
|
|
63
62
|
mountNode?: import("@instructure/ui-position").PositionMountNode | undefined;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
renderEmptyOption?: React.ReactNode | ((...args: any[]) => any);
|
|
72
|
-
renderBeforeInput?: React.ReactNode | ((...args: any[]) => any);
|
|
73
|
-
renderAfterInput?: React.ReactNode | ((...args: any[]) => any);
|
|
74
|
-
children?: React.ReactNode;
|
|
75
|
-
}>;
|
|
63
|
+
inputRef?: ((inputElement: HTMLInputElement | null) => void) | undefined;
|
|
64
|
+
listRef?: ((listElement: HTMLUListElement | null) => void) | undefined;
|
|
65
|
+
renderBeforeInput?: React.ReactNode | (() => React.ReactNode);
|
|
66
|
+
renderAfterInput?: React.ReactNode | (() => React.ReactNode);
|
|
67
|
+
onFocus?: ((event: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
68
|
+
onBlur?: ((event: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
69
|
+
} | "onShowOptions" | "onHideOptions" | "renderEmptyOption">;
|
|
76
70
|
static defaultProps: {
|
|
77
71
|
size: string;
|
|
78
|
-
placeholder: null;
|
|
79
72
|
isRequired: boolean;
|
|
80
73
|
isInline: boolean;
|
|
81
74
|
visibleOptionsCount: number;
|
|
82
75
|
placement: string;
|
|
83
76
|
constrain: string;
|
|
84
|
-
onChange: (event: any, data: any) => void;
|
|
85
|
-
onFocus: (event: any) => void;
|
|
86
|
-
onBlur: (event: any) => void;
|
|
87
|
-
onShowOptions: (event: any) => void;
|
|
88
|
-
onHideOptions: (event: any) => void;
|
|
89
|
-
inputRef: (node: any) => void;
|
|
90
|
-
listRef: (node: any) => void;
|
|
91
77
|
renderEmptyOption: string;
|
|
92
|
-
renderBeforeInput: null;
|
|
93
|
-
renderAfterInput: null;
|
|
94
|
-
children: null;
|
|
95
78
|
};
|
|
96
|
-
ref:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
get _select():
|
|
79
|
+
ref: Select | null;
|
|
80
|
+
private readonly _emptyOptionId;
|
|
81
|
+
constructor(props: SimpleSelectProps);
|
|
82
|
+
get _select(): Select | null;
|
|
83
|
+
get childrenArray(): (OptionChild | GroupChild)[];
|
|
100
84
|
focus(): void;
|
|
101
|
-
get focused():
|
|
102
|
-
get id(): string |
|
|
85
|
+
get focused(): boolean;
|
|
86
|
+
get id(): string | undefined;
|
|
103
87
|
get isControlled(): boolean;
|
|
104
88
|
get interaction(): import("@instructure/ui-react-utils").InteractionType;
|
|
105
|
-
componentDidUpdate(prevProps:
|
|
106
|
-
getInitialOption(props:
|
|
107
|
-
getOptionLabelById(id:
|
|
108
|
-
|
|
109
|
-
getOption
|
|
110
|
-
handleRef: (node:
|
|
111
|
-
handleBlur:
|
|
89
|
+
componentDidUpdate(prevProps: SimpleSelectProps): void;
|
|
90
|
+
getInitialOption(props: SimpleSelectProps): OptionChild | undefined;
|
|
91
|
+
getOptionLabelById(id: string): string | undefined;
|
|
92
|
+
getFirstOption(): OptionChild | undefined;
|
|
93
|
+
getOption: GetOption;
|
|
94
|
+
handleRef: (node: Select) => void;
|
|
95
|
+
handleBlur: SelectProps['onBlur'];
|
|
112
96
|
handleShowOptions: SelectProps['onRequestShowOptions'];
|
|
113
97
|
handleHideOptions: SelectProps['onRequestHideOptions'];
|
|
114
98
|
handleHighlightOption: SelectProps['onRequestHighlightOption'];
|
|
115
99
|
handleSelectOption: SelectProps['onRequestSelectOption'];
|
|
116
|
-
renderChildren():
|
|
117
|
-
renderEmptyOption():
|
|
118
|
-
renderOption(option:
|
|
119
|
-
renderGroup(group:
|
|
100
|
+
renderChildren(): OptionChild | (OptionChild | GroupChild)[];
|
|
101
|
+
renderEmptyOption(): OptionChild;
|
|
102
|
+
renderOption(option: OptionChild): OptionChild;
|
|
103
|
+
renderGroup(group: GroupChild): GroupChild;
|
|
120
104
|
render(): JSX.Element;
|
|
121
105
|
}
|
|
122
106
|
export { SimpleSelect };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/SimpleSelect/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts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ED,GAAG,EAAE,MAAM,GAAG,IAAI,CAAO;IAEzB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAA;gBAEnB,KAAK,EAAE,iBAAiB;IAepC,IAAI,OAAO,kBAMV;IAED,IAAI,aAAa,iCAIhB;IAED,KAAK;IAIL,IAAI,OAAO,YAEV;IAED,IAAI,EAAE,uBAEL;IAED,IAAI,YAAY,YAEf;IAED,IAAI,WAAW,0DAEd;IAED,kBAAkB,CAAC,SAAS,EAAE,iBAAiB;IAc/C,gBAAgB,CAAC,KAAK,EAAE,iBAAiB;IAYzC,kBAAkB,CAAC,EAAE,EAAE,MAAM;IAK7B,cAAc;IAsBd,SAAS,EAAE,SAAS,CAwBnB;IAED,SAAS,SAAU,MAAM,UAExB;IAED,UAAU,EAAE,WAAW,CAAC,QAAQ,CAAC,CAKhC;IAED,iBAAiB,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAKrD;IAED,iBAAiB,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAYrD;IAED,qBAAqB,EAAE,WAAW,CAAC,0BAA0B,CAAC,CAc7D;IAED,kBAAkB,EAAE,WAAW,CAAC,uBAAuB,CAAC,CA8BvD;IAED,cAAc;IAkBd,iBAAiB;IAYjB,YAAY,CAAC,MAAM,EAAE,WAAW;IA2ChC,WAAW,CAAC,KAAK,EAAE,UAAU;IAe7B,MAAM;CAoEP;AAED,OAAO,EAAE,YAAY,EAAE,CAAA;AACvB,eAAe,YAAY,CAAA"}
|
|
@@ -1,42 +1,153 @@
|
|
|
1
1
|
import React, { InputHTMLAttributes } from 'react';
|
|
2
2
|
import type { FormMessage } from '@instructure/ui-form-field';
|
|
3
|
-
import type { OtherHTMLAttributes, PropValidators } from '@instructure/shared-types';
|
|
3
|
+
import type { OtherHTMLAttributes, PickPropsWithExceptions, PropValidators } from '@instructure/shared-types';
|
|
4
4
|
import type { PlacementPropValues, PositionConstraint, PositionMountNode } from '@instructure/ui-position';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import type { SelectOwnProps } from '@instructure/ui-select';
|
|
6
|
+
declare type SimpleSelectOwnProps = PropsPassedToSelect & {
|
|
7
|
+
/**
|
|
8
|
+
* The value corresponding to the value of the selected option. If defined,
|
|
9
|
+
* the component will act controlled and will not manage its own state.
|
|
10
|
+
*/
|
|
7
11
|
value?: string | number;
|
|
12
|
+
/**
|
|
13
|
+
* The value of the option to select by default, when uncontrolled.
|
|
14
|
+
*/
|
|
8
15
|
defaultValue?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Callback fired when a new option is selected.
|
|
18
|
+
*/
|
|
19
|
+
onChange?: (event: React.SyntheticEvent, data: {
|
|
20
|
+
value?: string | number;
|
|
21
|
+
id?: string;
|
|
22
|
+
}) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Callback fired when the options list is shown.
|
|
25
|
+
*/
|
|
26
|
+
onShowOptions?: (event: React.SyntheticEvent) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Callback fired when the options list is hidden.
|
|
29
|
+
*/
|
|
30
|
+
onHideOptions?: (event: React.SyntheticEvent) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Content to display in the list when no options are available.
|
|
33
|
+
*/
|
|
34
|
+
renderEmptyOption?: React.ReactNode | (() => React.ReactNode);
|
|
35
|
+
/**
|
|
36
|
+
* Children of type `<SimpleSelect.Option />` or `<SimpleSelect.Group />`.
|
|
37
|
+
*/
|
|
38
|
+
children?: React.ReactNode;
|
|
39
|
+
};
|
|
40
|
+
declare type PropsPassedToSelect = {
|
|
41
|
+
/**
|
|
42
|
+
* The form field label.
|
|
43
|
+
*/
|
|
44
|
+
renderLabel: React.ReactNode | (() => React.ReactNode);
|
|
45
|
+
/**
|
|
46
|
+
* The id of the text input. One is generated if not supplied.
|
|
47
|
+
*/
|
|
9
48
|
id?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The size of the text input.
|
|
51
|
+
*/
|
|
10
52
|
size?: 'small' | 'medium' | 'large';
|
|
53
|
+
/**
|
|
54
|
+
* Additional helpful text to provide to screen readers about the operation
|
|
55
|
+
* of the component. Provided via aria-describedby.
|
|
56
|
+
*/
|
|
11
57
|
assistiveText?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Html placeholder text to display when the input has no value. This should
|
|
60
|
+
* be hint text, not a label replacement.
|
|
61
|
+
*/
|
|
12
62
|
placeholder?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Specifies if interaction with the input is enabled, disabled, or readonly.
|
|
65
|
+
* When "disabled", the input changes visibly to indicate that it cannot
|
|
66
|
+
* receive user interactions. When "readonly" the input still cannot receive
|
|
67
|
+
* user interactions but it keeps the same styles as if it were enabled.
|
|
68
|
+
*/
|
|
13
69
|
interaction?: 'enabled' | 'disabled' | 'readonly';
|
|
70
|
+
/**
|
|
71
|
+
* Whether or not the text input is required.
|
|
72
|
+
*/
|
|
14
73
|
isRequired?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Whether the input is rendered inline with other elements or if it
|
|
76
|
+
* is rendered as a block level element.
|
|
77
|
+
*/
|
|
15
78
|
isInline?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The width of the text input.
|
|
81
|
+
*/
|
|
16
82
|
width?: string;
|
|
83
|
+
/**
|
|
84
|
+
* The max width the options list can be before option text wraps. If not
|
|
85
|
+
* set, the list will only display as wide as the text input.
|
|
86
|
+
*/
|
|
17
87
|
optionsMaxWidth?: string;
|
|
88
|
+
/**
|
|
89
|
+
* The number of options that should be visible before having to scroll.
|
|
90
|
+
*/
|
|
18
91
|
visibleOptionsCount?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Displays messages and validation for the input. It should be an array of
|
|
94
|
+
* objects with the following shape:
|
|
95
|
+
* `{
|
|
96
|
+
* text: ReactNode,
|
|
97
|
+
* type: One of: ['error', 'hint', 'success', 'screenreader-only']
|
|
98
|
+
* }`
|
|
99
|
+
*/
|
|
19
100
|
messages?: FormMessage[];
|
|
101
|
+
/**
|
|
102
|
+
* The placement of the options list.
|
|
103
|
+
*/
|
|
20
104
|
placement?: PlacementPropValues;
|
|
105
|
+
/**
|
|
106
|
+
* The parent in which to constrain the placement.
|
|
107
|
+
*/
|
|
21
108
|
constrain?: PositionConstraint;
|
|
109
|
+
/**
|
|
110
|
+
* An element or a function returning an element to use mount the options
|
|
111
|
+
* list to in the DOM (defaults to `document.body`)
|
|
112
|
+
*/
|
|
22
113
|
mountNode?: PositionMountNode;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
114
|
+
/**
|
|
115
|
+
* A ref to the html `input` element.
|
|
116
|
+
*/
|
|
117
|
+
inputRef?: (inputElement: HTMLInputElement | null) => void;
|
|
118
|
+
/**
|
|
119
|
+
* A ref to the html `ul` element.
|
|
120
|
+
*/
|
|
121
|
+
listRef?: (listElement: HTMLUListElement | null) => void;
|
|
122
|
+
/**
|
|
123
|
+
* Content to display before the text input. This will commonly be an icon.
|
|
124
|
+
*/
|
|
125
|
+
renderBeforeInput?: React.ReactNode | (() => React.ReactNode);
|
|
126
|
+
/**
|
|
127
|
+
* Content to display after the text input. This content will replace the
|
|
128
|
+
* default arrow icons.
|
|
129
|
+
*/
|
|
130
|
+
renderAfterInput?: React.ReactNode | (() => React.ReactNode);
|
|
131
|
+
/**
|
|
132
|
+
* Callback fired when text input receives focus.
|
|
133
|
+
*/
|
|
134
|
+
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
135
|
+
/**
|
|
136
|
+
* Callback fired when text input loses focus.
|
|
137
|
+
*/
|
|
138
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
34
139
|
};
|
|
35
140
|
declare type PropKeys = keyof SimpleSelectOwnProps;
|
|
36
141
|
declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
|
|
37
|
-
declare type SimpleSelectProps = SimpleSelectOwnProps & OtherHTMLAttributes<SimpleSelectOwnProps, InputHTMLAttributes<SimpleSelectOwnProps>>;
|
|
142
|
+
declare type SimpleSelectProps = PickPropsWithExceptions<SelectOwnProps, keyof PropsPassedToSelect | 'children' | 'onRequestShowOptions' | 'onRequestHideOptions' | 'onRequestHighlightOption' | 'onRequestSelectOption' | 'inputValue' | 'isShowingOptions'> & SimpleSelectOwnProps & OtherHTMLAttributes<SimpleSelectOwnProps, InputHTMLAttributes<SimpleSelectOwnProps>>;
|
|
143
|
+
declare type SimpleSelectState = {
|
|
144
|
+
inputValue?: string;
|
|
145
|
+
isShowingOptions: boolean;
|
|
146
|
+
highlightedOptionId?: string;
|
|
147
|
+
selectedOptionId?: string;
|
|
148
|
+
};
|
|
38
149
|
declare const propTypes: PropValidators<PropKeys>;
|
|
39
150
|
declare const allowedProps: AllowedPropKeys;
|
|
40
|
-
export type { SimpleSelectProps };
|
|
151
|
+
export type { SimpleSelectProps, SimpleSelectState };
|
|
41
152
|
export { propTypes, allowedProps };
|
|
42
153
|
//# sourceMappingURL=props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/SimpleSelect/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAUlD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACf,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/SimpleSelect/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAUlD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7D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