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.js CHANGED
@@ -3312,6 +3312,10 @@ var component_schema_default = {
3312
3312
  disableDefaultUI: {
3313
3313
  type: "boolean",
3314
3314
  description: "Hide default map controls"
3315
+ },
3316
+ showCurrentLocation: {
3317
+ type: "boolean",
3318
+ description: "Show a blue dot for the user's current location"
3315
3319
  }
3316
3320
  },
3317
3321
  additionalProperties: false
@@ -5523,7 +5527,8 @@ var googleMapSchema = z46.object({
5523
5527
  height: z46.string().optional().describe("Map height CSS value. Defaults to '400px'"),
5524
5528
  width: z46.string().optional().describe("Map width CSS value. Defaults to '100%'"),
5525
5529
  gestureHandling: z46.enum(["cooperative", "greedy", "none", "auto"]).optional().describe("How the map handles touch/scroll gestures. Defaults to 'cooperative'"),
5526
- disableDefaultUI: z46.boolean().optional().describe("Hide default map controls")
5530
+ disableDefaultUI: z46.boolean().optional().describe("Hide default map controls"),
5531
+ showCurrentLocation: z46.boolean().optional().describe("Show a blue dot for the user's current location")
5527
5532
  })
5528
5533
  }).describe("An interactive Google Map with optional markers and info windows");
5529
5534
 
