@foundrykit/components 1.0.9 → 1.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/dist/index.js CHANGED
@@ -609,9 +609,641 @@ function CommandShortcut({
609
609
  );
610
610
  }
611
611
 
612
- // src/index.ts
612
+ // src/components/advanced-search-bar/index.tsx
613
+ import * as React6 from "react";
614
+
615
+ // ../../node_modules/@radix-ui/react-slot/dist/index.mjs
616
+ import * as React5 from "react";
617
+
618
+ // ../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs
619
+ import * as React4 from "react";
620
+ function setRef(ref, value) {
621
+ if (typeof ref === "function") {
622
+ return ref(value);
623
+ } else if (ref !== null && ref !== void 0) {
624
+ ref.current = value;
625
+ }
626
+ }
627
+ function composeRefs(...refs) {
628
+ return (node) => {
629
+ let hasCleanup = false;
630
+ const cleanups = refs.map((ref) => {
631
+ const cleanup = setRef(ref, node);
632
+ if (!hasCleanup && typeof cleanup == "function") {
633
+ hasCleanup = true;
634
+ }
635
+ return cleanup;
636
+ });
637
+ if (hasCleanup) {
638
+ return () => {
639
+ for (let i = 0; i < cleanups.length; i++) {
640
+ const cleanup = cleanups[i];
641
+ if (typeof cleanup == "function") {
642
+ cleanup();
643
+ } else {
644
+ setRef(refs[i], null);
645
+ }
646
+ }
647
+ };
648
+ }
649
+ };
650
+ }
651
+
652
+ // ../../node_modules/@radix-ui/react-slot/dist/index.mjs
653
+ import { Fragment as Fragment2, jsx as jsx6 } from "react/jsx-runtime";
654
+ // @__NO_SIDE_EFFECTS__
655
+ function createSlot(ownerName) {
656
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
657
+ const Slot2 = React5.forwardRef((props, forwardedRef) => {
658
+ const { children, ...slotProps } = props;
659
+ const childrenArray = React5.Children.toArray(children);
660
+ const slottable = childrenArray.find(isSlottable);
661
+ if (slottable) {
662
+ const newElement = slottable.props.children;
663
+ const newChildren = childrenArray.map((child) => {
664
+ if (child === slottable) {
665
+ if (React5.Children.count(newElement) > 1) return React5.Children.only(null);
666
+ return React5.isValidElement(newElement) ? newElement.props.children : null;
667
+ } else {
668
+ return child;
669
+ }
670
+ });
671
+ return /* @__PURE__ */ jsx6(SlotClone, { ...slotProps, ref: forwardedRef, children: React5.isValidElement(newElement) ? React5.cloneElement(newElement, void 0, newChildren) : null });
672
+ }
673
+ return /* @__PURE__ */ jsx6(SlotClone, { ...slotProps, ref: forwardedRef, children });
674
+ });
675
+ Slot2.displayName = `${ownerName}.Slot`;
676
+ return Slot2;
677
+ }
678
+ var Slot = /* @__PURE__ */ createSlot("Slot");
679
+ // @__NO_SIDE_EFFECTS__
680
+ function createSlotClone(ownerName) {
681
+ const SlotClone = React5.forwardRef((props, forwardedRef) => {
682
+ const { children, ...slotProps } = props;
683
+ if (React5.isValidElement(children)) {
684
+ const childrenRef = getElementRef(children);
685
+ const props2 = mergeProps(slotProps, children.props);
686
+ if (children.type !== React5.Fragment) {
687
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
688
+ }
689
+ return React5.cloneElement(children, props2);
690
+ }
691
+ return React5.Children.count(children) > 1 ? React5.Children.only(null) : null;
692
+ });
693
+ SlotClone.displayName = `${ownerName}.SlotClone`;
694
+ return SlotClone;
695
+ }
696
+ var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
697
+ function isSlottable(child) {
698
+ return React5.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
699
+ }
700
+ function mergeProps(slotProps, childProps) {
701
+ const overrideProps = { ...childProps };
702
+ for (const propName in childProps) {
703
+ const slotPropValue = slotProps[propName];
704
+ const childPropValue = childProps[propName];
705
+ const isHandler = /^on[A-Z]/.test(propName);
706
+ if (isHandler) {
707
+ if (slotPropValue && childPropValue) {
708
+ overrideProps[propName] = (...args) => {
709
+ const result = childPropValue(...args);
710
+ slotPropValue(...args);
711
+ return result;
712
+ };
713
+ } else if (slotPropValue) {
714
+ overrideProps[propName] = slotPropValue;
715
+ }
716
+ } else if (propName === "style") {
717
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
718
+ } else if (propName === "className") {
719
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
720
+ }
721
+ }
722
+ return { ...slotProps, ...overrideProps };
723
+ }
724
+ function getElementRef(element) {
725
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
726
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
727
+ if (mayWarn) {
728
+ return element.ref;
729
+ }
730
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
731
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
732
+ if (mayWarn) {
733
+ return element.props.ref;
734
+ }
735
+ return element.props.ref || element.ref;
736
+ }
737
+
738
+ // ../../node_modules/class-variance-authority/dist/index.mjs
739
+ import { clsx } from "clsx";
740
+ var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
741
+ var cx = clsx;
742
+ var cva = (base, config) => (props) => {
743
+ var _config_compoundVariants;
744
+ if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
745
+ const { variants, defaultVariants } = config;
746
+ const getVariantClassNames = Object.keys(variants).map((variant) => {
747
+ const variantProp = props === null || props === void 0 ? void 0 : props[variant];
748
+ const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
749
+ if (variantProp === null) return null;
750
+ const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
751
+ return variants[variant][variantKey];
752
+ });
753
+ const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
754
+ let [key, value] = param;
755
+ if (value === void 0) {
756
+ return acc;
757
+ }
758
+ acc[key] = value;
759
+ return acc;
760
+ }, {});
761
+ const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param) => {
762
+ let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
763
+ return Object.entries(compoundVariantOptions).every((param2) => {
764
+ let [key, value] = param2;
765
+ return Array.isArray(value) ? value.includes({
766
+ ...defaultVariants,
767
+ ...propsWithoutUndefined
768
+ }[key]) : {
769
+ ...defaultVariants,
770
+ ...propsWithoutUndefined
771
+ }[key] === value;
772
+ }) ? [
773
+ ...acc,
774
+ cvClass,
775
+ cvClassName
776
+ ] : acc;
777
+ }, []);
778
+ return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
779
+ };
780
+
781
+ // src/components/advanced-search-bar/index.tsx
782
+ import { Search as Search2, X, ChevronDown } from "lucide-react";
613
783
  import { cn as cn6 } from "@foundrykit/utils";
