@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,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Separator } from "@base-ui/react/separator";
|
|
3
|
+
|
|
4
|
+
//#region src/components/primitives/Separator.d.ts
|
|
5
|
+
type SeparatorVariantsProps = {
|
|
6
|
+
color?: "default" | "subtle";
|
|
7
|
+
orientation?: "horizontal" | "vertical";
|
|
8
|
+
};
|
|
9
|
+
type SeparatorOwnProps = SeparatorVariantsProps & {
|
|
10
|
+
label?: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
interface SeparatorProps extends React.ComponentProps<typeof Separator>, SeparatorOwnProps {}
|
|
13
|
+
declare function Separator$1({
|
|
14
|
+
className,
|
|
15
|
+
color,
|
|
16
|
+
orientation,
|
|
17
|
+
label,
|
|
18
|
+
ref,
|
|
19
|
+
...props
|
|
20
|
+
}: SeparatorProps): React.ReactElement;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Separator$1 as Separator };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Text } from "./Text.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Separator } from "@base-ui/react/separator";
|
|
5
|
+
|
|
6
|
+
//#region src/components/primitives/Separator.tsx
|
|
7
|
+
const separatorVariants = (props) => {
|
|
8
|
+
return `${{
|
|
9
|
+
default: "bg-border",
|
|
10
|
+
subtle: "bg-separator"
|
|
11
|
+
}[props.color ?? "default"]} ${{
|
|
12
|
+
horizontal: "h-px",
|
|
13
|
+
vertical: "w-px"
|
|
14
|
+
}[props.orientation ?? "horizontal"]}`;
|
|
15
|
+
};
|
|
16
|
+
function Separator$1({ className, color, orientation, label, ref, ...props }) {
|
|
17
|
+
const colorClass = color ?? "default";
|
|
18
|
+
const orientationValue = orientation ?? "horizontal";
|
|
19
|
+
const lineColorClass = colorClass === "default" ? "bg-border" : "bg-separator";
|
|
20
|
+
if (label) {
|
|
21
|
+
if (orientationValue === "vertical") return /* @__PURE__ */ jsxs("div", {
|
|
22
|
+
className: cn("flex min-h-0 min-w-px flex-col items-center justify-center gap-2", className),
|
|
23
|
+
"aria-hidden": true,
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ jsx("div", { className: cn("min-h-0 w-px flex-1", lineColorClass) }),
|
|
26
|
+
/* @__PURE__ */ jsx(Text, {
|
|
27
|
+
size: "1",
|
|
28
|
+
color: "secondary",
|
|
29
|
+
className: "shrink-0",
|
|
30
|
+
children: label
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ jsx("div", { className: cn("min-h-0 w-px flex-1", lineColorClass) })
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
36
|
+
className: cn("flex min-w-0 items-center gap-3 py-2", className),
|
|
37
|
+
"aria-hidden": true,
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsx("div", { className: cn("h-px min-w-0 flex-1", lineColorClass) }),
|
|
40
|
+
/* @__PURE__ */ jsx(Text, {
|
|
41
|
+
size: "1",
|
|
42
|
+
color: "secondary",
|
|
43
|
+
className: "shrink-0",
|
|
44
|
+
children: label
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ jsx("div", { className: cn("h-px min-w-0 flex-1", lineColorClass) })
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
51
|
+
ref,
|
|
52
|
+
className: cn(separatorVariants({
|
|
53
|
+
color,
|
|
54
|
+
orientation
|
|
55
|
+
}), className),
|
|
56
|
+
orientation,
|
|
57
|
+
...props
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
export { Separator$1 as Separator };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
|
|
4
|
+
//#region src/components/primitives/Skeleton.d.ts
|
|
5
|
+
type SkeletonProps = Omit<useRender.ComponentProps<"span">, "color">;
|
|
6
|
+
type SkeletonElement = React.ComponentRef<"span">;
|
|
7
|
+
declare function Skeleton({
|
|
8
|
+
className,
|
|
9
|
+
render,
|
|
10
|
+
ref,
|
|
11
|
+
...props
|
|
12
|
+
}: SkeletonProps): React.ReactElement;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Skeleton, SkeletonElement, SkeletonProps };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
|
|
5
|
+
//#region src/components/primitives/Skeleton.tsx
|
|
6
|
+
function Skeleton({ className, render, ref, ...props }) {
|
|
7
|
+
return useRender({
|
|
8
|
+
defaultTagName: "span",
|
|
9
|
+
render,
|
|
10
|
+
props: mergeProps({
|
|
11
|
+
className: cn("pointer-events-none animate-pulse rounded-xs border-none! bg-muted bg-none! text-transparent! shadow-none! select-none *:invisible empty:block", className),
|
|
12
|
+
"aria-hidden": true,
|
|
13
|
+
tabIndex: -1
|
|
14
|
+
}, props),
|
|
15
|
+
ref
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { Skeleton };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { NumberField } from "@base-ui/react/number-field";
|
|
3
|
+
|
|
4
|
+
//#region src/components/primitives/SteppedInput.d.ts
|
|
5
|
+
type SnapToTickMode = "up" | "down" | "nearest";
|
|
6
|
+
interface RootProps {
|
|
7
|
+
value: bigint;
|
|
8
|
+
onChange: (value: bigint) => void;
|
|
9
|
+
min?: bigint;
|
|
10
|
+
max?: bigint;
|
|
11
|
+
getTickSize: (currentValue: bigint) => bigint;
|
|
12
|
+
decimals?: number;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
snapToTick?: SnapToTickMode | false;
|
|
17
|
+
}
|
|
18
|
+
declare function Root({
|
|
19
|
+
value,
|
|
20
|
+
onChange,
|
|
21
|
+
min,
|
|
22
|
+
max,
|
|
23
|
+
getTickSize,
|
|
24
|
+
decimals,
|
|
25
|
+
disabled,
|
|
26
|
+
className,
|
|
27
|
+
children,
|
|
28
|
+
snapToTick
|
|
29
|
+
}: RootProps): React.ReactElement;
|
|
30
|
+
interface GroupProps {
|
|
31
|
+
children: React.ReactNode;
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
34
|
+
declare function Group({
|
|
35
|
+
children,
|
|
36
|
+
className
|
|
37
|
+
}: GroupProps): React.ReactElement;
|
|
38
|
+
interface DecrementProps {
|
|
39
|
+
className?: string;
|
|
40
|
+
children?: React.ReactNode;
|
|
41
|
+
}
|
|
42
|
+
declare function Decrement({
|
|
43
|
+
className,
|
|
44
|
+
children
|
|
45
|
+
}: DecrementProps): React.ReactElement;
|
|
46
|
+
interface IncrementProps {
|
|
47
|
+
className?: string;
|
|
48
|
+
children?: React.ReactNode;
|
|
49
|
+
}
|
|
50
|
+
declare function Increment({
|
|
51
|
+
className,
|
|
52
|
+
children
|
|
53
|
+
}: IncrementProps): React.ReactElement;
|
|
54
|
+
interface ScrubAreaProps {
|
|
55
|
+
children: React.ReactNode;
|
|
56
|
+
className?: string;
|
|
57
|
+
}
|
|
58
|
+
declare function ScrubArea({
|
|
59
|
+
children,
|
|
60
|
+
className
|
|
61
|
+
}: ScrubAreaProps): React.ReactElement;
|
|
62
|
+
interface InputProps {
|
|
63
|
+
className?: string;
|
|
64
|
+
}
|
|
65
|
+
declare function Input({
|
|
66
|
+
className
|
|
67
|
+
}: InputProps): React.ReactElement;
|
|
68
|
+
interface ValueProps {
|
|
69
|
+
children: (context: {
|
|
70
|
+
value: bigint;
|
|
71
|
+
inputValue: number;
|
|
72
|
+
step: number;
|
|
73
|
+
disabled: boolean;
|
|
74
|
+
}) => React.ReactNode;
|
|
75
|
+
className?: string;
|
|
76
|
+
}
|
|
77
|
+
declare function Value({
|
|
78
|
+
children,
|
|
79
|
+
className
|
|
80
|
+
}: ValueProps): React.ReactElement;
|
|
81
|
+
declare function CursorGrowIcon(props: React.ComponentProps<"svg">): React.ReactElement;
|
|
82
|
+
interface SteppedInputComponent {
|
|
83
|
+
Root: typeof Root;
|
|
84
|
+
Group: typeof Group;
|
|
85
|
+
Decrement: typeof Decrement;
|
|
86
|
+
Increment: typeof Increment;
|
|
87
|
+
ScrubArea: typeof ScrubArea;
|
|
88
|
+
ScrubAreaCursor: typeof NumberField.ScrubAreaCursor;
|
|
89
|
+
Input: typeof Input;
|
|
90
|
+
Value: typeof Value;
|
|
91
|
+
}
|
|
92
|
+
declare const SteppedInput: SteppedInputComponent;
|
|
93
|
+
//#endregion
|
|
94
|
+
export { CursorGrowIcon, SteppedInput };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { IconArrowsHorizontal } from "@tabler/icons-react";
|
|
7
|
+
import { NumberField } from "@base-ui/react/number-field";
|
|
8
|
+
|
|
9
|
+
//#region src/components/primitives/SteppedInput.tsx
|
|
10
|
+
const SteppedInputContext = React.createContext(null);
|
|
11
|
+
function useSteppedInput() {
|
|
12
|
+
const context = React.useContext(SteppedInputContext);
|
|
13
|
+
if (!context) throw new Error("useSteppedInput must be used within SteppedInput.Root");
|
|
14
|
+
return context;
|
|
15
|
+
}
|
|
16
|
+
function getScale(decimals) {
|
|
17
|
+
return 10 ** decimals;
|
|
18
|
+
}
|
|
19
|
+
function toInputValue(value, decimals) {
|
|
20
|
+
return Number(value) / getScale(decimals);
|
|
21
|
+
}
|
|
22
|
+
function fromInputValue(value, decimals) {
|
|
23
|
+
return BigInt(Math.round(value * getScale(decimals)));
|
|
24
|
+
}
|
|
25
|
+
function snapValueToTick(value, tickSize, mode, min) {
|
|
26
|
+
if (tickSize <= 0n) return value;
|
|
27
|
+
const remainder = value % tickSize;
|
|
28
|
+
if (remainder === 0n) return value;
|
|
29
|
+
let snapped;
|
|
30
|
+
switch (mode) {
|
|
31
|
+
case "up":
|
|
32
|
+
snapped = value - remainder + tickSize;
|
|
33
|
+
break;
|
|
34
|
+
case "down":
|
|
35
|
+
snapped = value - remainder;
|
|
36
|
+
break;
|
|
37
|
+
case "nearest":
|
|
38
|
+
snapped = remainder * 2n >= tickSize ? value - remainder + tickSize : value - remainder;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
if (min !== void 0 && snapped < min) snapped = min;
|
|
42
|
+
return snapped;
|
|
43
|
+
}
|
|
44
|
+
function Root({ value, onChange, min, max, getTickSize, decimals = 0, disabled = false, className, children, snapToTick = false }) {
|
|
45
|
+
const inputValue = toInputValue(value, decimals);
|
|
46
|
+
const step = toInputValue(getTickSize(value), decimals);
|
|
47
|
+
const handleValueChange = React.useCallback((val) => {
|
|
48
|
+
if (val === null || val === void 0) return;
|
|
49
|
+
let newValue = fromInputValue(val, decimals);
|
|
50
|
+
if (min !== void 0 && newValue < min) newValue = min;
|
|
51
|
+
if (max !== void 0 && newValue > max) newValue = max;
|
|
52
|
+
if (snapToTick) {
|
|
53
|
+
const tickSize = getTickSize(value);
|
|
54
|
+
newValue = snapValueToTick(newValue, tickSize, snapToTick, min);
|
|
55
|
+
}
|
|
56
|
+
onChange(newValue);
|
|
57
|
+
}, [
|
|
58
|
+
decimals,
|
|
59
|
+
snapToTick,
|
|
60
|
+
getTickSize,
|
|
61
|
+
min,
|
|
62
|
+
max,
|
|
63
|
+
onChange,
|
|
64
|
+
value
|
|
65
|
+
]);
|
|
66
|
+
const contextValue = React.useMemo(() => ({
|
|
67
|
+
value,
|
|
68
|
+
inputValue,
|
|
69
|
+
step,
|
|
70
|
+
disabled
|
|
71
|
+
}), [
|
|
72
|
+
value,
|
|
73
|
+
inputValue,
|
|
74
|
+
step,
|
|
75
|
+
disabled
|
|
76
|
+
]);
|
|
77
|
+
return /* @__PURE__ */ jsx(SteppedInputContext.Provider, {
|
|
78
|
+
value: contextValue,
|
|
79
|
+
children: /* @__PURE__ */ jsx(NumberField.Root, {
|
|
80
|
+
value: inputValue,
|
|
81
|
+
onValueChange: handleValueChange,
|
|
82
|
+
min: min !== void 0 ? toInputValue(min, decimals) : -Infinity,
|
|
83
|
+
max: max !== void 0 ? toInputValue(max, decimals) : Infinity,
|
|
84
|
+
step,
|
|
85
|
+
className: cn("w-full", className),
|
|
86
|
+
disabled,
|
|
87
|
+
children
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function Group({ children, className }) {
|
|
92
|
+
return /* @__PURE__ */ jsx(NumberField.Group, {
|
|
93
|
+
className: cn("flex", className),
|
|
94
|
+
children
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function Decrement({ className, children }) {
|
|
98
|
+
return /* @__PURE__ */ jsx(NumberField.Decrement, {
|
|
99
|
+
className: cn("flex size-10 items-center justify-center rounded-l-md border-y border-l", "border-input bg-muted text-foreground select-none", "hover:bg-accent-hover", "active:bg-accent-active", "disabled:cursor-not-allowed disabled:border-disabled disabled:bg-disabled disabled:text-disabled-foreground", className),
|
|
100
|
+
children: children ?? "-"
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function Increment({ className, children }) {
|
|
104
|
+
return /* @__PURE__ */ jsx(NumberField.Increment, {
|
|
105
|
+
className: cn("flex size-10 items-center justify-center rounded-r-md border-y border-r", "border-input bg-muted text-foreground select-none", "hover:bg-accent-hover", "active:bg-accent-active", "disabled:cursor-not-allowed disabled:border-disabled disabled:bg-disabled disabled:text-disabled-foreground", className),
|
|
106
|
+
children: children ?? "+"
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function ScrubArea({ children, className }) {
|
|
110
|
+
return /* @__PURE__ */ jsx(NumberField.ScrubArea, {
|
|
111
|
+
className: cn("relative flex w-full items-center", "disabled:cursor-not-allowed", className),
|
|
112
|
+
children
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function Input({ className }) {
|
|
116
|
+
return /* @__PURE__ */ jsx(NumberField.Input, { className: cn("h-10 w-auto grow border border-input bg-background px-4", "text-center text-sm leading-[21px] text-foreground tabular-nums", "focus:ring-2 focus:ring-ring focus:outline-none focus:ring-inset", "disabled:cursor-not-allowed disabled:border-disabled disabled:text-disabled-foreground", className) });
|
|
117
|
+
}
|
|
118
|
+
function Value({ children, className }) {
|
|
119
|
+
const { value, inputValue, step, disabled } = useSteppedInput();
|
|
120
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
121
|
+
className: cn("relative flex h-10 grow items-center border border-input bg-background", "px-4", "focus-within:ring-2 focus-within:ring-ring focus-within:ring-inset", className),
|
|
122
|
+
children: [/* @__PURE__ */ jsx(NumberField.Input, {
|
|
123
|
+
readOnly: true,
|
|
124
|
+
className: "sr-only"
|
|
125
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
126
|
+
className: "w-full text-center text-sm leading-[21px] text-foreground tabular-nums",
|
|
127
|
+
children: children({
|
|
128
|
+
value,
|
|
129
|
+
inputValue,
|
|
130
|
+
step,
|
|
131
|
+
disabled
|
|
132
|
+
})
|
|
133
|
+
})]
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function CursorGrowIcon(props) {
|
|
137
|
+
return /* @__PURE__ */ jsx(IconArrowsHorizontal, {
|
|
138
|
+
"aria-label": "Drag to adjust",
|
|
139
|
+
...props
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
const SteppedInput = {
|
|
143
|
+
Root,
|
|
144
|
+
Group,
|
|
145
|
+
Decrement,
|
|
146
|
+
Increment,
|
|
147
|
+
ScrubArea,
|
|
148
|
+
ScrubAreaCursor: NumberField.ScrubAreaCursor,
|
|
149
|
+
Input,
|
|
150
|
+
Value
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
//#endregion
|
|
154
|
+
export { CursorGrowIcon, SteppedInput };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Tabs } from "@base-ui/react/tabs";
|
|
3
|
+
|
|
4
|
+
//#region src/components/primitives/Tabs.d.ts
|
|
5
|
+
type TabsContextType = {
|
|
6
|
+
layout: "default" | "centered";
|
|
7
|
+
variant: "default" | "underline" | "segmented";
|
|
8
|
+
};
|
|
9
|
+
interface TabsProps extends React.ComponentProps<typeof Tabs.Root> {
|
|
10
|
+
layout?: TabsContextType["layout"];
|
|
11
|
+
variant?: TabsContextType["variant"];
|
|
12
|
+
}
|
|
13
|
+
declare function Tabs$1({
|
|
14
|
+
className,
|
|
15
|
+
layout,
|
|
16
|
+
variant,
|
|
17
|
+
...props
|
|
18
|
+
}: TabsProps): React.ReactElement;
|
|
19
|
+
declare function TabsList({
|
|
20
|
+
children,
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof Tabs.List>): React.ReactElement;
|
|
24
|
+
declare function TabsIndicator({
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof Tabs.Indicator>): React.ReactElement;
|
|
28
|
+
declare function Tab({
|
|
29
|
+
className,
|
|
30
|
+
...props
|
|
31
|
+
}: React.ComponentProps<typeof Tabs.Tab>): React.ReactElement;
|
|
32
|
+
declare function TabsPanel({
|
|
33
|
+
className,
|
|
34
|
+
...props
|
|
35
|
+
}: React.ComponentProps<typeof Tabs.Panel>): React.ReactElement;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { Tab, Tabs$1 as Tabs, TabsContextType, TabsIndicator, TabsList, TabsPanel };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
|
+
import { Tabs } from "@base-ui/react/tabs";
|
|
8
|
+
|
|
9
|
+
//#region src/components/primitives/Tabs.tsx
|
|
10
|
+
const TabsLayoutContext = React.createContext({
|
|
11
|
+
layout: "default",
|
|
12
|
+
variant: "default"
|
|
13
|
+
});
|
|
14
|
+
function Tabs$1({ className, layout = "default", variant = "default", ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsx(TabsLayoutContext, {
|
|
16
|
+
value: {
|
|
17
|
+
layout,
|
|
18
|
+
variant
|
|
19
|
+
},
|
|
20
|
+
children: /* @__PURE__ */ jsx(Tabs.Root, {
|
|
21
|
+
className: cn("flex flex-col", className),
|
|
22
|
+
...props
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const tabsListVariants = cva("relative flex", {
|
|
27
|
+
variants: {
|
|
28
|
+
layout: {
|
|
29
|
+
default: "items-center gap-5",
|
|
30
|
+
centered: "justify-between px-1"
|
|
31
|
+
},
|
|
32
|
+
variant: {
|
|
33
|
+
default: "border-b border-b-border pb-4",
|
|
34
|
+
underline: "border-b border-b-border pb-4",
|
|
35
|
+
segmented: "inline-flex items-center gap-1 rounded-lg border border-border bg-muted/30 p-1"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
defaultVariants: {
|
|
39
|
+
layout: "default",
|
|
40
|
+
variant: "default"
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
function TabsList({ children, className, ...props }) {
|
|
44
|
+
const context = React.useContext(TabsLayoutContext);
|
|
45
|
+
return /* @__PURE__ */ jsxs(Tabs.List, {
|
|
46
|
+
className: cn(tabsListVariants({
|
|
47
|
+
layout: context.layout,
|
|
48
|
+
variant: context.variant
|
|
49
|
+
}), context.variant === "segmented" && context.layout === "centered" && "justify-start px-1", className),
|
|
50
|
+
...props,
|
|
51
|
+
children: [children, context.variant === "underline" ? /* @__PURE__ */ jsx(TabsIndicator, {}) : null]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function TabsIndicator({ className, ...props }) {
|
|
55
|
+
const context = React.useContext(TabsLayoutContext);
|
|
56
|
+
return /* @__PURE__ */ jsx(Tabs.Indicator, {
|
|
57
|
+
className: cn("absolute bottom-0 left-0 z-1 h-[3px] w-(--active-tab-width) translate-x-(--active-tab-left) bg-foreground transition-transform duration-200 ease-in-out", {
|
|
58
|
+
"w-[calc(var(--active-tab-width)+4px)]": context.layout === "centered",
|
|
59
|
+
"translate-x-[calc(var(--active-tab-left)-4px)]": context.layout === "centered"
|
|
60
|
+
}, className),
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
const tabVariants = cva("relative rounded-xs font-sans text-sm leading-none whitespace-nowrap text-muted-foreground after:pointer-events-auto after:absolute after:z-0 after:rounded-xs after:bg-transparent after:content-[''] hover:text-foreground focus-visible:ring focus-visible:outline-none data-active:text-foreground", {
|
|
65
|
+
variants: {
|
|
66
|
+
layout: {
|
|
67
|
+
default: "after:-inset-x-2.5 after:-inset-y-1.5",
|
|
68
|
+
centered: "w-full after:inset-x-0 after:-inset-y-1.5"
|
|
69
|
+
},
|
|
70
|
+
variant: {
|
|
71
|
+
default: "",
|
|
72
|
+
underline: "",
|
|
73
|
+
segmented: "rounded-md border border-transparent px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors after:hidden hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background data-active:border-border data-active:bg-background data-active:text-foreground data-active:shadow-[0_1px_2px_0_rgb(0,0,0,0.04)] aria-selected:border-border aria-selected:bg-background aria-selected:text-foreground aria-selected:shadow-[0_1px_2px_0_rgb(0,0,0,0.04)]"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
defaultVariants: {
|
|
77
|
+
layout: "default",
|
|
78
|
+
variant: "default"
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
function Tab({ className, ...props }) {
|
|
82
|
+
const context = React.useContext(TabsLayoutContext);
|
|
83
|
+
return /* @__PURE__ */ jsx(Tabs.Tab, {
|
|
84
|
+
className: cn(tabVariants({
|
|
85
|
+
layout: context.layout,
|
|
86
|
+
variant: context.variant
|
|
87
|
+
}), context.variant === "segmented" && context.layout === "centered" && "w-auto", className),
|
|
88
|
+
...props
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function TabsPanel({ className, ...props }) {
|
|
92
|
+
return /* @__PURE__ */ jsx(Tabs.Panel, {
|
|
93
|
+
className: cn("focus-visible:outline-none", className),
|
|
94
|
+
...props
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
99
|
+
export { Tab, Tabs$1 as Tabs, TabsIndicator, TabsList, TabsPanel };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TextProps } from "./Text.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/primitives/Tag.d.ts
|
|
5
|
+
type TagVariantsProps = {
|
|
6
|
+
type?: "informative" | "interactive";
|
|
7
|
+
};
|
|
8
|
+
type BaseTagProps = Omit<TextProps, "render"> & TagVariantsProps;
|
|
9
|
+
type TagInformativeProps = BaseTagProps & {
|
|
10
|
+
type?: "informative";
|
|
11
|
+
} & Omit<React.ComponentProps<"span">, "color">;
|
|
12
|
+
type TagButtonProps = BaseTagProps & {
|
|
13
|
+
type: "interactive";
|
|
14
|
+
} & Omit<React.ComponentProps<"button">, "type">;
|
|
15
|
+
type TagProps = TagInformativeProps | TagButtonProps;
|
|
16
|
+
type TagElement = HTMLSpanElement | HTMLButtonElement;
|
|
17
|
+
declare function Tag({
|
|
18
|
+
className,
|
|
19
|
+
type,
|
|
20
|
+
children,
|
|
21
|
+
...rest
|
|
22
|
+
}: TagProps): React.ReactElement;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { Tag, TagElement, TagProps };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Text } from "./Text.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/primitives/Tag.tsx
|
|
6
|
+
const tagVariants = (props) => {
|
|
7
|
+
return `inline-flex rounded-xs border border-solid border-border bg-muted px-1 leading-none ${{
|
|
8
|
+
informative: "",
|
|
9
|
+
interactive: "underline hover:bg-accent-hover focus-visible:ring focus-visible:outline-none"
|
|
10
|
+
}[props.type ?? "informative"]}`;
|
|
11
|
+
};
|
|
12
|
+
function Tag({ className, type = "informative", children, ...rest }) {
|
|
13
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
14
|
+
render: type === "interactive" ? /* @__PURE__ */ jsx("button", { type: "button" }) : /* @__PURE__ */ jsx("span", {}),
|
|
15
|
+
className: cn(tagVariants({ type }), className),
|
|
16
|
+
...rest,
|
|
17
|
+
children
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Tag };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { VariantProps as VariantProps$1 } from "class-variance-authority";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
|
|
5
|
+
//#region src/components/primitives/Text.d.ts
|
|
6
|
+
declare const textVariants: (props?: {
|
|
7
|
+
size?: "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
|
|
8
|
+
weight?: "regular" | "medium" | "semibold";
|
|
9
|
+
align?: "left" | "center" | "right";
|
|
10
|
+
color?: "primary" | "secondary" | "tertiary" | "disabled" | "current" | "success" | "error";
|
|
11
|
+
tabularNums?: true;
|
|
12
|
+
className?: string;
|
|
13
|
+
}) => string;
|
|
14
|
+
type TextVariants = typeof textVariants;
|
|
15
|
+
interface TextProps extends VariantProps$1<TextVariants>, Omit<useRender.ComponentProps<"span">, "color"> {}
|
|
16
|
+
type TextElement = React.ComponentRef<"span">;
|
|
17
|
+
declare function Text({
|
|
18
|
+
as,
|
|
19
|
+
className,
|
|
20
|
+
align,
|
|
21
|
+
size,
|
|
22
|
+
weight,
|
|
23
|
+
color,
|
|
24
|
+
tabularNums,
|
|
25
|
+
render,
|
|
26
|
+
ref,
|
|
27
|
+
...props
|
|
28
|
+
}: TextProps & {
|
|
29
|
+
as?: React.ElementType;
|
|
30
|
+
}): React.ReactElement;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { Text, TextElement, TextProps, textVariants };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
5
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
6
|
+
|
|
7
|
+
//#region src/components/primitives/Text.tsx
|
|
8
|
+
const textVariants = cva("font-sans", {
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
"1": "text-xs leading-[18px]",
|
|
12
|
+
"2": "text-sm leading-[21px]",
|
|
13
|
+
"3": "text-base leading-6",
|
|
14
|
+
"4": "text-xl leading-7",
|
|
15
|
+
"5": "text-2xl leading-8",
|
|
16
|
+
"6": "text-[28px] leading-9",
|
|
17
|
+
"7": "text-[32px] leading-10",
|
|
18
|
+
"8": "text-[36px] leading-[44px]",
|
|
19
|
+
"9": "text-5xl leading-[56px]"
|
|
20
|
+
},
|
|
21
|
+
weight: {
|
|
22
|
+
regular: "font-normal",
|
|
23
|
+
medium: "font-medium",
|
|
24
|
+
semibold: "font-semibold"
|
|
25
|
+
},
|
|
26
|
+
align: {
|
|
27
|
+
left: "text-left",
|
|
28
|
+
center: "text-center",
|
|
29
|
+
right: "text-right"
|
|
30
|
+
},
|
|
31
|
+
color: {
|
|
32
|
+
primary: "text-foreground",
|
|
33
|
+
secondary: "text-muted-foreground",
|
|
34
|
+
tertiary: "text-muted-foreground",
|
|
35
|
+
disabled: "text-disabled-foreground",
|
|
36
|
+
current: "text-current",
|
|
37
|
+
success: "text-success",
|
|
38
|
+
error: "text-destructive"
|
|
39
|
+
},
|
|
40
|
+
tabularNums: { true: "tabular-nums" }
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
size: "2",
|
|
44
|
+
weight: "regular",
|
|
45
|
+
color: "primary"
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
function Text({ as, className, align, size, weight, color, tabularNums, render, ref, ...props }) {
|
|
49
|
+
const defaultProps = { className: cn(textVariants({
|
|
50
|
+
align,
|
|
51
|
+
size,
|
|
52
|
+
weight,
|
|
53
|
+
color,
|
|
54
|
+
tabularNums
|
|
55
|
+
}), className) };
|
|
56
|
+
return useRender({
|
|
57
|
+
defaultTagName: "span",
|
|
58
|
+
render: render ?? (as ? React.createElement(as) : void 0),
|
|
59
|
+
props: mergeProps(defaultProps, props),
|
|
60
|
+
ref
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { Text, textVariants };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { UseCountdownResult } from "../../../hooks/useCountdown.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/primitives/countdown/Countdown.d.ts
|
|
4
|
+
interface CountdownProps {
|
|
5
|
+
/** Target date to count down to */
|
|
6
|
+
to: Date;
|
|
7
|
+
/** Show full format even when not expired (default: only show when expired) */
|
|
8
|
+
showWhenExpired?: boolean;
|
|
9
|
+
/** Stop counting up when countdown reaches zero (default: false - keeps counting up) */
|
|
10
|
+
stopOnExpired?: boolean;
|
|
11
|
+
/** Custom className */
|
|
12
|
+
className?: string;
|
|
13
|
+
/** Custom renderer - receives full countdown state */
|
|
14
|
+
children?: (result: UseCountdownResult) => React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
declare function Countdown({
|
|
17
|
+
to,
|
|
18
|
+
showWhenExpired,
|
|
19
|
+
stopOnExpired,
|
|
20
|
+
className,
|
|
21
|
+
children
|
|
22
|
+
}: CountdownProps): React.ReactElement | null;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { Countdown, CountdownProps };
|