@botiverse/raft-ui 0.10.4 → 0.10.5

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/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { cn } from "./cn.mjs";
2
- import { C as ThemeStateContext, S as useTheme, _ as defaultNativeButton, a as DialogDescription, b as resolveThemeScopeProps, c as DialogNav, d as DialogSurface, f as DialogTitle, g as Spinner, h as buttonVariants, i as DialogContent, l as DialogOverlay, m as Button, n as DialogBody, o as DialogFooter, p as DialogTrigger, r as DialogClose, s as DialogHeader, t as Dialog, u as DialogPortal, v as useParentOverlayKind, w as tv, x as useThemeScopeProps, y as withOverlayLayer } from "./dialog-CDPAT3DH.mjs";
2
+ import { A as buttonVariants, C as DialogNav, D as DialogTitle, E as DialogSurface, F as resolveThemeScopeProps, I as useThemeScopeProps, L as useTheme, M as defaultNativeButton, N as useParentOverlayKind, O as DialogTrigger, P as withOverlayLayer, R as ThemeStateContext, S as DialogHeader, T as DialogPortal, _ as DialogBody, a as DrawerContent, b as DialogDescription, c as DrawerHeader, d as DrawerTitle, f as DrawerTrigger, g as Dialog, h as panelHeader, i as DrawerClose, j as Spinner, k as Button, l as DrawerOverlay, m as panelHeadEdges, n as DrawerActions, o as DrawerDescription, p as panelHeadActions, r as DrawerBody, s as DrawerFooter, t as Drawer, u as DrawerPortal, v as DialogClose, w as DialogOverlay, x as DialogFooter, y as DialogContent, z as tv } from "./drawer-yZD16Ybl.mjs";
3
3
  import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
4
4
  import { AlertTriangle, Bell, Check, CheckCircle2, ChevronDown, ChevronLeft, ChevronRight, Copy, FileText, Image, Info, Minus, Upload, X, Zap } from "lucide-react";
5
5
  import { Children, Fragment, cloneElement, createContext, isValidElement, use, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
@@ -7,7 +7,6 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { Button as Button$1 } from "@base-ui/react/button";
8
8
  import { mergeProps } from "@base-ui/react/merge-props";
9
9
  import { useRender } from "@base-ui/react/use-render";
10
- import { Drawer as Drawer$1 } from "@base-ui/react/drawer";
11
10
  import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
12
11
  import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
13
12
  import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
@@ -173,449 +172,6 @@ function AlertDialogCancel({ className, variant, size, ...props }) {
173
172
  });
174
173
  }
175
174
  //#endregion
