@deframe-sdk/components 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 +174 -0
- package/dist/index.d.mts +556 -0
- package/dist/index.d.ts +556 -0
- package/dist/index.js +1678 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1618 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +2247 -0
- package/package.json +75 -0
package/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# @deframe-sdk/components
|
|
2
|
+
|
|
3
|
+
Deframe SDK React component library built with TypeScript and Tailwind CSS.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @deframe-sdk/components
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Importing Styles
|
|
14
|
+
|
|
15
|
+
**Important:** You must import the CSS file for the components to render correctly with their styles.
|
|
16
|
+
|
|
17
|
+
In your main application file (e.g., `_app.tsx`, `main.tsx`, or `index.tsx`):
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
// Import the component styles
|
|
21
|
+
import '@deframe-sdk/components/styles.css'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or in your main CSS file:
|
|
25
|
+
|
|
26
|
+
```css
|
|
27
|
+
@import '@deframe-sdk/components/styles.css';
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Importing Components
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { PrimaryButton, SecondaryButton, TertiaryButton } from '@deframe-sdk/components'
|
|
34
|
+
|
|
35
|
+
function App() {
|
|
36
|
+
return (
|
|
37
|
+
<div>
|
|
38
|
+
<PrimaryButton onClick={() => console.log('clicked')}>
|
|
39
|
+
Primary Action
|
|
40
|
+
</PrimaryButton>
|
|
41
|
+
|
|
42
|
+
<SecondaryButton disabled={false}>
|
|
43
|
+
Secondary Action
|
|
44
|
+
</SecondaryButton>
|
|
45
|
+
|
|
46
|
+
<TertiaryButton type="submit">
|
|
47
|
+
Submit
|
|
48
|
+
</TertiaryButton>
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Available Components
|
|
55
|
+
|
|
56
|
+
### Buttons
|
|
57
|
+
- **PrimaryButton** - Main call-to-action button
|
|
58
|
+
- **SecondaryButton** - Secondary action button with outline
|
|
59
|
+
- **TertiaryButton** - Tertiary action button with subtle styling
|
|
60
|
+
- **ActionButton** - Action button variant
|
|
61
|
+
- **PercentageButton** - Percentage selector button
|
|
62
|
+
|
|
63
|
+
### Component Props
|
|
64
|
+
|
|
65
|
+
All button components share the same props interface:
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
interface ButtonProps {
|
|
69
|
+
children: React.ReactNode;
|
|
70
|
+
disabled?: boolean;
|
|
71
|
+
className?: string;
|
|
72
|
+
type?: 'button' | 'submit' | 'reset';
|
|
73
|
+
onClick?: () => void;
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Development
|
|
78
|
+
|
|
79
|
+
### Running Storybook
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm run storybook
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
View components in Storybook at [http://localhost:6006](http://localhost:6006)
|
|
86
|
+
|
|
87
|
+
### Building the Library
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npm run build:lib
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
This will generate:
|
|
94
|
+
- CommonJS bundle (`dist/index.js`)
|
|
95
|
+
- ES Module bundle (`dist/index.mjs`)
|
|
96
|
+
- TypeScript declarations (`dist/index.d.ts`, `dist/index.d.mts`)
|
|
97
|
+
- Compiled CSS with all styles (`dist/styles.css`)
|
|
98
|
+
- Source maps
|
|
99
|
+
|
|
100
|
+
### Project Structure
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
src/
|
|
104
|
+
├── index.ts # Main entry point, exports all components
|
|
105
|
+
├── stories/
|
|
106
|
+
│ └── buttons/
|
|
107
|
+
│ ├── PrimaryButton.tsx
|
|
108
|
+
│ ├── SecondaryButton.tsx
|
|
109
|
+
│ ├── TertiaryButton.tsx
|
|
110
|
+
│ ├── ActionButton.tsx
|
|
111
|
+
│ └── PercentageButton.tsx
|
|
112
|
+
└── styles/
|
|
113
|
+
└── globals.css # Tailwind CSS configuration
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Publishing
|
|
117
|
+
|
|
118
|
+
The package is configured to automatically build before publishing:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Bump version
|
|
122
|
+
npm version patch # or minor, major
|
|
123
|
+
|
|
124
|
+
# Publish to npm
|
|
125
|
+
npm publish
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The `prepublishOnly` script will automatically run `build:lib` before publishing.
|
|
129
|
+
|
|
130
|
+
### Publishing to GitHub Packages
|
|
131
|
+
|
|
132
|
+
To publish to GitHub Packages instead of npm:
|
|
133
|
+
|
|
134
|
+
1. Update package.json to add publishConfig:
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"publishConfig": {
|
|
138
|
+
"registry": "https://npm.pkg.github.com"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
2. Authenticate with GitHub Packages:
|
|
144
|
+
```bash
|
|
145
|
+
npm login --registry=https://npm.pkg.github.com
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
3. Publish:
|
|
149
|
+
```bash
|
|
150
|
+
npm publish
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Local Development
|
|
154
|
+
|
|
155
|
+
To test the library locally in another project:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# In this project
|
|
159
|
+
npm run build:lib
|
|
160
|
+
npm link
|
|
161
|
+
|
|
162
|
+
# In your consuming project
|
|
163
|
+
npm link @deframe-sdk/components
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Peer Dependencies
|
|
167
|
+
|
|
168
|
+
This package requires:
|
|
169
|
+
- React >= 18.0.0
|
|
170
|
+
- React DOM >= 18.0.0
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
MIT
|