@neoptocom/neopto-ui 0.12.3 → 0.13.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/dist/index.cjs +35 -5
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +35 -5
- package/package.json +1 -1
- package/src/components/Card.tsx +40 -5
- package/src/stories/Card.stories.tsx +43 -0
package/dist/index.cjs
CHANGED
|
@@ -152,20 +152,22 @@ function Card({
|
|
|
152
152
|
className = "",
|
|
153
153
|
style,
|
|
154
154
|
showDecorations = false,
|
|
155
|
+
variant = "default",
|
|
155
156
|
...props
|
|
156
157
|
}) {
|
|
158
|
+
const isAppBackground = variant === "app-background";
|
|
157
159
|
const mergedStyle = {
|
|
158
160
|
borderRadius: "30px",
|
|
159
|
-
backgroundColor: "color-mix(in srgb, var(--surface) 85%, transparent)",
|
|
160
|
-
backdropFilter: "blur(75px)",
|
|
161
|
-
WebkitBackdropFilter: "blur(75px)",
|
|
161
|
+
backgroundColor: isAppBackground ? "transparent" : "color-mix(in srgb, var(--surface) 85%, transparent)",
|
|
162
|
+
backdropFilter: isAppBackground ? void 0 : "blur(75px)",
|
|
163
|
+
WebkitBackdropFilter: isAppBackground ? void 0 : "blur(75px)",
|
|
162
164
|
// Safari support
|
|
163
165
|
color: "var(--fg)",
|
|
164
166
|
overflow: "hidden",
|
|
165
167
|
transition: "background-color 0.3s ease, color 0.3s ease",
|
|
166
168
|
...style,
|
|
167
|
-
//
|
|
168
|
-
|
|
169
|
+
// Apply position: relative by default, but allow user override via style prop
|
|
170
|
+
position: style?.position || "relative"
|
|
169
171
|
};
|
|
170
172
|
const hasPadding = className && /\b(p-|px-|py-|pt-|pb-|pl-|pr-)\d/.test(className);
|
|
171
173
|
const cardClasses = `${!hasPadding ? "p-6" : ""} ${className || ""}`.trim();
|
|
@@ -176,6 +178,34 @@ function Card({
|
|
|
176
178
|
style: mergedStyle,
|
|
177
179
|
...props,
|
|
178
180
|
children: [
|
|
181
|
+
isAppBackground && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
182
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
183
|
+
"div",
|
|
184
|
+
{
|
|
185
|
+
className: "absolute inset-0 transition-opacity duration-500 opacity-100 dark:opacity-0",
|
|
186
|
+
style: {
|
|
187
|
+
backgroundImage: `url(${bgLight})`,
|
|
188
|
+
backgroundSize: "cover",
|
|
189
|
+
backgroundPosition: "center",
|
|
190
|
+
backgroundRepeat: "no-repeat",
|
|
191
|
+
zIndex: 0
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
196
|
+
"div",
|
|
197
|
+
{
|
|
198
|
+
className: "absolute inset-0 transition-opacity duration-500 opacity-0 dark:opacity-100",
|
|
199
|
+
style: {
|
|
200
|
+
backgroundImage: `url(${bgDark})`,
|
|
201
|
+
backgroundSize: "cover",
|
|
202
|
+
backgroundPosition: "center",
|
|
203
|
+
backgroundRepeat: "no-repeat",
|
|
204
|
+
zIndex: 0
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
] }),
|
|
179
209
|
showDecorations && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
180
210
|
"svg",
|
|
181
211
|
{
|
package/dist/index.d.cts
CHANGED
|
@@ -47,8 +47,10 @@ type CardProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
47
47
|
className?: string;
|
|
48
48
|
/** Show decorative elements (default: false) */
|
|
49
49
|
showDecorations?: boolean;
|
|
50
|
+
/** Card variant (default: "default") */
|
|
51
|
+
variant?: "default" | "app-background";
|
|
50
52
|
};
|
|
51
|
-
declare function Card({ children, className, style, showDecorations, ...props }: CardProps): react_jsx_runtime.JSX.Element;
|
|
53
|
+
declare function Card({ children, className, style, showDecorations, variant, ...props }: CardProps): react_jsx_runtime.JSX.Element;
|
|
52
54
|
|
|
53
55
|
type InputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> & {
|
|
54
56
|
/** Input visual variant */
|
package/dist/index.d.ts
CHANGED
|
@@ -47,8 +47,10 @@ type CardProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
47
47
|
className?: string;
|
|
48
48
|
/** Show decorative elements (default: false) */
|
|
49
49
|
showDecorations?: boolean;
|
|
50
|
+
/** Card variant (default: "default") */
|
|
51
|
+
variant?: "default" | "app-background";
|
|
50
52
|
};
|
|
51
|
-
declare function Card({ children, className, style, showDecorations, ...props }: CardProps): react_jsx_runtime.JSX.Element;
|
|
53
|
+
declare function Card({ children, className, style, showDecorations, variant, ...props }: CardProps): react_jsx_runtime.JSX.Element;
|
|
52
54
|
|
|
53
55
|
type InputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> & {
|
|
54
56
|
/** Input visual variant */
|
package/dist/index.js
CHANGED
|
@@ -131,20 +131,22 @@ function Card({
|
|
|
131
131
|
className = "",
|
|
132
132
|
style,
|
|
133
133
|
showDecorations = false,
|
|
134
|
+
variant = "default",
|
|
134
135
|
...props
|
|
135
136
|
}) {
|
|
137
|
+
const isAppBackground = variant === "app-background";
|
|
136
138
|
const mergedStyle = {
|
|
137
139
|
borderRadius: "30px",
|
|
138
|
-
backgroundColor: "color-mix(in srgb, var(--surface) 85%, transparent)",
|
|
139
|
-
backdropFilter: "blur(75px)",
|
|
140
|
-
WebkitBackdropFilter: "blur(75px)",
|
|
140
|
+
backgroundColor: isAppBackground ? "transparent" : "color-mix(in srgb, var(--surface) 85%, transparent)",
|
|
141
|
+
backdropFilter: isAppBackground ? void 0 : "blur(75px)",
|
|
142
|
+
WebkitBackdropFilter: isAppBackground ? void 0 : "blur(75px)",
|
|
141
143
|
// Safari support
|
|
142
144
|
color: "var(--fg)",
|
|
143
145
|
overflow: "hidden",
|
|
144
146
|
transition: "background-color 0.3s ease, color 0.3s ease",
|
|
145
147
|
...style,
|
|
146
|
-
//
|
|
147
|
-
|
|
148
|
+
// Apply position: relative by default, but allow user override via style prop
|
|
149
|
+
position: style?.position || "relative"
|
|
148
150
|
};
|
|
149
151
|
const hasPadding = className && /\b(p-|px-|py-|pt-|pb-|pl-|pr-)\d/.test(className);
|
|
150
152
|
const cardClasses = `${!hasPadding ? "p-6" : ""} ${className || ""}`.trim();
|
|
@@ -155,6 +157,34 @@ function Card({
|
|
|
155
157
|
style: mergedStyle,
|
|
156
158
|
...props,
|
|
157
159
|
children: [
|
|
160
|
+
isAppBackground && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
161
|
+
/* @__PURE__ */ jsx(
|
|
162
|
+
"div",
|
|
163
|
+
{
|
|
164
|
+
className: "absolute inset-0 transition-opacity duration-500 opacity-100 dark:opacity-0",
|
|
165
|
+
style: {
|
|
166
|
+
backgroundImage: `url(${bgLight})`,
|
|
167
|
+
backgroundSize: "cover",
|
|
168
|
+
backgroundPosition: "center",
|
|
169
|
+
backgroundRepeat: "no-repeat",
|
|
170
|
+
zIndex: 0
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ jsx(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
className: "absolute inset-0 transition-opacity duration-500 opacity-0 dark:opacity-100",
|
|
178
|
+
style: {
|
|
179
|
+
backgroundImage: `url(${bgDark})`,
|
|
180
|
+
backgroundSize: "cover",
|
|
181
|
+
backgroundPosition: "center",
|
|
182
|
+
backgroundRepeat: "no-repeat",
|
|
183
|
+
zIndex: 0
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
] }),
|
|
158
188
|
showDecorations && /* @__PURE__ */ jsxs(
|
|
159
189
|
"svg",
|
|
160
190
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neoptocom/neopto-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
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": [
|
package/src/components/Card.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import * as assets from "../assets";
|
|
2
3
|
|
|
3
4
|
export type CardProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
4
5
|
/** Content to render inside the card */
|
|
@@ -7,6 +8,8 @@ export type CardProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
7
8
|
className?: string;
|
|
8
9
|
/** Show decorative elements (default: false) */
|
|
9
10
|
showDecorations?: boolean;
|
|
11
|
+
/** Card variant (default: "default") */
|
|
12
|
+
variant?: "default" | "app-background";
|
|
10
13
|
};
|
|
11
14
|
|
|
12
15
|
export function Card({
|
|
@@ -14,20 +17,25 @@ export function Card({
|
|
|
14
17
|
className = "",
|
|
15
18
|
style,
|
|
16
19
|
showDecorations = false,
|
|
20
|
+
variant = "default",
|
|
17
21
|
...props
|
|
18
22
|
}: CardProps) {
|
|
23
|
+
const isAppBackground = variant === "app-background";
|
|
24
|
+
|
|
19
25
|
// Merge user styles with card styles
|
|
20
26
|
const mergedStyle: React.CSSProperties = {
|
|
21
27
|
borderRadius: "30px",
|
|
22
|
-
backgroundColor:
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
backgroundColor: isAppBackground
|
|
29
|
+
? "transparent"
|
|
30
|
+
: "color-mix(in srgb, var(--surface) 85%, transparent)",
|
|
31
|
+
backdropFilter: isAppBackground ? undefined : "blur(75px)",
|
|
32
|
+
WebkitBackdropFilter: isAppBackground ? undefined : "blur(75px)", // Safari support
|
|
25
33
|
color: "var(--fg)",
|
|
26
34
|
overflow: "hidden",
|
|
27
35
|
transition: "background-color 0.3s ease, color 0.3s ease",
|
|
28
36
|
...style,
|
|
29
|
-
//
|
|
30
|
-
|
|
37
|
+
// Apply position: relative by default, but allow user override via style prop
|
|
38
|
+
position: style?.position || "relative",
|
|
31
39
|
};
|
|
32
40
|
|
|
33
41
|
// Smart class merging: only add default padding if not provided
|
|
@@ -40,6 +48,33 @@ export function Card({
|
|
|
40
48
|
style={mergedStyle}
|
|
41
49
|
{...props}
|
|
42
50
|
>
|
|
51
|
+
{/* App background variant images */}
|
|
52
|
+
{isAppBackground && (
|
|
53
|
+
<>
|
|
54
|
+
{/* Light mode background */}
|
|
55
|
+
<div
|
|
56
|
+
className="absolute inset-0 transition-opacity duration-500 opacity-100 dark:opacity-0"
|
|
57
|
+
style={{
|
|
58
|
+
backgroundImage: `url(${assets.bgLight})`,
|
|
59
|
+
backgroundSize: "cover",
|
|
60
|
+
backgroundPosition: "center",
|
|
61
|
+
backgroundRepeat: "no-repeat",
|
|
62
|
+
zIndex: 0,
|
|
63
|
+
}}
|
|
64
|
+
/>
|
|
65
|
+
{/* Dark mode background */}
|
|
66
|
+
<div
|
|
67
|
+
className="absolute inset-0 transition-opacity duration-500 opacity-0 dark:opacity-100"
|
|
68
|
+
style={{
|
|
69
|
+
backgroundImage: `url(${assets.bgDark})`,
|
|
70
|
+
backgroundSize: "cover",
|
|
71
|
+
backgroundPosition: "center",
|
|
72
|
+
backgroundRepeat: "no-repeat",
|
|
73
|
+
zIndex: 0,
|
|
74
|
+
}}
|
|
75
|
+
/>
|
|
76
|
+
</>
|
|
77
|
+
)}
|
|
43
78
|
{showDecorations && (
|
|
44
79
|
<svg
|
|
45
80
|
style={{
|
|
@@ -39,6 +39,49 @@ export const WithDecorations: Story = {
|
|
|
39
39
|
),
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
export const AppBackgroundVariant: Story = {
|
|
43
|
+
render: () => (
|
|
44
|
+
<div className="max-w-md">
|
|
45
|
+
<Card variant="app-background">
|
|
46
|
+
<Typo variant="headline-sm" bold="semibold">App Background Card</Typo>
|
|
47
|
+
<Typo variant="body-md" className="mt-2">
|
|
48
|
+
This card uses the same background images as AppBackground component. It automatically switches between light and dark mode backgrounds.
|
|
49
|
+
</Typo>
|
|
50
|
+
<div className="mt-4">
|
|
51
|
+
<Button variant="primary">Learn More</Button>
|
|
52
|
+
</div>
|
|
53
|
+
</Card>
|
|
54
|
+
</div>
|
|
55
|
+
),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const AppBackgroundLarge: Story = {
|
|
59
|
+
render: () => (
|
|
60
|
+
<div className="max-w-2xl">
|
|
61
|
+
<Card variant="app-background" className="p-8" style={{ minHeight: "400px" }}>
|
|
62
|
+
<Typo variant="headline-lg" bold="bold">Large App Background Card</Typo>
|
|
63
|
+
<Typo variant="body-lg" className="mt-4">
|
|
64
|
+
The app-background variant looks great with larger cards. The background image scales to fill the entire card.
|
|
65
|
+
</Typo>
|
|
66
|
+
<div className="mt-8 grid grid-cols-2 gap-6">
|
|
67
|
+
<div>
|
|
68
|
+
<Typo variant="title-md" bold="semibold">Feature One</Typo>
|
|
69
|
+
<Typo variant="body-sm" className="mt-2 text-[var(--muted-fg)]">
|
|
70
|
+
Description of the first feature goes here.
|
|
71
|
+
</Typo>
|
|
72
|
+
</div>
|
|
73
|
+
<div>
|
|
74
|
+
<Typo variant="title-md" bold="semibold">Feature Two</Typo>
|
|
75
|
+
<Typo variant="body-sm" className="mt-2 text-[var(--muted-fg)]">
|
|
76
|
+
Description of the second feature goes here.
|
|
77
|
+
</Typo>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</Card>
|
|
81
|
+
</div>
|
|
82
|
+
),
|
|
83
|
+
};
|
|
84
|
+
|
|
42
85
|
export const CustomPadding: Story = {
|
|
43
86
|
render: () => (
|
|
44
87
|
<div className="max-w-md space-y-4">
|