dune-react 0.0.10 → 0.0.12

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 (120) hide show
  1. package/dist/components/puck-base/article-card.js +1 -1
  2. package/dist/components/puck-base/button.d.ts +0 -1
  3. package/dist/components/puck-base/button.js +3 -3
  4. package/dist/components/puck-base/card.js +0 -1
  5. package/dist/components/puck-base/content.js +0 -1
  6. package/dist/components/puck-base/core/fields.d.ts +26 -119
  7. package/dist/components/puck-base/core/fields.js +10 -17
  8. package/dist/components/puck-base/core/icon-catalog.d.ts +14 -0
  9. package/dist/components/puck-base/core/icon-catalog.js +193 -0
  10. package/dist/components/puck-base/core/styles.d.ts +102 -33
  11. package/dist/components/puck-base/core/styles.js +45 -81
  12. package/dist/components/puck-base/core/with-editable.d.ts +4 -9
  13. package/dist/components/puck-base/core/with-editable.js +43 -62
  14. package/dist/components/puck-base/fields/action-field.d.ts +30 -0
  15. package/dist/components/puck-base/fields/action-field.js +289 -0
  16. package/dist/components/puck-base/fields/auto-field.d.ts +0 -1
  17. package/dist/components/puck-base/fields/auto-field.js +2 -90
  18. package/dist/components/puck-base/form.js +0 -1
  19. package/dist/components/puck-base/gradient-text.js +1 -1
  20. package/dist/components/puck-base/icon-picker-field.d.ts +8 -0
  21. package/dist/components/puck-base/icon-picker-field.js +153 -0
  22. package/dist/components/puck-base/index.d.ts +1 -1
  23. package/dist/components/puck-base/navigation-menu.d.ts +18 -0
  24. package/dist/components/puck-base/navigation-menu.js +202 -0
  25. package/dist/components/puck-block/banner-sections/announcement-banner-1/index.js +1 -1
  26. package/dist/components/puck-block/banner-sections/marquee-1/index.js +6 -4
  27. package/dist/components/puck-block/contact-sections/contact-us-1/index.js +18 -8
  28. package/dist/components/puck-block/contact-sections/contact-us-2/contact-us-2.js +1 -1
  29. package/dist/components/puck-block/contact-sections/contact-us-2/index.js +7 -7
  30. package/dist/components/puck-block/contact-sections/contact-us-3/index.js +2 -2
  31. package/dist/components/puck-block/cta-sections/banner-cta-1/banner-cta.d.ts +2 -1
  32. package/dist/components/puck-block/cta-sections/banner-cta-1/banner-cta.js +6 -5
  33. package/dist/components/puck-block/cta-sections/banner-cta-1/index.js +4 -4
  34. package/dist/components/puck-block/cta-sections/cta-1/index.js +9 -9
  35. package/dist/components/puck-block/cta-sections/gradient-cta-1/gradient-cta.js +34 -12
  36. package/dist/components/puck-block/cta-sections/gradient-cta-1/index.js +3 -3
  37. package/dist/components/puck-block/cta-sections/newsletter-signup-1/index.js +1 -1
  38. package/dist/components/puck-block/cta-sections/promo-section-1/index.js +5 -6
  39. package/dist/components/puck-block/cta-sections/promo-section-1/promo-section.js +2 -2
  40. package/dist/components/puck-block/faq-sections/accordion-1/accordion.js +8 -3
  41. package/dist/components/puck-block/faq-sections/accordion-1/index.js +7 -3
  42. package/dist/components/puck-block/faq-sections/faq-1/index.js +16 -4
  43. package/dist/components/puck-block/faq-sections/faq-2/index.js +11 -11
  44. package/dist/components/puck-block/feature-sections/bento-1/bento.js +16 -7
  45. package/dist/components/puck-block/feature-sections/bento-1/index.js +19 -6
  46. package/dist/components/puck-block/feature-sections/feature-cards-1/index.js +11 -12
  47. package/dist/components/puck-block/feature-sections/feature-showcase-1/index.js +10 -10
  48. package/dist/components/puck-block/feature-sections/icon-grid-1/icon-grid.js +1 -1
  49. package/dist/components/puck-block/feature-sections/icon-grid-1/index.js +13 -18
  50. package/dist/components/puck-block/feature-sections/product-features-1/index.js +18 -23
  51. package/dist/components/puck-block/footer-sections/footer-1/index.js +17 -22
  52. package/dist/components/puck-block/gallery-sections/gallery-1/index.js +12 -8
  53. package/dist/components/puck-block/gallery-sections/gallery-2/gallery-2.js +14 -6
  54. package/dist/components/puck-block/gallery-sections/gallery-2/index.js +10 -9
  55. package/dist/components/puck-block/gallery-sections/gallery-3/index.js +17 -14
  56. package/dist/components/puck-block/header-sections/header-1/header.d.ts +4 -1
  57. package/dist/components/puck-block/header-sections/header-1/header.js +26 -19
  58. package/dist/components/puck-block/header-sections/header-1/index.js +61 -50
  59. package/dist/components/puck-block/header-sections/sticky-nav-1/index.js +4 -3
  60. package/dist/components/puck-block/hero-sections/fullscreen-hero-1/fullscreen-hero.js +15 -2
  61. package/dist/components/puck-block/hero-sections/fullscreen-hero-1/index.js +4 -4
  62. package/dist/components/puck-block/hero-sections/gradient-hero-1/gradient-hero.js +2 -2
  63. package/dist/components/puck-block/hero-sections/gradient-hero-1/index.js +5 -4
  64. package/dist/components/puck-block/hero-sections/grid-hero-1/grid-hero.js +1 -1
  65. package/dist/components/puck-block/hero-sections/grid-hero-1/index.js +8 -8
  66. package/dist/components/puck-block/hero-sections/hero-1/hero.js +1 -1
  67. package/dist/components/puck-block/hero-sections/hero-1/index.js +16 -12
  68. package/dist/components/puck-block/hero-sections/image-hero-1/image-hero.d.ts +0 -1
  69. package/dist/components/puck-block/hero-sections/image-hero-1/image-hero.js +1 -1
  70. package/dist/components/puck-block/hero-sections/image-hero-1/index.js +23 -6
  71. package/dist/components/puck-block/hero-sections/split-hero-1/index.js +7 -7
  72. package/dist/components/puck-block/hero-sections/video-hero-1/index.js +5 -5
  73. package/dist/components/puck-block/hero-sections/video-hero-1/video-hero.js +1 -1
  74. package/dist/components/puck-block/location-sections/location-1/index.js +4 -7
  75. package/dist/components/puck-block/location-sections/location-1/location.d.ts +1 -0
  76. package/dist/components/puck-block/location-sections/location-1/location.js +2 -3
  77. package/dist/components/puck-block/location-sections/location-2/index.js +4 -7
  78. package/dist/components/puck-block/location-sections/location-2/location.d.ts +1 -0
  79. package/dist/components/puck-block/location-sections/location-2/location.js +2 -3
  80. package/dist/components/puck-block/location-sections/location-3/index.js +15 -14
  81. package/dist/components/puck-block/location-sections/location-3/location.d.ts +3 -0
  82. package/dist/components/puck-block/location-sections/location-3/location.js +7 -4
  83. package/dist/components/puck-block/metrics-sections/stats-1/index.js +13 -13
  84. package/dist/components/puck-block/metrics-sections/stats-2/index.js +8 -10
  85. package/dist/components/puck-block/metrics-sections/stats-2/stats-2.js +0 -1
  86. package/dist/components/puck-block/metrics-sections/stats-3/index.js +13 -15
  87. package/dist/components/puck-block/metrics-sections/stats-3/stats-3.js +14 -1
  88. package/dist/components/puck-block/pricing-sections/comparison-1/index.js +2 -2
  89. package/dist/components/puck-block/pricing-sections/pricing-1/index.js +39 -21
  90. package/dist/components/puck-block/pricing-sections/pricing-2/index.js +30 -34
  91. package/dist/components/puck-block/showcase-sections/before-after-1/index.js +12 -13
  92. package/dist/components/puck-block/showcase-sections/case-study-1/case-study.js +1 -1
  93. package/dist/components/puck-block/showcase-sections/case-study-1/index.js +8 -8
  94. package/dist/components/puck-block/showcase-sections/step-by-step-1/index.js +8 -8
  95. package/dist/components/puck-block/team-sections/team-grid-1/index.js +9 -9
  96. package/dist/components/puck-block/team-sections/team-grid-2/index.js +12 -14
  97. package/dist/components/puck-block/team-sections/team-profiles-1/index.js +11 -9
  98. package/dist/components/puck-block/testimonial-sections/customers-1/index.js +18 -7
  99. package/dist/components/puck-block/testimonial-sections/logo-marquee-1/index.js +2 -2
  100. package/dist/components/puck-block/testimonial-sections/logo-marquee-1/logo-marquee.js +1 -1
  101. package/dist/components/puck-block/testimonial-sections/logo-wall-1/index.js +7 -7
  102. package/dist/components/puck-block/testimonial-sections/review-section-1/index.js +27 -12
  103. package/dist/components/puck-block/testimonial-sections/testimonials-1/index.js +17 -7
  104. package/dist/components/puck-block/testimonial-sections/testimonials-1/testimonials.js +30 -10
  105. package/dist/components/puck-block/text-sections/articles-1/articles.js +1 -1
  106. package/dist/components/puck-block/text-sections/articles-1/index.js +12 -8
  107. package/dist/components/puck-block/text-sections/content-section-1/content-section.js +0 -1
  108. package/dist/components/puck-block/text-sections/content-section-1/index.js +6 -8
  109. package/dist/components/puck-block/text-sections/rich-text-1/index.js +1 -1
  110. package/dist/components/puck-block/text-sections/rich-text-1/rich-text.js +6 -1
  111. package/dist/components/puck-block/text-sections/tab-section-1/index.js +12 -12
  112. package/dist/components/puck-block/text-sections/tab-section-1/tab-section.js +7 -3
  113. package/dist/components/puck-block/text-sections/timeline-1/index.js +17 -7
  114. package/dist/components/puck-block/text-sections/two-column-1/index.js +10 -10
  115. package/dist/components/shadcn/navigation-menu.js +8 -33
  116. package/dist/index.js +9 -1
  117. package/dist/node_modules/.pnpm/lucide-react@0.540.0_react@19.2.4/node_modules/lucide-react/dist/esm/DynamicIcon.js +1 -3
  118. package/package.json +3 -2
  119. package/dist/components/puck-base/action-field.d.ts +0 -8
  120. package/dist/components/puck-base/action-field.js +0 -170
