-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow default import with TypeScript (#72)
- Loading branch information
Showing
13 changed files
with
213 additions
and
26 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 |
---|---|---|
|
@@ -3,8 +3,5 @@ | |
"es2015", | ||
"stage-0", | ||
"react" | ||
], | ||
"plugins": [ | ||
"add-module-exports" | ||
] | ||
} |
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,13 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html lang="en-GB"> | ||
<head> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="x-ua-compatible" content="ie=edge"> | ||
<title>React Tether</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
</head> | ||
<body> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script src="./index.js"></script> | ||
</body> | ||
<a id='commonjs' href="../tests/examples/commonjs/index.html" /> | ||
<a id='esm' href="../tests/examples/esm/index.html" /> | ||
<a id='typescript' href="../tests/examples/typescript/index.html" /> | ||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,38 @@ | ||
import * as React from 'react'; | ||
import * as Tether from 'tether'; | ||
|
||
export default TetherComponent; | ||
export as namespace ReactTether; | ||
|
||
declare class TetherComponent extends React.Component<ReactTether.TetherComponentProps> { | ||
props: ReactTether.TetherComponentProps; | ||
|
||
static propTypes: ReactTether.TetherComponentProps; | ||
|
||
static defaultProps: { | ||
renderElementTag: string; | ||
renderElementTo: any; | ||
}; | ||
|
||
getTetherInstance(): Tether; | ||
|
||
disable(): void; | ||
|
||
enable(): void; | ||
|
||
on(event: any, handler: any, ctx?: any): void; | ||
|
||
once(event: any, handler: any, ctx?: any): void; | ||
|
||
off(event: any, handler: any): void; | ||
|
||
position(): void; | ||
} | ||
|
||
declare namespace ReactTether { | ||
interface TetherComponentProps extends React.Props<TetherComponent>, Tether.ITetherOptions { | ||
children: React.ReactNode; | ||
renderElementTag?: string; | ||
renderElementTo?: Element | string; | ||
} | ||
} |
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
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,10 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>CommonJS example</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script src="./index.js"></script> | ||
</body> | ||
</html> |
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,17 @@ | ||
const React = require('react'); | ||
const { render } = require('react-dom'); | ||
const { default: ReactTether } = require('../../../lib/react-tether'); | ||
|
||
function App() { | ||
return ( | ||
<div> | ||
<h1>CommonJS example</h1> | ||
<ReactTether attachment="top left"> | ||
<span>Child 1</span> | ||
<span>Child 2</span> | ||
</ReactTether> | ||
</div> | ||
); | ||
} | ||
|
||
render(<App />, document.querySelector('#app')); |
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,10 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>ES Modules example</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script src="./index.js"></script> | ||
</body> | ||
</html> |
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,17 @@ | ||
import React from 'react'; | ||
import { render } from 'react-dom'; | ||
import ReactTether from '../../../lib/react-tether'; | ||
|
||
function App() { | ||
return ( | ||
<div> | ||
<h1>ES Modules example</h1> | ||
<ReactTether attachment="top left"> | ||
<span>Child 1</span> | ||
<span>Child 2</span> | ||
</ReactTether> | ||
</div> | ||
); | ||
} | ||
|
||
render(<App />, document.querySelector('#app')); |
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,10 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>TypeScript example</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script src="./index.tsx"></script> | ||
</body> | ||
</html> |
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,15 @@ | ||
import * as React from 'react'; | ||
import * as ReactDOM from 'react-dom'; | ||
import ReactTether from '../../../lib/react-tether'; | ||
|
||
function App () { | ||
return <div> | ||
<h1>TypeScript example</h1> | ||
<ReactTether attachment="top left"> | ||
<span>Child 1</span> | ||
<span>Child 2</span> | ||
</ReactTether> | ||
</div> | ||
} | ||
|
||
ReactDOM.render(<App/>, document.querySelector('#app')); |
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,22 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "commonjs", | ||
"lib": ["es6", "dom"], | ||
"jsx": "react", | ||
"noEmit": true, | ||
|
||
"strict": true, | ||
"noImplicitAny": true, | ||
"strictNullChecks": true, | ||
"noImplicitThis": true, | ||
"alwaysStrict": true, | ||
|
||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"forceConsistentCasingInFileNames": true | ||
}, | ||
"include": ["src/**/*", "tests/examples/**/*.tsx"] | ||
} |