@kgalexander/mcreate 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/{chunk-TDZCSKBT.mjs → chunk-LAW7VVEQ.mjs} +445 -174
- package/dist/{core-F5E63TCH.mjs → core-GBVVYXAB.mjs} +1 -1
- package/dist/index.d.mts +15 -3
- package/dist/index.d.ts +15 -3
- package/dist/index.js +3427 -2626
- package/dist/index.mjs +1334 -835
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
MAX_FONT_SIZE,
|
|
30
30
|
MAX_LETTER_SPACING,
|
|
31
31
|
MAX_LINE_HEIGHT,
|
|
32
|
+
MAX_PAID_LEVEL,
|
|
32
33
|
MAX_TEMPLATE_SIZE,
|
|
33
34
|
MIN_FONT_SIZE,
|
|
34
35
|
MIN_LETTER_SPACING,
|
|
@@ -59,9 +60,8 @@ import {
|
|
|
59
60
|
parsePrice,
|
|
60
61
|
setupDragImage,
|
|
61
62
|
useEditorStore,
|
|
62
|
-
useSidebarContext
|
|
63
|
-
|
|
64
|
-
} from "./chunk-TDZCSKBT.mjs";
|
|
63
|
+
useSidebarContext
|
|
64
|
+
} from "./chunk-LAW7VVEQ.mjs";
|
|
65
65
|
|
|
66
66
|
// src/core/editor/components/email-template-v2/header.tsx
|
|
67
67
|
import { ArrowLeftIcon, CopyIcon, MegaphoneIcon, MoreHorizontalIcon, PencilIcon, TrashIcon } from "lucide-react";
|
|
@@ -257,7 +257,7 @@ function TemplateHeader({ template }) {
|
|
|
257
257
|
|
|
258
258
|
// src/core/editor/components/email-template-v2/sidebar/sidebar.tsx
|
|
259
259
|
import { useCallback as useCallback8, useEffect as useEffect2, useRef as useRef3, useMemo as useMemo6, useState as useState6 } from "react";
|
|
260
|
-
import { BlocksIcon, Paintbrush, PanelLeftClose, PanelLeftOpen } from "lucide-react";
|
|
260
|
+
import { BlocksIcon, Hexagon as Hexagon2, Paintbrush, PanelLeftClose, PanelLeftOpen } from "lucide-react";
|
|
261
261
|
|
|
262
262
|
// src/core/editor/components/email-template-v2/sidebar/view/elements/main.tsx
|
|
263
263
|
import { useState as useState2 } from "react";
|
|
@@ -690,8 +690,8 @@ import { EyeOff } from "lucide-react";
|
|
|
690
690
|
import { CheckIcon } from "lucide-react";
|
|
691
691
|
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
692
692
|
var StylesBadge = ({ value }) => {
|
|
693
|
-
const {
|
|
694
|
-
const
|
|
693
|
+
const { template, setShowCompanyFooter, isPaidLevel } = useEditorStore();
|
|
694
|
+
const isPaid = isPaidLevel >= 1;
|
|
695
695
|
const showCompanyFooter = useMemo(() => {
|
|
696
696
|
return template.content[0]?.data?.value?.showCompanyFooter ?? true;
|
|
697
697
|
}, [template]);
|
|
@@ -1519,6 +1519,10 @@ var IMAGES_MOCK_DATA = [
|
|
|
1519
1519
|
{
|
|
1520
1520
|
src: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRlIqGRcEU6qFIYC_nYbC88kuKRy9YKnqInVQ&s",
|
|
1521
1521
|
alt: "Image"
|
|
1522
|
+
},
|
|
1523
|
+
{
|
|
1524
|
+
src: "https://icons.veryicon.com/png/o/miscellaneous/face-monochrome-icon/calendar-249.png",
|
|
1525
|
+
alt: "Image"
|
|
1522
1526
|
}
|
|
1523
1527
|
];
|
|
1524
1528
|
var ImageSelection = ({ setActiveView, lastView, onImageSelect, focusIdx }) => {
|
|
@@ -2231,6 +2235,19 @@ function TemplateSidebar({ editorLoading }) {
|
|
|
2231
2235
|
}
|
|
2232
2236
|
),
|
|
2233
2237
|
/* @__PURE__ */ jsx24("span", { className: "text-xs text-muted-foreground", children: "Styles" })
|
|
2238
|
+
] }),
|
|
2239
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-col items-center gap-1", children: [
|
|
2240
|
+
/* @__PURE__ */ jsx24(
|
|
2241
|
+
Button,
|
|
2242
|
+
{
|
|
2243
|
+
onClick: () => handleViewClick("brand"),
|
|
2244
|
+
variant: "ghost",
|
|
2245
|
+
size: "icon",
|
|
2246
|
+
className: `shadow-none transition-none w-[44px] h-[44px] p-0 flex flex-col items-center cursor-pointer ${activeView === "brand" ? "bg-sidebar-accent" : ""}`,
|
|
2247
|
+
children: /* @__PURE__ */ jsx24(Hexagon2, {})
|
|
2248
|
+
}
|
|
2249
|
+
),
|
|
2250
|
+
/* @__PURE__ */ jsx24("span", { className: "text-xs text-muted-foreground", children: "Brand" })
|
|
2234
2251
|
] })
|
|
2235
2252
|
] }),
|
|
2236
2253
|
/* @__PURE__ */ jsx24(
|
|
@@ -4251,7 +4268,7 @@ var TextToolbar = () => {
|
|
|
4251
4268
|
};
|
|
4252
4269
|
|
|
4253
4270
|
// src/core/editor/components/element-gear/button/toolbar.tsx
|
|
4254
|
-
import { useCallback as
|
|
4271
|
+
import { useCallback as useCallback21, useMemo as useMemo18 } from "react";
|
|
4255
4272
|
import { get as lodashGet7 } from "lodash";
|
|
4256
4273
|
import { BoldIcon as BoldIcon2, CaseUpperIcon as CaseUpperIcon2, ItalicIcon as ItalicIcon2, Strikethrough as Strikethrough2, Underline as Underline2 } from "lucide-react";
|
|
4257
4274
|
|
|
@@ -4384,8 +4401,227 @@ var useSize = (options = {}) => {
|
|
|
4384
4401
|
return { width, height, setWidth, setHeight };
|
|
4385
4402
|
};
|
|
4386
4403
|
|
|
4387
|
-
// src/core/editor/components/
|
|
4404
|
+
// src/core/editor/components/button-text-settings.tsx
|
|
4405
|
+
import { TypeIcon as TypeIcon2 } from "lucide-react";
|
|
4406
|
+
import { useState as useState13, useEffect as useEffect9, useMemo as useMemo17, useCallback as useCallback20, memo as memo4 } from "react";
|
|
4388
4407
|
import { jsx as jsx46, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4408
|
+
var ButtonTextSettings = memo4(function ButtonTextSettings2() {
|
|
4409
|
+
const [isOpen, setIsOpen] = useState13(false);
|
|
4410
|
+
const focusIdx = useEditorStore((s) => s.focusIdx);
|
|
4411
|
+
const template = useEditorStore((s) => s.template);
|
|
4412
|
+
const updateElement = useEditorStore((s) => s.updateElement);
|
|
4413
|
+
const buttonElement = useMemo17(() => {
|
|
4414
|
+
return focusIdx ? getValueByIdx(template, focusIdx) : null;
|
|
4415
|
+
}, [focusIdx, template]);
|
|
4416
|
+
const currentLetterSpacing = useMemo17(() => {
|
|
4417
|
+
if (!buttonElement?.attributes?.["letter-spacing"]) return DEFAULT_LETTER_SPACING;
|
|
4418
|
+
const parsed = parseFloat(buttonElement.attributes["letter-spacing"]);
|
|
4419
|
+
return isNaN(parsed) ? DEFAULT_LETTER_SPACING : parsed;
|
|
4420
|
+
}, [buttonElement]);
|
|
4421
|
+
const currentLineHeight = useMemo17(() => {
|
|
4422
|
+
if (!buttonElement?.attributes?.["line-height"]) return DEFAULT_LINE_HEIGHT;
|
|
4423
|
+
const parsed = parseFloat(buttonElement.attributes["line-height"]);
|
|
4424
|
+
return isNaN(parsed) ? DEFAULT_LINE_HEIGHT : parsed;
|
|
4425
|
+
}, [buttonElement]);
|
|
4426
|
+
const [letterSpacingInputValue, setLetterSpacingInputValue] = useState13(
|
|
4427
|
+
String(currentLetterSpacing)
|
|
4428
|
+
);
|
|
4429
|
+
const [isLetterSpacingInputFocused, setIsLetterSpacingInputFocused] = useState13(false);
|
|
4430
|
+
const [lineHeightInputValue, setLineHeightInputValue] = useState13(
|
|
4431
|
+
String(currentLineHeight)
|
|
4432
|
+
);
|
|
4433
|
+
const [isLineHeightInputFocused, setIsLineHeightInputFocused] = useState13(false);
|
|
4434
|
+
useEffect9(() => {
|
|
4435
|
+
if (!isLetterSpacingInputFocused) {
|
|
4436
|
+
setLetterSpacingInputValue(String(currentLetterSpacing));
|
|
4437
|
+
}
|
|
4438
|
+
}, [currentLetterSpacing, isLetterSpacingInputFocused]);
|
|
4439
|
+
useEffect9(() => {
|
|
4440
|
+
if (!isLineHeightInputFocused) {
|
|
4441
|
+
setLineHeightInputValue(String(currentLineHeight));
|
|
4442
|
+
}
|
|
4443
|
+
}, [currentLineHeight, isLineHeightInputFocused]);
|
|
4444
|
+
const handleLetterSpacingSliderChange = useCallback20((values) => {
|
|
4445
|
+
if (!focusIdx) return;
|
|
4446
|
+
const value = values[0];
|
|
4447
|
+
setLetterSpacingInputValue(String(value));
|
|
4448
|
+
const currentTemplate = useEditorStore.getState().template;
|
|
4449
|
+
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
4450
|
+
updateElement(focusIdx, {
|
|
4451
|
+
attributes: {
|
|
4452
|
+
...element?.attributes,
|
|
4453
|
+
"letter-spacing": `${value}px`
|
|
4454
|
+
}
|
|
4455
|
+
});
|
|
4456
|
+
}, [focusIdx, updateElement]);
|
|
4457
|
+
const handleLetterSpacingInputChange = useCallback20((e) => {
|
|
4458
|
+
setLetterSpacingInputValue(e.target.value);
|
|
4459
|
+
}, []);
|
|
4460
|
+
const applyLetterSpacing = useCallback20(() => {
|
|
4461
|
+
if (!focusIdx) return;
|
|
4462
|
+
const parsed = parseFloat(letterSpacingInputValue);
|
|
4463
|
+
if (isNaN(parsed) || letterSpacingInputValue === "") {
|
|
4464
|
+
setLetterSpacingInputValue(String(currentLetterSpacing));
|
|
4465
|
+
return;
|
|
4466
|
+
}
|
|
4467
|
+
const clampedValue = Math.max(MIN_LETTER_SPACING, Math.min(parsed, MAX_LETTER_SPACING));
|
|
4468
|
+
setLetterSpacingInputValue(String(clampedValue));
|
|
4469
|
+
const currentTemplate = useEditorStore.getState().template;
|
|
4470
|
+
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
4471
|
+
updateElement(focusIdx, {
|
|
4472
|
+
attributes: {
|
|
4473
|
+
...element?.attributes,
|
|
4474
|
+
"letter-spacing": `${clampedValue}px`
|
|
4475
|
+
}
|
|
4476
|
+
});
|
|
4477
|
+
}, [focusIdx, letterSpacingInputValue, currentLetterSpacing, updateElement]);
|
|
4478
|
+
const handleLetterSpacingInputBlur = useCallback20(() => {
|
|
4479
|
+
setIsLetterSpacingInputFocused(false);
|
|
4480
|
+
applyLetterSpacing();
|
|
4481
|
+
}, [applyLetterSpacing]);
|
|
4482
|
+
const handleLetterSpacingInputKeyDown = useCallback20((e) => {
|
|
4483
|
+
if (e.key === "Enter") {
|
|
4484
|
+
e.preventDefault();
|
|
4485
|
+
applyLetterSpacing();
|
|
4486
|
+
e.target.blur();
|
|
4487
|
+
}
|
|
4488
|
+
}, [applyLetterSpacing]);
|
|
4489
|
+
const handleLineHeightSliderChange = useCallback20((values) => {
|
|
4490
|
+
if (!focusIdx) return;
|
|
4491
|
+
const value = values[0];
|
|
4492
|
+
setLineHeightInputValue(String(value));
|
|
4493
|
+
const currentTemplate = useEditorStore.getState().template;
|
|
4494
|
+
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
4495
|
+
updateElement(focusIdx, {
|
|
4496
|
+
attributes: {
|
|
4497
|
+
...element?.attributes,
|
|
4498
|
+
"line-height": String(value)
|
|
4499
|
+
}
|
|
4500
|
+
});
|
|
4501
|
+
}, [focusIdx, updateElement]);
|
|
4502
|
+
const handleLineHeightInputChange = useCallback20((e) => {
|
|
4503
|
+
setLineHeightInputValue(e.target.value);
|
|
4504
|
+
}, []);
|
|
4505
|
+
const applyLineHeight = useCallback20(() => {
|
|
4506
|
+
if (!focusIdx) return;
|
|
4507
|
+
const parsed = parseFloat(lineHeightInputValue);
|
|
4508
|
+
if (isNaN(parsed) || lineHeightInputValue === "") {
|
|
4509
|
+
setLineHeightInputValue(String(currentLineHeight));
|
|
4510
|
+
return;
|
|
4511
|
+
}
|
|
4512
|
+
const clampedValue = Math.max(MIN_LINE_HEIGHT, Math.min(parsed, MAX_LINE_HEIGHT));
|
|
4513
|
+
setLineHeightInputValue(String(clampedValue));
|
|
4514
|
+
const currentTemplate = useEditorStore.getState().template;
|
|
4515
|
+
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
4516
|
+
updateElement(focusIdx, {
|
|
4517
|
+
attributes: {
|
|
4518
|
+
...element?.attributes,
|
|
4519
|
+
"line-height": String(clampedValue)
|
|
4520
|
+
}
|
|
4521
|
+
});
|
|
4522
|
+
}, [focusIdx, lineHeightInputValue, currentLineHeight, updateElement]);
|
|
4523
|
+
const handleLineHeightInputBlur = useCallback20(() => {
|
|
4524
|
+
setIsLineHeightInputFocused(false);
|
|
4525
|
+
applyLineHeight();
|
|
4526
|
+
}, [applyLineHeight]);
|
|
4527
|
+
const handleLineHeightInputKeyDown = useCallback20((e) => {
|
|
4528
|
+
if (e.key === "Enter") {
|
|
4529
|
+
e.preventDefault();
|
|
4530
|
+
applyLineHeight();
|
|
4531
|
+
e.target.blur();
|
|
4532
|
+
}
|
|
4533
|
+
}, [applyLineHeight]);
|
|
4534
|
+
return /* @__PURE__ */ jsxs35(Tooltip, { children: [
|
|
4535
|
+
/* @__PURE__ */ jsxs35(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
4536
|
+
/* @__PURE__ */ jsx46(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx46(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx46(
|
|
4537
|
+
Button,
|
|
4538
|
+
{
|
|
4539
|
+
variant: "ghost",
|
|
4540
|
+
className: `shadow-none transition-none cursor-pointer rounded-[12px] ${isOpen ? "bg-muted" : ""}`,
|
|
4541
|
+
size: "icon",
|
|
4542
|
+
disabled: !focusIdx,
|
|
4543
|
+
children: /* @__PURE__ */ jsx46(TypeIcon2, { className: "w-4 h-4" })
|
|
4544
|
+
}
|
|
4545
|
+
) }) }),
|
|
4546
|
+
/* @__PURE__ */ jsx46(
|
|
4547
|
+
PopoverContent,
|
|
4548
|
+
{
|
|
4549
|
+
className: "w-64 z-51 mt-1 rounded-[12px]",
|
|
4550
|
+
"data-editor-toolbar": "true",
|
|
4551
|
+
children: /* @__PURE__ */ jsxs35("div", { className: "flex flex-col gap-4", children: [
|
|
4552
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex flex-col gap-3", children: [
|
|
4553
|
+
/* @__PURE__ */ jsx46(Label, { children: "Letter spacing" }),
|
|
4554
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex flex-row items-center gap-2", children: [
|
|
4555
|
+
/* @__PURE__ */ jsx46(
|
|
4556
|
+
Slider2,
|
|
4557
|
+
{
|
|
4558
|
+
value: [currentLetterSpacing],
|
|
4559
|
+
onValueChange: handleLetterSpacingSliderChange,
|
|
4560
|
+
min: MIN_LETTER_SPACING,
|
|
4561
|
+
max: MAX_LETTER_SPACING,
|
|
4562
|
+
step: LETTER_SPACING_STEP,
|
|
4563
|
+
disabled: !focusIdx
|
|
4564
|
+
}
|
|
4565
|
+
),
|
|
4566
|
+
/* @__PURE__ */ jsx46(
|
|
4567
|
+
Input,
|
|
4568
|
+
{
|
|
4569
|
+
type: "number",
|
|
4570
|
+
value: letterSpacingInputValue,
|
|
4571
|
+
onChange: handleLetterSpacingInputChange,
|
|
4572
|
+
onFocus: () => setIsLetterSpacingInputFocused(true),
|
|
4573
|
+
onBlur: handleLetterSpacingInputBlur,
|
|
4574
|
+
onKeyDown: handleLetterSpacingInputKeyDown,
|
|
4575
|
+
className: "w-25 shadow-none rounded-[12px]",
|
|
4576
|
+
min: MIN_LETTER_SPACING,
|
|
4577
|
+
max: MAX_LETTER_SPACING,
|
|
4578
|
+
disabled: !focusIdx
|
|
4579
|
+
}
|
|
4580
|
+
)
|
|
4581
|
+
] })
|
|
4582
|
+
] }),
|
|
4583
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex flex-col gap-3", children: [
|
|
4584
|
+
/* @__PURE__ */ jsx46(Label, { children: "Line spacing" }),
|
|
4585
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex flex-row items-center gap-2", children: [
|
|
4586
|
+
/* @__PURE__ */ jsx46(
|
|
4587
|
+
Slider2,
|
|
4588
|
+
{
|
|
4589
|
+
value: [currentLineHeight],
|
|
4590
|
+
onValueChange: handleLineHeightSliderChange,
|
|
4591
|
+
min: MIN_LINE_HEIGHT,
|
|
4592
|
+
max: MAX_LINE_HEIGHT,
|
|
4593
|
+
step: LINE_HEIGHT_STEP,
|
|
4594
|
+
disabled: !focusIdx
|
|
4595
|
+
}
|
|
4596
|
+
),
|
|
4597
|
+
/* @__PURE__ */ jsx46(
|
|
4598
|
+
Input,
|
|
4599
|
+
{
|
|
4600
|
+
type: "number",
|
|
4601
|
+
value: lineHeightInputValue,
|
|
4602
|
+
onChange: handleLineHeightInputChange,
|
|
4603
|
+
onFocus: () => setIsLineHeightInputFocused(true),
|
|
4604
|
+
onBlur: handleLineHeightInputBlur,
|
|
4605
|
+
onKeyDown: handleLineHeightInputKeyDown,
|
|
4606
|
+
className: "w-25 shadow-none rounded-[12px]",
|
|
4607
|
+
min: MIN_LINE_HEIGHT,
|
|
4608
|
+
max: MAX_LINE_HEIGHT,
|
|
4609
|
+
step: LINE_HEIGHT_STEP,
|
|
4610
|
+
disabled: !focusIdx
|
|
4611
|
+
}
|
|
4612
|
+
)
|
|
4613
|
+
] })
|
|
4614
|
+
] })
|
|
4615
|
+
] })
|
|
4616
|
+
}
|
|
4617
|
+
)
|
|
4618
|
+
] }),
|
|
4619
|
+
/* @__PURE__ */ jsx46(TooltipContent, { side: "bottom", className: "z-51", children: "Text Settings" })
|
|
4620
|
+
] });
|
|
4621
|
+
});
|
|
4622
|
+
|
|
4623
|
+
// src/core/editor/components/element-gear/button/toolbar.tsx
|
|
4624
|
+
import { jsx as jsx47, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4389
4625
|
var ButtonToolbar = () => {
|
|
4390
4626
|
const { focusIdx, deleteElement, template, updateElement } = useEditorStore();
|
|
4391
4627
|
const { activeView, colorTarget, setActiveView, setColorType, setColorTarget } = useSidebarContext();
|
|
@@ -4393,41 +4629,41 @@ var ButtonToolbar = () => {
|
|
|
4393
4629
|
const border = useBorder();
|
|
4394
4630
|
const padding = usePadding();
|
|
4395
4631
|
const size = useSize({ defaultWidth: 100, defaultHeight: 40, widthUnit: "%", heightUnit: "px" });
|
|
4396
|
-
const currentElement =
|
|
4632
|
+
const currentElement = useMemo18(() => {
|
|
4397
4633
|
if (!focusIdx || !template) return null;
|
|
4398
4634
|
const path = focusIdx.startsWith("content.") ? focusIdx.replace("content.", "content[0].").replace(/\.\[(\d+)\]/g, "[$1]") : focusIdx;
|
|
4399
4635
|
return lodashGet7(template, path);
|
|
4400
4636
|
}, [focusIdx, template]);
|
|
4401
|
-
const currentBgColor =
|
|
4637
|
+
const currentBgColor = useMemo18(() => {
|
|
4402
4638
|
return currentElement?.attributes?.["background-color"];
|
|
4403
4639
|
}, [currentElement]);
|
|
4404
|
-
const currentTextColor =
|
|
4640
|
+
const currentTextColor = useMemo18(() => {
|
|
4405
4641
|
return currentElement?.attributes?.["color"] || "#ffffff";
|
|
4406
4642
|
}, [currentElement]);
|
|
4407
|
-
const isBold =
|
|
4643
|
+
const isBold = useMemo18(() => {
|
|
4408
4644
|
return currentElement?.attributes?.["font-weight"] === "bold";
|
|
4409
4645
|
}, [currentElement]);
|
|
4410
|
-
const isItalic =
|
|
4646
|
+
const isItalic = useMemo18(() => {
|
|
4411
4647
|
return currentElement?.attributes?.["font-style"] === "italic";
|
|
4412
4648
|
}, [currentElement]);
|
|
4413
|
-
const isUnderline =
|
|
4649
|
+
const isUnderline = useMemo18(() => {
|
|
4414
4650
|
const decoration = currentElement?.attributes?.["text-decoration"] || "";
|
|
4415
4651
|
return decoration.includes("underline");
|
|
4416
4652
|
}, [currentElement]);
|
|
4417
|
-
const isStrikethrough =
|
|
4653
|
+
const isStrikethrough = useMemo18(() => {
|
|
4418
4654
|
const decoration = currentElement?.attributes?.["text-decoration"] || "";
|
|
4419
4655
|
return decoration.includes("line-through");
|
|
4420
4656
|
}, [currentElement]);
|
|
4421
|
-
const currentAlignment =
|
|
4657
|
+
const currentAlignment = useMemo18(() => {
|
|
4422
4658
|
return currentElement?.attributes?.["text-align"] || "left";
|
|
4423
4659
|
}, [currentElement]);
|
|
4424
|
-
const currentButtonAlign =
|
|
4660
|
+
const currentButtonAlign = useMemo18(() => {
|
|
4425
4661
|
return currentElement?.attributes?.["align"] || "center";
|
|
4426
4662
|
}, [currentElement]);
|
|
4427
|
-
const currentFontFamily =
|
|
4663
|
+
const currentFontFamily = useMemo18(() => {
|
|
4428
4664
|
return currentElement?.attributes?.["font-family"] || "Arial";
|
|
4429
4665
|
}, [currentElement]);
|
|
4430
|
-
const currentFontSize =
|
|
4666
|
+
const currentFontSize = useMemo18(() => {
|
|
4431
4667
|
return parseFontSize(currentElement?.attributes?.["font-size"]);
|
|
4432
4668
|
}, [currentElement]);
|
|
4433
4669
|
const handleDelete = () => {
|
|
@@ -4435,36 +4671,36 @@ var ButtonToolbar = () => {
|
|
|
4435
4671
|
deleteElement(focusIdx);
|
|
4436
4672
|
}
|
|
4437
4673
|
};
|
|
4438
|
-
const handleOpenBgColorPicker =
|
|
4674
|
+
const handleOpenBgColorPicker = useCallback21(() => {
|
|
4439
4675
|
setColorType("Button Color");
|
|
4440
4676
|
setColorTarget("buttonBgColor");
|
|
4441
4677
|
setActiveView("color");
|
|
4442
4678
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
4443
|
-
const handleOpenStrokeColorPicker =
|
|
4679
|
+
const handleOpenStrokeColorPicker = useCallback21(() => {
|
|
4444
4680
|
setColorType("Stroke Color");
|
|
4445
4681
|
setColorTarget("buttonStrokeColor");
|
|
4446
4682
|
setActiveView("color");
|
|
4447
4683
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
4448
|
-
const handleOpenTextColorPicker =
|
|
4684
|
+
const handleOpenTextColorPicker = useCallback21(() => {
|
|
4449
4685
|
setColorType("Text Color");
|
|
4450
4686
|
setColorTarget("buttonTextColor");
|
|
4451
4687
|
setActiveView("color");
|
|
4452
4688
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
4453
|
-
const handleToggleBold =
|
|
4689
|
+
const handleToggleBold = useCallback21(() => {
|
|
4454
4690
|
if (!focusIdx || !currentElement) return;
|
|
4455
4691
|
const newWeight = isBold ? "normal" : "bold";
|
|
4456
4692
|
updateElement(focusIdx, {
|
|
4457
4693
|
attributes: { ...currentElement.attributes, "font-weight": newWeight }
|
|
4458
4694
|
});
|
|
4459
4695
|
}, [focusIdx, currentElement, isBold, updateElement]);
|
|
4460
|
-
const handleToggleItalic =
|
|
4696
|
+
const handleToggleItalic = useCallback21(() => {
|
|
4461
4697
|
if (!focusIdx || !currentElement) return;
|
|
4462
4698
|
const newStyle = isItalic ? "normal" : "italic";
|
|
4463
4699
|
updateElement(focusIdx, {
|
|
4464
4700
|
attributes: { ...currentElement.attributes, "font-style": newStyle }
|
|
4465
4701
|
});
|
|
4466
4702
|
}, [focusIdx, currentElement, isItalic, updateElement]);
|
|
4467
|
-
const handleToggleUnderline =
|
|
4703
|
+
const handleToggleUnderline = useCallback21(() => {
|
|
4468
4704
|
if (!focusIdx || !currentElement) return;
|
|
4469
4705
|
const currentDecoration = currentElement.attributes?.["text-decoration"] || "";
|
|
4470
4706
|
let newDecoration;
|
|
@@ -4477,7 +4713,7 @@ var ButtonToolbar = () => {
|
|
|
4477
4713
|
attributes: { ...currentElement.attributes, "text-decoration": newDecoration || "none" }
|
|
4478
4714
|
});
|
|
4479
4715
|
}, [focusIdx, currentElement, isUnderline, updateElement]);
|
|
4480
|
-
const handleToggleStrike =
|
|
4716
|
+
const handleToggleStrike = useCallback21(() => {
|
|
4481
4717
|
if (!focusIdx || !currentElement) return;
|
|
4482
4718
|
const currentDecoration = currentElement.attributes?.["text-decoration"] || "";
|
|
4483
4719
|
let newDecoration;
|
|
@@ -4490,7 +4726,7 @@ var ButtonToolbar = () => {
|
|
|
4490
4726
|
attributes: { ...currentElement.attributes, "text-decoration": newDecoration || "none" }
|
|
4491
4727
|
});
|
|
4492
4728
|
}, [focusIdx, currentElement, isStrikethrough, updateElement]);
|
|
4493
|
-
const handleCycleAlignment =
|
|
4729
|
+
const handleCycleAlignment = useCallback21(() => {
|
|
4494
4730
|
if (!focusIdx || !currentElement) return;
|
|
4495
4731
|
const currentIndex = BUTTON_ALIGNMENTS.indexOf(currentAlignment);
|
|
4496
4732
|
const nextIndex = (currentIndex + 1) % BUTTON_ALIGNMENTS.length;
|
|
@@ -4499,7 +4735,7 @@ var ButtonToolbar = () => {
|
|
|
4499
4735
|
attributes: { ...currentElement.attributes, "text-align": nextAlignment }
|
|
4500
4736
|
});
|
|
4501
4737
|
}, [focusIdx, currentElement, currentAlignment, updateElement]);
|
|
4502
|
-
const handleCycleButtonAlign =
|
|
4738
|
+
const handleCycleButtonAlign = useCallback21(() => {
|
|
4503
4739
|
if (!focusIdx || !currentElement) return;
|
|
4504
4740
|
const currentIndex = BUTTON_ALIGNMENTS.indexOf(currentButtonAlign);
|
|
4505
4741
|
const nextIndex = (currentIndex + 1) % BUTTON_ALIGNMENTS.length;
|
|
@@ -4508,22 +4744,22 @@ var ButtonToolbar = () => {
|
|
|
4508
4744
|
attributes: { ...currentElement.attributes, "align": nextAlign }
|
|
4509
4745
|
});
|
|
4510
4746
|
}, [focusIdx, currentElement, currentButtonAlign, updateElement]);
|
|
4511
|
-
const handleSetFontFamily =
|
|
4747
|
+
const handleSetFontFamily = useCallback21((font) => {
|
|
4512
4748
|
if (!focusIdx || !currentElement) return;
|
|
4513
4749
|
updateElement(focusIdx, {
|
|
4514
4750
|
attributes: { ...currentElement.attributes, "font-family": font }
|
|
4515
4751
|
});
|
|
4516
4752
|
}, [focusIdx, currentElement, updateElement]);
|
|
4517
|
-
const handleFontSizeChange =
|
|
4753
|
+
const handleFontSizeChange = useCallback21((size2) => {
|
|
4518
4754
|
if (!focusIdx || !currentElement) return;
|
|
4519
4755
|
updateElement(focusIdx, {
|
|
4520
4756
|
attributes: { ...currentElement.attributes, "font-size": `${size2}px` }
|
|
4521
4757
|
});
|
|
4522
4758
|
}, [focusIdx, currentElement, updateElement]);
|
|
4523
|
-
return /* @__PURE__ */
|
|
4524
|
-
/* @__PURE__ */
|
|
4525
|
-
/* @__PURE__ */
|
|
4526
|
-
/* @__PURE__ */
|
|
4759
|
+
return /* @__PURE__ */ jsxs36(ToolbarContainer, { children: [
|
|
4760
|
+
/* @__PURE__ */ jsx47(ToolbarContent, { children: /* @__PURE__ */ jsx47(BasicOption, {}) }),
|
|
4761
|
+
/* @__PURE__ */ jsx47(ToolbarSeparator, {}),
|
|
4762
|
+
/* @__PURE__ */ jsx47(
|
|
4527
4763
|
BackgroundColorBtn,
|
|
4528
4764
|
{
|
|
4529
4765
|
activeView,
|
|
@@ -4532,29 +4768,29 @@ var ButtonToolbar = () => {
|
|
|
4532
4768
|
currentBgColor: currentBgColor || "transparent"
|
|
4533
4769
|
}
|
|
4534
4770
|
),
|
|
4535
|
-
/* @__PURE__ */
|
|
4536
|
-
/* @__PURE__ */
|
|
4537
|
-
border.isEnabled && /* @__PURE__ */
|
|
4538
|
-
/* @__PURE__ */
|
|
4771
|
+
/* @__PURE__ */ jsx47(ToolbarSeparator, {}),
|
|
4772
|
+
/* @__PURE__ */ jsxs36(ToolbarContent, { children: [
|
|
4773
|
+
border.isEnabled && /* @__PURE__ */ jsxs36(Tooltip, { children: [
|
|
4774
|
+
/* @__PURE__ */ jsx47(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx47(
|
|
4539
4775
|
Button,
|
|
4540
4776
|
{
|
|
4541
4777
|
variant: "ghost",
|
|
4542
4778
|
className: `shadow-none transition-none cursor-pointer rounded-[12px] ${activeView === "color" && colorTarget === "buttonStrokeColor" ? "bg-muted" : ""}`,
|
|
4543
4779
|
size: "icon",
|
|
4544
4780
|
onClick: handleOpenStrokeColorPicker,
|
|
4545
|
-
children: /* @__PURE__ */
|
|
4781
|
+
children: /* @__PURE__ */ jsx47(
|
|
4546
4782
|
"div",
|
|
4547
4783
|
{
|
|
4548
4784
|
className: "w-5 h-5 rounded-full border justify-center items-center flex",
|
|
4549
4785
|
style: { backgroundColor: border.color },
|
|
4550
|
-
children: /* @__PURE__ */
|
|
4786
|
+
children: /* @__PURE__ */ jsx47("div", { className: "w-[50%] h-[50%] bg-secondary rounded-full" })
|
|
4551
4787
|
}
|
|
4552
4788
|
)
|
|
4553
4789
|
}
|
|
4554
4790
|
) }),
|
|
4555
|
-
/* @__PURE__ */
|
|
4791
|
+
/* @__PURE__ */ jsx47(TooltipContent, { side: "bottom", className: "z-51", children: "Stroke Color" })
|
|
4556
4792
|
] }),
|
|
4557
|
-
/* @__PURE__ */
|
|
4793
|
+
/* @__PURE__ */ jsx47(
|
|
4558
4794
|
StrokeWeight,
|
|
4559
4795
|
{
|
|
4560
4796
|
width: border.width,
|
|
@@ -4563,7 +4799,7 @@ var ButtonToolbar = () => {
|
|
|
4563
4799
|
onEnabledChange: border.setEnabled
|
|
4564
4800
|
}
|
|
4565
4801
|
),
|
|
4566
|
-
/* @__PURE__ */
|
|
4802
|
+
/* @__PURE__ */ jsx47(
|
|
4567
4803
|
BorderRadius,
|
|
4568
4804
|
{
|
|
4569
4805
|
value: borderRadius.value,
|
|
@@ -4571,18 +4807,18 @@ var ButtonToolbar = () => {
|
|
|
4571
4807
|
tooltipText: "Corner Rounding"
|
|
4572
4808
|
}
|
|
4573
4809
|
),
|
|
4574
|
-
/* @__PURE__ */
|
|
4810
|
+
/* @__PURE__ */ jsx47(BetterPadding, { showInnerPadding: true })
|
|
4575
4811
|
] }),
|
|
4576
|
-
/* @__PURE__ */
|
|
4577
|
-
/* @__PURE__ */
|
|
4578
|
-
/* @__PURE__ */
|
|
4812
|
+
/* @__PURE__ */ jsx47(ToolbarSeparator, {}),
|
|
4813
|
+
/* @__PURE__ */ jsxs36(ToolbarContent, { children: [
|
|
4814
|
+
/* @__PURE__ */ jsx47(
|
|
4579
4815
|
FontFamilyDropdown,
|
|
4580
4816
|
{
|
|
4581
4817
|
currentFont: currentFontFamily,
|
|
4582
4818
|
onFontChange: handleSetFontFamily
|
|
4583
4819
|
}
|
|
4584
4820
|
),
|
|
4585
|
-
/* @__PURE__ */
|
|
4821
|
+
/* @__PURE__ */ jsx47(
|
|
4586
4822
|
FontSizeControl,
|
|
4587
4823
|
{
|
|
4588
4824
|
value: currentFontSize,
|
|
@@ -4590,10 +4826,10 @@ var ButtonToolbar = () => {
|
|
|
4590
4826
|
}
|
|
4591
4827
|
)
|
|
4592
4828
|
] }),
|
|
4593
|
-
/* @__PURE__ */
|
|
4594
|
-
/* @__PURE__ */
|
|
4595
|
-
/* @__PURE__ */
|
|
4596
|
-
/* @__PURE__ */
|
|
4829
|
+
/* @__PURE__ */ jsx47(ToolbarSeparator, {}),
|
|
4830
|
+
/* @__PURE__ */ jsxs36(ToolbarContent, { children: [
|
|
4831
|
+
/* @__PURE__ */ jsxs36(Tooltip, { children: [
|
|
4832
|
+
/* @__PURE__ */ jsx47(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs36(
|
|
4597
4833
|
Button,
|
|
4598
4834
|
{
|
|
4599
4835
|
variant: "ghost",
|
|
@@ -4601,8 +4837,8 @@ var ButtonToolbar = () => {
|
|
|
4601
4837
|
size: "icon",
|
|
4602
4838
|
onClick: handleOpenTextColorPicker,
|
|
4603
4839
|
children: [
|
|
4604
|
-
/* @__PURE__ */
|
|
4605
|
-
/* @__PURE__ */
|
|
4840
|
+
/* @__PURE__ */ jsx47(CaseUpperIcon2, {}),
|
|
4841
|
+
/* @__PURE__ */ jsx47(
|
|
4606
4842
|
"span",
|
|
4607
4843
|
{
|
|
4608
4844
|
className: "w-[14px] h-[3px] rounded-full",
|
|
@@ -4612,62 +4848,62 @@ var ButtonToolbar = () => {
|
|
|
4612
4848
|
]
|
|
4613
4849
|
}
|
|
4614
4850
|
) }),
|
|
4615
|
-
/* @__PURE__ */
|
|
4851
|
+
/* @__PURE__ */ jsx47(TooltipContent, { side: "bottom", children: "Text Color" })
|
|
4616
4852
|
] }),
|
|
4617
|
-
/* @__PURE__ */
|
|
4618
|
-
/* @__PURE__ */
|
|
4853
|
+
/* @__PURE__ */ jsxs36(Tooltip, { children: [
|
|
4854
|
+
/* @__PURE__ */ jsx47(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx47(
|
|
4619
4855
|
Button,
|
|
4620
4856
|
{
|
|
4621
4857
|
variant: "ghost",
|
|
4622
4858
|
className: `shadow-none transition-none cursor-pointer ${isBold ? "bg-muted" : ""}`,
|
|
4623
4859
|
size: "icon",
|
|
4624
4860
|
onClick: handleToggleBold,
|
|
4625
|
-
children: /* @__PURE__ */
|
|
4861
|
+
children: /* @__PURE__ */ jsx47(BoldIcon2, {})
|
|
4626
4862
|
}
|
|
4627
4863
|
) }),
|
|
4628
|
-
/* @__PURE__ */
|
|
4864
|
+
/* @__PURE__ */ jsx47(TooltipContent, { side: "bottom", children: "Bold" })
|
|
4629
4865
|
] }),
|
|
4630
|
-
/* @__PURE__ */
|
|
4631
|
-
/* @__PURE__ */
|
|
4866
|
+
/* @__PURE__ */ jsxs36(Tooltip, { children: [
|
|
4867
|
+
/* @__PURE__ */ jsx47(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx47(
|
|
4632
4868
|
Button,
|
|
4633
4869
|
{
|
|
4634
4870
|
variant: "ghost",
|
|
4635
4871
|
className: `shadow-none transition-none cursor-pointer ${isItalic ? "bg-muted" : ""}`,
|
|
4636
4872
|
size: "icon",
|
|
4637
4873
|
onClick: handleToggleItalic,
|
|
4638
|
-
children: /* @__PURE__ */
|
|
4874
|
+
children: /* @__PURE__ */ jsx47(ItalicIcon2, {})
|
|
4639
4875
|
}
|
|
4640
4876
|
) }),
|
|
4641
|
-
/* @__PURE__ */
|
|
4877
|
+
/* @__PURE__ */ jsx47(TooltipContent, { side: "bottom", children: "Italic" })
|
|
4642
4878
|
] }),
|
|
4643
|
-
/* @__PURE__ */
|
|
4644
|
-
/* @__PURE__ */
|
|
4879
|
+
/* @__PURE__ */ jsxs36(Tooltip, { children: [
|
|
4880
|
+
/* @__PURE__ */ jsx47(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx47(
|
|
4645
4881
|
Button,
|
|
4646
4882
|
{
|
|
4647
4883
|
variant: "ghost",
|
|
4648
4884
|
className: `shadow-none transition-none cursor-pointer ${isUnderline ? "bg-muted" : ""}`,
|
|
4649
4885
|
size: "icon",
|
|
4650
4886
|
onClick: handleToggleUnderline,
|
|
4651
|
-
children: /* @__PURE__ */
|
|
4887
|
+
children: /* @__PURE__ */ jsx47(Underline2, {})
|
|
4652
4888
|
}
|
|
4653
4889
|
) }),
|
|
4654
|
-
/* @__PURE__ */
|
|
4890
|
+
/* @__PURE__ */ jsx47(TooltipContent, { side: "bottom", children: "Underline" })
|
|
4655
4891
|
] }),
|
|
4656
|
-
/* @__PURE__ */
|
|
4657
|
-
/* @__PURE__ */
|
|
4892
|
+
/* @__PURE__ */ jsxs36(Tooltip, { children: [
|
|
4893
|
+
/* @__PURE__ */ jsx47(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx47(
|
|
4658
4894
|
Button,
|
|
4659
4895
|
{
|
|
4660
4896
|
variant: "ghost",
|
|
4661
4897
|
className: `shadow-none transition-none cursor-pointer ${isStrikethrough ? "bg-muted" : ""}`,
|
|
4662
4898
|
size: "icon",
|
|
4663
4899
|
onClick: handleToggleStrike,
|
|
4664
|
-
children: /* @__PURE__ */
|
|
4900
|
+
children: /* @__PURE__ */ jsx47(Strikethrough2, {})
|
|
4665
4901
|
}
|
|
4666
4902
|
) }),
|
|
4667
|
-
/* @__PURE__ */
|
|
4903
|
+
/* @__PURE__ */ jsx47(TooltipContent, { side: "bottom", children: "Strikethrough" })
|
|
4668
4904
|
] }),
|
|
4669
|
-
/* @__PURE__ */
|
|
4670
|
-
/* @__PURE__ */
|
|
4905
|
+
/* @__PURE__ */ jsxs36(Tooltip, { children: [
|
|
4906
|
+
/* @__PURE__ */ jsx47(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx47(
|
|
4671
4907
|
Button,
|
|
4672
4908
|
{
|
|
4673
4909
|
variant: "ghost",
|
|
@@ -4676,46 +4912,47 @@ var ButtonToolbar = () => {
|
|
|
4676
4912
|
onClick: handleCycleAlignment,
|
|
4677
4913
|
children: (() => {
|
|
4678
4914
|
const AlignIcon = TEXT_ALIGNMENT_ICONS[currentAlignment];
|
|
4679
|
-
return /* @__PURE__ */
|
|
4915
|
+
return /* @__PURE__ */ jsx47(AlignIcon, {});
|
|
4680
4916
|
})()
|
|
4681
4917
|
}
|
|
4682
4918
|
) }),
|
|
4683
|
-
/* @__PURE__ */
|
|
4684
|
-
] })
|
|
4919
|
+
/* @__PURE__ */ jsx47(TooltipContent, { side: "bottom", children: "Alignment" })
|
|
4920
|
+
] }),
|
|
4921
|
+
/* @__PURE__ */ jsx47(ButtonTextSettings, {})
|
|
4685
4922
|
] }),
|
|
4686
|
-
/* @__PURE__ */
|
|
4687
|
-
/* @__PURE__ */
|
|
4688
|
-
/* @__PURE__ */
|
|
4923
|
+
/* @__PURE__ */ jsx47(ToolbarSeparator, {}),
|
|
4924
|
+
/* @__PURE__ */ jsx47(ToolbarContent, { children: /* @__PURE__ */ jsxs36(Tooltip, { children: [
|
|
4925
|
+
/* @__PURE__ */ jsx47(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx47(
|
|
4689
4926
|
Button,
|
|
4690
4927
|
{
|
|
4691
4928
|
variant: "ghost",
|
|
4692
4929
|
className: "shadow-none transition-none cursor-pointer",
|
|
4693
4930
|
size: "icon",
|
|
4694
4931
|
onClick: handleCycleButtonAlign,
|
|
4695
|
-
children: /* @__PURE__ */
|
|
4932
|
+
children: /* @__PURE__ */ jsx47("img", { src: ALIGNMENT_ICONS[currentButtonAlign], alt: "Align", className: "w-4 h-4" })
|
|
4696
4933
|
}
|
|
4697
4934
|
) }),
|
|
4698
|
-
/* @__PURE__ */
|
|
4935
|
+
/* @__PURE__ */ jsx47(TooltipContent, { side: "bottom", children: "Align" })
|
|
4699
4936
|
] }) })
|
|
4700
4937
|
] });
|
|
4701
4938
|
};
|
|
4702
4939
|
|
|
4703
4940
|
// src/core/editor/components/element-gear/section/toolbar.tsx
|
|
4704
|
-
import { useCallback as
|
|
4941
|
+
import { useCallback as useCallback23, useMemo as useMemo20 } from "react";
|
|
4705
4942
|
import { get as lodashGet9 } from "lodash";
|
|
4706
4943
|
|
|
4707
4944
|
// src/core/editor/components/image-menu.tsx
|
|
4708
4945
|
import { ImageIcon, TrashIcon as TrashIcon4, UploadIcon } from "lucide-react";
|
|
4709
|
-
import { useState as
|
|
4946
|
+
import { useState as useState14 } from "react";
|
|
4710
4947
|
|
|
4711
4948
|
// src/core/editor/hooks/use-image.ts
|
|
4712
|
-
import { useMemo as
|
|
4949
|
+
import { useMemo as useMemo19, useCallback as useCallback22 } from "react";
|
|
4713
4950
|
import { get as lodashGet8 } from "lodash";
|
|
4714
4951
|
var useImage = (options = {}) => {
|
|
4715
4952
|
const { type = "background" } = options;
|
|
4716
4953
|
const attributeName = type === "image" ? "src" : type === "property" ? "image-src" : "background-url";
|
|
4717
4954
|
const { focusIdx, updateElement, template } = useEditorStore();
|
|
4718
|
-
const { element, url, positionX, positionY, backgroundSize, backgroundRepeat, width, height } =
|
|
4955
|
+
const { element, url, positionX, positionY, backgroundSize, backgroundRepeat, width, height } = useMemo19(() => {
|
|
4719
4956
|
if (!focusIdx || !template) {
|
|
4720
4957
|
return {
|
|
4721
4958
|
element: null,
|
|
@@ -4741,49 +4978,49 @@ var useImage = (options = {}) => {
|
|
|
4741
4978
|
height: el?.attributes?.["height"] || "auto"
|
|
4742
4979
|
};
|
|
4743
4980
|
}, [focusIdx, template, attributeName]);
|
|
4744
|
-
const setUrl =
|
|
4981
|
+
const setUrl = useCallback22((newUrl) => {
|
|
4745
4982
|
if (!focusIdx || !element) return;
|
|
4746
4983
|
updateElement(focusIdx, {
|
|
4747
4984
|
attributes: { ...element.attributes, [attributeName]: newUrl }
|
|
4748
4985
|
});
|
|
4749
4986
|
}, [focusIdx, element, updateElement, attributeName]);
|
|
4750
|
-
const removeUrl =
|
|
4987
|
+
const removeUrl = useCallback22(() => {
|
|
4751
4988
|
if (!focusIdx || !element) return;
|
|
4752
4989
|
const newAttributes = { ...element.attributes };
|
|
4753
4990
|
delete newAttributes[attributeName];
|
|
4754
4991
|
updateElement(focusIdx, { attributes: newAttributes });
|
|
4755
4992
|
}, [focusIdx, element, updateElement, attributeName]);
|
|
4756
|
-
const setPositionX =
|
|
4993
|
+
const setPositionX = useCallback22((value) => {
|
|
4757
4994
|
if (!focusIdx || !element) return;
|
|
4758
4995
|
updateElement(focusIdx, {
|
|
4759
4996
|
attributes: { ...element.attributes, "background-position-x": value }
|
|
4760
4997
|
});
|
|
4761
4998
|
}, [focusIdx, element, updateElement]);
|
|
4762
|
-
const setPositionY =
|
|
4999
|
+
const setPositionY = useCallback22((value) => {
|
|
4763
5000
|
if (!focusIdx || !element) return;
|
|
4764
5001
|
updateElement(focusIdx, {
|
|
4765
5002
|
attributes: { ...element.attributes, "background-position-y": value }
|
|
4766
5003
|
});
|
|
4767
5004
|
}, [focusIdx, element, updateElement]);
|
|
4768
|
-
const setBackgroundSize =
|
|
5005
|
+
const setBackgroundSize = useCallback22((value) => {
|
|
4769
5006
|
if (!focusIdx || !element) return;
|
|
4770
5007
|
updateElement(focusIdx, {
|
|
4771
5008
|
attributes: { ...element.attributes, "background-size": value }
|
|
4772
5009
|
});
|
|
4773
5010
|
}, [focusIdx, element, updateElement]);
|
|
4774
|
-
const setBackgroundRepeat =
|
|
5011
|
+
const setBackgroundRepeat = useCallback22((value) => {
|
|
4775
5012
|
if (!focusIdx || !element) return;
|
|
4776
5013
|
updateElement(focusIdx, {
|
|
4777
5014
|
attributes: { ...element.attributes, "background-repeat": value }
|
|
4778
5015
|
});
|
|
4779
5016
|
}, [focusIdx, element, updateElement]);
|
|
4780
|
-
const setWidth =
|
|
5017
|
+
const setWidth = useCallback22((value) => {
|
|
4781
5018
|
if (!focusIdx || !element) return;
|
|
4782
5019
|
updateElement(focusIdx, {
|
|
4783
5020
|
attributes: { ...element.attributes, width: value }
|
|
4784
5021
|
});
|
|
4785
5022
|
}, [focusIdx, element, updateElement]);
|
|
4786
|
-
const setHeight =
|
|
5023
|
+
const setHeight = useCallback22((value) => {
|
|
4787
5024
|
if (!focusIdx || !element) return;
|
|
4788
5025
|
updateElement(focusIdx, {
|
|
4789
5026
|
attributes: { ...element.attributes, height: value }
|
|
@@ -4809,7 +5046,7 @@ var useImage = (options = {}) => {
|
|
|
4809
5046
|
};
|
|
4810
5047
|
|
|
4811
5048
|
// src/core/editor/components/image-options.tsx
|
|
4812
|
-
import { jsx as
|
|
5049
|
+
import { jsx as jsx48, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4813
5050
|
var ImageOptions = () => {
|
|
4814
5051
|
const { width, height, setWidth, setHeight } = useImage({ type: "image" });
|
|
4815
5052
|
const parsedWidth = parseInt(width.replace("px", ""), 10);
|
|
@@ -4834,10 +5071,10 @@ var ImageOptions = () => {
|
|
|
4834
5071
|
setHeight(`${numValue}px`);
|
|
4835
5072
|
}
|
|
4836
5073
|
};
|
|
4837
|
-
return /* @__PURE__ */
|
|
4838
|
-
/* @__PURE__ */
|
|
4839
|
-
/* @__PURE__ */
|
|
4840
|
-
/* @__PURE__ */
|
|
5074
|
+
return /* @__PURE__ */ jsx48("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx48("div", { className: "flex flex-row items-center gap-2 w-full", children: /* @__PURE__ */ jsxs37("div", { className: "flex flex-row gap-2 flex-1", children: [
|
|
5075
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex flex-row items-center gap-1.5 flex-1", children: [
|
|
5076
|
+
/* @__PURE__ */ jsx48(Label, { htmlFor: "width", className: "text-xs text-muted-foreground", children: "W" }),
|
|
5077
|
+
/* @__PURE__ */ jsx48(
|
|
4841
5078
|
Input,
|
|
4842
5079
|
{
|
|
4843
5080
|
id: "width",
|
|
@@ -4851,9 +5088,9 @@ var ImageOptions = () => {
|
|
|
4851
5088
|
}
|
|
4852
5089
|
)
|
|
4853
5090
|
] }),
|
|
4854
|
-
/* @__PURE__ */
|
|
4855
|
-
/* @__PURE__ */
|
|
4856
|
-
/* @__PURE__ */
|
|
5091
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex flex-row items-center gap-1.5 flex-1", children: [
|
|
5092
|
+
/* @__PURE__ */ jsx48(Label, { htmlFor: "height", className: "text-xs text-muted-foreground", children: "H" }),
|
|
5093
|
+
/* @__PURE__ */ jsx48(
|
|
4857
5094
|
Input,
|
|
4858
5095
|
{
|
|
4859
5096
|
id: "height",
|
|
@@ -4872,7 +5109,7 @@ var ImageOptions = () => {
|
|
|
4872
5109
|
|
|
4873
5110
|
// src/core/editor/components/bg-img-options.tsx
|
|
4874
5111
|
import { Scaling, Repeat } from "lucide-react";
|
|
4875
|
-
import { jsx as
|
|
5112
|
+
import { jsx as jsx49, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
4876
5113
|
var BgImgOptions = () => {
|
|
4877
5114
|
const {
|
|
4878
5115
|
positionX,
|
|
@@ -4884,51 +5121,51 @@ var BgImgOptions = () => {
|
|
|
4884
5121
|
backgroundRepeat,
|
|
4885
5122
|
setBackgroundRepeat
|
|
4886
5123
|
} = useImage({ type: "background" });
|
|
4887
|
-
return /* @__PURE__ */
|
|
4888
|
-
/* @__PURE__ */
|
|
4889
|
-
/* @__PURE__ */
|
|
4890
|
-
/* @__PURE__ */
|
|
4891
|
-
/* @__PURE__ */
|
|
4892
|
-
/* @__PURE__ */
|
|
4893
|
-
/* @__PURE__ */
|
|
4894
|
-
/* @__PURE__ */
|
|
4895
|
-
/* @__PURE__ */
|
|
4896
|
-
/* @__PURE__ */
|
|
5124
|
+
return /* @__PURE__ */ jsxs38("div", { className: "flex flex-col gap-2", children: [
|
|
5125
|
+
/* @__PURE__ */ jsx49("div", { className: "flex flex-row items-center gap-2 w-full", children: /* @__PURE__ */ jsxs38("div", { className: "flex flex-row gap-2 flex-1", children: [
|
|
5126
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex flex-row items-center gap-1.5 flex-1", children: [
|
|
5127
|
+
/* @__PURE__ */ jsx49(Label, { className: "text-xs text-muted-foreground", children: "X" }),
|
|
5128
|
+
/* @__PURE__ */ jsxs38(Select, { value: positionX, onValueChange: setPositionX, children: [
|
|
5129
|
+
/* @__PURE__ */ jsx49(SelectTrigger, { className: "w-full rounded-[12px] shadow-none", children: /* @__PURE__ */ jsx49(SelectValue, { placeholder: "X Position" }) }),
|
|
5130
|
+
/* @__PURE__ */ jsx49(SelectContent, { className: "z-51", children: /* @__PURE__ */ jsxs38(SelectGroup, { children: [
|
|
5131
|
+
/* @__PURE__ */ jsx49(SelectItem, { value: "left", children: "Left" }),
|
|
5132
|
+
/* @__PURE__ */ jsx49(SelectItem, { value: "center", children: "Center" }),
|
|
5133
|
+
/* @__PURE__ */ jsx49(SelectItem, { value: "right", children: "Right" })
|
|
4897
5134
|
] }) })
|
|
4898
5135
|
] })
|
|
4899
5136
|
] }),
|
|
4900
|
-
/* @__PURE__ */
|
|
4901
|
-
/* @__PURE__ */
|
|
4902
|
-
/* @__PURE__ */
|
|
4903
|
-
/* @__PURE__ */
|
|
4904
|
-
/* @__PURE__ */
|
|
4905
|
-
/* @__PURE__ */
|
|
4906
|
-
/* @__PURE__ */
|
|
4907
|
-
/* @__PURE__ */
|
|
5137
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex flex-row items-center gap-1.5 flex-1", children: [
|
|
5138
|
+
/* @__PURE__ */ jsx49(Label, { className: "text-xs text-muted-foreground", children: "Y" }),
|
|
5139
|
+
/* @__PURE__ */ jsxs38(Select, { value: positionY, onValueChange: setPositionY, children: [
|
|
5140
|
+
/* @__PURE__ */ jsx49(SelectTrigger, { className: "w-full rounded-[12px] shadow-none", children: /* @__PURE__ */ jsx49(SelectValue, { placeholder: "Y Position" }) }),
|
|
5141
|
+
/* @__PURE__ */ jsx49(SelectContent, { className: "z-51", children: /* @__PURE__ */ jsxs38(SelectGroup, { children: [
|
|
5142
|
+
/* @__PURE__ */ jsx49(SelectItem, { value: "top", children: "Top" }),
|
|
5143
|
+
/* @__PURE__ */ jsx49(SelectItem, { value: "center", children: "Center" }),
|
|
5144
|
+
/* @__PURE__ */ jsx49(SelectItem, { value: "bottom", children: "Bottom" })
|
|
4908
5145
|
] }) })
|
|
4909
5146
|
] })
|
|
4910
5147
|
] })
|
|
4911
5148
|
] }) }),
|
|
4912
|
-
/* @__PURE__ */
|
|
4913
|
-
/* @__PURE__ */
|
|
4914
|
-
/* @__PURE__ */
|
|
4915
|
-
/* @__PURE__ */
|
|
4916
|
-
/* @__PURE__ */
|
|
4917
|
-
/* @__PURE__ */
|
|
4918
|
-
/* @__PURE__ */
|
|
4919
|
-
/* @__PURE__ */
|
|
4920
|
-
/* @__PURE__ */
|
|
4921
|
-
/* @__PURE__ */
|
|
5149
|
+
/* @__PURE__ */ jsx49(Separator, { className: "my-2" }),
|
|
5150
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex flex-col items-center gap-2 ", children: [
|
|
5151
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex flex-row items-center gap-2 w-full", children: [
|
|
5152
|
+
/* @__PURE__ */ jsx49(Scaling, { size: 18, className: "text-muted-foreground" }),
|
|
5153
|
+
/* @__PURE__ */ jsxs38(Select, { value: backgroundSize, onValueChange: setBackgroundSize, children: [
|
|
5154
|
+
/* @__PURE__ */ jsx49(SelectTrigger, { className: "w-full rounded-[12px] shadow-none", children: /* @__PURE__ */ jsx49(SelectValue, { placeholder: "Background Size" }) }),
|
|
5155
|
+
/* @__PURE__ */ jsx49(SelectContent, { className: "z-51", children: /* @__PURE__ */ jsxs38(SelectGroup, { children: [
|
|
5156
|
+
/* @__PURE__ */ jsx49(SelectItem, { value: "auto", children: "Auto" }),
|
|
5157
|
+
/* @__PURE__ */ jsx49(SelectItem, { value: "cover", children: "Cover" }),
|
|
5158
|
+
/* @__PURE__ */ jsx49(SelectItem, { value: "contain", children: "Contain" })
|
|
4922
5159
|
] }) })
|
|
4923
5160
|
] })
|
|
4924
5161
|
] }),
|
|
4925
|
-
/* @__PURE__ */
|
|
4926
|
-
/* @__PURE__ */
|
|
4927
|
-
/* @__PURE__ */
|
|
4928
|
-
/* @__PURE__ */
|
|
4929
|
-
/* @__PURE__ */
|
|
4930
|
-
/* @__PURE__ */
|
|
4931
|
-
/* @__PURE__ */
|
|
5162
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex flex-row items-center gap-2 w-full", children: [
|
|
5163
|
+
/* @__PURE__ */ jsx49(Repeat, { size: 18, className: "text-muted-foreground" }),
|
|
5164
|
+
/* @__PURE__ */ jsxs38(Select, { value: backgroundRepeat, onValueChange: setBackgroundRepeat, children: [
|
|
5165
|
+
/* @__PURE__ */ jsx49(SelectTrigger, { className: "w-full rounded-[12px] shadow-none", children: /* @__PURE__ */ jsx49(SelectValue, { placeholder: "Background Repeat" }) }),
|
|
5166
|
+
/* @__PURE__ */ jsx49(SelectContent, { className: "z-51", children: /* @__PURE__ */ jsxs38(SelectGroup, { children: [
|
|
5167
|
+
/* @__PURE__ */ jsx49(SelectItem, { value: "repeat", children: "Repeat" }),
|
|
5168
|
+
/* @__PURE__ */ jsx49(SelectItem, { value: "no-repeat", children: "No Repeat" })
|
|
4932
5169
|
] }) })
|
|
4933
5170
|
] })
|
|
4934
5171
|
] })
|
|
@@ -4937,9 +5174,9 @@ var BgImgOptions = () => {
|
|
|
4937
5174
|
};
|
|
4938
5175
|
|
|
4939
5176
|
// src/core/editor/components/image-menu.tsx
|
|
4940
|
-
import { Fragment as Fragment5, jsx as
|
|
5177
|
+
import { Fragment as Fragment5, jsx as jsx50, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
4941
5178
|
var ImageMenu = ({ type }) => {
|
|
4942
|
-
const [isOpen, setIsOpen] =
|
|
5179
|
+
const [isOpen, setIsOpen] = useState14(false);
|
|
4943
5180
|
const { setActiveView, setImageTarget } = useSidebarContext();
|
|
4944
5181
|
const { url, removeUrl } = useImage({ type });
|
|
4945
5182
|
const handleSelectImage = () => {
|
|
@@ -4952,41 +5189,41 @@ var ImageMenu = ({ type }) => {
|
|
|
4952
5189
|
removeUrl();
|
|
4953
5190
|
setIsOpen(false);
|
|
4954
5191
|
};
|
|
4955
|
-
return /* @__PURE__ */
|
|
4956
|
-
/* @__PURE__ */
|
|
4957
|
-
/* @__PURE__ */
|
|
5192
|
+
return /* @__PURE__ */ jsxs39(Tooltip, { children: [
|
|
5193
|
+
/* @__PURE__ */ jsxs39(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
5194
|
+
/* @__PURE__ */ jsx50(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx50(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx50(
|
|
4958
5195
|
Button,
|
|
4959
5196
|
{
|
|
4960
5197
|
variant: "outline",
|
|
4961
5198
|
className: "shadow-none transition-none cursor-pointer rounded-[12px]",
|
|
4962
5199
|
size: "icon",
|
|
4963
|
-
children: url && !url.includes("https://placehold.co/600x200") ? /* @__PURE__ */
|
|
5200
|
+
children: url && !url.includes("https://placehold.co/600x200") ? /* @__PURE__ */ jsx50("img", { src: url, alt: "Background Image", className: "w-full h-full object-cover rounded-[12px]" }) : /* @__PURE__ */ jsx50(ImageIcon, { className: "w-4 h-4" })
|
|
4964
5201
|
}
|
|
4965
5202
|
) }) }),
|
|
4966
|
-
/* @__PURE__ */
|
|
4967
|
-
/* @__PURE__ */
|
|
4968
|
-
/* @__PURE__ */
|
|
4969
|
-
/* @__PURE__ */
|
|
5203
|
+
/* @__PURE__ */ jsxs39(PopoverContent, { className: "w-64 z-51 mt-1 rounded-[12px] p-3", children: [
|
|
5204
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex flex-row gap-2", children: [
|
|
5205
|
+
/* @__PURE__ */ jsxs39(Button, { variant: "outline", className: "w-full flex-1 cursor-pointer shadow-none transition-none", onClick: handleSelectImage, children: [
|
|
5206
|
+
/* @__PURE__ */ jsx50(UploadIcon, { className: "w-4 h-4" }),
|
|
4970
5207
|
url ? "Change Image" : "Select Image"
|
|
4971
5208
|
] }),
|
|
4972
|
-
/* @__PURE__ */
|
|
5209
|
+
/* @__PURE__ */ jsx50(Button, { disabled: !url, variant: "ghost", size: "icon", className: " cursor-pointer shadow-none transition-none", onClick: handleRemoveImage, children: /* @__PURE__ */ jsx50(TrashIcon4, { className: "w-4 h-4" }) })
|
|
4973
5210
|
] }),
|
|
4974
|
-
type !== "property" && /* @__PURE__ */
|
|
4975
|
-
/* @__PURE__ */
|
|
4976
|
-
/* @__PURE__ */
|
|
5211
|
+
type !== "property" && /* @__PURE__ */ jsxs39(Fragment5, { children: [
|
|
5212
|
+
/* @__PURE__ */ jsx50(Separator, { className: "my-2" }),
|
|
5213
|
+
/* @__PURE__ */ jsx50("div", { children: type === "background" ? /* @__PURE__ */ jsx50(BgImgOptions, {}) : /* @__PURE__ */ jsx50(ImageOptions, {}) })
|
|
4977
5214
|
] })
|
|
4978
5215
|
] })
|
|
4979
5216
|
] }),
|
|
4980
|
-
/* @__PURE__ */
|
|
5217
|
+
/* @__PURE__ */ jsx50(TooltipContent, { side: "bottom", className: "z-51", children: /* @__PURE__ */ jsx50("p", { children: type === "background" ? "Background Image" : type === "image" ? "Image" : "Property Image" }) })
|
|
4981
5218
|
] });
|
|
4982
5219
|
};
|
|
4983
5220
|
|
|
4984
5221
|
// src/core/editor/components/element-gear/section/toolbar.tsx
|
|
4985
|
-
import { jsx as
|
|
5222
|
+
import { jsx as jsx51, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
4986
5223
|
var SectionToolbar = () => {
|
|
4987
5224
|
const { focusIdx, deleteElement, template } = useEditorStore();
|
|
4988
5225
|
const { activeView, colorTarget, setActiveView, setColorType, setColorTarget } = useSidebarContext();
|
|
4989
|
-
const currentBgColor =
|
|
5226
|
+
const currentBgColor = useMemo20(() => {
|
|
4990
5227
|
if (!focusIdx || !template) return void 0;
|
|
4991
5228
|
const path = focusIdx.startsWith("content.") ? focusIdx.replace("content.", "content[0].").replace(/\.\[(\d+)\]/g, "[$1]") : focusIdx;
|
|
4992
5229
|
const element = lodashGet9(template, path);
|
|
@@ -5000,21 +5237,21 @@ var SectionToolbar = () => {
|
|
|
5000
5237
|
deleteElement(focusIdx);
|
|
5001
5238
|
}
|
|
5002
5239
|
};
|
|
5003
|
-
const handleOpenBgColorPicker =
|
|
5240
|
+
const handleOpenBgColorPicker = useCallback23(() => {
|
|
5004
5241
|
setColorType("Background Color");
|
|
5005
5242
|
setColorTarget("sectionBgColor");
|
|
5006
5243
|
setActiveView("color");
|
|
5007
5244
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
5008
|
-
const handleOpenStrokeColorPicker =
|
|
5245
|
+
const handleOpenStrokeColorPicker = useCallback23(() => {
|
|
5009
5246
|
setColorType("Stroke Color");
|
|
5010
5247
|
setColorTarget("strokeColor");
|
|
5011
5248
|
setActiveView("color");
|
|
5012
5249
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
5013
|
-
return /* @__PURE__ */
|
|
5014
|
-
/* @__PURE__ */
|
|
5015
|
-
/* @__PURE__ */
|
|
5016
|
-
/* @__PURE__ */
|
|
5017
|
-
/* @__PURE__ */
|
|
5250
|
+
return /* @__PURE__ */ jsxs40(ToolbarContainer, { children: [
|
|
5251
|
+
/* @__PURE__ */ jsx51(ToolbarContent, { children: /* @__PURE__ */ jsx51(BasicOption, {}) }),
|
|
5252
|
+
/* @__PURE__ */ jsx51(ToolbarSeparator, {}),
|
|
5253
|
+
/* @__PURE__ */ jsxs40(ToolbarContent, { children: [
|
|
5254
|
+
/* @__PURE__ */ jsx51(
|
|
5018
5255
|
BackgroundColorBtn,
|
|
5019
5256
|
{
|
|
5020
5257
|
activeView,
|
|
@@ -5023,29 +5260,29 @@ var SectionToolbar = () => {
|
|
|
5023
5260
|
currentBgColor: currentBgColor || "transparent"
|
|
5024
5261
|
}
|
|
5025
5262
|
),
|
|
5026
|
-
/* @__PURE__ */
|
|
5027
|
-
/* @__PURE__ */
|
|
5028
|
-
border.isEnabled && /* @__PURE__ */
|
|
5029
|
-
/* @__PURE__ */
|
|
5263
|
+
/* @__PURE__ */ jsx51(ImageMenu, { type: "background" }),
|
|
5264
|
+
/* @__PURE__ */ jsx51(ToolbarSeparator, {}),
|
|
5265
|
+
border.isEnabled && /* @__PURE__ */ jsxs40(Tooltip, { children: [
|
|
5266
|
+
/* @__PURE__ */ jsx51(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx51(
|
|
5030
5267
|
Button,
|
|
5031
5268
|
{
|
|
5032
5269
|
variant: "ghost",
|
|
5033
5270
|
className: `shadow-none transition-none cursor-pointer rounded-[12px] ${activeView === "color" && colorTarget === "strokeColor" ? "bg-muted" : ""}`,
|
|
5034
5271
|
size: "icon",
|
|
5035
5272
|
onClick: handleOpenStrokeColorPicker,
|
|
5036
|
-
children: /* @__PURE__ */
|
|
5273
|
+
children: /* @__PURE__ */ jsx51(
|
|
5037
5274
|
"div",
|
|
5038
5275
|
{
|
|
5039
5276
|
className: "w-5 h-5 rounded-full border justify-center items-center flex",
|
|
5040
5277
|
style: { backgroundColor: border.color },
|
|
5041
|
-
children: /* @__PURE__ */
|
|
5278
|
+
children: /* @__PURE__ */ jsx51("div", { className: "w-[50%] h-[50%] bg-secondary rounded-full" })
|
|
5042
5279
|
}
|
|
5043
5280
|
)
|
|
5044
5281
|
}
|
|
5045
5282
|
) }),
|
|
5046
|
-
/* @__PURE__ */
|
|
5283
|
+
/* @__PURE__ */ jsx51(TooltipContent, { side: "bottom", className: "z-51", children: "Stroke Color" })
|
|
5047
5284
|
] }),
|
|
5048
|
-
/* @__PURE__ */
|
|
5285
|
+
/* @__PURE__ */ jsx51(
|
|
5049
5286
|
StrokeWeight,
|
|
5050
5287
|
{
|
|
5051
5288
|
width: border.width,
|
|
@@ -5054,7 +5291,7 @@ var SectionToolbar = () => {
|
|
|
5054
5291
|
onEnabledChange: border.setEnabled
|
|
5055
5292
|
}
|
|
5056
5293
|
),
|
|
5057
|
-
/* @__PURE__ */
|
|
5294
|
+
/* @__PURE__ */ jsx51(
|
|
5058
5295
|
BorderRadius,
|
|
5059
5296
|
{
|
|
5060
5297
|
value: borderRadius.value,
|
|
@@ -5062,26 +5299,32 @@ var SectionToolbar = () => {
|
|
|
5062
5299
|
tooltipText: "Corner Rounding"
|
|
5063
5300
|
}
|
|
5064
5301
|
),
|
|
5065
|
-
/* @__PURE__ */
|
|
5302
|
+
/* @__PURE__ */ jsx51(BetterPadding, {})
|
|
5066
5303
|
] })
|
|
5067
5304
|
] });
|
|
5068
5305
|
};
|
|
5069
5306
|
|
|
5070
5307
|
// src/core/editor/components/element-gear/section-column/toolbar.tsx
|
|
5071
|
-
import { useCallback as
|
|
5308
|
+
import { useCallback as useCallback24, useMemo as useMemo21, useState as useState15 } from "react";
|
|
5072
5309
|
import { CheckIcon as CheckIcon6, Columns2Icon, Columns3Icon, Columns4Icon } from "lucide-react";
|
|
5073
5310
|
import { get as lodashGet10 } from "lodash";
|
|
5074
|
-
import { jsx as
|
|
5311
|
+
import { jsx as jsx52, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
5312
|
+
var VERTICAL_ALIGNMENTS = ["top", "middle", "bottom"];
|
|
5075
5313
|
var SectionColumnToolbar = () => {
|
|
5076
|
-
const { focusIdx, deleteElement, template, setColumnCount } = useEditorStore();
|
|
5314
|
+
const { focusIdx, deleteElement, template, setColumnCount, updateElement } = useEditorStore();
|
|
5077
5315
|
const { activeView, colorTarget, setActiveView, setColorType, setColorTarget } = useSidebarContext();
|
|
5078
|
-
const [columnCountOpen, setColumnCountOpen] =
|
|
5079
|
-
const
|
|
5316
|
+
const [columnCountOpen, setColumnCountOpen] = useState15(false);
|
|
5317
|
+
const [verticalAlignOpen, setVerticalAlignOpen] = useState15(false);
|
|
5318
|
+
const element = useMemo21(() => {
|
|
5080
5319
|
if (!focusIdx || !template) return null;
|
|
5081
5320
|
const path = focusIdx.startsWith("content.") ? focusIdx.replace("content.", "content[0].").replace(/\.\[(\d+)\]/g, "[$1]") : focusIdx;
|
|
5082
5321
|
return lodashGet10(template, path);
|
|
5083
5322
|
}, [focusIdx, template]);
|
|
5084
5323
|
const columnCount = element?.children?.length || 2;
|
|
5324
|
+
const currentVerticalAlign = useMemo21(() => {
|
|
5325
|
+
const firstChild = element?.children?.[0];
|
|
5326
|
+
return firstChild?.attributes?.["vertical-align"] || "top";
|
|
5327
|
+
}, [element]);
|
|
5085
5328
|
const currentBgColor = element?.attributes?.["background-color"];
|
|
5086
5329
|
const borderRadius = useBorderRadius();
|
|
5087
5330
|
const border = useBorder();
|
|
@@ -5091,21 +5334,30 @@ var SectionColumnToolbar = () => {
|
|
|
5091
5334
|
deleteElement(focusIdx);
|
|
5092
5335
|
}
|
|
5093
5336
|
};
|
|
5094
|
-
const handleOpenBgColorPicker =
|
|
5337
|
+
const handleOpenBgColorPicker = useCallback24(() => {
|
|
5095
5338
|
setColorType("Background Color");
|
|
5096
5339
|
setColorTarget("sectionBgColor");
|
|
5097
5340
|
setActiveView("color");
|
|
5098
5341
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
5099
|
-
const handleOpenStrokeColorPicker =
|
|
5342
|
+
const handleOpenStrokeColorPicker = useCallback24(() => {
|
|
5100
5343
|
setColorType("Stroke Color");
|
|
5101
5344
|
setColorTarget("strokeColor");
|
|
5102
5345
|
setActiveView("color");
|
|
5103
5346
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5347
|
+
const handleVerticalAlignChange = useCallback24((align) => {
|
|
5348
|
+
if (!focusIdx || !element?.children) return;
|
|
5349
|
+
const updatedChildren = element.children.map((child) => ({
|
|
5350
|
+
...child,
|
|
5351
|
+
attributes: { ...child.attributes, "vertical-align": align }
|
|
5352
|
+
}));
|
|
5353
|
+
updateElement(focusIdx, { children: updatedChildren });
|
|
5354
|
+
setVerticalAlignOpen(false);
|
|
5355
|
+
}, [focusIdx, element, updateElement]);
|
|
5356
|
+
return /* @__PURE__ */ jsxs41(ToolbarContainer, { children: [
|
|
5357
|
+
/* @__PURE__ */ jsx52(ToolbarContent, { children: /* @__PURE__ */ jsx52(BasicOption, {}) }),
|
|
5358
|
+
/* @__PURE__ */ jsx52(ToolbarSeparator, {}),
|
|
5359
|
+
/* @__PURE__ */ jsxs41(ToolbarContent, { children: [
|
|
5360
|
+
/* @__PURE__ */ jsx52(
|
|
5109
5361
|
BackgroundColorBtn,
|
|
5110
5362
|
{
|
|
5111
5363
|
activeView,
|
|
@@ -5114,29 +5366,29 @@ var SectionColumnToolbar = () => {
|
|
|
5114
5366
|
currentBgColor: currentBgColor || "transparent"
|
|
5115
5367
|
}
|
|
5116
5368
|
),
|
|
5117
|
-
/* @__PURE__ */
|
|
5118
|
-
/* @__PURE__ */
|
|
5119
|
-
border.isEnabled && /* @__PURE__ */
|
|
5120
|
-
/* @__PURE__ */
|
|
5369
|
+
/* @__PURE__ */ jsx52(ImageMenu, { type: "background" }),
|
|
5370
|
+
/* @__PURE__ */ jsx52(ToolbarSeparator, {}),
|
|
5371
|
+
border.isEnabled && /* @__PURE__ */ jsxs41(Tooltip, { children: [
|
|
5372
|
+
/* @__PURE__ */ jsx52(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx52(
|
|
5121
5373
|
Button,
|
|
5122
5374
|
{
|
|
5123
5375
|
variant: "ghost",
|
|
5124
5376
|
className: `shadow-none transition-none cursor-pointer rounded-[12px] ${activeView === "color" && colorTarget === "strokeColor" ? "bg-muted" : ""}`,
|
|
5125
5377
|
size: "icon",
|
|
5126
5378
|
onClick: handleOpenStrokeColorPicker,
|
|
5127
|
-
children: /* @__PURE__ */
|
|
5379
|
+
children: /* @__PURE__ */ jsx52(
|
|
5128
5380
|
"div",
|
|
5129
5381
|
{
|
|
5130
5382
|
className: "w-5 h-5 rounded-full border justify-center items-center flex",
|
|
5131
5383
|
style: { backgroundColor: border.color },
|
|
5132
|
-
children: /* @__PURE__ */
|
|
5384
|
+
children: /* @__PURE__ */ jsx52("div", { className: "w-[50%] h-[50%] bg-secondary rounded-full" })
|
|
5133
5385
|
}
|
|
5134
5386
|
)
|
|
5135
5387
|
}
|
|
5136
5388
|
) }),
|
|
5137
|
-
/* @__PURE__ */
|
|
5389
|
+
/* @__PURE__ */ jsx52(TooltipContent, { side: "bottom", className: "z-51", children: "Stroke Color" })
|
|
5138
5390
|
] }),
|
|
5139
|
-
/* @__PURE__ */
|
|
5391
|
+
/* @__PURE__ */ jsx52(
|
|
5140
5392
|
StrokeWeight,
|
|
5141
5393
|
{
|
|
5142
5394
|
width: border.width,
|
|
@@ -5145,7 +5397,7 @@ var SectionColumnToolbar = () => {
|
|
|
5145
5397
|
onEnabledChange: border.setEnabled
|
|
5146
5398
|
}
|
|
5147
5399
|
),
|
|
5148
|
-
/* @__PURE__ */
|
|
5400
|
+
/* @__PURE__ */ jsx52(
|
|
5149
5401
|
BorderRadius,
|
|
5150
5402
|
{
|
|
5151
5403
|
value: borderRadius.value,
|
|
@@ -5153,56 +5405,79 @@ var SectionColumnToolbar = () => {
|
|
|
5153
5405
|
tooltipText: "Corner Rounding"
|
|
5154
5406
|
}
|
|
5155
5407
|
),
|
|
5156
|
-
/* @__PURE__ */
|
|
5157
|
-
/* @__PURE__ */
|
|
5158
|
-
/* @__PURE__ */
|
|
5159
|
-
/* @__PURE__ */
|
|
5160
|
-
columnCount === 2 && /* @__PURE__ */
|
|
5161
|
-
columnCount === 3 && /* @__PURE__ */
|
|
5162
|
-
columnCount === 4 && /* @__PURE__ */
|
|
5408
|
+
/* @__PURE__ */ jsx52(BetterPadding, {}),
|
|
5409
|
+
/* @__PURE__ */ jsx52(ToolbarSeparator, {}),
|
|
5410
|
+
/* @__PURE__ */ jsxs41(DropdownMenu, { open: columnCountOpen, onOpenChange: setColumnCountOpen, children: [
|
|
5411
|
+
/* @__PURE__ */ jsx52(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs41(Button, { variant: "ghost", className: `shadow-none transition-none cursor-pointer rounded-[12px] ${columnCountOpen ? "bg-muted" : ""}`, onClick: () => setColumnCountOpen(!columnCountOpen), children: [
|
|
5412
|
+
columnCount === 2 && /* @__PURE__ */ jsx52(Columns2Icon, { className: "w-4 h-4" }),
|
|
5413
|
+
columnCount === 3 && /* @__PURE__ */ jsx52(Columns3Icon, { className: "w-4 h-4" }),
|
|
5414
|
+
columnCount === 4 && /* @__PURE__ */ jsx52(Columns4Icon, { className: "w-4 h-4" })
|
|
5163
5415
|
] }) }),
|
|
5164
|
-
/* @__PURE__ */
|
|
5165
|
-
/* @__PURE__ */
|
|
5166
|
-
/* @__PURE__ */
|
|
5416
|
+
/* @__PURE__ */ jsxs41(DropdownMenuContent, { align: "center", "data-editor-toolbar": "true", className: "z-51", children: [
|
|
5417
|
+
/* @__PURE__ */ jsxs41(DropdownMenuItem, { onClick: () => focusIdx && setColumnCount(focusIdx, 2), children: [
|
|
5418
|
+
/* @__PURE__ */ jsx52(Columns2Icon, { className: "w-4 h-4" }),
|
|
5167
5419
|
"2 Columns",
|
|
5168
|
-
columnCount === 2 && /* @__PURE__ */
|
|
5420
|
+
columnCount === 2 && /* @__PURE__ */ jsx52(CheckIcon6, { className: "w-4 h-4" })
|
|
5169
5421
|
] }),
|
|
5170
|
-
/* @__PURE__ */
|
|
5171
|
-
/* @__PURE__ */
|
|
5422
|
+
/* @__PURE__ */ jsxs41(DropdownMenuItem, { onClick: () => focusIdx && setColumnCount(focusIdx, 3), children: [
|
|
5423
|
+
/* @__PURE__ */ jsx52(Columns3Icon, { className: "w-4 h-4" }),
|
|
5172
5424
|
"3 Columns",
|
|
5173
|
-
columnCount === 3 && /* @__PURE__ */
|
|
5425
|
+
columnCount === 3 && /* @__PURE__ */ jsx52(CheckIcon6, { className: "w-4 h-4" })
|
|
5174
5426
|
] }),
|
|
5175
|
-
/* @__PURE__ */
|
|
5176
|
-
/* @__PURE__ */
|
|
5427
|
+
/* @__PURE__ */ jsxs41(DropdownMenuItem, { onClick: () => focusIdx && setColumnCount(focusIdx, 4), children: [
|
|
5428
|
+
/* @__PURE__ */ jsx52(Columns4Icon, { className: "w-4 h-4" }),
|
|
5177
5429
|
"4 Columns",
|
|
5178
|
-
columnCount === 4 && /* @__PURE__ */
|
|
5430
|
+
columnCount === 4 && /* @__PURE__ */ jsx52(CheckIcon6, { className: "w-4 h-4" })
|
|
5179
5431
|
] })
|
|
5180
5432
|
] })
|
|
5181
|
-
] })
|
|
5433
|
+
] }),
|
|
5434
|
+
/* @__PURE__ */ jsx52(Tooltip, { children: /* @__PURE__ */ jsxs41(DropdownMenu, { open: verticalAlignOpen, onOpenChange: setVerticalAlignOpen, children: [
|
|
5435
|
+
/* @__PURE__ */ jsx52(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx52(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx52(
|
|
5436
|
+
Button,
|
|
5437
|
+
{
|
|
5438
|
+
variant: "outline",
|
|
5439
|
+
className: `shadow-none transition-none cursor-pointer rounded-[12px] gap-1 ${verticalAlignOpen ? "bg-muted" : ""}`,
|
|
5440
|
+
children: currentVerticalAlign.charAt(0).toUpperCase() + currentVerticalAlign.slice(1)
|
|
5441
|
+
}
|
|
5442
|
+
) }) }),
|
|
5443
|
+
/* @__PURE__ */ jsx52(TooltipContent, { side: "bottom", className: "z-51", children: "Vertical Alignment" }),
|
|
5444
|
+
/* @__PURE__ */ jsx52(DropdownMenuContent, { align: "center", "data-editor-toolbar": "true", className: "z-51", children: VERTICAL_ALIGNMENTS.map((align) => /* @__PURE__ */ jsxs41(
|
|
5445
|
+
DropdownMenuItem,
|
|
5446
|
+
{
|
|
5447
|
+
onClick: () => handleVerticalAlignChange(align),
|
|
5448
|
+
className: "gap-2 capitalize",
|
|
5449
|
+
children: [
|
|
5450
|
+
align.charAt(0).toUpperCase() + align.slice(1),
|
|
5451
|
+
currentVerticalAlign === align && /* @__PURE__ */ jsx52(CheckIcon6, { className: "w-4 h-4 ml-auto" })
|
|
5452
|
+
]
|
|
5453
|
+
},
|
|
5454
|
+
align
|
|
5455
|
+
)) })
|
|
5456
|
+
] }) })
|
|
5182
5457
|
] })
|
|
5183
5458
|
] });
|
|
5184
5459
|
};
|
|
5185
5460
|
|
|
5186
5461
|
// src/core/editor/components/element-gear/page/toolbar.tsx
|
|
5187
|
-
import { useCallback as
|
|
5188
|
-
import { jsx as
|
|
5462
|
+
import { useCallback as useCallback25, useMemo as useMemo22 } from "react";
|
|
5463
|
+
import { jsx as jsx53, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
5189
5464
|
var PageToolbar = () => {
|
|
5190
5465
|
const { focusIdx, template } = useEditorStore();
|
|
5191
5466
|
const { activeView, colorTarget, setColorType, setColorTarget, setActiveView } = useSidebarContext();
|
|
5192
|
-
const currentBgColor =
|
|
5467
|
+
const currentBgColor = useMemo22(() => {
|
|
5193
5468
|
if (!focusIdx || !template || focusIdx !== "content") return void 0;
|
|
5194
5469
|
const page = template.content?.[0];
|
|
5195
5470
|
return page?.attributes?.["background-color"];
|
|
5196
5471
|
}, [focusIdx, template]);
|
|
5197
|
-
const handleOpenBgColorPicker =
|
|
5472
|
+
const handleOpenBgColorPicker = useCallback25(() => {
|
|
5198
5473
|
setColorType("Background Color");
|
|
5199
5474
|
setColorTarget("sectionBgColor");
|
|
5200
5475
|
setActiveView("color");
|
|
5201
5476
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
5202
|
-
return /* @__PURE__ */
|
|
5203
|
-
/* @__PURE__ */
|
|
5204
|
-
/* @__PURE__ */
|
|
5205
|
-
/* @__PURE__ */
|
|
5477
|
+
return /* @__PURE__ */ jsxs42(ToolbarContainer, { children: [
|
|
5478
|
+
/* @__PURE__ */ jsx53(ToolbarContent, { children: /* @__PURE__ */ jsx53(BasicOption, {}) }),
|
|
5479
|
+
/* @__PURE__ */ jsx53(ToolbarSeparator, {}),
|
|
5480
|
+
/* @__PURE__ */ jsx53(
|
|
5206
5481
|
BackgroundColorBtn,
|
|
5207
5482
|
{
|
|
5208
5483
|
activeView,
|
|
@@ -5215,14 +5490,14 @@ var PageToolbar = () => {
|
|
|
5215
5490
|
};
|
|
5216
5491
|
|
|
5217
5492
|
// src/core/editor/components/element-gear/spacer/toolbar.tsx
|
|
5218
|
-
import { useCallback as
|
|
5493
|
+
import { useCallback as useCallback27, useMemo as useMemo24 } from "react";
|
|
5219
5494
|
|
|
5220
5495
|
// src/core/editor/hooks/use-height.ts
|
|
5221
|
-
import { useMemo as
|
|
5496
|
+
import { useMemo as useMemo23, useCallback as useCallback26 } from "react";
|
|
5222
5497
|
import { get as lodashGet11 } from "lodash";
|
|
5223
5498
|
var useHeight = () => {
|
|
5224
5499
|
const { focusIdx, updateElement, template } = useEditorStore();
|
|
5225
|
-
const currentValue =
|
|
5500
|
+
const currentValue = useMemo23(() => {
|
|
5226
5501
|
if (!focusIdx || !template) return 12;
|
|
5227
5502
|
const path = focusIdx.startsWith("content.") ? focusIdx.replace("content.", "content[0].").replace(/\.\[(\d+)\]/g, "[$1]") : focusIdx;
|
|
5228
5503
|
const element = lodashGet11(template, path);
|
|
@@ -5231,7 +5506,7 @@ var useHeight = () => {
|
|
|
5231
5506
|
const parsed = parseInt(rawValue.replace("px", ""), 10);
|
|
5232
5507
|
return isNaN(parsed) ? 12 : Math.max(4, parsed);
|
|
5233
5508
|
}, [focusIdx, template]);
|
|
5234
|
-
const handleChange =
|
|
5509
|
+
const handleChange = useCallback26((value) => {
|
|
5235
5510
|
if (!focusIdx || !template) return;
|
|
5236
5511
|
const path = focusIdx.startsWith("content.") ? focusIdx.replace("content.", "content[0].").replace(/\.\[(\d+)\]/g, "[$1]") : focusIdx;
|
|
5237
5512
|
const element = lodashGet11(template, path);
|
|
@@ -5251,27 +5526,27 @@ var useHeight = () => {
|
|
|
5251
5526
|
|
|
5252
5527
|
// src/core/editor/components/element-gear/spacer/toolbar.tsx
|
|
5253
5528
|
import { get as lodashGet12 } from "lodash";
|
|
5254
|
-
import { jsx as
|
|
5529
|
+
import { jsx as jsx54, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
5255
5530
|
var SpacerToolbar = () => {
|
|
5256
5531
|
const { focusIdx, template } = useEditorStore();
|
|
5257
5532
|
const { activeView, colorTarget, setActiveView, setColorType, setColorTarget } = useSidebarContext();
|
|
5258
5533
|
const height = useHeight();
|
|
5259
5534
|
const padding = usePadding();
|
|
5260
|
-
const currentBgColor =
|
|
5535
|
+
const currentBgColor = useMemo24(() => {
|
|
5261
5536
|
if (!focusIdx || !template) return void 0;
|
|
5262
5537
|
const path = focusIdx.startsWith("content.") ? focusIdx.replace("content.", "content[0].").replace(/\.\[(\d+)\]/g, "[$1]") : focusIdx;
|
|
5263
5538
|
const element = lodashGet12(template, path);
|
|
5264
5539
|
return element?.attributes?.["container-background-color"];
|
|
5265
5540
|
}, [focusIdx, template]);
|
|
5266
|
-
const handleOpenBgColorPicker =
|
|
5541
|
+
const handleOpenBgColorPicker = useCallback27(() => {
|
|
5267
5542
|
setColorType("Background Color");
|
|
5268
5543
|
setColorTarget("spacerBgColor");
|
|
5269
5544
|
setActiveView("color");
|
|
5270
5545
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
5271
|
-
return /* @__PURE__ */
|
|
5272
|
-
/* @__PURE__ */
|
|
5273
|
-
/* @__PURE__ */
|
|
5274
|
-
/* @__PURE__ */
|
|
5546
|
+
return /* @__PURE__ */ jsxs43(ToolbarContainer, { children: [
|
|
5547
|
+
/* @__PURE__ */ jsx54(ToolbarContent, { children: /* @__PURE__ */ jsx54(BasicOption, {}) }),
|
|
5548
|
+
/* @__PURE__ */ jsx54(ToolbarSeparator, {}),
|
|
5549
|
+
/* @__PURE__ */ jsx54(ToolbarContent, { children: /* @__PURE__ */ jsx54(
|
|
5275
5550
|
BackgroundColorBtn,
|
|
5276
5551
|
{
|
|
5277
5552
|
activeView,
|
|
@@ -5280,17 +5555,151 @@ var SpacerToolbar = () => {
|
|
|
5280
5555
|
currentBgColor: currentBgColor || "transparent"
|
|
5281
5556
|
}
|
|
5282
5557
|
) }),
|
|
5283
|
-
/* @__PURE__ */
|
|
5284
|
-
/* @__PURE__ */
|
|
5558
|
+
/* @__PURE__ */ jsx54(ToolbarSeparator, {}),
|
|
5559
|
+
/* @__PURE__ */ jsx54(ToolbarContent, { children: /* @__PURE__ */ jsx54(BetterPadding, {}) })
|
|
5285
5560
|
] });
|
|
5286
5561
|
};
|
|
5287
5562
|
|
|
5288
5563
|
// src/core/editor/components/element-gear/social/toolbar.tsx
|
|
5289
|
-
import { BoldIcon as BoldIcon3, CaseUpperIcon as CaseUpperIcon3, CheckIcon as CheckIcon7, ItalicIcon as ItalicIcon3, Scan, Strikethrough as Strikethrough3, Underline as Underline3 } from "lucide-react";
|
|
5290
|
-
import { useCallback as
|
|
5291
|
-
|
|
5564
|
+
import { AlignCenterIcon, AlignLeftIcon, AlignRightIcon, BoldIcon as BoldIcon3, CaseUpperIcon as CaseUpperIcon3, CheckIcon as CheckIcon7, ItalicIcon as ItalicIcon3, Scan, Strikethrough as Strikethrough3, Underline as Underline3 } from "lucide-react";
|
|
5565
|
+
import { useCallback as useCallback29, useMemo as useMemo26 } from "react";
|
|
5566
|
+
|
|
5567
|
+
// src/core/editor/components/social-line-spacing.tsx
|
|
5568
|
+
import { TypeIcon as TypeIcon3 } from "lucide-react";
|
|
5569
|
+
import { useState as useState16, useEffect as useEffect10, useMemo as useMemo25, useCallback as useCallback28, memo as memo5 } from "react";
|
|
5570
|
+
import { jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
5571
|
+
var SocialLineSpacing = memo5(function SocialLineSpacing2() {
|
|
5572
|
+
const [isOpen, setIsOpen] = useState16(false);
|
|
5573
|
+
const focusIdx = useEditorStore((s) => s.focusIdx);
|
|
5574
|
+
const template = useEditorStore((s) => s.template);
|
|
5575
|
+
const updateElement = useEditorStore((s) => s.updateElement);
|
|
5576
|
+
const socialElement = useMemo25(() => {
|
|
5577
|
+
return focusIdx ? getValueByIdx(template, focusIdx) : null;
|
|
5578
|
+
}, [focusIdx, template]);
|
|
5579
|
+
const currentLineHeight = useMemo25(() => {
|
|
5580
|
+
if (!socialElement?.attributes?.["line-height"]) return DEFAULT_LINE_HEIGHT;
|
|
5581
|
+
const parsed = parseFloat(socialElement.attributes["line-height"]);
|
|
5582
|
+
return isNaN(parsed) ? DEFAULT_LINE_HEIGHT : parsed;
|
|
5583
|
+
}, [socialElement]);
|
|
5584
|
+
const [lineHeightInputValue, setLineHeightInputValue] = useState16(
|
|
5585
|
+
String(currentLineHeight)
|
|
5586
|
+
);
|
|
5587
|
+
const [isLineHeightInputFocused, setIsLineHeightInputFocused] = useState16(false);
|
|
5588
|
+
useEffect10(() => {
|
|
5589
|
+
if (!isLineHeightInputFocused) {
|
|
5590
|
+
setLineHeightInputValue(String(currentLineHeight));
|
|
5591
|
+
}
|
|
5592
|
+
}, [currentLineHeight, isLineHeightInputFocused]);
|
|
5593
|
+
const handleLineHeightSliderChange = useCallback28((values) => {
|
|
5594
|
+
if (!focusIdx) return;
|
|
5595
|
+
const value = values[0];
|
|
5596
|
+
setLineHeightInputValue(String(value));
|
|
5597
|
+
const currentTemplate = useEditorStore.getState().template;
|
|
5598
|
+
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
5599
|
+
updateElement(focusIdx, {
|
|
5600
|
+
attributes: {
|
|
5601
|
+
...element?.attributes,
|
|
5602
|
+
"line-height": String(value)
|
|
5603
|
+
}
|
|
5604
|
+
});
|
|
5605
|
+
}, [focusIdx, updateElement]);
|
|
5606
|
+
const handleLineHeightInputChange = useCallback28((e) => {
|
|
5607
|
+
setLineHeightInputValue(e.target.value);
|
|
5608
|
+
}, []);
|
|
5609
|
+
const applyLineHeight = useCallback28(() => {
|
|
5610
|
+
if (!focusIdx) return;
|
|
5611
|
+
const parsed = parseFloat(lineHeightInputValue);
|
|
5612
|
+
if (isNaN(parsed) || lineHeightInputValue === "") {
|
|
5613
|
+
setLineHeightInputValue(String(currentLineHeight));
|
|
5614
|
+
return;
|
|
5615
|
+
}
|
|
5616
|
+
const clampedValue = Math.max(MIN_LINE_HEIGHT, Math.min(parsed, MAX_LINE_HEIGHT));
|
|
5617
|
+
setLineHeightInputValue(String(clampedValue));
|
|
5618
|
+
const currentTemplate = useEditorStore.getState().template;
|
|
5619
|
+
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
5620
|
+
updateElement(focusIdx, {
|
|
5621
|
+
attributes: {
|
|
5622
|
+
...element?.attributes,
|
|
5623
|
+
"line-height": String(clampedValue)
|
|
5624
|
+
}
|
|
5625
|
+
});
|
|
5626
|
+
}, [focusIdx, lineHeightInputValue, currentLineHeight, updateElement]);
|
|
5627
|
+
const handleLineHeightInputBlur = useCallback28(() => {
|
|
5628
|
+
setIsLineHeightInputFocused(false);
|
|
5629
|
+
applyLineHeight();
|
|
5630
|
+
}, [applyLineHeight]);
|
|
5631
|
+
const handleLineHeightInputKeyDown = useCallback28((e) => {
|
|
5632
|
+
if (e.key === "Enter") {
|
|
5633
|
+
e.preventDefault();
|
|
5634
|
+
applyLineHeight();
|
|
5635
|
+
e.target.blur();
|
|
5636
|
+
}
|
|
5637
|
+
}, [applyLineHeight]);
|
|
5638
|
+
return /* @__PURE__ */ jsxs44(Tooltip, { children: [
|
|
5639
|
+
/* @__PURE__ */ jsxs44(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
5640
|
+
/* @__PURE__ */ jsx55(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx55(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx55(
|
|
5641
|
+
Button,
|
|
5642
|
+
{
|
|
5643
|
+
variant: "ghost",
|
|
5644
|
+
className: `shadow-none transition-none cursor-pointer rounded-[12px] ${isOpen ? "bg-muted" : ""}`,
|
|
5645
|
+
size: "icon",
|
|
5646
|
+
disabled: !focusIdx,
|
|
5647
|
+
children: /* @__PURE__ */ jsx55(TypeIcon3, { className: "w-4 h-4" })
|
|
5648
|
+
}
|
|
5649
|
+
) }) }),
|
|
5650
|
+
/* @__PURE__ */ jsx55(
|
|
5651
|
+
PopoverContent,
|
|
5652
|
+
{
|
|
5653
|
+
className: "w-64 z-5001 mt-1 rounded-[12px]",
|
|
5654
|
+
"data-editor-toolbar": "true",
|
|
5655
|
+
children: /* @__PURE__ */ jsx55("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsxs44("div", { className: "flex flex-col gap-3", children: [
|
|
5656
|
+
/* @__PURE__ */ jsx55(Label, { children: "Line spacing" }),
|
|
5657
|
+
/* @__PURE__ */ jsxs44("div", { className: "flex flex-row items-center gap-2", children: [
|
|
5658
|
+
/* @__PURE__ */ jsx55(
|
|
5659
|
+
Slider2,
|
|
5660
|
+
{
|
|
5661
|
+
value: [currentLineHeight],
|
|
5662
|
+
onValueChange: handleLineHeightSliderChange,
|
|
5663
|
+
min: MIN_LINE_HEIGHT,
|
|
5664
|
+
max: MAX_LINE_HEIGHT,
|
|
5665
|
+
step: LINE_HEIGHT_STEP,
|
|
5666
|
+
disabled: !focusIdx
|
|
5667
|
+
}
|
|
5668
|
+
),
|
|
5669
|
+
/* @__PURE__ */ jsx55(
|
|
5670
|
+
Input,
|
|
5671
|
+
{
|
|
5672
|
+
type: "number",
|
|
5673
|
+
value: lineHeightInputValue,
|
|
5674
|
+
onChange: handleLineHeightInputChange,
|
|
5675
|
+
onFocus: () => setIsLineHeightInputFocused(true),
|
|
5676
|
+
onBlur: handleLineHeightInputBlur,
|
|
5677
|
+
onKeyDown: handleLineHeightInputKeyDown,
|
|
5678
|
+
className: "w-25 shadow-none rounded-[12px]",
|
|
5679
|
+
min: MIN_LINE_HEIGHT,
|
|
5680
|
+
max: MAX_LINE_HEIGHT,
|
|
5681
|
+
step: LINE_HEIGHT_STEP,
|
|
5682
|
+
disabled: !focusIdx
|
|
5683
|
+
}
|
|
5684
|
+
)
|
|
5685
|
+
] })
|
|
5686
|
+
] }) })
|
|
5687
|
+
}
|
|
5688
|
+
)
|
|
5689
|
+
] }),
|
|
5690
|
+
/* @__PURE__ */ jsx55(TooltipContent, { side: "bottom", className: "z-5001", children: "Line Spacing" })
|
|
5691
|
+
] });
|
|
5692
|
+
});
|
|
5693
|
+
|
|
5694
|
+
// src/core/editor/components/element-gear/social/toolbar.tsx
|
|
5695
|
+
import { Fragment as Fragment6, jsx as jsx56, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
5292
5696
|
var ALIGNMENTS2 = ["left", "center", "right"];
|
|
5293
5697
|
var MODES = ["horizontal", "vertical"];
|
|
5698
|
+
var SOCIAL_ITEM_ALIGNMENT_ICONS = {
|
|
5699
|
+
left: AlignLeftIcon,
|
|
5700
|
+
center: AlignCenterIcon,
|
|
5701
|
+
right: AlignRightIcon
|
|
5702
|
+
};
|
|
5294
5703
|
var SocialToolbar = () => {
|
|
5295
5704
|
const focusIdx = useEditorStore((state) => state.focusIdx);
|
|
5296
5705
|
const template = useEditorStore((state) => state.template);
|
|
@@ -5301,44 +5710,48 @@ var SocialToolbar = () => {
|
|
|
5301
5710
|
const currentIconStyle = socialElement?.data?.value?.iconStyle || "Regular";
|
|
5302
5711
|
const currentIconColor = socialElement?.data?.value?.iconColor || "Colored";
|
|
5303
5712
|
const { setActiveView, setColorTarget, setColorType, activeView, colorTarget } = useSidebarContext();
|
|
5304
|
-
const currentBgColor =
|
|
5713
|
+
const currentBgColor = useMemo26(() => {
|
|
5305
5714
|
return socialElement?.attributes?.["container-background-color"] || "transparent";
|
|
5306
5715
|
}, [socialElement]);
|
|
5307
|
-
const currentFontFamily =
|
|
5716
|
+
const currentFontFamily = useMemo26(() => {
|
|
5308
5717
|
return socialElement?.attributes?.["font-family"] || "Arial";
|
|
5309
5718
|
}, [socialElement]);
|
|
5310
|
-
const currentFontSize =
|
|
5719
|
+
const currentFontSize = useMemo26(() => {
|
|
5311
5720
|
return parseFontSize(socialElement?.attributes?.["font-size"]);
|
|
5312
5721
|
}, [socialElement]);
|
|
5313
|
-
const currentTextColor =
|
|
5722
|
+
const currentTextColor = useMemo26(() => {
|
|
5314
5723
|
return socialElement?.attributes?.["color"] || "#000000";
|
|
5315
5724
|
}, [socialElement]);
|
|
5316
|
-
const isBold =
|
|
5725
|
+
const isBold = useMemo26(() => {
|
|
5317
5726
|
return socialElement?.attributes?.["font-weight"] === "bold";
|
|
5318
5727
|
}, [socialElement]);
|
|
5319
|
-
const isItalic =
|
|
5728
|
+
const isItalic = useMemo26(() => {
|
|
5320
5729
|
return socialElement?.attributes?.["font-style"] === "italic";
|
|
5321
5730
|
}, [socialElement]);
|
|
5322
|
-
const isUnderline =
|
|
5731
|
+
const isUnderline = useMemo26(() => {
|
|
5323
5732
|
const decoration = socialElement?.attributes?.["text-decoration"] || "";
|
|
5324
5733
|
return decoration.includes("underline");
|
|
5325
5734
|
}, [socialElement]);
|
|
5326
|
-
const isStrikethrough =
|
|
5735
|
+
const isStrikethrough = useMemo26(() => {
|
|
5327
5736
|
const decoration = socialElement?.attributes?.["text-decoration"] || "";
|
|
5328
5737
|
return decoration.includes("line-through");
|
|
5329
5738
|
}, [socialElement]);
|
|
5330
|
-
const currentMode =
|
|
5739
|
+
const currentMode = useMemo26(() => {
|
|
5331
5740
|
return socialElement?.attributes?.["mode"] || "horizontal";
|
|
5332
5741
|
}, [socialElement]);
|
|
5333
|
-
const currentAlign =
|
|
5742
|
+
const currentAlign = useMemo26(() => {
|
|
5334
5743
|
return socialElement?.attributes?.["align"] || "center";
|
|
5335
5744
|
}, [socialElement]);
|
|
5336
|
-
const
|
|
5745
|
+
const currentSocialItemAlign = useMemo26(() => {
|
|
5746
|
+
const firstChild = socialElement?.children?.[0];
|
|
5747
|
+
return firstChild?.attributes?.["align"] || "center";
|
|
5748
|
+
}, [socialElement]);
|
|
5749
|
+
const handleOpenBgColorPicker = useCallback29(() => {
|
|
5337
5750
|
setColorType("Background Color");
|
|
5338
5751
|
setColorTarget("socialBgColor");
|
|
5339
5752
|
setActiveView("color");
|
|
5340
5753
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
5341
|
-
const handleSocialStyleChange =
|
|
5754
|
+
const handleSocialStyleChange = useCallback29((value) => {
|
|
5342
5755
|
if (!focusIdx) return;
|
|
5343
5756
|
const currentTemplate = useEditorStore.getState().template;
|
|
5344
5757
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5353,7 +5766,7 @@ var SocialToolbar = () => {
|
|
|
5353
5766
|
}
|
|
5354
5767
|
});
|
|
5355
5768
|
}, [focusIdx, updateElement]);
|
|
5356
|
-
const handleIconSizeChange =
|
|
5769
|
+
const handleIconSizeChange = useCallback29((value) => {
|
|
5357
5770
|
if (!focusIdx) return;
|
|
5358
5771
|
const currentTemplate = useEditorStore.getState().template;
|
|
5359
5772
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5368,7 +5781,7 @@ var SocialToolbar = () => {
|
|
|
5368
5781
|
}
|
|
5369
5782
|
});
|
|
5370
5783
|
}, [focusIdx, updateElement]);
|
|
5371
|
-
const handleIconStyleChange =
|
|
5784
|
+
const handleIconStyleChange = useCallback29((value) => {
|
|
5372
5785
|
if (!focusIdx) return;
|
|
5373
5786
|
const currentTemplate = useEditorStore.getState().template;
|
|
5374
5787
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5383,7 +5796,7 @@ var SocialToolbar = () => {
|
|
|
5383
5796
|
}
|
|
5384
5797
|
});
|
|
5385
5798
|
}, [focusIdx, updateElement]);
|
|
5386
|
-
const handleIconColorChange =
|
|
5799
|
+
const handleIconColorChange = useCallback29((value) => {
|
|
5387
5800
|
if (!focusIdx) return;
|
|
5388
5801
|
const currentTemplate = useEditorStore.getState().template;
|
|
5389
5802
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5398,7 +5811,7 @@ var SocialToolbar = () => {
|
|
|
5398
5811
|
}
|
|
5399
5812
|
});
|
|
5400
5813
|
}, [focusIdx, updateElement]);
|
|
5401
|
-
const handleSetFontFamily =
|
|
5814
|
+
const handleSetFontFamily = useCallback29((font) => {
|
|
5402
5815
|
if (!focusIdx) return;
|
|
5403
5816
|
const currentTemplate = useEditorStore.getState().template;
|
|
5404
5817
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5409,7 +5822,7 @@ var SocialToolbar = () => {
|
|
|
5409
5822
|
}
|
|
5410
5823
|
});
|
|
5411
5824
|
}, [focusIdx, updateElement]);
|
|
5412
|
-
const handleFontSizeChange =
|
|
5825
|
+
const handleFontSizeChange = useCallback29((size) => {
|
|
5413
5826
|
if (!focusIdx) return;
|
|
5414
5827
|
const currentTemplate = useEditorStore.getState().template;
|
|
5415
5828
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5420,12 +5833,12 @@ var SocialToolbar = () => {
|
|
|
5420
5833
|
}
|
|
5421
5834
|
});
|
|
5422
5835
|
}, [focusIdx, updateElement]);
|
|
5423
|
-
const handleOpenTextColorPicker =
|
|
5836
|
+
const handleOpenTextColorPicker = useCallback29(() => {
|
|
5424
5837
|
setColorType("Text Color");
|
|
5425
5838
|
setColorTarget("socialTextColor");
|
|
5426
5839
|
setActiveView("color");
|
|
5427
5840
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
5428
|
-
const handleToggleBold =
|
|
5841
|
+
const handleToggleBold = useCallback29(() => {
|
|
5429
5842
|
if (!focusIdx) return;
|
|
5430
5843
|
const currentTemplate = useEditorStore.getState().template;
|
|
5431
5844
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5437,7 +5850,7 @@ var SocialToolbar = () => {
|
|
|
5437
5850
|
}
|
|
5438
5851
|
});
|
|
5439
5852
|
}, [focusIdx, isBold, updateElement]);
|
|
5440
|
-
const handleToggleItalic =
|
|
5853
|
+
const handleToggleItalic = useCallback29(() => {
|
|
5441
5854
|
if (!focusIdx) return;
|
|
5442
5855
|
const currentTemplate = useEditorStore.getState().template;
|
|
5443
5856
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5449,7 +5862,7 @@ var SocialToolbar = () => {
|
|
|
5449
5862
|
}
|
|
5450
5863
|
});
|
|
5451
5864
|
}, [focusIdx, isItalic, updateElement]);
|
|
5452
|
-
const handleToggleUnderline =
|
|
5865
|
+
const handleToggleUnderline = useCallback29(() => {
|
|
5453
5866
|
if (!focusIdx) return;
|
|
5454
5867
|
const currentTemplate = useEditorStore.getState().template;
|
|
5455
5868
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5467,7 +5880,7 @@ var SocialToolbar = () => {
|
|
|
5467
5880
|
}
|
|
5468
5881
|
});
|
|
5469
5882
|
}, [focusIdx, isUnderline, updateElement]);
|
|
5470
|
-
const handleToggleStrike =
|
|
5883
|
+
const handleToggleStrike = useCallback29(() => {
|
|
5471
5884
|
if (!focusIdx) return;
|
|
5472
5885
|
const currentTemplate = useEditorStore.getState().template;
|
|
5473
5886
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5485,7 +5898,7 @@ var SocialToolbar = () => {
|
|
|
5485
5898
|
}
|
|
5486
5899
|
});
|
|
5487
5900
|
}, [focusIdx, isStrikethrough, updateElement]);
|
|
5488
|
-
const handleModeChange =
|
|
5901
|
+
const handleModeChange = useCallback29((mode) => {
|
|
5489
5902
|
if (!focusIdx) return;
|
|
5490
5903
|
const currentTemplate = useEditorStore.getState().template;
|
|
5491
5904
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5496,24 +5909,43 @@ var SocialToolbar = () => {
|
|
|
5496
5909
|
}
|
|
5497
5910
|
});
|
|
5498
5911
|
}, [focusIdx, updateElement]);
|
|
5499
|
-
const handleCycleAlign =
|
|
5912
|
+
const handleCycleAlign = useCallback29(() => {
|
|
5500
5913
|
if (!focusIdx) return;
|
|
5501
5914
|
const currentTemplate = useEditorStore.getState().template;
|
|
5502
5915
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
5503
5916
|
const currentIndex = ALIGNMENTS2.indexOf(currentAlign);
|
|
5504
5917
|
const nextIndex = (currentIndex + 1) % ALIGNMENTS2.length;
|
|
5505
5918
|
const nextAlign = ALIGNMENTS2[nextIndex];
|
|
5919
|
+
const updatedChildren = element?.children?.map((child) => ({
|
|
5920
|
+
...child,
|
|
5921
|
+
attributes: { ...child.attributes, align: nextAlign }
|
|
5922
|
+
}));
|
|
5506
5923
|
updateElement(focusIdx, {
|
|
5507
5924
|
attributes: {
|
|
5508
5925
|
...element?.attributes,
|
|
5509
5926
|
"align": nextAlign
|
|
5510
|
-
}
|
|
5927
|
+
},
|
|
5928
|
+
children: updatedChildren
|
|
5511
5929
|
});
|
|
5512
5930
|
}, [focusIdx, currentAlign, updateElement]);
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5931
|
+
const handleCycleSocialItemAlign = useCallback29(() => {
|
|
5932
|
+
if (!focusIdx) return;
|
|
5933
|
+
const currentTemplate = useEditorStore.getState().template;
|
|
5934
|
+
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
5935
|
+
if (!element?.children) return;
|
|
5936
|
+
const currentIndex = ALIGNMENTS2.indexOf(currentSocialItemAlign);
|
|
5937
|
+
const nextIndex = (currentIndex + 1) % ALIGNMENTS2.length;
|
|
5938
|
+
const nextAlign = ALIGNMENTS2[nextIndex];
|
|
5939
|
+
const updatedChildren = element.children.map((child) => ({
|
|
5940
|
+
...child,
|
|
5941
|
+
attributes: { ...child.attributes, align: nextAlign }
|
|
5942
|
+
}));
|
|
5943
|
+
updateElement(focusIdx, { children: updatedChildren });
|
|
5944
|
+
}, [focusIdx, currentSocialItemAlign, updateElement]);
|
|
5945
|
+
return /* @__PURE__ */ jsxs45(ToolbarContainer, { children: [
|
|
5946
|
+
/* @__PURE__ */ jsx56(ToolbarContent, { children: /* @__PURE__ */ jsx56(BasicOption, {}) }),
|
|
5947
|
+
/* @__PURE__ */ jsx56(ToolbarSeparator, {}),
|
|
5948
|
+
/* @__PURE__ */ jsx56(ToolbarContent, { children: /* @__PURE__ */ jsx56(
|
|
5517
5949
|
BackgroundColorBtn,
|
|
5518
5950
|
{
|
|
5519
5951
|
activeView,
|
|
@@ -5522,19 +5954,19 @@ var SocialToolbar = () => {
|
|
|
5522
5954
|
currentBgColor: currentBgColor || "transparent"
|
|
5523
5955
|
}
|
|
5524
5956
|
) }),
|
|
5525
|
-
/* @__PURE__ */
|
|
5526
|
-
/* @__PURE__ */
|
|
5527
|
-
currentSocialStyle !== "Icon" && /* @__PURE__ */
|
|
5528
|
-
/* @__PURE__ */
|
|
5529
|
-
/* @__PURE__ */
|
|
5530
|
-
/* @__PURE__ */
|
|
5957
|
+
/* @__PURE__ */ jsx56(ToolbarSeparator, {}),
|
|
5958
|
+
/* @__PURE__ */ jsx56(ToolbarContent, { children: /* @__PURE__ */ jsx56(BetterPadding, { showInnerPadding: true, showIconPadding: true, showTextPadding: true }) }),
|
|
5959
|
+
currentSocialStyle !== "Icon" && /* @__PURE__ */ jsxs45(Fragment6, { children: [
|
|
5960
|
+
/* @__PURE__ */ jsx56(ToolbarSeparator, {}),
|
|
5961
|
+
/* @__PURE__ */ jsxs45(ToolbarContent, { children: [
|
|
5962
|
+
/* @__PURE__ */ jsx56(
|
|
5531
5963
|
FontFamilyDropdown,
|
|
5532
5964
|
{
|
|
5533
5965
|
currentFont: currentFontFamily,
|
|
5534
5966
|
onFontChange: handleSetFontFamily
|
|
5535
5967
|
}
|
|
5536
5968
|
),
|
|
5537
|
-
/* @__PURE__ */
|
|
5969
|
+
/* @__PURE__ */ jsx56(
|
|
5538
5970
|
FontSizeControl,
|
|
5539
5971
|
{
|
|
5540
5972
|
value: currentFontSize,
|
|
@@ -5542,10 +5974,10 @@ var SocialToolbar = () => {
|
|
|
5542
5974
|
}
|
|
5543
5975
|
)
|
|
5544
5976
|
] }),
|
|
5545
|
-
/* @__PURE__ */
|
|
5546
|
-
/* @__PURE__ */
|
|
5547
|
-
/* @__PURE__ */
|
|
5548
|
-
/* @__PURE__ */
|
|
5977
|
+
/* @__PURE__ */ jsx56(ToolbarSeparator, {}),
|
|
5978
|
+
/* @__PURE__ */ jsxs45(ToolbarContent, { children: [
|
|
5979
|
+
/* @__PURE__ */ jsxs45(Tooltip, { children: [
|
|
5980
|
+
/* @__PURE__ */ jsx56(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs45(
|
|
5549
5981
|
Button,
|
|
5550
5982
|
{
|
|
5551
5983
|
variant: "ghost",
|
|
@@ -5553,8 +5985,8 @@ var SocialToolbar = () => {
|
|
|
5553
5985
|
size: "icon",
|
|
5554
5986
|
onClick: handleOpenTextColorPicker,
|
|
5555
5987
|
children: [
|
|
5556
|
-
/* @__PURE__ */
|
|
5557
|
-
/* @__PURE__ */
|
|
5988
|
+
/* @__PURE__ */ jsx56(CaseUpperIcon3, {}),
|
|
5989
|
+
/* @__PURE__ */ jsx56(
|
|
5558
5990
|
"span",
|
|
5559
5991
|
{
|
|
5560
5992
|
className: "w-[14px] h-[3px] rounded-full",
|
|
@@ -5564,113 +5996,130 @@ var SocialToolbar = () => {
|
|
|
5564
5996
|
]
|
|
5565
5997
|
}
|
|
5566
5998
|
) }),
|
|
5567
|
-
/* @__PURE__ */
|
|
5999
|
+
/* @__PURE__ */ jsx56(TooltipContent, { side: "bottom", className: "z-51", children: "Text Color" })
|
|
5568
6000
|
] }),
|
|
5569
|
-
/* @__PURE__ */
|
|
5570
|
-
/* @__PURE__ */
|
|
6001
|
+
/* @__PURE__ */ jsxs45(Tooltip, { children: [
|
|
6002
|
+
/* @__PURE__ */ jsx56(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx56(
|
|
5571
6003
|
Button,
|
|
5572
6004
|
{
|
|
5573
6005
|
variant: "ghost",
|
|
5574
6006
|
className: `shadow-none transition-none cursor-pointer ${isBold ? "bg-muted" : ""}`,
|
|
5575
6007
|
size: "icon",
|
|
5576
6008
|
onClick: handleToggleBold,
|
|
5577
|
-
children: /* @__PURE__ */
|
|
6009
|
+
children: /* @__PURE__ */ jsx56(BoldIcon3, {})
|
|
5578
6010
|
}
|
|
5579
6011
|
) }),
|
|
5580
|
-
/* @__PURE__ */
|
|
6012
|
+
/* @__PURE__ */ jsx56(TooltipContent, { side: "bottom", className: "z-51", children: "Bold" })
|
|
5581
6013
|
] }),
|
|
5582
|
-
/* @__PURE__ */
|
|
5583
|
-
/* @__PURE__ */
|
|
6014
|
+
/* @__PURE__ */ jsxs45(Tooltip, { children: [
|
|
6015
|
+
/* @__PURE__ */ jsx56(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx56(
|
|
5584
6016
|
Button,
|
|
5585
6017
|
{
|
|
5586
6018
|
variant: "ghost",
|
|
5587
6019
|
className: `shadow-none transition-none cursor-pointer ${isItalic ? "bg-muted" : ""}`,
|
|
5588
6020
|
size: "icon",
|
|
5589
6021
|
onClick: handleToggleItalic,
|
|
5590
|
-
children: /* @__PURE__ */
|
|
6022
|
+
children: /* @__PURE__ */ jsx56(ItalicIcon3, {})
|
|
5591
6023
|
}
|
|
5592
6024
|
) }),
|
|
5593
|
-
/* @__PURE__ */
|
|
6025
|
+
/* @__PURE__ */ jsx56(TooltipContent, { side: "bottom", className: "z-51", children: "Italic" })
|
|
5594
6026
|
] }),
|
|
5595
|
-
/* @__PURE__ */
|
|
5596
|
-
/* @__PURE__ */
|
|
6027
|
+
/* @__PURE__ */ jsxs45(Tooltip, { children: [
|
|
6028
|
+
/* @__PURE__ */ jsx56(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx56(
|
|
5597
6029
|
Button,
|
|
5598
6030
|
{
|
|
5599
6031
|
variant: "ghost",
|
|
5600
6032
|
className: `shadow-none transition-none cursor-pointer ${isUnderline ? "bg-muted" : ""}`,
|
|
5601
6033
|
size: "icon",
|
|
5602
6034
|
onClick: handleToggleUnderline,
|
|
5603
|
-
children: /* @__PURE__ */
|
|
6035
|
+
children: /* @__PURE__ */ jsx56(Underline3, {})
|
|
5604
6036
|
}
|
|
5605
6037
|
) }),
|
|
5606
|
-
/* @__PURE__ */
|
|
6038
|
+
/* @__PURE__ */ jsx56(TooltipContent, { side: "bottom", className: "z-51", children: "Underline" })
|
|
5607
6039
|
] }),
|
|
5608
|
-
/* @__PURE__ */
|
|
5609
|
-
/* @__PURE__ */
|
|
6040
|
+
/* @__PURE__ */ jsxs45(Tooltip, { children: [
|
|
6041
|
+
/* @__PURE__ */ jsx56(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx56(
|
|
5610
6042
|
Button,
|
|
5611
6043
|
{
|
|
5612
6044
|
variant: "ghost",
|
|
5613
6045
|
className: `shadow-none transition-none cursor-pointer ${isStrikethrough ? "bg-muted" : ""}`,
|
|
5614
6046
|
size: "icon",
|
|
5615
6047
|
onClick: handleToggleStrike,
|
|
5616
|
-
children: /* @__PURE__ */
|
|
6048
|
+
children: /* @__PURE__ */ jsx56(Strikethrough3, {})
|
|
5617
6049
|
}
|
|
5618
6050
|
) }),
|
|
5619
|
-
/* @__PURE__ */
|
|
5620
|
-
] })
|
|
6051
|
+
/* @__PURE__ */ jsx56(TooltipContent, { side: "bottom", className: "z-51", children: "Strikethrough" })
|
|
6052
|
+
] }),
|
|
6053
|
+
/* @__PURE__ */ jsxs45(Tooltip, { children: [
|
|
6054
|
+
/* @__PURE__ */ jsx56(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx56(
|
|
6055
|
+
Button,
|
|
6056
|
+
{
|
|
6057
|
+
variant: "ghost",
|
|
6058
|
+
className: "shadow-none transition-none cursor-pointer",
|
|
6059
|
+
size: "icon",
|
|
6060
|
+
onClick: handleCycleSocialItemAlign,
|
|
6061
|
+
children: (() => {
|
|
6062
|
+
const AlignIcon = SOCIAL_ITEM_ALIGNMENT_ICONS[currentSocialItemAlign];
|
|
6063
|
+
return /* @__PURE__ */ jsx56(AlignIcon, {});
|
|
6064
|
+
})()
|
|
6065
|
+
}
|
|
6066
|
+
) }),
|
|
6067
|
+
/* @__PURE__ */ jsx56(TooltipContent, { side: "bottom", className: "z-51", children: "Alignment" })
|
|
6068
|
+
] }),
|
|
6069
|
+
/* @__PURE__ */ jsx56(SocialLineSpacing, {})
|
|
5621
6070
|
] })
|
|
5622
6071
|
] }),
|
|
5623
|
-
/* @__PURE__ */
|
|
5624
|
-
/* @__PURE__ */
|
|
5625
|
-
/* @__PURE__ */
|
|
5626
|
-
/* @__PURE__ */
|
|
6072
|
+
/* @__PURE__ */ jsx56(ToolbarSeparator, {}),
|
|
6073
|
+
/* @__PURE__ */ jsxs45(ToolbarContent, { children: [
|
|
6074
|
+
/* @__PURE__ */ jsx56(Tooltip, { children: /* @__PURE__ */ jsxs45(Popover, { children: [
|
|
6075
|
+
/* @__PURE__ */ jsx56(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx56(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx56(
|
|
5627
6076
|
Button,
|
|
5628
6077
|
{
|
|
5629
6078
|
variant: "ghost",
|
|
5630
6079
|
size: "icon",
|
|
5631
6080
|
className: "shadow-none transition-none cursor-pointer rounded-[12px] gap-1",
|
|
5632
|
-
children: /* @__PURE__ */
|
|
6081
|
+
children: /* @__PURE__ */ jsx56(Scan, {})
|
|
5633
6082
|
}
|
|
5634
6083
|
) }) }),
|
|
5635
|
-
/* @__PURE__ */
|
|
5636
|
-
/* @__PURE__ */
|
|
5637
|
-
/* @__PURE__ */
|
|
5638
|
-
/* @__PURE__ */
|
|
5639
|
-
/* @__PURE__ */
|
|
5640
|
-
/* @__PURE__ */
|
|
5641
|
-
/* @__PURE__ */
|
|
5642
|
-
/* @__PURE__ */
|
|
6084
|
+
/* @__PURE__ */ jsx56(TooltipContent, { side: "bottom", className: "z-51", children: "Icon Settings" }),
|
|
6085
|
+
/* @__PURE__ */ jsxs45(PopoverContent, { className: "flex flex-col gap-2 p-2 z-5001 w-[200px]", children: [
|
|
6086
|
+
/* @__PURE__ */ jsxs45(Select, { value: currentSocialStyle, onValueChange: (v) => handleSocialStyleChange(v), children: [
|
|
6087
|
+
/* @__PURE__ */ jsx56(SelectTrigger, { className: "w-full shadow-none rounded-[12px]", children: /* @__PURE__ */ jsx56(SelectValue, { placeholder: "Icon + Text" }) }),
|
|
6088
|
+
/* @__PURE__ */ jsxs45(SelectContent, { className: "w-full z-5001", children: [
|
|
6089
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "Icon + Text", children: "Icon + Text" }),
|
|
6090
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "Icon", children: "Icon" }),
|
|
6091
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "Text", children: "Text" })
|
|
5643
6092
|
] })
|
|
5644
6093
|
] }),
|
|
5645
|
-
/* @__PURE__ */
|
|
5646
|
-
/* @__PURE__ */
|
|
5647
|
-
/* @__PURE__ */
|
|
5648
|
-
/* @__PURE__ */
|
|
5649
|
-
/* @__PURE__ */
|
|
5650
|
-
/* @__PURE__ */
|
|
6094
|
+
/* @__PURE__ */ jsxs45(Select, { value: currentIconSize, onValueChange: (v) => handleIconSizeChange(v), children: [
|
|
6095
|
+
/* @__PURE__ */ jsx56(SelectTrigger, { className: "w-full shadow-none rounded-[12px]", children: /* @__PURE__ */ jsx56(SelectValue, { placeholder: "Small" }) }),
|
|
6096
|
+
/* @__PURE__ */ jsxs45(SelectContent, { className: "w-full z-5001", children: [
|
|
6097
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "Small", children: "Small" }),
|
|
6098
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "Medium", children: "Medium" }),
|
|
6099
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "Large", children: "Large" })
|
|
5651
6100
|
] })
|
|
5652
6101
|
] }),
|
|
5653
|
-
/* @__PURE__ */
|
|
5654
|
-
/* @__PURE__ */
|
|
5655
|
-
/* @__PURE__ */
|
|
5656
|
-
/* @__PURE__ */
|
|
5657
|
-
/* @__PURE__ */
|
|
5658
|
-
/* @__PURE__ */
|
|
6102
|
+
/* @__PURE__ */ jsxs45(Select, { value: currentIconStyle, onValueChange: (v) => handleIconStyleChange(v), children: [
|
|
6103
|
+
/* @__PURE__ */ jsx56(SelectTrigger, { className: "w-full shadow-none rounded-[12px]", children: /* @__PURE__ */ jsx56(SelectValue, { placeholder: "Regular" }) }),
|
|
6104
|
+
/* @__PURE__ */ jsxs45(SelectContent, { className: "w-full z-5001", children: [
|
|
6105
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "Regular", children: "Regular" }),
|
|
6106
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "Filled", children: "Filled" }),
|
|
6107
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "Outline", children: "Outline" })
|
|
5659
6108
|
] })
|
|
5660
6109
|
] }),
|
|
5661
|
-
/* @__PURE__ */
|
|
5662
|
-
/* @__PURE__ */
|
|
5663
|
-
/* @__PURE__ */
|
|
5664
|
-
/* @__PURE__ */
|
|
5665
|
-
/* @__PURE__ */
|
|
5666
|
-
/* @__PURE__ */
|
|
5667
|
-
/* @__PURE__ */
|
|
6110
|
+
/* @__PURE__ */ jsxs45(Select, { value: currentIconColor, onValueChange: (v) => handleIconColorChange(v), children: [
|
|
6111
|
+
/* @__PURE__ */ jsx56(SelectTrigger, { className: "w-full shadow-none rounded-[12px]", children: /* @__PURE__ */ jsx56(SelectValue, { placeholder: "Colored" }) }),
|
|
6112
|
+
/* @__PURE__ */ jsxs45(SelectContent, { className: "w-full z-5001", children: [
|
|
6113
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "Colored", children: "Colored" }),
|
|
6114
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "Dark", children: "Dark" }),
|
|
6115
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "Light", children: "Light" }),
|
|
6116
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "Gray", children: "Gray" })
|
|
5668
6117
|
] })
|
|
5669
6118
|
] })
|
|
5670
6119
|
] })
|
|
5671
6120
|
] }) }),
|
|
5672
|
-
/* @__PURE__ */
|
|
5673
|
-
/* @__PURE__ */
|
|
6121
|
+
/* @__PURE__ */ jsx56(Tooltip, { children: /* @__PURE__ */ jsxs45(DropdownMenu, { modal: false, children: [
|
|
6122
|
+
/* @__PURE__ */ jsx56(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx56(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx56(
|
|
5674
6123
|
Button,
|
|
5675
6124
|
{
|
|
5676
6125
|
variant: "outline",
|
|
@@ -5678,21 +6127,21 @@ var SocialToolbar = () => {
|
|
|
5678
6127
|
children: currentMode === "horizontal" ? "Horizontal" : "Vertical"
|
|
5679
6128
|
}
|
|
5680
6129
|
) }) }),
|
|
5681
|
-
/* @__PURE__ */
|
|
5682
|
-
/* @__PURE__ */
|
|
6130
|
+
/* @__PURE__ */ jsx56(TooltipContent, { side: "bottom", className: "z-51", children: "Direction" }),
|
|
6131
|
+
/* @__PURE__ */ jsx56(
|
|
5683
6132
|
DropdownMenuContent,
|
|
5684
6133
|
{
|
|
5685
6134
|
align: "start",
|
|
5686
6135
|
className: "z-51",
|
|
5687
6136
|
"data-editor-toolbar": "true",
|
|
5688
|
-
children: MODES.map((mode) => /* @__PURE__ */
|
|
6137
|
+
children: MODES.map((mode) => /* @__PURE__ */ jsxs45(
|
|
5689
6138
|
DropdownMenuItem,
|
|
5690
6139
|
{
|
|
5691
6140
|
onClick: () => handleModeChange(mode),
|
|
5692
6141
|
className: "gap-2 capitalize",
|
|
5693
6142
|
children: [
|
|
5694
6143
|
mode.charAt(0).toUpperCase() + mode.slice(1),
|
|
5695
|
-
currentMode === mode && /* @__PURE__ */
|
|
6144
|
+
currentMode === mode && /* @__PURE__ */ jsx56(CheckIcon7, { className: "w-4 h-4 ml-auto" })
|
|
5696
6145
|
]
|
|
5697
6146
|
},
|
|
5698
6147
|
mode
|
|
@@ -5700,18 +6149,18 @@ var SocialToolbar = () => {
|
|
|
5700
6149
|
}
|
|
5701
6150
|
)
|
|
5702
6151
|
] }) }),
|
|
5703
|
-
/* @__PURE__ */
|
|
5704
|
-
/* @__PURE__ */
|
|
6152
|
+
/* @__PURE__ */ jsxs45(Tooltip, { children: [
|
|
6153
|
+
/* @__PURE__ */ jsx56(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx56(
|
|
5705
6154
|
Button,
|
|
5706
6155
|
{
|
|
5707
6156
|
variant: "ghost",
|
|
5708
6157
|
className: "shadow-none transition-none cursor-pointer",
|
|
5709
6158
|
size: "icon",
|
|
5710
6159
|
onClick: handleCycleAlign,
|
|
5711
|
-
children: /* @__PURE__ */
|
|
6160
|
+
children: /* @__PURE__ */ jsx56("img", { src: ALIGNMENT_ICONS[currentAlign], alt: "Align", className: "w-4 h-4" })
|
|
5712
6161
|
}
|
|
5713
6162
|
) }),
|
|
5714
|
-
/* @__PURE__ */
|
|
6163
|
+
/* @__PURE__ */ jsxs45(TooltipContent, { side: "bottom", className: "z-51", children: [
|
|
5715
6164
|
"Align (",
|
|
5716
6165
|
currentAlign,
|
|
5717
6166
|
")"
|
|
@@ -5722,9 +6171,15 @@ var SocialToolbar = () => {
|
|
|
5722
6171
|
};
|
|
5723
6172
|
|
|
5724
6173
|
// src/core/editor/components/element-gear/social-item/toolbar.tsx
|
|
5725
|
-
import { BoldIcon as BoldIcon4, CaseUpperIcon as CaseUpperIcon4, ItalicIcon as ItalicIcon4, RemoveFormatting, Strikethrough as Strikethrough4, Underline as Underline4 } from "lucide-react";
|
|
5726
|
-
import { useCallback as
|
|
5727
|
-
import { Fragment as Fragment7, jsx as
|
|
6174
|
+
import { AlignCenterIcon as AlignCenterIcon2, AlignLeftIcon as AlignLeftIcon2, AlignRightIcon as AlignRightIcon2, BoldIcon as BoldIcon4, CaseUpperIcon as CaseUpperIcon4, ItalicIcon as ItalicIcon4, RemoveFormatting, Strikethrough as Strikethrough4, Underline as Underline4 } from "lucide-react";
|
|
6175
|
+
import { useCallback as useCallback30, useMemo as useMemo27 } from "react";
|
|
6176
|
+
import { Fragment as Fragment7, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
6177
|
+
var ALIGNMENTS3 = ["left", "center", "right"];
|
|
6178
|
+
var SOCIAL_ITEM_ALIGNMENT_ICONS2 = {
|
|
6179
|
+
left: AlignLeftIcon2,
|
|
6180
|
+
center: AlignCenterIcon2,
|
|
6181
|
+
right: AlignRightIcon2
|
|
6182
|
+
};
|
|
5728
6183
|
var SocialItemToolbar = () => {
|
|
5729
6184
|
const focusIdx = useEditorStore((state) => state.focusIdx);
|
|
5730
6185
|
const template = useEditorStore((state) => state.template);
|
|
@@ -5733,30 +6188,33 @@ var SocialItemToolbar = () => {
|
|
|
5733
6188
|
const socialItemElement = focusIdx ? getValueByIdx(template, focusIdx) : null;
|
|
5734
6189
|
const parentSocialElement = focusIdx ? getParentByIdx(template, focusIdx) : null;
|
|
5735
6190
|
const parentSocialStyle = parentSocialElement?.data?.value?.socialStyle || "Icon + Text";
|
|
5736
|
-
const currentFontFamily =
|
|
6191
|
+
const currentFontFamily = useMemo27(() => {
|
|
5737
6192
|
return socialItemElement?.attributes?.["font-family"] || "Arial";
|
|
5738
6193
|
}, [socialItemElement]);
|
|
5739
|
-
const currentFontSize =
|
|
6194
|
+
const currentFontSize = useMemo27(() => {
|
|
5740
6195
|
return parseFontSize(socialItemElement?.attributes?.["font-size"]);
|
|
5741
6196
|
}, [socialItemElement]);
|
|
5742
|
-
const currentTextColor =
|
|
6197
|
+
const currentTextColor = useMemo27(() => {
|
|
5743
6198
|
return socialItemElement?.attributes?.["color"] || "#000000";
|
|
5744
6199
|
}, [socialItemElement]);
|
|
5745
|
-
const isBold =
|
|
6200
|
+
const isBold = useMemo27(() => {
|
|
5746
6201
|
return socialItemElement?.attributes?.["font-weight"] === "bold";
|
|
5747
6202
|
}, [socialItemElement]);
|
|
5748
|
-
const isItalic =
|
|
6203
|
+
const isItalic = useMemo27(() => {
|
|
5749
6204
|
return socialItemElement?.attributes?.["font-style"] === "italic";
|
|
5750
6205
|
}, [socialItemElement]);
|
|
5751
|
-
const isUnderline =
|
|
6206
|
+
const isUnderline = useMemo27(() => {
|
|
5752
6207
|
const decoration = socialItemElement?.attributes?.["text-decoration"] || "";
|
|
5753
6208
|
return decoration.includes("underline");
|
|
5754
6209
|
}, [socialItemElement]);
|
|
5755
|
-
const isStrikethrough =
|
|
6210
|
+
const isStrikethrough = useMemo27(() => {
|
|
5756
6211
|
const decoration = socialItemElement?.attributes?.["text-decoration"] || "";
|
|
5757
6212
|
return decoration.includes("line-through");
|
|
5758
6213
|
}, [socialItemElement]);
|
|
5759
|
-
const
|
|
6214
|
+
const currentAlign = useMemo27(() => {
|
|
6215
|
+
return socialItemElement?.attributes?.["align"] || "center";
|
|
6216
|
+
}, [socialItemElement]);
|
|
6217
|
+
const handleSetFontFamily = useCallback30((font) => {
|
|
5760
6218
|
if (!focusIdx) return;
|
|
5761
6219
|
const currentTemplate = useEditorStore.getState().template;
|
|
5762
6220
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5767,7 +6225,7 @@ var SocialItemToolbar = () => {
|
|
|
5767
6225
|
}
|
|
5768
6226
|
});
|
|
5769
6227
|
}, [focusIdx, updateElement]);
|
|
5770
|
-
const handleFontSizeChange =
|
|
6228
|
+
const handleFontSizeChange = useCallback30((size) => {
|
|
5771
6229
|
if (!focusIdx) return;
|
|
5772
6230
|
const currentTemplate = useEditorStore.getState().template;
|
|
5773
6231
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5778,12 +6236,12 @@ var SocialItemToolbar = () => {
|
|
|
5778
6236
|
}
|
|
5779
6237
|
});
|
|
5780
6238
|
}, [focusIdx, updateElement]);
|
|
5781
|
-
const handleOpenTextColorPicker =
|
|
6239
|
+
const handleOpenTextColorPicker = useCallback30(() => {
|
|
5782
6240
|
setColorType("Text Color");
|
|
5783
6241
|
setColorTarget("socialItemTextColor");
|
|
5784
6242
|
setActiveView("color");
|
|
5785
6243
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
5786
|
-
const handleToggleBold =
|
|
6244
|
+
const handleToggleBold = useCallback30(() => {
|
|
5787
6245
|
if (!focusIdx) return;
|
|
5788
6246
|
const currentTemplate = useEditorStore.getState().template;
|
|
5789
6247
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5795,7 +6253,7 @@ var SocialItemToolbar = () => {
|
|
|
5795
6253
|
}
|
|
5796
6254
|
});
|
|
5797
6255
|
}, [focusIdx, isBold, updateElement]);
|
|
5798
|
-
const handleToggleItalic =
|
|
6256
|
+
const handleToggleItalic = useCallback30(() => {
|
|
5799
6257
|
if (!focusIdx) return;
|
|
5800
6258
|
const currentTemplate = useEditorStore.getState().template;
|
|
5801
6259
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5807,7 +6265,7 @@ var SocialItemToolbar = () => {
|
|
|
5807
6265
|
}
|
|
5808
6266
|
});
|
|
5809
6267
|
}, [focusIdx, isItalic, updateElement]);
|
|
5810
|
-
const handleToggleUnderline =
|
|
6268
|
+
const handleToggleUnderline = useCallback30(() => {
|
|
5811
6269
|
if (!focusIdx) return;
|
|
5812
6270
|
const currentTemplate = useEditorStore.getState().template;
|
|
5813
6271
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5825,7 +6283,7 @@ var SocialItemToolbar = () => {
|
|
|
5825
6283
|
}
|
|
5826
6284
|
});
|
|
5827
6285
|
}, [focusIdx, isUnderline, updateElement]);
|
|
5828
|
-
const handleToggleStrike =
|
|
6286
|
+
const handleToggleStrike = useCallback30(() => {
|
|
5829
6287
|
if (!focusIdx) return;
|
|
5830
6288
|
const currentTemplate = useEditorStore.getState().template;
|
|
5831
6289
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5843,7 +6301,7 @@ var SocialItemToolbar = () => {
|
|
|
5843
6301
|
}
|
|
5844
6302
|
});
|
|
5845
6303
|
}, [focusIdx, isStrikethrough, updateElement]);
|
|
5846
|
-
const handleRemoveFormatting =
|
|
6304
|
+
const handleRemoveFormatting = useCallback30(() => {
|
|
5847
6305
|
if (!focusIdx) return;
|
|
5848
6306
|
const currentTemplate = useEditorStore.getState().template;
|
|
5849
6307
|
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
@@ -5861,19 +6319,33 @@ var SocialItemToolbar = () => {
|
|
|
5861
6319
|
attributes: restAttributes
|
|
5862
6320
|
});
|
|
5863
6321
|
}, [focusIdx, updateElement]);
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
6322
|
+
const handleCycleAlign = useCallback30(() => {
|
|
6323
|
+
if (!focusIdx) return;
|
|
6324
|
+
const currentTemplate = useEditorStore.getState().template;
|
|
6325
|
+
const element = getValueByIdx(currentTemplate, focusIdx);
|
|
6326
|
+
const currentIndex = ALIGNMENTS3.indexOf(currentAlign);
|
|
6327
|
+
const nextIndex = (currentIndex + 1) % ALIGNMENTS3.length;
|
|
6328
|
+
const nextAlign = ALIGNMENTS3[nextIndex];
|
|
6329
|
+
updateElement(focusIdx, {
|
|
6330
|
+
attributes: {
|
|
6331
|
+
...element?.attributes,
|
|
6332
|
+
"align": nextAlign
|
|
6333
|
+
}
|
|
6334
|
+
});
|
|
6335
|
+
}, [focusIdx, currentAlign, updateElement]);
|
|
6336
|
+
return /* @__PURE__ */ jsxs46(ToolbarContainer, { children: [
|
|
6337
|
+
/* @__PURE__ */ jsx57(ToolbarContent, { children: /* @__PURE__ */ jsx57(BasicOption, {}) }),
|
|
6338
|
+
parentSocialStyle !== "Icon" && /* @__PURE__ */ jsxs46(Fragment7, { children: [
|
|
6339
|
+
/* @__PURE__ */ jsx57(ToolbarSeparator, {}),
|
|
6340
|
+
/* @__PURE__ */ jsxs46(ToolbarContent, { children: [
|
|
6341
|
+
/* @__PURE__ */ jsx57(
|
|
5870
6342
|
FontFamilyDropdown,
|
|
5871
6343
|
{
|
|
5872
6344
|
currentFont: currentFontFamily,
|
|
5873
6345
|
onFontChange: handleSetFontFamily
|
|
5874
6346
|
}
|
|
5875
6347
|
),
|
|
5876
|
-
/* @__PURE__ */
|
|
6348
|
+
/* @__PURE__ */ jsx57(
|
|
5877
6349
|
FontSizeControl,
|
|
5878
6350
|
{
|
|
5879
6351
|
value: currentFontSize,
|
|
@@ -5881,10 +6353,10 @@ var SocialItemToolbar = () => {
|
|
|
5881
6353
|
}
|
|
5882
6354
|
)
|
|
5883
6355
|
] }),
|
|
5884
|
-
/* @__PURE__ */
|
|
5885
|
-
/* @__PURE__ */
|
|
5886
|
-
/* @__PURE__ */
|
|
5887
|
-
/* @__PURE__ */
|
|
6356
|
+
/* @__PURE__ */ jsx57(ToolbarSeparator, {}),
|
|
6357
|
+
/* @__PURE__ */ jsxs46(ToolbarContent, { children: [
|
|
6358
|
+
/* @__PURE__ */ jsxs46(Tooltip, { children: [
|
|
6359
|
+
/* @__PURE__ */ jsx57(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs46(
|
|
5888
6360
|
Button,
|
|
5889
6361
|
{
|
|
5890
6362
|
variant: "ghost",
|
|
@@ -5892,8 +6364,8 @@ var SocialItemToolbar = () => {
|
|
|
5892
6364
|
size: "icon",
|
|
5893
6365
|
onClick: handleOpenTextColorPicker,
|
|
5894
6366
|
children: [
|
|
5895
|
-
/* @__PURE__ */
|
|
5896
|
-
/* @__PURE__ */
|
|
6367
|
+
/* @__PURE__ */ jsx57(CaseUpperIcon4, {}),
|
|
6368
|
+
/* @__PURE__ */ jsx57(
|
|
5897
6369
|
"span",
|
|
5898
6370
|
{
|
|
5899
6371
|
className: "w-[14px] h-[3px] rounded-full",
|
|
@@ -5903,72 +6375,88 @@ var SocialItemToolbar = () => {
|
|
|
5903
6375
|
]
|
|
5904
6376
|
}
|
|
5905
6377
|
) }),
|
|
5906
|
-
/* @__PURE__ */
|
|
6378
|
+
/* @__PURE__ */ jsx57(TooltipContent, { side: "bottom", children: "Text Color" })
|
|
5907
6379
|
] }),
|
|
5908
|
-
/* @__PURE__ */
|
|
5909
|
-
/* @__PURE__ */
|
|
6380
|
+
/* @__PURE__ */ jsxs46(Tooltip, { children: [
|
|
6381
|
+
/* @__PURE__ */ jsx57(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx57(
|
|
5910
6382
|
Button,
|
|
5911
6383
|
{
|
|
5912
6384
|
variant: "ghost",
|
|
5913
6385
|
className: `shadow-none transition-none cursor-pointer ${isBold ? "bg-muted" : ""}`,
|
|
5914
6386
|
size: "icon",
|
|
5915
6387
|
onClick: handleToggleBold,
|
|
5916
|
-
children: /* @__PURE__ */
|
|
6388
|
+
children: /* @__PURE__ */ jsx57(BoldIcon4, {})
|
|
5917
6389
|
}
|
|
5918
6390
|
) }),
|
|
5919
|
-
/* @__PURE__ */
|
|
6391
|
+
/* @__PURE__ */ jsx57(TooltipContent, { side: "bottom", children: "Bold" })
|
|
5920
6392
|
] }),
|
|
5921
|
-
/* @__PURE__ */
|
|
5922
|
-
/* @__PURE__ */
|
|
6393
|
+
/* @__PURE__ */ jsxs46(Tooltip, { children: [
|
|
6394
|
+
/* @__PURE__ */ jsx57(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx57(
|
|
5923
6395
|
Button,
|
|
5924
6396
|
{
|
|
5925
6397
|
variant: "ghost",
|
|
5926
6398
|
className: `shadow-none transition-none cursor-pointer ${isItalic ? "bg-muted" : ""}`,
|
|
5927
6399
|
size: "icon",
|
|
5928
6400
|
onClick: handleToggleItalic,
|
|
5929
|
-
children: /* @__PURE__ */
|
|
6401
|
+
children: /* @__PURE__ */ jsx57(ItalicIcon4, {})
|
|
5930
6402
|
}
|
|
5931
6403
|
) }),
|
|
5932
|
-
/* @__PURE__ */
|
|
6404
|
+
/* @__PURE__ */ jsx57(TooltipContent, { side: "bottom", children: "Italic" })
|
|
5933
6405
|
] }),
|
|
5934
|
-
/* @__PURE__ */
|
|
5935
|
-
/* @__PURE__ */
|
|
6406
|
+
/* @__PURE__ */ jsxs46(Tooltip, { children: [
|
|
6407
|
+
/* @__PURE__ */ jsx57(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx57(
|
|
5936
6408
|
Button,
|
|
5937
6409
|
{
|
|
5938
6410
|
variant: "ghost",
|
|
5939
6411
|
className: `shadow-none transition-none cursor-pointer ${isUnderline ? "bg-muted" : ""}`,
|
|
5940
6412
|
size: "icon",
|
|
5941
6413
|
onClick: handleToggleUnderline,
|
|
5942
|
-
children: /* @__PURE__ */
|
|
6414
|
+
children: /* @__PURE__ */ jsx57(Underline4, {})
|
|
5943
6415
|
}
|
|
5944
6416
|
) }),
|
|
5945
|
-
/* @__PURE__ */
|
|
6417
|
+
/* @__PURE__ */ jsx57(TooltipContent, { side: "bottom", children: "Underline" })
|
|
5946
6418
|
] }),
|
|
5947
|
-
/* @__PURE__ */
|
|
5948
|
-
/* @__PURE__ */
|
|
6419
|
+
/* @__PURE__ */ jsxs46(Tooltip, { children: [
|
|
6420
|
+
/* @__PURE__ */ jsx57(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx57(
|
|
5949
6421
|
Button,
|
|
5950
6422
|
{
|
|
5951
6423
|
variant: "ghost",
|
|
5952
6424
|
className: `shadow-none transition-none cursor-pointer ${isStrikethrough ? "bg-muted" : ""}`,
|
|
5953
6425
|
size: "icon",
|
|
5954
6426
|
onClick: handleToggleStrike,
|
|
5955
|
-
children: /* @__PURE__ */
|
|
6427
|
+
children: /* @__PURE__ */ jsx57(Strikethrough4, {})
|
|
6428
|
+
}
|
|
6429
|
+
) }),
|
|
6430
|
+
/* @__PURE__ */ jsx57(TooltipContent, { side: "bottom", children: "Strikethrough" })
|
|
6431
|
+
] }),
|
|
6432
|
+
/* @__PURE__ */ jsxs46(Tooltip, { children: [
|
|
6433
|
+
/* @__PURE__ */ jsx57(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx57(
|
|
6434
|
+
Button,
|
|
6435
|
+
{
|
|
6436
|
+
variant: "ghost",
|
|
6437
|
+
className: "shadow-none transition-none cursor-pointer",
|
|
6438
|
+
size: "icon",
|
|
6439
|
+
onClick: handleCycleAlign,
|
|
6440
|
+
children: (() => {
|
|
6441
|
+
const AlignIcon = SOCIAL_ITEM_ALIGNMENT_ICONS2[currentAlign];
|
|
6442
|
+
return /* @__PURE__ */ jsx57(AlignIcon, {});
|
|
6443
|
+
})()
|
|
5956
6444
|
}
|
|
5957
6445
|
) }),
|
|
5958
|
-
/* @__PURE__ */
|
|
6446
|
+
/* @__PURE__ */ jsx57(TooltipContent, { side: "bottom", children: "Alignment" })
|
|
5959
6447
|
] }),
|
|
5960
|
-
/* @__PURE__ */
|
|
5961
|
-
/* @__PURE__ */
|
|
6448
|
+
/* @__PURE__ */ jsxs46(Tooltip, { children: [
|
|
6449
|
+
/* @__PURE__ */ jsx57(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx57(
|
|
5962
6450
|
Button,
|
|
5963
6451
|
{
|
|
5964
6452
|
variant: "ghost",
|
|
5965
6453
|
className: "shadow-none transition-none cursor-pointer",
|
|
5966
6454
|
size: "icon",
|
|
5967
6455
|
onClick: handleRemoveFormatting,
|
|
5968
|
-
children: /* @__PURE__ */
|
|
6456
|
+
children: /* @__PURE__ */ jsx57(RemoveFormatting, {})
|
|
5969
6457
|
}
|
|
5970
6458
|
) }),
|
|
5971
|
-
/* @__PURE__ */
|
|
6459
|
+
/* @__PURE__ */ jsx57(TooltipContent, { side: "bottom", children: "Remove formatting" })
|
|
5972
6460
|
] })
|
|
5973
6461
|
] })
|
|
5974
6462
|
] })
|
|
@@ -5977,8 +6465,8 @@ var SocialItemToolbar = () => {
|
|
|
5977
6465
|
|
|
5978
6466
|
// src/core/editor/components/element-gear/divider/_components/stroke-weight.tsx
|
|
5979
6467
|
import { MinusIcon as MinusIcon4 } from "lucide-react";
|
|
5980
|
-
import { useState as
|
|
5981
|
-
import { jsx as
|
|
6468
|
+
import { useState as useState17, useEffect as useEffect11, useCallback as useCallback31 } from "react";
|
|
6469
|
+
import { jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
5982
6470
|
var StrokeWeight2 = ({
|
|
5983
6471
|
width,
|
|
5984
6472
|
borderStyle,
|
|
@@ -5986,20 +6474,20 @@ var StrokeWeight2 = ({
|
|
|
5986
6474
|
onStyleChange,
|
|
5987
6475
|
tooltipText = "Stroke Weight"
|
|
5988
6476
|
}) => {
|
|
5989
|
-
const [isOpen, setIsOpen] =
|
|
5990
|
-
const [inputValue, setInputValue] =
|
|
5991
|
-
|
|
6477
|
+
const [isOpen, setIsOpen] = useState17(false);
|
|
6478
|
+
const [inputValue, setInputValue] = useState17(width.toString());
|
|
6479
|
+
useEffect11(() => {
|
|
5992
6480
|
setInputValue(width.toString());
|
|
5993
6481
|
}, [width]);
|
|
5994
|
-
const handleSliderChange =
|
|
6482
|
+
const handleSliderChange = useCallback31((values) => {
|
|
5995
6483
|
const newWidth = values[0];
|
|
5996
6484
|
setInputValue(newWidth.toString());
|
|
5997
6485
|
onWidthChange(newWidth);
|
|
5998
6486
|
}, [onWidthChange]);
|
|
5999
|
-
const handleInputChange =
|
|
6487
|
+
const handleInputChange = useCallback31((e) => {
|
|
6000
6488
|
setInputValue(e.target.value);
|
|
6001
6489
|
}, []);
|
|
6002
|
-
const handleInputBlur =
|
|
6490
|
+
const handleInputBlur = useCallback31(() => {
|
|
6003
6491
|
const parsed = parseInt(inputValue, 10);
|
|
6004
6492
|
if (isNaN(parsed)) {
|
|
6005
6493
|
setInputValue(width.toString());
|
|
@@ -6009,63 +6497,63 @@ var StrokeWeight2 = ({
|
|
|
6009
6497
|
setInputValue(clamped.toString());
|
|
6010
6498
|
onWidthChange(clamped);
|
|
6011
6499
|
}, [inputValue, width, onWidthChange]);
|
|
6012
|
-
const handleInputKeyDown =
|
|
6500
|
+
const handleInputKeyDown = useCallback31((e) => {
|
|
6013
6501
|
if (e.key === "Enter") {
|
|
6014
6502
|
handleInputBlur();
|
|
6015
6503
|
}
|
|
6016
6504
|
}, [handleInputBlur]);
|
|
6017
|
-
return /* @__PURE__ */
|
|
6018
|
-
/* @__PURE__ */
|
|
6019
|
-
/* @__PURE__ */
|
|
6505
|
+
return /* @__PURE__ */ jsxs47(Tooltip, { children: [
|
|
6506
|
+
/* @__PURE__ */ jsxs47(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
6507
|
+
/* @__PURE__ */ jsx58(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx58(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx58(
|
|
6020
6508
|
Button,
|
|
6021
6509
|
{
|
|
6022
6510
|
variant: "ghost",
|
|
6023
6511
|
className: `shadow-none transition-none cursor-pointer rounded-[12px] ${isOpen ? "bg-muted" : ""}`,
|
|
6024
6512
|
size: "icon",
|
|
6025
|
-
children: /* @__PURE__ */
|
|
6513
|
+
children: /* @__PURE__ */ jsx58(MinusIcon4, { className: "w-4 h-4" })
|
|
6026
6514
|
}
|
|
6027
6515
|
) }) }),
|
|
6028
|
-
/* @__PURE__ */
|
|
6029
|
-
/* @__PURE__ */
|
|
6030
|
-
/* @__PURE__ */
|
|
6516
|
+
/* @__PURE__ */ jsx58(PopoverContent, { className: "w-64 z-51 mt-1 rounded-[12px]", children: /* @__PURE__ */ jsxs47("div", { className: "flex flex-col gap-3", children: [
|
|
6517
|
+
/* @__PURE__ */ jsxs47("div", { className: "flex flex-row items-center gap-2", children: [
|
|
6518
|
+
/* @__PURE__ */ jsx58(
|
|
6031
6519
|
Button,
|
|
6032
6520
|
{
|
|
6033
6521
|
variant: borderStyle === "solid" ? "default" : "outline",
|
|
6034
6522
|
className: "flex-1 cursor-pointer shadow-none rounded-[12px]",
|
|
6035
6523
|
onClick: () => onStyleChange("solid"),
|
|
6036
|
-
children: /* @__PURE__ */
|
|
6524
|
+
children: /* @__PURE__ */ jsx58("div", { className: "w-full h-[2px] bg-current" })
|
|
6037
6525
|
}
|
|
6038
6526
|
),
|
|
6039
|
-
/* @__PURE__ */
|
|
6527
|
+
/* @__PURE__ */ jsx58(
|
|
6040
6528
|
Button,
|
|
6041
6529
|
{
|
|
6042
6530
|
variant: borderStyle === "dashed" ? "default" : "outline",
|
|
6043
6531
|
className: "flex-1 cursor-pointer shadow-none rounded-[12px]",
|
|
6044
6532
|
onClick: () => onStyleChange("dashed"),
|
|
6045
|
-
children: /* @__PURE__ */
|
|
6046
|
-
/* @__PURE__ */
|
|
6047
|
-
/* @__PURE__ */
|
|
6533
|
+
children: /* @__PURE__ */ jsxs47("div", { className: "w-full flex flex-row items-center justify-center gap-1", children: [
|
|
6534
|
+
/* @__PURE__ */ jsx58("div", { className: "w-full h-[2px] bg-current" }),
|
|
6535
|
+
/* @__PURE__ */ jsx58("div", { className: "w-full h-[2px] bg-current" })
|
|
6048
6536
|
] })
|
|
6049
6537
|
}
|
|
6050
6538
|
),
|
|
6051
|
-
/* @__PURE__ */
|
|
6539
|
+
/* @__PURE__ */ jsx58(
|
|
6052
6540
|
Button,
|
|
6053
6541
|
{
|
|
6054
6542
|
variant: borderStyle === "dotted" ? "default" : "outline",
|
|
6055
6543
|
className: "flex-1 cursor-pointer shadow-none rounded-[12px]",
|
|
6056
6544
|
onClick: () => onStyleChange("dotted"),
|
|
6057
|
-
children: /* @__PURE__ */
|
|
6058
|
-
/* @__PURE__ */
|
|
6059
|
-
/* @__PURE__ */
|
|
6060
|
-
/* @__PURE__ */
|
|
6545
|
+
children: /* @__PURE__ */ jsxs47("div", { className: "w-full flex flex-row items-center justify-center gap-1", children: [
|
|
6546
|
+
/* @__PURE__ */ jsx58("div", { className: "rounded-full w-[4px] h-[4px] bg-current" }),
|
|
6547
|
+
/* @__PURE__ */ jsx58("div", { className: "rounded-full w-[4px] h-[4px] bg-current" }),
|
|
6548
|
+
/* @__PURE__ */ jsx58("div", { className: "rounded-full w-[4px] h-[4px] bg-current" })
|
|
6061
6549
|
] })
|
|
6062
6550
|
}
|
|
6063
6551
|
)
|
|
6064
6552
|
] }),
|
|
6065
|
-
/* @__PURE__ */
|
|
6066
|
-
/* @__PURE__ */
|
|
6067
|
-
/* @__PURE__ */
|
|
6068
|
-
/* @__PURE__ */
|
|
6553
|
+
/* @__PURE__ */ jsxs47("div", { children: [
|
|
6554
|
+
/* @__PURE__ */ jsx58(Label, { children: "Stroke weight" }),
|
|
6555
|
+
/* @__PURE__ */ jsxs47("div", { className: "flex flex-row items-center gap-2", children: [
|
|
6556
|
+
/* @__PURE__ */ jsx58(
|
|
6069
6557
|
Slider2,
|
|
6070
6558
|
{
|
|
6071
6559
|
value: [width],
|
|
@@ -6075,7 +6563,7 @@ var StrokeWeight2 = ({
|
|
|
6075
6563
|
step: 1
|
|
6076
6564
|
}
|
|
6077
6565
|
),
|
|
6078
|
-
/* @__PURE__ */
|
|
6566
|
+
/* @__PURE__ */ jsx58(
|
|
6079
6567
|
Input,
|
|
6080
6568
|
{
|
|
6081
6569
|
type: "number",
|
|
@@ -6092,15 +6580,15 @@ var StrokeWeight2 = ({
|
|
|
6092
6580
|
] })
|
|
6093
6581
|
] }) })
|
|
6094
6582
|
] }),
|
|
6095
|
-
/* @__PURE__ */
|
|
6583
|
+
/* @__PURE__ */ jsx58(TooltipContent, { side: "bottom", className: "z-51", children: tooltipText })
|
|
6096
6584
|
] });
|
|
6097
6585
|
};
|
|
6098
6586
|
|
|
6099
6587
|
// src/core/editor/hooks/use-divider-border.ts
|
|
6100
|
-
import { useMemo as
|
|
6588
|
+
import { useMemo as useMemo28, useCallback as useCallback32 } from "react";
|
|
6101
6589
|
var useDividerBorder = () => {
|
|
6102
6590
|
const { focusIdx, updateElement, template } = useEditorStore();
|
|
6103
|
-
const { element, width, style, color } =
|
|
6591
|
+
const { element, width, style, color } = useMemo28(() => {
|
|
6104
6592
|
if (!focusIdx || !template) {
|
|
6105
6593
|
return { element: null, width: 1, style: "solid", color: "#000000" };
|
|
6106
6594
|
}
|
|
@@ -6118,7 +6606,7 @@ var useDividerBorder = () => {
|
|
|
6118
6606
|
color: rawColor
|
|
6119
6607
|
};
|
|
6120
6608
|
}, [focusIdx, template]);
|
|
6121
|
-
const setWidth =
|
|
6609
|
+
const setWidth = useCallback32((newWidth) => {
|
|
6122
6610
|
if (!focusIdx || !template || !element) return;
|
|
6123
6611
|
const clampedWidth = Math.max(1, Math.min(50, newWidth));
|
|
6124
6612
|
updateElement(focusIdx, {
|
|
@@ -6128,7 +6616,7 @@ var useDividerBorder = () => {
|
|
|
6128
6616
|
}
|
|
6129
6617
|
});
|
|
6130
6618
|
}, [focusIdx, template, element, updateElement]);
|
|
6131
|
-
const setStyle =
|
|
6619
|
+
const setStyle = useCallback32((newStyle) => {
|
|
6132
6620
|
if (!focusIdx || !template || !element) return;
|
|
6133
6621
|
updateElement(focusIdx, {
|
|
6134
6622
|
attributes: {
|
|
@@ -6147,10 +6635,10 @@ var useDividerBorder = () => {
|
|
|
6147
6635
|
};
|
|
6148
6636
|
|
|
6149
6637
|
// src/core/editor/hooks/use-width.ts
|
|
6150
|
-
import { useMemo as
|
|
6638
|
+
import { useMemo as useMemo29, useCallback as useCallback33 } from "react";
|
|
6151
6639
|
var useWidth = () => {
|
|
6152
6640
|
const { focusIdx, updateElement, template } = useEditorStore();
|
|
6153
|
-
const currentValue =
|
|
6641
|
+
const currentValue = useMemo29(() => {
|
|
6154
6642
|
if (!focusIdx || !template) return 100;
|
|
6155
6643
|
const element = getValueByIdx(template, focusIdx);
|
|
6156
6644
|
const rawValue = element?.attributes?.width;
|
|
@@ -6158,7 +6646,7 @@ var useWidth = () => {
|
|
|
6158
6646
|
const parsed = parseFloat(rawValue.replace("%", ""));
|
|
6159
6647
|
return isNaN(parsed) ? 100 : Math.max(10, Math.min(100, parsed));
|
|
6160
6648
|
}, [focusIdx, template]);
|
|
6161
|
-
const handleChange =
|
|
6649
|
+
const handleChange = useCallback33((value) => {
|
|
6162
6650
|
if (!focusIdx || !template) return;
|
|
6163
6651
|
const element = getValueByIdx(template, focusIdx);
|
|
6164
6652
|
if (!element) return;
|
|
@@ -6177,9 +6665,9 @@ var useWidth = () => {
|
|
|
6177
6665
|
};
|
|
6178
6666
|
|
|
6179
6667
|
// src/core/editor/components/element-gear/divider/toolbar.tsx
|
|
6180
|
-
import { useCallback as
|
|
6668
|
+
import { useCallback as useCallback34, useMemo as useMemo30 } from "react";
|
|
6181
6669
|
import lodashGet13 from "lodash/get";
|
|
6182
|
-
import { jsx as
|
|
6670
|
+
import { jsx as jsx59, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
6183
6671
|
var DIVIDER_ALIGNMENTS = ["left", "center", "right"];
|
|
6184
6672
|
var DividerToolbar = () => {
|
|
6185
6673
|
const { activeView, setActiveView, setColorType, setColorTarget, colorTarget } = useSidebarContext();
|
|
@@ -6187,24 +6675,24 @@ var DividerToolbar = () => {
|
|
|
6187
6675
|
const border = useDividerBorder();
|
|
6188
6676
|
const padding = usePadding();
|
|
6189
6677
|
const width = useWidth();
|
|
6190
|
-
const currentElement =
|
|
6678
|
+
const currentElement = useMemo30(() => {
|
|
6191
6679
|
if (!focusIdx || !template) return null;
|
|
6192
6680
|
const path = focusIdx.startsWith("content.") ? focusIdx.replace("content.", "content[0].").replace(/\.\[(\d+)\]/g, "[$1]") : focusIdx;
|
|
6193
6681
|
return lodashGet13(template, path);
|
|
6194
6682
|
}, [focusIdx, template]);
|
|
6195
6683
|
const currentAlign = currentElement?.attributes?.align || "center";
|
|
6196
6684
|
const currentBgColor = currentElement?.attributes?.["container-background-color"];
|
|
6197
|
-
const handleOpenBgColorPicker =
|
|
6685
|
+
const handleOpenBgColorPicker = useCallback34(() => {
|
|
6198
6686
|
setColorType("Background Color");
|
|
6199
6687
|
setColorTarget("dividerBgColor");
|
|
6200
6688
|
setActiveView("color");
|
|
6201
6689
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
6202
|
-
const handleOpenStrokeColorPicker =
|
|
6690
|
+
const handleOpenStrokeColorPicker = useCallback34(() => {
|
|
6203
6691
|
setColorType("Stroke Color");
|
|
6204
6692
|
setColorTarget("dividerBorderColor");
|
|
6205
6693
|
setActiveView("color");
|
|
6206
6694
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
6207
|
-
const handleCycleAlign =
|
|
6695
|
+
const handleCycleAlign = useCallback34(() => {
|
|
6208
6696
|
if (!focusIdx || !currentElement) return;
|
|
6209
6697
|
const currentIndex = DIVIDER_ALIGNMENTS.indexOf(currentAlign);
|
|
6210
6698
|
const nextIndex = (currentIndex + 1) % DIVIDER_ALIGNMENTS.length;
|
|
@@ -6213,10 +6701,10 @@ var DividerToolbar = () => {
|
|
|
6213
6701
|
attributes: { ...currentElement.attributes, align: nextAlign }
|
|
6214
6702
|
});
|
|
6215
6703
|
}, [focusIdx, currentElement, currentAlign, updateElement]);
|
|
6216
|
-
return /* @__PURE__ */
|
|
6217
|
-
/* @__PURE__ */
|
|
6218
|
-
/* @__PURE__ */
|
|
6219
|
-
/* @__PURE__ */
|
|
6704
|
+
return /* @__PURE__ */ jsxs48(ToolbarContainer, { children: [
|
|
6705
|
+
/* @__PURE__ */ jsx59(ToolbarContent, { children: /* @__PURE__ */ jsx59(BasicOption, {}) }),
|
|
6706
|
+
/* @__PURE__ */ jsx59(ToolbarSeparator, {}),
|
|
6707
|
+
/* @__PURE__ */ jsx59(ToolbarContent, { children: /* @__PURE__ */ jsx59(
|
|
6220
6708
|
BackgroundColorBtn,
|
|
6221
6709
|
{
|
|
6222
6710
|
activeView,
|
|
@@ -6225,29 +6713,29 @@ var DividerToolbar = () => {
|
|
|
6225
6713
|
currentBgColor: currentBgColor || "transparent"
|
|
6226
6714
|
}
|
|
6227
6715
|
) }),
|
|
6228
|
-
/* @__PURE__ */
|
|
6229
|
-
/* @__PURE__ */
|
|
6230
|
-
/* @__PURE__ */
|
|
6231
|
-
/* @__PURE__ */
|
|
6716
|
+
/* @__PURE__ */ jsx59(ToolbarSeparator, {}),
|
|
6717
|
+
/* @__PURE__ */ jsxs48(ToolbarContent, { children: [
|
|
6718
|
+
/* @__PURE__ */ jsxs48(Tooltip, { children: [
|
|
6719
|
+
/* @__PURE__ */ jsx59(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx59(
|
|
6232
6720
|
Button,
|
|
6233
6721
|
{
|
|
6234
6722
|
variant: "ghost",
|
|
6235
6723
|
className: "shadow-none transition-none cursor-pointer rounded-[12px]",
|
|
6236
6724
|
size: "icon",
|
|
6237
6725
|
onClick: handleOpenStrokeColorPicker,
|
|
6238
|
-
children: /* @__PURE__ */
|
|
6726
|
+
children: /* @__PURE__ */ jsx59(
|
|
6239
6727
|
"div",
|
|
6240
6728
|
{
|
|
6241
6729
|
className: "w-5 h-5 rounded-full border justify-center items-center flex",
|
|
6242
6730
|
style: { backgroundColor: border.color },
|
|
6243
|
-
children: /* @__PURE__ */
|
|
6731
|
+
children: /* @__PURE__ */ jsx59("div", { className: "w-[50%] h-[50%] bg-secondary rounded-full" })
|
|
6244
6732
|
}
|
|
6245
6733
|
)
|
|
6246
6734
|
}
|
|
6247
6735
|
) }),
|
|
6248
|
-
/* @__PURE__ */
|
|
6736
|
+
/* @__PURE__ */ jsx59(TooltipContent, { side: "bottom", className: "z-51", children: "Stroke Color" })
|
|
6249
6737
|
] }),
|
|
6250
|
-
/* @__PURE__ */
|
|
6738
|
+
/* @__PURE__ */ jsx59(
|
|
6251
6739
|
StrokeWeight2,
|
|
6252
6740
|
{
|
|
6253
6741
|
width: border.width,
|
|
@@ -6257,57 +6745,57 @@ var DividerToolbar = () => {
|
|
|
6257
6745
|
tooltipText: "Stroke Weight"
|
|
6258
6746
|
}
|
|
6259
6747
|
),
|
|
6260
|
-
/* @__PURE__ */
|
|
6748
|
+
/* @__PURE__ */ jsx59(BetterPadding, {})
|
|
6261
6749
|
] }),
|
|
6262
|
-
/* @__PURE__ */
|
|
6263
|
-
/* @__PURE__ */
|
|
6264
|
-
/* @__PURE__ */
|
|
6750
|
+
/* @__PURE__ */ jsx59(ToolbarSeparator, {}),
|
|
6751
|
+
/* @__PURE__ */ jsx59(ToolbarContent, { children: /* @__PURE__ */ jsxs48(Tooltip, { children: [
|
|
6752
|
+
/* @__PURE__ */ jsx59(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx59(
|
|
6265
6753
|
Button,
|
|
6266
6754
|
{
|
|
6267
6755
|
variant: "ghost",
|
|
6268
6756
|
className: "shadow-none transition-none cursor-pointer",
|
|
6269
6757
|
size: "icon",
|
|
6270
6758
|
onClick: handleCycleAlign,
|
|
6271
|
-
children: /* @__PURE__ */
|
|
6759
|
+
children: /* @__PURE__ */ jsx59("img", { src: ALIGNMENT_ICONS[currentAlign], alt: "Align", className: "w-4 h-4" })
|
|
6272
6760
|
}
|
|
6273
6761
|
) }),
|
|
6274
|
-
/* @__PURE__ */
|
|
6762
|
+
/* @__PURE__ */ jsx59(TooltipContent, { side: "bottom", className: "z-51", children: "Align" })
|
|
6275
6763
|
] }) })
|
|
6276
6764
|
] });
|
|
6277
6765
|
};
|
|
6278
6766
|
|
|
6279
6767
|
// src/core/editor/components/element-gear/image/toolbar.tsx
|
|
6280
|
-
import { useCallback as
|
|
6768
|
+
import { useCallback as useCallback35, useMemo as useMemo31 } from "react";
|
|
6281
6769
|
import { get as lodashGet14 } from "lodash";
|
|
6282
|
-
import { jsx as
|
|
6770
|
+
import { jsx as jsx60, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
6283
6771
|
var ImageToolbar = () => {
|
|
6284
6772
|
const { focusIdx, template, updateElement } = useEditorStore();
|
|
6285
6773
|
const { activeView, colorTarget, setActiveView, setColorType, setColorTarget } = useSidebarContext();
|
|
6286
|
-
const currentElement =
|
|
6774
|
+
const currentElement = useMemo31(() => {
|
|
6287
6775
|
if (!focusIdx || !template) return null;
|
|
6288
6776
|
const path = focusIdx.startsWith("content.") ? focusIdx.replace("content.", "content[0].").replace(/\.\[(\d+)\]/g, "[$1]") : focusIdx;
|
|
6289
6777
|
return lodashGet14(template, path);
|
|
6290
6778
|
}, [focusIdx, template]);
|
|
6291
|
-
const currentBgColor =
|
|
6779
|
+
const currentBgColor = useMemo31(() => {
|
|
6292
6780
|
return currentElement?.attributes?.["container-background-color"];
|
|
6293
6781
|
}, [currentElement]);
|
|
6294
|
-
const currentAlign =
|
|
6782
|
+
const currentAlign = useMemo31(() => {
|
|
6295
6783
|
return currentElement?.attributes?.["align"] || "center";
|
|
6296
6784
|
}, [currentElement]);
|
|
6297
6785
|
const border = useBorder();
|
|
6298
6786
|
const borderRadius = useBorderRadius();
|
|
6299
6787
|
const padding = usePadding();
|
|
6300
|
-
const handleOpenBgColorPicker =
|
|
6788
|
+
const handleOpenBgColorPicker = useCallback35(() => {
|
|
6301
6789
|
setColorType("Background Color");
|
|
6302
6790
|
setColorTarget("imageBgColor");
|
|
6303
6791
|
setActiveView("color");
|
|
6304
6792
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
6305
|
-
const handleOpenStrokeColorPicker =
|
|
6793
|
+
const handleOpenStrokeColorPicker = useCallback35(() => {
|
|
6306
6794
|
setColorType("Stroke Color");
|
|
6307
6795
|
setColorTarget("strokeColor");
|
|
6308
6796
|
setActiveView("color");
|
|
6309
6797
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
6310
|
-
const handleCycleAlign =
|
|
6798
|
+
const handleCycleAlign = useCallback35(() => {
|
|
6311
6799
|
if (!focusIdx || !currentElement) return;
|
|
6312
6800
|
const currentIndex = BUTTON_ALIGNMENTS.indexOf(currentAlign);
|
|
6313
6801
|
const nextIndex = (currentIndex + 1) % BUTTON_ALIGNMENTS.length;
|
|
@@ -6316,11 +6804,11 @@ var ImageToolbar = () => {
|
|
|
6316
6804
|
attributes: { ...currentElement.attributes, align: nextAlign }
|
|
6317
6805
|
});
|
|
6318
6806
|
}, [focusIdx, currentElement, currentAlign, updateElement]);
|
|
6319
|
-
return /* @__PURE__ */
|
|
6320
|
-
/* @__PURE__ */
|
|
6321
|
-
/* @__PURE__ */
|
|
6322
|
-
/* @__PURE__ */
|
|
6323
|
-
/* @__PURE__ */
|
|
6807
|
+
return /* @__PURE__ */ jsxs49(ToolbarContainer, { children: [
|
|
6808
|
+
/* @__PURE__ */ jsx60(ToolbarContent, { children: /* @__PURE__ */ jsx60(BasicOption, {}) }),
|
|
6809
|
+
/* @__PURE__ */ jsx60(ToolbarSeparator, {}),
|
|
6810
|
+
/* @__PURE__ */ jsxs49(ToolbarContent, { children: [
|
|
6811
|
+
/* @__PURE__ */ jsx60(
|
|
6324
6812
|
BackgroundColorBtn,
|
|
6325
6813
|
{
|
|
6326
6814
|
activeView,
|
|
@@ -6329,31 +6817,31 @@ var ImageToolbar = () => {
|
|
|
6329
6817
|
currentBgColor: currentBgColor || "transparent"
|
|
6330
6818
|
}
|
|
6331
6819
|
),
|
|
6332
|
-
/* @__PURE__ */
|
|
6820
|
+
/* @__PURE__ */ jsx60(ImageMenu, { type: "image" })
|
|
6333
6821
|
] }),
|
|
6334
|
-
/* @__PURE__ */
|
|
6335
|
-
/* @__PURE__ */
|
|
6336
|
-
border.isEnabled && /* @__PURE__ */
|
|
6337
|
-
/* @__PURE__ */
|
|
6822
|
+
/* @__PURE__ */ jsx60(ToolbarSeparator, {}),
|
|
6823
|
+
/* @__PURE__ */ jsxs49(ToolbarContent, { children: [
|
|
6824
|
+
border.isEnabled && /* @__PURE__ */ jsxs49(Tooltip, { children: [
|
|
6825
|
+
/* @__PURE__ */ jsx60(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx60(
|
|
6338
6826
|
Button,
|
|
6339
6827
|
{
|
|
6340
6828
|
variant: "ghost",
|
|
6341
6829
|
className: `shadow-none transition-none cursor-pointer rounded-[12px] ${activeView === "color" && colorTarget === "strokeColor" ? "bg-muted" : ""}`,
|
|
6342
6830
|
size: "icon",
|
|
6343
6831
|
onClick: handleOpenStrokeColorPicker,
|
|
6344
|
-
children: /* @__PURE__ */
|
|
6832
|
+
children: /* @__PURE__ */ jsx60(
|
|
6345
6833
|
"div",
|
|
6346
6834
|
{
|
|
6347
6835
|
className: "w-5 h-5 rounded-full border justify-center items-center flex",
|
|
6348
6836
|
style: { backgroundColor: border.color },
|
|
6349
|
-
children: /* @__PURE__ */
|
|
6837
|
+
children: /* @__PURE__ */ jsx60("div", { className: "w-[50%] h-[50%] bg-secondary rounded-full" })
|
|
6350
6838
|
}
|
|
6351
6839
|
)
|
|
6352
6840
|
}
|
|
6353
6841
|
) }),
|
|
6354
|
-
/* @__PURE__ */
|
|
6842
|
+
/* @__PURE__ */ jsx60(TooltipContent, { side: "bottom", className: "z-51", children: "Stroke Color" })
|
|
6355
6843
|
] }),
|
|
6356
|
-
/* @__PURE__ */
|
|
6844
|
+
/* @__PURE__ */ jsx60(
|
|
6357
6845
|
StrokeWeight,
|
|
6358
6846
|
{
|
|
6359
6847
|
width: border.width,
|
|
@@ -6362,7 +6850,7 @@ var ImageToolbar = () => {
|
|
|
6362
6850
|
onEnabledChange: border.setEnabled
|
|
6363
6851
|
}
|
|
6364
6852
|
),
|
|
6365
|
-
/* @__PURE__ */
|
|
6853
|
+
/* @__PURE__ */ jsx60(
|
|
6366
6854
|
BorderRadius,
|
|
6367
6855
|
{
|
|
6368
6856
|
value: borderRadius.value,
|
|
@@ -6370,41 +6858,41 @@ var ImageToolbar = () => {
|
|
|
6370
6858
|
tooltipText: "Corner Rounding"
|
|
6371
6859
|
}
|
|
6372
6860
|
),
|
|
6373
|
-
/* @__PURE__ */
|
|
6861
|
+
/* @__PURE__ */ jsx60(BetterPadding, {})
|
|
6374
6862
|
] }),
|
|
6375
|
-
/* @__PURE__ */
|
|
6376
|
-
/* @__PURE__ */
|
|
6377
|
-
/* @__PURE__ */
|
|
6863
|
+
/* @__PURE__ */ jsx60(ToolbarSeparator, {}),
|
|
6864
|
+
/* @__PURE__ */ jsx60(ToolbarContent, { children: /* @__PURE__ */ jsxs49(Tooltip, { children: [
|
|
6865
|
+
/* @__PURE__ */ jsx60(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx60(
|
|
6378
6866
|
Button,
|
|
6379
6867
|
{
|
|
6380
6868
|
variant: "ghost",
|
|
6381
6869
|
className: "shadow-none transition-none cursor-pointer",
|
|
6382
6870
|
size: "icon",
|
|
6383
6871
|
onClick: handleCycleAlign,
|
|
6384
|
-
children: /* @__PURE__ */
|
|
6872
|
+
children: /* @__PURE__ */ jsx60("img", { src: ALIGNMENT_ICONS[currentAlign], alt: "Align", className: "w-4 h-4" })
|
|
6385
6873
|
}
|
|
6386
6874
|
) }),
|
|
6387
|
-
/* @__PURE__ */
|
|
6875
|
+
/* @__PURE__ */ jsx60(TooltipContent, { side: "bottom", children: "Align" })
|
|
6388
6876
|
] }) })
|
|
6389
6877
|
] });
|
|
6390
6878
|
};
|
|
6391
6879
|
|
|
6392
6880
|
// src/core/editor/components/element-gear/property/toolbar.tsx
|
|
6393
|
-
import { useMemo as
|
|
6881
|
+
import { useMemo as useMemo33, useCallback as useCallback37 } from "react";
|
|
6394
6882
|
|
|
6395
6883
|
// src/core/editor/components/property-edit-menu.tsx
|
|
6396
6884
|
import { ChevronDownIcon as ChevronDownIcon4, CircleCheckIcon, HouseIcon } from "lucide-react";
|
|
6397
|
-
import { useState as
|
|
6885
|
+
import { useState as useState18, useCallback as useCallback36, useMemo as useMemo32, useEffect as useEffect12 } from "react";
|
|
6398
6886
|
|
|
6399
6887
|
// src/components/ui/checkbox.tsx
|
|
6400
6888
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
6401
6889
|
import { CheckIcon as CheckIcon8 } from "lucide-react";
|
|
6402
|
-
import { jsx as
|
|
6890
|
+
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
6403
6891
|
function Checkbox({
|
|
6404
6892
|
className,
|
|
6405
6893
|
...props
|
|
6406
6894
|
}) {
|
|
6407
|
-
return /* @__PURE__ */
|
|
6895
|
+
return /* @__PURE__ */ jsx61(
|
|
6408
6896
|
CheckboxPrimitive.Root,
|
|
6409
6897
|
{
|
|
6410
6898
|
"data-slot": "checkbox",
|
|
@@ -6413,12 +6901,12 @@ function Checkbox({
|
|
|
6413
6901
|
className
|
|
6414
6902
|
),
|
|
6415
6903
|
...props,
|
|
6416
|
-
children: /* @__PURE__ */
|
|
6904
|
+
children: /* @__PURE__ */ jsx61(
|
|
6417
6905
|
CheckboxPrimitive.Indicator,
|
|
6418
6906
|
{
|
|
6419
6907
|
"data-slot": "checkbox-indicator",
|
|
6420
6908
|
className: "grid place-content-center text-current transition-none",
|
|
6421
|
-
children: /* @__PURE__ */
|
|
6909
|
+
children: /* @__PURE__ */ jsx61(CheckIcon8, { className: "size-3.5" })
|
|
6422
6910
|
}
|
|
6423
6911
|
)
|
|
6424
6912
|
}
|
|
@@ -6428,7 +6916,7 @@ function Checkbox({
|
|
|
6428
6916
|
// src/components/ui/toggle.tsx
|
|
6429
6917
|
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
6430
6918
|
import { cva as cva3 } from "class-variance-authority";
|
|
6431
|
-
import { jsx as
|
|
6919
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
6432
6920
|
var toggleVariants = cva3(
|
|
6433
6921
|
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
|
|
6434
6922
|
{
|
|
@@ -6455,7 +6943,7 @@ function Toggle({
|
|
|
6455
6943
|
size,
|
|
6456
6944
|
...props
|
|
6457
6945
|
}) {
|
|
6458
|
-
return /* @__PURE__ */
|
|
6946
|
+
return /* @__PURE__ */ jsx62(
|
|
6459
6947
|
TogglePrimitive.Root,
|
|
6460
6948
|
{
|
|
6461
6949
|
"data-slot": "toggle",
|
|
@@ -6466,7 +6954,7 @@ function Toggle({
|
|
|
6466
6954
|
}
|
|
6467
6955
|
|
|
6468
6956
|
// src/core/editor/components/property-edit-menu.tsx
|
|
6469
|
-
import { jsx as
|
|
6957
|
+
import { jsx as jsx63, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
6470
6958
|
var CARD_FEATURES = {
|
|
6471
6959
|
"property-card": { status: true, openhouse: true, brokerage: true, description: true },
|
|
6472
6960
|
"property-card-single-two": { status: true, openhouse: false, brokerage: true, description: false },
|
|
@@ -6475,27 +6963,27 @@ var CARD_FEATURES = {
|
|
|
6475
6963
|
var PropertyEditMenu = () => {
|
|
6476
6964
|
const { focusIdx, template, updateElement } = useEditorStore();
|
|
6477
6965
|
const { activeView, colorTarget, setActiveView, setColorType, setColorTarget } = useSidebarContext();
|
|
6478
|
-
const [isOpen, setIsOpen] =
|
|
6479
|
-
const [openSection, setOpenSection] =
|
|
6480
|
-
const [openhouseEnabled, setOpenhouseEnabled] =
|
|
6481
|
-
const [openhouseDate, setOpenhouseDate] =
|
|
6482
|
-
const [openhouseStartTime, setOpenhouseStartTime] =
|
|
6483
|
-
const [openhouseEndTime, setOpenhouseEndTime] =
|
|
6484
|
-
const propertyElement =
|
|
6966
|
+
const [isOpen, setIsOpen] = useState18(false);
|
|
6967
|
+
const [openSection, setOpenSection] = useState18(null);
|
|
6968
|
+
const [openhouseEnabled, setOpenhouseEnabled] = useState18(true);
|
|
6969
|
+
const [openhouseDate, setOpenhouseDate] = useState18(/* @__PURE__ */ new Date());
|
|
6970
|
+
const [openhouseStartTime, setOpenhouseStartTime] = useState18("12:00");
|
|
6971
|
+
const [openhouseEndTime, setOpenhouseEndTime] = useState18("13:00");
|
|
6972
|
+
const propertyElement = useMemo32(() => {
|
|
6485
6973
|
if (!focusIdx || !template) return null;
|
|
6486
6974
|
return getValueByIdx(template, focusIdx);
|
|
6487
6975
|
}, [focusIdx, template]);
|
|
6488
6976
|
const cardType = propertyElement?.type;
|
|
6489
6977
|
const features = cardType ? CARD_FEATURES[cardType] : null;
|
|
6490
|
-
const currentPrice =
|
|
6978
|
+
const currentPrice = useMemo32(() => {
|
|
6491
6979
|
const rawPrice = propertyElement?.attributes?.["price"] || "";
|
|
6492
6980
|
return parsePrice(rawPrice);
|
|
6493
6981
|
}, [propertyElement]);
|
|
6494
|
-
const [priceInput, setPriceInput] =
|
|
6495
|
-
|
|
6982
|
+
const [priceInput, setPriceInput] = useState18(currentPrice);
|
|
6983
|
+
useEffect12(() => {
|
|
6496
6984
|
setPriceInput(currentPrice);
|
|
6497
6985
|
}, [currentPrice]);
|
|
6498
|
-
const handlePriceBlur =
|
|
6986
|
+
const handlePriceBlur = useCallback36(() => {
|
|
6499
6987
|
if (!focusIdx || !propertyElement) return;
|
|
6500
6988
|
if (priceInput === currentPrice) return;
|
|
6501
6989
|
updateElement(focusIdx, {
|
|
@@ -6505,73 +6993,73 @@ var PropertyEditMenu = () => {
|
|
|
6505
6993
|
}
|
|
6506
6994
|
});
|
|
6507
6995
|
}, [focusIdx, propertyElement, priceInput, currentPrice, updateElement]);
|
|
6508
|
-
const currentBeds =
|
|
6509
|
-
const currentBaths =
|
|
6510
|
-
const currentSqft =
|
|
6511
|
-
const currentDescription =
|
|
6512
|
-
const currentIsDescription =
|
|
6513
|
-
const currentBrokerage =
|
|
6514
|
-
const currentIsBrokerage =
|
|
6515
|
-
const currentStatus =
|
|
6516
|
-
const currentIsStatus =
|
|
6517
|
-
const currentIsNew =
|
|
6518
|
-
const currentStatusColor =
|
|
6519
|
-
const currentIsOpenHouse =
|
|
6520
|
-
const currentOpenHouseDate =
|
|
6521
|
-
const currentOpenHouseTime =
|
|
6522
|
-
const currentAddress =
|
|
6523
|
-
const currentCity =
|
|
6524
|
-
const currentCountry =
|
|
6525
|
-
const [bedsInput, setBedsInput] =
|
|
6526
|
-
const [bathsInput, setBathsInput] =
|
|
6527
|
-
const [sqftInput, setSqftInput] =
|
|
6528
|
-
const [descriptionInput, setDescriptionInput] =
|
|
6529
|
-
const [isDescriptionEnabled, setIsDescriptionEnabled] =
|
|
6530
|
-
const [brokerageInput, setBrokerageInput] =
|
|
6531
|
-
const [isBrokerageEnabled, setIsBrokerageEnabled] =
|
|
6532
|
-
const [statusInput, setStatusInput] =
|
|
6533
|
-
const [isStatusEnabled, setIsStatusEnabled] =
|
|
6534
|
-
const [isNewEnabled, setIsNewEnabled] =
|
|
6535
|
-
const [addressLine1Input, setAddressLine1Input] =
|
|
6536
|
-
const [addressLine2Input, setAddressLine2Input] =
|
|
6537
|
-
const [cityInput, setCityInput] =
|
|
6538
|
-
const [stateInput, setStateInput] =
|
|
6539
|
-
const [zipInput, setZipInput] =
|
|
6540
|
-
const [countryInput, setCountryInput] =
|
|
6541
|
-
|
|
6996
|
+
const currentBeds = useMemo32(() => propertyElement?.attributes?.["beds"] || "", [propertyElement]);
|
|
6997
|
+
const currentBaths = useMemo32(() => propertyElement?.attributes?.["baths"] || "", [propertyElement]);
|
|
6998
|
+
const currentSqft = useMemo32(() => propertyElement?.attributes?.["sqft"] || "", [propertyElement]);
|
|
6999
|
+
const currentDescription = useMemo32(() => propertyElement?.attributes?.["description"] || "", [propertyElement]);
|
|
7000
|
+
const currentIsDescription = useMemo32(() => propertyElement?.attributes?.["is-description"] || "", [propertyElement]);
|
|
7001
|
+
const currentBrokerage = useMemo32(() => propertyElement?.attributes?.["brokerage"] || "", [propertyElement]);
|
|
7002
|
+
const currentIsBrokerage = useMemo32(() => propertyElement?.attributes?.["is-brokerage"] || "", [propertyElement]);
|
|
7003
|
+
const currentStatus = useMemo32(() => propertyElement?.attributes?.["status"] || "", [propertyElement]);
|
|
7004
|
+
const currentIsStatus = useMemo32(() => propertyElement?.attributes?.["is-status"] || "", [propertyElement]);
|
|
7005
|
+
const currentIsNew = useMemo32(() => propertyElement?.attributes?.["is-new"] || "", [propertyElement]);
|
|
7006
|
+
const currentStatusColor = useMemo32(() => propertyElement?.attributes?.["status-color"] || "#B8B8B8", [propertyElement]);
|
|
7007
|
+
const currentIsOpenHouse = useMemo32(() => propertyElement?.attributes?.["is-open-house"] || "", [propertyElement]);
|
|
7008
|
+
const currentOpenHouseDate = useMemo32(() => propertyElement?.attributes?.["open-house-date"] || "", [propertyElement]);
|
|
7009
|
+
const currentOpenHouseTime = useMemo32(() => propertyElement?.attributes?.["open-house-time"] || "", [propertyElement]);
|
|
7010
|
+
const currentAddress = useMemo32(() => propertyElement?.attributes?.["address"] || "", [propertyElement]);
|
|
7011
|
+
const currentCity = useMemo32(() => propertyElement?.attributes?.["city"] || "", [propertyElement]);
|
|
7012
|
+
const currentCountry = useMemo32(() => propertyElement?.attributes?.["country"] || "USA", [propertyElement]);
|
|
7013
|
+
const [bedsInput, setBedsInput] = useState18(currentBeds);
|
|
7014
|
+
const [bathsInput, setBathsInput] = useState18(currentBaths);
|
|
7015
|
+
const [sqftInput, setSqftInput] = useState18(currentSqft);
|
|
7016
|
+
const [descriptionInput, setDescriptionInput] = useState18(currentDescription);
|
|
7017
|
+
const [isDescriptionEnabled, setIsDescriptionEnabled] = useState18(!!currentIsDescription);
|
|
7018
|
+
const [brokerageInput, setBrokerageInput] = useState18(currentBrokerage);
|
|
7019
|
+
const [isBrokerageEnabled, setIsBrokerageEnabled] = useState18(!!currentIsBrokerage);
|
|
7020
|
+
const [statusInput, setStatusInput] = useState18(currentStatus);
|
|
7021
|
+
const [isStatusEnabled, setIsStatusEnabled] = useState18(!!currentIsStatus);
|
|
7022
|
+
const [isNewEnabled, setIsNewEnabled] = useState18(!!currentIsNew);
|
|
7023
|
+
const [addressLine1Input, setAddressLine1Input] = useState18("");
|
|
7024
|
+
const [addressLine2Input, setAddressLine2Input] = useState18("");
|
|
7025
|
+
const [cityInput, setCityInput] = useState18("");
|
|
7026
|
+
const [stateInput, setStateInput] = useState18("");
|
|
7027
|
+
const [zipInput, setZipInput] = useState18("");
|
|
7028
|
+
const [countryInput, setCountryInput] = useState18("USA");
|
|
7029
|
+
useEffect12(() => {
|
|
6542
7030
|
setBedsInput(currentBeds);
|
|
6543
7031
|
}, [currentBeds]);
|
|
6544
|
-
|
|
7032
|
+
useEffect12(() => {
|
|
6545
7033
|
setBathsInput(currentBaths);
|
|
6546
7034
|
}, [currentBaths]);
|
|
6547
|
-
|
|
7035
|
+
useEffect12(() => {
|
|
6548
7036
|
setSqftInput(currentSqft);
|
|
6549
7037
|
}, [currentSqft]);
|
|
6550
|
-
|
|
7038
|
+
useEffect12(() => {
|
|
6551
7039
|
setDescriptionInput(currentDescription);
|
|
6552
7040
|
}, [currentDescription]);
|
|
6553
|
-
|
|
7041
|
+
useEffect12(() => {
|
|
6554
7042
|
setIsDescriptionEnabled(!!currentIsDescription);
|
|
6555
7043
|
}, [currentIsDescription]);
|
|
6556
|
-
|
|
7044
|
+
useEffect12(() => {
|
|
6557
7045
|
setBrokerageInput(currentBrokerage);
|
|
6558
7046
|
}, [currentBrokerage]);
|
|
6559
|
-
|
|
7047
|
+
useEffect12(() => {
|
|
6560
7048
|
setIsBrokerageEnabled(!!currentIsBrokerage);
|
|
6561
7049
|
}, [currentIsBrokerage]);
|
|
6562
|
-
|
|
7050
|
+
useEffect12(() => {
|
|
6563
7051
|
setStatusInput(currentStatus);
|
|
6564
7052
|
}, [currentStatus]);
|
|
6565
|
-
|
|
7053
|
+
useEffect12(() => {
|
|
6566
7054
|
setIsStatusEnabled(!!currentIsStatus);
|
|
6567
7055
|
}, [currentIsStatus]);
|
|
6568
|
-
|
|
7056
|
+
useEffect12(() => {
|
|
6569
7057
|
setIsNewEnabled(!!currentIsNew);
|
|
6570
7058
|
}, [currentIsNew]);
|
|
6571
|
-
|
|
7059
|
+
useEffect12(() => {
|
|
6572
7060
|
setOpenhouseEnabled(!!currentIsOpenHouse);
|
|
6573
7061
|
}, [currentIsOpenHouse]);
|
|
6574
|
-
|
|
7062
|
+
useEffect12(() => {
|
|
6575
7063
|
if (currentOpenHouseDate) {
|
|
6576
7064
|
const parsed = new Date(currentOpenHouseDate);
|
|
6577
7065
|
if (!isNaN(parsed.getTime())) {
|
|
@@ -6579,18 +7067,18 @@ var PropertyEditMenu = () => {
|
|
|
6579
7067
|
}
|
|
6580
7068
|
}
|
|
6581
7069
|
}, [currentOpenHouseDate]);
|
|
6582
|
-
|
|
7070
|
+
useEffect12(() => {
|
|
6583
7071
|
if (currentOpenHouseTime) {
|
|
6584
7072
|
const [start, end] = currentOpenHouseTime.split("-");
|
|
6585
7073
|
if (start) setOpenhouseStartTime(start);
|
|
6586
7074
|
if (end) setOpenhouseEndTime(end);
|
|
6587
7075
|
}
|
|
6588
7076
|
}, [currentOpenHouseTime]);
|
|
6589
|
-
|
|
7077
|
+
useEffect12(() => {
|
|
6590
7078
|
setAddressLine1Input(currentAddress);
|
|
6591
7079
|
setAddressLine2Input("");
|
|
6592
7080
|
}, [currentAddress]);
|
|
6593
|
-
|
|
7081
|
+
useEffect12(() => {
|
|
6594
7082
|
const match = currentCity.match(/^(.+),\s*(\w{2})\s*(\d{5})?$/);
|
|
6595
7083
|
if (match) {
|
|
6596
7084
|
setCityInput(match[1] || "");
|
|
@@ -6602,10 +7090,10 @@ var PropertyEditMenu = () => {
|
|
|
6602
7090
|
setZipInput("");
|
|
6603
7091
|
}
|
|
6604
7092
|
}, [currentCity]);
|
|
6605
|
-
|
|
7093
|
+
useEffect12(() => {
|
|
6606
7094
|
setCountryInput(currentCountry);
|
|
6607
7095
|
}, [currentCountry]);
|
|
6608
|
-
const handleBedsBlur =
|
|
7096
|
+
const handleBedsBlur = useCallback36(() => {
|
|
6609
7097
|
if (!focusIdx || !propertyElement) return;
|
|
6610
7098
|
if (bedsInput === currentBeds) return;
|
|
6611
7099
|
updateElement(focusIdx, {
|
|
@@ -6615,7 +7103,7 @@ var PropertyEditMenu = () => {
|
|
|
6615
7103
|
}
|
|
6616
7104
|
});
|
|
6617
7105
|
}, [focusIdx, propertyElement, bedsInput, currentBeds, updateElement]);
|
|
6618
|
-
const handleBathsBlur =
|
|
7106
|
+
const handleBathsBlur = useCallback36(() => {
|
|
6619
7107
|
if (!focusIdx || !propertyElement) return;
|
|
6620
7108
|
if (bathsInput === currentBaths) return;
|
|
6621
7109
|
updateElement(focusIdx, {
|
|
@@ -6625,7 +7113,7 @@ var PropertyEditMenu = () => {
|
|
|
6625
7113
|
}
|
|
6626
7114
|
});
|
|
6627
7115
|
}, [focusIdx, propertyElement, bathsInput, currentBaths, updateElement]);
|
|
6628
|
-
const handleSqftBlur =
|
|
7116
|
+
const handleSqftBlur = useCallback36(() => {
|
|
6629
7117
|
if (!focusIdx || !propertyElement) return;
|
|
6630
7118
|
if (sqftInput === currentSqft) return;
|
|
6631
7119
|
updateElement(focusIdx, {
|
|
@@ -6635,7 +7123,7 @@ var PropertyEditMenu = () => {
|
|
|
6635
7123
|
}
|
|
6636
7124
|
});
|
|
6637
7125
|
}, [focusIdx, propertyElement, sqftInput, currentSqft, updateElement]);
|
|
6638
|
-
const handleDescriptionBlur =
|
|
7126
|
+
const handleDescriptionBlur = useCallback36(() => {
|
|
6639
7127
|
if (!focusIdx || !propertyElement) return;
|
|
6640
7128
|
if (descriptionInput === currentDescription) return;
|
|
6641
7129
|
updateElement(focusIdx, {
|
|
@@ -6645,7 +7133,7 @@ var PropertyEditMenu = () => {
|
|
|
6645
7133
|
}
|
|
6646
7134
|
});
|
|
6647
7135
|
}, [focusIdx, propertyElement, descriptionInput, currentDescription, updateElement]);
|
|
6648
|
-
const handleIsDescriptionChange =
|
|
7136
|
+
const handleIsDescriptionChange = useCallback36((checked) => {
|
|
6649
7137
|
setIsDescriptionEnabled(checked);
|
|
6650
7138
|
if (!focusIdx || !propertyElement) return;
|
|
6651
7139
|
updateElement(focusIdx, {
|
|
@@ -6655,7 +7143,7 @@ var PropertyEditMenu = () => {
|
|
|
6655
7143
|
}
|
|
6656
7144
|
});
|
|
6657
7145
|
}, [focusIdx, propertyElement, updateElement]);
|
|
6658
|
-
const handleBrokerageBlur =
|
|
7146
|
+
const handleBrokerageBlur = useCallback36(() => {
|
|
6659
7147
|
if (!focusIdx || !propertyElement) return;
|
|
6660
7148
|
if (brokerageInput === currentBrokerage) return;
|
|
6661
7149
|
updateElement(focusIdx, {
|
|
@@ -6665,7 +7153,7 @@ var PropertyEditMenu = () => {
|
|
|
6665
7153
|
}
|
|
6666
7154
|
});
|
|
6667
7155
|
}, [focusIdx, propertyElement, brokerageInput, currentBrokerage, updateElement]);
|
|
6668
|
-
const handleIsBrokerageChange =
|
|
7156
|
+
const handleIsBrokerageChange = useCallback36((checked) => {
|
|
6669
7157
|
setIsBrokerageEnabled(checked);
|
|
6670
7158
|
if (!focusIdx || !propertyElement) return;
|
|
6671
7159
|
updateElement(focusIdx, {
|
|
@@ -6675,7 +7163,7 @@ var PropertyEditMenu = () => {
|
|
|
6675
7163
|
}
|
|
6676
7164
|
});
|
|
6677
7165
|
}, [focusIdx, propertyElement, updateElement]);
|
|
6678
|
-
const handleStatusBlur =
|
|
7166
|
+
const handleStatusBlur = useCallback36(() => {
|
|
6679
7167
|
if (!focusIdx || !propertyElement) return;
|
|
6680
7168
|
if (statusInput === currentStatus) return;
|
|
6681
7169
|
updateElement(focusIdx, {
|
|
@@ -6685,7 +7173,7 @@ var PropertyEditMenu = () => {
|
|
|
6685
7173
|
}
|
|
6686
7174
|
});
|
|
6687
7175
|
}, [focusIdx, propertyElement, statusInput, currentStatus, updateElement]);
|
|
6688
|
-
const handleIsStatusChange =
|
|
7176
|
+
const handleIsStatusChange = useCallback36((checked) => {
|
|
6689
7177
|
setIsStatusEnabled(checked);
|
|
6690
7178
|
if (!focusIdx || !propertyElement) return;
|
|
6691
7179
|
updateElement(focusIdx, {
|
|
@@ -6695,7 +7183,7 @@ var PropertyEditMenu = () => {
|
|
|
6695
7183
|
}
|
|
6696
7184
|
});
|
|
6697
7185
|
}, [focusIdx, propertyElement, updateElement]);
|
|
6698
|
-
const handleIsNewChange =
|
|
7186
|
+
const handleIsNewChange = useCallback36((checked) => {
|
|
6699
7187
|
setIsNewEnabled(checked);
|
|
6700
7188
|
if (!focusIdx || !propertyElement) return;
|
|
6701
7189
|
updateElement(focusIdx, {
|
|
@@ -6705,7 +7193,7 @@ var PropertyEditMenu = () => {
|
|
|
6705
7193
|
}
|
|
6706
7194
|
});
|
|
6707
7195
|
}, [focusIdx, propertyElement, updateElement]);
|
|
6708
|
-
const handleIsOpenHouseChange =
|
|
7196
|
+
const handleIsOpenHouseChange = useCallback36((checked) => {
|
|
6709
7197
|
setOpenhouseEnabled(checked);
|
|
6710
7198
|
if (!focusIdx || !propertyElement) return;
|
|
6711
7199
|
updateElement(focusIdx, {
|
|
@@ -6715,7 +7203,7 @@ var PropertyEditMenu = () => {
|
|
|
6715
7203
|
}
|
|
6716
7204
|
});
|
|
6717
7205
|
}, [focusIdx, propertyElement, updateElement]);
|
|
6718
|
-
const handleOpenHouseDateBlur =
|
|
7206
|
+
const handleOpenHouseDateBlur = useCallback36(() => {
|
|
6719
7207
|
if (!focusIdx || !propertyElement) return;
|
|
6720
7208
|
const newDate = openhouseDate ? openhouseDate.toISOString().split("T")[0] : "";
|
|
6721
7209
|
if (newDate === currentOpenHouseDate) return;
|
|
@@ -6726,7 +7214,7 @@ var PropertyEditMenu = () => {
|
|
|
6726
7214
|
}
|
|
6727
7215
|
});
|
|
6728
7216
|
}, [focusIdx, propertyElement, openhouseDate, currentOpenHouseDate, updateElement]);
|
|
6729
|
-
const handleOpenHouseTimeBlur =
|
|
7217
|
+
const handleOpenHouseTimeBlur = useCallback36(() => {
|
|
6730
7218
|
if (!focusIdx || !propertyElement) return;
|
|
6731
7219
|
const newTime = `${openhouseStartTime}-${openhouseEndTime}`;
|
|
6732
7220
|
if (newTime === currentOpenHouseTime) return;
|
|
@@ -6737,7 +7225,7 @@ var PropertyEditMenu = () => {
|
|
|
6737
7225
|
}
|
|
6738
7226
|
});
|
|
6739
7227
|
}, [focusIdx, propertyElement, openhouseStartTime, openhouseEndTime, currentOpenHouseTime, updateElement]);
|
|
6740
|
-
const handleAddressBlur =
|
|
7228
|
+
const handleAddressBlur = useCallback36(() => {
|
|
6741
7229
|
if (!focusIdx || !propertyElement) return;
|
|
6742
7230
|
const newAddress = addressLine2Input ? `${addressLine1Input}, ${addressLine2Input}` : addressLine1Input;
|
|
6743
7231
|
if (newAddress === currentAddress) return;
|
|
@@ -6748,7 +7236,7 @@ var PropertyEditMenu = () => {
|
|
|
6748
7236
|
}
|
|
6749
7237
|
});
|
|
6750
7238
|
}, [focusIdx, propertyElement, addressLine1Input, addressLine2Input, currentAddress, updateElement]);
|
|
6751
|
-
const handleCityBlur =
|
|
7239
|
+
const handleCityBlur = useCallback36(() => {
|
|
6752
7240
|
if (!focusIdx || !propertyElement) return;
|
|
6753
7241
|
const newCity = zipInput ? `${cityInput}, ${stateInput} ${zipInput}` : stateInput ? `${cityInput}, ${stateInput}` : cityInput;
|
|
6754
7242
|
if (newCity === currentCity) return;
|
|
@@ -6759,7 +7247,7 @@ var PropertyEditMenu = () => {
|
|
|
6759
7247
|
}
|
|
6760
7248
|
});
|
|
6761
7249
|
}, [focusIdx, propertyElement, cityInput, stateInput, zipInput, currentCity, updateElement]);
|
|
6762
|
-
const handleCountryChange =
|
|
7250
|
+
const handleCountryChange = useCallback36((value) => {
|
|
6763
7251
|
setCountryInput(value);
|
|
6764
7252
|
if (!focusIdx || !propertyElement) return;
|
|
6765
7253
|
updateElement(focusIdx, {
|
|
@@ -6769,43 +7257,43 @@ var PropertyEditMenu = () => {
|
|
|
6769
7257
|
}
|
|
6770
7258
|
});
|
|
6771
7259
|
}, [focusIdx, propertyElement, updateElement]);
|
|
6772
|
-
const handleOpenStatusColorPicker =
|
|
7260
|
+
const handleOpenStatusColorPicker = useCallback36(() => {
|
|
6773
7261
|
setColorType("Status Color");
|
|
6774
7262
|
setColorTarget("statusColor");
|
|
6775
7263
|
setActiveView("color");
|
|
6776
7264
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
6777
|
-
const handleToggle =
|
|
7265
|
+
const handleToggle = useCallback36((section) => {
|
|
6778
7266
|
setOpenSection((prev) => prev === section ? null : section);
|
|
6779
7267
|
}, []);
|
|
6780
|
-
const handleTogglePrice =
|
|
6781
|
-
const handleToggleDetails =
|
|
6782
|
-
const handleToggleAddress =
|
|
6783
|
-
const handleToggleStatus =
|
|
6784
|
-
const handleToggleOpenhouse =
|
|
6785
|
-
const handleToggleBrokerage =
|
|
6786
|
-
const handleToggleDescription =
|
|
6787
|
-
const handleToggleMLS =
|
|
6788
|
-
return /* @__PURE__ */
|
|
6789
|
-
/* @__PURE__ */
|
|
6790
|
-
/* @__PURE__ */
|
|
7268
|
+
const handleTogglePrice = useCallback36(() => handleToggle("price"), [handleToggle]);
|
|
7269
|
+
const handleToggleDetails = useCallback36(() => handleToggle("details"), [handleToggle]);
|
|
7270
|
+
const handleToggleAddress = useCallback36(() => handleToggle("address"), [handleToggle]);
|
|
7271
|
+
const handleToggleStatus = useCallback36(() => handleToggle("status"), [handleToggle]);
|
|
7272
|
+
const handleToggleOpenhouse = useCallback36(() => handleToggle("openhouse"), [handleToggle]);
|
|
7273
|
+
const handleToggleBrokerage = useCallback36(() => handleToggle("brokerage"), [handleToggle]);
|
|
7274
|
+
const handleToggleDescription = useCallback36(() => handleToggle("description"), [handleToggle]);
|
|
7275
|
+
const handleToggleMLS = useCallback36(() => handleToggle("mls"), [handleToggle]);
|
|
7276
|
+
return /* @__PURE__ */ jsxs50(Tooltip, { children: [
|
|
7277
|
+
/* @__PURE__ */ jsxs50(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
7278
|
+
/* @__PURE__ */ jsx63(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx63(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx63(
|
|
6791
7279
|
Button,
|
|
6792
7280
|
{
|
|
6793
7281
|
variant: "outline",
|
|
6794
7282
|
className: "shadow-none transition-none cursor-pointer rounded-[12px]",
|
|
6795
7283
|
size: "icon",
|
|
6796
|
-
children: /* @__PURE__ */
|
|
7284
|
+
children: /* @__PURE__ */ jsx63(HouseIcon, { className: "w-4 h-4" })
|
|
6797
7285
|
}
|
|
6798
7286
|
) }) }),
|
|
6799
|
-
/* @__PURE__ */
|
|
6800
|
-
/* @__PURE__ */
|
|
6801
|
-
/* @__PURE__ */
|
|
6802
|
-
/* @__PURE__ */
|
|
6803
|
-
/* @__PURE__ */
|
|
7287
|
+
/* @__PURE__ */ jsxs50(PopoverContent, { className: "w-84 z-51 mt-1 rounded-[12px] p-2 gap-2 flex flex-col z-50001", children: [
|
|
7288
|
+
/* @__PURE__ */ jsxs50(Collapsible, { open: openSection === "price", onOpenChange: handleTogglePrice, children: [
|
|
7289
|
+
/* @__PURE__ */ jsx63(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsx63(Button, { variant: "ghost", className: "w-full shadow-none rounded-[12px] cursor-pointer", children: /* @__PURE__ */ jsxs50("div", { className: "w-full flex flex-row items-center justify-between gap-2", children: [
|
|
7290
|
+
/* @__PURE__ */ jsxs50("p", { children: [
|
|
7291
|
+
/* @__PURE__ */ jsx63("span", { className: "text-red-500", children: "*" }),
|
|
6804
7292
|
"Price"
|
|
6805
7293
|
] }),
|
|
6806
|
-
/* @__PURE__ */
|
|
7294
|
+
/* @__PURE__ */ jsx63(ChevronDownIcon4, { className: `w-4 h-4 transition-transform duration-200 ${openSection === "price" ? "rotate-180" : ""}` })
|
|
6807
7295
|
] }) }) }),
|
|
6808
|
-
/* @__PURE__ */
|
|
7296
|
+
/* @__PURE__ */ jsx63(CollapsibleContent2, { className: "w-full p-2", children: /* @__PURE__ */ jsx63("div", { className: "flex flex-row items-center justify-between gap-2", children: /* @__PURE__ */ jsx63(
|
|
6809
7297
|
Input,
|
|
6810
7298
|
{
|
|
6811
7299
|
type: "number",
|
|
@@ -6817,16 +7305,16 @@ var PropertyEditMenu = () => {
|
|
|
6817
7305
|
}
|
|
6818
7306
|
) }) })
|
|
6819
7307
|
] }),
|
|
6820
|
-
/* @__PURE__ */
|
|
6821
|
-
/* @__PURE__ */
|
|
6822
|
-
/* @__PURE__ */
|
|
6823
|
-
/* @__PURE__ */
|
|
7308
|
+
/* @__PURE__ */ jsxs50(Collapsible, { open: openSection === "details", onOpenChange: handleToggleDetails, children: [
|
|
7309
|
+
/* @__PURE__ */ jsx63(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsx63(Button, { variant: "ghost", className: "w-full shadow-none rounded-[12px] cursor-pointer", children: /* @__PURE__ */ jsxs50("div", { className: "w-full flex flex-row items-center justify-between gap-2", children: [
|
|
7310
|
+
/* @__PURE__ */ jsxs50("p", { children: [
|
|
7311
|
+
/* @__PURE__ */ jsx63("span", { className: "text-red-500", children: "*" }),
|
|
6824
7312
|
"Details"
|
|
6825
7313
|
] }),
|
|
6826
|
-
/* @__PURE__ */
|
|
7314
|
+
/* @__PURE__ */ jsx63(ChevronDownIcon4, { className: `w-4 h-4 transition-transform duration-200 ${openSection === "details" ? "rotate-180" : ""}` })
|
|
6827
7315
|
] }) }) }),
|
|
6828
|
-
/* @__PURE__ */
|
|
6829
|
-
/* @__PURE__ */
|
|
7316
|
+
/* @__PURE__ */ jsx63(CollapsibleContent2, { className: "w-full p-2", children: /* @__PURE__ */ jsxs50("div", { className: "flex flex-row items-start justify-start gap-2", children: [
|
|
7317
|
+
/* @__PURE__ */ jsx63(
|
|
6830
7318
|
Input,
|
|
6831
7319
|
{
|
|
6832
7320
|
type: "number",
|
|
@@ -6837,7 +7325,7 @@ var PropertyEditMenu = () => {
|
|
|
6837
7325
|
onBlur: handleBedsBlur
|
|
6838
7326
|
}
|
|
6839
7327
|
),
|
|
6840
|
-
/* @__PURE__ */
|
|
7328
|
+
/* @__PURE__ */ jsx63(
|
|
6841
7329
|
Input,
|
|
6842
7330
|
{
|
|
6843
7331
|
type: "number",
|
|
@@ -6848,7 +7336,7 @@ var PropertyEditMenu = () => {
|
|
|
6848
7336
|
onBlur: handleBathsBlur
|
|
6849
7337
|
}
|
|
6850
7338
|
),
|
|
6851
|
-
/* @__PURE__ */
|
|
7339
|
+
/* @__PURE__ */ jsx63(
|
|
6852
7340
|
Input,
|
|
6853
7341
|
{
|
|
6854
7342
|
type: "number",
|
|
@@ -6861,16 +7349,16 @@ var PropertyEditMenu = () => {
|
|
|
6861
7349
|
)
|
|
6862
7350
|
] }) })
|
|
6863
7351
|
] }),
|
|
6864
|
-
/* @__PURE__ */
|
|
6865
|
-
/* @__PURE__ */
|
|
6866
|
-
/* @__PURE__ */
|
|
6867
|
-
/* @__PURE__ */
|
|
7352
|
+
/* @__PURE__ */ jsxs50(Collapsible, { open: openSection === "address", onOpenChange: handleToggleAddress, children: [
|
|
7353
|
+
/* @__PURE__ */ jsx63(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsx63(Button, { variant: "ghost", className: "w-full shadow-none rounded-[12px] cursor-pointer", children: /* @__PURE__ */ jsxs50("div", { className: "w-full flex flex-row items-center justify-between gap-2", children: [
|
|
7354
|
+
/* @__PURE__ */ jsxs50("p", { children: [
|
|
7355
|
+
/* @__PURE__ */ jsx63("span", { className: "text-red-500", children: "*" }),
|
|
6868
7356
|
"Address"
|
|
6869
7357
|
] }),
|
|
6870
|
-
/* @__PURE__ */
|
|
7358
|
+
/* @__PURE__ */ jsx63(ChevronDownIcon4, { className: `w-4 h-4 transition-transform duration-200 ${openSection === "address" ? "rotate-180" : ""}` })
|
|
6871
7359
|
] }) }) }),
|
|
6872
|
-
/* @__PURE__ */
|
|
6873
|
-
/* @__PURE__ */
|
|
7360
|
+
/* @__PURE__ */ jsx63(CollapsibleContent2, { className: "w-full p-2", children: /* @__PURE__ */ jsxs50("div", { className: "flex flex-col items-start justify-start gap-2", children: [
|
|
7361
|
+
/* @__PURE__ */ jsx63("div", { className: "w-full flex flex-row items-start justify-start gap-2", children: /* @__PURE__ */ jsx63(
|
|
6874
7362
|
Input,
|
|
6875
7363
|
{
|
|
6876
7364
|
type: "text",
|
|
@@ -6881,7 +7369,7 @@ var PropertyEditMenu = () => {
|
|
|
6881
7369
|
onBlur: handleAddressBlur
|
|
6882
7370
|
}
|
|
6883
7371
|
) }),
|
|
6884
|
-
/* @__PURE__ */
|
|
7372
|
+
/* @__PURE__ */ jsx63("div", { className: "w-full", children: /* @__PURE__ */ jsx63(
|
|
6885
7373
|
Input,
|
|
6886
7374
|
{
|
|
6887
7375
|
type: "text",
|
|
@@ -6892,8 +7380,8 @@ var PropertyEditMenu = () => {
|
|
|
6892
7380
|
onBlur: handleAddressBlur
|
|
6893
7381
|
}
|
|
6894
7382
|
) }),
|
|
6895
|
-
/* @__PURE__ */
|
|
6896
|
-
/* @__PURE__ */
|
|
7383
|
+
/* @__PURE__ */ jsxs50("div", { className: "flex flex-row items-start justify-start gap-2", children: [
|
|
7384
|
+
/* @__PURE__ */ jsx63(
|
|
6897
7385
|
Input,
|
|
6898
7386
|
{
|
|
6899
7387
|
type: "text",
|
|
@@ -6904,7 +7392,7 @@ var PropertyEditMenu = () => {
|
|
|
6904
7392
|
onBlur: handleCityBlur
|
|
6905
7393
|
}
|
|
6906
7394
|
),
|
|
6907
|
-
/* @__PURE__ */
|
|
7395
|
+
/* @__PURE__ */ jsx63(
|
|
6908
7396
|
Input,
|
|
6909
7397
|
{
|
|
6910
7398
|
type: "text",
|
|
@@ -6916,12 +7404,12 @@ var PropertyEditMenu = () => {
|
|
|
6916
7404
|
}
|
|
6917
7405
|
)
|
|
6918
7406
|
] }),
|
|
6919
|
-
/* @__PURE__ */
|
|
6920
|
-
/* @__PURE__ */
|
|
6921
|
-
/* @__PURE__ */
|
|
6922
|
-
/* @__PURE__ */
|
|
7407
|
+
/* @__PURE__ */ jsxs50("div", { className: "flex flex-row items-start justify-start gap-2", children: [
|
|
7408
|
+
/* @__PURE__ */ jsxs50(Select, { value: countryInput, onValueChange: handleCountryChange, children: [
|
|
7409
|
+
/* @__PURE__ */ jsx63(SelectTrigger, { className: "w-3/4 shadow-none rounded-[12px]", children: /* @__PURE__ */ jsx63(SelectValue, { placeholder: "Country" }) }),
|
|
7410
|
+
/* @__PURE__ */ jsx63(SelectContent, { className: "w-full shadow-none rounded-[12px] z-50001", children: /* @__PURE__ */ jsx63(SelectItem, { value: "USA", children: "United States" }) })
|
|
6923
7411
|
] }),
|
|
6924
|
-
/* @__PURE__ */
|
|
7412
|
+
/* @__PURE__ */ jsx63(
|
|
6925
7413
|
Input,
|
|
6926
7414
|
{
|
|
6927
7415
|
type: "text",
|
|
@@ -6935,15 +7423,15 @@ var PropertyEditMenu = () => {
|
|
|
6935
7423
|
] })
|
|
6936
7424
|
] }) })
|
|
6937
7425
|
] }),
|
|
6938
|
-
features?.status && /* @__PURE__ */
|
|
6939
|
-
/* @__PURE__ */
|
|
6940
|
-
/* @__PURE__ */
|
|
6941
|
-
/* @__PURE__ */
|
|
7426
|
+
features?.status && /* @__PURE__ */ jsxs50(Collapsible, { open: openSection === "status", onOpenChange: handleToggleStatus, children: [
|
|
7427
|
+
/* @__PURE__ */ jsx63(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsx63(Button, { variant: "ghost", className: "w-full shadow-none rounded-[12px] cursor-pointer", children: /* @__PURE__ */ jsxs50("div", { className: "w-full flex flex-row items-center justify-between gap-2", children: [
|
|
7428
|
+
/* @__PURE__ */ jsx63("p", { children: "Status" }),
|
|
7429
|
+
/* @__PURE__ */ jsx63(ChevronDownIcon4, { className: `w-4 h-4 transition-transform duration-200 ${openSection === "status" ? "rotate-180" : ""}` })
|
|
6942
7430
|
] }) }) }),
|
|
6943
|
-
/* @__PURE__ */
|
|
6944
|
-
/* @__PURE__ */
|
|
6945
|
-
/* @__PURE__ */
|
|
6946
|
-
/* @__PURE__ */
|
|
7431
|
+
/* @__PURE__ */ jsx63(CollapsibleContent2, { className: "w-full p-2", children: /* @__PURE__ */ jsxs50("div", { className: "flex flex-col items-start justify-start gap-2", children: [
|
|
7432
|
+
/* @__PURE__ */ jsxs50("div", { className: "w-full flex flex-row items-center justify-start gap-2", children: [
|
|
7433
|
+
/* @__PURE__ */ jsxs50(Tooltip, { children: [
|
|
7434
|
+
/* @__PURE__ */ jsx63(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx63(
|
|
6947
7435
|
Checkbox,
|
|
6948
7436
|
{
|
|
6949
7437
|
className: " shadow-none rounded-[12px] w-9 h-9",
|
|
@@ -6951,9 +7439,9 @@ var PropertyEditMenu = () => {
|
|
|
6951
7439
|
onCheckedChange: (checked) => handleIsStatusChange(checked === "indeterminate" ? false : checked)
|
|
6952
7440
|
}
|
|
6953
7441
|
) }),
|
|
6954
|
-
/* @__PURE__ */
|
|
7442
|
+
/* @__PURE__ */ jsx63(TooltipContent, { side: "bottom", className: "z-50001", children: isStatusEnabled ? "Hide Status" : "Show Status" })
|
|
6955
7443
|
] }),
|
|
6956
|
-
/* @__PURE__ */
|
|
7444
|
+
/* @__PURE__ */ jsx63(
|
|
6957
7445
|
BackgroundColorBtn,
|
|
6958
7446
|
{
|
|
6959
7447
|
activeView,
|
|
@@ -6962,7 +7450,7 @@ var PropertyEditMenu = () => {
|
|
|
6962
7450
|
currentBgColor: currentStatusColor
|
|
6963
7451
|
}
|
|
6964
7452
|
),
|
|
6965
|
-
/* @__PURE__ */
|
|
7453
|
+
/* @__PURE__ */ jsx63(
|
|
6966
7454
|
Input,
|
|
6967
7455
|
{
|
|
6968
7456
|
disabled: !isStatusEnabled,
|
|
@@ -6975,7 +7463,7 @@ var PropertyEditMenu = () => {
|
|
|
6975
7463
|
}
|
|
6976
7464
|
)
|
|
6977
7465
|
] }),
|
|
6978
|
-
/* @__PURE__ */
|
|
7466
|
+
/* @__PURE__ */ jsx63("div", { className: "w-full flex flex-row items-center justify-start gap-2", children: /* @__PURE__ */ jsxs50(
|
|
6979
7467
|
Toggle,
|
|
6980
7468
|
{
|
|
6981
7469
|
className: "w-full shadow-none rounded-[12px]",
|
|
@@ -6985,22 +7473,22 @@ var PropertyEditMenu = () => {
|
|
|
6985
7473
|
pressed: isNewEnabled,
|
|
6986
7474
|
onPressedChange: handleIsNewChange,
|
|
6987
7475
|
children: [
|
|
6988
|
-
/* @__PURE__ */
|
|
7476
|
+
/* @__PURE__ */ jsx63(CircleCheckIcon, { className: "group-aria-pressed/toggle:fill-foreground" }),
|
|
6989
7477
|
"New Label"
|
|
6990
7478
|
]
|
|
6991
7479
|
}
|
|
6992
7480
|
) })
|
|
6993
7481
|
] }) })
|
|
6994
7482
|
] }),
|
|
6995
|
-
features?.openhouse && /* @__PURE__ */
|
|
6996
|
-
/* @__PURE__ */
|
|
6997
|
-
/* @__PURE__ */
|
|
6998
|
-
/* @__PURE__ */
|
|
7483
|
+
features?.openhouse && /* @__PURE__ */ jsxs50(Collapsible, { open: openSection === "openhouse", onOpenChange: handleToggleOpenhouse, children: [
|
|
7484
|
+
/* @__PURE__ */ jsx63(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsx63(Button, { variant: "ghost", className: "w-full shadow-none rounded-[12px] cursor-pointer", children: /* @__PURE__ */ jsxs50("div", { className: "w-full flex flex-row items-center justify-between gap-2", children: [
|
|
7485
|
+
/* @__PURE__ */ jsx63("p", { children: "Open house" }),
|
|
7486
|
+
/* @__PURE__ */ jsx63(ChevronDownIcon4, { className: `w-4 h-4 transition-transform duration-200 ${openSection === "openhouse" ? "rotate-180" : ""}` })
|
|
6999
7487
|
] }) }) }),
|
|
7000
|
-
/* @__PURE__ */
|
|
7001
|
-
/* @__PURE__ */
|
|
7002
|
-
/* @__PURE__ */
|
|
7003
|
-
/* @__PURE__ */
|
|
7488
|
+
/* @__PURE__ */ jsx63(CollapsibleContent2, { className: "w-full p-2", children: /* @__PURE__ */ jsxs50("div", { className: "flex flex-col items-start justify-start gap-2", children: [
|
|
7489
|
+
/* @__PURE__ */ jsxs50("div", { className: "w-full flex flex-row items-center justify-start gap-2", children: [
|
|
7490
|
+
/* @__PURE__ */ jsxs50(Tooltip, { children: [
|
|
7491
|
+
/* @__PURE__ */ jsx63(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx63(
|
|
7004
7492
|
Checkbox,
|
|
7005
7493
|
{
|
|
7006
7494
|
className: "shadow-none rounded-[12px] w-9 h-9",
|
|
@@ -7008,9 +7496,9 @@ var PropertyEditMenu = () => {
|
|
|
7008
7496
|
onCheckedChange: (checked) => handleIsOpenHouseChange(checked === "indeterminate" ? false : checked)
|
|
7009
7497
|
}
|
|
7010
7498
|
) }),
|
|
7011
|
-
/* @__PURE__ */
|
|
7499
|
+
/* @__PURE__ */ jsx63(TooltipContent, { side: "bottom", className: "z-50001", children: openhouseEnabled ? "Disable Open House" : "Enable Open House" })
|
|
7012
7500
|
] }),
|
|
7013
|
-
/* @__PURE__ */
|
|
7501
|
+
/* @__PURE__ */ jsx63(
|
|
7014
7502
|
Input,
|
|
7015
7503
|
{
|
|
7016
7504
|
disabled: !openhouseEnabled,
|
|
@@ -7022,8 +7510,8 @@ var PropertyEditMenu = () => {
|
|
|
7022
7510
|
}
|
|
7023
7511
|
)
|
|
7024
7512
|
] }),
|
|
7025
|
-
/* @__PURE__ */
|
|
7026
|
-
/* @__PURE__ */
|
|
7513
|
+
/* @__PURE__ */ jsxs50("div", { className: "w-full flex flex-row items-center justify-start gap-2", children: [
|
|
7514
|
+
/* @__PURE__ */ jsx63(
|
|
7027
7515
|
Input,
|
|
7028
7516
|
{
|
|
7029
7517
|
disabled: !openhouseEnabled,
|
|
@@ -7034,7 +7522,7 @@ var PropertyEditMenu = () => {
|
|
|
7034
7522
|
className: "w-full shadow-none rounded-[12px]"
|
|
7035
7523
|
}
|
|
7036
7524
|
),
|
|
7037
|
-
/* @__PURE__ */
|
|
7525
|
+
/* @__PURE__ */ jsx63(
|
|
7038
7526
|
Input,
|
|
7039
7527
|
{
|
|
7040
7528
|
disabled: !openhouseEnabled,
|
|
@@ -7048,15 +7536,15 @@ var PropertyEditMenu = () => {
|
|
|
7048
7536
|
] })
|
|
7049
7537
|
] }) })
|
|
7050
7538
|
] }),
|
|
7051
|
-
features?.brokerage && /* @__PURE__ */
|
|
7052
|
-
/* @__PURE__ */
|
|
7053
|
-
/* @__PURE__ */
|
|
7054
|
-
/* @__PURE__ */
|
|
7539
|
+
features?.brokerage && /* @__PURE__ */ jsxs50(Collapsible, { open: openSection === "brokerage", onOpenChange: handleToggleBrokerage, children: [
|
|
7540
|
+
/* @__PURE__ */ jsx63(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsx63(Button, { variant: "ghost", className: "w-full shadow-none rounded-[12px] cursor-pointer", children: /* @__PURE__ */ jsxs50("div", { className: "w-full flex flex-row items-center justify-between gap-2", children: [
|
|
7541
|
+
/* @__PURE__ */ jsx63("p", { children: "Brokerage" }),
|
|
7542
|
+
/* @__PURE__ */ jsx63(ChevronDownIcon4, { className: `w-4 h-4 transition-transform duration-200 ${openSection === "brokerage" ? "rotate-180" : ""}` })
|
|
7055
7543
|
] }) }) }),
|
|
7056
|
-
/* @__PURE__ */
|
|
7057
|
-
/* @__PURE__ */
|
|
7058
|
-
/* @__PURE__ */
|
|
7059
|
-
/* @__PURE__ */
|
|
7544
|
+
/* @__PURE__ */ jsx63(CollapsibleContent2, { className: "w-full p-2", children: /* @__PURE__ */ jsxs50("div", { className: "flex flex-col items-start justify-start gap-2", children: [
|
|
7545
|
+
/* @__PURE__ */ jsxs50("div", { className: "w-full flex flex-row items-center justify-start gap-2", children: [
|
|
7546
|
+
/* @__PURE__ */ jsxs50(Tooltip, { children: [
|
|
7547
|
+
/* @__PURE__ */ jsx63(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx63(
|
|
7060
7548
|
Checkbox,
|
|
7061
7549
|
{
|
|
7062
7550
|
className: "shadow-none rounded-[12px] w-9 h-9",
|
|
@@ -7064,9 +7552,9 @@ var PropertyEditMenu = () => {
|
|
|
7064
7552
|
onCheckedChange: (checked) => handleIsBrokerageChange(checked === "indeterminate" ? false : checked)
|
|
7065
7553
|
}
|
|
7066
7554
|
) }),
|
|
7067
|
-
/* @__PURE__ */
|
|
7555
|
+
/* @__PURE__ */ jsx63(TooltipContent, { side: "bottom", className: "z-50001", children: isBrokerageEnabled ? "Hide Brokerage" : "Show Brokerage" })
|
|
7068
7556
|
] }),
|
|
7069
|
-
/* @__PURE__ */
|
|
7557
|
+
/* @__PURE__ */ jsx63(
|
|
7070
7558
|
Input,
|
|
7071
7559
|
{
|
|
7072
7560
|
disabled: !isBrokerageEnabled,
|
|
@@ -7079,17 +7567,17 @@ var PropertyEditMenu = () => {
|
|
|
7079
7567
|
}
|
|
7080
7568
|
)
|
|
7081
7569
|
] }),
|
|
7082
|
-
/* @__PURE__ */
|
|
7570
|
+
/* @__PURE__ */ jsx63("div", { className: "w-full flex flex-row items-center justify-start gap-2", children: /* @__PURE__ */ jsx63("p", { className: "text-xs text-muted-foreground", children: "Please provide the listing office name." }) })
|
|
7083
7571
|
] }) })
|
|
7084
7572
|
] }),
|
|
7085
|
-
features?.description && /* @__PURE__ */
|
|
7086
|
-
/* @__PURE__ */
|
|
7087
|
-
/* @__PURE__ */
|
|
7088
|
-
/* @__PURE__ */
|
|
7573
|
+
features?.description && /* @__PURE__ */ jsxs50(Collapsible, { open: openSection === "description", onOpenChange: handleToggleDescription, children: [
|
|
7574
|
+
/* @__PURE__ */ jsx63(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsx63(Button, { variant: "ghost", className: "w-full shadow-none rounded-[12px] cursor-pointer", children: /* @__PURE__ */ jsxs50("div", { className: "w-full flex flex-row items-center justify-between gap-2", children: [
|
|
7575
|
+
/* @__PURE__ */ jsx63("p", { children: "Description" }),
|
|
7576
|
+
/* @__PURE__ */ jsx63(ChevronDownIcon4, { className: `w-4 h-4 transition-transform duration-200 ${openSection === "description" ? "rotate-180" : ""}` })
|
|
7089
7577
|
] }) }) }),
|
|
7090
|
-
/* @__PURE__ */
|
|
7091
|
-
/* @__PURE__ */
|
|
7092
|
-
/* @__PURE__ */
|
|
7578
|
+
/* @__PURE__ */ jsx63(CollapsibleContent2, { className: "w-full p-2", children: /* @__PURE__ */ jsxs50("div", { className: "flex flex-row items-start justify-between gap-2", children: [
|
|
7579
|
+
/* @__PURE__ */ jsxs50(Tooltip, { children: [
|
|
7580
|
+
/* @__PURE__ */ jsx63(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx63(
|
|
7093
7581
|
Checkbox,
|
|
7094
7582
|
{
|
|
7095
7583
|
className: "shadow-none rounded-[12px] w-9 h-9",
|
|
@@ -7097,9 +7585,9 @@ var PropertyEditMenu = () => {
|
|
|
7097
7585
|
onCheckedChange: (checked) => handleIsDescriptionChange(checked === "indeterminate" ? false : checked)
|
|
7098
7586
|
}
|
|
7099
7587
|
) }),
|
|
7100
|
-
/* @__PURE__ */
|
|
7588
|
+
/* @__PURE__ */ jsx63(TooltipContent, { side: "bottom", className: "z-50001", children: isDescriptionEnabled ? "Hide Description" : "Show Description" })
|
|
7101
7589
|
] }),
|
|
7102
|
-
/* @__PURE__ */
|
|
7590
|
+
/* @__PURE__ */ jsx63(
|
|
7103
7591
|
Textarea,
|
|
7104
7592
|
{
|
|
7105
7593
|
disabled: !isDescriptionEnabled,
|
|
@@ -7114,61 +7602,61 @@ var PropertyEditMenu = () => {
|
|
|
7114
7602
|
] })
|
|
7115
7603
|
] })
|
|
7116
7604
|
] }),
|
|
7117
|
-
/* @__PURE__ */
|
|
7605
|
+
/* @__PURE__ */ jsx63(TooltipContent, { side: "bottom", className: "z-50001", children: "Edit" })
|
|
7118
7606
|
] });
|
|
7119
7607
|
};
|
|
7120
7608
|
|
|
7121
7609
|
// src/core/editor/components/element-gear/property/toolbar.tsx
|
|
7122
7610
|
import { CaseUpperIcon as CaseUpperIcon6 } from "lucide-react";
|
|
7123
|
-
import { jsx as
|
|
7611
|
+
import { jsx as jsx64, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
7124
7612
|
function PropertyToolbar() {
|
|
7125
7613
|
const { focusIdx, template, updateElement } = useEditorStore();
|
|
7126
7614
|
const { activeView, colorTarget, setActiveView, setColorType, setColorTarget } = useSidebarContext();
|
|
7127
|
-
const columnIdx =
|
|
7615
|
+
const columnIdx = useMemo33(() => {
|
|
7128
7616
|
if (!focusIdx) return null;
|
|
7129
7617
|
return getParentIdx(focusIdx);
|
|
7130
7618
|
}, [focusIdx]);
|
|
7131
|
-
const columnElement =
|
|
7619
|
+
const columnElement = useMemo33(() => {
|
|
7132
7620
|
if (!columnIdx || !template) return null;
|
|
7133
7621
|
return getValueByIdx(template, columnIdx);
|
|
7134
7622
|
}, [columnIdx, template]);
|
|
7135
|
-
const propertyElement =
|
|
7623
|
+
const propertyElement = useMemo33(() => {
|
|
7136
7624
|
if (!focusIdx || !template) return null;
|
|
7137
7625
|
return getValueByIdx(template, focusIdx);
|
|
7138
7626
|
}, [focusIdx, template]);
|
|
7139
|
-
const currentBgColor =
|
|
7627
|
+
const currentBgColor = useMemo33(() => {
|
|
7140
7628
|
return columnElement?.attributes?.["background-color"] || "transparent";
|
|
7141
7629
|
}, [columnElement]);
|
|
7142
|
-
const border =
|
|
7630
|
+
const border = useMemo33(() => {
|
|
7143
7631
|
const rawBorder = columnElement?.attributes?.["border"];
|
|
7144
7632
|
return parseBorder(rawBorder);
|
|
7145
7633
|
}, [columnElement]);
|
|
7146
|
-
const borderRadiusValue =
|
|
7634
|
+
const borderRadiusValue = useMemo33(() => {
|
|
7147
7635
|
const rawRadius = columnElement?.attributes?.["border-radius"];
|
|
7148
7636
|
return parseBorderRadius(rawRadius);
|
|
7149
7637
|
}, [columnElement]);
|
|
7150
|
-
const currentFontFamily =
|
|
7638
|
+
const currentFontFamily = useMemo33(() => {
|
|
7151
7639
|
return propertyElement?.attributes?.["font-family"] || "Arial, sans-serif";
|
|
7152
7640
|
}, [propertyElement]);
|
|
7153
|
-
const currentTextColor =
|
|
7641
|
+
const currentTextColor = useMemo33(() => {
|
|
7154
7642
|
return propertyElement?.attributes?.["text-color"] || "#111116";
|
|
7155
7643
|
}, [propertyElement]);
|
|
7156
|
-
const handleOpenBgColorPicker =
|
|
7644
|
+
const handleOpenBgColorPicker = useCallback37(() => {
|
|
7157
7645
|
setColorType("Background Color");
|
|
7158
7646
|
setColorTarget("propertyBgColor");
|
|
7159
7647
|
setActiveView("color");
|
|
7160
7648
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
7161
|
-
const handleOpenStrokeColorPicker =
|
|
7649
|
+
const handleOpenStrokeColorPicker = useCallback37(() => {
|
|
7162
7650
|
setColorType("Stroke Color");
|
|
7163
7651
|
setColorTarget("propertyStrokeColor");
|
|
7164
7652
|
setActiveView("color");
|
|
7165
7653
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
7166
|
-
const handleOpenTextColorPicker =
|
|
7654
|
+
const handleOpenTextColorPicker = useCallback37(() => {
|
|
7167
7655
|
setColorType("Text Color");
|
|
7168
7656
|
setColorTarget("propertyTextColor");
|
|
7169
7657
|
setActiveView("color");
|
|
7170
7658
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
7171
|
-
const handleFontChange =
|
|
7659
|
+
const handleFontChange = useCallback37((font) => {
|
|
7172
7660
|
if (!focusIdx || !propertyElement) return;
|
|
7173
7661
|
updateElement(focusIdx, {
|
|
7174
7662
|
attributes: {
|
|
@@ -7177,7 +7665,7 @@ function PropertyToolbar() {
|
|
|
7177
7665
|
}
|
|
7178
7666
|
});
|
|
7179
7667
|
}, [focusIdx, propertyElement, updateElement]);
|
|
7180
|
-
const handleBorderWidthChange =
|
|
7668
|
+
const handleBorderWidthChange = useCallback37((width) => {
|
|
7181
7669
|
if (!columnIdx || !columnElement || !focusIdx || !propertyElement) return;
|
|
7182
7670
|
const newBorder = { ...border, width };
|
|
7183
7671
|
const formattedBorder = formatBorder(newBorder);
|
|
@@ -7194,7 +7682,7 @@ function PropertyToolbar() {
|
|
|
7194
7682
|
}
|
|
7195
7683
|
});
|
|
7196
7684
|
}, [columnIdx, columnElement, focusIdx, propertyElement, border, updateElement]);
|
|
7197
|
-
const handleBorderEnabledChange =
|
|
7685
|
+
const handleBorderEnabledChange = useCallback37((enabled) => {
|
|
7198
7686
|
if (!columnIdx || !columnElement || !focusIdx || !propertyElement) return;
|
|
7199
7687
|
const newWidth = enabled ? border.width === 0 ? 1 : border.width : 0;
|
|
7200
7688
|
const newBorder = { ...border, width: newWidth };
|
|
@@ -7212,7 +7700,7 @@ function PropertyToolbar() {
|
|
|
7212
7700
|
}
|
|
7213
7701
|
});
|
|
7214
7702
|
}, [columnIdx, columnElement, focusIdx, propertyElement, border, updateElement]);
|
|
7215
|
-
const handleBorderRadiusChange =
|
|
7703
|
+
const handleBorderRadiusChange = useCallback37((value) => {
|
|
7216
7704
|
if (!columnIdx || !columnElement || !focusIdx || !propertyElement) return;
|
|
7217
7705
|
const formattedRadius = formatBorderRadius(value);
|
|
7218
7706
|
updateElement(columnIdx, {
|
|
@@ -7228,11 +7716,11 @@ function PropertyToolbar() {
|
|
|
7228
7716
|
}
|
|
7229
7717
|
});
|
|
7230
7718
|
}, [columnIdx, columnElement, focusIdx, propertyElement, updateElement]);
|
|
7231
|
-
return /* @__PURE__ */
|
|
7232
|
-
/* @__PURE__ */
|
|
7233
|
-
/* @__PURE__ */
|
|
7234
|
-
/* @__PURE__ */
|
|
7235
|
-
/* @__PURE__ */
|
|
7719
|
+
return /* @__PURE__ */ jsxs51(ToolbarContainer, { children: [
|
|
7720
|
+
/* @__PURE__ */ jsx64(ToolbarContent, { children: /* @__PURE__ */ jsx64(BasicOption, {}) }),
|
|
7721
|
+
/* @__PURE__ */ jsx64(ToolbarSeparator, {}),
|
|
7722
|
+
/* @__PURE__ */ jsxs51(ToolbarContent, { children: [
|
|
7723
|
+
/* @__PURE__ */ jsx64(
|
|
7236
7724
|
BackgroundColorBtn,
|
|
7237
7725
|
{
|
|
7238
7726
|
activeView,
|
|
@@ -7241,18 +7729,18 @@ function PropertyToolbar() {
|
|
|
7241
7729
|
currentBgColor
|
|
7242
7730
|
}
|
|
7243
7731
|
),
|
|
7244
|
-
/* @__PURE__ */
|
|
7245
|
-
/* @__PURE__ */
|
|
7246
|
-
/* @__PURE__ */
|
|
7732
|
+
/* @__PURE__ */ jsx64(ImageMenu, { type: "property" }),
|
|
7733
|
+
/* @__PURE__ */ jsx64(ToolbarSeparator, {}),
|
|
7734
|
+
/* @__PURE__ */ jsx64(ToolbarContent, { children: /* @__PURE__ */ jsx64(
|
|
7247
7735
|
FontFamilyDropdown,
|
|
7248
7736
|
{
|
|
7249
7737
|
currentFont: currentFontFamily,
|
|
7250
7738
|
onFontChange: handleFontChange
|
|
7251
7739
|
}
|
|
7252
7740
|
) }),
|
|
7253
|
-
/* @__PURE__ */
|
|
7254
|
-
/* @__PURE__ */
|
|
7255
|
-
/* @__PURE__ */
|
|
7741
|
+
/* @__PURE__ */ jsx64(ToolbarSeparator, {}),
|
|
7742
|
+
/* @__PURE__ */ jsxs51(Tooltip, { children: [
|
|
7743
|
+
/* @__PURE__ */ jsx64(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs51(
|
|
7256
7744
|
Button,
|
|
7257
7745
|
{
|
|
7258
7746
|
variant: "ghost",
|
|
@@ -7260,8 +7748,8 @@ function PropertyToolbar() {
|
|
|
7260
7748
|
size: "icon",
|
|
7261
7749
|
onClick: handleOpenTextColorPicker,
|
|
7262
7750
|
children: [
|
|
7263
|
-
/* @__PURE__ */
|
|
7264
|
-
/* @__PURE__ */
|
|
7751
|
+
/* @__PURE__ */ jsx64(CaseUpperIcon6, {}),
|
|
7752
|
+
/* @__PURE__ */ jsx64(
|
|
7265
7753
|
"span",
|
|
7266
7754
|
{
|
|
7267
7755
|
className: "w-[14px] h-[3px] rounded-full",
|
|
@@ -7271,30 +7759,30 @@ function PropertyToolbar() {
|
|
|
7271
7759
|
]
|
|
7272
7760
|
}
|
|
7273
7761
|
) }),
|
|
7274
|
-
/* @__PURE__ */
|
|
7762
|
+
/* @__PURE__ */ jsx64(TooltipContent, { side: "bottom", className: "z-51", children: "Text Color" })
|
|
7275
7763
|
] }),
|
|
7276
|
-
/* @__PURE__ */
|
|
7277
|
-
border.width > 0 && /* @__PURE__ */
|
|
7278
|
-
/* @__PURE__ */
|
|
7764
|
+
/* @__PURE__ */ jsx64(ToolbarSeparator, {}),
|
|
7765
|
+
border.width > 0 && /* @__PURE__ */ jsxs51(Tooltip, { children: [
|
|
7766
|
+
/* @__PURE__ */ jsx64(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx64(
|
|
7279
7767
|
Button,
|
|
7280
7768
|
{
|
|
7281
7769
|
variant: "ghost",
|
|
7282
7770
|
className: `shadow-none transition-none cursor-pointer rounded-[12px] ${activeView === "color" && colorTarget === "propertyStrokeColor" ? "bg-muted" : ""}`,
|
|
7283
7771
|
size: "icon",
|
|
7284
7772
|
onClick: handleOpenStrokeColorPicker,
|
|
7285
|
-
children: /* @__PURE__ */
|
|
7773
|
+
children: /* @__PURE__ */ jsx64(
|
|
7286
7774
|
"div",
|
|
7287
7775
|
{
|
|
7288
7776
|
className: "w-5 h-5 rounded-full border justify-center items-center flex",
|
|
7289
7777
|
style: { backgroundColor: border.color },
|
|
7290
|
-
children: /* @__PURE__ */
|
|
7778
|
+
children: /* @__PURE__ */ jsx64("div", { className: "w-[50%] h-[50%] bg-secondary rounded-full" })
|
|
7291
7779
|
}
|
|
7292
7780
|
)
|
|
7293
7781
|
}
|
|
7294
7782
|
) }),
|
|
7295
|
-
/* @__PURE__ */
|
|
7783
|
+
/* @__PURE__ */ jsx64(TooltipContent, { side: "bottom", className: "z-51", children: "Stroke Color" })
|
|
7296
7784
|
] }),
|
|
7297
|
-
/* @__PURE__ */
|
|
7785
|
+
/* @__PURE__ */ jsx64(
|
|
7298
7786
|
StrokeWeight,
|
|
7299
7787
|
{
|
|
7300
7788
|
width: border.width,
|
|
@@ -7304,7 +7792,7 @@ function PropertyToolbar() {
|
|
|
7304
7792
|
max: 14
|
|
7305
7793
|
}
|
|
7306
7794
|
),
|
|
7307
|
-
/* @__PURE__ */
|
|
7795
|
+
/* @__PURE__ */ jsx64(
|
|
7308
7796
|
BorderRadius,
|
|
7309
7797
|
{
|
|
7310
7798
|
value: borderRadiusValue,
|
|
@@ -7313,36 +7801,36 @@ function PropertyToolbar() {
|
|
|
7313
7801
|
max: 18
|
|
7314
7802
|
}
|
|
7315
7803
|
),
|
|
7316
|
-
/* @__PURE__ */
|
|
7317
|
-
/* @__PURE__ */
|
|
7804
|
+
/* @__PURE__ */ jsx64(ToolbarSeparator, {}),
|
|
7805
|
+
/* @__PURE__ */ jsx64(PropertyEditMenu, {})
|
|
7318
7806
|
] })
|
|
7319
7807
|
] });
|
|
7320
7808
|
}
|
|
7321
7809
|
|
|
7322
7810
|
// src/core/editor/components/element-gear/property/triple/toolbar.tsx
|
|
7323
|
-
import { useCallback as
|
|
7811
|
+
import { useCallback as useCallback39, useMemo as useMemo35 } from "react";
|
|
7324
7812
|
|
|
7325
7813
|
// src/core/editor/components/property-triple-edit-menu.tsx
|
|
7326
7814
|
import { ChevronDownIcon as ChevronDownIcon5, HouseIcon as HouseIcon2 } from "lucide-react";
|
|
7327
|
-
import { useState as
|
|
7328
|
-
import { jsx as
|
|
7815
|
+
import { useState as useState19, useCallback as useCallback38, useMemo as useMemo34, useEffect as useEffect13 } from "react";
|
|
7816
|
+
import { jsx as jsx65, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
7329
7817
|
var PropertyTripleEditMenu = () => {
|
|
7330
7818
|
const { focusIdx, template, updateElement } = useEditorStore();
|
|
7331
|
-
const [isOpen, setIsOpen] =
|
|
7332
|
-
const [openSection, setOpenSection] =
|
|
7333
|
-
const propertyElement =
|
|
7819
|
+
const [isOpen, setIsOpen] = useState19(false);
|
|
7820
|
+
const [openSection, setOpenSection] = useState19(null);
|
|
7821
|
+
const propertyElement = useMemo34(() => {
|
|
7334
7822
|
if (!focusIdx || !template) return null;
|
|
7335
7823
|
return getValueByIdx(template, focusIdx);
|
|
7336
7824
|
}, [focusIdx, template]);
|
|
7337
|
-
const currentPrice =
|
|
7825
|
+
const currentPrice = useMemo34(() => {
|
|
7338
7826
|
const rawPrice = propertyElement?.attributes?.["price"] || "";
|
|
7339
7827
|
return parsePrice(rawPrice);
|
|
7340
7828
|
}, [propertyElement]);
|
|
7341
|
-
const [priceInput, setPriceInput] =
|
|
7342
|
-
|
|
7829
|
+
const [priceInput, setPriceInput] = useState19(currentPrice);
|
|
7830
|
+
useEffect13(() => {
|
|
7343
7831
|
setPriceInput(currentPrice);
|
|
7344
7832
|
}, [currentPrice]);
|
|
7345
|
-
const handlePriceBlur =
|
|
7833
|
+
const handlePriceBlur = useCallback38(() => {
|
|
7346
7834
|
if (!focusIdx || !propertyElement) return;
|
|
7347
7835
|
if (priceInput === currentPrice) return;
|
|
7348
7836
|
updateElement(focusIdx, {
|
|
@@ -7352,27 +7840,27 @@ var PropertyTripleEditMenu = () => {
|
|
|
7352
7840
|
}
|
|
7353
7841
|
});
|
|
7354
7842
|
}, [focusIdx, propertyElement, priceInput, currentPrice, updateElement]);
|
|
7355
|
-
const currentBeds =
|
|
7356
|
-
const currentBaths =
|
|
7357
|
-
const currentSqft =
|
|
7358
|
-
const currentCity =
|
|
7359
|
-
const [bedsInput, setBedsInput] =
|
|
7360
|
-
const [bathsInput, setBathsInput] =
|
|
7361
|
-
const [sqftInput, setSqftInput] =
|
|
7362
|
-
const [cityInput, setCityInput] =
|
|
7363
|
-
|
|
7843
|
+
const currentBeds = useMemo34(() => propertyElement?.attributes?.["beds"] || "", [propertyElement]);
|
|
7844
|
+
const currentBaths = useMemo34(() => propertyElement?.attributes?.["baths"] || "", [propertyElement]);
|
|
7845
|
+
const currentSqft = useMemo34(() => propertyElement?.attributes?.["sqft"] || "", [propertyElement]);
|
|
7846
|
+
const currentCity = useMemo34(() => propertyElement?.attributes?.["city"] || "", [propertyElement]);
|
|
7847
|
+
const [bedsInput, setBedsInput] = useState19(currentBeds);
|
|
7848
|
+
const [bathsInput, setBathsInput] = useState19(currentBaths);
|
|
7849
|
+
const [sqftInput, setSqftInput] = useState19(currentSqft);
|
|
7850
|
+
const [cityInput, setCityInput] = useState19(currentCity);
|
|
7851
|
+
useEffect13(() => {
|
|
7364
7852
|
setBedsInput(currentBeds);
|
|
7365
7853
|
}, [currentBeds]);
|
|
7366
|
-
|
|
7854
|
+
useEffect13(() => {
|
|
7367
7855
|
setBathsInput(currentBaths);
|
|
7368
7856
|
}, [currentBaths]);
|
|
7369
|
-
|
|
7857
|
+
useEffect13(() => {
|
|
7370
7858
|
setSqftInput(currentSqft);
|
|
7371
7859
|
}, [currentSqft]);
|
|
7372
|
-
|
|
7860
|
+
useEffect13(() => {
|
|
7373
7861
|
setCityInput(currentCity);
|
|
7374
7862
|
}, [currentCity]);
|
|
7375
|
-
const handleBedsBlur =
|
|
7863
|
+
const handleBedsBlur = useCallback38(() => {
|
|
7376
7864
|
if (!focusIdx || !propertyElement) return;
|
|
7377
7865
|
if (bedsInput === currentBeds) return;
|
|
7378
7866
|
updateElement(focusIdx, {
|
|
@@ -7382,7 +7870,7 @@ var PropertyTripleEditMenu = () => {
|
|
|
7382
7870
|
}
|
|
7383
7871
|
});
|
|
7384
7872
|
}, [focusIdx, propertyElement, bedsInput, currentBeds, updateElement]);
|
|
7385
|
-
const handleBathsBlur =
|
|
7873
|
+
const handleBathsBlur = useCallback38(() => {
|
|
7386
7874
|
if (!focusIdx || !propertyElement) return;
|
|
7387
7875
|
if (bathsInput === currentBaths) return;
|
|
7388
7876
|
updateElement(focusIdx, {
|
|
@@ -7392,7 +7880,7 @@ var PropertyTripleEditMenu = () => {
|
|
|
7392
7880
|
}
|
|
7393
7881
|
});
|
|
7394
7882
|
}, [focusIdx, propertyElement, bathsInput, currentBaths, updateElement]);
|
|
7395
|
-
const handleSqftBlur =
|
|
7883
|
+
const handleSqftBlur = useCallback38(() => {
|
|
7396
7884
|
if (!focusIdx || !propertyElement) return;
|
|
7397
7885
|
if (sqftInput === currentSqft) return;
|
|
7398
7886
|
updateElement(focusIdx, {
|
|
@@ -7402,7 +7890,7 @@ var PropertyTripleEditMenu = () => {
|
|
|
7402
7890
|
}
|
|
7403
7891
|
});
|
|
7404
7892
|
}, [focusIdx, propertyElement, sqftInput, currentSqft, updateElement]);
|
|
7405
|
-
const handleCityBlur =
|
|
7893
|
+
const handleCityBlur = useCallback38(() => {
|
|
7406
7894
|
if (!focusIdx || !propertyElement) return;
|
|
7407
7895
|
if (cityInput === currentCity) return;
|
|
7408
7896
|
updateElement(focusIdx, {
|
|
@@ -7412,33 +7900,33 @@ var PropertyTripleEditMenu = () => {
|
|
|
7412
7900
|
}
|
|
7413
7901
|
});
|
|
7414
7902
|
}, [focusIdx, propertyElement, cityInput, currentCity, updateElement]);
|
|
7415
|
-
const handleToggle =
|
|
7903
|
+
const handleToggle = useCallback38((section) => {
|
|
7416
7904
|
setOpenSection((prev) => prev === section ? null : section);
|
|
7417
7905
|
}, []);
|
|
7418
|
-
const handleTogglePrice =
|
|
7419
|
-
const handleToggleDetails =
|
|
7420
|
-
const handleToggleAddress =
|
|
7421
|
-
return /* @__PURE__ */
|
|
7422
|
-
/* @__PURE__ */
|
|
7423
|
-
/* @__PURE__ */
|
|
7906
|
+
const handleTogglePrice = useCallback38(() => handleToggle("price"), [handleToggle]);
|
|
7907
|
+
const handleToggleDetails = useCallback38(() => handleToggle("details"), [handleToggle]);
|
|
7908
|
+
const handleToggleAddress = useCallback38(() => handleToggle("address"), [handleToggle]);
|
|
7909
|
+
return /* @__PURE__ */ jsxs52(Tooltip, { children: [
|
|
7910
|
+
/* @__PURE__ */ jsxs52(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
7911
|
+
/* @__PURE__ */ jsx65(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx65(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx65(
|
|
7424
7912
|
Button,
|
|
7425
7913
|
{
|
|
7426
7914
|
variant: "outline",
|
|
7427
7915
|
className: "shadow-none transition-none cursor-pointer rounded-[12px]",
|
|
7428
7916
|
size: "icon",
|
|
7429
|
-
children: /* @__PURE__ */
|
|
7917
|
+
children: /* @__PURE__ */ jsx65(HouseIcon2, { className: "w-4 h-4" })
|
|
7430
7918
|
}
|
|
7431
7919
|
) }) }),
|
|
7432
|
-
/* @__PURE__ */
|
|
7433
|
-
/* @__PURE__ */
|
|
7434
|
-
/* @__PURE__ */
|
|
7435
|
-
/* @__PURE__ */
|
|
7436
|
-
/* @__PURE__ */
|
|
7920
|
+
/* @__PURE__ */ jsxs52(PopoverContent, { className: "w-84 z-51 mt-1 rounded-[12px] p-2 gap-2 flex flex-col z-50001", children: [
|
|
7921
|
+
/* @__PURE__ */ jsxs52(Collapsible, { open: openSection === "price", onOpenChange: handleTogglePrice, children: [
|
|
7922
|
+
/* @__PURE__ */ jsx65(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsx65(Button, { variant: "ghost", className: "w-full shadow-none rounded-[12px] cursor-pointer", children: /* @__PURE__ */ jsxs52("div", { className: "w-full flex flex-row items-center justify-between gap-2", children: [
|
|
7923
|
+
/* @__PURE__ */ jsxs52("p", { children: [
|
|
7924
|
+
/* @__PURE__ */ jsx65("span", { className: "text-red-500", children: "*" }),
|
|
7437
7925
|
"Price"
|
|
7438
7926
|
] }),
|
|
7439
|
-
/* @__PURE__ */
|
|
7927
|
+
/* @__PURE__ */ jsx65(ChevronDownIcon5, { className: `w-4 h-4 transition-transform duration-200 ${openSection === "price" ? "rotate-180" : ""}` })
|
|
7440
7928
|
] }) }) }),
|
|
7441
|
-
/* @__PURE__ */
|
|
7929
|
+
/* @__PURE__ */ jsx65(CollapsibleContent2, { className: "w-full p-2", children: /* @__PURE__ */ jsx65("div", { className: "flex flex-row items-center justify-between gap-2", children: /* @__PURE__ */ jsx65(
|
|
7442
7930
|
Input,
|
|
7443
7931
|
{
|
|
7444
7932
|
type: "number",
|
|
@@ -7450,16 +7938,16 @@ var PropertyTripleEditMenu = () => {
|
|
|
7450
7938
|
}
|
|
7451
7939
|
) }) })
|
|
7452
7940
|
] }),
|
|
7453
|
-
/* @__PURE__ */
|
|
7454
|
-
/* @__PURE__ */
|
|
7455
|
-
/* @__PURE__ */
|
|
7456
|
-
/* @__PURE__ */
|
|
7941
|
+
/* @__PURE__ */ jsxs52(Collapsible, { open: openSection === "details", onOpenChange: handleToggleDetails, children: [
|
|
7942
|
+
/* @__PURE__ */ jsx65(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsx65(Button, { variant: "ghost", className: "w-full shadow-none rounded-[12px] cursor-pointer", children: /* @__PURE__ */ jsxs52("div", { className: "w-full flex flex-row items-center justify-between gap-2", children: [
|
|
7943
|
+
/* @__PURE__ */ jsxs52("p", { children: [
|
|
7944
|
+
/* @__PURE__ */ jsx65("span", { className: "text-red-500", children: "*" }),
|
|
7457
7945
|
"Details"
|
|
7458
7946
|
] }),
|
|
7459
|
-
/* @__PURE__ */
|
|
7947
|
+
/* @__PURE__ */ jsx65(ChevronDownIcon5, { className: `w-4 h-4 transition-transform duration-200 ${openSection === "details" ? "rotate-180" : ""}` })
|
|
7460
7948
|
] }) }) }),
|
|
7461
|
-
/* @__PURE__ */
|
|
7462
|
-
/* @__PURE__ */
|
|
7949
|
+
/* @__PURE__ */ jsx65(CollapsibleContent2, { className: "w-full p-2", children: /* @__PURE__ */ jsxs52("div", { className: "flex flex-row items-start justify-start gap-2", children: [
|
|
7950
|
+
/* @__PURE__ */ jsx65(
|
|
7463
7951
|
Input,
|
|
7464
7952
|
{
|
|
7465
7953
|
type: "number",
|
|
@@ -7470,7 +7958,7 @@ var PropertyTripleEditMenu = () => {
|
|
|
7470
7958
|
onBlur: handleBedsBlur
|
|
7471
7959
|
}
|
|
7472
7960
|
),
|
|
7473
|
-
/* @__PURE__ */
|
|
7961
|
+
/* @__PURE__ */ jsx65(
|
|
7474
7962
|
Input,
|
|
7475
7963
|
{
|
|
7476
7964
|
type: "number",
|
|
@@ -7481,7 +7969,7 @@ var PropertyTripleEditMenu = () => {
|
|
|
7481
7969
|
onBlur: handleBathsBlur
|
|
7482
7970
|
}
|
|
7483
7971
|
),
|
|
7484
|
-
/* @__PURE__ */
|
|
7972
|
+
/* @__PURE__ */ jsx65(
|
|
7485
7973
|
Input,
|
|
7486
7974
|
{
|
|
7487
7975
|
type: "number",
|
|
@@ -7494,15 +7982,15 @@ var PropertyTripleEditMenu = () => {
|
|
|
7494
7982
|
)
|
|
7495
7983
|
] }) })
|
|
7496
7984
|
] }),
|
|
7497
|
-
/* @__PURE__ */
|
|
7498
|
-
/* @__PURE__ */
|
|
7499
|
-
/* @__PURE__ */
|
|
7500
|
-
/* @__PURE__ */
|
|
7985
|
+
/* @__PURE__ */ jsxs52(Collapsible, { open: openSection === "address", onOpenChange: handleToggleAddress, children: [
|
|
7986
|
+
/* @__PURE__ */ jsx65(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsx65(Button, { variant: "ghost", className: "w-full shadow-none rounded-[12px] cursor-pointer", children: /* @__PURE__ */ jsxs52("div", { className: "w-full flex flex-row items-center justify-between gap-2", children: [
|
|
7987
|
+
/* @__PURE__ */ jsxs52("p", { children: [
|
|
7988
|
+
/* @__PURE__ */ jsx65("span", { className: "text-red-500", children: "*" }),
|
|
7501
7989
|
"City"
|
|
7502
7990
|
] }),
|
|
7503
|
-
/* @__PURE__ */
|
|
7991
|
+
/* @__PURE__ */ jsx65(ChevronDownIcon5, { className: `w-4 h-4 transition-transform duration-200 ${openSection === "address" ? "rotate-180" : ""}` })
|
|
7504
7992
|
] }) }) }),
|
|
7505
|
-
/* @__PURE__ */
|
|
7993
|
+
/* @__PURE__ */ jsx65(CollapsibleContent2, { className: "w-full p-2", children: /* @__PURE__ */ jsx65("div", { className: "flex flex-col items-start justify-start gap-2", children: /* @__PURE__ */ jsx65(
|
|
7506
7994
|
Input,
|
|
7507
7995
|
{
|
|
7508
7996
|
type: "text",
|
|
@@ -7516,59 +8004,59 @@ var PropertyTripleEditMenu = () => {
|
|
|
7516
8004
|
] })
|
|
7517
8005
|
] })
|
|
7518
8006
|
] }),
|
|
7519
|
-
/* @__PURE__ */
|
|
8007
|
+
/* @__PURE__ */ jsx65(TooltipContent, { side: "bottom", className: "z-50001", children: "Edit" })
|
|
7520
8008
|
] });
|
|
7521
8009
|
};
|
|
7522
8010
|
|
|
7523
8011
|
// src/core/editor/components/element-gear/property/triple/toolbar.tsx
|
|
7524
8012
|
import { CaseUpperIcon as CaseUpperIcon7 } from "lucide-react";
|
|
7525
|
-
import { jsx as
|
|
8013
|
+
import { jsx as jsx66, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
7526
8014
|
var PropertyTripleItemToolbar = () => {
|
|
7527
8015
|
const focusIdx = useEditorStore((state) => state.focusIdx);
|
|
7528
8016
|
const template = useEditorStore((state) => state.template);
|
|
7529
8017
|
const updateElement = useEditorStore((state) => state.updateElement);
|
|
7530
8018
|
const { activeView, colorTarget, setActiveView, setColorType, setColorTarget } = useSidebarContext();
|
|
7531
|
-
const parentIdx =
|
|
8019
|
+
const parentIdx = useMemo35(() => {
|
|
7532
8020
|
if (!focusIdx) return null;
|
|
7533
8021
|
return getParentIdx(focusIdx);
|
|
7534
8022
|
}, [focusIdx]);
|
|
7535
|
-
const parentElement =
|
|
8023
|
+
const parentElement = useMemo35(() => {
|
|
7536
8024
|
if (!parentIdx || !template) return null;
|
|
7537
8025
|
return getValueByIdx(template, parentIdx);
|
|
7538
8026
|
}, [parentIdx, template]);
|
|
7539
|
-
const currentBgColor =
|
|
8027
|
+
const currentBgColor = useMemo35(() => {
|
|
7540
8028
|
return parentElement?.attributes?.["background-color"] || "transparent";
|
|
7541
8029
|
}, [parentElement]);
|
|
7542
|
-
const border =
|
|
8030
|
+
const border = useMemo35(() => {
|
|
7543
8031
|
const rawBorder = parentElement?.attributes?.["border"];
|
|
7544
8032
|
return parseBorder(rawBorder);
|
|
7545
8033
|
}, [parentElement]);
|
|
7546
|
-
const borderRadiusValue =
|
|
8034
|
+
const borderRadiusValue = useMemo35(() => {
|
|
7547
8035
|
const rawRadius = parentElement?.attributes?.["border-radius"];
|
|
7548
8036
|
return parseBorderRadius(rawRadius);
|
|
7549
8037
|
}, [parentElement]);
|
|
7550
|
-
const currentTextColor =
|
|
8038
|
+
const currentTextColor = useMemo35(() => {
|
|
7551
8039
|
return parentElement?.attributes?.["text-color"] || "#111116";
|
|
7552
8040
|
}, [parentElement]);
|
|
7553
|
-
const currentFontFamily =
|
|
8041
|
+
const currentFontFamily = useMemo35(() => {
|
|
7554
8042
|
return parentElement?.attributes?.["font-family"] || "Arial, sans-serif";
|
|
7555
8043
|
}, [parentElement]);
|
|
7556
|
-
const handleOpenBgColorPicker =
|
|
8044
|
+
const handleOpenBgColorPicker = useCallback39(() => {
|
|
7557
8045
|
setColorType("Background Color");
|
|
7558
8046
|
setColorTarget("propertyBgColor");
|
|
7559
8047
|
setActiveView("color");
|
|
7560
8048
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
7561
|
-
const handleOpenStrokeColorPicker =
|
|
8049
|
+
const handleOpenStrokeColorPicker = useCallback39(() => {
|
|
7562
8050
|
setColorType("Stroke Color");
|
|
7563
8051
|
setColorTarget("propertyStrokeColor");
|
|
7564
8052
|
setActiveView("color");
|
|
7565
8053
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
7566
|
-
const handleOpenTextColorPicker =
|
|
8054
|
+
const handleOpenTextColorPicker = useCallback39(() => {
|
|
7567
8055
|
setColorType("Text Color");
|
|
7568
8056
|
setColorTarget("propertyTextColor");
|
|
7569
8057
|
setActiveView("color");
|
|
7570
8058
|
}, [setColorType, setColorTarget, setActiveView]);
|
|
7571
|
-
const handleFontChange =
|
|
8059
|
+
const handleFontChange = useCallback39((font) => {
|
|
7572
8060
|
if (!parentIdx || !parentElement) return;
|
|
7573
8061
|
updateElement(parentIdx, {
|
|
7574
8062
|
attributes: {
|
|
@@ -7577,7 +8065,7 @@ var PropertyTripleItemToolbar = () => {
|
|
|
7577
8065
|
}
|
|
7578
8066
|
});
|
|
7579
8067
|
}, [parentIdx, parentElement, updateElement]);
|
|
7580
|
-
const handleBorderWidthChange =
|
|
8068
|
+
const handleBorderWidthChange = useCallback39((width) => {
|
|
7581
8069
|
if (!parentIdx || !parentElement) return;
|
|
7582
8070
|
const newBorder = { ...border, width };
|
|
7583
8071
|
const formattedBorder = formatBorder(newBorder);
|
|
@@ -7588,7 +8076,7 @@ var PropertyTripleItemToolbar = () => {
|
|
|
7588
8076
|
}
|
|
7589
8077
|
});
|
|
7590
8078
|
}, [parentIdx, parentElement, border, updateElement]);
|
|
7591
|
-
const handleBorderEnabledChange =
|
|
8079
|
+
const handleBorderEnabledChange = useCallback39((enabled) => {
|
|
7592
8080
|
if (!parentIdx || !parentElement) return;
|
|
7593
8081
|
const newWidth = enabled ? border.width === 0 ? 1 : border.width : 0;
|
|
7594
8082
|
const newBorder = { ...border, width: newWidth };
|
|
@@ -7600,7 +8088,7 @@ var PropertyTripleItemToolbar = () => {
|
|
|
7600
8088
|
}
|
|
7601
8089
|
});
|
|
7602
8090
|
}, [parentIdx, parentElement, border, updateElement]);
|
|
7603
|
-
const handleBorderRadiusChange =
|
|
8091
|
+
const handleBorderRadiusChange = useCallback39((value) => {
|
|
7604
8092
|
if (!parentIdx || !parentElement) return;
|
|
7605
8093
|
const formattedRadius = formatBorderRadius(value);
|
|
7606
8094
|
updateElement(parentIdx, {
|
|
@@ -7610,11 +8098,11 @@ var PropertyTripleItemToolbar = () => {
|
|
|
7610
8098
|
}
|
|
7611
8099
|
});
|
|
7612
8100
|
}, [parentIdx, parentElement, updateElement]);
|
|
7613
|
-
return /* @__PURE__ */
|
|
7614
|
-
/* @__PURE__ */
|
|
7615
|
-
/* @__PURE__ */
|
|
7616
|
-
/* @__PURE__ */
|
|
7617
|
-
/* @__PURE__ */
|
|
8101
|
+
return /* @__PURE__ */ jsxs53(ToolbarContainer, { children: [
|
|
8102
|
+
/* @__PURE__ */ jsx66(ToolbarContent, { children: /* @__PURE__ */ jsx66(BasicOption, {}) }),
|
|
8103
|
+
/* @__PURE__ */ jsx66(ToolbarSeparator, {}),
|
|
8104
|
+
/* @__PURE__ */ jsxs53(ToolbarContent, { children: [
|
|
8105
|
+
/* @__PURE__ */ jsx66(
|
|
7618
8106
|
BackgroundColorBtn,
|
|
7619
8107
|
{
|
|
7620
8108
|
activeView,
|
|
@@ -7623,18 +8111,18 @@ var PropertyTripleItemToolbar = () => {
|
|
|
7623
8111
|
currentBgColor
|
|
7624
8112
|
}
|
|
7625
8113
|
),
|
|
7626
|
-
/* @__PURE__ */
|
|
7627
|
-
/* @__PURE__ */
|
|
7628
|
-
/* @__PURE__ */
|
|
8114
|
+
/* @__PURE__ */ jsx66(ImageMenu, { type: "property" }),
|
|
8115
|
+
/* @__PURE__ */ jsx66(ToolbarSeparator, {}),
|
|
8116
|
+
/* @__PURE__ */ jsx66(
|
|
7629
8117
|
FontFamilyDropdown,
|
|
7630
8118
|
{
|
|
7631
8119
|
currentFont: currentFontFamily,
|
|
7632
8120
|
onFontChange: handleFontChange
|
|
7633
8121
|
}
|
|
7634
8122
|
),
|
|
7635
|
-
/* @__PURE__ */
|
|
7636
|
-
/* @__PURE__ */
|
|
7637
|
-
/* @__PURE__ */
|
|
8123
|
+
/* @__PURE__ */ jsx66(ToolbarSeparator, {}),
|
|
8124
|
+
/* @__PURE__ */ jsxs53(Tooltip, { children: [
|
|
8125
|
+
/* @__PURE__ */ jsx66(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs53(
|
|
7638
8126
|
Button,
|
|
7639
8127
|
{
|
|
7640
8128
|
variant: "ghost",
|
|
@@ -7642,8 +8130,8 @@ var PropertyTripleItemToolbar = () => {
|
|
|
7642
8130
|
size: "icon",
|
|
7643
8131
|
onClick: handleOpenTextColorPicker,
|
|
7644
8132
|
children: [
|
|
7645
|
-
/* @__PURE__ */
|
|
7646
|
-
/* @__PURE__ */
|
|
8133
|
+
/* @__PURE__ */ jsx66(CaseUpperIcon7, {}),
|
|
8134
|
+
/* @__PURE__ */ jsx66(
|
|
7647
8135
|
"span",
|
|
7648
8136
|
{
|
|
7649
8137
|
className: "w-[14px] h-[3px] rounded-full",
|
|
@@ -7653,30 +8141,30 @@ var PropertyTripleItemToolbar = () => {
|
|
|
7653
8141
|
]
|
|
7654
8142
|
}
|
|
7655
8143
|
) }),
|
|
7656
|
-
/* @__PURE__ */
|
|
8144
|
+
/* @__PURE__ */ jsx66(TooltipContent, { side: "bottom", className: "z-51", children: "Text Color" })
|
|
7657
8145
|
] }),
|
|
7658
|
-
/* @__PURE__ */
|
|
7659
|
-
border.width > 0 && /* @__PURE__ */
|
|
7660
|
-
/* @__PURE__ */
|
|
8146
|
+
/* @__PURE__ */ jsx66(ToolbarSeparator, {}),
|
|
8147
|
+
border.width > 0 && /* @__PURE__ */ jsxs53(Tooltip, { children: [
|
|
8148
|
+
/* @__PURE__ */ jsx66(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx66(
|
|
7661
8149
|
Button,
|
|
7662
8150
|
{
|
|
7663
8151
|
variant: "ghost",
|
|
7664
8152
|
className: `shadow-none transition-none cursor-pointer rounded-[12px] ${activeView === "color" && colorTarget === "propertyStrokeColor" ? "bg-muted" : ""}`,
|
|
7665
8153
|
size: "icon",
|
|
7666
8154
|
onClick: handleOpenStrokeColorPicker,
|
|
7667
|
-
children: /* @__PURE__ */
|
|
8155
|
+
children: /* @__PURE__ */ jsx66(
|
|
7668
8156
|
"div",
|
|
7669
8157
|
{
|
|
7670
8158
|
className: "w-5 h-5 rounded-full border justify-center items-center flex",
|
|
7671
8159
|
style: { backgroundColor: border.color },
|
|
7672
|
-
children: /* @__PURE__ */
|
|
8160
|
+
children: /* @__PURE__ */ jsx66("div", { className: "w-[50%] h-[50%] bg-secondary rounded-full" })
|
|
7673
8161
|
}
|
|
7674
8162
|
)
|
|
7675
8163
|
}
|
|
7676
8164
|
) }),
|
|
7677
|
-
/* @__PURE__ */
|
|
8165
|
+
/* @__PURE__ */ jsx66(TooltipContent, { side: "bottom", className: "z-51", children: "Stroke Color" })
|
|
7678
8166
|
] }),
|
|
7679
|
-
/* @__PURE__ */
|
|
8167
|
+
/* @__PURE__ */ jsx66(
|
|
7680
8168
|
StrokeWeight,
|
|
7681
8169
|
{
|
|
7682
8170
|
width: border.width,
|
|
@@ -7686,7 +8174,7 @@ var PropertyTripleItemToolbar = () => {
|
|
|
7686
8174
|
max: 4
|
|
7687
8175
|
}
|
|
7688
8176
|
),
|
|
7689
|
-
/* @__PURE__ */
|
|
8177
|
+
/* @__PURE__ */ jsx66(
|
|
7690
8178
|
BorderRadius,
|
|
7691
8179
|
{
|
|
7692
8180
|
value: borderRadiusValue,
|
|
@@ -7695,14 +8183,14 @@ var PropertyTripleItemToolbar = () => {
|
|
|
7695
8183
|
max: 18
|
|
7696
8184
|
}
|
|
7697
8185
|
),
|
|
7698
|
-
/* @__PURE__ */
|
|
7699
|
-
/* @__PURE__ */
|
|
8186
|
+
/* @__PURE__ */ jsx66(ToolbarSeparator, {}),
|
|
8187
|
+
/* @__PURE__ */ jsx66(PropertyTripleEditMenu, {})
|
|
7700
8188
|
] })
|
|
7701
8189
|
] });
|
|
7702
8190
|
};
|
|
7703
8191
|
|
|
7704
8192
|
// src/core/editor/components/email-template-v2/toolbar/toolbar.tsx
|
|
7705
|
-
import { jsx as
|
|
8193
|
+
import { jsx as jsx67 } from "react/jsx-runtime";
|
|
7706
8194
|
function Toolbar() {
|
|
7707
8195
|
const { focusIdx, template } = useEditorStore();
|
|
7708
8196
|
const selectedElement = focusIdx ? getValueByIdx(template, focusIdx) : null;
|
|
@@ -7711,60 +8199,60 @@ function Toolbar() {
|
|
|
7711
8199
|
return;
|
|
7712
8200
|
}
|
|
7713
8201
|
if (elementType === "text") {
|
|
7714
|
-
return /* @__PURE__ */
|
|
8202
|
+
return /* @__PURE__ */ jsx67(TextToolbar, {});
|
|
7715
8203
|
}
|
|
7716
8204
|
if (elementType === "button") {
|
|
7717
|
-
return /* @__PURE__ */
|
|
8205
|
+
return /* @__PURE__ */ jsx67(ButtonToolbar, {});
|
|
7718
8206
|
}
|
|
7719
8207
|
if (elementType === "section-column") {
|
|
7720
|
-
return /* @__PURE__ */
|
|
8208
|
+
return /* @__PURE__ */ jsx67(SectionColumnToolbar, {});
|
|
7721
8209
|
}
|
|
7722
8210
|
if (elementType === "section") {
|
|
7723
|
-
return /* @__PURE__ */
|
|
8211
|
+
return /* @__PURE__ */ jsx67(SectionToolbar, {});
|
|
7724
8212
|
}
|
|
7725
8213
|
if (elementType === "section-property-km") {
|
|
7726
|
-
return /* @__PURE__ */
|
|
8214
|
+
return /* @__PURE__ */ jsx67(SectionToolbar, {});
|
|
7727
8215
|
}
|
|
7728
8216
|
if (elementType === "section-property-single-two") {
|
|
7729
|
-
return /* @__PURE__ */
|
|
8217
|
+
return /* @__PURE__ */ jsx67(SectionToolbar, {});
|
|
7730
8218
|
}
|
|
7731
8219
|
if (elementType === "section-property-triple") {
|
|
7732
|
-
return /* @__PURE__ */
|
|
8220
|
+
return /* @__PURE__ */ jsx67(SectionToolbar, {});
|
|
7733
8221
|
}
|
|
7734
8222
|
if (elementType === "page") {
|
|
7735
|
-
return /* @__PURE__ */
|
|
8223
|
+
return /* @__PURE__ */ jsx67(PageToolbar, {});
|
|
7736
8224
|
}
|
|
7737
8225
|
if (elementType === "space") {
|
|
7738
|
-
return /* @__PURE__ */
|
|
8226
|
+
return /* @__PURE__ */ jsx67(SpacerToolbar, {});
|
|
7739
8227
|
}
|
|
7740
8228
|
if (elementType === "social") {
|
|
7741
|
-
return /* @__PURE__ */
|
|
8229
|
+
return /* @__PURE__ */ jsx67(SocialToolbar, {});
|
|
7742
8230
|
}
|
|
7743
8231
|
if (elementType === "divider") {
|
|
7744
|
-
return /* @__PURE__ */
|
|
8232
|
+
return /* @__PURE__ */ jsx67(DividerToolbar, {});
|
|
7745
8233
|
}
|
|
7746
8234
|
if (elementType === "image") {
|
|
7747
|
-
return /* @__PURE__ */
|
|
8235
|
+
return /* @__PURE__ */ jsx67(ImageToolbar, {});
|
|
7748
8236
|
}
|
|
7749
8237
|
if (elementType === "social-item") {
|
|
7750
|
-
return /* @__PURE__ */
|
|
8238
|
+
return /* @__PURE__ */ jsx67(SocialItemToolbar, {});
|
|
7751
8239
|
}
|
|
7752
8240
|
if (elementType === "property-card") {
|
|
7753
|
-
return /* @__PURE__ */
|
|
8241
|
+
return /* @__PURE__ */ jsx67(PropertyToolbar, {});
|
|
7754
8242
|
}
|
|
7755
8243
|
if (elementType === "property-card-single-two") {
|
|
7756
|
-
return /* @__PURE__ */
|
|
8244
|
+
return /* @__PURE__ */ jsx67(PropertyToolbar, {});
|
|
7757
8245
|
}
|
|
7758
8246
|
if (elementType === "property-card-triple-item") {
|
|
7759
|
-
return /* @__PURE__ */
|
|
8247
|
+
return /* @__PURE__ */ jsx67(PropertyTripleItemToolbar, {});
|
|
7760
8248
|
}
|
|
7761
|
-
return /* @__PURE__ */
|
|
8249
|
+
return /* @__PURE__ */ jsx67(PlainToolbar, {});
|
|
7762
8250
|
}
|
|
7763
8251
|
|
|
7764
8252
|
// src/components/ui/skeleton.tsx
|
|
7765
|
-
import { jsx as
|
|
8253
|
+
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
7766
8254
|
function Skeleton({ className, ...props }) {
|
|
7767
|
-
return /* @__PURE__ */
|
|
8255
|
+
return /* @__PURE__ */ jsx68(
|
|
7768
8256
|
"div",
|
|
7769
8257
|
{
|
|
7770
8258
|
"data-slot": "skeleton",
|
|
@@ -7775,14 +8263,14 @@ function Skeleton({ className, ...props }) {
|
|
|
7775
8263
|
}
|
|
7776
8264
|
|
|
7777
8265
|
// src/core/editor/components/email-template-v2/template-page.tsx
|
|
7778
|
-
import { Suspense, useState as
|
|
8266
|
+
import { Suspense, useState as useState20, lazy } from "react";
|
|
7779
8267
|
|
|
7780
8268
|
// src/core/editor/hooks/use-auto-save.ts
|
|
7781
|
-
import { useEffect as
|
|
8269
|
+
import { useEffect as useEffect14, useRef as useRef4 } from "react";
|
|
7782
8270
|
var AUTO_SAVE_INTERVAL = 30 * 1e3;
|
|
7783
8271
|
function useAutoSave() {
|
|
7784
8272
|
const intervalRef = useRef4(null);
|
|
7785
|
-
|
|
8273
|
+
useEffect14(() => {
|
|
7786
8274
|
intervalRef.current = setInterval(async () => {
|
|
7787
8275
|
const { template, templateId, onSave, hasUnsavedChanges, markAsSaved, isSaving, setIsSaving } = useEditorStore.getState();
|
|
7788
8276
|
if (isSaving || !templateId || !onSave || !hasUnsavedChanges()) {
|
|
@@ -7809,22 +8297,33 @@ function useAutoSave() {
|
|
|
7809
8297
|
|
|
7810
8298
|
// src/core/editor/components/email-template-v2/template-page.tsx
|
|
7811
8299
|
import "react-json-view-lite/dist/index.css";
|
|
7812
|
-
import { jsx as
|
|
7813
|
-
var Editor2 = lazy(() => import("./core-
|
|
8300
|
+
import { jsx as jsx69, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
8301
|
+
var Editor2 = lazy(() => import("./core-GBVVYXAB.mjs").then((module) => ({
|
|
7814
8302
|
default: module.Editor
|
|
7815
8303
|
})));
|
|
7816
8304
|
function TemplatePage({
|
|
7817
8305
|
templateId,
|
|
7818
8306
|
initialTemplate,
|
|
7819
|
-
onSave
|
|
8307
|
+
onSave,
|
|
8308
|
+
onToast,
|
|
8309
|
+
isPaidLevel = 0
|
|
7820
8310
|
}) {
|
|
7821
|
-
|
|
7822
|
-
|
|
8311
|
+
console.log("Template page rendered!");
|
|
8312
|
+
if (isPaidLevel > MAX_PAID_LEVEL) {
|
|
8313
|
+
console.warn("This paid level is invalid:", isPaidLevel);
|
|
8314
|
+
} else {
|
|
8315
|
+
console.log("This paid level is valid:", isPaidLevel);
|
|
8316
|
+
}
|
|
8317
|
+
useState20(() => {
|
|
8318
|
+
useEditorStore.getState().initializeWithTemplate(templateId, initialTemplate, onSave, onToast, isPaidLevel);
|
|
7823
8319
|
});
|
|
7824
8320
|
useAutoSave();
|
|
7825
|
-
const [editorLoading, setEditorLoading] =
|
|
7826
|
-
const [isPageHovered, setIsPageHovered] =
|
|
7827
|
-
const
|
|
8321
|
+
const [editorLoading, setEditorLoading] = useState20(false);
|
|
8322
|
+
const [isPageHovered, setIsPageHovered] = useState20(false);
|
|
8323
|
+
const template = useEditorStore((state) => state.template);
|
|
8324
|
+
const previewMode = useEditorStore((state) => state.previewMode);
|
|
8325
|
+
const focusIdx = useEditorStore((state) => state.focusIdx);
|
|
8326
|
+
const setFocusIdx = useEditorStore((state) => state.setFocusIdx);
|
|
7828
8327
|
const canvasBackgroundColor = template?.content?.[0]?.attributes?.["background-color"] || "#ffffff";
|
|
7829
8328
|
const handlePageClick = (e) => {
|
|
7830
8329
|
if (!previewMode && e.target === e.currentTarget) {
|
|
@@ -7841,19 +8340,19 @@ function TemplatePage({
|
|
|
7841
8340
|
const handlePageMouseLeave = () => {
|
|
7842
8341
|
setIsPageHovered(false);
|
|
7843
8342
|
};
|
|
7844
|
-
return /* @__PURE__ */
|
|
8343
|
+
return /* @__PURE__ */ jsx69(SidebarProvider, { children: /* @__PURE__ */ jsxs54(
|
|
7845
8344
|
"div",
|
|
7846
8345
|
{
|
|
7847
8346
|
className: "flex flex-col bg-background overflow-hidden",
|
|
7848
8347
|
children: [
|
|
7849
|
-
/* @__PURE__ */
|
|
7850
|
-
/* @__PURE__ */
|
|
7851
|
-
/* @__PURE__ */
|
|
7852
|
-
/* @__PURE__ */
|
|
7853
|
-
/* @__PURE__ */
|
|
7854
|
-
/* @__PURE__ */
|
|
7855
|
-
editorLoading && /* @__PURE__ */
|
|
7856
|
-
/* @__PURE__ */
|
|
8348
|
+
/* @__PURE__ */ jsx69(TemplateHeader, { template }),
|
|
8349
|
+
/* @__PURE__ */ jsxs54("div", { className: "flex flex-row h-full bg-background", children: [
|
|
8350
|
+
/* @__PURE__ */ jsx69(TemplateSidebar, { editorLoading }),
|
|
8351
|
+
/* @__PURE__ */ jsxs54("div", { className: "flex flex-col w-full overflow-hidden h-[calc(100vh-60px)] bg-background relative", children: [
|
|
8352
|
+
/* @__PURE__ */ jsx69(Toolbar, {}),
|
|
8353
|
+
/* @__PURE__ */ jsxs54("div", { className: "w-full h-[calc(100vh)] flex justify-center bg-accent overflow-scroll", children: [
|
|
8354
|
+
editorLoading && /* @__PURE__ */ jsx69(Skeleton, { className: `min-h-[calc(70vh)] h-fit rounded-[12px] pt-8 pb-12 bg-white mt-24 mb-4 w-[600px] bg-muted` }),
|
|
8355
|
+
/* @__PURE__ */ jsx69(
|
|
7857
8356
|
"div",
|
|
7858
8357
|
{
|
|
7859
8358
|
className: cn(
|
|
@@ -7865,7 +8364,7 @@ function TemplatePage({
|
|
|
7865
8364
|
onClick: handlePageClick,
|
|
7866
8365
|
onMouseMove: handlePageMouseMove,
|
|
7867
8366
|
onMouseLeave: handlePageMouseLeave,
|
|
7868
|
-
children: /* @__PURE__ */
|
|
8367
|
+
children: /* @__PURE__ */ jsx69(Suspense, { children: /* @__PURE__ */ jsx69(
|
|
7869
8368
|
Editor2,
|
|
7870
8369
|
{
|
|
7871
8370
|
setEditorLoading,
|