orbital-ds 0.1.1 → 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 +89 -9
- 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 +133 -95
- package/scripts/doctor.mjs +142 -0
package/dist/ui/alert.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
const alertVariants = cva(
|
|
5
|
+
"group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",
|
|
6
|
+
{
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "bg-card text-card-foreground",
|
|
10
|
+
destructive: "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
variant: "default"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
function Alert({
|
|
19
|
+
className,
|
|
20
|
+
variant,
|
|
21
|
+
...props
|
|
22
|
+
}) {
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
"data-slot": "alert",
|
|
27
|
+
role: "alert",
|
|
28
|
+
className: cn(alertVariants({ variant }), className),
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function AlertTitle({ className, ...props }) {
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
"data-slot": "alert-title",
|
|
38
|
+
className: cn(
|
|
39
|
+
"font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",
|
|
40
|
+
className
|
|
41
|
+
),
|
|
42
|
+
...props
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
function AlertDescription({
|
|
47
|
+
className,
|
|
48
|
+
...props
|
|
49
|
+
}) {
|
|
50
|
+
return /* @__PURE__ */ jsx(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
"data-slot": "alert-description",
|
|
54
|
+
className: cn(
|
|
55
|
+
"text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",
|
|
56
|
+
className
|
|
57
|
+
),
|
|
58
|
+
...props
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
function AlertAction({ className, ...props }) {
|
|
63
|
+
return /* @__PURE__ */ jsx(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
"data-slot": "alert-action",
|
|
67
|
+
className: cn("absolute top-2.5 right-3", className),
|
|
68
|
+
...props
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
Alert,
|
|
74
|
+
AlertAction,
|
|
75
|
+
AlertDescription,
|
|
76
|
+
AlertTitle
|
|
77
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../lib/utils";
|
|
3
|
+
function AspectRatio({
|
|
4
|
+
ratio,
|
|
5
|
+
className,
|
|
6
|
+
...props
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
"data-slot": "aspect-ratio",
|
|
12
|
+
style: {
|
|
13
|
+
"--ratio": ratio
|
|
14
|
+
},
|
|
15
|
+
className: cn("relative aspect-(--ratio)", className),
|
|
16
|
+
...props
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
AspectRatio
|
|
22
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import { Button } from './button.js';
|
|
6
|
+
|
|
7
|
+
declare const attachmentVariants: (props?: ({
|
|
8
|
+
size?: "default" | "xs" | "sm" | null | undefined;
|
|
9
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
10
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
|
+
declare function Attachment({ className, state, size, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof attachmentVariants> & {
|
|
12
|
+
state?: "idle" | "uploading" | "processing" | "error" | "done";
|
|
13
|
+
}): React.JSX.Element;
|
|
14
|
+
declare const attachmentMediaVariants: (props?: ({
|
|
15
|
+
variant?: "image" | "icon" | null | undefined;
|
|
16
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
17
|
+
declare function AttachmentMedia({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof attachmentMediaVariants>): React.JSX.Element;
|
|
18
|
+
declare function AttachmentContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
19
|
+
declare function AttachmentTitle({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
20
|
+
declare function AttachmentDescription({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
21
|
+
declare function AttachmentActions({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
22
|
+
declare function AttachmentAction({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
23
|
+
declare function AttachmentTrigger({ className, render, type, ...props }: useRender.ComponentProps<"button">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
24
|
+
declare function AttachmentGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
25
|
+
|
|
26
|
+
export { Attachment, AttachmentAction, AttachmentActions, AttachmentContent, AttachmentDescription, AttachmentGroup, AttachmentMedia, AttachmentTitle, AttachmentTrigger };
|
|
@@ -0,0 +1,197 @@
|
|
|
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 { Button } from "./button";
|
|
7
|
+
const attachmentVariants = cva(
|
|
8
|
+
"group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-2xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
size: {
|
|
12
|
+
default: "gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2",
|
|
13
|
+
sm: "gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5",
|
|
14
|
+
xs: "gap-1.5 rounded-xl text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1"
|
|
15
|
+
},
|
|
16
|
+
orientation: {
|
|
17
|
+
horizontal: "min-w-40 items-center",
|
|
18
|
+
vertical: "w-24 flex-col has-data-[slot=attachment-content]:w-30"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
function Attachment({
|
|
24
|
+
className,
|
|
25
|
+
state = "done",
|
|
26
|
+
size = "default",
|
|
27
|
+
orientation = "horizontal",
|
|
28
|
+
...props
|
|
29
|
+
}) {
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
"data-slot": "attachment",
|
|
34
|
+
"data-state": state,
|
|
35
|
+
"data-size": size,
|
|
36
|
+
"data-orientation": orientation,
|
|
37
|
+
className: cn(attachmentVariants({ size, orientation }), className),
|
|
38
|
+
...props
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
const attachmentMediaVariants = cva(
|
|
43
|
+
"relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-xl bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-lg group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5",
|
|
44
|
+
{
|
|
45
|
+
variants: {
|
|
46
|
+
variant: {
|
|
47
|
+
icon: "",
|
|
48
|
+
image: "opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
defaultVariants: {
|
|
52
|
+
variant: "icon"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
function AttachmentMedia({
|
|
57
|
+
className,
|
|
58
|
+
variant = "icon",
|
|
59
|
+
...props
|
|
60
|
+
}) {
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
"data-slot": "attachment-media",
|
|
65
|
+
"data-variant": variant,
|
|
66
|
+
className: cn(attachmentMediaVariants({ variant }), className),
|
|
67
|
+
...props
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
function AttachmentContent({
|
|
72
|
+
className,
|
|
73
|
+
...props
|
|
74
|
+
}) {
|
|
75
|
+
return /* @__PURE__ */ jsx(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
"data-slot": "attachment-content",
|
|
79
|
+
className: cn(
|
|
80
|
+
"max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1",
|
|
81
|
+
className
|
|
82
|
+
),
|
|
83
|
+
...props
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
function AttachmentTitle({
|
|
88
|
+
className,
|
|
89
|
+
...props
|
|
90
|
+
}) {
|
|
91
|
+
return /* @__PURE__ */ jsx(
|
|
92
|
+
"span",
|
|
93
|
+
{
|
|
94
|
+
"data-slot": "attachment-title",
|
|
95
|
+
className: cn(
|
|
96
|
+
"block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer",
|
|
97
|
+
className
|
|
98
|
+
),
|
|
99
|
+
...props
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function AttachmentDescription({
|
|
104
|
+
className,
|
|
105
|
+
...props
|
|
106
|
+
}) {
|
|
107
|
+
return /* @__PURE__ */ jsx(
|
|
108
|
+
"span",
|
|
109
|
+
{
|
|
110
|
+
"data-slot": "attachment-description",
|
|
111
|
+
className: cn(
|
|
112
|
+
"mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80",
|
|
113
|
+
"max-w-full",
|
|
114
|
+
className
|
|
115
|
+
),
|
|
116
|
+
...props
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
function AttachmentActions({
|
|
121
|
+
className,
|
|
122
|
+
...props
|
|
123
|
+
}) {
|
|
124
|
+
return /* @__PURE__ */ jsx(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
"data-slot": "attachment-actions",
|
|
128
|
+
className: cn(
|
|
129
|
+
"relative z-(--ds-z-sticky) flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1",
|
|
130
|
+
className
|
|
131
|
+
),
|
|
132
|
+
...props
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
function AttachmentAction({
|
|
137
|
+
className,
|
|
138
|
+
variant,
|
|
139
|
+
size = "icon-xs",
|
|
140
|
+
...props
|
|
141
|
+
}) {
|
|
142
|
+
return /* @__PURE__ */ jsx(
|
|
143
|
+
Button,
|
|
144
|
+
{
|
|
145
|
+
"data-slot": "attachment-action",
|
|
146
|
+
variant: variant ?? "ghost",
|
|
147
|
+
size,
|
|
148
|
+
className: cn(className),
|
|
149
|
+
...props
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
function AttachmentTrigger({
|
|
154
|
+
className,
|
|
155
|
+
render,
|
|
156
|
+
type,
|
|
157
|
+
...props
|
|
158
|
+
}) {
|
|
159
|
+
return useRender({
|
|
160
|
+
defaultTagName: "button",
|
|
161
|
+
props: mergeProps(
|
|
162
|
+
{
|
|
163
|
+
type: render ? type : type ?? "button",
|
|
164
|
+
className: cn("absolute inset-0 z-(--ds-z-raised) outline-none", className)
|
|
165
|
+
},
|
|
166
|
+
props
|
|
167
|
+
),
|
|
168
|
+
render,
|
|
169
|
+
state: {
|
|
170
|
+
slot: "attachment-trigger"
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function AttachmentGroup({ className, ...props }) {
|
|
175
|
+
return /* @__PURE__ */ jsx(
|
|
176
|
+
"div",
|
|
177
|
+
{
|
|
178
|
+
"data-slot": "attachment-group",
|
|
179
|
+
className: cn(
|
|
180
|
+
"flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start",
|
|
181
|
+
className
|
|
182
|
+
),
|
|
183
|
+
...props
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
export {
|
|
188
|
+
Attachment,
|
|
189
|
+
AttachmentAction,
|
|
190
|
+
AttachmentActions,
|
|
191
|
+
AttachmentContent,
|
|
192
|
+
AttachmentDescription,
|
|
193
|
+
AttachmentGroup,
|
|
194
|
+
AttachmentMedia,
|
|
195
|
+
AttachmentTitle,
|
|
196
|
+
AttachmentTrigger
|
|
197
|
+
};
|
package/dist/ui/avatar.js
CHANGED
|
@@ -54,7 +54,7 @@ function AvatarBadge({ className, ...props }) {
|
|
|
54
54
|
{
|
|
55
55
|
"data-slot": "avatar-badge",
|
|
56
56
|
className: cn(
|
|
57
|
-
"absolute right-0 bottom-0 z-(--z-raised) inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none",
|
|
57
|
+
"absolute right-0 bottom-0 z-(--ds-z-raised) inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none",
|
|
58
58
|
"group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden",
|
|
59
59
|
"group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",
|
|
60
60
|
"group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",
|
package/dist/ui/badge.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { useRender } from '@base-ui/react/use-render';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "default" | "
|
|
7
|
+
variant?: "default" | "destructive" | "link" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
declare function Badge({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
10
10
|
|
package/dist/ui/badge.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 badgeVariants = cva(
|
|
6
|
-
"group/badge inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-md border border-transparent px-
|
|
6
|
+
"group/badge inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-md border border-transparent px-(--ds-badge-px) py-1 text-xs font-semibold whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
|
|
7
7
|
{
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare function BubbleGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
7
|
+
declare const bubbleVariants: (props?: ({
|
|
8
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "muted" | "tinted" | null | undefined;
|
|
9
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
+
declare function Bubble({ variant, align, className, ...props }: React.ComponentProps<"div"> & VariantProps<typeof bubbleVariants> & {
|
|
11
|
+
align?: "start" | "end";
|
|
12
|
+
}): React.JSX.Element;
|
|
13
|
+
declare function BubbleContent({ className, render, ...props }: useRender.ComponentProps<"div">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
14
|
+
declare function BubbleReactions({ side, align, className, ...props }: React.ComponentProps<"div"> & {
|
|
15
|
+
align?: "start" | "end";
|
|
16
|
+
side?: "top" | "bottom";
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
|
|
19
|
+
export { Bubble, BubbleContent, BubbleGroup, BubbleReactions };
|
|
@@ -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({
|