@designa8/vibedesign-linear-internal-v1-b737 0.12.0 → 0.12.2
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 +103 -24
- package/dist/index.js +103 -24
- package/dist/styles.css +18 -0
- package/package.json +1 -1
- package/src/atoms/AgentQuestionCard/AgentQuestionCard.tsx +22 -4
- package/src/atoms/Drawer/Drawer.tsx +109 -10
- package/src/atoms/Drawer/preview.tsx +62 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @designa8/vibedesign-linear-internal-v1-b737
|
|
2
2
|
|
|
3
|
-
Complete design system generated by Atoms Design, version **0.12.
|
|
3
|
+
Complete design system generated by Atoms Design, version **0.12.2**.
|
|
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
|
@@ -1091,6 +1091,7 @@ var letterBadge = (selected) => cn8(
|
|
|
1091
1091
|
"flex h-lg w-lg shrink-0 items-center justify-center rounded-xs border text-caption transition-colors duration-150 ease-out",
|
|
1092
1092
|
selected ? "border-primary bg-primary text-on-primary" : "border-hairline-strong bg-canvas text-muted group-hover:border-primary group-hover:text-primary"
|
|
1093
1093
|
);
|
|
1094
|
+
var firstLineGlyph = "flex h-lg shrink-0 items-center";
|
|
1094
1095
|
var PANEL = "min-h-0 overflow-hidden transition duration-200 ease-out data-[state=open]:translate-y-0 data-[state=open]:opacity-100 data-[state=closed]:pointer-events-none data-[state=closed]:opacity-0";
|
|
1095
1096
|
var AgentQuestionCard = React11.forwardRef(
|
|
1096
1097
|
({
|
|
@@ -1269,7 +1270,7 @@ var AgentQuestionCard = React11.forwardRef(
|
|
|
1269
1270
|
"aria-label": option.label,
|
|
1270
1271
|
disabled: submitting,
|
|
1271
1272
|
leadingIcon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": "true", className: letterBadge(isSelected), children: letterFor(option, index) }),
|
|
1272
|
-
trailingIcon: isSelected ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "check", size: 14, className: "text-primary" }) : void 0,
|
|
1273
|
+
trailingIcon: isSelected ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": "true", className: firstLineGlyph, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "check", size: 14, className: "text-primary" }) }) : void 0,
|
|
1273
1274
|
onClick: () => setSelection(option.id),
|
|
1274
1275
|
onKeyDown: radioKeys(index),
|
|
1275
1276
|
className: "group",
|
|
@@ -1282,7 +1283,12 @@ var AgentQuestionCard = React11.forwardRef(
|
|
|
1282
1283
|
"div",
|
|
1283
1284
|
{
|
|
1284
1285
|
className: cn8(
|
|
1285
|
-
"flex w-full items-center
|
|
1286
|
+
"flex w-full items-center rounded-md border transition-colors duration-150 ease-out",
|
|
1287
|
+
// Both states land the letter badge 12px from the row edge:
|
|
1288
|
+
// the plain row button supplies that inset itself, while the
|
|
1289
|
+
// inline-field state pads the track (the square badge button
|
|
1290
|
+
// already centres its badge inside its own 4px of slack).
|
|
1291
|
+
freeTextSelected ? "gap-xs px-sm" : "px-0",
|
|
1286
1292
|
errorMessage && freeTextSelected ? "border-semantic-error" : freeTextSelected ? "border-transparent bg-primary-soft" : "border-transparent"
|
|
1287
1293
|
),
|
|
1288
1294
|
children: [
|
|
@@ -1353,7 +1359,7 @@ var AgentQuestionCard = React11.forwardRef(
|
|
|
1353
1359
|
disabled: submitting
|
|
1354
1360
|
}
|
|
1355
1361
|
) }),
|
|
1356
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "check", size: 14, className: "
|
|
1362
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": "true", className: cn8(firstLineGlyph, "mr-xs"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "check", size: 14, className: "text-primary" }) })
|
|
1357
1363
|
] })
|
|
1358
1364
|
]
|
|
1359
1365
|
}
|
|
@@ -5694,6 +5700,7 @@ var React46 = __toESM(require("react"));
|
|
|
5694
5700
|
var import_react_dom5 = require("react-dom");
|
|
5695
5701
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
5696
5702
|
var cn35 = (...parts) => parts.filter(Boolean).join(" ");
|
|
5703
|
+
var DISMISS_THRESHOLD = 0.3;
|
|
5697
5704
|
var Drawer = React46.forwardRef(
|
|
5698
5705
|
({
|
|
5699
5706
|
open,
|
|
@@ -5708,6 +5715,7 @@ var Drawer = React46.forwardRef(
|
|
|
5708
5715
|
"aria-label": ariaLabel,
|
|
5709
5716
|
closeOnScrimClick = true,
|
|
5710
5717
|
bodyClassName,
|
|
5718
|
+
showHandle = true,
|
|
5711
5719
|
className,
|
|
5712
5720
|
children,
|
|
5713
5721
|
...rest
|
|
@@ -5716,6 +5724,20 @@ var Drawer = React46.forwardRef(
|
|
|
5716
5724
|
const panelRef = React46.useRef(null);
|
|
5717
5725
|
const [mounted, setMounted] = React46.useState(false);
|
|
5718
5726
|
React46.useEffect(() => setMounted(true), []);
|
|
5727
|
+
const isBottom = side === "bottom";
|
|
5728
|
+
const [dragging, setDragging] = React46.useState(false);
|
|
5729
|
+
const [dragOffset, setDragOffset] = React46.useState(0);
|
|
5730
|
+
const dragStartY = React46.useRef(0);
|
|
5731
|
+
const dragHeight = React46.useRef(0);
|
|
5732
|
+
const endDrag = React46.useCallback(
|
|
5733
|
+
(close) => {
|
|
5734
|
+
const passed = dragOffset > (dragHeight.current || 0) * DISMISS_THRESHOLD;
|
|
5735
|
+
setDragging(false);
|
|
5736
|
+
setDragOffset(0);
|
|
5737
|
+
if (close && passed) onOpenChange(false);
|
|
5738
|
+
},
|
|
5739
|
+
[dragOffset, onOpenChange]
|
|
5740
|
+
);
|
|
5719
5741
|
React46.useEffect(() => {
|
|
5720
5742
|
if (!open) return;
|
|
5721
5743
|
const onKey = (e) => {
|
|
@@ -5742,13 +5764,40 @@ var Drawer = React46.forwardRef(
|
|
|
5742
5764
|
window.clearTimeout(t);
|
|
5743
5765
|
};
|
|
5744
5766
|
}, [open, onOpenChange, closeOnScrimClick]);
|
|
5767
|
+
const onHandlePointerDown = (e) => {
|
|
5768
|
+
if (!isBottom) return;
|
|
5769
|
+
dragStartY.current = e.clientY;
|
|
5770
|
+
dragHeight.current = panelRef.current?.getBoundingClientRect().height ?? 0;
|
|
5771
|
+
setDragging(true);
|
|
5772
|
+
setDragOffset(0);
|
|
5773
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
5774
|
+
};
|
|
5775
|
+
const onHandlePointerMove = (e) => {
|
|
5776
|
+
if (!dragging) return;
|
|
5777
|
+
const next = Math.max(0, e.clientY - dragStartY.current);
|
|
5778
|
+
setDragOffset(Math.min(next, dragHeight.current || next));
|
|
5779
|
+
};
|
|
5780
|
+
const onHandlePointerUp = (e) => {
|
|
5781
|
+
if (!dragging) return;
|
|
5782
|
+
try {
|
|
5783
|
+
e.currentTarget.releasePointerCapture?.(e.pointerId);
|
|
5784
|
+
} catch {
|
|
5785
|
+
}
|
|
5786
|
+
endDrag(true);
|
|
5787
|
+
};
|
|
5788
|
+
const onHandlePointerCancel = () => {
|
|
5789
|
+
if (!dragging) return;
|
|
5790
|
+
endDrag(false);
|
|
5791
|
+
};
|
|
5745
5792
|
const state = open ? "open" : "closed";
|
|
5746
5793
|
const hasTitle = title !== void 0 && title !== null;
|
|
5794
|
+
const sideClasses = isBottom ? "inset-x-0 bottom-0 w-full rounded-t-xl border-t border-hairline shadow-card data-[state=open]:translate-y-0 data-[state=closed]:translate-y-full" : side === "right" ? "inset-y-0 right-0 w-full border-l border-hairline shadow-modal sm:w-[var(--container-drawer,448px)] data-[state=open]:translate-x-0 data-[state=closed]:translate-x-full" : "inset-y-0 left-0 w-full border-r border-hairline shadow-modal sm:w-[var(--container-drawer,448px)] data-[state=open]:translate-x-0 data-[state=closed]:-translate-x-full";
|
|
5795
|
+
const scrimDragOpacity = dragging ? Math.max(0, 1 - dragOffset / Math.max(dragHeight.current, 1)) : void 0;
|
|
5747
5796
|
const node = /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
5748
5797
|
"div",
|
|
5749
5798
|
{
|
|
5750
5799
|
"data-state": state,
|
|
5751
|
-
className: "fixed inset-0 data-[state=closed]:pointer-events-none",
|
|
5800
|
+
className: "fixed inset-0 overflow-hidden data-[state=closed]:pointer-events-none",
|
|
5752
5801
|
style: { zIndex: "var(--z-modal, 1200)" },
|
|
5753
5802
|
"aria-hidden": open ? void 0 : true,
|
|
5754
5803
|
children: [
|
|
@@ -5757,7 +5806,11 @@ var Drawer = React46.forwardRef(
|
|
|
5757
5806
|
{
|
|
5758
5807
|
"data-state": state,
|
|
5759
5808
|
"aria-hidden": "true",
|
|
5760
|
-
className:
|
|
5809
|
+
className: cn35(
|
|
5810
|
+
dragging ? "transition-none" : "transition-opacity duration-200 ease-out",
|
|
5811
|
+
"fixed inset-0 bg-scrim/40 data-[state=open]:opacity-100 data-[state=closed]:opacity-0"
|
|
5812
|
+
),
|
|
5813
|
+
style: scrimDragOpacity === void 0 ? void 0 : { opacity: scrimDragOpacity }
|
|
5761
5814
|
}
|
|
5762
5815
|
),
|
|
5763
5816
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
@@ -5776,29 +5829,55 @@ var Drawer = React46.forwardRef(
|
|
|
5776
5829
|
"data-side": side,
|
|
5777
5830
|
"data-drawer": "",
|
|
5778
5831
|
className: cn35(
|
|
5779
|
-
"fixed
|
|
5780
|
-
|
|
5781
|
-
"data-[state=open]:translate-x-0 data-[state=closed]:invisible",
|
|
5832
|
+
"fixed flex flex-col overflow-hidden bg-canvas text-ink transition ease-out data-[state=closed]:invisible",
|
|
5833
|
+
sideClasses,
|
|
5782
5834
|
className
|
|
5783
5835
|
),
|
|
5836
|
+
style: {
|
|
5837
|
+
maxHeight: isBottom ? "90dvh" : void 0,
|
|
5838
|
+
paddingBottom: isBottom ? "env(safe-area-inset-bottom, 0px)" : void 0,
|
|
5839
|
+
transform: isBottom && dragging && dragOffset > 0 ? `translateY(${dragOffset}px)` : void 0,
|
|
5840
|
+
transitionDuration: dragging ? "0ms" : "240ms"
|
|
5841
|
+
},
|
|
5784
5842
|
...rest,
|
|
5785
5843
|
children: [
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5844
|
+
isBottom && showHandle && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5845
|
+
"div",
|
|
5846
|
+
{
|
|
5847
|
+
"aria-hidden": "true",
|
|
5848
|
+
onPointerDown: onHandlePointerDown,
|
|
5849
|
+
onPointerMove: onHandlePointerMove,
|
|
5850
|
+
onPointerUp: onHandlePointerUp,
|
|
5851
|
+
onPointerCancel: onHandlePointerCancel,
|
|
5852
|
+
className: "flex shrink-0 cursor-grab touch-none select-none items-center justify-center pb-xs pt-sm active:cursor-grabbing",
|
|
5853
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "h-1 w-10 rounded-full bg-hairline-strong" })
|
|
5854
|
+
}
|
|
5855
|
+
),
|
|
5856
|
+
!hideHeader && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
5857
|
+
"div",
|
|
5858
|
+
{
|
|
5859
|
+
className: cn35(
|
|
5860
|
+
"flex shrink-0 items-center justify-between gap-sm px-base pb-sm",
|
|
5861
|
+
isBottom ? "pt-xs" : "pt-base"
|
|
5862
|
+
),
|
|
5863
|
+
children: [
|
|
5864
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-sm", children: [
|
|
5865
|
+
headerStart,
|
|
5866
|
+
hasTitle && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("h2", { id: titleId, className: "truncate text-heading-sm text-ink", children: title })
|
|
5867
|
+
] }),
|
|
5868
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5869
|
+
IconButton,
|
|
5870
|
+
{
|
|
5871
|
+
icon: closeIcon,
|
|
5872
|
+
variant: closeIcon === "x" ? "ghost" : "secondary",
|
|
5873
|
+
size: "md",
|
|
5874
|
+
"aria-label": closeLabel,
|
|
5875
|
+
onClick: () => onOpenChange(false)
|
|
5876
|
+
}
|
|
5877
|
+
)
|
|
5878
|
+
]
|
|
5879
|
+
}
|
|
5880
|
+
),
|
|
5802
5881
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5803
5882
|
"div",
|
|
5804
5883
|
{
|
package/dist/index.js
CHANGED
|
@@ -946,6 +946,7 @@ var letterBadge = (selected) => cn8(
|
|
|
946
946
|
"flex h-lg w-lg shrink-0 items-center justify-center rounded-xs border text-caption transition-colors duration-150 ease-out",
|
|
947
947
|
selected ? "border-primary bg-primary text-on-primary" : "border-hairline-strong bg-canvas text-muted group-hover:border-primary group-hover:text-primary"
|
|
948
948
|
);
|
|
949
|
+
var firstLineGlyph = "flex h-lg shrink-0 items-center";
|
|
949
950
|
var PANEL = "min-h-0 overflow-hidden transition duration-200 ease-out data-[state=open]:translate-y-0 data-[state=open]:opacity-100 data-[state=closed]:pointer-events-none data-[state=closed]:opacity-0";
|
|
950
951
|
var AgentQuestionCard = React11.forwardRef(
|
|
951
952
|
({
|
|
@@ -1124,7 +1125,7 @@ var AgentQuestionCard = React11.forwardRef(
|
|
|
1124
1125
|
"aria-label": option.label,
|
|
1125
1126
|
disabled: submitting,
|
|
1126
1127
|
leadingIcon: /* @__PURE__ */ jsx11("span", { "aria-hidden": "true", className: letterBadge(isSelected), children: letterFor(option, index) }),
|
|
1127
|
-
trailingIcon: isSelected ? /* @__PURE__ */ jsx11(Icon, { name: "check", size: 14, className: "text-primary" }) : void 0,
|
|
1128
|
+
trailingIcon: isSelected ? /* @__PURE__ */ jsx11("span", { "aria-hidden": "true", className: firstLineGlyph, children: /* @__PURE__ */ jsx11(Icon, { name: "check", size: 14, className: "text-primary" }) }) : void 0,
|
|
1128
1129
|
onClick: () => setSelection(option.id),
|
|
1129
1130
|
onKeyDown: radioKeys(index),
|
|
1130
1131
|
className: "group",
|
|
@@ -1137,7 +1138,12 @@ var AgentQuestionCard = React11.forwardRef(
|
|
|
1137
1138
|
"div",
|
|
1138
1139
|
{
|
|
1139
1140
|
className: cn8(
|
|
1140
|
-
"flex w-full items-center
|
|
1141
|
+
"flex w-full items-center rounded-md border transition-colors duration-150 ease-out",
|
|
1142
|
+
// Both states land the letter badge 12px from the row edge:
|
|
1143
|
+
// the plain row button supplies that inset itself, while the
|
|
1144
|
+
// inline-field state pads the track (the square badge button
|
|
1145
|
+
// already centres its badge inside its own 4px of slack).
|
|
1146
|
+
freeTextSelected ? "gap-xs px-sm" : "px-0",
|
|
1141
1147
|
errorMessage && freeTextSelected ? "border-semantic-error" : freeTextSelected ? "border-transparent bg-primary-soft" : "border-transparent"
|
|
1142
1148
|
),
|
|
1143
1149
|
children: [
|
|
@@ -1208,7 +1214,7 @@ var AgentQuestionCard = React11.forwardRef(
|
|
|
1208
1214
|
disabled: submitting
|
|
1209
1215
|
}
|
|
1210
1216
|
) }),
|
|
1211
|
-
/* @__PURE__ */ jsx11(Icon, { name: "check", size: 14, className: "
|
|
1217
|
+
/* @__PURE__ */ jsx11("span", { "aria-hidden": "true", className: cn8(firstLineGlyph, "mr-xs"), children: /* @__PURE__ */ jsx11(Icon, { name: "check", size: 14, className: "text-primary" }) })
|
|
1212
1218
|
] })
|
|
1213
1219
|
]
|
|
1214
1220
|
}
|
|
@@ -5549,6 +5555,7 @@ import * as React46 from "react";
|
|
|
5549
5555
|
import { createPortal as createPortal5 } from "react-dom";
|
|
5550
5556
|
import { jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
5551
5557
|
var cn35 = (...parts) => parts.filter(Boolean).join(" ");
|
|
5558
|
+
var DISMISS_THRESHOLD = 0.3;
|
|
5552
5559
|
var Drawer = React46.forwardRef(
|
|
5553
5560
|
({
|
|
5554
5561
|
open,
|
|
@@ -5563,6 +5570,7 @@ var Drawer = React46.forwardRef(
|
|
|
5563
5570
|
"aria-label": ariaLabel,
|
|
5564
5571
|
closeOnScrimClick = true,
|
|
5565
5572
|
bodyClassName,
|
|
5573
|
+
showHandle = true,
|
|
5566
5574
|
className,
|
|
5567
5575
|
children,
|
|
5568
5576
|
...rest
|
|
@@ -5571,6 +5579,20 @@ var Drawer = React46.forwardRef(
|
|
|
5571
5579
|
const panelRef = React46.useRef(null);
|
|
5572
5580
|
const [mounted, setMounted] = React46.useState(false);
|
|
5573
5581
|
React46.useEffect(() => setMounted(true), []);
|
|
5582
|
+
const isBottom = side === "bottom";
|
|
5583
|
+
const [dragging, setDragging] = React46.useState(false);
|
|
5584
|
+
const [dragOffset, setDragOffset] = React46.useState(0);
|
|
5585
|
+
const dragStartY = React46.useRef(0);
|
|
5586
|
+
const dragHeight = React46.useRef(0);
|
|
5587
|
+
const endDrag = React46.useCallback(
|
|
5588
|
+
(close) => {
|
|
5589
|
+
const passed = dragOffset > (dragHeight.current || 0) * DISMISS_THRESHOLD;
|
|
5590
|
+
setDragging(false);
|
|
5591
|
+
setDragOffset(0);
|
|
5592
|
+
if (close && passed) onOpenChange(false);
|
|
5593
|
+
},
|
|
5594
|
+
[dragOffset, onOpenChange]
|
|
5595
|
+
);
|
|
5574
5596
|
React46.useEffect(() => {
|
|
5575
5597
|
if (!open) return;
|
|
5576
5598
|
const onKey = (e) => {
|
|
@@ -5597,13 +5619,40 @@ var Drawer = React46.forwardRef(
|
|
|
5597
5619
|
window.clearTimeout(t);
|
|
5598
5620
|
};
|
|
5599
5621
|
}, [open, onOpenChange, closeOnScrimClick]);
|
|
5622
|
+
const onHandlePointerDown = (e) => {
|
|
5623
|
+
if (!isBottom) return;
|
|
5624
|
+
dragStartY.current = e.clientY;
|
|
5625
|
+
dragHeight.current = panelRef.current?.getBoundingClientRect().height ?? 0;
|
|
5626
|
+
setDragging(true);
|
|
5627
|
+
setDragOffset(0);
|
|
5628
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
5629
|
+
};
|
|
5630
|
+
const onHandlePointerMove = (e) => {
|
|
5631
|
+
if (!dragging) return;
|
|
5632
|
+
const next = Math.max(0, e.clientY - dragStartY.current);
|
|
5633
|
+
setDragOffset(Math.min(next, dragHeight.current || next));
|
|
5634
|
+
};
|
|
5635
|
+
const onHandlePointerUp = (e) => {
|
|
5636
|
+
if (!dragging) return;
|
|
5637
|
+
try {
|
|
5638
|
+
e.currentTarget.releasePointerCapture?.(e.pointerId);
|
|
5639
|
+
} catch {
|
|
5640
|
+
}
|
|
5641
|
+
endDrag(true);
|
|
5642
|
+
};
|
|
5643
|
+
const onHandlePointerCancel = () => {
|
|
5644
|
+
if (!dragging) return;
|
|
5645
|
+
endDrag(false);
|
|
5646
|
+
};
|
|
5600
5647
|
const state = open ? "open" : "closed";
|
|
5601
5648
|
const hasTitle = title !== void 0 && title !== null;
|
|
5649
|
+
const sideClasses = isBottom ? "inset-x-0 bottom-0 w-full rounded-t-xl border-t border-hairline shadow-card data-[state=open]:translate-y-0 data-[state=closed]:translate-y-full" : side === "right" ? "inset-y-0 right-0 w-full border-l border-hairline shadow-modal sm:w-[var(--container-drawer,448px)] data-[state=open]:translate-x-0 data-[state=closed]:translate-x-full" : "inset-y-0 left-0 w-full border-r border-hairline shadow-modal sm:w-[var(--container-drawer,448px)] data-[state=open]:translate-x-0 data-[state=closed]:-translate-x-full";
|
|
5650
|
+
const scrimDragOpacity = dragging ? Math.max(0, 1 - dragOffset / Math.max(dragHeight.current, 1)) : void 0;
|
|
5602
5651
|
const node = /* @__PURE__ */ jsxs40(
|
|
5603
5652
|
"div",
|
|
5604
5653
|
{
|
|
5605
5654
|
"data-state": state,
|
|
5606
|
-
className: "fixed inset-0 data-[state=closed]:pointer-events-none",
|
|
5655
|
+
className: "fixed inset-0 overflow-hidden data-[state=closed]:pointer-events-none",
|
|
5607
5656
|
style: { zIndex: "var(--z-modal, 1200)" },
|
|
5608
5657
|
"aria-hidden": open ? void 0 : true,
|
|
5609
5658
|
children: [
|
|
@@ -5612,7 +5661,11 @@ var Drawer = React46.forwardRef(
|
|
|
5612
5661
|
{
|
|
5613
5662
|
"data-state": state,
|
|
5614
5663
|
"aria-hidden": "true",
|
|
5615
|
-
className:
|
|
5664
|
+
className: cn35(
|
|
5665
|
+
dragging ? "transition-none" : "transition-opacity duration-200 ease-out",
|
|
5666
|
+
"fixed inset-0 bg-scrim/40 data-[state=open]:opacity-100 data-[state=closed]:opacity-0"
|
|
5667
|
+
),
|
|
5668
|
+
style: scrimDragOpacity === void 0 ? void 0 : { opacity: scrimDragOpacity }
|
|
5616
5669
|
}
|
|
5617
5670
|
),
|
|
5618
5671
|
/* @__PURE__ */ jsxs40(
|
|
@@ -5631,29 +5684,55 @@ var Drawer = React46.forwardRef(
|
|
|
5631
5684
|
"data-side": side,
|
|
5632
5685
|
"data-drawer": "",
|
|
5633
5686
|
className: cn35(
|
|
5634
|
-
"fixed
|
|
5635
|
-
|
|
5636
|
-
"data-[state=open]:translate-x-0 data-[state=closed]:invisible",
|
|
5687
|
+
"fixed flex flex-col overflow-hidden bg-canvas text-ink transition ease-out data-[state=closed]:invisible",
|
|
5688
|
+
sideClasses,
|
|
5637
5689
|
className
|
|
5638
5690
|
),
|
|
5691
|
+
style: {
|
|
5692
|
+
maxHeight: isBottom ? "90dvh" : void 0,
|
|
5693
|
+
paddingBottom: isBottom ? "env(safe-area-inset-bottom, 0px)" : void 0,
|
|
5694
|
+
transform: isBottom && dragging && dragOffset > 0 ? `translateY(${dragOffset}px)` : void 0,
|
|
5695
|
+
transitionDuration: dragging ? "0ms" : "240ms"
|
|
5696
|
+
},
|
|
5639
5697
|
...rest,
|
|
5640
5698
|
children: [
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5699
|
+
isBottom && showHandle && /* @__PURE__ */ jsx46(
|
|
5700
|
+
"div",
|
|
5701
|
+
{
|
|
5702
|
+
"aria-hidden": "true",
|
|
5703
|
+
onPointerDown: onHandlePointerDown,
|
|
5704
|
+
onPointerMove: onHandlePointerMove,
|
|
5705
|
+
onPointerUp: onHandlePointerUp,
|
|
5706
|
+
onPointerCancel: onHandlePointerCancel,
|
|
5707
|
+
className: "flex shrink-0 cursor-grab touch-none select-none items-center justify-center pb-xs pt-sm active:cursor-grabbing",
|
|
5708
|
+
children: /* @__PURE__ */ jsx46("span", { className: "h-1 w-10 rounded-full bg-hairline-strong" })
|
|
5709
|
+
}
|
|
5710
|
+
),
|
|
5711
|
+
!hideHeader && /* @__PURE__ */ jsxs40(
|
|
5712
|
+
"div",
|
|
5713
|
+
{
|
|
5714
|
+
className: cn35(
|
|
5715
|
+
"flex shrink-0 items-center justify-between gap-sm px-base pb-sm",
|
|
5716
|
+
isBottom ? "pt-xs" : "pt-base"
|
|
5717
|
+
),
|
|
5718
|
+
children: [
|
|
5719
|
+
/* @__PURE__ */ jsxs40("div", { className: "flex min-w-0 flex-1 items-center gap-sm", children: [
|
|
5720
|
+
headerStart,
|
|
5721
|
+
hasTitle && /* @__PURE__ */ jsx46("h2", { id: titleId, className: "truncate text-heading-sm text-ink", children: title })
|
|
5722
|
+
] }),
|
|
5723
|
+
/* @__PURE__ */ jsx46(
|
|
5724
|
+
IconButton,
|
|
5725
|
+
{
|
|
5726
|
+
icon: closeIcon,
|
|
5727
|
+
variant: closeIcon === "x" ? "ghost" : "secondary",
|
|
5728
|
+
size: "md",
|
|
5729
|
+
"aria-label": closeLabel,
|
|
5730
|
+
onClick: () => onOpenChange(false)
|
|
5731
|
+
}
|
|
5732
|
+
)
|
|
5733
|
+
]
|
|
5734
|
+
}
|
|
5735
|
+
),
|
|
5657
5736
|
/* @__PURE__ */ jsx46(
|
|
5658
5737
|
"div",
|
|
5659
5738
|
{
|
package/dist/styles.css
CHANGED
|
@@ -1062,6 +1062,9 @@
|
|
|
1062
1062
|
.cursor-default {
|
|
1063
1063
|
cursor: default;
|
|
1064
1064
|
}
|
|
1065
|
+
.cursor-grab {
|
|
1066
|
+
cursor: grab;
|
|
1067
|
+
}
|
|
1065
1068
|
.cursor-not-allowed {
|
|
1066
1069
|
cursor: not-allowed;
|
|
1067
1070
|
}
|
|
@@ -1321,6 +1324,10 @@
|
|
|
1321
1324
|
border-top-left-radius: var(--radius-lg);
|
|
1322
1325
|
border-top-right-radius: var(--radius-lg);
|
|
1323
1326
|
}
|
|
1327
|
+
.rounded-t-xl {
|
|
1328
|
+
border-top-left-radius: var(--radius-xl);
|
|
1329
|
+
border-top-right-radius: var(--radius-xl);
|
|
1330
|
+
}
|
|
1324
1331
|
.rounded-t-xs {
|
|
1325
1332
|
border-top-left-radius: var(--radius-xs);
|
|
1326
1333
|
border-top-right-radius: var(--radius-xs);
|
|
@@ -1657,6 +1664,9 @@
|
|
|
1657
1664
|
.py-xxs {
|
|
1658
1665
|
padding-block: var(--spacing-xxs);
|
|
1659
1666
|
}
|
|
1667
|
+
.pt-0 {
|
|
1668
|
+
padding-top: 0;
|
|
1669
|
+
}
|
|
1660
1670
|
.pt-base {
|
|
1661
1671
|
padding-top: var(--spacing-base);
|
|
1662
1672
|
}
|
|
@@ -2024,6 +2034,9 @@
|
|
|
2024
2034
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
2025
2035
|
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
2026
2036
|
}
|
|
2037
|
+
.transition-none {
|
|
2038
|
+
transition-property: none;
|
|
2039
|
+
}
|
|
2027
2040
|
.duration-150 {
|
|
2028
2041
|
--tw-duration: 150ms;
|
|
2029
2042
|
transition-duration: 150ms;
|
|
@@ -2476,6 +2489,11 @@
|
|
|
2476
2489
|
}
|
|
2477
2490
|
}
|
|
2478
2491
|
}
|
|
2492
|
+
.active\:cursor-grabbing {
|
|
2493
|
+
&:active {
|
|
2494
|
+
cursor: grabbing;
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2479
2497
|
.active\:bg-surface-strong {
|
|
2480
2498
|
&:active {
|
|
2481
2499
|
background-color: var(--color-surface-strong);
|
package/package.json
CHANGED
|
@@ -76,6 +76,13 @@ const letterBadge = (selected: boolean): string =>
|
|
|
76
76
|
: "border-hairline-strong bg-canvas text-muted group-hover:border-primary group-hover:text-primary",
|
|
77
77
|
);
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Wraps a first-line glyph (the trailing check) in a badge-height band so it
|
|
81
|
+
* centres on the same line as the letter badge instead of pinning to the top
|
|
82
|
+
* of a wrapped label.
|
|
83
|
+
*/
|
|
84
|
+
const firstLineGlyph = "flex h-lg shrink-0 items-center";
|
|
85
|
+
|
|
79
86
|
const PANEL =
|
|
80
87
|
"min-h-0 overflow-hidden transition duration-200 ease-out data-[state=open]:translate-y-0 data-[state=open]:opacity-100 data-[state=closed]:pointer-events-none data-[state=closed]:opacity-0";
|
|
81
88
|
|
|
@@ -84,7 +91,9 @@ const PANEL =
|
|
|
84
91
|
* Options are a radiogroup (arrow keys move and select), the trailing row turns
|
|
85
92
|
* into an inline text field, and closing folds the card into a slim restore bar.
|
|
86
93
|
* Option labels wrap onto multiple lines — agent options are often full
|
|
87
|
-
* sentences — with the letter badge
|
|
94
|
+
* sentences — with the letter badge and the trailing check sitting on the first
|
|
95
|
+
* line. Every row, including the free-text one, shares one left inset so the
|
|
96
|
+
* letter badges line up in a single column.
|
|
88
97
|
*/
|
|
89
98
|
export const AgentQuestionCard = React.forwardRef<
|
|
90
99
|
HTMLDivElement,
|
|
@@ -303,7 +312,9 @@ export const AgentQuestionCard = React.forwardRef<
|
|
|
303
312
|
}
|
|
304
313
|
trailingIcon={
|
|
305
314
|
isSelected ? (
|
|
306
|
-
<
|
|
315
|
+
<span aria-hidden="true" className={firstLineGlyph}>
|
|
316
|
+
<Icon name="check" size={14} className="text-primary" />
|
|
317
|
+
</span>
|
|
307
318
|
) : undefined
|
|
308
319
|
}
|
|
309
320
|
onClick={() => setSelection(option.id)}
|
|
@@ -318,7 +329,12 @@ export const AgentQuestionCard = React.forwardRef<
|
|
|
318
329
|
{hasFreeText && (
|
|
319
330
|
<div
|
|
320
331
|
className={cn(
|
|
321
|
-
"flex w-full items-center
|
|
332
|
+
"flex w-full items-center rounded-md border transition-colors duration-150 ease-out",
|
|
333
|
+
// Both states land the letter badge 12px from the row edge:
|
|
334
|
+
// the plain row button supplies that inset itself, while the
|
|
335
|
+
// inline-field state pads the track (the square badge button
|
|
336
|
+
// already centres its badge inside its own 4px of slack).
|
|
337
|
+
freeTextSelected ? "gap-xs px-sm" : "px-0",
|
|
322
338
|
errorMessage && freeTextSelected
|
|
323
339
|
? "border-semantic-error"
|
|
324
340
|
: freeTextSelected
|
|
@@ -400,7 +416,9 @@ export const AgentQuestionCard = React.forwardRef<
|
|
|
400
416
|
disabled={submitting}
|
|
401
417
|
/>
|
|
402
418
|
</div>
|
|
403
|
-
<
|
|
419
|
+
<span aria-hidden="true" className={cn(firstLineGlyph, "mr-xs")}>
|
|
420
|
+
<Icon name="check" size={14} className="text-primary" />
|
|
421
|
+
</span>
|
|
404
422
|
</>
|
|
405
423
|
)}
|
|
406
424
|
</div>
|
|
@@ -3,14 +3,17 @@ import { createPortal } from "react-dom";
|
|
|
3
3
|
import { IconButton } from "../IconButton";
|
|
4
4
|
import type { IconName } from "../Icon";
|
|
5
5
|
|
|
6
|
-
export type DrawerSide = "left" | "right";
|
|
6
|
+
export type DrawerSide = "left" | "right" | "bottom";
|
|
7
7
|
|
|
8
8
|
export interface DrawerProps
|
|
9
9
|
extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
10
10
|
/** Controlled open state. */
|
|
11
11
|
open: boolean;
|
|
12
12
|
onOpenChange: (open: boolean) => void;
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Edge the panel is pinned to and slides in from. `"bottom"` renders a
|
|
15
|
+
* content-sized sheet pinned to the bottom edge (mobile action sheet).
|
|
16
|
+
*/
|
|
14
17
|
side?: DrawerSide;
|
|
15
18
|
/** Title shown in the default header row; also the dialog's accessible name. */
|
|
16
19
|
title?: React.ReactNode;
|
|
@@ -29,11 +32,19 @@ export interface DrawerProps
|
|
|
29
32
|
closeOnScrimClick?: boolean;
|
|
30
33
|
/** Class for the scrolling body. */
|
|
31
34
|
bodyClassName?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Show the drag handle above the header. Defaults to true for
|
|
37
|
+
* `side="bottom"`; ignored for `left` / `right`.
|
|
38
|
+
*/
|
|
39
|
+
showHandle?: boolean;
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
const cn = (...parts: Array<string | false | null | undefined>) =>
|
|
35
43
|
parts.filter(Boolean).join(" ");
|
|
36
44
|
|
|
45
|
+
/** Fraction of the sheet height a downward drag must pass to dismiss. */
|
|
46
|
+
const DISMISS_THRESHOLD = 0.3;
|
|
47
|
+
|
|
37
48
|
export const Drawer = React.forwardRef<HTMLDivElement, DrawerProps>(
|
|
38
49
|
(
|
|
39
50
|
{
|
|
@@ -49,6 +60,7 @@ export const Drawer = React.forwardRef<HTMLDivElement, DrawerProps>(
|
|
|
49
60
|
"aria-label": ariaLabel,
|
|
50
61
|
closeOnScrimClick = true,
|
|
51
62
|
bodyClassName,
|
|
63
|
+
showHandle = true,
|
|
52
64
|
className,
|
|
53
65
|
children,
|
|
54
66
|
...rest
|
|
@@ -60,6 +72,25 @@ export const Drawer = React.forwardRef<HTMLDivElement, DrawerProps>(
|
|
|
60
72
|
const [mounted, setMounted] = React.useState(false);
|
|
61
73
|
React.useEffect(() => setMounted(true), []);
|
|
62
74
|
|
|
75
|
+
const isBottom = side === "bottom";
|
|
76
|
+
|
|
77
|
+
/** Drag-to-dismiss state (bottom sheet only). */
|
|
78
|
+
const [dragging, setDragging] = React.useState(false);
|
|
79
|
+
const [dragOffset, setDragOffset] = React.useState(0);
|
|
80
|
+
const dragStartY = React.useRef(0);
|
|
81
|
+
const dragHeight = React.useRef(0);
|
|
82
|
+
|
|
83
|
+
const endDrag = React.useCallback(
|
|
84
|
+
(close: boolean) => {
|
|
85
|
+
const passed =
|
|
86
|
+
dragOffset > (dragHeight.current || 0) * DISMISS_THRESHOLD;
|
|
87
|
+
setDragging(false);
|
|
88
|
+
setDragOffset(0);
|
|
89
|
+
if (close && passed) onOpenChange(false);
|
|
90
|
+
},
|
|
91
|
+
[dragOffset, onOpenChange],
|
|
92
|
+
);
|
|
93
|
+
|
|
63
94
|
React.useEffect(() => {
|
|
64
95
|
if (!open) return;
|
|
65
96
|
const onKey = (e: KeyboardEvent) => {
|
|
@@ -88,20 +119,65 @@ export const Drawer = React.forwardRef<HTMLDivElement, DrawerProps>(
|
|
|
88
119
|
};
|
|
89
120
|
}, [open, onOpenChange, closeOnScrimClick]);
|
|
90
121
|
|
|
122
|
+
const onHandlePointerDown = (e: React.PointerEvent<HTMLDivElement>) => {
|
|
123
|
+
if (!isBottom) return;
|
|
124
|
+
dragStartY.current = e.clientY;
|
|
125
|
+
dragHeight.current = panelRef.current?.getBoundingClientRect().height ?? 0;
|
|
126
|
+
setDragging(true);
|
|
127
|
+
setDragOffset(0);
|
|
128
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const onHandlePointerMove = (e: React.PointerEvent<HTMLDivElement>) => {
|
|
132
|
+
if (!dragging) return;
|
|
133
|
+
const next = Math.max(0, e.clientY - dragStartY.current);
|
|
134
|
+
setDragOffset(Math.min(next, dragHeight.current || next));
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const onHandlePointerUp = (e: React.PointerEvent<HTMLDivElement>) => {
|
|
138
|
+
if (!dragging) return;
|
|
139
|
+
try {
|
|
140
|
+
e.currentTarget.releasePointerCapture?.(e.pointerId);
|
|
141
|
+
} catch {
|
|
142
|
+
/* pointer already released */
|
|
143
|
+
}
|
|
144
|
+
endDrag(true);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const onHandlePointerCancel = () => {
|
|
148
|
+
if (!dragging) return;
|
|
149
|
+
endDrag(false);
|
|
150
|
+
};
|
|
151
|
+
|
|
91
152
|
const state = open ? "open" : "closed";
|
|
92
153
|
const hasTitle = title !== undefined && title !== null;
|
|
93
154
|
|
|
155
|
+
const sideClasses = isBottom
|
|
156
|
+
? "inset-x-0 bottom-0 w-full rounded-t-xl border-t border-hairline shadow-card data-[state=open]:translate-y-0 data-[state=closed]:translate-y-full"
|
|
157
|
+
: side === "right"
|
|
158
|
+
? "inset-y-0 right-0 w-full border-l border-hairline shadow-modal sm:w-[var(--container-drawer,448px)] data-[state=open]:translate-x-0 data-[state=closed]:translate-x-full"
|
|
159
|
+
: "inset-y-0 left-0 w-full border-r border-hairline shadow-modal sm:w-[var(--container-drawer,448px)] data-[state=open]:translate-x-0 data-[state=closed]:-translate-x-full";
|
|
160
|
+
|
|
161
|
+
/** Scrim opacity tracks the drag one-to-one, then hands back to the state fade. */
|
|
162
|
+
const scrimDragOpacity = dragging
|
|
163
|
+
? Math.max(0, 1 - dragOffset / Math.max(dragHeight.current, 1))
|
|
164
|
+
: undefined;
|
|
165
|
+
|
|
94
166
|
const node = (
|
|
95
167
|
<div
|
|
96
168
|
data-state={state}
|
|
97
|
-
className="fixed inset-0 data-[state=closed]:pointer-events-none"
|
|
169
|
+
className="fixed inset-0 overflow-hidden data-[state=closed]:pointer-events-none"
|
|
98
170
|
style={{ zIndex: "var(--z-modal, 1200)" }}
|
|
99
171
|
aria-hidden={open ? undefined : true}
|
|
100
172
|
>
|
|
101
173
|
<div
|
|
102
174
|
data-state={state}
|
|
103
175
|
aria-hidden="true"
|
|
104
|
-
className=
|
|
176
|
+
className={cn(
|
|
177
|
+
dragging ? "transition-none" : "transition-opacity duration-200 ease-out",
|
|
178
|
+
"fixed inset-0 bg-scrim/40 data-[state=open]:opacity-100 data-[state=closed]:opacity-0",
|
|
179
|
+
)}
|
|
180
|
+
style={scrimDragOpacity === undefined ? undefined : { opacity: scrimDragOpacity }}
|
|
105
181
|
/>
|
|
106
182
|
<div
|
|
107
183
|
ref={(el) => {
|
|
@@ -117,17 +193,40 @@ export const Drawer = React.forwardRef<HTMLDivElement, DrawerProps>(
|
|
|
117
193
|
data-side={side}
|
|
118
194
|
data-drawer=""
|
|
119
195
|
className={cn(
|
|
120
|
-
"fixed
|
|
121
|
-
|
|
122
|
-
? "right-0 border-l border-hairline data-[state=closed]:translate-x-full"
|
|
123
|
-
: "left-0 border-r border-hairline data-[state=closed]:-translate-x-full",
|
|
124
|
-
"data-[state=open]:translate-x-0 data-[state=closed]:invisible",
|
|
196
|
+
"fixed flex flex-col overflow-hidden bg-canvas text-ink transition ease-out data-[state=closed]:invisible",
|
|
197
|
+
sideClasses,
|
|
125
198
|
className,
|
|
126
199
|
)}
|
|
200
|
+
style={{
|
|
201
|
+
maxHeight: isBottom ? "90dvh" : undefined,
|
|
202
|
+
paddingBottom: isBottom ? "env(safe-area-inset-bottom, 0px)" : undefined,
|
|
203
|
+
transform:
|
|
204
|
+
isBottom && dragging && dragOffset > 0
|
|
205
|
+
? `translateY(${dragOffset}px)`
|
|
206
|
+
: undefined,
|
|
207
|
+
transitionDuration: dragging ? "0ms" : "240ms",
|
|
208
|
+
}}
|
|
127
209
|
{...rest}
|
|
128
210
|
>
|
|
211
|
+
{isBottom && showHandle && (
|
|
212
|
+
<div
|
|
213
|
+
aria-hidden="true"
|
|
214
|
+
onPointerDown={onHandlePointerDown}
|
|
215
|
+
onPointerMove={onHandlePointerMove}
|
|
216
|
+
onPointerUp={onHandlePointerUp}
|
|
217
|
+
onPointerCancel={onHandlePointerCancel}
|
|
218
|
+
className="flex shrink-0 cursor-grab touch-none select-none items-center justify-center pb-xs pt-sm active:cursor-grabbing"
|
|
219
|
+
>
|
|
220
|
+
<span className="h-1 w-10 rounded-full bg-hairline-strong" />
|
|
221
|
+
</div>
|
|
222
|
+
)}
|
|
129
223
|
{!hideHeader && (
|
|
130
|
-
<div
|
|
224
|
+
<div
|
|
225
|
+
className={cn(
|
|
226
|
+
"flex shrink-0 items-center justify-between gap-sm px-base pb-sm",
|
|
227
|
+
isBottom ? "pt-xs" : "pt-base",
|
|
228
|
+
)}
|
|
229
|
+
>
|
|
131
230
|
<div className="flex min-w-0 flex-1 items-center gap-sm">
|
|
132
231
|
{headerStart}
|
|
133
232
|
{hasTitle && (
|
|
@@ -8,6 +8,7 @@ import { Avatar } from "../Avatar";
|
|
|
8
8
|
import { Input } from "../Input";
|
|
9
9
|
import { Dropdown } from "../Dropdown";
|
|
10
10
|
import { DatePickerInput } from "../DatePickerInput";
|
|
11
|
+
import { MenuItem } from "../MenuItem";
|
|
11
12
|
|
|
12
13
|
const NAV: Array<{ label: string; icon: IconName }> = [
|
|
13
14
|
{ label: "Inbox", icon: "inbox" },
|
|
@@ -16,14 +17,23 @@ const NAV: Array<{ label: string; icon: IconName }> = [
|
|
|
16
17
|
{ label: "Views", icon: "layers" },
|
|
17
18
|
];
|
|
18
19
|
|
|
20
|
+
const PROJECT_ACTIONS: Array<{ label: string; icon: IconName }> = [
|
|
21
|
+
{ label: "Open project", icon: "box" },
|
|
22
|
+
{ label: "Project settings", icon: "settings" },
|
|
23
|
+
{ label: "Share project", icon: "users" },
|
|
24
|
+
{ label: "Archive project", icon: "archive" },
|
|
25
|
+
];
|
|
26
|
+
|
|
19
27
|
export default function DrawerPreview() {
|
|
20
28
|
const [navOpen, setNavOpen] = React.useState(false);
|
|
21
29
|
const [issueOpen, setIssueOpen] = React.useState(false);
|
|
30
|
+
const [sheetOpen, setSheetOpen] = React.useState(false);
|
|
22
31
|
const [active, setActive] = React.useState("Inbox");
|
|
23
32
|
const [title, setTitle] = React.useState("Create a habit tracker");
|
|
24
33
|
const [assignee, setAssignee] = React.useState<string | null>("me");
|
|
25
34
|
const [status, setStatus] = React.useState<string | null>("backlog");
|
|
26
35
|
const [due, setDue] = React.useState<Date | null>(new Date(2026, 2, 30));
|
|
36
|
+
const [lastAction, setLastAction] = React.useState<string | null>(null);
|
|
27
37
|
|
|
28
38
|
return (
|
|
29
39
|
<div className="w-full max-w-3xl mx-auto p-lg">
|
|
@@ -47,6 +57,23 @@ export default function DrawerPreview() {
|
|
|
47
57
|
</Button>
|
|
48
58
|
</div>
|
|
49
59
|
|
|
60
|
+
<div className="mt-md flex flex-wrap items-center justify-between gap-md rounded-xl border border-hairline bg-surface p-base">
|
|
61
|
+
<div className="min-w-0">
|
|
62
|
+
<p className="text-body-md text-ink">Habit tracker</p>
|
|
63
|
+
<p className="text-body-sm text-muted">
|
|
64
|
+
{lastAction ? `Last action: ${lastAction}` : "Bottom sheet project menu, drag the handle to dismiss"}
|
|
65
|
+
</p>
|
|
66
|
+
</div>
|
|
67
|
+
<Button
|
|
68
|
+
variant="secondary"
|
|
69
|
+
leadingIcon={<Icon name="ellipsis" size={16} />}
|
|
70
|
+
aria-expanded={sheetOpen}
|
|
71
|
+
onClick={() => setSheetOpen(true)}
|
|
72
|
+
>
|
|
73
|
+
Project actions
|
|
74
|
+
</Button>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
50
77
|
<Drawer
|
|
51
78
|
open={navOpen}
|
|
52
79
|
onOpenChange={setNavOpen}
|
|
@@ -134,6 +161,41 @@ export default function DrawerPreview() {
|
|
|
134
161
|
<DatePickerInput aria-label="Due date" value={due} onValueChange={setDue} />
|
|
135
162
|
</div>
|
|
136
163
|
</Drawer>
|
|
164
|
+
|
|
165
|
+
<Drawer
|
|
166
|
+
open={sheetOpen}
|
|
167
|
+
onOpenChange={setSheetOpen}
|
|
168
|
+
side="bottom"
|
|
169
|
+
aria-label="Project actions"
|
|
170
|
+
closeLabel="Dismiss project actions"
|
|
171
|
+
headerStart={
|
|
172
|
+
<div className="flex min-w-0 flex-col">
|
|
173
|
+
<span className="truncate text-body-md text-ink">Habit tracker</span>
|
|
174
|
+
<span className="truncate text-body-sm text-muted">4 actions available</span>
|
|
175
|
+
</div>
|
|
176
|
+
}
|
|
177
|
+
bodyClassName="px-xs pb-xs pt-0"
|
|
178
|
+
>
|
|
179
|
+
<div
|
|
180
|
+
role="menu"
|
|
181
|
+
aria-label="Project actions"
|
|
182
|
+
className="flex flex-col gap-xxs"
|
|
183
|
+
>
|
|
184
|
+
{PROJECT_ACTIONS.map((action) => (
|
|
185
|
+
<MenuItem
|
|
186
|
+
key={action.label}
|
|
187
|
+
icon={action.icon}
|
|
188
|
+
className="h-11"
|
|
189
|
+
onClick={() => {
|
|
190
|
+
setLastAction(action.label);
|
|
191
|
+
setSheetOpen(false);
|
|
192
|
+
}}
|
|
193
|
+
>
|
|
194
|
+
{action.label}
|
|
195
|
+
</MenuItem>
|
|
196
|
+
))}
|
|
197
|
+
</div>
|
|
198
|
+
</Drawer>
|
|
137
199
|
</div>
|
|
138
200
|
);
|
|
139
201
|
}
|