@avenue-ticketing/ui 0.12.0-beta.1 → 0.12.0-beta.2

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.
Files changed (65) hide show
  1. package/dist/react/checkbox.js +10 -7
  2. package/dist/react/checkbox.js.map +1 -1
  3. package/dist/react/combobox.d.ts +3 -2
  4. package/dist/react/combobox.js +284 -32
  5. package/dist/react/combobox.js.map +1 -1
  6. package/dist/react/dropdown-account-breadcrumb.js +176 -14
  7. package/dist/react/dropdown-account-breadcrumb.js.map +1 -1
  8. package/dist/react/dropdown-account-button.js +186 -21
  9. package/dist/react/dropdown-account-button.js.map +1 -1
  10. package/dist/react/dropdown-account-card-md.js +187 -22
  11. package/dist/react/dropdown-account-card-md.js.map +1 -1
  12. package/dist/react/dropdown-account-card-sm.js +187 -22
  13. package/dist/react/dropdown-account-card-sm.js.map +1 -1
  14. package/dist/react/dropdown-account-card-xs.js +187 -22
  15. package/dist/react/dropdown-account-card-xs.js.map +1 -1
  16. package/dist/react/dropdown-avatar.js +186 -21
  17. package/dist/react/dropdown-avatar.js.map +1 -1
  18. package/dist/react/dropdown-button-advanced.js +186 -21
  19. package/dist/react/dropdown-button-advanced.js.map +1 -1
  20. package/dist/react/dropdown-button-link.js +187 -22
  21. package/dist/react/dropdown-button-link.js.map +1 -1
  22. package/dist/react/dropdown-button-simple.js +186 -21
  23. package/dist/react/dropdown-button-simple.js.map +1 -1
  24. package/dist/react/dropdown-icon-advanced.js +187 -22
  25. package/dist/react/dropdown-icon-advanced.js.map +1 -1
  26. package/dist/react/dropdown-icon-simple.js +187 -22
  27. package/dist/react/dropdown-icon-simple.js.map +1 -1
  28. package/dist/react/dropdown-integration.js +186 -21
  29. package/dist/react/dropdown-integration.js.map +1 -1
  30. package/dist/react/dropdown-search-advanced.js +186 -21
  31. package/dist/react/dropdown-search-advanced.js.map +1 -1
  32. package/dist/react/dropdown-search-simple.js +186 -21
  33. package/dist/react/dropdown-search-simple.js.map +1 -1
  34. package/dist/react/dropdown.d.ts +4 -1
  35. package/dist/react/dropdown.js +187 -22
  36. package/dist/react/dropdown.js.map +1 -1
  37. package/dist/react/input-tags-outer.js +8 -8
  38. package/dist/react/input-tags-outer.js.map +1 -1
  39. package/dist/react/input-tags.js +8 -8
  40. package/dist/react/input-tags.js.map +1 -1
  41. package/dist/react/multi-select.d.ts +3 -2
  42. package/dist/react/multi-select.js +228 -27
  43. package/dist/react/multi-select.js.map +1 -1
  44. package/dist/react/popover.d.ts +10 -1
  45. package/dist/react/popover.js +195 -18
  46. package/dist/react/popover.js.map +1 -1
  47. package/dist/react/radio-buttons.js +2 -1
  48. package/dist/react/radio-buttons.js.map +1 -1
  49. package/dist/react/select-item.d.ts +2 -1
  50. package/dist/react/select-item.js +11 -7
  51. package/dist/react/select-item.js.map +1 -1
  52. package/dist/react/select.d.ts +4 -3
  53. package/dist/react/select.js +298 -42
  54. package/dist/react/select.js.map +1 -1
  55. package/dist/react/switch.js +1 -1
  56. package/dist/react/switch.js.map +1 -1
  57. package/dist/react/tag-select.d.ts +5 -2
  58. package/dist/react/tag-select.js +215 -25
  59. package/dist/react/tag-select.js.map +1 -1
  60. package/dist/react/tags.js +8 -8
  61. package/dist/react/tags.js.map +1 -1
  62. package/dist/select-mobile-sheet-CB2ptDTJ.d.ts +12 -0
  63. package/dist/{select-shared-B3Y5SMXU.d.ts → select-shared-oJEeJxeB.d.ts} +6 -0
  64. package/package.json +1 -1
  65. package/theme.css +1 -1
