@deftui/react 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vendor/README.md +2 -1
- package/dist/vendor/coss/calendar.mjs +2 -0
- package/dist/vendor/coss/card.d.mts +0 -6
- package/dist/vendor/coss/card.mjs +1 -68
- package/dist/vendor/reui.io/frame.d.mts +22 -0
- package/dist/vendor/reui.io/frame.mjs +106 -0
- package/dist/widgets/datetime.mjs +0 -5
- package/dist/widgets/index.d.mts +9 -8
- package/dist/widgets/index.mjs +9 -8
- package/package.json +1 -1
package/dist/vendor/README.md
CHANGED
|
@@ -12,7 +12,7 @@ shadcn 组件使用 `components.json` 中的 `base-vega` 风格和 Lucide 图标
|
|
|
12
12
|
| ID | File | Docs | Modifications |
|
|
13
13
|
| --- | --- | --- | --- |
|
|
14
14
|
| `@coss/alert-dialog` | [coss/alert-dialog.tsx](coss/alert-dialog.tsx) | [Alert Dialog](https://coss.com/ui/docs/components/alert-dialog) | `font-bold text-xl` 替换为 `font-semibold text-lg`;用 `@starting-style` 支持初始打开时的入场动画 |
|
|
15
|
-
| `@coss/calendar` | [coss/calendar.tsx](coss/calendar.tsx) | [Calendar](https://coss.com/ui/docs/components/calendar) |
|
|
15
|
+
| `@coss/calendar` | [coss/calendar.tsx](coss/calendar.tsx) | [Calendar](https://coss.com/ui/docs/components/calendar) | 根据 `navigator.language` 自动设置 `locale` 为 zhCN 或 enUS |
|
|
16
16
|
| `@coss/card` | [coss/card.tsx](coss/card.tsx) | [Card](https://coss.com/ui/docs/components/card) | 用 `--card-spacing` 与 `--card-gap` 替代分段 padding;新增 `spacing`、`gap` 属性写入对应变量;标题改为 `text-base font-semibold leading-normal`;首尾图片贴边并补圆角 |
|
|
17
17
|
| `@coss/dialog` | [coss/dialog.tsx](coss/dialog.tsx) | [Dialog](https://coss.com/ui/docs/components/dialog) | `font-bold text-xl` 替换为 `font-semibold text-lg`;用 `@starting-style` 支持初始打开时的入场动画 |
|
|
18
18
|
| `@coss/drawer` | [coss/drawer.tsx](coss/drawer.tsx) | [Drawer](https://coss.com/ui/docs/components/drawer) | `font-bold text-xl` 替换为 `font-semibold text-lg`;用 `@starting-style` 支持初始打开时的入场动画 |
|
|
@@ -23,6 +23,7 @@ shadcn 组件使用 `components.json` 中的 `base-vega` 风格和 Lucide 图标
|
|
|
23
23
|
| `@coss/use-copy-to-clipboard` | [coss/hooks/use-copy-to-clipboard.ts](coss/hooks/use-copy-to-clipboard.ts) | [useCopyToClipboard](https://coss.com/ui/docs/hooks/use-copy-to-clipboard) | — |
|
|
24
24
|
| `@coss/use-media-query` | [coss/hooks/use-media-query.ts](coss/hooks/use-media-query.ts) | [useMediaQuery](https://coss.com/ui/docs/hooks/use-media-query) | 断点:`md` 设为 768px,与 Tailwind 默认值一致 |
|
|
25
25
|
| `@reui/cascader` | [reui.io/cascader/cascader.tsx](reui.io/cascader/cascader.tsx) | [Cascader](https://reui.io/docs/components/cascader) | 重映射 `scroll-area` 与 `spinner` 的导入 |
|
|
26
|
+
| `@reui/frame` | [reui.io/frame.tsx](reui.io/frame.tsx) | [Frame](https://reui.io/docs/components/base/frame) | — |
|
|
26
27
|
| `@reui/timeline` | [reui.io/timeline.tsx](reui.io/timeline.tsx) | [Timeline](https://reui.io/docs/components/timeline) | — |
|
|
27
28
|
| `badge` | [shadcn/badge.tsx](shadcn/badge.tsx) | [Badge](https://ui.shadcn.com/docs/components/base/badge) | 提供 `info`、`success`、`warning` 语义变体 |
|
|
28
29
|
| `breadcrumb` | [shadcn/breadcrumb.tsx](shadcn/breadcrumb.tsx) | [Breadcrumb](https://ui.shadcn.com/docs/components/base/breadcrumb) | 未显式指定 `BreadcrumbList` 则自动包裹 |
|
|
@@ -3,6 +3,7 @@ import { cn } from "../shadcn/lib/utils.mjs";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { ChevronLeftIcon, ChevronRightIcon, ChevronsUpDownIcon } from "lucide-react";
|
|
5
5
|
import { DayPicker } from "@daypicker/react";
|
|
6
|
+
import { enUS, zhCN } from "@daypicker/react/locale";
|
|
6
7
|
// src/vendor/coss/calendar.tsx
|
|
7
8
|
const buttonClassNames = "relative flex size-(--cell-size) text-base sm:text-sm items-center justify-center rounded-lg text-foreground not-in-data-selected:hover:bg-accent disabled:pointer-events-none disabled:opacity-64 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0";
|
|
8
9
|
/** https://coss.com/ui/docs/components/calendar */
|
|
@@ -63,6 +64,7 @@ function Calendar({ className, classNames, showOutsideDays = true, components: u
|
|
|
63
64
|
formatters: { formatMonthDropdown: (month, dateLib) => dateLib.format(month, "LLL") },
|
|
64
65
|
mode,
|
|
65
66
|
showOutsideDays,
|
|
67
|
+
locale: navigator.language.startsWith("zh") ? zhCN : enUS,
|
|
66
68
|
...props
|
|
67
69
|
};
|
|
68
70
|
return /* @__PURE__ */ jsx(DayPicker, { ...dayPickerProps });
|
|
@@ -8,12 +8,6 @@ type SpacingProps = {
|
|
|
8
8
|
};
|
|
9
9
|
type CardSpacing = number | (string & {});
|
|
10
10
|
export declare function Card({ className, render, gap, spacing, ...props }: useRender.ComponentProps<"div"> & SpacingProps): React.ReactElement;
|
|
11
|
-
export declare function CardFrame({ className, render, gap, spacing, ...props }: useRender.ComponentProps<"div"> & SpacingProps): React.ReactElement;
|
|
12
|
-
export declare function CardFrameHeader({ className, render, ...props }: useRender.ComponentProps<"div">): React.ReactElement;
|
|
13
|
-
export declare function CardFrameTitle({ className, render, ...props }: useRender.ComponentProps<"div">): React.ReactElement;
|
|
14
|
-
export declare function CardFrameDescription({ className, render, ...props }: useRender.ComponentProps<"div">): React.ReactElement;
|
|
15
|
-
export declare function CardFrameAction({ className, render, ...props }: useRender.ComponentProps<"div">): React.ReactElement;
|
|
16
|
-
export declare function CardFrameFooter({ className, render, ...props }: useRender.ComponentProps<"div">): React.ReactElement;
|
|
17
11
|
export declare function CardHeader({ className, render, ...props }: useRender.ComponentProps<"div">): React.ReactElement;
|
|
18
12
|
export declare function CardTitle({ className, render, ...props }: useRender.ComponentProps<"div">): React.ReactElement;
|
|
19
13
|
export declare function CardDescription({ className, render, ...props }: useRender.ComponentProps<"div">): React.ReactElement;
|
|
@@ -24,73 +24,6 @@ function Card({ className, render, gap, spacing, ...props }) {
|
|
|
24
24
|
render
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
function CardFrame({ className, render, gap, spacing, ...props }) {
|
|
28
|
-
const defaultProps = {
|
|
29
|
-
className: cn("relative flex flex-col rounded-2xl border bg-card not-dark:bg-clip-padding text-card-foreground shadow-xs/5 [--clip-bottom:-1rem] [--clip-top:-1rem] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:bg-muted/72 before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=table-container]:overflow-hidden *:data-[slot=card]:-m-px *:data-[slot=table-container]:-m-px *:data-[slot=table-container]:w-[calc(100%+2px)] *:not-first:data-[slot=card]:rounded-t-xl *:not-last:data-[slot=card]:rounded-b-xl *:data-[slot=card]:bg-clip-padding *:data-[slot=card]:shadow-none *:data-[slot=card]:before:hidden *:not-first:data-[slot=card]:before:rounded-t-[calc(var(--radius-xl)-1px)] *:not-last:data-[slot=card]:before:rounded-b-[calc(var(--radius-xl)-1px)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)] *:data-[slot=card]:[clip-path:inset(var(--clip-top)_1px_var(--clip-bottom)_1px_round_calc(var(--radius-2xl)-1px))] *:data-[slot=card]:last:[--clip-bottom:1px] *:data-[slot=card]:first:[--clip-top:1px]", className),
|
|
30
|
-
"data-slot": "card-frame",
|
|
31
|
-
style: getCardStyle(spacing, gap)
|
|
32
|
-
};
|
|
33
|
-
return useRender({
|
|
34
|
-
defaultTagName: "div",
|
|
35
|
-
props: mergeProps(defaultProps, props),
|
|
36
|
-
render
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function CardFrameHeader({ className, render, ...props }) {
|
|
40
|
-
const defaultProps = {
|
|
41
|
-
className: cn("relative flex grid auto-rows-min grid-rows-[auto_auto] flex-col items-start gap-x-4 px-(--card-spacing) py-(--card-gap) has-data-[slot=card-frame-action]:grid-cols-[1fr_auto]", className),
|
|
42
|
-
"data-slot": "card-frame-header"
|
|
43
|
-
};
|
|
44
|
-
return useRender({
|
|
45
|
-
defaultTagName: "div",
|
|
46
|
-
props: mergeProps(defaultProps, props),
|
|
47
|
-
render
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function CardFrameTitle({ className, render, ...props }) {
|
|
51
|
-
const defaultProps = {
|
|
52
|
-
className: cn("self-center font-semibold text-sm", className),
|
|
53
|
-
"data-slot": "card-frame-title"
|
|
54
|
-
};
|
|
55
|
-
return useRender({
|
|
56
|
-
defaultTagName: "div",
|
|
57
|
-
props: mergeProps(defaultProps, props),
|
|
58
|
-
render
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
function CardFrameDescription({ className, render, ...props }) {
|
|
62
|
-
const defaultProps = {
|
|
63
|
-
className: cn("self-center text-muted-foreground text-sm", className),
|
|
64
|
-
"data-slot": "card-frame-description"
|
|
65
|
-
};
|
|
66
|
-
return useRender({
|
|
67
|
-
defaultTagName: "div",
|
|
68
|
-
props: mergeProps(defaultProps, props),
|
|
69
|
-
render
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
function CardFrameAction({ className, render, ...props }) {
|
|
73
|
-
const defaultProps = {
|
|
74
|
-
className: cn("col-start-2 nth-3:row-span-2 nth-3:row-start-1 inline-flex self-center justify-self-end", className),
|
|
75
|
-
"data-slot": "card-frame-action"
|
|
76
|
-
};
|
|
77
|
-
return useRender({
|
|
78
|
-
defaultTagName: "div",
|
|
79
|
-
props: mergeProps(defaultProps, props),
|
|
80
|
-
render
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
function CardFrameFooter({ className, render, ...props }) {
|
|
84
|
-
const defaultProps = {
|
|
85
|
-
className: cn("px-(--card-spacing) py-(--card-gap)", className),
|
|
86
|
-
"data-slot": "card-frame-footer"
|
|
87
|
-
};
|
|
88
|
-
return useRender({
|
|
89
|
-
defaultTagName: "div",
|
|
90
|
-
props: mergeProps(defaultProps, props),
|
|
91
|
-
render
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
27
|
function CardHeader({ className, render, ...props }) {
|
|
95
28
|
const defaultProps = {
|
|
96
29
|
className: cn("grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-(--card-spacing) [.border-b]:pb-(--card-gap) has-data-[slot=card-action]:grid-cols-[1fr_auto]", className),
|
|
@@ -157,4 +90,4 @@ function CardFooter({ className, render, ...props }) {
|
|
|
157
90
|
render
|
|
158
91
|
});
|
|
159
92
|
}
|
|
160
|
-
export { Card, CardAction, CardPanel as CardContent, CardPanel, CardDescription, CardFooter,
|
|
93
|
+
export { Card, CardAction, CardPanel as CardContent, CardPanel, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
/**
|
|
3
|
+
* Frame sets --frame-panel-bg and --frame-panel-border-color; FramePanel reads
|
|
4
|
+
* them back as bg-(--frame-panel-bg) and border-(--frame-panel-border-color).
|
|
5
|
+
* So variant="inverse" re-points every panel from one place, and a consumer's
|
|
6
|
+
* own bg-* on a panel still wins on source order, with no :not() and no `!`.
|
|
7
|
+
*/
|
|
8
|
+
declare const frameVariants: (props?: ({
|
|
9
|
+
variant?: "default" | "ghost" | "inverse" | null | undefined;
|
|
10
|
+
spacing?: "default" | "lg" | "sm" | "xs" | null | undefined;
|
|
11
|
+
stacked?: boolean | null | undefined;
|
|
12
|
+
dense?: boolean | null | undefined;
|
|
13
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
14
|
+
declare function Frame({ className, variant, spacing, stacked, dense, ...props }: React.ComponentProps<"div"> & VariantProps<typeof frameVariants>): import("react").JSX.Element;
|
|
15
|
+
declare function FramePanel({ className, fit, ...props }: React.ComponentProps<"div"> & {
|
|
16
|
+
fit?: boolean;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
declare function FrameHeader({ className, ...props }: React.ComponentProps<"header">): import("react").JSX.Element;
|
|
19
|
+
declare function FrameTitle({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
20
|
+
declare function FrameDescription({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
21
|
+
declare function FrameFooter({ className, ...props }: React.ComponentProps<"footer">): import("react").JSX.Element;
|
|
22
|
+
export { Frame, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle, frameVariants };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { cn } from "cn";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/vendor/reui.io/frame.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Frame sets --frame-panel-bg and --frame-panel-border-color; FramePanel reads
|
|
7
|
+
* them back as bg-(--frame-panel-bg) and border-(--frame-panel-border-color).
|
|
8
|
+
* So variant="inverse" re-points every panel from one place, and a consumer's
|
|
9
|
+
* own bg-* on a panel still wins on source order, with no :not() and no `!`.
|
|
10
|
+
*/
|
|
11
|
+
const frameVariants = cva([
|
|
12
|
+
"relative flex flex-col bg-muted/50 gap-(--frame-gap) px-(--frame-px) py-(--frame-py) rounded-(--frame-radius)",
|
|
13
|
+
"[--frame-radius:var(--radius-xl)]",
|
|
14
|
+
"[--frame-gap:--spacing(0.75)] [--frame-px:--spacing(0.75)] [--frame-py:--spacing(0.75)] [--frame-panel-header-gap:0rem] [--frame-panel-footer-gap:--spacing(1)]",
|
|
15
|
+
"[--frame-panel-px-adjust:0px] [--frame-panel-py-adjust:0px] [--frame-panel-header-px-adjust:0px] [--frame-panel-header-py-adjust:0px] [--frame-panel-footer-px-adjust:0px] [--frame-panel-footer-py-adjust:0px]",
|
|
16
|
+
"[--frame-panel-px:calc(var(--frame-panel-px-base)+var(--frame-panel-px-adjust))] [--frame-panel-py:calc(var(--frame-panel-py-base)+var(--frame-panel-py-adjust))] [--frame-panel-header-px:calc(var(--frame-panel-header-px-base)+var(--frame-panel-header-px-adjust))] [--frame-panel-header-py:calc(var(--frame-panel-header-py-base)+var(--frame-panel-header-py-adjust))] [--frame-panel-footer-px:calc(var(--frame-panel-footer-px-base)+var(--frame-panel-footer-px-adjust))] [--frame-panel-footer-py:calc(var(--frame-panel-footer-py-base)+var(--frame-panel-footer-py-adjust))]",
|
|
17
|
+
"",
|
|
18
|
+
"[--frame-panel-bg:var(--color-card)] [--frame-panel-border-color:var(--color-border)] [--frame-border-color:var(--color-border)]",
|
|
19
|
+
"[--frame-panel-radius:calc(var(--frame-radius)-var(--frame-px)-1px)]"
|
|
20
|
+
], {
|
|
21
|
+
variants: {
|
|
22
|
+
variant: {
|
|
23
|
+
default: "border border-[var(--frame-border-color)] bg-clip-padding",
|
|
24
|
+
inverse: "[--frame-panel-bg:color-mix(in_oklch,var(--color-muted)_40%,transparent)] border border-[var(--frame-border-color)] bg-background bg-clip-padding",
|
|
25
|
+
ghost: "[--frame-panel-radius:calc(var(--frame-radius)-var(--frame-px))]"
|
|
26
|
+
},
|
|
27
|
+
spacing: {
|
|
28
|
+
xs: "[--frame-panel-px-base:--spacing(2)] [--frame-panel-py-base:--spacing(2)] [--frame-panel-header-px-base:--spacing(2)] [--frame-panel-header-py-base:--spacing(0.5)] [--frame-panel-footer-px-base:--spacing(2)] [--frame-panel-footer-py-base:--spacing(0.5)]",
|
|
29
|
+
sm: "[--frame-panel-px-base:--spacing(3)] [--frame-panel-py-base:--spacing(3.5)] [--frame-panel-header-px-base:--spacing(3)] [--frame-panel-header-py-base:--spacing(1.5)] [--frame-panel-footer-px-base:--spacing(3)] [--frame-panel-footer-py-base:--spacing(1.5)]",
|
|
30
|
+
default: "[--frame-panel-px-base:--spacing(4)] [--frame-panel-py-base:--spacing(4)] [--frame-panel-header-px-base:--spacing(4)] [--frame-panel-header-py-base:--spacing(2)] [--frame-panel-footer-px-base:--spacing(4)] [--frame-panel-footer-py-base:--spacing(2)]",
|
|
31
|
+
lg: "[--frame-panel-px-base:--spacing(5)] [--frame-panel-py-base:--spacing(5)] [--frame-panel-header-px-base:--spacing(5)] [--frame-panel-header-py-base:--spacing(2.5)] [--frame-panel-footer-px-base:--spacing(5)] [--frame-panel-footer-py-base:--spacing(2.5)]"
|
|
32
|
+
},
|
|
33
|
+
stacked: {
|
|
34
|
+
true: [
|
|
35
|
+
"gap-0 *:has-[+[data-slot=frame-panel]]:rounded-b-none",
|
|
36
|
+
"*:has-[+[data-slot=frame-panel]]:before:hidden",
|
|
37
|
+
"*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:rounded-t-none",
|
|
38
|
+
"*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:border-t-0"
|
|
39
|
+
],
|
|
40
|
+
false: [
|
|
41
|
+
"data-[spacing=sm]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-0.5",
|
|
42
|
+
"data-[spacing=default]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-1",
|
|
43
|
+
"data-[spacing=lg]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-2"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
dense: {
|
|
47
|
+
true: "p-0 gap-0 border-[var(--frame-border-color)] [--frame-panel-radius:var(--frame-radius)] [&_[data-slot=frame-panel]]:-mx-px [&_[data-slot=frame-panel]]:before:hidden [&_[data-slot=frame-panel]:last-child]:-mb-px [&:not(:has([data-slot=frame-panel-header]))_[data-slot=frame-panel]:is(:first-child)]:-mt-px",
|
|
48
|
+
false: ""
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
defaultVariants: {
|
|
52
|
+
variant: "default",
|
|
53
|
+
spacing: "default",
|
|
54
|
+
stacked: false,
|
|
55
|
+
dense: false
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
function Frame({ className, variant, spacing, stacked, dense, ...props }) {
|
|
59
|
+
return /* @__PURE__ */ jsx("div", {
|
|
60
|
+
className: cn(frameVariants({
|
|
61
|
+
variant,
|
|
62
|
+
spacing,
|
|
63
|
+
stacked,
|
|
64
|
+
dense
|
|
65
|
+
}), className),
|
|
66
|
+
"data-slot": "frame",
|
|
67
|
+
"data-spacing": spacing,
|
|
68
|
+
...props
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function FramePanel({ className, fit, ...props }) {
|
|
72
|
+
return /* @__PURE__ */ jsx("div", {
|
|
73
|
+
className: cn("relative overflow-hidden rounded-(--frame-panel-radius) border border-(--frame-panel-border-color) bg-(--frame-panel-bg) bg-clip-padding shadow-xs", !fit && "grow", "before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--frame-panel-radius)-1px)] before:shadow-black/5", "dark:bg-clip-border dark:before:shadow-white/5", "px-(--frame-panel-px) py-(--frame-panel-py)", className),
|
|
74
|
+
"data-slot": "frame-panel",
|
|
75
|
+
...props
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function FrameHeader({ className, ...props }) {
|
|
79
|
+
return /* @__PURE__ */ jsx("header", {
|
|
80
|
+
className: cn("flex flex-col gap-(--frame-panel-header-gap) px-(--frame-panel-header-px) py-(--frame-panel-header-py)", className),
|
|
81
|
+
"data-slot": "frame-panel-header",
|
|
82
|
+
...props
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function FrameTitle({ className, ...props }) {
|
|
86
|
+
return /* @__PURE__ */ jsx("div", {
|
|
87
|
+
className: cn("text-sm font-semibold", className),
|
|
88
|
+
"data-slot": "frame-panel-title",
|
|
89
|
+
...props
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function FrameDescription({ className, ...props }) {
|
|
93
|
+
return /* @__PURE__ */ jsx("div", {
|
|
94
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
95
|
+
"data-slot": "frame-panel-description",
|
|
96
|
+
...props
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function FrameFooter({ className, ...props }) {
|
|
100
|
+
return /* @__PURE__ */ jsx("footer", {
|
|
101
|
+
className: cn("flex flex-col gap-(--frame-panel-footer-gap) px-(--frame-panel-footer-px) py-(--frame-panel-footer-py)", className),
|
|
102
|
+
"data-slot": "frame-panel-footer",
|
|
103
|
+
...props
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
export { Frame, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle, frameVariants };
|
|
@@ -6,7 +6,6 @@ import { cn } from "cn";
|
|
|
6
6
|
import { useState } from "react";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { CalendarIcon } from "lucide-react";
|
|
9
|
-
import { enUS, zhCN } from "@daypicker/react/locale";
|
|
10
9
|
import { format } from "date-fns";
|
|
11
10
|
// src/widgets/datetime.tsx
|
|
12
11
|
function TimePicker({ className, step = "1", ...props }) {
|
|
@@ -19,7 +18,6 @@ function TimePicker({ className, step = "1", ...props }) {
|
|
|
19
18
|
}
|
|
20
19
|
function DatePicker({ value, defaultValue = null, placeholder = "请选择日期", disabled, onChange, className, calendarProps, ...props }) {
|
|
21
20
|
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
22
|
-
const locale = navigator.language.startsWith("zh") ? zhCN : enUS;
|
|
23
21
|
const date = value === void 0 ? internalValue : value;
|
|
24
22
|
function handleSelect(selected) {
|
|
25
23
|
const nextValue = selected ?? null;
|
|
@@ -36,7 +34,6 @@ function DatePicker({ value, defaultValue = null, placeholder = "请选择日期
|
|
|
36
34
|
}),
|
|
37
35
|
children: [/* @__PURE__ */ jsx(CalendarIcon, { "aria-hidden": "true" }), date ? format(date, "PPP") : placeholder]
|
|
38
36
|
}), /* @__PURE__ */ jsx(PopoverContent, { children: /* @__PURE__ */ jsx(Calendar, {
|
|
39
|
-
locale,
|
|
40
37
|
defaultMonth: date ?? void 0,
|
|
41
38
|
...calendarProps,
|
|
42
39
|
disabled: disabled || calendarProps?.disabled,
|
|
@@ -47,7 +44,6 @@ function DatePicker({ value, defaultValue = null, placeholder = "请选择日期
|
|
|
47
44
|
}
|
|
48
45
|
function DateRangePicker({ value, defaultValue = null, placeholder = "请选择日期范围", disabled, onChange, className, calendarProps, ...props }) {
|
|
49
46
|
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
50
|
-
const locale = navigator.language.startsWith("zh") ? zhCN : enUS;
|
|
51
47
|
const date = value === void 0 ? internalValue : value;
|
|
52
48
|
function handleSelect(selected) {
|
|
53
49
|
const nextValue = selected ?? null;
|
|
@@ -68,7 +64,6 @@ function DateRangePicker({ value, defaultValue = null, placeholder = "请选择
|
|
|
68
64
|
date?.to && /* @__PURE__ */ jsxs(Fragment, { children: [" - ", format(date.to, "LLL dd, y")] })
|
|
69
65
|
]
|
|
70
66
|
}), /* @__PURE__ */ jsx(PopoverContent, { children: /* @__PURE__ */ jsx(Calendar, {
|
|
71
|
-
locale,
|
|
72
67
|
defaultMonth: date?.from,
|
|
73
68
|
...calendarProps,
|
|
74
69
|
disabled: disabled || calendarProps?.disabled,
|
package/dist/widgets/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AlertDialogClose, AlertDialogContent as AlertDialogPopup, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogPrimitive, AlertDialogTitle, AlertDialogTrigger } from "../vendor/coss/alert-dialog.mjs";
|
|
2
|
-
import { Card as Card$1, CardAction, CardContent as CardPanel, CardDescription, CardFooter,
|
|
2
|
+
import { Card as Card$1, CardAction, CardContent as CardPanel, CardDescription, CardFooter, CardHeader, CardTitle } from "../vendor/coss/card.mjs";
|
|
3
3
|
import { DialogClose, DialogContent as DialogPopup, DialogDescription, DialogFooter, DialogHeader, DialogPanel, DialogPrimitive, DialogTitle, DialogTrigger } from "../vendor/coss/dialog.mjs";
|
|
4
4
|
import { Drawer as Drawer$1, DrawerClose, DrawerDescription, DrawerFooter, DrawerHeader, DrawerPanel, DrawerPopup, DrawerTitle, DrawerTrigger } from "../vendor/coss/drawer.mjs";
|
|
5
5
|
import { Empty as Empty$1, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "../vendor/coss/empty.mjs";
|
|
@@ -10,6 +10,7 @@ import { CascaderAction, CascaderFooter, CascaderSubmenu, CascaderSubmenuContent
|
|
|
10
10
|
import { CascaderGroup, CascaderItemProps, CascaderItems, CascaderLabel, CascaderSeparator } from "../vendor/reui.io/cascader/cascader-item.mjs";
|
|
11
11
|
import { CascaderBack, CascaderBreadcrumb, CascaderInput, CascaderNav, CascaderValue } from "../vendor/reui.io/cascader/cascader-nav.mjs";
|
|
12
12
|
import { CascaderVirtualItems } from "../vendor/reui.io/cascader/cascader-virtual.mjs";
|
|
13
|
+
import { Frame as Frame$1, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle } from "../vendor/reui.io/frame.mjs";
|
|
13
14
|
import { Timeline as Timeline$1, TimelineContent, TimelineDate, TimelineHeader, TimelineIndicator, TimelineItem, TimelineSeparator, TimelineTitle } from "../vendor/reui.io/timeline.mjs";
|
|
14
15
|
import { Breadcrumb as Breadcrumb$1, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "../vendor/shadcn/breadcrumb.mjs";
|
|
15
16
|
import { Separator } from "../vendor/shadcn/separator.mjs";
|
|
@@ -68,13 +69,13 @@ export declare const Card: typeof Card$1 & {
|
|
|
68
69
|
Action: typeof CardAction;
|
|
69
70
|
Description: typeof CardDescription;
|
|
70
71
|
};
|
|
71
|
-
/** https://
|
|
72
|
-
export declare const Frame: typeof
|
|
73
|
-
Header: typeof
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
/** https://reui.io/docs/components/base/frame */
|
|
73
|
+
export declare const Frame: typeof Frame$1 & {
|
|
74
|
+
Header: typeof FrameHeader;
|
|
75
|
+
Panel: typeof FramePanel;
|
|
76
|
+
Footer: typeof FrameFooter;
|
|
77
|
+
Title: typeof FrameTitle;
|
|
78
|
+
Description: typeof FrameDescription;
|
|
78
79
|
};
|
|
79
80
|
/** https://ui.shadcn.com/docs/components/base/field */
|
|
80
81
|
export declare const Field: typeof Field$1 & {
|
package/dist/widgets/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AlertDialog as AlertDialog$1, AlertDialogClose, AlertDialogContent as AlertDialogPopup, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "../vendor/coss/alert-dialog.mjs";
|
|
2
|
-
import { Card as Card$1, CardAction, CardContent as CardPanel, CardDescription, CardFooter,
|
|
2
|
+
import { Card as Card$1, CardAction, CardContent as CardPanel, CardDescription, CardFooter, CardHeader, CardTitle } from "../vendor/coss/card.mjs";
|
|
3
3
|
import { Spinner } from "../vendor/shadcn/spinner.mjs";
|
|
4
4
|
import { Button } from "../vendor/shadcn/button.mjs";
|
|
5
5
|
import { ScrollArea } from "../vendor/coss/scroll-area.mjs";
|
|
@@ -12,6 +12,7 @@ import { CascaderAction, CascaderFooter, CascaderSubmenu, CascaderSubmenuContent
|
|
|
12
12
|
import { CascaderGroup, CascaderItem, CascaderItems, CascaderLabel, CascaderSeparator } from "../vendor/reui.io/cascader/cascader-item.mjs";
|
|
13
13
|
import { CascaderBack, CascaderBreadcrumb, CascaderInput, CascaderNav, CascaderValue } from "../vendor/reui.io/cascader/cascader-nav.mjs";
|
|
14
14
|
import { CascaderVirtualItems } from "../vendor/reui.io/cascader/cascader-virtual.mjs";
|
|
15
|
+
import { Frame as Frame$1, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle } from "../vendor/reui.io/frame.mjs";
|
|
15
16
|
import { Timeline as Timeline$1, TimelineContent, TimelineDate, TimelineHeader, TimelineIndicator, TimelineItem, TimelineSeparator, TimelineTitle } from "../vendor/reui.io/timeline.mjs";
|
|
16
17
|
import { Breadcrumb as Breadcrumb$1, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "../vendor/shadcn/breadcrumb.mjs";
|
|
17
18
|
import { Separator } from "../vendor/shadcn/separator.mjs";
|
|
@@ -63,13 +64,13 @@ const Card = /* @__PURE__ */ Object.assign(Card$1, {
|
|
|
63
64
|
Action: CardAction,
|
|
64
65
|
Description: CardDescription
|
|
65
66
|
});
|
|
66
|
-
/** https://
|
|
67
|
-
const Frame = /* @__PURE__ */ Object.assign(
|
|
68
|
-
Header:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
/** https://reui.io/docs/components/base/frame */
|
|
68
|
+
const Frame = /* @__PURE__ */ Object.assign(Frame$1, {
|
|
69
|
+
Header: FrameHeader,
|
|
70
|
+
Panel: FramePanel,
|
|
71
|
+
Footer: FrameFooter,
|
|
72
|
+
Title: FrameTitle,
|
|
73
|
+
Description: FrameDescription
|
|
73
74
|
});
|
|
74
75
|
/** https://ui.shadcn.com/docs/components/base/field */
|
|
75
76
|
const Field = /* @__PURE__ */ Object.assign(Field$1, {
|