@kopexa/spinner 0.0.0-canary-20250719153200
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 +24 -0
- package/dist/chunk-5FYDQXPO.mjs +70 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +95 -0
- package/dist/index.mjs +7 -0
- package/dist/spinner.d.mts +13 -0
- package/dist/spinner.d.ts +13 -0
- package/dist/spinner.js +93 -0
- package/dist/spinner.mjs +7 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @kopexa/spinner
|
|
2
|
+
|
|
3
|
+
A Quick description of the component
|
|
4
|
+
|
|
5
|
+
> This is an internal utility, not intended for public usage.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
yarn add @kopexa/spinner
|
|
11
|
+
# or
|
|
12
|
+
npm i @kopexa/spinner
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Contribution
|
|
16
|
+
|
|
17
|
+
Yes please! See the
|
|
18
|
+
[contributing guidelines](https://github.com/kopexa-grc/sight/blob/master/CONTRIBUTING.md)
|
|
19
|
+
for details.
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
This project is licensed under the terms of the
|
|
24
|
+
[MIT license](https://github.com/kopexa-grc/sight/blob/master/LICENSE).
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/spinner.tsx
|
|
4
|
+
import { spinner } from "@kopexa/theme";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
var Spinner = (props) => {
|
|
8
|
+
const {
|
|
9
|
+
label: labelProp,
|
|
10
|
+
children,
|
|
11
|
+
size,
|
|
12
|
+
color,
|
|
13
|
+
variant,
|
|
14
|
+
className,
|
|
15
|
+
...otherProps
|
|
16
|
+
} = props;
|
|
17
|
+
const slots = useMemo(
|
|
18
|
+
() => spinner({ size, color, variant }),
|
|
19
|
+
[size, color, variant]
|
|
20
|
+
);
|
|
21
|
+
const label = labelProp || children;
|
|
22
|
+
const ariaLabel = useMemo(() => {
|
|
23
|
+
if (label && typeof label === "string") {
|
|
24
|
+
return label;
|
|
25
|
+
}
|
|
26
|
+
return !otherProps["aria-label"] ? "Loading..." : "";
|
|
27
|
+
}, [label, otherProps["aria-label"]]);
|
|
28
|
+
if (variant === "wave" || variant === "dots") {
|
|
29
|
+
return /* @__PURE__ */ jsxs(
|
|
30
|
+
"output",
|
|
31
|
+
{
|
|
32
|
+
"aria-label": ariaLabel,
|
|
33
|
+
className: slots.base({ className }),
|
|
34
|
+
...otherProps,
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsx("div", { className: slots.wrapper(), children: [...new Array(3)].map((_, index) => /* @__PURE__ */ jsx(
|
|
37
|
+
"i",
|
|
38
|
+
{
|
|
39
|
+
className: slots.dots(),
|
|
40
|
+
style: {
|
|
41
|
+
"--dot-index": index
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
`dot-${index.toString()}`
|
|
45
|
+
)) }),
|
|
46
|
+
label && /* @__PURE__ */ jsx("span", { className: slots.label(), children: label })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return /* @__PURE__ */ jsxs(
|
|
52
|
+
"output",
|
|
53
|
+
{
|
|
54
|
+
"aria-label": ariaLabel,
|
|
55
|
+
className: slots.base({ className }),
|
|
56
|
+
...otherProps,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsxs("div", { className: slots.wrapper(), children: [
|
|
59
|
+
/* @__PURE__ */ jsx("div", { className: slots.circle1() }),
|
|
60
|
+
/* @__PURE__ */ jsx("div", { className: slots.circle2() })
|
|
61
|
+
] }),
|
|
62
|
+
label && /* @__PURE__ */ jsx("span", { className: slots.label(), children: label })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
Spinner
|
|
70
|
+
};
|
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
|
+
Spinner: () => Spinner
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
|
|
28
|
+
// src/spinner.tsx
|
|
29
|
+
var import_theme = require("@kopexa/theme");
|
|
30
|
+
var import_react = require("react");
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var Spinner = (props) => {
|
|
33
|
+
const {
|
|
34
|
+
label: labelProp,
|
|
35
|
+
children,
|
|
36
|
+
size,
|
|
37
|
+
color,
|
|
38
|
+
variant,
|
|
39
|
+
className,
|
|
40
|
+
...otherProps
|
|
41
|
+
} = props;
|
|
42
|
+
const slots = (0, import_react.useMemo)(
|
|
43
|
+
() => (0, import_theme.spinner)({ size, color, variant }),
|
|
44
|
+
[size, color, variant]
|
|
45
|
+
);
|
|
46
|
+
const label = labelProp || children;
|
|
47
|
+
const ariaLabel = (0, import_react.useMemo)(() => {
|
|
48
|
+
if (label && typeof label === "string") {
|
|
49
|
+
return label;
|
|
50
|
+
}
|
|
51
|
+
return !otherProps["aria-label"] ? "Loading..." : "";
|
|
52
|
+
}, [label, otherProps["aria-label"]]);
|
|
53
|
+
if (variant === "wave" || variant === "dots") {
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
55
|
+
"output",
|
|
56
|
+
{
|
|
57
|
+
"aria-label": ariaLabel,
|
|
58
|
+
className: slots.base({ className }),
|
|
59
|
+
...otherProps,
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: slots.wrapper(), children: [...new Array(3)].map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
62
|
+
"i",
|
|
63
|
+
{
|
|
64
|
+
className: slots.dots(),
|
|
65
|
+
style: {
|
|
66
|
+
"--dot-index": index
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
`dot-${index.toString()}`
|
|
70
|
+
)) }),
|
|
71
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: slots.label(), children: label })
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
77
|
+
"output",
|
|
78
|
+
{
|
|
79
|
+
"aria-label": ariaLabel,
|
|
80
|
+
className: slots.base({ className }),
|
|
81
|
+
...otherProps,
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: slots.wrapper(), children: [
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: slots.circle1() }),
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: slots.circle2() })
|
|
86
|
+
] }),
|
|
87
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: slots.label(), children: label })
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
93
|
+
0 && (module.exports = {
|
|
94
|
+
Spinner
|
|
95
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { SpinnerVariants } from '@kopexa/theme';
|
|
3
|
+
import { ComponentProps } from 'react';
|
|
4
|
+
|
|
5
|
+
type SpinnerProps = ComponentProps<"output"> & SpinnerVariants & {
|
|
6
|
+
/**
|
|
7
|
+
* Spinner label, in case you passed it will be used as `aria-label`.
|
|
8
|
+
*/
|
|
9
|
+
label?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const Spinner: (props: SpinnerProps) => react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { Spinner, type SpinnerProps };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { SpinnerVariants } from '@kopexa/theme';
|
|
3
|
+
import { ComponentProps } from 'react';
|
|
4
|
+
|
|
5
|
+
type SpinnerProps = ComponentProps<"output"> & SpinnerVariants & {
|
|
6
|
+
/**
|
|
7
|
+
* Spinner label, in case you passed it will be used as `aria-label`.
|
|
8
|
+
*/
|
|
9
|
+
label?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const Spinner: (props: SpinnerProps) => react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { Spinner, type SpinnerProps };
|
package/dist/spinner.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/spinner.tsx
|
|
22
|
+
var spinner_exports = {};
|
|
23
|
+
__export(spinner_exports, {
|
|
24
|
+
Spinner: () => Spinner
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(spinner_exports);
|
|
27
|
+
var import_theme = require("@kopexa/theme");
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
var Spinner = (props) => {
|
|
31
|
+
const {
|
|
32
|
+
label: labelProp,
|
|
33
|
+
children,
|
|
34
|
+
size,
|
|
35
|
+
color,
|
|
36
|
+
variant,
|
|
37
|
+
className,
|
|
38
|
+
...otherProps
|
|
39
|
+
} = props;
|
|
40
|
+
const slots = (0, import_react.useMemo)(
|
|
41
|
+
() => (0, import_theme.spinner)({ size, color, variant }),
|
|
42
|
+
[size, color, variant]
|
|
43
|
+
);
|
|
44
|
+
const label = labelProp || children;
|
|
45
|
+
const ariaLabel = (0, import_react.useMemo)(() => {
|
|
46
|
+
if (label && typeof label === "string") {
|
|
47
|
+
return label;
|
|
48
|
+
}
|
|
49
|
+
return !otherProps["aria-label"] ? "Loading..." : "";
|
|
50
|
+
}, [label, otherProps["aria-label"]]);
|
|
51
|
+
if (variant === "wave" || variant === "dots") {
|
|
52
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
53
|
+
"output",
|
|
54
|
+
{
|
|
55
|
+
"aria-label": ariaLabel,
|
|
56
|
+
className: slots.base({ className }),
|
|
57
|
+
...otherProps,
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: slots.wrapper(), children: [...new Array(3)].map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
+
"i",
|
|
61
|
+
{
|
|
62
|
+
className: slots.dots(),
|
|
63
|
+
style: {
|
|
64
|
+
"--dot-index": index
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
`dot-${index.toString()}`
|
|
68
|
+
)) }),
|
|
69
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: slots.label(), children: label })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
75
|
+
"output",
|
|
76
|
+
{
|
|
77
|
+
"aria-label": ariaLabel,
|
|
78
|
+
className: slots.base({ className }),
|
|
79
|
+
...otherProps,
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: slots.wrapper(), children: [
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: slots.circle1() }),
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: slots.circle2() })
|
|
84
|
+
] }),
|
|
85
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: slots.label(), children: label })
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
Spinner
|
|
93
|
+
});
|
package/dist/spinner.mjs
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kopexa/spinner",
|
|
3
|
+
"version": "0.0.0-canary-20250719153200",
|
|
4
|
+
"description": "A loading spinner package",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"spinner"
|
|
7
|
+
],
|
|
8
|
+
"author": "Kopexa <hello@kopexa.com>",
|
|
9
|
+
"homepage": "https://kopexa.com",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/kopexa-grc/sight.git",
|
|
22
|
+
"directory": "packages/components/spinner"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/kopexa-grc/sight/issues"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"react": ">=19.0.0-rc.0",
|
|
29
|
+
"react-dom": ">=19.0.0-rc.0",
|
|
30
|
+
"motion": ">=12.23.6",
|
|
31
|
+
"@kopexa/theme": "0.0.0-canary-20250719153200"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@kopexa/shared-utils": "1.1.0",
|
|
35
|
+
"@kopexa/react-utils": "2.0.0"
|
|
36
|
+
},
|
|
37
|
+
"clean-package": "../../../clean-package.config.json",
|
|
38
|
+
"module": "dist/index.mjs",
|
|
39
|
+
"types": "dist/index.d.ts",
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
|
+
"import": "./dist/index.mjs",
|
|
44
|
+
"require": "./dist/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./package.json": "./package.json"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsup src --dts",
|
|
50
|
+
"build:fast": "tsup src",
|
|
51
|
+
"dev": "pnpm build:fast --watch",
|
|
52
|
+
"clean": "rimraf dist .turbo",
|
|
53
|
+
"typecheck": "tsc --noEmit"
|
|
54
|
+
}
|
|
55
|
+
}
|