@@ -1,6 +1,6 @@
1
- import { createContext, isValidElement, useRef, useState, useCallback, useContext, useEffect, useLayoutEffect } from 'react';
1
+ import { createContext, isValidElement, useMemo, useContext, useEffect, useRef, useState, useCallback, useLayoutEffect } from 'react';
2
2
  import { CaretDownIcon } from '@phosphor-icons/react/dist/csr/CaretDown';
3
- import { Select as Select$1, ListBox, Label as Label$1, Button, SelectValue as SelectValue$1, Popover as Popover$1, Text, ComboBox as ComboBox$1, ListBoxItem, TooltipTrigger as TooltipTrigger$1, Tooltip as Tooltip$1, OverlayArrow, ComboBoxStateContext, Group, Input } from 'react-aria-components';
3
+ import { Select as Select$1, ListBox, Label as Label$1, Button, SelectValue as SelectValue$1, OverlayTriggerStateContext, Popover as Popover$1, Text, ComboBox as ComboBox$1, ListBoxItem, TooltipTrigger as TooltipTrigger$1, Tooltip as Tooltip$1, OverlayArrow, ComboBoxStateContext, Group, Input } from 'react-aria-components';
4
4
  import { UserIcon } from '@phosphor-icons/react/dist/csr/User';
5
5
  import { extendTailwindMerge } from 'tailwind-merge';
6
6
  import '@phosphor-icons/react/dist/csr/Plus';
@@ -10,6 +10,8 @@ import '@phosphor-icons/react/dist/csr/Eye';
10
10
  import '@phosphor-icons/react/dist/csr/EyeSlash';
11
11
  import '@phosphor-icons/react/dist/csr/Info';
12
12
  import { MagnifyingGlassIcon } from '@phosphor-icons/react/dist/csr/MagnifyingGlass';
13
+ import { createPortal } from 'react-dom';
14
+ import { XIcon } from '@phosphor-icons/react/dist/csr/X';
13
15
  import { CheckIcon } from '@phosphor-icons/react/dist/csr/Check';
14
16
 
