@motor-hero/ui-kit 0.51.0 → 0.51.1

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
@@ -681,7 +681,7 @@ function Rating({
681
681
 
682
682
  // src/components/combobox.tsx
683
683
  import * as PopoverPrimitive2 from "@radix-ui/react-popover";
684
- import { Command as CommandPrimitive } from "cmdk";
684
+ import { Command as CommandPrimitive, defaultFilter } from "cmdk";
685
685
  import { Check, ChevronsUpDown as ChevronsUpDown2, Loader2, Plus, Search } from "lucide-react";
686
686
  import * as React5 from "react";
687
687
  import { Drawer as DrawerPrimitive2 } from "vaul";
@@ -799,7 +799,14 @@ function Combobox({
799
799
  className
800
800
  ),
801
801
  children: [
802
- /* @__PURE__ */ jsx9("span", { className: cn("truncate", !selected && "text-muted-foreground"), children: selected ? selected.label : placeholder }),
802
+ /* @__PURE__ */ jsx9(
803
+ "span",
804
+ {
805
+ title: selected?.description,
806
+ className: cn("truncate", !selected && "text-muted-foreground"),
807
+ children: selected ? selected.label : placeholder
808
+ }
809
+ ),
803
810
  /* @__PURE__ */ jsx9(ChevronsUpDown2, { className: "h-4 w-4 shrink-0 opacity-50" })
804
811
  ]
805
812
  }
@@ -808,6 +815,7 @@ function Combobox({
808
815
  CommandPrimitive,
809
816
  {
810
817
  shouldFilter: !isServer,
818
+ filter: filterByKeywords,
811
819
  className: "flex h-full w-full flex-col overflow-hidden",
812
820
  children: [
813
821
  /* @__PURE__ */ jsxs7("div", { className: "flex items-center border-b px-3", children: [
@@ -832,6 +840,7 @@ function Combobox({
832
840
  CommandPrimitive.Item,
833
841
  {
834
842
  value: trimmedSearch,
843
+ keywords: [trimmedSearch],
835
844
  onSelect: () => handleSelect(trimmedSearch),
836
845
  className: "relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-2.5 text-sm outline-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground sm:py-1.5",
837
846
  children: [
@@ -845,8 +854,8 @@ function Combobox({
845
854
  options.map((option) => /* @__PURE__ */ jsxs7(
846
855
  CommandPrimitive.Item,
847
856
  {
848
- value: isServer ? option.value : option.label,
849
- keywords: option.description ? [option.description] : void 0,
857
+ value: option.value,
858
+ keywords: optionKeywords(option),
850
859
  disabled: option.disabled,
851
860
  onSelect: () => handleSelect(option.value),
852
861
  className: "relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-2.5 text-sm outline-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 sm:py-1.5",
@@ -902,6 +911,8 @@ function Combobox({
902
911
  ] })
903
912
  ] });
904
913
  }
914
+ var filterByKeywords = (_value, search, keywords = []) => defaultFilter(keywords.join(" "), search);
915
+ var optionKeywords = (option) => option.description ? [option.label, option.description] : [option.label];
905
916
  function OptionText({ option }) {
906
917
  if (!option.description)
907
918
  return /* @__PURE__ */ jsx9("span", { className: "truncate", children: option.label });
@@ -1907,6 +1918,7 @@ function MultiCombobox({
1907
1918
  CommandPrimitive2,
1908
1919
  {
1909
1920
  shouldFilter: !isServer,
1921
+ filter: filterByKeywords,
1910
1922
  className: "flex h-full w-full flex-col overflow-hidden",
1911
1923
  children: [
1912
1924
  /* @__PURE__ */ jsxs17("div", { className: "flex items-center border-b px-3", children: [
@@ -1930,8 +1942,8 @@ function MultiCombobox({
1930
1942
  options.map((option) => /* @__PURE__ */ jsxs17(
1931
1943
  CommandPrimitive2.Item,
1932
1944
  {
1933
- value: isServer ? option.value : option.label,
1934
- keywords: option.description ? [option.description] : void 0,
1945
+ value: option.value,
1946
+ keywords: optionKeywords(option),
1935
1947
  disabled: option.disabled,
1936
1948
  onSelect: () => toggleValue(option.value),
1937
1949
  className: "relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-2.5 text-sm outline-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 sm:py-1.5",