magick-ui 0.2.3 → 0.2.4
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.cjs +74 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +86 -49
- package/dist/index.js.map +1 -1
- package/dist/schema.cjs +6 -1
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.d.cts +10 -0
- package/dist/schema.d.ts +10 -0
- package/dist/schema.js +6 -1
- package/dist/schema.js.map +1 -1
- package/dist/ui/index.cjs +68 -36
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +2 -1
- package/dist/ui/index.d.ts +2 -1
- package/dist/ui/index.js +80 -48
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/schema/component-schema.json +4 -0
package/dist/ui/index.d.cts
CHANGED
|
@@ -601,9 +601,10 @@ interface MapProps {
|
|
|
601
601
|
className?: string;
|
|
602
602
|
gestureHandling?: "cooperative" | "greedy" | "none" | "auto";
|
|
603
603
|
disableDefaultUI?: boolean;
|
|
604
|
+
showCurrentLocation?: boolean;
|
|
604
605
|
onMarkerClick?: (marker: MapMarker, index: number) => void;
|
|
605
606
|
}
|
|
606
|
-
declare function GoogleMapView({ apiKey, center, zoom, markers, mapId, height, width, className, gestureHandling, disableDefaultUI, onMarkerClick, }: MapProps): react_jsx_runtime.JSX.Element;
|
|
607
|
+
declare function GoogleMapView({ apiKey, center, zoom, markers, mapId, height, width, className, gestureHandling, disableDefaultUI, showCurrentLocation, onMarkerClick, }: MapProps): react_jsx_runtime.JSX.Element;
|
|
607
608
|
|
|
608
609
|
interface MediaProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof mediaVariants> {
|
|
609
610
|
src: string;
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -601,9 +601,10 @@ interface MapProps {
|
|
|
601
601
|
className?: string;
|
|
602
602
|
gestureHandling?: "cooperative" | "greedy" | "none" | "auto";
|
|
603
603
|
disableDefaultUI?: boolean;
|
|
604
|
+
showCurrentLocation?: boolean;
|
|
604
605
|
onMarkerClick?: (marker: MapMarker, index: number) => void;
|
|
605
606
|
}
|
|
606
|
-
declare function GoogleMapView({ apiKey, center, zoom, markers, mapId, height, width, className, gestureHandling, disableDefaultUI, onMarkerClick, }: MapProps): react_jsx_runtime.JSX.Element;
|
|
607
|
+
declare function GoogleMapView({ apiKey, center, zoom, markers, mapId, height, width, className, gestureHandling, disableDefaultUI, showCurrentLocation, onMarkerClick, }: MapProps): react_jsx_runtime.JSX.Element;
|
|
607
608
|
|
|
608
609
|
interface MediaProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof mediaVariants> {
|
|
609
610
|
src: string;
|
package/dist/ui/index.js
CHANGED
|
@@ -3608,12 +3608,12 @@ function LinkButton({
|
|
|
3608
3608
|
import {
|
|
3609
3609
|
APIProvider,
|
|
3610
3610
|
Map as GoogleMap,
|
|
3611
|
-
|
|
3611
|
+
Marker,
|
|
3612
3612
|
InfoWindow,
|
|
3613
|
-
|
|
3613
|
+
useMap
|
|
3614
3614
|
} from "@vis.gl/react-google-maps";
|
|
3615
|
-
import { useState as useState6, useCallback as useCallback3 } from "react";
|
|
3616
|
-
import { jsx as jsx34, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3615
|
+
import { useState as useState6, useCallback as useCallback3, useEffect as useEffect5 } from "react";
|
|
3616
|
+
import { Fragment as Fragment5, jsx as jsx34, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3617
3617
|
function MarkerWithInfo({
|
|
3618
3618
|
marker,
|
|
3619
3619
|
index,
|
|
@@ -3624,33 +3624,61 @@ function MarkerWithInfo({
|
|
|
3624
3624
|
setOpen((prev) => !prev);
|
|
3625
3625
|
onMarkerClick?.(marker, index);
|
|
3626
3626
|
}, [marker, index, onMarkerClick]);
|
|
3627
|
-
return /* @__PURE__ */ jsxs25(
|
|
3628
|
-
|
|
3627
|
+
return /* @__PURE__ */ jsxs25(Fragment5, { children: [
|
|
3628
|
+
/* @__PURE__ */ jsx34(
|
|
3629
|
+
Marker,
|
|
3630
|
+
{
|
|
3631
|
+
position: { lat: marker.lat, lng: marker.lng },
|
|
3632
|
+
title: marker.title,
|
|
3633
|
+
onClick: handleClick
|
|
3634
|
+
}
|
|
3635
|
+
),
|
|
3636
|
+
open && (marker.title || marker.description) && /* @__PURE__ */ jsx34(
|
|
3637
|
+
InfoWindow,
|
|
3638
|
+
{
|
|
3639
|
+
position: { lat: marker.lat, lng: marker.lng },
|
|
3640
|
+
onCloseClick: () => setOpen(false),
|
|
3641
|
+
children: /* @__PURE__ */ jsxs25("div", { className: "max-w-xs", children: [
|
|
3642
|
+
marker.title && /* @__PURE__ */ jsx34("h3", { className: "text-body-sm font-semibold", children: marker.title }),
|
|
3643
|
+
marker.description && /* @__PURE__ */ jsx34("p", { className: "text-body-sm text-element-inverse-gray mt-1", children: marker.description })
|
|
3644
|
+
] })
|
|
3645
|
+
}
|
|
3646
|
+
)
|
|
3647
|
+
] });
|
|
3648
|
+
}
|
|
3649
|
+
var CURRENT_LOCATION_ICON = {
|
|
3650
|
+
path: 0,
|
|
3651
|
+
// google.maps.SymbolPath.CIRCLE
|
|
3652
|
+
scale: 8,
|
|
3653
|
+
fillColor: "#4285F4",
|
|
3654
|
+
fillOpacity: 1,
|
|
3655
|
+
strokeColor: "#ffffff",
|
|
3656
|
+
strokeWeight: 2.5
|
|
3657
|
+
};
|
|
3658
|
+
function CurrentLocationMarker() {
|
|
3659
|
+
const map = useMap();
|
|
3660
|
+
const [position, setPosition] = useState6(null);
|
|
3661
|
+
useEffect5(() => {
|
|
3662
|
+
if (!navigator.geolocation) return;
|
|
3663
|
+
const watchId = navigator.geolocation.watchPosition(
|
|
3664
|
+
(pos) => {
|
|
3665
|
+
const coords = { lat: pos.coords.latitude, lng: pos.coords.longitude };
|
|
3666
|
+
setPosition(coords);
|
|
3667
|
+
},
|
|
3668
|
+
() => {
|
|
3669
|
+
},
|
|
3670
|
+
{ enableHighAccuracy: true, maximumAge: 1e4 }
|
|
3671
|
+
);
|
|
3672
|
+
return () => navigator.geolocation.clearWatch(watchId);
|
|
3673
|
+
}, [map]);
|
|
3674
|
+
if (!position) return null;
|
|
3675
|
+
return /* @__PURE__ */ jsx34(
|
|
3676
|
+
Marker,
|
|
3629
3677
|
{
|
|
3630
|
-
position
|
|
3631
|
-
title:
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
marker.color && /* @__PURE__ */ jsx34(
|
|
3635
|
-
Pin,
|
|
3636
|
-
{
|
|
3637
|
-
background: marker.color,
|
|
3638
|
-
borderColor: marker.color,
|
|
3639
|
-
glyphColor: "#fff"
|
|
3640
|
-
}
|
|
3641
|
-
),
|
|
3642
|
-
open && (marker.title || marker.description) && /* @__PURE__ */ jsx34(
|
|
3643
|
-
InfoWindow,
|
|
3644
|
-
{
|
|
3645
|
-
position: { lat: marker.lat, lng: marker.lng },
|
|
3646
|
-
onCloseClick: () => setOpen(false),
|
|
3647
|
-
children: /* @__PURE__ */ jsxs25("div", { className: "max-w-xs", children: [
|
|
3648
|
-
marker.title && /* @__PURE__ */ jsx34("h3", { className: "text-body-sm font-semibold", children: marker.title }),
|
|
3649
|
-
marker.description && /* @__PURE__ */ jsx34("p", { className: "text-body-sm text-element-inverse-gray mt-1", children: marker.description })
|
|
3650
|
-
] })
|
|
3651
|
-
}
|
|
3652
|
-
)
|
|
3653
|
-
]
|
|
3678
|
+
position,
|
|
3679
|
+
title: "Your location",
|
|
3680
|
+
icon: CURRENT_LOCATION_ICON,
|
|
3681
|
+
clickable: false
|
|
3654
3682
|
}
|
|
3655
3683
|
);
|
|
3656
3684
|
}
|
|
@@ -3666,6 +3694,7 @@ function GoogleMapView({
|
|
|
3666
3694
|
className,
|
|
3667
3695
|
gestureHandling = "cooperative",
|
|
3668
3696
|
disableDefaultUI = false,
|
|
3697
|
+
showCurrentLocation = false,
|
|
3669
3698
|
onMarkerClick
|
|
3670
3699
|
}) {
|
|
3671
3700
|
return /* @__PURE__ */ jsx34(APIProvider, { apiKey, children: /* @__PURE__ */ jsx34(
|
|
@@ -3673,7 +3702,7 @@ function GoogleMapView({
|
|
|
3673
3702
|
{
|
|
3674
3703
|
className: cn("overflow-hidden rounded-unit-corner-radius-xl", className),
|
|
3675
3704
|
style: { height, width },
|
|
3676
|
-
children: /* @__PURE__ */
|
|
3705
|
+
children: /* @__PURE__ */ jsxs25(
|
|
3677
3706
|
GoogleMap,
|
|
3678
3707
|
{
|
|
3679
3708
|
defaultCenter: center,
|
|
@@ -3682,15 +3711,18 @@ function GoogleMapView({
|
|
|
3682
3711
|
gestureHandling,
|
|
3683
3712
|
disableDefaultUI,
|
|
3684
3713
|
style: { width: "100%", height: "100%" },
|
|
3685
|
-
children:
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3714
|
+
children: [
|
|
3715
|
+
showCurrentLocation && /* @__PURE__ */ jsx34(CurrentLocationMarker, {}),
|
|
3716
|
+
markers.map((marker, i) => /* @__PURE__ */ jsx34(
|
|
3717
|
+
MarkerWithInfo,
|
|
3718
|
+
{
|
|
3719
|
+
marker,
|
|
3720
|
+
index: i,
|
|
3721
|
+
onMarkerClick
|
|
3722
|
+
},
|
|
3723
|
+
`${marker.lat}-${marker.lng}-${i}`
|
|
3724
|
+
))
|
|
3725
|
+
]
|
|
3694
3726
|
}
|
|
3695
3727
|
)
|
|
3696
3728
|
}
|
|
@@ -3701,7 +3733,7 @@ function GoogleMapView({
|
|
|
3701
3733
|
import { cva as cva10 } from "class-variance-authority";
|
|
3702
3734
|
import { Pause, Play } from "lucide-react";
|
|
3703
3735
|
import * as React10 from "react";
|
|
3704
|
-
import { Fragment as
|
|
3736
|
+
import { Fragment as Fragment6, jsx as jsx35, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3705
3737
|
var mediaVariants = cva10(
|
|
3706
3738
|
"relative overflow-hidden bg-gray-100 dark:bg-gray-800",
|
|
3707
3739
|
{
|
|
@@ -3807,7 +3839,7 @@ var Media = React10.forwardRef(
|
|
|
3807
3839
|
onMouseEnter: () => setIsHovered(true),
|
|
3808
3840
|
onMouseLeave: () => setIsHovered(false),
|
|
3809
3841
|
...props,
|
|
3810
|
-
children: type === "image" ? /* @__PURE__ */ jsxs26(
|
|
3842
|
+
children: type === "image" ? /* @__PURE__ */ jsxs26(Fragment6, { children: [
|
|
3811
3843
|
/* @__PURE__ */ jsx35(
|
|
3812
3844
|
"img",
|
|
3813
3845
|
{
|
|
@@ -3831,7 +3863,7 @@ var Media = React10.forwardRef(
|
|
|
3831
3863
|
/* @__PURE__ */ jsx35("div", { className: "text-2xl", children: "\u{1F4F7}" }),
|
|
3832
3864
|
/* @__PURE__ */ jsx35("div", { className: "text-sm", children: "Failed to load" })
|
|
3833
3865
|
] }) })
|
|
3834
|
-
] }) : /* @__PURE__ */ jsxs26(
|
|
3866
|
+
] }) : /* @__PURE__ */ jsxs26(Fragment6, { children: [
|
|
3835
3867
|
/* @__PURE__ */ jsx35(
|
|
3836
3868
|
"video",
|
|
3837
3869
|
{
|
|
@@ -4287,7 +4319,7 @@ function BaseRadioGroupItem({
|
|
|
4287
4319
|
import { debounce } from "lodash";
|
|
4288
4320
|
import { SearchIcon as SearchIcon2 } from "lucide-react";
|
|
4289
4321
|
import { useQueryState } from "nuqs";
|
|
4290
|
-
import { useCallback as useCallback4, useEffect as
|
|
4322
|
+
import { useCallback as useCallback4, useEffect as useEffect7, useState as useState10 } from "react";
|
|
4291
4323
|
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
4292
4324
|
function SearchInput({
|
|
4293
4325
|
searchKey,
|
|
@@ -4311,7 +4343,7 @@ function SearchInput({
|
|
|
4311
4343
|
}, debounceDelay),
|
|
4312
4344
|
[debounceDelay, addToParam, setSearch]
|
|
4313
4345
|
);
|
|
4314
|
-
|
|
4346
|
+
useEffect7(() => {
|
|
4315
4347
|
debouncedSetValue(inputValue);
|
|
4316
4348
|
return () => {
|
|
4317
4349
|
debouncedSetValue.cancel();
|
|
@@ -4747,7 +4779,7 @@ import {
|
|
|
4747
4779
|
} from "magick-icons";
|
|
4748
4780
|
import * as React16 from "react";
|
|
4749
4781
|
import { useState as useState12 } from "react";
|
|
4750
|
-
import { Fragment as
|
|
4782
|
+
import { Fragment as Fragment7, jsx as jsx48, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4751
4783
|
var Table = ({
|
|
4752
4784
|
columns,
|
|
4753
4785
|
tableData,
|
|
@@ -4870,7 +4902,7 @@ var PrimaryCell = React16.forwardRef(
|
|
|
4870
4902
|
badgeContent && /* @__PURE__ */ jsx48(Badge, { type: badgeType, size: badgeSize, children: badgeContent })
|
|
4871
4903
|
] });
|
|
4872
4904
|
} else if (variant === "progress") {
|
|
4873
|
-
content = /* @__PURE__ */ jsxs36(
|
|
4905
|
+
content = /* @__PURE__ */ jsxs36(Fragment7, { children: [
|
|
4874
4906
|
progressValue !== 100 && /* @__PURE__ */ jsx48(
|
|
4875
4907
|
ProgressIndicator,
|
|
4876
4908
|
{
|
|
@@ -4883,7 +4915,7 @@ var PrimaryCell = React16.forwardRef(
|
|
|
4883
4915
|
children && /* @__PURE__ */ jsx48("span", { className: "text-body-sm text-element-inverse-default", children })
|
|
4884
4916
|
] });
|
|
4885
4917
|
} else if (variant === "error") {
|
|
4886
|
-
content = /* @__PURE__ */ jsxs36(
|
|
4918
|
+
content = /* @__PURE__ */ jsxs36(Fragment7, { children: [
|
|
4887
4919
|
/* @__PURE__ */ jsx48(AlertCircle, { className: "size-4 shrink-0" }),
|
|
4888
4920
|
errorMessage ? /* @__PURE__ */ jsx48("span", { className: "text-body-sm", children: errorMessage }) : children
|
|
4889
4921
|
] });
|