784
+ import { useAdvancedSearch, SearchContext } from "@foundrykit/hooks";
785
+ import { Input as Input3 } from "@foundrykit/primitives";
786
+ import { Button as Button4 } from "@foundrykit/primitives";
787
+ import { Separator } from "@foundrykit/primitives";
788
+ import { Badge } from "@foundrykit/primitives";
789
+ import { Card, CardContent } from "@foundrykit/primitives";
790
+ import {
791
+ Popover,
792
+ PopoverContent,
793
+ PopoverTrigger
794
+ } from "@foundrykit/primitives";
795
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
796
+ function AdvancedSearchProvider({
797
+ children,
798
+ onSearch,
799
+ onResultSelect,
800
+ debounceMs = 300,
801
+ minQueryLength = 1
802
+ }) {
803
+ const [query, setQuery] = React6.useState("");
804
+ const [isOpen, setIsOpen] = React6.useState(false);
805
+ const [results, setResults] = React6.useState([]);
806
+ const [isLoading, setIsLoading] = React6.useState(false);
807
+ const debouncedSearch = React6.useCallback(
808
+ (searchQuery) => {
809
+ const timeoutId = setTimeout(async () => {
810
+ if (searchQuery.length >= minQueryLength && onSearch) {
811
+ setIsLoading(true);
812
+ try {
813
+ const searchResults = await onSearch(searchQuery);
814
+ setResults(searchResults);
815
+ } catch (error) {
816
+ console.error("Search error:", error);
817
+ setResults([]);
818
+ } finally {
819
+ setIsLoading(false);
820
+ }
821
+ } else {
822
+ setResults([]);
823
+ }
824
+ }, debounceMs);
825
+ return () => clearTimeout(timeoutId);
826
+ },
827
+ [onSearch, debounceMs, minQueryLength]
828
+ );
829
+ const handleSearch = React6.useCallback(
830
+ (searchQuery) => {
831
+ setQuery(searchQuery);
832
+ debouncedSearch(searchQuery);
833
+ },
834
+ [debouncedSearch]
835
+ );
836
+ const handleResultSelect = React6.useCallback(
837
+ (result) => {
838
+ onResultSelect?.(result);
839
+ setIsOpen(false);
840
+ },
841
+ [onResultSelect]
842
+ );
843
+ const value = React6.useMemo(
844
+ () => ({
845
+ query,
846
+ setQuery,
847
+ isOpen,
848
+ setIsOpen,
849
+ results,
850
+ setResults,
851
+ isLoading,
852
+ setIsLoading,
853
+ onSearch: handleSearch,
854
+ onResultSelect: handleResultSelect
855
+ }),
856
+ [query, isOpen, results, isLoading, handleSearch, handleResultSelect]
857
+ );
858
+ return /* @__PURE__ */ jsx7(SearchContext.Provider, { value, children });
859
+ }
860
+ var searchInputWrapperVariants = cva("relative flex items-center w-full", {
861
+ variants: {
862
+ size: {
863
+ sm: "h-8",
864
+ md: "h-10",
865
+ lg: "h-12",
866
+ xl: "h-14"
867
+ },
868
+ variant: {
869
+ default: "border border-input bg-background",
870
+ ghost: "bg-transparent",
871
+ filled: "bg-muted"
872
+ }
873
+ },
874
+ defaultVariants: {
875
+ size: "md",
876
+ variant: "default"
877
+ }
878
+ });
879
+ var searchResultsVariants = cva("w-full", {
880
+ variants: {
881
+ size: {
882
+ sm: "max-w-sm",
883
+ md: "max-w-md",
884
+ lg: "max-w-lg",
885
+ xl: "max-w-xl",
886
+ "2xl": "max-w-2xl",
887
+ full: "max-w-full"
888
+ }
889
+ },
890
+ defaultVariants: {
891
+ size: "lg"
892
+ }
893
+ });
894
+ var SearchInput = React6.forwardRef(
895
+ ({
896
+ className,
897
+ size,
898
+ variant,
899
+ placeholder = "Search...",
900
+ showSearchIcon = true,
901
+ showClearButton = true,
902
+ onClear,
903
+ asChild = false,
904
+ ...props
905
+ }, ref) => {
906
+ const { query, setQuery, onSearch } = useAdvancedSearch();
907
+ const Comp = asChild ? Slot : "div";
908
+ const handleChange = (e) => {
909
+ const value = e.target.value;
910
+ setQuery(value);
911
+ onSearch(value);
912
+ props.onChange?.(e);
913
+ };
914
+ const handleClear = () => {
915
+ setQuery("");
916
+ onSearch("");
917
+ onClear?.();
918
+ };
919
+ return /* @__PURE__ */ jsxs5(
920
+ Comp,
921
+ {
922
+ className: cn6(
923
+ searchInputWrapperVariants({ size, variant }),
924
+ "rounded-md",
925
+ className
926
+ ),
927
+ children: [
928
+ showSearchIcon && /* @__PURE__ */ jsx7(Search2, { className: "text-muted-foreground absolute left-3 h-4 w-4" }),
929
+ /* @__PURE__ */ jsx7(
930
+ Input3,
931
+ {
932
+ ref,
933
+ type: "search",
934
+ placeholder,
935
+ value: query,
936
+ onChange: handleChange,
937
+ className: cn6(
938
+ "border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0",
939
+ showSearchIcon && "pl-10",
940
+ showClearButton && query && "pr-10"
941
+ ),
942
+ size: void 0,
943
+ ...props
944
+ }
945
+ ),
946
+ showClearButton && query && /* @__PURE__ */ jsx7(
947
+ Button4,
948
+ {
949
+ variant: "ghost",
950
+ size: "sm",
951
+ className: "absolute right-1 h-6 w-6 p-0",
952
+ onClick: handleClear,
953
+ children: /* @__PURE__ */ jsx7(X, { className: "h-3 w-3" })
954
+ }
955
+ )
956
+ ]
957
+ }
958
+ );
959
+ }
960
+ );
961
+ SearchInput.displayName = "SearchInput";
962
+ var SearchTrigger = React6.forwardRef(({ className, asChild = false, children, ...props }, ref) => {
963
+ const { isOpen, setIsOpen } = useAdvancedSearch();
964
+ const Comp = asChild ? Slot : Button4;
965
+ return /* @__PURE__ */ jsx7(
966
+ Comp,
967
+ {
968
+ ref,
969
+ className: cn6(className),
970
+ onClick: () => setIsOpen(!isOpen),
971
+ ...props,
972
+ children
973
+ }
974
+ );
975
+ });
976
+ SearchTrigger.displayName = "SearchTrigger";
977
+ var SearchResults = React6.forwardRef(
978
+ ({
979
+ className,
980
+ size,
981
+ sections,
982
+ showEmptyState = true,
983
+ emptyStateMessage = "No results found",
984
+ showLoadingState = true,
985
+ loadingMessage = "Searching...",
986
+ ...props
987
+ }, ref) => {
988
+ const { results, isLoading, query, onResultSelect } = useAdvancedSearch();
989
+ if (isLoading && showLoadingState) {
990
+ return /* @__PURE__ */ jsx7(
991
+ "div",
992
+ {
993
+ ref,
994
+ className: cn6(
995
+ searchResultsVariants({ size }),
996
+ "text-muted-foreground p-4 text-center",
997
+ className
998
+ ),
999
+ ...props,
1000
+ children: loadingMessage
1001
+ }
1002
+ );
1003
+ }
1004
+ if (!query || results.length === 0) {
1005
+ if (!showEmptyState) return null;
1006
+ return /* @__PURE__ */ jsx7(
1007
+ "div",
1008
+ {
1009
+ ref,
1010
+ className: cn6(
1011
+ searchResultsVariants({ size }),
1012
+ "text-muted-foreground p-4 text-center",
1013
+ className
1014
+ ),
1015
+ ...props,
1016
+ children: emptyStateMessage
1017
+ }
1018
+ );
1019
+ }
1020
+ const displaySections = sections || [
1021
+ {
1022
+ id: "results",
1023
+ title: "Results",
1024
+ results
1025
+ }
1026
+ ];
1027
+ return /* @__PURE__ */ jsx7(
1028
+ "div",
1029
+ {
1030
+ ref,
1031
+ className: cn6(
1032
+ searchResultsVariants({ size }),
1033
+ "max-h-96 overflow-hidden",
1034
+ className
1035
+ ),
1036
+ ...props,
1037
+ children: /* @__PURE__ */ jsx7("div", { className: "h-full overflow-auto", children: /* @__PURE__ */ jsx7("div", { className: "space-y-4 p-4", children: displaySections.map((section, index) => /* @__PURE__ */ jsxs5("div", { children: [
1038
+ index > 0 && /* @__PURE__ */ jsx7(Separator, { className: "my-4" }),
1039
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
1040
+ /* @__PURE__ */ jsx7("h3", { className: "text-muted-foreground text-sm font-semibold uppercase tracking-wide", children: section.title }),
1041
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-1", children: [
1042
+ section.results.map((result) => /* @__PURE__ */ jsx7(
1043
+ SearchResultItem,
1044
+ {
1045
+ result,
1046
+ onClick: () => onResultSelect(result)
1047
+ },
1048
+ result.id
1049
+ )),
1050
+ section.showMore && section.onShowMore && /* @__PURE__ */ jsxs5(
1051
+ Button4,
1052
+ {
1053
+ variant: "ghost",
1054
+ size: "sm",
1055
+ className: "text-muted-foreground w-full justify-start",
1056
+ onClick: section.onShowMore,
1057
+ children: [
1058
+ "Show more",
1059
+ /* @__PURE__ */ jsx7(ChevronDown, { className: "ml-2 h-3 w-3" })
1060
+ ]
1061
+ }
1062
+ )
1063
+ ] })
1064
+ ] })
1065
+ ] }, section.id)) }) })
1066
+ }
1067
+ );
1068
+ }
1069
+ );
1070
+ SearchResults.displayName = "SearchResults";
1071
+ var SearchResultItem = ({ result, onClick }) => {
1072
+ if (result.type === "category") {
1073
+ return /* @__PURE__ */ jsx7("div", { className: "text-muted-foreground p-2 text-sm font-medium", children: result.title });
1074
+ }
1075
+ if (result.type === "suggestion") {
1076
+ return /* @__PURE__ */ jsx7(
1077
+ Button4,
1078
+ {
1079
+ variant: "ghost",
1080
+ size: "sm",
1081
+ className: "h-auto w-full justify-start p-2",
1082
+ onClick,
1083
+ children: /* @__PURE__ */ jsx7("span", { className: "text-sm", children: result.title })
1084
+ }
1085
+ );
1086
+ }
1087
+ return /* @__PURE__ */ jsx7(
1088
+ Card,
1089
+ {
1090
+ className: "hover:bg-muted/50 cursor-pointer transition-colors",
1091
+ onClick,
1092
+ children: /* @__PURE__ */ jsx7(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs5("div", { className: "flex gap-3", children: [
1093
+ result.image && /* @__PURE__ */ jsx7("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx7(
1094
+ "img",
1095
+ {
1096
+ src: result.image,
1097
+ alt: result.title,
1098
+ className: "h-12 w-12 rounded-md object-cover"
1099
+ }
1100
+ ) }),
1101
+ /* @__PURE__ */ jsxs5("div", { className: "min-w-0 flex-1", children: [
1102
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-start justify-between gap-2", children: [
1103
+ /* @__PURE__ */ jsx7("h4", { className: "truncate text-sm font-semibold", children: result.title }),
1104
+ result.badge && /* @__PURE__ */ jsx7(Badge, { variant: "secondary", className: "text-xs", children: result.badge })
1105
+ ] }),
1106
+ result.description && /* @__PURE__ */ jsx7("p", { className: "text-muted-foreground mt-1 line-clamp-2 text-xs", children: result.description })
1107
+ ] })
1108
+ ] }) })
1109
+ }
1110
+ );
1111
+ };
1112
+ var AdvancedSearchBar = React6.forwardRef(({ className, children, open, onOpenChange, ...props }, ref) => {
1113
+ const { isOpen, setIsOpen } = useAdvancedSearch();
1114
+ const handleOpenChange = (newOpen) => {
1115
+ if (open !== void 0) {
1116
+ onOpenChange?.(newOpen);
1117
+ } else {
1118
+ setIsOpen(newOpen);
1119
+ }
1120
+ };
1121
+ const isControlled = open !== void 0;
1122
+ const isOpenState = isControlled ? open : isOpen;
1123
+ const childrenArray = React6.Children.toArray(children);
1124
+ const inputChild = childrenArray.find(
1125
+ (child) => React6.isValidElement(child) && child.type === SearchInput
1126
+ );
1127
+ const resultsChild = childrenArray.find(
1128
+ (child) => React6.isValidElement(child) && child.type === SearchResults
1129
+ );
1130
+ const triggerElement = inputChild || /* @__PURE__ */ jsx7(SearchInput, {});
1131
+ return /* @__PURE__ */ jsx7("div", { ref, className: cn6("relative", className), ...props, children: /* @__PURE__ */ jsxs5(Popover, { open: isOpenState, onOpenChange: handleOpenChange, children: [
1132
+ /* @__PURE__ */ jsx7(PopoverTrigger, { asChild: true, children: triggerElement }),
1133
+ /* @__PURE__ */ jsx7(PopoverContent, { className: "p-0", align: "start", children: resultsChild || /* @__PURE__ */ jsx7(SearchResults, {}) })
1134
+ ] }) });
1135
+ });
1136
+ AdvancedSearchBar.displayName = "AdvancedSearchBar";
1137
+ var SearchSection = React6.forwardRef(({ className, title, showMore, onShowMore, children, ...props }, ref) => {
1138
+ return /* @__PURE__ */ jsxs5("div", { ref, className: cn6("space-y-2", className), ...props, children: [
1139
+ title && /* @__PURE__ */ jsx7("h3", { className: "text-muted-foreground text-sm font-semibold uppercase tracking-wide", children: title }),
1140
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-1", children: [
1141
+ children,
1142
+ showMore && onShowMore && /* @__PURE__ */ jsxs5(
1143
+ Button4,
1144
+ {
1145
+ variant: "ghost",
1146
+ size: "sm",
1147
+ className: "text-muted-foreground w-full justify-start",
1148
+ onClick: onShowMore,
1149
+ children: [
1150
+ "Show more",
1151
+ /* @__PURE__ */ jsx7(ChevronDown, { className: "ml-2 h-3 w-3" })
1152
+ ]
1153
+ }
1154
+ )
1155
+ ] })
1156
+ ] });
1157
+ });
1158
+ SearchSection.displayName = "SearchSection ";
1159
+ var SearchItem = React6.forwardRef(
1160
+ ({ className, result, onClick, children, ...props }, ref) => {
1161
+ const { onResultSelect } = useAdvancedSearch();
1162
+ const handleClick = () => {
1163
+ if (result) {
1164
+ onResultSelect(result);
1165
+ }
1166
+ onClick?.();
1167
+ };
1168
+ if (children) {
1169
+ return /* @__PURE__ */ jsx7(
1170
+ "div",
1171
+ {
1172
+ ref,
1173
+ className: cn6("cursor-pointer", className),
1174
+ onClick: handleClick,
1175
+ ...props,
1176
+ children
1177
+ }
1178
+ );
1179
+ }
1180
+ if (!result) return null;
1181
+ if (result.type === "category") {
1182
+ return /* @__PURE__ */ jsx7(
1183
+ "div",
1184
+ {
1185
+ ref,
1186
+ className: cn6(
1187
+ "text-muted-foreground p-2 text-sm font-medium",
1188
+ className
1189
+ ),
1190
+ ...props,
1191
+ children: result.title
1192
+ }
1193
+ );
1194
+ }
1195
+ if (result.type === "suggestion") {
1196
+ return /* @__PURE__ */ jsx7(
1197
+ Button4,
1198
+ {
1199
+ ref,
1200
+ variant: "ghost",
1201
+ size: "sm",
1202
+ className: cn6("h-auto w-full justify-start p-2", className),
1203
+ onClick: handleClick,
1204
+ ...props,
1205
+ children: /* @__PURE__ */ jsx7("span", { className: "text-sm", children: result.title })
1206
+ }
1207
+ );
1208
+ }
1209
+ return /* @__PURE__ */ jsx7(
1210
+ Card,
1211
+ {
1212
+ ref,
1213
+ className: cn6(
1214
+ "hover:bg-muted/50 cursor-pointer transition-colors",
1215
+ className
1216
+ ),
1217
+ onClick: handleClick,
1218
+ ...props,
1219
+ children: /* @__PURE__ */ jsx7(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs5("div", { className: "flex gap-3", children: [
1220
+ result.image && /* @__PURE__ */ jsx7("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx7(
1221
+ "img",
1222
+ {
1223
+ src: result.image,
1224
+ alt: result.title,
1225
+ className: "h-12 w-12 rounded-md object-cover"
1226
+ }
1227
+ ) }),
1228
+ /* @__PURE__ */ jsxs5("div", { className: "min-w-0 flex-1", children: [
1229
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-start justify-between gap-2", children: [
1230
+ /* @__PURE__ */ jsx7("h4", { className: "truncate text-sm font-semibold", children: result.title }),
1231
+ result.badge && /* @__PURE__ */ jsx7(Badge, { variant: "secondary", className: "text-xs", children: result.badge })
1232
+ ] }),
1233
+ result.description && /* @__PURE__ */ jsx7("p", { className: "text-muted-foreground mt-1 line-clamp-2 text-xs", children: result.description })
1234
+ ] })
1235
+ ] }) })
1236
+ }
1237
+ );
1238
+ }
1239
+ );
1240
+ SearchItem.displayName = "SearchItem";
1241
+
1242
+ // src/index.ts
1243
+ import { cn as cn7 } from "@foundrykit/utils";
614
1244
  export {
1245
+ AdvancedSearchBar,
1246
+ AdvancedSearchProvider,
615
1247
  Calendar,
616
1248
  Command,
617
1249
  CommandDialog,
@@ -631,6 +1263,11 @@ export {
631
1263
  PaginationNext,
632
1264
  PaginationPrevious,
633
1265
  SearchBar,
634
- cn6 as cn
1266
+ SearchInput,
1267
+ SearchItem,
1268
+ SearchResults,
1269
+ SearchSection,
1270
+ SearchTrigger,
1271
+ cn7 as cn
635
1272
  };
636
1273
  //# sourceMappingURL=index.js.map