@xingxingmofashu/ui 0.1.2 → 0.1.3
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/README.md +21 -6
- package/dist/components/accordion.d.ts +14 -10
- package/dist/components/accordion.mjs +78 -20
- package/dist/components/alert-dialog.d.ts +7 -2
- package/dist/components/alert-dialog.mjs +74 -33
- package/dist/components/button.d.ts +6 -2
- package/dist/components/button.mjs +20 -11
- package/dist/components/card.d.ts +6 -1
- package/dist/components/card.mjs +27 -4
- package/dist/components/checkbox.d.ts +5 -1
- package/dist/components/checkbox.mjs +53 -14
- package/dist/components/dialog.d.ts +7 -2
- package/dist/components/dialog.mjs +66 -20
- package/dist/components/drawer.d.ts +7 -2
- package/dist/components/drawer.mjs +66 -20
- package/dist/components/input.d.ts +5 -1
- package/dist/components/input.mjs +60 -33
- package/dist/components/popover.d.ts +7 -2
- package/dist/components/popover.mjs +53 -14
- package/dist/components/progress.d.ts +21 -0
- package/dist/components/progress.mjs +71 -0
- package/dist/components/scroll-area.d.ts +7 -2
- package/dist/components/scroll-area.mjs +48 -14
- package/dist/components/slider.d.ts +7 -2
- package/dist/components/slider.mjs +38 -22
- package/dist/components/switch.d.ts +5 -1
- package/dist/components/switch.mjs +47 -23
- package/dist/components/toast.d.ts +6 -1
- package/dist/components/toast.mjs +68 -15
- package/dist/components/toggle-group.d.ts +11 -5
- package/dist/components/toggle-group.mjs +54 -6
- package/dist/components/toggle.d.ts +5 -1
- package/dist/components/toggle.mjs +36 -5
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/internal/tv.d.ts +17 -0
- package/dist/internal/tv.mjs +0 -0
- package/dist/keyframes.css +1 -1
- package/dist/theme/alert-dialog.mjs +1 -1
- package/dist/theme/checkbox.mjs +4 -4
- package/dist/theme/dialog.mjs +1 -1
- package/dist/theme/drawer.mjs +1 -1
- package/dist/theme/popover.mjs +2 -2
- package/dist/theme/progress.d.ts +80 -0
- package/dist/theme/progress.mjs +64 -0
- package/dist/theme/slider.mjs +8 -0
- package/dist/theme/switch.mjs +2 -0
- package/dist/theme/toast.mjs +1 -1
- package/package.json +7 -2
|
@@ -8,6 +8,7 @@ import { CheckIcon } from "./icons/check.mjs";
|
|
|
8
8
|
import { DashIcon } from "./icons/dash.mjs";
|
|
9
9
|
function Checkbox({
|
|
10
10
|
className,
|
|
11
|
+
ui,
|
|
11
12
|
label,
|
|
12
13
|
description,
|
|
13
14
|
size,
|
|
@@ -17,7 +18,7 @@ function Checkbox({
|
|
|
17
18
|
"aria-labelledby": ariaLabelledBy,
|
|
18
19
|
...props
|
|
19
20
|
}) {
|
|
20
|
-
const
|
|
21
|
+
const styles = theme({ size });
|
|
21
22
|
const labelId = React.useId();
|
|
22
23
|
const descriptionId = React.useId();
|
|
23
24
|
const hasName = Boolean(label || ariaLabel || ariaLabelledBy);
|
|
@@ -35,34 +36,72 @@ function Checkbox({
|
|
|
35
36
|
"aria-labelledby": labelledBy,
|
|
36
37
|
indeterminate,
|
|
37
38
|
"data-slot": "root",
|
|
38
|
-
className: cn(
|
|
39
|
+
className: cn(styles.root(), ui?.root, className)
|
|
39
40
|
},
|
|
40
|
-
/* @__PURE__ */ React.createElement("span", { "data-slot": "box", className:
|
|
41
|
+
/* @__PURE__ */ React.createElement("span", { "data-slot": "box", className: cn(styles.box(), ui?.box) }, /* @__PURE__ */ React.createElement(
|
|
41
42
|
"span",
|
|
42
43
|
{
|
|
43
44
|
"aria-hidden": "true",
|
|
44
|
-
"data-slot": "
|
|
45
|
-
className:
|
|
45
|
+
"data-slot": "fill",
|
|
46
|
+
className: cn(styles.fill(), ui?.fill)
|
|
46
47
|
}
|
|
47
|
-
)
|
|
48
|
+
), /* @__PURE__ */ React.createElement(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
"aria-hidden": "true",
|
|
52
|
+
"data-slot": "glass",
|
|
53
|
+
className: cn(styles.glass(), ui?.glass)
|
|
54
|
+
},
|
|
55
|
+
/* @__PURE__ */ React.createElement(
|
|
56
|
+
"span",
|
|
57
|
+
{
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
"data-slot": "overlay",
|
|
60
|
+
className: cn(styles.overlay(), ui?.overlay)
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
), /* @__PURE__ */ React.createElement(
|
|
48
64
|
UICheckbox.Indicator,
|
|
49
65
|
{
|
|
50
66
|
keepMounted: true,
|
|
51
67
|
"aria-hidden": "true",
|
|
52
68
|
"data-slot": "indicator",
|
|
53
|
-
className:
|
|
69
|
+
className: cn(styles.indicator(), ui?.indicator)
|
|
54
70
|
},
|
|
55
|
-
/* @__PURE__ */ React.createElement(
|
|
71
|
+
/* @__PURE__ */ React.createElement(
|
|
72
|
+
"span",
|
|
73
|
+
{
|
|
74
|
+
"data-slot": "indicator-icon",
|
|
75
|
+
className: cn(styles.indicatorIcon(), ui?.indicatorIcon)
|
|
76
|
+
},
|
|
77
|
+
indeterminate ? /* @__PURE__ */ React.createElement(DashIcon, null) : /* @__PURE__ */ React.createElement(CheckIcon, null)
|
|
78
|
+
)
|
|
56
79
|
)),
|
|
57
|
-
label || description ? /* @__PURE__ */ React.createElement(
|
|
80
|
+
label || description ? /* @__PURE__ */ React.createElement(
|
|
58
81
|
"span",
|
|
59
82
|
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
className: ui.description()
|
|
83
|
+
"data-slot": "wrapper",
|
|
84
|
+
className: cn(styles.wrapper(), ui?.wrapper)
|
|
63
85
|
},
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
label ? /* @__PURE__ */ React.createElement(
|
|
87
|
+
"span",
|
|
88
|
+
{
|
|
89
|
+
id: labelId,
|
|
90
|
+
"data-slot": "label",
|
|
91
|
+
className: cn(styles.label(), ui?.label)
|
|
92
|
+
},
|
|
93
|
+
label
|
|
94
|
+
) : null,
|
|
95
|
+
description ? /* @__PURE__ */ React.createElement(
|
|
96
|
+
"span",
|
|
97
|
+
{
|
|
98
|
+
id: descriptionId,
|
|
99
|
+
"data-slot": "description",
|
|
100
|
+
className: cn(styles.description(), ui?.description)
|
|
101
|
+
},
|
|
102
|
+
description
|
|
103
|
+
) : null
|
|
104
|
+
) : null
|
|
66
105
|
);
|
|
67
106
|
}
|
|
68
107
|
export { Checkbox };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Dialog as UIDialog } from "@base-ui/react/dialog";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { type ComponentConfig } from "../internal/tv";
|
|
4
|
+
import theme from "../theme/dialog";
|
|
5
|
+
type Dialog = ComponentConfig<typeof theme>;
|
|
3
6
|
type DialogProps = Omit<UIDialog.Root.Props, "children"> & {
|
|
4
7
|
/** Dialog heading. */
|
|
5
8
|
title: React.ReactNode;
|
|
@@ -10,8 +13,10 @@ type DialogProps = Omit<UIDialog.Root.Props, "children"> & {
|
|
|
10
13
|
/** Action area rendered at the bottom of the dialog. */
|
|
11
14
|
footer?: React.ReactNode;
|
|
12
15
|
/** Tailwind classes merged into the popup. */
|
|
13
|
-
className?:
|
|
16
|
+
className?: string;
|
|
17
|
+
/** Tailwind classes for internal slots, keyed by `data-slot`. */
|
|
18
|
+
ui?: Dialog["slots"];
|
|
14
19
|
};
|
|
15
|
-
declare function Dialog({ title, description, children, footer, className, ...props }: DialogProps): React.JSX.Element;
|
|
20
|
+
declare function Dialog({ title, description, children, footer, className, ui, ...props }: DialogProps): React.JSX.Element;
|
|
16
21
|
export { Dialog };
|
|
17
22
|
export type { DialogProps };
|
|
@@ -9,31 +9,77 @@ function Dialog({
|
|
|
9
9
|
children,
|
|
10
10
|
footer,
|
|
11
11
|
className,
|
|
12
|
+
ui,
|
|
12
13
|
...props
|
|
13
14
|
}) {
|
|
14
|
-
const
|
|
15
|
-
return /* @__PURE__ */ React.createElement(UIDialog.Root, { ...props }, /* @__PURE__ */ React.createElement(UIDialog.Portal, null, /* @__PURE__ */ React.createElement(
|
|
16
|
-
UIDialog.
|
|
15
|
+
const styles = theme();
|
|
16
|
+
return /* @__PURE__ */ React.createElement(UIDialog.Root, { ...props }, /* @__PURE__ */ React.createElement(UIDialog.Portal, null, /* @__PURE__ */ React.createElement(
|
|
17
|
+
UIDialog.Backdrop,
|
|
17
18
|
{
|
|
18
|
-
"data-slot": "
|
|
19
|
-
className: cn(
|
|
19
|
+
"data-slot": "backdrop",
|
|
20
|
+
className: cn(styles.backdrop(), ui?.backdrop)
|
|
21
|
+
}
|
|
22
|
+
), /* @__PURE__ */ React.createElement(
|
|
23
|
+
UIDialog.Viewport,
|
|
24
|
+
{
|
|
25
|
+
"data-slot": "viewport",
|
|
26
|
+
className: cn(styles.viewport(), ui?.viewport)
|
|
20
27
|
},
|
|
21
|
-
/* @__PURE__ */ React.createElement(
|
|
22
|
-
|
|
23
|
-
{
|
|
24
|
-
"aria-hidden": "true",
|
|
25
|
-
"data-slot": "overlay",
|
|
26
|
-
className: ui.overlay()
|
|
27
|
-
}
|
|
28
|
-
)),
|
|
29
|
-
/* @__PURE__ */ React.createElement("div", { "data-slot": "content", className: ui.content() }, /* @__PURE__ */ React.createElement(UIDialog.Title, { "data-slot": "title", className: ui.title() }, title), description ? /* @__PURE__ */ React.createElement(
|
|
30
|
-
UIDialog.Description,
|
|
28
|
+
/* @__PURE__ */ React.createElement(
|
|
29
|
+
UIDialog.Popup,
|
|
31
30
|
{
|
|
32
|
-
"data-slot": "
|
|
33
|
-
className:
|
|
31
|
+
"data-slot": "popup",
|
|
32
|
+
className: cn(styles.popup(), ui?.popup, className)
|
|
34
33
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
/* @__PURE__ */ React.createElement(
|
|
35
|
+
"span",
|
|
36
|
+
{
|
|
37
|
+
"aria-hidden": "true",
|
|
38
|
+
"data-slot": "glass",
|
|
39
|
+
className: cn(styles.glass(), ui?.glass)
|
|
40
|
+
},
|
|
41
|
+
/* @__PURE__ */ React.createElement(
|
|
42
|
+
"span",
|
|
43
|
+
{
|
|
44
|
+
"aria-hidden": "true",
|
|
45
|
+
"data-slot": "overlay",
|
|
46
|
+
className: cn(styles.overlay(), ui?.overlay)
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ React.createElement(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
"data-slot": "content",
|
|
54
|
+
className: cn(styles.content(), ui?.content)
|
|
55
|
+
},
|
|
56
|
+
/* @__PURE__ */ React.createElement(
|
|
57
|
+
UIDialog.Title,
|
|
58
|
+
{
|
|
59
|
+
"data-slot": "title",
|
|
60
|
+
className: cn(styles.title(), ui?.title)
|
|
61
|
+
},
|
|
62
|
+
title
|
|
63
|
+
),
|
|
64
|
+
description ? /* @__PURE__ */ React.createElement(
|
|
65
|
+
UIDialog.Description,
|
|
66
|
+
{
|
|
67
|
+
"data-slot": "description",
|
|
68
|
+
className: cn(styles.description(), ui?.description)
|
|
69
|
+
},
|
|
70
|
+
description
|
|
71
|
+
) : null,
|
|
72
|
+
children ? /* @__PURE__ */ React.createElement("div", { "data-slot": "body", className: cn(styles.body(), ui?.body) }, children) : null,
|
|
73
|
+
footer ? /* @__PURE__ */ React.createElement(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
"data-slot": "footer",
|
|
77
|
+
className: cn(styles.footer(), ui?.footer)
|
|
78
|
+
},
|
|
79
|
+
footer
|
|
80
|
+
) : null
|
|
81
|
+
)
|
|
82
|
+
)
|
|
83
|
+
)));
|
|
38
84
|
}
|
|
39
85
|
export { Dialog };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Drawer as UIDrawer } from "@base-ui/react/drawer";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { type ComponentConfig } from "../internal/tv";
|
|
4
|
+
import theme from "../theme/drawer";
|
|
5
|
+
type Drawer = ComponentConfig<typeof theme>;
|
|
3
6
|
interface DrawerProps extends Omit<UIDrawer.Root.Props, "children" | "className" | "style" | "swipeDirection"> {
|
|
4
7
|
/** Drawer heading. */
|
|
5
8
|
title: React.ReactNode;
|
|
@@ -12,8 +15,10 @@ interface DrawerProps extends Omit<UIDrawer.Root.Props, "children" | "className"
|
|
|
12
15
|
/** Edge the drawer slides in from. */
|
|
13
16
|
direction?: NonNullable<UIDrawer.Root.Props["swipeDirection"]>;
|
|
14
17
|
/** Tailwind classes merged into the popup. */
|
|
15
|
-
className?:
|
|
18
|
+
className?: string;
|
|
19
|
+
/** Tailwind classes for internal slots, keyed by `data-slot`. */
|
|
20
|
+
ui?: Drawer["slots"];
|
|
16
21
|
}
|
|
17
|
-
declare function Drawer({ title, description, children, footer, direction, className, ...props }: DrawerProps): React.JSX.Element;
|
|
22
|
+
declare function Drawer({ title, description, children, footer, direction, className, ui, ...props }: DrawerProps): React.JSX.Element;
|
|
18
23
|
export { Drawer };
|
|
19
24
|
export type { DrawerProps };
|
|
@@ -10,31 +10,77 @@ function Drawer({
|
|
|
10
10
|
footer,
|
|
11
11
|
direction = "down",
|
|
12
12
|
className,
|
|
13
|
+
ui,
|
|
13
14
|
...props
|
|
14
15
|
}) {
|
|
15
|
-
const
|
|
16
|
-
return /* @__PURE__ */ React.createElement(UIDrawer.Root, { ...props, swipeDirection: direction }, /* @__PURE__ */ React.createElement(UIDrawer.Portal, null, /* @__PURE__ */ React.createElement(
|
|
17
|
-
UIDrawer.
|
|
16
|
+
const styles = theme({ direction });
|
|
17
|
+
return /* @__PURE__ */ React.createElement(UIDrawer.Root, { ...props, swipeDirection: direction }, /* @__PURE__ */ React.createElement(UIDrawer.Portal, null, /* @__PURE__ */ React.createElement(
|
|
18
|
+
UIDrawer.Backdrop,
|
|
18
19
|
{
|
|
19
|
-
"data-slot": "
|
|
20
|
-
className: cn(
|
|
20
|
+
"data-slot": "backdrop",
|
|
21
|
+
className: cn(styles.backdrop(), ui?.backdrop)
|
|
22
|
+
}
|
|
23
|
+
), /* @__PURE__ */ React.createElement(
|
|
24
|
+
UIDrawer.Viewport,
|
|
25
|
+
{
|
|
26
|
+
"data-slot": "viewport",
|
|
27
|
+
className: cn(styles.viewport(), ui?.viewport)
|
|
21
28
|
},
|
|
22
|
-
/* @__PURE__ */ React.createElement(
|
|
23
|
-
|
|
24
|
-
{
|
|
25
|
-
"aria-hidden": "true",
|
|
26
|
-
"data-slot": "overlay",
|
|
27
|
-
className: ui.overlay()
|
|
28
|
-
}
|
|
29
|
-
)),
|
|
30
|
-
/* @__PURE__ */ React.createElement(UIDrawer.Content, { "data-slot": "content", className: ui.content() }, /* @__PURE__ */ React.createElement(UIDrawer.Title, { "data-slot": "title", className: ui.title() }, title), description ? /* @__PURE__ */ React.createElement(
|
|
31
|
-
UIDrawer.Description,
|
|
29
|
+
/* @__PURE__ */ React.createElement(
|
|
30
|
+
UIDrawer.Popup,
|
|
32
31
|
{
|
|
33
|
-
"data-slot": "
|
|
34
|
-
className:
|
|
32
|
+
"data-slot": "popup",
|
|
33
|
+
className: cn(styles.popup(), ui?.popup, className)
|
|
35
34
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
/* @__PURE__ */ React.createElement(
|
|
36
|
+
"span",
|
|
37
|
+
{
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
"data-slot": "glass",
|
|
40
|
+
className: cn(styles.glass(), ui?.glass)
|
|
41
|
+
},
|
|
42
|
+
/* @__PURE__ */ React.createElement(
|
|
43
|
+
"span",
|
|
44
|
+
{
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
"data-slot": "overlay",
|
|
47
|
+
className: cn(styles.overlay(), ui?.overlay)
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ React.createElement(
|
|
52
|
+
UIDrawer.Content,
|
|
53
|
+
{
|
|
54
|
+
"data-slot": "content",
|
|
55
|
+
className: cn(styles.content(), ui?.content)
|
|
56
|
+
},
|
|
57
|
+
/* @__PURE__ */ React.createElement(
|
|
58
|
+
UIDrawer.Title,
|
|
59
|
+
{
|
|
60
|
+
"data-slot": "title",
|
|
61
|
+
className: cn(styles.title(), ui?.title)
|
|
62
|
+
},
|
|
63
|
+
title
|
|
64
|
+
),
|
|
65
|
+
description ? /* @__PURE__ */ React.createElement(
|
|
66
|
+
UIDrawer.Description,
|
|
67
|
+
{
|
|
68
|
+
"data-slot": "description",
|
|
69
|
+
className: cn(styles.description(), ui?.description)
|
|
70
|
+
},
|
|
71
|
+
description
|
|
72
|
+
) : null,
|
|
73
|
+
children ? /* @__PURE__ */ React.createElement("div", { "data-slot": "body", className: cn(styles.body(), ui?.body) }, children) : null,
|
|
74
|
+
footer ? /* @__PURE__ */ React.createElement(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
"data-slot": "footer",
|
|
78
|
+
className: cn(styles.footer(), ui?.footer)
|
|
79
|
+
},
|
|
80
|
+
footer
|
|
81
|
+
) : null
|
|
82
|
+
)
|
|
83
|
+
)
|
|
84
|
+
)));
|
|
39
85
|
}
|
|
40
86
|
export { Drawer };
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { Input as UIInput } from "@base-ui/react/input";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { type VariantProps } from "tailwind-variants";
|
|
4
|
+
import { type ComponentConfig } from "../internal/tv";
|
|
4
5
|
import theme from "../theme/input";
|
|
6
|
+
type Input = ComponentConfig<typeof theme>;
|
|
5
7
|
interface InputProps extends Omit<UIInput.Props, "className" | "children" | "size" | "style">, VariantProps<typeof theme> {
|
|
6
8
|
/** Tailwind classes merged into the root element. */
|
|
7
9
|
className?: string;
|
|
10
|
+
/** Tailwind classes for internal slots, keyed by `data-slot`. */
|
|
11
|
+
ui?: Input["slots"];
|
|
8
12
|
/** Visible label associated with the input. */
|
|
9
13
|
label?: React.ReactNode;
|
|
10
14
|
/** Optional supporting text under the field. */
|
|
@@ -14,6 +18,6 @@ interface InputProps extends Omit<UIInput.Props, "className" | "children" | "siz
|
|
|
14
18
|
/** Icon rendered after the input. */
|
|
15
19
|
trailingIcon?: React.ReactNode;
|
|
16
20
|
}
|
|
17
|
-
declare function Input({ className, label, description, leadingIcon, trailingIcon, size, id, disabled, "aria-describedby": ariaDescribedBy, ...props }: InputProps): React.JSX.Element;
|
|
21
|
+
declare function Input({ className, ui, label, description, leadingIcon, trailingIcon, size, id, disabled, "aria-describedby": ariaDescribedBy, ...props }: InputProps): React.JSX.Element;
|
|
18
22
|
export { Input };
|
|
19
23
|
export type { InputProps };
|
|
@@ -6,6 +6,7 @@ import { mergeIds } from "../internal/aria.mjs";
|
|
|
6
6
|
import theme from "../theme/input.mjs";
|
|
7
7
|
function Input({
|
|
8
8
|
className,
|
|
9
|
+
ui,
|
|
9
10
|
label,
|
|
10
11
|
description,
|
|
11
12
|
leadingIcon,
|
|
@@ -16,7 +17,7 @@ function Input({
|
|
|
16
17
|
"aria-describedby": ariaDescribedBy,
|
|
17
18
|
...props
|
|
18
19
|
}) {
|
|
19
|
-
const
|
|
20
|
+
const styles = theme({ size });
|
|
20
21
|
const generatedId = React.useId();
|
|
21
22
|
const descriptionId = React.useId();
|
|
22
23
|
const inputId = id ?? generatedId;
|
|
@@ -29,49 +30,75 @@ function Input({
|
|
|
29
30
|
{
|
|
30
31
|
"data-slot": "root",
|
|
31
32
|
"data-disabled": disabled || void 0,
|
|
32
|
-
className: cn(
|
|
33
|
+
className: cn(styles.root(), ui?.root, className)
|
|
33
34
|
},
|
|
34
|
-
label ? /* @__PURE__ */ React.createElement(
|
|
35
|
-
|
|
36
|
-
"span",
|
|
37
|
-
{
|
|
38
|
-
"aria-hidden": "true",
|
|
39
|
-
"data-slot": "overlay",
|
|
40
|
-
className: ui.overlay()
|
|
41
|
-
}
|
|
42
|
-
)), leadingIcon ? /* @__PURE__ */ React.createElement(
|
|
43
|
-
"span",
|
|
35
|
+
label ? /* @__PURE__ */ React.createElement(
|
|
36
|
+
"label",
|
|
44
37
|
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
htmlFor: inputId,
|
|
39
|
+
"data-slot": "label",
|
|
40
|
+
className: cn(styles.label(), ui?.label)
|
|
48
41
|
},
|
|
49
|
-
|
|
50
|
-
) : null,
|
|
51
|
-
|
|
52
|
-
{
|
|
53
|
-
...props,
|
|
54
|
-
id: inputId,
|
|
55
|
-
disabled,
|
|
56
|
-
"aria-describedby": describedBy,
|
|
57
|
-
"data-slot": "input",
|
|
58
|
-
className: ui.input()
|
|
59
|
-
}
|
|
60
|
-
), trailingIcon ? /* @__PURE__ */ React.createElement(
|
|
42
|
+
label
|
|
43
|
+
) : null,
|
|
44
|
+
/* @__PURE__ */ React.createElement(
|
|
61
45
|
"span",
|
|
62
46
|
{
|
|
63
|
-
"data-slot": "
|
|
64
|
-
className:
|
|
65
|
-
"aria-hidden": "true"
|
|
47
|
+
"data-slot": "control",
|
|
48
|
+
className: cn(styles.control(), ui?.control)
|
|
66
49
|
},
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
/* @__PURE__ */ React.createElement(
|
|
51
|
+
"span",
|
|
52
|
+
{
|
|
53
|
+
"aria-hidden": "true",
|
|
54
|
+
"data-slot": "glass",
|
|
55
|
+
className: cn(styles.glass(), ui?.glass)
|
|
56
|
+
},
|
|
57
|
+
/* @__PURE__ */ React.createElement(
|
|
58
|
+
"span",
|
|
59
|
+
{
|
|
60
|
+
"aria-hidden": "true",
|
|
61
|
+
"data-slot": "overlay",
|
|
62
|
+
className: cn(styles.overlay(), ui?.overlay)
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
),
|
|
66
|
+
leadingIcon ? /* @__PURE__ */ React.createElement(
|
|
67
|
+
"span",
|
|
68
|
+
{
|
|
69
|
+
"data-slot": "leading-icon",
|
|
70
|
+
className: cn(styles.leadingIcon(), ui?.leadingIcon),
|
|
71
|
+
"aria-hidden": "true"
|
|
72
|
+
},
|
|
73
|
+
leadingIcon
|
|
74
|
+
) : null,
|
|
75
|
+
/* @__PURE__ */ React.createElement(
|
|
76
|
+
UIInput,
|
|
77
|
+
{
|
|
78
|
+
...props,
|
|
79
|
+
id: inputId,
|
|
80
|
+
disabled,
|
|
81
|
+
"aria-describedby": describedBy,
|
|
82
|
+
"data-slot": "input",
|
|
83
|
+
className: cn(styles.input(), ui?.input)
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
trailingIcon ? /* @__PURE__ */ React.createElement(
|
|
87
|
+
"span",
|
|
88
|
+
{
|
|
89
|
+
"data-slot": "trailing-icon",
|
|
90
|
+
className: cn(styles.trailingIcon(), ui?.trailingIcon),
|
|
91
|
+
"aria-hidden": "true"
|
|
92
|
+
},
|
|
93
|
+
trailingIcon
|
|
94
|
+
) : null
|
|
95
|
+
),
|
|
69
96
|
description ? /* @__PURE__ */ React.createElement(
|
|
70
97
|
"span",
|
|
71
98
|
{
|
|
72
99
|
id: descriptionId,
|
|
73
100
|
"data-slot": "description",
|
|
74
|
-
className:
|
|
101
|
+
className: cn(styles.description(), ui?.description)
|
|
75
102
|
},
|
|
76
103
|
description
|
|
77
104
|
) : null
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Popover as UIPopover } from "@base-ui/react/popover";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { type ComponentConfig } from "../internal/tv";
|
|
4
|
+
import theme from "../theme/popover";
|
|
5
|
+
type Popover = ComponentConfig<typeof theme>;
|
|
3
6
|
type PositionerProps = React.ComponentProps<typeof UIPopover.Positioner>;
|
|
4
7
|
type PopoverProps = Omit<UIPopover.Root.Props, "children"> & {
|
|
5
8
|
/** Element that opens the popover. It must forward props and refs. */
|
|
@@ -25,8 +28,10 @@ type PopoverProps = Omit<UIPopover.Root.Props, "children"> & {
|
|
|
25
28
|
/** Padding between the popup and the edge of the collision boundary. */
|
|
26
29
|
collisionPadding?: PositionerProps["collisionPadding"];
|
|
27
30
|
/** Tailwind classes merged into the popup. */
|
|
28
|
-
className?:
|
|
31
|
+
className?: string;
|
|
32
|
+
/** Tailwind classes for internal slots, keyed by `data-slot`. */
|
|
33
|
+
ui?: Popover["slots"];
|
|
29
34
|
};
|
|
30
|
-
declare function Popover({ trigger, title, description, children, footer, arrow, side, align, sideOffset, alignOffset, collisionPadding, className, ...props }: PopoverProps): React.JSX.Element;
|
|
35
|
+
declare function Popover({ trigger, title, description, children, footer, arrow, side, align, sideOffset, alignOffset, collisionPadding, className, ui, ...props }: PopoverProps): React.JSX.Element;
|
|
31
36
|
export { Popover };
|
|
32
37
|
export type { PopoverProps };
|
|
@@ -16,9 +16,10 @@ function Popover({
|
|
|
16
16
|
alignOffset,
|
|
17
17
|
collisionPadding,
|
|
18
18
|
className,
|
|
19
|
+
ui,
|
|
19
20
|
...props
|
|
20
21
|
}) {
|
|
21
|
-
const
|
|
22
|
+
const styles = theme();
|
|
22
23
|
return /* @__PURE__ */ React.createElement(UIPopover.Root, { ...props }, /* @__PURE__ */ React.createElement(UIPopover.Trigger, { render: trigger }), /* @__PURE__ */ React.createElement(UIPopover.Portal, null, /* @__PURE__ */ React.createElement(
|
|
23
24
|
UIPopover.Positioner,
|
|
24
25
|
{
|
|
@@ -28,31 +29,69 @@ function Popover({
|
|
|
28
29
|
sideOffset,
|
|
29
30
|
alignOffset,
|
|
30
31
|
collisionPadding,
|
|
31
|
-
className:
|
|
32
|
+
className: cn(styles.positioner(), ui?.positioner)
|
|
32
33
|
},
|
|
33
34
|
/* @__PURE__ */ React.createElement(
|
|
34
35
|
UIPopover.Popup,
|
|
35
36
|
{
|
|
36
37
|
"data-slot": "popup",
|
|
37
|
-
className: cn(
|
|
38
|
+
className: cn(styles.popup(), ui?.popup, className)
|
|
38
39
|
},
|
|
39
|
-
/* @__PURE__ */ React.createElement(
|
|
40
|
+
/* @__PURE__ */ React.createElement(
|
|
40
41
|
"span",
|
|
41
42
|
{
|
|
42
43
|
"aria-hidden": "true",
|
|
43
|
-
"data-slot": "
|
|
44
|
-
className:
|
|
44
|
+
"data-slot": "glass",
|
|
45
|
+
className: cn(styles.glass(), ui?.glass)
|
|
46
|
+
},
|
|
47
|
+
/* @__PURE__ */ React.createElement(
|
|
48
|
+
"span",
|
|
49
|
+
{
|
|
50
|
+
"aria-hidden": "true",
|
|
51
|
+
"data-slot": "overlay",
|
|
52
|
+
className: cn(styles.overlay(), ui?.overlay)
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
),
|
|
56
|
+
arrow ? /* @__PURE__ */ React.createElement(
|
|
57
|
+
UIPopover.Arrow,
|
|
58
|
+
{
|
|
59
|
+
"data-slot": "arrow",
|
|
60
|
+
className: cn(styles.arrow(), ui?.arrow)
|
|
45
61
|
}
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
UIPopover.Description,
|
|
62
|
+
) : null,
|
|
63
|
+
/* @__PURE__ */ React.createElement(
|
|
64
|
+
"div",
|
|
50
65
|
{
|
|
51
|
-
"data-slot": "
|
|
52
|
-
className:
|
|
66
|
+
"data-slot": "content",
|
|
67
|
+
className: cn(styles.content(), ui?.content)
|
|
53
68
|
},
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
/* @__PURE__ */ React.createElement(
|
|
70
|
+
UIPopover.Title,
|
|
71
|
+
{
|
|
72
|
+
"data-slot": "title",
|
|
73
|
+
className: cn(styles.title(), ui?.title)
|
|
74
|
+
},
|
|
75
|
+
title
|
|
76
|
+
),
|
|
77
|
+
description ? /* @__PURE__ */ React.createElement(
|
|
78
|
+
UIPopover.Description,
|
|
79
|
+
{
|
|
80
|
+
"data-slot": "description",
|
|
81
|
+
className: cn(styles.description(), ui?.description)
|
|
82
|
+
},
|
|
83
|
+
description
|
|
84
|
+
) : null,
|
|
85
|
+
children ? /* @__PURE__ */ React.createElement("div", { "data-slot": "body", className: cn(styles.body(), ui?.body) }, children) : null,
|
|
86
|
+
footer ? /* @__PURE__ */ React.createElement(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
"data-slot": "footer",
|
|
90
|
+
className: cn(styles.footer(), ui?.footer)
|
|
91
|
+
},
|
|
92
|
+
footer
|
|
93
|
+
) : null
|
|
94
|
+
)
|
|
56
95
|
)
|
|
57
96
|
)));
|
|
58
97
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Progress as UIProgress } from "@base-ui/react/progress";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { type VariantProps } from "tailwind-variants";
|
|
4
|
+
import { type ComponentConfig } from "../internal/tv";
|
|
5
|
+
import theme from "../theme/progress";
|
|
6
|
+
type Progress = ComponentConfig<typeof theme>;
|
|
7
|
+
type ProgressProps = Omit<UIProgress.Root.Props, "children" | "className" | "style" | "value"> & VariantProps<typeof theme> & {
|
|
8
|
+
/** Current value. Use `null` for an indeterminate progress bar. */
|
|
9
|
+
value?: number | null;
|
|
10
|
+
/** Visible label for the progress bar. */
|
|
11
|
+
label?: React.ReactNode;
|
|
12
|
+
/** Supporting text rendered below the bar. */
|
|
13
|
+
description?: React.ReactNode;
|
|
14
|
+
/** Tailwind classes merged into the root. */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** Tailwind classes for internal slots, keyed by `data-slot`. */
|
|
17
|
+
ui?: Progress["slots"];
|
|
18
|
+
};
|
|
19
|
+
declare function Progress({ className, ui, label, description, size, value, "aria-describedby": ariaDescribedBy, ...props }: ProgressProps): React.JSX.Element;
|
|
20
|
+
export { Progress };
|
|
21
|
+
export type { ProgressProps };
|