aidos-ui 3.0.6 → 3.0.8
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/dist/Card.d.ts +4 -4
- package/dist/Card.js +10 -8
- package/dist/Card.js.map +1 -1
- package/dist/Select.d.ts +10 -0
- package/dist/Select.js +15 -0
- package/dist/Select.js.map +1 -0
- package/dist/TextArea.d.ts +2 -1
- package/dist/TextArea.js +12 -7
- package/dist/TextArea.js.map +1 -1
- package/dist/TextInputWithState.d.ts +1 -3
- package/dist/TextInputWithState.js +1 -1
- package/dist/TextInputWithState.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Card.tsx +23 -10
- package/src/Select.tsx +37 -0
- package/src/TextArea.tsx +20 -7
- package/src/TextInputWithState.tsx +1 -4
- package/src/docs/pages.ts +1 -0
- package/src/docs/searchIndex.ts +1 -1
- package/src/index.ts +2 -1
- package/src/pages/Card.mdx +71 -0
- package/src/pages/_app.tsx +27 -17
package/src/index.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./aria";
|
|
2
1
|
export * from "./Badge";
|
|
3
2
|
export * from "./BaseButton";
|
|
4
3
|
export * from "./BaseInput";
|
|
@@ -11,6 +10,7 @@ export * from "./Box";
|
|
|
11
10
|
export * from "./Button";
|
|
12
11
|
export * from "./Calendar";
|
|
13
12
|
export * from "./Checkbox";
|
|
13
|
+
export * from "./Card";
|
|
14
14
|
export * from "./Circle";
|
|
15
15
|
export * from "./Column";
|
|
16
16
|
export * from "./DarkMode";
|
|
@@ -46,6 +46,7 @@ export * from "./RootView";
|
|
|
46
46
|
export * from "./Row";
|
|
47
47
|
export * from "./StackContext";
|
|
48
48
|
export * from "./stateMachineContextFactory";
|
|
49
|
+
export * from "./Select";
|
|
49
50
|
export * from "./StaticCheckbox";
|
|
50
51
|
export * from "./Storage";
|
|
51
52
|
export * from "./Stream";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Card } from "../Card";
|
|
2
|
+
import { Button } from "../Button";
|
|
3
|
+
import { TextInput } from "../TextInput";
|
|
4
|
+
import { TextArea } from "../TextArea";
|
|
5
|
+
import { H2, P } from "../Text";
|
|
6
|
+
|
|
7
|
+
# Card
|
|
8
|
+
|
|
9
|
+
Cards can be used to make give cohesion to some UI elements, grouping them visually in a distinct way.
|
|
10
|
+
|
|
11
|
+
<Card>
|
|
12
|
+
<H2>Contact Us</H2>
|
|
13
|
+
<P>If you have any questions or inquiries, please feel free to contact us.</P>
|
|
14
|
+
<TextInput
|
|
15
|
+
name="email"
|
|
16
|
+
placeholder="Email"
|
|
17
|
+
value={null}
|
|
18
|
+
padding={"medium"}
|
|
19
|
+
type="email"
|
|
20
|
+
onValueChange={() => {}}
|
|
21
|
+
/>
|
|
22
|
+
<TextArea
|
|
23
|
+
jsStyle={{
|
|
24
|
+
resize: "vertical",
|
|
25
|
+
}}
|
|
26
|
+
name="message"
|
|
27
|
+
placeholder="Type your query here..."
|
|
28
|
+
value={null}
|
|
29
|
+
type="text"
|
|
30
|
+
onValueChange={() => {}}
|
|
31
|
+
/>
|
|
32
|
+
<Button
|
|
33
|
+
jsStyle={{ animation: "all 1s ease-out" }}
|
|
34
|
+
onClick={() => {}}
|
|
35
|
+
type="submit"
|
|
36
|
+
label="Subscribe"
|
|
37
|
+
color="positive"
|
|
38
|
+
/>
|
|
39
|
+
</Card>
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
<Card>
|
|
43
|
+
<H2>Contact Us</H2>
|
|
44
|
+
<P>If you have any questions or inquiries, please feel free to contact us.</P>
|
|
45
|
+
<TextInput
|
|
46
|
+
name="email"
|
|
47
|
+
placeholder="Email"
|
|
48
|
+
value={null}
|
|
49
|
+
padding={"medium"}
|
|
50
|
+
type="email"
|
|
51
|
+
onValueChange={() => {}}
|
|
52
|
+
/>
|
|
53
|
+
<TextArea
|
|
54
|
+
jsStyle={{
|
|
55
|
+
resize: "vertical",
|
|
56
|
+
}}
|
|
57
|
+
name="message"
|
|
58
|
+
placeholder="Type your query here..."
|
|
59
|
+
value={null}
|
|
60
|
+
type="text"
|
|
61
|
+
onValueChange={() => {}}
|
|
62
|
+
/>
|
|
63
|
+
<Button
|
|
64
|
+
jsStyle={{ animation: "all 1s ease-out" }}
|
|
65
|
+
onClick={() => {}}
|
|
66
|
+
type="submit"
|
|
67
|
+
label="Subscribe"
|
|
68
|
+
color="positive"
|
|
69
|
+
/>
|
|
70
|
+
</Card>
|
|
71
|
+
```
|
package/src/pages/_app.tsx
CHANGED
|
@@ -33,7 +33,7 @@ import { Column } from "../Column";
|
|
|
33
33
|
import { Icon } from "../Icon";
|
|
34
34
|
import { BaseLinkComponentOverrideContext } from "../BaseLink";
|
|
35
35
|
import { DocsMDXProvider, labelToID } from "../docs/mdx";
|
|
36
|
-
import { dot } from "@xenova/transformers";
|
|
36
|
+
import { Pipeline, dot, pipeline } from "@xenova/transformers";
|
|
37
37
|
import { pages } from "../docs/pages";
|
|
38
38
|
|
|
39
39
|
const transformers = import("@xenova/transformers");
|
|
@@ -141,35 +141,37 @@ export default function App({ Component, pageProps }: AppProps) {
|
|
|
141
141
|
queryIndexRef.current = queryIndex;
|
|
142
142
|
}, [queryIndex]);
|
|
143
143
|
|
|
144
|
+
const stateRef = useRef<string | null>(null);
|
|
145
|
+
|
|
144
146
|
useEffect(() => {
|
|
145
147
|
if (sanetisedQuery.length === 0) {
|
|
146
148
|
return;
|
|
147
149
|
}
|
|
148
150
|
|
|
149
|
-
|
|
151
|
+
const effectId = self.crypto.randomUUID();
|
|
152
|
+
stateRef.current = effectId;
|
|
153
|
+
|
|
154
|
+
const isInvalid = () => effectId !== stateRef.current;
|
|
150
155
|
|
|
151
156
|
async function run() {
|
|
152
157
|
const data = await searchIndex;
|
|
153
158
|
|
|
154
|
-
if (
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
const { pipeline } = await transformers;
|
|
158
|
-
if (state.cancel) {
|
|
159
|
+
if (isInvalid()) {
|
|
159
160
|
return;
|
|
160
161
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
)
|
|
165
|
-
if (state.cancel) {
|
|
162
|
+
|
|
163
|
+
const generateEmbeddings = await loadModel();
|
|
164
|
+
|
|
165
|
+
if (isInvalid()) {
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
|
+
|
|
168
169
|
const queryEmbeddings = await generateEmbeddings(query, {
|
|
169
170
|
normalize: true,
|
|
170
171
|
pooling: "mean",
|
|
171
172
|
}).then((embedding) => embedding.data);
|
|
172
|
-
|
|
173
|
+
|
|
174
|
+
if (isInvalid()) {
|
|
173
175
|
return;
|
|
174
176
|
}
|
|
175
177
|
|
|
@@ -209,10 +211,6 @@ export default function App({ Component, pageProps }: AppProps) {
|
|
|
209
211
|
}
|
|
210
212
|
|
|
211
213
|
run();
|
|
212
|
-
|
|
213
|
-
return () => {
|
|
214
|
-
state.cancel = true;
|
|
215
|
-
};
|
|
216
214
|
}, [sanetisedQuery]);
|
|
217
215
|
|
|
218
216
|
useEffect(() => {
|
|
@@ -433,3 +431,15 @@ export default function App({ Component, pageProps }: AppProps) {
|
|
|
433
431
|
</>
|
|
434
432
|
);
|
|
435
433
|
}
|
|
434
|
+
|
|
435
|
+
let modelPromise: Promise<Pipeline> | null = null;
|
|
436
|
+
|
|
437
|
+
const loadModel: () => Promise<Pipeline> = async () => {
|
|
438
|
+
const { pipeline } = await transformers;
|
|
439
|
+
if (modelPromise == null) {
|
|
440
|
+
modelPromise = pipeline("feature-extraction", "Xenova/all-MiniLM-L6-v2");
|
|
441
|
+
}
|
|
442
|
+
const generateEmbeddings = await modelPromise;
|
|
443
|
+
|
|
444
|
+
return generateEmbeddings;
|
|
445
|
+
};
|