dune-react 0.0.11 → 0.0.13
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/components/puck-base/core/fields.d.ts +25 -96
- package/dist/components/puck-base/core/fields.js +4 -10
- package/dist/components/puck-base/core/icon-catalog.d.ts +14 -0
- package/dist/components/puck-base/core/icon-catalog.js +193 -0
- package/dist/components/puck-base/fields/action-field.d.ts +23 -1
- package/dist/components/puck-base/fields/action-field.js +174 -130
- package/dist/components/puck-base/gradient-text.js +1 -1
- package/dist/components/puck-base/icon-picker-field.d.ts +8 -0
- package/dist/components/puck-base/icon-picker-field.js +153 -0
- package/dist/components/puck-base/index.d.ts +1 -1
- package/dist/components/puck-block/banner-sections/announcement-banner-1/index.js +1 -1
- package/dist/components/puck-block/banner-sections/marquee-1/index.js +6 -4
- package/dist/components/puck-block/contact-sections/contact-us-1/index.js +18 -8
- package/dist/components/puck-block/contact-sections/contact-us-2/contact-us-2.js +1 -1
- package/dist/components/puck-block/contact-sections/contact-us-2/index.js +7 -7
- package/dist/components/puck-block/contact-sections/contact-us-3/index.js +2 -2
- package/dist/components/puck-block/cta-sections/banner-cta-1/index.js +4 -4
- package/dist/components/puck-block/cta-sections/cta-1/index.js +9 -9
- package/dist/components/puck-block/cta-sections/gradient-cta-1/index.js +3 -3
- package/dist/components/puck-block/cta-sections/newsletter-signup-1/index.js +1 -1
- package/dist/components/puck-block/cta-sections/promo-section-1/index.js +5 -5
- package/dist/components/puck-block/faq-sections/accordion-1/index.js +7 -3
- package/dist/components/puck-block/faq-sections/faq-1/index.js +16 -4
- package/dist/components/puck-block/faq-sections/faq-2/index.js +11 -11
- package/dist/components/puck-block/feature-sections/bento-1/bento.js +16 -7
- package/dist/components/puck-block/feature-sections/bento-1/index.js +19 -6
- package/dist/components/puck-block/feature-sections/feature-cards-1/index.js +11 -10
- package/dist/components/puck-block/feature-sections/feature-showcase-1/index.js +10 -10
- package/dist/components/puck-block/feature-sections/icon-grid-1/index.js +13 -18
- package/dist/components/puck-block/feature-sections/product-features-1/index.js +18 -23
- package/dist/components/puck-block/footer-sections/footer-1/index.js +17 -22
- package/dist/components/puck-block/gallery-sections/gallery-1/index.js +12 -8
- package/dist/components/puck-block/gallery-sections/gallery-2/index.js +10 -9
- package/dist/components/puck-block/gallery-sections/gallery-3/index.js +17 -14
- package/dist/components/puck-block/header-sections/header-1/index.js +56 -40
- package/dist/components/puck-block/header-sections/sticky-nav-1/index.js +4 -3
- package/dist/components/puck-block/hero-sections/fullscreen-hero-1/index.js +4 -3
- package/dist/components/puck-block/hero-sections/gradient-hero-1/index.js +4 -4
- package/dist/components/puck-block/hero-sections/hero-1/index.js +16 -12
- package/dist/components/puck-block/hero-sections/image-hero-1/index.js +2 -2
- package/dist/components/puck-block/hero-sections/props.d.ts +1 -12
- package/dist/components/puck-block/hero-sections/split-hero-1/index.js +7 -7
- package/dist/components/puck-block/hero-sections/video-hero-1/index.js +5 -5
- package/dist/components/puck-block/index.d.ts +0 -1
- package/dist/components/puck-block/location-sections/location-1/index.js +4 -4
- package/dist/components/puck-block/location-sections/location-1/location.js +1 -1
- package/dist/components/puck-block/location-sections/location-2/index.js +4 -4
- package/dist/components/puck-block/location-sections/location-2/location.js +1 -1
- package/dist/components/puck-block/location-sections/location-3/index.js +15 -14
- package/dist/components/puck-block/location-sections/location-3/location.d.ts +1 -0
- package/dist/components/puck-block/location-sections/location-3/location.js +2 -2
- package/dist/components/puck-block/metrics-sections/stats-1/index.js +13 -13
- package/dist/components/puck-block/metrics-sections/stats-2/index.js +8 -8
- package/dist/components/puck-block/metrics-sections/stats-3/index.js +13 -13
- package/dist/components/puck-block/pricing-sections/comparison-1/index.js +2 -2
- package/dist/components/puck-block/pricing-sections/pricing-1/index.js +39 -19
- package/dist/components/puck-block/pricing-sections/pricing-2/index.js +30 -30
- package/dist/components/puck-block/showcase-sections/before-after-1/index.js +12 -12
- package/dist/components/puck-block/showcase-sections/case-study-1/index.js +7 -7
- package/dist/components/puck-block/showcase-sections/step-by-step-1/index.js +8 -8
- package/dist/components/puck-block/team-sections/team-grid-1/index.js +9 -9
- package/dist/components/puck-block/team-sections/team-grid-2/index.js +12 -12
- package/dist/components/puck-block/team-sections/team-profiles-1/index.js +11 -9
- package/dist/components/puck-block/testimonial-sections/customers-1/index.js +18 -7
- package/dist/components/puck-block/testimonial-sections/logo-marquee-1/index.js +1 -1
- package/dist/components/puck-block/testimonial-sections/logo-wall-1/index.js +7 -7
- package/dist/components/puck-block/testimonial-sections/review-section-1/index.js +27 -12
- package/dist/components/puck-block/testimonial-sections/testimonials-1/index.js +17 -7
- package/dist/components/puck-block/text-sections/articles-1/articles.d.ts +3 -2
- package/dist/components/puck-block/text-sections/articles-1/articles.js +6 -4
- package/dist/components/puck-block/text-sections/articles-1/index.js +46 -18
- package/dist/components/puck-block/text-sections/content-section-1/index.js +6 -6
- package/dist/components/puck-block/text-sections/rich-text-1/index.js +1 -1
- package/dist/components/puck-block/text-sections/rich-text-1/rich-text.js +6 -1
- package/dist/components/puck-block/text-sections/tab-section-1/index.js +12 -12
- package/dist/components/puck-block/text-sections/timeline-1/index.js +17 -7
- package/dist/components/puck-block/text-sections/two-column-1/index.js +10 -10
- package/dist/index.js +69 -63
- package/dist/node_modules/.pnpm/lucide-react@0.540.0_react@19.2.4/node_modules/lucide-react/dist/esm/DynamicIcon.js +1 -3
- package/package.json +2 -1
- package/dist/components/puck-block/hero-sections/grid-hero-1/grid-hero.d.ts +0 -26
- package/dist/components/puck-block/hero-sections/grid-hero-1/grid-hero.js +0 -125
- package/dist/components/puck-block/hero-sections/grid-hero-1/index.d.ts +0 -5
- package/dist/components/puck-block/hero-sections/grid-hero-1/index.js +0 -71
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { fieldTypes } from "../field.js";
|
|
2
2
|
import { ActionField } from "../fields/action-field.js";
|
|
3
|
-
import {
|
|
3
|
+
import { IconPickerField } from "../icon-picker-field.js";
|
|
4
4
|
const formMethods = ["get", "post", "put", "patch", "delete"];
|
|
5
5
|
const icon = {
|
|
6
|
-
type: "
|
|
7
|
-
|
|
8
|
-
{ label: "none", value: "none" },
|
|
9
|
-
...iconNames.map((iconName) => ({
|
|
10
|
-
label: iconName,
|
|
11
|
-
value: iconName
|
|
12
|
-
}))
|
|
13
|
-
]
|
|
6
|
+
type: "custom",
|
|
7
|
+
render: IconPickerField
|
|
14
8
|
};
|
|
15
9
|
const action = {
|
|
16
10
|
type: "custom",
|
|
@@ -95,7 +89,7 @@ const image = {
|
|
|
95
89
|
type: "object",
|
|
96
90
|
objectFields: {
|
|
97
91
|
// "image" is a custom field type registered via Puck overrides (fieldTypes.image)
|
|
98
|
-
src: { type: "image", label: "
|
|
92
|
+
src: { type: "image", label: "Image" },
|
|
99
93
|
alt: { type: "text" }
|
|
100
94
|
}
|
|
101
95
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LucideIcon } from "lucide-react";
|
|
2
|
+
export interface IconEntry {
|
|
3
|
+
name: string;
|
|
4
|
+
component: LucideIcon;
|
|
5
|
+
}
|
|
6
|
+
export interface IconCategory {
|
|
7
|
+
label: string;
|
|
8
|
+
icons: IconEntry[];
|
|
9
|
+
}
|
|
10
|
+
export declare const ICON_CATALOG: IconCategory[];
|
|
11
|
+
/** Flat map of icon name → LucideIcon component */
|
|
12
|
+
export declare const ICON_MAP: Map<string, LucideIcon>;
|
|
13
|
+
/** Set of all curated icon names, for membership checks */
|
|
14
|
+
export declare const CURATED_ICON_SET: Set<string>;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { ArrowRight, ArrowLeft, ArrowUp, ArrowDown, ArrowUpRight, ChevronRight, ChevronLeft, ChevronDown, ChevronUp, ChevronsRight, MoveRight, ExternalLink, CornerDownRight, Undo2, Redo2, Mail, Phone, MessageCircle, MessageSquare, Send, AtSign, Inbox, Bell, BellRing, Megaphone, PhoneCall, Voicemail, Globe, Share2, Link, ThumbsUp, Heart, Star, Users, User, UserPlus, UserCheck, HandHeart, Handshake, Briefcase, Building2, CreditCard, DollarSign, Wallet, Receipt, BarChart3, TrendingUp, PiggyBank, BadgeDollarSign, ChartPie, Landmark, Image, Video, Camera, Play, Music, FileText, BookOpen, PenTool, Newspaper, Mic, Headphones, Film, Code, Terminal, Cpu, Database, Server, Cloud, Wifi, Smartphone, Monitor, Laptop, HardDrive, GitBranch, Check, CheckCircle, CircleCheck, X, XCircle, AlertTriangle, AlertCircle, Info, Ban, Loader, CircleAlert, ShieldCheck, Search, Settings, Menu, Plus, Minus, Pencil, Trash2, Copy, Download, Upload, Filter, Eye, EyeOff, Lock, Unlock, MoreHorizontal, Grip, Sun, Moon, Zap, Flame, Droplets, Leaf, Mountain, Compass, MapPin, Clock, Calendar, Gift, TreePine, Snowflake, CloudRain, ShoppingCart, ShoppingBag, Tag, Percent, Store, Package, Truck, Box, BadgePercent, Ticket } from "lucide-react";
|
|
2
|
+
function entry(name, component) {
|
|
3
|
+
return { name, component };
|
|
4
|
+
}
|
|
5
|
+
const ICON_CATALOG = [
|
|
6
|
+
{
|
|
7
|
+
label: "Navigation",
|
|
8
|
+
icons: [
|
|
9
|
+
entry("arrow-right", ArrowRight),
|
|
10
|
+
entry("arrow-left", ArrowLeft),
|
|
11
|
+
entry("arrow-up", ArrowUp),
|
|
12
|
+
entry("arrow-down", ArrowDown),
|
|
13
|
+
entry("arrow-up-right", ArrowUpRight),
|
|
14
|
+
entry("chevron-right", ChevronRight),
|
|
15
|
+
entry("chevron-left", ChevronLeft),
|
|
16
|
+
entry("chevron-down", ChevronDown),
|
|
17
|
+
entry("chevron-up", ChevronUp),
|
|
18
|
+
entry("chevrons-right", ChevronsRight),
|
|
19
|
+
entry("move-right", MoveRight),
|
|
20
|
+
entry("external-link", ExternalLink),
|
|
21
|
+
entry("corner-down-right", CornerDownRight),
|
|
22
|
+
entry("undo-2", Undo2),
|
|
23
|
+
entry("redo-2", Redo2)
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: "Communication",
|
|
28
|
+
icons: [
|
|
29
|
+
entry("mail", Mail),
|
|
30
|
+
entry("phone", Phone),
|
|
31
|
+
entry("message-circle", MessageCircle),
|
|
32
|
+
entry("message-square", MessageSquare),
|
|
33
|
+
entry("send", Send),
|
|
34
|
+
entry("at-sign", AtSign),
|
|
35
|
+
entry("inbox", Inbox),
|
|
36
|
+
entry("bell", Bell),
|
|
37
|
+
entry("bell-ring", BellRing),
|
|
38
|
+
entry("megaphone", Megaphone),
|
|
39
|
+
entry("phone-call", PhoneCall),
|
|
40
|
+
entry("voicemail", Voicemail)
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: "Social",
|
|
45
|
+
icons: [
|
|
46
|
+
entry("globe", Globe),
|
|
47
|
+
entry("share-2", Share2),
|
|
48
|
+
entry("link", Link),
|
|
49
|
+
entry("thumbs-up", ThumbsUp),
|
|
50
|
+
entry("heart", Heart),
|
|
51
|
+
entry("star", Star),
|
|
52
|
+
entry("users", Users),
|
|
53
|
+
entry("user", User),
|
|
54
|
+
entry("user-plus", UserPlus),
|
|
55
|
+
entry("user-check", UserCheck),
|
|
56
|
+
entry("hand-heart", HandHeart),
|
|
57
|
+
entry("handshake", Handshake)
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: "Business",
|
|
62
|
+
icons: [
|
|
63
|
+
entry("briefcase", Briefcase),
|
|
64
|
+
entry("building-2", Building2),
|
|
65
|
+
entry("credit-card", CreditCard),
|
|
66
|
+
entry("dollar-sign", DollarSign),
|
|
67
|
+
entry("wallet", Wallet),
|
|
68
|
+
entry("receipt", Receipt),
|
|
69
|
+
entry("bar-chart-3", BarChart3),
|
|
70
|
+
entry("trending-up", TrendingUp),
|
|
71
|
+
entry("piggy-bank", PiggyBank),
|
|
72
|
+
entry("badge-dollar-sign", BadgeDollarSign),
|
|
73
|
+
entry("chart-pie", ChartPie),
|
|
74
|
+
entry("landmark", Landmark)
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
label: "Media",
|
|
79
|
+
icons: [
|
|
80
|
+
entry("image", Image),
|
|
81
|
+
entry("video", Video),
|
|
82
|
+
entry("camera", Camera),
|
|
83
|
+
entry("play", Play),
|
|
84
|
+
entry("music", Music),
|
|
85
|
+
entry("file-text", FileText),
|
|
86
|
+
entry("book-open", BookOpen),
|
|
87
|
+
entry("pen-tool", PenTool),
|
|
88
|
+
entry("newspaper", Newspaper),
|
|
89
|
+
entry("mic", Mic),
|
|
90
|
+
entry("headphones", Headphones),
|
|
91
|
+
entry("film", Film)
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
label: "Tech",
|
|
96
|
+
icons: [
|
|
97
|
+
entry("code", Code),
|
|
98
|
+
entry("terminal", Terminal),
|
|
99
|
+
entry("cpu", Cpu),
|
|
100
|
+
entry("database", Database),
|
|
101
|
+
entry("server", Server),
|
|
102
|
+
entry("cloud", Cloud),
|
|
103
|
+
entry("wifi", Wifi),
|
|
104
|
+
entry("smartphone", Smartphone),
|
|
105
|
+
entry("monitor", Monitor),
|
|
106
|
+
entry("laptop", Laptop),
|
|
107
|
+
entry("hard-drive", HardDrive),
|
|
108
|
+
entry("git-branch", GitBranch)
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
label: "Status",
|
|
113
|
+
icons: [
|
|
114
|
+
entry("check", Check),
|
|
115
|
+
entry("check-circle", CheckCircle),
|
|
116
|
+
entry("circle-check", CircleCheck),
|
|
117
|
+
entry("x", X),
|
|
118
|
+
entry("x-circle", XCircle),
|
|
119
|
+
entry("alert-triangle", AlertTriangle),
|
|
120
|
+
entry("alert-circle", AlertCircle),
|
|
121
|
+
entry("info", Info),
|
|
122
|
+
entry("ban", Ban),
|
|
123
|
+
entry("loader", Loader),
|
|
124
|
+
entry("circle-alert", CircleAlert),
|
|
125
|
+
entry("shield-check", ShieldCheck)
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
label: "UI",
|
|
130
|
+
icons: [
|
|
131
|
+
entry("search", Search),
|
|
132
|
+
entry("settings", Settings),
|
|
133
|
+
entry("menu", Menu),
|
|
134
|
+
entry("plus", Plus),
|
|
135
|
+
entry("minus", Minus),
|
|
136
|
+
entry("pencil", Pencil),
|
|
137
|
+
entry("trash-2", Trash2),
|
|
138
|
+
entry("copy", Copy),
|
|
139
|
+
entry("download", Download),
|
|
140
|
+
entry("upload", Upload),
|
|
141
|
+
entry("filter", Filter),
|
|
142
|
+
entry("eye", Eye),
|
|
143
|
+
entry("eye-off", EyeOff),
|
|
144
|
+
entry("lock", Lock),
|
|
145
|
+
entry("unlock", Unlock),
|
|
146
|
+
entry("more-horizontal", MoreHorizontal),
|
|
147
|
+
entry("grip", Grip)
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
label: "Nature",
|
|
152
|
+
icons: [
|
|
153
|
+
entry("sun", Sun),
|
|
154
|
+
entry("moon", Moon),
|
|
155
|
+
entry("zap", Zap),
|
|
156
|
+
entry("flame", Flame),
|
|
157
|
+
entry("droplets", Droplets),
|
|
158
|
+
entry("leaf", Leaf),
|
|
159
|
+
entry("mountain", Mountain),
|
|
160
|
+
entry("compass", Compass),
|
|
161
|
+
entry("map-pin", MapPin),
|
|
162
|
+
entry("clock", Clock),
|
|
163
|
+
entry("calendar", Calendar),
|
|
164
|
+
entry("gift", Gift),
|
|
165
|
+
entry("tree-pine", TreePine),
|
|
166
|
+
entry("snowflake", Snowflake),
|
|
167
|
+
entry("cloud-rain", CloudRain)
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
label: "Commerce",
|
|
172
|
+
icons: [
|
|
173
|
+
entry("shopping-cart", ShoppingCart),
|
|
174
|
+
entry("shopping-bag", ShoppingBag),
|
|
175
|
+
entry("tag", Tag),
|
|
176
|
+
entry("percent", Percent),
|
|
177
|
+
entry("store", Store),
|
|
178
|
+
entry("package", Package),
|
|
179
|
+
entry("truck", Truck),
|
|
180
|
+
entry("box", Box),
|
|
181
|
+
entry("badge-percent", BadgePercent),
|
|
182
|
+
entry("ticket", Ticket)
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
];
|
|
186
|
+
const ICON_MAP = new Map(
|
|
187
|
+
ICON_CATALOG.flatMap((cat) => cat.icons.map((e) => [e.name, e.component]))
|
|
188
|
+
);
|
|
189
|
+
new Set(ICON_MAP.keys());
|
|
190
|
+
export {
|
|
191
|
+
ICON_CATALOG,
|
|
192
|
+
ICON_MAP
|
|
193
|
+
};
|
|
@@ -1,8 +1,30 @@
|
|
|
1
|
-
import { Action } from "../core/types";
|
|
1
|
+
import { Action, ActionType } from "../core/types";
|
|
2
|
+
export interface ActionTypeFieldProps {
|
|
3
|
+
/** 表单字段名前缀,会拼到各子 input 的 name 上 */
|
|
4
|
+
name: string;
|
|
5
|
+
/** 当前完整的 Action 对象(子组件只读写与自己 type 相关的字段) */
|
|
6
|
+
value: Action;
|
|
7
|
+
/** 合并局部 patch 到 Action,由父组件负责与完整 state 合并 */
|
|
8
|
+
onChange: (patch: Partial<Action>) => void;
|
|
9
|
+
}
|
|
10
|
+
/** 完整 Action 编辑器(含类型切换 + 子字段) */
|
|
2
11
|
interface ActionFieldProps {
|
|
3
12
|
name: string;
|
|
4
13
|
value: Action | undefined;
|
|
14
|
+
/** 传出合并后的完整 Action */
|
|
5
15
|
onChange: (value: Action) => void;
|
|
6
16
|
}
|
|
17
|
+
/** 类型 Tab 的展示文案与值(可在外部自定义 UI 时复用) */
|
|
18
|
+
export declare const ACTION_TYPE_OPTIONS: {
|
|
19
|
+
label: string;
|
|
20
|
+
value: ActionType;
|
|
21
|
+
}[];
|
|
22
|
+
export declare const PageActionFields: import("react").NamedExoticComponent<ActionTypeFieldProps>;
|
|
23
|
+
export declare const ExternalActionFields: import("react").NamedExoticComponent<ActionTypeFieldProps>;
|
|
24
|
+
export declare const EmailActionFields: import("react").NamedExoticComponent<ActionTypeFieldProps>;
|
|
25
|
+
export declare const PhoneActionFields: import("react").NamedExoticComponent<ActionTypeFieldProps>;
|
|
26
|
+
export declare const SectionActionFields: import("react").NamedExoticComponent<ActionTypeFieldProps>;
|
|
27
|
+
export declare const DownloadActionFields: import("react").NamedExoticComponent<ActionTypeFieldProps>;
|
|
28
|
+
export declare const ACTION_TYPE_FIELD_MAP: Partial<Record<ActionType, React.ComponentType<ActionTypeFieldProps>>>;
|
|
7
29
|
export declare function ActionField({ name, value, onChange }: ActionFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
8
30
|
export {};
|
|
@@ -16,18 +16,19 @@ const ACTION_TYPE_OPTIONS = [
|
|
|
16
16
|
{ label: "Download", value: "download" },
|
|
17
17
|
{ label: "None", value: "none" }
|
|
18
18
|
];
|
|
19
|
-
const
|
|
19
|
+
const PageActionFields = memo(function PageActionFields2({
|
|
20
20
|
name,
|
|
21
21
|
value,
|
|
22
22
|
onChange
|
|
23
23
|
}) {
|
|
24
24
|
const { sitePages } = useEditorContext();
|
|
25
25
|
const pages = sitePages ?? [];
|
|
26
|
-
const
|
|
26
|
+
const pageUrl = value.pageUrl ?? "";
|
|
27
|
+
const selectedSlug = pageUrl.startsWith("/") ? pageUrl.slice(1) : null;
|
|
27
28
|
const handlePaste = useCallback(async () => {
|
|
28
29
|
try {
|
|
29
30
|
const text = await navigator.clipboard.readText();
|
|
30
|
-
if (text) onChange(text.trim());
|
|
31
|
+
if (text) onChange({ pageUrl: text.trim() });
|
|
31
32
|
} catch {
|
|
32
33
|
}
|
|
33
34
|
}, [onChange]);
|
|
@@ -42,16 +43,16 @@ const PageUrlField = memo(function PageUrlField2({
|
|
|
42
43
|
name: `${name}.pageUrl`,
|
|
43
44
|
className: "w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",
|
|
44
45
|
placeholder: "/about",
|
|
45
|
-
value,
|
|
46
|
-
onChange: (e) => onChange(e.target.value)
|
|
46
|
+
value: pageUrl,
|
|
47
|
+
onChange: (e) => onChange({ pageUrl: e.target.value })
|
|
47
48
|
}
|
|
48
49
|
),
|
|
49
|
-
|
|
50
|
+
pageUrl && /* @__PURE__ */ jsx(
|
|
50
51
|
"button",
|
|
51
52
|
{
|
|
52
53
|
type: "button",
|
|
53
54
|
className: "text-muted-foreground hover:text-foreground shrink-0",
|
|
54
|
-
onClick: () => onChange(""),
|
|
55
|
+
onClick: () => onChange({ pageUrl: "" }),
|
|
55
56
|
children: /* @__PURE__ */ jsx(XIcon, { className: "size-3.5" })
|
|
56
57
|
}
|
|
57
58
|
)
|
|
@@ -80,7 +81,7 @@ const PageUrlField = memo(function PageUrlField2({
|
|
|
80
81
|
{
|
|
81
82
|
type: "button",
|
|
82
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"}`,
|
|
83
|
-
onClick: () => onChange(isSelected ? "" : `${page.slug}`),
|
|
84
|
+
onClick: () => onChange({ pageUrl: isSelected ? "" : `${page.slug}` }),
|
|
84
85
|
children: [
|
|
85
86
|
/* @__PURE__ */ jsx(GlobeIcon, { className: "size-3" }),
|
|
86
87
|
page.label
|
|
@@ -92,154 +93,197 @@ const PageUrlField = memo(function PageUrlField2({
|
|
|
92
93
|
] })
|
|
93
94
|
] });
|
|
94
95
|
});
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return /* @__PURE__ */ jsxs(
|
|
96
|
+
const ExternalActionFields = memo(function ExternalActionFields2({
|
|
97
|
+
name,
|
|
98
|
+
value,
|
|
99
|
+
onChange
|
|
100
|
+
}) {
|
|
101
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
101
102
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
102
|
-
/* @__PURE__ */ jsx(Label, { children: "
|
|
103
|
+
/* @__PURE__ */ jsx(Label, { children: "External URL" }),
|
|
103
104
|
/* @__PURE__ */ jsx(
|
|
104
|
-
|
|
105
|
+
Input,
|
|
105
106
|
{
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
value: opt.value,
|
|
112
|
-
className: "h-7 flex-none text-xs",
|
|
113
|
-
children: opt.label
|
|
114
|
-
},
|
|
115
|
-
opt.value
|
|
116
|
-
)) })
|
|
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"
|
|
117
112
|
}
|
|
118
113
|
)
|
|
119
114
|
] }),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
{
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
{
|
|
149
|
-
type: "radio",
|
|
150
|
-
name: `${name}.openInNewTab`,
|
|
151
|
-
value: "true",
|
|
152
|
-
checked: current.openInNewTab === "true",
|
|
153
|
-
onChange: () => update({ openInNewTab: "true" })
|
|
154
|
-
}
|
|
155
|
-
),
|
|
156
|
-
"Yes"
|
|
157
|
-
] }),
|
|
158
|
-
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-1.5 text-sm", children: [
|
|
159
|
-
/* @__PURE__ */ jsx(
|
|
160
|
-
"input",
|
|
161
|
-
{
|
|
162
|
-
type: "radio",
|
|
163
|
-
name: `${name}.openInNewTab`,
|
|
164
|
-
value: "false",
|
|
165
|
-
checked: current.openInNewTab !== "true",
|
|
166
|
-
onChange: () => update({ openInNewTab: "false" })
|
|
167
|
-
}
|
|
168
|
-
),
|
|
169
|
-
"No"
|
|
170
|
-
] })
|
|
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"
|
|
171
143
|
] })
|
|
172
144
|
] })
|
|
173
|
-
] })
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
placeholder: "hello@example.com"
|
|
185
|
-
}
|
|
186
|
-
)
|
|
187
|
-
] }),
|
|
188
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
189
|
-
/* @__PURE__ */ jsx(Label, { children: "Subject" }),
|
|
190
|
-
/* @__PURE__ */ jsx(
|
|
191
|
-
Input,
|
|
192
|
-
{
|
|
193
|
-
name: `${name}.subject`,
|
|
194
|
-
className: "h-8 text-sm",
|
|
195
|
-
value: current.subject ?? "",
|
|
196
|
-
onChange: (e) => update({ subject: e.target.value }),
|
|
197
|
-
placeholder: "Optional email subject"
|
|
198
|
-
}
|
|
199
|
-
)
|
|
200
|
-
] })
|
|
201
|
-
] }),
|
|
202
|
-
current.type === "phone" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
203
|
-
/* @__PURE__ */ jsx(Label, { children: "Phone" }),
|
|
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" }),
|
|
204
156
|
/* @__PURE__ */ jsx(
|
|
205
157
|
Input,
|
|
206
158
|
{
|
|
207
|
-
name: `${name}.
|
|
159
|
+
name: `${name}.email`,
|
|
208
160
|
className: "h-8 text-sm",
|
|
209
|
-
value:
|
|
210
|
-
onChange: (e) =>
|
|
211
|
-
placeholder: "
|
|
161
|
+
value: value.email ?? "",
|
|
162
|
+
onChange: (e) => onChange({ email: e.target.value }),
|
|
163
|
+
placeholder: "hello@example.com"
|
|
212
164
|
}
|
|
213
165
|
)
|
|
214
166
|
] }),
|
|
215
|
-
|
|
216
|
-
/* @__PURE__ */ jsx(Label, { children: "
|
|
167
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
168
|
+
/* @__PURE__ */ jsx(Label, { children: "Subject" }),
|
|
217
169
|
/* @__PURE__ */ jsx(
|
|
218
170
|
Input,
|
|
219
171
|
{
|
|
220
|
-
name: `${name}.
|
|
172
|
+
name: `${name}.subject`,
|
|
221
173
|
className: "h-8 text-sm",
|
|
222
|
-
value:
|
|
223
|
-
onChange: (e) =>
|
|
224
|
-
placeholder: "
|
|
174
|
+
value: value.subject ?? "",
|
|
175
|
+
onChange: (e) => onChange({ subject: e.target.value }),
|
|
176
|
+
placeholder: "Optional email subject"
|
|
225
177
|
}
|
|
226
178
|
)
|
|
227
|
-
] })
|
|
228
|
-
|
|
229
|
-
|
|
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" }),
|
|
230
259
|
/* @__PURE__ */ jsx(
|
|
231
|
-
|
|
260
|
+
Tabs,
|
|
232
261
|
{
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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
|
+
)) })
|
|
238
273
|
}
|
|
239
274
|
)
|
|
240
|
-
] })
|
|
275
|
+
] }),
|
|
276
|
+
TypeFields && /* @__PURE__ */ jsx(TypeFields, { name, value: current, onChange: update })
|
|
241
277
|
] });
|
|
242
278
|
}
|
|
243
279
|
export {
|
|
244
|
-
|
|
280
|
+
ACTION_TYPE_FIELD_MAP,
|
|
281
|
+
ACTION_TYPE_OPTIONS,
|
|
282
|
+
ActionField,
|
|
283
|
+
DownloadActionFields,
|
|
284
|
+
EmailActionFields,
|
|
285
|
+
ExternalActionFields,
|
|
286
|
+
PageActionFields,
|
|
287
|
+
PhoneActionFields,
|
|
288
|
+
SectionActionFields
|
|
245
289
|
};
|