-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
document interfaces for intellisense
- Loading branch information
1 parent
2f4d74a
commit 4d69e8b
Showing
5 changed files
with
135 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,84 @@ | ||
interface IBehavior { | ||
/** | ||
* A boolean dictating whether or not to further | ||
* reduce the `maxVisibleItems` value of the dropdown | ||
* menu when a collision occurs. | ||
* | ||
* @default true | ||
*/ | ||
|
||
clampMaxVisibleItems?: boolean; | ||
|
||
/** | ||
* A boolean dictating whether or not the dropdown | ||
* should close when a value is selected. | ||
* | ||
* @default true | ||
*/ | ||
|
||
closeOnSelect?: boolean; | ||
|
||
/** | ||
* A boolean dictating whether or not the dropdown should | ||
* watch for updates to the underyling `<select>` element | ||
* and reactively update itself. For example, when an | ||
* `<option>` is added or removed, or the `disabled` | ||
* attribute is toggled on. | ||
* | ||
* @default false | ||
*/ | ||
|
||
liveUpdates?: boolean; | ||
|
||
/** | ||
* A boolean dictating whether or not the user should be | ||
* able to loop from the top of the menu to the bottom | ||
* (and vice-versa) when changing the focused option by | ||
* pressing the up/down arrow keys. | ||
* | ||
* @default false | ||
*/ | ||
|
||
loop?: boolean; | ||
|
||
/** | ||
* An integer dictating the maximum visible options | ||
* that should be visible in the dropdown body before | ||
* limiting its height and forcing the user to scroll. | ||
* | ||
* @default 15 | ||
*/ | ||
|
||
maxVisibleItems?: number; | ||
|
||
/** | ||
* A boolean dictating whether or not the dropdown | ||
* should open automatically whenever it gains focus. | ||
* | ||
* @default false | ||
*/ | ||
|
||
openOnFocus?: boolean; | ||
|
||
/** | ||
* A boolean dictating whether or not the placeholder text | ||
* (if provided) should be shown whenever the dropdown is | ||
* open (even once a value has been selected). | ||
* | ||
* @default false | ||
*/ | ||
|
||
showPlaceholderWhenOpen?: boolean; | ||
openOnFocus?: boolean; | ||
closeOnSelect?: boolean; | ||
useNativeUiOnMobile?: boolean; | ||
loop?: boolean; | ||
clampMaxVisibleItems?: boolean; | ||
liveUpdates?: boolean; | ||
maxVisibleItems?: number; | ||
|
||
/** | ||
* A boolean dictating whether or not to fall back to | ||
* the native `<select>` UI on mobile devices (while | ||
* maintaing a styled "head"). | ||
* | ||
* @default true | ||
*/ | ||
|
||
useNativeUiOnMobile?: boolean; | ||
} | ||
|
||
export default IBehavior; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
type ICallback = (arg?: any) => void; | ||
type ICallback = () => void; | ||
|
||
export default ICallback; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,28 @@ | ||
import ICallback from './ICallback'; | ||
import ICallback from './ICallback'; | ||
import ISelectCallback from './ISelectCallback'; | ||
|
||
interface ICallbacks { | ||
onOpen?: ICallback; | ||
/** | ||
* An optional callback function to be invoked whenever | ||
* the dropdown is closed. | ||
*/ | ||
|
||
onClose?: ICallback; | ||
onSelect?: ICallback; | ||
|
||
/** | ||
* An optional callback function to be invoked whenever | ||
* the dropdown is opened. | ||
*/ | ||
|
||
onOpen?: ICallback; | ||
|
||
/** | ||
* An optional callback function to be invoked whenever | ||
* an option is selected. The selected option's value | ||
* is passed as the first argument to the callback. | ||
*/ | ||
|
||
onSelect?: ISelectCallback; | ||
} | ||
|
||
export default ICallbacks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type ISelectCallback = (value?: string) => void; | ||
|
||
export default ISelectCallback; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters