@api7/ui-components 0.4.0 → 0.5.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/README.md +176 -30
- package/dist/animations.css +12 -0
- package/dist/components/alert/alert.js +7 -7
- package/dist/components/avatar/avatar.d.ts +4 -4
- package/dist/components/avatar/avatar.js +6 -6
- package/dist/components/badge/badge.js +14 -14
- package/dist/components/button/button.d.ts +1 -2
- package/dist/components/button/button.js +14 -14
- package/dist/components/calendar/calendar.d.ts +1 -1
- package/dist/components/calendar/calendar.js +28 -28
- package/dist/components/checkbox/checkbox.js +3 -3
- package/dist/components/combobox/combobox.js +24 -23
- package/dist/components/data-table/data-table.js +7 -7
- package/dist/components/data-table/filter-header.js +4 -4
- package/dist/components/data-table/sort-header.js +2 -2
- package/dist/components/date-picker/date-picker.js +14 -14
- package/dist/components/description-list/description-list.d.ts +26 -0
- package/dist/components/description-list/description-list.js +89 -0
- package/dist/components/dialog/dialog.js +11 -11
- package/dist/components/drawer/drawer.js +12 -12
- package/dist/components/empty/empty.js +8 -8
- package/dist/components/field/field.js +6 -6
- package/dist/components/form/date-fields.js +1 -1
- package/dist/components/form/form-item.js +6 -6
- package/dist/components/form/lazy-field-components.js +1 -1
- package/dist/components/form/toggle-fields.js +4 -4
- package/dist/components/input/input.js +1 -1
- package/dist/components/input-group/input-group.js +11 -11
- package/dist/components/menu/menu.js +13 -11
- package/dist/components/number-field/number-field.js +7 -7
- package/dist/components/pagination/pagination.js +12 -12
- package/dist/components/popover/popover.js +5 -4
- package/dist/components/progress/progress.d.ts +19 -0
- package/dist/components/progress/progress.js +36 -0
- package/dist/components/radio-group/radio-group.js +3 -3
- package/dist/components/select/select.js +17 -16
- package/dist/components/separator/separator.js +1 -1
- package/dist/components/sidebar/sidebar.js +9 -9
- package/dist/components/skeleton/skeleton.js +1 -1
- package/dist/components/spinner/spinner.d.ts +14 -0
- package/dist/components/spinner/spinner.js +28 -0
- package/dist/components/switch/switch.js +2 -2
- package/dist/components/table/table.js +7 -7
- package/dist/components/tabs/tabs.js +4 -4
- package/dist/components/textarea/textarea.js +1 -1
- package/dist/components/toast/toast.js +18 -18
- package/dist/components/tooltip/tooltip.js +4 -2
- package/dist/config/messages.d.ts +4 -0
- package/dist/config/messages.js +2 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/lib/cn.js +4 -4
- package/dist/lib/control.js +3 -3
- package/dist/lib/popup.js +5 -4
- package/dist/theme.css +220 -0
- package/package.json +7 -5
- package/dist/styles.css +0 -2
|
@@ -25,22 +25,22 @@ function DialogTrigger({ className, ...props }) {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
const dialogContentSizeClassName = {
|
|
28
|
-
sm: "
|
|
29
|
-
md: "
|
|
30
|
-
lg: "
|
|
28
|
+
sm: "max-w-md",
|
|
29
|
+
md: "max-w-xl",
|
|
30
|
+
lg: "max-w-3xl"
|
|
31
31
|
};
|
|
32
32
|
function DialogContent({ className, showCloseButton = true, closeLabel, size = "md", children, ...props }) {
|
|
33
33
|
const messages = useMessages();
|
|
34
34
|
const showBackdrop = useContext(DialogModalContext) === true;
|
|
35
35
|
return /* @__PURE__ */ jsxs(Dialog.Portal, { children: [showBackdrop && /* @__PURE__ */ jsx(Dialog.Backdrop, {
|
|
36
|
-
className: "
|
|
36
|
+
className: "fixed inset-0 z-50 bg-overlay transition-opacity duration-150 motion-reduce:transition-none data-ending-style:opacity-0 data-starting-style:opacity-0",
|
|
37
37
|
"data-slot": "dialog-backdrop"
|
|
38
38
|
}), /* @__PURE__ */ jsxs(Dialog.Popup, {
|
|
39
|
-
className: cn("
|
|
39
|
+
className: cn("fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100vh-4rem)] w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-md bg-background text-foreground shadow-lg dark:ring-1 dark:ring-border outline-none transition-[opacity,scale] duration-150 motion-reduce:transition-none data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0", dialogContentSizeClassName[size], className),
|
|
40
40
|
...props,
|
|
41
41
|
"data-slot": "dialog-content",
|
|
42
42
|
children: [showCloseButton && /* @__PURE__ */ jsx(Dialog.Close, {
|
|
43
|
-
className: "
|
|
43
|
+
className: "absolute top-3 right-4",
|
|
44
44
|
render: /* @__PURE__ */ jsx(Button, {
|
|
45
45
|
variant: "ghost",
|
|
46
46
|
size: "icon"
|
|
@@ -52,35 +52,35 @@ function DialogContent({ className, showCloseButton = true, closeLabel, size = "
|
|
|
52
52
|
}
|
|
53
53
|
function DialogHeader({ className, ...props }) {
|
|
54
54
|
return /* @__PURE__ */ jsx("div", {
|
|
55
|
-
className: cn("
|
|
55
|
+
className: cn("flex flex-col gap-1 border-b border-border p-4 pr-12", className),
|
|
56
56
|
...props,
|
|
57
57
|
"data-slot": "dialog-header"
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
function DialogTitle({ className, ...props }) {
|
|
61
61
|
return /* @__PURE__ */ jsx(Dialog.Title, {
|
|
62
|
-
className: cn("
|
|
62
|
+
className: cn("text-lg font-medium text-foreground", className),
|
|
63
63
|
...props,
|
|
64
64
|
"data-slot": "dialog-title"
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
function DialogDescription({ className, ...props }) {
|
|
68
68
|
return /* @__PURE__ */ jsx(Dialog.Description, {
|
|
69
|
-
className: cn("
|
|
69
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
70
70
|
...props,
|
|
71
71
|
"data-slot": "dialog-description"
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
function DialogBody({ className, ...props }) {
|
|
75
75
|
return /* @__PURE__ */ jsx("div", {
|
|
76
|
-
className: cn("
|
|
76
|
+
className: cn("max-h-[596px] overflow-y-auto p-6", className),
|
|
77
77
|
...props,
|
|
78
78
|
"data-slot": "dialog-body"
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
function DialogFooter({ className, ...props }) {
|
|
82
82
|
return /* @__PURE__ */ jsx("div", {
|
|
83
|
-
className: cn("
|
|
83
|
+
className: cn("flex items-center justify-end gap-3 border-t border-border px-6 py-4", className),
|
|
84
84
|
...props,
|
|
85
85
|
"data-slot": "dialog-footer"
|
|
86
86
|
});
|
|
@@ -26,26 +26,26 @@ function DrawerTrigger({ className, ...props }) {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
const drawerContentSizeClassName = {
|
|
29
|
-
md: "
|
|
30
|
-
lg: "
|
|
31
|
-
full: "
|
|
29
|
+
md: "w-[588px] max-w-[100vw]",
|
|
30
|
+
lg: "w-[748px] max-w-[100vw]",
|
|
31
|
+
full: "w-[90vw] max-w-[100vw]"
|
|
32
32
|
};
|
|
33
33
|
function DrawerContent({ className, showCloseButton = true, closeLabel, size = "md", children, ...props }) {
|
|
34
34
|
const messages = useMessages();
|
|
35
35
|
const isNonModal = useContext(DrawerModalContext) !== true;
|
|
36
36
|
const showBackdrop = !isNonModal;
|
|
37
37
|
return /* @__PURE__ */ jsxs(Drawer.Portal, { children: [showBackdrop && /* @__PURE__ */ jsx(Drawer.Backdrop, {
|
|
38
|
-
className: "
|
|
38
|
+
className: "fixed inset-0 z-50 bg-overlay transition-opacity duration-150 motion-reduce:transition-none data-ending-style:opacity-0 data-starting-style:opacity-0",
|
|
39
39
|
"data-slot": "drawer-backdrop"
|
|
40
40
|
}), /* @__PURE__ */ jsx(Drawer.Viewport, {
|
|
41
|
-
className: cn("
|
|
41
|
+
className: cn("fixed inset-0 z-50", isNonModal && "pointer-events-none"),
|
|
42
42
|
"data-slot": "drawer-viewport",
|
|
43
43
|
children: /* @__PURE__ */ jsxs(Drawer.Popup, {
|
|
44
|
-
className: cn("
|
|
44
|
+
className: cn("fixed inset-y-0 right-0 flex h-full flex-col bg-background text-foreground shadow-lg dark:ring-1 dark:ring-border outline-none transition-transform duration-200 motion-reduce:transition-none data-ending-style:translate-x-full data-starting-style:translate-x-full", isNonModal && "pointer-events-auto", drawerContentSizeClassName[size], className),
|
|
45
45
|
...props,
|
|
46
46
|
"data-slot": "drawer-content",
|
|
47
47
|
children: [showCloseButton && /* @__PURE__ */ jsx(Drawer.Close, {
|
|
48
|
-
className: "
|
|
48
|
+
className: "absolute top-3 right-4",
|
|
49
49
|
render: /* @__PURE__ */ jsx(Button, {
|
|
50
50
|
variant: "ghost",
|
|
51
51
|
size: "icon"
|
|
@@ -58,35 +58,35 @@ function DrawerContent({ className, showCloseButton = true, closeLabel, size = "
|
|
|
58
58
|
}
|
|
59
59
|
function DrawerHeader({ className, ...props }) {
|
|
60
60
|
return /* @__PURE__ */ jsx("div", {
|
|
61
|
-
className: cn("
|
|
61
|
+
className: cn("flex flex-col gap-1 border-b border-border px-6 py-4 pr-12", className),
|
|
62
62
|
...props,
|
|
63
63
|
"data-slot": "drawer-header"
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
function DrawerTitle({ className, ...props }) {
|
|
67
67
|
return /* @__PURE__ */ jsx(Drawer.Title, {
|
|
68
|
-
className: cn("
|
|
68
|
+
className: cn("text-lg font-semibold text-foreground", className),
|
|
69
69
|
...props,
|
|
70
70
|
"data-slot": "drawer-title"
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
function DrawerDescription({ className, ...props }) {
|
|
74
74
|
return /* @__PURE__ */ jsx(Drawer.Description, {
|
|
75
|
-
className: cn("
|
|
75
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
76
76
|
...props,
|
|
77
77
|
"data-slot": "drawer-description"
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
function DrawerBody({ className, ...props }) {
|
|
81
81
|
return /* @__PURE__ */ jsx("div", {
|
|
82
|
-
className: cn("
|
|
82
|
+
className: cn("flex-1 overflow-y-auto px-6 py-4", className),
|
|
83
83
|
...props,
|
|
84
84
|
"data-slot": "drawer-body"
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
function DrawerFooter({ className, ...props }) {
|
|
88
88
|
return /* @__PURE__ */ jsx("div", {
|
|
89
|
-
className: cn("
|
|
89
|
+
className: cn("flex items-center justify-end gap-4 border-t border-border px-6 py-3", className),
|
|
90
90
|
...props,
|
|
91
91
|
"data-slot": "drawer-footer"
|
|
92
92
|
});
|
|
@@ -2,11 +2,11 @@ import { cn } from "../../lib/cn.js";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
//#region src/components/empty/empty.tsx
|
|
5
|
-
const emptyVariants = cva("
|
|
6
|
-
const emptyMediaVariants = cva("
|
|
5
|
+
const emptyVariants = cva("flex w-full min-w-0 flex-col items-center justify-center gap-3 rounded-sm border-[3px] border-dashed border-border px-4 py-4 text-center");
|
|
6
|
+
const emptyMediaVariants = cva("flex shrink-0 items-center justify-center", {
|
|
7
7
|
variants: { variant: {
|
|
8
|
-
default: "
|
|
9
|
-
icon: "
|
|
8
|
+
default: "size-[76px] [&_img]:size-full [&_img]:object-contain [&_svg]:size-full",
|
|
9
|
+
icon: "size-10 rounded-sm bg-muted text-foreground [&_svg:not([class*=size-])]:size-5"
|
|
10
10
|
} },
|
|
11
11
|
defaultVariants: { variant: "default" }
|
|
12
12
|
});
|
|
@@ -19,7 +19,7 @@ function Empty({ className, ...props }) {
|
|
|
19
19
|
}
|
|
20
20
|
function EmptyHeader({ className, ...props }) {
|
|
21
21
|
return /* @__PURE__ */ jsx("div", {
|
|
22
|
-
className: cn("
|
|
22
|
+
className: cn("flex max-w-sm flex-col items-center gap-1", className),
|
|
23
23
|
...props,
|
|
24
24
|
"data-slot": "empty-header"
|
|
25
25
|
});
|
|
@@ -34,21 +34,21 @@ function EmptyMedia({ variant = "default", className, ...props }) {
|
|
|
34
34
|
}
|
|
35
35
|
function EmptyTitle({ className, ...props }) {
|
|
36
36
|
return /* @__PURE__ */ jsx("div", {
|
|
37
|
-
className: cn("
|
|
37
|
+
className: cn("text-base font-medium text-foreground", className),
|
|
38
38
|
...props,
|
|
39
39
|
"data-slot": "empty-title"
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
function EmptyDescription({ className, ...props }) {
|
|
43
43
|
return /* @__PURE__ */ jsx("div", {
|
|
44
|
-
className: cn("
|
|
44
|
+
className: cn("text-xs text-muted-foreground", className),
|
|
45
45
|
...props,
|
|
46
46
|
"data-slot": "empty-description"
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
function EmptyContent({ className, ...props }) {
|
|
50
50
|
return /* @__PURE__ */ jsx("div", {
|
|
51
|
-
className: cn("
|
|
51
|
+
className: cn("flex max-w-sm flex-col items-center gap-2", className),
|
|
52
52
|
...props,
|
|
53
53
|
"data-slot": "empty-content"
|
|
54
54
|
});
|
|
@@ -6,42 +6,42 @@ import { Fieldset } from "@base-ui/react/fieldset";
|
|
|
6
6
|
//#region src/components/field/field.tsx
|
|
7
7
|
function Field$1({ className, ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx(Field.Root, {
|
|
9
|
-
className: cn("
|
|
9
|
+
className: cn("flex flex-col gap-1.5", className),
|
|
10
10
|
...props,
|
|
11
11
|
"data-slot": "field"
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
function FieldLabel({ className, ...props }) {
|
|
15
15
|
return /* @__PURE__ */ jsx(Field.Label, {
|
|
16
|
-
className: cn("
|
|
16
|
+
className: cn("inline-flex items-center gap-2 text-sm leading-5 font-medium text-foreground data-disabled:text-muted-foreground", className),
|
|
17
17
|
...props,
|
|
18
18
|
"data-slot": "field-label"
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
function FieldDescription({ className, ...props }) {
|
|
22
22
|
return /* @__PURE__ */ jsx(Field.Description, {
|
|
23
|
-
className: cn("
|
|
23
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
24
24
|
...props,
|
|
25
25
|
"data-slot": "field-description"
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
function FieldError({ className, ...props }) {
|
|
29
29
|
return /* @__PURE__ */ jsx(Field.Error, {
|
|
30
|
-
className: cn("
|
|
30
|
+
className: cn("text-sm text-destructive-text", className),
|
|
31
31
|
...props,
|
|
32
32
|
"data-slot": "field-error"
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
function Fieldset$1({ className, ...props }) {
|
|
36
36
|
return /* @__PURE__ */ jsx(Fieldset.Root, {
|
|
37
|
-
className: cn("
|
|
37
|
+
className: cn("m-0 flex flex-col gap-3 border-0 p-0", className),
|
|
38
38
|
...props,
|
|
39
39
|
"data-slot": "fieldset"
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
function FieldsetLegend({ className, ...props }) {
|
|
43
43
|
return /* @__PURE__ */ jsx(Fieldset.Legend, {
|
|
44
|
-
className: cn("
|
|
44
|
+
className: cn("mb-1 text-sm font-medium text-foreground", className),
|
|
45
45
|
...props,
|
|
46
46
|
"data-slot": "fieldset-legend"
|
|
47
47
|
});
|
|
@@ -8,7 +8,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
8
8
|
const DatePicker = lazy(() => import("../date-picker/date-picker.js").then((m) => ({ default: m.DatePicker })));
|
|
9
9
|
const DateRangePicker = lazy(() => import("../date-picker/date-picker.js").then((m) => ({ default: m.DateRangePicker })));
|
|
10
10
|
function PickerFallback() {
|
|
11
|
-
return /* @__PURE__ */ jsx(Skeleton, { className: "
|
|
11
|
+
return /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-full" });
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Tracks whether the calendar popover is open. Opening it moves focus off the trigger; that blur
|
|
@@ -24,7 +24,7 @@ function useFieldState() {
|
|
|
24
24
|
function OptionalMarker({ label }) {
|
|
25
25
|
const messages = useMessages();
|
|
26
26
|
return /* @__PURE__ */ jsxs("span", {
|
|
27
|
-
className: "
|
|
27
|
+
className: "font-medium text-muted-foreground",
|
|
28
28
|
children: [" ", label ?? messages.form.optional]
|
|
29
29
|
});
|
|
30
30
|
}
|
|
@@ -35,15 +35,15 @@ function LabelTooltip({ content, label }) {
|
|
|
35
35
|
render: /* @__PURE__ */ jsx("button", {
|
|
36
36
|
type: "button",
|
|
37
37
|
"aria-label": label ?? messages.form.moreInfo,
|
|
38
|
-
className: "
|
|
38
|
+
className: "inline-flex text-muted-foreground"
|
|
39
39
|
}),
|
|
40
|
-
children: /* @__PURE__ */ jsx(InfoIcon, { className: "
|
|
40
|
+
children: /* @__PURE__ */ jsx(InfoIcon, { className: "size-3.5" })
|
|
41
41
|
}), /* @__PURE__ */ jsx(TooltipContent, { children: content })] });
|
|
42
42
|
}
|
|
43
43
|
function FormItem({ label, description, labelTooltip, optional, optionalLabel, moreInfoLabel, className, layout = "stacked", children }) {
|
|
44
44
|
const { name, invalid, errors, touched, dirty } = useFieldState();
|
|
45
45
|
const labelRow = label && /* @__PURE__ */ jsxs("div", {
|
|
46
|
-
className: "
|
|
46
|
+
className: "flex items-center gap-1",
|
|
47
47
|
children: [/* @__PURE__ */ jsxs(FieldLabel, { children: [label, optional && /* @__PURE__ */ jsx(OptionalMarker, { label: optionalLabel })] }), labelTooltip && /* @__PURE__ */ jsx(LabelTooltip, {
|
|
48
48
|
content: labelTooltip,
|
|
49
49
|
label: moreInfoLabel
|
|
@@ -58,14 +58,14 @@ function FormItem({ label, description, labelTooltip, optional, optionalLabel, m
|
|
|
58
58
|
"data-slot": "form-item",
|
|
59
59
|
children: [
|
|
60
60
|
layout === "stacked" ? /* @__PURE__ */ jsxs(Fragment, { children: [labelRow, children] }) : /* @__PURE__ */ jsx("div", {
|
|
61
|
-
className: "
|
|
61
|
+
className: "flex flex-row items-center gap-2.5",
|
|
62
62
|
children: layout === "inline-end" ? /* @__PURE__ */ jsxs(Fragment, { children: [labelRow, children] }) : /* @__PURE__ */ jsxs(Fragment, { children: [children, labelRow] })
|
|
63
63
|
}),
|
|
64
64
|
description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
|
|
65
65
|
invalid && /* @__PURE__ */ jsx(FieldError, {
|
|
66
66
|
match: true,
|
|
67
67
|
children: errors.map((message) => /* @__PURE__ */ jsx("span", {
|
|
68
|
-
className: "
|
|
68
|
+
className: "block",
|
|
69
69
|
children: message
|
|
70
70
|
}, message))
|
|
71
71
|
})
|
|
@@ -7,7 +7,7 @@ function loadOnDemand(load) {
|
|
|
7
7
|
const Lazy = lazy(load);
|
|
8
8
|
return function OnDemandField(props) {
|
|
9
9
|
return /* @__PURE__ */ jsx(Suspense, {
|
|
10
|
-
fallback: /* @__PURE__ */ jsx(Skeleton, { className: "
|
|
10
|
+
fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-full" }),
|
|
11
11
|
children: /* @__PURE__ */ jsx(Lazy, { ...props })
|
|
12
12
|
});
|
|
13
13
|
};
|
|
@@ -61,7 +61,7 @@ function RadioGroupField({ label, description, labelTooltip, optional, optionalL
|
|
|
61
61
|
"data-slot": "form-item",
|
|
62
62
|
children: [
|
|
63
63
|
/* @__PURE__ */ jsxs(Fieldset, { children: [label && /* @__PURE__ */ jsxs("div", {
|
|
64
|
-
className: "
|
|
64
|
+
className: "flex items-center gap-1",
|
|
65
65
|
children: [/* @__PURE__ */ jsxs(FieldsetLegend, { children: [label, optional && /* @__PURE__ */ jsx(OptionalMarker, { label: optionalLabel })] }), labelTooltip && /* @__PURE__ */ jsx(LabelTooltip, {
|
|
66
66
|
content: labelTooltip,
|
|
67
67
|
label: moreInfoLabel
|
|
@@ -72,11 +72,11 @@ function RadioGroupField({ label, description, labelTooltip, optional, optionalL
|
|
|
72
72
|
onBlur: field.handleBlur,
|
|
73
73
|
disabled,
|
|
74
74
|
"aria-orientation": orientation,
|
|
75
|
-
className: cn(orientation === "horizontal" && "
|
|
75
|
+
className: cn(orientation === "horizontal" && "flex-row flex-wrap gap-6"),
|
|
76
76
|
children: options.map((option) => /* @__PURE__ */ jsx(Field.Item, {
|
|
77
77
|
disabled: option.disabled,
|
|
78
78
|
children: /* @__PURE__ */ jsxs(FieldLabel, {
|
|
79
|
-
className: "
|
|
79
|
+
className: "font-normal",
|
|
80
80
|
children: [
|
|
81
81
|
/* @__PURE__ */ jsx(RadioGroupItem, { value: option.value }),
|
|
82
82
|
" ",
|
|
@@ -89,7 +89,7 @@ function RadioGroupField({ label, description, labelTooltip, optional, optionalL
|
|
|
89
89
|
invalid && /* @__PURE__ */ jsx(FieldError, {
|
|
90
90
|
match: true,
|
|
91
91
|
children: errors.map((message) => /* @__PURE__ */ jsx("span", {
|
|
92
|
-
className: "
|
|
92
|
+
className: "block",
|
|
93
93
|
children: message
|
|
94
94
|
}, message))
|
|
95
95
|
})
|
|
@@ -6,7 +6,7 @@ import { Input } from "@base-ui/react/input";
|
|
|
6
6
|
//#region src/components/input/input.tsx
|
|
7
7
|
function Input$1({ className, ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx(Input, {
|
|
9
|
-
className: cn(controlSurface, controlFocus, "
|
|
9
|
+
className: cn(controlSurface, controlFocus, "h-8 px-3 py-1", className),
|
|
10
10
|
...props,
|
|
11
11
|
"data-slot": "input"
|
|
12
12
|
});
|
|
@@ -3,20 +3,20 @@ import { cn } from "../../lib/cn.js";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/input-group/input-group.tsx
|
|
5
5
|
const groupParts = [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
6
|
+
"isolate",
|
|
7
|
+
"[&>[data-slot]]:h-auto [&>[data-slot]]:rounded-none",
|
|
8
|
+
"[&>[data-slot]:first-child]:rounded-l-sm [&>[data-slot]:last-child]:rounded-r-sm [&>[data-slot]:not(:first-child)]:-ml-px",
|
|
9
|
+
"[&>[data-slot=input]]:relative [&>[data-slot=input]]:flex-1 [&>[data-slot=input]]:focus-visible:z-10",
|
|
10
|
+
"[&>[data-slot=button]]:focus-visible:relative [&>[data-slot=button]]:focus-visible:z-10",
|
|
11
|
+
"[&>[data-slot=input]+[data-slot][data-slot]]:border-l-transparent [&>[data-slot][data-slot]:has(+[data-slot=input])]:border-r-transparent",
|
|
12
|
+
"[&>[data-slot=input]:not(:focus-visible):not([aria-invalid=true]):has(+[data-slot=button]:is([data-variant=primary],[data-variant=secondary],[data-variant=destructive]))]:border-r-transparent [&>[data-slot=input]+[data-slot=button]:is([data-variant=primary],[data-variant=secondary],[data-variant=destructive])]:ml-0",
|
|
13
|
+
"[&>[data-slot=button]:is([data-variant=primary],[data-variant=secondary],[data-variant=destructive])+[data-slot=input]:not(:focus-visible):not([aria-invalid=true])]:border-l-transparent [&>[data-slot=button]:is([data-variant=primary],[data-variant=secondary],[data-variant=destructive])+[data-slot=input]]:ml-0",
|
|
14
|
+
"[&>[data-slot=input]+[data-slot=button][data-variant=outline]:focus-visible]:border-l-input [&>[data-slot=button][data-variant=outline]:focus-visible:has(+[data-slot=input])]:border-r-input"
|
|
15
15
|
].join(" ");
|
|
16
16
|
/** Joins an `Input` and a `Button` or an `InputGroupAddon` into one control: they touch, share one divider, and each keeps its own hover and focus. */
|
|
17
17
|
function InputGroup({ className, ...props }) {
|
|
18
18
|
return /* @__PURE__ */ jsx("div", {
|
|
19
|
-
className: cn("
|
|
19
|
+
className: cn("flex h-8 w-full items-stretch", groupParts, className),
|
|
20
20
|
...props,
|
|
21
21
|
"data-slot": "input-group"
|
|
22
22
|
});
|
|
@@ -27,7 +27,7 @@ function InputGroup({ className, ...props }) {
|
|
|
27
27
|
*/
|
|
28
28
|
function InputGroupAddon({ className, ...props }) {
|
|
29
29
|
return /* @__PURE__ */ jsx("div", {
|
|
30
|
-
className: cn("
|
|
30
|
+
className: cn("flex shrink-0 items-center border border-input bg-muted px-3 text-sm text-muted-foreground", "overflow-hidden [&_[data-slot=button]]:-mx-3 [&_[data-slot=button]]:h-full [&_[data-slot=button]]:rounded-none [&_[data-slot=button]]:border-0 [&_[data-slot=button]]:focus-visible:ring-inset [&_[data-slot=button]]:focus-visible:ring-ring [&_[data-slot=button]]:bg-transparent [&_[data-slot=button]]:text-foreground [&_[data-slot=button]]:hover:bg-accent", className),
|
|
31
31
|
...props,
|
|
32
32
|
"data-slot": "input-group-addon"
|
|
33
33
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../../lib/cn.js";
|
|
3
|
-
import { popupClassName } from "../../lib/popup.js";
|
|
3
|
+
import { popupClassName, popupLayerClassName } from "../../lib/popup.js";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { CheckIcon, ChevronRightIcon } from "lucide-react";
|
|
6
6
|
import { Menu } from "@base-ui/react/menu";
|
|
7
7
|
//#region src/components/menu/menu.tsx
|
|
8
|
-
const menuItemClassName = "
|
|
9
|
-
const destructiveItemClassName = "
|
|
8
|
+
const menuItemClassName = "flex h-13 cursor-default items-center gap-2 px-3 text-sm outline-none select-none data-highlighted:bg-accent data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0";
|
|
9
|
+
const destructiveItemClassName = "text-destructive-text data-highlighted:bg-destructive-subtle";
|
|
10
10
|
const Menu$1 = Menu.Root;
|
|
11
11
|
function MenuTrigger({ className, ...props }) {
|
|
12
12
|
return /* @__PURE__ */ jsx(Menu.Trigger, {
|
|
@@ -17,11 +17,12 @@ function MenuTrigger({ className, ...props }) {
|
|
|
17
17
|
}
|
|
18
18
|
function MenuContent({ className, side = "bottom", sideOffset = 4, align = "end", ...props }) {
|
|
19
19
|
return /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
20
|
+
className: popupLayerClassName,
|
|
20
21
|
side,
|
|
21
22
|
sideOffset,
|
|
22
23
|
align,
|
|
23
24
|
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
24
|
-
className: cn(popupClassName, "
|
|
25
|
+
className: cn(popupClassName, "min-w-40 py-1", className),
|
|
25
26
|
...props,
|
|
26
27
|
"data-slot": "menu-content"
|
|
27
28
|
})
|
|
@@ -36,7 +37,7 @@ function MenuItem({ className, variant = "default", ...props }) {
|
|
|
36
37
|
}
|
|
37
38
|
function MenuSeparator({ className, ...props }) {
|
|
38
39
|
return /* @__PURE__ */ jsx(Menu.Separator, {
|
|
39
|
-
className: cn("
|
|
40
|
+
className: cn("my-1 h-px bg-border", className),
|
|
40
41
|
...props,
|
|
41
42
|
"data-slot": "menu-separator"
|
|
42
43
|
});
|
|
@@ -50,7 +51,7 @@ function MenuGroup({ className, ...props }) {
|
|
|
50
51
|
}
|
|
51
52
|
function MenuGroupLabel({ className, ...props }) {
|
|
52
53
|
return /* @__PURE__ */ jsx(Menu.GroupLabel, {
|
|
53
|
-
className: cn("
|
|
54
|
+
className: cn("px-3 py-2 text-xs font-medium text-muted-foreground", className),
|
|
54
55
|
...props,
|
|
55
56
|
"data-slot": "menu-group-label"
|
|
56
57
|
});
|
|
@@ -61,7 +62,7 @@ function MenuCheckboxItem({ className, children, ...props }) {
|
|
|
61
62
|
...props,
|
|
62
63
|
"data-slot": "menu-checkbox-item",
|
|
63
64
|
children: [/* @__PURE__ */ jsx("span", {
|
|
64
|
-
className: "
|
|
65
|
+
className: "flex size-4 shrink-0 items-center justify-center",
|
|
65
66
|
children: /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
66
67
|
}), children]
|
|
67
68
|
});
|
|
@@ -79,8 +80,8 @@ function MenuRadioItem({ className, children, ...props }) {
|
|
|
79
80
|
...props,
|
|
80
81
|
"data-slot": "menu-radio-item",
|
|
81
82
|
children: [/* @__PURE__ */ jsx("span", {
|
|
82
|
-
className: "
|
|
83
|
-
children: /* @__PURE__ */ jsx(Menu.RadioItemIndicator, { children: /* @__PURE__ */ jsx("span", { className: "
|
|
83
|
+
className: "flex size-4 shrink-0 items-center justify-center",
|
|
84
|
+
children: /* @__PURE__ */ jsx(Menu.RadioItemIndicator, { children: /* @__PURE__ */ jsx("span", { className: "inline-block size-2 rounded-full bg-current" }) })
|
|
84
85
|
}), children]
|
|
85
86
|
});
|
|
86
87
|
}
|
|
@@ -90,16 +91,17 @@ function MenuSubTrigger({ className, children, ...props }) {
|
|
|
90
91
|
className: cn(menuItemClassName, className),
|
|
91
92
|
...props,
|
|
92
93
|
"data-slot": "menu-sub-trigger",
|
|
93
|
-
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "
|
|
94
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto" })]
|
|
94
95
|
});
|
|
95
96
|
}
|
|
96
97
|
function MenuSubContent({ className, side, sideOffset, align, ...props }) {
|
|
97
98
|
return /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
99
|
+
className: popupLayerClassName,
|
|
98
100
|
side,
|
|
99
101
|
sideOffset,
|
|
100
102
|
align,
|
|
101
103
|
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
102
|
-
className: cn(popupClassName, "
|
|
104
|
+
className: cn(popupClassName, "min-w-40 py-1", className),
|
|
103
105
|
...props,
|
|
104
106
|
"data-slot": "menu-sub-content"
|
|
105
107
|
})
|
|
@@ -7,7 +7,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
import { ChevronDown, ChevronUp } from "lucide-react";
|
|
8
8
|
import { NumberField } from "@base-ui/react/number-field";
|
|
9
9
|
//#region src/components/number-field/number-field.tsx
|
|
10
|
-
const stepperButtonClassName = "
|
|
10
|
+
const stepperButtonClassName = "flex basis-1/2 grow-0 shrink-0 items-center justify-center text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:size-3";
|
|
11
11
|
function NumberField$1({ className, placeholder, showStepper = false, unit, incrementLabel, decrementLabel, locale, format, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, ...props }) {
|
|
12
12
|
const messages = useMessages();
|
|
13
13
|
const uiLocale = useLocale();
|
|
@@ -20,25 +20,25 @@ function NumberField$1({ className, placeholder, showStepper = false, unit, incr
|
|
|
20
20
|
useGrouping: false,
|
|
21
21
|
...format
|
|
22
22
|
},
|
|
23
|
-
className: cn("
|
|
23
|
+
className: cn("group/number-field flex w-full", className),
|
|
24
24
|
...props,
|
|
25
25
|
"data-slot": "number-field",
|
|
26
26
|
children: [/* @__PURE__ */ jsxs(NumberField.Group, {
|
|
27
|
-
className: cn(controlSurface, controlFocusWithin, "
|
|
27
|
+
className: cn(controlSurface, controlFocusWithin, "flex h-8 flex-1 overflow-hidden", hasUnit ? "rounded-l-sm rounded-r-none" : "rounded-sm"),
|
|
28
28
|
"data-slot": "number-field-group",
|
|
29
29
|
children: [/* @__PURE__ */ jsx(NumberField.Input, {
|
|
30
30
|
placeholder,
|
|
31
31
|
"aria-label": ariaLabel,
|
|
32
32
|
"aria-labelledby": ariaLabelledby,
|
|
33
33
|
"aria-describedby": describedBy,
|
|
34
|
-
className: "
|
|
34
|
+
className: "min-w-0 flex-1 bg-transparent px-3 text-left text-foreground tabular-nums outline-none placeholder:text-muted-foreground",
|
|
35
35
|
"data-slot": "number-field-input"
|
|
36
36
|
}), showStepper && /* @__PURE__ */ jsxs("div", {
|
|
37
|
-
className: "
|
|
37
|
+
className: "flex w-6 shrink-0 flex-col border-l border-input",
|
|
38
38
|
"data-slot": "number-field-stepper",
|
|
39
39
|
children: [/* @__PURE__ */ jsx(NumberField.Increment, {
|
|
40
40
|
"aria-label": incrementLabel ?? messages.numberField.increment,
|
|
41
|
-
className: cn(stepperButtonClassName, "
|
|
41
|
+
className: cn(stepperButtonClassName, "border-b border-input"),
|
|
42
42
|
"data-slot": "number-field-increment",
|
|
43
43
|
children: /* @__PURE__ */ jsx(ChevronUp, {})
|
|
44
44
|
}), /* @__PURE__ */ jsx(NumberField.Decrement, {
|
|
@@ -50,7 +50,7 @@ function NumberField$1({ className, placeholder, showStepper = false, unit, incr
|
|
|
50
50
|
})]
|
|
51
51
|
}), hasUnit && /* @__PURE__ */ jsx("span", {
|
|
52
52
|
id: unitId,
|
|
53
|
-
className: "
|
|
53
|
+
className: "flex shrink-0 items-center rounded-r-sm border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground group-data-disabled/number-field:opacity-50",
|
|
54
54
|
"data-slot": "number-field-unit",
|
|
55
55
|
children: unit
|
|
56
56
|
})]
|
|
@@ -56,13 +56,13 @@ function Pagination({ pageIndex, pageSize, rowCount, pageSizeOptions = DEFAULT_P
|
|
|
56
56
|
const pageItems = getPageItems(currentPage, pageCount);
|
|
57
57
|
const effectivePageSizeOptions = pageSizeOptions.includes(pageSize) ? pageSizeOptions : [...pageSizeOptions, pageSize].sort((a, b) => a - b);
|
|
58
58
|
return /* @__PURE__ */ jsxs("div", {
|
|
59
|
-
className: cn("
|
|
59
|
+
className: cn("flex h-11 items-center justify-between px-[22px] py-3", className),
|
|
60
60
|
"data-slot": "pagination",
|
|
61
61
|
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
|
|
62
|
-
className: "
|
|
62
|
+
className: "text-sm text-muted-foreground",
|
|
63
63
|
children: messages.pagination.results
|
|
64
64
|
}), /* @__PURE__ */ jsx("span", {
|
|
65
|
-
className: "
|
|
65
|
+
className: "ml-2.5 text-sm text-foreground",
|
|
66
66
|
children: messages.pagination.range({
|
|
67
67
|
from: formatter.format(from),
|
|
68
68
|
to: formatter.format(to),
|
|
@@ -70,7 +70,7 @@ function Pagination({ pageIndex, pageSize, rowCount, pageSizeOptions = DEFAULT_P
|
|
|
70
70
|
})
|
|
71
71
|
})] }), /* @__PURE__ */ jsxs("nav", {
|
|
72
72
|
"aria-label": label ?? messages.pagination.label,
|
|
73
|
-
className: "
|
|
73
|
+
className: "flex items-center gap-1.5",
|
|
74
74
|
"data-slot": "pagination-nav",
|
|
75
75
|
children: [
|
|
76
76
|
/* @__PURE__ */ jsx("button", {
|
|
@@ -78,13 +78,13 @@ function Pagination({ pageIndex, pageSize, rowCount, pageSizeOptions = DEFAULT_P
|
|
|
78
78
|
"aria-label": messages.pagination.previous,
|
|
79
79
|
disabled: currentPage <= 0,
|
|
80
80
|
onClick: () => onPageIndexChange(currentPage - 1),
|
|
81
|
-
className: cn("
|
|
81
|
+
className: cn("flex size-6 items-center justify-center rounded-sm border border-input outline-none focus-visible:ring-2 focus-visible:ring-ring/40", currentPage <= 0 && "cursor-not-allowed opacity-50"),
|
|
82
82
|
"data-slot": "pagination-previous",
|
|
83
|
-
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "
|
|
83
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-3.5" })
|
|
84
84
|
}),
|
|
85
85
|
pageItems.map((item, index) => item === "ellipsis" ? /* @__PURE__ */ jsx("span", {
|
|
86
86
|
"aria-hidden": "true",
|
|
87
|
-
className: "
|
|
87
|
+
className: "flex size-6 items-center justify-center text-sm text-muted-foreground",
|
|
88
88
|
"data-slot": "pagination-ellipsis",
|
|
89
89
|
children: "…"
|
|
90
90
|
}, `ellipsis-${index}`) : /* @__PURE__ */ jsx("button", {
|
|
@@ -92,7 +92,7 @@ function Pagination({ pageIndex, pageSize, rowCount, pageSizeOptions = DEFAULT_P
|
|
|
92
92
|
"aria-label": messages.pagination.page({ page: formatter.format(item + 1) }),
|
|
93
93
|
"aria-current": item === currentPage ? "page" : void 0,
|
|
94
94
|
onClick: () => onPageIndexChange(item),
|
|
95
|
-
className: cn("
|
|
95
|
+
className: cn("size-6 rounded-sm text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring/40", item === currentPage ? "bg-primary text-primary-foreground" : "hover:bg-accent-hover"),
|
|
96
96
|
"data-slot": "pagination-page",
|
|
97
97
|
children: item + 1
|
|
98
98
|
}, item)),
|
|
@@ -101,9 +101,9 @@ function Pagination({ pageIndex, pageSize, rowCount, pageSizeOptions = DEFAULT_P
|
|
|
101
101
|
"aria-label": messages.pagination.next,
|
|
102
102
|
disabled: currentPage >= pageCount - 1,
|
|
103
103
|
onClick: () => onPageIndexChange(currentPage + 1),
|
|
104
|
-
className: cn("
|
|
104
|
+
className: cn("flex size-6 items-center justify-center rounded-sm border border-input outline-none focus-visible:ring-2 focus-visible:ring-ring/40", currentPage >= pageCount - 1 && "cursor-not-allowed opacity-50"),
|
|
105
105
|
"data-slot": "pagination-next",
|
|
106
|
-
children: /* @__PURE__ */ jsx(ChevronRight, { className: "
|
|
106
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5" })
|
|
107
107
|
}),
|
|
108
108
|
/* @__PURE__ */ jsxs(Select, {
|
|
109
109
|
items: pageSizeItems(effectivePageSizeOptions, messages, formatter),
|
|
@@ -111,9 +111,9 @@ function Pagination({ pageIndex, pageSize, rowCount, pageSizeOptions = DEFAULT_P
|
|
|
111
111
|
onValueChange: (value) => onPageSizeChange(Number(value)),
|
|
112
112
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
113
113
|
size: "sm",
|
|
114
|
-
className: "
|
|
114
|
+
className: "w-[110px]",
|
|
115
115
|
"aria-label": messages.pagination.pageSizeLabel,
|
|
116
|
-
children: /* @__PURE__ */ jsx(SelectValue, { className: "
|
|
116
|
+
children: /* @__PURE__ */ jsx(SelectValue, { className: "flex-1 text-center" })
|
|
117
117
|
}), /* @__PURE__ */ jsx(SelectContent, { children: effectivePageSizeOptions.map((size) => /* @__PURE__ */ jsx(SelectItem, {
|
|
118
118
|
value: String(size),
|
|
119
119
|
children: messages.pagination.pageSize({ size: formatter.format(size) })
|