@cofhe/react 0.0.0-alpha-20260413110630 → 0.0.0-alpha-20260518122951
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 +46 -16
- package/dist/chunk-6ZQHUMPQ.cjs +5629 -0
- package/dist/chunk-6ZQHUMPQ.cjs.map +1 -0
- package/dist/chunk-GKUSKEHQ.js +5629 -0
- package/dist/chunk-GKUSKEHQ.js.map +1 -0
- package/dist/index.cjs +4 -17200
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -275
- package/dist/index.d.ts +28 -275
- package/dist/index.js +58 -17201
- package/dist/index.js.map +1 -1
- package/dist/styles.css +163 -144
- 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 +42 -37
- package/dist/index.css +0 -2032
- package/dist/index.css.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @cofhe/react
|
|
2
2
|
|
|
3
|
-
React component and hook for the CoFHE SDK - featuring the advanced
|
|
3
|
+
React component and hook for the CoFHE SDK - featuring the advanced CofheEncryptInput component.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -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,14 +29,49 @@ function App() {
|
|
|
30
29
|
}
|
|
31
30
|
```
|
|
32
31
|
|
|
33
|
-
###
|
|
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`:
|
|
34
49
|
|
|
35
50
|
```tsx
|
|
36
|
-
import {
|
|
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
|
+
|
|
66
|
+
### 2. Use the CofheEncryptInput component
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
import { FheTypesList } from '@cofhe/react';
|
|
70
|
+
import { CofheEncryptInput } from '@cofhe/react/ui';
|
|
37
71
|
|
|
38
72
|
function MyComponent() {
|
|
39
73
|
return (
|
|
40
|
-
<
|
|
74
|
+
<CofheEncryptInput
|
|
41
75
|
placeholder="Enter value to encrypt..."
|
|
42
76
|
options={FheTypesList} // Pre-defined FHE types
|
|
43
77
|
showProgressBar={true}
|
|
@@ -75,7 +109,7 @@ function CustomComponent() {
|
|
|
75
109
|
}
|
|
76
110
|
```
|
|
77
111
|
|
|
78
|
-
##
|
|
112
|
+
## CofheEncryptInput Component
|
|
79
113
|
|
|
80
114
|
Advanced input component with integrated features:
|
|
81
115
|
|
|
@@ -85,7 +119,7 @@ Advanced input component with integrated features:
|
|
|
85
119
|
- ✅ **Real-time Input Validation** - Validates input against selected FHE type
|
|
86
120
|
- ✅ **Progress Tracking** - Shows encryption steps with progress bar
|
|
87
121
|
- ✅ **Copy to Clipboard** - Copy encrypted results with one click
|
|
88
|
-
- ✅ **
|
|
122
|
+
- ✅ **Bundled Iconography** - Consistent icons with no extra consumer install
|
|
89
123
|
- ✅ **Responsive Design** - Works on desktop and mobile
|
|
90
124
|
- ✅ **Dark Mode Support** - Automatic dark/light theme support
|
|
91
125
|
- ✅ **TypeScript Support** - Full type safety
|
|
@@ -93,7 +127,7 @@ Advanced input component with integrated features:
|
|
|
93
127
|
### Props
|
|
94
128
|
|
|
95
129
|
```tsx
|
|
96
|
-
interface
|
|
130
|
+
interface CofheEncryptInputProps {
|
|
97
131
|
placeholder?: string;
|
|
98
132
|
initialValue?: string;
|
|
99
133
|
options?: FheTypeOption[]; // Use FheTypesList or custom options
|
|
@@ -131,20 +165,16 @@ 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
|
|
|
144
174
|
### Required Peer Dependencies
|
|
145
175
|
|
|
146
|
-
- `react` ^16.8.0 || ^17.0.0 || ^18.0.0
|
|
147
|
-
- `react-dom` ^16.8.0 || ^17.0.0 || ^18.0.0
|
|
176
|
+
- `react` ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
|
177
|
+
- `react-dom` ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
|
148
178
|
- `viem` ^2.38.6
|
|
149
179
|
|
|
150
180
|
### CoFHE SDK Dependencies
|