@cofhe/react 0.5.1 → 0.5.2
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 +38 -8
- package/dist/chunk-3YAGCPSA.cjs +5630 -0
- package/dist/chunk-3YAGCPSA.cjs.map +1 -0
- package/dist/chunk-N3S7TQY6.js +5630 -0
- package/dist/chunk-N3S7TQY6.js.map +1 -0
- package/dist/index.cjs +4 -10968
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -315
- package/dist/index.d.ts +7 -315
- package/dist/index.js +56 -10973
- package/dist/index.js.map +1 -1
- package/dist/types-BzYdBjL5.d.cts +234 -0
- package/dist/types-BzYdBjL5.d.ts +234 -0
- package/dist/ui-base.cjs +5543 -0
- package/dist/ui-base.cjs.map +1 -0
- package/dist/ui-base.d.cts +86 -0
- package/dist/ui-base.d.ts +86 -0
- package/dist/ui-base.js +5543 -0
- package/dist/ui-base.js.map +1 -0
- package/dist/ui.cjs +2 -0
- package/dist/ui.js +2 -0
- package/package.json +14 -7
- package/dist/index.css +0 -2051
- package/dist/index.css.map +0 -1
package/README.md
CHANGED
|
@@ -16,7 +16,6 @@ pnpm add @cofhe/react @cofhe/sdk
|
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
18
|
import { CofheProvider } from '@cofhe/react';
|
|
19
|
-
import '@cofhe/react/styles.css'; // Import component styles
|
|
20
19
|
import { createCofheClient } from '@cofhe/sdk/web';
|
|
21
20
|
|
|
22
21
|
const client = createCofheClient(config);
|
|
@@ -30,10 +29,45 @@ function App() {
|
|
|
30
29
|
}
|
|
31
30
|
```
|
|
32
31
|
|
|
32
|
+
### Hooks-only usage
|
|
33
|
+
|
|
34
|
+
If you only want hooks/providers and do not want package CSS or UI components, import from the root package only:
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { CofheProvider, useCofheClient } from '@cofhe/react';
|
|
38
|
+
|
|
39
|
+
function App() {
|
|
40
|
+
return (
|
|
41
|
+
<CofheProvider config={config}>
|
|
42
|
+
<YourHookDrivenApp />
|
|
43
|
+
</CofheProvider>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If you do want the styled React UI components, import them from `@cofhe/react/ui`:
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import { CofheProvider } from '@cofhe/react';
|
|
52
|
+
import { CofheFloatingButtonWithProvider } from '@cofhe/react/ui';
|
|
53
|
+
|
|
54
|
+
function App() {
|
|
55
|
+
return (
|
|
56
|
+
<CofheProvider config={config}>
|
|
57
|
+
<YourApp />
|
|
58
|
+
<CofheFloatingButtonWithProvider />
|
|
59
|
+
</CofheProvider>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The `@cofhe/react/ui` entrypoint includes the package styles automatically.
|
|
65
|
+
|
|
33
66
|
### 2. Use the CofheEncryptInput component
|
|
34
67
|
|
|
35
68
|
```tsx
|
|
36
|
-
import {
|
|
69
|
+
import { FheTypesList } from '@cofhe/react';
|
|
70
|
+
import { CofheEncryptInput } from '@cofhe/react/ui';
|
|
37
71
|
|
|
38
72
|
function MyComponent() {
|
|
39
73
|
return (
|
|
@@ -131,13 +165,9 @@ const {
|
|
|
131
165
|
|
|
132
166
|
## Styling
|
|
133
167
|
|
|
134
|
-
The
|
|
135
|
-
|
|
136
|
-
```tsx
|
|
137
|
-
import '@cofhe/react/styles.css';
|
|
138
|
-
```
|
|
168
|
+
The root `@cofhe/react` entrypoint is headless and does not load package styles.
|
|
139
169
|
|
|
140
|
-
If you
|
|
170
|
+
If you import components from `@cofhe/react/ui`, the package styles are loaded automatically.
|
|
141
171
|
|
|
142
172
|
## Dependencies
|
|
143
173
|
|