176
- //#region src/components/panel/panel-header.recipe.ts
177
- /**
178
- * Where a head's edge controls sit, shared by every head (panel, section,
179
- * drawer, thread). Phone: a filled thing (a sticker, a pill) puts its shape
180
- * on 16. A ghost button has no shape, so its empty 44px box overhangs, and
181
- * the two edge buttons mirror each other: the last action (6px padding,
182
- * `panelHeadActions`' -3px) and a leading Back (16px padding, -13px) both sit
183
- * 3px from their edge. Their 22px icon frames are then 14px in and every
184
- * glyph's centre 25px in, whatever the glyph (an arrow, a gear, a narrow ⋮);
185
- * aligning ink instead would move each button by its glyph's own side
186
- * bearing. A Button straight in the head (ghost ones are PanelActions) is a
187
- * filled control, so its shape ends on the content edge: 20 / 16.
188
- */
189
- const panelHeadEdges = [
190
- "pr-3 pl-5 max-md:pr-1.5 max-md:pl-4",
191
- "max-md:[&>[data-slot=panel-action]:first-child]:-ml-[13px]",
192
- "[&>[data-slot=button]:last-child]:mr-2 max-md:[&>[data-slot=button]:last-child]:mr-2.5"
193
- ];
194
- /**
195
- * A head's trailing actions. The last glyph ends on the head's edge: 20px on
196
- * desktop (12px of padding, 1px here, the 32px button's 7px glyph inset); on
197
- * a phone 14px in (44px buttons, 11px inset), mirroring a leading Back. The
198
- * margin and gap follow the button's size, not the layout: a touch screen
199
- * from 768px has the desktop head with 44px buttons, so -3px puts its last
200
- * glyph on 20px too.
201
- */
202
- const panelHeadActions = "flex shrink-0 items-center gap-0.5 mr-[-3px] md:pointer-fine:mr-px md:pointer-fine:gap-1";
203
- /**
204
- * `header` and `sectionHeader` share one bar, expressed through
205
- * `compoundSlots`: a 56px row (the shell header height) with a seam under it.
206
- * On a phone the section head sits on the frame.
207
- */
208
- const panelHeader = tv({
209
- slots: {
210
- header: [],
211
- sectionHeader: [],
212
- headerIcon: [
213
- "flex size-[27px] shrink-0 items-center justify-center",
214
- "rounded-sticker border-[1.5px] border-sticker-ink bg-brand text-sticker-ink ring-[1.5px] ring-sticker-edge",
215
- "not-data-[icon-kind=avatar]:[&_svg]:size-3.5 not-data-[icon-kind=avatar]:[&_svg]:stroke-2",
216
- "data-[icon-kind=avatar]:size-auto data-[icon-kind=avatar]:border-transparent data-[icon-kind=avatar]:bg-transparent"
217
- ],
218
- headerContent: "flex min-w-0 flex-1 flex-col justify-center",
219
- heading: "flex min-w-0 items-center gap-2",
220
- title: "truncate font-sans text-headline font-bold text-foreground",
221
- meta: "min-w-0 truncate font-sans text-caption text-foreground-hint",
222
- status: [
223
- "inline-flex shrink-0 items-center gap-1 border-0 bg-transparent p-0",
224
- "font-sans text-caption font-medium normal-case text-foreground-hint",
225
- "[&_svg]:size-3.5 [&_svg]:shrink-0"
226
- ],
227
- activity: [
228
- "inline-flex shrink-0 items-center gap-1.5",
229
- "font-sans text-caption text-foreground-hint",
230
- "[&_svg]:size-3.5 [&_svg]:shrink-0"
231
- ],
232
- actions: panelHeadActions
233
- },
234
- variants: { size: {
235
- sm: {},
236
- md: { meta: ["text-footnote"] }
237
- } },
238
- compoundSlots: [{
239
- slots: ["header", "sectionHeader"],
240
- class: [
241
- "flex h-(--shell-header-height,56px) shrink-0 items-center gap-3 max-md:gap-2",
242
- panelHeadEdges,
243
- "border-b border-line-seam bg-layer-canvas text-foreground",
244
- "max-md:sticky max-md:top-0 max-md:z-30"
245
- ]
246
- }, {
247
- slots: ["sectionHeader"],
248
- class: [
249
- "max-md:bg-layer-frame max-md:text-foreground-on-frame",
250
- "max-md:[&>[data-slot=panel-header-icon]]:hidden",
251
- "max-md:**:data-[slot=panel-title]:text-foreground-on-frame",
252
- "max-md:**:data-[slot=panel-meta]:text-foreground-on-frame-muted",
253
- "max-md:**:data-[slot=panel-action]:text-foreground-on-frame",
254
- "max-md:**:data-[slot=panel-action]:hover:bg-fill-frame-pressed max-md:**:data-[slot=panel-action]:active:bg-fill-frame-pressed"
255
- ]
256
- }]
257
- });
258
- //#endregion
259
- //#region src/components/drawer/drawer.recipe.ts
260
- const drawerMotion = tv({
261
- slots: {
262
- overlay: [
263
- "opacity-[max(var(--drawer-overlay-min-opacity,0),calc(1-var(--drawer-swipe-progress)))]",
264
- "transition-opacity duration-200 ease-slide",
265
- "data-starting-style:opacity-0 data-ending-style:pointer-events-none data-ending-style:opacity-0 data-ending-style:duration-150",
266
- "motion-reduce:transition-none"
267
- ],
268
- popup: [
269
- "[--drawer-blur:2px] [--drawer-ease:var(--ease-slide)]",
270
- "[--closed-transform:translate3d(var(--drawer-exit-x,0px),var(--drawer-exit-y,0px),0)]",
271
- "[--drawer-stack-peek:16px] [--drawer-stack-step:0.05]",
272
- "[--drawer-stack-progress:clamp(0,var(--drawer-swipe-progress),1)]",
273
- "[--drawer-stack-offset:max(0px,calc((var(--nested-drawers)-var(--drawer-stack-progress))*var(--drawer-stack-peek)))]",
274
- "[--drawer-stack-scale-base:calc(max(0,1-(var(--nested-drawers)*var(--drawer-stack-step))))]",
275
- "[--drawer-stack-scale:clamp(0,calc(var(--drawer-stack-scale-base)+(var(--drawer-stack-step)*var(--drawer-stack-progress))),1)]",
276
- "[--drawer-stack-shrink:calc(1-var(--drawer-stack-scale))]",
277
- "[--drawer-stack-shrink-offset:calc(var(--drawer-stack-shrink)*var(--drawer-stack-size))]",
278
- "origin-(--drawer-transform-origin)",
279
- "transform-[translate3d(calc(var(--drawer-swipe-x,0px)+var(--drawer-stack-x,0px)),calc(var(--drawer-swipe-y,0px)+var(--drawer-stack-y,0px)),0)_scale(var(--drawer-stack-scale))]",
280
- "opacity-100 blur-0",
281
- "transition-[transform,height,opacity,filter] duration-240 ease-(--drawer-ease) will-change-transform",
282
- "data-ending-style:duration-[calc(var(--drawer-swipe-strength,1)*180ms)]",
283
- "data-starting-style:transform-(--closed-transform) data-starting-style:opacity-0 data-starting-style:blur-(--drawer-blur)",
284
- "data-ending-style:transform-(--closed-transform) data-ending-style:opacity-0 data-ending-style:blur-(--drawer-blur)",
285
- "data-swiping:duration-0 data-nested-drawer-swiping:duration-0 motion-reduce:transition-none"
286
- ],
287
- content: ["transition-opacity duration-150 ease-slide motion-reduce:transition-none", "group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100"],
288
- swipeHandle: ["transition-opacity duration-150 motion-reduce:transition-none", "group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100"]
289
- },
290
- variants: {
291
- side: {
292
- down: { popup: [
293
- "[--drawer-exit-y:calc(100%+var(--drawer-inset)+2px)]",
294
- "[--drawer-stack-y:calc(0px-var(--drawer-stack-offset)-var(--drawer-stack-shrink-offset))]",
295
- "[--drawer-transform-origin:50%_100%]"
296
- ] },
297
- up: { popup: [
298
- "[--drawer-exit-y:calc(-100%-var(--drawer-inset)-2px)]",
299
- "[--drawer-stack-y:calc(var(--drawer-stack-offset)+var(--drawer-stack-shrink-offset))]",
300
- "[--drawer-transform-origin:50%_0%]"
301
- ] },
302
- left: { popup: [
303
- "[--drawer-exit-x:calc(-100%-var(--drawer-inset)-2px)]",
304
- "[--drawer-stack-x:calc(var(--drawer-stack-offset)+var(--drawer-stack-shrink-offset))]",
305
- "[--drawer-transform-origin:0%_50%]"
306
- ] },
307
- right: { popup: [
308
- "[--drawer-exit-x:calc(100%+var(--drawer-inset)+2px)]",
309
- "[--drawer-stack-x:calc(0px-var(--drawer-stack-offset)-var(--drawer-stack-shrink-offset))]",
310
- "[--drawer-transform-origin:100%_50%]"
311
- ] }
312
- },
313
- axis: {
314
- x: { popup: ["[--drawer-stack-size:100%]", "[--drawer-swipe-x:var(--drawer-swipe-movement-x)]"] },
315
- y: { popup: ["[--drawer-stack-size:max(0px,var(--drawer-frontmost-height,var(--drawer-height)))]", "[--drawer-swipe-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y))]"] }
316
- },
317
- snapPoints: { true: { overlay: ["[--drawer-overlay-min-opacity:0.5]"] } }
318
- }
319
- });
320
- const drawer = tv({
321
- extend: drawerMotion,
322
- slots: {
323
- overlay: [
324
- "fixed inset-0 z-50 min-h-dvh select-none",
325
- "supports-[-webkit-touch-callout:none]:absolute",
326
- "bg-layer-backdrop"
327
- ],
328
- viewport: ["pointer-events-none fixed inset-0 z-50 select-none"],
329
- popup: [
330
- "group/drawer-popup pointer-events-auto fixed z-50 flex h-(--drawer-content-height) flex-col outline-none",
331
- "[--drawer-inset:12px] [--drawer-content-height:var(--drawer-height,auto)]",
332
- "data-nested-drawer-open:overflow-hidden",
333
- "bg-layer-popover text-foreground",
334
- "shadow-float ring-1 ring-line-seam"
335
- ],
336
- content: ["flex min-h-0 flex-1 flex-col rounded-[inherit] select-text", "group-data-swiping/drawer-popup:select-none"],
337
- swipeHandle: [
338
- "relative z-10 shrink-0 cursor-grab select-none active:cursor-grabbing",
339
- "before:absolute before:content-['']",
340
- "before:rounded-[1px] before:bg-line-seam"
341
- ],
342
- close: ["shrink-0"],
343
- closeIcon: ["size-5.5"],
344
- header: ["flex flex-col", "items-stretch gap-1 px-4 pt-4 pb-2 text-left"],
345
- body: ["flex flex-1 flex-col", "items-stretch px-4 pt-2 pb-4 text-left"],
346
- footer: ["mt-auto py-5", "px-4 pt-3 pb-4"],
347
- actions: [
348
- "flex w-full flex-col items-stretch",
349
- "**:data-[slot=button]:w-full",
350
- "gap-2"
351
- ],
352
- title: ["text-pretty text-foreground", "max-w-none text-left font-sans text-headline font-bold"],
353
- description: ["text-pretty", "max-w-none text-left font-sans text-callout text-foreground-muted"]
354
- },
355
- variants: {
356
- nested: {
357
- false: {},
358
- true: { overlay: ["bg-layer-backdrop-nested"] }
359
- },
360
- side: {
361
- down: {
362
- popup: [
363
- "bottom-(--drawer-inset) min-h-64 max-h-[82vh]",
364
- "rounded-t-dialog [--drawer-inset:0px]",
365
- "pb-[env(safe-area-inset-bottom,0px)]"
366
- ],
367
- swipeHandle: ["before:top-3"]
368
- },
369
- up: {
370
- popup: [
371
- "top-(--drawer-inset) max-h-[80vh]",
372
- "rounded-b-dialog [--drawer-inset:0px]",
373
- "pt-[env(safe-area-inset-top,0px)]"
374
- ],
375
- swipeHandle: ["order-last", "before:bottom-3"]
376
- },
377
- left: {
378
- popup: ["left-(--drawer-inset)"],
379
- swipeHandle: ["order-last", "before:right-3"]
380
- },
381
- right: {
382
- popup: ["right-(--drawer-inset)"],
383
- swipeHandle: ["before:left-3"]
384
- }
385
- },
386
- axis: {
387
- x: {
388
- popup: ["flex-row", "inset-y-0 w-full max-w-[420px] [--drawer-inset:0px]"],
389
- swipeHandle: [
390
- "my-auto h-16 w-11",
391
- "before:top-1/2 before:-translate-y-1/2",
392
- "before:w-1 before:h-9"
393
- ],
394
- header: [
395
- "min-h-14 shrink-0 flex-row items-center justify-between gap-2 py-0 text-left",
396
- "border-b border-line-seam",
397
- panelHeadEdges
398
- ],
399
- body: ["items-stretch text-left", "min-h-0 overflow-y-auto px-5 py-4"],
400
- footer: ["border-t border-line-seam px-5 py-3"],
401
- title: ["min-w-0 max-w-none flex-1 text-left"],
402
- description: ["max-w-none text-left"],
403
- actions: ["flex-row flex-wrap justify-end", "**:data-[slot=button]:w-auto"]
404
- },
405
- y: {
406
- popup: [
407
- "data-nested-drawer-open:h-(--drawer-frontmost-height)",
408
- "mx-auto md:max-w-md",
409
- "inset-x-0"
410
- ],
411
- swipeHandle: [
412
- "mx-auto w-16",
413
- "before:left-1/2 before:-translate-x-1/2",
414
- "h-4",
415
- "before:top-1.5 before:h-1 before:w-9"
416
- ]
417
- }
418
- }
419
- },
420
- compoundVariants: [{
421
- side: "down",
422
- snapPoints: true,
423
- class: { header: ["pt-2"] }
424
- }, {
425
- axis: "y",
426
- snapPoints: true,
427
- class: { popup: ["[--drawer-content-height:100dvh]"] }
428
- }]
429
- });
430
- //#endregion
431
- //#region src/components/drawer/drawer.tsx
432
- const DrawerConfigContext = createContext(null);
433
- function useDrawerConfig() {
434
- const context = useContext(DrawerConfigContext);
435
- if (!context) throw new Error("Drawer parts must be used within Drawer.");
436
- return context;
437
- }
438
- function Drawer({ modal = true, snapPoints, swipeDirection = "down", children, ...props }) {
439
- const hasSnapPoints = snapPoints != null && snapPoints.length > 0;
440
- const swipeAxis = swipeDirection === "down" || swipeDirection === "up" ? "y" : "x";
441
- const contextValue = useMemo(() => ({
442
- hasSnapPoints,
443
- modal,
444
- swipeAxis,
445
- swipeDirection
446
- }), [
447
- hasSnapPoints,
448
- modal,
449
- swipeAxis,
450
- swipeDirection
451
- ]);
452
- return /* @__PURE__ */ jsx(DrawerConfigContext.Provider, {
453
- value: contextValue,
454
- children: /* @__PURE__ */ jsx(Drawer$1.Root, {
455
- modal,
456
- snapPoints,
457
- swipeDirection,
458
- ...props,
459
- children: withOverlayLayer("drawer", modal === true, children)
460
- })
461
- });
462
- }
463
- function DrawerTrigger(props) {
464
- return /* @__PURE__ */ jsx(Drawer$1.Trigger, {
465
- "data-slot": "drawer-trigger",
466
- ...props
467
- });
468
- }
469
- function DrawerPortal(props) {
470
- return /* @__PURE__ */ jsx(Drawer$1.Portal, {
471
- "data-slot": "drawer-portal",
472
- ...useThemeScopeProps(props)
473
- });
474
- }
475
- function DrawerOverlay({ className, ...props }) {
476
- const { hasSnapPoints } = useDrawerConfig();
477
- const nested = useParentOverlayKind() === "dialog";
478
- const { overlay } = drawer({
479
- snapPoints: hasSnapPoints,
480
- nested
481
- });
482
- return /* @__PURE__ */ jsx(Drawer$1.Backdrop, {
483
- "data-slot": "drawer-overlay",
484
- "data-nested": nested ? "" : void 0,
485
- forceRender: nested,
486
- className: overlay({ className }),
487
- ...props
488
- });
489
- }
490
- function DrawerSwipeHandle() {
491
- const { swipeAxis, swipeDirection } = useDrawerConfig();
492
- const { swipeHandle } = drawer({
493
- side: swipeDirection,
494
- axis: swipeAxis
495
- });
496
- return /* @__PURE__ */ jsx("div", {
497
- "data-slot": "drawer-swipe-handle",
498
- "aria-hidden": "true",
499
- className: swipeHandle()
500
- });
501
- }
502
- function DrawerContent({ className, children, portalProps, ...props }) {
503
- const { hasSnapPoints, modal, swipeAxis, swipeDirection } = useDrawerConfig();
504
- const { content, popup, viewport } = drawer({
505
- side: swipeDirection,
506
- axis: swipeAxis,
507
- snapPoints: hasSnapPoints
508
- });
509
- return /* @__PURE__ */ jsxs(DrawerPortal, {
510
- ...portalProps,
511
- children: [modal === true ? /* @__PURE__ */ jsx(DrawerOverlay, {}) : null, /* @__PURE__ */ jsx(Drawer$1.Viewport, {
512
- "data-slot": "drawer-viewport",
513
- className: cn(viewport(), modal === true && "pointer-events-auto"),
514
- children: /* @__PURE__ */ jsxs(Drawer$1.Popup, {
515
- "data-slot": "drawer-popup",
516
- className: popup({ className }),
517
- ...props,
518
- children: [hasSnapPoints ? /* @__PURE__ */ jsx(DrawerSwipeHandle, {}) : null, /* @__PURE__ */ jsx(Drawer$1.Content, {
519
- "data-slot": "drawer-content",
520
- className: content(),
521
- children
522
- })]
523
- })
524
- })]
525
- });
526
- }
527
- function DrawerClose({ className, variant, size, children, render, "aria-label": ariaLabel, ...props }) {
528
- const { close, closeIcon } = drawer();
529
- if (render) return /* @__PURE__ */ jsx(Drawer$1.Close, {
530
- "data-slot": "drawer-close",
531
- className,
532
- render,
533
- "aria-label": ariaLabel,
534
- ...props,
535
- children
536
- });
537
- return /* @__PURE__ */ jsx(Drawer$1.Close, {
538
- "data-slot": "drawer-close",
539
- render: /* @__PURE__ */ jsx(Button, {
540
- variant: variant ?? "ghost",
541
- size: size ?? "icon-lg",
542
- "aria-label": ariaLabel ?? "Close"
543
- }),
544
- className: close({ className }),
545
- ...props,
546
- children: children ?? /* @__PURE__ */ jsx(X, { className: closeIcon() })
547
- });
548
- }
549
- function DrawerHeader({ className, render, ...props }) {
550
- const { hasSnapPoints, swipeAxis, swipeDirection } = useDrawerConfig();
551
- const { header } = drawer({
552
- side: swipeDirection,
553
- axis: swipeAxis,
554
- snapPoints: hasSnapPoints
555
- });
556
- const defaultProps = { className: header({ className }) };
557
- return useRender({
558
- defaultTagName: "div",
559
- render,
560
- props: mergeProps(defaultProps, props),
561
- state: { slot: "drawer-header" }
562
- });
563
- }
564
- function DrawerFooter({ className, render, ...props }) {
565
- const { swipeAxis } = useDrawerConfig();
566
- const { footer } = drawer({ axis: swipeAxis });
567
- const defaultProps = { className: footer({ className }) };
568
- return useRender({
569
- defaultTagName: "div",
570
- render,
571
- props: mergeProps(defaultProps, props),
572
- state: { slot: "drawer-footer" }
573
- });
574
- }
575
- function DrawerBody({ className, render, ...props }) {
576
- const { swipeAxis } = useDrawerConfig();
577
- const { body } = drawer({ axis: swipeAxis });
578
- const defaultProps = { className: body({ className }) };
579
- return useRender({
580
- defaultTagName: "div",
581
- render,
582
- props: mergeProps(defaultProps, props),
583
- state: { slot: "drawer-body" }
584
- });
585
- }
586
- function DrawerActions({ className, render, children, ...props }) {
587
- const swipeAxis = useContext(DrawerConfigContext)?.swipeAxis;
588
- const { actions } = drawer({ axis: swipeAxis });
589
- const defaultProps = {
590
- className: actions({ className }),
591
- children
592
- };
593
- return useRender({
594
- defaultTagName: "div",
595
- render,
596
- props: mergeProps(defaultProps, props),
597
- state: { slot: "drawer-actions" }
598
- });
599
- }
600
- function DrawerTitle({ className, ...props }) {
601
- const { swipeAxis } = useDrawerConfig();
602
- const { title } = drawer({ axis: swipeAxis });
603
- return /* @__PURE__ */ jsx(Drawer$1.Title, {
604
- "data-slot": "drawer-title",
605
- className: title({ className }),
606
- ...props
607
- });
608
- }
609
- function DrawerDescription({ className, ...props }) {
610
- const { swipeAxis } = useDrawerConfig();
611
- const { description } = drawer({ axis: swipeAxis });
612
- return /* @__PURE__ */ jsx(Drawer$1.Description, {
613
- "data-slot": "drawer-description",
614
- className: description({ className }),
615
- ...props
616
- });
617
- }
618
- //#endregion
619
175
  //#region src/components/badge/badge.tsx
