@neoptocom/neopto-ui 0.8.1 → 0.9.1
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/index.cjs +73 -0
- package/dist/index.d.cts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +73 -2
- package/package.json +1 -1
- package/src/components/BackgroundBlur.tsx +73 -0
- package/src/components/Card.tsx +35 -0
- package/src/index.ts +4 -0
package/dist/index.cjs
CHANGED
|
@@ -100,6 +100,77 @@ function AppBackground({
|
|
|
100
100
|
)
|
|
101
101
|
] });
|
|
102
102
|
}
|
|
103
|
+
function BackgroundBlur({
|
|
104
|
+
open,
|
|
105
|
+
children,
|
|
106
|
+
onClose,
|
|
107
|
+
zIndex = 40,
|
|
108
|
+
className = ""
|
|
109
|
+
}) {
|
|
110
|
+
const [shouldRender, setShouldRender] = React2.useState(false);
|
|
111
|
+
const [isVisible, setIsVisible] = React2.useState(false);
|
|
112
|
+
React2.useEffect(() => {
|
|
113
|
+
if (open) {
|
|
114
|
+
setShouldRender(true);
|
|
115
|
+
requestAnimationFrame(() => {
|
|
116
|
+
setIsVisible(true);
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
setIsVisible(false);
|
|
120
|
+
const timer = setTimeout(() => {
|
|
121
|
+
setShouldRender(false);
|
|
122
|
+
}, 500);
|
|
123
|
+
return () => clearTimeout(timer);
|
|
124
|
+
}
|
|
125
|
+
}, [open]);
|
|
126
|
+
if (!shouldRender) return null;
|
|
127
|
+
const handleBackdropClick = (e) => {
|
|
128
|
+
if (e.target === e.currentTarget && onClose) {
|
|
129
|
+
onClose();
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
133
|
+
"div",
|
|
134
|
+
{
|
|
135
|
+
className: `fixed inset-0 flex items-center justify-center transition-opacity duration-500 ${className}`,
|
|
136
|
+
style: {
|
|
137
|
+
backgroundColor: "rgba(0, 0, 0, 0.10)",
|
|
138
|
+
backdropFilter: "blur(10px)",
|
|
139
|
+
WebkitBackdropFilter: "blur(10px)",
|
|
140
|
+
// Safari support
|
|
141
|
+
zIndex,
|
|
142
|
+
opacity: isVisible ? 1 : 0
|
|
143
|
+
},
|
|
144
|
+
onClick: handleBackdropClick,
|
|
145
|
+
role: "presentation",
|
|
146
|
+
children
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
function Card({
|
|
151
|
+
children,
|
|
152
|
+
className = "",
|
|
153
|
+
style,
|
|
154
|
+
...props
|
|
155
|
+
}) {
|
|
156
|
+
const mergedStyle = {
|
|
157
|
+
borderRadius: "30px",
|
|
158
|
+
background: "rgba(112, 133, 233, 0.05)",
|
|
159
|
+
backdropFilter: "blur(75px)",
|
|
160
|
+
WebkitBackdropFilter: "blur(75px)",
|
|
161
|
+
// Safari support
|
|
162
|
+
...style
|
|
163
|
+
};
|
|
164
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
165
|
+
"div",
|
|
166
|
+
{
|
|
167
|
+
className: `p-6 ${className}`,
|
|
168
|
+
style: mergedStyle,
|
|
169
|
+
...props,
|
|
170
|
+
children
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
103
174
|
var Input = React2__namespace.forwardRef(
|
|
104
175
|
({ className, disabled, ...props }, ref) => {
|
|
105
176
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1162,7 +1233,9 @@ exports.AppBackground = AppBackground;
|
|
|
1162
1233
|
exports.Autocomplete = Autocomplete;
|
|
1163
1234
|
exports.Avatar = Avatar;
|
|
1164
1235
|
exports.AvatarGroup = AvatarGroup;
|
|
1236
|
+
exports.BackgroundBlur = BackgroundBlur;
|
|
1165
1237
|
exports.Button = Button;
|
|
1238
|
+
exports.Card = Card;
|
|
1166
1239
|
exports.ChatButton = ChatButton_default;
|
|
1167
1240
|
exports.Chip = Chip;
|
|
1168
1241
|
exports.Counter = Counter;
|
package/dist/index.d.cts
CHANGED
|
@@ -26,6 +26,28 @@ type AppBackgroundProps = {
|
|
|
26
26
|
};
|
|
27
27
|
declare function AppBackground({ children, lightImage, darkImage, className, }: AppBackgroundProps): react_jsx_runtime.JSX.Element;
|
|
28
28
|
|
|
29
|
+
type BackgroundBlurProps = {
|
|
30
|
+
/** Whether the blur overlay is visible */
|
|
31
|
+
open: boolean;
|
|
32
|
+
/** Content to render on top of the blur (e.g., modal, drawer) */
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
/** Callback when the backdrop is clicked */
|
|
35
|
+
onClose?: () => void;
|
|
36
|
+
/** z-index for the overlay (default: 40) */
|
|
37
|
+
zIndex?: number;
|
|
38
|
+
/** Additional CSS classes */
|
|
39
|
+
className?: string;
|
|
40
|
+
};
|
|
41
|
+
declare function BackgroundBlur({ open, children, onClose, zIndex, className, }: BackgroundBlurProps): react_jsx_runtime.JSX.Element | null;
|
|
42
|
+
|
|
43
|
+
type CardProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
44
|
+
/** Content to render inside the card */
|
|
45
|
+
children: React.ReactNode;
|
|
46
|
+
/** Additional CSS classes */
|
|
47
|
+
className?: string;
|
|
48
|
+
};
|
|
49
|
+
declare function Card({ children, className, style, ...props }: CardProps): react_jsx_runtime.JSX.Element;
|
|
50
|
+
|
|
29
51
|
type InputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>;
|
|
30
52
|
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
31
53
|
|
|
@@ -259,4 +281,4 @@ interface AnimatedBgRectangleProps {
|
|
|
259
281
|
}
|
|
260
282
|
declare const AnimatedBgRectangle: ({ colors, delay }: AnimatedBgRectangleProps) => react_jsx_runtime.JSX.Element;
|
|
261
283
|
|
|
262
|
-
export { AnimatedBgCircle, AnimatedBgRectangle, AppBackground, type AppBackgroundProps, Autocomplete, type AutocompleteOption, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Button, type ButtonProps, ChatButton, type ChatButtonProps, Chip, type ChipProps, Counter, type CounterProps, Icon, IconButton, type IconButtonProps, type IconProps, Input, type InputProps, Modal, type ModalProps, Search, type SearchOption, type SearchProps, Skeleton, type SkeletonProps, Typo, type TypoProps, type TypoVariant, type TypoWeight, index as assets };
|
|
284
|
+
export { AnimatedBgCircle, AnimatedBgRectangle, AppBackground, type AppBackgroundProps, Autocomplete, type AutocompleteOption, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, BackgroundBlur, type BackgroundBlurProps, Button, type ButtonProps, Card, type CardProps, ChatButton, type ChatButtonProps, Chip, type ChipProps, Counter, type CounterProps, Icon, IconButton, type IconButtonProps, type IconProps, Input, type InputProps, Modal, type ModalProps, Search, type SearchOption, type SearchProps, Skeleton, type SkeletonProps, Typo, type TypoProps, type TypoVariant, type TypoWeight, index as assets };
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,28 @@ type AppBackgroundProps = {
|
|
|
26
26
|
};
|
|
27
27
|
declare function AppBackground({ children, lightImage, darkImage, className, }: AppBackgroundProps): react_jsx_runtime.JSX.Element;
|
|
28
28
|
|
|
29
|
+
type BackgroundBlurProps = {
|
|
30
|
+
/** Whether the blur overlay is visible */
|
|
31
|
+
open: boolean;
|
|
32
|
+
/** Content to render on top of the blur (e.g., modal, drawer) */
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
/** Callback when the backdrop is clicked */
|
|
35
|
+
onClose?: () => void;
|
|
36
|
+
/** z-index for the overlay (default: 40) */
|
|
37
|
+
zIndex?: number;
|
|
38
|
+
/** Additional CSS classes */
|
|
39
|
+
className?: string;
|
|
40
|
+
};
|
|
41
|
+
declare function BackgroundBlur({ open, children, onClose, zIndex, className, }: BackgroundBlurProps): react_jsx_runtime.JSX.Element | null;
|
|
42
|
+
|
|
43
|
+
type CardProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
44
|
+
/** Content to render inside the card */
|
|
45
|
+
children: React.ReactNode;
|
|
46
|
+
/** Additional CSS classes */
|
|
47
|
+
className?: string;
|
|
48
|
+
};
|
|
49
|
+
declare function Card({ children, className, style, ...props }: CardProps): react_jsx_runtime.JSX.Element;
|
|
50
|
+
|
|
29
51
|
type InputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>;
|
|
30
52
|
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
31
53
|
|
|
@@ -259,4 +281,4 @@ interface AnimatedBgRectangleProps {
|
|
|
259
281
|
}
|
|
260
282
|
declare const AnimatedBgRectangle: ({ colors, delay }: AnimatedBgRectangleProps) => react_jsx_runtime.JSX.Element;
|
|
261
283
|
|
|
262
|
-
export { AnimatedBgCircle, AnimatedBgRectangle, AppBackground, type AppBackgroundProps, Autocomplete, type AutocompleteOption, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Button, type ButtonProps, ChatButton, type ChatButtonProps, Chip, type ChipProps, Counter, type CounterProps, Icon, IconButton, type IconButtonProps, type IconProps, Input, type InputProps, Modal, type ModalProps, Search, type SearchOption, type SearchProps, Skeleton, type SkeletonProps, Typo, type TypoProps, type TypoVariant, type TypoWeight, index as assets };
|
|
284
|
+
export { AnimatedBgCircle, AnimatedBgRectangle, AppBackground, type AppBackgroundProps, Autocomplete, type AutocompleteOption, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, BackgroundBlur, type BackgroundBlurProps, Button, type ButtonProps, Card, type CardProps, ChatButton, type ChatButtonProps, Chip, type ChipProps, Counter, type CounterProps, Icon, IconButton, type IconButtonProps, type IconProps, Input, type InputProps, Modal, type ModalProps, Search, type SearchOption, type SearchProps, Skeleton, type SkeletonProps, Typo, type TypoProps, type TypoVariant, type TypoWeight, index as assets };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React2 from 'react';
|
|
3
|
-
import { useState, useMemo, useId, useRef, useCallback
|
|
3
|
+
import { useState, useEffect, useMemo, useId, useRef, useCallback } from 'react';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
|
|
6
6
|
var __defProp = Object.defineProperty;
|
|
@@ -79,6 +79,77 @@ function AppBackground({
|
|
|
79
79
|
)
|
|
80
80
|
] });
|
|
81
81
|
}
|
|
82
|
+
function BackgroundBlur({
|
|
83
|
+
open,
|
|
84
|
+
children,
|
|
85
|
+
onClose,
|
|
86
|
+
zIndex = 40,
|
|
87
|
+
className = ""
|
|
88
|
+
}) {
|
|
89
|
+
const [shouldRender, setShouldRender] = useState(false);
|
|
90
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (open) {
|
|
93
|
+
setShouldRender(true);
|
|
94
|
+
requestAnimationFrame(() => {
|
|
95
|
+
setIsVisible(true);
|
|
96
|
+
});
|
|
97
|
+
} else {
|
|
98
|
+
setIsVisible(false);
|
|
99
|
+
const timer = setTimeout(() => {
|
|
100
|
+
setShouldRender(false);
|
|
101
|
+
}, 500);
|
|
102
|
+
return () => clearTimeout(timer);
|
|
103
|
+
}
|
|
104
|
+
}, [open]);
|
|
105
|
+
if (!shouldRender) return null;
|
|
106
|
+
const handleBackdropClick = (e) => {
|
|
107
|
+
if (e.target === e.currentTarget && onClose) {
|
|
108
|
+
onClose();
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return /* @__PURE__ */ jsx(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
className: `fixed inset-0 flex items-center justify-center transition-opacity duration-500 ${className}`,
|
|
115
|
+
style: {
|
|
116
|
+
backgroundColor: "rgba(0, 0, 0, 0.10)",
|
|
117
|
+
backdropFilter: "blur(10px)",
|
|
118
|
+
WebkitBackdropFilter: "blur(10px)",
|
|
119
|
+
// Safari support
|
|
120
|
+
zIndex,
|
|
121
|
+
opacity: isVisible ? 1 : 0
|
|
122
|
+
},
|
|
123
|
+
onClick: handleBackdropClick,
|
|
124
|
+
role: "presentation",
|
|
125
|
+
children
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
function Card({
|
|
130
|
+
children,
|
|
131
|
+
className = "",
|
|
132
|
+
style,
|
|
133
|
+
...props
|
|
134
|
+
}) {
|
|
135
|
+
const mergedStyle = {
|
|
136
|
+
borderRadius: "30px",
|
|
137
|
+
background: "rgba(112, 133, 233, 0.05)",
|
|
138
|
+
backdropFilter: "blur(75px)",
|
|
139
|
+
WebkitBackdropFilter: "blur(75px)",
|
|
140
|
+
// Safari support
|
|
141
|
+
...style
|
|
142
|
+
};
|
|
143
|
+
return /* @__PURE__ */ jsx(
|
|
144
|
+
"div",
|
|
145
|
+
{
|
|
146
|
+
className: `p-6 ${className}`,
|
|
147
|
+
style: mergedStyle,
|
|
148
|
+
...props,
|
|
149
|
+
children
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
82
153
|
var Input = React2.forwardRef(
|
|
83
154
|
({ className, disabled, ...props }, ref) => {
|
|
84
155
|
return /* @__PURE__ */ jsx(
|
|
@@ -1135,4 +1206,4 @@ var ChatButton = ({
|
|
|
1135
1206
|
};
|
|
1136
1207
|
var ChatButton_default = ChatButton;
|
|
1137
1208
|
|
|
1138
|
-
export { AnimatedBgCircle_default as AnimatedBgCircle, AnimatedBgRectangle_default as AnimatedBgRectangle, AppBackground, Autocomplete, Avatar, AvatarGroup, Button, ChatButton_default as ChatButton, Chip, Counter, Icon, IconButton, Input, Modal, Search, Skeleton, Typo, assets_exports as assets };
|
|
1209
|
+
export { AnimatedBgCircle_default as AnimatedBgCircle, AnimatedBgRectangle_default as AnimatedBgRectangle, AppBackground, Autocomplete, Avatar, AvatarGroup, BackgroundBlur, Button, Card, ChatButton_default as ChatButton, Chip, Counter, Icon, IconButton, Input, Modal, Search, Skeleton, Typo, assets_exports as assets };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neoptocom/neopto-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A modern React component library built with Tailwind CSS v4 and TypeScript. Features dark mode, design tokens, and comprehensive Storybook documentation. Requires Tailwind v4+.",
|
|
6
6
|
"keywords": [
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
|
|
4
|
+
export type BackgroundBlurProps = {
|
|
5
|
+
/** Whether the blur overlay is visible */
|
|
6
|
+
open: boolean;
|
|
7
|
+
/** Content to render on top of the blur (e.g., modal, drawer) */
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/** Callback when the backdrop is clicked */
|
|
10
|
+
onClose?: () => void;
|
|
11
|
+
/** z-index for the overlay (default: 40) */
|
|
12
|
+
zIndex?: number;
|
|
13
|
+
/** Additional CSS classes */
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function BackgroundBlur({
|
|
18
|
+
open,
|
|
19
|
+
children,
|
|
20
|
+
onClose,
|
|
21
|
+
zIndex = 40,
|
|
22
|
+
className = "",
|
|
23
|
+
}: BackgroundBlurProps) {
|
|
24
|
+
const [shouldRender, setShouldRender] = useState(false);
|
|
25
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (open) {
|
|
29
|
+
// Mount the component
|
|
30
|
+
setShouldRender(true);
|
|
31
|
+
// Trigger fade-in on next frame
|
|
32
|
+
requestAnimationFrame(() => {
|
|
33
|
+
setIsVisible(true);
|
|
34
|
+
});
|
|
35
|
+
} else {
|
|
36
|
+
// Trigger fade-out
|
|
37
|
+
setIsVisible(false);
|
|
38
|
+
// Unmount after transition completes
|
|
39
|
+
const timer = setTimeout(() => {
|
|
40
|
+
setShouldRender(false);
|
|
41
|
+
}, 500); // Match transition duration
|
|
42
|
+
return () => clearTimeout(timer);
|
|
43
|
+
}
|
|
44
|
+
}, [open]);
|
|
45
|
+
|
|
46
|
+
// Don't render if not mounted
|
|
47
|
+
if (!shouldRender) return null;
|
|
48
|
+
|
|
49
|
+
const handleBackdropClick = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
50
|
+
// Only trigger onClose if clicking the backdrop itself, not children
|
|
51
|
+
if (e.target === e.currentTarget && onClose) {
|
|
52
|
+
onClose();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div
|
|
58
|
+
className={`fixed inset-0 flex items-center justify-center transition-opacity duration-500 ${className}`}
|
|
59
|
+
style={{
|
|
60
|
+
backgroundColor: "rgba(0, 0, 0, 0.10)",
|
|
61
|
+
backdropFilter: "blur(10px)",
|
|
62
|
+
WebkitBackdropFilter: "blur(10px)", // Safari support
|
|
63
|
+
zIndex,
|
|
64
|
+
opacity: isVisible ? 1 : 0,
|
|
65
|
+
}}
|
|
66
|
+
onClick={handleBackdropClick}
|
|
67
|
+
role="presentation"
|
|
68
|
+
>
|
|
69
|
+
{children}
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export type CardProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
/** Content to render inside the card */
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/** Additional CSS classes */
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function Card({
|
|
11
|
+
children,
|
|
12
|
+
className = "",
|
|
13
|
+
style,
|
|
14
|
+
...props
|
|
15
|
+
}: CardProps) {
|
|
16
|
+
// Merge user styles with card styles
|
|
17
|
+
const mergedStyle: React.CSSProperties = {
|
|
18
|
+
borderRadius: "30px",
|
|
19
|
+
background: "rgba(112, 133, 233, 0.05)",
|
|
20
|
+
backdropFilter: "blur(75px)",
|
|
21
|
+
WebkitBackdropFilter: "blur(75px)", // Safari support
|
|
22
|
+
...style,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
className={`p-6 ${className}`}
|
|
28
|
+
style={mergedStyle}
|
|
29
|
+
{...props}
|
|
30
|
+
>
|
|
31
|
+
{children}
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,8 @@ export * as assets from "./assets";
|
|
|
3
3
|
|
|
4
4
|
// Components
|
|
5
5
|
export { AppBackground } from "./components/AppBackground";
|
|
6
|
+
export { BackgroundBlur } from "./components/BackgroundBlur";
|
|
7
|
+
export { Card } from "./components/Card";
|
|
6
8
|
export * from "./components/Input";
|
|
7
9
|
export * from "./components/Modal";
|
|
8
10
|
export { default as Typo } from "./components/Typo";
|
|
@@ -20,6 +22,8 @@ export * from "./components/Chat";
|
|
|
20
22
|
|
|
21
23
|
// Types
|
|
22
24
|
export type { AppBackgroundProps } from "./components/AppBackground";
|
|
25
|
+
export type { BackgroundBlurProps } from "./components/BackgroundBlur";
|
|
26
|
+
export type { CardProps } from "./components/Card";
|
|
23
27
|
export type { InputProps } from "./components/Input";
|
|
24
28
|
export type { ModalProps } from "./components/Modal";
|
|
25
29
|
export type { TypoProps, TypoVariant, TypoWeight } from "./components/Typo";
|