@neoptocom/neopto-ui 0.12.3 → 0.14.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 CHANGED
@@ -152,20 +152,24 @@ function Card({
152
152
  className = "",
153
153
  style,
154
154
  showDecorations = false,
155
+ variant = "default",
156
+ elevated = false,
155
157
  ...props
156
158
  }) {
159
+ const isAppBackground = variant === "app-background";
157
160
  const mergedStyle = {
158
161
  borderRadius: "30px",
159
- backgroundColor: "color-mix(in srgb, var(--surface) 85%, transparent)",
160
- backdropFilter: "blur(75px)",
161
- WebkitBackdropFilter: "blur(75px)",
162
+ backgroundColor: isAppBackground ? "transparent" : "color-mix(in srgb, var(--surface) 85%, transparent)",
163
+ backdropFilter: isAppBackground ? void 0 : "blur(75px)",
164
+ WebkitBackdropFilter: isAppBackground ? void 0 : "blur(75px)",
162
165
  // Safari support
163
166
  color: "var(--fg)",
164
167
  overflow: "hidden",
165
- transition: "background-color 0.3s ease, color 0.3s ease",
168
+ transition: "background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease",
169
+ boxShadow: elevated ? "var(--shadow-elevated)" : void 0,
166
170
  ...style,
167
- // Only set position: relative if decorations are shown (for SVG positioning) and user hasn't provided their own
168
- ...showDecorations && !style?.position && { position: "relative" }
171
+ // Apply position: relative by default, but allow user override via style prop
172
+ position: style?.position || "relative"
169
173
  };
170
174
  const hasPadding = className && /\b(p-|px-|py-|pt-|pb-|pl-|pr-)\d/.test(className);
171
175
  const cardClasses = `${!hasPadding ? "p-6" : ""} ${className || ""}`.trim();
@@ -176,6 +180,34 @@ function Card({
176
180
  style: mergedStyle,
177
181
  ...props,
178
182
  children: [
183
+ isAppBackground && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
184
+ /* @__PURE__ */ jsxRuntime.jsx(
185
+ "div",
186
+ {
187
+ className: "absolute inset-0 transition-opacity duration-500 opacity-100 dark:opacity-0",
188
+ style: {
189
+ backgroundImage: `url(${bgLight})`,
190
+ backgroundSize: "cover",
191
+ backgroundPosition: "center",
192
+ backgroundRepeat: "no-repeat",
193
+ zIndex: 0
194
+ }
195
+ }
196
+ ),
197
+ /* @__PURE__ */ jsxRuntime.jsx(
198
+ "div",
199
+ {
200
+ className: "absolute inset-0 transition-opacity duration-500 opacity-0 dark:opacity-100",
201
+ style: {
202
+ backgroundImage: `url(${bgDark})`,
203
+ backgroundSize: "cover",
204
+ backgroundPosition: "center",
205
+ backgroundRepeat: "no-repeat",
206
+ zIndex: 0
207
+ }
208
+ }
209
+ )
210
+ ] }),
179
211
  showDecorations && /* @__PURE__ */ jsxRuntime.jsxs(
180
212
  "svg",
181
213
  {
package/dist/index.d.cts CHANGED
@@ -47,8 +47,12 @@ 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";
52
+ /** Apply elevated shadow effect (default: false) */
53
+ elevated?: boolean;
50
54
  };
51
- declare function Card({ children, className, style, showDecorations, ...props }: CardProps): react_jsx_runtime.JSX.Element;
55
+ declare function Card({ children, className, style, showDecorations, variant, elevated, ...props }: CardProps): react_jsx_runtime.JSX.Element;
52
56
 
53
57
  type InputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> & {
54
58
  /** Input visual variant */
package/dist/index.d.ts CHANGED
@@ -47,8 +47,12 @@ 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";
52
+ /** Apply elevated shadow effect (default: false) */
53
+ elevated?: boolean;
50
54
  };
51
- declare function Card({ children, className, style, showDecorations, ...props }: CardProps): react_jsx_runtime.JSX.Element;
55
+ declare function Card({ children, className, style, showDecorations, variant, elevated, ...props }: CardProps): react_jsx_runtime.JSX.Element;
52
56
 
53
57
  type InputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> & {
54
58
  /** Input visual variant */
package/dist/index.js CHANGED
@@ -131,20 +131,24 @@ function Card({
131
131
  className = "",
132
132
  style,
133
133
  showDecorations = false,
134
+ variant = "default",
135
+ elevated = false,
134
136
  ...props
135
137
  }) {
138
+ const isAppBackground = variant === "app-background";
136
139
  const mergedStyle = {
137
140
  borderRadius: "30px",
138
- backgroundColor: "color-mix(in srgb, var(--surface) 85%, transparent)",
139
- backdropFilter: "blur(75px)",
140
- WebkitBackdropFilter: "blur(75px)",
141
+ backgroundColor: isAppBackground ? "transparent" : "color-mix(in srgb, var(--surface) 85%, transparent)",
142
+ backdropFilter: isAppBackground ? void 0 : "blur(75px)",
143
+ WebkitBackdropFilter: isAppBackground ? void 0 : "blur(75px)",
141
144
  // Safari support
142
145
  color: "var(--fg)",
143
146
  overflow: "hidden",
144
- transition: "background-color 0.3s ease, color 0.3s ease",
147
+ transition: "background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease",
148
+ boxShadow: elevated ? "var(--shadow-elevated)" : void 0,
145
149
  ...style,
146
- // Only set position: relative if decorations are shown (for SVG positioning) and user hasn't provided their own
147
- ...showDecorations && !style?.position && { position: "relative" }
150
+ // Apply position: relative by default, but allow user override via style prop
151
+ position: style?.position || "relative"
148
152
  };
149
153
  const hasPadding = className && /\b(p-|px-|py-|pt-|pb-|pl-|pr-)\d/.test(className);
150
154
  const cardClasses = `${!hasPadding ? "p-6" : ""} ${className || ""}`.trim();
@@ -155,6 +159,34 @@ function Card({
155
159
  style: mergedStyle,
156
160
  ...props,
157
161
  children: [
162
+ isAppBackground && /* @__PURE__ */ jsxs(Fragment, { children: [
163
+ /* @__PURE__ */ jsx(
164
+ "div",
165
+ {
166
+ className: "absolute inset-0 transition-opacity duration-500 opacity-100 dark:opacity-0",
167
+ style: {
168
+ backgroundImage: `url(${bgLight})`,
169
+ backgroundSize: "cover",
170
+ backgroundPosition: "center",
171
+ backgroundRepeat: "no-repeat",
172
+ zIndex: 0
173
+ }
174
+ }
175
+ ),
176
+ /* @__PURE__ */ jsx(
177
+ "div",
178
+ {
179
+ className: "absolute inset-0 transition-opacity duration-500 opacity-0 dark:opacity-100",
180
+ style: {
181
+ backgroundImage: `url(${bgDark})`,
182
+ backgroundSize: "cover",
183
+ backgroundPosition: "center",
184
+ backgroundRepeat: "no-repeat",
185
+ zIndex: 0
186
+ }
187
+ }
188
+ )
189
+ ] }),
158
190
  showDecorations && /* @__PURE__ */ jsxs(
159
191
  "svg",
160
192
  {
package/dist/styles.css CHANGED
@@ -60,6 +60,7 @@
60
60
  /* Shadows */
61
61
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
62
62
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.10), 0 2px 4px -2px rgb(0 0 0 / 0.10);
63
+ --shadow-elevated: 0 4px 4px 0 rgba(0, 0, 0, 0.25), 2px 2px 24px 0 rgba(0, 0, 0, 0.10);
63
64
 
64
65
  /* Motion */
65
66
  --motion-fast: 150ms;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neoptocom/neopto-ui",
3
- "version": "0.12.3",
3
+ "version": "0.14.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": [
@@ -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,10 @@ 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";
13
+ /** Apply elevated shadow effect (default: false) */
14
+ elevated?: boolean;
10
15
  };
11
16
 
12
17
  export function Card({
@@ -14,20 +19,27 @@ export function Card({
14
19
  className = "",
15
20
  style,
16
21
  showDecorations = false,
22
+ variant = "default",
23
+ elevated = false,
17
24
  ...props
18
25
  }: CardProps) {
26
+ const isAppBackground = variant === "app-background";
27
+
19
28
  // Merge user styles with card styles
20
29
  const mergedStyle: React.CSSProperties = {
21
30
  borderRadius: "30px",
22
- backgroundColor: "color-mix(in srgb, var(--surface) 85%, transparent)",
23
- backdropFilter: "blur(75px)",
24
- WebkitBackdropFilter: "blur(75px)", // Safari support
31
+ backgroundColor: isAppBackground
32
+ ? "transparent"
33
+ : "color-mix(in srgb, var(--surface) 85%, transparent)",
34
+ backdropFilter: isAppBackground ? undefined : "blur(75px)",
35
+ WebkitBackdropFilter: isAppBackground ? undefined : "blur(75px)", // Safari support
25
36
  color: "var(--fg)",
26
37
  overflow: "hidden",
27
- transition: "background-color 0.3s ease, color 0.3s ease",
38
+ transition: "background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease",
39
+ boxShadow: elevated ? "var(--shadow-elevated)" : undefined,
28
40
  ...style,
29
- // Only set position: relative if decorations are shown (for SVG positioning) and user hasn't provided their own
30
- ...(showDecorations && !style?.position && { position: "relative" }),
41
+ // Apply position: relative by default, but allow user override via style prop
42
+ position: style?.position || "relative",
31
43
  };
32
44
 
33
45
  // Smart class merging: only add default padding if not provided
@@ -40,6 +52,33 @@ export function Card({
40
52
  style={mergedStyle}
41
53
  {...props}
42
54
  >
55
+ {/* App background variant images */}
56
+ {isAppBackground && (
57
+ <>
58
+ {/* Light mode background */}
59
+ <div
60
+ className="absolute inset-0 transition-opacity duration-500 opacity-100 dark:opacity-0"
61
+ style={{
62
+ backgroundImage: `url(${assets.bgLight})`,
63
+ backgroundSize: "cover",
64
+ backgroundPosition: "center",
65
+ backgroundRepeat: "no-repeat",
66
+ zIndex: 0,
67
+ }}
68
+ />
69
+ {/* Dark mode background */}
70
+ <div
71
+ className="absolute inset-0 transition-opacity duration-500 opacity-0 dark:opacity-100"
72
+ style={{
73
+ backgroundImage: `url(${assets.bgDark})`,
74
+ backgroundSize: "cover",
75
+ backgroundPosition: "center",
76
+ backgroundRepeat: "no-repeat",
77
+ zIndex: 0,
78
+ }}
79
+ />
80
+ </>
81
+ )}
43
82
  {showDecorations && (
44
83
  <svg
45
84
  style={{
@@ -39,6 +39,107 @@ 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
+
85
+ export const Elevated: Story = {
86
+ render: () => (
87
+ <div className="max-w-md">
88
+ <Card elevated>
89
+ <Typo variant="headline-sm" bold="semibold">Elevated Card</Typo>
90
+ <Typo variant="body-md" className="mt-2">
91
+ This card uses the elevated shadow effect for a floating appearance.
92
+ </Typo>
93
+ <div className="mt-4">
94
+ <Button variant="primary">Take Action</Button>
95
+ </div>
96
+ </Card>
97
+ </div>
98
+ ),
99
+ };
100
+
101
+ export const ElevatedComparison: Story = {
102
+ render: () => (
103
+ <div className="grid grid-cols-2 gap-6 max-w-4xl">
104
+ <div>
105
+ <Typo variant="label-lg" bold="semibold" className="mb-3">Default</Typo>
106
+ <Card>
107
+ <Typo variant="title-md" bold="semibold">Regular Card</Typo>
108
+ <Typo variant="body-sm" className="mt-2">
109
+ Standard card with glassmorphic effect, no shadow.
110
+ </Typo>
111
+ </Card>
112
+ </div>
113
+ <div>
114
+ <Typo variant="label-lg" bold="semibold" className="mb-3">Elevated</Typo>
115
+ <Card elevated>
116
+ <Typo variant="title-md" bold="semibold">Elevated Card</Typo>
117
+ <Typo variant="body-sm" className="mt-2">
118
+ Enhanced with elevated shadow for emphasis.
119
+ </Typo>
120
+ </Card>
121
+ </div>
122
+ </div>
123
+ ),
124
+ };
125
+
126
+ export const ElevatedAppBackground: Story = {
127
+ render: () => (
128
+ <div className="max-w-md">
129
+ <Card variant="app-background" elevated className="p-8">
130
+ <Typo variant="headline-sm" bold="semibold">Elevated + App Background</Typo>
131
+ <Typo variant="body-md" className="mt-3">
132
+ Combining the app-background variant with elevated shadow creates a stunning effect.
133
+ </Typo>
134
+ <div className="mt-6 flex gap-3">
135
+ <Button variant="primary">Primary</Button>
136
+ <Button variant="secondary">Secondary</Button>
137
+ </div>
138
+ </Card>
139
+ </div>
140
+ ),
141
+ };
142
+
42
143
  export const CustomPadding: Story = {
43
144
  render: () => (
44
145
  <div className="max-w-md space-y-4">
@@ -44,6 +44,7 @@
44
44
  /* Shadows */
45
45
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
46
46
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.10), 0 2px 4px -2px rgb(0 0 0 / 0.10);
47
+ --shadow-elevated: 0 4px 4px 0 rgba(0, 0, 0, 0.25), 2px 2px 24px 0 rgba(0, 0, 0, 0.10);
47
48
 
48
49
  /* Motion */
49
50
  --motion-fast: 150ms;