@kittycad/react-shared 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.esm.js +2548 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2551 -0
- package/dist/index.js.map +1 -0
- package/package.json +73 -0
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# @kittycad/react-shared
|
|
2
|
+
|
|
3
|
+
Shared React components for KittyCAD applications.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @kittycad/react-shared
|
|
9
|
+
# or
|
|
10
|
+
yarn add @kittycad/react-shared
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Button } from '@kittycad/react-shared'
|
|
17
|
+
|
|
18
|
+
function App() {
|
|
19
|
+
return (
|
|
20
|
+
<Button variant="primary" size="md" onClick={() => console.log('Clicked!')}>
|
|
21
|
+
Click me
|
|
22
|
+
</Button>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Development
|
|
28
|
+
|
|
29
|
+
### Prerequisites
|
|
30
|
+
|
|
31
|
+
- Node.js 20+
|
|
32
|
+
- npm or yarn
|
|
33
|
+
|
|
34
|
+
### Setup
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Install dependencies
|
|
38
|
+
npm install
|
|
39
|
+
|
|
40
|
+
# Start Storybook for development
|
|
41
|
+
npm run dev
|
|
42
|
+
|
|
43
|
+
# Build the library
|
|
44
|
+
npm run build
|
|
45
|
+
|
|
46
|
+
# Run tests
|
|
47
|
+
npm test
|
|
48
|
+
|
|
49
|
+
# Type checking
|
|
50
|
+
npm run tsc
|
|
51
|
+
|
|
52
|
+
# Linting and formatting
|
|
53
|
+
npm run lint
|
|
54
|
+
npm run fmt
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Available Components
|
|
58
|
+
|
|
59
|
+
- **Button**: A customizable button component with multiple variants and sizes
|
|
60
|
+
|
|
61
|
+
### Storybook
|
|
62
|
+
|
|
63
|
+
This project uses Storybook for component development and documentation. Run `npm run dev` to start the Storybook development server.
|
|
64
|
+
|
|
65
|
+
### Publishing
|
|
66
|
+
|
|
67
|
+
The library is automatically published to npm when a new git tag is created:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Create a new version
|
|
71
|
+
npm version patch # or minor, major
|
|
72
|
+
|
|
73
|
+
# Push with tags
|
|
74
|
+
git push --follow-tags
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
This will trigger the GitHub Action to publish to npm.
|
|
78
|
+
|
|
79
|
+
## Contributing
|
|
80
|
+
|
|
81
|
+
1. Fork the repository
|
|
82
|
+
2. Create a feature branch
|
|
83
|
+
3. Make your changes
|
|
84
|
+
4. Add tests and stories for new components
|
|
85
|
+
5. Run `npm run lint` and `npm run type-check`
|
|
86
|
+
6. Submit a pull request
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ClassValue } from 'clsx';
|
|
3
|
+
|
|
4
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
variant?: 'primary' | 'secondary' | 'outline' | 'ghost';
|
|
6
|
+
size?: 'sm' | 'md' | 'lg';
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
|
|
11
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
12
|
+
|
|
13
|
+
export { Button, cn };
|
|
14
|
+
export type { ButtonProps };
|