@@ -0,0 +1,289 @@
1
+ "use client";
2
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
3
+ import { memo, useCallback } from "react";
4
+ import { Input } from "../../shadcn/input.js";
5
+ import { Button } from "../../shadcn/button.js";
6
+ import { Label } from "../../shadcn/label.js";
7
+ import { Tabs, TabsList, TabsTrigger } from "../../shadcn/tabs.js";
8
+ import { LinkIcon, XIcon, ClipboardIcon, GlobeIcon } from "lucide-react";
9
+ import { useEditorContext } from "../editor-context.js";
10
+ const ACTION_TYPE_OPTIONS = [
11
+ { label: "Page Link", value: "page" },
12
+ { label: "External Link", value: "external" },
13
+ { label: "Email", value: "email" },
14
+ { label: "Phone", value: "phone" },
15
+ { label: "Page Section", value: "section" },
16
+ { label: "Download", value: "download" },
17
+ { label: "None", value: "none" }
18
+ ];
19
+ const PageActionFields = memo(function PageActionFields2({
20
+ name,
21
+ value,
22
+ onChange
23
+ }) {
24
+ const { sitePages } = useEditorContext();
25
+ const pages = sitePages ?? [];
26
+ const pageUrl = value.pageUrl ?? "";
27
+ const selectedSlug = pageUrl.startsWith("/") ? pageUrl.slice(1) : null;
28
+ const handlePaste = useCallback(async () => {
29
+ try {
30
+ const text = await navigator.clipboard.readText();
31
+ if (text) onChange({ pageUrl: text.trim() });
32
+ } catch {
33
+ }
34
+ }, [onChange]);
35
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
36
+ /* @__PURE__ */ jsx(Label, { children: "Page URL" }),
37
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
38
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-2 rounded-lg border px-3 py-2", children: [
39
+ /* @__PURE__ */ jsx(LinkIcon, { className: "text-muted-foreground size-4 shrink-0" }),
40
+ /* @__PURE__ */ jsx(
41
+ "input",
42
+ {
43
+ name: `${name}.pageUrl`,
44
+ className: "w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",
45
+ placeholder: "/about",
46
+ value: pageUrl,
47
+ onChange: (e) => onChange({ pageUrl: e.target.value })
48
+ }
49
+ ),
50
+ pageUrl && /* @__PURE__ */ jsx(
51
+ "button",
52
+ {
53
+ type: "button",
54
+ className: "text-muted-foreground hover:text-foreground shrink-0",
55
+ onClick: () => onChange({ pageUrl: "" }),
56
+ children: /* @__PURE__ */ jsx(XIcon, { className: "size-3.5" })
57
+ }
58
+ )
59
+ ] }),
60
+ /* @__PURE__ */ jsxs(
61
+ Button,
62
+ {
63
+ type: "button",
64
+ variant: "outline",
65
+ size: "sm",
66
+ className: "shrink-0 gap-1.5",
67
+ onClick: handlePaste,
68
+ children: [
69
+ /* @__PURE__ */ jsx(ClipboardIcon, { className: "size-3.5" }),
70
+ "Paste"
71
+ ]
72
+ }
73
+ )
74
+ ] }),
75
+ pages.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
76
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs font-medium", children: "Site pages" }),
77
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: pages.map((page) => {
78
+ const isSelected = selectedSlug === page.slug;
79
+ return /* @__PURE__ */ jsxs(
80
+ "button",
81
+ {
82
+ type: "button",
83
+ className: `inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-colors ${isSelected ? "border-primary bg-primary text-primary-foreground" : "border-border bg-background text-foreground hover:bg-accent"}`,
84
+ onClick: () => onChange({ pageUrl: isSelected ? "" : `${page.slug}` }),
85
+ children: [
86
+ /* @__PURE__ */ jsx(GlobeIcon, { className: "size-3" }),
87
+ page.label
88
+ ]
89
+ },
90
+ page.slug
91
+ );
92
+ }) })
93
+ ] })
94
+ ] });
95
+ });
96
+ const ExternalActionFields = memo(function ExternalActionFields2({
97
+ name,
98
+ value,
99
+ onChange
100
+ }) {
101
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
102
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
103
+ /* @__PURE__ */ jsx(Label, { children: "External URL" }),
104
+ /* @__PURE__ */ jsx(
105
+ Input,
106
+ {
107
+ name: `${name}.externalUrl`,
108
+ className: "h-8 text-sm",
109
+ value: value.externalUrl ?? "",
110
+ onChange: (e) => onChange({ externalUrl: e.target.value }),
111
+ placeholder: "https://example.com"
112
+ }
113
+ )
114
+ ] }),
115
+ /* @__PURE__ */ jsxs("fieldset", { className: "flex flex-col gap-1.5", children: [
116
+ /* @__PURE__ */ jsx(Label, { children: "Open in new tab" }),
117
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
118
+ /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-1.5 text-sm", children: [
119
+ /* @__PURE__ */ jsx(
120
+ "input",
121
+ {
122
+ type: "radio",
123
+ name: `${name}.openInNewTab`,
124
+ value: "true",
125
+ checked: value.openInNewTab === "true",
126
+ onChange: () => onChange({ openInNewTab: "true" })
127
+ }
128
+ ),
129
+ "Yes"
130
+ ] }),
131
+ /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-1.5 text-sm", children: [
132
+ /* @__PURE__ */ jsx(
133
+ "input",
134
+ {
135
+ type: "radio",
136
+ name: `${name}.openInNewTab`,
137
+ value: "false",
138
+ checked: value.openInNewTab !== "true",
139
+ onChange: () => onChange({ openInNewTab: "false" })
140
+ }
141
+ ),
142
+ "No"
143
+ ] })
144
+ ] })
145
+ ] })
146
+ ] });
147
+ });
148
+ const EmailActionFields = memo(function EmailActionFields2({
149
+ name,
150
+ value,
151
+ onChange
152
+ }) {
153
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
154
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
155
+ /* @__PURE__ */ jsx(Label, { children: "Email" }),
156
+ /* @__PURE__ */ jsx(
157
+ Input,
158
+ {
159
+ name: `${name}.email`,
160
+ className: "h-8 text-sm",
161
+ value: value.email ?? "",
162
+ onChange: (e) => onChange({ email: e.target.value }),
163
+ placeholder: "hello@example.com"
164
+ }
165
+ )
166
+ ] }),
167
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
168
+ /* @__PURE__ */ jsx(Label, { children: "Subject" }),
169
+ /* @__PURE__ */ jsx(
170
+ Input,
171
+ {
172
+ name: `${name}.subject`,
173
+ className: "h-8 text-sm",
174
+ value: value.subject ?? "",
175
+ onChange: (e) => onChange({ subject: e.target.value }),
176
+ placeholder: "Optional email subject"
177
+ }
178
+ )
179
+ ] })
180
+ ] });
181
+ });
182
+ const PhoneActionFields = memo(function PhoneActionFields2({
183
+ name,
184
+ value,
185
+ onChange
186
+ }) {
187
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
188
+ /* @__PURE__ */ jsx(Label, { children: "Phone" }),
189
+ /* @__PURE__ */ jsx(
190
+ Input,
191
+ {
192
+ name: `${name}.phone`,
193
+ className: "h-8 text-sm",
194
+ value: value.phone ?? "",
195
+ onChange: (e) => onChange({ phone: e.target.value }),
196
+ placeholder: "+1 234 567 890"
197
+ }
198
+ )
199
+ ] });
200
+ });
201
+ const SectionActionFields = memo(function SectionActionFields2({
202
+ name,
203
+ value,
204
+ onChange
205
+ }) {
206
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
207
+ /* @__PURE__ */ jsx(Label, { children: "Section ID" }),
208
+ /* @__PURE__ */ jsx(
209
+ Input,
210
+ {
211
+ name: `${name}.sectionId`,
212
+ className: "h-8 text-sm",
213
+ value: value.sectionId ?? "",
214
+ onChange: (e) => onChange({ sectionId: e.target.value }),
215
+ placeholder: "#section-id"
216
+ }
217
+ )
218
+ ] });
219
+ });
220
+ const DownloadActionFields = memo(function DownloadActionFields2({
221
+ name,
222
+ value,
223
+ onChange
224
+ }) {
225
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
226
+ /* @__PURE__ */ jsx(Label, { children: "Download URL" }),
227
+ /* @__PURE__ */ jsx(
228
+ Input,
229
+ {
230
+ name: `${name}.downloadUrl`,
231
+ className: "h-8 text-sm",
232
+ value: value.downloadUrl ?? "",
233
+ onChange: (e) => onChange({ downloadUrl: e.target.value }),
234
+ placeholder: "https://example.com/file.pdf"
235
+ }
236
+ )
237
+ ] });
238
+ });
239
+ const ACTION_TYPE_FIELD_MAP = {
240
+ page: PageActionFields,
241
+ external: ExternalActionFields,
242
+ email: EmailActionFields,
243
+ phone: PhoneActionFields,
244
+ section: SectionActionFields,
245
+ download: DownloadActionFields
246
+ };
247
+ function ActionField({ name, value, onChange }) {
248
+ const current = value ?? { type: "none" };
249
+ const update = useCallback(
250
+ (patch) => {
251
+ onChange({ ...current, ...patch });
252
+ },
253
+ [current, onChange]
254
+ );
255
+ const TypeFields = ACTION_TYPE_FIELD_MAP[current.type];
256
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
257
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
258
+ /* @__PURE__ */ jsx(Label, { children: "Action Type" }),
259
+ /* @__PURE__ */ jsx(
260
+ Tabs,
261
+ {
262
+ value: current.type,
263
+ onValueChange: (val) => update({ type: val }),
264
+ children: /* @__PURE__ */ jsx(TabsList, { className: "h-auto w-full flex-wrap justify-start gap-1 p-1 group-data-[orientation=horizontal]/tabs:h-auto", children: ACTION_TYPE_OPTIONS.map((opt) => /* @__PURE__ */ jsx(
265
+ TabsTrigger,
266
+ {
267
+ value: opt.value,
268
+ className: "h-7 flex-none text-xs",
269
+ children: opt.label
270
+ },
271
+ opt.value
272
+ )) })
273
+ }
274
+ )
275
+ ] }),
276
+ TypeFields && /* @__PURE__ */ jsx(TypeFields, { name, value: current, onChange: update })
277
+ ] });
278
+ }
279
+ export {
280
+ ACTION_TYPE_FIELD_MAP,
281
+ ACTION_TYPE_OPTIONS,
282
+ ActionField,
283
+ DownloadActionFields,
284
+ EmailActionFields,
285
+ ExternalActionFields,
286
+ PageActionFields,
287
+ PhoneActionFields,
288
+ SectionActionFields
289
+ };
@@ -1,3 +1,2 @@
1
1
  import type { AutoFieldProps } from "./types";
