@react-cupertino-ui/ai-loading-state 0.0.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/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Anderson Lima
4
+
5
+ This project is inspired by Apple's design principles but is not affiliated with, endorsed, or sponsored by Apple Inc.
6
+
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
package/dist/index.css ADDED
@@ -0,0 +1,75 @@
1
+ .react-cupertino-ui-ai-loading-state {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ gap: 0.75rem;
5
+ padding: 0.85rem 1.1rem;
6
+ border-radius: 1.25rem;
7
+ background: rgba(13, 13, 15, 0.08);
8
+ backdrop-filter: blur(26px) saturate(160%);
9
+ border: 1px solid rgba(255, 255, 255, 0.2);
10
+ box-shadow: 0 14px 30px rgba(5, 5, 10, 0.15);
11
+ }
12
+ .react-cupertino-ui-ai-loading-state__orb {
13
+ position: relative;
14
+ width: 2.4rem;
15
+ height: 2.4rem;
16
+ border-radius: 999px;
17
+ background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), rgba(0, 0, 0, 0));
18
+ display: inline-flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ overflow: hidden;
22
+ }
23
+ .react-cupertino-ui-ai-loading-state__orb span {
24
+ position: absolute;
25
+ width: 100%;
26
+ height: 100%;
27
+ border-radius: inherit;
28
+ border: 1px solid rgba(255, 255, 255, 0.65);
29
+ animation: ai-orb 1.8s infinite ease-in-out;
30
+ }
31
+ .react-cupertino-ui-ai-loading-state__orb span:nth-child(2) {
32
+ animation-delay: 0.2s;
33
+ }
34
+ .react-cupertino-ui-ai-loading-state__orb span:nth-child(3) {
35
+ animation-delay: 0.4s;
36
+ }
37
+ .react-cupertino-ui-ai-loading-state__text {
38
+ display: flex;
39
+ flex-direction: column;
40
+ gap: 0.1rem;
41
+ color: rgba(10, 10, 15, 0.75);
42
+ }
43
+ .react-cupertino-ui-ai-loading-state__text strong {
44
+ font-size: 0.95rem;
45
+ }
46
+ .react-cupertino-ui-ai-loading-state__text span {
47
+ font-size: 0.85rem;
48
+ color: rgba(10, 10, 15, 0.5);
49
+ }
50
+ .react-cupertino-ui-ai-loading-state.variant-generating {
51
+ background: rgba(15, 10, 60, 0.2);
52
+ }
53
+ .react-cupertino-ui-ai-loading-state.variant-generating .react-cupertino-ui-ai-loading-state__orb {
54
+ background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.95), rgba(15, 10, 60, 0.1));
55
+ }
56
+ .react-cupertino-ui-ai-loading-state.variant-searching {
57
+ background: rgba(0, 122, 255, 0.12);
58
+ }
59
+ .react-cupertino-ui-ai-loading-state.variant-searching .react-cupertino-ui-ai-loading-state__orb {
60
+ background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.95), rgba(0, 122, 255, 0.15));
61
+ }
62
+
63
+ @keyframes ai-orb {
64
+ 0% {
65
+ transform: scale(0.8);
66
+ opacity: 0.9;
67
+ }
68
+ 70% {
69
+ transform: scale(1.3);
70
+ opacity: 0;
71
+ }
72
+ 100% {
73
+ opacity: 0;
74
+ }
75
+ }
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import type { BaseProps } from "@react-cupertino-ui/shared/lib/interfaces/BaseProps";
3
+ import "./index.scss";
4
+ export type AILoadingStateVariant = "thinking" | "generating" | "searching";
5
+ export interface AILoadingStateProps extends Omit<BaseProps<HTMLDivElement>, "children" | "variant" | "size"> {
6
+ variant?: AILoadingStateVariant;
7
+ message?: string;
8
+ }
9
+ declare const AILoadingState: React.ForwardRefExoticComponent<AILoadingStateProps & React.RefAttributes<HTMLDivElement>>;
10
+ export { AILoadingState };
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { cn } from "@react-cupertino-ui/shared/lib/utils";
4
+ import "./index.scss";
5
+ const variantLabel = {
6
+ thinking: "Thinking",
7
+ generating: "Generating",
8
+ searching: "Searching",
9
+ };
10
+ const AILoadingState = React.forwardRef((props, ref) => {
11
+ const { className, variant = "thinking", message, ...rest } = props;
12
+ return (_jsxs("div", { ref: ref, className: cn("react-cupertino-ui-ai-loading-state", `variant-${variant}`, className), role: "status", "aria-live": "polite", ...rest, children: [_jsxs("div", { className: "react-cupertino-ui-ai-loading-state__orb", children: [_jsx("span", {}), _jsx("span", {}), _jsx("span", {})] }), _jsxs("div", { className: "react-cupertino-ui-ai-loading-state__text", children: [_jsx("strong", { children: variantLabel[variant] }), message ? _jsx("span", { children: message }) : null] })] }));
13
+ });
14
+ AILoadingState.displayName = "AILoadingState";
15
+ export { AILoadingState };
@@ -0,0 +1,86 @@
1
+ .react-cupertino-ui-ai-loading-state {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ gap: 0.75rem;
5
+ padding: 0.85rem 1.1rem;
6
+ border-radius: 1.25rem;
7
+ background: rgba(13, 13, 15, 0.08);
8
+ backdrop-filter: blur(26px) saturate(160%);
9
+ border: 1px solid rgba(255, 255, 255, 0.2);
10
+ box-shadow: 0 14px 30px rgba(5, 5, 10, 0.15);
11
+
12
+ &__orb {
13
+ position: relative;
14
+ width: 2.4rem;
15
+ height: 2.4rem;
16
+ border-radius: 999px;
17
+ background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), rgba(0, 0, 0, 0));
18
+ display: inline-flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ overflow: hidden;
22
+
23
+ span {
24
+ position: absolute;
25
+ width: 100%;
26
+ height: 100%;
27
+ border-radius: inherit;
28
+ border: 1px solid rgba(255, 255, 255, 0.65);
29
+ animation: ai-orb 1.8s infinite ease-in-out;
30
+
31
+ &:nth-child(2) {
32
+ animation-delay: 0.2s;
33
+ }
34
+
35
+ &:nth-child(3) {
36
+ animation-delay: 0.4s;
37
+ }
38
+ }
39
+ }
40
+
41
+ &__text {
42
+ display: flex;
43
+ flex-direction: column;
44
+ gap: 0.1rem;
45
+ color: rgba(10, 10, 15, 0.75);
46
+
47
+ strong {
48
+ font-size: 0.95rem;
49
+ }
50
+
51
+ span {
52
+ font-size: 0.85rem;
53
+ color: rgba(10, 10, 15, 0.5);
54
+ }
55
+ }
56
+
57
+ &.variant-generating {
58
+ background: rgba(15, 10, 60, 0.2);
59
+
60
+ .react-cupertino-ui-ai-loading-state__orb {
61
+ background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.95), rgba(15, 10, 60, 0.1));
62
+ }
63
+ }
64
+
65
+ &.variant-searching {
66
+ background: rgba(0, 122, 255, 0.12);
67
+
68
+ .react-cupertino-ui-ai-loading-state__orb {
69
+ background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.95), rgba(0, 122, 255, 0.15));
70
+ }
71
+ }
72
+ }
73
+
74
+ @keyframes ai-orb {
75
+ 0% {
76
+ transform: scale(0.8);
77
+ opacity: 0.9;
78
+ }
79
+ 70% {
80
+ transform: scale(1.3);
81
+ opacity: 0;
82
+ }
83
+ 100% {
84
+ opacity: 0;
85
+ }
86
+ }
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@react-cupertino-ui/ai-loading-state",
3
+ "version": "0.0.0",
4
+ "description": "AI Loading State indicator for React Cupertino UI",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "sideEffects": [
13
+ "./dist/**/*.css",
14
+ "./dist/**/*.scss"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsc -p tsconfig.build.json && npm run build:styles",
18
+ "build:styles": "node ../../../scripts/build-styles.mjs"
19
+ },
20
+ "peerDependencies": {
21
+ "react": "^18.3.1",
22
+ "react-dom": "^18.3.1"
23
+ },
24
+ "dependencies": {
25
+ "@react-cupertino-ui/shared": "0.0.0"
26
+ },
27
+ "devDependencies": {
28
+ "typescript": "^5.2.2"
29
+ },
30
+ "gitHead": "a6b07a7a8a0ab6f4c80884b6fb9d5eb16ee6da1d",
31
+ "publishConfig": {
32
+ "access": "public"
33
+ }
34
+ }