@next-degree/pickle-shared-js 0.3.30 → 0.5.31
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/app/layout.css +41 -0
- package/dist/app/layout.css.map +1 -1
- package/dist/app/page.cjs +238 -8
- package/dist/app/page.cjs.map +1 -1
- package/dist/app/page.js +238 -8
- package/dist/app/page.js.map +1 -1
- package/dist/components/demos/MapComponentDemo.cjs +129 -0
- package/dist/components/demos/MapComponentDemo.cjs.map +1 -0
- package/dist/components/demos/MapComponentDemo.d.cts +5 -0
- package/dist/components/demos/MapComponentDemo.d.ts +5 -0
- package/dist/components/demos/MapComponentDemo.js +107 -0
- package/dist/components/demos/MapComponentDemo.js.map +1 -0
- package/dist/components/demos/PlacesQueryInputDemo.cjs +341 -0
- package/dist/components/demos/PlacesQueryInputDemo.cjs.map +1 -0
- package/dist/components/demos/PlacesQueryInputDemo.d.cts +5 -0
- package/dist/components/demos/PlacesQueryInputDemo.d.ts +5 -0
- package/dist/components/demos/PlacesQueryInputDemo.js +309 -0
- package/dist/components/demos/PlacesQueryInputDemo.js.map +1 -0
- package/dist/components/demos/index.cjs +236 -6
- package/dist/components/demos/index.cjs.map +1 -1
- package/dist/components/demos/index.js +236 -6
- package/dist/components/demos/index.js.map +1 -1
- package/dist/components/ui/MapComponent.cjs +54 -0
- package/dist/components/ui/MapComponent.cjs.map +1 -0
- package/dist/components/ui/MapComponent.d.cts +15 -0
- package/dist/components/ui/MapComponent.d.ts +15 -0
- package/dist/components/ui/MapComponent.js +34 -0
- package/dist/components/ui/MapComponent.js.map +1 -0
- package/dist/components/ui/PlacesQueryInput.cjs +321 -0
- package/dist/components/ui/PlacesQueryInput.cjs.map +1 -0
- package/dist/components/ui/PlacesQueryInput.d.cts +18 -0
- package/dist/components/ui/PlacesQueryInput.d.ts +18 -0
- package/dist/components/ui/PlacesQueryInput.js +289 -0
- package/dist/components/ui/PlacesQueryInput.js.map +1 -0
- package/dist/index.cjs +354 -173
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +345 -167
- package/dist/index.js.map +1 -1
- package/dist/lib/google.cjs +85 -0
- package/dist/lib/google.cjs.map +1 -0
- package/dist/lib/google.d.cts +26 -0
- package/dist/lib/google.d.ts +26 -0
- package/dist/lib/google.js +58 -0
- package/dist/lib/google.js.map +1 -0
- package/dist/styles/globals.css +41 -0
- package/dist/styles/globals.css.map +1 -1
- package/package.json +23 -21
package/dist/index.js
CHANGED
|
@@ -492,132 +492,38 @@ var inputVariants = cva2(
|
|
|
492
492
|
);
|
|
493
493
|
var Input_default = Input;
|
|
494
494
|
|
|
495
|
-
// src/components/ui/
|
|
496
|
-
import {
|
|
497
|
-
import { cva as cva3 } from "cva";
|
|
498
|
-
import { forwardRef as forwardRef6 } from "react";
|
|
495
|
+
// src/components/ui/MapComponent.tsx
|
|
496
|
+
import { APIProvider, Map, AdvancedMarker, Pin } from "@vis.gl/react-google-maps";
|
|
499
497
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
"flex",
|
|
517
|
-
"items-center",
|
|
518
|
-
"justify-center",
|
|
519
|
-
"gap-2",
|
|
520
|
-
"rounded-full",
|
|
521
|
-
"font-bold",
|
|
522
|
-
"outline-2",
|
|
523
|
-
"outline-offset-2",
|
|
524
|
-
"outline-dashed",
|
|
525
|
-
"outline-transparent"
|
|
526
|
-
],
|
|
527
|
-
{
|
|
528
|
-
variants: {
|
|
529
|
-
variant: {
|
|
530
|
-
neutral: [
|
|
531
|
-
"bg-black",
|
|
532
|
-
"text-white",
|
|
533
|
-
"hover:bg-grey-90",
|
|
534
|
-
"active:bg-grey-80",
|
|
535
|
-
"focus:outline-purple-100",
|
|
536
|
-
"disabled:text-grey-40",
|
|
537
|
-
"disabled:bg-grey-10"
|
|
538
|
-
],
|
|
539
|
-
primary: [
|
|
540
|
-
"bg-pickle-100",
|
|
541
|
-
"text-black",
|
|
542
|
-
"hover:bg-pickle-80",
|
|
543
|
-
"active:bg-pickle-60",
|
|
544
|
-
"focus:outline-purple-100",
|
|
545
|
-
"disabled:text-grey-40",
|
|
546
|
-
"disabled:bg-grey-10"
|
|
547
|
-
],
|
|
548
|
-
secondary: [
|
|
549
|
-
"bg-green-80",
|
|
550
|
-
"text-white",
|
|
551
|
-
"hover:bg-green-90",
|
|
552
|
-
"active:bg-green-100",
|
|
553
|
-
"focus:outline-pickle-100",
|
|
554
|
-
"disabled:text-grey-40",
|
|
555
|
-
"disabled:bg-grey-10"
|
|
556
|
-
],
|
|
557
|
-
transparent: [
|
|
558
|
-
"text-white",
|
|
559
|
-
"hover:bg-green-80",
|
|
560
|
-
"active:bg-green-100",
|
|
561
|
-
"focus:outline-pickle-100",
|
|
562
|
-
"disabled:text-grey-40"
|
|
563
|
-
],
|
|
564
|
-
link: [
|
|
565
|
-
"leading-tight",
|
|
566
|
-
"text-black",
|
|
567
|
-
"underline",
|
|
568
|
-
"hover:text-purple-100",
|
|
569
|
-
"focus:text-black",
|
|
570
|
-
"focus:outline-purple-100",
|
|
571
|
-
"active:text-purple-80"
|
|
572
|
-
]
|
|
573
|
-
},
|
|
574
|
-
size: {
|
|
575
|
-
small: ["h-10", "text-sm", "px-4", "py-2"],
|
|
576
|
-
medium: ["h-12", "text-base", "px-6", "py-3"],
|
|
577
|
-
large: ["h-14", "text-lg", "px-8", "py-4"]
|
|
578
|
-
}
|
|
579
|
-
},
|
|
580
|
-
defaultVariants: {
|
|
581
|
-
variant: "neutral",
|
|
582
|
-
size: "medium"
|
|
583
|
-
},
|
|
584
|
-
compoundVariants: [
|
|
585
|
-
{
|
|
586
|
-
variant: "link",
|
|
587
|
-
size: "small",
|
|
588
|
-
class: ["h-3", "text-xs", "p-0"]
|
|
589
|
-
},
|
|
590
|
-
{
|
|
591
|
-
variant: "link",
|
|
592
|
-
size: "medium",
|
|
593
|
-
class: ["h-4", "text-sm", "p-0"]
|
|
594
|
-
},
|
|
595
|
-
{
|
|
596
|
-
variant: "link",
|
|
597
|
-
size: "large",
|
|
598
|
-
class: ["h-6", "text-base", "p-0"]
|
|
599
|
-
}
|
|
600
|
-
]
|
|
601
|
-
}
|
|
602
|
-
);
|
|
603
|
-
|
|
604
|
-
// src/components/ui/Combobox.tsx
|
|
605
|
-
import { forwardRef as forwardRef10, useEffect as useEffect2, useState as useState2 } from "react";
|
|
606
|
-
import { ChevronDownIcon as ChevronDownIcon2, CircleX, icons as icons3 } from "lucide-react";
|
|
607
|
-
import { cva as cva5 } from "cva";
|
|
498
|
+
function MapComponent({ apiKey, mapId, position, className, zoom = 15 }) {
|
|
499
|
+
const defaultPosition = { lat: 40.715021, lng: -74.00459 };
|
|
500
|
+
const defaultZoom = 11;
|
|
501
|
+
return /* @__PURE__ */ jsx10(APIProvider, { apiKey, children: /* @__PURE__ */ jsx10("div", { className: cn("h-screen max-w-full", className), children: /* @__PURE__ */ jsx10(
|
|
502
|
+
Map,
|
|
503
|
+
{
|
|
504
|
+
zoom: position ? zoom : defaultZoom,
|
|
505
|
+
center: position || defaultPosition,
|
|
506
|
+
mapId,
|
|
507
|
+
keyboardShortcuts: false,
|
|
508
|
+
disableDefaultUI: true,
|
|
509
|
+
children: position && /* @__PURE__ */ jsx10(AdvancedMarker, { position, children: /* @__PURE__ */ jsx10(Pin, { background: "#0B5441", borderColor: "#EBFDF1", glyphColor: "#D4F500" }) })
|
|
510
|
+
}
|
|
511
|
+
) }) });
|
|
512
|
+
}
|
|
513
|
+
var MapComponent_default = MapComponent;
|
|
608
514
|
|
|
609
515
|
// src/components/primitives/command.tsx
|
|
610
516
|
import { Command as CommandPrimitive } from "cmdk";
|
|
611
517
|
import { Search } from "lucide-react";
|
|
612
|
-
import * as
|
|
518
|
+
import * as React4 from "react";
|
|
613
519
|
|
|
614
520
|
// src/components/primitives/dialog.tsx
|
|
615
521
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
616
522
|
import { X as X3 } from "lucide-react";
|
|
617
|
-
import * as
|
|
523
|
+
import * as React3 from "react";
|
|
618
524
|
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
619
525
|
var DialogPortal = DialogPrimitive.Portal;
|
|
620
|
-
var DialogOverlay =
|
|
526
|
+
var DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
621
527
|
DialogPrimitive.Overlay,
|
|
622
528
|
{
|
|
623
529
|
ref,
|
|
@@ -629,7 +535,7 @@ var DialogOverlay = React4.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
629
535
|
}
|
|
630
536
|
));
|
|
631
537
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
632
|
-
var DialogContent =
|
|
538
|
+
var DialogContent = React3.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs6(DialogPortal, { children: [
|
|
633
539
|
/* @__PURE__ */ jsx11(DialogOverlay, {}),
|
|
634
540
|
/* @__PURE__ */ jsxs6(
|
|
635
541
|
DialogPrimitive.Content,
|
|
@@ -661,7 +567,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx11(
|
|
|
661
567
|
}
|
|
662
568
|
);
|
|
663
569
|
DialogFooter.displayName = "DialogFooter";
|
|
664
|
-
var DialogTitle =
|
|
570
|
+
var DialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
665
571
|
DialogPrimitive.Title,
|
|
666
572
|
{
|
|
667
573
|
ref,
|
|
@@ -670,7 +576,7 @@ var DialogTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
670
576
|
}
|
|
671
577
|
));
|
|
672
578
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
673
|
-
var DialogDescription =
|
|
579
|
+
var DialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
674
580
|
DialogPrimitive.Description,
|
|
675
581
|
{
|
|
676
582
|
ref,
|
|
@@ -682,7 +588,7 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
|
682
588
|
|
|
683
589
|
// src/components/primitives/command.tsx
|
|
684
590
|
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
685
|
-
var Command =
|
|
591
|
+
var Command = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
686
592
|
CommandPrimitive,
|
|
687
593
|
{
|
|
688
594
|
ref,
|
|
@@ -694,7 +600,7 @@ var Command = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
694
600
|
}
|
|
695
601
|
));
|
|
696
602
|
Command.displayName = CommandPrimitive.displayName;
|
|
697
|
-
var CommandInput =
|
|
603
|
+
var CommandInput = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs7("div", { className: "m-1 flex items-center rounded-xl border px-3", "cmdk-input-wrapper": "", children: [
|
|
698
604
|
/* @__PURE__ */ jsx12(Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
699
605
|
/* @__PURE__ */ jsx12(
|
|
700
606
|
CommandPrimitive.Input,
|
|
@@ -709,7 +615,7 @@ var CommandInput = React5.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
709
615
|
)
|
|
710
616
|
] }));
|
|
711
617
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
712
|
-
var CommandList =
|
|
618
|
+
var CommandList = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
713
619
|
CommandPrimitive.List,
|
|
714
620
|
{
|
|
715
621
|
ref,
|
|
@@ -718,9 +624,9 @@ var CommandList = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
718
624
|
}
|
|
719
625
|
));
|
|
720
626
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
721
|
-
var CommandEmpty =
|
|
627
|
+
var CommandEmpty = React4.forwardRef((props, ref) => /* @__PURE__ */ jsx12(CommandPrimitive.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
|
|
722
628
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
723
|
-
var CommandGroup =
|
|
629
|
+
var CommandGroup = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
724
630
|
CommandPrimitive.Group,
|
|
725
631
|
{
|
|
726
632
|
ref,
|
|
@@ -732,7 +638,7 @@ var CommandGroup = React5.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
732
638
|
}
|
|
733
639
|
));
|
|
734
640
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
735
|
-
var CommandSeparator =
|
|
641
|
+
var CommandSeparator = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
736
642
|
CommandPrimitive.Separator,
|
|
737
643
|
{
|
|
738
644
|
ref,
|
|
@@ -741,7 +647,7 @@ var CommandSeparator = React5.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
741
647
|
}
|
|
742
648
|
));
|
|
743
649
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
744
|
-
var CommandItem =
|
|
650
|
+
var CommandItem = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
745
651
|
CommandPrimitive.Item,
|
|
746
652
|
{
|
|
747
653
|
ref,
|
|
@@ -764,13 +670,282 @@ var CommandShortcut = ({ className, ...props }) => {
|
|
|
764
670
|
};
|
|
765
671
|
CommandShortcut.displayName = "CommandShortcut";
|
|
766
672
|
|
|
673
|
+
// src/lib/google.ts
|
|
674
|
+
import { Client, PlaceAutocompleteType } from "@googlemaps/google-maps-services-js";
|
|
675
|
+
var client = new Client();
|
|
676
|
+
var autocomplete = async (input, key) => {
|
|
677
|
+
try {
|
|
678
|
+
const response = await client.placeAutocomplete({
|
|
679
|
+
params: { input, key, types: PlaceAutocompleteType.address }
|
|
680
|
+
});
|
|
681
|
+
return response.data.predictions;
|
|
682
|
+
} catch (error) {
|
|
683
|
+
console.error(error);
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
var fetchLocation = async (place, key) => {
|
|
687
|
+
try {
|
|
688
|
+
if (place.place_id) {
|
|
689
|
+
const placeDetails = await getPlaceDetails(place.place_id, key);
|
|
690
|
+
if (placeDetails) return placeDetails;
|
|
691
|
+
}
|
|
692
|
+
if (place.address) {
|
|
693
|
+
const result = await geocode(place.address, key);
|
|
694
|
+
const firstAddress = result?.[0];
|
|
695
|
+
return firstAddress;
|
|
696
|
+
}
|
|
697
|
+
return void 0;
|
|
698
|
+
} catch (error) {
|
|
699
|
+
console.error("Error fetching location:", error);
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
var getPlaceDetails = async (place_id, key) => {
|
|
703
|
+
try {
|
|
704
|
+
const response = await client.placeDetails({
|
|
705
|
+
params: { place_id, key }
|
|
706
|
+
});
|
|
707
|
+
return response.data.result;
|
|
708
|
+
} catch (error) {
|
|
709
|
+
console.error(error);
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
var geocode = async (address, key) => {
|
|
713
|
+
try {
|
|
714
|
+
const response = await client.geocode({
|
|
715
|
+
params: { address, key }
|
|
716
|
+
});
|
|
717
|
+
return response.data.results;
|
|
718
|
+
} catch (error) {
|
|
719
|
+
console.error(error);
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
// src/components/ui/PlacesQueryInput.tsx
|
|
724
|
+
import { CircleX, LoaderCircle } from "lucide-react";
|
|
725
|
+
import { useState as useState2, useCallback, useRef as useRef2, useEffect as useEffect2 } from "react";
|
|
726
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
727
|
+
function PlacesQueryInput({
|
|
728
|
+
apiKey,
|
|
729
|
+
selected,
|
|
730
|
+
onSelect,
|
|
731
|
+
className
|
|
732
|
+
}) {
|
|
733
|
+
const [predictions, setPredictions] = useState2(null);
|
|
734
|
+
const [input, setInput] = useState2(selected?.description ?? "");
|
|
735
|
+
const [isLoadingPredictions, setIsLoadingPredictions] = useState2(false);
|
|
736
|
+
const [shouldOpenUpward, setShouldOpenUpward] = useState2(false);
|
|
737
|
+
const timeoutRef = useRef2(null);
|
|
738
|
+
const inputRef = useRef2(null);
|
|
739
|
+
const debouncedAutocomplete = useCallback((value) => {
|
|
740
|
+
if (timeoutRef.current) {
|
|
741
|
+
clearTimeout(timeoutRef.current);
|
|
742
|
+
}
|
|
743
|
+
timeoutRef.current = setTimeout(async () => {
|
|
744
|
+
if (value.length > 2) {
|
|
745
|
+
setIsLoadingPredictions(true);
|
|
746
|
+
const fetchedPredictions = await autocomplete(value, apiKey);
|
|
747
|
+
fetchedPredictions && setIsLoadingPredictions(false);
|
|
748
|
+
setPredictions(fetchedPredictions ?? []);
|
|
749
|
+
} else {
|
|
750
|
+
setPredictions(null);
|
|
751
|
+
}
|
|
752
|
+
}, 300);
|
|
753
|
+
}, []);
|
|
754
|
+
const handleInputChange = (value) => {
|
|
755
|
+
setInput(value);
|
|
756
|
+
debouncedAutocomplete(value);
|
|
757
|
+
};
|
|
758
|
+
const handleSelect = (prediction) => {
|
|
759
|
+
onSelect(prediction);
|
|
760
|
+
setPredictions(null);
|
|
761
|
+
setInput(prediction.description);
|
|
762
|
+
};
|
|
763
|
+
const handleClear = () => {
|
|
764
|
+
onSelect();
|
|
765
|
+
setPredictions(null);
|
|
766
|
+
setInput("");
|
|
767
|
+
};
|
|
768
|
+
const handleBlur = () => setTimeout(() => setPredictions(null), 200);
|
|
769
|
+
useEffect2(() => {
|
|
770
|
+
const checkDropdownPosition = () => {
|
|
771
|
+
if (inputRef.current) {
|
|
772
|
+
const rect = inputRef.current.getBoundingClientRect();
|
|
773
|
+
const windowHeight = window.innerHeight;
|
|
774
|
+
setShouldOpenUpward(rect.bottom + 200 > windowHeight);
|
|
775
|
+
}
|
|
776
|
+
};
|
|
777
|
+
checkDropdownPosition();
|
|
778
|
+
window.addEventListener("resize", checkDropdownPosition);
|
|
779
|
+
return () => window.removeEventListener("resize", checkDropdownPosition);
|
|
780
|
+
}, []);
|
|
781
|
+
return /* @__PURE__ */ jsx13("div", { className: cn("relative w-full", className), ref: inputRef, onBlur: handleBlur, children: /* @__PURE__ */ jsxs8(Command, { children: [
|
|
782
|
+
/* @__PURE__ */ jsxs8("div", { className: "relative w-full", children: [
|
|
783
|
+
/* @__PURE__ */ jsx13(
|
|
784
|
+
CommandInput,
|
|
785
|
+
{
|
|
786
|
+
placeholder: "Type an address to search...",
|
|
787
|
+
value: input,
|
|
788
|
+
onValueChange: handleInputChange,
|
|
789
|
+
className: "truncate pr-8"
|
|
790
|
+
}
|
|
791
|
+
),
|
|
792
|
+
isLoadingPredictions && /* @__PURE__ */ jsx13(LoaderCircle, { className: "absolute inset-y-0 right-2 my-auto flex h-8 w-8 animate-spin items-center justify-center rounded-full text-green-100" }),
|
|
793
|
+
input && /* @__PURE__ */ jsx13(
|
|
794
|
+
"button",
|
|
795
|
+
{
|
|
796
|
+
type: "button",
|
|
797
|
+
className: "absolute inset-y-0 right-2 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
|
|
798
|
+
onClick: handleClear,
|
|
799
|
+
children: /* @__PURE__ */ jsx13(CircleX, { className: "h-4 w-4 text-green-100" })
|
|
800
|
+
}
|
|
801
|
+
)
|
|
802
|
+
] }),
|
|
803
|
+
predictions && /* @__PURE__ */ jsxs8(
|
|
804
|
+
CommandList,
|
|
805
|
+
{
|
|
806
|
+
className: cn(
|
|
807
|
+
"absolute z-50 w-full rounded-md border bg-white shadow-lg",
|
|
808
|
+
shouldOpenUpward ? "bottom-full" : "top-full"
|
|
809
|
+
),
|
|
810
|
+
children: [
|
|
811
|
+
/* @__PURE__ */ jsx13(CommandEmpty, { children: "No results" }),
|
|
812
|
+
/* @__PURE__ */ jsx13(CommandGroup, { children: predictions.map((prediction) => /* @__PURE__ */ jsx13(
|
|
813
|
+
CommandItem,
|
|
814
|
+
{
|
|
815
|
+
onSelect: () => handleSelect(prediction),
|
|
816
|
+
className: "truncate",
|
|
817
|
+
children: prediction.description
|
|
818
|
+
},
|
|
819
|
+
prediction.place_id
|
|
820
|
+
)) })
|
|
821
|
+
]
|
|
822
|
+
}
|
|
823
|
+
)
|
|
824
|
+
] }) });
|
|
825
|
+
}
|
|
826
|
+
var PlacesQueryInput_default = PlacesQueryInput;
|
|
827
|
+
|
|
828
|
+
// src/components/ui/Button.tsx
|
|
829
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
830
|
+
import { cva as cva3 } from "cva";
|
|
831
|
+
import { forwardRef as forwardRef8 } from "react";
|
|
832
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
833
|
+
var Button = forwardRef8(
|
|
834
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
835
|
+
const Component = asChild ? Slot : "button";
|
|
836
|
+
return /* @__PURE__ */ jsx14(
|
|
837
|
+
Component,
|
|
838
|
+
{
|
|
839
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
840
|
+
ref,
|
|
841
|
+
...props
|
|
842
|
+
}
|
|
843
|
+
);
|
|
844
|
+
}
|
|
845
|
+
);
|
|
846
|
+
Button.displayName = "Button";
|
|
847
|
+
var buttonVariants = cva3(
|
|
848
|
+
[
|
|
849
|
+
"flex",
|
|
850
|
+
"items-center",
|
|
851
|
+
"justify-center",
|
|
852
|
+
"gap-2",
|
|
853
|
+
"rounded-full",
|
|
854
|
+
"font-bold",
|
|
855
|
+
"outline-2",
|
|
856
|
+
"outline-offset-2",
|
|
857
|
+
"outline-dashed",
|
|
858
|
+
"outline-transparent"
|
|
859
|
+
],
|
|
860
|
+
{
|
|
861
|
+
variants: {
|
|
862
|
+
variant: {
|
|
863
|
+
neutral: [
|
|
864
|
+
"bg-black",
|
|
865
|
+
"text-white",
|
|
866
|
+
"hover:bg-grey-90",
|
|
867
|
+
"active:bg-grey-80",
|
|
868
|
+
"focus:outline-purple-100",
|
|
869
|
+
"disabled:text-grey-40",
|
|
870
|
+
"disabled:bg-grey-10"
|
|
871
|
+
],
|
|
872
|
+
primary: [
|
|
873
|
+
"bg-pickle-100",
|
|
874
|
+
"text-black",
|
|
875
|
+
"hover:bg-pickle-80",
|
|
876
|
+
"active:bg-pickle-60",
|
|
877
|
+
"focus:outline-purple-100",
|
|
878
|
+
"disabled:text-grey-40",
|
|
879
|
+
"disabled:bg-grey-10"
|
|
880
|
+
],
|
|
881
|
+
secondary: [
|
|
882
|
+
"bg-green-80",
|
|
883
|
+
"text-white",
|
|
884
|
+
"hover:bg-green-90",
|
|
885
|
+
"active:bg-green-100",
|
|
886
|
+
"focus:outline-pickle-100",
|
|
887
|
+
"disabled:text-grey-40",
|
|
888
|
+
"disabled:bg-grey-10"
|
|
889
|
+
],
|
|
890
|
+
transparent: [
|
|
891
|
+
"text-white",
|
|
892
|
+
"hover:bg-green-80",
|
|
893
|
+
"active:bg-green-100",
|
|
894
|
+
"focus:outline-pickle-100",
|
|
895
|
+
"disabled:text-grey-40"
|
|
896
|
+
],
|
|
897
|
+
link: [
|
|
898
|
+
"leading-tight",
|
|
899
|
+
"text-black",
|
|
900
|
+
"underline",
|
|
901
|
+
"hover:text-purple-100",
|
|
902
|
+
"focus:text-black",
|
|
903
|
+
"focus:outline-purple-100",
|
|
904
|
+
"active:text-purple-80"
|
|
905
|
+
]
|
|
906
|
+
},
|
|
907
|
+
size: {
|
|
908
|
+
small: ["h-10", "text-sm", "px-4", "py-2"],
|
|
909
|
+
medium: ["h-12", "text-base", "px-6", "py-3"],
|
|
910
|
+
large: ["h-14", "text-lg", "px-8", "py-4"]
|
|
911
|
+
}
|
|
912
|
+
},
|
|
913
|
+
defaultVariants: {
|
|
914
|
+
variant: "neutral",
|
|
915
|
+
size: "medium"
|
|
916
|
+
},
|
|
917
|
+
compoundVariants: [
|
|
918
|
+
{
|
|
919
|
+
variant: "link",
|
|
920
|
+
size: "small",
|
|
921
|
+
class: ["h-3", "text-xs", "p-0"]
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
variant: "link",
|
|
925
|
+
size: "medium",
|
|
926
|
+
class: ["h-4", "text-sm", "p-0"]
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
variant: "link",
|
|
930
|
+
size: "large",
|
|
931
|
+
class: ["h-6", "text-base", "p-0"]
|
|
932
|
+
}
|
|
933
|
+
]
|
|
934
|
+
}
|
|
935
|
+
);
|
|
936
|
+
|
|
937
|
+
// src/components/ui/Combobox.tsx
|
|
938
|
+
import { forwardRef as forwardRef10, useEffect as useEffect3, useState as useState3 } from "react";
|
|
939
|
+
import { ChevronDownIcon as ChevronDownIcon2, CircleX as CircleX2, icons as icons3 } from "lucide-react";
|
|
940
|
+
import { cva as cva5 } from "cva";
|
|
941
|
+
|
|
767
942
|
// src/components/primitives/popover.tsx
|
|
768
943
|
import * as React6 from "react";
|
|
769
944
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
770
|
-
import { jsx as
|
|
945
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
771
946
|
var Popover = PopoverPrimitive.Root;
|
|
772
947
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
773
|
-
var PopoverContent = React6.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */
|
|
948
|
+
var PopoverContent = React6.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx15(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx15(
|
|
774
949
|
PopoverPrimitive.Content,
|
|
775
950
|
{
|
|
776
951
|
ref,
|
|
@@ -787,7 +962,7 @@ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
|
787
962
|
|
|
788
963
|
// src/components/ui/Badge.tsx
|
|
789
964
|
import { cva as cva4 } from "cva";
|
|
790
|
-
import { jsx as
|
|
965
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
791
966
|
var badgeVariants = cva4("rounded-full px-2 py-0.5 text-xs font-semibold", {
|
|
792
967
|
variants: {
|
|
793
968
|
variant: {
|
|
@@ -801,11 +976,11 @@ var badgeVariants = cva4("rounded-full px-2 py-0.5 text-xs font-semibold", {
|
|
|
801
976
|
}
|
|
802
977
|
});
|
|
803
978
|
function Badge({ className, variant, ...props }) {
|
|
804
|
-
return /* @__PURE__ */
|
|
979
|
+
return /* @__PURE__ */ jsx16("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
805
980
|
}
|
|
806
981
|
|
|
807
982
|
// src/components/ui/Combobox.tsx
|
|
808
|
-
import { jsx as
|
|
983
|
+
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
809
984
|
var Combobox = forwardRef10((props, ref) => {
|
|
810
985
|
const {
|
|
811
986
|
id,
|
|
@@ -825,8 +1000,8 @@ var Combobox = forwardRef10((props, ref) => {
|
|
|
825
1000
|
onChange: handleChange,
|
|
826
1001
|
children: footer
|
|
827
1002
|
} = props;
|
|
828
|
-
const [selected, setSelected] =
|
|
829
|
-
const [open, setOpen] =
|
|
1003
|
+
const [selected, setSelected] = useState3([]);
|
|
1004
|
+
const [open, setOpen] = useState3(false);
|
|
830
1005
|
const IconComponent = icon && icons3[icon];
|
|
831
1006
|
const hideSearchBox = options?.length <= 5;
|
|
832
1007
|
const isDefault = variant === "default";
|
|
@@ -834,7 +1009,7 @@ var Combobox = forwardRef10((props, ref) => {
|
|
|
834
1009
|
const isEmpty = selected.length == 0;
|
|
835
1010
|
const showChevron = isDefault ? isEmpty : true;
|
|
836
1011
|
const close = () => setOpen(false);
|
|
837
|
-
|
|
1012
|
+
useEffect3(() => {
|
|
838
1013
|
const valueArray = multiselect ? value ?? [] : value ? [value] : [];
|
|
839
1014
|
setSelected(
|
|
840
1015
|
valueArray.map((v) => options.find((o) => o.value === v)).filter((v) => v !== void 0)
|
|
@@ -862,8 +1037,8 @@ var Combobox = forwardRef10((props, ref) => {
|
|
|
862
1037
|
const defaultLabel = !isEmpty ? selected.map((s) => s.title).join(", ") : placeholder;
|
|
863
1038
|
return isDefault ? defaultLabel : label;
|
|
864
1039
|
};
|
|
865
|
-
return /* @__PURE__ */
|
|
866
|
-
isDefault && /* @__PURE__ */
|
|
1040
|
+
return /* @__PURE__ */ jsxs9("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
1041
|
+
isDefault && /* @__PURE__ */ jsx17(
|
|
867
1042
|
Label_default,
|
|
868
1043
|
{
|
|
869
1044
|
text: label,
|
|
@@ -873,15 +1048,15 @@ var Combobox = forwardRef10((props, ref) => {
|
|
|
873
1048
|
className: classNames?.label
|
|
874
1049
|
}
|
|
875
1050
|
),
|
|
876
|
-
/* @__PURE__ */
|
|
877
|
-
/* @__PURE__ */
|
|
878
|
-
/* @__PURE__ */
|
|
1051
|
+
/* @__PURE__ */ jsxs9("div", { className: "relative flex", children: [
|
|
1052
|
+
/* @__PURE__ */ jsxs9(Popover, { open, onOpenChange: setOpen, children: [
|
|
1053
|
+
/* @__PURE__ */ jsx17(
|
|
879
1054
|
PopoverTrigger,
|
|
880
1055
|
{
|
|
881
1056
|
asChild: true,
|
|
882
1057
|
disabled: options.length === 0,
|
|
883
1058
|
"data-testid": `${id ?? name}-combobox-trigger`,
|
|
884
|
-
children: /* @__PURE__ */
|
|
1059
|
+
children: /* @__PURE__ */ jsxs9(
|
|
885
1060
|
"div",
|
|
886
1061
|
{
|
|
887
1062
|
ref,
|
|
@@ -892,9 +1067,9 @@ var Combobox = forwardRef10((props, ref) => {
|
|
|
892
1067
|
),
|
|
893
1068
|
"aria-expanded": open,
|
|
894
1069
|
children: [
|
|
895
|
-
isDefault && IconComponent && /* @__PURE__ */
|
|
896
|
-
isChip && !isEmpty && /* @__PURE__ */
|
|
897
|
-
/* @__PURE__ */
|
|
1070
|
+
isDefault && IconComponent && /* @__PURE__ */ jsx17(IconComponent, { className: "h-4 w-4 shrink-0" }),
|
|
1071
|
+
isChip && !isEmpty && /* @__PURE__ */ jsx17(Badge, { variant: "purple", children: selected.length }),
|
|
1072
|
+
/* @__PURE__ */ jsx17(
|
|
898
1073
|
"span",
|
|
899
1074
|
{
|
|
900
1075
|
className: cn(
|
|
@@ -904,7 +1079,7 @@ var Combobox = forwardRef10((props, ref) => {
|
|
|
904
1079
|
children: handleDisplayValue()
|
|
905
1080
|
}
|
|
906
1081
|
),
|
|
907
|
-
showChevron && /* @__PURE__ */
|
|
1082
|
+
showChevron && /* @__PURE__ */ jsx17(
|
|
908
1083
|
ChevronDownIcon2,
|
|
909
1084
|
{
|
|
910
1085
|
className: "shrink-0 transform group-data-[state=open]:rotate-180",
|
|
@@ -916,7 +1091,7 @@ var Combobox = forwardRef10((props, ref) => {
|
|
|
916
1091
|
)
|
|
917
1092
|
}
|
|
918
1093
|
),
|
|
919
|
-
/* @__PURE__ */
|
|
1094
|
+
/* @__PURE__ */ jsx17(
|
|
920
1095
|
PopoverContent,
|
|
921
1096
|
{
|
|
922
1097
|
className: cn(
|
|
@@ -927,16 +1102,16 @@ var Combobox = forwardRef10((props, ref) => {
|
|
|
927
1102
|
collisionPadding: 8,
|
|
928
1103
|
sideOffset: 4,
|
|
929
1104
|
align: "start",
|
|
930
|
-
children: /* @__PURE__ */
|
|
931
|
-
!hideSearchBox && /* @__PURE__ */
|
|
932
|
-
/* @__PURE__ */
|
|
933
|
-
/* @__PURE__ */
|
|
934
|
-
/* @__PURE__ */
|
|
1105
|
+
children: /* @__PURE__ */ jsxs9(Command, { children: [
|
|
1106
|
+
!hideSearchBox && /* @__PURE__ */ jsx17(CommandInput, { placeholder: "Search..." }),
|
|
1107
|
+
/* @__PURE__ */ jsxs9(CommandList, { children: [
|
|
1108
|
+
/* @__PURE__ */ jsx17(CommandEmpty, { children: "No results" }),
|
|
1109
|
+
/* @__PURE__ */ jsx17(CommandGroup, { children: options.map(({ id: id2, ...option }) => /* @__PURE__ */ jsx17(
|
|
935
1110
|
CommandItem,
|
|
936
1111
|
{
|
|
937
1112
|
value: option.title,
|
|
938
1113
|
onSelect: () => handleSelect(option.value),
|
|
939
|
-
children: /* @__PURE__ */
|
|
1114
|
+
children: /* @__PURE__ */ jsx17(
|
|
940
1115
|
ListItem_default,
|
|
941
1116
|
{
|
|
942
1117
|
className: cn(classNames?.items, "truncate py-1"),
|
|
@@ -949,19 +1124,19 @@ var Combobox = forwardRef10((props, ref) => {
|
|
|
949
1124
|
id2
|
|
950
1125
|
)) })
|
|
951
1126
|
] }),
|
|
952
|
-
!!footer && /* @__PURE__ */
|
|
1127
|
+
!!footer && /* @__PURE__ */ jsx17(Separator, {}),
|
|
953
1128
|
footer && footer({ close })
|
|
954
1129
|
] })
|
|
955
1130
|
}
|
|
956
1131
|
)
|
|
957
1132
|
] }),
|
|
958
|
-
isDefault && !isEmpty && /* @__PURE__ */
|
|
1133
|
+
isDefault && !isEmpty && /* @__PURE__ */ jsx17(
|
|
959
1134
|
"button",
|
|
960
1135
|
{
|
|
961
1136
|
type: "button",
|
|
962
1137
|
className: "absolute inset-y-0 right-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
|
|
963
1138
|
onClick: handleClear,
|
|
964
|
-
children: /* @__PURE__ */
|
|
1139
|
+
children: /* @__PURE__ */ jsx17(CircleX2, { className: "h-4 w-4 text-green-100" })
|
|
965
1140
|
}
|
|
966
1141
|
)
|
|
967
1142
|
] })
|
|
@@ -997,12 +1172,12 @@ var triggerVariants = cva5(
|
|
|
997
1172
|
// src/components/ui/Counter.tsx
|
|
998
1173
|
import { cva as cva6 } from "cva";
|
|
999
1174
|
import { Minus as Minus2, Plus } from "lucide-react";
|
|
1000
|
-
import { forwardRef as forwardRef11, useEffect as
|
|
1001
|
-
import { jsx as
|
|
1175
|
+
import { forwardRef as forwardRef11, useEffect as useEffect4, useState as useState4 } from "react";
|
|
1176
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1002
1177
|
var Counter = forwardRef11(
|
|
1003
1178
|
({ label, error, min, max, step = 1, description, theme, value, classNames, onChange, ...props }, ref) => {
|
|
1004
|
-
const [count, setCount] =
|
|
1005
|
-
|
|
1179
|
+
const [count, setCount] = useState4(0);
|
|
1180
|
+
useEffect4(() => {
|
|
1006
1181
|
setCount(value ?? 0);
|
|
1007
1182
|
}, [value]);
|
|
1008
1183
|
const handleChange = (e) => {
|
|
@@ -1033,13 +1208,13 @@ var Counter = forwardRef11(
|
|
|
1033
1208
|
onChange?.(newValue);
|
|
1034
1209
|
setCount(newValue);
|
|
1035
1210
|
};
|
|
1036
|
-
return /* @__PURE__ */
|
|
1211
|
+
return /* @__PURE__ */ jsxs10(
|
|
1037
1212
|
"div",
|
|
1038
1213
|
{
|
|
1039
1214
|
className: cn("flex w-auto flex-col gap-1", classNames?.root),
|
|
1040
1215
|
"data-testid": `counter-wrapper-${props.id}`,
|
|
1041
1216
|
children: [
|
|
1042
|
-
label && /* @__PURE__ */
|
|
1217
|
+
label && /* @__PURE__ */ jsx18(
|
|
1043
1218
|
Label_default,
|
|
1044
1219
|
{
|
|
1045
1220
|
text: label,
|
|
@@ -1049,17 +1224,17 @@ var Counter = forwardRef11(
|
|
|
1049
1224
|
className: classNames?.label
|
|
1050
1225
|
}
|
|
1051
1226
|
),
|
|
1052
|
-
/* @__PURE__ */
|
|
1053
|
-
/* @__PURE__ */
|
|
1227
|
+
/* @__PURE__ */ jsxs10("div", { className: "relative flex w-[122px] flex-row items-center", children: [
|
|
1228
|
+
/* @__PURE__ */ jsx18(
|
|
1054
1229
|
"button",
|
|
1055
1230
|
{
|
|
1056
1231
|
type: "button",
|
|
1057
1232
|
className: "absolute inset-y-0 left-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
|
|
1058
1233
|
onClick: decrement,
|
|
1059
|
-
children: /* @__PURE__ */
|
|
1234
|
+
children: /* @__PURE__ */ jsx18(Minus2, { className: "h-4 w-4 text-green-100" })
|
|
1060
1235
|
}
|
|
1061
1236
|
),
|
|
1062
|
-
/* @__PURE__ */
|
|
1237
|
+
/* @__PURE__ */ jsx18(
|
|
1063
1238
|
"input",
|
|
1064
1239
|
{
|
|
1065
1240
|
className: cn(counterVariants({ theme }), classNames?.input),
|
|
@@ -1070,17 +1245,17 @@ var Counter = forwardRef11(
|
|
|
1070
1245
|
...props
|
|
1071
1246
|
}
|
|
1072
1247
|
),
|
|
1073
|
-
/* @__PURE__ */
|
|
1248
|
+
/* @__PURE__ */ jsx18(
|
|
1074
1249
|
"button",
|
|
1075
1250
|
{
|
|
1076
1251
|
type: "button",
|
|
1077
1252
|
className: "absolute inset-y-0 right-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
|
|
1078
1253
|
onClick: increment,
|
|
1079
|
-
children: /* @__PURE__ */
|
|
1254
|
+
children: /* @__PURE__ */ jsx18(Plus, { className: "h-4 w-4 text-green-100" })
|
|
1080
1255
|
}
|
|
1081
1256
|
)
|
|
1082
1257
|
] }),
|
|
1083
|
-
/* @__PURE__ */
|
|
1258
|
+
/* @__PURE__ */ jsx18(ErrorMessage_default, { message: error })
|
|
1084
1259
|
]
|
|
1085
1260
|
}
|
|
1086
1261
|
);
|
|
@@ -1146,7 +1321,10 @@ export {
|
|
|
1146
1321
|
Input_default as Input,
|
|
1147
1322
|
Label_default as Label,
|
|
1148
1323
|
ListItem_default as ListItem,
|
|
1324
|
+
MapComponent_default as MapComponent,
|
|
1325
|
+
PlacesQueryInput_default as PlacesQueryInput,
|
|
1149
1326
|
Select_default as Select,
|
|
1150
|
-
cn
|
|
1327
|
+
cn,
|
|
1328
|
+
fetchLocation
|
|
1151
1329
|
};
|
|
1152
1330
|
//# sourceMappingURL=index.js.map
|