@betfin/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-3CAXHUAL.js +23 -0
- package/dist/chunk-3CAXHUAL.js.map +1 -0
- package/dist/chunk-3YCD2QLS.js +113 -0
- package/dist/chunk-3YCD2QLS.js.map +1 -0
- package/dist/chunk-5CXIFF6J.js +46 -0
- package/dist/chunk-5CXIFF6J.js.map +1 -0
- package/dist/chunk-EP6DYU4N.js +26 -0
- package/dist/chunk-EP6DYU4N.js.map +1 -0
- package/dist/chunk-FHYW2QBY.js +21 -0
- package/dist/chunk-FHYW2QBY.js.map +1 -0
- package/dist/chunk-HRFMTZ55.js +49 -0
- package/dist/chunk-HRFMTZ55.js.map +1 -0
- package/dist/chunk-ILNHKDYA.js +107 -0
- package/dist/chunk-ILNHKDYA.js.map +1 -0
- package/dist/chunk-JTVU6ANA.js +37 -0
- package/dist/chunk-JTVU6ANA.js.map +1 -0
- package/dist/chunk-K7JWN6NH.js +21 -0
- package/dist/chunk-K7JWN6NH.js.map +1 -0
- package/dist/chunk-QZIKXMHP.js +131 -0
- package/dist/chunk-QZIKXMHP.js.map +1 -0
- package/dist/chunk-SSC2M625.js +24 -0
- package/dist/chunk-SSC2M625.js.map +1 -0
- package/dist/chunk-TLULUIYC.js +14 -0
- package/dist/chunk-TLULUIYC.js.map +1 -0
- package/dist/chunk-VJ6P5FFS.js +90 -0
- package/dist/chunk-VJ6P5FFS.js.map +1 -0
- package/dist/chunk-Y2TKUANL.js +11 -0
- package/dist/chunk-Y2TKUANL.js.map +1 -0
- package/dist/components/accordion.d.ts +6 -0
- package/dist/components/accordion.js +59 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/alert-dialog.d.ts +18 -0
- package/dist/components/alert-dialog.js +144 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/app-header.d.ts +19 -0
- package/dist/components/app-header.js +17 -0
- package/dist/components/app-header.js.map +1 -0
- package/dist/components/badge.d.ts +7 -0
- package/dist/components/badge.js +47 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/bet-value.d.ts +49 -0
- package/dist/components/bet-value.js +12 -0
- package/dist/components/bet-value.js.map +1 -0
- package/dist/components/breadcrumb.d.ts +10 -0
- package/dist/components/breadcrumb.js +65 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/button.d.ts +8 -0
- package/dist/components/button.js +10 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/calendar.d.ts +10 -0
- package/dist/components/calendar.js +145 -0
- package/dist/components/calendar.js.map +1 -0
- package/dist/components/carousel.d.ts +28 -0
- package/dist/components/carousel.js +153 -0
- package/dist/components/carousel.js.map +1 -0
- package/dist/components/chart.d.ts +39 -0
- package/dist/components/chart.js +219 -0
- package/dist/components/chart.js.map +1 -0
- package/dist/components/checkbox.d.ts +3 -0
- package/dist/components/checkbox.js +26 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/collapsible.d.ts +5 -0
- package/dist/components/collapsible.js +20 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/command.d.ts +19 -0
- package/dist/components/command.js +130 -0
- package/dist/components/command.js.map +1 -0
- package/dist/components/context-menu.d.ts +29 -0
- package/dist/components/context-menu.js +186 -0
- package/dist/components/context-menu.js.map +1 -0
- package/dist/components/dialog.d.ts +17 -0
- package/dist/components/dialog.js +28 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/drawer.d.ts +16 -0
- package/dist/components/drawer.js +164 -0
- package/dist/components/drawer.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +29 -0
- package/dist/components/dropdown-menu.js +207 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/input-group.d.ts +18 -0
- package/dist/components/input-group.js +22 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input.d.ts +3 -0
- package/dist/components/input.js +8 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/loading.d.ts +9 -0
- package/dist/components/loading.js +26 -0
- package/dist/components/loading.js.map +1 -0
- package/dist/components/member-profile.d.ts +79 -0
- package/dist/components/member-profile.js +342 -0
- package/dist/components/member-profile.js.map +1 -0
- package/dist/components/popover.d.ts +9 -0
- package/dist/components/popover.js +52 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/progress.d.ts +7 -0
- package/dist/components/progress.js +40 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/radio-group.d.ts +5 -0
- package/dist/components/radio-group.js +31 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/scroll-area.d.ts +4 -0
- package/dist/components/scroll-area.js +42 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/select.d.ts +15 -0
- package/dist/components/select.js +136 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +3 -0
- package/dist/components/separator.js +8 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/sheet.d.ts +14 -0
- package/dist/components/sheet.js +23 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/sidebar.d.ts +63 -0
- package/dist/components/sidebar.js +536 -0
- package/dist/components/sidebar.js.map +1 -0
- package/dist/components/skeleton.d.ts +2 -0
- package/dist/components/skeleton.js +8 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.d.ts +3 -0
- package/dist/components/slider.js +45 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/sonner.d.ts +3 -0
- package/dist/components/sonner.js +39 -0
- package/dist/components/sonner.js.map +1 -0
- package/dist/components/switch.d.ts +5 -0
- package/dist/components/switch.js +36 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +56 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +10 -0
- package/dist/components/tabs.js +63 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/textarea.d.ts +3 -0
- package/dist/components/textarea.js +8 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/toggle-group.d.ts +11 -0
- package/dist/components/toggle-group.js +80 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.d.ts +8 -0
- package/dist/components/toggle.js +11 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/tooltip.d.ts +6 -0
- package/dist/components/tooltip.js +14 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +7 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/lib/date.d.ts +14 -0
- package/dist/lib/date.js +24 -0
- package/dist/lib/date.js.map +1 -0
- package/dist/lib/format.d.ts +16 -0
- package/dist/lib/format.js +9 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +7 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +71 -0
- package/src/styles/globals.css +151 -0
- package/src/styles/theme.css +144 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "../chunk-Y2TKUANL.js";
|
|
4
|
+
|
|
5
|
+
// src/components/badge.tsx
|
|
6
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
7
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
8
|
+
import { cva } from "class-variance-authority";
|
|
9
|
+
var badgeVariants = cva(
|
|
10
|
+
"group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-4xl border border-transparent px-2 py-0.5 font-medium text-xs transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
|
|
11
|
+
{
|
|
12
|
+
variants: {
|
|
13
|
+
variant: {
|
|
14
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
15
|
+
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
16
|
+
destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
|
|
17
|
+
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
18
|
+
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
19
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: "default"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
function Badge({ className, variant = "default", render, ...props }) {
|
|
28
|
+
return useRender({
|
|
29
|
+
defaultTagName: "span",
|
|
30
|
+
props: mergeProps(
|
|
31
|
+
{
|
|
32
|
+
className: cn(badgeVariants({ variant }), className)
|
|
33
|
+
},
|
|
34
|
+
props
|
|
35
|
+
),
|
|
36
|
+
render,
|
|
37
|
+
state: {
|
|
38
|
+
slot: "badge",
|
|
39
|
+
variant
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
Badge,
|
|
45
|
+
badgeVariants
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/badge.tsx"],"sourcesContent":["import { mergeProps } from '@base-ui/react/merge-props';\nimport { useRender } from '@base-ui/react/use-render';\nimport { cn } from '@betfin/ui/lib/utils';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nconst badgeVariants = cva(\n\t'group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-4xl border border-transparent px-2 py-0.5 font-medium text-xs transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!',\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault: 'bg-primary text-primary-foreground [a]:hover:bg-primary/80',\n\t\t\t\tsecondary: 'bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80',\n\t\t\t\tdestructive:\n\t\t\t\t\t'bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20',\n\t\t\t\toutline: 'border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground',\n\t\t\t\tghost: 'hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50',\n\t\t\t\tlink: 'text-primary underline-offset-4 hover:underline',\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: 'default',\n\t\t},\n\t},\n);\n\nfunction Badge({ className, variant = 'default', render, ...props }: useRender.ComponentProps<'span'> & VariantProps<typeof badgeVariants>) {\n\treturn useRender({\n\t\tdefaultTagName: 'span',\n\t\tprops: mergeProps<'span'>(\n\t\t\t{\n\t\t\t\tclassName: cn(badgeVariants({ variant }), className),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t\tstate: {\n\t\t\tslot: 'badge',\n\t\t\tvariant,\n\t\t},\n\t});\n}\n\nexport { Badge, badgeVariants };\n"],"mappings":";;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAE1B,SAAS,WAA8B;AAEvC,IAAM,gBAAgB;AAAA,EACrB;AAAA,EACA;AAAA,IACC,UAAU;AAAA,MACT,SAAS;AAAA,QACR,SAAS;AAAA,QACT,WAAW;AAAA,QACX,aACC;AAAA,QACD,SAAS;AAAA,QACT,OAAO;AAAA,QACP,MAAM;AAAA,MACP;AAAA,IACD;AAAA,IACA,iBAAiB;AAAA,MAChB,SAAS;AAAA,IACV;AAAA,EACD;AACD;AAEA,SAAS,MAAM,EAAE,WAAW,UAAU,WAAW,QAAQ,GAAG,MAAM,GAA0E;AAC3I,SAAO,UAAU;AAAA,IAChB,gBAAgB;AAAA,IAChB,OAAO;AAAA,MACN;AAAA,QACC,WAAW,GAAG,cAAc,EAAE,QAAQ,CAAC,GAAG,SAAS;AAAA,MACpD;AAAA,MACA;AAAA,IACD;AAAA,IACA;AAAA,IACA,OAAO;AAAA,MACN,MAAM;AAAA,MACN;AAAA,IACD;AAAA,EACD,CAAC;AACF;","names":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type FormatBetOptions } from '@betfin/ui/lib/format';
|
|
2
|
+
import type { CSSProperties } from 'react';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
/** Whitelabel override for the coin glyph, set by the host from the manifest
|
|
6
|
+
* (`branding.betIcon`). A window global so it crosses the module-federation
|
|
7
|
+
* boundary — remotes render BetCoin against the host's window. */
|
|
8
|
+
__BET_ICON__?: string;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The BET coin token — the single source of the coin glyph. Renders the default
|
|
13
|
+
* gold coin (from the original Betfin design system), or a whitelabel image when
|
|
14
|
+
* `window.__BET_ICON__` is set.
|
|
15
|
+
*/
|
|
16
|
+
export declare function BetCoin({ size, className, style }: {
|
|
17
|
+
size?: number | string;
|
|
18
|
+
className?: string;
|
|
19
|
+
style?: CSSProperties;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
21
|
+
export interface BetValueProps extends FormatBetOptions {
|
|
22
|
+
/** The amount — a number, or a raw on-chain bigint (18-decimals). */
|
|
23
|
+
value: number | bigint;
|
|
24
|
+
/** Colour the number + coin in the brand primary (gold). */
|
|
25
|
+
gold?: boolean;
|
|
26
|
+
/** Coin size — a px number, or any CSS length. Defaults to `1em` so it scales with the surrounding text. */
|
|
27
|
+
size?: number | string;
|
|
28
|
+
/** Show the BET coin (default true). */
|
|
29
|
+
icon?: boolean;
|
|
30
|
+
/** Coin side (default 'right'). */
|
|
31
|
+
iconPosition?: 'left' | 'right';
|
|
32
|
+
/** Optional text before the number. */
|
|
33
|
+
prefix?: string;
|
|
34
|
+
/** Tooltip side (default 'top'). */
|
|
35
|
+
tooltipSide?: 'top' | 'bottom' | 'left' | 'right';
|
|
36
|
+
className?: string;
|
|
37
|
+
style?: CSSProperties;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Canonical way to display a BET amount. Formats the value compactly and shows
|
|
41
|
+
* the gold coin (sized to the surrounding text). Hovering reveals the exact,
|
|
42
|
+
* un-abbreviated amount in a styled tooltip. Use this everywhere a BET amount
|
|
43
|
+
* is rendered.
|
|
44
|
+
*
|
|
45
|
+
* <BetValue value={12_500} /> → 12.5K ● (coin matches text size)
|
|
46
|
+
* <BetValue value={rewardsBigint} gold /> → 1.24K ● (gold)
|
|
47
|
+
* <BetValue value={n} size={30} /> → fixed 30px coin
|
|
48
|
+
*/
|
|
49
|
+
export declare function BetValue({ value, gold, size, icon, iconPosition, prefix, tooltipSide, className, style, ...opts }: BetValueProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
declare function Breadcrumb({ className, ...props }: React.ComponentProps<'nav'>): React.JSX.Element;
|
|
4
|
+
declare function BreadcrumbList({ className, ...props }: React.ComponentProps<'ol'>): React.JSX.Element;
|
|
5
|
+
declare function BreadcrumbItem({ className, ...props }: React.ComponentProps<'li'>): React.JSX.Element;
|
|
6
|
+
declare function BreadcrumbLink({ className, render, ...props }: useRender.ComponentProps<'a'>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
7
|
+
declare function BreadcrumbPage({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
|
|
8
|
+
declare function BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<'li'>): React.JSX.Element;
|
|
9
|
+
declare function BreadcrumbEllipsis({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
|
|
10
|
+
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "../chunk-Y2TKUANL.js";
|
|
4
|
+
|
|
5
|
+
// src/components/breadcrumb.tsx
|
|
6
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
7
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
8
|
+
import { ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
function Breadcrumb({ className, ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", className: cn(className), ...props });
|
|
12
|
+
}
|
|
13
|
+
function BreadcrumbList({ className, ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx("ol", { "data-slot": "breadcrumb-list", className: cn("wrap-break-word flex flex-wrap items-center gap-1.5 text-muted-foreground text-sm", className), ...props });
|
|
15
|
+
}
|
|
16
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx("li", { "data-slot": "breadcrumb-item", className: cn("inline-flex items-center gap-1", className), ...props });
|
|
18
|
+
}
|
|
19
|
+
function BreadcrumbLink({ className, render, ...props }) {
|
|
20
|
+
return useRender({
|
|
21
|
+
defaultTagName: "a",
|
|
22
|
+
props: mergeProps(
|
|
23
|
+
{
|
|
24
|
+
className: cn("transition-colors hover:text-foreground", className)
|
|
25
|
+
},
|
|
26
|
+
props
|
|
27
|
+
),
|
|
28
|
+
render,
|
|
29
|
+
state: {
|
|
30
|
+
slot: "breadcrumb-link"
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
35
|
+
return /* @__PURE__ */ jsx("span", { "data-slot": "breadcrumb-page", "aria-current": "page", className: cn("font-normal text-foreground", className), ...props });
|
|
36
|
+
}
|
|
37
|
+
function BreadcrumbSeparator({ children, className, ...props }) {
|
|
38
|
+
return /* @__PURE__ */ jsx("li", { "data-slot": "breadcrumb-separator", role: "presentation", "aria-hidden": "true", className: cn("[&>svg]:size-3.5", className), ...props, children: children ?? /* @__PURE__ */ jsx(ChevronRightIcon, {}) });
|
|
39
|
+
}
|
|
40
|
+
function BreadcrumbEllipsis({ className, ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsxs(
|
|
42
|
+
"span",
|
|
43
|
+
{
|
|
44
|
+
"data-slot": "breadcrumb-ellipsis",
|
|
45
|
+
role: "presentation",
|
|
46
|
+
"aria-hidden": "true",
|
|
47
|
+
className: cn("flex size-5 items-center justify-center [&>svg]:size-4", className),
|
|
48
|
+
...props,
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx(MoreHorizontalIcon, {}),
|
|
51
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "More" })
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
Breadcrumb,
|
|
58
|
+
BreadcrumbEllipsis,
|
|
59
|
+
BreadcrumbItem,
|
|
60
|
+
BreadcrumbLink,
|
|
61
|
+
BreadcrumbList,
|
|
62
|
+
BreadcrumbPage,
|
|
63
|
+
BreadcrumbSeparator
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=breadcrumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/breadcrumb.tsx"],"sourcesContent":["import { mergeProps } from '@base-ui/react/merge-props';\nimport { useRender } from '@base-ui/react/use-render';\nimport { cn } from '@betfin/ui/lib/utils';\nimport { ChevronRightIcon, MoreHorizontalIcon } from 'lucide-react';\nimport type * as React from 'react';\n\nfunction Breadcrumb({ className, ...props }: React.ComponentProps<'nav'>) {\n\treturn <nav aria-label=\"breadcrumb\" data-slot=\"breadcrumb\" className={cn(className)} {...props} />;\n}\n\nfunction BreadcrumbList({ className, ...props }: React.ComponentProps<'ol'>) {\n\treturn (\n\t\t<ol data-slot=\"breadcrumb-list\" className={cn('wrap-break-word flex flex-wrap items-center gap-1.5 text-muted-foreground text-sm', className)} {...props} />\n\t);\n}\n\nfunction BreadcrumbItem({ className, ...props }: React.ComponentProps<'li'>) {\n\treturn <li data-slot=\"breadcrumb-item\" className={cn('inline-flex items-center gap-1', className)} {...props} />;\n}\n\nfunction BreadcrumbLink({ className, render, ...props }: useRender.ComponentProps<'a'>) {\n\treturn useRender({\n\t\tdefaultTagName: 'a',\n\t\tprops: mergeProps<'a'>(\n\t\t\t{\n\t\t\t\tclassName: cn('transition-colors hover:text-foreground', className),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t\tstate: {\n\t\t\tslot: 'breadcrumb-link',\n\t\t},\n\t});\n}\n\nfunction BreadcrumbPage({ className, ...props }: React.ComponentProps<'span'>) {\n\treturn <span data-slot=\"breadcrumb-page\" aria-current=\"page\" className={cn('font-normal text-foreground', className)} {...props} />;\n}\n\nfunction BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<'li'>) {\n\treturn (\n\t\t<li data-slot=\"breadcrumb-separator\" role=\"presentation\" aria-hidden=\"true\" className={cn('[&>svg]:size-3.5', className)} {...props}>\n\t\t\t{children ?? <ChevronRightIcon />}\n\t\t</li>\n\t);\n}\n\nfunction BreadcrumbEllipsis({ className, ...props }: React.ComponentProps<'span'>) {\n\treturn (\n\t\t<span\n\t\t\tdata-slot=\"breadcrumb-ellipsis\"\n\t\t\trole=\"presentation\"\n\t\t\taria-hidden=\"true\"\n\t\t\tclassName={cn('flex size-5 items-center justify-center [&>svg]:size-4', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<MoreHorizontalIcon />\n\t\t\t<span className=\"sr-only\">More</span>\n\t\t</span>\n\t);\n}\n\nexport { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };\n"],"mappings":";;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAE1B,SAAS,kBAAkB,0BAA0B;AAI7C,cA2CN,YA3CM;AADR,SAAS,WAAW,EAAE,WAAW,GAAG,MAAM,GAAgC;AACzE,SAAO,oBAAC,SAAI,cAAW,cAAa,aAAU,cAAa,WAAW,GAAG,SAAS,GAAI,GAAG,OAAO;AACjG;AAEA,SAAS,eAAe,EAAE,WAAW,GAAG,MAAM,GAA+B;AAC5E,SACC,oBAAC,QAAG,aAAU,mBAAkB,WAAW,GAAG,qFAAqF,SAAS,GAAI,GAAG,OAAO;AAE5J;AAEA,SAAS,eAAe,EAAE,WAAW,GAAG,MAAM,GAA+B;AAC5E,SAAO,oBAAC,QAAG,aAAU,mBAAkB,WAAW,GAAG,kCAAkC,SAAS,GAAI,GAAG,OAAO;AAC/G;AAEA,SAAS,eAAe,EAAE,WAAW,QAAQ,GAAG,MAAM,GAAkC;AACvF,SAAO,UAAU;AAAA,IAChB,gBAAgB;AAAA,IAChB,OAAO;AAAA,MACN;AAAA,QACC,WAAW,GAAG,2CAA2C,SAAS;AAAA,MACnE;AAAA,MACA;AAAA,IACD;AAAA,IACA;AAAA,IACA,OAAO;AAAA,MACN,MAAM;AAAA,IACP;AAAA,EACD,CAAC;AACF;AAEA,SAAS,eAAe,EAAE,WAAW,GAAG,MAAM,GAAiC;AAC9E,SAAO,oBAAC,UAAK,aAAU,mBAAkB,gBAAa,QAAO,WAAW,GAAG,+BAA+B,SAAS,GAAI,GAAG,OAAO;AAClI;AAEA,SAAS,oBAAoB,EAAE,UAAU,WAAW,GAAG,MAAM,GAA+B;AAC3F,SACC,oBAAC,QAAG,aAAU,wBAAuB,MAAK,gBAAe,eAAY,QAAO,WAAW,GAAG,oBAAoB,SAAS,GAAI,GAAG,OAC5H,sBAAY,oBAAC,oBAAiB,GAChC;AAEF;AAEA,SAAS,mBAAmB,EAAE,WAAW,GAAG,MAAM,GAAiC;AAClF,SACC;AAAA,IAAC;AAAA;AAAA,MACA,aAAU;AAAA,MACV,MAAK;AAAA,MACL,eAAY;AAAA,MACZ,WAAW,GAAG,0DAA0D,SAAS;AAAA,MAChF,GAAG;AAAA,MAEJ;AAAA,4BAAC,sBAAmB;AAAA,QACpB,oBAAC,UAAK,WAAU,WAAU,kBAAI;AAAA;AAAA;AAAA,EAC/B;AAEF;","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Button as ButtonPrimitive } from '@base-ui/react/button';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "destructive" | "ghost" | "link" | "outline" | "secondary" | null | undefined;
|
|
5
|
+
size?: "default" | "icon" | "icon-lg" | "icon-sm" | "icon-xs" | "lg" | "sm" | "xs" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare function Button({ className, variant, size, ...props }: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>): import("react").JSX.Element;
|
|
8
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Button } from '@betfin/ui/components/button';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { type DayButton, DayPicker, type Locale } from 'react-day-picker';
|
|
4
|
+
declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, locale, formatters, components, ...props }: React.ComponentProps<typeof DayPicker> & {
|
|
5
|
+
buttonVariant?: React.ComponentProps<typeof Button>['variant'];
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
declare function CalendarDayButton({ className, day, modifiers, locale, ...props }: React.ComponentProps<typeof DayButton> & {
|
|
8
|
+
locale?: Partial<Locale>;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
export { Calendar, CalendarDayButton };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
buttonVariants
|
|
5
|
+
} from "../chunk-5CXIFF6J.js";
|
|
6
|
+
import {
|
|
7
|
+
cn
|
|
8
|
+
} from "../chunk-Y2TKUANL.js";
|
|
9
|
+
|
|
10
|
+
// src/components/calendar.tsx
|
|
11
|
+
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
function Calendar({
|
|
16
|
+
className,
|
|
17
|
+
classNames,
|
|
18
|
+
showOutsideDays = true,
|
|
19
|
+
captionLayout = "label",
|
|
20
|
+
buttonVariant = "ghost",
|
|
21
|
+
locale,
|
|
22
|
+
formatters,
|
|
23
|
+
components,
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
26
|
+
const defaultClassNames = getDefaultClassNames();
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
DayPicker,
|
|
29
|
+
{
|
|
30
|
+
showOutsideDays,
|
|
31
|
+
className: cn(
|
|
32
|
+
"group/calendar bg-background in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)]",
|
|
33
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
34
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
35
|
+
className
|
|
36
|
+
),
|
|
37
|
+
captionLayout,
|
|
38
|
+
locale,
|
|
39
|
+
formatters: {
|
|
40
|
+
formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
|
|
41
|
+
...formatters
|
|
42
|
+
},
|
|
43
|
+
classNames: {
|
|
44
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
45
|
+
months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
|
|
46
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
47
|
+
nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
|
|
48
|
+
button_previous: cn(
|
|
49
|
+
buttonVariants({ variant: buttonVariant }),
|
|
50
|
+
"size-(--cell-size) select-none p-0 aria-disabled:opacity-50",
|
|
51
|
+
defaultClassNames.button_previous
|
|
52
|
+
),
|
|
53
|
+
button_next: cn(
|
|
54
|
+
buttonVariants({ variant: buttonVariant }),
|
|
55
|
+
"size-(--cell-size) select-none p-0 aria-disabled:opacity-50",
|
|
56
|
+
defaultClassNames.button_next
|
|
57
|
+
),
|
|
58
|
+
month_caption: cn("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)", defaultClassNames.month_caption),
|
|
59
|
+
dropdowns: cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5 font-medium text-sm", defaultClassNames.dropdowns),
|
|
60
|
+
dropdown_root: cn("relative rounded-(--cell-radius)", defaultClassNames.dropdown_root),
|
|
61
|
+
dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
|
|
62
|
+
caption_label: cn(
|
|
63
|
+
"select-none font-medium",
|
|
64
|
+
captionLayout === "label" ? "text-sm" : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
|
|
65
|
+
defaultClassNames.caption_label
|
|
66
|
+
),
|
|
67
|
+
month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
|
|
68
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
69
|
+
weekday: cn("flex-1 select-none rounded-(--cell-radius) font-normal text-[0.8rem] text-muted-foreground", defaultClassNames.weekday),
|
|
70
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
71
|
+
week_number_header: cn("w-(--cell-size) select-none", defaultClassNames.week_number_header),
|
|
72
|
+
week_number: cn("select-none text-[0.8rem] text-muted-foreground", defaultClassNames.week_number),
|
|
73
|
+
day: cn(
|
|
74
|
+
"group/day relative aspect-square h-full w-full select-none rounded-(--cell-radius) p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)",
|
|
75
|
+
props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)",
|
|
76
|
+
defaultClassNames.day
|
|
77
|
+
),
|
|
78
|
+
range_start: cn(
|
|
79
|
+
"relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted",
|
|
80
|
+
defaultClassNames.range_start
|
|
81
|
+
),
|
|
82
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
83
|
+
range_end: cn(
|
|
84
|
+
"relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted",
|
|
85
|
+
defaultClassNames.range_end
|
|
86
|
+
),
|
|
87
|
+
today: cn("rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none", defaultClassNames.today),
|
|
88
|
+
outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
89
|
+
disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
|
|
90
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
91
|
+
...classNames
|
|
92
|
+
},
|
|
93
|
+
components: {
|
|
94
|
+
Root: ({ className: className2, rootRef, ...props2 }) => {
|
|
95
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "calendar", ref: rootRef, className: cn(className2), ...props2 });
|
|
96
|
+
},
|
|
97
|
+
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
98
|
+
if (orientation === "left") {
|
|
99
|
+
return /* @__PURE__ */ jsx(ChevronLeftIcon, { className: cn("size-4", className2), ...props2 });
|
|
100
|
+
}
|
|
101
|
+
if (orientation === "right") {
|
|
102
|
+
return /* @__PURE__ */ jsx(ChevronRightIcon, { className: cn("size-4", className2), ...props2 });
|
|
103
|
+
}
|
|
104
|
+
return /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn("size-4", className2), ...props2 });
|
|
105
|
+
},
|
|
106
|
+
DayButton: ({ ...props2 }) => /* @__PURE__ */ jsx(CalendarDayButton, { locale, ...props2 }),
|
|
107
|
+
WeekNumber: ({ children, ...props2 }) => {
|
|
108
|
+
return /* @__PURE__ */ jsx("td", { ...props2, children: /* @__PURE__ */ jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
|
|
109
|
+
},
|
|
110
|
+
...components
|
|
111
|
+
},
|
|
112
|
+
...props
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
function CalendarDayButton({ className, day, modifiers, locale, ...props }) {
|
|
117
|
+
const defaultClassNames = getDefaultClassNames();
|
|
118
|
+
const ref = React.useRef(null);
|
|
119
|
+
React.useEffect(() => {
|
|
120
|
+
if (modifiers.focused) ref.current?.focus();
|
|
121
|
+
}, [modifiers.focused]);
|
|
122
|
+
return /* @__PURE__ */ jsx(
|
|
123
|
+
Button,
|
|
124
|
+
{
|
|
125
|
+
variant: "ghost",
|
|
126
|
+
size: "icon",
|
|
127
|
+
"data-day": day.date.toLocaleDateString(locale?.code),
|
|
128
|
+
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
129
|
+
"data-range-start": modifiers.range_start,
|
|
130
|
+
"data-range-end": modifiers.range_end,
|
|
131
|
+
"data-range-middle": modifiers.range_middle,
|
|
132
|
+
className: cn(
|
|
133
|
+
"relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 font-normal leading-none data-[range-end=true]:rounded-(--cell-radius) data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-end=true]:bg-primary data-[range-middle=true]:bg-muted data-[range-start=true]:bg-primary data-[selected-single=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:text-foreground data-[range-start=true]:text-primary-foreground data-[selected-single=true]:text-primary-foreground group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70",
|
|
134
|
+
defaultClassNames.day,
|
|
135
|
+
className
|
|
136
|
+
),
|
|
137
|
+
...props
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
export {
|
|
142
|
+
Calendar,
|
|
143
|
+
CalendarDayButton
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=calendar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/calendar.tsx"],"sourcesContent":["'use client';\n\nimport { Button, buttonVariants } from '@betfin/ui/components/button';\nimport { cn } from '@betfin/ui/lib/utils';\nimport { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport * as React from 'react';\nimport { type DayButton, DayPicker, getDefaultClassNames, type Locale } from 'react-day-picker';\n\nfunction Calendar({\n\tclassName,\n\tclassNames,\n\tshowOutsideDays = true,\n\tcaptionLayout = 'label',\n\tbuttonVariant = 'ghost',\n\tlocale,\n\tformatters,\n\tcomponents,\n\t...props\n}: React.ComponentProps<typeof DayPicker> & {\n\tbuttonVariant?: React.ComponentProps<typeof Button>['variant'];\n}) {\n\tconst defaultClassNames = getDefaultClassNames();\n\n\treturn (\n\t\t<DayPicker\n\t\t\tshowOutsideDays={showOutsideDays}\n\t\t\tclassName={cn(\n\t\t\t\t'group/calendar bg-background in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)]',\n\t\t\t\tString.raw`rtl:**:[.rdp-button\\_next>svg]:rotate-180`,\n\t\t\t\tString.raw`rtl:**:[.rdp-button\\_previous>svg]:rotate-180`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tcaptionLayout={captionLayout}\n\t\t\tlocale={locale}\n\t\t\tformatters={{\n\t\t\t\tformatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: 'short' }),\n\t\t\t\t...formatters,\n\t\t\t}}\n\t\t\tclassNames={{\n\t\t\t\troot: cn('w-fit', defaultClassNames.root),\n\t\t\t\tmonths: cn('relative flex flex-col gap-4 md:flex-row', defaultClassNames.months),\n\t\t\t\tmonth: cn('flex w-full flex-col gap-4', defaultClassNames.month),\n\t\t\t\tnav: cn('absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1', defaultClassNames.nav),\n\t\t\t\tbutton_previous: cn(\n\t\t\t\t\tbuttonVariants({ variant: buttonVariant }),\n\t\t\t\t\t'size-(--cell-size) select-none p-0 aria-disabled:opacity-50',\n\t\t\t\t\tdefaultClassNames.button_previous,\n\t\t\t\t),\n\t\t\t\tbutton_next: cn(\n\t\t\t\t\tbuttonVariants({ variant: buttonVariant }),\n\t\t\t\t\t'size-(--cell-size) select-none p-0 aria-disabled:opacity-50',\n\t\t\t\t\tdefaultClassNames.button_next,\n\t\t\t\t),\n\t\t\t\tmonth_caption: cn('flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)', defaultClassNames.month_caption),\n\t\t\t\tdropdowns: cn('flex h-(--cell-size) w-full items-center justify-center gap-1.5 font-medium text-sm', defaultClassNames.dropdowns),\n\t\t\t\tdropdown_root: cn('relative rounded-(--cell-radius)', defaultClassNames.dropdown_root),\n\t\t\t\tdropdown: cn('absolute inset-0 bg-popover opacity-0', defaultClassNames.dropdown),\n\t\t\t\tcaption_label: cn(\n\t\t\t\t\t'select-none font-medium',\n\t\t\t\t\tcaptionLayout === 'label' ? 'text-sm' : 'flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground',\n\t\t\t\t\tdefaultClassNames.caption_label,\n\t\t\t\t),\n\t\t\t\tmonth_grid: cn('w-full border-collapse', defaultClassNames.month_grid),\n\t\t\t\tweekdays: cn('flex', defaultClassNames.weekdays),\n\t\t\t\tweekday: cn('flex-1 select-none rounded-(--cell-radius) font-normal text-[0.8rem] text-muted-foreground', defaultClassNames.weekday),\n\t\t\t\tweek: cn('mt-2 flex w-full', defaultClassNames.week),\n\t\t\t\tweek_number_header: cn('w-(--cell-size) select-none', defaultClassNames.week_number_header),\n\t\t\t\tweek_number: cn('select-none text-[0.8rem] text-muted-foreground', defaultClassNames.week_number),\n\t\t\t\tday: cn(\n\t\t\t\t\t'group/day relative aspect-square h-full w-full select-none rounded-(--cell-radius) p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)',\n\t\t\t\t\tprops.showWeekNumber\n\t\t\t\t\t\t? '[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)'\n\t\t\t\t\t\t: '[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)',\n\t\t\t\t\tdefaultClassNames.day,\n\t\t\t\t),\n\t\t\t\trange_start: cn(\n\t\t\t\t\t'relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted',\n\t\t\t\t\tdefaultClassNames.range_start,\n\t\t\t\t),\n\t\t\t\trange_middle: cn('rounded-none', defaultClassNames.range_middle),\n\t\t\t\trange_end: cn(\n\t\t\t\t\t'relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted',\n\t\t\t\t\tdefaultClassNames.range_end,\n\t\t\t\t),\n\t\t\t\ttoday: cn('rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none', defaultClassNames.today),\n\t\t\t\toutside: cn('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside),\n\t\t\t\tdisabled: cn('text-muted-foreground opacity-50', defaultClassNames.disabled),\n\t\t\t\thidden: cn('invisible', defaultClassNames.hidden),\n\t\t\t\t...classNames,\n\t\t\t}}\n\t\t\tcomponents={{\n\t\t\t\tRoot: ({ className, rootRef, ...props }) => {\n\t\t\t\t\treturn <div data-slot=\"calendar\" ref={rootRef} className={cn(className)} {...props} />;\n\t\t\t\t},\n\t\t\t\tChevron: ({ className, orientation, ...props }) => {\n\t\t\t\t\tif (orientation === 'left') {\n\t\t\t\t\t\treturn <ChevronLeftIcon className={cn('size-4', className)} {...props} />;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (orientation === 'right') {\n\t\t\t\t\t\treturn <ChevronRightIcon className={cn('size-4', className)} {...props} />;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn <ChevronDownIcon className={cn('size-4', className)} {...props} />;\n\t\t\t\t},\n\t\t\t\tDayButton: ({ ...props }) => <CalendarDayButton locale={locale} {...props} />,\n\t\t\t\tWeekNumber: ({ children, ...props }) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<td {...props}>\n\t\t\t\t\t\t\t<div className=\"flex size-(--cell-size) items-center justify-center text-center\">{children}</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\t...components,\n\t\t\t}}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction CalendarDayButton({ className, day, modifiers, locale, ...props }: React.ComponentProps<typeof DayButton> & { locale?: Partial<Locale> }) {\n\tconst defaultClassNames = getDefaultClassNames();\n\n\tconst ref = React.useRef<HTMLButtonElement>(null);\n\tReact.useEffect(() => {\n\t\tif (modifiers.focused) ref.current?.focus();\n\t}, [modifiers.focused]);\n\n\treturn (\n\t\t<Button\n\t\t\tvariant=\"ghost\"\n\t\t\tsize=\"icon\"\n\t\t\tdata-day={day.date.toLocaleDateString(locale?.code)}\n\t\t\tdata-selected-single={modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle}\n\t\t\tdata-range-start={modifiers.range_start}\n\t\t\tdata-range-end={modifiers.range_end}\n\t\t\tdata-range-middle={modifiers.range_middle}\n\t\t\tclassName={cn(\n\t\t\t\t'relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 font-normal leading-none data-[range-end=true]:rounded-(--cell-radius) data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-end=true]:bg-primary data-[range-middle=true]:bg-muted data-[range-start=true]:bg-primary data-[selected-single=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:text-foreground data-[range-start=true]:text-primary-foreground data-[selected-single=true]:text-primary-foreground group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70',\n\t\t\t\tdefaultClassNames.day,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Calendar, CalendarDayButton };\n"],"mappings":";;;;;;;;;;AAIA,SAAS,iBAAiB,iBAAiB,wBAAwB;AACnE,YAAY,WAAW;AACvB,SAAyB,WAAW,4BAAyC;AAsFjE;AApFZ,SAAS,SAAS;AAAA,EACjB;AAAA,EACA;AAAA,EACA,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EA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QAAiB,GAAGA,QAAO;AAAA,QAC3E,YAAY,CAAC,EAAE,UAAU,GAAGA,OAAM,MAAM;AACvC,iBACC,oBAAC,QAAI,GAAGA,QACP,8BAAC,SAAI,WAAU,mEAAmE,UAAS,GAC5F;AAAA,QAEF;AAAA,QACA,GAAG;AAAA,MACJ;AAAA,MACC,GAAG;AAAA;AAAA,EACL;AAEF;AAEA,SAAS,kBAAkB,EAAE,WAAW,KAAK,WAAW,QAAQ,GAAG,MAAM,GAA0E;AAClJ,QAAM,oBAAoB,qBAAqB;AAE/C,QAAM,MAAY,aAA0B,IAAI;AAChD,EAAM,gBAAU,MAAM;AACrB,QAAI,UAAU,QAAS,KAAI,SAAS,MAAM;AAAA,EAC3C,GAAG,CAAC,UAAU,OAAO,CAAC;AAEtB,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,YAAU,IAAI,KAAK,mBAAmB,QAAQ,IAAI;AAAA,MAClD,wBAAsB,UAAU,YAAY,CAAC,UAAU,eAAe,CAAC,UAAU,aAAa,CAAC,UAAU;AAAA,MACzG,oBAAkB,UAAU;AAAA,MAC5B,kBAAgB,UAAU;AAAA,MAC1B,qBAAmB,UAAU;AAAA,MAC7B,WAAW;AAAA,QACV;AAAA,QACA,kBAAkB;AAAA,QAClB;AAAA,MACD;AAAA,MACC,GAAG;AAAA;AAAA,EACL;AAEF;","names":["className","props"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Button } from '@betfin/ui/components/button';
|
|
2
|
+
import useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
type CarouselApi = UseEmblaCarouselType[1];
|
|
5
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
6
|
+
type CarouselOptions = UseCarouselParameters[0];
|
|
7
|
+
type CarouselPlugin = UseCarouselParameters[1];
|
|
8
|
+
type CarouselProps = {
|
|
9
|
+
opts?: CarouselOptions;
|
|
10
|
+
plugins?: CarouselPlugin;
|
|
11
|
+
orientation?: 'horizontal' | 'vertical';
|
|
12
|
+
setApi?: (api: CarouselApi) => void;
|
|
13
|
+
};
|
|
14
|
+
type CarouselContextProps = {
|
|
15
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
16
|
+
api: ReturnType<typeof useEmblaCarousel>[1];
|
|
17
|
+
scrollPrev: () => void;
|
|
18
|
+
scrollNext: () => void;
|
|
19
|
+
canScrollPrev: boolean;
|
|
20
|
+
canScrollNext: boolean;
|
|
21
|
+
} & CarouselProps;
|
|
22
|
+
declare function useCarousel(): CarouselContextProps;
|
|
23
|
+
declare function Carousel({ orientation, opts, setApi, plugins, className, children, ...props }: React.ComponentProps<'div'> & CarouselProps): React.JSX.Element;
|
|
24
|
+
declare function CarouselContent({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
25
|
+
declare function CarouselItem({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
26
|
+
declare function CarouselPrevious({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
27
|
+
declare function CarouselNext({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
28
|
+
export { Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel };
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button
|
|
3
|
+
} from "../chunk-5CXIFF6J.js";
|
|
4
|
+
import {
|
|
5
|
+
cn
|
|
6
|
+
} from "../chunk-Y2TKUANL.js";
|
|
7
|
+
|
|
8
|
+
// src/components/carousel.tsx
|
|
9
|
+
import useEmblaCarousel from "embla-carousel-react";
|
|
10
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
var CarouselContext = React.createContext(null);
|
|
14
|
+
function useCarousel() {
|
|
15
|
+
const context = React.use(CarouselContext);
|
|
16
|
+
if (!context) {
|
|
17
|
+
throw new Error("useCarousel must be used within a <Carousel />");
|
|
18
|
+
}
|
|
19
|
+
return context;
|
|
20
|
+
}
|
|
21
|
+
function Carousel({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }) {
|
|
22
|
+
const [carouselRef, api] = useEmblaCarousel(
|
|
23
|
+
{
|
|
24
|
+
...opts,
|
|
25
|
+
axis: orientation === "horizontal" ? "x" : "y"
|
|
26
|
+
},
|
|
27
|
+
plugins
|
|
28
|
+
);
|
|
29
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
30
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
31
|
+
const onSelect = React.useCallback((api2) => {
|
|
32
|
+
if (!api2) return;
|
|
33
|
+
setCanScrollPrev(api2.canScrollPrev());
|
|
34
|
+
setCanScrollNext(api2.canScrollNext());
|
|
35
|
+
}, []);
|
|
36
|
+
const scrollPrev = React.useCallback(() => {
|
|
37
|
+
api?.scrollPrev();
|
|
38
|
+
}, [api]);
|
|
39
|
+
const scrollNext = React.useCallback(() => {
|
|
40
|
+
api?.scrollNext();
|
|
41
|
+
}, [api]);
|
|
42
|
+
const handleKeyDown = React.useCallback(
|
|
43
|
+
(event) => {
|
|
44
|
+
if (event.key === "ArrowLeft") {
|
|
45
|
+
event.preventDefault();
|
|
46
|
+
scrollPrev();
|
|
47
|
+
} else if (event.key === "ArrowRight") {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
scrollNext();
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
[scrollPrev, scrollNext]
|
|
53
|
+
);
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
if (!api || !setApi) return;
|
|
56
|
+
setApi(api);
|
|
57
|
+
}, [api, setApi]);
|
|
58
|
+
React.useEffect(() => {
|
|
59
|
+
if (!api) return;
|
|
60
|
+
onSelect(api);
|
|
61
|
+
api.on("reInit", onSelect);
|
|
62
|
+
api.on("select", onSelect);
|
|
63
|
+
return () => {
|
|
64
|
+
api?.off("select", onSelect);
|
|
65
|
+
};
|
|
66
|
+
}, [api, onSelect]);
|
|
67
|
+
const contextValue = React.useMemo(
|
|
68
|
+
() => ({
|
|
69
|
+
carouselRef,
|
|
70
|
+
api,
|
|
71
|
+
opts,
|
|
72
|
+
orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
|
73
|
+
scrollPrev,
|
|
74
|
+
scrollNext,
|
|
75
|
+
canScrollPrev,
|
|
76
|
+
canScrollNext
|
|
77
|
+
}),
|
|
78
|
+
[carouselRef, api, opts, orientation, scrollPrev, scrollNext, canScrollPrev, canScrollNext]
|
|
79
|
+
);
|
|
80
|
+
return /* @__PURE__ */ jsx(CarouselContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("div", { onKeyDownCapture: handleKeyDown, className: cn("relative", className), role: "region", "aria-roledescription": "carousel", "data-slot": "carousel", ...props, children }) });
|
|
81
|
+
}
|
|
82
|
+
function CarouselContent({ className, ...props }) {
|
|
83
|
+
const { carouselRef, orientation } = useCarousel();
|
|
84
|
+
return /* @__PURE__ */ jsx("div", { ref: carouselRef, className: "overflow-hidden", "data-slot": "carousel-content", children: /* @__PURE__ */ jsx("div", { className: cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className), ...props }) });
|
|
85
|
+
}
|
|
86
|
+
function CarouselItem({ className, ...props }) {
|
|
87
|
+
const { orientation } = useCarousel();
|
|
88
|
+
return /* @__PURE__ */ jsx(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
role: "group",
|
|
92
|
+
"aria-roledescription": "slide",
|
|
93
|
+
"data-slot": "carousel-item",
|
|
94
|
+
className: cn("min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className),
|
|
95
|
+
...props
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
function CarouselPrevious({ className, variant = "outline", size = "icon-sm", ...props }) {
|
|
100
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
101
|
+
return /* @__PURE__ */ jsxs(
|
|
102
|
+
Button,
|
|
103
|
+
{
|
|
104
|
+
"data-slot": "carousel-previous",
|
|
105
|
+
variant,
|
|
106
|
+
size,
|
|
107
|
+
className: cn(
|
|
108
|
+
"absolute touch-manipulation rounded-full",
|
|
109
|
+
orientation === "horizontal" ? "inset-y-0 -left-12 my-auto" : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
110
|
+
className
|
|
111
|
+
),
|
|
112
|
+
disabled: !canScrollPrev,
|
|
113
|
+
onClick: scrollPrev,
|
|
114
|
+
...props,
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ jsx(ChevronLeftIcon, {}),
|
|
117
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Previous slide" })
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
function CarouselNext({ className, variant = "outline", size = "icon-sm", ...props }) {
|
|
123
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
124
|
+
return /* @__PURE__ */ jsxs(
|
|
125
|
+
Button,
|
|
126
|
+
{
|
|
127
|
+
"data-slot": "carousel-next",
|
|
128
|
+
variant,
|
|
129
|
+
size,
|
|
130
|
+
className: cn(
|
|
131
|
+
"absolute touch-manipulation rounded-full",
|
|
132
|
+
orientation === "horizontal" ? "inset-y-0 -right-12 my-auto" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
133
|
+
className
|
|
134
|
+
),
|
|
135
|
+
disabled: !canScrollNext,
|
|
136
|
+
onClick: scrollNext,
|
|
137
|
+
...props,
|
|
138
|
+
children: [
|
|
139
|
+
/* @__PURE__ */ jsx(ChevronRightIcon, {}),
|
|
140
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Next slide" })
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
export {
|
|
146
|
+
Carousel,
|
|
147
|
+
CarouselContent,
|
|
148
|
+
CarouselItem,
|
|
149
|
+
CarouselNext,
|
|
150
|
+
CarouselPrevious,
|
|
151
|
+
useCarousel
|
|
152
|
+
};
|
|
153
|
+
//# sourceMappingURL=carousel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/carousel.tsx"],"sourcesContent":["import { Button } from '@betfin/ui/components/button';\nimport { cn } from '@betfin/ui/lib/utils';\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';\nimport { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport * as React from 'react';\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = {\n\topts?: CarouselOptions;\n\tplugins?: CarouselPlugin;\n\torientation?: 'horizontal' | 'vertical';\n\tsetApi?: (api: CarouselApi) => void;\n};\n\ntype CarouselContextProps = {\n\tcarouselRef: ReturnType<typeof useEmblaCarousel>[0];\n\tapi: ReturnType<typeof useEmblaCarousel>[1];\n\tscrollPrev: () => void;\n\tscrollNext: () => void;\n\tcanScrollPrev: boolean;\n\tcanScrollNext: boolean;\n} & CarouselProps;\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\n\nfunction useCarousel() {\n\tconst context = React.use(CarouselContext);\n\n\tif (!context) {\n\t\tthrow new Error('useCarousel must be used within a <Carousel />');\n\t}\n\n\treturn context;\n}\n\nfunction Carousel({ orientation = 'horizontal', opts, setApi, plugins, className, children, ...props }: React.ComponentProps<'div'> & CarouselProps) {\n\tconst [carouselRef, api] = useEmblaCarousel(\n\t\t{\n\t\t\t...opts,\n\t\t\taxis: orientation === 'horizontal' ? 'x' : 'y',\n\t\t},\n\t\tplugins,\n\t);\n\tconst [canScrollPrev, setCanScrollPrev] = React.useState(false);\n\tconst [canScrollNext, setCanScrollNext] = React.useState(false);\n\n\tconst onSelect = React.useCallback((api: CarouselApi) => {\n\t\tif (!api) return;\n\t\tsetCanScrollPrev(api.canScrollPrev());\n\t\tsetCanScrollNext(api.canScrollNext());\n\t}, []);\n\n\tconst scrollPrev = React.useCallback(() => {\n\t\tapi?.scrollPrev();\n\t}, [api]);\n\n\tconst scrollNext = React.useCallback(() => {\n\t\tapi?.scrollNext();\n\t}, [api]);\n\n\tconst handleKeyDown = React.useCallback(\n\t\t(event: React.KeyboardEvent<HTMLDivElement>) => {\n\t\t\tif (event.key === 'ArrowLeft') {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tscrollPrev();\n\t\t\t} else if (event.key === 'ArrowRight') {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tscrollNext();\n\t\t\t}\n\t\t},\n\t\t[scrollPrev, scrollNext],\n\t);\n\n\tReact.useEffect(() => {\n\t\tif (!api || !setApi) return;\n\t\tsetApi(api);\n\t}, [api, setApi]);\n\n\tReact.useEffect(() => {\n\t\tif (!api) return;\n\t\tonSelect(api);\n\t\tapi.on('reInit', onSelect);\n\t\tapi.on('select', onSelect);\n\n\t\treturn () => {\n\t\t\tapi?.off('select', onSelect);\n\t\t};\n\t}, [api, onSelect]);\n\n\tconst contextValue = React.useMemo(\n\t\t() => ({\n\t\t\tcarouselRef,\n\t\t\tapi,\n\t\t\topts,\n\t\t\torientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n\t\t\tscrollPrev,\n\t\t\tscrollNext,\n\t\t\tcanScrollPrev,\n\t\t\tcanScrollNext,\n\t\t}),\n\t\t[carouselRef, api, opts, orientation, scrollPrev, scrollNext, canScrollPrev, canScrollNext],\n\t);\n\n\treturn (\n\t\t<CarouselContext.Provider value={contextValue}>\n\t\t\t<div onKeyDownCapture={handleKeyDown} className={cn('relative', className)} role=\"region\" aria-roledescription=\"carousel\" data-slot=\"carousel\" {...props}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</CarouselContext.Provider>\n\t);\n}\n\nfunction CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {\n\tconst { carouselRef, orientation } = useCarousel();\n\n\treturn (\n\t\t<div ref={carouselRef} className=\"overflow-hidden\" data-slot=\"carousel-content\">\n\t\t\t<div className={cn('flex', orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', className)} {...props} />\n\t\t</div>\n\t);\n}\n\nfunction CarouselItem({ className, ...props }: React.ComponentProps<'div'>) {\n\tconst { orientation } = useCarousel();\n\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-roledescription=\"slide\"\n\t\t\tdata-slot=\"carousel-item\"\n\t\t\tclassName={cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'pl-4' : 'pt-4', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction CarouselPrevious({ className, variant = 'outline', size = 'icon-sm', ...props }: React.ComponentProps<typeof Button>) {\n\tconst { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n\treturn (\n\t\t<Button\n\t\t\tdata-slot=\"carousel-previous\"\n\t\t\tvariant={variant}\n\t\t\tsize={size}\n\t\t\tclassName={cn(\n\t\t\t\t'absolute touch-manipulation rounded-full',\n\t\t\t\torientation === 'horizontal' ? 'inset-y-0 -left-12 my-auto' : '-top-12 left-1/2 -translate-x-1/2 rotate-90',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tdisabled={!canScrollPrev}\n\t\t\tonClick={scrollPrev}\n\t\t\t{...props}\n\t\t>\n\t\t\t<ChevronLeftIcon />\n\t\t\t<span className=\"sr-only\">Previous slide</span>\n\t\t</Button>\n\t);\n}\n\nfunction CarouselNext({ className, variant = 'outline', size = 'icon-sm', ...props }: React.ComponentProps<typeof Button>) {\n\tconst { orientation, scrollNext, canScrollNext } = useCarousel();\n\n\treturn (\n\t\t<Button\n\t\t\tdata-slot=\"carousel-next\"\n\t\t\tvariant={variant}\n\t\t\tsize={size}\n\t\t\tclassName={cn(\n\t\t\t\t'absolute touch-manipulation rounded-full',\n\t\t\t\torientation === 'horizontal' ? 'inset-y-0 -right-12 my-auto' : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tdisabled={!canScrollNext}\n\t\t\tonClick={scrollNext}\n\t\t\t{...props}\n\t\t>\n\t\t\t<ChevronRightIcon />\n\t\t\t<span className=\"sr-only\">Next slide</span>\n\t\t</Button>\n\t);\n}\n\nexport { Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel };\n"],"mappings":";;;;;;;;AAEA,OAAO,sBAAqD;AAC5D,SAAS,iBAAiB,wBAAwB;AAClD,YAAY,WAAW;AAyGpB,cAmCD,YAnCC;AAlFH,IAAM,kBAAwB,oBAA2C,IAAI;AAE7E,SAAS,cAAc;AACtB,QAAM,UAAgB,UAAI,eAAe;AAEzC,MAAI,CAAC,SAAS;AACb,UAAM,IAAI,MAAM,gDAAgD;AAAA,EACjE;AAEA,SAAO;AACR;AAEA,SAAS,SAAS,EAAE,cAAc,cAAc,MAAM,QAAQ,SAAS,WAAW,UAAU,GAAG,MAAM,GAAgD;AACpJ,QAAM,CAAC,aAAa,GAAG,IAAI;AAAA,IAC1B;AAAA,MACC,GAAG;AAAA,MACH,MAAM,gBAAgB,eAAe,MAAM;AAAA,IAC5C;AAAA,IACA;AAAA,EACD;AACA,QAAM,CAAC,eAAe,gBAAgB,IAAU,eAAS,KAAK;AAC9D,QAAM,CAAC,eAAe,gBAAgB,IAAU,eAAS,KAAK;AAE9D,QAAM,WAAiB,kBAAY,CAACA,SAAqB;AACxD,QAAI,CAACA,KAAK;AACV,qBAAiBA,KAAI,cAAc,CAAC;AACpC,qBAAiBA,KAAI,cAAc,CAAC;AAAA,EACrC,GAAG,CAAC,CAAC;AAEL,QAAM,aAAmB,k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