@datum-cloud/datum-ui 0.2.0-alpha.3 → 0.2.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -21
- package/dist/alert/index.mjs +3 -0
- package/dist/alert-BC2Mccfo.mjs +95 -0
- package/dist/autocomplete/index.mjs +7 -0
- package/dist/autocomplete-DZtI97HP.mjs +295 -0
- package/dist/avatar-stack/index.mjs +5 -0
- package/dist/avatar-stack-JCfBlPB9.mjs +80 -0
- package/dist/badge/index.mjs +3 -0
- package/dist/badge-bFgeYceE.mjs +185 -0
- package/dist/breadcrumb/index.mjs +4 -0
- package/dist/breadcrumb-BGYJgom_.mjs +71 -0
- package/dist/button/index.mjs +4 -0
- package/dist/button-AzpnV-WB.mjs +49 -0
- package/dist/button-C1wRfGtT.mjs +230 -0
- package/dist/button-group/index.mjs +5 -0
- package/dist/button-group-C1IB2K5s.mjs +40 -0
- package/dist/calendar/index.mjs +5 -0
- package/dist/calendar-DlIHeWb0.mjs +113 -0
- package/dist/card/index.mjs +4 -0
- package/dist/card-3Kd0VdNf.mjs +63 -0
- package/dist/chart/index.mjs +4 -0
- package/dist/chart-BZqUKpkh.mjs +143 -0
- package/dist/checkbox/index.mjs +4 -0
- package/dist/checkbox-LG1OKTpG.mjs +34 -0
- package/dist/col-lrLMZaTJ.mjs +184 -0
- package/dist/collapsible/index.mjs +3 -0
- package/dist/collapsible-Bt9UYfv3.mjs +9 -0
- package/dist/command/index.mjs +5 -0
- package/dist/command-s0Yv3abE.mjs +86 -0
- package/dist/components/features/date-picker/index.d.ts +3 -0
- package/dist/components/features/date-picker/index.d.ts.map +1 -0
- package/dist/components/features/dropzone/index.d.ts +1 -0
- package/dist/components/features/dropzone/index.d.ts.map +1 -1
- package/dist/date-picker/index.mjs +9 -0
- package/dist/{datum.provider-D6VMjSV0.mjs → datum.provider-B77goJgl.mjs} +1 -1
- package/dist/dialog/index.mjs +5 -0
- package/dist/dialog-DXBaT9gA.mjs +86 -0
- package/dist/dialog-bnMMf9GD.mjs +73 -0
- package/dist/dropdown/index.mjs +3 -0
- package/dist/dropdown-DtSa_lqc.mjs +112 -0
- package/dist/dropzone/index.mjs +5 -0
- package/dist/dropzone-BkOnwrS4.mjs +221 -0
- package/dist/empty-content/index.mjs +3 -0
- package/dist/empty-content-BM9rzI13.mjs +196 -0
- package/dist/exports/map.d.ts +3 -0
- package/dist/exports/map.d.ts.map +1 -0
- package/dist/form/index.mjs +146 -0
- package/dist/grid/index.mjs +3 -0
- package/dist/hooks/index.mjs +2 -3
- package/dist/hover-card/index.mjs +4 -0
- package/dist/hover-card-CUPfFUqE.mjs +33 -0
- package/dist/icon-wrapper-9ticVbRL.mjs +14 -0
- package/dist/icons/index.mjs +3 -3
- package/dist/index.mjs +66 -8
- package/dist/input/index.mjs +5 -0
- package/dist/input-DuyjEKEW.mjs +17 -0
- package/dist/input-fzXBheCN.mjs +17 -0
- package/dist/input-group/index.mjs +7 -0
- package/dist/input-group-CPaFSTEV.mjs +80 -0
- package/dist/input-number/index.mjs +6 -0
- package/dist/input-number-9o62JHRl.mjs +106 -0
- package/dist/input-with-addons/index.mjs +3 -0
- package/dist/input-with-addons-BQn7KCTU.mjs +30 -0
- package/dist/label/index.mjs +4 -0
- package/dist/label-_ste_Re3.mjs +44 -0
- package/dist/link-button-TIF2Zdrk.mjs +36 -0
- package/dist/loader-overlay/index.mjs +3 -0
- package/dist/loader-overlay-DUaQSZQP.mjs +17 -0
- package/dist/map/index.mjs +13 -0
- package/dist/map-Df8QMcX0.mjs +1094 -0
- package/dist/more-actions/index.mjs +5 -0
- package/dist/more-actions-Ch1f6Mh3.mjs +54 -0
- package/dist/nprogress/index.mjs +32 -0
- package/dist/page-title/index.mjs +3 -0
- package/dist/page-title-BJuo81rT.mjs +26 -0
- package/dist/popover/index.mjs +4 -0
- package/dist/popover-SQlKSz6L.mjs +36 -0
- package/dist/provider/index.mjs +4 -0
- package/dist/radio-group/index.mjs +4 -0
- package/dist/radio-group-Oshv0b-U.mjs +49 -0
- package/dist/select/index.mjs +4 -0
- package/dist/select-DVlEzD2W.mjs +166 -0
- package/dist/separator/index.mjs +4 -0
- package/dist/separator-T2ppyD-8.mjs +18 -0
- package/dist/sheet/index.mjs +5 -0
- package/dist/sheet-BKiCwtNO.mjs +45 -0
- package/dist/sheet-CtnP6gTD.mjs +77 -0
- package/dist/sidebar/index.mjs +11 -0
- package/dist/sidebar-DfqezV8t.mjs +945 -0
- package/dist/skeleton/index.mjs +4 -0
- package/dist/skeleton-vzbxA-DQ.mjs +13 -0
- package/dist/spinner/index.mjs +4 -0
- package/dist/spinner-BE7k2bAD.mjs +16 -0
- package/dist/{icon-wrapper-BgPkifId.mjs → spinner.icon-Bg8zgGh0.mjs} +1 -12
- package/dist/stepper/index.mjs +5 -0
- package/dist/stepper-SWB-u_nM.mjs +323 -0
- package/dist/switch/index.mjs +4 -0
- package/dist/switch-Calk7Gyw.mjs +32 -0
- package/dist/table/index.mjs +4 -0
- package/dist/table-CsXBcQLI.mjs +68 -0
- package/dist/tabs/index.mjs +3 -0
- package/dist/tabs-D8n-dqnw.mjs +52 -0
- package/dist/tag-input/index.mjs +5 -0
- package/dist/tag-input-Di7SDNbK.mjs +284 -0
- package/dist/task-queue/index.mjs +7 -0
- package/dist/task-queue-dropdown-DW72ikDH.mjs +1356 -0
- package/dist/textarea/index.mjs +5 -0
- package/dist/textarea-CxE3YbC7.mjs +17 -0
- package/dist/textarea-QYRcDEpK.mjs +15 -0
- package/dist/theme/index.mjs +4 -0
- package/dist/theme-script-XBouzsNR.mjs +66 -0
- package/dist/to-api-format-C2xjQUcI.mjs +1506 -0
- package/dist/toast/index.mjs +3 -0
- package/dist/tooltip/index.mjs +4 -0
- package/dist/tooltip-Dd3ActSS.mjs +74 -0
- package/dist/typography/index.mjs +3 -0
- package/dist/typography-UA7ZZvgJ.mjs +200 -0
- package/dist/use-copy-to-clipboard-ki-WoTml.mjs +31 -0
- package/dist/use-stepper-BaToCYMs.mjs +2017 -0
- package/dist/{use-copy-to-clipboard-BfrpD6G8.mjs → use-toast-mdn_CqRY.mjs} +34 -27
- package/dist/utils/index.mjs +0 -1
- package/dist/utils-Bfgoe-Gm.mjs +20 -0
- package/dist/visually-hidden/index.mjs +3 -0
- package/dist/visuallyhidden-aaTUk4Yo.mjs +7 -0
- package/package.json +208 -8
- package/dist/components/index.mjs +0 -8
- package/dist/providers/index.mjs +0 -4
- package/dist/theme-script-DHyLk25i.mjs +0 -11128
- /package/dist/{close.icon-chkXPAUC.mjs → close.icon-CMNMoXM_.mjs} +0 -0
- /package/dist/{map-leaflet-imports-OKaoesjZ.mjs → map-leaflet-imports-CdzvEnzY.mjs} +0 -0
- /package/dist/{theme.provider-DpFLwtHe.mjs → theme.provider-DgGshapa.mjs} +0 -0
- /package/dist/{use-debounce-BYB-jPeX.mjs → use-debounce-DQ1tmxOL.mjs} +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { t as cn } from "./cn-DWCc1QRE.mjs";
|
|
2
|
+
import { t as cn$1 } from "./utils-Bfgoe-Gm.mjs";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
6
|
+
|
|
7
|
+
//#region ../shadcn/ui/tooltip.tsx
|
|
8
|
+
const TooltipProvider = ({ delayDuration = 0, ...props }) => {
|
|
9
|
+
return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, {
|
|
10
|
+
"data-slot": "tooltip-provider",
|
|
11
|
+
delayDuration,
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
const Tooltip$1 = ({ ...props }) => {
|
|
16
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, {
|
|
17
|
+
"data-slot": "tooltip",
|
|
18
|
+
...props
|
|
19
|
+
}) });
|
|
20
|
+
};
|
|
21
|
+
const TooltipTrigger = ({ ...props }) => {
|
|
22
|
+
return /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, {
|
|
23
|
+
"data-slot": "tooltip-trigger",
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const TooltipContent$1 = ({ className, sideOffset = 0, children, ...props }) => {
|
|
28
|
+
return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(TooltipPrimitive.Content, {
|
|
29
|
+
"data-slot": "tooltip-content",
|
|
30
|
+
sideOffset,
|
|
31
|
+
className: cn$1("tooltip-content", "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit rounded-md px-3 py-1.5 text-xs text-balance", className),
|
|
32
|
+
...props,
|
|
33
|
+
children: [children, /* @__PURE__ */ jsx(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })]
|
|
34
|
+
}) });
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/components/base/tooltip/tooltip.tsx
|
|
39
|
+
function TooltipContent({ className, arrowClassName, sideOffset = 0, children, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(TooltipPrimitive.Content, {
|
|
41
|
+
"data-slot": "tooltip-content",
|
|
42
|
+
sideOffset,
|
|
43
|
+
className: cn("tooltip-content", "bg-secondary text-secondary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit rounded-md px-3 py-1.5 text-xs text-balance", className),
|
|
44
|
+
...props,
|
|
45
|
+
children: [children, /* @__PURE__ */ jsx(TooltipPrimitive.Arrow, {
|
|
46
|
+
className: cn("fill-secondary -my-px border-none drop-shadow-[0_1px_0_secondary]", arrowClassName),
|
|
47
|
+
width: 12,
|
|
48
|
+
height: 7,
|
|
49
|
+
"aria-hidden": "true"
|
|
50
|
+
})]
|
|
51
|
+
}) });
|
|
52
|
+
}
|
|
53
|
+
function Tooltip({ message, children, delayDuration = 200, side, align, sideOffset, hidden, open, onOpenChange, contentClassName, arrowClassName }) {
|
|
54
|
+
return /* @__PURE__ */ jsxs(Tooltip$1, {
|
|
55
|
+
delayDuration,
|
|
56
|
+
open,
|
|
57
|
+
onOpenChange,
|
|
58
|
+
children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
59
|
+
asChild: true,
|
|
60
|
+
children
|
|
61
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
62
|
+
side,
|
|
63
|
+
align,
|
|
64
|
+
sideOffset,
|
|
65
|
+
hidden,
|
|
66
|
+
className: contentClassName,
|
|
67
|
+
arrowClassName,
|
|
68
|
+
children: /* @__PURE__ */ jsx("span", { children: message })
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
export { TooltipTrigger as a, TooltipProvider as i, Tooltip$1 as n, TooltipContent$1 as r, Tooltip as t };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as ListItem, c as Title, d as titleVariants, i as List, l as paragraphVariants, n as Code, o as Paragraph, r as Link, s as Text, t as Blockquote, u as textVariants } from "../typography-UA7ZZvgJ.mjs";
|
|
2
|
+
|
|
3
|
+
export { Blockquote, Code, Link, List, ListItem, Paragraph, Text, Title, paragraphVariants, textVariants, titleVariants };
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { t as cn } from "./cn-DWCc1QRE.mjs";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { CopyIcon } from "lucide-react";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/base/typography/typography.tsx
|
|
8
|
+
const titleVariants = cva("font-semibold leading-tight tracking-tight", {
|
|
9
|
+
variants: {
|
|
10
|
+
level: {
|
|
11
|
+
1: "text-2xl md:text-3xl lg:text-4xl",
|
|
12
|
+
2: "text-xl md:text-2xl lg:text-3xl",
|
|
13
|
+
3: "text-lg md:text-xl lg:text-2xl",
|
|
14
|
+
4: "text-base md:text-lg lg:text-xl",
|
|
15
|
+
5: "text-sm md:text-base lg:text-lg",
|
|
16
|
+
6: "text-xs md:text-sm lg:text-base"
|
|
17
|
+
},
|
|
18
|
+
weight: {
|
|
19
|
+
normal: "font-normal",
|
|
20
|
+
medium: "font-medium",
|
|
21
|
+
semibold: "font-semibold",
|
|
22
|
+
bold: "font-bold",
|
|
23
|
+
extrabold: "font-extrabold"
|
|
24
|
+
},
|
|
25
|
+
textColor: {
|
|
26
|
+
default: "text-foreground",
|
|
27
|
+
muted: "text-muted-foreground",
|
|
28
|
+
primary: "text-primary",
|
|
29
|
+
secondary: "text-secondary-foreground",
|
|
30
|
+
destructive: "text-destructive",
|
|
31
|
+
success: "text-green-600 dark:text-green-400",
|
|
32
|
+
warning: "text-yellow-600 dark:text-yellow-400",
|
|
33
|
+
info: "text-blue-600 dark:text-blue-400"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
defaultVariants: {
|
|
37
|
+
level: 4,
|
|
38
|
+
weight: "semibold",
|
|
39
|
+
textColor: "default"
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
const textVariants = cva("leading-relaxed", {
|
|
43
|
+
variants: {
|
|
44
|
+
size: {
|
|
45
|
+
"xs": "text-xs",
|
|
46
|
+
"sm": "text-sm",
|
|
47
|
+
"base": "text-sm",
|
|
48
|
+
"lg": "text-lg",
|
|
49
|
+
"xl": "text-xl",
|
|
50
|
+
"2xl": "text-2xl",
|
|
51
|
+
"3xl": "text-3xl",
|
|
52
|
+
"4xl": "text-4xl"
|
|
53
|
+
},
|
|
54
|
+
weight: {
|
|
55
|
+
normal: "font-normal",
|
|
56
|
+
medium: "font-medium",
|
|
57
|
+
semibold: "font-semibold",
|
|
58
|
+
bold: "font-bold",
|
|
59
|
+
extrabold: "font-extrabold"
|
|
60
|
+
},
|
|
61
|
+
textColor: {
|
|
62
|
+
default: "text-foreground",
|
|
63
|
+
muted: "text-muted-foreground",
|
|
64
|
+
primary: "text-primary",
|
|
65
|
+
secondary: "text-secondary-foreground",
|
|
66
|
+
destructive: "text-destructive",
|
|
67
|
+
success: "text-green-600 dark:text-green-400",
|
|
68
|
+
warning: "text-yellow-600 dark:text-yellow-400",
|
|
69
|
+
info: "text-blue-600 dark:text-blue-400"
|
|
70
|
+
},
|
|
71
|
+
type: {
|
|
72
|
+
default: "",
|
|
73
|
+
code: "font-mono bg-muted px-1.5 py-0.5 rounded text-sm",
|
|
74
|
+
mark: "bg-yellow-100 dark:bg-yellow-900/30 px-1.5 py-0.5 rounded",
|
|
75
|
+
underline: "underline underline-offset-4",
|
|
76
|
+
delete: "line-through",
|
|
77
|
+
strong: "font-semibold",
|
|
78
|
+
italic: "italic"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
defaultVariants: {
|
|
82
|
+
size: "base",
|
|
83
|
+
weight: "normal",
|
|
84
|
+
textColor: "default",
|
|
85
|
+
type: "default"
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
const paragraphVariants = cva("leading-relaxed", {
|
|
89
|
+
variants: {
|
|
90
|
+
size: {
|
|
91
|
+
xs: "text-xs",
|
|
92
|
+
sm: "text-sm",
|
|
93
|
+
base: "text-sm",
|
|
94
|
+
lg: "text-lg",
|
|
95
|
+
xl: "text-xl"
|
|
96
|
+
},
|
|
97
|
+
spacing: {
|
|
98
|
+
tight: "leading-tight",
|
|
99
|
+
normal: "leading-relaxed",
|
|
100
|
+
loose: "leading-loose"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
defaultVariants: {
|
|
104
|
+
size: "base",
|
|
105
|
+
spacing: "normal"
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
function Title({ className, level, weight, textColor, as, children, ...props }) {
|
|
109
|
+
const Component = as ?? `h${level ?? 4}`;
|
|
110
|
+
return React$1.createElement(Component, {
|
|
111
|
+
className: cn(titleVariants({
|
|
112
|
+
level,
|
|
113
|
+
weight,
|
|
114
|
+
textColor,
|
|
115
|
+
className
|
|
116
|
+
})),
|
|
117
|
+
...props
|
|
118
|
+
}, children);
|
|
119
|
+
}
|
|
120
|
+
function Text({ className, size, weight, textColor, type, as = "span", copyable, ellipsis, mark, underline, delete: deleteProp, strong, italic, code, children, ...props }) {
|
|
121
|
+
const resolvedType = code ? "code" : italic ? "italic" : strong ? "strong" : deleteProp ? "delete" : underline ? "underline" : mark ? "mark" : type;
|
|
122
|
+
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [children, copyable && /* @__PURE__ */ jsx("button", {
|
|
123
|
+
type: "button",
|
|
124
|
+
"aria-label": "Copy text",
|
|
125
|
+
className: "hover:bg-accent hover:text-accent-foreground ml-2 inline-flex size-4 items-center justify-center rounded-md text-sm font-medium transition-colors",
|
|
126
|
+
onClick: () => {
|
|
127
|
+
if (typeof children === "string") navigator.clipboard.writeText(children).catch(() => {});
|
|
128
|
+
},
|
|
129
|
+
title: "Copy text",
|
|
130
|
+
children: /* @__PURE__ */ jsx(CopyIcon, {
|
|
131
|
+
className: "size-3",
|
|
132
|
+
"aria-hidden": "true"
|
|
133
|
+
})
|
|
134
|
+
})] });
|
|
135
|
+
return React$1.createElement(as, {
|
|
136
|
+
className: cn(textVariants({
|
|
137
|
+
size,
|
|
138
|
+
weight,
|
|
139
|
+
textColor,
|
|
140
|
+
type: resolvedType
|
|
141
|
+
}), ellipsis && "truncate", className),
|
|
142
|
+
...props
|
|
143
|
+
}, content);
|
|
144
|
+
}
|
|
145
|
+
function Paragraph({ className, size, spacing, as = "p", children, ...props }) {
|
|
146
|
+
return React$1.createElement(as, {
|
|
147
|
+
className: cn(paragraphVariants({
|
|
148
|
+
size,
|
|
149
|
+
spacing,
|
|
150
|
+
className
|
|
151
|
+
})),
|
|
152
|
+
...props
|
|
153
|
+
}, children);
|
|
154
|
+
}
|
|
155
|
+
function Link({ className, children, href, target = "_self", rel, ...props }) {
|
|
156
|
+
return /* @__PURE__ */ jsx("a", {
|
|
157
|
+
href,
|
|
158
|
+
target,
|
|
159
|
+
rel: rel ?? (target === "_blank" ? "noopener noreferrer" : void 0),
|
|
160
|
+
className: cn("text-primary focus-visible:ring-ring underline-offset-4 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none", className),
|
|
161
|
+
...props,
|
|
162
|
+
children
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function List({ className, as, listType = "unordered", children, ...props }) {
|
|
166
|
+
const Component = as ?? (listType === "ordered" ? "ol" : "ul");
|
|
167
|
+
return React$1.createElement(Component, {
|
|
168
|
+
className: cn("space-y-2", listType === "ordered" ? "list-decimal list-inside" : "list-disc list-inside", className),
|
|
169
|
+
...props
|
|
170
|
+
}, children);
|
|
171
|
+
}
|
|
172
|
+
function ListItem({ className, children, ...props }) {
|
|
173
|
+
return /* @__PURE__ */ jsx("li", {
|
|
174
|
+
className: cn("leading-relaxed", className),
|
|
175
|
+
...props,
|
|
176
|
+
children
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
function Blockquote({ className, children, ...props }) {
|
|
180
|
+
return /* @__PURE__ */ jsx("blockquote", {
|
|
181
|
+
className: cn("border-primary text-muted-foreground border-l-4 pl-4 italic", className),
|
|
182
|
+
...props,
|
|
183
|
+
children
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
function Code({ className, as = "code", children, ...props }) {
|
|
187
|
+
if (as === "pre") return /* @__PURE__ */ jsx("pre", {
|
|
188
|
+
className: cn("bg-muted relative overflow-x-auto rounded p-4 font-mono text-sm", className),
|
|
189
|
+
...props,
|
|
190
|
+
children
|
|
191
|
+
});
|
|
192
|
+
return /* @__PURE__ */ jsx("code", {
|
|
193
|
+
className: cn("bg-muted relative rounded px-[0.3rem] py-[0.2rem] font-mono text-sm", className),
|
|
194
|
+
...props,
|
|
195
|
+
children
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
//#endregion
|
|
200
|
+
export { ListItem as a, Title as c, titleVariants as d, List as i, paragraphVariants as l, Code as n, Paragraph as o, Link as r, Text as s, Blockquote as t, textVariants as u };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { r as toast } from "./use-toast-mdn_CqRY.mjs";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/hooks/use-copy-to-clipboard.ts
|
|
5
|
+
function useCopyToClipboard() {
|
|
6
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
7
|
+
const timeoutRef = useRef(null);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
return () => {
|
|
10
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
11
|
+
};
|
|
12
|
+
}, []);
|
|
13
|
+
return [isCopied, useCallback(async (text, options) => {
|
|
14
|
+
if (!navigator?.clipboard) return false;
|
|
15
|
+
try {
|
|
16
|
+
await navigator.clipboard.writeText(text);
|
|
17
|
+
setIsCopied(true);
|
|
18
|
+
if (options?.withToast) toast.success(options.toastMessage ?? "Copied to clipboard");
|
|
19
|
+
timeoutRef.current = setTimeout(() => {
|
|
20
|
+
setIsCopied(false);
|
|
21
|
+
}, 2e3);
|
|
22
|
+
return true;
|
|
23
|
+
} catch {
|
|
24
|
+
setIsCopied(false);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}, [])];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { useCopyToClipboard as t };
|