tinacms 3.0.0 → 3.0.2

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/index.js CHANGED
@@ -15,7 +15,7 @@ import { isHotkey } from "is-hotkey";
15
15
  import clsx$1, { clsx } from "clsx";
16
16
  import { Slot } from "@radix-ui/react-slot";
17
17
  import { isLangSupported, formatCodeBlock, insertEmptyCodeBlock, unwrapCodeBlock, isCodeBlockEmpty, isSelectionAtCodeBlockStart } from "@udecode/plate-code-block";
18
- import { X, Search, ChevronDown, Check, AlertTriangle, BracesIcon, Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, PaintBucket, Quote, ChevronRight, ChevronsUpDown, FileCode, Baseline, RectangleVertical, Combine, Ungroup, MessageSquare, MessageSquarePlus, Trash, GripVertical, Edit2, Smile, ExternalLink, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Indent, Keyboard, WrapText, Minus, MoreHorizontal, Outdent, Pilcrow, RotateCcw, RectangleHorizontal, Settings, Strikethrough, Subscript, Superscript, Table, Text as Text$2, Underline, Link2Off, Eye, SeparatorHorizontal, Moon, SunMedium, Twitter, PaintBucketIcon, CombineIcon, SquareSplitHorizontalIcon, Grid2X2Icon, Trash2Icon, ArrowUp, ArrowDown, XIcon, ArrowLeft, ArrowRight, EraserIcon, ChevronDownIcon as ChevronDownIcon$1, ChevronUp, Clock, CalendarCheck, Calendar as Calendar$1, CalendarDays, RotateCw, ChevronLeft, LoaderCircle, TriangleAlert, EllipsisVertical, GitBranchIcon, List as List$1, ListOrdered, Grid3x3Icon, Link, Unlink } from "lucide-react";
18
+ import { X, Search, ChevronDown, Check, AlertTriangle, BracesIcon, Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, PaintBucket, Quote, ChevronRight, ChevronsUpDown, FileCode, Baseline, RectangleVertical, Combine, Ungroup, MessageSquare, MessageSquarePlus, Trash, GripVertical, Edit2, Smile, ExternalLink, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Indent, Keyboard, WrapText, Minus, MoreHorizontal, Outdent, Pilcrow, RotateCcw, RectangleHorizontal, Settings, Strikethrough, Subscript, Superscript, Table, Text as Text$2, Underline, Link2Off, Eye, SeparatorHorizontal, Moon, SunMedium, Twitter, PaintBucketIcon, CombineIcon, SquareSplitHorizontalIcon, Grid2X2Icon, Trash2Icon, ArrowUp, ArrowDown, XIcon, ArrowLeft, ArrowRight, EraserIcon, ChevronDownIcon as ChevronDownIcon$1, ChevronUp, Clock, CalendarCheck, Calendar as Calendar$1, CalendarDays, RotateCw, ChevronLeft, LoaderCircle, TriangleAlert, EllipsisVertical, GitBranchIcon, List as List$1, ListOrdered, Grid3x3Icon, CircleX, Link, Unlink } from "lucide-react";
19
19
  import mermaid from "mermaid";
20
20
  import { cva } from "class-variance-authority";
21
21
  import { Command as Command$2 } from "cmdk";
@@ -43,10 +43,10 @@ import { twMerge } from "tailwind-merge";
43
43
  import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from "@dnd-kit/core";
44
44
  import { sortableKeyboardCoordinates, useSortable, SortableContext, verticalListSortingStrategy, defaultAnimateLayoutChanges } from "@dnd-kit/sortable";
45
45
  import { CSS } from "@dnd-kit/utilities";
46
- import * as pkg$1 from "react-color";
47
- import * as pkg from "color-string";
48
46
  import { buildSchema, print, getIntrospectionQuery, buildClientSchema, parse as parse$4 } from "graphql";
49
47
  import { diff as diff$1 } from "@graphql-inspector/core";
48
+ import { get as get$6, to as to$1 } from "color-string";
49
+ import { HexColorPicker } from "react-colorful";
50
50
  import * as dropzone from "react-dropzone";
51
51
  import { Command as Command$3 } from "@udecode/cmdk";
52
52
  import { Popover as Popover$4, PopoverButton, Transition, PopoverPanel, TransitionChild, Disclosure, DisclosureButton, DisclosurePanel, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
@@ -33524,7 +33524,8 @@ const buttonVariants$2 = cva(
33524
33524
  inlineLink: "text-base text-primary underline underline-offset-4",
33525
33525
  link: "text-primary underline-offset-4 hover:underline",
33526
33526
  outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
33527
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
33527
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
33528
+ tinaPrimary: "bg-tina-orange-dark text-white hover:bg-tina-orange-dark/90 disabled:bg-tina-orange-dark/50"
33528
33529
  }
33529
33530
  }
33530
33531
  }
@@ -39367,20 +39368,183 @@ const TextArea = React.forwardRef(({ ...props }, ref) => {
39367
39368
  }
39368
39369
  );
39369
39370
  });
