Skip to content

Commit eb26749

Browse files
committed
add ts support
1 parent 8540b94 commit eb26749

35 files changed

Lines changed: 10598 additions & 9134 deletions

.babelrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# production
1313
/build
1414
/dist
15+
/lib
1516
.env
1617

1718
# misc

.npmrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

package-lock.json

Lines changed: 10305 additions & 8696 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 52 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
{
2-
"name": "@JoshK2/react-spinners-css",
3-
"version": "1.2.3",
2+
"name": "react-spinners-css",
3+
"version": "2.0.0",
44
"private": false,
5-
"main": "dist/index.js",
6-
"module": "dist/index.js",
5+
"main": "./lib/cjs/index.js",
6+
"module": "./lib/esm/index.js",
7+
"types": "./lib/esm/index.d.ts",
8+
"directories": {
9+
"lib": "lib"
10+
},
711
"files": [
8-
"dist",
12+
"lib",
913
"README.md"
1014
],
1115
"repository": {
1216
"type": "git",
13-
"url": "git://github.com/JoshK2/react-spinners-css.git"
17+
"url": "https://github.com/JoshK2/react-spinners-css"
1418
},
1519
"homepage": "https://bit.dev/joshk/react-spinners-css",
1620
"keywords": [
@@ -35,43 +39,59 @@
3539
"license": "MIT",
3640
"scripts": {
3741
"start": "react-scripts start",
38-
"build:lib": "rm -rf dist && NODE_ENV=production babel src/components --out-dir dist --copy-files --ignore __tests__,spec.js,test.js,__snapshots__",
39-
"build:bit": "rm -rf dist && bit build",
42+
"build": "react-scripts build",
4043
"test": "react-scripts test",
4144
"eject": "react-scripts eject",
42-
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
45+
"build:lib": "rm -rf dist && NODE_ENV=production babel src/components --out-dir dist --copy-files --ignore __tests__,spec.js,test.js,__snapshots__",
46+
"build:lib2": "rm -rf lib && npm run build:esm && npm run build:cjs",
47+
"build:esm": "tsc",
48+
"build:cjs": "tsc --module commonjs --outDir lib/cjs",
49+
"build:bit": "rm -rf dist && bit build",
50+
"format": "prettier --write \"src/**/*.tsx\" \"src/**/*.ts\"",
4351
"deploy:npm": "npm publish",
4452
"deploy:bit": "bit export joshk.react-spinners-css"
4553
},
46-
"eslintConfig": {
47-
"extends": "react-app"
48-
},
49-
"browserslist": [
50-
">0.2%",
51-
"not dead",
52-
"not ie <= 11",
53-
"not op_mini all"
54-
],
5554
"dependencies": {
56-
"classnames": "^2.2.6",
57-
"prop-types": "^15.7.2"
55+
"classnames": "^2.3.1",
56+
"react": "^17.0.2",
57+
"react-dom": "^17.0.2",
58+
"react-scripts": "4.0.3",
59+
"typescript": "^4.1.2",
60+
"web-vitals": "^1.0.1"
5861
},
5962
"devDependencies": {
60-
"@babel/cli": "^7.2.3",
61-
"@babel/preset-env": "^7.10.3",
62-
"@babel/preset-react": "^7.10.1",
63-
"@bit/joshk.jotils.get-random-color": "^2.0.8",
64-
"prettier": "^1.18.2",
65-
"react": "^16.8.6",
66-
"react-dom": "^16.8.6",
67-
"react-scripts": "^3.1.1"
63+
"@testing-library/jest-dom": "^5.11.4",
64+
"@testing-library/react": "^11.1.0",
65+
"@testing-library/user-event": "^12.1.10",
66+
"@types/classnames": "^2.2.11",
67+
"@types/jest": "^26.0.15",
68+
"@types/node": "^12.0.0",
69+
"@types/react": "^17.0.0",
70+
"@types/react-dom": "^17.0.0",
71+
"copyfiles": "^2.4.1",
72+
"typescript-plugin-css-modules": "^3.2.0"
6873
},
6974
"peerDependencies": {
70-
"react": "^16.8.6",
71-
"react-dom": "^16.8.6"
75+
"react": "^17.0.2",
76+
"react-dom": "^17.0.2"
77+
},
78+
"eslintConfig": {
79+
"extends": [
80+
"react-app",
81+
"react-app/jest"
82+
]
7283
},
73-
"publishConfig": {
74-
"registry": "https://npm.pkg.github.com/"
84+
"browserslist": {
85+
"production": [
86+
">0.2%",
87+
"not dead",
88+
"not op_mini all"
89+
],
90+
"development": [
91+
"last 1 chrome version",
92+
"last 1 firefox version",
93+
"last 1 safari version"
94+
]
7595
},
7696
"bit": {
7797
"env": {

src/components/Circle/index.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/components/Circle/index.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import classNames from 'classnames'
2+
import styles from './style.module.css'
3+
import type { Props } from '../types'
4+
5+
export default function Circle({ color = '#7f58af', size = 64, className, style, ...rest }: Props) {
6+
return (
7+
<div
8+
className={classNames(styles['lds-circle'], className)}
9+
style={{ background: color, width: size, height: size, ...style }}
10+
{...rest}
11+
/>
12+
)
13+
}

src/components/Default/index.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/components/Default/index.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import classNames from 'classnames'
2+
import styles from './style.module.css'
3+
import type { Props } from '../types'
4+
5+
export default function Default({ color = '#7f58af', size = 80, className, style, ...rest }: Props) {
6+
const circles = [...Array(12)].map((_, index) => (
7+
<div key={index} style={{ background: `${color}`, width: size * 0.075, height: size * 0.075 }} />
8+
))
9+
10+
return (
11+
<div
12+
className={classNames(styles['lds-default'], className)}
13+
style={{ height: size, width: size, ...style }}
14+
{...rest}
15+
>
16+
{circles}
17+
</div>
18+
)
19+
}

src/components/DualRing/index.js

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)