@bizapps/ui 1.3.4 → 1.3.6

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/main.cjs CHANGED
@@ -2634,6 +2634,17 @@ function AccordionContent({
2634
2634
  }
2635
2635
  );
2636
2636
  }
2637
+ function createMatchFilter(mode) {
2638
+ return (value, search, keywords = []) => {
2639
+ const query = search.toLowerCase().trim();
2640
+ if (!query) return 1;
2641
+ const haystacks = [value, ...keywords].map((s) => s.toLowerCase());
2642
+ const matched = mode === "substring" ? haystacks.some((h) => h.includes(query)) : haystacks.some(
2643
+ (h) => h.startsWith(query) || h.split(/\s+/).some((word) => word.startsWith(query))
2644
+ );
2645
+ return matched ? 1 : 0;
2646
+ };
2647
+ }
2637
2648
  function Combobox({
2638
2649
  options,
2639
2650
  value,
@@ -2643,10 +2654,16 @@ function Combobox({
2643
2654
  emptyMessage = "No results found.",
2644
2655
  disabled = false,
2645
2656
  className,
2646
- container
2657
+ container,
2658
+ matchMode = "fuzzy"
2647
2659
  }) {
2648
2660
  const [open, setOpen] = react.useState(false);
2661
+ const listRef = react.useRef(null);
2649
2662
  const selected = options.find((opt) => opt.value === value);
2663
+ const filter = matchMode === "fuzzy" ? void 0 : createMatchFilter(matchMode);
2664
+ const handleSearchChange = () => {
2665
+ requestAnimationFrame(() => listRef.current?.scrollTo({ top: 0 }));
2666
+ };
2650
2667
  return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
2651
2668
  /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
2652
2669
  Button,
@@ -2666,18 +2683,19 @@ function Combobox({
2666
2683
  ]
2667
2684
  }
2668
2685
  ) }),
2669
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-64 rounded-lg p-0", align: "start", container, children: /* @__PURE__ */ jsxRuntime.jsxs(cmdk.Command, { className: "rounded-lg", children: [
2686
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-64 rounded-lg p-0", align: "start", container, children: /* @__PURE__ */ jsxRuntime.jsxs(cmdk.Command, { className: "rounded-lg", filter, children: [
2670
2687
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border flex items-center gap-2 border-b px-3", children: [
2671
2688
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { size: 14, className: "text-muted-foreground shrink-0" }),
2672
2689
  /* @__PURE__ */ jsxRuntime.jsx(
2673
2690
  cmdk.Command.Input,
2674
2691
  {
2675
2692
  placeholder: searchPlaceholder,
2693
+ onValueChange: handleSearchChange,
2676
2694
  className: "placeholder:text-muted-foreground flex h-9 w-full bg-transparent py-2 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50"
2677
2695
  }
2678
2696
  )
2679
2697
  ] }),
2680
- /* @__PURE__ */ jsxRuntime.jsxs(cmdk.Command.List, { className: "max-h-56 overflow-y-auto p-1", children: [
2698
+ /* @__PURE__ */ jsxRuntime.jsxs(cmdk.Command.List, { ref: listRef, className: "max-h-56 overflow-y-auto p-1", children: [
2681
2699
  /* @__PURE__ */ jsxRuntime.jsx(cmdk.Command.Empty, { className: "text-muted-foreground py-4 text-center text-sm", children: emptyMessage }),
2682
2700
  options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
2683
2701
  cmdk.Command.Item,
@@ -8477,7 +8495,7 @@ function BottomNavTabsList({ items, className }) {
8477
8495
  {
8478
8496
  "data-slot": "bottom-nav-tabs-list",
8479
8497
  className: cn(
8480
- "fixed bottom-0 left-0 right-0 z-50 mx-4 mb-4 rounded-2xl bg-background shadow-[0_-4px_20px_rgba(0,0,0,0.08)]",
8498
+ "fixed bottom-0 left-0 right-0 z-50 mx-6 max-w- mb-4 rounded-2xl bg-background shadow-[0_-4px_20px_rgba(0,0,0,0.08)]",
8481
8499
  className
8482
8500
  ),
8483
8501
  children: /* @__PURE__ */ jsxRuntime.jsx(radixUi.Tabs.List, { className: "flex h-20 items-center justify-around px-4", children: items.map(({ value, label, icon, activeIcon }) => {
@@ -8488,12 +8506,12 @@ function BottomNavTabsList({ items, className }) {
8488
8506
  value,
8489
8507
  "data-slot": "bottom-nav-tabs-trigger",
8490
8508
  className: cn(
8491
- "group flex flex-col items-center gap-0.5 transition-colors",
8509
+ "group flex flex-col items-center transition-colors",
8492
8510
  "data-[state=active]:text-primary data-[state=inactive]:text-muted-foreground",
8493
8511
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:rounded-2xl"
8494
8512
  ),
8495
8513
  children: [
8496
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "relative flex h-12 w-12 items-center justify-center", children: [
8514
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "relative flex h-15 w-16 flex-col items-center justify-center gap-1.5", children: [
8497
8515
  /* @__PURE__ */ jsxRuntime.jsx(react$1.AnimatePresence, { initial: false, children: isActive && /* @__PURE__ */ jsxRuntime.jsx(
8498
8516
  react$1.motion.span,
8499
8517
  {
@@ -8502,23 +8520,14 @@ function BottomNavTabsList({ items, className }) {
8502
8520
  transition: spring.snappy
8503
8521
  }
8504
8522
  ) }),
8505
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative z-10 h-6 w-6", children: isActive ? activeIcon ?? icon : icon })
8523
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative z-10 h-6 w-6", children: isActive ? activeIcon ?? icon : icon }),
8524
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative z-10 text-[10px] font-medium leading-none", children: label })
8506
8525
  ] }),
8507
8526
  /* @__PURE__ */ jsxRuntime.jsx(
8508
8527
  "span",
8509
8528
  {
8510
8529
  className: cn(
8511
- "text-[10px] font-medium",
8512
- isActive && "font-semibold"
8513
- ),
8514
- children: label
8515
- }
8516
- ),
8517
- /* @__PURE__ */ jsxRuntime.jsx(
8518
- "span",
8519
- {
8520
- className: cn(
8521
- "h-1 w-5 rounded-full transition-colors",
8530
+ "mt-1 h-1 w-6 rounded-full transition-colors",
8522
8531
  isActive ? "bg-primary" : "bg-transparent"
8523
8532
  )
8524
8533
  }