15
17
  var twMerge = extendTailwindMerge({
@@ -302,25 +304,199 @@ var isForwardRefComponent = (component) => {
302
304
  var isReactComponent = (component) => {
303
305
  return isFunctionComponent(component) || isForwardRefComponent(component) || isClassComponent(component);
304
306
  };
305
- var Popover = (props) => {
306
- return /* @__PURE__ */ jsx(
307
- Popover$1,
307
+ var MOBILE_SHEET_MAX_PX = 1024;
308
+ function useIsMobile(breakpoint = MOBILE_SHEET_MAX_PX + 1) {
309
+ const [isMobile, setIsMobile] = useState(() => {
310
+ if (typeof window === "undefined") return false;
311
+ return window.matchMedia(`(max-width: ${breakpoint - 1}px)`).matches;
312
+ });
313
+ useEffect(() => {
314
+ const mq = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
315
+ const handler = (e) => setIsMobile(e.matches);
316
+ mq.addEventListener("change", handler);
317
+ return () => mq.removeEventListener("change", handler);
318
+ }, [breakpoint]);
319
+ return isMobile;
320
+ }
321
+ var MOBILE_SHEET_MOTION_MS = 175;
322
+ var MOBILE_SHEET_ENTRY_EASING = "cubic-bezier(0.85, 0, 0.15, 1)";
323
+ var MOBILE_SHEET_EXIT_EASING = "cubic-bezier(0.85, 0, 1, 0.15)";
324
+ var MOBILE_SHEET_SLIDE_ENTRANCE_OFFSET_PX = 120;
325
+ function resolveSelectMobileOptions(mobileOptions) {
326
+ return {
327
+ sheet: mobileOptions?.sheet ?? true,
328
+ title: mobileOptions?.title,
329
+ sheetClassName: mobileOptions?.className,
330
+ contentClassName: mobileOptions?.contentClassName
331
+ };
332
+ }
333
+ function useMobileSheetAnimation(open, enabled, slideEntrance = true, slideOffsetPx = MOBILE_SHEET_SLIDE_ENTRANCE_OFFSET_PX) {
334
+ const [shouldRender, setShouldRender] = useState(open);
335
+ const [isAnimating, setIsAnimating] = useState(false);
336
+ useLayoutEffect(() => {
337
+ if (!enabled) {
338
+ setShouldRender(open);
339
+ return;
340
+ }
341
+ if (open) {
342
+ setShouldRender(true);
343
+ }
344
+ }, [open, enabled]);
345
+ useEffect(() => {
346
+ if (!enabled || open) return;
347
+ const timer = setTimeout(() => setShouldRender(false), MOBILE_SHEET_MOTION_MS);
348
+ return () => clearTimeout(timer);
349
+ }, [open, enabled]);
350
+ useLayoutEffect(() => {
351
+ if (!enabled || open || !shouldRender) return;
352
+ setIsAnimating(false);
353
+ }, [enabled, open, shouldRender]);
354
+ useEffect(() => {
355
+ if (!enabled || !shouldRender || !open) return;
356
+ let raf2 = 0;
357
+ const raf1 = requestAnimationFrame(() => {
358
+ raf2 = requestAnimationFrame(() => setIsAnimating(true));
359
+ });
360
+ return () => {
361
+ cancelAnimationFrame(raf1);
362
+ if (raf2) cancelAnimationFrame(raf2);
363
+ };
364
+ }, [shouldRender, open, enabled]);
365
+ const motionEasing = open ? MOBILE_SHEET_ENTRY_EASING : MOBILE_SHEET_EXIT_EASING;
366
+ const hiddenTransform = slideEntrance ? `translateY(${slideOffsetPx}px)` : "translateY(100%)";
367
+ const panelStyle = enabled ? {
368
+ transform: isAnimating ? "translateY(0)" : hiddenTransform,
369
+ opacity: isAnimating ? 1 : 0,
370
+ transitionProperty: "transform, opacity",
371
+ transitionDuration: `${MOBILE_SHEET_MOTION_MS}ms`,
372
+ transitionTimingFunction: motionEasing
373
+ } : void 0;
374
+ const backdropStyle = enabled ? {
375
+ opacity: isAnimating ? 1 : 0,
376
+ transitionProperty: "opacity",
377
+ transitionDuration: `${MOBILE_SHEET_MOTION_MS}ms`,
378
+ transitionTimingFunction: motionEasing
379
+ } : void 0;
380
+ return { shouldRender, isAnimating, panelStyle, backdropStyle };
381
+ }
382
+ function MobileSheetCloseButton({ onClose }) {
383
+ return /* @__PURE__ */ jsxs(
384
+ "button",
308
385
  {
309
- placement: "bottom",
310
- containerPadding: 0,
311
- offset: 4,
312
- ...props,
313
- className: (state) => cx(
314
- "w-(--trigger-width) origin-(--trigger-anchor-point) overflow-x-hidden overflow-y-auto rounded-lg bg-primary py-1 shadow-lg ring-1 ring-secondary_alt outline-hidden will-change-transform",
315
- state.isEntering && "duration-150 ease-out animate-in fade-in placement-right:slide-in-from-left-0.5 placement-top:slide-in-from-bottom-0.5 placement-bottom:slide-in-from-top-0.5",
316
- state.isExiting && "duration-100 ease-in animate-out fade-out placement-right:slide-out-to-left-0.5 placement-top:slide-out-to-bottom-0.5 placement-bottom:slide-out-to-top-0.5",
317
- props.size === "sm" && "max-h-56!",
318
- props.size === "md" && "max-h-64!",
319
- props.size === "lg" && "max-h-80!",
320
- typeof props.className === "function" ? props.className(state) : props.className
321
- )
386
+ type: "button",
387
+ onClick: (e) => {
388
+ e.stopPropagation();
389
+ onClose();
390
+ },
391
+ className: "flex size-12 shrink-0 cursor-pointer items-center justify-center rounded-full text-fg-primary transition duration-100 ease-linear hover:bg-primary_hover active:scale-[0.96] focus-visible:outline-none focus-visible:[box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]",
392
+ children: [
393
+ /* @__PURE__ */ jsx(XIcon, { className: "size-5", "aria-hidden": "true" }),
394
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
395
+ ]
322
396
  }
323
397
  );
398
+ }
399
+ function MobileSheetChrome({
400
+ title,
401
+ contentClassName,
402
+ onClose,
403
+ children
404
+ }) {
405
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
406
+ /* @__PURE__ */ jsxs("div", { className: cx("flex w-full shrink-0 items-center py-2 pl-4 pr-2", title ? "justify-between gap-3" : "justify-end"), children: [
407
+ title ? /* @__PURE__ */ jsx("p", { className: "min-w-0 flex-1 truncate text-base font-semibold text-primary", children: title }) : null,
408
+ /* @__PURE__ */ jsx(MobileSheetCloseButton, { onClose })
409
+ ] }),
410
+ /* @__PURE__ */ jsx(
411
+ "div",
412
+ {
413
+ className: cx(
414
+ "min-h-0 flex-1 overflow-y-auto pb-[calc(5rem+env(safe-area-inset-bottom,0px))]",
415
+ contentClassName
416
+ ),
417
+ children
418
+ }
419
+ )
420
+ ] });
421
+ }
422
+ var Popover = ({ mobileOptions, children, size, className, style, compoundContent = false, ...props }) => {
423
+ const isMobile = useIsMobile();
424
+ const resolvedMobile = useMemo(() => resolveSelectMobileOptions(mobileOptions), [mobileOptions]);
425
+ const useMobileSheet = isMobile && resolvedMobile.sheet;
426
+ const overlayState = useContext(OverlayTriggerStateContext);
427
+ const open = overlayState?.isOpen ?? false;
428
+ const { shouldRender, panelStyle, backdropStyle } = useMobileSheetAnimation(open, useMobileSheet);
429
+ useEffect(() => {
430
+ if (!useMobileSheet || !open) return;
431
+ const prev = document.body.style.overflow;
432
+ document.body.style.overflow = "hidden";
433
+ return () => {
434
+ document.body.style.overflow = prev;
435
+ };
436
+ }, [useMobileSheet, open]);
437
+ const close = () => overlayState?.close();
438
+ const showMobileSheet = useMobileSheet && shouldRender;
439
+ const isMobileSheetExiting = showMobileSheet && !open;
440
+ const mobileScrim = useMobileSheet && shouldRender && typeof document !== "undefined" ? createPortal(
441
+ /* @__PURE__ */ jsx(
442
+ "div",
443
+ {
444
+ className: "fixed inset-0 z-50 bg-overlay/70",
445
+ style: backdropStyle,
446
+ onClick: close,
447
+ "aria-hidden": "true"
448
+ }
449
+ ),
450
+ document.body
451
+ ) : null;
452
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
453
+ mobileScrim,
454
+ /* @__PURE__ */ jsx(
455
+ Popover$1,
456
+ {
457
+ placement: "bottom",
458
+ containerPadding: 0,
459
+ offset: 4,
460
+ ...props,
461
+ isExiting: isMobileSheetExiting,
462
+ ...useMobileSheet ? { "data-select-mobile-sheet": true } : {},
463
+ style: useMobileSheet ? { ...panelStyle, ...style } : style,
464
+ className: (state) => cx(
465
+ "outline-hidden",
466
+ !useMobileSheet && [
467
+ "w-(--trigger-width) origin-(--trigger-anchor-point) rounded-lg bg-primary shadow-lg ring-1 ring-secondary_alt will-change-transform",
468
+ compoundContent ? "overflow-hidden outline-hidden" : "overflow-x-hidden overflow-y-auto py-1 outline-hidden",
469
+ state.isEntering && "duration-150 ease-out animate-in fade-in placement-right:slide-in-from-left-0.5 placement-top:slide-in-from-bottom-0.5 placement-bottom:slide-in-from-top-0.5",
470
+ state.isExiting && "duration-100 ease-in animate-out fade-out placement-right:slide-out-to-left-0.5 placement-top:slide-out-to-bottom-0.5 placement-bottom:slide-out-to-top-0.5",
471
+ !compoundContent && size === "sm" && "max-h-56!",
472
+ !compoundContent && size === "md" && "max-h-64!",
473
+ !compoundContent && size === "lg" && "max-h-80!"
474
+ ],
475
+ useMobileSheet && [
476
+ "fixed! inset-x-0! bottom-0! top-auto! left-0! right-0! z-[51] flex w-full! max-w-none! flex-col overflow-hidden rounded-t-2xl rounded-b-none border-x-0 border-t border-secondary bg-primary shadow-xl",
477
+ "max-h-[min(90dvh,calc(100dvh-env(safe-area-inset-bottom,0px)))]",
478
+ resolvedMobile.sheetClassName
479
+ ],
480
+ typeof className === "function" ? className(state) : className
481
+ ),
482
+ children: (state) => {
483
+ const content = typeof children === "function" ? children(state) : children;
484
+ if (useMobileSheet) {
485
+ return /* @__PURE__ */ jsx(
486
+ MobileSheetChrome,
487
+ {
488
+ title: resolvedMobile.title,
489
+ contentClassName: resolvedMobile.contentClassName,
490
+ onClose: close,
491
+ children: content
492
+ }
493
+ );
494
+ }
495
+ return content;
496
+ }
497
+ }
498
+ )
499
+ ] });
324
500
  };
