@taicode/common-web 3.3.0 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +9 -0
- package/output/components/index.d.ts.map +1 -1
- package/output/components/index.js +9 -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/list-actions/index.d.ts +23 -0
- package/output/components/list-actions/index.d.ts.map +1 -0
- package/output/components/list-actions/index.js +15 -0
- package/output/components/page-back-button/index.d.ts +8 -0
- package/output/components/page-back-button/index.d.ts.map +1 -0
- package/output/components/page-back-button/index.js +7 -0
- package/output/components/pagination/index.d.ts +34 -0
- package/output/components/pagination/index.d.ts.map +1 -0
- package/output/components/pagination/index.js +75 -0
- 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/package.json +4 -5
|
@@ -0,0 +1,233 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
15
|
+
import { cva } from 'class-variance-authority';
|
|
16
|
+
import { Slot } from 'radix-ui';
|
|
17
|
+
import { mergeClassNames } from '../utils/merge-class-names/index.js';
|
|
18
|
+
import { Button } from './button.js';
|
|
19
|
+
import { Input } from './input.js';
|
|
20
|
+
import { Separator } from './separator.js';
|
|
21
|
+
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from './sheet.js';
|
|
22
|
+
import { Skeleton } from './skeleton.js';
|
|
23
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './tooltip.js';
|
|
24
|
+
import { useIsMobile } from '../hooks/use-mobile/index.js';
|
|
25
|
+
import { PanelLeftIcon } from 'lucide-react';
|
|
26
|
+
const SIDEBAR_COOKIE_NAME = 'sidebar_state';
|
|
27
|
+
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
28
|
+
const SIDEBAR_WIDTH = '16rem';
|
|
29
|
+
const SIDEBAR_WIDTH_MOBILE = '18rem';
|
|
30
|
+
const SIDEBAR_WIDTH_ICON = '3rem';
|
|
31
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
|
|
32
|
+
const SidebarContext = React.createContext(null);
|
|
33
|
+
function useSidebar() {
|
|
34
|
+
const context = useContext(SidebarContext);
|
|
35
|
+
if (!context) {
|
|
36
|
+
throw new Error('useSidebar must be used within a SidebarProvider.');
|
|
37
|
+
}
|
|
38
|
+
return context;
|
|
39
|
+
}
|
|
40
|
+
function SidebarProvider(params) {
|
|
41
|
+
const { defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children } = params, props = __rest(params, ["defaultOpen", "open", "onOpenChange", "className", "style", "children"]);
|
|
42
|
+
const isMobile = useIsMobile();
|
|
43
|
+
const [openMobile, setOpenMobile] = useState(false);
|
|
44
|
+
// This is the internal state of the sidebar.
|
|
45
|
+
// We use openProp and setOpenProp for control from outside the component.
|
|
46
|
+
const [_open, _setOpen] = useState(defaultOpen);
|
|
47
|
+
const open = openProp !== null && openProp !== void 0 ? openProp : _open;
|
|
48
|
+
const setOpen = useCallback((value) => {
|
|
49
|
+
const openState = typeof value === 'function' ? value(open) : value;
|
|
50
|
+
if (setOpenProp) {
|
|
51
|
+
setOpenProp(openState);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
_setOpen(openState);
|
|
55
|
+
}
|
|
56
|
+
// This sets the cookie to keep the sidebar state.
|
|
57
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
58
|
+
}, [setOpenProp, open]);
|
|
59
|
+
// Helper to toggle the sidebar.
|
|
60
|
+
const toggleSidebar = useCallback(() => {
|
|
61
|
+
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
62
|
+
}, [isMobile, setOpen, setOpenMobile]);
|
|
63
|
+
// Adds a keyboard shortcut to toggle the sidebar.
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const handleKeyDown = (event) => {
|
|
66
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
67
|
+
event.preventDefault();
|
|
68
|
+
toggleSidebar();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
72
|
+
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
73
|
+
}, [toggleSidebar]);
|
|
74
|
+
// We add a state so that we can do data-state="expanded" or "collapsed".
|
|
75
|
+
// This makes it easier to style the sidebar with Tailwind classes.
|
|
76
|
+
const state = open ? 'expanded' : 'collapsed';
|
|
77
|
+
const contextValue = useMemo(() => ({
|
|
78
|
+
state,
|
|
79
|
+
open,
|
|
80
|
+
setOpen,
|
|
81
|
+
isMobile,
|
|
82
|
+
openMobile,
|
|
83
|
+
setOpenMobile,
|
|
84
|
+
toggleSidebar,
|
|
85
|
+
}), [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]);
|
|
86
|
+
return (_jsx(SidebarContext.Provider, { value: contextValue, children: _jsx(TooltipProvider, { delayDuration: 0, children: _jsx("div", Object.assign({ "data-slot": "sidebar-wrapper", style: Object.assign({ '--sidebar-width': SIDEBAR_WIDTH, '--sidebar-width-icon': SIDEBAR_WIDTH_ICON }, style), className: mergeClassNames('group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full', className) }, props, { children: children })) }) }));
|
|
87
|
+
}
|
|
88
|
+
function Sidebar(params) {
|
|
89
|
+
const { side = 'left', variant = 'sidebar', collapsible = 'offcanvas', className, children, dir } = params, props = __rest(params, ["side", "variant", "collapsible", "className", "children", "dir"]);
|
|
90
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
91
|
+
if (collapsible === 'none') {
|
|
92
|
+
return (_jsx("div", Object.assign({ "data-slot": "sidebar", className: mergeClassNames('bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col', className) }, props, { children: children })));
|
|
93
|
+
}
|
|
94
|
+
if (isMobile) {
|
|
95
|
+
return (_jsx(Sheet, Object.assign({ open: openMobile, onOpenChange: setOpenMobile }, props, { children: _jsxs(SheetContent, { dir: dir, "data-sidebar": "sidebar", "data-slot": "sidebar", "data-mobile": "true", className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden", style: {
|
|
96
|
+
'--sidebar-width': SIDEBAR_WIDTH_MOBILE,
|
|
97
|
+
}, side: side, children: [_jsxs(SheetHeader, { className: "sr-only", children: [_jsx(SheetTitle, { children: "Sidebar" }), _jsx(SheetDescription, { children: "Displays the mobile sidebar." })] }), _jsx("div", { className: "flex h-full w-full flex-col", children: children })] }) })));
|
|
98
|
+
}
|
|
99
|
+
return (_jsxs("div", { className: "group peer text-sidebar-foreground hidden md:block", "data-state": state, "data-collapsible": state === 'collapsed' ? collapsible : '', "data-variant": variant, "data-side": side, "data-slot": "sidebar", children: [_jsx("div", { "data-slot": "sidebar-gap", className: mergeClassNames('transition-[width] duration-200 ease-linear relative w-(--sidebar-width) bg-transparent', 'group-data-[collapsible=offcanvas]:w-0', 'group-data-[side=right]:rotate-180', variant === 'floating' || variant === 'inset'
|
|
100
|
+
? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]'
|
|
101
|
+
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)') }), _jsx("div", Object.assign({ "data-slot": "sidebar-container", "data-side": side, className: mergeClassNames('fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex',
|
|
102
|
+
// Adjust the padding for floating and inset variants.
|
|
103
|
+
variant === 'floating' || variant === 'inset'
|
|
104
|
+
? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
|
|
105
|
+
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l', className) }, props, { children: _jsx("div", { "data-sidebar": "sidebar", "data-slot": "sidebar-inner", className: "bg-sidebar group-data-[variant=floating]:ring-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 flex size-full flex-col", children: children }) }))] }));
|
|
106
|
+
}
|
|
107
|
+
function SidebarTrigger(params) {
|
|
108
|
+
const { className, onClick } = params, props = __rest(params, ["className", "onClick"]);
|
|
109
|
+
const { toggleSidebar } = useSidebar();
|
|
110
|
+
return (_jsxs(Button, Object.assign({ "data-sidebar": "trigger", "data-slot": "sidebar-trigger", variant: "ghost", size: "icon-sm", className: mergeClassNames(className), onClick: (event) => {
|
|
111
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
112
|
+
toggleSidebar();
|
|
113
|
+
} }, props, { children: [_jsx(PanelLeftIcon, {}), _jsx("span", { className: "sr-only", children: "Toggle Sidebar" })] })));
|
|
114
|
+
}
|
|
115
|
+
function SidebarRail(params) {
|
|
116
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
117
|
+
const { toggleSidebar } = useSidebar();
|
|
118
|
+
return (_jsx("button", Object.assign({ "data-sidebar": "rail", "data-slot": "sidebar-rail", "aria-label": "Toggle Sidebar", tabIndex: -1, onClick: toggleSidebar, title: "Toggle Sidebar", className: mergeClassNames('hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2', 'in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize', '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize', 'hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full', '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2', '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2', className) }, props)));
|
|
119
|
+
}
|
|
120
|
+
function SidebarInset(params) {
|
|
121
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
122
|
+
return (_jsx("main", Object.assign({ "data-slot": "sidebar-inset", className: mergeClassNames('bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 relative flex w-full flex-1 flex-col', className) }, props)));
|
|
123
|
+
}
|
|
124
|
+
function SidebarInput(params) {
|
|
125
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
126
|
+
return (_jsx(Input, Object.assign({ "data-slot": "sidebar-input", "data-sidebar": "input", className: mergeClassNames('bg-background h-8 w-full shadow-none', className) }, props)));
|
|
127
|
+
}
|
|
128
|
+
function SidebarHeader(params) {
|
|
129
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
130
|
+
return (_jsx("div", Object.assign({ "data-slot": "sidebar-header", "data-sidebar": "header", className: mergeClassNames('gap-2 p-2 flex flex-col', className) }, props)));
|
|
131
|
+
}
|
|
132
|
+
function SidebarFooter(params) {
|
|
133
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
134
|
+
return (_jsx("div", Object.assign({ "data-slot": "sidebar-footer", "data-sidebar": "footer", className: mergeClassNames('gap-2 p-2 flex flex-col', className) }, props)));
|
|
135
|
+
}
|
|
136
|
+
function SidebarSeparator(params) {
|
|
137
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
138
|
+
return (_jsx(Separator, Object.assign({ "data-slot": "sidebar-separator", "data-sidebar": "separator", className: mergeClassNames('bg-sidebar-border mx-2 w-auto', className) }, props)));
|
|
139
|
+
}
|
|
140
|
+
function SidebarContent(params) {
|
|
141
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
142
|
+
return (_jsx("div", Object.assign({ "data-slot": "sidebar-content", "data-sidebar": "content", className: mergeClassNames('no-scrollbar gap-2 flex min-h-0 flex-1 flex-col overflow-auto group-data-[collapsible=icon]:overflow-hidden', className) }, props)));
|
|
143
|
+
}
|
|
144
|
+
function SidebarGroup(params) {
|
|
145
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
146
|
+
return (_jsx("div", Object.assign({ "data-slot": "sidebar-group", "data-sidebar": "group", className: mergeClassNames('p-2 relative flex w-full min-w-0 flex-col', className) }, props)));
|
|
147
|
+
}
|
|
148
|
+
function SidebarGroupLabel(params) {
|
|
149
|
+
const { className, asChild = false } = params, props = __rest(params, ["className", "asChild"]);
|
|
150
|
+
const Comp = asChild ? Slot.Root : 'div';
|
|
151
|
+
return (_jsx(Comp, Object.assign({ "data-slot": "sidebar-group-label", "data-sidebar": "group-label", className: mergeClassNames('text-sidebar-foreground/70 ring-sidebar-ring h-8 rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 flex shrink-0 items-center outline-hidden [&>svg]:shrink-0', className) }, props)));
|
|
152
|
+
}
|
|
153
|
+
function SidebarGroupAction(params) {
|
|
154
|
+
const { className, asChild = false } = params, props = __rest(params, ["className", "asChild"]);
|
|
155
|
+
const Comp = asChild ? Slot.Root : 'button';
|
|
156
|
+
return (_jsx(Comp, Object.assign({ "data-slot": "sidebar-group-action", "data-sidebar": "group-action", className: mergeClassNames('text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 w-5 rounded-md p-0 focus-visible:ring-2 [&>svg]:size-4 flex aspect-square items-center justify-center outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 md:after:hidden [&>svg]:shrink-0', className) }, props)));
|
|
157
|
+
}
|
|
158
|
+
function SidebarGroupContent(params) {
|
|
159
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
160
|
+
return (_jsx("div", Object.assign({ "data-slot": "sidebar-group-content", "data-sidebar": "group-content", className: mergeClassNames('text-sm w-full', className) }, props)));
|
|
161
|
+
}
|
|
162
|
+
function SidebarMenu(params) {
|
|
163
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
164
|
+
return (_jsx("ul", Object.assign({ "data-slot": "sidebar-menu", "data-sidebar": "menu", className: mergeClassNames('gap-1 flex w-full min-w-0 flex-col', className) }, props)));
|
|
165
|
+
}
|
|
166
|
+
function SidebarMenuItem(params) {
|
|
167
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
168
|
+
return (_jsx("li", Object.assign({ "data-slot": "sidebar-menu-item", "data-sidebar": "menu-item", className: mergeClassNames('group/menu-item relative', className) }, props)));
|
|
169
|
+
}
|
|
170
|
+
const sidebarMenuButtonVariants = cva('ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground gap-2 rounded-md p-2 text-left text-sm transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 data-active:font-medium peer/menu-button flex w-full items-center overflow-hidden outline-hidden group/menu-button disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&_svg]:size-4 [&_svg]:shrink-0', {
|
|
171
|
+
variants: {
|
|
172
|
+
variant: {
|
|
173
|
+
default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
|
174
|
+
outline: 'bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]',
|
|
175
|
+
},
|
|
176
|
+
size: {
|
|
177
|
+
default: 'h-8 text-sm',
|
|
178
|
+
sm: 'h-7 text-xs',
|
|
179
|
+
lg: 'h-12 text-sm group-data-[collapsible=icon]:p-0!',
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
defaultVariants: {
|
|
183
|
+
variant: 'default',
|
|
184
|
+
size: 'default',
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
function SidebarMenuButton(params) {
|
|
188
|
+
const { asChild = false, isActive = false, variant = 'default', size = 'default', tooltip: tooltipProp, className } = params, props = __rest(params, ["asChild", "isActive", "variant", "size", "tooltip", "className"]);
|
|
189
|
+
const Comp = asChild ? Slot.Root : 'button';
|
|
190
|
+
const { isMobile, state } = useSidebar();
|
|
191
|
+
const button = (_jsx(Comp, Object.assign({ "data-slot": "sidebar-menu-button", "data-sidebar": "menu-button", "data-size": size, "data-active": isActive, className: mergeClassNames(sidebarMenuButtonVariants({ variant, size }), className) }, props)));
|
|
192
|
+
if (!tooltipProp) {
|
|
193
|
+
return button;
|
|
194
|
+
}
|
|
195
|
+
const tooltip = typeof tooltipProp === 'string' ? { children: tooltipProp } : tooltipProp;
|
|
196
|
+
return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: button }), _jsx(TooltipContent, Object.assign({ side: "right", align: "center", hidden: state !== 'collapsed' || isMobile }, tooltip))] }));
|
|
197
|
+
}
|
|
198
|
+
function SidebarMenuAction(params) {
|
|
199
|
+
const { className, asChild = false, showOnHover = false } = params, props = __rest(params, ["className", "asChild", "showOnHover"]);
|
|
200
|
+
const Comp = asChild ? Slot.Root : 'button';
|
|
201
|
+
return (_jsx(Comp, Object.assign({ "data-slot": "sidebar-menu-action", "data-sidebar": "menu-action", className: mergeClassNames('text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 aspect-square w-5 rounded-md p-0 peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 focus-visible:ring-2 [&>svg]:size-4 flex items-center justify-center outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 md:after:hidden [&>svg]:shrink-0', showOnHover &&
|
|
202
|
+
'peer-data-active/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-open:opacity-100 md:opacity-0', className) }, props)));
|
|
203
|
+
}
|
|
204
|
+
function SidebarMenuBadge(params) {
|
|
205
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
206
|
+
return (_jsx("div", Object.assign({ "data-slot": "sidebar-menu-badge", "data-sidebar": "menu-badge", className: mergeClassNames('text-sidebar-foreground peer-hover/menu-button:text-sidebar-accent-foreground peer-data-active/menu-button:text-sidebar-accent-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 rounded-md px-1 text-xs font-medium peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 flex items-center justify-center tabular-nums select-none group-data-[collapsible=icon]:hidden', className) }, props)));
|
|
207
|
+
}
|
|
208
|
+
function SidebarMenuSkeleton(params) {
|
|
209
|
+
const { className, showIcon = false } = params, props = __rest(params
|
|
210
|
+
// Random width between 50 to 90%.
|
|
211
|
+
, ["className", "showIcon"]);
|
|
212
|
+
// Random width between 50 to 90%.
|
|
213
|
+
const [width] = useState(() => {
|
|
214
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
215
|
+
});
|
|
216
|
+
return (_jsxs("div", Object.assign({ "data-slot": "sidebar-menu-skeleton", "data-sidebar": "menu-skeleton", className: mergeClassNames('h-8 gap-2 rounded-md px-2 flex items-center', className) }, props, { children: [showIcon && _jsx(Skeleton, { className: "size-4 rounded-md", "data-sidebar": "menu-skeleton-icon" }), _jsx(Skeleton, { className: "h-4 max-w-(--skeleton-width) flex-1", "data-sidebar": "menu-skeleton-text", style: {
|
|
217
|
+
'--skeleton-width': width,
|
|
218
|
+
} })] })));
|
|
219
|
+
}
|
|
220
|
+
function SidebarMenuSub(params) {
|
|
221
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
222
|
+
return (_jsx("ul", Object.assign({ "data-slot": "sidebar-menu-sub", "data-sidebar": "menu-sub", className: mergeClassNames('border-sidebar-border mx-3.5 translate-x-px gap-1 border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden flex min-w-0 flex-col', className) }, props)));
|
|
223
|
+
}
|
|
224
|
+
function SidebarMenuSubItem(params) {
|
|
225
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
226
|
+
return (_jsx("li", Object.assign({ "data-slot": "sidebar-menu-sub-item", "data-sidebar": "menu-sub-item", className: mergeClassNames('group/menu-sub-item relative', className) }, props)));
|
|
227
|
+
}
|
|
228
|
+
function SidebarMenuSubButton(params) {
|
|
229
|
+
const { asChild = false, size = 'md', isActive = false, className } = params, props = __rest(params, ["asChild", "size", "isActive", "className"]);
|
|
230
|
+
const Comp = asChild ? Slot.Root : 'a';
|
|
231
|
+
return (_jsx(Comp, Object.assign({ "data-slot": "sidebar-menu-sub-button", "data-sidebar": "menu-sub-button", "data-size": size, "data-active": isActive, className: mergeClassNames('text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground h-7 gap-2 rounded-md px-2 focus-visible:ring-2 data-[size=md]:text-sm data-[size=sm]:text-xs [&>svg]:size-4 flex min-w-0 -translate-x-px items-center overflow-hidden outline-hidden group-data-[collapsible=icon]:hidden disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:shrink-0', className) }, props)));
|
|
232
|
+
}
|
|
233
|
+
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar, };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
declare function Skeleton(params: React.ComponentProps<'div'>): import("react").JSX.Element;
|
|
2
|
+
export { Skeleton };
|
|
3
3
|
//# sourceMappingURL=skeleton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../source/components/skeleton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../source/components/skeleton.tsx"],"names":[],"mappings":"AAEA,iBAAS,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,+BAGpD;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -11,7 +11,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { mergeClassNames } from '../utils/merge-class-names/index.js';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return _jsx("div", Object.assign({ className: mergeClassNames('
|
|
14
|
+
function Skeleton(params) {
|
|
15
|
+
const { className } = params, props = __rest(params, ["className"]);
|
|
16
|
+
return _jsx("div", Object.assign({ "data-slot": "skeleton", className: mergeClassNames('bg-muted rounded-md animate-pulse', className) }, props));
|
|
17
17
|
}
|
|
18
|
+
export { Skeleton };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { ToggleGroup as ToggleGroupPrimitive } from 'radix-ui';
|
|
4
|
+
import { toggleVariants } from './toggle.js';
|
|
5
|
+
type ToggleGroupParams = {
|
|
6
|
+
spacing?: number;
|
|
7
|
+
orientation?: 'horizontal' | 'vertical';
|
|
8
|
+
};
|
|
9
|
+
declare function ToggleGroup(params: React.ComponentProps<typeof ToggleGroupPrimitive.Root> & VariantProps<typeof toggleVariants> & ToggleGroupParams): React.JSX.Element;
|
|
10
|
+
declare function ToggleGroupItem(params: React.ComponentProps<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>): React.JSX.Element;
|
|
11
|
+
export { ToggleGroup, ToggleGroupItem };
|
|
12
|
+
//# sourceMappingURL=toggle-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle-group.d.ts","sourceRoot":"","sources":["../../source/components/toggle-group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAG9D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;CACxC,CAAA;AAcD,iBAAS,WAAW,CAClB,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,GAC5D,YAAY,CAAC,OAAO,cAAc,CAAC,GACnC,iBAAiB,qBAsBpB;AAED,iBAAS,eAAe,CACtB,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,qBAwBrG;AAED,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { useContext } from 'react';
|
|
15
|
+
import {} from 'class-variance-authority';
|
|
16
|
+
import { ToggleGroup as ToggleGroupPrimitive } from 'radix-ui';
|
|
17
|
+
import { mergeClassNames } from '../utils/merge-class-names/index.js';
|
|
18
|
+
import { toggleVariants } from './toggle.js';
|
|
19
|
+
const ToggleGroupContext = React.createContext({
|
|
20
|
+
size: 'default',
|
|
21
|
+
variant: 'default',
|
|
22
|
+
spacing: 0,
|
|
23
|
+
orientation: 'horizontal',
|
|
24
|
+
});
|
|
25
|
+
function ToggleGroup(params) {
|
|
26
|
+
const { className, variant, size, spacing = 0, orientation = 'horizontal', children } = params, props = __rest(params, ["className", "variant", "size", "spacing", "orientation", "children"]);
|
|
27
|
+
return (_jsx(ToggleGroupPrimitive.Root, Object.assign({ "data-slot": "toggle-group", "data-variant": variant, "data-size": size, "data-spacing": spacing, "data-orientation": orientation, style: { '--gap': spacing }, className: mergeClassNames('rounded-md data-[spacing=0]:data-[variant=outline]:shadow-xs group/toggle-group flex w-fit flex-row items-center gap-(--spacing(var(--gap))) data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch', className) }, props, { children: _jsx(ToggleGroupContext.Provider, { value: { variant, size, spacing, orientation }, children: children }) })));
|
|
28
|
+
}
|
|
29
|
+
function ToggleGroupItem(params) {
|
|
30
|
+
var _a, _b, _c, _d;
|
|
31
|
+
const { className, children, variant = 'default', size = 'default' } = params, props = __rest(params, ["className", "children", "variant", "size"]);
|
|
32
|
+
const context = useContext(ToggleGroupContext);
|
|
33
|
+
return (_jsx(ToggleGroupPrimitive.Item, Object.assign({ "data-slot": "toggle-group-item", "data-variant": (_a = context.variant) !== null && _a !== void 0 ? _a : variant, "data-size": (_b = context.size) !== null && _b !== void 0 ? _b : size, "data-spacing": context.spacing, className: mergeClassNames('data-[state=on]:bg-muted group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-[spacing=0]/toggle-group:shadow-none group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-md group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-md group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-md shrink-0 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t', toggleVariants({
|
|
34
|
+
variant: (_c = context.variant) !== null && _c !== void 0 ? _c : variant,
|
|
35
|
+
size: (_d = context.size) !== null && _d !== void 0 ? _d : size,
|
|
36
|
+
}), className) }, props, { children: children })));
|
|
37
|
+
}
|
|
38
|
+
export { ToggleGroup, ToggleGroupItem };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { Toggle as TogglePrimitive } from 'radix-ui';
|
|
4
|
+
declare const toggleVariants: (props?: ({
|
|
5
|
+
variant?: "default" | "outline" | null | undefined;
|
|
6
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
declare function Toggle(params: React.ComponentProps<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>): React.JSX.Element;
|
|
9
|
+
export { Toggle, toggleVariants };
|
|
10
|
+
//# sourceMappingURL=toggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../source/components/toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAA;AAIpD,QAAA,MAAM,cAAc;;;8EAmBnB,CAAA;AAED,iBAAS,MAAM,CACb,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,qBAUhG;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { cva } from 'class-variance-authority';
|
|
15
|
+
import { Toggle as TogglePrimitive } from 'radix-ui';
|
|
16
|
+
import { mergeClassNames } from '../utils/merge-class-names/index.js';
|
|
17
|
+
const toggleVariants = cva("hover:text-foreground aria-pressed:bg-muted focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive gap-1 rounded-md text-sm font-medium transition-[color,box-shadow] [&_svg:not([class*='size-'])]:size-4 group/toggle hover:bg-muted inline-flex items-center justify-center whitespace-nowrap outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
18
|
+
variants: {
|
|
19
|
+
variant: {
|
|
20
|
+
default: 'bg-transparent',
|
|
21
|
+
outline: 'border-input hover:bg-muted border bg-transparent shadow-xs',
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
default: 'h-9 min-w-9 px-2',
|
|
25
|
+
sm: 'h-8 min-w-8 px-1.5',
|
|
26
|
+
lg: 'h-10 min-w-10 px-2.5',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
variant: 'default',
|
|
31
|
+
size: 'default',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
function Toggle(params) {
|
|
35
|
+
const { className, variant = 'default', size = 'default' } = params, props = __rest(params, ["className", "variant", "size"]);
|
|
36
|
+
return (_jsx(TogglePrimitive.Root, Object.assign({ "data-slot": "toggle", className: mergeClassNames(toggleVariants({ variant, size, className })) }, props)));
|
|
37
|
+
}
|
|
38
|
+
export { Toggle, toggleVariants };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taicode/common-web",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"author": "Alain",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"description": "",
|
|
@@ -14,10 +14,6 @@
|
|
|
14
14
|
"types": "./output/components/index.d.ts",
|
|
15
15
|
"default": "./output/components/index.js"
|
|
16
16
|
},
|
|
17
|
-
"./vite-config": {
|
|
18
|
-
"types": "./output/vite-config/index.d.ts",
|
|
19
|
-
"default": "./output/vite-config/index.js"
|
|
20
|
-
},
|
|
21
17
|
"./features/*": {
|
|
22
18
|
"types": "./output/features/*/index.d.ts",
|
|
23
19
|
"default": "./output/features/*/index.js"
|
|
@@ -81,9 +77,12 @@
|
|
|
81
77
|
"jsoneditor": "^10.4.2",
|
|
82
78
|
"lucide-react": "^0.468.0",
|
|
83
79
|
"radix-ui": "^1.4.3",
|
|
80
|
+
"react-day-picker": "^9.14.0",
|
|
84
81
|
"react-hook-form": "^7.71.2",
|
|
82
|
+
"recharts": "^2.15.4",
|
|
85
83
|
"sonner": "^1.7.4",
|
|
86
84
|
"tailwind-merge": "^3.5.0",
|
|
85
|
+
"vaul": "^1.1.2",
|
|
87
86
|
"web-vitals": "^5.1.0"
|
|
88
87
|
},
|
|
89
88
|
"devDependencies": {
|