Skip to content

Commit 674f227

Browse files
committed
feat(typings): Adding TypeScript definitions
1 parent 11dd14f commit 674f227

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.0.0-semantically-released",
44
"description": "Datepickers built with Semantic UI for React and Dayzed",
55
"main": "dist/react-semantic-ui-datepickers.js",
6+
"typings": "./dist/index.d.ts",
67
"scripts": {
78
"add-contributor": "kcd-scripts contributors add",
89
"build": "kcd-scripts build --bundle cjs.minify",

rollup.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ module.exports = {
1111
sourcemap: true,
1212
}),
1313
plugins: [
14-
copy({ 'src/locales': 'dist/locales' }),
14+
copy({
15+
'src/locales': 'dist/locales',
16+
'src/index.d.ts': 'dist/index.d.ts',
17+
}),
1518
postcss({ extract: true, minimize: true }),
1619
].concat(rollupConfig.plugins),
1720
};

src/index.d.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import * as React from 'react';
2+
import { SemanticICONS, SemanticSIZES } from 'semantic-ui-react';
3+
4+
interface Locale {
5+
todayButton: string;
6+
nextMonth: string;
7+
previousMonth: string;
8+
nextYear: string;
9+
previousYear: string;
10+
weekdays: string[];
11+
months: string[];
12+
}
13+
14+
export interface SemanticDatepickerProps {
15+
clearable?: boolean;
16+
date?: Date;
17+
disabled?: boolean;
18+
error?: boolean;
19+
firstDayOfWeek?: number;
20+
format?: string;
21+
icon?: SemanticICONS;
22+
iconPosition?: 'left';
23+
id?: string;
24+
keepOpenOnClear?: boolean;
25+
keepOpenOnSelect?: boolean;
26+
label?: string;
27+
loading?: boolean;
28+
locale?: Locale;
29+
maxDate?: Date;
30+
minDate?: Date;
31+
name?: string;
32+
onDateChange: (newDate: Date | Date[] | null) => void;
33+
placeholder?: string;
34+
placeholder?: string;
35+
selected?: Date | Date[];
36+
showOutsideDays?: boolean;
37+
size?: SemanticSIZES;
38+
transparent?: boolean;
39+
type: 'basic' | 'range';
40+
}
41+
42+
declare class SemanticDatepicker extends React.Component<
43+
SemanticDatepickerProps,
44+
any
45+
> {}
46+
47+
export default SemanticDatepicker;

0 commit comments

Comments
 (0)