325
501
  var sizes3 = {
326
502
  sm: {
@@ -333,6 +509,11 @@ var sizes3 = {
333
509
  md: { root: "py-2 px-3 gap-2 *:data-icon:size-5", withIcon: "", text: "text-md", textContainer: "gap-x-1.5", shortcut: "pr-2.5" },
334
510
  lg: { root: "py-2.5 px-3.5 gap-2 *:data-icon:size-5", withIcon: "", text: "text-md", textContainer: "gap-x-1.5", shortcut: "pr-3" }
335
511
  };
512
+ var searchSizes = {
513
+ sm: { wrapper: "py-1", root: "px-3 py-2 gap-2 *:data-icon:size-4 *:data-icon:stroke-[2.25px]", text: "text-sm" },
514
+ md: { wrapper: "py-0.5", root: "px-3 py-2 gap-2 *:data-icon:size-5", text: "text-md" },
515
+ lg: { wrapper: "py-0.5", root: "px-3.5 py-2.5 gap-2 *:data-icon:size-5", text: "text-md" }
516
+ };
336
517
  var SelectContext = createContext({ size: "md" });
337
518
  function hasResizeObserver() {
338
519
  return typeof window.ResizeObserver !== "undefined";
@@ -365,6 +546,47 @@ function useResizeObserver(options) {
365
546
  }
366
547
  }, [onResize, ref, box]);
367
548
  }
