orbital-ds 0.1.0 → 0.2.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/contract.json +38 -0
- package/dist/styles.css +98 -18
- package/dist/themes/qratia.css +13 -13
- package/dist/themes/zyro.css +189 -0
- package/dist/ui/accordion.d.ts +9 -0
- package/dist/ui/accordion.js +79 -0
- package/dist/ui/alert-dialog.d.ts +23 -0
- package/dist/ui/alert-dialog.js +173 -0
- package/dist/ui/alert.d.ts +13 -0
- package/dist/ui/alert.js +77 -0
- package/dist/ui/aspect-ratio.d.ts +7 -0
- package/dist/ui/aspect-ratio.js +22 -0
- package/dist/ui/attachment.d.ts +26 -0
- package/dist/ui/attachment.js +197 -0
- package/dist/ui/avatar.js +1 -1
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/badge.js +1 -1
- package/dist/ui/bubble.d.ts +19 -0
- package/dist/ui/bubble.js +115 -0
- package/dist/ui/button-group.d.ts +15 -0
- package/dist/ui/button-group.js +82 -0
- package/dist/ui/button.d.ts +5 -3
- package/dist/ui/button.js +9 -6
- package/dist/ui/calendar.d.ts +15 -0
- package/dist/ui/calendar.js +190 -0
- package/dist/ui/card.js +4 -4
- package/dist/ui/carousel.d.ts +33 -0
- package/dist/ui/carousel.js +199 -0
- package/dist/ui/checkbox.js +1 -1
- package/dist/ui/combobox.d.ts +26 -0
- package/dist/ui/combobox.js +281 -0
- package/dist/ui/command.d.ts +22 -0
- package/dist/ui/command.js +183 -0
- package/dist/ui/context-menu.d.ts +31 -0
- package/dist/ui/context-menu.js +242 -0
- package/dist/ui/dialog.js +2 -2
- package/dist/ui/direction.d.ts +1 -0
- package/dist/ui/direction.js +8 -0
- package/dist/ui/drawer.d.ts +18 -0
- package/dist/ui/drawer.js +208 -0
- package/dist/ui/dropdown-menu.d.ts +1 -1
- package/dist/ui/dropdown-menu.js +13 -9
- package/dist/ui/empty.d.ts +15 -0
- package/dist/ui/empty.js +102 -0
- package/dist/ui/field.d.ts +28 -0
- package/dist/ui/field.js +217 -0
- package/dist/ui/hover-card.d.ts +8 -0
- package/dist/ui/hover-card.js +45 -0
- package/dist/ui/input-group.d.ts +22 -0
- package/dist/ui/input-group.js +145 -0
- package/dist/ui/input-otp.d.ts +13 -0
- package/dist/ui/input-otp.js +82 -0
- package/dist/ui/input.js +1 -1
- package/dist/ui/item.d.ts +26 -0
- package/dist/ui/item.js +195 -0
- package/dist/ui/kbd.d.ts +6 -0
- package/dist/ui/kbd.js +29 -0
- package/dist/ui/marker.d.ts +13 -0
- package/dist/ui/marker.js +71 -0
- package/dist/ui/menubar.d.ts +31 -0
- package/dist/ui/menubar.js +259 -0
- package/dist/ui/message-scroller.d.ts +16 -0
- package/dist/ui/message-scroller.js +120 -0
- package/dist/ui/message.d.ts +12 -0
- package/dist/ui/message.js +90 -0
- package/dist/ui/native-select.d.ts +10 -0
- package/dist/ui/native-select.js +63 -0
- package/dist/ui/navigation-menu.d.ts +15 -0
- package/dist/ui/navigation-menu.js +162 -0
- package/dist/ui/pagination.d.ts +22 -0
- package/dist/ui/pagination.js +128 -0
- package/dist/ui/popover.js +2 -2
- package/dist/ui/questionnaire.d.ts +24 -0
- package/dist/ui/questionnaire.js +331 -0
- package/dist/ui/radio-group.d.ts +8 -0
- package/dist/ui/radio-group.js +39 -0
- package/dist/ui/resizable.d.ts +10 -0
- package/dist/ui/resizable.js +46 -0
- package/dist/ui/scroll-area.js +1 -1
- package/dist/ui/select.js +5 -5
- package/dist/ui/sheet.js +4 -4
- package/dist/ui/sidebar.js +4 -4
- package/dist/ui/slider.d.ts +6 -0
- package/dist/ui/slider.js +53 -0
- package/dist/ui/spinner.d.ts +5 -0
- package/dist/ui/spinner.js +9 -0
- package/dist/ui/switch.d.ts +8 -0
- package/dist/ui/switch.js +32 -0
- package/dist/ui/table.js +2 -2
- package/dist/ui/tabs.js +1 -1
- package/dist/ui/textarea.js +1 -1
- package/dist/ui/toast.d.ts +19 -0
- package/dist/ui/toast.js +193 -0
- package/dist/ui/toggle-group.d.ts +14 -0
- package/dist/ui/toggle-group.js +77 -0
- package/dist/ui/toggle.d.ts +12 -0
- package/dist/ui/toggle.js +43 -0
- package/dist/ui/tooltip.js +3 -3
- package/docs/CONTRACT.md +113 -0
- package/package.json +50 -12
- package/scripts/doctor.mjs +142 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../lib/utils";
|
|
6
|
+
function BubbleGroup({ className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
"data-slot": "bubble-group",
|
|
11
|
+
className: cn("flex min-w-0 flex-col gap-2", className),
|
|
12
|
+
...props
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
const bubbleVariants = cva(
|
|
17
|
+
"group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",
|
|
18
|
+
{
|
|
19
|
+
variants: {
|
|
20
|
+
variant: {
|
|
21
|
+
default: "*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",
|
|
22
|
+
secondary: "*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",
|
|
23
|
+
muted: "*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",
|
|
24
|
+
tinted: "*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",
|
|
25
|
+
outline: "*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",
|
|
26
|
+
ghost: "border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",
|
|
27
|
+
destructive: "*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
variant: "default"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
function Bubble({
|
|
36
|
+
variant = "default",
|
|
37
|
+
align = "start",
|
|
38
|
+
className,
|
|
39
|
+
...props
|
|
40
|
+
}) {
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
"data-slot": "bubble",
|
|
45
|
+
"data-variant": variant,
|
|
46
|
+
"data-align": align,
|
|
47
|
+
className: cn(bubbleVariants({ variant }), className),
|
|
48
|
+
...props
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function BubbleContent({
|
|
53
|
+
className,
|
|
54
|
+
render,
|
|
55
|
+
...props
|
|
56
|
+
}) {
|
|
57
|
+
return useRender({
|
|
58
|
+
defaultTagName: "div",
|
|
59
|
+
props: mergeProps(
|
|
60
|
+
{
|
|
61
|
+
className: cn(
|
|
62
|
+
"w-fit max-w-full min-w-0 overflow-hidden rounded-overlay border border-transparent px-3.5 py-2.5 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-(length:--ds-ring-width) [button,a]:focus-visible:ring-ring/50",
|
|
63
|
+
className
|
|
64
|
+
)
|
|
65
|
+
},
|
|
66
|
+
props
|
|
67
|
+
),
|
|
68
|
+
render,
|
|
69
|
+
state: {
|
|
70
|
+
slot: "bubble-content"
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const bubbleReactionsVariants = cva(
|
|
75
|
+
"absolute z-(--ds-z-raised) flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0",
|
|
76
|
+
{
|
|
77
|
+
variants: {
|
|
78
|
+
side: {
|
|
79
|
+
top: "top-0 -translate-y-3/4",
|
|
80
|
+
bottom: "bottom-0 translate-y-3/4"
|
|
81
|
+
},
|
|
82
|
+
align: {
|
|
83
|
+
start: "left-3",
|
|
84
|
+
end: "right-3"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
defaultVariants: {
|
|
88
|
+
side: "bottom",
|
|
89
|
+
align: "end"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
function BubbleReactions({
|
|
94
|
+
side = "bottom",
|
|
95
|
+
align = "end",
|
|
96
|
+
className,
|
|
97
|
+
...props
|
|
98
|
+
}) {
|
|
99
|
+
return /* @__PURE__ */ jsx(
|
|
100
|
+
"div",
|
|
101
|
+
{
|
|
102
|
+
"data-slot": "bubble-reactions",
|
|
103
|
+
"data-align": align,
|
|
104
|
+
"data-side": side,
|
|
105
|
+
className: cn(bubbleReactionsVariants({ side, align }), className),
|
|
106
|
+
...props
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
Bubble,
|
|
112
|
+
BubbleContent,
|
|
113
|
+
BubbleGroup,
|
|
114
|
+
BubbleReactions
|
|
115
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import { Separator } from './separator.js';
|
|
6
|
+
import '@base-ui/react/separator';
|
|
7
|
+
|
|
8
|
+
declare const buttonGroupVariants: (props?: ({
|
|
9
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
10
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
|
+
declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>): React$1.JSX.Element;
|
|
12
|
+
declare function ButtonGroupText({ className, render, ...props }: useRender.ComponentProps<"div">): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
13
|
+
declare function ButtonGroupSeparator({ className, orientation, ...props }: React.ComponentProps<typeof Separator>): React$1.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../lib/utils";
|
|
6
|
+
import { Separator } from "./separator";
|
|
7
|
+
const buttonGroupVariants = cva(
|
|
8
|
+
"flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-(--ds-z-raised) has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-4xl [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
orientation: {
|
|
12
|
+
horizontal: "*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-4xl! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0",
|
|
13
|
+
vertical: "flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-4xl! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
orientation: "horizontal"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
function ButtonGroup({
|
|
22
|
+
className,
|
|
23
|
+
orientation,
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
role: "group",
|
|
30
|
+
"data-slot": "button-group",
|
|
31
|
+
"data-orientation": orientation,
|
|
32
|
+
className: cn(buttonGroupVariants({ orientation }), className),
|
|
33
|
+
...props
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function ButtonGroupText({
|
|
38
|
+
className,
|
|
39
|
+
render,
|
|
40
|
+
...props
|
|
41
|
+
}) {
|
|
42
|
+
return useRender({
|
|
43
|
+
defaultTagName: "div",
|
|
44
|
+
props: mergeProps(
|
|
45
|
+
{
|
|
46
|
+
className: cn(
|
|
47
|
+
"flex items-center gap-2 rounded-control border bg-muted px-2.5 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
48
|
+
className
|
|
49
|
+
)
|
|
50
|
+
},
|
|
51
|
+
props
|
|
52
|
+
),
|
|
53
|
+
render,
|
|
54
|
+
state: {
|
|
55
|
+
slot: "button-group-text"
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function ButtonGroupSeparator({
|
|
60
|
+
className,
|
|
61
|
+
orientation = "vertical",
|
|
62
|
+
...props
|
|
63
|
+
}) {
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
65
|
+
Separator,
|
|
66
|
+
{
|
|
67
|
+
"data-slot": "button-group-separator",
|
|
68
|
+
orientation,
|
|
69
|
+
className: cn(
|
|
70
|
+
"relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto",
|
|
71
|
+
className
|
|
72
|
+
),
|
|
73
|
+
...props
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
ButtonGroup,
|
|
79
|
+
ButtonGroupSeparator,
|
|
80
|
+
ButtonGroupText,
|
|
81
|
+
buttonGroupVariants
|
|
82
|
+
};
|
package/dist/ui/button.d.ts
CHANGED
|
@@ -4,9 +4,11 @@ import { useRender } from '@base-ui/react/use-render';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const buttonVariants: (props?: ({
|
|
7
|
-
variant?: "default" | "
|
|
8
|
-
size?: "default" | "
|
|
7
|
+
variant?: "default" | "destructive" | "link" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
8
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
-
declare function Button({ className, variant, size, render, ...props }: useRender.ComponentProps<"button"> & VariantProps<typeof buttonVariants>
|
|
10
|
+
declare function Button({ className, variant, size, render, nativeButton: _nativeButton, ...props }: useRender.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
11
|
+
nativeButton?: boolean;
|
|
12
|
+
}): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
11
13
|
|
|
12
14
|
export { Button, buttonVariants };
|
package/dist/ui/button.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import { cn } from "../lib/utils";
|
|
5
5
|
const buttonVariants = cva(
|
|
6
|
-
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-semibold whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-(length:--ring-width) focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-(length:--ring-width) aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
6
|
+
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-semibold whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-(length:--ds-ring-width) aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
7
7
|
{
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
@@ -15,13 +15,13 @@ const buttonVariants = cva(
|
|
|
15
15
|
link: "text-primary underline-offset-4 hover:underline"
|
|
16
16
|
},
|
|
17
17
|
size: {
|
|
18
|
-
default: "h-(--control-h-md) gap-1.5 px-
|
|
18
|
+
default: "h-(--ds-control-h-md) gap-1.5 px-(--ds-button-px-md) has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5",
|
|
19
19
|
xs: "h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3",
|
|
20
|
-
sm: "h-(--control-h-sm) gap-1 px-
|
|
21
|
-
lg: "h-(--control-h-lg) gap-1.5 px-
|
|
22
|
-
icon: "size-(--control-h-md)",
|
|
20
|
+
sm: "h-(--ds-control-h-sm) gap-1 px-(--ds-button-px-sm) has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
21
|
+
lg: "h-(--ds-control-h-lg) gap-1.5 px-(--ds-button-px-lg) has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
|
|
22
|
+
icon: "size-(--ds-control-h-md)",
|
|
23
23
|
"icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3",
|
|
24
|
-
"icon-sm": "size-(--control-h-sm)",
|
|
24
|
+
"icon-sm": "size-(--ds-control-h-sm)",
|
|
25
25
|
"icon-lg": "size-10"
|
|
26
26
|
}
|
|
27
27
|
},
|
|
@@ -36,6 +36,9 @@ function Button({
|
|
|
36
36
|
variant = "default",
|
|
37
37
|
size = "default",
|
|
38
38
|
render,
|
|
39
|
+
// Se acepta por compatibilidad con la API de shadcn (`render` hacia un enlace);
|
|
40
|
+
// este botón no lo necesita: useRender ya decide la etiqueta.
|
|
41
|
+
nativeButton: _nativeButton,
|
|
39
42
|
...props
|
|
40
43
|
}) {
|
|
41
44
|
return useRender({
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DayPicker, DayButton, Locale } from 'react-day-picker';
|
|
3
|
+
import { Button } from './button.js';
|
|
4
|
+
import 'class-variance-authority/types';
|
|
5
|
+
import '@base-ui/react/use-render';
|
|
6
|
+
import 'class-variance-authority';
|
|
7
|
+
|
|
8
|
+
declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, locale, formatters, components, ...props }: React.ComponentProps<typeof DayPicker> & {
|
|
9
|
+
buttonVariant?: React.ComponentProps<typeof Button>["variant"];
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
declare function CalendarDayButton({ className, day, modifiers, locale, ...props }: React.ComponentProps<typeof DayButton> & {
|
|
12
|
+
locale?: Partial<Locale>;
|
|
13
|
+
}): React.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { Calendar, CalendarDayButton };
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
5
|
+
import {
|
|
6
|
+
DayPicker,
|
|
7
|
+
getDefaultClassNames
|
|
8
|
+
} from "react-day-picker";
|
|
9
|
+
import { Button, buttonVariants } from "./button";
|
|
10
|
+
import { ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon } from "lucide-react";
|
|
11
|
+
function Calendar({
|
|
12
|
+
className,
|
|
13
|
+
classNames,
|
|
14
|
+
showOutsideDays = true,
|
|
15
|
+
captionLayout = "label",
|
|
16
|
+
buttonVariant = "ghost",
|
|
17
|
+
locale,
|
|
18
|
+
formatters,
|
|
19
|
+
components,
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
const defaultClassNames = getDefaultClassNames();
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
DayPicker,
|
|
25
|
+
{
|
|
26
|
+
showOutsideDays,
|
|
27
|
+
className: cn(
|
|
28
|
+
"group/calendar bg-background p-3 [--cell-radius:var(--radius-4xl)] [--cell-size:--spacing(8)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",
|
|
29
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
30
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
31
|
+
className
|
|
32
|
+
),
|
|
33
|
+
captionLayout,
|
|
34
|
+
locale,
|
|
35
|
+
formatters: {
|
|
36
|
+
formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
|
|
37
|
+
...formatters
|
|
38
|
+
},
|
|
39
|
+
classNames: {
|
|
40
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
41
|
+
months: cn(
|
|
42
|
+
"relative flex flex-col gap-4 md:flex-row",
|
|
43
|
+
defaultClassNames.months
|
|
44
|
+
),
|
|
45
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
46
|
+
nav: cn(
|
|
47
|
+
"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
|
|
48
|
+
defaultClassNames.nav
|
|
49
|
+
),
|
|
50
|
+
button_previous: cn(
|
|
51
|
+
buttonVariants({ variant: buttonVariant }),
|
|
52
|
+
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
53
|
+
defaultClassNames.button_previous
|
|
54
|
+
),
|
|
55
|
+
button_next: cn(
|
|
56
|
+
buttonVariants({ variant: buttonVariant }),
|
|
57
|
+
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
58
|
+
defaultClassNames.button_next
|
|
59
|
+
),
|
|
60
|
+
month_caption: cn(
|
|
61
|
+
"flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
|
|
62
|
+
defaultClassNames.month_caption
|
|
63
|
+
),
|
|
64
|
+
dropdowns: cn(
|
|
65
|
+
"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
|
|
66
|
+
defaultClassNames.dropdowns
|
|
67
|
+
),
|
|
68
|
+
dropdown_root: cn(
|
|
69
|
+
"relative rounded-(--cell-radius)",
|
|
70
|
+
defaultClassNames.dropdown_root
|
|
71
|
+
),
|
|
72
|
+
dropdown: cn(
|
|
73
|
+
"absolute inset-0 bg-popover opacity-0",
|
|
74
|
+
defaultClassNames.dropdown
|
|
75
|
+
),
|
|
76
|
+
caption_label: cn(
|
|
77
|
+
"font-medium select-none",
|
|
78
|
+
captionLayout === "label" ? "text-sm" : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
|
|
79
|
+
defaultClassNames.caption_label
|
|
80
|
+
),
|
|
81
|
+
month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
|
|
82
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
83
|
+
weekday: cn(
|
|
84
|
+
"flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none",
|
|
85
|
+
defaultClassNames.weekday
|
|
86
|
+
),
|
|
87
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
88
|
+
week_number_header: cn(
|
|
89
|
+
"w-(--cell-size) select-none",
|
|
90
|
+
defaultClassNames.week_number_header
|
|
91
|
+
),
|
|
92
|
+
week_number: cn(
|
|
93
|
+
"text-[0.8rem] text-muted-foreground select-none",
|
|
94
|
+
defaultClassNames.week_number
|
|
95
|
+
),
|
|
96
|
+
day: cn(
|
|
97
|
+
"group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)",
|
|
98
|
+
props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)",
|
|
99
|
+
defaultClassNames.day
|
|
100
|
+
),
|
|
101
|
+
range_start: cn(
|
|
102
|
+
"relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted",
|
|
103
|
+
defaultClassNames.range_start
|
|
104
|
+
),
|
|
105
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
106
|
+
range_end: cn(
|
|
107
|
+
"relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted",
|
|
108
|
+
defaultClassNames.range_end
|
|
109
|
+
),
|
|
110
|
+
today: cn(
|
|
111
|
+
"rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none",
|
|
112
|
+
defaultClassNames.today
|
|
113
|
+
),
|
|
114
|
+
outside: cn(
|
|
115
|
+
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
116
|
+
defaultClassNames.outside
|
|
117
|
+
),
|
|
118
|
+
disabled: cn(
|
|
119
|
+
"text-muted-foreground opacity-50",
|
|
120
|
+
defaultClassNames.disabled
|
|
121
|
+
),
|
|
122
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
123
|
+
...classNames
|
|
124
|
+
},
|
|
125
|
+
components: {
|
|
126
|
+
Root: ({ className: className2, rootRef, ...props2 }) => {
|
|
127
|
+
return /* @__PURE__ */ jsx(
|
|
128
|
+
"div",
|
|
129
|
+
{
|
|
130
|
+
"data-slot": "calendar",
|
|
131
|
+
ref: rootRef,
|
|
132
|
+
className: cn(className2),
|
|
133
|
+
...props2
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
},
|
|
137
|
+
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
138
|
+
if (orientation === "left") {
|
|
139
|
+
return /* @__PURE__ */ jsx(ChevronLeftIcon, { className: cn("size-4", className2), ...props2 });
|
|
140
|
+
}
|
|
141
|
+
if (orientation === "right") {
|
|
142
|
+
return /* @__PURE__ */ jsx(ChevronRightIcon, { className: cn("size-4", className2), ...props2 });
|
|
143
|
+
}
|
|
144
|
+
return /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn("size-4", className2), ...props2 });
|
|
145
|
+
},
|
|
146
|
+
DayButton: ({ ...props2 }) => /* @__PURE__ */ jsx(CalendarDayButton, { locale, ...props2 }),
|
|
147
|
+
WeekNumber: ({ children, ...props2 }) => {
|
|
148
|
+
return /* @__PURE__ */ jsx("td", { ...props2, children: /* @__PURE__ */ jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
|
|
149
|
+
},
|
|
150
|
+
...components
|
|
151
|
+
},
|
|
152
|
+
...props
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
function CalendarDayButton({
|
|
157
|
+
className,
|
|
158
|
+
day,
|
|
159
|
+
modifiers,
|
|
160
|
+
locale,
|
|
161
|
+
...props
|
|
162
|
+
}) {
|
|
163
|
+
const defaultClassNames = getDefaultClassNames();
|
|
164
|
+
const ref = React.useRef(null);
|
|
165
|
+
React.useEffect(() => {
|
|
166
|
+
if (modifiers.focused) ref.current?.focus();
|
|
167
|
+
}, [modifiers.focused]);
|
|
168
|
+
return /* @__PURE__ */ jsx(
|
|
169
|
+
Button,
|
|
170
|
+
{
|
|
171
|
+
variant: "ghost",
|
|
172
|
+
size: "icon",
|
|
173
|
+
"data-day": day.date.toLocaleDateString(locale?.code),
|
|
174
|
+
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
175
|
+
"data-range-start": modifiers.range_start,
|
|
176
|
+
"data-range-end": modifiers.range_end,
|
|
177
|
+
"data-range-middle": modifiers.range_middle,
|
|
178
|
+
className: cn(
|
|
179
|
+
"relative isolate z-(--ds-z-raised) 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-(--ds-z-raised) group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-(length:--ds-ring-width) group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70",
|
|
180
|
+
defaultClassNames.day,
|
|
181
|
+
className
|
|
182
|
+
),
|
|
183
|
+
...props
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
export {
|
|
188
|
+
Calendar,
|
|
189
|
+
CalendarDayButton
|
|
190
|
+
};
|
package/dist/ui/card.js
CHANGED
|
@@ -11,7 +11,7 @@ function Card({
|
|
|
11
11
|
"data-slot": "card",
|
|
12
12
|
"data-size": size,
|
|
13
13
|
className: cn(
|
|
14
|
-
"group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl border bg-card py-(--card-spacing) text-sm text-card-foreground shadow-card transition-shadow hover:shadow-card-hover
|
|
14
|
+
"group/card flex flex-col gap-(--ds-card-spacing) overflow-hidden rounded-xl border bg-card py-(--ds-card-spacing) text-sm text-card-foreground shadow-card transition-shadow hover:shadow-card-hover has-[>img:first-child]:pt-0 data-[size=sm]:[--ds-card-spacing:var(--ds-card-spacing-sm)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
|
15
15
|
className
|
|
16
16
|
),
|
|
17
17
|
...props
|
|
@@ -24,7 +24,7 @@ function CardHeader({ className, ...props }) {
|
|
|
24
24
|
{
|
|
25
25
|
"data-slot": "card-header",
|
|
26
26
|
className: cn(
|
|
27
|
-
"group/card-header @container/card-header grid auto-rows-min items-start gap-2 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",
|
|
27
|
+
"group/card-header @container/card-header grid auto-rows-min items-start gap-2 rounded-t-xl px-(--ds-card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--ds-card-spacing)",
|
|
28
28
|
className
|
|
29
29
|
),
|
|
30
30
|
...props
|
|
@@ -69,7 +69,7 @@ function CardContent({ className, ...props }) {
|
|
|
69
69
|
"div",
|
|
70
70
|
{
|
|
71
71
|
"data-slot": "card-content",
|
|
72
|
-
className: cn("px-(--card-spacing)", className),
|
|
72
|
+
className: cn("px-(--ds-card-spacing)", className),
|
|
73
73
|
...props
|
|
74
74
|
}
|
|
75
75
|
);
|
|
@@ -80,7 +80,7 @@ function CardFooter({ className, ...props }) {
|
|
|
80
80
|
{
|
|
81
81
|
"data-slot": "card-footer",
|
|
82
82
|
className: cn(
|
|
83
|
-
"flex items-center rounded-b-xl px-(--card-spacing) [.border-t]:pt-(--card-spacing)",
|
|
83
|
+
"flex items-center rounded-b-xl px-(--ds-card-spacing) [.border-t]:pt-(--ds-card-spacing)",
|
|
84
84
|
className
|
|
85
85
|
),
|
|
86
86
|
...props
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import useEmblaCarousel, { UseEmblaCarouselType } from 'embla-carousel-react';
|
|
3
|
+
import { Button } from './button.js';
|
|
4
|
+
import 'class-variance-authority/types';
|
|
5
|
+
import '@base-ui/react/use-render';
|
|
6
|
+
import 'class-variance-authority';
|
|
7
|
+
|
|
8
|
+
type CarouselApi = UseEmblaCarouselType[1];
|
|
9
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
10
|
+
type CarouselOptions = UseCarouselParameters[0];
|
|
11
|
+
type CarouselPlugin = UseCarouselParameters[1];
|
|
12
|
+
type CarouselProps = {
|
|
13
|
+
opts?: CarouselOptions;
|
|
14
|
+
plugins?: CarouselPlugin;
|
|
15
|
+
orientation?: "horizontal" | "vertical";
|
|
16
|
+
setApi?: (api: CarouselApi) => void;
|
|
17
|
+
};
|
|
18
|
+
type CarouselContextProps = {
|
|
19
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
20
|
+
api: ReturnType<typeof useEmblaCarousel>[1];
|
|
21
|
+
scrollPrev: () => void;
|
|
22
|
+
scrollNext: () => void;
|
|
23
|
+
canScrollPrev: boolean;
|
|
24
|
+
canScrollNext: boolean;
|
|
25
|
+
} & CarouselProps;
|
|
26
|
+
declare function useCarousel(): CarouselContextProps;
|
|
27
|
+
declare function Carousel({ orientation, opts, setApi, plugins, className, children, ...props }: React.ComponentProps<"div"> & CarouselProps): React.JSX.Element;
|
|
28
|
+
declare function CarouselContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
29
|
+
declare function CarouselItem({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
30
|
+
declare function CarouselPrevious({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
31
|
+
declare function CarouselNext({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
32
|
+
|
|
33
|
+
export { Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel };
|