@terreno/ui 0.23.1 → 0.24.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/dist/AiSuggestionBox.d.ts +11 -0
- package/dist/AiSuggestionBox.js +50 -23
- package/dist/AiSuggestionBox.js.map +1 -1
- package/dist/Common.d.ts +9 -1
- package/dist/Common.js.map +1 -1
- package/dist/icons/SparklesIcon.d.ts +7 -0
- package/dist/icons/SparklesIcon.js +32 -0
- package/dist/icons/SparklesIcon.js.map +1 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/icons/index.js.map +1 -1
- package/package.json +1 -1
- package/src/ActionSheet.test.tsx +96 -0
- package/src/AiSuggestionBox.test.tsx +184 -15
- package/src/AiSuggestionBox.tsx +72 -55
- package/src/Common.ts +9 -1
- package/src/__snapshots__/AiSuggestionBox.test.tsx.snap +489 -102
- package/src/icons/SparklesIcon.test.tsx +16 -0
- package/src/icons/SparklesIcon.tsx +38 -0
- package/src/icons/__snapshots__/SparklesIcon.test.tsx.snap +47 -0
- package/src/icons/index.ts +1 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {describe, expect, it} from "bun:test";
|
|
2
|
+
import {render} from "@testing-library/react-native";
|
|
3
|
+
|
|
4
|
+
import {SparklesIcon} from "./SparklesIcon";
|
|
5
|
+
|
|
6
|
+
describe("SparklesIcon", () => {
|
|
7
|
+
it("renders correctly", () => {
|
|
8
|
+
const {toJSON} = render(<SparklesIcon />);
|
|
9
|
+
expect(toJSON()).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("accepts custom props", () => {
|
|
13
|
+
const {toJSON} = render(<SparklesIcon fill="#0A0A0A" height={24} width={24} />);
|
|
14
|
+
expect(toJSON()).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import Svg, {Path, type SvgProps} from "react-native-svg";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Builds a four-pointed sparkle path with concave edges, centered at (cx, cy) with
|
|
6
|
+
* outer radius r. FontAwesome 6 free has no standalone `sparkles` glyph (it is a Pro
|
|
7
|
+
* icon), so the glyph is composed locally from three of these sparkle shapes.
|
|
8
|
+
*/
|
|
9
|
+
const sparklePath = (cx: number, cy: number, r: number): string => {
|
|
10
|
+
const pinch = r * 0.16;
|
|
11
|
+
return [
|
|
12
|
+
`M ${cx} ${cy - r}`,
|
|
13
|
+
`Q ${cx + pinch} ${cy - pinch} ${cx + r} ${cy}`,
|
|
14
|
+
`Q ${cx + pinch} ${cy + pinch} ${cx} ${cy + r}`,
|
|
15
|
+
`Q ${cx - pinch} ${cy + pinch} ${cx - r} ${cy}`,
|
|
16
|
+
`Q ${cx - pinch} ${cy - pinch} ${cx} ${cy - r}`,
|
|
17
|
+
"Z",
|
|
18
|
+
].join(" ");
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** One large sparkle with two smaller companions, mirroring Font Awesome's sparkles layout. */
|
|
22
|
+
const SPARKLES_PATH = [
|
|
23
|
+
sparklePath(200, 272, 200),
|
|
24
|
+
sparklePath(420, 92, 88),
|
|
25
|
+
sparklePath(420, 428, 80),
|
|
26
|
+
].join(" ");
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Solid "sparkles" icon (three four-pointed stars). Defaults to 16x16 — pass
|
|
30
|
+
* `height`/`width` to resize and `fill` to recolor.
|
|
31
|
+
*/
|
|
32
|
+
export const SparklesIcon = (props: SvgProps): React.ReactElement => {
|
|
33
|
+
return (
|
|
34
|
+
<Svg fill="currentColor" height={16} viewBox="0 0 512 512" width={16} {...props}>
|
|
35
|
+
<Path d={SPARKLES_PATH} />
|
|
36
|
+
</Svg>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
+
|
|
3
|
+
exports[`SparklesIcon renders correctly 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"$$typeof": Symbol(react.test.json),
|
|
6
|
+
"children": [
|
|
7
|
+
{
|
|
8
|
+
"$$typeof": Symbol(react.test.json),
|
|
9
|
+
"children": null,
|
|
10
|
+
"props": {
|
|
11
|
+
"d": "M 200 72 Q 232 240 400 272 Q 232 304 200 472 Q 168 304 0 272 Q 168 240 200 72 Z M 420 4 Q 434.08 77.92 508 92 Q 434.08 106.08 420 180 Q 405.92 106.08 332 92 Q 405.92 77.92 420 4 Z M 420 348 Q 432.8 415.2 500 428 Q 432.8 440.8 420 508 Q 407.2 440.8 340 428 Q 407.2 415.2 420 348 Z",
|
|
12
|
+
},
|
|
13
|
+
"type": "Path",
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
"props": {
|
|
17
|
+
"fill": "currentColor",
|
|
18
|
+
"height": 16,
|
|
19
|
+
"viewBox": "0 0 512 512",
|
|
20
|
+
"width": 16,
|
|
21
|
+
},
|
|
22
|
+
"type": "Svg",
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
exports[`SparklesIcon accepts custom props 1`] = `
|
|
27
|
+
{
|
|
28
|
+
"$$typeof": Symbol(react.test.json),
|
|
29
|
+
"children": [
|
|
30
|
+
{
|
|
31
|
+
"$$typeof": Symbol(react.test.json),
|
|
32
|
+
"children": null,
|
|
33
|
+
"props": {
|
|
34
|
+
"d": "M 200 72 Q 232 240 400 272 Q 232 304 200 472 Q 168 304 0 272 Q 168 240 200 72 Z M 420 4 Q 434.08 77.92 508 92 Q 434.08 106.08 420 180 Q 405.92 106.08 332 92 Q 405.92 77.92 420 4 Z M 420 348 Q 432.8 415.2 500 428 Q 432.8 440.8 420 508 Q 407.2 440.8 340 428 Q 407.2 415.2 420 348 Z",
|
|
35
|
+
},
|
|
36
|
+
"type": "Path",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
"props": {
|
|
40
|
+
"fill": "#0A0A0A",
|
|
41
|
+
"height": 24,
|
|
42
|
+
"viewBox": "0 0 512 512",
|
|
43
|
+
"width": 24,
|
|
44
|
+
},
|
|
45
|
+
"type": "Svg",
|
|
46
|
+
}
|
|
47
|
+
`;
|
package/src/icons/index.ts
CHANGED