@designa8/vibedesign-openai-internal-v1-2-176b 0.0.7 → 0.1.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/README.md +1 -1
- package/dist/index.cjs +87 -67
- package/dist/index.js +87 -67
- package/dist/styles.css +34 -20
- package/package.json +1 -1
- package/src/atoms/CommentThread/CommentThread.tsx +2 -2
- package/src/atoms/Icon/icons.data.ts +1 -0
- package/src/atoms/Image/Image.tsx +1 -1
- package/src/atoms/NotificationFeed/NotificationFeed.tsx +26 -5
- package/src/atoms/NotificationFeed/preview.tsx +115 -11
- package/src/atoms/SearchResultsList/SearchResultsList.tsx +2 -1
- package/src/atoms/Tabs/Tabs.tsx +63 -48
- package/src/tokens.css +1 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @designa8/vibedesign-openai-internal-v1-2-176b
|
|
2
2
|
|
|
3
|
-
Complete design system generated by Atoms Design, version **0.0
|
|
3
|
+
Complete design system generated by Atoms Design, version **0.1.0**.
|
|
4
4
|
Tokens, atoms, molecules, organisms, and templates — import from the package root;
|
|
5
5
|
never hardcode visual values in consumer code.
|
|
6
6
|
|
package/dist/index.cjs
CHANGED
|
@@ -246,7 +246,8 @@ var ICON_REGISTRY = {
|
|
|
246
246
|
"eye-off": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49" }, { tag: "path", d: "M14.084 14.158a3 3 0 0 1-4.242-4.242" }, { tag: "path", d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" }, { tag: "path", d: "m2 2 20 20" }] },
|
|
247
247
|
"filter": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z" }] },
|
|
248
248
|
"lock": { viewBox: "0 0 24 24", nodes: [{ tag: "rect", width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }, { tag: "path", d: "M7 11V7a5 5 0 0 1 10 0v4" }] },
|
|
249
|
-
"external-link": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M15 3h6v6" }, { tag: "path", d: "M10 14 21 3" }, { tag: "path", d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }] }
|
|
249
|
+
"external-link": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M15 3h6v6" }, { tag: "path", d: "M10 14 21 3" }, { tag: "path", d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }] },
|
|
250
|
+
"at-sign": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "4" }, { tag: "path", d: "M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8" }] }
|
|
250
251
|
};
|
|
251
252
|
|
|
252
253
|
// virtual-pkg:src/atoms/Icon/Icon.tsx
|
|
@@ -2851,6 +2852,7 @@ var Tabs = React30.forwardRef(
|
|
|
2851
2852
|
onValueChange,
|
|
2852
2853
|
label = "Sections",
|
|
2853
2854
|
panelChrome = "card",
|
|
2855
|
+
actions,
|
|
2854
2856
|
className,
|
|
2855
2857
|
...props
|
|
2856
2858
|
}, ref) => {
|
|
@@ -2893,57 +2895,63 @@ var Tabs = React30.forwardRef(
|
|
|
2893
2895
|
}
|
|
2894
2896
|
};
|
|
2895
2897
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { ref, className: cn26("flex w-full flex-col gap-xs", className), ...props, children: [
|
|
2896
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.
|
|
2897
|
-
"div",
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
"aria-hidden": "true",
|
|
2909
|
-
className: "pointer-events-none absolute top-xxs bottom-xxs left-0 rounded-sm bg-canvas shadow-sm transition-[transform,width,opacity] duration-200 ease-out motion-reduce:transition-none dark:bg-surface-strong",
|
|
2910
|
-
style: {
|
|
2911
|
-
transform: `translateX(${pill?.x ?? 0}px)`,
|
|
2912
|
-
width: pill?.w ?? 0,
|
|
2913
|
-
opacity: pill ? 1 : 0
|
|
2914
|
-
}
|
|
2915
|
-
}
|
|
2916
|
-
),
|
|
2917
|
-
items.map((item) => {
|
|
2918
|
-
const isSel = item.value === selected;
|
|
2919
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2920
|
-
Tab,
|
|
2898
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex w-full flex-wrap items-center justify-between gap-x-sm gap-y-xs", children: [
|
|
2899
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "min-w-0 max-w-full shrink basis-auto overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
2900
|
+
"div",
|
|
2901
|
+
{
|
|
2902
|
+
ref: listRef,
|
|
2903
|
+
role: "tablist",
|
|
2904
|
+
"aria-label": label,
|
|
2905
|
+
onKeyDown,
|
|
2906
|
+
className: "relative inline-flex items-center gap-xxs rounded-md bg-surface-soft p-xxs",
|
|
2907
|
+
children: [
|
|
2908
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2909
|
+
"span",
|
|
2921
2910
|
{
|
|
2922
|
-
|
|
2923
|
-
|
|
2911
|
+
"aria-hidden": "true",
|
|
2912
|
+
className: "pointer-events-none absolute top-xxs bottom-xxs left-0 rounded-sm bg-canvas shadow-sm transition-[transform,width,opacity] duration-200 ease-out motion-reduce:transition-none dark:bg-surface-strong",
|
|
2913
|
+
style: {
|
|
2914
|
+
transform: `translateX(${pill?.x ?? 0}px)`,
|
|
2915
|
+
width: pill?.w ?? 0,
|
|
2916
|
+
opacity: pill ? 1 : 0
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
),
|
|
2920
|
+
items.map((item) => {
|
|
2921
|
+
const isSel = item.value === selected;
|
|
2922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2923
|
+
Tab,
|
|
2924
|
+
{
|
|
2925
|
+
ref: (el) => {
|
|
2926
|
+
tabRefs.current[item.value] = el;
|
|
2927
|
+
},
|
|
2928
|
+
id: `${baseId}-tab-${item.value}`,
|
|
2929
|
+
controls: `${baseId}-panel-${item.value}`,
|
|
2930
|
+
selected: isSel,
|
|
2931
|
+
role: "tab",
|
|
2932
|
+
"aria-selected": isSel,
|
|
2933
|
+
"aria-controls": `${baseId}-panel-${item.value}`,
|
|
2934
|
+
hideIndicator: true,
|
|
2935
|
+
size: "sm",
|
|
2936
|
+
disabled: item.disabled,
|
|
2937
|
+
onClick: () => select(item.value),
|
|
2938
|
+
className: cn26(
|
|
2939
|
+
"z-10 cursor-pointer transition duration-150 ease-out hover:bg-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50",
|
|
2940
|
+
isSel && "font-weight-heading-sm"
|
|
2941
|
+
),
|
|
2942
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "inline-flex items-center gap-xs", children: [
|
|
2943
|
+
item.label,
|
|
2944
|
+
item.count != null ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Badge, { tone: "neutral", variant: "soft", size: "sm", className: "rounded-full", children: item.count }) : null
|
|
2945
|
+
] })
|
|
2924
2946
|
},
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
disabled: item.disabled,
|
|
2934
|
-
onClick: () => select(item.value),
|
|
2935
|
-
className: cn26("z-10 cursor-pointer transition duration-150 ease-out hover:bg-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50", isSel && "font-weight-heading-sm"),
|
|
2936
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "inline-flex items-center gap-xs", children: [
|
|
2937
|
-
item.label,
|
|
2938
|
-
item.count != null ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Badge, { tone: "neutral", variant: "soft", size: "sm", className: "rounded-full", children: item.count }) : null
|
|
2939
|
-
] })
|
|
2940
|
-
},
|
|
2941
|
-
item.value
|
|
2942
|
-
);
|
|
2943
|
-
})
|
|
2944
|
-
]
|
|
2945
|
-
}
|
|
2946
|
-
) }),
|
|
2947
|
+
item.value
|
|
2948
|
+
);
|
|
2949
|
+
})
|
|
2950
|
+
]
|
|
2951
|
+
}
|
|
2952
|
+
) }),
|
|
2953
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "ml-auto shrink-0", children: actions }) : null
|
|
2954
|
+
] }),
|
|
2947
2955
|
items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2948
2956
|
"div",
|
|
2949
2957
|
{
|
|
@@ -7037,6 +7045,7 @@ var toneTile = {
|
|
|
7037
7045
|
error: "bg-semantic-error-soft text-semantic-error",
|
|
7038
7046
|
neutral: "bg-surface-soft text-ink"
|
|
7039
7047
|
};
|
|
7048
|
+
var MARK_ALL_LABEL = "Mark all as read";
|
|
7040
7049
|
var NotificationFeed = React62.forwardRef(
|
|
7041
7050
|
({
|
|
7042
7051
|
notifications,
|
|
@@ -7048,6 +7057,7 @@ var NotificationFeed = React62.forwardRef(
|
|
|
7048
7057
|
onMarkAllRead,
|
|
7049
7058
|
emptyTitle = "No notifications yet",
|
|
7050
7059
|
emptyDescription = "We'll let you know when there's something new.",
|
|
7060
|
+
compact = false,
|
|
7051
7061
|
className,
|
|
7052
7062
|
...props
|
|
7053
7063
|
}, ref) => {
|
|
@@ -7119,30 +7129,40 @@ var NotificationFeed = React62.forwardRef(
|
|
|
7119
7129
|
{ value: "mentions", label: "Mentions" },
|
|
7120
7130
|
{ value: "system", label: "System" }
|
|
7121
7131
|
];
|
|
7122
|
-
|
|
7132
|
+
const markAll = compact ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
7133
|
+
Button,
|
|
7134
|
+
{
|
|
7135
|
+
variant: "ghost",
|
|
7136
|
+
size: "sm",
|
|
7137
|
+
iconOnly: true,
|
|
7138
|
+
"aria-label": MARK_ALL_LABEL,
|
|
7139
|
+
onClick: onMarkAllRead,
|
|
7140
|
+
disabled: unread === 0,
|
|
7141
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Icon, { name: "check", size: 16 })
|
|
7142
|
+
}
|
|
7143
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Button, { variant: "ghost", size: "sm", onClick: onMarkAllRead, disabled: unread === 0, children: "Mark all read" });
|
|
7144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
7123
7145
|
"section",
|
|
7124
7146
|
{
|
|
7125
7147
|
ref,
|
|
7126
7148
|
"aria-label": "Notifications",
|
|
7127
7149
|
className: cn55("relative flex w-full flex-col text-ink", className),
|
|
7128
7150
|
...props,
|
|
7129
|
-
children:
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
onFilterChange?.(f);
|
|
7142
|
-
}
|
|
7151
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
7152
|
+
Tabs,
|
|
7153
|
+
{
|
|
7154
|
+
label: "Notification filters",
|
|
7155
|
+
panelChrome: "none",
|
|
7156
|
+
actions: markAll,
|
|
7157
|
+
items: tabs.map((t) => ({ ...t, content: t.value === current ? list : null })),
|
|
7158
|
+
value: current,
|
|
7159
|
+
onValueChange: (v) => {
|
|
7160
|
+
const f = v;
|
|
7161
|
+
if (filter === void 0) setInnerFilter(f);
|
|
7162
|
+
onFilterChange?.(f);
|
|
7143
7163
|
}
|
|
7144
|
-
|
|
7145
|
-
|
|
7164
|
+
}
|
|
7165
|
+
)
|
|
7146
7166
|
}
|
|
7147
7167
|
);
|
|
7148
7168
|
}
|
package/dist/index.js
CHANGED
|
@@ -121,7 +121,8 @@ var ICON_REGISTRY = {
|
|
|
121
121
|
"eye-off": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49" }, { tag: "path", d: "M14.084 14.158a3 3 0 0 1-4.242-4.242" }, { tag: "path", d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" }, { tag: "path", d: "m2 2 20 20" }] },
|
|
122
122
|
"filter": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z" }] },
|
|
123
123
|
"lock": { viewBox: "0 0 24 24", nodes: [{ tag: "rect", width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }, { tag: "path", d: "M7 11V7a5 5 0 0 1 10 0v4" }] },
|
|
124
|
-
"external-link": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M15 3h6v6" }, { tag: "path", d: "M10 14 21 3" }, { tag: "path", d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }] }
|
|
124
|
+
"external-link": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M15 3h6v6" }, { tag: "path", d: "M10 14 21 3" }, { tag: "path", d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }] },
|
|
125
|
+
"at-sign": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "4" }, { tag: "path", d: "M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8" }] }
|
|
125
126
|
};
|
|
126
127
|
|
|
127
128
|
// virtual-pkg:src/atoms/Icon/Icon.tsx
|
|
@@ -2726,6 +2727,7 @@ var Tabs = React30.forwardRef(
|
|
|
2726
2727
|
onValueChange,
|
|
2727
2728
|
label = "Sections",
|
|
2728
2729
|
panelChrome = "card",
|
|
2730
|
+
actions,
|
|
2729
2731
|
className,
|
|
2730
2732
|
...props
|
|
2731
2733
|
}, ref) => {
|
|
@@ -2768,57 +2770,63 @@ var Tabs = React30.forwardRef(
|
|
|
2768
2770
|
}
|
|
2769
2771
|
};
|
|
2770
2772
|
return /* @__PURE__ */ jsxs27("div", { ref, className: cn26("flex w-full flex-col gap-xs", className), ...props, children: [
|
|
2771
|
-
/* @__PURE__ */
|
|
2772
|
-
"div",
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
"aria-hidden": "true",
|
|
2784
|
-
className: "pointer-events-none absolute top-xxs bottom-xxs left-0 rounded-sm bg-canvas shadow-sm transition-[transform,width,opacity] duration-200 ease-out motion-reduce:transition-none dark:bg-surface-strong",
|
|
2785
|
-
style: {
|
|
2786
|
-
transform: `translateX(${pill?.x ?? 0}px)`,
|
|
2787
|
-
width: pill?.w ?? 0,
|
|
2788
|
-
opacity: pill ? 1 : 0
|
|
2789
|
-
}
|
|
2790
|
-
}
|
|
2791
|
-
),
|
|
2792
|
-
items.map((item) => {
|
|
2793
|
-
const isSel = item.value === selected;
|
|
2794
|
-
return /* @__PURE__ */ jsx30(
|
|
2795
|
-
Tab,
|
|
2773
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex w-full flex-wrap items-center justify-between gap-x-sm gap-y-xs", children: [
|
|
2774
|
+
/* @__PURE__ */ jsx30("div", { className: "min-w-0 max-w-full shrink basis-auto overflow-x-auto", children: /* @__PURE__ */ jsxs27(
|
|
2775
|
+
"div",
|
|
2776
|
+
{
|
|
2777
|
+
ref: listRef,
|
|
2778
|
+
role: "tablist",
|
|
2779
|
+
"aria-label": label,
|
|
2780
|
+
onKeyDown,
|
|
2781
|
+
className: "relative inline-flex items-center gap-xxs rounded-md bg-surface-soft p-xxs",
|
|
2782
|
+
children: [
|
|
2783
|
+
/* @__PURE__ */ jsx30(
|
|
2784
|
+
"span",
|
|
2796
2785
|
{
|
|
2797
|
-
|
|
2798
|
-
|
|
2786
|
+
"aria-hidden": "true",
|
|
2787
|
+
className: "pointer-events-none absolute top-xxs bottom-xxs left-0 rounded-sm bg-canvas shadow-sm transition-[transform,width,opacity] duration-200 ease-out motion-reduce:transition-none dark:bg-surface-strong",
|
|
2788
|
+
style: {
|
|
2789
|
+
transform: `translateX(${pill?.x ?? 0}px)`,
|
|
2790
|
+
width: pill?.w ?? 0,
|
|
2791
|
+
opacity: pill ? 1 : 0
|
|
2792
|
+
}
|
|
2793
|
+
}
|
|
2794
|
+
),
|
|
2795
|
+
items.map((item) => {
|
|
2796
|
+
const isSel = item.value === selected;
|
|
2797
|
+
return /* @__PURE__ */ jsx30(
|
|
2798
|
+
Tab,
|
|
2799
|
+
{
|
|
2800
|
+
ref: (el) => {
|
|
2801
|
+
tabRefs.current[item.value] = el;
|
|
2802
|
+
},
|
|
2803
|
+
id: `${baseId}-tab-${item.value}`,
|
|
2804
|
+
controls: `${baseId}-panel-${item.value}`,
|
|
2805
|
+
selected: isSel,
|
|
2806
|
+
role: "tab",
|
|
2807
|
+
"aria-selected": isSel,
|
|
2808
|
+
"aria-controls": `${baseId}-panel-${item.value}`,
|
|
2809
|
+
hideIndicator: true,
|
|
2810
|
+
size: "sm",
|
|
2811
|
+
disabled: item.disabled,
|
|
2812
|
+
onClick: () => select(item.value),
|
|
2813
|
+
className: cn26(
|
|
2814
|
+
"z-10 cursor-pointer transition duration-150 ease-out hover:bg-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50",
|
|
2815
|
+
isSel && "font-weight-heading-sm"
|
|
2816
|
+
),
|
|
2817
|
+
children: /* @__PURE__ */ jsxs27("span", { className: "inline-flex items-center gap-xs", children: [
|
|
2818
|
+
item.label,
|
|
2819
|
+
item.count != null ? /* @__PURE__ */ jsx30(Badge, { tone: "neutral", variant: "soft", size: "sm", className: "rounded-full", children: item.count }) : null
|
|
2820
|
+
] })
|
|
2799
2821
|
},
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
disabled: item.disabled,
|
|
2809
|
-
onClick: () => select(item.value),
|
|
2810
|
-
className: cn26("z-10 cursor-pointer transition duration-150 ease-out hover:bg-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50", isSel && "font-weight-heading-sm"),
|
|
2811
|
-
children: /* @__PURE__ */ jsxs27("span", { className: "inline-flex items-center gap-xs", children: [
|
|
2812
|
-
item.label,
|
|
2813
|
-
item.count != null ? /* @__PURE__ */ jsx30(Badge, { tone: "neutral", variant: "soft", size: "sm", className: "rounded-full", children: item.count }) : null
|
|
2814
|
-
] })
|
|
2815
|
-
},
|
|
2816
|
-
item.value
|
|
2817
|
-
);
|
|
2818
|
-
})
|
|
2819
|
-
]
|
|
2820
|
-
}
|
|
2821
|
-
) }),
|
|
2822
|
+
item.value
|
|
2823
|
+
);
|
|
2824
|
+
})
|
|
2825
|
+
]
|
|
2826
|
+
}
|
|
2827
|
+
) }),
|
|
2828
|
+
actions ? /* @__PURE__ */ jsx30("div", { className: "ml-auto shrink-0", children: actions }) : null
|
|
2829
|
+
] }),
|
|
2822
2830
|
items.map((item) => /* @__PURE__ */ jsx30(
|
|
2823
2831
|
"div",
|
|
2824
2832
|
{
|
|
@@ -6912,6 +6920,7 @@ var toneTile = {
|
|
|
6912
6920
|
error: "bg-semantic-error-soft text-semantic-error",
|
|
6913
6921
|
neutral: "bg-surface-soft text-ink"
|
|
6914
6922
|
};
|
|
6923
|
+
var MARK_ALL_LABEL = "Mark all as read";
|
|
6915
6924
|
var NotificationFeed = React62.forwardRef(
|
|
6916
6925
|
({
|
|
6917
6926
|
notifications,
|
|
@@ -6923,6 +6932,7 @@ var NotificationFeed = React62.forwardRef(
|
|
|
6923
6932
|
onMarkAllRead,
|
|
6924
6933
|
emptyTitle = "No notifications yet",
|
|
6925
6934
|
emptyDescription = "We'll let you know when there's something new.",
|
|
6935
|
+
compact = false,
|
|
6926
6936
|
className,
|
|
6927
6937
|
...props
|
|
6928
6938
|
}, ref) => {
|
|
@@ -6994,30 +7004,40 @@ var NotificationFeed = React62.forwardRef(
|
|
|
6994
7004
|
{ value: "mentions", label: "Mentions" },
|
|
6995
7005
|
{ value: "system", label: "System" }
|
|
6996
7006
|
];
|
|
6997
|
-
|
|
7007
|
+
const markAll = compact ? /* @__PURE__ */ jsx62(
|
|
7008
|
+
Button,
|
|
7009
|
+
{
|
|
7010
|
+
variant: "ghost",
|
|
7011
|
+
size: "sm",
|
|
7012
|
+
iconOnly: true,
|
|
7013
|
+
"aria-label": MARK_ALL_LABEL,
|
|
7014
|
+
onClick: onMarkAllRead,
|
|
7015
|
+
disabled: unread === 0,
|
|
7016
|
+
children: /* @__PURE__ */ jsx62(Icon, { name: "check", size: 16 })
|
|
7017
|
+
}
|
|
7018
|
+
) : /* @__PURE__ */ jsx62(Button, { variant: "ghost", size: "sm", onClick: onMarkAllRead, disabled: unread === 0, children: "Mark all read" });
|
|
7019
|
+
return /* @__PURE__ */ jsx62(
|
|
6998
7020
|
"section",
|
|
6999
7021
|
{
|
|
7000
7022
|
ref,
|
|
7001
7023
|
"aria-label": "Notifications",
|
|
7002
7024
|
className: cn55("relative flex w-full flex-col text-ink", className),
|
|
7003
7025
|
...props,
|
|
7004
|
-
children:
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
onFilterChange?.(f);
|
|
7017
|
-
}
|
|
7026
|
+
children: /* @__PURE__ */ jsx62(
|
|
7027
|
+
Tabs,
|
|
7028
|
+
{
|
|
7029
|
+
label: "Notification filters",
|
|
7030
|
+
panelChrome: "none",
|
|
7031
|
+
actions: markAll,
|
|
7032
|
+
items: tabs.map((t) => ({ ...t, content: t.value === current ? list : null })),
|
|
7033
|
+
value: current,
|
|
7034
|
+
onValueChange: (v) => {
|
|
7035
|
+
const f = v;
|
|
7036
|
+
if (filter === void 0) setInnerFilter(f);
|
|
7037
|
+
onFilterChange?.(f);
|
|
7018
7038
|
}
|
|
7019
|
-
|
|
7020
|
-
|
|
7039
|
+
}
|
|
7040
|
+
)
|
|
7021
7041
|
}
|
|
7022
7042
|
);
|
|
7023
7043
|
}
|
package/dist/styles.css
CHANGED
|
@@ -128,6 +128,7 @@
|
|
|
128
128
|
--spacing-xl: 32px;
|
|
129
129
|
--spacing-xxl: 48px;
|
|
130
130
|
--spacing-gutter: 16px;
|
|
131
|
+
--container-drawer: 440px;
|
|
131
132
|
--grid-template-columns-system: repeat(12, minmax(0, 1fr));
|
|
132
133
|
}
|
|
133
134
|
}
|
|
@@ -407,6 +408,24 @@
|
|
|
407
408
|
.col-span-12 {
|
|
408
409
|
grid-column: span 12 / span 12;
|
|
409
410
|
}
|
|
411
|
+
.container {
|
|
412
|
+
width: 100%;
|
|
413
|
+
@media (width >= 640px) {
|
|
414
|
+
max-width: 640px;
|
|
415
|
+
}
|
|
416
|
+
@media (width >= 768px) {
|
|
417
|
+
max-width: 768px;
|
|
418
|
+
}
|
|
419
|
+
@media (width >= 1024px) {
|
|
420
|
+
max-width: 1024px;
|
|
421
|
+
}
|
|
422
|
+
@media (width >= 1280px) {
|
|
423
|
+
max-width: 1280px;
|
|
424
|
+
}
|
|
425
|
+
@media (width >= 1536px) {
|
|
426
|
+
max-width: 1536px;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
410
429
|
.m-0 {
|
|
411
430
|
margin: 0;
|
|
412
431
|
}
|
|
@@ -771,6 +790,9 @@
|
|
|
771
790
|
.max-w-5xl {
|
|
772
791
|
max-width: var(--container-5xl);
|
|
773
792
|
}
|
|
793
|
+
.max-w-drawer {
|
|
794
|
+
max-width: var(--container-drawer);
|
|
795
|
+
}
|
|
774
796
|
.max-w-full {
|
|
775
797
|
max-width: 100%;
|
|
776
798
|
}
|
|
@@ -813,9 +835,15 @@
|
|
|
813
835
|
.flex-1 {
|
|
814
836
|
flex: 1;
|
|
815
837
|
}
|
|
838
|
+
.shrink {
|
|
839
|
+
flex-shrink: 1;
|
|
840
|
+
}
|
|
816
841
|
.shrink-0 {
|
|
817
842
|
flex-shrink: 0;
|
|
818
843
|
}
|
|
844
|
+
.basis-auto {
|
|
845
|
+
flex-basis: auto;
|
|
846
|
+
}
|
|
819
847
|
.border-collapse {
|
|
820
848
|
border-collapse: collapse;
|
|
821
849
|
}
|
|
@@ -1049,6 +1077,9 @@
|
|
|
1049
1077
|
.gap-x-lg {
|
|
1050
1078
|
column-gap: var(--spacing-lg);
|
|
1051
1079
|
}
|
|
1080
|
+
.gap-x-sm {
|
|
1081
|
+
column-gap: var(--spacing-sm);
|
|
1082
|
+
}
|
|
1052
1083
|
.gap-x-xl {
|
|
1053
1084
|
column-gap: var(--spacing-xl);
|
|
1054
1085
|
}
|
|
@@ -1061,6 +1092,9 @@
|
|
|
1061
1092
|
.gap-y-xl {
|
|
1062
1093
|
row-gap: var(--spacing-xl);
|
|
1063
1094
|
}
|
|
1095
|
+
.gap-y-xs {
|
|
1096
|
+
row-gap: var(--spacing-xs);
|
|
1097
|
+
}
|
|
1064
1098
|
.gap-y-xxl {
|
|
1065
1099
|
row-gap: var(--spacing-xxl);
|
|
1066
1100
|
}
|
|
@@ -2416,26 +2450,6 @@
|
|
|
2416
2450
|
transition-property: none;
|
|
2417
2451
|
}
|
|
2418
2452
|
}
|
|
2419
|
-
.sm\:absolute {
|
|
2420
|
-
@media (width >= 640px) {
|
|
2421
|
-
position: absolute;
|
|
2422
|
-
}
|
|
2423
|
-
}
|
|
2424
|
-
.sm\:top-0 {
|
|
2425
|
-
@media (width >= 640px) {
|
|
2426
|
-
top: 0;
|
|
2427
|
-
}
|
|
2428
|
-
}
|
|
2429
|
-
.sm\:right-0 {
|
|
2430
|
-
@media (width >= 640px) {
|
|
2431
|
-
right: 0;
|
|
2432
|
-
}
|
|
2433
|
-
}
|
|
2434
|
-
.sm\:mb-0 {
|
|
2435
|
-
@media (width >= 640px) {
|
|
2436
|
-
margin-bottom: 0;
|
|
2437
|
-
}
|
|
2438
|
-
}
|
|
2439
2453
|
.sm\:flex {
|
|
2440
2454
|
@media (width >= 640px) {
|
|
2441
2455
|
display: flex;
|
package/package.json
CHANGED
|
@@ -2,7 +2,6 @@ import * as React from "react";
|
|
|
2
2
|
import { Avatar } from "../Avatar";
|
|
3
3
|
import { Button } from "../Button";
|
|
4
4
|
import { IconButton } from "../IconButton";
|
|
5
|
-
import { Icon } from "../Icon";
|
|
6
5
|
import { Textarea } from "../Textarea";
|
|
7
6
|
|
|
8
7
|
export type CommentReaction = "up" | "down" | null;
|
|
@@ -17,7 +16,8 @@ export interface CommentData {
|
|
|
17
16
|
replies?: CommentData[];
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
export interface CommentThreadProps
|
|
19
|
+
export interface CommentThreadProps
|
|
20
|
+
extends Omit<React.HTMLAttributes<HTMLElement>, "onSubmit"> {
|
|
21
21
|
comments: CommentData[];
|
|
22
22
|
/** Called when a reaction is toggled. */
|
|
23
23
|
onReact?: (id: string, reaction: CommentReaction) => void;
|
|
@@ -106,6 +106,7 @@ export const ICON_REGISTRY = {
|
|
|
106
106
|
"filter": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z" }] },
|
|
107
107
|
"lock": { viewBox: "0 0 24 24", nodes: [{ tag: "rect", width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }, { tag: "path", d: "M7 11V7a5 5 0 0 1 10 0v4" }] },
|
|
108
108
|
"external-link": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M15 3h6v6" }, { tag: "path", d: "M10 14 21 3" }, { tag: "path", d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }] },
|
|
109
|
+
"at-sign": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "4" }, { tag: "path", d: "M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8" }] },
|
|
109
110
|
} as const;
|
|
110
111
|
|
|
111
112
|
export type IconName = keyof typeof ICON_REGISTRY;
|
|
@@ -6,7 +6,7 @@ export type ImageRatio = "landscape" | "wide" | "square" | "portrait" | "auto";
|
|
|
6
6
|
export type ImageRadius = "none" | "sm" | "md" | "lg";
|
|
7
7
|
|
|
8
8
|
export interface ImageProps
|
|
9
|
-
extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, "alt"> {
|
|
9
|
+
extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, "alt" | "loading"> {
|
|
10
10
|
/** Required. Use "" for a purely decorative image. */
|
|
11
11
|
alt: string;
|
|
12
12
|
/** Frame aspect ratio. `auto` keeps the image's own ratio. */
|
|
@@ -31,6 +31,11 @@ export interface NotificationFeedProps extends Omit<React.HTMLAttributes<HTMLEle
|
|
|
31
31
|
onMarkAllRead?: () => void;
|
|
32
32
|
emptyTitle?: string;
|
|
33
33
|
emptyDescription?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Renders the mark-all-read action as an icon-only control. Use it when the feed sits in a
|
|
36
|
+
* narrow container such as a 440px drawer and the header row has no room for the label.
|
|
37
|
+
*/
|
|
38
|
+
compact?: boolean;
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
const cn = (...parts: Array<string | false | null | undefined>) =>
|
|
@@ -44,6 +49,8 @@ const toneTile: Record<NotificationTone, string> = {
|
|
|
44
49
|
neutral: "bg-surface-soft text-ink",
|
|
45
50
|
};
|
|
46
51
|
|
|
52
|
+
const MARK_ALL_LABEL = "Mark all as read";
|
|
53
|
+
|
|
47
54
|
export const NotificationFeed = React.forwardRef<HTMLElement, NotificationFeedProps>(
|
|
48
55
|
(
|
|
49
56
|
{
|
|
@@ -56,6 +63,7 @@ export const NotificationFeed = React.forwardRef<HTMLElement, NotificationFeedPr
|
|
|
56
63
|
onMarkAllRead,
|
|
57
64
|
emptyTitle = "No notifications yet",
|
|
58
65
|
emptyDescription = "We'll let you know when there's something new.",
|
|
66
|
+
compact = false,
|
|
59
67
|
className,
|
|
60
68
|
...props
|
|
61
69
|
},
|
|
@@ -141,6 +149,23 @@ export const NotificationFeed = React.forwardRef<HTMLElement, NotificationFeedPr
|
|
|
141
149
|
{ value: "system", label: "System" },
|
|
142
150
|
];
|
|
143
151
|
|
|
152
|
+
const markAll = compact ? (
|
|
153
|
+
<Button
|
|
154
|
+
variant="ghost"
|
|
155
|
+
size="sm"
|
|
156
|
+
iconOnly
|
|
157
|
+
aria-label={MARK_ALL_LABEL}
|
|
158
|
+
onClick={onMarkAllRead}
|
|
159
|
+
disabled={unread === 0}
|
|
160
|
+
>
|
|
161
|
+
<Icon name="check" size={16} />
|
|
162
|
+
</Button>
|
|
163
|
+
) : (
|
|
164
|
+
<Button variant="ghost" size="sm" onClick={onMarkAllRead} disabled={unread === 0}>
|
|
165
|
+
Mark all read
|
|
166
|
+
</Button>
|
|
167
|
+
);
|
|
168
|
+
|
|
144
169
|
return (
|
|
145
170
|
<section
|
|
146
171
|
ref={ref}
|
|
@@ -148,14 +173,10 @@ export const NotificationFeed = React.forwardRef<HTMLElement, NotificationFeedPr
|
|
|
148
173
|
className={cn("relative flex w-full flex-col text-ink", className)}
|
|
149
174
|
{...props}
|
|
150
175
|
>
|
|
151
|
-
<div className="mb-sm flex justify-end sm:absolute sm:right-0 sm:top-0 sm:mb-0">
|
|
152
|
-
<Button variant="outline" size="md" onClick={onMarkAllRead} disabled={unread === 0}>
|
|
153
|
-
Mark all as read
|
|
154
|
-
</Button>
|
|
155
|
-
</div>
|
|
156
176
|
<Tabs
|
|
157
177
|
label="Notification filters"
|
|
158
178
|
panelChrome="none"
|
|
179
|
+
actions={markAll}
|
|
159
180
|
items={tabs.map((t) => ({ ...t, content: t.value === current ? list : null }))}
|
|
160
181
|
value={current}
|
|
161
182
|
onValueChange={(v) => {
|
|
@@ -1,21 +1,125 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { NotificationFeed, type NotificationEntry } from "./NotificationFeed";
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
{
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const fixtures: NotificationEntry[] = [
|
|
5
|
+
{
|
|
6
|
+
id: "n1",
|
|
7
|
+
title: "Priya mentioned you in Launch brief",
|
|
8
|
+
body: "Can you take a look at the pricing section before Thursday?",
|
|
9
|
+
time: "2m",
|
|
10
|
+
icon: "at-sign",
|
|
11
|
+
tone: "accent",
|
|
12
|
+
category: "mention",
|
|
13
|
+
read: false,
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: "n2",
|
|
17
|
+
title: "Payment succeeded",
|
|
18
|
+
body: "Invoice #3021 for Northwind Studio was paid.",
|
|
19
|
+
time: "18m",
|
|
20
|
+
icon: "circle-check",
|
|
21
|
+
tone: "success",
|
|
22
|
+
category: "system",
|
|
23
|
+
read: false,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "n3",
|
|
27
|
+
title: "Your export is ready",
|
|
28
|
+
body: "The quarterly report finished building.",
|
|
29
|
+
time: "1h",
|
|
30
|
+
icon: "check",
|
|
31
|
+
tone: "success",
|
|
32
|
+
category: "system",
|
|
33
|
+
read: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "n4",
|
|
37
|
+
title: "Storage almost full",
|
|
38
|
+
body: "You've used 92% of your workspace storage.",
|
|
39
|
+
time: "3h",
|
|
40
|
+
icon: "settings",
|
|
41
|
+
tone: "warning",
|
|
42
|
+
category: "system",
|
|
43
|
+
read: true,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "n5",
|
|
47
|
+
title: "Marco mentioned you in Design review",
|
|
48
|
+
body: "Left three comments on the drawer layout.",
|
|
49
|
+
time: "Yesterday",
|
|
50
|
+
icon: "at-sign",
|
|
51
|
+
tone: "accent",
|
|
52
|
+
category: "mention",
|
|
53
|
+
read: true,
|
|
54
|
+
},
|
|
8
55
|
];
|
|
9
56
|
|
|
57
|
+
type Filter = "all" | "unread" | "mentions" | "system";
|
|
58
|
+
|
|
10
59
|
export default function NotificationFeedPreview() {
|
|
11
|
-
const [
|
|
60
|
+
const [drawerItems, setDrawerItems] = React.useState(fixtures);
|
|
61
|
+
const [compactItems, setCompactItems] = React.useState(fixtures);
|
|
62
|
+
const [filter, setFilter] = React.useState<Filter>("all");
|
|
63
|
+
|
|
64
|
+
const markRead = (
|
|
65
|
+
setter: React.Dispatch<React.SetStateAction<NotificationEntry[]>>,
|
|
66
|
+
id: string,
|
|
67
|
+
) => {
|
|
68
|
+
setter((prev) => prev.map((n) => (n.id === id ? { ...n, read: true } : n)));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const markAll = (setter: React.Dispatch<React.SetStateAction<NotificationEntry[]>>) => {
|
|
72
|
+
setter((prev) => prev.map((n) => ({ ...n, read: true })));
|
|
73
|
+
};
|
|
74
|
+
|
|
12
75
|
return (
|
|
13
|
-
<div className="w-full max-w-3xl
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
76
|
+
<div className="mx-auto w-full max-w-3xl space-y-lg p-lg">
|
|
77
|
+
<section className="space-y-sm">
|
|
78
|
+
<h2 className="text-body-md font-weight-heading-sm text-ink">
|
|
79
|
+
In a 440px drawer — labelled action wraps under the tabs
|
|
80
|
+
</h2>
|
|
81
|
+
<div className="w-full max-w-drawer rounded-lg border border-hairline bg-surface p-md">
|
|
82
|
+
<NotificationFeed
|
|
83
|
+
notifications={drawerItems}
|
|
84
|
+
filter={filter}
|
|
85
|
+
onFilterChange={(f) => setFilter(f)}
|
|
86
|
+
onMarkRead={(id) => markRead(setDrawerItems, id)}
|
|
87
|
+
onMarkAllRead={() => markAll(setDrawerItems)}
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
</section>
|
|
91
|
+
|
|
92
|
+
<section className="space-y-sm">
|
|
93
|
+
<h2 className="text-body-md font-weight-heading-sm text-ink">
|
|
94
|
+
440px drawer — compact icon-only action
|
|
95
|
+
</h2>
|
|
96
|
+
<div className="w-full max-w-drawer rounded-lg border border-hairline bg-surface p-md">
|
|
97
|
+
<NotificationFeed
|
|
98
|
+
compact
|
|
99
|
+
notifications={compactItems}
|
|
100
|
+
onMarkRead={(id) => markRead(setCompactItems, id)}
|
|
101
|
+
onMarkAllRead={() => markAll(setCompactItems)}
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
</section>
|
|
105
|
+
|
|
106
|
+
<section className="space-y-sm">
|
|
107
|
+
<h2 className="text-body-md font-weight-heading-sm text-ink">Wide container</h2>
|
|
108
|
+
<div className="w-full rounded-lg border border-hairline bg-surface p-md">
|
|
109
|
+
<NotificationFeed
|
|
110
|
+
notifications={fixtures}
|
|
111
|
+
onMarkRead={() => {}}
|
|
112
|
+
onMarkAllRead={() => {}}
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
</section>
|
|
116
|
+
|
|
117
|
+
<section className="space-y-sm">
|
|
118
|
+
<h2 className="text-body-md font-weight-heading-sm text-ink">Empty state</h2>
|
|
119
|
+
<div className="w-full max-w-drawer rounded-lg border border-hairline bg-surface p-md">
|
|
120
|
+
<NotificationFeed notifications={[]} defaultFilter="unread" onMarkAllRead={() => {}} />
|
|
121
|
+
</div>
|
|
122
|
+
</section>
|
|
19
123
|
</div>
|
|
20
124
|
);
|
|
21
125
|
}
|
|
@@ -14,7 +14,8 @@ export interface SearchResult {
|
|
|
14
14
|
icon?: IconName;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export interface SearchResultsListProps
|
|
17
|
+
export interface SearchResultsListProps
|
|
18
|
+
extends Omit<React.HTMLAttributes<HTMLElement>, "onSelect" | "results"> {
|
|
18
19
|
query?: string;
|
|
19
20
|
defaultQuery?: string;
|
|
20
21
|
onQueryChange?: (query: string) => void;
|
package/src/atoms/Tabs/Tabs.tsx
CHANGED
|
@@ -21,6 +21,12 @@ export interface TabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "o
|
|
|
21
21
|
label?: string;
|
|
22
22
|
/** Wrap panels in a bordered surface (default) or render them bare. */
|
|
23
23
|
panelChrome?: "card" | "none";
|
|
24
|
+
/**
|
|
25
|
+
* Optional trailing action rendered in the same row as the tab list, right aligned.
|
|
26
|
+
* The row wraps, so the action drops onto its own line in a narrow container instead of
|
|
27
|
+
* covering the last tab. The list scrolls horizontally when it runs out of room.
|
|
28
|
+
*/
|
|
29
|
+
actions?: React.ReactNode;
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
const cn = (...parts: Array<string | false | null | undefined>) =>
|
|
@@ -35,6 +41,7 @@ export const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(
|
|
|
35
41
|
onValueChange,
|
|
36
42
|
label = "Sections",
|
|
37
43
|
panelChrome = "card",
|
|
44
|
+
actions,
|
|
38
45
|
className,
|
|
39
46
|
...props
|
|
40
47
|
},
|
|
@@ -86,55 +93,63 @@ export const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(
|
|
|
86
93
|
|
|
87
94
|
return (
|
|
88
95
|
<div ref={ref} className={cn("flex w-full flex-col gap-xs", className)} {...props}>
|
|
89
|
-
<div className="
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
96
|
+
<div className="flex w-full flex-wrap items-center justify-between gap-x-sm gap-y-xs">
|
|
97
|
+
{/* Basis auto (never flex-1) so the strip keeps its intrinsic width and the trailing
|
|
98
|
+
action wraps to the next line instead of shrinking the tabs under it. */}
|
|
99
|
+
<div className="min-w-0 max-w-full shrink basis-auto overflow-x-auto">
|
|
100
|
+
<div
|
|
101
|
+
ref={listRef}
|
|
102
|
+
role="tablist"
|
|
103
|
+
aria-label={label}
|
|
104
|
+
onKeyDown={onKeyDown}
|
|
105
|
+
className="relative inline-flex items-center gap-xxs rounded-md bg-surface-soft p-xxs"
|
|
106
|
+
>
|
|
107
|
+
<span
|
|
108
|
+
aria-hidden="true"
|
|
109
|
+
className="pointer-events-none absolute top-xxs bottom-xxs left-0 rounded-sm bg-canvas shadow-sm transition-[transform,width,opacity] duration-200 ease-out motion-reduce:transition-none dark:bg-surface-strong"
|
|
110
|
+
style={{
|
|
111
|
+
transform: `translateX(${pill?.x ?? 0}px)`,
|
|
112
|
+
width: pill?.w ?? 0,
|
|
113
|
+
opacity: pill ? 1 : 0,
|
|
114
|
+
}}
|
|
115
|
+
/>
|
|
116
|
+
{items.map((item) => {
|
|
117
|
+
const isSel = item.value === selected;
|
|
118
|
+
return (
|
|
119
|
+
<Tab
|
|
120
|
+
key={item.value}
|
|
121
|
+
ref={(el) => {
|
|
122
|
+
tabRefs.current[item.value] = el;
|
|
123
|
+
}}
|
|
124
|
+
id={`${baseId}-tab-${item.value}`}
|
|
125
|
+
controls={`${baseId}-panel-${item.value}`}
|
|
126
|
+
selected={isSel}
|
|
127
|
+
role="tab"
|
|
128
|
+
aria-selected={isSel}
|
|
129
|
+
aria-controls={`${baseId}-panel-${item.value}`}
|
|
130
|
+
hideIndicator
|
|
131
|
+
size="sm"
|
|
132
|
+
disabled={item.disabled}
|
|
133
|
+
onClick={() => select(item.value)}
|
|
134
|
+
className={cn(
|
|
135
|
+
"z-10 cursor-pointer transition duration-150 ease-out hover:bg-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50",
|
|
136
|
+
isSel && "font-weight-heading-sm",
|
|
137
|
+
)}
|
|
138
|
+
>
|
|
139
|
+
<span className="inline-flex items-center gap-xs">
|
|
140
|
+
{item.label}
|
|
141
|
+
{item.count != null ? (
|
|
142
|
+
<Badge tone="neutral" variant="soft" size="sm" className="rounded-full">
|
|
143
|
+
{item.count}
|
|
144
|
+
</Badge>
|
|
145
|
+
) : null}
|
|
146
|
+
</span>
|
|
147
|
+
</Tab>
|
|
148
|
+
);
|
|
149
|
+
})}
|
|
150
|
+
</div>
|
|
137
151
|
</div>
|
|
152
|
+
{actions ? <div className="ml-auto shrink-0">{actions}</div> : null}
|
|
138
153
|
</div>
|
|
139
154
|
|
|
140
155
|
{items.map((item) => (
|
package/src/tokens.css
CHANGED