@@ -9418,12 +9423,12 @@ function LinkButton({
9418
9423
  import {
9419
9424
  APIProvider,
9420
9425
  Map as GoogleMap,
9421
- AdvancedMarker,
9426
+ Marker,
9422
9427
  InfoWindow,
9423
- Pin
9428
+ useMap
9424
9429
  } from "@vis.gl/react-google-maps";
9425
- import { useState as useState6, useCallback as useCallback3 } from "react";
9426
- import { jsx as jsx34, jsxs as jsxs25 } from "react/jsx-runtime";
9430
+ import { useState as useState6, useCallback as useCallback3, useEffect as useEffect5 } from "react";
9431
+ import { Fragment as Fragment5, jsx as jsx34, jsxs as jsxs25 } from "react/jsx-runtime";
9427
9432
  function MarkerWithInfo({
9428
9433
  marker,
9429
9434
  index,
@@ -9434,33 +9439,61 @@ function MarkerWithInfo({
9434
9439
  setOpen((prev) => !prev);
9435
9440
  onMarkerClick?.(marker, index);
9436
9441
  }, [marker, index, onMarkerClick]);
9437
- return /* @__PURE__ */ jsxs25(
9438
- AdvancedMarker,
9442
+ return /* @__PURE__ */ jsxs25(Fragment5, { children: [
9443
+ /* @__PURE__ */ jsx34(
9444
+ Marker,
9445
+ {
9446
+ position: { lat: marker.lat, lng: marker.lng },
9447
+ title: marker.title,
9448
+ onClick: handleClick
9449
+ }
9450
+ ),
9451
+ open && (marker.title || marker.description) && /* @__PURE__ */ jsx34(
9452
+ InfoWindow,
9453
+ {
9454
+ position: { lat: marker.lat, lng: marker.lng },
9455
+ onCloseClick: () => setOpen(false),
9456
+ children: /* @__PURE__ */ jsxs25("div", { className: "max-w-xs", children: [
9457
+ marker.title && /* @__PURE__ */ jsx34("h3", { className: "text-body-sm font-semibold", children: marker.title }),
9458
+ marker.description && /* @__PURE__ */ jsx34("p", { className: "text-body-sm text-element-inverse-gray mt-1", children: marker.description })
9459
+ ] })
9460
+ }
9461
+ )
9462
+ ] });
9463
+ }
9464
+ var CURRENT_LOCATION_ICON = {
9465
+ path: 0,
9466
+ // google.maps.SymbolPath.CIRCLE
9467
+ scale: 8,
9468
+ fillColor: "#4285F4",
9469
+ fillOpacity: 1,
9470
+ strokeColor: "#ffffff",
9471
+ strokeWeight: 2.5
9472
+ };
9473
+ function CurrentLocationMarker() {
9474
+ const map = useMap();
9475
+ const [position, setPosition] = useState6(null);
9476
+ useEffect5(() => {
9477
+ if (!navigator.geolocation) return;
9478
+ const watchId = navigator.geolocation.watchPosition(
9479
+ (pos) => {
9480
+ const coords = { lat: pos.coords.latitude, lng: pos.coords.longitude };
9481
+ setPosition(coords);
9482
+ },
9483
+ () => {
9484
+ },
9485
+ { enableHighAccuracy: true, maximumAge: 1e4 }
9486
+ );
9487
+ return () => navigator.geolocation.clearWatch(watchId);
9488
+ }, [map]);
9489
+ if (!position) return null;
9490
+ return /* @__PURE__ */ jsx34(
9491
+ Marker,
9439
9492
  {
9440
- position: { lat: marker.lat, lng: marker.lng },
9441
- title: marker.title,
9442
- onClick: handleClick,
9443
- children: [
9444
- marker.color && /* @__PURE__ */ jsx34(
9445
- Pin,
9446
- {
9447
- background: marker.color,
9448
- borderColor: marker.color,
9449
- glyphColor: "#fff"
9450
- }
9451
- ),
9452
- open && (marker.title || marker.description) && /* @__PURE__ */ jsx34(
9453
- InfoWindow,
9454
- {
9455
- position: { lat: marker.lat, lng: marker.lng },
9456
- onCloseClick: () => setOpen(false),
9457
- children: /* @__PURE__ */ jsxs25("div", { className: "max-w-xs", children: [
9458
- marker.title && /* @__PURE__ */ jsx34("h3", { className: "text-body-sm font-semibold", children: marker.title }),
9459
- marker.description && /* @__PURE__ */ jsx34("p", { className: "text-body-sm text-element-inverse-gray mt-1", children: marker.description })
9460
- ] })
9461
- }
9462
- )
9463
- ]
9493
+ position,
9494
+ title: "Your location",
9495
+ icon: CURRENT_LOCATION_ICON,
9496
+ clickable: false
9464
9497
  }
9465
9498
  );
9466
9499
  }
@@ -9476,6 +9509,7 @@ function GoogleMapView({
9476
9509
  className,
9477
9510
  gestureHandling = "cooperative",
9478
9511
  disableDefaultUI = false,
9512
+ showCurrentLocation = false,
9479
9513
  onMarkerClick
9480
9514
  }) {
9481
9515
  return /* @__PURE__ */ jsx34(APIProvider, { apiKey, children: /* @__PURE__ */ jsx34(
@@ -9483,7 +9517,7 @@ function GoogleMapView({
9483
9517
  {
9484
9518
  className: cn("overflow-hidden rounded-unit-corner-radius-xl", className),
9485
9519
  style: { height, width },
9486
- children: /* @__PURE__ */ jsx34(
9520
+ children: /* @__PURE__ */ jsxs25(
9487
9521
  GoogleMap,
9488
9522
  {
9489
9523
  defaultCenter: center,
@@ -9492,15 +9526,18 @@ function GoogleMapView({
9492
9526
  gestureHandling,
9493
9527
  disableDefaultUI,
9494
9528
  style: { width: "100%", height: "100%" },
9495
- children: markers.map((marker, i) => /* @__PURE__ */ jsx34(
9496
- MarkerWithInfo,
9497
- {
9498
- marker,
9499
- index: i,
9500
- onMarkerClick
9501
- },
9502
- `${marker.lat}-${marker.lng}-${i}`
9503
- ))
9529
+ children: [
9530
+ showCurrentLocation && /* @__PURE__ */ jsx34(CurrentLocationMarker, {}),
9531
+ markers.map((marker, i) => /* @__PURE__ */ jsx34(
9532
+ MarkerWithInfo,
9533
+ {
9534
+ marker,
9535
+ index: i,
9536
+ onMarkerClick
9537
+ },
9538
+ `${marker.lat}-${marker.lng}-${i}`
9539
+ ))
9540
+ ]
9504
9541
  }
9505
9542
  )
9506
9543
  }
@@ -9511,7 +9548,7 @@ function GoogleMapView({
9511
9548
  import { cva as cva10 } from "class-variance-authority";
9512
9549
  import { Pause, Play } from "lucide-react";
9513
9550
  import * as React10 from "react";
9514
- import { Fragment as Fragment5, jsx as jsx35, jsxs as jsxs26 } from "react/jsx-runtime";
9551
+ import { Fragment as Fragment6, jsx as jsx35, jsxs as jsxs26 } from "react/jsx-runtime";
9515
9552
  var mediaVariants = cva10(
9516
9553
  "relative overflow-hidden bg-gray-100 dark:bg-gray-800",
9517
9554
  {
@@ -9617,7 +9654,7 @@ var Media = React10.forwardRef(
9617
9654
  onMouseEnter: () => setIsHovered(true),
9618
9655
  onMouseLeave: () => setIsHovered(false),
9619
9656
  ...props,
9620
- children: type === "image" ? /* @__PURE__ */ jsxs26(Fragment5, { children: [
9657
+ children: type === "image" ? /* @__PURE__ */ jsxs26(Fragment6, { children: [
9621
9658
  /* @__PURE__ */ jsx35(
9622
9659
  "img",
9623
9660
  {
@@ -9641,7 +9678,7 @@ var Media = React10.forwardRef(
9641
9678
  /* @__PURE__ */ jsx35("div", { className: "text-2xl", children: "\u{1F4F7}" }),
9642
9679
  /* @__PURE__ */ jsx35("div", { className: "text-sm", children: "Failed to load" })
9643
9680
  ] }) })
9644
- ] }) : /* @__PURE__ */ jsxs26(Fragment5, { children: [
9681
+ ] }) : /* @__PURE__ */ jsxs26(Fragment6, { children: [
9645
9682
  /* @__PURE__ */ jsx35(
9646
9683
  "video",
9647
9684
  {
@@ -10097,7 +10134,7 @@ function BaseRadioGroupItem({
10097
10134
  import { debounce } from "lodash";
10098
10135
  import { SearchIcon as SearchIcon2 } from "lucide-react";
10099
10136
  import { useQueryState } from "nuqs";
10100
- import { useCallback as useCallback4, useEffect as useEffect6, useState as useState10 } from "react";
10137
+ import { useCallback as useCallback4, useEffect as useEffect7, useState as useState10 } from "react";
10101
10138
  import { jsx as jsx40 } from "react/jsx-runtime";
10102
10139
  function SearchInput({
10103
10140
  searchKey,
@@ -10121,7 +10158,7 @@ function SearchInput({
10121
10158
  }, debounceDelay),
10122
10159
  [debounceDelay, addToParam, setSearch]
10123
10160
  );
10124
- useEffect6(() => {
10161
+ useEffect7(() => {
10125
10162
  debouncedSetValue(inputValue);
10126
10163
  return () => {
10127
10164
  debouncedSetValue.cancel();
@@ -10557,7 +10594,7 @@ import {
10557
10594
  } from "magick-icons";
10558
10595
  import * as React16 from "react";
10559
10596
  import { useState as useState12 } from "react";
10560
- import { Fragment as Fragment6, jsx as jsx48, jsxs as jsxs36 } from "react/jsx-runtime";
10597
+ import { Fragment as Fragment7, jsx as jsx48, jsxs as jsxs36 } from "react/jsx-runtime";
10561
10598
  var Table = ({
10562
10599
  columns,
10563
10600
  tableData,
@@ -10680,7 +10717,7 @@ var PrimaryCell = React16.forwardRef(
10680
10717
  badgeContent && /* @__PURE__ */ jsx48(Badge, { type: badgeType, size: badgeSize, children: badgeContent })
10681
10718
  ] });
10682
10719
  } else if (variant === "progress") {
10683
- content = /* @__PURE__ */ jsxs36(Fragment6, { children: [
10720
+ content = /* @__PURE__ */ jsxs36(Fragment7, { children: [
10684
10721
  progressValue !== 100 && /* @__PURE__ */ jsx48(
10685
10722
  ProgressIndicator,
10686
10723
  {
@@ -10693,7 +10730,7 @@ var PrimaryCell = React16.forwardRef(
10693
10730
  children && /* @__PURE__ */ jsx48("span", { className: "text-body-sm text-element-inverse-default", children })
10694
10731
  ] });
10695
10732
  } else if (variant === "error") {
10696
- content = /* @__PURE__ */ jsxs36(Fragment6, { children: [
10733
+ content = /* @__PURE__ */ jsxs36(Fragment7, { children: [
10697
10734
  /* @__PURE__ */ jsx48(AlertCircle, { className: "size-4 shrink-0" }),
10698
10735
  errorMessage ? /* @__PURE__ */ jsx48("span", { className: "text-body-sm", children: errorMessage }) : children
10699
10736
  ] });