dune-react 0.0.16 → 0.0.19

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.
Files changed (30) hide show
  1. package/dist/components/puck-base/core/fields.d.ts +23 -0
  2. package/dist/components/puck-base/core/fields.js +24 -15
  3. package/dist/components/puck-base/core/styles.d.ts +1 -5
  4. package/dist/components/puck-base/core/styles.js +1 -5
  5. package/dist/components/puck-base/core/with-editable.js +2 -2
  6. package/dist/components/puck-base/editor-context.d.ts +2 -0
  7. package/dist/components/puck-base/fields/index.d.ts +1 -0
  8. package/dist/components/puck-base/fields/location-field.d.ts +44 -0
  9. package/dist/components/puck-base/fields/location-field.js +207 -0
  10. package/dist/components/puck-block/hero-sections/fullscreen-hero-1/fullscreen-hero.d.ts +3 -3
  11. package/dist/components/puck-block/hero-sections/fullscreen-hero-1/fullscreen-hero.js +57 -11
  12. package/dist/components/puck-block/hero-sections/fullscreen-hero-1/index.js +4 -4
  13. package/dist/components/puck-block/hero-sections/image-hero-1/image-hero.d.ts +3 -3
  14. package/dist/components/puck-block/hero-sections/image-hero-1/image-hero.js +4 -3
  15. package/dist/components/puck-block/hero-sections/image-hero-1/index.js +3 -10
  16. package/dist/components/puck-block/hero-sections/props.d.ts +1 -3
  17. package/dist/components/puck-block/hero-sections/video-hero-1/index.js +3 -3
  18. package/dist/components/puck-block/hero-sections/video-hero-1/video-hero.d.ts +4 -4
  19. package/dist/components/puck-block/hero-sections/video-hero-1/video-hero.js +32 -29
  20. package/dist/components/puck-block/location-sections/location-1/index.js +17 -22
  21. package/dist/components/puck-block/location-sections/location-1/location.d.ts +5 -7
  22. package/dist/components/puck-block/location-sections/location-1/location.js +15 -12
  23. package/dist/components/puck-block/location-sections/location-2/index.js +28 -24
  24. package/dist/components/puck-block/location-sections/location-2/location.d.ts +6 -8
  25. package/dist/components/puck-block/location-sections/location-2/location.js +18 -15
  26. package/dist/components/puck-block/location-sections/location-3/index.js +43 -20
  27. package/dist/components/puck-block/location-sections/location-3/location.d.ts +5 -6
  28. package/dist/components/puck-block/location-sections/location-3/location.js +96 -86
  29. package/dist/components/puck-block/location-sections/props.d.ts +9 -10
  30. package/package.json +3 -2
@@ -2,15 +2,22 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { CompoundContainer } from "../../../puck-base/container.js";
3
3
  import { CompoundButton } from "../../../puck-base/button.js";
4
4
  import { cn } from "../../../../utils/css-utils.js";
5
+ import { getMapEmbedUrl, getDirectionsUrl } from "../../../puck-base/core/fields.js";
6
+ const MAP_STYLE_FILTERS = {
7
+ default: "",
8
+ grayscale: "grayscale(35%) contrast(1.05) brightness(1.0)",
9
+ dark: "grayscale(100%) invert(1) contrast(1.1) brightness(0.8)"
10
+ };
5
11
  const Location3 = ({
6
12
  heading,
7
13
  description,
8
- mapEmbedUrl,
9
- mapTitle = "Google Maps",
10
- mapFilter,
14
+ mapLocation,
15
+ mapStyle = "default",
11
16
  locations = [],
12
17
  styles
13
18
  }) => {
19
+ const mapEmbedUrl = mapLocation && mapLocation.lat !== 0 ? getMapEmbedUrl(mapLocation) : void 0;
20
+ const mapFilter = MAP_STYLE_FILTERS[mapStyle] || "";
14
21
  const mapHeight = (styles == null ? void 0 : styles.mapHeight) ?? "md";
15
22
  const columns = (styles == null ? void 0 : styles.columns) ?? "3";
16
23
  const mapHeightClass = mapHeight === "sm" ? "h-[220px] md:h-[260px]" : mapHeight === "lg" ? "h-[360px] md:h-[440px]" : "h-[280px] md:h-[340px]";
@@ -30,97 +37,100 @@ const Location3 = ({
30
37
  "iframe",
31
38
  {
32
39
  src: mapEmbedUrl,
33
- title: mapTitle,
40
+ title: (mapLocation == null ? void 0 : mapLocation.address) || "Google Maps",
34
41
  className: "h-full w-full border-0",
35
42
  loading: "lazy",
36
43
  referrerPolicy: "no-referrer-when-downgrade",
37
44
  allowFullScreen: true,
38
- style: { filter: mapFilter }
45
+ style: mapFilter ? { filter: mapFilter } : void 0
39
46
  }
40
47
  ) : /* @__PURE__ */ jsx("div", { className: "bg-muted text-muted-foreground flex h-full w-full items-center justify-center text-sm", children: "Map address not configured" }) }),
