mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[gestalt-datepicker] Add type definitions (#47570)
* [gestalt-datepicker] Add type definitions * Change export to default to match * update project url
This commit is contained in:
parent
89c78c18e4
commit
ba87a83b35
15
types/gestalt-datepicker/gestalt-datepicker-tests.tsx
Normal file
15
types/gestalt-datepicker/gestalt-datepicker-tests.tsx
Normal file
@ -0,0 +1,15 @@
|
||||
import * as React from 'react';
|
||||
import DatePicker from 'gestalt-datepicker';
|
||||
|
||||
const handleChange = (value: Date) => value;
|
||||
|
||||
<DatePicker id="example-basic" label="Select a date" onChange={({ value }) => handleChange(value)} />;
|
||||
<DatePicker
|
||||
disabled
|
||||
id="example-preselected value"
|
||||
minDate={new Date(1984, 6, 6)}
|
||||
maxDate={new Date(2020, 6, 10)}
|
||||
label="Alberto's birth date"
|
||||
onChange={({ value }) => handleChange(value)}
|
||||
value={new Date(1985, 6, 4)}
|
||||
/>;
|
||||
39
types/gestalt-datepicker/index.d.ts
vendored
Normal file
39
types/gestalt-datepicker/index.d.ts
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
// Type definitions for gestalt-datepicker 13.4
|
||||
// Project: https://github.com/pinterest/gestalt/tree/master/packages/gestalt-datepicker, https://gestalt.netlify.app/DatePicker
|
||||
// Definitions by: cgu <https://github.com/czgu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// Minimum TypeScript Version: 3.4
|
||||
|
||||
import * as React from 'react';
|
||||
import { Locale } from 'date-fns';
|
||||
|
||||
/*
|
||||
DatePicker Props Interface
|
||||
https://gestalt.netlify.app/DatePicker
|
||||
https://github.com/pinterest/gestalt/blob/master/packages/gestalt-datepicker/src/DatePicker.js
|
||||
*/
|
||||
|
||||
export interface DatePickerProps {
|
||||
id: string;
|
||||
onChange: (args: { event: React.SyntheticEvent<HTMLInputElement>; value: Date }) => void;
|
||||
disabled?: boolean;
|
||||
errorMessage?: string;
|
||||
excludeDates?: ReadonlyArray<Date>;
|
||||
helperText?: string;
|
||||
idealDirection?: 'up' | 'right' | 'down' | 'left';
|
||||
includeDates?: ReadonlyArray<Date>;
|
||||
label?: string;
|
||||
localeData?: Locale;
|
||||
maxDate?: Date;
|
||||
minDate?: Date;
|
||||
nextRef?: React.Ref<any>;
|
||||
|
||||
placeholder?: string;
|
||||
rangeEndDate?: Date;
|
||||
rangeSelector?: 'start' | 'end';
|
||||
rangeStartDate?: Date;
|
||||
ref?: React.Ref<any>;
|
||||
value?: Date;
|
||||
}
|
||||
|
||||
export default class DatePicker extends React.Component<DatePickerProps, any> {}
|
||||
6
types/gestalt-datepicker/package.json
Normal file
6
types/gestalt-datepicker/package.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"date-fns": "^2.0.1"
|
||||
}
|
||||
}
|
||||
24
types/gestalt-datepicker/tsconfig.json
Normal file
24
types/gestalt-datepicker/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"jsx": "react",
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gestalt-datepicker-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/gestalt-datepicker/tslint.json
Normal file
1
types/gestalt-datepicker/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user