dune-react 0.0.13 → 0.0.14

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.
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
3
3
  import { useState, useCallback } from "react";
4
+ import { SafeDynamicIcon } from "./safe-dynamic-icon.js";
4
5
  import { Button, buttonVariants } from "../shadcn/button.js";
5
6
  import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "../shadcn/dialog.js";
6
7
  import { AutoField } from "./fields/auto-field.js";
@@ -8,7 +9,6 @@ import { button } from "./core/fields.js";
8
9
  import { cn } from "../../utils/css-utils.js";
9
10
  import { resolveActionUrl } from "./core/types.js";
10
11
  import { withEditable } from "./core/with-editable.js";
11
- import DynamicIcon from "../../node_modules/.pnpm/lucide-react@0.540.0_react@19.2.4/node_modules/lucide-react/dist/esm/DynamicIcon.js";
12
12
  const BUTTON_FIELDS = button.objectFields;
13
13
  function ButtonEditDialog({
14
14
  open,
@@ -46,7 +46,7 @@ function CompoundButtonBase(props) {
46
46
  var _a, _b, _c;
47
47
  const content = /* @__PURE__ */ jsxs(Fragment, { children: [
48
48
  props.size !== "icon" && props.label,
49
- props.icon && props.icon !== "none" ? /* @__PURE__ */ jsx(DynamicIcon, { name: props.icon, className: "h-4 w-4" }) : null
49
+ props.icon && props.icon !== "none" ? /* @__PURE__ */ jsx(SafeDynamicIcon, { name: props.icon, className: "h-4 w-4" }) : null
50
50
  ] });
51
51
  const href = props.action ? resolveActionUrl(props.action) : void 0;
52
52
  const isDownload = ((_a = props.action) == null ? void 0 : _a.type) === "download";
@@ -1,8 +1,8 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { SafeDynamicIcon } from "./safe-dynamic-icon.js";
2
3
  import { cn } from "../../utils/css-utils.js";
3
4
  import { CompoundButton } from "./button.js";
4
5
  import { CompoundImage } from "./image.js";
5
- import DynamicIcon from "../../node_modules/.pnpm/lucide-react@0.540.0_react@19.2.4/node_modules/lucide-react/dist/esm/DynamicIcon.js";
6
6
  const CompoundCard = ({
7
7
  image,
8
8
  icon,
@@ -32,7 +32,7 @@ const CompoundCard = ({
32
32
  children: [
33
33
  hasImage ? /* @__PURE__ */ jsx("div", { className: "aspect-video overflow-hidden rounded-t-md", children: /* @__PURE__ */ jsx(CompoundImage, { src: image.src, alt: image.alt, className: "h-full" }) }) : null,
34
34
  hasIcon && !hasImage ? /* @__PURE__ */ jsx(
35
- DynamicIcon,
35
+ SafeDynamicIcon,
36
36
  {
37
37
  name: icon,
38
38
  className: cn("h-4 w-4", isLight && "text-gray-900")
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { cn } from "../../utils/css-utils.js";
3
3
  import { CompoundBadge } from "./badge.js";
4
4
  import { CompoundButton } from "./button.js";
5
- import DynamicIcon from "../../node_modules/.pnpm/lucide-react@0.540.0_react@19.2.4/node_modules/lucide-react/dist/esm/DynamicIcon.js";
5
+ import { SafeDynamicIcon } from "./safe-dynamic-icon.js";
6
6
  const CompoundContent = ({
7
7
  badge,
8
8
  heading,
@@ -83,7 +83,7 @@ const CompoundContent = ({
83
83
  ) : null,
84
84
  Array.isArray(features) && features.length > 0 ? features.map((feature, index) => /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-4", children: [
85
85
  feature.icon && feature.icon !== "none" ? /* @__PURE__ */ jsx(
86
- DynamicIcon,
86
+ SafeDynamicIcon,
87
87
  {
88
88
  name: feature.icon,
89
89
  className: "h-6 w-6 shrink-0"
@@ -0,0 +1,7 @@
1
+ import { DynamicIcon } from "lucide-react/dynamic";
2
+ import type { ComponentPropsWithoutRef } from "react";
3
+ type SafeDynamicIconProps = Omit<ComponentPropsWithoutRef<typeof DynamicIcon>, "name"> & {
4
+ name: string;
5
+ };
6
+ export declare function SafeDynamicIcon({ name, ...props }: SafeDynamicIconProps): import("react/jsx-runtime").JSX.Element | null;
7
+ export {};
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import dynamicIconImports from "../../node_modules/.pnpm/lucide-react@0.540.0_react@19.2.4/node_modules/lucide-react/dist/esm/dynamicIconImports.js";
4
+ import DynamicIcon from "../../node_modules/.pnpm/lucide-react@0.540.0_react@19.2.4/node_modules/lucide-react/dist/esm/DynamicIcon.js";
5
+ function SafeDynamicIcon({ name, ...props }) {
6
+ if (!name || name === "none" || !(name in dynamicIconImports)) {
7
+ return null;
8
+ }
9
+ return /* @__PURE__ */ jsx(DynamicIcon, { name, ...props });
10
+ }
11
+ export {
12
+ SafeDynamicIcon
13
+ };
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { CompoundContainer } from "../../../puck-base/container.js";
3
3
  import { CompoundImage } from "../../../puck-base/image.js";
4
4
  import { cn } from "../../../../utils/css-utils.js";
5
- import DynamicIcon from "../../../../node_modules/.pnpm/lucide-react@0.540.0_react@19.2.4/node_modules/lucide-react/dist/esm/DynamicIcon.js";
5
+ import { SafeDynamicIcon } from "../../../puck-base/safe-dynamic-icon.js";
6
6
  const GridLayout = ({
7
7
  features,
8
8
  columns,
@@ -18,7 +18,7 @@ const GridLayout = ({
18
18
  ),
19
19
  children: features.map((feature, index) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
20
20
  feature.icon && feature.icon !== "none" && /* @__PURE__ */ jsx("div", { className: "bg-primary/10 flex h-10 w-10 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx(
21
- DynamicIcon,
21
+ SafeDynamicIcon,
22
22
  {
23
23
  name: feature.icon,
24
24
  className: "text-primary h-5 w-5"
@@ -46,7 +46,7 @@ const AlternatingLayout = ({ features }) => /* @__PURE__ */ jsx("div", { classNa
46
46
  !isEven && "lg:order-2"
47
47
  ),
48
48
  children: ((_a = feature.image) == null ? void 0 : _a.src) ? /* @__PURE__ */ jsx(CompoundImage, { src: feature.image.src, alt: feature.image.alt || "", className: "w-full object-cover" }) : /* @__PURE__ */ jsx("div", { className: "flex aspect-video items-center justify-center", children: feature.icon && feature.icon !== "none" && /* @__PURE__ */ jsx(
49
- DynamicIcon,
49
+ SafeDynamicIcon,
50
50
  {
51
51
  name: feature.icon,
52
52
  className: "text-muted-foreground h-16 w-16"
@@ -56,7 +56,7 @@ const AlternatingLayout = ({ features }) => /* @__PURE__ */ jsx("div", { classNa
56
56
  ),
57
57
  /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-4", !isEven && "lg:order-1"), children: [
58
58
  feature.icon && feature.icon !== "none" && /* @__PURE__ */ jsx("div", { className: "bg-primary/10 flex h-10 w-10 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx(
59
- DynamicIcon,
59
+ SafeDynamicIcon,
60
60
  {
61
61
  name: feature.icon,
62
62
  className: "text-primary h-5 w-5"
@@ -80,7 +80,7 @@ const ListLayout = ({
80
80
  className: "border-border flex gap-4 border-b pb-8 last:border-b-0 last:pb-0",
81
81
  children: [
82
82
  feature.icon && feature.icon !== "none" && /* @__PURE__ */ jsx("div", { className: "bg-primary/10 flex h-10 w-10 shrink-0 items-center justify-center rounded-lg", children: /* @__PURE__ */ jsx(
83
- DynamicIcon,
83
+ SafeDynamicIcon,
84
84
  {
85
85
  name: feature.icon,
86
86
  className: "text-primary h-5 w-5"
@@ -94,11 +94,11 @@ const defaultActionItems = [
94
94
  },
95
95
  {
96
96
  label: "Get Started",
97
- url: "#",
97
+ url: "",
98
98
  action: {
99
- type: "external",
99
+ type: "email",
100
100
  pageUrl: "",
101
- externalUrl: "#",
101
+ externalUrl: "",
102
102
  openInNewTab: "false",
103
103
  email: "",
104
104
  subject: "",
@@ -3,7 +3,7 @@ import { Card, CardHeader, CardTitle, CardDescription, CardContent } from "../..
3
3
  import { CompoundButton } from "../../../puck-base/button.js";
4
4
  import { CompoundContainer } from "../../../puck-base/container.js";
5
5
  import { CompoundContent } from "../../../puck-base/content.js";
6
- import DynamicIcon from "../../../../node_modules/.pnpm/lucide-react@0.540.0_react@19.2.4/node_modules/lucide-react/dist/esm/DynamicIcon.js";
6
+ import { SafeDynamicIcon } from "../../../puck-base/safe-dynamic-icon.js";
7
7
  const Pricing = (props) => {
8
8
  var _a, _b, _c, _d;
9
9
  return /* @__PURE__ */ jsx(
@@ -40,7 +40,7 @@ const Pricing = (props) => {
40
40
  ] })
41
41
  ] }),
42
42
  /* @__PURE__ */ jsx("div", { className: "flex flex-col justify-start gap-4", children: (tier.features ?? []).map((feature, index2) => /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-4", children: [
43
- feature.icon && feature.icon !== "none" ? /* @__PURE__ */ jsx(DynamicIcon, { name: feature.icon }) : null,
43
+ feature.icon && feature.icon !== "none" ? /* @__PURE__ */ jsx(SafeDynamicIcon, { name: feature.icon }) : null,
44
44
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
45
45
  /* @__PURE__ */ jsx("p", { children: feature.name }),
46
46
  feature.description ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: feature.description }) : null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dune-react",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {