mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-30 23:30:06 +00:00
Added type definitions for react-text-truncate
This commit is contained in:
24
types/react-text-truncate/index.d.ts
vendored
Normal file
24
types/react-text-truncate/index.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// Type definitions for react-text-truncate 0.14
|
||||
// Project: https://github.com/ShinyChang/react-text-truncate
|
||||
// Definitions by: Adrien Antoine <https://github.com/adriantoine>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
export interface TextTruncateProps {
|
||||
containerClassName?: string;
|
||||
element?: string;
|
||||
line?: number | boolean;
|
||||
onCalculated?: () => void;
|
||||
onTruncated?: () => void;
|
||||
onToggled?: (truncated: boolean) => void;
|
||||
text?: string;
|
||||
textElement?: React.ReactNode;
|
||||
textTruncateChild?: React.ReactNode;
|
||||
truncateText?: string;
|
||||
maxCalculateTimes?: number;
|
||||
}
|
||||
|
||||
declare class TextTruncate extends React.Component<TextTruncateProps> {}
|
||||
|
||||
export default TextTruncate;
|
||||
18
types/react-text-truncate/react-text-truncate-tests.tsx
Normal file
18
types/react-text-truncate/react-text-truncate-tests.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import * as React from 'react';
|
||||
import TextTruncate from 'react-text-truncate';
|
||||
|
||||
const TruncatedText = () => (
|
||||
<TextTruncate
|
||||
text="My Text"
|
||||
line={2}
|
||||
containerClassName="my-container"
|
||||
element="span"
|
||||
onCalculated={() => {}}
|
||||
onTruncated={() => {}}
|
||||
onToggled={(truncate: boolean) => {}}
|
||||
textElement={<div />}
|
||||
textTruncateChild={<div />}
|
||||
truncateText="..."
|
||||
maxCalculateTimes={5}
|
||||
/>
|
||||
);
|
||||
25
types/react-text-truncate/tsconfig.json
Normal file
25
types/react-text-truncate/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-text-truncate-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-text-truncate/tslint.json
Normal file
1
types/react-text-truncate/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user