@designa8/vibedesign-v6 1.8.3 → 1.8.4
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/README.md +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
- package/src/atoms/FilterTabBar/FilterTabBar.tsx +11 -2
- package/src/atoms/FilterTabBar/preview.tsx +98 -16
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -3086,12 +3086,14 @@ var FilterTabBar = import_react13.default.forwardRef(
|
|
|
3086
3086
|
{
|
|
3087
3087
|
role: "tab",
|
|
3088
3088
|
"aria-selected": isActive,
|
|
3089
|
+
"aria-label": tab.label ?? tab.value,
|
|
3089
3090
|
variant: isActive ? "primary" : "ghost",
|
|
3090
3091
|
size: "sm",
|
|
3091
3092
|
onClick: () => onChange(tab.value),
|
|
3092
3093
|
className: "gap-xs",
|
|
3093
3094
|
children: [
|
|
3094
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: tab.
|
|
3095
|
+
tab.icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "inline-flex items-center justify-center shrink-0", "aria-hidden": "true", children: tab.icon }),
|
|
3096
|
+
tab.label && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: tab.label }),
|
|
3095
3097
|
tab.count !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3096
3098
|
"span",
|
|
3097
3099
|
{
|
package/dist/index.js
CHANGED
|
@@ -3038,12 +3038,14 @@ var FilterTabBar = React13.forwardRef(
|
|
|
3038
3038
|
{
|
|
3039
3039
|
role: "tab",
|
|
3040
3040
|
"aria-selected": isActive,
|
|
3041
|
+
"aria-label": tab.label ?? tab.value,
|
|
3041
3042
|
variant: isActive ? "primary" : "ghost",
|
|
3042
3043
|
size: "sm",
|
|
3043
3044
|
onClick: () => onChange(tab.value),
|
|
3044
3045
|
className: "gap-xs",
|
|
3045
3046
|
children: [
|
|
3046
|
-
/* @__PURE__ */ jsx13("span", { children: tab.
|
|
3047
|
+
tab.icon && /* @__PURE__ */ jsx13("span", { className: "inline-flex items-center justify-center shrink-0", "aria-hidden": "true", children: tab.icon }),
|
|
3048
|
+
tab.label && /* @__PURE__ */ jsx13("span", { children: tab.label }),
|
|
3047
3049
|
tab.count !== void 0 && /* @__PURE__ */ jsx13(
|
|
3048
3050
|
"span",
|
|
3049
3051
|
{
|
package/package.json
CHANGED
|
@@ -5,9 +5,11 @@ export interface FilterTab {
|
|
|
5
5
|
/** Unique identifier for this tab */
|
|
6
6
|
value: string;
|
|
7
7
|
/** Display label */
|
|
8
|
-
label
|
|
8
|
+
label?: string;
|
|
9
9
|
/** Optional count badge */
|
|
10
10
|
count?: number;
|
|
11
|
+
/** Optional icon rendered before the label */
|
|
12
|
+
icon?: React.ReactNode;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export interface FilterTabBarProps
|
|
@@ -42,12 +44,19 @@ export const FilterTabBar = React.forwardRef<HTMLDivElement, FilterTabBarProps>(
|
|
|
42
44
|
key={tab.value}
|
|
43
45
|
role="tab"
|
|
44
46
|
aria-selected={isActive}
|
|
47
|
+
aria-label={tab.label ?? tab.value}
|
|
45
48
|
variant={isActive ? "primary" : "ghost"}
|
|
46
49
|
size="sm"
|
|
47
50
|
onClick={() => onChange(tab.value)}
|
|
48
51
|
className="gap-xs"
|
|
49
52
|
>
|
|
50
|
-
|
|
53
|
+
{tab.icon && (
|
|
54
|
+
<span className="inline-flex items-center justify-center shrink-0" aria-hidden="true">
|
|
55
|
+
{tab.icon}
|
|
56
|
+
</span>
|
|
57
|
+
)}
|
|
58
|
+
|
|
59
|
+
{tab.label && <span>{tab.label}</span>}
|
|
51
60
|
|
|
52
61
|
{tab.count !== undefined && (
|
|
53
62
|
<span
|
|
@@ -1,31 +1,113 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { FilterTabBar } from "./FilterTabBar";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/* Minimal inline SVG icons — no external deps */
|
|
5
|
+
const IconGrid = () => (
|
|
6
|
+
<svg width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
7
|
+
<rect x="1" y="1" width="6" height="6" rx="1.5" fill="currentColor" />
|
|
8
|
+
<rect x="9" y="1" width="6" height="6" rx="1.5" fill="currentColor" />
|
|
9
|
+
<rect x="1" y="9" width="6" height="6" rx="1.5" fill="currentColor" />
|
|
10
|
+
<rect x="9" y="9" width="6" height="6" rx="1.5" fill="currentColor" />
|
|
11
|
+
</svg>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const IconAtom = () => (
|
|
15
|
+
<svg width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
16
|
+
<circle cx="8" cy="8" r="2" fill="currentColor" />
|
|
17
|
+
<ellipse cx="8" cy="8" rx="7" ry="3" stroke="currentColor" strokeWidth="1.25" fill="none" />
|
|
18
|
+
<ellipse cx="8" cy="8" rx="7" ry="3" stroke="currentColor" strokeWidth="1.25" fill="none" transform="rotate(60 8 8)" />
|
|
19
|
+
<ellipse cx="8" cy="8" rx="7" ry="3" stroke="currentColor" strokeWidth="1.25" fill="none" transform="rotate(120 8 8)" />
|
|
20
|
+
</svg>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const IconLayers = () => (
|
|
24
|
+
<svg width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
25
|
+
<path d="M8 1L15 5L8 9L1 5L8 1Z" fill="currentColor" opacity="0.4" />
|
|
26
|
+
<path d="M1 8L8 12L15 8" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" fill="none" />
|
|
27
|
+
<path d="M1 11L8 15L15 11" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" fill="none" />
|
|
28
|
+
</svg>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const IconStar = () => (
|
|
32
|
+
<svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">
|
|
33
|
+
<path d="M8 1l1.854 4.146H14l-3.427 2.708 1.31 4.146L8 9.764l-3.883 2.236 1.31-4.146L2 5.146h4.146L8 1z" />
|
|
34
|
+
</svg>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const IconArchive = () => (
|
|
38
|
+
<svg width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
39
|
+
<rect x="1" y="1" width="14" height="3" rx="1" fill="currentColor" opacity="0.5" />
|
|
40
|
+
<path d="M2 5h12v8a1 1 0 01-1 1H3a1 1 0 01-1-1V5z" fill="currentColor" opacity="0.3" />
|
|
41
|
+
<path d="M6 8h4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" />
|
|
42
|
+
</svg>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const tabsWithCounts = [
|
|
5
46
|
{ value: "all", label: "All", count: 15 },
|
|
6
47
|
{ value: "atoms", label: "Atoms", count: 8 },
|
|
7
48
|
{ value: "molecules", label: "Molecules", count: 2 },
|
|
8
49
|
{ value: "organisms", label: "Organisms", count: 5 },
|
|
9
|
-
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
const tabsWithIcons = [
|
|
53
|
+
{ value: "all", label: "All", icon: <IconGrid /> },
|
|
54
|
+
{ value: "atoms", label: "Atoms", icon: <IconAtom />, count: 8 },
|
|
55
|
+
{ value: "molecules", label: "Molecules", icon: <IconLayers />, count: 2 },
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
const tabsIconOnly = [
|
|
59
|
+
{ value: "all", icon: <IconGrid />, label: "All" },
|
|
60
|
+
{ value: "starred", icon: <IconStar />, label: "Starred" },
|
|
61
|
+
{ value: "archived", icon: <IconArchive />, label: "Archived" },
|
|
10
62
|
];
|
|
11
63
|
|
|
12
64
|
export default function FilterTabBarPreview() {
|
|
13
|
-
const [
|
|
65
|
+
const [active1, setActive1] = useState("all");
|
|
66
|
+
const [active2, setActive2] = useState("all");
|
|
67
|
+
const [active3, setActive3] = useState("all");
|
|
68
|
+
const [active4, setActive4] = useState("all");
|
|
14
69
|
|
|
15
70
|
return (
|
|
16
|
-
<div className="w-full max-w-3xl mx-auto p-xl flex flex-col items-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
value=
|
|
27
|
-
|
|
28
|
-
|
|
71
|
+
<div className="w-full max-w-3xl mx-auto p-xl flex flex-col items-start gap-xl bg-canvas py-xxl">
|
|
72
|
+
{/* Label + count (existing behavior) */}
|
|
73
|
+
<div className="flex flex-col gap-sm w-full">
|
|
74
|
+
<p className="text-caption text-muted uppercase tracking-wide">Label + count</p>
|
|
75
|
+
<FilterTabBar tabs={tabsWithCounts} value={active1} onChange={setActive1} />
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
{/* Icon + label (new) */}
|
|
79
|
+
<div className="flex flex-col gap-sm w-full">
|
|
80
|
+
<p className="text-caption text-muted uppercase tracking-wide">Icon + label</p>
|
|
81
|
+
<FilterTabBar tabs={tabsWithIcons} value={active2} onChange={setActive2} />
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
{/* Icon + label + count (new) */}
|
|
85
|
+
<div className="flex flex-col gap-sm w-full">
|
|
86
|
+
<p className="text-caption text-muted uppercase tracking-wide">Icon + label + count</p>
|
|
87
|
+
<FilterTabBar
|
|
88
|
+
tabs={[
|
|
89
|
+
{ value: "all", label: "All", icon: <IconGrid />, count: 15 },
|
|
90
|
+
{ value: "atoms", label: "Atoms", icon: <IconAtom />, count: 8 },
|
|
91
|
+
{ value: "molecules", label: "Molecules", icon: <IconLayers />, count: 2 },
|
|
92
|
+
]}
|
|
93
|
+
value={active3}
|
|
94
|
+
onChange={setActive3}
|
|
95
|
+
/>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
{/* Label only (no count or icon) */}
|
|
99
|
+
<div className="flex flex-col gap-sm w-full">
|
|
100
|
+
<p className="text-caption text-muted uppercase tracking-wide">Label only</p>
|
|
101
|
+
<FilterTabBar
|
|
102
|
+
tabs={[
|
|
103
|
+
{ value: "recent", label: "Recent" },
|
|
104
|
+
{ value: "starred", label: "Starred" },
|
|
105
|
+
{ value: "archived", label: "Archived" },
|
|
106
|
+
]}
|
|
107
|
+
value={active4}
|
|
108
|
+
onChange={setActive4}
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
29
111
|
</div>
|
|
30
112
|
);
|
|
31
113
|
}
|