@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.
- package/dist/react/checkbox.js +10 -7
- package/dist/react/checkbox.js.map +1 -1
- package/dist/react/combobox.d.ts +3 -2
- package/dist/react/combobox.js +284 -32
- package/dist/react/combobox.js.map +1 -1
- package/dist/react/dropdown-account-breadcrumb.js +176 -14
- package/dist/react/dropdown-account-breadcrumb.js.map +1 -1
- package/dist/react/dropdown-account-button.js +186 -21
- package/dist/react/dropdown-account-button.js.map +1 -1
- package/dist/react/dropdown-account-card-md.js +187 -22
- package/dist/react/dropdown-account-card-md.js.map +1 -1
- package/dist/react/dropdown-account-card-sm.js +187 -22
- package/dist/react/dropdown-account-card-sm.js.map +1 -1
- package/dist/react/dropdown-account-card-xs.js +187 -22
- package/dist/react/dropdown-account-card-xs.js.map +1 -1
- package/dist/react/dropdown-avatar.js +186 -21
- package/dist/react/dropdown-avatar.js.map +1 -1
- package/dist/react/dropdown-button-advanced.js +186 -21
- package/dist/react/dropdown-button-advanced.js.map +1 -1
- package/dist/react/dropdown-button-link.js +187 -22
- package/dist/react/dropdown-button-link.js.map +1 -1
- package/dist/react/dropdown-button-simple.js +186 -21
- package/dist/react/dropdown-button-simple.js.map +1 -1
- package/dist/react/dropdown-icon-advanced.js +187 -22
- package/dist/react/dropdown-icon-advanced.js.map +1 -1
- package/dist/react/dropdown-icon-simple.js +187 -22
- package/dist/react/dropdown-icon-simple.js.map +1 -1
- package/dist/react/dropdown-integration.js +186 -21
- package/dist/react/dropdown-integration.js.map +1 -1
- package/dist/react/dropdown-search-advanced.js +186 -21
- package/dist/react/dropdown-search-advanced.js.map +1 -1
- package/dist/react/dropdown-search-simple.js +186 -21
- package/dist/react/dropdown-search-simple.js.map +1 -1
- package/dist/react/dropdown.d.ts +4 -1
- package/dist/react/dropdown.js +187 -22
- package/dist/react/dropdown.js.map +1 -1
- package/dist/react/input-tags-outer.js +8 -8
- package/dist/react/input-tags-outer.js.map +1 -1
- package/dist/react/input-tags.js +8 -8
- package/dist/react/input-tags.js.map +1 -1
- package/dist/react/multi-select.d.ts +3 -2
- package/dist/react/multi-select.js +228 -27
- package/dist/react/multi-select.js.map +1 -1
- package/dist/react/popover.d.ts +10 -1
- package/dist/react/popover.js +195 -18
- package/dist/react/popover.js.map +1 -1
- package/dist/react/radio-buttons.js +2 -1
- package/dist/react/radio-buttons.js.map +1 -1
- package/dist/react/select-item.d.ts +2 -1
- package/dist/react/select-item.js +11 -7
- package/dist/react/select-item.js.map +1 -1
- package/dist/react/select.d.ts +4 -3
- package/dist/react/select.js +298 -42
- package/dist/react/select.js.map +1 -1
- package/dist/react/switch.js +1 -1
- package/dist/react/switch.js.map +1 -1
- package/dist/react/tag-select.d.ts +5 -2
- package/dist/react/tag-select.js +215 -25
- package/dist/react/tag-select.js.map +1 -1
- package/dist/react/tags.js +8 -8
- package/dist/react/tags.js.map +1 -1
- package/dist/select-mobile-sheet-CB2ptDTJ.d.ts +12 -0
- package/dist/{select-shared-B3Y5SMXU.d.ts → select-shared-oJEeJxeB.d.ts} +6 -0
- package/package.json +1 -1
- package/theme.css +1 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { createContext, useState, useRef, useCallback, useContext, isValidElement, useLayoutEffect } from 'react';
|
|
1
|
+
import { createContext, useState, useRef, useCallback, useEffect, useMemo, useContext, isValidElement, useLayoutEffect } from 'react';
|
|
2
2
|
import { CaretDownIcon } from '@phosphor-icons/react/dist/csr/CaretDown';
|
|
3
3
|
import { MagnifyingGlassIcon } from '@phosphor-icons/react/dist/csr/MagnifyingGlass';
|
|
4
4
|
import { useFilter } from 'react-aria';
|
|
5
|
-
import { DialogTrigger, Button as Button$1,
|
|
5
|
+
import { DialogTrigger, Button as Button$1, Dialog, Autocomplete, SearchField, Input, ListBox, Label as Label$1, OverlayTriggerStateContext, Popover as Popover$1, Text, ListBoxItem, TooltipTrigger as TooltipTrigger$1, Tooltip as Tooltip$1, OverlayArrow, Link } from 'react-aria-components';
|
|
6
6
|
import { extendTailwindMerge } from 'tailwind-merge';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import { QuestionIcon } from '@phosphor-icons/react/dist/csr/Question';
|
|
9
9
|
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
|
+
import { createPortal } from 'react-dom';
|
|
13
|
+
import { XIcon } from '@phosphor-icons/react/dist/csr/X';
|
|
12
14
|
import { CheckIcon } from '@phosphor-icons/react/dist/csr/Check';
|
|
13
15
|
import { UserIcon } from '@phosphor-icons/react/dist/csr/User';
|
|
14
16
|
import '@phosphor-icons/react/dist/csr/Plus';
|
|
@@ -534,9 +536,203 @@ var FeaturedIcon = (props) => {
|
|
|
534
536
|
}
|
|
535
537
|
);
|
|
536
538
|
};
|
|
539
|
+
var MOBILE_SHEET_MAX_PX = 1024;
|
|
540
|
+
function useIsMobile(breakpoint = MOBILE_SHEET_MAX_PX + 1) {
|
|
541
|
+
const [isMobile, setIsMobile] = useState(() => {
|
|
542
|
+
if (typeof window === "undefined") return false;
|
|
543
|
+
return window.matchMedia(`(max-width: ${breakpoint - 1}px)`).matches;
|
|
544
|
+
});
|
|
545
|
+
useEffect(() => {
|
|
546
|
+
const mq = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
|
|
547
|
+
const handler = (e) => setIsMobile(e.matches);
|
|
548
|
+
mq.addEventListener("change", handler);
|
|
549
|
+
return () => mq.removeEventListener("change", handler);
|
|
550
|
+
}, [breakpoint]);
|
|
551
|
+
return isMobile;
|
|
552
|
+
}
|
|
537
553
|
var inputFocusRingShadow = "border-brand ring-1 ring-inset ring-brand";
|
|
538
554
|
var inputErrorFocusRingShadow = "border-error ring-1 ring-inset ring-error";
|
|
539
555
|
createContext({});
|
|
556
|
+
var MOBILE_SHEET_MOTION_MS = 175;
|
|
557
|
+
var MOBILE_SHEET_ENTRY_EASING = "cubic-bezier(0.85, 0, 0.15, 1)";
|
|
558
|
+
var MOBILE_SHEET_EXIT_EASING = "cubic-bezier(0.85, 0, 1, 0.15)";
|
|
559
|
+
var MOBILE_SHEET_SLIDE_ENTRANCE_OFFSET_PX = 120;
|
|
560
|
+
function resolveSelectMobileOptions(mobileOptions) {
|
|
561
|
+
return {
|
|
562
|
+
sheet: mobileOptions?.sheet ?? true,
|
|
563
|
+
title: mobileOptions?.title,
|
|
564
|
+
sheetClassName: mobileOptions?.className,
|
|
565
|
+
contentClassName: mobileOptions?.contentClassName
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
function useMobileSheetAnimation(open, enabled, slideEntrance = true, slideOffsetPx = MOBILE_SHEET_SLIDE_ENTRANCE_OFFSET_PX) {
|
|
569
|
+
const [shouldRender, setShouldRender] = useState(open);
|
|
570
|
+
const [isAnimating, setIsAnimating] = useState(false);
|
|
571
|
+
useLayoutEffect(() => {
|
|
572
|
+
if (!enabled) {
|
|
573
|
+
setShouldRender(open);
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
if (open) {
|
|
577
|
+
setShouldRender(true);
|
|
578
|
+
}
|
|
579
|
+
}, [open, enabled]);
|
|
580
|
+
useEffect(() => {
|
|
581
|
+
if (!enabled || open) return;
|
|
582
|
+
const timer = setTimeout(() => setShouldRender(false), MOBILE_SHEET_MOTION_MS);
|
|
583
|
+
return () => clearTimeout(timer);
|
|
584
|
+
}, [open, enabled]);
|
|
585
|
+
useLayoutEffect(() => {
|
|
586
|
+
if (!enabled || open || !shouldRender) return;
|
|
587
|
+
setIsAnimating(false);
|
|
588
|
+
}, [enabled, open, shouldRender]);
|
|
589
|
+
useEffect(() => {
|
|
590
|
+
if (!enabled || !shouldRender || !open) return;
|
|
591
|
+
let raf2 = 0;
|
|
592
|
+
const raf1 = requestAnimationFrame(() => {
|
|
593
|
+
raf2 = requestAnimationFrame(() => setIsAnimating(true));
|
|
594
|
+
});
|
|
595
|
+
return () => {
|
|
596
|
+
cancelAnimationFrame(raf1);
|
|
597
|
+
if (raf2) cancelAnimationFrame(raf2);
|
|
598
|
+
};
|
|
599
|
+
}, [shouldRender, open, enabled]);
|
|
600
|
+
const motionEasing = open ? MOBILE_SHEET_ENTRY_EASING : MOBILE_SHEET_EXIT_EASING;
|
|
601
|
+
const hiddenTransform = slideEntrance ? `translateY(${slideOffsetPx}px)` : "translateY(100%)";
|
|
602
|
+
const panelStyle = enabled ? {
|
|
603
|
+
transform: isAnimating ? "translateY(0)" : hiddenTransform,
|
|
604
|
+
opacity: isAnimating ? 1 : 0,
|
|
605
|
+
transitionProperty: "transform, opacity",
|
|
606
|
+
transitionDuration: `${MOBILE_SHEET_MOTION_MS}ms`,
|
|
607
|
+
transitionTimingFunction: motionEasing
|
|
608
|
+
} : void 0;
|
|
609
|
+
const backdropStyle = enabled ? {
|
|
610
|
+
opacity: isAnimating ? 1 : 0,
|
|
611
|
+
transitionProperty: "opacity",
|
|
612
|
+
transitionDuration: `${MOBILE_SHEET_MOTION_MS}ms`,
|
|
613
|
+
transitionTimingFunction: motionEasing
|
|
614
|
+
} : void 0;
|
|
615
|
+
return { shouldRender, isAnimating, panelStyle, backdropStyle };
|
|
616
|
+
}
|
|
617
|
+
function MobileSheetCloseButton({ onClose }) {
|
|
618
|
+
return /* @__PURE__ */ jsxs(
|
|
619
|
+
"button",
|
|
620
|
+
{
|
|
621
|
+
type: "button",
|
|
622
|
+
onClick: (e) => {
|
|
623
|
+
e.stopPropagation();
|
|
624
|
+
onClose();
|
|
625
|
+
},
|
|
626
|
+
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)]",
|
|
627
|
+
children: [
|
|
628
|
+
/* @__PURE__ */ jsx(XIcon, { className: "size-5", "aria-hidden": "true" }),
|
|
629
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
630
|
+
]
|
|
631
|
+
}
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
function MobileSheetChrome({
|
|
635
|
+
title,
|
|
636
|
+
contentClassName,
|
|
637
|
+
onClose,
|
|
638
|
+
children
|
|
639
|
+
}) {
|
|
640
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
641
|
+
/* @__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: [
|
|
642
|
+
title ? /* @__PURE__ */ jsx("p", { className: "min-w-0 flex-1 truncate text-base font-semibold text-primary", children: title }) : null,
|
|
643
|
+
/* @__PURE__ */ jsx(MobileSheetCloseButton, { onClose })
|
|
644
|
+
] }),
|
|
645
|
+
/* @__PURE__ */ jsx(
|
|
646
|
+
"div",
|
|
647
|
+
{
|
|
648
|
+
className: cx(
|
|
649
|
+
"min-h-0 flex-1 overflow-y-auto pb-[calc(5rem+env(safe-area-inset-bottom,0px))]",
|
|
650
|
+
contentClassName
|
|
651
|
+
),
|
|
652
|
+
children
|
|
653
|
+
}
|
|
654
|
+
)
|
|
655
|
+
] });
|
|
656
|
+
}
|
|
657
|
+
var Popover = ({ mobileOptions, children, size, className, style, compoundContent = false, ...props }) => {
|
|
658
|
+
const isMobile = useIsMobile();
|
|
659
|
+
const resolvedMobile = useMemo(() => resolveSelectMobileOptions(mobileOptions), [mobileOptions]);
|
|
660
|
+
const useMobileSheet = isMobile && resolvedMobile.sheet;
|
|
661
|
+
const overlayState = useContext(OverlayTriggerStateContext);
|
|
662
|
+
const open = overlayState?.isOpen ?? false;
|
|
663
|
+
const { shouldRender, panelStyle, backdropStyle } = useMobileSheetAnimation(open, useMobileSheet);
|
|
664
|
+
useEffect(() => {
|
|
665
|
+
if (!useMobileSheet || !open) return;
|
|
666
|
+
const prev = document.body.style.overflow;
|
|
667
|
+
document.body.style.overflow = "hidden";
|
|
668
|
+
return () => {
|
|
669
|
+
document.body.style.overflow = prev;
|
|
670
|
+
};
|
|
671
|
+
}, [useMobileSheet, open]);
|
|
672
|
+
const close = () => overlayState?.close();
|
|
673
|
+
const showMobileSheet = useMobileSheet && shouldRender;
|
|
674
|
+
const isMobileSheetExiting = showMobileSheet && !open;
|
|
675
|
+
const mobileScrim = useMobileSheet && shouldRender && typeof document !== "undefined" ? createPortal(
|
|
676
|
+
/* @__PURE__ */ jsx(
|
|
677
|
+
"div",
|
|
678
|
+
{
|
|
679
|
+
className: "fixed inset-0 z-50 bg-overlay/70",
|
|
680
|
+
style: backdropStyle,
|
|
681
|
+
onClick: close,
|
|
682
|
+
"aria-hidden": "true"
|
|
683
|
+
}
|
|
684
|
+
),
|
|
685
|
+
document.body
|
|
686
|
+
) : null;
|
|
687
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
688
|
+
mobileScrim,
|
|
689
|
+
/* @__PURE__ */ jsx(
|
|
690
|
+
Popover$1,
|
|
691
|
+
{
|
|
692
|
+
placement: "bottom",
|
|
693
|
+
containerPadding: 0,
|
|
694
|
+
offset: 4,
|
|
695
|
+
...props,
|
|
696
|
+
isExiting: isMobileSheetExiting,
|
|
697
|
+
...useMobileSheet ? { "data-select-mobile-sheet": true } : {},
|
|
698
|
+
style: useMobileSheet ? { ...panelStyle, ...style } : style,
|
|
699
|
+
className: (state) => cx(
|
|
700
|
+
"outline-hidden",
|
|
701
|
+
!useMobileSheet && [
|
|
702
|
+
"w-(--trigger-width) origin-(--trigger-anchor-point) rounded-lg bg-primary shadow-lg ring-1 ring-secondary_alt will-change-transform",
|
|
703
|
+
compoundContent ? "overflow-hidden outline-hidden" : "overflow-x-hidden overflow-y-auto py-1 outline-hidden",
|
|
704
|
+
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",
|
|
705
|
+
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",
|
|
706
|
+
!compoundContent && size === "sm" && "max-h-56!",
|
|
707
|
+
!compoundContent && size === "md" && "max-h-64!",
|
|
708
|
+
!compoundContent && size === "lg" && "max-h-80!"
|
|
709
|
+
],
|
|
710
|
+
useMobileSheet && [
|
|
711
|
+
"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",
|
|
712
|
+
"max-h-[min(90dvh,calc(100dvh-env(safe-area-inset-bottom,0px)))]",
|
|
713
|
+
resolvedMobile.sheetClassName
|
|
714
|
+
],
|
|
715
|
+
typeof className === "function" ? className(state) : className
|
|
716
|
+
),
|
|
717
|
+
children: (state) => {
|
|
718
|
+
const content = typeof children === "function" ? children(state) : children;
|
|
719
|
+
if (useMobileSheet) {
|
|
720
|
+
return /* @__PURE__ */ jsx(
|
|
721
|
+
MobileSheetChrome,
|
|
722
|
+
{
|
|
723
|
+
title: resolvedMobile.title,
|
|
724
|
+
contentClassName: resolvedMobile.contentClassName,
|
|
725
|
+
onClose: close,
|
|
726
|
+
children: content
|
|
727
|
+
}
|
|
728
|
+
);
|
|
729
|
+
}
|
|
730
|
+
return content;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
)
|
|
734
|
+
] });
|
|
735
|
+
};
|
|
540
736
|
var sizes = {
|
|
541
737
|
xs: "size-1.5",
|
|
542
738
|
sm: "size-2",
|
|
@@ -689,7 +885,7 @@ var Avatar = ({
|
|
|
689
885
|
};
|
|
690
886
|
var CHECKBOX_TICK_DELAY_MS = 60;
|
|
691
887
|
var CHECKBOX_TICK_DRAW_MS = 100;
|
|
692
|
-
function CheckboxAnimatedCheckMark({ className }) {
|
|
888
|
+
function CheckboxAnimatedCheckMark({ pixelSize, className }) {
|
|
693
889
|
const pathRef = useRef(null);
|
|
694
890
|
useLayoutEffect(() => {
|
|
695
891
|
const path = pathRef.current;
|
|
@@ -710,7 +906,7 @@ function CheckboxAnimatedCheckMark({ className }) {
|
|
|
710
906
|
});
|
|
711
907
|
return () => anim.cancel();
|
|
712
908
|
}, []);
|
|
713
|
-
return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 14 14", fill: "none", className: cx("block
|
|
909
|
+
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(
|
|
714
910
|
"path",
|
|
715
911
|
{
|
|
716
912
|
ref: pathRef,
|
|
@@ -725,14 +921,15 @@ function CheckboxAnimatedCheckMark({ className }) {
|
|
|
725
921
|
var focusRingShadow = "outline-none [box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]";
|
|
726
922
|
var CheckboxBase = ({ className, isSelected, isDisabled, isIndeterminate, size = "sm", isFocusVisible = false }) => {
|
|
727
923
|
const isChecked = isSelected || isIndeterminate;
|
|
728
|
-
const
|
|
924
|
+
const iconPixelSize = size === "sm" ? 10 : 14;
|
|
729
925
|
return /* @__PURE__ */ jsxs(
|
|
730
926
|
"div",
|
|
731
927
|
{
|
|
732
928
|
className: cx(
|
|
733
|
-
"relative flex shrink-0 cursor-pointer appearance-none items-center justify-center border border-solid border-primary",
|
|
929
|
+
"relative flex shrink-0 cursor-pointer appearance-none items-center justify-center overflow-clip border border-solid border-primary",
|
|
734
930
|
size === "sm" ? "size-4 rounded-xs" : "size-5 rounded-sm",
|
|
735
931
|
isChecked ? "border-transparent bg-brand-solid" : "bg-primary",
|
|
932
|
+
!isChecked && !isDisabled && "group-hover:bg-primary_hover",
|
|
736
933
|
isDisabled && "cursor-not-allowed opacity-50",
|
|
737
934
|
isDisabled && !isChecked && "bg-tertiary",
|
|
738
935
|
isFocusVisible && !isDisabled && focusRingShadow,
|
|
@@ -743,13 +940,15 @@ var CheckboxBase = ({ className, isSelected, isDisabled, isIndeterminate, size =
|
|
|
743
940
|
"svg",
|
|
744
941
|
{
|
|
745
942
|
"aria-hidden": "true",
|
|
943
|
+
width: iconPixelSize,
|
|
944
|
+
height: iconPixelSize,
|
|
746
945
|
viewBox: "0 0 14 14",
|
|
747
946
|
fill: "none",
|
|
748
|
-
className:
|
|
947
|
+
className: "pointer-events-none block text-fg-white",
|
|
749
948
|
children: /* @__PURE__ */ jsx("path", { d: "M2.91675 7H11.0834", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
750
949
|
}
|
|
751
950
|
),
|
|
752
|
-
isSelected && !isIndeterminate && /* @__PURE__ */ jsx(CheckboxAnimatedCheckMark, { className:
|
|
951
|
+
isSelected && !isIndeterminate && /* @__PURE__ */ jsx(CheckboxAnimatedCheckMark, { pixelSize: iconPixelSize, className: "pointer-events-none text-fg-white" })
|
|
753
952
|
]
|
|
754
953
|
}
|
|
755
954
|
);
|
|
@@ -766,6 +965,11 @@ var sizes3 = {
|
|
|
766
965
|
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" },
|
|
767
966
|
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" }
|
|
768
967
|
};
|
|
968
|
+
var searchSizes = {
|
|
969
|
+
sm: { wrapper: "py-1", root: "px-3 py-2 gap-2 *:data-icon:size-4 *:data-icon:stroke-[2.25px]", text: "text-sm" },
|
|
970
|
+
md: { wrapper: "py-0.5", root: "px-3 py-2 gap-2 *:data-icon:size-5", text: "text-md" },
|
|
971
|
+
lg: { wrapper: "py-0.5", root: "px-3.5 py-2.5 gap-2 *:data-icon:size-5", text: "text-md" }
|
|
972
|
+
};
|
|
769
973
|
var SelectContext = createContext({ size: "md" });
|
|
770
974
|
var sizes4 = {
|
|
771
975
|
sm: {
|
|
@@ -829,7 +1033,8 @@ var SelectItem = ({
|
|
|
829
1033
|
{
|
|
830
1034
|
className: cx(
|
|
831
1035
|
"flex cursor-pointer items-center rounded-md outline-hidden select-none",
|
|
832
|
-
(state.isFocused || state.isHovered
|
|
1036
|
+
(state.isFocused || state.isHovered) && !(state.isSelected && selectionIndicator !== "checkbox") && "bg-primary_hover",
|
|
1037
|
+
state.isSelected && selectionIndicator !== "checkbox" && "bg-brand-primary_alt",
|
|
833
1038
|
state.isDisabled && "cursor-not-allowed opacity-50",
|
|
834
1039
|
// Icon styles
|
|
835
1040
|
"*:data-icon:shrink-0 *:data-icon:text-fg-quaternary",
|
|
@@ -850,11 +1055,6 @@ var SelectItem = ({
|
|
|
850
1055
|
}
|
|
851
1056
|
);
|
|
852
1057
|
};
|
|
853
|
-
var searchSizes = {
|
|
854
|
-
sm: { wrapper: "py-1", root: "px-3 py-2 gap-2 *:data-icon:size-4 *:data-icon:stroke-[2.25px]", text: "text-sm" },
|
|
855
|
-
md: { wrapper: "py-0.5", root: "px-3 py-2 gap-2 *:data-icon:size-5", text: "text-md" },
|
|
856
|
-
lg: { wrapper: "py-0.5", root: "px-3.5 py-2.5 gap-2 *:data-icon:size-5", text: "text-md" }
|
|
857
|
-
};
|
|
858
1058
|
var footerButtonSize = {
|
|
859
1059
|
sm: "xs",
|
|
860
1060
|
md: "sm",
|
|
@@ -903,6 +1103,7 @@ var MultiSelectRoot = ({
|
|
|
903
1103
|
tooltip,
|
|
904
1104
|
hideRequiredIndicator,
|
|
905
1105
|
popoverClassName,
|
|
1106
|
+
mobileOptions,
|
|
906
1107
|
className,
|
|
907
1108
|
onReset,
|
|
908
1109
|
onSelectAll,
|
|
@@ -913,6 +1114,7 @@ var MultiSelectRoot = ({
|
|
|
913
1114
|
selectedCountFormatter,
|
|
914
1115
|
supportingText
|
|
915
1116
|
}) => {
|
|
1117
|
+
const isMobile = useIsMobile();
|
|
916
1118
|
const { contains } = useFilter({ sensitivity: "base" });
|
|
917
1119
|
const [searchValue, setSearchValue] = useState("");
|
|
918
1120
|
const triggerRef = useRef(null);
|
|
@@ -971,19 +1173,15 @@ var MultiSelectRoot = ({
|
|
|
971
1173
|
/* @__PURE__ */ jsx(
|
|
972
1174
|
Popover,
|
|
973
1175
|
{
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1176
|
+
size,
|
|
1177
|
+
triggerRef,
|
|
1178
|
+
compoundContent: true,
|
|
977
1179
|
style: { width: popoverWidth || void 0 },
|
|
978
|
-
className:
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
state.isExiting && "duration-100 ease-in animate-out fade-out placement-top:slide-out-to-bottom-0.5 placement-bottom:slide-out-to-top-0.5",
|
|
982
|
-
popoverClassName
|
|
983
|
-
),
|
|
984
|
-
children: /* @__PURE__ */ jsxs(Dialog, { className: "outline-hidden", children: [
|
|
1180
|
+
className: popoverClassName,
|
|
1181
|
+
mobileOptions: { title: label, ...mobileOptions },
|
|
1182
|
+
children: /* @__PURE__ */ jsxs(Dialog, { className: "flex flex-col overflow-hidden outline-hidden", children: [
|
|
985
1183
|
/* @__PURE__ */ jsxs(Autocomplete, { filter: contains, inputValue: searchValue, onInputChange: setSearchValue, children: [
|
|
986
|
-
showSearch && /* @__PURE__ */ jsx("div", { className: cx("border-b border-secondary", searchSizes[size].wrapper), children: /* @__PURE__ */ jsx(SearchField, { "aria-label": "Search", value: searchValue, onChange: setSearchValue, autoFocus:
|
|
1184
|
+
showSearch && /* @__PURE__ */ jsx("div", { className: cx("shrink-0 border-b border-secondary", searchSizes[size].wrapper), children: /* @__PURE__ */ jsx(SearchField, { "aria-label": "Search", value: searchValue, onChange: setSearchValue, autoFocus: !isMobile, children: /* @__PURE__ */ jsxs("div", { className: cx("flex items-center", searchSizes[size].root), children: [
|
|
987
1185
|
/* @__PURE__ */ jsx(MagnifyingGlassIcon, { "data-icon": true, "aria-hidden": "true", className: "shrink-0 text-fg-quaternary" }),
|
|
988
1186
|
/* @__PURE__ */ jsx(
|
|
989
1187
|
Input,
|
|
@@ -1013,12 +1211,15 @@ var MultiSelectRoot = ({
|
|
|
1013
1211
|
onClearSearch: searchValue ? handleClearSearch : void 0
|
|
1014
1212
|
}
|
|
1015
1213
|
),
|
|
1016
|
-
className: cx(
|
|
1214
|
+
className: cx(
|
|
1215
|
+
"min-h-0 overflow-y-auto py-1 outline-hidden",
|
|
1216
|
+
!isMobile && popoverMaxHeights[size]
|
|
1217
|
+
),
|
|
1017
1218
|
children
|
|
1018
1219
|
}
|
|
1019
1220
|
)
|
|
1020
1221
|
] }),
|
|
1021
|
-
showFooter && /* @__PURE__ */ jsx(MultiSelectFooter, { size, onReset, onSelectAll })
|
|
1222
|
+
showFooter && /* @__PURE__ */ jsx(MultiSelectFooter, { size, onReset, onSelectAll, className: "shrink-0" })
|
|
1022
1223
|
] })
|
|
1023
1224
|
}
|
|
1024
1225
|
)
|