2
- /** 按 field.type 分发控件;名为 url 且类型为 text 时固定使用 UrlField(链接 + 站内路由) */
3
2
  export declare const AutoField: import("react").NamedExoticComponent<AutoFieldProps>;
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { memo, useCallback, useState, useRef, useMemo, useEffect } from "react";
2
+ import { memo, useState, useRef, useMemo, useCallback, useEffect } from "react";
3
3
  import { Input } from "../../shadcn/input.js";
4
4
  import { Textarea } from "../../shadcn/textarea.js";
5
5
  import { Label } from "../../shadcn/label.js";
@@ -8,8 +8,7 @@ import { Button } from "../../shadcn/button.js";
8
8
  import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from "../../shadcn/select.js";
9
9
  import { Popover, PopoverTrigger, PopoverContent } from "../../shadcn/popover.js";
10
10
  import { ToggleGroup, ToggleGroupItem } from "../../shadcn/toggle-group.js";
11
- import { LinkIcon, XIcon, ClipboardIcon, GlobeIcon, ChevronDownIcon, CheckIcon } from "lucide-react";
12
- import { useEditorContext } from "../editor-context.js";
11
+ import { ChevronDownIcon, CheckIcon } from "lucide-react";
13
12
  const LARGE_SELECT_THRESHOLD = 200;
