@neoptocom/neopto-ui 1.6.8 → 1.6.10
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 +6 -7
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -7
- package/package.json +1 -1
- package/src/components/Avatar.tsx +9 -3
- package/src/components/Button.stories.tsx +10 -1
- package/src/components/Button.tsx +4 -3
- package/src/components/Typo.tsx +0 -6
package/dist/index.cjs
CHANGED
|
@@ -515,12 +515,9 @@ function getTypoClasses(weight = "normal", muted, className) {
|
|
|
515
515
|
semibold: "font-semibold",
|
|
516
516
|
bold: "font-bold"
|
|
517
517
|
};
|
|
518
|
-
const hasMarginRight = className?.includes("mr-");
|
|
519
|
-
const horizontalSpacing = hasMarginRight ? "" : "mr-2";
|
|
520
518
|
return [
|
|
521
519
|
weights[weight],
|
|
522
520
|
muted ? "text-[var(--muted-fg)]" : "",
|
|
523
|
-
horizontalSpacing,
|
|
524
521
|
className
|
|
525
522
|
].filter(Boolean).join(" ");
|
|
526
523
|
}
|
|
@@ -563,7 +560,8 @@ function getAvatarClasses(size = "md", className) {
|
|
|
563
560
|
const base = "relative box-border flex items-center justify-center overflow-hidden rounded-full border border-[var(--border)] bg-[var(--muted)] text-[var(--fg)] select-none";
|
|
564
561
|
const sizes = {
|
|
565
562
|
sm: "w-[28px] h-[28px]",
|
|
566
|
-
md: "w-[60px] h-[60px]"
|
|
563
|
+
md: "w-[60px] h-[60px]",
|
|
564
|
+
bg: "w-[90px] h-[90px]"
|
|
567
565
|
};
|
|
568
566
|
return [base, sizes[size], className].filter(Boolean).join(" ");
|
|
569
567
|
}
|
|
@@ -590,7 +588,7 @@ function Avatar({
|
|
|
590
588
|
if (color) s.backgroundColor = color;
|
|
591
589
|
return s;
|
|
592
590
|
}, [color, style]);
|
|
593
|
-
const textVariant = size === "sm" ? "label-md" : "headline-md";
|
|
591
|
+
const textVariant = size === "sm" ? "label-md" : size === "bg" ? "headline-lg" : "headline-md";
|
|
594
592
|
const showImage = !!src && !imgError;
|
|
595
593
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
596
594
|
"div",
|
|
@@ -1154,7 +1152,8 @@ function getButtonClasses(variant = "primary", size = "md", fullWidth, className
|
|
|
1154
1152
|
const variants = {
|
|
1155
1153
|
primary: "bg-cyan-500 text-white hover:bg-cyan-400 active:bg-cyan-600 disabled:bg-neutral-400",
|
|
1156
1154
|
secondary: "border border-cyan-500 text-cyan-500 bg-transparent hover:bg-cyan-50 active:bg-cyan-100 disabled:border-neutral-400 disabled:text-neutral-400",
|
|
1157
|
-
ghost: "bg-transparent text-[var(--fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50"
|
|
1155
|
+
ghost: "bg-transparent text-[var(--fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50",
|
|
1156
|
+
inline: "text-cyan-500 bg-transparent active:bg-cyan-100 disabled:text-neutral-400"
|
|
1158
1157
|
};
|
|
1159
1158
|
const sizes = {
|
|
1160
1159
|
sm: "h-9 px-3",
|
|
@@ -1164,7 +1163,7 @@ function getButtonClasses(variant = "primary", size = "md", fullWidth, className
|
|
|
1164
1163
|
return [
|
|
1165
1164
|
base,
|
|
1166
1165
|
variants[variant],
|
|
1167
|
-
sizes[size],
|
|
1166
|
+
variant === "inline" ? "px-2" : sizes[size],
|
|
1168
1167
|
fullWidth ? "w-full" : "",
|
|
1169
1168
|
className
|
|
1170
1169
|
].filter(Boolean).join(" ");
|
package/dist/index.d.cts
CHANGED
|
@@ -143,7 +143,7 @@ type AvatarProps = {
|
|
|
143
143
|
/** Accessible alt text; defaults to the person's name */
|
|
144
144
|
alt?: string;
|
|
145
145
|
/** Avatar size */
|
|
146
|
-
size?: "sm" | "md";
|
|
146
|
+
size?: "sm" | "md" | "bg";
|
|
147
147
|
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children">;
|
|
148
148
|
declare function Avatar({ name, src, color, size, alt, className, style, ...props }: AvatarProps): react_jsx_runtime.JSX.Element;
|
|
149
149
|
|
|
@@ -228,7 +228,7 @@ declare function Search({ className, options, onSearch, selectedOption, onSelect
|
|
|
228
228
|
|
|
229
229
|
type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
230
230
|
/** Button visual variant */
|
|
231
|
-
variant?: "primary" | "secondary" | "ghost";
|
|
231
|
+
variant?: "primary" | "secondary" | "ghost" | "inline";
|
|
232
232
|
/** Button size */
|
|
233
233
|
size?: "sm" | "md" | "lg";
|
|
234
234
|
/** Make button full width */
|
|
@@ -238,7 +238,7 @@ type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
|
238
238
|
};
|
|
239
239
|
declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
240
240
|
/** Button visual variant */
|
|
241
|
-
variant?: "primary" | "secondary" | "ghost";
|
|
241
|
+
variant?: "primary" | "secondary" | "ghost" | "inline";
|
|
242
242
|
/** Button size */
|
|
243
243
|
size?: "sm" | "md" | "lg";
|
|
244
244
|
/** Make button full width */
|
package/dist/index.d.ts
CHANGED
|
@@ -143,7 +143,7 @@ type AvatarProps = {
|
|
|
143
143
|
/** Accessible alt text; defaults to the person's name */
|
|
144
144
|
alt?: string;
|
|
145
145
|
/** Avatar size */
|
|
146
|
-
size?: "sm" | "md";
|
|
146
|
+
size?: "sm" | "md" | "bg";
|
|
147
147
|
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children">;
|
|
148
148
|
declare function Avatar({ name, src, color, size, alt, className, style, ...props }: AvatarProps): react_jsx_runtime.JSX.Element;
|
|
149
149
|
|
|
@@ -228,7 +228,7 @@ declare function Search({ className, options, onSearch, selectedOption, onSelect
|
|
|
228
228
|
|
|
229
229
|
type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
230
230
|
/** Button visual variant */
|
|
231
|
-
variant?: "primary" | "secondary" | "ghost";
|
|
231
|
+
variant?: "primary" | "secondary" | "ghost" | "inline";
|
|
232
232
|
/** Button size */
|
|
233
233
|
size?: "sm" | "md" | "lg";
|
|
234
234
|
/** Make button full width */
|
|
@@ -238,7 +238,7 @@ type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
|
238
238
|
};
|
|
239
239
|
declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
240
240
|
/** Button visual variant */
|
|
241
|
-
variant?: "primary" | "secondary" | "ghost";
|
|
241
|
+
variant?: "primary" | "secondary" | "ghost" | "inline";
|
|
242
242
|
/** Button size */
|
|
243
243
|
size?: "sm" | "md" | "lg";
|
|
244
244
|
/** Make button full width */
|
package/dist/index.js
CHANGED
|
@@ -494,12 +494,9 @@ function getTypoClasses(weight = "normal", muted, className) {
|
|
|
494
494
|
semibold: "font-semibold",
|
|
495
495
|
bold: "font-bold"
|
|
496
496
|
};
|
|
497
|
-
const hasMarginRight = className?.includes("mr-");
|
|
498
|
-
const horizontalSpacing = hasMarginRight ? "" : "mr-2";
|
|
499
497
|
return [
|
|
500
498
|
weights[weight],
|
|
501
499
|
muted ? "text-[var(--muted-fg)]" : "",
|
|
502
|
-
horizontalSpacing,
|
|
503
500
|
className
|
|
504
501
|
].filter(Boolean).join(" ");
|
|
505
502
|
}
|
|
@@ -542,7 +539,8 @@ function getAvatarClasses(size = "md", className) {
|
|
|
542
539
|
const base = "relative box-border flex items-center justify-center overflow-hidden rounded-full border border-[var(--border)] bg-[var(--muted)] text-[var(--fg)] select-none";
|
|
543
540
|
const sizes = {
|
|
544
541
|
sm: "w-[28px] h-[28px]",
|
|
545
|
-
md: "w-[60px] h-[60px]"
|
|
542
|
+
md: "w-[60px] h-[60px]",
|
|
543
|
+
bg: "w-[90px] h-[90px]"
|
|
546
544
|
};
|
|
547
545
|
return [base, sizes[size], className].filter(Boolean).join(" ");
|
|
548
546
|
}
|
|
@@ -569,7 +567,7 @@ function Avatar({
|
|
|
569
567
|
if (color) s.backgroundColor = color;
|
|
570
568
|
return s;
|
|
571
569
|
}, [color, style]);
|
|
572
|
-
const textVariant = size === "sm" ? "label-md" : "headline-md";
|
|
570
|
+
const textVariant = size === "sm" ? "label-md" : size === "bg" ? "headline-lg" : "headline-md";
|
|
573
571
|
const showImage = !!src && !imgError;
|
|
574
572
|
return /* @__PURE__ */ jsx(
|
|
575
573
|
"div",
|
|
@@ -1133,7 +1131,8 @@ function getButtonClasses(variant = "primary", size = "md", fullWidth, className
|
|
|
1133
1131
|
const variants = {
|
|
1134
1132
|
primary: "bg-cyan-500 text-white hover:bg-cyan-400 active:bg-cyan-600 disabled:bg-neutral-400",
|
|
1135
1133
|
secondary: "border border-cyan-500 text-cyan-500 bg-transparent hover:bg-cyan-50 active:bg-cyan-100 disabled:border-neutral-400 disabled:text-neutral-400",
|
|
1136
|
-
ghost: "bg-transparent text-[var(--fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50"
|
|
1134
|
+
ghost: "bg-transparent text-[var(--fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50",
|
|
1135
|
+
inline: "text-cyan-500 bg-transparent active:bg-cyan-100 disabled:text-neutral-400"
|
|
1137
1136
|
};
|
|
1138
1137
|
const sizes = {
|
|
1139
1138
|
sm: "h-9 px-3",
|
|
@@ -1143,7 +1142,7 @@ function getButtonClasses(variant = "primary", size = "md", fullWidth, className
|
|
|
1143
1142
|
return [
|
|
1144
1143
|
base,
|
|
1145
1144
|
variants[variant],
|
|
1146
|
-
sizes[size],
|
|
1145
|
+
variant === "inline" ? "px-2" : sizes[size],
|
|
1147
1146
|
fullWidth ? "w-full" : "",
|
|
1148
1147
|
className
|
|
1149
1148
|
].filter(Boolean).join(" ");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neoptocom/neopto-ui",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.10",
|
|
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 documentation. Requires Tailwind v4+.",
|
|
6
6
|
"keywords": [
|
|
@@ -12,7 +12,7 @@ export type AvatarProps = {
|
|
|
12
12
|
/** Accessible alt text; defaults to the person's name */
|
|
13
13
|
alt?: string;
|
|
14
14
|
/** Avatar size */
|
|
15
|
-
size?: "sm" | "md";
|
|
15
|
+
size?: "sm" | "md" | "bg";
|
|
16
16
|
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children">;
|
|
17
17
|
|
|
18
18
|
function getAvatarClasses(size: AvatarProps["size"] = "md", className?: string): string {
|
|
@@ -22,7 +22,8 @@ function getAvatarClasses(size: AvatarProps["size"] = "md", className?: string):
|
|
|
22
22
|
|
|
23
23
|
const sizes = {
|
|
24
24
|
sm: "w-[28px] h-[28px]",
|
|
25
|
-
md: "w-[60px] h-[60px]"
|
|
25
|
+
md: "w-[60px] h-[60px]",
|
|
26
|
+
bg: "w-[90px] h-[90px]"
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
return [base, sizes[size], className].filter(Boolean).join(" ");
|
|
@@ -53,7 +54,12 @@ export default function Avatar({
|
|
|
53
54
|
return s;
|
|
54
55
|
}, [color, style]);
|
|
55
56
|
|
|
56
|
-
const textVariant =
|
|
57
|
+
const textVariant =
|
|
58
|
+
size === "sm"
|
|
59
|
+
? ("label-md" as const)
|
|
60
|
+
: size === "bg"
|
|
61
|
+
? ("headline-lg" as const)
|
|
62
|
+
: ("headline-md" as const);
|
|
57
63
|
|
|
58
64
|
const showImage = !!src && !imgError;
|
|
59
65
|
|
|
@@ -16,7 +16,7 @@ const meta: Meta<typeof Button> = {
|
|
|
16
16
|
argTypes: {
|
|
17
17
|
variant: {
|
|
18
18
|
control: "inline-radio",
|
|
19
|
-
options: ["primary", "secondary", "ghost"]
|
|
19
|
+
options: ["primary", "secondary", "ghost", "inline"]
|
|
20
20
|
},
|
|
21
21
|
size: {
|
|
22
22
|
control: "inline-radio",
|
|
@@ -54,6 +54,11 @@ export const Variants: Story = {
|
|
|
54
54
|
Ghost
|
|
55
55
|
</Typo>
|
|
56
56
|
</Button>
|
|
57
|
+
<Button variant="inline">
|
|
58
|
+
<Typo variant="title-sm" bold="semibold">
|
|
59
|
+
Inline
|
|
60
|
+
</Typo>
|
|
61
|
+
</Button>
|
|
57
62
|
</div>
|
|
58
63
|
)
|
|
59
64
|
};
|
|
@@ -95,6 +100,10 @@ export const WithIcons: Story = {
|
|
|
95
100
|
<Icon name="settings" />
|
|
96
101
|
<span>Settings</span>
|
|
97
102
|
</Button>
|
|
103
|
+
<Button variant="inline">
|
|
104
|
+
<Icon name="settings" />
|
|
105
|
+
<span>Inline</span>
|
|
106
|
+
</Button>
|
|
98
107
|
</div>
|
|
99
108
|
)
|
|
100
109
|
};
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
|
|
3
3
|
export type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
4
4
|
/** Button visual variant */
|
|
5
|
-
variant?: "primary" | "secondary" | "ghost";
|
|
5
|
+
variant?: "primary" | "secondary" | "ghost" | "inline";
|
|
6
6
|
/** Button size */
|
|
7
7
|
size?: "sm" | "md" | "lg";
|
|
8
8
|
/** Make button full width */
|
|
@@ -25,7 +25,8 @@ function getButtonClasses(
|
|
|
25
25
|
const variants = {
|
|
26
26
|
primary: "bg-cyan-500 text-white hover:bg-cyan-400 active:bg-cyan-600 disabled:bg-neutral-400",
|
|
27
27
|
secondary: "border border-cyan-500 text-cyan-500 bg-transparent hover:bg-cyan-50 active:bg-cyan-100 disabled:border-neutral-400 disabled:text-neutral-400",
|
|
28
|
-
ghost: "bg-transparent text-[var(--fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50"
|
|
28
|
+
ghost: "bg-transparent text-[var(--fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50",
|
|
29
|
+
inline: "text-cyan-500 bg-transparent active:bg-cyan-100 disabled:text-neutral-400"
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
const sizes = {
|
|
@@ -37,7 +38,7 @@ function getButtonClasses(
|
|
|
37
38
|
return [
|
|
38
39
|
base,
|
|
39
40
|
variants[variant],
|
|
40
|
-
sizes[size],
|
|
41
|
+
variant === "inline" ? "px-2" : sizes[size],
|
|
41
42
|
fullWidth ? "w-full" : "",
|
|
42
43
|
className
|
|
43
44
|
].filter(Boolean).join(" ");
|
package/src/components/Typo.tsx
CHANGED
|
@@ -47,16 +47,10 @@ function getTypoClasses(
|
|
|
47
47
|
semibold: "font-semibold",
|
|
48
48
|
bold: "font-bold"
|
|
49
49
|
};
|
|
50
|
-
|
|
51
|
-
// Add default horizontal spacing (margin-right) for spacing between side-by-side Typo components
|
|
52
|
-
// Users can override with className="mr-0" if needed
|
|
53
|
-
const hasMarginRight = className?.includes("mr-");
|
|
54
|
-
const horizontalSpacing = hasMarginRight ? "" : "mr-2";
|
|
55
50
|
|
|
56
51
|
return [
|
|
57
52
|
weights[weight],
|
|
58
53
|
muted ? "text-[var(--muted-fg)]" : "",
|
|
59
|
-
horizontalSpacing,
|
|
60
54
|
className
|
|
61
55
|
].filter(Boolean).join(" ");
|
|
62
56
|
}
|