Skip to content

Commit 85cd9c9

Browse files
committed
ready for build
1 parent 0d4a5fe commit 85cd9c9

15 files changed

+483
-91
lines changed

README.md

+17-63
Original file line numberDiff line numberDiff line change
@@ -14,67 +14,21 @@ yarn add @wedevs/tail-react
1414

1515
## Usage
1616

17-
Once installed, you can import and use the components in your React application as follows:
18-
19-
```jsx
20-
import React from 'react';
21-
import { Button, Table } from '@wedevs/tail-react';
22-
23-
const App = () => {
24-
return (
25-
<div>
26-
<Button variant="primary" style="fill" size="medium" onClick={() => alert('Button clicked!')}>
27-
Click Me
28-
</Button>
29-
30-
<Table>
31-
<Table.Header>
32-
<th>ID</th>
33-
<th>Name</th>
34-
<th>Age</th>
35-
</Table.Header>
36-
<Table.Body
37-
items={users}
38-
renderRow={(item) => (
39-
<tr key={item.id}>
40-
<td>{item.id}</td>
41-
<td>{item.name}</td>
42-
<td>{item.age}</td>
43-
</tr>
44-
)}
45-
/>
46-
</Table>
47-
</div>
48-
);
49-
};
50-
51-
export default App;
17+
On your `tailwind.config.js` file, update the content entry:
18+
19+
```diff
20+
/** @type {import('tailwindcss').Config} */
21+
export default {
22+
content: [
23+
"./index.html",
24+
"./src/**/*.{js,ts,jsx,tsx}",
25+
+ "node_modules/tail-react/dist/index.js"
26+
],
27+
theme: {
28+
extend: {},
29+
},
30+
plugins: [
31+
+ import('@tailwindcss/forms'),
32+
],
33+
}
5234
```
53-
54-
## Components
55-
56-
The component library includes the following components:
57-
58-
- `Button`: A customizable button component with various styles and sizes.
59-
60-
- `Table`: A flexible and customizable table component for displaying data in tabular format.
61-
62-
## Customization
63-
64-
The components are built with Tailwind CSS, providing you with the flexibility to customize their appearance by leveraging Tailwind's utility classes. You can also pass custom CSS classes using the `className` prop to apply additional styles specific to your project.
65-
66-
## Documentation
67-
68-
For detailed information on each component and its available props, please refer to the documentation provided with the component library.
69-
70-
## License
71-
72-
This component library is open-source and distributed under the MIT License. You are free to use, modify, and distribute it in your projects.
73-
74-
## Contributing
75-
76-
Contributions to this component library are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the project's GitHub repository.
77-
78-
## Acknowledgments
79-
80-
A special thanks to the Tailwind CSS and React communities for their efforts in creating and maintaining these powerful tools. Their contributions have made it easier for developers like us to create beautiful and functional user interfaces.

package.json

+35-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,37 @@
11
{
22
"name": "tail-react",
3-
"private": true,
4-
"version": "0.0.0",
3+
"version": "0.1.0",
4+
"description": "A React UI component library based on Tailwind CSS",
5+
"author": "Tareq Hasan",
6+
"license": "MIT",
7+
"homepage": "https://github.com/weDevsOfficial/tail-react",
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/weDevsOfficial/tail-react.git"
11+
},
12+
"bugs": {
13+
"url": "https://github.com/weDevsOfficial/tail-react/issues"
14+
},
15+
"keywords": [
16+
"react",
17+
"tailwind",
18+
"tailwindcss",
19+
"tailwindcss-components",
20+
"tailwindcss-react"
21+
],
522
"type": "module",
23+
"files": [
24+
"dist"
25+
],
26+
"main": "./dist/index.umd.cjs",
27+
"module": "./dist/index.js",
28+
"types": "./dist/index.d.ts",
29+
"exports": {
30+
".": {
31+
"import": "./dist/index.js",
32+
"require": "./dist/index.umd.cjs"
33+
}
34+
},
635
"scripts": {
736
"dev": "vite",
837
"build": "tsc && vite build",
@@ -19,6 +48,7 @@
1948
},
2049
"devDependencies": {
2150
"@tailwindcss/forms": "^0.5.4",
51+
"@types/node": "^20.4.7",
2252
"@types/react": "^18.2.15",
2353
"@types/react-dom": "^18.2.7",
2454
"@typescript-eslint/eslint-plugin": "^6.0.0",
@@ -28,9 +58,11 @@
2858
"eslint": "^8.45.0",
2959
"eslint-plugin-react-hooks": "^4.6.0",
3060
"eslint-plugin-react-refresh": "^0.4.3",
61+
"path": "^0.12.7",
3162
"postcss": "^8.4.27",
3263
"tailwindcss": "^3.3.3",
3364
"typescript": "^5.0.2",
34-
"vite": "^4.4.5"
65+
"vite": "^4.4.5",
66+
"vite-plugin-dts": "^3.4.0"
3567
}
3668
}

src/App.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import ButtonExample from '@/Components/Button/Example';
2-
import TableExample from '@/Components/Table/Example';
32
import DropdownExample from '@/Components/Dropdown/Example';
3+
import TableExample from '@/Components/Table/Example';
44
import TextExample from '@/Components/TextField/Example';
5-
import ModalExample from './Components/Modal/Example';
65
import ContextulExample from './Components/ContextualHelp/Example';
6+
import ModalExample from './Components/Modal/Example';
77
import SwitchExample from './Components/SwitchInput/Example';
88

99
const App = () => {
1010
return (
1111
<div className="container mx-auto p-12">
12-
{/* <TextExample /> */}
13-
{/* <DropdownExample /> */}
14-
{/* <TableExample /> */}
15-
{/* <ButtonExample /> */}
16-
{/* <ModalExample /> */}
17-
{/* <ContextulExample /> */}
12+
<TextExample />
13+
<DropdownExample />
14+
<TableExample />
15+
<ButtonExample />
16+
<ModalExample />
17+
<ContextulExample />
1818
<SwitchExample />
1919
</div>
2020
);

src/Components/ContextualHelp/ContextualHelp.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useRef, useEffect, PropsWithChildren } from 'react';
1+
import { useState, useRef, useEffect, PropsWithChildren } from 'react';
22
import { twMerge } from 'tailwind-merge';
33
import { Transition } from '@headlessui/react';
44
import { QuestionMarkCircleIcon } from '@heroicons/react/24/outline';

src/Components/ContextualHelp/Example.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react';
2-
31
import { ContextualHelp } from './ContextualHelp';
42

53
const ContextulExample = () => {

src/Components/Modal/ConfirmModal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ const ConfirmModal = ({
5757
);
5858
};
5959

60-
export default ConfirmModal;
60+
export { ConfirmModal };

src/Components/Modal/Example.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React, { useState } from 'react';
1+
import { useState } from 'react';
22

33
import { Modal, ModalActions, ModalBody, ModalHeader } from './Modal';
44
import { Button } from '@/Components/Button';
5-
import ConfirmModal from './ConfirmModal';
5+
import { ConfirmModal } from './ConfirmModal';
66

77
const ModalExample = () => {
88
const [isOpen, setIsOpen] = useState(false);

src/Components/Modal/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './Modal';
2+
export * from './ConfirmModal';

src/Components/SwitchInput/SwitchInput.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect, ReactNode } from 'react';
1+
import { useState, useEffect, ReactNode } from 'react';
22
import { Switch } from '@headlessui/react';
33
import classNames from 'classnames';
44

src/Components/TextField/Example.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Fragment, useState } from 'react';
1+
import { Fragment, useState } from 'react';
22
import TextField from './TextField';
33
import { EnvelopeIcon, UserIcon } from '@heroicons/react/24/outline';
44

src/Components/index.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export * from './Button';
2+
export * from './ContextualHelp';
3+
export * from './Dropdown';
4+
export * from './Modal';
5+
export * from './SwitchInput';
6+
export * from './Table';
7+
export * from './TextField';

src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './Components';

tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"@/*": ["./src/*"]
2424
}
2525
},
26-
"include": ["src"],
26+
"include": ["src/**/*"],
27+
"exclude": ["src/App.tsx", "src/Components/**/Example.tsx"],
2728
"references": [{ "path": "./tsconfig.node.json" }]
2829
}

vite.config.ts

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,35 @@
11
import { defineConfig } from 'vite';
22
import react from '@vitejs/plugin-react';
3+
import dts from 'vite-plugin-dts';
4+
import { resolve } from 'path';
35

46
// https://vitejs.dev/config/
57
export default defineConfig({
6-
plugins: [react()],
8+
plugins: [
9+
react(),
10+
dts({
11+
insertTypesEntry: true,
12+
}),
13+
],
714
resolve: {
815
alias: {
916
'@': '/src',
1017
},
1118
},
19+
build: {
20+
lib: {
21+
entry: resolve(__dirname, 'src/index.ts'),
22+
name: 'tail-react',
23+
fileName: 'index',
24+
},
25+
rollupOptions: {
26+
external: ['react', 'react-dom'],
27+
output: {
28+
globals: {
29+
react: 'React',
30+
'react-dom': 'ReactDOM',
31+
},
32+
},
33+
},
34+
},
1235
});

0 commit comments

Comments
 (0)