@arcfusionz/arc-primitive-ui 0.3.8 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AlertDialog/AlertDialog.js +6 -0
- package/dist/components/Box/Box.d.ts +3 -3
- package/dist/components/Box/Box.js +3 -2
- package/dist/components/Combobox/Combobox.js +12 -1
- package/dist/components/ContextMenu/ContextMenu.js +6 -0
- package/dist/components/Dialog/Dialog.js +12 -1
- package/dist/components/Drawer/Drawer.js +14 -1
- package/dist/components/Menu/Menu.js +12 -1
- package/dist/components/Popover/Popover.js +12 -1
- package/dist/components/Select/Select.js +12 -1
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Table/Table.js +32 -12
- package/dist/components/Toast/Toast.js +12 -1
- package/dist/components/Tooltip/Tooltip.js +16 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/styles/theme.css +5 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Box } from "../Box/Box.js";
|
|
2
3
|
import { dialogPopupVariants } from "../Dialog/Dialog.js";
|
|
3
4
|
import { forwardRef } from "react";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -67,6 +68,11 @@ const AlertDialogPopup = forwardRef(({ size = "sm", scrollBehavior = "inside", k
|
|
|
67
68
|
className: cn(viewportBaseClasses, scrollBehavior === "inside" ? viewportInsideClasses : viewportOutsideClasses),
|
|
68
69
|
children: /* @__PURE__ */ jsx(AlertDialog.Popup, {
|
|
69
70
|
ref,
|
|
71
|
+
render: /* @__PURE__ */ jsx(Box, {
|
|
72
|
+
padding: "lg",
|
|
73
|
+
radius: "lg",
|
|
74
|
+
shadow: "lg"
|
|
75
|
+
}),
|
|
70
76
|
className: cn(alertDialogPopupVariants({
|
|
71
77
|
size,
|
|
72
78
|
scrollBehavior
|
|
@@ -3,14 +3,14 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
3
3
|
//#region src/components/Box/Box.d.ts
|
|
4
4
|
type BoxBackground = "background" | "surface" | "muted" | "transparent" | "primary" | "secondary" | "hero";
|
|
5
5
|
type BoxShadow = "none" | "sm" | "md" | "lg";
|
|
6
|
-
type BoxRadius = "none" | "md" | "full";
|
|
6
|
+
type BoxRadius = "none" | "md" | "lg" | "full";
|
|
7
7
|
type BoxPadding = "none" | "sm" | "md" | "lg";
|
|
8
8
|
interface BoxVariantsOptions {
|
|
9
9
|
/** Semantic fill and its contrast-safe foreground color. */
|
|
10
10
|
background?: BoxBackground;
|
|
11
11
|
/** Elevation depth with a soft, diffused blur. All levels use Slate 400 at no more than 30% opacity. */
|
|
12
12
|
shadow?: BoxShadow;
|
|
13
|
-
/** Corner treatment.
|
|
13
|
+
/** Corner treatment. Defaults to the 12px `lg` container radius. */
|
|
14
14
|
radius?: BoxRadius;
|
|
15
15
|
/** Inset spacing around the content. */
|
|
16
16
|
padding?: BoxPadding;
|
|
@@ -26,7 +26,7 @@ interface BoxProps extends Omit<ComponentPropsWithoutRef<"div">, "className"> {
|
|
|
26
26
|
background?: BoxBackground;
|
|
27
27
|
/** Elevation depth with a soft, diffused blur. Levels `sm`/`md`/`lg` use Slate 400 at 10%/20%/30% opacity and 8px/14px/22px blur; use `none` for flat layout containers. */
|
|
28
28
|
shadow?: BoxShadow;
|
|
29
|
-
/** Corner treatment. `
|
|
29
|
+
/** Corner treatment. `lg` (default) is the ArcFusion 12px container radius; `md` is the 6px control radius. */
|
|
30
30
|
radius?: BoxRadius;
|
|
31
31
|
/** Inset spacing around the content: `none` (0), `sm` (12px), `md` (16px), or `lg` (24px). */
|
|
32
32
|
padding?: BoxPadding;
|
|
@@ -21,6 +21,7 @@ const shadowClasses = {
|
|
|
21
21
|
const radiusClasses = {
|
|
22
22
|
none: "rounded-none",
|
|
23
23
|
md: "rounded-md",
|
|
24
|
+
lg: "rounded-lg",
|
|
24
25
|
full: "rounded-full"
|
|
25
26
|
};
|
|
26
27
|
const paddingClasses = {
|
|
@@ -30,10 +31,10 @@ const paddingClasses = {
|
|
|
30
31
|
lg: "p-6"
|
|
31
32
|
};
|
|
32
33
|
/** Class list for an element styled as an ArcFusion Box frame. */
|
|
33
|
-
function boxVariants({ background = "background", shadow = "md", radius = "
|
|
34
|
+
function boxVariants({ background = "background", shadow = "md", radius = "lg", padding = "md", border = true, className } = {}) {
|
|
34
35
|
return cn(baseClasses, backgroundClasses[background], shadowClasses[shadow], radiusClasses[radius], paddingClasses[padding], border && "border border-slate-200", className);
|
|
35
36
|
}
|
|
36
|
-
const Box = forwardRef(({ background = "background", shadow = "md", radius = "
|
|
37
|
+
const Box = forwardRef(({ background = "background", shadow = "md", radius = "lg", padding = "md", border = true, render, className, ...rest }, ref) => useRender({
|
|
37
38
|
defaultTagName: "div",
|
|
38
39
|
render,
|
|
39
40
|
ref,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Box, boxVariants } from "../Box/Box.js";
|
|
2
3
|
import { inputVariants } from "../Input/Input.js";
|
|
3
4
|
import { selectTriggerVariants } from "../Select/Select.js";
|
|
4
5
|
import { createContext, forwardRef, useContext } from "react";
|
|
@@ -225,7 +226,12 @@ ComboboxTrigger.displayName = "ComboboxTrigger";
|
|
|
225
226
|
* renders no element of its own; the trigger styles the text.
|
|
226
227
|
*/
|
|
227
228
|
const ComboboxValue = Combobox.Value;
|
|
228
|
-
const popupSurfaceClasses =
|
|
229
|
+
const popupSurfaceClasses = boxVariants({
|
|
230
|
+
padding: "none",
|
|
231
|
+
radius: "md",
|
|
232
|
+
shadow: "lg",
|
|
233
|
+
className: "relative overflow-clip text-sm outline-none"
|
|
234
|
+
});
|
|
229
235
|
const popupBehaviorClasses = "flex max-h-[min(var(--combobox-max-height,9999px),var(--available-height))] flex-col min-w-[var(--anchor-width)] max-w-[var(--available-width)] origin-[var(--transform-origin)] motion-safe:transition-[scale,opacity] motion-safe:duration-150 motion-safe:ease-out data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0";
|
|
230
236
|
const listClasses = "min-h-0 scroll-py-1 overflow-y-auto overscroll-contain p-1 outline-none data-empty:p-0";
|
|
231
237
|
const statusClasses = "flex shrink-0 items-center gap-2 px-3 py-2 font-sans text-xs text-muted-foreground empty:p-0";
|
|
@@ -254,6 +260,11 @@ const ComboboxPopup = forwardRef(({ align = "center", sideOffset = 4, alignOffse
|
|
|
254
260
|
style: maxHeight != null ? { "--combobox-max-height": typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight } : void 0,
|
|
255
261
|
children: /* @__PURE__ */ jsxs(Combobox.Popup, {
|
|
256
262
|
ref,
|
|
263
|
+
render: /* @__PURE__ */ jsx(Box, {
|
|
264
|
+
padding: "none",
|
|
265
|
+
radius: "md",
|
|
266
|
+
shadow: "lg"
|
|
267
|
+
}),
|
|
257
268
|
className: cn(popupSurfaceClasses, popupBehaviorClasses, className),
|
|
258
269
|
...rest,
|
|
259
270
|
children: [
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Box } from "../Box/Box.js";
|
|
2
3
|
import { MenuCheckboxItem, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSubmenuRoot, MenuSubmenuTrigger, popupBehaviorClasses, popupSurfaceClasses } from "../Menu/Menu.js";
|
|
3
4
|
import { forwardRef } from "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -60,6 +61,11 @@ const ContextMenuPopup = forwardRef(({ side, align, sideOffset = side === void 0
|
|
|
60
61
|
className: "z-50 select-none outline-none",
|
|
61
62
|
children: /* @__PURE__ */ jsx(ContextMenu.Popup, {
|
|
62
63
|
ref,
|
|
64
|
+
render: /* @__PURE__ */ jsx(Box, {
|
|
65
|
+
padding: "none",
|
|
66
|
+
radius: "md",
|
|
67
|
+
shadow: "lg"
|
|
68
|
+
}),
|
|
63
69
|
className: cn(popupSurfaceClasses, popupBehaviorClasses, className),
|
|
64
70
|
...rest,
|
|
65
71
|
children
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Box, boxVariants } from "../Box/Box.js";
|
|
2
3
|
import { forwardRef } from "react";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { Dialog } from "@base-ui/react/dialog";
|
|
@@ -43,7 +44,12 @@ const viewportSizeClasses = {
|
|
|
43
44
|
full: "p-0"
|
|
44
45
|
};
|
|
45
46
|
const viewportOutsideClasses = "overflow-y-auto overscroll-contain py-12";
|
|
46
|
-
const popupBaseClasses =
|
|
47
|
+
const popupBaseClasses = boxVariants({
|
|
48
|
+
padding: "lg",
|
|
49
|
+
radius: "lg",
|
|
50
|
+
shadow: "lg",
|
|
51
|
+
className: "relative m-auto flex w-full flex-col gap-4 outline-none pointer-events-auto data-closed:pointer-events-none scale-[calc(1-0.05*var(--nested-dialogs))] after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:bg-slate-950/5 after:opacity-0 data-nested-dialog-open:after:opacity-100 motion-safe:transition-[opacity,scale] motion-safe:duration-150 motion-safe:ease-out motion-safe:after:transition-opacity motion-safe:after:duration-150 data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0"
|
|
52
|
+
});
|
|
47
53
|
const popupSizeClasses = {
|
|
48
54
|
sm: "max-w-sm",
|
|
49
55
|
md: "max-w-lg",
|
|
@@ -88,6 +94,11 @@ const DialogPopup = forwardRef(({ size = "md", scrollBehavior = "inside", showCl
|
|
|
88
94
|
className: cn(viewportBaseClasses, viewportSizeClasses[size], scroll === "inside" ? viewportInsideClasses : viewportOutsideClasses),
|
|
89
95
|
children: /* @__PURE__ */ jsxs(Dialog.Popup, {
|
|
90
96
|
ref,
|
|
97
|
+
render: /* @__PURE__ */ jsx(Box, {
|
|
98
|
+
padding: "lg",
|
|
99
|
+
radius: "lg",
|
|
100
|
+
shadow: "lg"
|
|
101
|
+
}),
|
|
91
102
|
className: cn(dialogPopupVariants({
|
|
92
103
|
size,
|
|
93
104
|
scrollBehavior: scroll
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Box, boxVariants } from "../Box/Box.js";
|
|
2
3
|
import { createContext, forwardRef, useContext, useMemo } from "react";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { Drawer } from "@base-ui/react/drawer";
|
|
@@ -67,7 +68,13 @@ const viewportSideClasses = {
|
|
|
67
68
|
bottom: "items-end justify-center",
|
|
68
69
|
left: "justify-start"
|
|
69
70
|
};
|
|
70
|
-
const popupBaseClasses =
|
|
71
|
+
const popupBaseClasses = boxVariants({
|
|
72
|
+
border: false,
|
|
73
|
+
padding: "none",
|
|
74
|
+
radius: "none",
|
|
75
|
+
shadow: "lg",
|
|
76
|
+
className: "pointer-events-auto relative flex flex-col border-border outline-none touch-none will-change-transform data-closed:pointer-events-none scale-[calc(1_-_0.05*var(--nested-drawers,0))] before:pointer-events-none before:absolute before:bg-inherit after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:bg-slate-950/5 after:opacity-0 data-nested-drawer-open:after:opacity-100 motion-safe:transition-[transform,scale] motion-safe:duration-[450ms] motion-safe:ease-[cubic-bezier(0.32,0.72,0,1)] motion-safe:after:transition-opacity motion-safe:after:duration-[450ms] data-swiping:select-none data-swiping:duration-0 data-ending-style:duration-[calc(var(--drawer-swipe-strength,1)*400ms)]"
|
|
77
|
+
});
|
|
71
78
|
const popupSideClasses = {
|
|
72
79
|
top: "w-full origin-top rounded-b-md border-b before:inset-x-0 before:bottom-full before:h-12 [transform:translateY(calc(var(--drawer-snap-point-offset,0px)_+_var(--drawer-swipe-movement-y,0px)))] data-starting-style:[transform:translateY(calc(-100%_-_2px))] data-ending-style:[transform:translateY(calc(-100%_-_2px))]",
|
|
73
80
|
right: "h-full origin-right border-l before:inset-y-0 before:left-full before:w-12 [transform:translateX(var(--drawer-swipe-movement-x,0px))] data-starting-style:[transform:translateX(calc(100%_+_2px))] data-ending-style:[transform:translateX(calc(100%_+_2px))]",
|
|
@@ -136,6 +143,12 @@ const DrawerPopup = forwardRef(({ size = "md", showCloseButton = true, closeLabe
|
|
|
136
143
|
className: cn(viewportBaseClasses, viewportSideClasses[side]),
|
|
137
144
|
children: /* @__PURE__ */ jsxs(Drawer.Popup, {
|
|
138
145
|
ref,
|
|
146
|
+
render: /* @__PURE__ */ jsx(Box, {
|
|
147
|
+
border: false,
|
|
148
|
+
padding: "none",
|
|
149
|
+
radius: "none",
|
|
150
|
+
shadow: "lg"
|
|
151
|
+
}),
|
|
139
152
|
className: cn(drawerPopupVariants({
|
|
140
153
|
side,
|
|
141
154
|
size
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Box, boxVariants } from "../Box/Box.js";
|
|
2
3
|
import { forwardRef } from "react";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { Menu } from "@base-ui/react/menu";
|
|
@@ -83,7 +84,12 @@ const MenuTrigger = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */
|
|
|
83
84
|
...rest
|
|
84
85
|
}));
|
|
85
86
|
MenuTrigger.displayName = "MenuTrigger";
|
|
86
|
-
const popupSurfaceClasses =
|
|
87
|
+
const popupSurfaceClasses = boxVariants({
|
|
88
|
+
padding: "none",
|
|
89
|
+
radius: "md",
|
|
90
|
+
shadow: "lg",
|
|
91
|
+
className: "p-1 text-sm outline-none"
|
|
92
|
+
});
|
|
87
93
|
const popupBehaviorClasses = "min-w-32 max-h-[var(--available-height)] max-w-[var(--available-width)] overflow-y-auto scroll-py-1 origin-[var(--transform-origin)] motion-safe:transition-[scale,opacity] motion-safe:duration-150 motion-safe:ease-out data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0 data-instant:transition-none!";
|
|
88
94
|
const adaptiveSideOffset = ({ side }) => side === "top" || side === "bottom" ? 4 : -4;
|
|
89
95
|
const adaptiveAlignOffset = ({ side }) => side === "top" || side === "bottom" ? 0 : -4;
|
|
@@ -107,6 +113,11 @@ const MenuPopup = forwardRef(({ side, align, sideOffset = side === void 0 ? adap
|
|
|
107
113
|
className: "z-50 select-none outline-none",
|
|
108
114
|
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
109
115
|
ref,
|
|
116
|
+
render: /* @__PURE__ */ jsx(Box, {
|
|
117
|
+
padding: "none",
|
|
118
|
+
radius: "md",
|
|
119
|
+
shadow: "lg"
|
|
120
|
+
}),
|
|
110
121
|
className: cn(popupSurfaceClasses, popupBehaviorClasses, className),
|
|
111
122
|
...rest,
|
|
112
123
|
children
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Box, boxVariants } from "../Box/Box.js";
|
|
2
3
|
import { forwardRef } from "react";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { Popover } from "@base-ui/react/popover";
|
|
@@ -33,7 +34,12 @@ const PopoverTrigger = forwardRef(({ className, ...rest }, ref) => /* @__PURE__
|
|
|
33
34
|
...rest
|
|
34
35
|
}));
|
|
35
36
|
PopoverTrigger.displayName = "PopoverTrigger";
|
|
36
|
-
const popupSurfaceClasses =
|
|
37
|
+
const popupSurfaceClasses = boxVariants({
|
|
38
|
+
padding: "md",
|
|
39
|
+
radius: "md",
|
|
40
|
+
shadow: "lg",
|
|
41
|
+
className: "text-sm outline-none"
|
|
42
|
+
});
|
|
37
43
|
const popupBehaviorClasses = "origin-[var(--transform-origin)] max-w-[min(20rem,var(--available-width))] motion-safe:transition-[scale,opacity] motion-safe:duration-150 motion-safe:ease-out data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0";
|
|
38
44
|
const arrowClasses = "relative block h-1.5 w-3 overflow-clip data-[side=bottom]:top-[-6px] data-[side=top]:bottom-[-6px] data-[side=top]:rotate-180 data-[side=left]:right-[-9px] data-[side=left]:rotate-90 data-[side=right]:left-[-9px] data-[side=right]:-rotate-90 before:absolute before:bottom-0 before:left-1/2 before:h-[calc(6px*sqrt(2))] before:w-[calc(6px*sqrt(2))] before:border before:border-border before:bg-background before:content-[''] before:[transform:translate(-50%,50%)_rotate(45deg)]";
|
|
39
45
|
const ARROW_PADDING = 8;
|
|
@@ -65,6 +71,11 @@ const PopoverPopup = forwardRef(({ side = "bottom", align = "center", sideOffset
|
|
|
65
71
|
className: "z-50",
|
|
66
72
|
children: /* @__PURE__ */ jsxs(Popover.Popup, {
|
|
67
73
|
ref,
|
|
74
|
+
render: /* @__PURE__ */ jsx(Box, {
|
|
75
|
+
padding: "md",
|
|
76
|
+
radius: "md",
|
|
77
|
+
shadow: "lg"
|
|
78
|
+
}),
|
|
68
79
|
className: cn(popupSurfaceClasses, popupBehaviorClasses, className),
|
|
69
80
|
...rest,
|
|
70
81
|
children: [arrow && /* @__PURE__ */ jsx(Popover.Arrow, { className: arrowClasses }), children]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Box, boxVariants } from "../Box/Box.js";
|
|
2
3
|
import { forwardRef } from "react";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { Select } from "@base-ui/react/select";
|
|
@@ -134,7 +135,12 @@ const SelectValue = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */
|
|
|
134
135
|
...rest
|
|
135
136
|
}));
|
|
136
137
|
SelectValue.displayName = "SelectValue";
|
|
137
|
-
const popupSurfaceClasses =
|
|
138
|
+
const popupSurfaceClasses = boxVariants({
|
|
139
|
+
padding: "none",
|
|
140
|
+
radius: "md",
|
|
141
|
+
shadow: "lg",
|
|
142
|
+
className: "relative overflow-clip text-sm outline-none"
|
|
143
|
+
});
|
|
138
144
|
const popupBehaviorClasses = "flex max-h-[min(var(--select-max-height,9999px),var(--available-height))] flex-col min-w-[var(--anchor-width)] max-w-[var(--available-width)] origin-[var(--transform-origin)] motion-safe:transition-[scale,opacity] motion-safe:duration-150 motion-safe:ease-out data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0";
|
|
139
145
|
const listClasses = "min-h-0 scroll-py-6 overflow-y-auto p-1";
|
|
140
146
|
const scrollArrowBaseClasses = "z-[1] flex h-6 w-full cursor-default items-center justify-center bg-background text-muted-foreground";
|
|
@@ -163,6 +169,11 @@ const SelectPopup = forwardRef(({ align = "center", sideOffset = 4, alignOffset
|
|
|
163
169
|
style: maxHeight != null ? { "--select-max-height": typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight } : void 0,
|
|
164
170
|
children: /* @__PURE__ */ jsxs(Select.Popup, {
|
|
165
171
|
ref,
|
|
172
|
+
render: /* @__PURE__ */ jsx(Box, {
|
|
173
|
+
padding: "none",
|
|
174
|
+
radius: "md",
|
|
175
|
+
shadow: "lg"
|
|
176
|
+
}),
|
|
166
177
|
className: cn(popupSurfaceClasses, popupBehaviorClasses, className),
|
|
167
178
|
...rest,
|
|
168
179
|
children: [
|
|
@@ -34,7 +34,7 @@ interface TableRowRenderState extends Record<string, unknown> {
|
|
|
34
34
|
selected: boolean;
|
|
35
35
|
}
|
|
36
36
|
interface TableContainerProps extends Omit<ComponentPropsWithoutRef<"div">, "className"> {
|
|
37
|
-
/**
|
|
37
|
+
/** Box surface around the responsive scroll area. `elevated` is the rich card default, `outline` removes depth, and `plain` keeps only overflow behavior. */
|
|
38
38
|
variant?: TableContainerVariant;
|
|
39
39
|
/** Replace the rendered `div` or inspect `{ variant }` in a render callback. Preserve a suitable grouping element. */
|
|
40
40
|
render?: useRender.RenderProp<TableContainerRenderState>;
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Box } from "../Box/Box.js";
|
|
2
3
|
import { forwardRef } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
5
|
import { useRender } from "@base-ui/react/use-render";
|
|
4
6
|
//#region src/components/Table/Table.tsx
|
|
5
7
|
const containerClasses = "relative w-full overflow-auto overscroll-x-contain";
|
|
6
|
-
const
|
|
7
|
-
plain:
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const containerVariantBoxProps = {
|
|
9
|
+
plain: {
|
|
10
|
+
background: "transparent",
|
|
11
|
+
border: false,
|
|
12
|
+
padding: "none",
|
|
13
|
+
radius: "none",
|
|
14
|
+
shadow: "none"
|
|
15
|
+
},
|
|
16
|
+
outline: {
|
|
17
|
+
background: "background",
|
|
18
|
+
border: true,
|
|
19
|
+
padding: "none",
|
|
20
|
+
radius: "lg",
|
|
21
|
+
shadow: "none"
|
|
22
|
+
},
|
|
23
|
+
elevated: {
|
|
24
|
+
background: "background",
|
|
25
|
+
border: true,
|
|
26
|
+
padding: "none",
|
|
27
|
+
radius: "lg",
|
|
28
|
+
shadow: "md"
|
|
29
|
+
}
|
|
10
30
|
};
|
|
11
31
|
const tableClasses = "w-full min-w-full border-collapse bg-background font-sans text-sm text-foreground";
|
|
12
32
|
const tableSizeClasses = {
|
|
@@ -31,15 +51,15 @@ const captionSideClasses = {
|
|
|
31
51
|
bottom: "caption-bottom border-t border-border"
|
|
32
52
|
};
|
|
33
53
|
const TableContainer = forwardRef(({ variant = "elevated", render, className, ...rest }, ref) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
54
|
+
const state = { variant };
|
|
55
|
+
const boxRender = typeof render === "function" ? (props) => render(props, state) : render;
|
|
56
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
37
57
|
ref,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
...containerVariantBoxProps[variant],
|
|
59
|
+
render: boxRender,
|
|
60
|
+
"data-variant": variant,
|
|
61
|
+
...rest,
|
|
62
|
+
className: cn(containerClasses, className)
|
|
43
63
|
});
|
|
44
64
|
});
|
|
45
65
|
TableContainer.displayName = "TableContainer";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Box, boxVariants } from "../Box/Box.js";
|
|
2
3
|
import { forwardRef } from "react";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { Toast } from "@base-ui/react/toast";
|
|
@@ -28,7 +29,12 @@ const swipeDirections = {
|
|
|
28
29
|
"bottom-center": ["down"],
|
|
29
30
|
"bottom-right": ["down", "right"]
|
|
30
31
|
};
|
|
31
|
-
const rootBaseClasses =
|
|
32
|
+
const rootBaseClasses = boxVariants({
|
|
33
|
+
padding: "none",
|
|
34
|
+
radius: "md",
|
|
35
|
+
shadow: "lg",
|
|
36
|
+
className: "[--gap:0.75rem] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))] [--height:var(--toast-frontmost-height,var(--toast-height))] absolute right-0 left-0 z-[calc(1000-var(--toast-index))] mx-auto w-full select-none h-[var(--height)] data-expanded:h-[var(--toast-height)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring data-ending-style:opacity-0 data-limited:opacity-0 after:absolute after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-[''] motion-safe:[transition:transform_0.5s_cubic-bezier(0.22,1,0.36,1),opacity_0.5s,height_0.15s] data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))] data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))] data-expanded:data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))] data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))] data-expanded:data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))] data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))] data-expanded:data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))] data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))] data-expanded:data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]"
|
|
37
|
+
});
|
|
32
38
|
const rootBottomClasses = "bottom-0 origin-bottom after:top-full [--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))] [transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))] data-starting-style:[transform:translateY(150%)] [&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]";
|
|
33
39
|
const rootTopClasses = "top-0 origin-top after:bottom-full [--offset-y:calc(var(--toast-offset-y)+(var(--toast-index)*var(--gap))+var(--toast-swipe-movement-y))] [transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+(var(--toast-index)*var(--peek))+(var(--shrink)*var(--height))))_scale(var(--scale))] data-starting-style:[transform:translateY(-150%)] [&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(-150%)]";
|
|
34
40
|
const contentClasses = "flex h-full items-start gap-3 overflow-hidden p-4 motion-safe:[transition:opacity_250ms_cubic-bezier(0.22,1,0.36,1)] data-behind:opacity-0 data-expanded:opacity-100";
|
|
@@ -258,6 +264,11 @@ function ToastList({ position, closeLabel }) {
|
|
|
258
264
|
return toasts.map((toastObject) => /* @__PURE__ */ jsx(Toast.Root, {
|
|
259
265
|
toast: toastObject,
|
|
260
266
|
swipeDirection: swipeDirections[position],
|
|
267
|
+
render: /* @__PURE__ */ jsx(Box, {
|
|
268
|
+
padding: "none",
|
|
269
|
+
radius: "md",
|
|
270
|
+
shadow: "lg"
|
|
271
|
+
}),
|
|
261
272
|
className: cn(rootBaseClasses, position.startsWith("top") ? rootTopClasses : rootBottomClasses),
|
|
262
273
|
children: /* @__PURE__ */ jsxs(Toast.Content, {
|
|
263
274
|
className: contentClasses,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Box, boxVariants } from "../Box/Box.js";
|
|
2
3
|
import { forwardRef } from "react";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { Tooltip } from "@base-ui/react/tooltip";
|
|
@@ -49,7 +50,14 @@ const TooltipTrigger = forwardRef(({ className, ...rest }, ref) => /* @__PURE__
|
|
|
49
50
|
...rest
|
|
50
51
|
}));
|
|
51
52
|
TooltipTrigger.displayName = "TooltipTrigger";
|
|
52
|
-
const popupSurfaceClasses =
|
|
53
|
+
const popupSurfaceClasses = boxVariants({
|
|
54
|
+
background: "transparent",
|
|
55
|
+
border: false,
|
|
56
|
+
padding: "none",
|
|
57
|
+
radius: "md",
|
|
58
|
+
shadow: "lg",
|
|
59
|
+
className: "bg-foreground px-3 py-1.5 text-xs text-balance text-background"
|
|
60
|
+
});
|
|
53
61
|
const popupBehaviorClasses = "origin-[var(--transform-origin)] max-w-[min(17.5rem,var(--available-width))] motion-safe:transition-[scale,opacity] motion-safe:duration-100 motion-safe:ease-out data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0 data-instant:transition-none!";
|
|
54
62
|
const arrowClasses = "relative block h-1.5 w-3 overflow-clip data-[side=bottom]:top-[-6px] data-[side=top]:bottom-[-6px] data-[side=top]:rotate-180 data-[side=left]:right-[-9px] data-[side=left]:rotate-90 data-[side=right]:left-[-9px] data-[side=right]:-rotate-90 before:absolute before:bottom-0 before:left-1/2 before:h-[calc(6px*sqrt(2))] before:w-[calc(6px*sqrt(2))] before:bg-foreground before:content-[''] before:[transform:translate(-50%,50%)_rotate(45deg)]";
|
|
55
63
|
const ARROW_PADDING = 8;
|
|
@@ -84,6 +92,13 @@ const TooltipPopup = forwardRef(({ side = "top", align = "center", sideOffset =
|
|
|
84
92
|
className: "z-50",
|
|
85
93
|
children: /* @__PURE__ */ jsxs(Tooltip.Popup, {
|
|
86
94
|
ref,
|
|
95
|
+
render: /* @__PURE__ */ jsx(Box, {
|
|
96
|
+
background: "transparent",
|
|
97
|
+
border: false,
|
|
98
|
+
padding: "none",
|
|
99
|
+
radius: "md",
|
|
100
|
+
shadow: "lg"
|
|
101
|
+
}),
|
|
87
102
|
className: cn(popupSurfaceClasses, popupBehaviorClasses, className),
|
|
88
103
|
...rest,
|
|
89
104
|
children: [arrow && /* @__PURE__ */ jsx(Tooltip.Arrow, { className: arrowClasses }), children]
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,11 @@ import { cn } from "./lib/cn.js";
|
|
|
2
2
|
import { Accordion, AccordionHeader, AccordionItem, AccordionPanel, AccordionTrigger } from "./components/Accordion/Accordion.js";
|
|
3
3
|
import { AILoader } from "./components/AILoader/AILoader.js";
|
|
4
4
|
import { Alert, alertVariants } from "./components/Alert/Alert.js";
|
|
5
|
+
import { Box, boxVariants } from "./components/Box/Box.js";
|
|
5
6
|
import { Dialog, DialogClose, DialogDescription, DialogFooter, DialogHeader, DialogPopup, DialogTitle, DialogTrigger, dialogPopupVariants } from "./components/Dialog/Dialog.js";
|
|
6
7
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogPopup, AlertDialogTitle, AlertDialogTrigger, alertDialogPopupVariants, createAlertDialogHandle } from "./components/AlertDialog/AlertDialog.js";
|
|
7
8
|
import { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarImage, avatarVariants } from "./components/Avatar/Avatar.js";
|
|
8
9
|
import { Badge, badgeVariants } from "./components/Badge/Badge.js";
|
|
9
|
-
import { Box, boxVariants } from "./components/Box/Box.js";
|
|
10
10
|
import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, breadcrumbLinkVariants } from "./components/Breadcrumb/Breadcrumb.js";
|
|
11
11
|
import { Button, buttonVariants } from "./components/Button/Button.js";
|
|
12
12
|
import { Calendar } from "./components/Calendar/Calendar.js";
|
package/package.json
CHANGED
package/src/styles/theme.css
CHANGED
|
@@ -38,12 +38,14 @@
|
|
|
38
38
|
|
|
39
39
|
/* ---------------------------------------------------------------------
|
|
40
40
|
* Radius
|
|
41
|
-
* The system uses a
|
|
42
|
-
*
|
|
43
|
-
* and `rounded-full` stay
|
|
41
|
+
* The system uses a 6px control radius and a 12px container radius.
|
|
42
|
+
* Tailwind's default radius scale is removed so only `rounded-md` and
|
|
43
|
+
* `rounded-lg` are sized options (`rounded-none` and `rounded-full` stay
|
|
44
|
+
* available for structural cases).
|
|
44
45
|
* ------------------------------------------------------------------- */
|
|
45
46
|
--radius-*: initial;
|
|
46
47
|
--radius-md: 6px;
|
|
48
|
+
--radius-lg: 12px;
|
|
47
49
|
|
|
48
50
|
/* ---------------------------------------------------------------------
|
|
49
51
|
* Motion
|