@datum-cloud/datum-ui 0.2.0-alpha.2 → 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 +336 -0
- 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/style.css +3 -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,49 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Bfgoe-Gm.mjs";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
6
|
+
|
|
7
|
+
//#region ../shadcn/ui/button.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Vanilla shadcn/ui Button Component
|
|
10
|
+
* Pure shadcn button without Datum customizations
|
|
11
|
+
* For Datum-specific features (dashed variant, isLoading), import from @/modules/datum-ui
|
|
12
|
+
*/
|
|
13
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
14
|
+
variants: {
|
|
15
|
+
variant: {
|
|
16
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
17
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
18
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
19
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
20
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
21
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
default: "h-10 px-4 py-2",
|
|
25
|
+
sm: "h-9 rounded-md px-3",
|
|
26
|
+
lg: "h-11 rounded-md px-8",
|
|
27
|
+
icon: "h-10 w-10"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
variant: "default",
|
|
32
|
+
size: "default"
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const Button = React$1.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
36
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
|
|
37
|
+
className: cn(buttonVariants({
|
|
38
|
+
variant,
|
|
39
|
+
size,
|
|
40
|
+
className
|
|
41
|
+
})),
|
|
42
|
+
ref,
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
Button.displayName = "Button";
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { buttonVariants as n, Button as t };
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { t as cn } from "./cn-DWCc1QRE.mjs";
|
|
2
|
+
import { t as SpinnerIcon } from "./spinner.icon-Bg8zgGh0.mjs";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/base/button/button.tsx
|
|
8
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50", {
|
|
9
|
+
variants: {
|
|
10
|
+
type: {
|
|
11
|
+
primary: "",
|
|
12
|
+
secondary: "",
|
|
13
|
+
tertiary: "",
|
|
14
|
+
quaternary: "",
|
|
15
|
+
warning: "",
|
|
16
|
+
danger: "",
|
|
17
|
+
success: ""
|
|
18
|
+
},
|
|
19
|
+
theme: {
|
|
20
|
+
solid: "",
|
|
21
|
+
light: "",
|
|
22
|
+
outline: "border",
|
|
23
|
+
borderless: "border-0 bg-transparent",
|
|
24
|
+
link: "text-primary underline-offset-2 underline hover:opacity-80"
|
|
25
|
+
},
|
|
26
|
+
size: {
|
|
27
|
+
xs: "h-7 px-2.5 text-xs",
|
|
28
|
+
small: "h-9 px-3 text-xs",
|
|
29
|
+
default: "h-9 px-4 py-2",
|
|
30
|
+
large: "h-11 px-8 text-base",
|
|
31
|
+
icon: "h-9 w-9",
|
|
32
|
+
link: "px-0 py-0"
|
|
33
|
+
},
|
|
34
|
+
block: {
|
|
35
|
+
true: "w-full",
|
|
36
|
+
false: ""
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
compoundVariants: [
|
|
40
|
+
{
|
|
41
|
+
type: "primary",
|
|
42
|
+
theme: "solid",
|
|
43
|
+
className: "bg-btn-primary border border-btn-primary-border text-btn-primary-foreground hover:bg-btn-primary-hover active:bg-btn-primary-active disabled:bg-btn-primary/60"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: "primary",
|
|
47
|
+
theme: "light",
|
|
48
|
+
className: cn("bg-btn-neutral-bg text-primary hover:bg-btn-neutral-bg-hover active:bg-btn-neutral-bg-active disabled:bg-btn-neutral-bg disabled:text-primary", "dark:text-foreground")
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: "primary",
|
|
52
|
+
theme: "outline",
|
|
53
|
+
className: cn("border border-btn-primary-border/60 text-primary hover:border-btn-primary-border active:border-btn-primary-border disabled:bg-transparent disabled:text-primary disabled:border-btn-primary-border/60", "dark:text-foreground dark:border-foreground/60 dark:hover:border-foreground dark:active:border-foreground/80")
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: "primary",
|
|
57
|
+
theme: "borderless",
|
|
58
|
+
className: cn("text-primary hover:bg-btn-neutral-bg active:bg-btn-neutral-bg-active disabled:bg-transparent disabled:text-primary", "dark:text-foreground")
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: "secondary",
|
|
62
|
+
theme: "solid",
|
|
63
|
+
className: "bg-btn-secondary border border-btn-secondary-border text-btn-secondary-foreground hover:bg-btn-secondary-hover active:bg-btn-secondary-active disabled:bg-btn-secondary/60"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: "secondary",
|
|
67
|
+
theme: "light",
|
|
68
|
+
className: cn("bg-btn-neutral-bg text-secondary hover:bg-btn-neutral-bg-hover active:bg-btn-neutral-bg-active disabled:bg-btn-neutral-bg disabled:text-secondary", "dark:text-foreground")
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: "secondary",
|
|
72
|
+
theme: "outline",
|
|
73
|
+
className: cn("border border-btn-secondary-border/60 text-secondary hover:border-btn-secondary-border active:border-btn-secondary-border disabled:bg-transparent disabled:text-secondary disabled:border-btn-secondary-border/60", "dark:text-foreground dark:border-foreground/60 dark:hover:border-foreground dark:active:border-foreground/80")
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: "secondary",
|
|
77
|
+
theme: "borderless",
|
|
78
|
+
className: cn("text-secondary hover:bg-btn-neutral-bg active:bg-btn-neutral-bg-active disabled:bg-transparent disabled:text-secondary", "dark:text-foreground")
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: "tertiary",
|
|
82
|
+
theme: "solid",
|
|
83
|
+
className: "bg-btn-tertiary border border-btn-tertiary-border text-btn-tertiary-foreground hover:bg-btn-tertiary-hover active:bg-btn-tertiary-active disabled:bg-btn-tertiary/60"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: "tertiary",
|
|
87
|
+
theme: "light",
|
|
88
|
+
className: cn("bg-btn-neutral-bg text-tertiary hover:bg-btn-neutral-bg-hover active:bg-btn-neutral-bg-active disabled:bg-btn-neutral-bg disabled:text-tertiary", "dark:text-foreground")
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: "tertiary",
|
|
92
|
+
theme: "outline",
|
|
93
|
+
className: cn("border border-btn-tertiary-border/60 text-tertiary hover:border-btn-tertiary-border active:border-btn-tertiary-border disabled:bg-transparent disabled:text-tertiary disabled:border-btn-tertiary-border/60", "dark:text-foreground dark:border-foreground/60 dark:hover:border-foreground dark:active:border-foreground/80")
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
type: "tertiary",
|
|
97
|
+
theme: "borderless",
|
|
98
|
+
className: cn("text-tertiary hover:bg-btn-neutral-bg active:bg-btn-neutral-bg-active disabled:bg-transparent disabled:text-tertiary", "dark:text-foreground")
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: "quaternary",
|
|
102
|
+
theme: "solid",
|
|
103
|
+
className: "bg-btn-quaternary border border-btn-quaternary text-btn-quaternary-foreground hover:bg-btn-quaternary-hover active:bg-btn-quaternary-active disabled:bg-btn-quaternary/60"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
type: "quaternary",
|
|
107
|
+
theme: "light",
|
|
108
|
+
className: cn("bg-btn-neutral-bg text-btn-quaternary-foreground hover:bg-btn-neutral-bg-hover active:bg-btn-neutral-bg-active disabled:bg-btn-neutral-bg disabled:text-btn-quaternary-foreground", "dark:text-foreground")
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: "quaternary",
|
|
112
|
+
theme: "outline",
|
|
113
|
+
className: cn("border border-btn-quaternary-border/60 text-btn-quaternary-foreground hover:border-btn-quaternary-border active:border-btn-quaternary-border disabled:bg-transparent disabled:text-btn-quaternary-foreground disabled:border-btn-quaternary-border/60", "dark:text-foreground dark:border-foreground/60 dark:hover:border-foreground dark:active:border-foreground/80")
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
type: "quaternary",
|
|
117
|
+
theme: "borderless",
|
|
118
|
+
className: cn("text-btn-quaternary-foreground hover:bg-btn-neutral-bg active:bg-btn-neutral-bg-active disabled:bg-transparent disabled:text-btn-quaternary-foreground", "dark:text-foreground")
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: "warning",
|
|
122
|
+
theme: "solid",
|
|
123
|
+
className: "bg-btn-warning text-btn-warning-foreground border border-btn-warning-border hover:bg-btn-warning-hover active:bg-btn-warning-active disabled:bg-btn-warning/60"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: "warning",
|
|
127
|
+
theme: "light",
|
|
128
|
+
className: "bg-btn-neutral-bg text-btn-warning hover:bg-btn-neutral-bg-hover active:bg-btn-neutral-bg-active disabled:bg-btn-neutral-bg disabled:text-btn-warning"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
type: "warning",
|
|
132
|
+
theme: "outline",
|
|
133
|
+
className: "border-yellow-600 text-yellow-600 hover:bg-yellow-600 hover:text-white active:bg-yellow-700 active:text-white dark:border-yellow-500 dark:text-yellow-500 dark:hover:bg-yellow-500 dark:hover:text-white dark:active:bg-yellow-600 dark:active:text-white disabled:bg-transparent disabled:text-yellow-600 disabled:border-yellow-600 disabled:hover:bg-transparent disabled:hover:text-yellow-600"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
type: "warning",
|
|
137
|
+
theme: "borderless",
|
|
138
|
+
className: "text-btn-warning hover:bg-btn-neutral-bg active:bg-btn-neutral-bg-active disabled:bg-transparent disabled:text-btn-warning"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
type: "danger",
|
|
142
|
+
theme: "solid",
|
|
143
|
+
className: "bg-btn-danger text-btn-danger-foreground border border-btn-danger-border hover:bg-btn-danger-hover active:bg-btn-danger-active disabled:bg-btn-danger/60"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
type: "danger",
|
|
147
|
+
theme: "light",
|
|
148
|
+
className: "bg-btn-neutral-bg text-btn-danger hover:bg-btn-neutral-bg-hover active:bg-btn-neutral-bg-active disabled:bg-btn-neutral-bg disabled:text-btn-danger"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
type: "danger",
|
|
152
|
+
theme: "outline",
|
|
153
|
+
className: "border-destructive text-destructive hover:bg-destructive hover:text-destructive-foreground active:bg-destructive/90 active:text-destructive-foreground disabled:bg-transparent disabled:text-destructive disabled:border-destructive disabled:hover:bg-transparent disabled:hover:text-destructive"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
type: "danger",
|
|
157
|
+
theme: "borderless",
|
|
158
|
+
className: "text-btn-danger hover:bg-btn-neutral-bg active:bg-btn-neutral-bg-active disabled:bg-transparent disabled:text-btn-danger"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
type: "success",
|
|
162
|
+
theme: "solid",
|
|
163
|
+
className: "bg-btn-success text-btn-success-foreground border border-btn-success-border hover:bg-btn-success-hover active:bg-btn-success-active disabled:bg-btn-success/60"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
type: "success",
|
|
167
|
+
theme: "light",
|
|
168
|
+
className: "bg-btn-neutral-bg text-btn-success hover:bg-btn-neutral-bg-hover active:bg-btn-neutral-bg-active disabled:bg-btn-neutral-bg disabled:text-btn-success"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
type: "success",
|
|
172
|
+
theme: "outline",
|
|
173
|
+
className: "border-green-600 text-green-600 hover:bg-green-600 hover:text-white active:bg-green-700 active:text-white dark:border-green-500 dark:text-green-500 dark:hover:bg-green-500 dark:hover:text-white dark:active:bg-green-600 dark:active:text-white disabled:bg-transparent disabled:text-green-600 disabled:border-green-600 disabled:hover:bg-transparent disabled:hover:text-green-600"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
type: "success",
|
|
177
|
+
theme: "borderless",
|
|
178
|
+
className: "text-btn-success hover:bg-btn-neutral-bg active:bg-btn-neutral-bg-active disabled:bg-transparent disabled:text-btn-success"
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
defaultVariants: {
|
|
182
|
+
type: "primary",
|
|
183
|
+
theme: "solid",
|
|
184
|
+
size: "default",
|
|
185
|
+
block: false
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
function Button({ ref, className, type, theme, size, block, loading = false, disabled, icon, iconPosition = "left", loadingIcon, htmlType = "button", children, ...props }) {
|
|
189
|
+
const isDisabled = disabled || loading;
|
|
190
|
+
const isIconOnly = (icon || loading) && !children;
|
|
191
|
+
const showIcon = !loading && icon;
|
|
192
|
+
const getLoadingIcon = () => {
|
|
193
|
+
return loadingIcon || /* @__PURE__ */ jsx(SpinnerIcon, {
|
|
194
|
+
size: size === "small" ? "xs" : size === "large" ? "sm" : "md",
|
|
195
|
+
"aria-hidden": "true"
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
const showLoadingIcon = loading && (isIconOnly ? getLoadingIcon() : /* @__PURE__ */ jsx(SpinnerIcon, {
|
|
199
|
+
size: "sm",
|
|
200
|
+
"aria-hidden": "true"
|
|
201
|
+
}));
|
|
202
|
+
const getIconOnlyClass = () => {
|
|
203
|
+
if (!isIconOnly || size === "icon") return "";
|
|
204
|
+
if (size === "small") return "w-8 px-0";
|
|
205
|
+
if (size === "large") return "w-11 px-0";
|
|
206
|
+
return "w-9 px-0";
|
|
207
|
+
};
|
|
208
|
+
return /* @__PURE__ */ jsx("button", {
|
|
209
|
+
className: cn(buttonVariants({
|
|
210
|
+
type,
|
|
211
|
+
theme,
|
|
212
|
+
size,
|
|
213
|
+
block
|
|
214
|
+
}), getIconOnlyClass(), className),
|
|
215
|
+
ref,
|
|
216
|
+
disabled: isDisabled,
|
|
217
|
+
type: htmlType,
|
|
218
|
+
...props,
|
|
219
|
+
children: isIconOnly ? loading ? showLoadingIcon : showIcon && icon : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
220
|
+
showLoadingIcon && showLoadingIcon,
|
|
221
|
+
showIcon && iconPosition === "left" && icon,
|
|
222
|
+
children,
|
|
223
|
+
showIcon && iconPosition === "right" && icon
|
|
224
|
+
] })
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
Button.displayName = "Button";
|
|
228
|
+
|
|
229
|
+
//#endregion
|
|
230
|
+
export { buttonVariants as n, Button as t };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "../utils-Bfgoe-Gm.mjs";
|
|
2
|
+
import "../separator-T2ppyD-8.mjs";
|
|
3
|
+
import { i as buttonGroupVariants, n as ButtonGroupSeparator, r as ButtonGroupText, t as ButtonGroup } from "../button-group-C1IB2K5s.mjs";
|
|
4
|
+
|
|
5
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Bfgoe-Gm.mjs";
|
|
2
|
+
import { t as Separator } from "./separator-T2ppyD-8.mjs";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
6
|
+
|
|
7
|
+
//#region ../shadcn/ui/button-group.tsx
|
|
8
|
+
const buttonGroupVariants = cva("flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
|
|
9
|
+
variants: { orientation: {
|
|
10
|
+
horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
|
|
11
|
+
vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"
|
|
12
|
+
} },
|
|
13
|
+
defaultVariants: { orientation: "horizontal" }
|
|
14
|
+
});
|
|
15
|
+
function ButtonGroup({ className, orientation, ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsx("div", {
|
|
17
|
+
role: "group",
|
|
18
|
+
"data-slot": "button-group",
|
|
19
|
+
"data-orientation": orientation,
|
|
20
|
+
className: cn(buttonGroupVariants({ orientation }), className),
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function ButtonGroupText({ className, asChild = false, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "div", {
|
|
26
|
+
className: cn("bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className),
|
|
27
|
+
...props
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function ButtonGroupSeparator({ className, orientation = "vertical", ...props }) {
|
|
31
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
32
|
+
"data-slot": "button-group-separator",
|
|
33
|
+
orientation,
|
|
34
|
+
className: cn("bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto", className),
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { buttonGroupVariants as i, ButtonGroupSeparator as n, ButtonGroupText as r, ButtonGroup as t };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { t as cn } from "./cn-DWCc1QRE.mjs";
|
|
2
|
+
import { n as buttonVariants, t as Button } from "./button-AzpnV-WB.mjs";
|
|
3
|
+
import { t as Icon } from "./icon-wrapper-9ticVbRL.mjs";
|
|
4
|
+
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
5
|
+
import * as React$1 from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
8
|
+
|
|
9
|
+
//#region src/components/base/calendar/calendar.tsx
|
|
10
|
+
function CalendarRoot({ className, rootRef, ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx("div", {
|
|
12
|
+
"data-slot": "calendar",
|
|
13
|
+
ref: rootRef,
|
|
14
|
+
className: cn(className),
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function CalendarChevron({ className, orientation, ...props }) {
|
|
19
|
+
if (orientation === "left") return /* @__PURE__ */ jsx(Icon, {
|
|
20
|
+
icon: ChevronLeftIcon,
|
|
21
|
+
className: cn("size-4", className),
|
|
22
|
+
...props
|
|
23
|
+
});
|
|
24
|
+
if (orientation === "right") return /* @__PURE__ */ jsx(Icon, {
|
|
25
|
+
icon: ChevronRightIcon,
|
|
26
|
+
className: cn("size-4", className),
|
|
27
|
+
...props
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */ jsx(Icon, {
|
|
30
|
+
icon: ChevronDownIcon,
|
|
31
|
+
className: cn("size-4", className),
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function CalendarWeekNumber({ children, ...props }) {
|
|
36
|
+
return /* @__PURE__ */ jsx("td", {
|
|
37
|
+
...props,
|
|
38
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
39
|
+
className: "flex size-(--cell-size) items-center justify-center text-center",
|
|
40
|
+
children
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function Calendar$1({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", formatters, components, ...props }) {
|
|
45
|
+
const defaultClassNames = getDefaultClassNames();
|
|
46
|
+
return /* @__PURE__ */ jsx(DayPicker, {
|
|
47
|
+
showOutsideDays,
|
|
48
|
+
className: cn("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent", String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className),
|
|
49
|
+
captionLayout,
|
|
50
|
+
formatters: {
|
|
51
|
+
formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
|
|
52
|
+
...formatters
|
|
53
|
+
},
|
|
54
|
+
classNames: {
|
|
55
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
56
|
+
months: cn("flex gap-4 flex-col md:flex-row relative", defaultClassNames.months),
|
|
57
|
+
month: cn("flex flex-col w-full gap-4", defaultClassNames.month),
|
|
58
|
+
nav: cn("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between", defaultClassNames.nav),
|
|
59
|
+
button_previous: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none", defaultClassNames.button_previous),
|
|
60
|
+
button_next: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none", defaultClassNames.button_next),
|
|
61
|
+
month_caption: cn("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)", defaultClassNames.month_caption),
|
|
62
|
+
dropdowns: cn("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5", defaultClassNames.dropdowns),
|
|
63
|
+
dropdown_root: cn("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md", defaultClassNames.dropdown_root),
|
|
64
|
+
dropdown: cn("absolute bg-popover inset-0 opacity-0", defaultClassNames.dropdown),
|
|
65
|
+
caption_label: cn("select-none font-medium", captionLayout === "label" ? "text-sm" : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5", defaultClassNames.caption_label),
|
|
66
|
+
table: "w-full border-collapse",
|
|
67
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
68
|
+
weekday: cn("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none", defaultClassNames.weekday),
|
|
69
|
+
week: cn("flex w-full mt-2", defaultClassNames.week),
|
|
70
|
+
week_number_header: cn("select-none w-(--cell-size)", defaultClassNames.week_number_header),
|
|
71
|
+
week_number: cn("text-[0.8rem] select-none text-muted-foreground", defaultClassNames.week_number),
|
|
72
|
+
day: cn("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none", defaultClassNames.day),
|
|
73
|
+
range_start: cn("rounded-l-md bg-accent", defaultClassNames.range_start),
|
|
74
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
75
|
+
range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
76
|
+
today: cn("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none", defaultClassNames.today),
|
|
77
|
+
outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
78
|
+
disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
|
|
79
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
80
|
+
...classNames
|
|
81
|
+
},
|
|
82
|
+
components: {
|
|
83
|
+
Root: CalendarRoot,
|
|
84
|
+
Chevron: CalendarChevron,
|
|
85
|
+
DayButton: CalendarDayButton,
|
|
86
|
+
WeekNumber: CalendarWeekNumber,
|
|
87
|
+
...components
|
|
88
|
+
},
|
|
89
|
+
...props
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function CalendarDayButton({ className, day, modifiers, ...props }) {
|
|
93
|
+
const defaultClassNames = getDefaultClassNames();
|
|
94
|
+
const ref = React$1.useRef(null);
|
|
95
|
+
React$1.useEffect(() => {
|
|
96
|
+
if (modifiers.focused) ref.current?.focus();
|
|
97
|
+
}, [modifiers.focused]);
|
|
98
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
99
|
+
ref,
|
|
100
|
+
variant: "ghost",
|
|
101
|
+
size: "icon",
|
|
102
|
+
"data-day": day.date.toLocaleDateString(),
|
|
103
|
+
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
104
|
+
"data-range-start": modifiers.range_start,
|
|
105
|
+
"data-range-end": modifiers.range_end,
|
|
106
|
+
"data-range-middle": modifiers.range_middle,
|
|
107
|
+
className: cn("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className),
|
|
108
|
+
...props
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
//#endregion
|
|
113
|
+
export { CalendarDayButton as n, Calendar$1 as t };
|
|
@@ -0,0 +1,63 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region ../shadcn/ui/card.tsx
|
|
7
|
+
const CardTitle = ({ className, ...props }) => {
|
|
8
|
+
return /* @__PURE__ */ jsx("div", {
|
|
9
|
+
"data-slot": "card-title",
|
|
10
|
+
className: cn$1("leading-none font-semibold", className),
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
const CardDescription = ({ className, ...props }) => {
|
|
15
|
+
return /* @__PURE__ */ jsx("div", {
|
|
16
|
+
"data-slot": "card-description",
|
|
17
|
+
className: cn$1("text-muted-foreground text-sm", className),
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const CardContent = ({ className, ...props }) => {
|
|
22
|
+
return /* @__PURE__ */ jsx("div", {
|
|
23
|
+
"data-slot": "card-content",
|
|
24
|
+
className: cn$1("px-6", className),
|
|
25
|
+
...props
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/components/base/card/card.tsx
|
|
31
|
+
/**
|
|
32
|
+
* Datum Card Component
|
|
33
|
+
* Extends shadcn Card with custom default className
|
|
34
|
+
*
|
|
35
|
+
* This component replaces the default className of shadcn Card without modifying
|
|
36
|
+
* the original shadcn component. All sub-components (CardHeader, CardTitle, etc.)
|
|
37
|
+
* are re-exported from shadcn as-is.
|
|
38
|
+
*/
|
|
39
|
+
const DEFAULT_CARD_CLASSNAME = "bg-card text-card-foreground flex flex-col gap-4 rounded-xl border border-card-border py-6 shadow";
|
|
40
|
+
function Card({ className, ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx("div", {
|
|
42
|
+
"data-slot": "card",
|
|
43
|
+
className: cn(DEFAULT_CARD_CLASSNAME, className),
|
|
44
|
+
...props
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function CardHeader({ className, ...props }) {
|
|
48
|
+
return /* @__PURE__ */ jsx("div", {
|
|
49
|
+
"data-slot": "card-header",
|
|
50
|
+
className: cn("border-card-border flex flex-col gap-3 px-6", className),
|
|
51
|
+
...props
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function CardFooter({ className, ...props }) {
|
|
55
|
+
return /* @__PURE__ */ jsx("div", {
|
|
56
|
+
"data-slot": "card-footer",
|
|
57
|
+
className: cn("border-card-border px-6", className),
|
|
58
|
+
...props
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
export { CardDescription as a, CardContent as i, CardFooter as n, CardTitle as o, CardHeader as r, Card as t };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "../utils-Bfgoe-Gm.mjs";
|
|
2
|
+
import { a as ChartTooltip, i as ChartStyle, n as ChartLegend, o as ChartTooltipContent, r as ChartLegendContent, t as ChartContainer } from "../chart-BZqUKpkh.mjs";
|
|
3
|
+
|
|
4
|
+
export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Bfgoe-Gm.mjs";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import * as RechartsPrimitive from "recharts";
|
|
5
|
+
|
|
6
|
+
//#region ../shadcn/ui/chart.tsx
|
|
7
|
+
const THEMES = {
|
|
8
|
+
light: "",
|
|
9
|
+
dark: ".dark"
|
|
10
|
+
};
|
|
11
|
+
const ChartContext = React$1.createContext(null);
|
|
12
|
+
function useChart() {
|
|
13
|
+
const context = React$1.useContext(ChartContext);
|
|
14
|
+
if (!context) throw new Error("useChart must be used within a <ChartContainer />");
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
17
|
+
function ChartContainer({ id, className, children, config, ...props }) {
|
|
18
|
+
const uniqueId = React$1.useId();
|
|
19
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
20
|
+
return /* @__PURE__ */ jsx(ChartContext.Provider, {
|
|
21
|
+
value: { config },
|
|
22
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
23
|
+
"data-slot": "chart",
|
|
24
|
+
"data-chart": chartId,
|
|
25
|
+
className: cn("[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className),
|
|
26
|
+
...props,
|
|
27
|
+
children: [/* @__PURE__ */ jsx(ChartStyle, {
|
|
28
|
+
id: chartId,
|
|
29
|
+
config
|
|
30
|
+
}), /* @__PURE__ */ jsx(RechartsPrimitive.ResponsiveContainer, { children })]
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const ChartStyle = ({ id, config }) => {
|
|
35
|
+
const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);
|
|
36
|
+
if (!colorConfig.length) return null;
|
|
37
|
+
return /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: Object.entries(THEMES).map(([theme, prefix]) => `
|
|
38
|
+
${prefix} [data-chart=${id}] {
|
|
39
|
+
${colorConfig.map(([key, itemConfig]) => {
|
|
40
|
+
const color = itemConfig.theme?.[theme] || itemConfig.color;
|
|
41
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
42
|
+
}).join("\n")}
|
|
43
|
+
}
|
|
44
|
+
`).join("\n") } });
|
|
45
|
+
};
|
|
46
|
+
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
47
|
+
function ChartTooltipContent({ active, payload, label, className, indicator = "dot", hideLabel = false, hideIndicator = false, labelFormatter, formatter, labelClassName, color, nameKey, labelKey }) {
|
|
48
|
+
const { config } = useChart();
|
|
49
|
+
const tooltipLabel = React$1.useMemo(() => {
|
|
50
|
+
if (hideLabel || !payload?.length) return null;
|
|
51
|
+
const [item] = payload;
|
|
52
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, `${labelKey || item?.dataKey || item?.name || "value"}`);
|
|
53
|
+
const value = (() => {
|
|
54
|
+
const v = !labelKey && typeof label === "string" ? config[label]?.label ?? label : itemConfig?.label;
|
|
55
|
+
return typeof v === "string" || typeof v === "number" ? v : void 0;
|
|
56
|
+
})();
|
|
57
|
+
if (labelFormatter) return /* @__PURE__ */ jsx("div", {
|
|
58
|
+
className: cn("font-medium", labelClassName),
|
|
59
|
+
children: labelFormatter(label, payload)
|
|
60
|
+
});
|
|
61
|
+
if (!value) return null;
|
|
62
|
+
return /* @__PURE__ */ jsx("div", {
|
|
63
|
+
className: cn("font-medium", labelClassName),
|
|
64
|
+
children: value
|
|
65
|
+
});
|
|
66
|
+
}, [
|
|
67
|
+
label,
|
|
68
|
+
labelFormatter,
|
|
69
|
+
payload,
|
|
70
|
+
hideLabel,
|
|
71
|
+
labelClassName,
|
|
72
|
+
config,
|
|
73
|
+
labelKey
|
|
74
|
+
]);
|
|
75
|
+
if (!active || !payload?.length) return null;
|
|
76
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
77
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
78
|
+
className: cn("border-border/50 bg-background z-50 grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl", className),
|
|
79
|
+
children: [!nestLabel ? tooltipLabel : null, /* @__PURE__ */ jsx("div", {
|
|
80
|
+
className: "grid gap-1.5",
|
|
81
|
+
children: payload.map((item, index) => {
|
|
82
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, `${nameKey || item.name || item.dataKey || "value"}`);
|
|
83
|
+
const indicatorColor = color || item.payload.fill || item.color;
|
|
84
|
+
return /* @__PURE__ */ jsx("div", {
|
|
85
|
+
className: cn("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", indicator === "dot" && "items-center"),
|
|
86
|
+
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxs(Fragment$1, { children: [itemConfig?.icon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsx("div", {
|
|
87
|
+
className: cn("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", {
|
|
88
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
89
|
+
"w-1": indicator === "line",
|
|
90
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
91
|
+
"my-0.5": nestLabel && indicator === "dashed"
|
|
92
|
+
}),
|
|
93
|
+
style: {
|
|
94
|
+
"--color-bg": indicatorColor,
|
|
95
|
+
"--color-border": indicatorColor
|
|
96
|
+
}
|
|
97
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
98
|
+
className: cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center"),
|
|
99
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
100
|
+
className: "grid gap-1.5",
|
|
101
|
+
children: [nestLabel ? tooltipLabel : null, /* @__PURE__ */ jsx("span", {
|
|
102
|
+
className: "text-muted-foreground",
|
|
103
|
+
children: itemConfig?.label || item.name
|
|
104
|
+
})]
|
|
105
|
+
}), item.value && /* @__PURE__ */ jsx("span", {
|
|
106
|
+
className: "text-foreground font-mono font-medium tabular-nums",
|
|
107
|
+
children: item.value.toLocaleString()
|
|
108
|
+
})]
|
|
109
|
+
})] })
|
|
110
|
+
}, item.dataKey);
|
|
111
|
+
})
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
const ChartLegend = RechartsPrimitive.Legend;
|
|
116
|
+
function ChartLegendContent({ className, hideIcon = false, payload, nameKey }) {
|
|
117
|
+
const { config } = useChart();
|
|
118
|
+
if (!payload?.length) return null;
|
|
119
|
+
return /* @__PURE__ */ jsx("div", {
|
|
120
|
+
className: cn("flex flex-wrap items-center justify-center gap-2", className),
|
|
121
|
+
children: payload.map((item) => {
|
|
122
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, `${nameKey || item.dataKey || "value"}`);
|
|
123
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
124
|
+
className: cn("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
|
|
125
|
+
children: [itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsx("div", {
|
|
126
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
127
|
+
style: { backgroundColor: item.color }
|
|
128
|
+
}), itemConfig?.label]
|
|
129
|
+
}, item.value);
|
|
130
|
+
})
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
134
|
+
if (typeof payload !== "object" || payload === null) return;
|
|
135
|
+
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
|
|
136
|
+
let configLabelKey = key;
|
|
137
|
+
if (key in payload && typeof payload[key] === "string") configLabelKey = payload[key];
|
|
138
|
+
else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") configLabelKey = payloadPayload[key];
|
|
139
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
//#endregion
|
|
143
|
+
export { ChartTooltip as a, ChartStyle as i, ChartLegend as n, ChartTooltipContent as o, ChartLegendContent as r, ChartContainer as t };
|