41
- locations.length > 0 && /* @__PURE__ */ jsx("div", { className: cn("grid grid-cols-1 gap-5", colClass), children: locations.map((loc, i) => /* @__PURE__ */ jsxs(
42
- "div",
43
- {
44
- className: "bg-card border-border flex flex-col gap-3 rounded-xl border p-6",
45
- children: [
46
- /* @__PURE__ */ jsx("h3", { className: "text-foreground text-lg font-semibold", children: loc.name }),
47
- loc.address && /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground flex items-start gap-2 text-sm", children: [
48
- /* @__PURE__ */ jsxs(
49
- "svg",
50
- {
51
- className: "text-primary mt-0.5 shrink-0",
52
- width: "14",
53
- height: "14",
54
- viewBox: "0 0 24 24",
55
- fill: "none",
56
- stroke: "currentColor",
57
- strokeWidth: "2",
58
- strokeLinecap: "round",
59
- strokeLinejoin: "round",
60
- children: [
61
- /* @__PURE__ */ jsx("path", { d: "M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z" }),
62
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "10", r: "3" })
63
- ]
64
- }
65
- ),
66
- /* @__PURE__ */ jsx("span", { className: "whitespace-pre-line", children: loc.address })
67
- ] }),
68
- loc.phone && /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground flex items-center gap-2 text-sm", children: [
69
- /* @__PURE__ */ jsx(
70
- "svg",
71
- {
72
- className: "text-primary shrink-0",
73
- width: "14",
74
- height: "14",
75
- viewBox: "0 0 24 24",
76
- fill: "none",
77
- stroke: "currentColor",
78
- strokeWidth: "2",
79
- strokeLinecap: "round",
80
- strokeLinejoin: "round",
81
- children: /* @__PURE__ */ jsx("path", { d: "M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07A19.5 19.5 0 0 1 4.69 14a19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 3.62 3h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L8.09 10.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 22 17.92Z" })
82
- }
83
- ),
84
- /* @__PURE__ */ jsx("span", { children: loc.phone })
85
- ] }),
86
- loc.hours && /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground flex items-start gap-2 text-sm", children: [
87
- /* @__PURE__ */ jsxs(
88
- "svg",
48
+ locations.length > 0 && /* @__PURE__ */ jsx("div", { className: cn("grid grid-cols-1 gap-5", colClass), children: locations.map((loc, i) => {
49
+ var _a;
50
+ return /* @__PURE__ */ jsxs(
51
+ "div",
52
+ {
53
+ className: "bg-card border-border flex flex-col gap-3 rounded-xl border p-6",
54
+ children: [
55
+ /* @__PURE__ */ jsx("h3", { className: "text-foreground text-lg font-semibold", children: loc.name }),
56
+ ((_a = loc.location) == null ? void 0 : _a.address) && /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground flex items-start gap-2 text-sm", children: [
57
+ /* @__PURE__ */ jsxs(
58
+ "svg",
59
+ {
60
+ className: "text-primary mt-0.5 shrink-0",
61
+ width: "14",
62
+ height: "14",
63
+ viewBox: "0 0 24 24",
64
+ fill: "none",
65
+ stroke: "currentColor",
66
+ strokeWidth: "2",
67
+ strokeLinecap: "round",
68
+ strokeLinejoin: "round",
69
+ children: [
70
+ /* @__PURE__ */ jsx("path", { d: "M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z" }),
71
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "10", r: "3" })
72
+ ]
73
+ }
74
+ ),
75
+ /* @__PURE__ */ jsx("span", { className: "whitespace-pre-line", children: loc.location.address })
76
+ ] }),
77
+ loc.phone && /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground flex items-center gap-2 text-sm", children: [
78
+ /* @__PURE__ */ jsx(
79
+ "svg",
80
+ {
81
+ className: "text-primary shrink-0",
82
+ width: "14",
83
+ height: "14",
84
+ viewBox: "0 0 24 24",
85
+ fill: "none",
86
+ stroke: "currentColor",
87
+ strokeWidth: "2",
88
+ strokeLinecap: "round",
89
+ strokeLinejoin: "round",
90
+ children: /* @__PURE__ */ jsx("path", { d: "M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07A19.5 19.5 0 0 1 4.69 14a19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 3.62 3h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L8.09 10.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 22 17.92Z" })
91
+ }
92
+ ),
93
+ /* @__PURE__ */ jsx("span", { children: loc.phone })
94
+ ] }),
95
+ loc.hours && /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground flex items-start gap-2 text-sm", children: [
96
+ /* @__PURE__ */ jsxs(
97
+ "svg",
98
+ {
99
+ className: "text-primary mt-0.5 shrink-0",
100
+ width: "14",
101
+ height: "14",
102
+ viewBox: "0 0 24 24",
103
+ fill: "none",
104
+ stroke: "currentColor",
105
+ strokeWidth: "2",
106
+ strokeLinecap: "round",
107
+ strokeLinejoin: "round",
108
+ children: [
109
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
110
+ /* @__PURE__ */ jsx("polyline", { points: "12 6 12 12 16 14" })
111
+ ]
112
+ }
113
+ ),
114
+ /* @__PURE__ */ jsx("span", { className: "whitespace-pre-line", children: loc.hours })
115
+ ] }),
116
+ (loc.directionsAction || loc.location && loc.location.lat !== 0) && /* @__PURE__ */ jsx("div", { className: "mt-auto pt-2", children: /* @__PURE__ */ jsx(
117
+ CompoundButton,
89
118
  {
90
- className: "text-primary mt-0.5 shrink-0",
91
- width: "14",
92
- height: "14",
93
- viewBox: "0 0 24 24",
94
- fill: "none",
95
- stroke: "currentColor",
96
- strokeWidth: "2",
97
- strokeLinecap: "round",
98
- strokeLinejoin: "round",
99
- children: [
100
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
101
- /* @__PURE__ */ jsx("polyline", { points: "12 6 12 12 16 14" })
102
- ]
119
+ label: loc.directionsLabel || "Get Directions",
120
+ action: loc.directionsAction ?? (loc.location ? {
121
+ type: "external",
122
+ externalUrl: getDirectionsUrl(loc.location)
123
+ } : void 0),
124
+ variant: "outline",
125
+ size: "sm",
126
+ icon: "map-pin"
103
127
  }
104
- ),
105
- /* @__PURE__ */ jsx("span", { className: "whitespace-pre-line", children: loc.hours })
106
- ] }),
107
- (loc.directionsAction || loc.directionsUrl) && /* @__PURE__ */ jsx("div", { className: "mt-auto pt-2", children: /* @__PURE__ */ jsx(
108
- CompoundButton,
109
- {
110
- label: loc.directionsLabel || "Get Directions",
111
- action: loc.directionsAction ?? (loc.directionsUrl ? {
112
- type: "external",
113
- externalUrl: loc.directionsUrl
114
- } : void 0),
115
- variant: "outline",
116
- size: "sm",
117
- icon: "map-pin"
118
- }
119
- ) })
120
- ]
121
- },
122
- i
123
- )) })
128
+ ) })
129
+ ]
130
+ },
131
+ i
132
+ );
133
+ }) })
124
134
  ] })
