raft-ui 0.0.8 → 0.0.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/CHANGELOG.md +39 -7
- package/dist/button-jUlaK4eN.mjs +722 -0
- package/dist/index-lPUAF7fl.d.mts +267 -0
- package/dist/index.d.mts +694 -325
- package/dist/index.mjs +981 -732
- package/dist/styles.css +120 -4
- package/dist/wip.d.mts +100 -16
- package/dist/wip.mjs +255 -32
- package/package.json +3 -2
- package/dist/tv-UUMwNowu.d.mts +0 -16
- package/dist/use-theme-Y_h1DKll.mjs +0 -34
package/dist/wip.mjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { cn } from "./cn.mjs";
|
|
2
|
-
import { a as tv,
|
|
2
|
+
import { a as useThemeFamily, c as tv, t as Button$1 } from "./button-jUlaK4eN.mjs";
|
|
3
3
|
import { Dialog } from "@base-ui/react/dialog";
|
|
4
|
-
import { MessageSquare } from "lucide-react";
|
|
5
|
-
import { useCallback, useRef, useState } from "react";
|
|
4
|
+
import { MessageSquare, X } from "lucide-react";
|
|
5
|
+
import { Children, Fragment, cloneElement, isValidElement, useCallback, useRef, useState } from "react";
|
|
6
6
|
import { Button } from "@base-ui/react/button";
|
|
7
7
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
8
8
|
import { useRender } from "@base-ui/react/use-render";
|
|
9
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { Toggle } from "@base-ui/react/toggle";
|
|
11
11
|
import { ToggleGroup as ToggleGroup$1 } from "@base-ui/react/toggle-group";
|
|
12
12
|
import { useHotkey } from "@tanstack/react-hotkeys";
|
|
13
|
+
import { Drawer } from "vaul";
|
|
13
14
|
//#region src/components/toggle-group/toggle-group.tsx
|
|
14
15
|
const toggleGroup = tv({
|
|
15
16
|
slots: {
|
|
@@ -638,7 +639,7 @@ function QuotedMessageCardThread({ className, render, children = "Thread", ...pr
|
|
|
638
639
|
render,
|
|
639
640
|
props: mergeProps({
|
|
640
641
|
className: thread({ className }),
|
|
641
|
-
children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageSquare, {}), children] })
|
|
642
|
+
children: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(MessageSquare, {}), children] })
|
|
642
643
|
}, props),
|
|
643
644
|
state: { slot: "quoted-message-card-thread" }
|
|
644
645
|
});
|
|
@@ -1012,15 +1013,67 @@ const lightbox = tv({
|
|
|
1012
1013
|
actions: ["flex shrink-0 items-center gap-1.5"],
|
|
1013
1014
|
stage: ["pointer-events-none relative flex min-h-0 flex-1 items-center justify-center overflow-hidden"],
|
|
1014
1015
|
media: ["pointer-events-auto max-h-[80vh] max-w-[86vw] border-2"],
|
|
1016
|
+
navigationButton: [
|
|
1017
|
+
"pointer-events-auto absolute z-10 inline-flex items-center justify-center",
|
|
1018
|
+
"border-2 border-line-strong bg-layer-panel text-foreground-strong shadow-sm",
|
|
1019
|
+
"transition-[background-color,color,opacity,box-shadow,transform] duration-150",
|
|
1020
|
+
"outline outline-[1px] outline-offset-2 outline-transparent",
|
|
1021
|
+
"focus-visible:outline-foreground-strong",
|
|
1022
|
+
"data-[disabled=true]:cursor-default",
|
|
1023
|
+
"[&_svg]:pointer-events-none [&_svg]:size-6 [&_svg]:shrink-0"
|
|
1024
|
+
],
|
|
1025
|
+
infoBar: [
|
|
1026
|
+
"pointer-events-auto flex min-w-0 items-center",
|
|
1027
|
+
"bg-layer-panel text-foreground-strong",
|
|
1028
|
+
"shadow-[0_12px_32px_-18px_oklch(0_0_0_/_0.55)]"
|
|
1029
|
+
],
|
|
1030
|
+
infoTitle: ["min-w-0 flex-1 truncate font-heading text-sm font-bold"],
|
|
1031
|
+
infoActions: ["flex shrink-0 items-center gap-1.5"],
|
|
1015
1032
|
close: []
|
|
1016
1033
|
},
|
|
1017
1034
|
variants: { theme: {
|
|
1018
1035
|
brutal: {
|
|
1019
|
-
header: ["
|
|
1036
|
+
header: ["bg-transparent shadow-none"],
|
|
1020
1037
|
title: ["text-foreground-strong"],
|
|
1021
|
-
media: ["border-line-strong bg-layer-panel shadow-xl"]
|
|
1038
|
+
media: ["border-line-strong bg-layer-panel shadow-xl"],
|
|
1039
|
+
navigationButton: [
|
|
1040
|
+
"size-8 rounded-none",
|
|
1041
|
+
"hover:bg-layer-panel data-[disabled=true]:text-black/35",
|
|
1042
|
+
"[&_svg]:size-6"
|
|
1043
|
+
],
|
|
1044
|
+
infoBar: [
|
|
1045
|
+
"w-[clamp(9rem,20vw,14rem)] max-w-[calc(100vw-3rem)] min-w-[9rem]",
|
|
1046
|
+
"gap-2 rounded-none border-2 border-black py-0.5 pr-0.5 pl-2.5 shadow-[var(--shadow)]",
|
|
1047
|
+
"[&_[data-slot=button]_svg]:stroke-2"
|
|
1048
|
+
],
|
|
1049
|
+
infoTitle: ["text-xs text-black"]
|
|
1022
1050
|
},
|
|
1023
|
-
elegant: {
|
|
1051
|
+
elegant: {
|
|
1052
|
+
backdrop: ["bg-[oklch(0_0_0_/_0.72)] backdrop-blur-[2px]"],
|
|
1053
|
+
header: ["bg-transparent shadow-none"],
|
|
1054
|
+
title: ["font-sans font-medium text-foreground-strong"],
|
|
1055
|
+
actions: ["gap-2"],
|
|
1056
|
+
media: ["border border-line-subtle bg-layer-panel shadow-none"],
|
|
1057
|
+
navigationButton: [
|
|
1058
|
+
"size-8 rounded-full border-0",
|
|
1059
|
+
"bg-white/75 backdrop-blur-md",
|
|
1060
|
+
"text-foreground-muted",
|
|
1061
|
+
"shadow-none",
|
|
1062
|
+
"hover:bg-white/85 hover:text-foreground-strong",
|
|
1063
|
+
"active:scale-[0.97]",
|
|
1064
|
+
"data-[disabled=true]:bg-white/35 data-[disabled=true]:text-black/30 data-[disabled=true]:shadow-none",
|
|
1065
|
+
"data-[disabled=true]:hover:bg-white/35 data-[disabled=true]:active:scale-100",
|
|
1066
|
+
"[&_svg]:size-5"
|
|
1067
|
+
],
|
|
1068
|
+
infoBar: [
|
|
1069
|
+
"w-[clamp(9rem,20vw,14rem)] max-w-[calc(100vw-3rem)] min-w-[9rem]",
|
|
1070
|
+
"gap-2 rounded py-0.5 pr-0.5 pl-2.5",
|
|
1071
|
+
"bg-[rgba(245,245,245,0.8)] text-neutral-900 shadow-none backdrop-blur-[10px]",
|
|
1072
|
+
"[&_[data-slot=button]]:text-neutral-600 [&_[data-slot=button]]:hover:bg-neutral-900/10 [&_[data-slot=button]]:hover:text-neutral-800"
|
|
1073
|
+
],
|
|
1074
|
+
infoTitle: ["font-sans text-xs font-medium text-neutral-800"],
|
|
1075
|
+
infoActions: ["gap-1"]
|
|
1076
|
+
}
|
|
1024
1077
|
} }
|
|
1025
1078
|
});
|
|
1026
1079
|
function Lightbox({ closeOnModW = true, defaultOpen = false, modal = true, onOpenChange, open, children, ...props }) {
|
|
@@ -1066,12 +1119,15 @@ function LightboxPortal(props) {
|
|
|
1066
1119
|
});
|
|
1067
1120
|
}
|
|
1068
1121
|
function LightboxContent({ className, initialFocus = false, finalFocus = false, ...props }) {
|
|
1069
|
-
const
|
|
1122
|
+
const theme = useThemeFamily();
|
|
1123
|
+
const { backdrop, content } = lightbox({ theme });
|
|
1070
1124
|
return /* @__PURE__ */ jsxs(LightboxPortal, { children: [/* @__PURE__ */ jsx(Dialog.Backdrop, {
|
|
1071
1125
|
"data-slot": "lightbox-backdrop",
|
|
1126
|
+
"data-theme": theme,
|
|
1072
1127
|
className: backdrop()
|
|
1073
1128
|
}), /* @__PURE__ */ jsx(Dialog.Popup, {
|
|
1074
1129
|
"data-slot": "lightbox-content",
|
|
1130
|
+
"data-theme": theme,
|
|
1075
1131
|
initialFocus,
|
|
1076
1132
|
finalFocus,
|
|
1077
1133
|
className: content({ className }),
|
|
@@ -1123,6 +1179,56 @@ function LightboxMedia({ render, className, ...props }) {
|
|
|
1123
1179
|
state: { slot: "lightbox-media" }
|
|
1124
1180
|
});
|
|
1125
1181
|
}
|
|
1182
|
+
function LightboxNavigationButton({ className, direction, disabled, onClick, type = "button", ...props }) {
|
|
1183
|
+
const { navigationButton } = lightbox({ theme: useThemeFamily() });
|
|
1184
|
+
const handleClick = useCallback((event) => {
|
|
1185
|
+
event.stopPropagation();
|
|
1186
|
+
if (disabled) {
|
|
1187
|
+
event.preventDefault();
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
onClick?.(event);
|
|
1191
|
+
}, [disabled, onClick]);
|
|
1192
|
+
return /* @__PURE__ */ jsx(Button$1, {
|
|
1193
|
+
"aria-disabled": disabled,
|
|
1194
|
+
className: navigationButton({ className: cn(direction === "previous" ? "left-8" : "right-8", className) }),
|
|
1195
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
1196
|
+
"data-slot": "lightbox-navigation-button",
|
|
1197
|
+
"data-direction": direction,
|
|
1198
|
+
onClick: handleClick,
|
|
1199
|
+
size: "icon-lg",
|
|
1200
|
+
type,
|
|
1201
|
+
variant: "outline",
|
|
1202
|
+
...props
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
function LightboxInfoBar({ render, className, ...props }) {
|
|
1206
|
+
const { infoBar } = lightbox({ theme: useThemeFamily() });
|
|
1207
|
+
return useRender({
|
|
1208
|
+
defaultTagName: "div",
|
|
1209
|
+
render,
|
|
1210
|
+
props: mergeProps({ className: infoBar({ className }) }, props),
|
|
1211
|
+
state: { slot: "lightbox-info-bar" }
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
function LightboxInfoTitle({ render, className, ...props }) {
|
|
1215
|
+
const { infoTitle } = lightbox({ theme: useThemeFamily() });
|
|
1216
|
+
return useRender({
|
|
1217
|
+
defaultTagName: "div",
|
|
1218
|
+
render,
|
|
1219
|
+
props: mergeProps({ className: infoTitle({ className }) }, props),
|
|
1220
|
+
state: { slot: "lightbox-info-title" }
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
function LightboxInfoActions({ render, className, ...props }) {
|
|
1224
|
+
const { infoActions } = lightbox({ theme: useThemeFamily() });
|
|
1225
|
+
return useRender({
|
|
1226
|
+
defaultTagName: "div",
|
|
1227
|
+
render,
|
|
1228
|
+
props: mergeProps({ className: infoActions({ className }) }, props),
|
|
1229
|
+
state: { slot: "lightbox-info-actions" }
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1126
1232
|
function LightboxClose({ className, ...props }) {
|
|
1127
1233
|
const { close } = lightbox({ theme: useThemeFamily() });
|
|
1128
1234
|
return /* @__PURE__ */ jsx(Dialog.Close, {
|
|
@@ -1135,45 +1241,133 @@ function LightboxClose({ className, ...props }) {
|
|
|
1135
1241
|
//#region src/components/bottom-sheet/bottom-sheet.tsx
|
|
1136
1242
|
const bottomSheet = tv({
|
|
1137
1243
|
slots: {
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1244
|
+
portal: [],
|
|
1245
|
+
overlay: ["fixed inset-0 z-50", "![animation-duration:0.2s]"],
|
|
1246
|
+
positioner: ["contents"],
|
|
1247
|
+
content: [
|
|
1248
|
+
"fixed z-50 flex h-auto flex-col outline-none",
|
|
1249
|
+
"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 md:data-[vaul-drawer-direction=bottom]:inset-x-3",
|
|
1250
|
+
"data-[vaul-drawer-direction=bottom]:mx-auto data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:min-h-64 data-[vaul-drawer-direction=bottom]:max-h-[82vh] data-[vaul-drawer-direction=bottom]:max-w-lg md:data-[vaul-drawer-direction=bottom]:max-w-md",
|
|
1251
|
+
"data-[vaul-drawer-direction=top]:inset-x-3 data-[vaul-drawer-direction=top]:top-3",
|
|
1252
|
+
"data-[vaul-drawer-direction=top]:mx-auto data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:max-w-md",
|
|
1253
|
+
"data-[vaul-drawer-direction=left]:inset-y-3 data-[vaul-drawer-direction=left]:left-3 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:max-w-sm",
|
|
1254
|
+
"data-[vaul-drawer-direction=right]:inset-y-3 data-[vaul-drawer-direction=right]:right-3 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:max-w-sm",
|
|
1255
|
+
"!duration-200 ![animation-duration:0.2s]"
|
|
1256
|
+
],
|
|
1257
|
+
header: ["flex flex-col items-center px-6 pt-8 pb-2 text-center"],
|
|
1258
|
+
body: ["flex flex-1 flex-col items-center px-6 pt-4 pb-6 text-center"],
|
|
1259
|
+
footer: ["mt-auto px-6 py-5 md:pb-11"],
|
|
1260
|
+
actions: ["mx-auto w-full items-center justify-center gap-2.5", "[&_[data-slot=button]]:w-full"],
|
|
1261
|
+
title: ["max-w-sm text-pretty text-center text-2xl leading-8 text-foreground-strong"],
|
|
1262
|
+
description: ["max-w-sm text-pretty text-center text-sm leading-5 text-foreground/60"]
|
|
1143
1263
|
},
|
|
1144
1264
|
variants: { theme: {
|
|
1145
|
-
brutal: {
|
|
1146
|
-
|
|
1265
|
+
brutal: {
|
|
1266
|
+
overlay: ["bg-layer-backdrop"],
|
|
1267
|
+
title: ["font-bold"],
|
|
1268
|
+
content: [
|
|
1269
|
+
"border-2 border-black bg-white text-black shadow-[var(--shadow-lg)]",
|
|
1270
|
+
"data-[vaul-drawer-direction=bottom]:border-x-0 md:data-[vaul-drawer-direction=bottom]:border-x-2",
|
|
1271
|
+
"data-[vaul-drawer-direction=bottom]:border-b-0 md:data-[vaul-drawer-direction=bottom]:border-b-2"
|
|
1272
|
+
]
|
|
1273
|
+
},
|
|
1274
|
+
elegant: {
|
|
1275
|
+
overlay: ["bg-layer-backdrop backdrop-blur-[2px]"],
|
|
1276
|
+
content: [
|
|
1277
|
+
"overflow-clip rounded-lg bg-layer-popover text-foreground shadow-xl md:rounded-xl",
|
|
1278
|
+
"data-[vaul-drawer-direction=bottom]:rounded-b-none",
|
|
1279
|
+
"md:data-[vaul-drawer-direction=bottom]:max-w-md",
|
|
1280
|
+
"md:data-[vaul-drawer-direction=top]:max-w-md",
|
|
1281
|
+
"md:data-[vaul-drawer-direction=left]:max-w-md",
|
|
1282
|
+
"md:data-[vaul-drawer-direction=right]:max-w-md"
|
|
1283
|
+
],
|
|
1284
|
+
header: ["bg-white px-8 pt-9 pb-2"],
|
|
1285
|
+
body: ["bg-white px-8 pt-4 pb-7"],
|
|
1286
|
+
footer: ["mt-0 px-8 py-5 md:pb-11"],
|
|
1287
|
+
actions: ["flex w-fit max-w-none flex-row justify-center", "[&_[data-slot=button]]:w-auto"],
|
|
1288
|
+
title: ["font-sans text-2xl leading-8 font-semibold text-[oklch(0.22_0_0)]"],
|
|
1289
|
+
description: ["font-sans text-sm leading-5 text-[oklch(0.48_0_0)]"]
|
|
1290
|
+
}
|
|
1147
1291
|
} }
|
|
1148
1292
|
});
|
|
1149
|
-
function BottomSheet(props) {
|
|
1150
|
-
return /* @__PURE__ */ jsx(
|
|
1293
|
+
function BottomSheet({ direction = "bottom", ...props }) {
|
|
1294
|
+
return /* @__PURE__ */ jsx(Drawer.Root, {
|
|
1295
|
+
direction,
|
|
1296
|
+
...props
|
|
1297
|
+
});
|
|
1151
1298
|
}
|
|
1152
|
-
function BottomSheetTrigger(props) {
|
|
1153
|
-
return /* @__PURE__ */ jsx(
|
|
1299
|
+
function BottomSheetTrigger({ children, render, ...props }) {
|
|
1300
|
+
if (render) return /* @__PURE__ */ jsx(Drawer.Trigger, {
|
|
1301
|
+
"data-slot": "bottom-sheet-trigger",
|
|
1302
|
+
asChild: true,
|
|
1303
|
+
...props,
|
|
1304
|
+
children: cloneElement(render, void 0, children ?? render.props.children)
|
|
1305
|
+
});
|
|
1306
|
+
return /* @__PURE__ */ jsx(Drawer.Trigger, {
|
|
1154
1307
|
"data-slot": "bottom-sheet-trigger",
|
|
1308
|
+
...props,
|
|
1309
|
+
children
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
function BottomSheetPortal({ className, children, ...props }) {
|
|
1313
|
+
const portalChildren = Children.map(children, (child) => {
|
|
1314
|
+
if (isValidElement(child) && child.type === BottomSheetPositioner) return Children.map(child.props.children, (positionerChild) => withPortalClassName(positionerChild, className));
|
|
1315
|
+
return withPortalClassName(child, className);
|
|
1316
|
+
});
|
|
1317
|
+
return /* @__PURE__ */ jsx(Drawer.Portal, {
|
|
1318
|
+
...props,
|
|
1319
|
+
children: portalChildren
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
function withPortalClassName(child, className) {
|
|
1323
|
+
if (!className || !isValidElement(child)) return child;
|
|
1324
|
+
return cloneElement(child, { className: cn(child.props.className, className) });
|
|
1325
|
+
}
|
|
1326
|
+
function BottomSheetPositioner({ className, ...props }) {
|
|
1327
|
+
const { positioner } = bottomSheet({ theme: useThemeFamily() });
|
|
1328
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1329
|
+
"data-slot": "bottom-sheet-positioner",
|
|
1330
|
+
className: positioner({ className }),
|
|
1155
1331
|
...props
|
|
1156
1332
|
});
|
|
1157
1333
|
}
|
|
1158
|
-
function
|
|
1159
|
-
|
|
1160
|
-
|
|
1334
|
+
function BottomSheetOverlay({ className, ...props }) {
|
|
1335
|
+
const theme = useThemeFamily();
|
|
1336
|
+
const { overlay } = bottomSheet({ theme });
|
|
1337
|
+
return /* @__PURE__ */ jsx(Drawer.Overlay, {
|
|
1338
|
+
"data-slot": "bottom-sheet-overlay",
|
|
1339
|
+
"data-theme": theme,
|
|
1340
|
+
className: overlay({ className }),
|
|
1161
1341
|
...props
|
|
1162
1342
|
});
|
|
1163
1343
|
}
|
|
1164
1344
|
function BottomSheetContent({ className, ...props }) {
|
|
1165
1345
|
const { content } = bottomSheet({ theme: useThemeFamily() });
|
|
1166
|
-
return /* @__PURE__ */ jsx(
|
|
1346
|
+
return /* @__PURE__ */ jsx(Drawer.Content, {
|
|
1167
1347
|
"data-slot": "bottom-sheet-content",
|
|
1168
|
-
"data-side": "bottom",
|
|
1169
1348
|
className: content({ className }),
|
|
1170
1349
|
...props
|
|
1171
|
-
})
|
|
1350
|
+
});
|
|
1172
1351
|
}
|
|
1173
|
-
function BottomSheetClose(props) {
|
|
1174
|
-
|
|
1352
|
+
function BottomSheetClose({ className, variant, size, children, render, ...props }) {
|
|
1353
|
+
const isBrutal = useThemeFamily() === "brutal";
|
|
1354
|
+
if (render) return /* @__PURE__ */ jsx(Drawer.Close, {
|
|
1175
1355
|
"data-slot": "bottom-sheet-close",
|
|
1176
|
-
|
|
1356
|
+
asChild: true,
|
|
1357
|
+
...props,
|
|
1358
|
+
children: cloneElement(render, void 0, children ?? render.props.children)
|
|
1359
|
+
});
|
|
1360
|
+
return /* @__PURE__ */ jsx(Drawer.Close, {
|
|
1361
|
+
"data-slot": "bottom-sheet-close",
|
|
1362
|
+
asChild: true,
|
|
1363
|
+
...props,
|
|
1364
|
+
children: /* @__PURE__ */ jsx(Button$1, {
|
|
1365
|
+
variant: variant ?? (isBrutal ? "outline" : "ghost"),
|
|
1366
|
+
size: size ?? (isBrutal ? "icon-sm" : "icon-sm"),
|
|
1367
|
+
"aria-label": "Close",
|
|
1368
|
+
className: cn(isBrutal ? "absolute top-3 right-3" : "absolute top-4 right-6", isBrutal ? "bg-white" : "p-0 text-foreground-placeholder hover:bg-transparent hover:text-foreground", className),
|
|
1369
|
+
children: children ?? /* @__PURE__ */ jsx(X, { className: "size-4" })
|
|
1370
|
+
})
|
|
1177
1371
|
});
|
|
1178
1372
|
}
|
|
1179
1373
|
function BottomSheetHeader({ className, render, ...props }) {
|
|
@@ -1194,9 +1388,38 @@ function BottomSheetFooter({ className, render, ...props }) {
|
|
|
1194
1388
|
state: { slot: "bottom-sheet-footer" }
|
|
1195
1389
|
});
|
|
1196
1390
|
}
|
|
1391
|
+
function BottomSheetBody({ className, render, ...props }) {
|
|
1392
|
+
const { body } = bottomSheet({ theme: useThemeFamily() });
|
|
1393
|
+
return useRender({
|
|
1394
|
+
defaultTagName: "div",
|
|
1395
|
+
render,
|
|
1396
|
+
props: mergeProps({ className: body({ className }) }, props),
|
|
1397
|
+
state: { slot: "bottom-sheet-body" }
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
function BottomSheetActions({ className, render, children, ...props }) {
|
|
1401
|
+
const theme = useThemeFamily();
|
|
1402
|
+
const { actions } = bottomSheet({ theme });
|
|
1403
|
+
const count = Math.min(3, countActionChildren(children));
|
|
1404
|
+
return useRender({
|
|
1405
|
+
defaultTagName: "div",
|
|
1406
|
+
render,
|
|
1407
|
+
props: mergeProps({
|
|
1408
|
+
className: actions({ className: cn(theme === "elegant" ? "flex-row" : count <= 1 ? "flex max-w-64 flex-col" : count === 2 ? "flex max-w-64 flex-col-reverse" : "grid max-w-[32rem] grid-cols-3", className) }),
|
|
1409
|
+
children
|
|
1410
|
+
}, props),
|
|
1411
|
+
state: { slot: "bottom-sheet-actions" }
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
function countActionChildren(children) {
|
|
1415
|
+
return Children.toArray(children).reduce((count, child) => {
|
|
1416
|
+
if (isValidElement(child) && child.type === Fragment) return count + countActionChildren(child.props.children);
|
|
1417
|
+
return count + 1;
|
|
1418
|
+
}, 0);
|
|
1419
|
+
}
|
|
1197
1420
|
function BottomSheetTitle({ className, ...props }) {
|
|
1198
1421
|
const { title } = bottomSheet({ theme: useThemeFamily() });
|
|
1199
|
-
return /* @__PURE__ */ jsx(
|
|
1422
|
+
return /* @__PURE__ */ jsx(Drawer.Title, {
|
|
1200
1423
|
"data-slot": "bottom-sheet-title",
|
|
1201
1424
|
className: title({ className }),
|
|
1202
1425
|
...props
|
|
@@ -1204,11 +1427,11 @@ function BottomSheetTitle({ className, ...props }) {
|
|
|
1204
1427
|
}
|
|
1205
1428
|
function BottomSheetDescription({ className, ...props }) {
|
|
1206
1429
|
const { description } = bottomSheet({ theme: useThemeFamily() });
|
|
1207
|
-
return /* @__PURE__ */ jsx(
|
|
1430
|
+
return /* @__PURE__ */ jsx(Drawer.Description, {
|
|
1208
1431
|
"data-slot": "bottom-sheet-description",
|
|
1209
1432
|
className: description({ className }),
|
|
1210
1433
|
...props
|
|
1211
1434
|
});
|
|
1212
1435
|
}
|
|
1213
1436
|
//#endregion
|
|
1214
|
-
export { BottomSheet, BottomSheetClose, BottomSheetContent, BottomSheetDescription, BottomSheetFooter, BottomSheetHeader, BottomSheetPortal, BottomSheetTitle, BottomSheetTrigger, ConversationPreviewCard, ConversationPreviewCardAction, ConversationPreviewCardAuthor, ConversationPreviewCardAuthorName, ConversationPreviewCardAuthorSubtitle, ConversationPreviewCardChannel, ConversationPreviewCardContent, ConversationPreviewCardFooter, ConversationPreviewCardMeta, ConversationPreviewCardPreview, ConversationPreviewCardPreviewAuthor, ConversationPreviewCardPreviewLeading, ConversationPreviewCardSecondaryPreview, ConversationPreviewCardTimestamp, DescriptionAction, DescriptionDetails, DescriptionItem, DescriptionList, DescriptionTerm, Lightbox, LightboxActions, LightboxClose, LightboxContent, LightboxHeader, LightboxMedia, LightboxPortal, LightboxStage, LightboxTitle, LightboxTrigger, ListItem, ListItemActionGroup, ListItemBody, ListItemDescription, ListItemIcon, ListItemMeta, ListItemRow, ListItemTitle, MediaListItem, MediaListItemActionGroup, MediaListItemAside, MediaListItemBody, MediaListItemSubtitle, MediaListItemText, MediaListItemTitle, MediaListItemVisual, PanelHeader, PanelHeaderActions, PanelHeaderContent, PanelHeaderIcon, PanelHeaderSubtitle, PanelHeaderSuffix, PanelHeaderTitle, PanelHeaderTitleRow, PanelHeaderVisual, PreviewShell, QuotedMessageCard, QuotedMessageCardAttachments, QuotedMessageCardAuthor, QuotedMessageCardAuthorName, QuotedMessageCardAuthorSubtitle, QuotedMessageCardBody, QuotedMessageCardChannel, QuotedMessageCardContent, QuotedMessageCardContentWrap, QuotedMessageCardHeader, QuotedMessageCardMeta, QuotedMessageCardSeparator, QuotedMessageCardTag, QuotedMessageCardThread, QuotedMessageCardTimestamp, QuotedMessageCardUnavailable, SectionHeader, SectionHeaderActions, SectionHeaderContent, SectionHeaderCount, SectionHeaderIcon, SectionHeaderTitle, SectionLabel, ToggleGroup, ToggleGroupCount, ToggleGroupItem, ToggleGroupLabel };
|
|
1437
|
+
export { BottomSheet, BottomSheetActions, BottomSheetBody, BottomSheetClose, BottomSheetContent, BottomSheetDescription, BottomSheetFooter, BottomSheetHeader, BottomSheetOverlay, BottomSheetPortal, BottomSheetPositioner, BottomSheetTitle, BottomSheetTrigger, ConversationPreviewCard, ConversationPreviewCardAction, ConversationPreviewCardAuthor, ConversationPreviewCardAuthorName, ConversationPreviewCardAuthorSubtitle, ConversationPreviewCardChannel, ConversationPreviewCardContent, ConversationPreviewCardFooter, ConversationPreviewCardMeta, ConversationPreviewCardPreview, ConversationPreviewCardPreviewAuthor, ConversationPreviewCardPreviewLeading, ConversationPreviewCardSecondaryPreview, ConversationPreviewCardTimestamp, DescriptionAction, DescriptionDetails, DescriptionItem, DescriptionList, DescriptionTerm, Lightbox, LightboxActions, LightboxClose, LightboxContent, LightboxHeader, LightboxInfoActions, LightboxInfoBar, LightboxInfoTitle, LightboxMedia, LightboxNavigationButton, LightboxPortal, LightboxStage, LightboxTitle, LightboxTrigger, ListItem, ListItemActionGroup, ListItemBody, ListItemDescription, ListItemIcon, ListItemMeta, ListItemRow, ListItemTitle, MediaListItem, MediaListItemActionGroup, MediaListItemAside, MediaListItemBody, MediaListItemSubtitle, MediaListItemText, MediaListItemTitle, MediaListItemVisual, PanelHeader, PanelHeaderActions, PanelHeaderContent, PanelHeaderIcon, PanelHeaderSubtitle, PanelHeaderSuffix, PanelHeaderTitle, PanelHeaderTitleRow, PanelHeaderVisual, PreviewShell, QuotedMessageCard, QuotedMessageCardAttachments, QuotedMessageCardAuthor, QuotedMessageCardAuthorName, QuotedMessageCardAuthorSubtitle, QuotedMessageCardBody, QuotedMessageCardChannel, QuotedMessageCardContent, QuotedMessageCardContentWrap, QuotedMessageCardHeader, QuotedMessageCardMeta, QuotedMessageCardSeparator, QuotedMessageCardTag, QuotedMessageCardThread, QuotedMessageCardTimestamp, QuotedMessageCardUnavailable, SectionHeader, SectionHeaderActions, SectionHeaderContent, SectionHeaderCount, SectionHeaderIcon, SectionHeaderTitle, SectionLabel, ToggleGroup, ToggleGroupCount, ToggleGroupItem, ToggleGroupLabel };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "raft-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "React UI components for Raft.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
"cnfast": "^0.0.7",
|
|
42
42
|
"foxact": "^0.3.7",
|
|
43
43
|
"lucide-react": "^1.21.0",
|
|
44
|
-
"tailwind-variants": "^3.2.2"
|
|
44
|
+
"tailwind-variants": "^3.2.2",
|
|
45
|
+
"vaul": "^1.1.2"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@types/node": "^26.0.0",
|
package/dist/tv-UUMwNowu.d.mts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { VariantProps } from "tailwind-variants/lite";
|
|
2
|
-
|
|
3
|
-
//#region src/lib/styled-props.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Base UI components type `className` as `string | ((state) => string)`, but our
|
|
6
|
-
* tv() recipes only accept a plain string. `StyledProps` narrows a Base UI
|
|
7
|
-
* component's props to a string `className` so they can flow into a recipe.
|
|
8
|
-
*
|
|
9
|
-
* The state-callback form is intentionally dropped: our components express every
|
|
10
|
-
* state through `data-*` variants in the recipe, so a caller never needs it.
|
|
11
|
-
*/
|
|
12
|
-
type StyledProps<P> = Omit<P, "className"> & {
|
|
13
|
-
className?: string;
|
|
14
|
-
};
|
|
15
|
-
//#endregion
|
|
16
|
-
export { StyledProps as n, VariantProps as t };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { cn } from "cnfast";
|
|
2
|
-
import { tv } from "tailwind-variants/lite";
|
|
3
|
-
import { createContext, use } from "react";
|
|
4
|
-
//#region src/lib/tv.ts
|
|
5
|
-
const tv$1 = ((options) => {
|
|
6
|
-
const recipe = tv(options);
|
|
7
|
-
const wrappedRecipe = ((props) => {
|
|
8
|
-
const result = recipe(props);
|
|
9
|
-
if (typeof result === "string") return cn(result);
|
|
10
|
-
return Object.fromEntries(Object.entries(result).map(([slotName, slot]) => [slotName, (slotProps) => cn(slot(slotProps))]));
|
|
11
|
-
});
|
|
12
|
-
return Object.assign(wrappedRecipe, recipe);
|
|
13
|
-
});
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/lib/theme/theme-context.ts
|
|
16
|
-
const ThemeContext = createContext("brutal");
|
|
17
|
-
const ThemeStateContext = createContext({
|
|
18
|
-
theme: "brutal",
|
|
19
|
-
setTheme: () => void 0,
|
|
20
|
-
mode: "light",
|
|
21
|
-
resolvedMode: "light"
|
|
22
|
-
});
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/lib/theme/use-theme.ts
|
|
25
|
-
/** Read the active style family for theme-aware component recipes. */
|
|
26
|
-
function useThemeFamily() {
|
|
27
|
-
return use(ThemeContext);
|
|
28
|
-
}
|
|
29
|
-
/** Read and update the application-level RUI theme selection. */
|
|
30
|
-
function useTheme() {
|
|
31
|
-
return use(ThemeStateContext);
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
export { tv$1 as a, ThemeStateContext as i, useThemeFamily as n, ThemeContext as r, useTheme as t };
|