@examplary/ui 1.35.0 → 1.36.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.
@@ -0,0 +1 @@
1
+ export declare function AiSpinner(props: Omit<React.SVGProps<SVGSVGElement>, "style">): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { motion } from "motion/react";
14
+ import { useSpinLoop } from "../../lib/use-spin-loop";
15
+ import { cn } from "../../utils";
16
+ export function AiSpinner(props) {
17
+ var rotate = useSpinLoop();
18
+ return (_jsx(motion.svg, __assign({ width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, props, { className: cn("text-fuchsia-400", props.className), style: { rotate: rotate }, children: _jsx("path", { d: "M8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0ZM8.36621 3.70703C8.16407 3.5049 7.83594 3.50492 7.63379 3.70703L7.55469 3.78613C6.88523 5.5116 5.51162 6.88527 3.78613 7.55469L3.70703 7.63379C3.50492 7.83594 3.5049 8.16407 3.70703 8.36621L3.78516 8.44434C5.51093 9.11363 6.88511 10.4882 7.55469 12.2139L7.63379 12.293C7.83594 12.495 8.16409 12.495 8.36621 12.293L8.44434 12.2139C9.11375 10.4881 10.4881 9.11379 12.2139 8.44434L12.293 8.36621C12.495 8.16409 12.495 7.83594 12.293 7.63379L12.2139 7.55469C10.4882 6.88511 9.11363 5.51093 8.44434 3.78516L8.36621 3.70703Z", fill: "currentColor" }) })));
19
+ }
@@ -0,0 +1 @@
1
+ export * from "./ai-spinner";
@@ -0,0 +1 @@
1
+ export * from "./ai-spinner";
package/dist/index.d.ts CHANGED
@@ -6,5 +6,6 @@ export * from "./components/print";
6
6
  export * from "./components/chat";
7
7
  export * from "./components/brand";
8
8
  export * from "./components/ai";
9
+ export * from "./components/loading";
9
10
  export * from "./utils";
10
11
  export * from "./types";
package/dist/index.js CHANGED
@@ -6,5 +6,6 @@ export * from "./components/print";
6
6
  export * from "./components/chat";
7
7
  export * from "./components/brand";
8
8
  export * from "./components/ai";
9
+ export * from "./components/loading";
9
10
  export * from "./utils";
10
11
  export * from "./types";
@@ -0,0 +1 @@
1
+ export declare function useSpinLoop(): import("motion-dom").MotionValue<number>;
@@ -0,0 +1,79 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { useEffect } from "react";
38
+ import { useMotionValue, animate } from "motion/react";
39
+ export function useSpinLoop() {
40
+ var _this = this;
41
+ var rotation = useMotionValue(0);
42
+ useEffect(function () {
43
+ var cancelled = false;
44
+ var sleep = function (ms) { return new Promise(function (r) { return setTimeout(r, ms); }); };
45
+ var loop = function () { return __awaiter(_this, void 0, void 0, function () {
46
+ return __generator(this, function (_a) {
47
+ switch (_a.label) {
48
+ case 0: return [4 /*yield*/, animate(rotation, rotation.get() + 2880, {
49
+ duration: 2.5,
50
+ ease: [0.05, 0.8, 0.2, 1],
51
+ })];
52
+ case 1:
53
+ _a.sent();
54
+ _a.label = 2;
55
+ case 2:
56
+ if (!!cancelled) return [3 /*break*/, 5];
57
+ return [4 /*yield*/, sleep(1200)];
58
+ case 3:
59
+ _a.sent();
60
+ if (cancelled)
61
+ return [3 /*break*/, 5];
62
+ return [4 /*yield*/, animate(rotation, rotation.get() + 2880, {
63
+ duration: 2.5,
64
+ ease: [0.35, 0, 0.2, 1],
65
+ })];
66
+ case 4:
67
+ _a.sent();
68
+ return [3 /*break*/, 2];
69
+ case 5: return [2 /*return*/];
70
+ }
71
+ });
72
+ }); };
73
+ loop();
74
+ return function () {
75
+ cancelled = true;
76
+ };
77
+ }, [rotation]);
78
+ return rotation;
79
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@examplary/ui",
3
3
  "description": "UI components for the Examplary testing platform.",
4
4
  "packageManager": "yarn@4.5.3",
5
- "version": "1.35.0",
5
+ "version": "1.36.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "files": [
@@ -57,6 +57,7 @@
57
57
  "lucide-react": "^0.575.0",
58
58
  "lucide-static": "^0.575.0",
59
59
  "mathlive": "0.108.3",
60
+ "motion": "^12.35.0",
60
61
  "react-colorful": "^5.6.1",
61
62
  "react-hook-form": "^7.65.0",
62
63
  "react-hot-toast": "^2.6.0",