125
135
  }
126
136
  );
@@ -1,3 +1,4 @@
1
+ import type { MapLocation } from "@/components/puck-base/core/fields";
1
2
  type LocationVariant = "location-1" | "location-2" | "location-3";
2
3
  type LocationPadding = {
3
4
  top?: "none" | "small" | "medium" | "large";
@@ -13,22 +14,19 @@ type LocationButton = {
13
14
  };
14
15
  type LocationItem = {
15
16
  name: string;
16
- address?: string;
17
+ location?: MapLocation;
17
18
  phone?: string;
18
19
  hours?: string;
19
- directionsUrl?: string;
20
20
  };
21
- type LocationSectionProps = {
21
+ export type LocationSectionProps = {
22
22
  variant?: LocationVariant;
23
23
  heading?: string;
24
24
  description?: string;
25
- address?: string;
26
- mapEmbedUrl?: string;
27
- mapTitle?: string;
28
- mapFilter?: string;
29
- mapTintMode?: "none" | "theme" | "custom";
30
- mapTintColor?: string;
31
- mapTintOpacity?: number;
25
+ displayAddress?: string;
26
+ location?: MapLocation;
27
+ mapLocation?: MapLocation;
28
+ mapStyle?: "default" | "grayscale" | "dark";
29
+ mapTint?: "none" | "theme";
32
30
  buttons?: LocationButton[];
33
31
  locations?: LocationItem[];
34
32
  contentPosition?: "left" | "right";
@@ -43,3 +41,4 @@ type LocationSectionProps = {
43
41
  sectionHeight?: "sm" | "md" | "lg";
44
42
  };
45
43
  };
44
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dune-react",
3
- "version": "0.0.16",
3
+ "version": "0.0.19",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -16,7 +16,8 @@
16
16
  "build-storybook": "storybook build && cp -r skills storybook-static/skills",
17
17
  "deploy-storybook": "storybook-to-ghpages -- --existing-output-dir=storybook-static",
18
18
  "ondeploy": "pnpm build-storybook && pnpm deploy-storybook",
19
- "postpublish": "bash scripts/postpublish.sh"
19
+ "sync:downstream": "bash scripts/postpublish.sh",
20
+ "upload:previews": "tsx scripts/upload-previews-r2.ts"
20
21
  },
21
22
  "sideEffects": [
22
23
  "*.css"