39370
- const { get: getColor, to: toColor } = pkg;
39371
+ const TRANSPARENT = "transparent";
39372
+ const isValidHex = (value) => /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(value);
39373
+ const expandHex = (hex) => {
39374
+ const h = hex.replace("#", "");
39375
+ if (h.length === 3) {
39376
+ return `#${h[0]}${h[0]}${h[1]}${h[1]}${h[2]}${h[2]}`.toUpperCase();
39377
+ }
39378
+ return `#${h.toUpperCase()}`;
39379
+ };
39380
+ const hexToRgb = (hex) => {
39381
+ if (!hex || !isValidHex(hex))
39382
+ return null;
39383
+ const expanded = expandHex(hex).replace("#", "");
39384
+ return {
39385
+ r: parseInt(expanded.substring(0, 2), 16),
39386
+ g: parseInt(expanded.substring(2, 4), 16),
39387
+ b: parseInt(expanded.substring(4, 6), 16)
39388
+ };
39389
+ };
39390
+ const rgbToHex = (r2, g, b) => `#${((1 << 24) + (r2 << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase()}`;
39391
+ const checkerboardStyle$1 = (size2 = 8) => ({
39392
+ backgroundImage: "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)",
39393
+ backgroundSize: `${size2}px ${size2}px`,
39394
+ backgroundPosition: `0 0, 0 ${size2 / 2}px, ${size2 / 2}px -${size2 / 2}px, -${size2 / 2}px 0px`
39395
+ });
39396
+ const normalizeColorValue = (value) => {
39397
+ if (isValidHex(value)) {
39398
+ return expandHex(value);
39399
+ }
39400
+ const parsed = get$6(value.toLowerCase());
39401
+ if (parsed)
39402
+ return rgbToHex(parsed.value[0], parsed.value[1], parsed.value[2]);
39403
+ return null;
39404
+ };
39405
+ const useHexInput = (color, onChange) => {
39406
+ const [inputValue, setInputValue] = React.useState(color);
39407
+ const [isFocused2, setIsFocused] = React.useState(false);
39408
+ React.useEffect(() => {
39409
+ if (!isFocused2) {
39410
+ setInputValue(color);
39411
+ }
39412
+ }, [color, isFocused2]);
39413
+ const handleChange = (e3) => {
39414
+ const value = e3.target.value;
39415
+ setInputValue(value);
39416
+ const normalized = normalizeColorValue(value);
39417
+ if (normalized)
39418
+ onChange(normalized);
39419
+ };
39420
+ const handleFocus = () => {
39421
+ setIsFocused(true);
39422
+ };
39423
+ const handleBlur = () => {
39424
+ setIsFocused(false);
39425
+ const normalized = normalizeColorValue(inputValue);
39426
+ if (normalized) {
39427
+ setInputValue(normalized);
39428
+ onChange(normalized);
39429
+ } else {
39430
+ setInputValue(color);
39431
+ }
39432
+ };
39433
+ const handleSwatchClick = React.useCallback(
39434
+ (c2) => {
39435
+ if (c2 === TRANSPARENT) {
39436
+ onChange(null);
39437
+ } else {
39438
+ const normalized = normalizeColorValue(c2);
39439
+ onChange(normalized || c2);
39440
+ }
39441
+ },
39442
+ [onChange]
39443
+ );
39444
+ return {
39445
+ inputValue,
39446
+ handleChange,
39447
+ handleFocus,
39448
+ handleBlur,
39449
+ handleSwatchClick
39450
+ };
39451
+ };
39452
+ const SwatchButton = ({ color, isSelected: isSelected2, onClick }) => /* @__PURE__ */ React.createElement("div", { className: "relative w-full pb-[100%]" }, /* @__PURE__ */ React.createElement(
39453
+ "button",
39454
+ {
39455
+ type: "button",
39456
+ onClick,
39457
+ className: `absolute inset-0 rounded-sm border cursor-pointer transition-all ${isSelected2 ? "border-blue-500 border-2 scale-110" : "border-gray-200 hover:scale-105"}`,
39458
+ style: {
39459
+ backgroundColor: color === TRANSPARENT ? "#FFF" : color,
39460
+ ...color === TRANSPARENT ? checkerboardStyle$1() : {}
39461
+ },
39462
+ "aria-label": color === TRANSPARENT ? "Clear color" : `Select color ${color}`
39463
+ }
39464
+ ));
39465
+ const ColorPreview = ({
39466
+ color,
39467
+ size: size2 = "sm"
39468
+ }) => /* @__PURE__ */ React.createElement(
39469
+ "div",
39470
+ {
39471
+ className: size2 === "lg" ? "h-16 w-full rounded border border-gray-200 mb-2" : "w-8 h-8 rounded border border-gray-200 flex-shrink-0",
39472
+ style: {
39473
+ backgroundColor: color || TRANSPARENT,
39474
+ ...!color ? checkerboardStyle$1(size2 === "lg" ? 16 : 8) : {}
39475
+ },
39476
+ "aria-label": "Current color preview"
39477
+ }
39478
+ );
39479
+ const HexInput = ({ value, onChange, onFocus, onBlur, fullWidth }) => /* @__PURE__ */ React.createElement(
39480
+ "input",
39481
+ {
39482
+ type: "text",
39483
+ value: value || "",
39484
+ onChange,
39485
+ onFocus,
39486
+ onBlur,
39487
+ placeholder: "#000000 or color name",
39488
+ className: `shadow-inner px-2 py-1 text-sm border border-gray-200 rounded focus:shadow-outline focus:border-blue-500 focus:outline-none ${fullWidth ? "w-full" : "flex-1 min-w-0"}`
39489
+ }
39490
+ );
39491
+ const SwatchGrid = ({ colors, selectedColor, onSelect }) => /* @__PURE__ */ React.createElement("div", { className: "mt-2 grid grid-cols-8 gap-1.5" }, colors.map((c2) => /* @__PURE__ */ React.createElement(
39492
+ SwatchButton,
39493
+ {
39494
+ key: c2,
39495
+ color: c2,
39496
+ isSelected: (selectedColor == null ? void 0 : selectedColor.toLowerCase()) === c2.toLowerCase(),
39497
+ onClick: () => onSelect(c2)
39498
+ }
39499
+ )));
39500
+ const BlockWidget = ({
39501
+ presetColors: presetColors2,
39502
+ color,
39503
+ onChange,
39504
+ width
39505
+ }) => {
39506
+ const {
39507
+ inputValue,
39508
+ handleChange,
39509
+ handleFocus,
39510
+ handleBlur,
39511
+ handleSwatchClick
39512
+ } = useHexInput(color, onChange);
39513
+ return /* @__PURE__ */ React.createElement(
39514
+ "div",
39515
+ {
39516
+ className: "bg-white rounded-lg shadow-lg overflow-hidden",
39517
+ style: { width }
39518
+ },
39519
+ /* @__PURE__ */ React.createElement("div", { className: "p-3" }, /* @__PURE__ */ React.createElement(ColorPreview, { color, size: "lg" }), /* @__PURE__ */ React.createElement(
39520
+ HexInput,
39521
+ {
39522
+ value: inputValue,
39523
+ onChange: handleChange,
39524
+ onFocus: handleFocus,
39525
+ onBlur: handleBlur,
39526
+ fullWidth: true
39527
+ }
39528
+ ), /* @__PURE__ */ React.createElement(
39529
+ SwatchGrid,
39530
+ {
39531
+ colors: presetColors2,
39532
+ selectedColor: color,
39533
+ onSelect: handleSwatchClick
39534
+ }
39535
+ ))
39536
+ );
39537
+ };
39371
39538
  var ColorFormat = /* @__PURE__ */ ((ColorFormat2) => {
39372
39539
  ColorFormat2["Hex"] = "hex";
39373
39540
  ColorFormat2["RGB"] = "rgb";
39374
39541
  return ColorFormat2;
39375
39542
  })(ColorFormat || {});
39376
- const rgbToHex = function(color) {
39377
- return "#" + ((1 << 24) + (color.r << 16) + (color.g << 8) + color.b).toString(16).slice(1);
39378
- };
39379
39543
  function ParseColorStr(color) {
39380
39544
  if (!color) {
39381
39545
  return null;
39382
39546
  }
39383
- const colorDescriptor = getColor(color);
39547
+ const colorDescriptor = get$6(color);
39384
39548
  if (!colorDescriptor)
39385
39549
  return null;
39386
39550
  const colorVals = colorDescriptor.value;
@@ -39396,7 +39560,7 @@ const ColorFormatter = {
39396
39560
  },
39397
39561
  getValue(color) {
39398
39562
  const colorVals = [color.r, color.g, color.b, color.a];
39399
- return toColor.rgb(colorVals);
39563
+ return to$1.rgb(colorVals);
39400
39564
  },
39401
39565
  parse: ParseColorStr
39402
39566
  },
@@ -39405,37 +39569,88 @@ const ColorFormatter = {
39405
39569
  /* Hex */
39406
39570
  ]: {
39407
39571
  getLabel(color) {
39408
- return rgbToHex(color);
39572
+ return rgbToHex(color.r, color.g, color.b);
39409
39573
  },
39410
39574
  getValue(color) {
39411
39575
  const colorVals = [color.r, color.g, color.b, color.a];
39412
- return toColor.hex(colorVals);
39576
+ return to$1.hex(colorVals).toUpperCase();
39413
39577
  },
39414
39578
  parse: ParseColorStr
39415
39579
  }
39416
39580
  };