14
13
  const VIRTUAL_ITEM_HEIGHT = 32;
15
14
  const VIRTUAL_VIEWPORT_HEIGHT = 256;
@@ -213,81 +212,6 @@ const VirtualizedSelectField = memo(function VirtualizedSelectField2({
213
212
  ] })
214
213
  ] });
215
214
  });
216
- const UrlField = memo(function UrlField2({
217
- label,
218
- value,
219
- onChange,
220
- sitePages
221
- }) {
222
- const currentValue = value ?? "";
223
- const selectedSlug = currentValue.startsWith("/") ? currentValue.slice(1) : null;
224
- const handlePaste = useCallback(async () => {
225
- try {
226
- const text = await navigator.clipboard.readText();
227
- if (text) onChange(text.trim());
228
- } catch {
229
- }
230
- }, [onChange]);
231
- return /* @__PURE__ */ jsxs("div", { className: "mb-4 space-y-3", children: [
232
- /* @__PURE__ */ jsx(Label, { children: label }),
233
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
234
- /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-2 rounded-lg border px-3 py-2", children: [
235
- /* @__PURE__ */ jsx(LinkIcon, { className: "text-muted-foreground size-4 shrink-0" }),
236
- /* @__PURE__ */ jsx(
237
- "input",
238
- {
239
- className: "w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",
240
- placeholder: "https:// or /page-slug",
241
- value: currentValue,
242
- onChange: (e) => onChange(e.target.value)
243
- }
244
- ),
245
- currentValue && /* @__PURE__ */ jsx(
246
- "button",
247
- {
248
- type: "button",
249
- className: "text-muted-foreground hover:text-foreground shrink-0",
250
- onClick: () => onChange(""),
251
- children: /* @__PURE__ */ jsx(XIcon, { className: "size-3.5" })
252
- }
253
- )
254
- ] }),
255
- /* @__PURE__ */ jsxs(
256
- Button,
257
- {
258
- type: "button",
259
- variant: "outline",
260
- size: "sm",
261
- className: "shrink-0 gap-1.5",
262
- onClick: handlePaste,
263
- children: [
264
- /* @__PURE__ */ jsx(ClipboardIcon, { className: "size-3.5" }),
265
- "Paste"
266
- ]
267
- }
268
- )
269
- ] }),
270
- sitePages.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
271
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs font-medium", children: "Site pages" }),
272
- /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: sitePages.map((page) => {
273
- const isSelected = selectedSlug === page.slug;
274
- return /* @__PURE__ */ jsxs(
275
- "button",
276
- {
277
- type: "button",
278
- className: `inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-colors ${isSelected ? "border-primary bg-primary text-primary-foreground" : "border-border bg-background text-foreground hover:bg-accent"}`,
279
- onClick: () => onChange(isSelected ? "" : `${page.slug}`),
280
- children: [
281
- /* @__PURE__ */ jsx(GlobeIcon, { className: "size-3" }),
282
- page.label
283
- ]
284
- },
285
- page.slug
286
- );
287
- }) })
288
- ] })
289
- ] });
290
- });
291
215
  const AutoField = memo(function AutoField2({
292
216
  field,
293
217
  name,
@@ -296,18 +220,6 @@ const AutoField = memo(function AutoField2({
296
220
  }) {
297
221
  var _a, _b;
298
222
  const label = field.label || name;
299
- const { sitePages } = useEditorContext();
300
- if (name === "url" && field.type === "text") {
301
- return /* @__PURE__ */ jsx(
302
- UrlField,
303
- {
304
- label,
305
- value,
306
- onChange,
307
- sitePages: sitePages ?? []
308
- }
309
- );
310
- }
311
223
  switch (field.type) {
312
224
  case "text":
313
225
  return /* @__PURE__ */ jsxs("div", { className: "mb-4 space-y-1.5", children: [
@@ -19,7 +19,6 @@ const CompoundForm = (props) => {
19
19
  CompoundButton,
20
20
  {
21
21
  label: props.button.label,
22
- url: props.button.url,
23
22
  variant: props.button.variant,
24
23
  size: props.button.size,
25
24
  icon: props.button.icon,
@@ -33,7 +33,7 @@ const GradientText = ({
33
33
  Tag,
34
34
  {
35
35
  className: cn(
36
- "bg-clip-text text-transparent",
36
+ "bg-clip-text text-transparent pb-2",
37
37
  TAG_STYLES[Tag],
38
38
  className
39
39
  ),
@@ -0,0 +1,8 @@
1
+ export declare function IconPickerField({ value, onChange, }: {
2
+ field: any;
3
+ name: string;
4
+ id: string;
5
+ value: any;
6
+ onChange: (value: any) => void;
7
+ readOnly?: boolean;
8
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,153 @@
1
+ "use client";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ import { useState, useMemo } from "react";
4
+ import { cn } from "../../utils/css-utils.js";
5
+ import { Popover, PopoverTrigger, PopoverContent } from "../shadcn/popover.js";
6
+ import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "../shadcn/command.js";
7
+ import { ScrollArea } from "../shadcn/scroll-area.js";
8
+ import { Input } from "../shadcn/input.js";
9
+ import { Label } from "../shadcn/label.js";
10
+ import { ICON_MAP, ICON_CATALOG } from "./core/icon-catalog.js";
11
+ import { ChevronDown } from "lucide-react";
12
+ function IconPickerField({
13
+ value,
14
+ onChange
15
+ }) {
16
+ const [open, setOpen] = useState(false);
17
+ const current = value ?? "none";
18
+ const [search, setSearch] = useState("");
19
+ const [manualInput, setManualInput] = useState("");
20
+ const CurrentIcon = ICON_MAP.get(current);
21
+ const filteredCatalog = useMemo(() => {
22
+ const q = search.trim().toLowerCase();
23
+ if (!q) return ICON_CATALOG;
24
+ return ICON_CATALOG.map((cat) => ({
25
+ ...cat,
26
+ icons: cat.icons.filter((e) => e.name.toLowerCase().includes(q))
27
+ })).filter((cat) => cat.icons.length > 0);
28
+ }, [search]);
29
+ const handleSelect = (name) => {
30
+ onChange(name);
31
+ setSearch("");
32
+ setOpen(false);
33
+ };
34
+ const handleManualSubmit = () => {
35
+ const v = manualInput.trim();
36
+ if (v) {
37
+ onChange(v);
38
+ setManualInput("");
39
+ setOpen(false);
40
+ }
41
+ };
42
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
43
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
44
+ "button",
45
+ {
46
+ type: "button",
47
+ className: cn(
48
+ "inline-flex h-8 w-full items-center gap-2 rounded-md border bg-background px-2.5 text-sm",
49
+ "text-foreground transition-colors hover:bg-accent/50",
50
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
51
+ ),
52
+ children: [
53
+ CurrentIcon ? /* @__PURE__ */ jsx(CurrentIcon, { className: "size-4 shrink-0 text-muted-foreground" }) : /* @__PURE__ */ jsx("span", { className: "size-4 shrink-0 rounded-sm border border-dashed" }),
54
+ /* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-left", children: current === "none" ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "None" }) : current }),
55
+ /* @__PURE__ */ jsx(ChevronDown, { className: "size-3.5 shrink-0 text-muted-foreground" })
56
+ ]
57
+ }
58
+ ) }),
59
+ /* @__PURE__ */ jsx(
60
+ PopoverContent,
61
+ {
62
+ className: "w-72 p-0",
63
+ align: "start",
64
+ side: "bottom",
65
+ sideOffset: 4,
66
+ children: /* @__PURE__ */ jsxs(Command, { shouldFilter: false, children: [
67
+ /* @__PURE__ */ jsx(
68
+ CommandInput,
69
+ {
70
+ placeholder: "Search icons...",
71
+ value: search,
72
+ onValueChange: setSearch
73
+ }
74
+ ),
75
+ /* @__PURE__ */ jsxs(CommandList, { className: "max-h-none overflow-visible", children: [
76
+ /* @__PURE__ */ jsx(CommandEmpty, { children: "No icons found." }),
77
+ /* @__PURE__ */ jsxs(ScrollArea, { className: "h-72", children: [
78
+ /* @__PURE__ */ jsx(CommandGroup, { children: /* @__PURE__ */ jsxs(
79
+ CommandItem,
80
+ {
81
+ value: "none",
82
+ onSelect: () => handleSelect("none"),
83
+ "data-checked": current === "none" ? "true" : void 0,
84
+ className: "gap-2",
85
+ children: [
86
+ /* @__PURE__ */ jsx("span", { className: "size-4 shrink-0 rounded-sm border border-dashed" }),
87
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "None" })
88
+ ]
89
+ }
90
+ ) }),
91
+ filteredCatalog.map((cat) => /* @__PURE__ */ jsx(CommandGroup, { heading: cat.label, children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-6 gap-0.5 px-1 py-0.5", children: cat.icons.map((entry) => {
92
+ const IconComp = entry.component;
93
+ const isSelected = current === entry.name;
94
+ return /* @__PURE__ */ jsx(
95
+ "button",
96
+ {
97
+ type: "button",
98
+ title: entry.name,
99
+ onClick: () => handleSelect(entry.name),
100
+ className: cn(
101
+ "flex size-8 items-center justify-center rounded-md transition-colors",
102
+ "hover:bg-accent hover:text-accent-foreground",
103
+ isSelected && "bg-primary text-primary-foreground hover:bg-primary/90"
104
+ ),
105
+ "aria-label": entry.name,
106
+ "aria-pressed": isSelected,
107
+ children: /* @__PURE__ */ jsx(IconComp, { className: "size-4" })
108
+ },
109
+ entry.name
110
+ );
111
+ }) }) }, cat.label))
112
+ ] }),
113
+ /* @__PURE__ */ jsxs("div", { className: "border-t p-2", children: [
114
+ /* @__PURE__ */ jsx(Label, { className: "mb-1 block text-xs text-muted-foreground", children: "Or type any Lucide icon name" }),
115
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-1.5", children: [
116
+ /* @__PURE__ */ jsx(
117
+ Input,
118
+ {
119
+ className: "h-7 flex-1 text-xs",
120
+ placeholder: "e.g. arrow-right",
121
+ value: manualInput,
122
+ onChange: (e) => setManualInput(e.target.value),
123
+ onKeyDown: (e) => {
124
+ if (e.key === "Enter") {
125
+ e.preventDefault();
126
+ handleManualSubmit();
127
+ }
128
+ }
129
+ }
130
+ ),
131
+ /* @__PURE__ */ jsx(
132
+ "button",
133
+ {
134
+ type: "button",
135
+ onClick: handleManualSubmit,
136
+ className: cn(
137
+ "inline-flex h-7 items-center rounded-md border bg-secondary px-2.5 text-xs font-medium",
138
+ "text-secondary-foreground transition-colors hover:bg-secondary/80"
139
+ ),
140
+ children: "Set"
141
+ }
142
+ )
143
+ ] })
144
+ ] })
145
+ ] })
146
+ ] })
147
+ }
148
+ )
149
+ ] });
150
+ }
151
+ export {
152
+ IconPickerField
153
+ };
@@ -8,7 +8,7 @@ export { CompoundForm, type CompoundFormProps, formMethods, type FormMethods } f
8
8
  export { CompoundImage, type CompoundImageProps } from "./image";
9
9
  export { CompoundArticleCard, type CompoundArticleCardProps } from "./article-card";
10
10
  export { ImageUploadField } from "./image-upload-field";
11
- export { ActionField } from "./action-field";
11
+ export { ActionField, ACTION_TYPE_FIELD_MAP, ACTION_TYPE_OPTIONS, PageActionFields, ExternalActionFields, EmailActionFields, PhoneActionFields, SectionActionFields, DownloadActionFields, type ActionTypeFieldProps, } from "./fields/action-field";
12
12
  export { ErrorBoundary } from "./error-boundary";
13
13
  export { GradientText, type GradientTextProps } from "./gradient-text";
14
14
  export { InlineEditable } from "./inline-editable";
@@ -0,0 +1,18 @@
1
+ import { NavigationMenu as NavigationMenuPrimitive } from "@base-ui/react/navigation-menu";
2
+ declare function NavigationMenu({ align, portalContainer, className, children, onValueChange, ...props }: NavigationMenuPrimitive.Root.Props & Pick<NavigationMenuPrimitive.Positioner.Props, "align"> & {
3
+ portalContainer?: HTMLElement | null | React.RefObject<HTMLElement | null>;
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ declare function NavigationMenuList({ className, ...props }: React.ComponentPropsWithRef<typeof NavigationMenuPrimitive.List>): import("react/jsx-runtime").JSX.Element;
6
+ declare function NavigationMenuItem({ className, ...props }: React.ComponentPropsWithRef<typeof NavigationMenuPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
7
+ declare const navigationMenuTriggerStyle: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
8
+ declare function NavigationMenuTrigger({ className, children, ...props }: NavigationMenuPrimitive.Trigger.Props): import("react/jsx-runtime").JSX.Element;
9
+ declare function NavigationMenuContent({ className, ...props }: NavigationMenuPrimitive.Content.Props): import("react/jsx-runtime").JSX.Element;
10
+ declare function NavigationMenuPositioner({ className, side, sideOffset, align, alignOffset, portalContainer, ...props }: NavigationMenuPrimitive.Positioner.Props & {
11
+ portalContainer?: HTMLElement | null | React.RefObject<HTMLElement | null>;
12
+ }): import("react/jsx-runtime").JSX.Element;
13
+ declare function NavigationMenuLink({ className, asChild, children, active, ...props }: NavigationMenuPrimitive.Link.Props & {
14
+ asChild?: boolean;
15
+ active?: boolean;
16
+ }): import("react/jsx-runtime").JSX.Element;
17
+ declare function NavigationMenuIndicator({ className, ...props }: React.ComponentPropsWithRef<typeof NavigationMenuPrimitive.Icon>): import("react/jsx-runtime").JSX.Element;
18
+ export { NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, navigationMenuTriggerStyle, NavigationMenuPositioner, };