@cripty2001/utils 0.0.111 → 0.0.113

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.
@@ -21,5 +21,17 @@ function Button({ title, onClick, className }) {
21
21
  .catch(e => setError(e instanceof Error ? e.message : "Unknown error"))
22
22
  .finally(() => setLoading(false));
23
23
  };
24
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { onClick: handleClick, className: `cursor-pointer ${className}`, children: loading ? (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "w-4 h-4 animate-spin" }) : (0, jsx_runtime_1.jsx)("div", { children: title }) }), error && (0, jsx_runtime_1.jsx)("div", { className: "text-red-500", children: error })] }));
24
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { onClick: handleClick, className: className, style: {
25
+ display: 'flex',
26
+ alignItems: 'center',
27
+ justifyContent: 'center',
28
+ textAlign: 'center',
29
+ cursor: 'pointer',
30
+ }, children: loading ? (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { style: {
31
+ width: '1rem',
32
+ height: '1rem',
33
+ animation: 'spin 1s linear infinite',
34
+ } }) : (0, jsx_runtime_1.jsx)("div", { children: title }) }), error && (0, jsx_runtime_1.jsx)("div", { style: {
35
+ color: '#ef4444'
36
+ }, children: error })] }));
25
37
  }
@@ -1,6 +1,6 @@
1
1
  export type ModalComponentProps = {
2
2
  children: React.ReactNode;
3
- open: boolean | undefined;
4
- setOpen: (open: boolean) => void | undefined;
3
+ open: boolean;
4
+ setOpen: (open: boolean) => void;
5
5
  };
6
6
  export default function ModalComponent(props: ModalComponentProps): import("react/jsx-runtime").JSX.Element | null;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = ModalComponent;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const react_whispr_1 = require("../react-whispr");
7
6
  const slideUpKeyframes = `
8
7
  @keyframes slide-up {
9
8
  from {
@@ -28,8 +27,7 @@ let modalCount = 0;
28
27
  function ModalComponent(props) {
29
28
  const zIndex = (0, react_1.useRef)(1000 + modalCount++).current;
30
29
  const id = (0, react_1.useRef)(`modal-${zIndex}`).current;
31
- const [open, setOpen] = (0, react_whispr_1.useSynced)(true, props.open, props.setOpen);
32
- if (!open)
30
+ if (!props.open)
33
31
  return null;
34
32
  return ((0, jsx_runtime_1.jsx)("div", { id: id, style: {
35
33
  position: 'fixed',
@@ -45,5 +43,5 @@ function ModalComponent(props) {
45
43
  height: '100vh',
46
44
  width: '100vw',
47
45
  zIndex: zIndex
48
- }, onClick: () => setOpen(false), children: (0, jsx_runtime_1.jsx)("div", { style: { maxWidth: '100%', animation: 'slide-up 0.3s ease-out' }, onClick: (e) => e.stopPropagation(), children: props.children }) }));
46
+ }, onClick: () => props.setOpen(false), children: (0, jsx_runtime_1.jsx)("div", { style: { maxWidth: '100%', animation: 'slide-up 0.3s ease-out' }, onClick: (e) => e.stopPropagation(), children: props.children }) }));
49
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cripty2001/utils",
3
- "version": "0.0.111",
3
+ "version": "0.0.113",
4
4
  "description": "Internal Set of utils. If you need them use them, otherwise go to the next package ;)",
5
5
  "homepage": "https://github.com/cripty2001/utils#readme",
6
6
  "bugs": {