549
+ var ComboBoxMobileTrigger = ({ size, placeholder, icon: IconProp, isInvalid, onPointerEnter, ref }) => {
550
+ const state = useContext(ComboBoxStateContext);
551
+ const selectedItem = state?.selectedItem?.value ?? null;
552
+ return /* @__PURE__ */ jsxs(
553
+ Button,
554
+ {
555
+ ref,
556
+ onPress: () => state?.open(),
557
+ onPointerEnter,
558
+ className: ({ isFocusVisible, isDisabled }) => cx(
559
+ "relative flex w-full cursor-pointer items-center gap-2 rounded-lg border border-solid border-primary bg-primary text-left shadow-xs outline-hidden transition-[border-color,box-shadow] duration-100 ease-linear",
560
+ isDisabled && "cursor-not-allowed opacity-50",
561
+ !isInvalid && (isFocusVisible || state?.isOpen) && inputFocusRingShadow,
562
+ isInvalid && !(isFocusVisible || state?.isOpen) && "border-error_subtle",
563
+ isInvalid && (isFocusVisible || state?.isOpen) && inputErrorFocusRingShadow,
564
+ "*:data-icon:shrink-0 *:data-icon:text-fg-quaternary",
565
+ sizes3[size].root
566
+ ),
567
+ children: [
568
+ isReactComponent(IconProp) ? /* @__PURE__ */ jsx(IconProp, { "data-icon": true, className: "pointer-events-none", "aria-hidden": "true" }) : isValidElement(IconProp) ? IconProp : /* @__PURE__ */ jsx(MagnifyingGlassIcon, { "data-icon": true, className: "pointer-events-none", "aria-hidden": "true" }),
569
+ selectedItem ? /* @__PURE__ */ jsxs("section", { className: cx("flex w-full truncate", sizes3[size].textContainer), children: [
570
+ /* @__PURE__ */ jsx("p", { className: cx("truncate font-medium text-primary", sizes3[size].text), children: selectedItem.label }),
571
+ selectedItem.supportingText && /* @__PURE__ */ jsx("p", { className: cx("text-tertiary", sizes3[size].text), children: selectedItem.supportingText })
572
+ ] }) : /* @__PURE__ */ jsx("p", { className: cx("truncate text-placeholder", sizes3[size].text), children: placeholder })
573
+ ]
574
+ }
575
+ );
576
+ };
577
+ var ComboBoxSheetSearch = ({ size, placeholder, icon: IconProp }) => /* @__PURE__ */ jsx("div", { className: cx("shrink-0 border-b border-secondary", searchSizes[size].wrapper), children: /* @__PURE__ */ jsxs("div", { className: cx("flex items-center", searchSizes[size].root), children: [
578
+ isReactComponent(IconProp) ? /* @__PURE__ */ jsx(IconProp, { "data-icon": true, "aria-hidden": "true", className: "shrink-0 text-fg-quaternary" }) : isValidElement(IconProp) ? IconProp : /* @__PURE__ */ jsx(MagnifyingGlassIcon, { "data-icon": true, "aria-hidden": "true", className: "shrink-0 text-fg-quaternary" }),
579
+ /* @__PURE__ */ jsx(
580
+ Input,
581
+ {
582
+ placeholder,
583
+ className: cx(
584
+ "w-full appearance-none bg-transparent text-primary caret-alpha-black/90 outline-hidden placeholder:text-placeholder",
585
+ searchSizes[size].text
586
+ )
587
+ }
588
+ )
589
+ ] }) });
368
590
  var ComboBoxValue = ({ size, shortcut, placeholder, shortcutClassName, icon: IconProp, isInvalid, ref, ...otherProps }) => {
369
591
  const state = useContext(ComboBoxStateContext);
370
592
  const value = state?.selectedItem?.value || null;
@@ -377,12 +599,14 @@ var ComboBoxValue = ({ size, shortcut, placeholder, shortcutClassName, icon: Ico
377
599
  ref,
378
600
  ...otherProps,
379
601
  isInvalid,
380
- className: ({ isFocusWithin, isDisabled, isInvalid: isGroupInvalid }) => cx(
602
+ className: ({ isDisabled, isInvalid: isGroupInvalid }) => cx(
381
603
  "relative flex w-full items-center gap-2 rounded-lg border border-solid border-primary bg-primary shadow-xs outline-hidden transition-[border-color,box-shadow] duration-100 ease-linear",
382
604
  isDisabled && "cursor-not-allowed opacity-50",
383
- !isGroupInvalid && isFocusWithin && inputFocusRingShadow,
384
- isGroupInvalid && !isFocusWithin && "border-error_subtle",
385
- isGroupInvalid && isFocusWithin && inputErrorFocusRingShadow,
605
+ !isGroupInvalid && state?.isOpen && inputFocusRingShadow,
606
+ !isGroupInvalid && "has-[input:focus-visible]:border-brand has-[input:focus-visible]:ring-1 has-[input:focus-visible]:ring-inset has-[input:focus-visible]:ring-brand",
607
+ isGroupInvalid && !state?.isOpen && "border-error_subtle",
608
+ isGroupInvalid && state?.isOpen && inputErrorFocusRingShadow,
609
+ isGroupInvalid && "has-[input:focus-visible]:border-error has-[input:focus-visible]:ring-1 has-[input:focus-visible]:ring-inset has-[input:focus-visible]:ring-error",
386
610
  // Icon styles
387
611
  "*:data-icon:shrink-0 *:data-icon:text-fg-quaternary",
388
612
  sizes3[size].root
@@ -436,26 +660,40 @@ var ComboBox = ({
436
660
  shortcutClassName,
437
661
  icon,
438
662
  hideRequiredIndicator,
663
+ mobileOptions,
439
664
  ...otherProps
440
665
  }) => {
441
- const placeholderRef = useRef(null);
666
+ const isMobile = useIsMobile();
667
+ const resolvedMobile = useMemo(() => resolveSelectMobileOptions(mobileOptions), [mobileOptions]);
668
+ const useMobileSheet = isMobile && resolvedMobile.sheet;
669
+ const triggerRef = useRef(null);
442
670
  const [popoverWidth, setPopoverWidth] = useState("");
443
671
  const onResize = useCallback(() => {
444
- if (!placeholderRef.current) return;
445
- const divRect = placeholderRef.current?.getBoundingClientRect();
672
+ if (!triggerRef.current) return;
673
+ const divRect = triggerRef.current.getBoundingClientRect();
446
674
  setPopoverWidth(divRect.width + "px");
447
- }, [placeholderRef, setPopoverWidth]);
675
+ }, []);
448
676
  useResizeObserver({
449
- ref: placeholderRef,
677
+ ref: triggerRef,
450
678
  box: "border-box",
451
679
  onResize
452
680
  });
453
- return /* @__PURE__ */ jsx(SelectContext.Provider, { value: { size }, children: /* @__PURE__ */ jsx(ComboBox$1, { menuTrigger: "focus", ...otherProps, children: (state) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
681
+ return /* @__PURE__ */ jsx(SelectContext.Provider, { value: { size }, children: /* @__PURE__ */ jsx(ComboBox$1, { menuTrigger: useMobileSheet ? "manual" : "focus", ...otherProps, children: (state) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
454
682
  otherProps.label && /* @__PURE__ */ jsx(Label, { isRequired: hideRequiredIndicator ? false : state.isRequired, tooltip: otherProps.tooltip, children: otherProps.label }),
455
- /* @__PURE__ */ jsx(
683
+ useMobileSheet ? /* @__PURE__ */ jsx(
684
+ ComboBoxMobileTrigger,
685
+ {
686
+ ref: triggerRef,
687
+ placeholder,
688
+ icon,
689
+ size,
690
+ isInvalid: state.isInvalid,
691
+ onPointerEnter: onResize
692
+ }
693
+ ) : /* @__PURE__ */ jsx(
456
694
  ComboBoxValue,
457
695
  {
458
- ref: placeholderRef,
696
+ ref: triggerRef,
459
697
  placeholder,
460
698
  shortcut,
461
699
  shortcutClassName,
@@ -466,13 +704,27 @@ var ComboBox = ({
466
704
  onPointerEnter: onResize
467
705
  }
468
706
  ),
469
- /* @__PURE__ */ jsx(Popover, { size, triggerRef: placeholderRef, style: { width: popoverWidth }, className: otherProps.popoverClassName, children: /* @__PURE__ */ jsx(ListBox, { items, className: "size-full outline-hidden", children }) }),
707
+ /* @__PURE__ */ jsx(
708
+ Popover,
709
+ {
710
+ size,
711
+ triggerRef,
712
+ compoundContent: useMobileSheet,
713
+ style: useMobileSheet ? void 0 : { width: popoverWidth },
714
+ className: otherProps.popoverClassName,
715
+ mobileOptions: { title: otherProps.label, ...mobileOptions },
716
+ children: useMobileSheet ? /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-col overflow-hidden outline-hidden", children: [
717
+ /* @__PURE__ */ jsx(ComboBoxSheetSearch, { size, placeholder, icon }),
718
+ /* @__PURE__ */ jsx(ListBox, { items, className: "min-h-0 flex-1 overflow-y-auto py-1 outline-hidden", children })
719
+ ] }) : /* @__PURE__ */ jsx(ListBox, { items, className: "size-full outline-hidden", children })
720
+ }
721
+ ),
470
722
  otherProps.hint && /* @__PURE__ */ jsx(HintText, { isInvalid: state.isInvalid, className: cx(size === "sm" && "text-xs"), children: otherProps.hint })
471
723
  ] }) }) });
472
724
  };
473
725
  var CHECKBOX_TICK_DELAY_MS = 60;
474
726
  var CHECKBOX_TICK_DRAW_MS = 100;
475
- function CheckboxAnimatedCheckMark({ className }) {
727
+ function CheckboxAnimatedCheckMark({ pixelSize, className }) {
476
728
  const pathRef = useRef(null);
477
729
  useLayoutEffect(() => {
478
730
  const path = pathRef.current;
@@ -493,7 +745,7 @@ function CheckboxAnimatedCheckMark({ className }) {
493
745
  });
494
746
  return () => anim.cancel();
495
747
  }, []);
496
- return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 14 14", fill: "none", className: cx("block shrink-0", className), children: /* @__PURE__ */ jsx(
748
+ return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", width: pixelSize, height: pixelSize, viewBox: "0 0 14 14", fill: "none", className: cx("block", className), children: /* @__PURE__ */ jsx(
497
749
  "path",
498
750
  {
499
751
  ref: pathRef,
@@ -508,14 +760,15 @@ function CheckboxAnimatedCheckMark({ className }) {
508
760
  var focusRingShadow = "outline-none [box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]";
509
761
  var CheckboxBase = ({ className, isSelected, isDisabled, isIndeterminate, size = "sm", isFocusVisible = false }) => {
510
762
  const isChecked = isSelected || isIndeterminate;
511
- const iconClassName = size === "sm" ? "size-2.5" : "size-3.5";
763
+ const iconPixelSize = size === "sm" ? 10 : 14;
512
764
  return /* @__PURE__ */ jsxs(
513
765
  "div",
514
766
  {
515
767
  className: cx(
516
- "relative flex shrink-0 cursor-pointer appearance-none items-center justify-center border border-solid border-primary",
768
+ "relative flex shrink-0 cursor-pointer appearance-none items-center justify-center overflow-clip border border-solid border-primary",
517
769
  size === "sm" ? "size-4 rounded-xs" : "size-5 rounded-sm",
518
770
  isChecked ? "border-transparent bg-brand-solid" : "bg-primary",
771
+ !isChecked && !isDisabled && "group-hover:bg-primary_hover",
519
772
  isDisabled && "cursor-not-allowed opacity-50",
520
773
  isDisabled && !isChecked && "bg-tertiary",
521
774
  isFocusVisible && !isDisabled && focusRingShadow,
@@ -526,13 +779,15 @@ var CheckboxBase = ({ className, isSelected, isDisabled, isIndeterminate, size =
526
779
  "svg",
527
780
  {
528
781
  "aria-hidden": "true",
782
+ width: iconPixelSize,
783
+ height: iconPixelSize,
529
784
  viewBox: "0 0 14 14",
530
785
  fill: "none",
531
- className: cx("pointer-events-none block shrink-0 text-fg-white", iconClassName),
786
+ className: "pointer-events-none block text-fg-white",
532
787
  children: /* @__PURE__ */ jsx("path", { d: "M2.91675 7H11.0834", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
533
788
  }
534
789
  ),
535
- isSelected && !isIndeterminate && /* @__PURE__ */ jsx(CheckboxAnimatedCheckMark, { className: cx("pointer-events-none text-fg-white", iconClassName) })
790
+ isSelected && !isIndeterminate && /* @__PURE__ */ jsx(CheckboxAnimatedCheckMark, { pixelSize: iconPixelSize, className: "pointer-events-none text-fg-white" })
536
791
  ]
537
792
  }
538
793
  );
@@ -600,7 +855,8 @@ var SelectItem = ({
600
855
  {
601
856
  className: cx(
602
857
  "flex cursor-pointer items-center rounded-md outline-hidden select-none",
603
- (state.isFocused || state.isHovered || state.isSelected && selectionIndicator !== "checkbox") && "bg-primary_hover",
858
+ (state.isFocused || state.isHovered) && !(state.isSelected && selectionIndicator !== "checkbox") && "bg-primary_hover",
859
+ state.isSelected && selectionIndicator !== "checkbox" && "bg-brand-primary_alt",
604
860
  state.isDisabled && "cursor-not-allowed opacity-50",
605
861
  // Icon styles
606
862
  "*:data-icon:shrink-0 *:data-icon:text-fg-quaternary",
@@ -621,8 +877,8 @@ var SelectItem = ({
621
877
  }
622
878
  );
623
879
  };
624
- var SelectValue = ({ isOpen, isFocused, isDisabled, isInvalid, size, placeholder, icon, ref }) => {
625
- const isActive = isFocused || isOpen;
880
+ var SelectValue = ({ isOpen, isFocusVisible, isDisabled, isInvalid, size, placeholder, icon, ref }) => {
881
+ const isActive = isOpen || isFocusVisible;
626
882
  return /* @__PURE__ */ jsx(
627
883
  Button,
628
884
  {
@@ -668,11 +924,11 @@ var SelectValue = ({ isOpen, isFocused, isDisabled, isInvalid, size, placeholder
668
924
  }
669
925
  );
670
926
  };
671
- var Select = ({ placeholder = "Select", icon, size = "md", children, items, label, hint, tooltip, hideRequiredIndicator, className, ...rest }) => {
927
+ var Select = ({ placeholder = "Select", icon, size = "md", children, items, label, hint, tooltip, hideRequiredIndicator, mobileOptions, className, ...rest }) => {
672
928
  return /* @__PURE__ */ jsx(SelectContext.Provider, { value: { size }, children: /* @__PURE__ */ jsx(Select$1, { ...rest, className: (state) => cx("flex flex-col gap-1.5", typeof className === "function" ? className(state) : className), children: (state) => /* @__PURE__ */ jsxs(Fragment, { children: [
673
929
  label && /* @__PURE__ */ jsx(Label, { isRequired: hideRequiredIndicator ? false : state.isRequired, tooltip, children: label }),
674
930
  /* @__PURE__ */ jsx(SelectValue, { ...state, ...{ size, placeholder }, icon }),
675
- /* @__PURE__ */ jsx(Popover, { size, className: rest.popoverClassName, children: /* @__PURE__ */ jsx(ListBox, { items, className: "size-full outline-hidden", children }) }),
931
+ /* @__PURE__ */ jsx(Popover, { size, className: rest.popoverClassName, mobileOptions: { title: label, ...mobileOptions }, children: /* @__PURE__ */ jsx(ListBox, { items, className: "size-full outline-hidden", children }) }),
676
932
  hint && /* @__PURE__ */ jsx(HintText, { isInvalid: state.isInvalid, className: cx(size === "sm" && "text-xs"), children: hint })
677
933
  ] }) }) });
678
934
  };