39417
- const { SketchPicker, BlockPicker } = pkg$1;
39418
- const GetTextColorForBackground = function(backgroundColor) {
39419
- return !backgroundColor || backgroundColor.r * 0.299 + backgroundColor.g * 0.587 + backgroundColor.b * 0.114 > 186 ? "#000000" : "#ffffff";
39581
+ const SketchWidget = ({
39582
+ presetColors: presetColors2,
39583
+ color,
39584
+ onChange,
39585
+ width
39586
+ }) => {
39587
+ const {
39588
+ inputValue,
39589
+ handleChange,
39590
+ handleFocus,
39591
+ handleBlur,
39592
+ handleSwatchClick
39593
+ } = useHexInput(color, onChange);
39594
+ const currentRgb = hexToRgb(color) || { r: 0, g: 0, b: 0 };
39595
+ const handleRgbChange = (channel, value) => {
39596
+ const num = Math.max(0, Math.min(255, parseInt(value, 10) || 0));
39597
+ const updated = { ...currentRgb, [channel]: num };
39598
+ onChange(rgbToHex(updated.r, updated.g, updated.b));
39599
+ };
39600
+ return /* @__PURE__ */ React.createElement("div", { className: "bg-white rounded-lg shadow-lg p-3", style: { width } }, /* @__PURE__ */ React.createElement(
39601
+ HexColorPicker,
39602
+ {
39603
+ color: color || "#000000",
39604
+ onChange,
39605
+ className: "!w-full !h-[150px]"
39606
+ }
39607
+ ), /* @__PURE__ */ React.createElement("div", { className: "mt-2 flex gap-2 items-center" }, /* @__PURE__ */ React.createElement(ColorPreview, { color }), /* @__PURE__ */ React.createElement(
39608
+ HexInput,
39609
+ {
39610
+ value: inputValue,
39611
+ onChange: handleChange,
39612
+ onFocus: handleFocus,
39613
+ onBlur: handleBlur
39614
+ }
39615
+ )), /* @__PURE__ */ React.createElement("div", { className: "mt-2 flex gap-2" }, ["r", "g", "b"].map((channel) => /* @__PURE__ */ React.createElement("div", { key: channel, className: "flex-1" }, /* @__PURE__ */ React.createElement("label", { className: "block text-xs text-gray-500 mb-0.5" }, channel.toUpperCase()), /* @__PURE__ */ React.createElement(
39616
+ "input",
39617
+ {
39618
+ type: "number",
39619
+ min: 0,
39620
+ max: 255,
39621
+ value: currentRgb[channel],
39622
+ onChange: (e3) => handleRgbChange(channel, e3.target.value),
39623
+ className: "shadow-inner w-full px-2 py-1 text-sm border border-gray-200 rounded focus:shadow-outline focus:border-blue-500 focus:outline-none"
39624
+ }
39625
+ )))), /* @__PURE__ */ React.createElement(
39626
+ SwatchGrid,
39627
+ {
39628
+ colors: presetColors2,
39629
+ selectedColor: color,
39630
+ onSelect: handleSwatchClick
39631
+ }
39632
+ ));
39633
+ };
39634
+ const isLightBackground = function(backgroundColor) {
39635
+ return !backgroundColor || backgroundColor.r * 0.299 + backgroundColor.g * 0.587 + backgroundColor.b * 0.114 > 186;
39420
39636
  };
39421
- const Swatch = ({
39422
- colorRGBA,
39423
- colorFormat,
39424
- unselectable,
39425
- ...props
39426
- }) => /* @__PURE__ */ React.createElement(
39637
+ const getTextColorForBackground = function(backgroundColor) {
39638
+ return isLightBackground(backgroundColor) ? "#000000" : "#FFFFFF";
39639
+ };
39640
+ const Swatch = ({ colorRGBA, colorFormat, width, ...props }) => /* @__PURE__ */ React.createElement(
39427
39641
  "div",
39428
39642
  {
39429
- className: "bg-gray-100 rounded-3xl shadow-[0_2px_3px_rgba(0,0,0,0.12)] cursor-pointer w-full m-0",
39643
+ className: "bg-gray-100 rounded shadow-[0_2px_3px_rgba(0,0,0,0.12)] cursor-pointer m-0",
39644
+ style: { width },
39430
39645
  ...props
39431
39646
  },
39432
39647
  /* @__PURE__ */ React.createElement(
39433
39648
  "div",
39434
39649
  {
39435
- className: "swatch-inner flex items-center justify-center text-[13px] font-bold w-full h-10 rounded-3xl hover:opacity-[.6]",
39650
+ className: "swatch-inner flex items-center justify-center text-[13px] font-bold w-full h-10 rounded hover:opacity-[.6]",
39436
39651
  style: {
39437
39652
  background: colorRGBA ? `rgba(${colorRGBA.r}, ${colorRGBA.g}, ${colorRGBA.b}, ${colorRGBA.a})` : `#fff`,
39438
- color: GetTextColorForBackground(colorRGBA),
39653
+ color: getTextColorForBackground(colorRGBA),
39439
39654
  transition: "all var(--tina-timing-short) ease-out"
39440
39655
  }
39441
39656
  },
@@ -39451,7 +39666,7 @@ const Popover$2 = ({
39451
39666
  }) => /* @__PURE__ */ React.createElement(
39452
39667
  "div",
39453
39668
  {
39454
- className: `fixed z-50 before:content-[""] before:absolute before:left-1/2 before:-translate-x-1/2 before:w-[18px] before:h-[14px] before:bg-gray-200 before:z-10 after:content-[""] after:absolute after:left-1/2 after:-translate-x-1/2 after:w-4 after:h-[13px] after:bg-white after:z-20 ${openTop ? "before:bottom-0 before:mt-[1px] before:translate-y-full color-picker-on-top-clip-path after:bottom-0 after:mb-0.5 after:translate-y-full" : "before:top-0 before:mb-[1px] before:-translate-y-full color-picker-clip-path after:top-0 after:mt-0.5 after:-translate-y-full"} ${className}`,
39669
+ className: `fixed z-50 before:content-[""] before:absolute before:left-1/2 before:-translate-x-1/2 before:w-[18px] before:h-[14px] before:bg-white before:z-10 after:content-[""] after:absolute after:left-1/2 after:-translate-x-1/2 after:w-4 after:h-[13px] after:bg-white after:z-20 ${openTop ? "before:bottom-0 before:mt-[1px] before:translate-y-full color-picker-on-top-clip-path after:bottom-0 after:mb-0.5 after:translate-y-full" : "before:top-0 before:mb-[1px] before:-translate-y-full color-picker-clip-path after:top-0 after:mt-0.5 after:-translate-y-full"} ${className}`,
39455
39670
  style: {
39456
39671
  top: triggerBoundingBox ? openTop ? triggerBoundingBox.top : triggerBoundingBox.bottom : 0,
39457
39672
  left: triggerBoundingBox ? triggerBoundingBox.left + triggerBoundingBox.width / 2 : 0,
@@ -39463,7 +39678,6 @@ const Popover$2 = ({
39463
39678
  ...props
39464
39679
  }
39465
39680
  );
39466
- const nullColor = "transparent";
39467
39681
  const presetColors = [
39468
39682
  "#D0021B",
39469
39683
  "#F5A623",
@@ -39481,93 +39695,69 @@ const presetColors = [
39481
39695
  "#9B9B9B",
39482
39696
  "#FFFFFF"
39483
39697
  ];
39484
- const SketchWidget = (props) => /* @__PURE__ */ React.createElement(
39485
- SketchPicker,
39486
- {
39487
- presetColors: props.presetColors,
39488
- color: props.color,
39489
- onChange: props.onChange,
39490
- disableAlpha: props.disableAlpha,
39491
- width: props.width
39492
- }
39493
- );
39494
- const BlockWidget = (props) => /* @__PURE__ */ React.createElement(
39495
- BlockPicker,
39496
- {
39497
- colors: props.presetColors,
39498
- color: props.color,
39499
- onChange: props.onChange,
39500
- width: props.width
39501
- }
39502
- );
39503
39698
  const WIDGETS = { sketch: SketchWidget, block: BlockWidget };
39504
39699
  const ColorPicker = ({
39505
39700
  colorFormat,
39506
39701
  userColors = presetColors,
39507
39702
  widget = "sketch",
39703
+ width,
39508
39704
  input
39509
39705
  }) => {
39510
39706
  const FormPortal = useFormPortal();
39511
39707
  const triggerRef = React.useRef(null);
39512
39708
  const [triggerBoundingBox, setTriggerBoundingBox] = useState(null);
39513
- const [openTop, setOpenTop] = useState(false);
39709
+ const [displayColorPicker, setDisplayColorPicker] = useState(false);
39514
39710
  const updateTriggerBoundingBox = () => {
39515
- if (triggerRef.current) {
39711
+ if (triggerRef.current)
39516
39712
  setTriggerBoundingBox(triggerRef.current.getBoundingClientRect());
39517
- }
39518
39713
  };
39519
- React.useEffect(() => {
39520
- if (triggerBoundingBox) {
39521
- const triggerOffsetTop = triggerBoundingBox.top + triggerBoundingBox.height / 2;
39522
- const windowHeight = window.innerHeight;
39523
- if (triggerOffsetTop > windowHeight / 2) {
39524
- setOpenTop(true);
39525
- } else {
39526
- setOpenTop(false);
39527
- }
39528
- }
39529
- }, [triggerBoundingBox]);
39714
+ const openTop = triggerBoundingBox ? triggerBoundingBox.top + triggerBoundingBox.height / 2 > window.innerHeight / 2 : false;
39530
39715
  React.useEffect(() => {
39531
39716
  const delay = 100;
39532
- let timeout = false;
39533
- setTimeout(() => {
39534
- updateTriggerBoundingBox();
39535
- }, delay);
39717
+ let timeout = null;
39718
+ timeout = setTimeout(updateTriggerBoundingBox, delay);
39536
39719
  const handleResize = () => {
39537
- clearTimeout(timeout);
39720
+ if (timeout)
39721
+ clearTimeout(timeout);
39538
39722
  timeout = setTimeout(updateTriggerBoundingBox, delay);
39539
39723
  };
39540
39724
  window.addEventListener("resize", handleResize);
39541
- return () => {
39542
- window.removeEventListener("resize", handleResize);
39543
- };
39544
- }, [triggerRef.current]);
39545
- const Widget = WIDGETS[widget];
39546
- if (!Widget)
39547
- throw new Error("You must specify a widget type.");
39548
- const [displayColorPicker, setDisplayColorPicker] = useState(false);
39725
+ return () => window.removeEventListener("resize", handleResize);
39726
+ }, []);
39549
39727
  const getColorFormat = (colorFormat || ColorFormat.Hex).toLowerCase();
39550
39728
  const getColorRGBA = input.value ? ColorFormatter[getColorFormat].parse(input.value) : null;
39551
- const handleChange = (pickerColor) => {
39552
- const color = pickerColor.hex === nullColor ? null : { ...pickerColor.rgb, a: 1 };
39553
- input.onChange(
39554
- color ? ColorFormatter[getColorFormat].getValue(color) : null
39555
- );
39556
- };
39729
+ const currentHexColor = getColorRGBA ? rgbToHex(getColorRGBA.r, getColorRGBA.g, getColorRGBA.b) : "";
39730
+ const handleChange = useCallback(
39731
+ (hexColor) => {
39732
+ if (!hexColor) {
39733
+ input.onChange(null);
39734
+ return;
39735
+ }
39736
+ const rgb = hexToRgb(hexColor);
39737
+ if (rgb)
39738
+ input.onChange(
39739
+ ColorFormatter[getColorFormat].getValue({ ...rgb, a: 1 })
39740
+ );
39741
+ },
39742
+ [getColorFormat, input]
39743
+ );
39557
39744
  const toggleColorPicker = (event) => {
39558
39745
  event.stopPropagation();
39559
39746
  const display = !displayColorPicker;
39560
39747
  setDisplayColorPicker(display);
39561
- if (display) {
39748
+ if (display)
39562
39749
  updateTriggerBoundingBox();
39563
- }
39564
39750
  };
39565
- return /* @__PURE__ */ React.createElement("div", { className: "relative", ref: triggerRef }, /* @__PURE__ */ React.createElement(
39751
+ const Widget = WIDGETS[widget];
39752
+ if (!Widget)
39753
+ throw new Error("You must specify a widget type.");
39754
+ return /* @__PURE__ */ React.createElement("div", { className: "relative", ref: triggerRef, style: { width } }, /* @__PURE__ */ React.createElement(
39566
39755
  Swatch,
39567
39756
  {
39568
39757
  onClick: toggleColorPicker,
39569
39758
  colorRGBA: getColorRGBA,
39570
- colorFormat: getColorFormat
39759
+ colorFormat: getColorFormat,
39760
+ width
39571
39761
  }
39572
39762
  ), displayColorPicker && /* @__PURE__ */ React.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React.createElement(
39573
39763
  Popover$2,
@@ -39587,11 +39777,10 @@ const ColorPicker = ({
39587
39777
  /* @__PURE__ */ React.createElement(
39588
39778
  Widget,
39589
39779
  {
39590
- presetColors: [...userColors, nullColor],
39591
- color: getColorRGBA || { r: 0, g: 0, b: 0, a: 0 },
39780
+ presetColors: [...userColors, TRANSPARENT],
39781
+ color: currentHexColor,
39592
39782
  onChange: handleChange,
39593
- disableAlpha: true,
39594
- width: "240px"
39783
+ width: width || "240px"
39595
39784
  }
39596
39785
  )
39597
39786
  )
@@ -41338,6 +41527,7 @@ const ColorField = wrapFieldsWithMeta(
41338
41527
  colorFormat: field.colorFormat,
41339
41528
  userColors: field.colors,
41340
41529
  widget: field.widget,
41530
+ width: field.width,
41341
41531
  input
41342
41532
  }
41343
41533
  );
@@ -45485,7 +45675,7 @@ function GridMediaItem({ item, active, onClick }) {
45485
45675
  src: thumbnail,
45486
45676
  alt: item.filename
45487
45677
  }
45488
- )) : /* @__PURE__ */ React__default.createElement("div", { className: "p-4 w-full flex flex-col gap-4 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(FileIcon, { className: "w-[30%] h-auto fill-gray-300" }), /* @__PURE__ */ React__default.createElement("span", { className: "block text-base text-gray-600 w-full break-words truncate" }, item.filename)))
45678
+ )) : /* @__PURE__ */ React__default.createElement("div", { className: "p-4 w-full flex flex-col gap-4 items-center justify-center" }, /* @__PURE__ */ React__default.createElement(FileIcon, { className: "w-[40%] h-auto fill-gray-300", size: 40 })))
45489
45679
  ));
45490
45680
  }
45491
45681
  const DeleteModal$1 = ({
@@ -46296,12 +46486,12 @@ const Callout = ({
46296
46486
  className = "",
46297
46487
  ...props
46298
46488
  }) => {
46299
- const commonAlertStyles = "text-sm px-4 py-3 rounded-md border";
46489
+ const commonAlertStyles = "text-sm px-4 py-3 rounded-md border-2 font bg-white text-gray-700 font-medium";
46300
46490
  const styles = {
46301
- warning: `text-amber-700 bg-amber-100 border-amber-700/20`,
46302
- info: `text-blue-600 bg-blue-100/50 border-blue-600/20`,
46303
- success: `text-green-600 bg-green-100/50 border-green-600/20`,
46304
- error: `text-red-600 bg-red-100/50 border-red-600/20`
46491
+ warning: `border-amber-700/20`,
46492
+ info: `border-blue-600/20`,
46493
+ success: `border-green-600/20`,
46494
+ error: `border-red-600/20`
46305
46495
  };
46306
46496
  const icon = {
46307
46497
  warning: /* @__PURE__ */ React.createElement(MdWarning, { className: "w-5 h-auto inline-block mr-1 opacity-70 text-amber-600" }),
@@ -46390,7 +46580,31 @@ function FiInfo(props) {
46390
46580
  function VscNewFile(props) {
46391
46581
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 16 16", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "clipRule": "evenodd", "d": "M9.5 1.1l3.4 3.5.1.4v2h-1V6H8V2H3v11h4v1H2.5l-.5-.5v-12l.5-.5h6.7l.3.1zM9 2v3h2.9L9 2zm4 14h-1v-3H9v-1h3V9h1v3h3v1h-3v3z" }, "child": [] }] })(props);
46392
46582
  }
46393
- const version$1 = "3.0.0";
46583
+ const NavContext = createContext(void 0);
46584
+ const useNav = () => {
46585
+ const context = useContext(NavContext);
46586
+ if (!context) {
46587
+ throw new Error("useNav must be used within a NavProvider");
46588
+ }
46589
+ return context;
46590
+ };
46591
+ const NavProvider = ({
46592
+ children,
46593
+ defaultOpen = false
46594
+ }) => {
46595
+ const [menuIsOpen, setMenuIsOpen] = useState(defaultOpen);
46596
+ const toggleMenu = () => setMenuIsOpen((prev) => !prev);
46597
+ const openMenu = () => setMenuIsOpen(true);
46598
+ const closeMenu = () => setMenuIsOpen(false);
46599
+ const value = {
46600
+ menuIsOpen,
46601
+ toggleMenu,
46602
+ openMenu,
46603
+ closeMenu
46604
+ };
46605
+ return /* @__PURE__ */ React__default.createElement(NavContext.Provider, { value }, children);
46606
+ };
46607
+ const version$1 = "3.0.2";
46394
46608
  const VersionInfo = () => {
46395
46609
  var _a2, _b, _c, _d, _e, _f;
46396
46610
  const cms = useCMS();
@@ -46575,8 +46789,8 @@ const SyncStatusButton = ({
46575
46789
  const Nav = ({
46576
46790
  isLocalMode,
46577
46791
  showHamburger = true,
46578
- menuIsOpen,
46579
- toggleMenu,
46792
+ menuIsOpen: menuIsOpenProp,
46793
+ toggleMenu: toggleMenuProp,
46580
46794
  className = "",
46581
46795
  children,
46582
46796
  showCollections,
@@ -46593,6 +46807,10 @@ const Nav = ({
46593
46807
  }) => {
46594
46808
  const cms = useCMS$1();
46595
46809
  const [eventsOpen, setEventsOpen] = React.useState(false);
46810
+ const navContext = React.useContext(NavContext);
46811
+ const menuIsOpen = menuIsOpenProp ?? (navContext == null ? void 0 : navContext.menuIsOpen) ?? false;
46812
+ const toggleMenu = toggleMenuProp ?? (navContext == null ? void 0 : navContext.toggleMenu) ?? (() => {
46813
+ });
46596
46814
  const { contentCollections, authCollection } = collectionsInfo.collections.reduce(
46597
46815
  (acc, collection) => {
46598
46816
  if (collection.isAuthCollection) {
@@ -46615,7 +46833,7 @@ const Nav = ({
46615
46833
  },
46616
46834
  { Site: [] }
46617
46835
  );
46618
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline" }, /* @__PURE__ */ React.createElement(
46836
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, showHamburger && /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline" }, /* @__PURE__ */ React.createElement(
46619
46837
  "button",
46620
46838
  {
46621
46839
  className: cn(
@@ -46637,7 +46855,7 @@ const Nav = ({
46637
46855
  style: { maxWidth: `${sidebarWidth}px` },
46638
46856
  ...props
46639
46857
  },
46640
- /* @__PURE__ */ React.createElement("div", { className: "flex w-full px-4 py-3 justify-between items-center gap-2 border-b border-gray-200" }, /* @__PURE__ */ React.createElement(
46858
+ /* @__PURE__ */ React.createElement("div", { className: "flex w-full px-4 py-3 justify-between items-center gap-2 border-b border-gray-200" }, /* @__PURE__ */ React.createElement("span", { className: "text-left inline-flex items-center text-xl tracking-wide text-gray-800/80 flex-1 gap-1" }, /* @__PURE__ */ React.createElement(TinaExtendedIcon, { className: "h-8 w-auto fill-orange-500" })), /* @__PURE__ */ React.createElement(
46641
46859
  "button",
46642
46860
  {
46643
46861
  className: cn(
@@ -46647,8 +46865,8 @@ const Nav = ({
46647
46865
  toggleMenu();
46648
46866
  }
46649
46867
  },
46650
- /* @__PURE__ */ React.createElement(BiMenu, { className: "h-8 w-auto text-gray-600" })
46651
- ), /* @__PURE__ */ React.createElement("span", { className: "text-left inline-flex items-center text-xl tracking-wide text-gray-800/80 flex-1 gap-1" }, /* @__PURE__ */ React.createElement(TinaExtendedIcon, { className: "h-8 w-auto fill-orange-500" }))),
46868
+ /* @__PURE__ */ React.createElement(BiX, { className: "h-8 w-auto text-gray-600" })
46869
+ )),
46652
46870
  children,
46653
46871
  /* @__PURE__ */ React.createElement("div", { className: "flex flex-col px-6 flex-1 overflow-auto" }, showCollections && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h4", { className: "flex space-x-1 justify-items-start uppercase font-sans font-bold text-sm mb-3 mt-8 text-gray-700" }, /* @__PURE__ */ React.createElement("span", null, "Collections"), isLocalMode && /* @__PURE__ */ React.createElement("span", { className: "flex items-center" }, /* @__PURE__ */ React.createElement(
46654
46872
  "a",
@@ -46758,6 +46976,20 @@ const Logout = ({
46758
46976
  };
46759
46977
  return /* @__PURE__ */ React.createElement("button", { onClick: handleLogout, ...buttonProps }, /* @__PURE__ */ React.createElement(BiExit, { className: "w-6 h-auto mr-2" }), " Log Out");
46760
46978
  };
46979
+ const NavCloudLink = ({ config }) => {
46980
+ if (config.text) {
46981
+ return /* @__PURE__ */ React__default.createElement("span", { className: "text-base tracking-wide text-gray-500 flex items-center opacity-90" }, config.text, " ", /* @__PURE__ */ React__default.createElement(
46982
+ "a",
46983
+ {
46984
+ target: "_blank",
46985
+ className: "ml-1 text-blue-600 hover:opacity-60",
46986
+ href: config.link.href
46987
+ },
46988
+ config.link.text
46989
+ ));
46990
+ }
46991
+ return /* @__PURE__ */ React__default.createElement("span", { className: "text-base tracking-wide text-gray-500 hover:text-blue-600 flex items-center opacity-90 hover:opacity-100" }, /* @__PURE__ */ React__default.createElement(config.Icon, { className: "mr-2 h-6 opacity-80 w-auto" }), /* @__PURE__ */ React__default.createElement("a", { target: "_blank", href: config.link.href }, config.link.text));
46992
+ };
46761
46993
  const ResizeHandle = () => {
46762
46994
  const {
46763
46995
  resizingSidebar,
@@ -47422,7 +47654,7 @@ const Sidebar$1 = ({
47422
47654
  }
47423
47655
  }
47424
47656
  ),
47425
- RenderNavCloud: ({ config }) => /* @__PURE__ */ React.createElement(SidebarCloudLink$1, { config }),
47657
+ RenderNavCloud: ({ config }) => /* @__PURE__ */ React.createElement(NavCloudLink, { config }),
47426
47658
  RenderNavCollection: ({ collection }) => /* @__PURE__ */ React.createElement(
47427
47659
  SidebarCollectionLink,
47428
47660
  {
@@ -47530,20 +47762,6 @@ const SidebarSiteLink = ({
47530
47762
  view.name
47531
47763
  );
47532
47764
  };
47533
- const SidebarCloudLink$1 = ({ config }) => {
47534
- if (config.text) {
47535
- return /* @__PURE__ */ React.createElement("span", { className: "text-base tracking-wide text-gray-500 flex items-center opacity-90" }, config.text, " ", /* @__PURE__ */ React.createElement(
47536
- "a",
47537
- {
47538
- target: "_blank",
47539
- className: "ml-1 text-blue-600 hover:opacity-60",
47540
- href: config.link.href
47541
- },
47542
- config.link.text
47543
- ));
47544
- }
47545
- return /* @__PURE__ */ React.createElement("span", { className: "text-base tracking-wide text-gray-500 hover:text-blue-600 flex items-center opacity-90 hover:opacity-100" }, /* @__PURE__ */ React.createElement(config.Icon, { className: "mr-2 h-6 opacity-80 w-auto" }), /* @__PURE__ */ React.createElement("a", { target: "_blank", href: config.link.href }, config.link.text));
47546
- };
47547
47765
  const SidebarCollectionLink = ({
47548
47766
  Icon = ImFilesEmpty,
47549
47767
  collection,
@@ -47609,6 +47827,25 @@ const SidebarBody = ({ children }) => {
47609
47827
  children
47610
47828
  );
47611
47829
  };
47830
+ const NavMenuTrigger = ({
47831
+ className = "",
47832
+ label = "Toggle navigation menu"
47833
+ }) => {
47834
+ const { toggleMenu, menuIsOpen } = useNav();
47835
+ if (menuIsOpen) {
47836
+ return null;
47837
+ }
47838
+ return /* @__PURE__ */ React__default.createElement(
47839
+ "button",
47840
+ {
47841
+ className: `pointer-events-auto p-2 hover:bg-gray-100 transition-colors duration-150 ease-in-out rounded ${className}`,
47842
+ onClick: toggleMenu,
47843
+ "aria-label": label,
47844
+ title: label
47845
+ },
47846
+ /* @__PURE__ */ React__default.createElement(BiMenu, { className: "h-8 w-auto text-gray-600" })
47847
+ );
47848
+ };
47612
47849
  const DEFAULT_FIELDS = [
47613
47850
  TextFieldPlugin,
47614
47851
  TextareaFieldPlugin,
@@ -48038,7 +48275,7 @@ function Alerts2({ alerts }) {
48038
48275
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: "fixed top-0 left-0 p-6 flex flex-col items-center z-[999999]" }, alerts.all.filter((alert) => {
48039
48276
  return alert.level !== "error";
48040
48277
  }).map((alert) => {
48041
- return /* @__PURE__ */ React__default.createElement(Alert, { key: alert.id, level: alert.level }, alert.level === "info" && /* @__PURE__ */ React__default.createElement(MdInfo, { className: "w-5 h-auto opacity-70" }), alert.level === "success" && /* @__PURE__ */ React__default.createElement(MdCheckCircle, { className: "w-5 h-auto opacity-70" }), alert.level === "warn" && /* @__PURE__ */ React__default.createElement(MdWarning, { className: "w-5 h-auto opacity-70" }), /* @__PURE__ */ React__default.createElement("p", { className: "m-0 flex-1 max-w-[680px] text-left" }, parseUrlsInText(alert.message.toString())), /* @__PURE__ */ React__default.createElement(
48278
+ return /* @__PURE__ */ React__default.createElement(Alert, { key: alert.id, level: alert.level }, alert.level === "info" && /* @__PURE__ */ React__default.createElement(MdInfo, { className: "w-5 h-auto text-blue-500" }), alert.level === "success" && /* @__PURE__ */ React__default.createElement(MdCheckCircle, { className: "w-5 h-auto text-green-500" }), alert.level === "warn" && /* @__PURE__ */ React__default.createElement(MdWarning, { className: "w-5 h-auto text-yellow-500" }), /* @__PURE__ */ React__default.createElement("p", { className: "m-0 flex-1 max-w-[680px] text-left" }, parseUrlsInText(alert.message.toString())), /* @__PURE__ */ React__default.createElement(
48042
48279
  CloseAlert,
48043
48280
  {
48044
48281
  onClick: () => {
@@ -48079,21 +48316,21 @@ const Alert = ({
48079
48316
  ...props
48080
48317
  }) => {
48081
48318
  const colorClasses = {
48082
- info: "bg-white border-blue-500 text-blue-600 fill-blue-500",
48083
- success: "bg-white border-green-500 text-green-600 fill-green-500",
48084
- warn: "bg-white border-yellow-500 text-yellow-600 fill-yellow-500",
48085
- error: "bg-white border-red-500 text-red-600 fill-red-500"
48319
+ info: "bg-white",
48320
+ success: "bg-white",
48321
+ warn: "bg-white",
48322
+ error: "bg-white"
48086
48323
  };
48087
48324
  const borderClasses = {
48088
- info: "border-blue-200",
48089
- success: "border-green-200",
48090
- warn: "border-yellow-200",
48091
- error: "border-red-200"
48325
+ info: "border-blue-500",
48326
+ success: "border-green-500",
48327
+ warn: "border-amber-500",
48328
+ error: "border-red-500"
48092
48329
  };
48093
48330
  return /* @__PURE__ */ React__default.createElement(
48094
48331
  "div",
48095
48332
  {
48096
- className: `rounded shadow-lg font-normal cursor-pointer pointer-events-all text-sm transition-all duration-100 ease-out mb-4 max-w-full ${colorClasses[level]}}`,
48333
+ className: `rounded-md shadow-lg font-medium cursor-pointer pointer-events-all text-sm transition-all duration-100 ease-out mb-4 max-w-full text-gray-700 ${colorClasses[level]}`,
48097
48334
  style: {
48098
48335
  animationName: "fly-in-up, fade-in",
48099
48336
  animationTimingFunction: "ease-out",
@@ -48105,7 +48342,7 @@ const Alert = ({
48105
48342
  /* @__PURE__ */ React__default.createElement(
48106
48343
  "div",
48107
48344
  {
48108
- className: `flex items-center gap-1.5 w-[350px] rounded-md border p-2 ${borderClasses[level]}`,
48345
+ className: `flex items-center gap-2 w-[350px] rounded-md border px-4 py-3 ${borderClasses[level]}`,
48109
48346
  ...props
48110
48347
  }
48111
48348
  )
@@ -63987,6 +64224,10 @@ const CreateBranchModal = ({
63987
64224
  cms.alerts.success(
63988
64225
  `Branch created successfully - Pull Request at ${result.pullRequestUrl}`
63989
64226
  );
64227
+ if (crudType === "create") {
64228
+ const folderPath = relativePath2.includes("/") ? relativePath2.substring(0, relativePath2.lastIndexOf("/")) : "";
64229
+ window.location.hash = `#/collections/${collection.name}${folderPath ? `/${folderPath}` : ""}`;
64230
+ }
63990
64231
  close2();
63991
64232
  } catch (e3) {
63992
64233
  console.error(e3);
@@ -67140,6 +67381,23 @@ function LinkFloatingToolbar({
67140
67381
  }) {
67141
67382
  const activeCommentId = usePluginOption({ key: "comment" }, "activeId");
67142
67383
  const activeSuggestionId = usePluginOption({ key: "suggestion" }, "activeId");
67384
+ const { api, editor } = useEditorPlugin(LinkPlugin);
67385
+ const isUrlValidator = usePluginOption(LinkPlugin, "isUrl");
67386
+ const [currentUrl, setCurrentUrl] = React.useState("");
67387
+ const [isValidUrl, setIsValidUrl] = React.useState(true);
67388
+ const handleUrlInput = React.useCallback(
67389
+ (e3) => {
67390
+ const value = e3.currentTarget.value;
67391
+ setCurrentUrl(value);
67392
+ if (value && isUrlValidator) {
67393
+ const valid = isUrlValidator(value);
67394
+ setIsValidUrl(valid);
67395
+ } else {
67396
+ setIsValidUrl(true);
67397
+ }
67398
+ },
67399
+ [isUrlValidator]
67400
+ );
67143
67401
  const floatingOptions = React.useMemo(() => {
67144
67402
  return {
67145
67403
  middleware: [
@@ -67183,22 +67441,70 @@ function LinkFloatingToolbar({
67183
67441
  });
67184
67442
  if (hidden)
67185
67443
  return null;
67186
- const input = /* @__PURE__ */ React.createElement("div", { className: "z-[999999] flex w-[330px] flex-col", ...inputProps }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center pr-1 pl-2 text-muted-foreground" }, /* @__PURE__ */ React.createElement(Link, { className: "size-4" })), /* @__PURE__ */ React.createElement(
67187
- FloatingLinkUrlInput,
67188
- {
67189
- className: inputVariants(),
67190
- placeholder: "Paste link",
67191
- "data-plate-focus": true
67192
- }
67193
- )), /* @__PURE__ */ React.createElement(Separator, { className: "my-1" }), /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center pr-1 pl-2 text-muted-foreground" }, /* @__PURE__ */ React.createElement(Text$2, { className: "size-4" })), /* @__PURE__ */ React.createElement(
67194
- "input",
67444
+ const input = /* @__PURE__ */ React.createElement(
67445
+ "div",
67195
67446
  {
67196
- className: inputVariants(),
67197
- placeholder: "Text to display",
67198
- "data-plate-focus": true,
67199
- ...textInputProps
67200
- }
67201
- )));
67447
+ className: "z-[999999] flex w-[330px] flex-col relative",
67448
+ ...inputProps
67449
+ },
67450
+ !isValidUrl && currentUrl && /* @__PURE__ */ React.createElement("div", { className: "absolute -top-16 left-0 right-0 z-[1000000] mb-2" }, /* @__PURE__ */ React.createElement(
67451
+ "div",
67452
+ {
67453
+ className: "bg-red-50 border border-red-200 rounded-md p-2 shadow-lg",
67454
+ role: "alert",
67455
+ "aria-live": "polite"
67456
+ },
67457
+ /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React.createElement(CircleX, { className: "size-4 text-red-500 mr-2 flex-shrink-0" }), /* @__PURE__ */ React.createElement("span", { className: "text-sm text-red-700 text-wrap" }, "Invalid URL. Please prefix link with https:// or use a relative path like /about")),
67458
+ /* @__PURE__ */ React.createElement("div", { className: "absolute -bottom-1 left-4 w-2 h-2 bg-red-50 border-r border-b border-red-200 transform rotate-45" })
67459
+ )),
67460
+ /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center pr-1 pl-2 text-muted-foreground" }, /* @__PURE__ */ React.createElement(Link, { className: "size-4" })), /* @__PURE__ */ React.createElement(
67461
+ FloatingLinkUrlInput,
67462
+ {
67463
+ className: inputVariants(),
67464
+ placeholder: "Paste link",
67465
+ "data-plate-focus": true,
67466
+ onInput: handleUrlInput
67467
+ }
67468
+ )),
67469
+ /* @__PURE__ */ React.createElement(Separator, { className: "my-1" }),
67470
+ /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center pr-1 pl-2 text-muted-foreground" }, /* @__PURE__ */ React.createElement(Text$2, { className: "size-4" })), /* @__PURE__ */ React.createElement(
67471
+ "input",
67472
+ {
67473
+ className: inputVariants(),
67474
+ placeholder: "Text to display",
67475
+ "data-plate-focus": true,
67476
+ ...textInputProps
67477
+ }
67478
+ )),
67479
+ /* @__PURE__ */ React.createElement(Separator, { className: "my-1" }),
67480
+ /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-end gap-2 px-2 py-1" }, /* @__PURE__ */ React.createElement(
67481
+ "button",
67482
+ {
67483
+ type: "button",
67484
+ className: buttonVariants$2({ size: "sm", variant: "ghost" }),
67485
+ onClick: () => {
67486
+ api.floatingLink.hide();
67487
+ }
67488
+ },
67489
+ "Cancel"
67490
+ ), /* @__PURE__ */ React.createElement(
67491
+ "button",
67492
+ {
67493
+ type: "button",
67494
+ className: buttonVariants$2({
67495
+ size: "sm",
67496
+ variant: "tinaPrimary"
67497
+ }),
67498
+ onClick: () => {
67499
+ if (isValidUrl && currentUrl) {
67500
+ submitFloatingLink(editor);
67501
+ }
67502
+ },
67503
+ disabled: !isValidUrl && !!currentUrl
67504
+ },
67505
+ "OK"
67506
+ ))
67507
+ );
67202
67508
  const editContent = editState.isEditing ? input : /* @__PURE__ */ React.createElement("div", { className: "box-content flex items-center" }, /* @__PURE__ */ React.createElement(
67203
67509
  "button",
67204
67510
  {
@@ -67219,7 +67525,25 @@ function LinkFloatingToolbar({
67219
67525
  },
67220
67526
  /* @__PURE__ */ React.createElement(Unlink, { width: 18 })
67221
67527
  ));
67222
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { ref: insertRef, className: popoverVariants(), ...insertProps }, input), /* @__PURE__ */ React.createElement("div", { ref: editRef, className: popoverVariants(), ...editProps }, editContent));
67528
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
67529
+ "div",
67530
+ {
67531
+ ref: insertRef,
67532
+ className: popoverVariants(),
67533
+ ...insertProps,
67534
+ style: insertProps.style
67535
+ },
67536
+ input
67537
+ ), /* @__PURE__ */ React.createElement(
67538
+ "div",
67539
+ {
67540
+ ref: editRef,
67541
+ className: popoverVariants(),
67542
+ ...editProps,
67543
+ style: editProps.style
67544
+ },
67545
+ editContent
67546
+ ));
67223
67547
  }
67224
67548
  function LinkOpenButton() {
67225
67549
  const editor = useEditorRef();
@@ -120507,8 +120831,7 @@ const Sidebar = ({ cms }) => {
120507
120831
  const collectionsInfo = useGetCollections(cms);
120508
120832
  const screens = cms.plugins.getType("screen").all();
120509
120833
  const cloudConfigs = cms.plugins.getType("cloud-config").all();
120510
- const isOnDashboard = location.pathname === "/";
120511
- const [menuIsOpen, setMenuIsOpen] = React__default.useState(isOnDashboard);
120834
+ location.pathname === "/";
120512
120835
  const isLocalMode = (_b = (_a2 = cms.api) == null ? void 0 : _a2.tina) == null ? void 0 : _b.isLocalMode;
120513
120836
  const activeScreens = screens.filter(
120514
120837
  (screen) => {
@@ -120521,8 +120844,6 @@ const Sidebar = ({ cms }) => {
120521
120844
  {
120522
120845
  isLocalMode,
120523
120846
  showHamburger: false,
120524
- menuIsOpen,
120525
- toggleMenu: () => setMenuIsOpen((menu) => !menu),
120526
120847
  sidebarWidth: 360,
120527
120848
  showCollections: true,
120528
120849
  collectionsInfo,
@@ -120537,7 +120858,7 @@ const Sidebar = ({ cms }) => {
120537
120858
  Icon: view.Icon ? view.Icon : ImFilesEmpty
120538
120859
  }
120539
120860
  ),
120540
- RenderNavCloud: ({ config }) => /* @__PURE__ */ React__default.createElement(SidebarCloudLink, { config }),
120861
+ RenderNavCloud: ({ config }) => /* @__PURE__ */ React__default.createElement(NavCloudLink, { config }),
120541
120862
  RenderNavCollection: ({ collection }) => /* @__PURE__ */ React__default.createElement(
120542
120863
  SidebarLink,
120543
120864
  {
@@ -120574,20 +120895,6 @@ const SidebarLink = (props) => {
120574
120895
  label
120575
120896
  );
120576
120897
  };
120577
- const SidebarCloudLink = ({ config }) => {
120578
- if (config.text) {
120579
- return /* @__PURE__ */ React__default.createElement("span", { className: "text-base tracking-wide text-gray-500 flex items-center opacity-90" }, config.text, " ", /* @__PURE__ */ React__default.createElement(
120580
- "a",
120581
- {
120582
- target: "_blank",
120583
- className: "ml-1 text-blue-600 hover:opacity-60",
120584
- href: config.link.href
120585
- },
120586
- config.link.text
120587
- ));
120588
- }
120589
- return /* @__PURE__ */ React__default.createElement("span", { className: "text-base tracking-wide text-gray-500 hover:text-blue-600 flex items-center opacity-90 hover:opacity-100" }, /* @__PURE__ */ React__default.createElement(config.Icon, { className: "mr-2 h-6 opacity-80 w-auto" }), /* @__PURE__ */ React__default.createElement("a", { target: "_blank", href: config.link.href }, config.link.text));
120590
- };
120591
120898
  const ErrorDialog = (props) => {
120592
120899
  return /* @__PURE__ */ React__default.createElement(
120593
120900
  "div",
@@ -120752,7 +121059,7 @@ const PageWrapper = ({
120752
121059
  headerClassName,
120753
121060
  children
120754
121061
  }) => {
120755
- return /* @__PURE__ */ React__default.createElement("div", { className: "relative left-0 w-full h-full bg-gradient-to-b from-gray-50/50 to-gray-50 overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100" }, /* @__PURE__ */ React__default.createElement("div", { className: `py-2 pr-4 w-full ${headerClassName}` }, /* @__PURE__ */ React__default.createElement(BillingWarning, null), /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ React__default.createElement(TinaIcon, { className: "self-center h-10 min-w-10 w-auto text-orange-500" }), /* @__PURE__ */ React__default.createElement(LocalWarning, null), /* @__PURE__ */ React__default.createElement(BranchButton, null), /* @__PURE__ */ React__default.createElement(BranchPreviewButton, null))), children);
121062
+ return /* @__PURE__ */ React__default.createElement("div", { className: "relative left-0 w-full h-full bg-gradient-to-b from-gray-50/50 to-gray-50 overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100" }, /* @__PURE__ */ React__default.createElement("div", { className: `py-2 w-full ${headerClassName}` }, /* @__PURE__ */ React__default.createElement(BillingWarning, null), /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ React__default.createElement(NavMenuTrigger, { className: "ml-2" }), /* @__PURE__ */ React__default.createElement(TinaIcon, { className: "self-center h-10 min-w-10 w-auto text-orange-500" }), /* @__PURE__ */ React__default.createElement(LocalWarning, null), /* @__PURE__ */ React__default.createElement(BranchButton, null), /* @__PURE__ */ React__default.createElement(BranchPreviewButton, null))), children);
120756
121063
  };
120757
121064
  const PageHeader = ({
120758
121065
  children
@@ -122485,7 +122792,7 @@ const ScreenPage = () => {
122485
122792
  const selectedScreen = screens.find(
122486
122793
  ({ name }) => slugify(name) === screenName
122487
122794
  );
122488
- return /* @__PURE__ */ React__default.createElement("div", { className: "relative w-full h-full flex flex-col items-stretch justify-between" }, /* @__PURE__ */ React__default.createElement("div", { className: "py-2 px-6 w-fit " }, /* @__PURE__ */ React__default.createElement(LocalWarning, null), /* @__PURE__ */ React__default.createElement(BillingWarning, null)), /* @__PURE__ */ React__default.createElement(
122795
+ return /* @__PURE__ */ React__default.createElement("div", { className: "relative w-full h-full flex flex-col items-stretch justify-between" }, /* @__PURE__ */ React__default.createElement("div", { className: "py-2 w-full" }, /* @__PURE__ */ React__default.createElement(BillingWarning, null), /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ React__default.createElement(NavMenuTrigger, { className: "ml-2" }), /* @__PURE__ */ React__default.createElement(TinaIcon, { className: "self-center h-10 min-w-10 w-auto text-orange-500" }), /* @__PURE__ */ React__default.createElement(LocalWarning, null))), /* @__PURE__ */ React__default.createElement(
122489
122796
  "div",
122490
122797
  {
122491
122798
  className: `xl:hidden pl-6 py-5 border-b border-gray-200 bg-white`
@@ -122712,7 +123019,7 @@ const DefaultWrapper = ({
122712
123019
  cms,
122713
123020
  children
122714
123021
  }) => {
122715
- return /* @__PURE__ */ React__default.createElement(Layout, null, /* @__PURE__ */ React__default.createElement("div", { className: "flex items-stretch h-dvh overflow-hidden" }, /* @__PURE__ */ React__default.createElement(Sidebar, { cms }), /* @__PURE__ */ React__default.createElement("div", { className: "w-full relative" }, children)));
123022
+ return /* @__PURE__ */ React__default.createElement(Layout, null, /* @__PURE__ */ React__default.createElement(NavProvider, { defaultOpen: false }, /* @__PURE__ */ React__default.createElement("div", { className: "flex items-stretch h-dvh overflow-hidden" }, /* @__PURE__ */ React__default.createElement(Sidebar, { cms }), /* @__PURE__ */ React__default.createElement("div", { className: "w-full relative" }, children))));
122716
123023
  };
122717
123024
  const PlainLayout = ({ children }) => {
122718
123025
  return /* @__PURE__ */ React__default.createElement(
@@ -123001,6 +123308,9 @@ export {
123001
123308
  ModalProvider,
123002
123309
  NAMER,
123003
123310
  Nav,
123311
+ NavCloudLink,
123312
+ NavMenuTrigger,
123313
+ NavProvider,
123004
123314
  NumberField,
123005
123315
  NumberFieldPlugin,
123006
123316
  NumberInput,
@@ -123094,6 +123404,7 @@ export {
123094
123404
  useFormPortal,
123095
123405
  useLocalStorage,
123096
123406
  useModalContainer,
123407
+ useNav,
123097
123408
  useScreenPlugin,
123098
123409
  useTinaAuthRedirect,
123099
123410
  wrapFieldWithError,