@taicode/common-web 3.3.0 → 3.4.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/output/components/badge.d.ts +7 -6
- package/output/components/badge.d.ts.map +1 -1
- package/output/components/badge.js +20 -12
- package/output/components/button.d.ts +8 -8
- package/output/components/button.d.ts.map +1 -1
- package/output/components/button.js +25 -21
- package/output/components/calendar.d.ts +13 -0
- package/output/components/calendar.d.ts.map +1 -0
- package/output/components/calendar.js +57 -0
- package/output/components/card.d.ts +12 -7
- package/output/components/card.d.ts.map +1 -1
- package/output/components/card.js +25 -20
- package/output/components/chart.d.ts +56 -0
- package/output/components/chart.d.ts.map +1 -0
- package/output/components/chart.js +127 -0
- package/output/components/drawer.d.ts +14 -0
- package/output/components/drawer.d.ts.map +1 -0
- package/output/components/drawer.js +56 -0
- package/output/components/index.d.ts +6 -0
- package/output/components/index.d.ts.map +1 -1
- package/output/components/index.js +6 -0
- package/output/components/input-group.d.ts +1 -1
- package/output/components/input.d.ts +3 -2
- package/output/components/input.d.ts.map +1 -1
- package/output/components/input.js +6 -6
- package/output/components/item.d.ts +1 -1
- package/output/components/separator.d.ts +4 -5
- package/output/components/separator.d.ts.map +1 -1
- package/output/components/separator.js +7 -6
- package/output/components/sidebar.d.ts +78 -0
- package/output/components/sidebar.d.ts.map +1 -0
- package/output/components/sidebar.js +233 -0
- package/output/components/skeleton.d.ts +2 -2
- package/output/components/skeleton.d.ts.map +1 -1
- package/output/components/skeleton.js +4 -3
- package/output/components/toggle-group.d.ts +12 -0
- package/output/components/toggle-group.d.ts.map +1 -0
- package/output/components/toggle-group.js +38 -0
- package/output/components/toggle.d.ts +10 -0
- package/output/components/toggle.d.ts.map +1 -0
- package/output/components/toggle.js +38 -0
- package/output/layout/empty/index.d.ts +20 -0
- package/output/layout/empty/index.d.ts.map +1 -0
- package/output/layout/empty/index.js +14 -0
- package/output/layout/index.d.ts +4 -0
- package/output/layout/index.d.ts.map +1 -1
- package/output/layout/index.js +4 -0
- package/output/layout/list-actions/index.d.ts +23 -0
- package/output/layout/list-actions/index.d.ts.map +1 -0
- package/output/layout/list-actions/index.js +15 -0
- package/output/layout/page-back-button/index.d.ts +8 -0
- package/output/layout/page-back-button/index.d.ts.map +1 -0
- package/output/layout/page-back-button/index.js +7 -0
- package/output/layout/pagination/index.d.ts +34 -0
- package/output/layout/pagination/index.d.ts.map +1 -0
- package/output/layout/pagination/index.js +75 -0
- package/package.json +4 -5
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
type BadgeParams = {
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
};
|
|
3
6
|
declare const badgeVariants: (props?: ({
|
|
4
|
-
variant?: "default" | "destructive" | "
|
|
7
|
+
variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | "success" | "warning" | null | undefined;
|
|
5
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
export declare const Badge: import("react").ForwardRefExoticComponent<BadgeProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
-
export {};
|
|
9
|
+
declare function Badge(params: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & BadgeParams): React.JSX.Element;
|
|
10
|
+
export { Badge, badgeVariants };
|
|
10
11
|
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../source/components/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../source/components/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAKjE,KAAK,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAExC,QAAA,MAAM,aAAa;;8EAmBlB,CAAA;AAED,iBAAS,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,GAAG,WAAW,qBAYrG;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -10,22 +10,30 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import
|
|
13
|
+
import * as React from 'react';
|
|
14
14
|
import { cva } from 'class-variance-authority';
|
|
15
|
+
import { Slot } from 'radix-ui';
|
|
15
16
|
import { mergeClassNames } from '../utils/merge-class-names/index.js';
|
|
16
|
-
const badgeVariants = cva(
|
|
17
|
+
const badgeVariants = cva("h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive overflow-hidden group/badge", {
|
|
17
18
|
variants: {
|
|
18
19
|
variant: {
|
|
19
|
-
default: '
|
|
20
|
-
secondary: '
|
|
21
|
-
destructive: '
|
|
22
|
-
|
|
20
|
+
default: 'bg-primary text-primary-foreground [a]:hover:bg-primary/80',
|
|
21
|
+
secondary: 'bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80',
|
|
22
|
+
destructive: 'bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20',
|
|
23
|
+
success: 'border-green-600 bg-green-50 text-green-600 [a]:hover:bg-green-100 focus-visible:ring-green-600/20 dark:border-green-400 dark:bg-green-950 dark:text-green-400 dark:[a]:hover:bg-green-900',
|
|
24
|
+
warning: 'border-orange-600 bg-orange-50 text-orange-600 [a]:hover:bg-orange-100 focus-visible:ring-orange-600/20 dark:border-orange-400 dark:bg-orange-950 dark:text-orange-400 dark:[a]:hover:bg-orange-900',
|
|
25
|
+
outline: 'border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground',
|
|
26
|
+
ghost: 'hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50',
|
|
27
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
23
28
|
},
|
|
24
29
|
},
|
|
25
|
-
defaultVariants: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var { className, variant } = _a, props = __rest(_a, ["className", "variant"]);
|
|
29
|
-
return _jsx("div", Object.assign({ ref: ref, className: mergeClassNames(badgeVariants({ variant }), className) }, props));
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
variant: 'default',
|
|
32
|
+
},
|
|
30
33
|
});
|
|
31
|
-
Badge
|
|
34
|
+
function Badge(params) {
|
|
35
|
+
const { className, variant = 'default', asChild = false } = params, props = __rest(params, ["className", "variant", "asChild"]);
|
|
36
|
+
const Comp = asChild ? Slot.Root : 'span';
|
|
37
|
+
return (_jsx(Comp, Object.assign({ "data-slot": "badge", "data-variant": variant, className: mergeClassNames(badgeVariants({ variant }), className) }, props)));
|
|
38
|
+
}
|
|
39
|
+
export { Badge, badgeVariants };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
type ButtonParams = {
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
};
|
|
3
6
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "default" | "
|
|
5
|
-
size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-
|
|
7
|
+
variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
|
|
8
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
6
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
11
|
-
export { buttonVariants };
|
|
10
|
+
declare function Button(params: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & ButtonParams): React.JSX.Element;
|
|
11
|
+
export { Button, buttonVariants };
|
|
12
12
|
//# sourceMappingURL=button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../source/components/button.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../source/components/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,KAAK,YAAY,GAAG;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,QAAA,MAAM,cAAc;;;8EA4BnB,CAAA;AAED,iBAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG,YAAY,qBAa1G;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -10,35 +10,39 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import
|
|
14
|
-
import { Slot } from '
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { Slot } from 'radix-ui';
|
|
15
15
|
import { cva } from 'class-variance-authority';
|
|
16
16
|
import { mergeClassNames } from '../utils/merge-class-names/index.js';
|
|
17
|
-
const buttonVariants = cva(
|
|
17
|
+
const buttonVariants = cva("focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none", {
|
|
18
18
|
variants: {
|
|
19
19
|
variant: {
|
|
20
|
-
default: 'bg-primary text-primary-foreground hover:bg-primary/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
default: 'bg-primary text-primary-foreground hover:bg-primary/80',
|
|
21
|
+
outline: 'border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground shadow-xs',
|
|
22
|
+
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground',
|
|
23
|
+
ghost: 'hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground',
|
|
24
|
+
destructive: 'bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30',
|
|
25
25
|
link: 'text-primary underline-offset-4 hover:underline',
|
|
26
26
|
},
|
|
27
27
|
size: {
|
|
28
|
-
default: 'h-9 px-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
default: 'h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
|
|
29
|
+
xs: 'h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*="size-"])]:size-3',
|
|
30
|
+
sm: 'h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5',
|
|
31
|
+
lg: 'h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3',
|
|
31
32
|
icon: 'size-9',
|
|
32
|
-
'icon-
|
|
33
|
-
'icon-
|
|
33
|
+
'icon-xs': 'size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*="size-"])]:size-3',
|
|
34
|
+
'icon-sm': 'size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md',
|
|
35
|
+
'icon-lg': 'size-10',
|
|
34
36
|
},
|
|
35
37
|
},
|
|
36
|
-
defaultVariants: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const Component = asChild ? Slot : 'button';
|
|
41
|
-
return _jsx(Component, Object.assign({ ref: ref, className: mergeClassNames(buttonVariants({ variant, size, className })) }, props));
|
|
38
|
+
defaultVariants: {
|
|
39
|
+
variant: 'default',
|
|
40
|
+
size: 'default',
|
|
41
|
+
},
|
|
42
42
|
});
|
|
43
|
-
Button
|
|
44
|
-
|
|
43
|
+
function Button(params) {
|
|
44
|
+
const { className, variant = 'default', size = 'default', asChild = false } = params, props = __rest(params, ["className", "variant", "size", "asChild"]);
|
|
45
|
+
const Comp = asChild ? Slot.Root : 'button';
|
|
46
|
+
return (_jsx(Comp, Object.assign({ "data-slot": "button", "data-variant": variant, "data-size": size, className: mergeClassNames(buttonVariants({ variant, size, className })) }, props)));
|
|
47
|
+
}
|
|
48
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DayPicker, type DayButton, type Locale } from 'react-day-picker';
|
|
3
|
+
import { Button } from './button.js';
|
|
4
|
+
type CalendarDayButtonParams = {
|
|
5
|
+
locale?: Partial<Locale>;
|
|
6
|
+
};
|
|
7
|
+
type CalendarParams = {
|
|
8
|
+
buttonVariant?: React.ComponentProps<typeof Button>['variant'];
|
|
9
|
+
};
|
|
10
|
+
declare function Calendar(params: React.ComponentProps<typeof DayPicker> & CalendarParams): React.JSX.Element;
|
|
11
|
+
declare function CalendarDayButton(params: React.ComponentProps<typeof DayButton> & CalendarDayButtonParams): React.JSX.Element;
|
|
12
|
+
export { Calendar, CalendarDayButton };
|
|
13
|
+
//# sourceMappingURL=calendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../source/components/calendar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,SAAS,EAAwB,KAAK,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAG/F,OAAO,EAAE,MAAM,EAAkB,MAAM,aAAa,CAAA;AAGpD,KAAK,uBAAuB,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;CAAE,CAAA;AAE3D,KAAK,cAAc,GAAG;IACpB,aAAa,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAA;CAC/D,CAAA;AAED,iBAAS,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG,cAAc,qBA2GhF;AAED,iBAAS,iBAAiB,CACxB,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG,uBAAuB,qBA4BzE;AAED,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useRef, useEffect } from 'react';
|
|
15
|
+
import { DayPicker, getDefaultClassNames } from 'react-day-picker';
|
|
16
|
+
import { mergeClassNames } from '../utils/merge-class-names/index.js';
|
|
17
|
+
import { Button, buttonVariants } from './button.js';
|
|
18
|
+
import { ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon } from 'lucide-react';
|
|
19
|
+
function Calendar(params) {
|
|
20
|
+
const { className, classNames, showOutsideDays = true, captionLayout = 'label', buttonVariant = 'ghost', locale, formatters, components } = params, props = __rest(params, ["className", "classNames", "showOutsideDays", "captionLayout", "buttonVariant", "locale", "formatters", "components"]);
|
|
21
|
+
const defaultClassNames = getDefaultClassNames();
|
|
22
|
+
return (_jsx(DayPicker, Object.assign({ showOutsideDays: showOutsideDays, className: mergeClassNames('p-3 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(8)] bg-background group/calendar [[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), captionLayout: captionLayout, locale: locale, formatters: Object.assign({ formatMonthDropdown: (date) => date.toLocaleString(locale === null || locale === void 0 ? void 0 : locale.code, { month: 'short' }) }, formatters), classNames: Object.assign({ root: mergeClassNames('w-fit', defaultClassNames.root), months: mergeClassNames('flex gap-4 flex-col md:flex-row relative', defaultClassNames.months), month: mergeClassNames('flex flex-col w-full gap-4', defaultClassNames.month), nav: mergeClassNames('flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between', defaultClassNames.nav), button_previous: mergeClassNames(buttonVariants({ variant: buttonVariant }), 'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none', defaultClassNames.button_previous), button_next: mergeClassNames(buttonVariants({ variant: buttonVariant }), 'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none', defaultClassNames.button_next), month_caption: mergeClassNames('flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)', defaultClassNames.month_caption), dropdowns: mergeClassNames('w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5', defaultClassNames.dropdowns), dropdown_root: mergeClassNames('relative rounded-(--cell-radius)', defaultClassNames.dropdown_root), dropdown: mergeClassNames('absolute bg-popover inset-0 opacity-0', defaultClassNames.dropdown), caption_label: mergeClassNames('select-none font-medium', captionLayout === 'label'
|
|
23
|
+
? 'text-sm'
|
|
24
|
+
: 'rounded-(--cell-radius) flex items-center gap-1 text-sm [&>svg]:text-muted-foreground [&>svg]:size-3.5', defaultClassNames.caption_label), table: 'w-full border-collapse', weekdays: mergeClassNames('flex', defaultClassNames.weekdays), weekday: mergeClassNames('text-muted-foreground rounded-(--cell-radius) flex-1 font-normal text-[0.8rem] select-none', defaultClassNames.weekday), week: mergeClassNames('flex w-full mt-2', defaultClassNames.week), week_number_header: mergeClassNames('select-none w-(--cell-size)', defaultClassNames.week_number_header), week_number: mergeClassNames('text-[0.8rem] select-none text-muted-foreground', defaultClassNames.week_number), day: mergeClassNames('relative w-full rounded-(--cell-radius) h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius) group/day aspect-square select-none', props.showWeekNumber
|
|
25
|
+
? '[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)'
|
|
26
|
+
: '[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)', defaultClassNames.day), range_start: mergeClassNames('rounded-l-(--cell-radius) bg-muted relative after:bg-muted after:absolute after:inset-y-0 after:w-4 after:right-0 -z-0 isolate', defaultClassNames.range_start), range_middle: mergeClassNames('rounded-none', defaultClassNames.range_middle), range_end: mergeClassNames('rounded-r-(--cell-radius) bg-muted relative after:bg-muted after:absolute after:inset-y-0 after:w-4 after:left-0 -z-0 isolate', defaultClassNames.range_end), today: mergeClassNames('bg-muted text-foreground rounded-(--cell-radius) data-[selected=true]:rounded-none', defaultClassNames.today), outside: mergeClassNames('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside), disabled: mergeClassNames('text-muted-foreground opacity-50', defaultClassNames.disabled), hidden: mergeClassNames('invisible', defaultClassNames.hidden) }, classNames), components: Object.assign({ Root: (_a) => {
|
|
27
|
+
var { className, rootRef } = _a, props = __rest(_a, ["className", "rootRef"]);
|
|
28
|
+
return _jsx("div", Object.assign({ "data-slot": "calendar", ref: rootRef, className: mergeClassNames(className) }, props));
|
|
29
|
+
}, Chevron: (_a) => {
|
|
30
|
+
var { className, orientation } = _a, props = __rest(_a, ["className", "orientation"]);
|
|
31
|
+
if (orientation === 'left') {
|
|
32
|
+
return _jsx(ChevronLeftIcon, Object.assign({ className: mergeClassNames('size-4', className) }, props));
|
|
33
|
+
}
|
|
34
|
+
if (orientation === 'right') {
|
|
35
|
+
return _jsx(ChevronRightIcon, Object.assign({ className: mergeClassNames('size-4', className) }, props));
|
|
36
|
+
}
|
|
37
|
+
return _jsx(ChevronDownIcon, Object.assign({ className: mergeClassNames('size-4', className) }, props));
|
|
38
|
+
}, DayButton: (_a) => {
|
|
39
|
+
var props = __rest(_a, []);
|
|
40
|
+
return _jsx(CalendarDayButton, Object.assign({ locale: locale }, props));
|
|
41
|
+
}, WeekNumber: (_a) => {
|
|
42
|
+
var { children } = _a, props = __rest(_a, ["children"]);
|
|
43
|
+
return (_jsx("td", Object.assign({}, props, { children: _jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children: children }) })));
|
|
44
|
+
} }, components) }, props)));
|
|
45
|
+
}
|
|
46
|
+
function CalendarDayButton(params) {
|
|
47
|
+
const { className, day, modifiers, locale } = params, props = __rest(params, ["className", "day", "modifiers", "locale"]);
|
|
48
|
+
const defaultClassNames = getDefaultClassNames();
|
|
49
|
+
const ref = useRef(null);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
var _a;
|
|
52
|
+
if (modifiers.focused)
|
|
53
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
54
|
+
}, [modifiers.focused]);
|
|
55
|
+
return (_jsx(Button, Object.assign({ ref: ref, variant: "ghost", size: "icon", "data-day": day.date.toLocaleDateString(locale === null || locale === void 0 ? void 0 : locale.code), "data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle, "data-range-start": modifiers.range_start, "data-range-end": modifiers.range_end, "data-range-middle": modifiers.range_middle, className: mergeClassNames('data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-muted data-[range-middle=true]:text-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-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 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-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) [&>span]:text-xs [&>span]:opacity-70', defaultClassNames.day, className) }, props)));
|
|
56
|
+
}
|
|
57
|
+
export { Calendar, CalendarDayButton };
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type CardParams = {
|
|
3
|
+
size?: 'default' | 'sm';
|
|
4
|
+
};
|
|
5
|
+
declare function Card(params: React.ComponentProps<'div'> & CardParams): React.JSX.Element;
|
|
6
|
+
declare function CardHeader(params: React.ComponentProps<'div'>): React.JSX.Element;
|
|
7
|
+
declare function CardTitle(params: React.ComponentProps<'div'>): React.JSX.Element;
|
|
8
|
+
declare function CardDescription(params: React.ComponentProps<'div'>): React.JSX.Element;
|
|
9
|
+
declare function CardAction(params: React.ComponentProps<'div'>): React.JSX.Element;
|
|
10
|
+
declare function CardContent(params: React.ComponentProps<'div'>): React.JSX.Element;
|
|
11
|
+
declare function CardFooter(params: React.ComponentProps<'div'>): React.JSX.Element;
|
|
12
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardAction, CardContent };
|
|
8
13
|
//# sourceMappingURL=card.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../source/components/card.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../source/components/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,KAAK,UAAU,GAAG;IAAE,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;CAAE,CAAA;AAE7C,iBAAS,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,UAAU,qBAa7D;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAYtD;AAED,iBAAS,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBASrD;AAED,iBAAS,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAG3D;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAStD;AAED,iBAAS,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAGvD;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAStD;AAED,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -10,29 +10,34 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import
|
|
13
|
+
import * as React from 'react';
|
|
14
14
|
import { mergeClassNames } from '../utils/merge-class-names/index.js';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return _jsx("div", Object.assign({
|
|
18
|
-
});
|
|
19
|
-
export function CardHeader(_a) {
|
|
20
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
21
|
-
return _jsx("div", Object.assign({ className: mergeClassNames('flex flex-col space-y-1.5 p-6', className) }, props));
|
|
15
|
+
function Card(params) {
|
|
16
|
+
const { className, size = 'default' } = params, props = __rest(params, ["className", "size"]);
|
|
17
|
+
return (_jsx("div", Object.assign({ "data-slot": "card", "data-size": size, className: mergeClassNames('ring-foreground/10 bg-card text-card-foreground gap-6 overflow-hidden rounded-xl py-6 text-sm shadow-xs ring-1 has-[>img:first-child]:pt-0 data-[size=sm]:gap-4 data-[size=sm]:py-4 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl group/card flex flex-col', className) }, props)));
|
|
22
18
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return _jsx("
|
|
19
|
+
function CardHeader(params) {
|
|
20
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
21
|
+
return (_jsx("div", Object.assign({ "data-slot": "card-header", className: mergeClassNames('gap-1 rounded-t-xl px-6 group-data-[size=sm]/card:px-4 [.border-b]:pb-6 group-data-[size=sm]/card:[.border-b]:pb-4 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]', className) }, props)));
|
|
26
22
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return _jsx("
|
|
23
|
+
function CardTitle(params) {
|
|
24
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
25
|
+
return (_jsx("div", Object.assign({ "data-slot": "card-title", className: mergeClassNames('text-base leading-normal font-medium group-data-[size=sm]/card:text-sm', className) }, props)));
|
|
30
26
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return _jsx("div", Object.assign({ className: mergeClassNames('
|
|
27
|
+
function CardDescription(params) {
|
|
28
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
29
|
+
return _jsx("div", Object.assign({ "data-slot": "card-description", className: mergeClassNames('text-muted-foreground text-sm', className) }, props));
|
|
34
30
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return _jsx("div", Object.assign({ className: mergeClassNames('
|
|
31
|
+
function CardAction(params) {
|
|
32
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
33
|
+
return (_jsx("div", Object.assign({ "data-slot": "card-action", className: mergeClassNames('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className) }, props)));
|
|
38
34
|
}
|
|
35
|
+
function CardContent(params) {
|
|
36
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
37
|
+
return _jsx("div", Object.assign({ "data-slot": "card-content", className: mergeClassNames('px-6 group-data-[size=sm]/card:px-4', className) }, props));
|
|
38
|
+
}
|
|
39
|
+
function CardFooter(params) {
|
|
40
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
41
|
+
return (_jsx("div", Object.assign({ "data-slot": "card-footer", className: mergeClassNames('px-6 pb-6 group-data-[size=sm]/card:pb-4 flex items-center [.border-t]:pt-6 group-data-[size=sm]/card:[.border-t]:pt-4', className) }, props)));
|
|
42
|
+
}
|
|
43
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardAction, CardContent };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as RechartsPrimitive from 'recharts';
|
|
3
|
+
type ChartContainerParams = {
|
|
4
|
+
config: ChartConfig;
|
|
5
|
+
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
|
|
6
|
+
};
|
|
7
|
+
type ChartLegendContentParams = {
|
|
8
|
+
className?: string;
|
|
9
|
+
hideIcon?: boolean;
|
|
10
|
+
payload?: any[];
|
|
11
|
+
verticalAlign?: 'top' | 'bottom';
|
|
12
|
+
nameKey?: string;
|
|
13
|
+
};
|
|
14
|
+
type ChartTooltipContentParams = {
|
|
15
|
+
active?: boolean;
|
|
16
|
+
payload?: any[];
|
|
17
|
+
className?: string;
|
|
18
|
+
indicator?: 'line' | 'dot' | 'dashed';
|
|
19
|
+
hideLabel?: boolean;
|
|
20
|
+
hideIndicator?: boolean;
|
|
21
|
+
label?: string | number;
|
|
22
|
+
labelFormatter?: (value: any, payload: any[]) => React.ReactNode;
|
|
23
|
+
labelClassName?: string;
|
|
24
|
+
formatter?: (value: any, name: string, item: any, index: number, payload: any) => React.ReactNode;
|
|
25
|
+
color?: string;
|
|
26
|
+
nameKey?: string;
|
|
27
|
+
labelKey?: string;
|
|
28
|
+
};
|
|
29
|
+
type ChartStyleParams = {
|
|
30
|
+
id: string;
|
|
31
|
+
config: ChartConfig;
|
|
32
|
+
};
|
|
33
|
+
declare const THEMES: {
|
|
34
|
+
readonly light: "";
|
|
35
|
+
readonly dark: ".dark";
|
|
36
|
+
};
|
|
37
|
+
export type ChartConfig = {
|
|
38
|
+
[k in string]: {
|
|
39
|
+
label?: React.ReactNode;
|
|
40
|
+
icon?: React.ComponentType;
|
|
41
|
+
} & ({
|
|
42
|
+
color?: string;
|
|
43
|
+
theme?: never;
|
|
44
|
+
} | {
|
|
45
|
+
color?: never;
|
|
46
|
+
theme: Record<keyof typeof THEMES, string>;
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
declare function ChartContainer(params: React.ComponentProps<'div'> & ChartContainerParams): React.JSX.Element;
|
|
50
|
+
declare const ChartStyle: ({ id, config }: ChartStyleParams) => React.JSX.Element | null;
|
|
51
|
+
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
52
|
+
declare function ChartTooltipContent(params: ChartTooltipContentParams & React.ComponentProps<'div'>): React.JSX.Element | null;
|
|
53
|
+
declare const ChartLegend: typeof RechartsPrimitive.Legend;
|
|
54
|
+
declare function ChartLegendContent(params: ChartLegendContentParams & React.ComponentProps<'div'>): React.JSX.Element | null;
|
|
55
|
+
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle };
|
|
56
|
+
//# sourceMappingURL=chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../source/components/chart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,iBAAiB,MAAM,UAAU,CAAA;AAI7C,KAAK,oBAAoB,GAAG;IAC1B,MAAM,EAAE,WAAW,CAAA;IACnB,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,mBAAmB,CAAC,CAAC,UAAU,CAAC,CAAA;CACzF,CAAA;AAED,KAAK,wBAAwB,GAAG;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,GAAG,EAAE,CAAA;IACf,aAAa,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAA;IAChC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,KAAK,yBAAyB,GAAG;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,GAAG,EAAE,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAA;IACrC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,KAAK,CAAC,SAAS,CAAA;IAChE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,KAAK,CAAC,SAAS,CAAA;IACjG,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,KAAK,gBAAgB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,CAAA;AAG3D,QAAA,MAAM,MAAM;;;CAAwC,CAAA;AAEpD,MAAM,MAAM,WAAW,GAAG;KACvB,CAAC,IAAI,MAAM,GAAG;QACb,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;QACvB,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;KAC3B,GAAG,CACA;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE,GACjC;QAAE,KAAK,CAAC,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,OAAO,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAChE;CACF,CAAA;AAkBD,iBAAS,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,oBAAoB,qBAqBjF;AAED,QAAA,MAAM,UAAU,GAAI,gBAAgB,gBAAgB,6BA2BnD,CAAA;AAED,QAAA,MAAM,YAAY,kCAA4B,CAAA;AAE9C,iBAAS,mBAAmB,CAAC,MAAM,EAAE,yBAAyB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,4BA4G3F;AAED,QAAA,MAAM,WAAW,iCAA2B,CAAA;AAE5C,iBAAS,kBAAkB,CAAC,MAAM,EAAE,wBAAwB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,4BAkCzF;AAqBD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,mBAAmB,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useContext, useId, useMemo } from 'react';
|
|
15
|
+
import * as RechartsPrimitive from 'recharts';
|
|
16
|
+
import { mergeClassNames } from '../utils/merge-class-names/index.js';
|
|
17
|
+
// Format: { THEME_NAME: CSS_SELECTOR }
|
|
18
|
+
const THEMES = { light: '', dark: '.dark' };
|
|
19
|
+
const ChartContext = React.createContext(null);
|
|
20
|
+
function useChart() {
|
|
21
|
+
const context = useContext(ChartContext);
|
|
22
|
+
if (!context) {
|
|
23
|
+
throw new Error('useChart must be used within a <ChartContainer />');
|
|
24
|
+
}
|
|
25
|
+
return context;
|
|
26
|
+
}
|
|
27
|
+
function ChartContainer(params) {
|
|
28
|
+
const { id, className, children, config } = params, props = __rest(params, ["id", "className", "children", "config"]);
|
|
29
|
+
const uniqueId = useId();
|
|
30
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;
|
|
31
|
+
return (_jsx(ChartContext.Provider, { value: { config }, children: _jsxs("div", Object.assign({ "data-slot": "chart", "data-chart": chartId, className: mergeClassNames("[&_.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) }, props, { children: [_jsx(ChartStyle, { id: chartId, config: config }), _jsx(RechartsPrimitive.ResponsiveContainer, { children: children })] })) }));
|
|
32
|
+
}
|
|
33
|
+
const ChartStyle = ({ id, config }) => {
|
|
34
|
+
const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);
|
|
35
|
+
if (!colorConfig.length) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return (_jsx("style", { dangerouslySetInnerHTML: {
|
|
39
|
+
__html: Object.entries(THEMES)
|
|
40
|
+
.map(([theme, prefix]) => `
|
|
41
|
+
${prefix} [data-chart=${id}] {
|
|
42
|
+
${colorConfig
|
|
43
|
+
.map(([key, itemConfig]) => {
|
|
44
|
+
var _a;
|
|
45
|
+
const color = ((_a = itemConfig.theme) === null || _a === void 0 ? void 0 : _a[theme]) || itemConfig.color;
|
|
46
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
47
|
+
})
|
|
48
|
+
.join('\n')}
|
|
49
|
+
}
|
|
50
|
+
`)
|
|
51
|
+
.join('\n'),
|
|
52
|
+
} }));
|
|
53
|
+
};
|
|
54
|
+
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
55
|
+
function ChartTooltipContent(params) {
|
|
56
|
+
const { active, payload, className, indicator = 'dot', hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, } = params;
|
|
57
|
+
const { config } = useChart();
|
|
58
|
+
const tooltipLabel = useMemo(() => {
|
|
59
|
+
var _a;
|
|
60
|
+
if (hideLabel || !(payload === null || payload === void 0 ? void 0 : payload.length)) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const [item] = payload;
|
|
64
|
+
const key = `${labelKey || (item === null || item === void 0 ? void 0 : item.dataKey) || (item === null || item === void 0 ? void 0 : item.name) || 'value'}`;
|
|
65
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
66
|
+
const value = !labelKey && typeof label === 'string' ? ((_a = config[label]) === null || _a === void 0 ? void 0 : _a.label) || label : itemConfig === null || itemConfig === void 0 ? void 0 : itemConfig.label;
|
|
67
|
+
if (labelFormatter) {
|
|
68
|
+
return _jsx("div", { className: mergeClassNames('font-medium', labelClassName), children: labelFormatter(value, payload) });
|
|
69
|
+
}
|
|
70
|
+
if (!value) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
return _jsx("div", { className: mergeClassNames('font-medium', labelClassName), children: value });
|
|
74
|
+
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
|
|
75
|
+
if (!active || !(payload === null || payload === void 0 ? void 0 : payload.length)) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
const nestLabel = payload.length === 1 && indicator !== 'dot';
|
|
79
|
+
return (_jsxs("div", { className: mergeClassNames('border-border/50 bg-background gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl grid min-w-[8rem] items-start', className), children: [!nestLabel ? tooltipLabel : null, _jsx("div", { className: "grid gap-1.5", children: payload
|
|
80
|
+
.filter((item) => item.type !== 'none')
|
|
81
|
+
.map((item, index) => {
|
|
82
|
+
const key = `${nameKey || item.name || item.dataKey || 'value'}`;
|
|
83
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
84
|
+
const indicatorColor = color || item.payload.fill || item.color;
|
|
85
|
+
return (_jsx("div", { className: mergeClassNames('[&>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'), children: formatter && (item === null || item === void 0 ? void 0 : item.value) !== undefined && item.name ? (formatter(item.value, item.name, item, index, item.payload)) : (_jsxs(_Fragment, { children: [(itemConfig === null || itemConfig === void 0 ? void 0 : itemConfig.icon) ? (_jsx(itemConfig.icon, {})) : (!hideIndicator && (_jsx("div", { className: mergeClassNames('shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)', {
|
|
86
|
+
'h-2.5 w-2.5': indicator === 'dot',
|
|
87
|
+
'w-1': indicator === 'line',
|
|
88
|
+
'w-0 border-[1.5px] border-dashed bg-transparent': indicator === 'dashed',
|
|
89
|
+
'my-0.5': nestLabel && indicator === 'dashed',
|
|
90
|
+
}), style: {
|
|
91
|
+
'--color-bg': indicatorColor,
|
|
92
|
+
'--color-border': indicatorColor,
|
|
93
|
+
} }))), _jsxs("div", { className: mergeClassNames('flex flex-1 justify-between leading-none', nestLabel ? 'items-end' : 'items-center'), children: [_jsxs("div", { className: "grid gap-1.5", children: [nestLabel ? tooltipLabel : null, _jsx("span", { className: "text-muted-foreground", children: (itemConfig === null || itemConfig === void 0 ? void 0 : itemConfig.label) || item.name })] }), item.value && (_jsx("span", { className: "text-foreground font-mono font-medium tabular-nums", children: item.value.toLocaleString() }))] })] })) }, item.dataKey));
|
|
94
|
+
}) })] }));
|
|
95
|
+
}
|
|
96
|
+
const ChartLegend = RechartsPrimitive.Legend;
|
|
97
|
+
function ChartLegendContent(params) {
|
|
98
|
+
const { className, hideIcon = false, payload, verticalAlign = 'bottom', nameKey } = params;
|
|
99
|
+
const { config } = useChart();
|
|
100
|
+
if (!(payload === null || payload === void 0 ? void 0 : payload.length)) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
return (_jsx("div", { className: mergeClassNames('flex items-center justify-center gap-4', verticalAlign === 'top' ? 'pb-3' : 'pt-3', className), children: payload
|
|
104
|
+
.filter((item) => item.type !== 'none')
|
|
105
|
+
.map((item) => {
|
|
106
|
+
const key = `${nameKey || item.dataKey || 'value'}`;
|
|
107
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
108
|
+
return (_jsxs("div", { className: mergeClassNames('[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3'), children: [(itemConfig === null || itemConfig === void 0 ? void 0 : itemConfig.icon) && !hideIcon ? (_jsx(itemConfig.icon, {})) : (_jsx("div", { className: "h-2 w-2 shrink-0 rounded-[2px]", style: {
|
|
109
|
+
backgroundColor: item.color,
|
|
110
|
+
} })), itemConfig === null || itemConfig === void 0 ? void 0 : itemConfig.label] }, item.value));
|
|
111
|
+
}) }));
|
|
112
|
+
}
|
|
113
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
114
|
+
if (typeof payload !== 'object' || payload === null) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
const payloadPayload = 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null ? payload.payload : undefined;
|
|
118
|
+
let configLabelKey = key;
|
|
119
|
+
if (key in payload && typeof payload[key] === 'string') {
|
|
120
|
+
configLabelKey = payload[key];
|
|
121
|
+
}
|
|
122
|
+
else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === 'string') {
|
|
123
|
+
configLabelKey = payloadPayload[key];
|
|
124
|
+
}
|
|
125
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
126
|
+
}
|
|
127
|
+
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Drawer as DrawerPrimitive } from 'vaul';
|
|
3
|
+
declare function Drawer(params: React.ComponentProps<typeof DrawerPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function DrawerTrigger(params: React.ComponentProps<typeof DrawerPrimitive.Trigger>): React.JSX.Element;
|
|
5
|
+
declare function DrawerPortal(params: React.ComponentProps<typeof DrawerPrimitive.Portal>): React.JSX.Element;
|
|
6
|
+
declare function DrawerClose(params: React.ComponentProps<typeof DrawerPrimitive.Close>): React.JSX.Element;
|
|
7
|
+
declare function DrawerOverlay(params: React.ComponentProps<typeof DrawerPrimitive.Overlay>): React.JSX.Element;
|
|
8
|
+
declare function DrawerContent(params: React.ComponentProps<typeof DrawerPrimitive.Content>): React.JSX.Element;
|
|
9
|
+
declare function DrawerHeader(params: React.ComponentProps<'div'>): React.JSX.Element;
|
|
10
|
+
declare function DrawerFooter(params: React.ComponentProps<'div'>): React.JSX.Element;
|
|
11
|
+
declare function DrawerTitle(params: React.ComponentProps<typeof DrawerPrimitive.Title>): React.JSX.Element;
|
|
12
|
+
declare function DrawerDescription(params: React.ComponentProps<typeof DrawerPrimitive.Description>): React.JSX.Element;
|
|
13
|
+
export { Drawer, DrawerPortal, DrawerOverlay, DrawerTrigger, DrawerClose, DrawerContent, DrawerHeader, DrawerFooter, DrawerTitle, DrawerDescription };
|
|
14
|
+
//# sourceMappingURL=drawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../source/components/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,MAAM,CAAA;AAIhD,iBAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,qBAGxE;AAED,iBAAS,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,qBAGlF;AAED,iBAAS,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,MAAM,CAAC,qBAGhF;AAED,iBAAS,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAG9E;AAED,iBAAS,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,qBASlF;AAED,iBAAS,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,qBAkBlF;AAED,iBAAS,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBASxD;AAED,iBAAS,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAKxD;AAED,iBAAS,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAS9E;AAED,iBAAS,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,qBAS1F;AAED,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAA"}
|