mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Added type definitions for react-flags-select (#22787)
* Added type definitions for react-flags-select * fixed test and definitions
This commit is contained in:
parent
1f68776226
commit
f0b524190a
29
types/react-flags-select/index.d.ts
vendored
Normal file
29
types/react-flags-select/index.d.ts
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
// Type definitions for react-flags-select 1.1
|
||||
// Project: https://github.com/ekwonye-richard/react-flags-select#readme
|
||||
// Definitions by: Artur Sianiuk <https://github.com/senukartur>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Component } from 'react';
|
||||
|
||||
interface Props {
|
||||
countries?: string[];
|
||||
blackList?: boolean;
|
||||
customLabels?: {[propName: string]: string};
|
||||
selectedSize?: number;
|
||||
optionsSize?: number;
|
||||
defaultCountry?: string;
|
||||
placeholder?: string;
|
||||
className?: string;
|
||||
showSelectedLabel?: boolean;
|
||||
showOptionLabel?: boolean;
|
||||
alignOptions?: string;
|
||||
onSelect?: (countryCode: string) => void;
|
||||
disabled?: boolean;
|
||||
searchable?: boolean;
|
||||
}
|
||||
declare class ReactFlagsSelect extends Component<Props> {
|
||||
updateSelected(countryCode: string): void;
|
||||
}
|
||||
|
||||
export default ReactFlagsSelect;
|
||||
73
types/react-flags-select/react-flags-select-tests.tsx
Normal file
73
types/react-flags-select/react-flags-select-tests.tsx
Normal file
@ -0,0 +1,73 @@
|
||||
import * as React from 'react';
|
||||
import ReactFlagsSelect from 'react-flags-select';
|
||||
|
||||
export class ReactFlagsSelectTest extends React.Component {
|
||||
countries = ['US', 'GB', 'FR', 'DE', 'IT'];
|
||||
customLabels = {US: 'EN-US', GB: 'EN-GB', FR: 'FR', DE: 'DE', IT: 'IT'};
|
||||
onSelectFlag(countryCode: string) { }
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<ReactFlagsSelect />
|
||||
<ReactFlagsSelect defaultCountry='US' />
|
||||
<ReactFlagsSelect searchable={true} />
|
||||
<ReactFlagsSelect countries={this.countries} />
|
||||
<ReactFlagsSelect countries={this.countries} blackList={true} />
|
||||
<ReactFlagsSelect className='menu-flags' />
|
||||
<ReactFlagsSelect alignOptions='left' />
|
||||
<ReactFlagsSelect
|
||||
countries={this.countries}
|
||||
customLabels={this.customLabels}
|
||||
/>
|
||||
<ReactFlagsSelect
|
||||
countries={this.countries}
|
||||
customLabels={this.customLabels}
|
||||
placeholder='Select Language'
|
||||
/>
|
||||
<ReactFlagsSelect
|
||||
countries={this.countries}
|
||||
customLabels={this.customLabels}
|
||||
placeholder='Select Language'
|
||||
showSelectedLabel={false}
|
||||
/>
|
||||
<ReactFlagsSelect
|
||||
countries={this.countries}
|
||||
customLabels={this.customLabels}
|
||||
placeholder='Select Language'
|
||||
showSelectedLabel={false}
|
||||
showOptionLabel={false}
|
||||
/>
|
||||
<ReactFlagsSelect
|
||||
countries={this.countries}
|
||||
customLabels={this.customLabels}
|
||||
placeholder='Select Language'
|
||||
showSelectedLabel={false}
|
||||
showOptionLabel={false}
|
||||
selectedSize={14}
|
||||
/>
|
||||
<ReactFlagsSelect
|
||||
countries={this.countries}
|
||||
customLabels={this.customLabels}
|
||||
placeholder='Select Language'
|
||||
showSelectedLabel={false}
|
||||
showOptionLabel={false}
|
||||
selectedSize={18}
|
||||
optionsSize={14}
|
||||
/>
|
||||
<ReactFlagsSelect
|
||||
defaultCountry='US'
|
||||
showSelectedLabel={false}
|
||||
disabled={true}
|
||||
/>
|
||||
<ReactFlagsSelect
|
||||
defaultCountry='GB'
|
||||
onSelect={this.onSelectFlag}
|
||||
/>
|
||||
<ReactFlagsSelect
|
||||
ref='userFlag'
|
||||
defaultCountry='FR'
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
25
types/react-flags-select/tsconfig.json
Normal file
25
types/react-flags-select/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-flags-select-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-flags-select/tslint.json
Normal file
1
types/react-flags-select/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user