@m3000/market 0.0.1
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/LICENSE +21 -0
- package/dist/components/blocks/auction/Auction.d.ts +49 -0
- package/dist/components/blocks/auction/Auction.js +44 -0
- package/dist/components/blocks/auction/AuctionBidForm.d.ts +11 -0
- package/dist/components/blocks/auction/AuctionBidForm.js +88 -0
- package/dist/components/blocks/auction/AuctionBidInput.d.ts +9 -0
- package/dist/components/blocks/auction/AuctionBidInput.js +99 -0
- package/dist/components/blocks/auction/AuctionContext.d.ts +71 -0
- package/dist/components/blocks/auction/AuctionContext.js +228 -0
- package/dist/components/blocks/auction/AuctionInfo.d.ts +9 -0
- package/dist/components/blocks/auction/AuctionInfo.js +37 -0
- package/dist/components/blocks/auction/AuctionLayout.d.ts +63 -0
- package/dist/components/blocks/auction/AuctionLayout.js +80 -0
- package/dist/components/blocks/auction/AuctionRankings.d.ts +16 -0
- package/dist/components/blocks/auction/AuctionRankings.js +334 -0
- package/dist/components/blocks/auction/AuctionStatusTag.d.ts +15 -0
- package/dist/components/blocks/auction/AuctionStatusTag.js +60 -0
- package/dist/components/blocks/auction/AuctionSuggestedBids.d.ts +38 -0
- package/dist/components/blocks/auction/AuctionSuggestedBids.js +116 -0
- package/dist/components/blocks/auction/AuctionYourBidCard.d.ts +27 -0
- package/dist/components/blocks/auction/AuctionYourBidCard.js +94 -0
- package/dist/components/blocks/auction/AuctionYourBids.d.ts +9 -0
- package/dist/components/blocks/auction/AuctionYourBids.js +49 -0
- package/dist/components/blocks/auction/index.d.ts +12 -0
- package/dist/components/blocks/index.d.ts +12 -0
- package/dist/components/index.d.ts +28 -0
- package/dist/components/primitives/Button.d.ts +31 -0
- package/dist/components/primitives/Button.js +117 -0
- package/dist/components/primitives/Drawer.d.ts +43 -0
- package/dist/components/primitives/Drawer.js +51 -0
- package/dist/components/primitives/Feedback.d.ts +28 -0
- package/dist/components/primitives/Feedback.js +147 -0
- package/dist/components/primitives/MorphDialog.d.ts +39 -0
- package/dist/components/primitives/MorphDialog.js +87 -0
- package/dist/components/primitives/Price.d.ts +84 -0
- package/dist/components/primitives/Price.js +255 -0
- package/dist/components/primitives/PriceInput.d.ts +33 -0
- package/dist/components/primitives/PriceInput.js +25 -0
- package/dist/components/primitives/Receipt.d.ts +164 -0
- package/dist/components/primitives/Receipt.js +344 -0
- package/dist/components/primitives/Scale.d.ts +67 -0
- package/dist/components/primitives/Scale.js +132 -0
- package/dist/components/primitives/Separator.d.ts +22 -0
- package/dist/components/primitives/Separator.js +62 -0
- package/dist/components/primitives/Skeleton.d.ts +14 -0
- package/dist/components/primitives/Skeleton.js +20 -0
- package/dist/components/primitives/SteppedInput.d.ts +94 -0
- package/dist/components/primitives/SteppedInput.js +154 -0
- package/dist/components/primitives/Tabs.d.ts +37 -0
- package/dist/components/primitives/Tabs.js +99 -0
- package/dist/components/primitives/Tag.d.ts +24 -0
- package/dist/components/primitives/Tag.js +22 -0
- package/dist/components/primitives/Text.d.ts +32 -0
- package/dist/components/primitives/Text.js +65 -0
- package/dist/components/primitives/countdown/Countdown.d.ts +24 -0
- package/dist/components/primitives/countdown/Countdown.js +22 -0
- package/dist/components/primitives/framed-image/FramedImage.d.ts +13 -0
- package/dist/components/primitives/framed-image/FramedImage.js +37 -0
- package/dist/components/primitives/index.d.ts +17 -0
- package/dist/components/primitives/ranked-list/Ranking.d.ts +117 -0
- package/dist/components/primitives/ranked-list/Ranking.js +219 -0
- package/dist/components/primitives/ranked-list/index.d.ts +1 -0
- package/dist/hooks/useCountdown.d.ts +20 -0
- package/dist/hooks/useCountdown.js +75 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +36 -0
- package/dist/lib/cn.d.ts +6 -0
- package/dist/lib/cn.js +75 -0
- package/dist/lib/motion.d.ts +19 -0
- package/dist/lib/motion.js +43 -0
- package/dist/types/index.d.ts +120 -0
- package/dist/utils/format.d.ts +38 -0
- package/dist/utils/format.js +103 -0
- package/dist/utils/rank-utils.d.ts +34 -0
- package/dist/utils/rank-utils.js +80 -0
- package/dist/utils/tick-validation.d.ts +22 -0
- package/dist/utils/tick-validation.js +40 -0
- package/package.json +92 -0
- package/src/components/blocks/auction/Auction.tsx +74 -0
- package/src/components/blocks/auction/AuctionArtwork.tsx +4 -0
- package/src/components/blocks/auction/AuctionBidForm.tsx +138 -0
- package/src/components/blocks/auction/AuctionBidInput.tsx +166 -0
- package/src/components/blocks/auction/AuctionContext.tsx +401 -0
- package/src/components/blocks/auction/AuctionInfo.tsx +36 -0
- package/src/components/blocks/auction/AuctionLayout.tsx +200 -0
- package/src/components/blocks/auction/AuctionRankings.tsx +435 -0
- package/src/components/blocks/auction/AuctionStatusTag.tsx +98 -0
- package/src/components/blocks/auction/AuctionSuggestedBids.tsx +203 -0
- package/src/components/blocks/auction/AuctionYourBidCard.tsx +125 -0
- package/src/components/blocks/auction/AuctionYourBids.tsx +61 -0
- package/src/components/blocks/auction/index.ts +42 -0
- package/src/components/blocks/index.ts +1 -0
- package/src/components/index.ts +2 -0
- package/src/components/primitives/Button.tsx +183 -0
- package/src/components/primitives/Drawer.tsx +125 -0
- package/src/components/primitives/Feedback.tsx +185 -0
- package/src/components/primitives/MorphDialog.tsx +160 -0
- package/src/components/primitives/Price.tsx +394 -0
- package/src/components/primitives/PriceInput.tsx +48 -0
- package/src/components/primitives/Receipt.tsx +711 -0
- package/src/components/primitives/Scale.tsx +287 -0
- package/src/components/primitives/Separator.tsx +87 -0
- package/src/components/primitives/Skeleton.tsx +33 -0
- package/src/components/primitives/SteppedInput.tsx +313 -0
- package/src/components/primitives/Tabs.tsx +161 -0
- package/src/components/primitives/Tag.tsx +48 -0
- package/src/components/primitives/Text.tsx +102 -0
- package/src/components/primitives/countdown/Countdown.tsx +43 -0
- package/src/components/primitives/countdown/index.ts +2 -0
- package/src/components/primitives/framed-image/FramedImage.tsx +51 -0
- package/src/components/primitives/framed-image/index.ts +1 -0
- package/src/components/primitives/index.ts +42 -0
- package/src/components/primitives/ranked-list/RankedList.tsx +9 -0
- package/src/components/primitives/ranked-list/Ranking.tsx +454 -0
- package/src/components/primitives/ranked-list/index.ts +8 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useCountdown.ts +91 -0
- package/src/index.ts +130 -0
- package/src/lib/cn.ts +81 -0
- package/src/lib/index.ts +2 -0
- package/src/lib/motion.ts +55 -0
- package/src/public/lea-83-time-walk.png +0 -0
- package/src/public/lea-83-time-walk.webp +0 -0
- package/src/stories/Auction.stories.tsx +658 -0
- package/src/stories/AuctionLayout.stories.tsx +313 -0
- package/src/stories/AuctionStatusTag.stories.tsx +166 -0
- package/src/stories/AuctionYourBidCard.stories.tsx +257 -0
- package/src/stories/Button.stories.tsx +306 -0
- package/src/stories/Countdown.stories.tsx +158 -0
- package/src/stories/Feedback.stories.tsx +80 -0
- package/src/stories/FramedImage.stories.tsx +46 -0
- package/src/stories/MorphDialog.stories.tsx +88 -0
- package/src/stories/Price.stories.tsx +292 -0
- package/src/stories/RankedList.stories.tsx +190 -0
- package/src/stories/Receipt.stories.tsx +221 -0
- package/src/stories/Scale.stories.tsx +578 -0
- package/src/stories/Separator.stories.tsx +188 -0
- package/src/stories/Skeleton.stories.tsx +138 -0
- package/src/stories/SteppedInput.stories.tsx +321 -0
- package/src/stories/Tabs.stories.tsx +215 -0
- package/src/stories/Tag.stories.tsx +138 -0
- package/src/stories/Text.stories.tsx +245 -0
- package/src/styles/globals.css +39 -0
- package/src/styles/index.css +4 -0
- package/src/styles/theme/animation.css +11 -0
- package/src/styles/theme/color.css +185 -0
- package/src/styles/theme/index.css +3 -0
- package/src/styles/theme/typography.css +3 -0
- package/src/styles/utility.css +8 -0
- package/src/types/index.ts +149 -0
- package/src/utils/format.ts +130 -0
- package/src/utils/index.ts +16 -0
- package/src/utils/rank-utils.ts +131 -0
- package/src/utils/tick-validation.ts +65 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { getProjectedRankForPrice } from "../../../utils/rank-utils.js";
|
|
4
|
+
import { useAuctionContext } from "./AuctionContext.js";
|
|
5
|
+
import { cn } from "../../../lib/cn.js";
|
|
6
|
+
import { Button } from "../../primitives/Button.js";
|
|
7
|
+
import { Text } from "../../primitives/Text.js";
|
|
8
|
+
import { Scale } from "../../primitives/Scale.js";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
|
|
12
|
+
//#region src/components/blocks/auction/AuctionSuggestedBids.tsx
|
|
13
|
+
const SuggestedBidContext = React.createContext(null);
|
|
14
|
+
function useSuggestedBid() {
|
|
15
|
+
const context = React.useContext(SuggestedBidContext);
|
|
16
|
+
if (!context) throw new Error("useSuggestedBid must be used within AuctionSuggestedBids.Item");
|
|
17
|
+
return context;
|
|
18
|
+
}
|
|
19
|
+
function AuctionSuggestedBidsRoot({ className, count = 4, children }) {
|
|
20
|
+
const { minBidValue, tickConfig, tickSize, isAuctionEnded, bidValue, setBidValue, formatPrice, currencySymbol, bids, setShowBidPreview, lockedBid, userBids, mergedForRank, maxTotalItems } = useAuctionContext();
|
|
21
|
+
const lockedBidId = React.useMemo(() => {
|
|
22
|
+
if (lockedBid === null) return null;
|
|
23
|
+
return userBids.find((ub) => ub.globalBidId === lockedBid.bidId)?.id ?? null;
|
|
24
|
+
}, [lockedBid, userBids]);
|
|
25
|
+
const bidsForRankProjection = React.useMemo(() => {
|
|
26
|
+
if (lockedBidId === null) return mergedForRank;
|
|
27
|
+
return mergedForRank.filter((b) => b.id !== lockedBidId);
|
|
28
|
+
}, [mergedForRank, lockedBidId]);
|
|
29
|
+
const getProjectedRank = React.useCallback((priceValue) => {
|
|
30
|
+
return getProjectedRankForPrice(priceValue, bidsForRankProjection, maxTotalItems);
|
|
31
|
+
}, [bidsForRankProjection, maxTotalItems]);
|
|
32
|
+
if (isAuctionEnded) return null;
|
|
33
|
+
const getTickSize = (value) => {
|
|
34
|
+
if (!tickConfig) return tickSize;
|
|
35
|
+
return value > tickConfig.threshold ? tickConfig.largeTickSize : tickConfig.smallTickSize;
|
|
36
|
+
};
|
|
37
|
+
const effectiveMinBid = lockedBid !== null && lockedBid.priceValue > minBidValue ? lockedBid.priceValue : minBidValue;
|
|
38
|
+
const highestBid = bids.length > 0 ? BigInt(bids[0].price) : effectiveMinBid * 3n;
|
|
39
|
+
const leadingBid = highestBid + getTickSize(highestBid);
|
|
40
|
+
const maxBid = leadingBid > effectiveMinBid ? leadingBid : effectiveMinBid * 3n;
|
|
41
|
+
const selectedValue = bidValue;
|
|
42
|
+
const disabled = isAuctionEnded;
|
|
43
|
+
return /* @__PURE__ */ jsx(Scale.Linear, {
|
|
44
|
+
domain: [effectiveMinBid, maxBid],
|
|
45
|
+
getTickSize,
|
|
46
|
+
snapMode: "up",
|
|
47
|
+
className: cn("grid grid-cols-2 gap-2", className),
|
|
48
|
+
children: /* @__PURE__ */ jsx(Scale.Ticks, {
|
|
49
|
+
count,
|
|
50
|
+
children: ({ value, position }, index) => {
|
|
51
|
+
const v = value;
|
|
52
|
+
const display = `${formatPrice(v)} ${currencySymbol}`;
|
|
53
|
+
const isSelected = v === selectedValue;
|
|
54
|
+
const { rank: projectedRank, isWinning } = getProjectedRank(v);
|
|
55
|
+
const contextValue = {
|
|
56
|
+
value: v,
|
|
57
|
+
display,
|
|
58
|
+
position,
|
|
59
|
+
index,
|
|
60
|
+
isSelected,
|
|
61
|
+
onSelect: () => {
|
|
62
|
+
setBidValue(v);
|
|
63
|
+
setShowBidPreview(true);
|
|
64
|
+
},
|
|
65
|
+
disabled,
|
|
66
|
+
projectedRank,
|
|
67
|
+
isWinning
|
|
68
|
+
};
|
|
69
|
+
return /* @__PURE__ */ jsx(SuggestedBidContext.Provider, {
|
|
70
|
+
value: contextValue,
|
|
71
|
+
children: children(contextValue)
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function AuctionSuggestedBidsItem({ labels = [
|
|
78
|
+
"Minimum",
|
|
79
|
+
"Safe Entry",
|
|
80
|
+
"Competitive",
|
|
81
|
+
"Leading"
|
|
82
|
+
] }) {
|
|
83
|
+
const context = useSuggestedBid();
|
|
84
|
+
const label = labels[context.index] ?? labels[labels.length - 1] ?? "Bid";
|
|
85
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
86
|
+
type: "button",
|
|
87
|
+
color: "tertiary",
|
|
88
|
+
active: context.isSelected,
|
|
89
|
+
className: "h-auto w-full items-start justify-between gap-2 px-3 py-2.5 text-left",
|
|
90
|
+
disabled: context.disabled,
|
|
91
|
+
onClick: context.onSelect,
|
|
92
|
+
size: "card",
|
|
93
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
94
|
+
className: "flex flex-col",
|
|
95
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
96
|
+
color: "secondary",
|
|
97
|
+
size: "1",
|
|
98
|
+
children: label
|
|
99
|
+
}), /* @__PURE__ */ jsx(Text, { children: context.display })]
|
|
100
|
+
}), context.projectedRank != null && /* @__PURE__ */ jsxs("span", {
|
|
101
|
+
className: "flex shrink-0 flex-col",
|
|
102
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
103
|
+
color: "secondary",
|
|
104
|
+
size: "1",
|
|
105
|
+
children: "Rank"
|
|
106
|
+
}), /* @__PURE__ */ jsxs(Text, { children: ["#", context.projectedRank] })]
|
|
107
|
+
})]
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
const AuctionSuggestedBids = {
|
|
111
|
+
Root: AuctionSuggestedBidsRoot,
|
|
112
|
+
Item: AuctionSuggestedBidsItem
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
//#endregion
|
|
116
|
+
export { AuctionSuggestedBids, useSuggestedBid };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AuctionUserBid } from "../../../types/index.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/blocks/auction/AuctionYourBidCard.d.ts
|
|
4
|
+
interface AuctionYourBidCardProps {
|
|
5
|
+
bid: AuctionUserBid;
|
|
6
|
+
getRankForBid: (bidId: string) => number | null;
|
|
7
|
+
lockedBidId: bigint | null;
|
|
8
|
+
onLockForTopUp: (bidId: bigint, priceValue: bigint) => void;
|
|
9
|
+
onCancelTopUp: () => void;
|
|
10
|
+
isAuctionEnded: boolean;
|
|
11
|
+
onClaim?: (bidId: string) => Promise<boolean>;
|
|
12
|
+
formatPrice?: (priceValue: bigint) => string;
|
|
13
|
+
currencySymbol?: string;
|
|
14
|
+
}
|
|
15
|
+
declare function AuctionYourBidCard({
|
|
16
|
+
bid,
|
|
17
|
+
getRankForBid,
|
|
18
|
+
lockedBidId,
|
|
19
|
+
onLockForTopUp,
|
|
20
|
+
onCancelTopUp,
|
|
21
|
+
isAuctionEnded,
|
|
22
|
+
onClaim,
|
|
23
|
+
formatPrice,
|
|
24
|
+
currencySymbol
|
|
25
|
+
}: AuctionYourBidCardProps): React.ReactElement;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { AuctionYourBidCard, AuctionYourBidCardProps };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { formatDateTime } from "../../../utils/format.js";
|
|
4
|
+
import { cn } from "../../../lib/cn.js";
|
|
5
|
+
import { Button } from "../../primitives/Button.js";
|
|
6
|
+
import { Text } from "../../primitives/Text.js";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/components/blocks/auction/AuctionYourBidCard.tsx
|
|
10
|
+
function getBidStatusLabel(status, isWinning) {
|
|
11
|
+
if (status === "claimed") return "Won & Claimed";
|
|
12
|
+
if (isWinning) return "Winning";
|
|
13
|
+
if (status === "refunded") return "Refunded";
|
|
14
|
+
return "Outbid";
|
|
15
|
+
}
|
|
16
|
+
function AuctionYourBidCard({ bid, getRankForBid, lockedBidId, onLockForTopUp, onCancelTopUp, isAuctionEnded, onClaim, formatPrice = (v) => (Number(v) / 0xde0b6b3a7640000).toLocaleString("en-US", {
|
|
17
|
+
minimumFractionDigits: 3,
|
|
18
|
+
maximumFractionDigits: 3
|
|
19
|
+
}), currencySymbol = "USD" }) {
|
|
20
|
+
const rank = getRankForBid(bid.id);
|
|
21
|
+
const isLocked = lockedBidId !== null && bid.globalBidId === lockedBidId;
|
|
22
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
23
|
+
className: cn("rounded-xs border bg-muted p-4", isLocked ? "border-success" : "border-transparent"),
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ jsxs("div", {
|
|
26
|
+
className: "flex items-start justify-between gap-2",
|
|
27
|
+
children: [/* @__PURE__ */ jsxs(Text, {
|
|
28
|
+
size: "1",
|
|
29
|
+
color: "tertiary",
|
|
30
|
+
children: ["Rank #", rank ?? "-"]
|
|
31
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
32
|
+
size: "1",
|
|
33
|
+
color: "tertiary",
|
|
34
|
+
className: "tabular-nums",
|
|
35
|
+
suppressHydrationWarning: true,
|
|
36
|
+
children: formatDateTime(bid.createdAt)
|
|
37
|
+
})]
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ jsxs("div", {
|
|
40
|
+
className: "flex justify-between",
|
|
41
|
+
children: [/* @__PURE__ */ jsxs(Text, {
|
|
42
|
+
size: "2",
|
|
43
|
+
className: "mt-2",
|
|
44
|
+
children: [
|
|
45
|
+
formatPrice(bid.price),
|
|
46
|
+
" ",
|
|
47
|
+
currencySymbol
|
|
48
|
+
]
|
|
49
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
50
|
+
className: "mt-2 flex items-center gap-1.5",
|
|
51
|
+
children: bid.isWinning ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
52
|
+
className: "size-4 rounded-full bg-success",
|
|
53
|
+
"aria-hidden": true
|
|
54
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
55
|
+
size: "2",
|
|
56
|
+
color: "success",
|
|
57
|
+
children: getBidStatusLabel(bid.status, bid.isWinning)
|
|
58
|
+
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
59
|
+
className: "size-4 rounded-full bg-destructive",
|
|
60
|
+
"aria-hidden": true
|
|
61
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
62
|
+
size: "2",
|
|
63
|
+
color: "error",
|
|
64
|
+
children: getBidStatusLabel(bid.status, bid.isWinning)
|
|
65
|
+
})] })
|
|
66
|
+
})]
|
|
67
|
+
}),
|
|
68
|
+
bid.status === "claimed" ? /* @__PURE__ */ jsxs(Text, {
|
|
69
|
+
size: "1",
|
|
70
|
+
color: "tertiary",
|
|
71
|
+
className: "mt-2",
|
|
72
|
+
suppressHydrationWarning: true,
|
|
73
|
+
children: ["Claimed ", bid.claimedAt ? formatDateTime(bid.claimedAt) : ""]
|
|
74
|
+
}) : bid.isWinning && bid.status === "active" && onClaim ? /* @__PURE__ */ jsx(Button, {
|
|
75
|
+
color: "secondary",
|
|
76
|
+
className: "mt-3 w-full",
|
|
77
|
+
onClick: () => onClaim(bid.id),
|
|
78
|
+
children: "Claim"
|
|
79
|
+
}) : null,
|
|
80
|
+
bid.isWinning && !isAuctionEnded ? /* @__PURE__ */ jsx("div", {
|
|
81
|
+
className: "mt-3",
|
|
82
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
83
|
+
color: "secondary",
|
|
84
|
+
className: "w-full",
|
|
85
|
+
onClick: () => isLocked ? onCancelTopUp() : onLockForTopUp(bid.globalBidId, bid.price),
|
|
86
|
+
children: isLocked ? "Cancel top-up" : "Top up"
|
|
87
|
+
})
|
|
88
|
+
}) : null
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
export { AuctionYourBidCard };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/components/blocks/auction/AuctionYourBids.d.ts
|
|
2
|
+
interface AuctionYourBidsProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
}
|
|
5
|
+
declare function AuctionYourBids({
|
|
6
|
+
className
|
|
7
|
+
}: AuctionYourBidsProps): React.ReactElement | null;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { AuctionYourBids, AuctionYourBidsProps };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useAuctionContext } from "./AuctionContext.js";
|
|
4
|
+
import { Text } from "../../primitives/Text.js";
|
|
5
|
+
import { AuctionYourBidCard } from "./AuctionYourBidCard.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/components/blocks/auction/AuctionYourBids.tsx
|
|
9
|
+
function AuctionYourBids({ className }) {
|
|
10
|
+
const { userBids, getRankForBid, lockedBid, setLockedBid, isAuctionEnded, handleClaimEdition, formatPrice, currencySymbol } = useAuctionContext();
|
|
11
|
+
if (userBids.length === 0) return null;
|
|
12
|
+
const onLockForTopUp = (bidId, priceValue) => {
|
|
13
|
+
setLockedBid({
|
|
14
|
+
bidId,
|
|
15
|
+
priceValue
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const onCancelTopUp = () => setLockedBid(null);
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
20
|
+
className,
|
|
21
|
+
children: [/* @__PURE__ */ jsxs(Text, {
|
|
22
|
+
as: "h3",
|
|
23
|
+
color: "tertiary",
|
|
24
|
+
className: "mb-3 shrink-0",
|
|
25
|
+
"aria-label": `Your Bids (${userBids.length})`,
|
|
26
|
+
children: [
|
|
27
|
+
"Your Bids (",
|
|
28
|
+
userBids.length,
|
|
29
|
+
")"
|
|
30
|
+
]
|
|
31
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
32
|
+
className: "-mr-1 min-h-0 flex-1 space-y-3 overflow-y-auto py-1 pr-1",
|
|
33
|
+
children: userBids.map((bid) => /* @__PURE__ */ jsx(AuctionYourBidCard, {
|
|
34
|
+
bid,
|
|
35
|
+
getRankForBid,
|
|
36
|
+
lockedBidId: lockedBid?.bidId ?? null,
|
|
37
|
+
onLockForTopUp,
|
|
38
|
+
onCancelTopUp,
|
|
39
|
+
isAuctionEnded,
|
|
40
|
+
onClaim: handleClaimEdition,
|
|
41
|
+
formatPrice,
|
|
42
|
+
currencySymbol
|
|
43
|
+
}, bid.id))
|
|
44
|
+
})]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { AuctionYourBids };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AuctionProvider, AuctionProviderProps, useAuctionContext } from "./AuctionContext.js";
|
|
2
|
+
import { Auction, AuctionProps } from "./Auction.js";
|
|
3
|
+
import { FramedImage, FramedImageProps } from "../../primitives/framed-image/FramedImage.js";
|
|
4
|
+
import { AuctionBidForm } from "./AuctionBidForm.js";
|
|
5
|
+
import { AuctionBidInput, AuctionBidInputProps } from "./AuctionBidInput.js";
|
|
6
|
+
import { AuctionInfo, AuctionInfoProps } from "./AuctionInfo.js";
|
|
7
|
+
import { AuctionBiddingPanel, AuctionBiddingPanelProps, AuctionDetails, AuctionDetailsBody, AuctionDetailsBodyProps, AuctionDetailsFooter, AuctionDetailsFooterProps, AuctionDetailsHeader, AuctionDetailsHeaderProps, AuctionDetailsProps, AuctionLayout, AuctionLayoutProps, AuctionRankingsContainer, AuctionRankingsContainerProps } from "./AuctionLayout.js";
|
|
8
|
+
import { AuctionRankings, AuctionRankingsProps, RankingsSkeleton } from "./AuctionRankings.js";
|
|
9
|
+
import { AuctionStatusTag, AuctionStatusTagProps } from "./AuctionStatusTag.js";
|
|
10
|
+
import { AuctionSuggestedBids, AuctionSuggestedBidsProps, SuggestedBidContextValue, useSuggestedBid } from "./AuctionSuggestedBids.js";
|
|
11
|
+
import { AuctionYourBidCard, AuctionYourBidCardProps } from "./AuctionYourBidCard.js";
|
|
12
|
+
import { AuctionYourBids, AuctionYourBidsProps } from "./AuctionYourBids.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AuctionProvider, AuctionProviderProps, useAuctionContext } from "./auction/AuctionContext.js";
|
|
2
|
+
import { Auction, AuctionProps } from "./auction/Auction.js";
|
|
3
|
+
import { FramedImage, FramedImageProps } from "../primitives/framed-image/FramedImage.js";
|
|
4
|
+
import { AuctionBidForm } from "./auction/AuctionBidForm.js";
|
|
5
|
+
import { AuctionBidInput, AuctionBidInputProps } from "./auction/AuctionBidInput.js";
|
|
6
|
+
import { AuctionInfo, AuctionInfoProps } from "./auction/AuctionInfo.js";
|
|
7
|
+
import { AuctionBiddingPanel, AuctionBiddingPanelProps, AuctionDetails, AuctionDetailsBody, AuctionDetailsBodyProps, AuctionDetailsFooter, AuctionDetailsFooterProps, AuctionDetailsHeader, AuctionDetailsHeaderProps, AuctionDetailsProps, AuctionLayout, AuctionLayoutProps, AuctionRankingsContainer, AuctionRankingsContainerProps } from "./auction/AuctionLayout.js";
|
|
8
|
+
import { AuctionRankings, AuctionRankingsProps, RankingsSkeleton } from "./auction/AuctionRankings.js";
|
|
9
|
+
import { AuctionStatusTag, AuctionStatusTagProps } from "./auction/AuctionStatusTag.js";
|
|
10
|
+
import { AuctionSuggestedBids, AuctionSuggestedBidsProps, SuggestedBidContextValue, useSuggestedBid } from "./auction/AuctionSuggestedBids.js";
|
|
11
|
+
import { AuctionYourBidCard, AuctionYourBidCardProps } from "./auction/AuctionYourBidCard.js";
|
|
12
|
+
import { AuctionYourBids, AuctionYourBidsProps } from "./auction/AuctionYourBids.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AuctionProvider, AuctionProviderProps, useAuctionContext } from "./blocks/auction/AuctionContext.js";
|
|
2
|
+
import { Auction, AuctionProps } from "./blocks/auction/Auction.js";
|
|
3
|
+
import { FramedImage, FramedImageProps } from "./primitives/framed-image/FramedImage.js";
|
|
4
|
+
import { AuctionBidForm } from "./blocks/auction/AuctionBidForm.js";
|
|
5
|
+
import { AuctionBidInput, AuctionBidInputProps } from "./blocks/auction/AuctionBidInput.js";
|
|
6
|
+
import { AuctionInfo, AuctionInfoProps } from "./blocks/auction/AuctionInfo.js";
|
|
7
|
+
import { AuctionBiddingPanel, AuctionBiddingPanelProps, AuctionDetails, AuctionDetailsBody, AuctionDetailsBodyProps, AuctionDetailsFooter, AuctionDetailsFooterProps, AuctionDetailsHeader, AuctionDetailsHeaderProps, AuctionDetailsProps, AuctionLayout, AuctionLayoutProps, AuctionRankingsContainer, AuctionRankingsContainerProps } from "./blocks/auction/AuctionLayout.js";
|
|
8
|
+
import { Button, ButtonElement, ButtonProps, buttonVariants } from "./primitives/Button.js";
|
|
9
|
+
import { Countdown, CountdownProps } from "./primitives/countdown/Countdown.js";
|
|
10
|
+
import { Drawer, DrawerProps } from "./primitives/Drawer.js";
|
|
11
|
+
import { Feedback } from "./primitives/Feedback.js";
|
|
12
|
+
import { MorphDialog, MorphDialogProps } from "./primitives/MorphDialog.js";
|
|
13
|
+
import { FormatPriceOptions, Price, PriceProps, PriceSymbolProps, PriceValueProps, formatPrice } from "./primitives/Price.js";
|
|
14
|
+
import { CursorGrowIcon, SteppedInput } from "./primitives/SteppedInput.js";
|
|
15
|
+
import { PriceInput } from "./primitives/PriceInput.js";
|
|
16
|
+
import { Separator } from "./primitives/Separator.js";
|
|
17
|
+
import { Receipt, ReceiptDiscountProps, ReceiptFeeProps, ReceiptFooterProps, ReceiptHeaderProps, ReceiptItemProps, ReceiptPriceProps, ReceiptProps, ReceiptSeparatorProps, ReceiptSubtotalProps, ReceiptTaxProps, ReceiptTotalProps } from "./primitives/Receipt.js";
|
|
18
|
+
import { GroupItemContextValue, RankedList, RankedListProps, Ranking, RankingProps, SlotContext, SlotProps } from "./primitives/ranked-list/Ranking.js";
|
|
19
|
+
import { Scale, ScaleValue, SnapMode, TickContext, useScale } from "./primitives/Scale.js";
|
|
20
|
+
import { Skeleton, SkeletonElement, SkeletonProps } from "./primitives/Skeleton.js";
|
|
21
|
+
import { Tab, Tabs, TabsContextType, TabsIndicator, TabsList, TabsPanel } from "./primitives/Tabs.js";
|
|
22
|
+
import { Text, TextElement, TextProps, textVariants } from "./primitives/Text.js";
|
|
23
|
+
import { Tag, TagElement, TagProps } from "./primitives/Tag.js";
|
|
24
|
+
import { AuctionRankings, AuctionRankingsProps, RankingsSkeleton } from "./blocks/auction/AuctionRankings.js";
|
|
25
|
+
import { AuctionStatusTag, AuctionStatusTagProps } from "./blocks/auction/AuctionStatusTag.js";
|
|
26
|
+
import { AuctionSuggestedBids, AuctionSuggestedBidsProps, SuggestedBidContextValue, useSuggestedBid } from "./blocks/auction/AuctionSuggestedBids.js";
|
|
27
|
+
import { AuctionYourBidCard, AuctionYourBidCardProps } from "./blocks/auction/AuctionYourBidCard.js";
|
|
28
|
+
import { AuctionYourBids, AuctionYourBidsProps } from "./blocks/auction/AuctionYourBids.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Button } from "@base-ui/react/button";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
|
|
5
|
+
//#region src/components/primitives/Button.d.ts
|
|
6
|
+
type ButtonColor = "primary" | "secondary" | "tertiary" | "ghost" | "destructive" | "link";
|
|
7
|
+
type ButtonSize = "default" | "xs" | "sm" | "lg" | "xl" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | "card";
|
|
8
|
+
interface ButtonVariantProps {
|
|
9
|
+
color?: ButtonColor;
|
|
10
|
+
size?: ButtonSize;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const buttonVariants: (props?: ButtonVariantProps) => string;
|
|
14
|
+
type ButtonVariants = typeof buttonVariants;
|
|
15
|
+
type ButtonProps = React.ComponentProps<typeof Button> & VariantProps<ButtonVariants> & {
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
active?: boolean;
|
|
18
|
+
};
|
|
19
|
+
type ButtonElement = React.ComponentRef<"button">;
|
|
20
|
+
declare function Button$1({
|
|
21
|
+
className,
|
|
22
|
+
color,
|
|
23
|
+
size,
|
|
24
|
+
disabled,
|
|
25
|
+
loading,
|
|
26
|
+
children,
|
|
27
|
+
active,
|
|
28
|
+
...props
|
|
29
|
+
}: ButtonProps): React.ReactElement;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { Button$1 as Button, ButtonElement, ButtonProps, buttonVariants };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "@base-ui/react/button";
|
|
4
|
+
import { IconLoader2 } from "@tabler/icons-react";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
|
|
7
|
+
//#region src/components/primitives/Button.tsx
|
|
8
|
+
const buttonVariants = cva([
|
|
9
|
+
"inline-flex cursor-pointer items-center justify-center gap-1.5",
|
|
10
|
+
"font-sans text-sm leading-none font-medium whitespace-nowrap",
|
|
11
|
+
"shrink-0 select-none",
|
|
12
|
+
"transition-all duration-150 ease-out",
|
|
13
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
14
|
+
"outline-none",
|
|
15
|
+
"focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
16
|
+
"focus-visible:ring-ring focus-visible:ring-offset-background",
|
|
17
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed aria-disabled:pointer-events-none aria-disabled:cursor-not-allowed",
|
|
18
|
+
"aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/30"
|
|
19
|
+
].join(" "), {
|
|
20
|
+
variants: {
|
|
21
|
+
color: {
|
|
22
|
+
primary: [
|
|
23
|
+
"border border-solid",
|
|
24
|
+
"border-primary bg-primary text-primary-foreground",
|
|
25
|
+
"hover:border-primary-hover hover:bg-primary-hover",
|
|
26
|
+
"active:opacity-90",
|
|
27
|
+
"shadow-[0_1px_2px_0_rgb(0,0,0,0.08)]",
|
|
28
|
+
"disabled:opacity-50 aria-disabled:opacity-50"
|
|
29
|
+
].join(" "),
|
|
30
|
+
secondary: [
|
|
31
|
+
"border border-solid",
|
|
32
|
+
"border-border bg-transparent text-foreground",
|
|
33
|
+
"hover:border-input hover:bg-accent",
|
|
34
|
+
"active:border-input active:bg-accent-active",
|
|
35
|
+
"data-[state=active]:border-input data-[state=active]:bg-accent-active",
|
|
36
|
+
"shadow-[0_1px_2px_0_rgb(0,0,0,0.04)]",
|
|
37
|
+
"disabled:opacity-50 aria-disabled:opacity-50"
|
|
38
|
+
].join(" "),
|
|
39
|
+
tertiary: [
|
|
40
|
+
"border border-solid",
|
|
41
|
+
"border-border bg-muted text-muted-foreground",
|
|
42
|
+
"hover:border-input hover:bg-accent-hover hover:text-foreground",
|
|
43
|
+
"active:bg-accent-active active:text-foreground",
|
|
44
|
+
"data-[state=active]:bg-accent-active data-[state=active]:text-foreground",
|
|
45
|
+
"disabled:opacity-50 aria-disabled:opacity-50"
|
|
46
|
+
].join(" "),
|
|
47
|
+
ghost: [
|
|
48
|
+
"border border-transparent bg-transparent",
|
|
49
|
+
"text-muted-foreground",
|
|
50
|
+
"hover:bg-accent hover:text-foreground",
|
|
51
|
+
"active:bg-accent-active active:text-foreground",
|
|
52
|
+
"data-[state=active]:bg-accent-active data-[state=active]:text-foreground",
|
|
53
|
+
"disabled:text-disabled-foreground",
|
|
54
|
+
"aria-disabled:text-disabled-foreground"
|
|
55
|
+
].join(" "),
|
|
56
|
+
destructive: [
|
|
57
|
+
"border border-solid",
|
|
58
|
+
"border-destructive bg-destructive text-destructive-foreground",
|
|
59
|
+
"hover:border-destructive-hover hover:bg-destructive-hover",
|
|
60
|
+
"active:opacity-90",
|
|
61
|
+
"shadow-[0_1px_2px_0_rgb(0,0,0,0.08)]",
|
|
62
|
+
"disabled:opacity-50 aria-disabled:opacity-50"
|
|
63
|
+
].join(" "),
|
|
64
|
+
link: [
|
|
65
|
+
"border-transparent bg-transparent",
|
|
66
|
+
"text-foreground underline-offset-4",
|
|
67
|
+
"hover:underline",
|
|
68
|
+
"h-auto px-0 py-0",
|
|
69
|
+
"disabled:text-disabled-foreground disabled:no-underline",
|
|
70
|
+
"aria-disabled:text-disabled-foreground aria-disabled:no-underline"
|
|
71
|
+
].join(" ")
|
|
72
|
+
},
|
|
73
|
+
size: {
|
|
74
|
+
default: "h-9 rounded-md px-4 py-2 has-[>svg]:px-3",
|
|
75
|
+
xs: "h-6 gap-1 rounded px-2 text-xs has-[>svg]:px-1.5",
|
|
76
|
+
sm: "h-8 gap-1 rounded-md px-3 text-xs has-[>svg]:px-2.5",
|
|
77
|
+
lg: "h-10 rounded-lg px-5 text-[15px] has-[>svg]:px-4",
|
|
78
|
+
xl: "h-12 rounded-lg px-6 text-[15px] font-semibold has-[>svg]:px-5",
|
|
79
|
+
icon: "size-9 rounded-md",
|
|
80
|
+
"icon-xs": "size-6 rounded",
|
|
81
|
+
"icon-sm": "size-8 rounded-md",
|
|
82
|
+
"icon-lg": "size-10 rounded-lg",
|
|
83
|
+
card: "min-h-[4rem] rounded-md px-4 py-3"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
defaultVariants: {
|
|
87
|
+
color: "primary",
|
|
88
|
+
size: "default"
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
function Button$1({ className, color, size, disabled, loading, children, active, ...props }) {
|
|
92
|
+
const _disabled = disabled || loading;
|
|
93
|
+
const _children = loading ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
94
|
+
className: "invisible contents",
|
|
95
|
+
children
|
|
96
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
97
|
+
className: "absolute inset-0 flex items-center justify-center",
|
|
98
|
+
children: /* @__PURE__ */ jsx(IconLoader2, {
|
|
99
|
+
"aria-hidden": true,
|
|
100
|
+
className: "size-4 animate-spin"
|
|
101
|
+
})
|
|
102
|
+
})] }) : children;
|
|
103
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
104
|
+
"data-state": active ? "active" : void 0,
|
|
105
|
+
disabled: _disabled,
|
|
106
|
+
focusableWhenDisabled: true,
|
|
107
|
+
className: cn(buttonVariants({
|
|
108
|
+
color,
|
|
109
|
+
size
|
|
110
|
+
}), { relative: loading }, className),
|
|
111
|
+
...props,
|
|
112
|
+
children: _children
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
//#endregion
|
|
117
|
+
export { Button$1 as Button, buttonVariants };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Drawer } from "@base-ui/react/drawer";
|
|
3
|
+
|
|
4
|
+
//#region src/components/primitives/Drawer.d.ts
|
|
5
|
+
type OpenChangeDetails = Parameters<NonNullable<React.ComponentProps<typeof Drawer.Root>["onOpenChange"]>>[1];
|
|
6
|
+
interface DrawerProps {
|
|
7
|
+
trigger: React.ReactElement;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
open?: boolean;
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
onOpenChange?: (open: boolean, eventDetails: OpenChangeDetails) => void;
|
|
12
|
+
className?: string;
|
|
13
|
+
triggerClassName?: string;
|
|
14
|
+
panelClassName?: string;
|
|
15
|
+
backdropClassName?: string;
|
|
16
|
+
title?: React.ReactNode;
|
|
17
|
+
description?: React.ReactNode;
|
|
18
|
+
side?: "left" | "right";
|
|
19
|
+
modal?: React.ComponentProps<typeof Drawer.Root>["modal"];
|
|
20
|
+
initialFocus?: React.ComponentProps<typeof Drawer.Popup>["initialFocus"];
|
|
21
|
+
finalFocus?: React.ComponentProps<typeof Drawer.Popup>["finalFocus"];
|
|
22
|
+
popupAriaLabel?: string;
|
|
23
|
+
}
|
|
24
|
+
declare function Drawer$1({
|
|
25
|
+
trigger,
|
|
26
|
+
children,
|
|
27
|
+
open,
|
|
28
|
+
defaultOpen,
|
|
29
|
+
onOpenChange,
|
|
30
|
+
className,
|
|
31
|
+
triggerClassName,
|
|
32
|
+
panelClassName,
|
|
33
|
+
backdropClassName,
|
|
34
|
+
title,
|
|
35
|
+
description,
|
|
36
|
+
side,
|
|
37
|
+
modal,
|
|
38
|
+
initialFocus,
|
|
39
|
+
finalFocus,
|
|
40
|
+
popupAriaLabel
|
|
41
|
+
}: DrawerProps): React.ReactElement;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { Drawer$1 as Drawer, DrawerProps };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Drawer } from "@base-ui/react/drawer";
|
|
6
|
+
|
|
7
|
+
//#region src/components/primitives/Drawer.tsx
|
|
8
|
+
function Drawer$1({ trigger, children, open, defaultOpen = false, onOpenChange, className, triggerClassName, panelClassName, backdropClassName, title, description, side = "right", modal = true, initialFocus, finalFocus, popupAriaLabel }) {
|
|
9
|
+
const sideClassName = side === "left" ? "inset-y-0 left-0 h-full" : "inset-y-0 right-0 h-full";
|
|
10
|
+
const swipeDirection = side === "left" ? "left" : "right";
|
|
11
|
+
return /* @__PURE__ */ jsxs(Drawer.Root, {
|
|
12
|
+
open,
|
|
13
|
+
defaultOpen,
|
|
14
|
+
onOpenChange,
|
|
15
|
+
modal,
|
|
16
|
+
swipeDirection,
|
|
17
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
18
|
+
className,
|
|
19
|
+
children: /* @__PURE__ */ jsx(Drawer.Trigger, {
|
|
20
|
+
className: cn("outline-none", triggerClassName),
|
|
21
|
+
render: trigger
|
|
22
|
+
})
|
|
23
|
+
}), /* @__PURE__ */ jsxs(Drawer.Portal, { children: [/* @__PURE__ */ jsx(Drawer.Backdrop, { className: (state) => cn("fixed inset-0 z-60 bg-background/70 backdrop-blur-sm transition-opacity duration-150 ease-out", (state.transitionStatus === "starting" || state.transitionStatus === "ending") && "opacity-0", backdropClassName) }), /* @__PURE__ */ jsx(Drawer.Viewport, {
|
|
24
|
+
className: "fixed inset-0 z-70 overflow-hidden",
|
|
25
|
+
children: /* @__PURE__ */ jsx(Drawer.Popup, {
|
|
26
|
+
"aria-label": popupAriaLabel,
|
|
27
|
+
initialFocus,
|
|
28
|
+
finalFocus,
|
|
29
|
+
className: cn("fixed z-70 flex h-full w-auto outline-none transition-transform duration-200 ease-out", sideClassName),
|
|
30
|
+
style: (state) => ({ transform: state.transitionStatus === "starting" || state.transitionStatus === "ending" ? side === "left" ? "translateX(-100%)" : "translateX(100%)" : "translateX(var(--drawer-swipe-movement-x, 0px))" }),
|
|
31
|
+
children: /* @__PURE__ */ jsxs(Drawer.Content, {
|
|
32
|
+
className: cn("flex h-full w-[max(50vw,24rem)] max-w-none flex-col border-border bg-background shadow-2xl sm:w-[max(50vw,28rem)]", side === "left" ? "border-r" : "border-l", panelClassName),
|
|
33
|
+
children: [
|
|
34
|
+
title ? /* @__PURE__ */ jsx(Drawer.Title, {
|
|
35
|
+
className: "sr-only",
|
|
36
|
+
children: title
|
|
37
|
+
}) : null,
|
|
38
|
+
description ? /* @__PURE__ */ jsx(Drawer.Description, {
|
|
39
|
+
className: "sr-only",
|
|
40
|
+
children: description
|
|
41
|
+
}) : null,
|
|
42
|
+
children
|
|
43
|
+
]
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
})] })]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
export { Drawer$1 as Drawer };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/primitives/Feedback.d.ts
|
|
4
|
+
type FeedbackPosition = "bottom" | "top" | "left" | "right";
|
|
5
|
+
interface FeedbackRootProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
show?: boolean;
|
|
8
|
+
position?: FeedbackPosition;
|
|
9
|
+
className?: string;
|
|
10
|
+
transition?: {
|
|
11
|
+
stiffness?: number;
|
|
12
|
+
damping?: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
type ContentTransitionMode = "crossfade" | "slide-up" | "slide-down";
|
|
16
|
+
interface FeedbackContentProps {
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
contentKey?: string | number;
|
|
20
|
+
mode?: ContentTransitionMode;
|
|
21
|
+
}
|
|
22
|
+
interface FeedbackComponent {
|
|
23
|
+
Root: React.FC<FeedbackRootProps>;
|
|
24
|
+
Content: React.FC<FeedbackContentProps>;
|
|
25
|
+
}
|
|
26
|
+
declare const Feedback: FeedbackComponent;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { Feedback };
|