620
176
  const badge = tv({
621
177
  slots: { root: [
package/dist/style.css CHANGED
@@ -1300,6 +1300,136 @@
1300
1300
  color: var(--foreground-disabled);
1301
1301
  }
1302
1302
 
1303
+ .r-combobox-select__trigger {
1304
+ box-sizing: border-box;
1305
+ min-width: 0;
1306
+ min-height: inherit;
1307
+ color: inherit;
1308
+ font: inherit;
1309
+ text-align: start;
1310
+ cursor: default;
1311
+ -webkit-tap-highlight-color: transparent;
1312
+ background: none;
1313
+ border: 0;
1314
+ outline: 0;
1315
+ flex: 1;
1316
+ align-items: center;
1317
+ padding: 0;
1318
+ display: flex;
1319
+ }
1320
+
1321
+ .r-combobox-select__trigger:after {
1322
+ content: "";
1323
+ border-radius: inherit;
1324
+ position: absolute;
1325
+ inset: 0;
1326
+ }
1327
+
1328
+ .r-combobox-select__trigger:disabled {
1329
+ color: inherit;
1330
+ }
1331
+
1332
+ .r-combobox-select__value {
1333
+ text-overflow: ellipsis;
1334
+ white-space: nowrap;
1335
+ min-width: 0;
1336
+ overflow: hidden;
1337
+ }
1338
+
1339
+ .r-combobox-select__placeholder {
1340
+ text-overflow: ellipsis;
1341
+ white-space: nowrap;
1342
+ min-width: 0;
1343
+ color: var(--foreground-hint);
1344
+ overflow: hidden;
1345
+ }
1346
+
1347
+ .r-combobox-select__trigger .r-combobox-select__chips {
1348
+ margin-inline-start: -6px;
1349
+ }
1350
+
1351
+ .r-combobox-select__trigger .r-combobox-select__chip {
1352
+ padding-inline-end: 8px;
1353
+ }
1354
+
1355
+ .r-combobox-select__clear {
1356
+ z-index: 1;
1357
+ position: relative;
1358
+ }
1359
+
1360
+ .r-combobox-select__arrow {
1361
+ pointer-events: none;
1362
+ }
1363
+
1364
+ .r-combobox-select__control--trigger[data-popup-open] .r-combobox-select__arrow > svg {
1365
+ transform: rotate(180deg);
1366
+ }
1367
+
1368
+ .r-combobox-select__popup--anchored .r-combobox-select__list {
1369
+ box-sizing: border-box;
1370
+ max-height: min(calc(16rem + 12px), var(--available-height, 100vh));
1371
+ }
1372
+
1373
+ .r-combobox-select__sheet-popup {
1374
+ height: 82dvh;
1375
+ }
1376
+
1377
+ .r-combobox-select__sheet {
1378
+ flex-direction: column;
1379
+ flex: 1;
1380
+ min-height: 0;
1381
+ display: flex;
1382
+ }
1383
+
1384
+ .r-combobox-select__sheet-header {
1385
+ flex-direction: row;
1386
+ justify-content: space-between;
1387
+ align-items: center;
1388
+ gap: 8px;
1389
+ padding-inline-end: 8px;
1390
+ }
1391
+
1392
+ .r-combobox-select__sheet-title {
1393
+ flex: 1;
1394
+ min-width: 0;
1395
+ }
1396
+
1397
+ .r-combobox-select__sheet-search {
1398
+ flex: none;
1399
+ padding: 4px 16px 8px;
1400
+ }
1401
+
1402
+ .r-combobox-select__search-icon {
1403
+ width: 16px;
1404
+ height: 16px;
1405
+ color: var(--foreground-hint);
1406
+ flex: none;
1407
+ }
1408
+
1409
+ .r-combobox-select__sheet-body {
1410
+ overscroll-behavior: contain;
1411
+ min-height: 0;
1412
+ padding: 0 8px calc(16px + env(safe-area-inset-bottom, 0px));
1413
+ overflow-y: auto;
1414
+ }
1415
+
1416
+ .r-combobox-select__sheet .r-combobox-select__list {
1417
+ max-height: none;
1418
+ padding: 0;
1419
+ overflow: visible;
1420
+ }
1421
+
1422
+ .r-combobox-select__sheet .r-combobox-select__option {
1423
+ min-height: 52px;
1424
+ font-size: var(--text-body);
1425
+ line-height: var(--text-body--line-height);
1426
+ padding: 0 12px;
1427
+ }
1428
+
1429
+ .r-combobox-select__sheet .r-combobox-select__group-label {
1430
+ padding: 12px 12px 4px;
1431
+ }
1432
+
1303
1433
  @keyframes r-combobox-select-spin {
1304
1434
  to {
1305
1435
  transform: rotate(360deg);
package/dist/wip.d.mts CHANGED
@@ -22,6 +22,12 @@ interface ComboboxSelectMessages {
22
22
  chipDescription: string;
23
23
  inputDescription: string;
24
24
  remove: (label: string) => string;
25
+ /** The placeholder of the search input at the top of the phone's bottom sheet. */
26
+ search: string;
27
+ /** The button that closes the phone's bottom sheet of a multiple select. */
28
+ done: string;
29
+ /** The close button of the phone's bottom sheet. */
30
+ close: string;
25
31
  }
26
32
  type RootProps = Combobox.Root.Props<unknown, boolean>;
27
33
  type ComboboxSelectProps<Option = ComboboxSelectOption, Multiple extends boolean | undefined = false> = Pick<RootProps, "name" | "form" | "required" | "disabled" | "readOnly" | "open" | "defaultOpen" | "onOpenChange" | "onOpenChangeComplete" | "autoHighlight" | "autoComplete" | "inputValue" | "defaultInputValue" | "onInputValueChange"> & Pick<ComponentPropsWithRef<"input">, "id" | "ref" | "aria-label" | "aria-labelledby" | "aria-describedby" | "aria-invalid"> & {
@@ -66,16 +72,31 @@ type ComboboxSelectProps<Option = ComboboxSelectOption, Multiple extends boolean
66
72
  emptyContent?: ReactNode;
67
73
  loadingContent?: ReactNode;
68
74
  messages?: Partial<ComboboxSelectMessages>;
75
+ /**
76
+ * On a phone (a touch screen under 48rem), more selectable options than this open a
77
+ * bottom sheet instead of the anchored list.
78
+ * @default 10
79
+ */
80
+ sheetThreshold?: number;
81
+ /**
82
+ * The title of the phone's bottom sheet. Defaults to the field's name: `aria-label`,
83
+ * the text of `aria-labelledby`, or the `<label>` whose `for` is the field's `id`.
84
+ */
85
+ sheetTitle?: ReactNode;
86
+ /** The text input: the field on a desktop, the search input of the bottom sheet on a phone. */
69
87
  inputProps?: Omit<Combobox.Input.Props, "value" | "defaultValue" | "size" | "children">;
88
+ /** The portal of the list, and of the phone's anchored list and bottom sheet. */
70
89
  portalProps?: Combobox.Portal.Props;
90
+ /** The desktop list's positioner. A phone positions its list itself. */
71
91
  positionerProps?: Omit<Combobox.Positioner.Props, "children">;
92
+ /** The desktop list's popup. */
72
93
  popupProps?: Omit<Combobox.Popup.Props, "children">;
73
94
  className?: string;
74
95
  style?: CSSProperties;
75
96
  };
76
97
  //#endregion
77
98
  //#region src/components/combobox-select/combobox-select.d.ts
78
- export declare function ComboboxSelect<Option = ComboboxSelectOption, Multiple extends boolean | undefined = false>({ options, multiple, value, defaultValue, onValueChange, labelField, valueField, disabledField, fallbackOption, filterable, filter, remote, onSearch, loading, create, creatable, onCreate, clearable, showArrow, clearFilterAfterSelect, onClear, maxTagCount, size, status, placeholder, renderLabel, renderOption, renderTag, renderCreateLabel, emptyContent, loadingContent, messages, inputProps, portalProps, positionerProps, popupProps, className, style, id: idProp, ref, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, inputValue, defaultInputValue, onInputValueChange, disabled, readOnly, autoHighlight, ...rootProps }: ComboboxSelectProps<Option, Multiple>): import("react").JSX.Element;
99
+ export declare function ComboboxSelect<Option = ComboboxSelectOption, Multiple extends boolean | undefined = false>({ options, multiple, value, defaultValue, onValueChange, labelField, valueField, disabledField, fallbackOption, filterable, filter, remote, onSearch, loading, create, creatable, onCreate, clearable, showArrow, clearFilterAfterSelect, onClear, maxTagCount, size, status, placeholder, renderLabel, renderOption, renderTag, renderCreateLabel, emptyContent, loadingContent, messages, sheetThreshold, sheetTitle, inputProps, portalProps, positionerProps, popupProps, className, style, id: idProp, ref, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, inputValue, defaultInputValue, onInputValueChange, disabled, readOnly, autoHighlight, ...rootProps }: ComboboxSelectProps<Option, Multiple>): import("react").JSX.Element;
79
100
  //#endregion
80
101
  //#region src/components/announcement-dialog/announcement-dialog.d.ts
81
102
  export declare function AnnouncementDialogContent({ className, initialFocus, ref, ...props }: DialogContentProps): import("react").JSX.Element;