tinacms 2.9.3 → 2.9.4

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.mjs CHANGED
@@ -39,10 +39,10 @@ import arrayMutators from "final-form-arrays";
39
39
  import setFieldData from "final-form-set-field-data";
40
40
  import { Field, Form as Form$1 } from "react-final-form";
41
41
  import PropTypes from "prop-types";
42
- import * as pkg$1 from "react-color";
43
- import * as pkg from "color-string";
44
42
  import { twMerge } from "tailwind-merge";
45
43
  import { Droppable, Draggable, DragDropContext } from "react-beautiful-dnd";
44
+ import * as pkg$1 from "react-color";
45
+ import * as pkg from "color-string";
46
46
  import { buildSchema, print, getIntrospectionQuery, buildClientSchema, parse as parse$4 } from "graphql";
47
47
  import { diff as diff$1 } from "@graphql-inspector/core";
48
48
  import * as dropzone from "react-dropzone";
@@ -57,6 +57,8 @@ import { autoformatSmartQuotes, autoformatPunctuation, autoformatLegal, autoform
57
57
  import get$5 from "lodash.get";
58
58
  import moment from "moment";
59
59
  import { formatDistanceToNow as formatDistanceToNow$1 } from "date-fns";
60
+ import DOMPurify from "dompurify";
61
+ import { toast as toast$1, Toaster as Toaster$1 } from "sonner";
60
62
  import { TinaSchema, addNamespaceToSchema, parseURL, resolveForm, normalizePath, canonicalPath, validateSchema } from "@tinacms/schema-tools";
61
63
  import { NAMER, resolveField } from "@tinacms/schema-tools";
62
64
  import gql from "graphql-tag";
@@ -38335,6 +38337,171 @@ TinaField.propTypes = {
38335
38337
  Component: PropTypes.any.isRequired,
38336
38338
  children: PropTypes.any
38337
38339
  };
38340
+ function cn$1(...inputs) {
38341
+ return twMerge(clsx(inputs));
38342
+ }
38343
+ const Button$1 = ({
38344
+ variant = "secondary",
38345
+ as: Tag2 = "button",
38346
+ size: size2 = "medium",
38347
+ busy,
38348
+ disabled,
38349
+ rounded = "full",
38350
+ children,
38351
+ className = "",
38352
+ ...props
38353
+ }) => {
38354
+ const baseClasses = "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center inline-flex justify-center transition-all duration-150 ease-out ";
38355
+ const variantClasses = {
38356
+ primary: `shadow text-white bg-tina-orange-dark hover:bg-tina-orange focus:ring-tina-orange-dark border-0`,
38357
+ secondary: `shadow text-gray-500 hover:tina-orange-dark bg-gray-50 hover:bg-white border border-gray-100`,
38358
+ white: `shadow text-gray-500 hover:tina-orange-dark bg-white hover:bg-gray-50 border border-gray-100`,
38359
+ ghost: `text-gray-500 hover:tina-orange-dark hover:shadow border border-transparent border-0 hover:border hover:border-gray-200 bg-transparent`,
38360
+ danger: `shadow text-white bg-red-500 hover:bg-red-600 focus:ring-red-500`,
38361
+ accent: `shadow text-white bg-orange-500 hover:bg-orange-600 focus:ring-orange-500`,
38362
+ custom: ""
38363
+ };
38364
+ const state = busy ? `busy` : disabled ? `disabled` : `default`;
38365
+ const stateClasses = {
38366
+ disabled: `pointer-events-none opacity-30 cursor-not-allowed`,
38367
+ busy: `pointer-events-none opacity-70 cursor-wait`,
38368
+ default: ``
38369
+ };
38370
+ const roundedClasses = {
38371
+ full: `rounded`,
38372
+ left: `rounded-l`,
38373
+ right: `rounded-r`,
38374
+ custom: "",
38375
+ none: ""
38376
+ };
38377
+ const sizeClasses = {
38378
+ small: `text-xs h-8 px-3`,
38379
+ medium: `text-sm h-10 px-8`,
38380
+ custom: ``
38381
+ };
38382
+ return /* @__PURE__ */ React.createElement(
38383
+ Tag2,
38384
+ {
38385
+ className: cn$1(
38386
+ baseClasses,
38387
+ variantClasses[variant],
38388
+ sizeClasses[size2],
38389
+ stateClasses[state],
38390
+ roundedClasses[rounded],
38391
+ className
38392
+ ),
38393
+ ...props
38394
+ },
38395
+ children
38396
+ );
38397
+ };
38398
+ const IconButton = ({
38399
+ variant = "secondary",
38400
+ size: size2 = "medium",
38401
+ busy,
38402
+ disabled,
38403
+ children,
38404
+ className,
38405
+ ...props
38406
+ }) => {
38407
+ const baseClasses = "icon-parent inline-flex items-center border border-transparent text-sm font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center inline-flex justify-center transition-all duration-150 ease-out rounded-full";
38408
+ const variantClasses = {
38409
+ primary: `shadow text-white bg-tina-orange-dark hover:bg-tina-orange focus:ring-tina-orange-dark`,
38410
+ secondary: `shadow text-gray-500 hover:text-blue-500 bg-gray-50 hover:bg-white border border-gray-200`,
38411
+ white: `shadow text-gray-500 hover:text-blue-500 bg-white hover:bg-gray-50 border border-gray-200`,
38412
+ ghost: `text-gray-500 hover:text-blue-500 hover:shadow border border-transparent hover:border-gray-200 bg-transparent`,
38413
+ accent: `shadow text-white bg-orange-500 hover:bg-orange-600 focus:ring-orange-500`
38414
+ };
38415
+ const state = busy ? `busy` : disabled ? `disabled` : `default`;
38416
+ const stateClasses = {
38417
+ disabled: `pointer-events-none opacity-30 cursor-not-allowed`,
38418
+ busy: `pointer-events-none opacity-70 cursor-wait`,
38419
+ default: ``
38420
+ };
38421
+ const sizeClasses = {
38422
+ small: `h-7 w-7`,
38423
+ medium: `h-9 w-9`,
38424
+ custom: ``
38425
+ };
38426
+ return /* @__PURE__ */ React.createElement(
38427
+ "button",
38428
+ {
38429
+ className: cn$1(
38430
+ baseClasses,
38431
+ variantClasses[variant],
38432
+ sizeClasses[size2],
38433
+ stateClasses[state],
38434
+ className
38435
+ ),
38436
+ ...props
38437
+ },
38438
+ children
38439
+ );
38440
+ };
38441
+ function FontLoader() {
38442
+ React.useEffect(() => {
38443
+ const link = document.createElement("link");
38444
+ link.href = "https://fonts.googleapis.com/css2?family=Inter:wght@400;600&family=Libre+Baskerville:wght@400;500;600;700&display=swap";
38445
+ link.rel = "stylesheet";
38446
+ document.head.appendChild(link);
38447
+ return () => {
38448
+ document.head.removeChild(link);
38449
+ };
38450
+ }, []);
38451
+ return null;
38452
+ }
38453
+ function classNames(...classes) {
38454
+ return classes.filter(Boolean).join(" ");
38455
+ }
38456
+ const OverflowMenu$1 = ({ toolbarItems: toolbarItems2, className = "w-full" }) => {
38457
+ const [open, setOpen] = useState(false);
38458
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, toolbarItems2.length > 0 && /* @__PURE__ */ React__default.createElement(PopoverPrimitive.Root, { open, onOpenChange: setOpen }, /* @__PURE__ */ React__default.createElement(
38459
+ PopoverPrimitive.Trigger,
38460
+ {
38461
+ className: `cursor-pointer relative justify-center inline-flex items-center p-3 text-sm font-medium focus:outline-1 focus:outline-blue-200 pointer-events-auto ${open ? `text-blue-400` : `text-gray-300 hover:text-blue-500`} ${className}}`
38462
+ },
38463
+ /* @__PURE__ */ React__default.createElement(
38464
+ "svg",
38465
+ {
38466
+ xmlns: "http://www.w3.org/2000/svg",
38467
+ className: "h-5 w-5",
38468
+ fill: "none",
38469
+ viewBox: "0 0 24 24",
38470
+ stroke: "currentColor"
38471
+ },
38472
+ /* @__PURE__ */ React__default.createElement(
38473
+ "path",
38474
+ {
38475
+ strokeLinecap: "round",
38476
+ strokeLinejoin: "round",
38477
+ strokeWidth: 2,
38478
+ d: "M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"
38479
+ }
38480
+ )
38481
+ )
38482
+ ), /* @__PURE__ */ React__default.createElement(PopoverPrimitive.Portal, null, /* @__PURE__ */ React__default.createElement(PopoverPrimitive.Content, { style: { zIndex: 2e4 }, align: "end" }, /* @__PURE__ */ React__default.createElement("div", { className: "mt-0 -mr-1 rounded shadow-lg bg-white ring-1 ring-black ring-opacity-5 py-1" }, toolbarItems2.map((toolbarItem) => {
38483
+ return /* @__PURE__ */ React__default.createElement(
38484
+ "span",
38485
+ {
38486
+ "data-test": `${toolbarItem.name}OverflowButton`,
38487
+ key: toolbarItem.name,
38488
+ onMouseDown: (event) => {
38489
+ event.preventDefault();
38490
+ toolbarItem.onMouseDown(event);
38491
+ setOpen(false);
38492
+ },
38493
+ className: classNames(
38494
+ toolbarItem.active ? "bg-gray-50 text-blue-500" : "bg-white text-gray-600",
38495
+ "hover:bg-gray-50 hover:text-blue-500 cursor-pointer pointer-events-auto px-4 py-2 text-sm w-full flex items-center whitespace-nowrap",
38496
+ toolbarItem.className ?? ""
38497
+ )
38498
+ },
38499
+ /* @__PURE__ */ React__default.createElement("div", { className: "mr-2 opacity-80" }, toolbarItem.Icon),
38500
+ " ",
38501
+ toolbarItem.label
38502
+ );
38503
+ }))))));
38504
+ };
38338
38505
  var DefaultContext = {
38339
38506
  color: void 0,
38340
38507
  size: void 0,
@@ -38576,30 +38743,270 @@ function BiTrash(props) {
38576
38743
  function BiX(props) {
38577
38744
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m16.192 6.344-4.243 4.242-4.242-4.242-1.414 1.414L10.535 12l-4.242 4.242 1.414 1.414 4.242-4.242 4.243 4.242 1.414-1.414L13.364 12l4.242-4.242z" }, "child": [] }] })(props);
38578
38745
  }
38579
- const textFieldClasses = "shadow-inner focus:shadow-outline focus:border-blue-500 focus:outline-none block text-base placeholder:text-gray-300 px-3 py-2 text-gray-600 w-full bg-white border border-gray-200 transition-all ease-out duration-150 focus:text-gray-900 rounded";
38580
- const disabledClasses$1 = "opacity-50 pointer-events-none cursor-not-allowed";
38581
- const BaseTextField = React.forwardRef(({ className, disabled, ...rest }, ref) => {
38746
+ function BsArrowRightShort(props) {
38747
+ return GenIcon({ "tag": "svg", "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M4 8a.5.5 0 0 1 .5-.5h5.793L8.146 5.354a.5.5 0 1 1 .708-.708l3 3a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708-.708L10.293 8.5H4.5A.5.5 0 0 1 4 8" }, "child": [] }] })(props);
38748
+ }
38749
+ function BsCheckCircleFill(props) {
38750
+ return GenIcon({ "tag": "svg", "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z" }, "child": [] }] })(props);
38751
+ }
38752
+ function BsExclamationOctagonFill(props) {
38753
+ return GenIcon({ "tag": "svg", "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M11.46.146A.5.5 0 0 0 11.107 0H4.893a.5.5 0 0 0-.353.146L.146 4.54A.5.5 0 0 0 0 4.893v6.214a.5.5 0 0 0 .146.353l4.394 4.394a.5.5 0 0 0 .353.146h6.214a.5.5 0 0 0 .353-.146l4.394-4.394a.5.5 0 0 0 .146-.353V4.893a.5.5 0 0 0-.146-.353zM8 4c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995A.905.905 0 0 1 8 4m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2" }, "child": [] }] })(props);
38754
+ }
38755
+ const MessageIcon = ({
38756
+ type = "success",
38757
+ className = ""
38758
+ }) => {
38759
+ const icons = {
38760
+ success: BiCheckCircle,
38761
+ warning: BiError,
38762
+ error: BiError,
38763
+ info: BiInfoCircle
38764
+ };
38765
+ const Icon = icons[type];
38766
+ return /* @__PURE__ */ React__default.createElement(Icon, { className });
38767
+ };
38768
+ const Message = ({
38769
+ children,
38770
+ type = "success",
38771
+ size: size2 = "medium",
38772
+ className = "",
38773
+ link,
38774
+ linkLabel = "Learn More"
38775
+ }) => {
38776
+ const containerClasses = {
38777
+ success: "bg-gradient-to-r from-green-50 to-green-100 border-green-200",
38778
+ warning: "bg-gradient-to-r from-yellow-50 to-yellow-100 border-yellow-200",
38779
+ error: "bg-gradient-to-r from-red-50 to-red-100 border-red-200",
38780
+ info: "bg-gradient-to-r from-blue-50 to-blue-100 border-blue-100"
38781
+ };
38782
+ const textClasses = {
38783
+ success: "text-green-700",
38784
+ warning: "text-yellow-700",
38785
+ error: "text-red-700",
38786
+ info: "text-blue-700"
38787
+ };
38788
+ const iconClasses = {
38789
+ success: "text-green-400",
38790
+ warning: "text-yellow-400",
38791
+ error: "text-red-400",
38792
+ info: "text-blue-400"
38793
+ };
38794
+ const sizeClasses = {
38795
+ small: "px-3 py-1.5 text-xs",
38796
+ medium: "px-4 py-2.5 text-sm"
38797
+ };
38798
+ return /* @__PURE__ */ React__default.createElement(
38799
+ "div",
38800
+ {
38801
+ className: `rounded-lg border shadow-sm ${sizeClasses[size2]} ${containerClasses[type]} ${className}`
38802
+ },
38803
+ /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col sm:flex-row items-start sm:items-center gap-2" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React__default.createElement(
38804
+ MessageIcon,
38805
+ {
38806
+ type,
38807
+ className: `${size2 === "small" ? "w-5" : "w-6"} h-auto flex-shrink-0 ${iconClasses[type]}`
38808
+ }
38809
+ ), /* @__PURE__ */ React__default.createElement("div", { className: `flex-1 ${textClasses[type]}` }, children)), link && /* @__PURE__ */ React__default.createElement(
38810
+ "a",
38811
+ {
38812
+ href: link,
38813
+ target: "_blank",
38814
+ className: "flex-shrink-0 flex items-center gap-1 text-blue-600 underline decoration-blue-200 hover:text-blue-500 hover:decoration-blue-500 transition-all ease-out duration-150"
38815
+ },
38816
+ linkLabel,
38817
+ " ",
38818
+ /* @__PURE__ */ React__default.createElement(BsArrowRightShort, { className: "w-4 h-auto" })
38819
+ ))
38820
+ );
38821
+ };
38822
+ function cn(...inputs) {
38823
+ return twMerge(clsx(inputs));
38824
+ }
38825
+ function DropdownMenu({
38826
+ ...props
38827
+ }) {
38828
+ return /* @__PURE__ */ React.createElement(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
38829
+ }
38830
+ function DropdownMenuTrigger({
38831
+ ...props
38832
+ }) {
38582
38833
  return /* @__PURE__ */ React.createElement(
38583
- "input",
38834
+ DropdownMenuPrimitive.Trigger,
38584
38835
  {
38585
- ref,
38586
- type: "text",
38587
- className: `${textFieldClasses} ${disabled ? disabledClasses$1 : ""} ${className}`,
38588
- ...rest
38836
+ "data-slot": "dropdown-menu-trigger",
38837
+ ...props
38589
38838
  }
38590
38839
  );
38591
- });
38592
- const TextArea = React.forwardRef(({ ...props }, ref) => {
38840
+ }
38841
+ function DropdownMenuContent({
38842
+ className,
38843
+ sideOffset = 4,
38844
+ ...props
38845
+ }) {
38846
+ return /* @__PURE__ */ React.createElement(DropdownMenuPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
38847
+ DropdownMenuPrimitive.Content,
38848
+ {
38849
+ "data-slot": "dropdown-menu-content",
38850
+ sideOffset,
38851
+ className: cn(
38852
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-base max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
38853
+ className
38854
+ ),
38855
+ ...props
38856
+ }
38857
+ ));
38858
+ }
38859
+ function DropdownMenuItem({
38860
+ className,
38861
+ inset,
38862
+ variant = "default",
38863
+ ...props
38864
+ }) {
38593
38865
  return /* @__PURE__ */ React.createElement(
38594
- "textarea",
38866
+ DropdownMenuPrimitive.Item,
38595
38867
  {
38596
- ...props,
38597
- className: "shadow-inner text-base px-3 py-2 text-gray-600 resize-y focus:shadow-outline focus:border-blue-500 block w-full border border-gray-200 focus:text-gray-900 rounded",
38598
- ref,
38599
- style: { minHeight: "160px" }
38868
+ "data-slot": "dropdown-menu-item",
38869
+ "data-inset": inset,
38870
+ "data-variant": variant,
38871
+ className: cn(
38872
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 cursor-pointer text-gray-700 hover:text-blue-500",
38873
+ className
38874
+ ),
38875
+ ...props
38600
38876
  }
38601
38877
  );
38602
- });
38878
+ }
38879
+ function DropdownMenuSeparator({
38880
+ className,
38881
+ ...props
38882
+ }) {
38883
+ return /* @__PURE__ */ React.createElement(
38884
+ DropdownMenuPrimitive.Separator,
38885
+ {
38886
+ "data-slot": "dropdown-menu-separator",
38887
+ className: cn("bg-border -mx-1 my-1 h-px", className),
38888
+ ...props
38889
+ }
38890
+ );
38891
+ }
38892
+ const DropdownButton = React.forwardRef(
38893
+ ({
38894
+ variant = "primary",
38895
+ size: size2 = "medium",
38896
+ busy,
38897
+ disabled,
38898
+ rounded = "full",
38899
+ children,
38900
+ className = "",
38901
+ onMainAction,
38902
+ items: items2,
38903
+ showSplitButton = true,
38904
+ ...props
38905
+ }, ref) => {
38906
+ const [open, setOpen] = React.useState(false);
38907
+ if (!onMainAction || !showSplitButton) {
38908
+ return /* @__PURE__ */ React.createElement(DropdownMenu, { open, onOpenChange: setOpen, modal: false }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
38909
+ Button$1,
38910
+ {
38911
+ variant,
38912
+ size: size2,
38913
+ busy,
38914
+ disabled,
38915
+ rounded,
38916
+ className: cn$1("gap-2", className),
38917
+ ...props
38918
+ },
38919
+ children,
38920
+ /* @__PURE__ */ React.createElement(
38921
+ ChevronDownIcon$1,
38922
+ {
38923
+ className: cn$1(
38924
+ "h-4 w-4 transition-transform duration-200",
38925
+ open && "rotate-180"
38926
+ )
38927
+ }
38928
+ )
38929
+ )), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "end", side: "bottom", className: "z-[100000]" }, items2.map((item, index) => /* @__PURE__ */ React.createElement(
38930
+ DropdownMenuItem,
38931
+ {
38932
+ key: index,
38933
+ onClick: item.onClick,
38934
+ disabled: item.disabled,
38935
+ variant: item.variant
38936
+ },
38937
+ item.icon && item.icon,
38938
+ item.label
38939
+ ))));
38940
+ }
38941
+ return /* @__PURE__ */ React.createElement("div", { className: cn$1("inline-flex", className) }, /* @__PURE__ */ React.createElement(
38942
+ Button$1,
38943
+ {
38944
+ variant,
38945
+ size: size2,
38946
+ busy,
38947
+ disabled,
38948
+ rounded: "left",
38949
+ onClick: onMainAction,
38950
+ className: "border-r-0 w-full",
38951
+ ...props
38952
+ },
38953
+ children
38954
+ ), /* @__PURE__ */ React.createElement(DropdownMenu, { open, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, null, /* @__PURE__ */ React.createElement(
38955
+ Button$1,
38956
+ {
38957
+ variant,
38958
+ size: size2,
38959
+ busy,
38960
+ disabled,
38961
+ rounded: "right",
38962
+ className: "px-4 border-l",
38963
+ style: { borderColor: "#00000030" },
38964
+ "aria-label": "More options"
38965
+ },
38966
+ /* @__PURE__ */ React.createElement(
38967
+ ChevronDownIcon$1,
38968
+ {
38969
+ className: cn$1(
38970
+ "h-4 w-4 transition-transform duration-200 fill-none",
38971
+ open && "rotate-180"
38972
+ ),
38973
+ style: { fill: "none" }
38974
+ }
38975
+ )
38976
+ )), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "end", side: "bottom" }, items2.map((item, index) => {
38977
+ var _a2;
38978
+ return /* @__PURE__ */ React.createElement(React.Fragment, { key: index }, /* @__PURE__ */ React.createElement(
38979
+ DropdownMenuItem,
38980
+ {
38981
+ onClick: item.onClick,
38982
+ disabled: item.disabled,
38983
+ variant: item.variant
38984
+ },
38985
+ item.icon && item.icon,
38986
+ item.label
38987
+ ), item.variant === "destructive" && index < items2.length - 1 && ((_a2 = items2[index + 1]) == null ? void 0 : _a2.variant) !== "destructive" && /* @__PURE__ */ React.createElement(DropdownMenuSeparator, null));
38988
+ }))));
38989
+ }
38990
+ );
38991
+ DropdownButton.displayName = "DropdownButton";
38992
+ function FaCircle(props) {
38993
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z" }, "child": [] }] })(props);
38994
+ }
38995
+ function FaFile(props) {
38996
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 384 512" }, "child": [{ "tag": "path", "attr": { "d": "M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm160-14.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z" }, "child": [] }] })(props);
38997
+ }
38998
+ function FaFolder(props) {
38999
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M464 128H272l-64-64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V176c0-26.51-21.49-48-48-48z" }, "child": [] }] })(props);
39000
+ }
39001
+ function FaLock(props) {
39002
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z" }, "child": [] }] })(props);
39003
+ }
39004
+ function FaSpinner(props) {
39005
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z" }, "child": [] }] })(props);
39006
+ }
39007
+ function FaUnlock(props) {
39008
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M400 256H152V152.9c0-39.6 31.7-72.5 71.3-72.9 40-.4 72.7 32.1 72.7 72v16c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24v-16C376 68 307.5-.3 223.5 0 139.5.3 72 69.5 72 153.5V256H48c-26.5 0-48 21.5-48 48v160c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48z" }, "child": [] }] })(props);
39009
+ }
38603
39010
  const Dismissible = ({
38604
39011
  onDismiss,
38605
39012
  escape: escape2,
@@ -38672,6 +39079,159 @@ function useDismissible({
38672
39079
  }, [click, customDocument, escape2, disabled, onDismiss]);
38673
39080
  return area;
38674
39081
  }
39082
+ const FormActionMenu = ({ actions, form }) => {
39083
+ const [actionMenuVisibility, setActionMenuVisibility] = useState(false);
39084
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(MoreActionsButton, { onClick: () => setActionMenuVisibility((p2) => !p2) }), /* @__PURE__ */ React.createElement(ActionsOverlay, { open: actionMenuVisibility }, /* @__PURE__ */ React.createElement(
39085
+ Dismissible,
39086
+ {
39087
+ click: true,
39088
+ escape: true,
39089
+ disabled: !actionMenuVisibility,
39090
+ onDismiss: () => {
39091
+ setActionMenuVisibility((p2) => !p2);
39092
+ }
39093
+ },
39094
+ actions.map((Action, i2) => (
39095
+ // TODO: `i` will suppress warnings but this indicates that maybe
39096
+ // Actions should just be componets
39097
+ /* @__PURE__ */ React.createElement(Action, { form, key: i2 })
39098
+ ))
39099
+ )));
39100
+ };
39101
+ const MoreActionsButton = ({ className = "", ...props }) => /* @__PURE__ */ React.createElement(
39102
+ "button",
39103
+ {
39104
+ className: `h-16 w-10 self-stretch bg-transparent bg-center bg-[length:auto_18px] -mr-4 ml-2 outline-none cursor-pointer transition-opacity duration-100 ease-out flex justify-center items-center hover:bg-gray-50 hover:fill-gray-700 ${className}`,
39105
+ ...props
39106
+ },
39107
+ /* @__PURE__ */ React.createElement(EllipsisVerticalIcon, null)
39108
+ );
39109
+ const ActionsOverlay = ({ open, className = "", style = {}, ...props }) => /* @__PURE__ */ React.createElement(
39110
+ "div",
39111
+ {
39112
+ className: `min-w-[192px] rounded-3xl border border-solid border-[#efefef] block absolute bottom-5 right-5 ${open ? "opacity-100" : "opacity-0"} transition-all duration-100 ease-out origin-bottom-right shadow-[0_2px_3px_rgba(0,0,0,0.05)] bg-white overflow-hidden z-10 ${className}`,
39113
+ style: {
39114
+ transform: open ? "translate3d(0, -28px, 0) scale3d(1, 1, 1)" : "translate3d(0, 0, 0) scale3d(0.5, 0.5, 1)",
39115
+ pointerEvents: open ? "all" : "none",
39116
+ ...style
39117
+ },
39118
+ ...props
39119
+ }
39120
+ );
39121
+ const ActionButton = ({ className = "", ...props }) => /* @__PURE__ */ React.createElement(
39122
+ "button",
39123
+ {
39124
+ className: `relative text-center text-[13px] px-3 h-10 font-normal w-full bg-none cursor-pointer outline-none border-0 transition-all duration-[150ms] ease-out hover:text-blue-500 hover:bg-gray50 [&:not(:last-child)]: border-b-[1px] border-solid border-b-[#edecf3] ${className}`,
39125
+ ...props
39126
+ }
39127
+ );
39128
+ const FormPortalContext = React.createContext(() => {
39129
+ return null;
39130
+ });
39131
+ function useFormPortal() {
39132
+ return React.useContext(FormPortalContext);
39133
+ }
39134
+ const FormPortalProvider = ({
39135
+ children
39136
+ }) => {
39137
+ const wrapperRef = React.useRef(null);
39138
+ const zIndexRef = React.useRef(0);
39139
+ const FormPortal = React.useCallback(
39140
+ (props) => {
39141
+ if (!wrapperRef.current)
39142
+ return null;
39143
+ return createPortal(
39144
+ props.children({ zIndexShift: zIndexRef.current += 1 }),
39145
+ wrapperRef.current
39146
+ );
39147
+ },
39148
+ [wrapperRef, zIndexRef]
39149
+ );
39150
+ return /* @__PURE__ */ React.createElement(FormPortalContext.Provider, { value: FormPortal }, /* @__PURE__ */ React.createElement("div", { ref: wrapperRef, className: "relative w-full flex-1 overflow-hidden" }, children));
39151
+ };
39152
+ const LoadingDots = ({
39153
+ dotSize = 8,
39154
+ color = "white"
39155
+ }) => {
39156
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(SingleDot, { dotSize, color }), /* @__PURE__ */ React.createElement(SingleDot, { dotSize, color, delay: 0.3 }), /* @__PURE__ */ React.createElement(SingleDot, { dotSize, color, delay: 0.5 }));
39157
+ };
39158
+ const SingleDot = ({ delay = 0, color, dotSize }) => /* @__PURE__ */ React.createElement(
39159
+ "span",
39160
+ {
39161
+ className: "inline-block mr-1",
39162
+ style: {
39163
+ animation: "loading-dots-scale-up-and-down 2s linear infinite",
39164
+ animationDelay: `${delay}s`,
39165
+ background: color,
39166
+ width: dotSize,
39167
+ height: dotSize,
39168
+ borderRadius: dotSize
39169
+ }
39170
+ }
39171
+ );
39172
+ const ResetForm = ({
39173
+ pristine,
39174
+ reset: reset2,
39175
+ children,
39176
+ ...props
39177
+ }) => {
39178
+ const [open, setOpen] = React.useState(false);
39179
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
39180
+ Button$1,
39181
+ {
39182
+ onClick: () => {
39183
+ setOpen((p2) => !p2);
39184
+ },
39185
+ disabled: pristine,
39186
+ ...props
39187
+ },
39188
+ children
39189
+ ), open && /* @__PURE__ */ React.createElement(ResetModal, { reset: reset2, close: () => setOpen(false) }));
39190
+ };
39191
+ const ResetModal = ({ close: close2, reset: reset2 }) => {
39192
+ return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(ModalPopup, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "Reset"), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", null, "Are you sure you want to reset all changes?")), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
39193
+ Button$1,
39194
+ {
39195
+ style: { flexGrow: 3 },
39196
+ variant: "primary",
39197
+ onClick: async () => {
39198
+ await reset2();
39199
+ close2();
39200
+ }
39201
+ },
39202
+ "Reset"
39203
+ ))));
39204
+ };
39205
+ function AiFillWarning(props) {
39206
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zM480 416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416zm32 352a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z" }, "child": [] }] })(props);
39207
+ }
39208
+ function AiOutlineLoading(props) {
39209
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 0 0-94.3-139.9 437.71 437.71 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" }, "child": [] }] })(props);
39210
+ }
39211
+ const textFieldClasses = "shadow-inner focus:shadow-outline focus:border-blue-500 focus:outline-none block text-base placeholder:text-gray-300 px-3 py-2 text-gray-600 w-full bg-white border border-gray-200 transition-all ease-out duration-150 focus:text-gray-900 rounded";
39212
+ const disabledClasses$1 = "opacity-50 pointer-events-none cursor-not-allowed";
39213
+ const BaseTextField = React.forwardRef(({ className, disabled, ...rest }, ref) => {
39214
+ return /* @__PURE__ */ React.createElement(
39215
+ "input",
39216
+ {
39217
+ ref,
39218
+ type: "text",
39219
+ className: `${textFieldClasses} ${disabled ? disabledClasses$1 : ""} ${className}`,
39220
+ ...rest
39221
+ }
39222
+ );
39223
+ });
39224
+ const TextArea = React.forwardRef(({ ...props }, ref) => {
39225
+ return /* @__PURE__ */ React.createElement(
39226
+ "textarea",
39227
+ {
39228
+ ...props,
39229
+ className: "shadow-inner text-base px-3 py-2 text-gray-600 resize-y focus:shadow-outline focus:border-blue-500 block w-full border border-gray-200 focus:text-gray-900 rounded",
39230
+ ref,
39231
+ style: { minHeight: "160px" }
39232
+ }
39233
+ );
39234
+ });
38675
39235
  const { get: getColor, to: toColor } = pkg;
38676
39236
  var ColorFormat = /* @__PURE__ */ ((ColorFormat2) => {
38677
39237
  ColorFormat2["Hex"] = "hex";
@@ -39214,533 +39774,122 @@ const NumberInput = ({
39214
39774
  }
39215
39775
  }
39216
39776
  );
39217
- function cn$1(...inputs) {
39218
- return twMerge(clsx(inputs));
39777
+ function useCMS() {
39778
+ return useCMS$1();
39219
39779
  }
39220
- const Button$1 = ({
39221
- variant = "secondary",
39222
- as: Tag2 = "button",
39223
- size: size2 = "medium",
39224
- busy,
39225
- disabled,
39226
- rounded = "full",
39227
- children,
39228
- className = "",
39229
- ...props
39230
- }) => {
39231
- const baseClasses = "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center inline-flex justify-center transition-all duration-150 ease-out ";
39232
- const variantClasses = {
39233
- primary: `shadow text-white bg-tina-orange-dark hover:bg-tina-orange focus:ring-tina-orange-dark border-0`,
39234
- secondary: `shadow text-gray-500 hover:tina-orange-dark bg-gray-50 hover:bg-white border border-gray-100`,
39235
- white: `shadow text-gray-500 hover:tina-orange-dark bg-white hover:bg-gray-50 border border-gray-100`,
39236
- ghost: `text-gray-500 hover:tina-orange-dark hover:shadow border border-transparent border-0 hover:border hover:border-gray-200 bg-transparent`,
39237
- danger: `shadow text-white bg-red-500 hover:bg-red-600 focus:ring-red-500`,
39238
- accent: `shadow text-white bg-orange-500 hover:bg-orange-600 focus:ring-orange-500`,
39239
- custom: ""
39240
- };
39241
- const state = busy ? `busy` : disabled ? `disabled` : `default`;
39242
- const stateClasses = {
39243
- disabled: `pointer-events-none opacity-30 cursor-not-allowed`,
39244
- busy: `pointer-events-none opacity-70 cursor-wait`,
39245
- default: ``
39246
- };
39247
- const roundedClasses = {
39248
- full: `rounded`,
39249
- left: `rounded-l`,
39250
- right: `rounded-r`,
39251
- custom: "",
39252
- none: ""
39253
- };
39254
- const sizeClasses = {
39255
- small: `text-xs h-8 px-3`,
39256
- medium: `text-sm h-10 px-8`,
39257
- custom: ``
39258
- };
39259
- return /* @__PURE__ */ React.createElement(
39260
- Tag2,
39261
- {
39262
- className: cn$1(
39263
- baseClasses,
39264
- variantClasses[variant],
39265
- sizeClasses[size2],
39266
- stateClasses[state],
39267
- roundedClasses[rounded],
39268
- className
39269
- ),
39270
- ...props
39271
- },
39272
- children
39780
+ const supportedFileTypes = [
39781
+ "text/*",
39782
+ "application/pdf",
39783
+ "application/octet-stream",
39784
+ "application/json",
39785
+ "application/ld+json",
39786
+ "application/vnd.ms-excel",
39787
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
39788
+ "application/msword",
39789
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
39790
+ "application/postscript",
39791
+ "model/fbx",
39792
+ "model/gltf+json",
39793
+ "model/ply",
39794
+ "model/u3d+mesh",
39795
+ "model/vnd.usdz+zip",
39796
+ "application/x-indesign",
39797
+ "application/vnd.apple.mpegurl",
39798
+ "application/dash+xml",
39799
+ "application/mxf",
39800
+ "image/*",
39801
+ "video/*"
39802
+ ];
39803
+ const DEFAULT_MEDIA_UPLOAD_TYPES = supportedFileTypes.join(",");
39804
+ const dropzoneAcceptFromString = (str) => {
39805
+ return Object.assign(
39806
+ {},
39807
+ ...(str || DEFAULT_MEDIA_UPLOAD_TYPES).split(",").map((x) => ({ [x]: [] }))
39273
39808
  );
39274
39809
  };
39275
- const IconButton = ({
39276
- variant = "secondary",
39277
- size: size2 = "medium",
39278
- busy,
39279
- disabled,
39280
- children,
39281
- className,
39282
- ...props
39283
- }) => {
39284
- const baseClasses = "icon-parent inline-flex items-center border border-transparent text-sm font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center inline-flex justify-center transition-all duration-150 ease-out rounded-full";
39285
- const variantClasses = {
39286
- primary: `shadow text-white bg-tina-orange-dark hover:bg-tina-orange focus:ring-tina-orange-dark`,
39287
- secondary: `shadow text-gray-500 hover:text-blue-500 bg-gray-50 hover:bg-white border border-gray-200`,
39288
- white: `shadow text-gray-500 hover:text-blue-500 bg-white hover:bg-gray-50 border border-gray-200`,
39289
- ghost: `text-gray-500 hover:text-blue-500 hover:shadow border border-transparent hover:border-gray-200 bg-transparent`,
39290
- accent: `shadow text-white bg-orange-500 hover:bg-orange-600 focus:ring-orange-500`
39291
- };
39292
- const state = busy ? `busy` : disabled ? `disabled` : `default`;
39293
- const stateClasses = {
39294
- disabled: `pointer-events-none opacity-30 cursor-not-allowed`,
39295
- busy: `pointer-events-none opacity-70 cursor-wait`,
39296
- default: ``
39297
- };
39298
- const sizeClasses = {
39299
- small: `h-7 w-7`,
39300
- medium: `h-9 w-9`,
39301
- custom: ``
39302
- };
39810
+ const isImage = (filename) => {
39811
+ return /\.(gif|jpg|jpeg|tiff|png|svg|webp|avif)(\?.*)?$/i.test(filename);
39812
+ };
39813
+ const isVideo = (filename) => {
39814
+ return /\.(mp4|webm|ogg|m4v|mov|avi|flv|mkv)(\?.*)?$/i.test(filename);
39815
+ };
39816
+ const absoluteImgURL = (str) => {
39817
+ if (str.startsWith("http"))
39818
+ return str;
39819
+ return `${window.location.origin}${str}`;
39820
+ };
39821
+ const { useDropzone: useDropzone$1 } = dropzone;
39822
+ const StyledImage = ({ src }) => {
39823
+ const isSvg = /\.svg$/.test(src);
39303
39824
  return /* @__PURE__ */ React.createElement(
39304
- "button",
39825
+ "img",
39305
39826
  {
39306
- className: cn$1(
39307
- baseClasses,
39308
- variantClasses[variant],
39309
- sizeClasses[size2],
39310
- stateClasses[state],
39311
- className
39312
- ),
39313
- ...props
39314
- },
39315
- children
39827
+ src,
39828
+ className: `block max-w-full rounded shadow overflow-hidden max-h-48 lg:max-h-64 h-auto object-contain transition-opacity duration-100 ease-out m-0 bg-gray-200 bg-auto bg-center bg-no-repeat ${isSvg ? "min-w-[12rem]" : ""}`
39829
+ }
39316
39830
  );
39317
39831
  };
39318
- function FontLoader() {
39319
- React.useEffect(() => {
39320
- const link = document.createElement("link");
39321
- link.href = "https://fonts.googleapis.com/css2?family=Inter:wght@400;600&family=Libre+Baskerville:wght@400;500;600;700&display=swap";
39322
- link.rel = "stylesheet";
39323
- document.head.appendChild(link);
39324
- return () => {
39325
- document.head.removeChild(link);
39326
- };
39327
- }, []);
39328
- return null;
39329
- }
39330
- function classNames(...classes) {
39331
- return classes.filter(Boolean).join(" ");
39332
- }
39333
- const OverflowMenu$1 = ({ toolbarItems: toolbarItems2, className = "w-full" }) => {
39334
- const [open, setOpen] = useState(false);
39335
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, toolbarItems2.length > 0 && /* @__PURE__ */ React__default.createElement(PopoverPrimitive.Root, { open, onOpenChange: setOpen }, /* @__PURE__ */ React__default.createElement(
39336
- PopoverPrimitive.Trigger,
39832
+ const StyledFile = ({ src }) => {
39833
+ return /* @__PURE__ */ React.createElement("div", { className: "max-w-full w-full flex-1 flex justify-start items-center gap-3" }, /* @__PURE__ */ React.createElement("div", { className: "w-12 h-12 bg-white shadow border border-gray-100 rounded flex justify-center flex-none" }, /* @__PURE__ */ React.createElement(BiFileBlank, { className: "w-3/5 h-full fill-gray-300" })), /* @__PURE__ */ React.createElement("span", { className: "text-base text-left flex-1 text-gray-500 w-full break-words truncate" }, src));
39834
+ };
39835
+ const ImageUpload = React.forwardRef(({ onDrop, onClear, onClick, value, src, loading }, ref) => {
39836
+ const cms = useCMS();
39837
+ const { getRootProps, getInputProps } = useDropzone$1({
39838
+ accept: dropzoneAcceptFromString(
39839
+ cms.media.accept || DEFAULT_MEDIA_UPLOAD_TYPES
39840
+ ),
39841
+ onDrop,
39842
+ noClick: !!onClick
39843
+ });
39844
+ return /* @__PURE__ */ React.createElement("div", { className: "w-full max-w-full", ...getRootProps() }, /* @__PURE__ */ React.createElement("input", { ...getInputProps() }), value ? loading ? /* @__PURE__ */ React.createElement(ImageLoadingIndicator, null) : /* @__PURE__ */ React.createElement(
39845
+ "div",
39337
39846
  {
39338
- className: `cursor-pointer relative justify-center inline-flex items-center p-3 text-sm font-medium focus:outline-1 focus:outline-blue-200 pointer-events-auto ${open ? `text-blue-400` : `text-gray-300 hover:text-blue-500`} ${className}}`
39847
+ className: `relative w-full max-w-full flex justify-start ${isImage(src) ? `items-start gap-3` : `items-center gap-2`}`
39339
39848
  },
39340
- /* @__PURE__ */ React__default.createElement(
39341
- "svg",
39849
+ /* @__PURE__ */ React.createElement(
39850
+ "button",
39342
39851
  {
39343
- xmlns: "http://www.w3.org/2000/svg",
39344
- className: "h-5 w-5",
39345
- fill: "none",
39346
- viewBox: "0 0 24 24",
39347
- stroke: "currentColor"
39852
+ className: "flex-shrink min-w-0 focus-within:shadow-outline focus-within:border-blue-500 rounded outline-none overflow-visible cursor-pointer border-none hover:opacity-60 transition ease-out duration-100",
39853
+ onClick,
39854
+ ref
39348
39855
  },
39349
- /* @__PURE__ */ React__default.createElement(
39350
- "path",
39351
- {
39352
- strokeLinecap: "round",
39353
- strokeLinejoin: "round",
39354
- strokeWidth: 2,
39355
- d: "M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"
39856
+ isImage(src) ? /* @__PURE__ */ React.createElement(StyledImage, { src }) : /* @__PURE__ */ React.createElement(StyledFile, { src })
39857
+ ),
39858
+ onClear && /* @__PURE__ */ React.createElement(
39859
+ DeleteImageButton,
39860
+ {
39861
+ onClick: (e3) => {
39862
+ e3.stopPropagation();
39863
+ onClear();
39356
39864
  }
39357
- )
39865
+ }
39358
39866
  )
39359
- ), /* @__PURE__ */ React__default.createElement(PopoverPrimitive.Portal, null, /* @__PURE__ */ React__default.createElement(PopoverPrimitive.Content, { style: { zIndex: 2e4 }, align: "end" }, /* @__PURE__ */ React__default.createElement("div", { className: "mt-0 -mr-1 rounded shadow-lg bg-white ring-1 ring-black ring-opacity-5 py-1" }, toolbarItems2.map((toolbarItem) => {
39360
- return /* @__PURE__ */ React__default.createElement(
39361
- "span",
39362
- {
39363
- "data-test": `${toolbarItem.name}OverflowButton`,
39364
- key: toolbarItem.name,
39365
- onMouseDown: (event) => {
39366
- event.preventDefault();
39367
- toolbarItem.onMouseDown(event);
39368
- setOpen(false);
39369
- },
39370
- className: classNames(
39371
- toolbarItem.active ? "bg-gray-50 text-blue-500" : "bg-white text-gray-600",
39372
- "hover:bg-gray-50 hover:text-blue-500 cursor-pointer pointer-events-auto px-4 py-2 text-sm w-full flex items-center whitespace-nowrap",
39373
- toolbarItem.className ?? ""
39374
- )
39375
- },
39376
- /* @__PURE__ */ React__default.createElement("div", { className: "mr-2 opacity-80" }, toolbarItem.Icon),
39377
- " ",
39378
- toolbarItem.label
39379
- );
39380
- }))))));
39381
- };
39382
- function BsArrowRightShort(props) {
39383
- return GenIcon({ "tag": "svg", "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M4 8a.5.5 0 0 1 .5-.5h5.793L8.146 5.354a.5.5 0 1 1 .708-.708l3 3a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708-.708L10.293 8.5H4.5A.5.5 0 0 1 4 8" }, "child": [] }] })(props);
39384
- }
39385
- function BsCheckCircleFill(props) {
39386
- return GenIcon({ "tag": "svg", "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z" }, "child": [] }] })(props);
39387
- }
39388
- function BsExclamationOctagonFill(props) {
39389
- return GenIcon({ "tag": "svg", "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M11.46.146A.5.5 0 0 0 11.107 0H4.893a.5.5 0 0 0-.353.146L.146 4.54A.5.5 0 0 0 0 4.893v6.214a.5.5 0 0 0 .146.353l4.394 4.394a.5.5 0 0 0 .353.146h6.214a.5.5 0 0 0 .353-.146l4.394-4.394a.5.5 0 0 0 .146-.353V4.893a.5.5 0 0 0-.146-.353zM8 4c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995A.905.905 0 0 1 8 4m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2" }, "child": [] }] })(props);
39390
- }
39391
- const MessageIcon = ({
39392
- type = "success",
39393
- className = ""
39394
- }) => {
39395
- const icons = {
39396
- success: BiCheckCircle,
39397
- warning: BiError,
39398
- error: BiError,
39399
- info: BiInfoCircle
39400
- };
39401
- const Icon = icons[type];
39402
- return /* @__PURE__ */ React__default.createElement(Icon, { className });
39403
- };
39404
- const Message = ({
39405
- children,
39406
- type = "success",
39407
- size: size2 = "medium",
39408
- className = "",
39409
- link,
39410
- linkLabel = "Learn More"
39411
- }) => {
39412
- const containerClasses = {
39413
- success: "bg-gradient-to-r from-green-50 to-green-100 border-green-200",
39414
- warning: "bg-gradient-to-r from-yellow-50 to-yellow-100 border-yellow-200",
39415
- error: "bg-gradient-to-r from-red-50 to-red-100 border-red-200",
39416
- info: "bg-gradient-to-r from-blue-50 to-blue-100 border-blue-100"
39417
- };
39418
- const textClasses = {
39419
- success: "text-green-700",
39420
- warning: "text-yellow-700",
39421
- error: "text-red-700",
39422
- info: "text-blue-700"
39423
- };
39424
- const iconClasses = {
39425
- success: "text-green-400",
39426
- warning: "text-yellow-400",
39427
- error: "text-red-400",
39428
- info: "text-blue-400"
39429
- };
39430
- const sizeClasses = {
39431
- small: "px-3 py-1.5 text-xs",
39432
- medium: "px-4 py-2.5 text-sm"
39433
- };
39434
- return /* @__PURE__ */ React__default.createElement(
39435
- "div",
39867
+ ) : /* @__PURE__ */ React.createElement(
39868
+ "button",
39436
39869
  {
39437
- className: `rounded-lg border shadow-sm ${sizeClasses[size2]} ${containerClasses[type]} ${className}`
39870
+ className: "outline-none relative hover:opacity-60 w-full",
39871
+ onClick
39438
39872
  },
39439
- /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col sm:flex-row items-start sm:items-center gap-2" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React__default.createElement(
39440
- MessageIcon,
39441
- {
39442
- type,
39443
- className: `${size2 === "small" ? "w-5" : "w-6"} h-auto flex-shrink-0 ${iconClasses[type]}`
39444
- }
39445
- ), /* @__PURE__ */ React__default.createElement("div", { className: `flex-1 ${textClasses[type]}` }, children)), link && /* @__PURE__ */ React__default.createElement(
39446
- "a",
39447
- {
39448
- href: link,
39449
- target: "_blank",
39450
- className: "flex-shrink-0 flex items-center gap-1 text-blue-600 underline decoration-blue-200 hover:text-blue-500 hover:decoration-blue-500 transition-all ease-out duration-150"
39451
- },
39452
- linkLabel,
39453
- " ",
39454
- /* @__PURE__ */ React__default.createElement(BsArrowRightShort, { className: "w-4 h-auto" })
39455
- ))
39456
- );
39873
+ loading ? /* @__PURE__ */ React.createElement(ImageLoadingIndicator, null) : /* @__PURE__ */ React.createElement("div", { className: "text-center rounded-[5px] bg-gray-100 text-gray-300 leading-[1.35] py-3 text-[15px] font-normal transition-all ease-out duration-100 hover:opacity-60" }, "Drag 'n' drop a file here,", /* @__PURE__ */ React.createElement("br", null), "or click to select a file")
39874
+ ));
39875
+ });
39876
+ const DeleteImageButton = ({
39877
+ onClick
39878
+ }) => {
39879
+ return /* @__PURE__ */ React.createElement(IconButton, { variant: "white", className: "flex-none", onClick }, /* @__PURE__ */ React.createElement(TrashIcon, { className: "w-7 h-auto caret-transparent" }));
39457
39880
  };
39458
- function cn(...inputs) {
39459
- return twMerge(clsx(inputs));
39881
+ const ImageLoadingIndicator = () => /* @__PURE__ */ React.createElement("div", { className: "p-4 w-full min-h-[96px] flex flex-col justify-center items-center" }, /* @__PURE__ */ React.createElement(LoadingDots, null));
39882
+ function IoMdArrowDropdown(props) {
39883
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M128 192l128 128 128-128z" }, "child": [] }] })(props);
39460
39884
  }
39461
- function DropdownMenu({
39462
- ...props
39463
- }) {
39464
- return /* @__PURE__ */ React.createElement(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
39885
+ function IoMdArrowDropup(props) {
39886
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M128 320l128-128 128 128z" }, "child": [] }] })(props);
39465
39887
  }
39466
- function DropdownMenuTrigger({
39467
- ...props
39468
- }) {
39469
- return /* @__PURE__ */ React.createElement(
39470
- DropdownMenuPrimitive.Trigger,
39471
- {
39472
- "data-slot": "dropdown-menu-trigger",
39473
- ...props
39474
- }
39475
- );
39888
+ function IoMdClose(props) {
39889
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M405 136.798L375.202 107 256 226.202 136.798 107 107 136.798 226.202 256 107 375.202 136.798 405 256 285.798 375.202 405 405 375.202 285.798 256z" }, "child": [] }] })(props);
39476
39890
  }
39477
- function DropdownMenuContent({
39478
- className,
39479
- sideOffset = 4,
39480
- ...props
39481
- }) {
39482
- return /* @__PURE__ */ React.createElement(DropdownMenuPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
39483
- DropdownMenuPrimitive.Content,
39484
- {
39485
- "data-slot": "dropdown-menu-content",
39486
- sideOffset,
39487
- className: cn(
39488
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-base max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
39489
- className
39490
- ),
39491
- ...props
39492
- }
39493
- ));
39494
- }
39495
- function DropdownMenuItem({
39496
- className,
39497
- inset,
39498
- variant = "default",
39499
- ...props
39500
- }) {
39501
- return /* @__PURE__ */ React.createElement(
39502
- DropdownMenuPrimitive.Item,
39503
- {
39504
- "data-slot": "dropdown-menu-item",
39505
- "data-inset": inset,
39506
- "data-variant": variant,
39507
- className: cn(
39508
- "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 cursor-pointer text-gray-700 hover:text-blue-500",
39509
- className
39510
- ),
39511
- ...props
39512
- }
39513
- );
39514
- }
39515
- function DropdownMenuSeparator({
39516
- className,
39517
- ...props
39518
- }) {
39519
- return /* @__PURE__ */ React.createElement(
39520
- DropdownMenuPrimitive.Separator,
39521
- {
39522
- "data-slot": "dropdown-menu-separator",
39523
- className: cn("bg-border -mx-1 my-1 h-px", className),
39524
- ...props
39525
- }
39526
- );
39527
- }
39528
- const DropdownButton = React.forwardRef(
39529
- ({
39530
- variant = "primary",
39531
- size: size2 = "medium",
39532
- busy,
39533
- disabled,
39534
- rounded = "full",
39535
- children,
39536
- className = "",
39537
- onMainAction,
39538
- items: items2,
39539
- showSplitButton = true,
39540
- ...props
39541
- }, ref) => {
39542
- const [open, setOpen] = React.useState(false);
39543
- if (!onMainAction || !showSplitButton) {
39544
- return /* @__PURE__ */ React.createElement(DropdownMenu, { open, onOpenChange: setOpen, modal: false }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
39545
- Button$1,
39546
- {
39547
- variant,
39548
- size: size2,
39549
- busy,
39550
- disabled,
39551
- rounded,
39552
- className: cn$1("gap-2", className),
39553
- ...props
39554
- },
39555
- children,
39556
- /* @__PURE__ */ React.createElement(
39557
- ChevronDownIcon$1,
39558
- {
39559
- className: cn$1(
39560
- "h-4 w-4 transition-transform duration-200",
39561
- open && "rotate-180"
39562
- )
39563
- }
39564
- )
39565
- )), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "end", side: "bottom", className: "z-[100000]" }, items2.map((item, index) => /* @__PURE__ */ React.createElement(
39566
- DropdownMenuItem,
39567
- {
39568
- key: index,
39569
- onClick: item.onClick,
39570
- disabled: item.disabled,
39571
- variant: item.variant
39572
- },
39573
- item.icon && item.icon,
39574
- item.label
39575
- ))));
39576
- }
39577
- return /* @__PURE__ */ React.createElement("div", { className: cn$1("inline-flex", className) }, /* @__PURE__ */ React.createElement(
39578
- Button$1,
39579
- {
39580
- variant,
39581
- size: size2,
39582
- busy,
39583
- disabled,
39584
- rounded: "left",
39585
- onClick: onMainAction,
39586
- className: "border-r-0 w-full",
39587
- ...props
39588
- },
39589
- children
39590
- ), /* @__PURE__ */ React.createElement(DropdownMenu, { open, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, null, /* @__PURE__ */ React.createElement(
39591
- Button$1,
39592
- {
39593
- variant,
39594
- size: size2,
39595
- busy,
39596
- disabled,
39597
- rounded: "right",
39598
- className: "px-4 border-l",
39599
- style: { borderColor: "#00000030" },
39600
- "aria-label": "More options"
39601
- },
39602
- /* @__PURE__ */ React.createElement(
39603
- ChevronDownIcon$1,
39604
- {
39605
- className: cn$1(
39606
- "h-4 w-4 transition-transform duration-200 fill-none",
39607
- open && "rotate-180"
39608
- ),
39609
- style: { fill: "none" }
39610
- }
39611
- )
39612
- )), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "end", side: "bottom" }, items2.map((item, index) => {
39613
- var _a2;
39614
- return /* @__PURE__ */ React.createElement(React.Fragment, { key: index }, /* @__PURE__ */ React.createElement(
39615
- DropdownMenuItem,
39616
- {
39617
- onClick: item.onClick,
39618
- disabled: item.disabled,
39619
- variant: item.variant
39620
- },
39621
- item.icon && item.icon,
39622
- item.label
39623
- ), item.variant === "destructive" && index < items2.length - 1 && ((_a2 = items2[index + 1]) == null ? void 0 : _a2.variant) !== "destructive" && /* @__PURE__ */ React.createElement(DropdownMenuSeparator, null));
39624
- }))));
39625
- }
39626
- );
39627
- DropdownButton.displayName = "DropdownButton";
39628
- function useCMS() {
39629
- return useCMS$1();
39630
- }
39631
- const supportedFileTypes = [
39632
- "text/*",
39633
- "application/pdf",
39634
- "application/octet-stream",
39635
- "application/json",
39636
- "application/ld+json",
39637
- "application/vnd.ms-excel",
39638
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
39639
- "application/msword",
39640
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
39641
- "application/postscript",
39642
- "model/fbx",
39643
- "model/gltf+json",
39644
- "model/ply",
39645
- "model/u3d+mesh",
39646
- "model/vnd.usdz+zip",
39647
- "application/x-indesign",
39648
- "application/vnd.apple.mpegurl",
39649
- "application/dash+xml",
39650
- "application/mxf",
39651
- "image/*",
39652
- "video/*"
39653
- ];
39654
- const DEFAULT_MEDIA_UPLOAD_TYPES = supportedFileTypes.join(",");
39655
- const dropzoneAcceptFromString = (str) => {
39656
- return Object.assign(
39657
- {},
39658
- ...(str || DEFAULT_MEDIA_UPLOAD_TYPES).split(",").map((x) => ({ [x]: [] }))
39659
- );
39660
- };
39661
- const isImage = (filename) => {
39662
- return /\.(gif|jpg|jpeg|tiff|png|svg|webp|avif)(\?.*)?$/i.test(filename);
39663
- };
39664
- const isVideo = (filename) => {
39665
- return /\.(mp4|webm|ogg|m4v|mov|avi|flv|mkv)(\?.*)?$/i.test(filename);
39666
- };
39667
- const absoluteImgURL = (str) => {
39668
- if (str.startsWith("http"))
39669
- return str;
39670
- return `${window.location.origin}${str}`;
39671
- };
39672
- const { useDropzone: useDropzone$1 } = dropzone;
39673
- const StyledImage = ({ src }) => {
39674
- const isSvg = /\.svg$/.test(src);
39675
- return /* @__PURE__ */ React.createElement(
39676
- "img",
39677
- {
39678
- src,
39679
- className: `block max-w-full rounded shadow overflow-hidden max-h-48 lg:max-h-64 h-auto object-contain transition-opacity duration-100 ease-out m-0 bg-gray-200 bg-auto bg-center bg-no-repeat ${isSvg ? "min-w-[12rem]" : ""}`
39680
- }
39681
- );
39682
- };
39683
- const StyledFile = ({ src }) => {
39684
- return /* @__PURE__ */ React.createElement("div", { className: "max-w-full w-full flex-1 flex justify-start items-center gap-3" }, /* @__PURE__ */ React.createElement("div", { className: "w-12 h-12 bg-white shadow border border-gray-100 rounded flex justify-center flex-none" }, /* @__PURE__ */ React.createElement(BiFileBlank, { className: "w-3/5 h-full fill-gray-300" })), /* @__PURE__ */ React.createElement("span", { className: "text-base text-left flex-1 text-gray-500 w-full break-words truncate" }, src));
39685
- };
39686
- const ImageUpload = React.forwardRef(({ onDrop, onClear, onClick, value, src, loading }, ref) => {
39687
- const cms = useCMS();
39688
- const { getRootProps, getInputProps } = useDropzone$1({
39689
- accept: dropzoneAcceptFromString(
39690
- cms.media.accept || DEFAULT_MEDIA_UPLOAD_TYPES
39691
- ),
39692
- onDrop,
39693
- noClick: !!onClick
39694
- });
39695
- return /* @__PURE__ */ React.createElement("div", { className: "w-full max-w-full", ...getRootProps() }, /* @__PURE__ */ React.createElement("input", { ...getInputProps() }), value ? loading ? /* @__PURE__ */ React.createElement(ImageLoadingIndicator, null) : /* @__PURE__ */ React.createElement(
39696
- "div",
39697
- {
39698
- className: `relative w-full max-w-full flex justify-start ${isImage(src) ? `items-start gap-3` : `items-center gap-2`}`
39699
- },
39700
- /* @__PURE__ */ React.createElement(
39701
- "button",
39702
- {
39703
- className: "flex-shrink min-w-0 focus-within:shadow-outline focus-within:border-blue-500 rounded outline-none overflow-visible cursor-pointer border-none hover:opacity-60 transition ease-out duration-100",
39704
- onClick,
39705
- ref
39706
- },
39707
- isImage(src) ? /* @__PURE__ */ React.createElement(StyledImage, { src }) : /* @__PURE__ */ React.createElement(StyledFile, { src })
39708
- ),
39709
- onClear && /* @__PURE__ */ React.createElement(
39710
- DeleteImageButton,
39711
- {
39712
- onClick: (e3) => {
39713
- e3.stopPropagation();
39714
- onClear();
39715
- }
39716
- }
39717
- )
39718
- ) : /* @__PURE__ */ React.createElement(
39719
- "button",
39720
- {
39721
- className: "outline-none relative hover:opacity-60 w-full",
39722
- onClick
39723
- },
39724
- loading ? /* @__PURE__ */ React.createElement(ImageLoadingIndicator, null) : /* @__PURE__ */ React.createElement("div", { className: "text-center rounded-[5px] bg-gray-100 text-gray-300 leading-[1.35] py-3 text-[15px] font-normal transition-all ease-out duration-100 hover:opacity-60" }, "Drag 'n' drop a file here,", /* @__PURE__ */ React.createElement("br", null), "or click to select a file")
39725
- ));
39726
- });
39727
- const DeleteImageButton = ({
39728
- onClick
39729
- }) => {
39730
- return /* @__PURE__ */ React.createElement(IconButton, { variant: "white", className: "flex-none", onClick }, /* @__PURE__ */ React.createElement(TrashIcon, { className: "w-7 h-auto caret-transparent" }));
39731
- };
39732
- const ImageLoadingIndicator = () => /* @__PURE__ */ React.createElement("div", { className: "p-4 w-full min-h-[96px] flex flex-col justify-center items-center" }, /* @__PURE__ */ React.createElement(LoadingDots, null));
39733
- function IoMdArrowDropdown(props) {
39734
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M128 192l128 128 128-128z" }, "child": [] }] })(props);
39735
- }
39736
- function IoMdArrowDropup(props) {
39737
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M128 320l128-128 128 128z" }, "child": [] }] })(props);
39738
- }
39739
- function IoMdClose(props) {
39740
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M405 136.798L375.202 107 256 226.202 136.798 107 107 136.798 226.202 256 107 375.202 136.798 405 256 285.798 375.202 405 405 375.202 285.798 256z" }, "child": [] }] })(props);
39741
- }
39742
- function IoMdRefresh(props) {
39743
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M256 388c-72.597 0-132-59.405-132-132 0-72.601 59.403-132 132-132 36.3 0 69.299 15.4 92.406 39.601L278 234h154V80l-51.698 51.702C348.406 99.798 304.406 80 256 80c-96.797 0-176 79.203-176 176s78.094 176 176 176c81.045 0 148.287-54.134 169.401-128H378.85c-18.745 49.561-67.138 84-122.85 84z" }, "child": [] }] })(props);
39891
+ function IoMdRefresh(props) {
39892
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M256 388c-72.597 0-132-59.405-132-132 0-72.601 59.403-132 132-132 36.3 0 69.299 15.4 92.406 39.601L278 234h154V80l-51.698 51.702C348.406 99.798 304.406 80 256 80c-96.797 0-176 79.203-176 176s78.094 176 176 176c81.045 0 148.287-54.134 169.401-128H378.85c-18.745 49.561-67.138 84-122.85 84z" }, "child": [] }] })(props);
39744
39893
  }
39745
39894
  const buttonVariants = cva(
39746
39895
  "inline-flex items-center justify-center whitespace-nowrap rounded text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
@@ -42733,30 +42882,6 @@ const PasswordFieldPlugin = {
42733
42882
  },
42734
42883
  parse: parse$2
42735
42884
  };
42736
- function AiFillWarning(props) {
42737
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zM480 416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416zm32 352a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z" }, "child": [] }] })(props);
42738
- }
42739
- function AiOutlineLoading(props) {
42740
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 0 0-94.3-139.9 437.71 437.71 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" }, "child": [] }] })(props);
42741
- }
42742
- function FaCircle(props) {
42743
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z" }, "child": [] }] })(props);
42744
- }
42745
- function FaFile(props) {
42746
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 384 512" }, "child": [{ "tag": "path", "attr": { "d": "M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm160-14.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z" }, "child": [] }] })(props);
42747
- }
42748
- function FaFolder(props) {
42749
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M464 128H272l-64-64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V176c0-26.51-21.49-48-48-48z" }, "child": [] }] })(props);
42750
- }
42751
- function FaLock(props) {
42752
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z" }, "child": [] }] })(props);
42753
- }
42754
- function FaSpinner(props) {
42755
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z" }, "child": [] }] })(props);
42756
- }
42757
- function FaUnlock(props) {
42758
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M400 256H152V152.9c0-39.6 31.7-72.5 71.3-72.9 40-.4 72.7 32.1 72.7 72v16c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24v-16C376 68 307.5-.3 223.5 0 139.5.3 72 69.5 72 153.5V256H48c-26.5 0-48 21.5-48 48v160c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48z" }, "child": [] }] })(props);
42759
- }
42760
42885
  function GrCircleQuestion(props) {
42761
42886
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeWidth": "2", "d": "M12,22 C17.5228475,22 22,17.5228475 22,12 C22,6.4771525 17.5228475,2 12,2 C6.4771525,2 2,6.4771525 2,12 C2,17.5228475 6.4771525,22 12,22 Z M12,15 L12,14 C12,13 12,12.5 13,12 C14,11.5 15,11 15,9.5 C15,8.5 14,7 12,7 C10,7 9,8.26413718 9,10 M12,16 L12,18" }, "child": [] }] })(props);
42762
42887
  }
@@ -43472,6 +43597,93 @@ class GlobalFormPlugin {
43472
43597
  };
43473
43598
  }
43474
43599
  }
43600
+ const isSafeHref = (href) => {
43601
+ return /^https?:\/\//.test(href) && !/^javascript:/i.test(href) && !/^data:/i.test(href) && !/^vbscript:/i.test(href);
43602
+ };
43603
+ const parseUrlsInText$1 = (text) => {
43604
+ const urlRegex = /(https?:\/\/[^\s]+|www\.[^\s]+)/g;
43605
+ const parts = text.split(urlRegex);
43606
+ return parts.map((part, index) => {
43607
+ if (part.match(urlRegex)) {
43608
+ let href = part.startsWith("http") ? part : `https://${part}`;
43609
+ href = DOMPurify.sanitize(href, {
43610
+ ALLOWED_URI_REGEXP: /^https?:\/\/.*/i
43611
+ });
43612
+ if (isSafeHref(href)) {
43613
+ const safeText2 = DOMPurify.sanitize(part, {
43614
+ ALLOWED_TAGS: [],
43615
+ ALLOWED_ATTR: []
43616
+ });
43617
+ return /* @__PURE__ */ React__default.createElement(
43618
+ "a",
43619
+ {
43620
+ key: index,
43621
+ href,
43622
+ target: "_blank",
43623
+ rel: "noopener noreferrer",
43624
+ className: "underline hover:opacity-80",
43625
+ onClick: (e3) => e3.stopPropagation()
43626
+ },
43627
+ safeText2
43628
+ );
43629
+ } else {
43630
+ const safeText2 = DOMPurify.sanitize(part, {
43631
+ ALLOWED_TAGS: [],
43632
+ ALLOWED_ATTR: []
43633
+ });
43634
+ return /* @__PURE__ */ React__default.createElement("span", { key: index }, safeText2);
43635
+ }
43636
+ }
43637
+ const safeText = DOMPurify.sanitize(part, {
43638
+ ALLOWED_TAGS: [],
43639
+ ALLOWED_ATTR: []
43640
+ });
43641
+ return safeText;
43642
+ });
43643
+ };
43644
+ const toast = {
43645
+ success: (message, options) => {
43646
+ const content = typeof message === "string" ? parseUrlsInText$1(message) : message;
43647
+ return toast$1.success(content, options);
43648
+ },
43649
+ error: (message, options) => {
43650
+ const content = typeof message === "string" ? parseUrlsInText$1(message) : message;
43651
+ return toast$1.error(content, options);
43652
+ },
43653
+ warning: (message, options) => {
43654
+ const content = typeof message === "string" ? parseUrlsInText$1(message) : message;
43655
+ return toast$1.warning(content, options);
43656
+ },
43657
+ info: (message, options) => {
43658
+ const content = typeof message === "string" ? parseUrlsInText$1(message) : message;
43659
+ return toast$1.info(content, options);
43660
+ },
43661
+ dismiss: toast$1.dismiss
43662
+ };
43663
+ const Toaster = ({ ...props }) => {
43664
+ return /* @__PURE__ */ React__default.createElement(
43665
+ Toaster$1,
43666
+ {
43667
+ className: "toaster group",
43668
+ position: "top-left",
43669
+ closeButton: true,
43670
+ toastOptions: {
43671
+ classNames: {
43672
+ toast: "group toast group-[.toaster]:bg-white group-[.toaster]:shadow-lg",
43673
+ description: "group-[.toast]:text-gray-700",
43674
+ actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
43675
+ cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
43676
+ closeButton: "group-[.toast]:bg-white group-[.toast]:text-current group-[.toast]:border-0",
43677
+ success: "group-[.toaster]:border-green-500 [&_[data-icon]]:text-green-500 [&_[data-content]]:text-gray-700",
43678
+ error: "group-[.toaster]:border-red-500 [&_[data-icon]]:text-red-500 [&_[data-content]]:text-gray-700",
43679
+ warning: "group-[.toaster]:border-yellow-500 [&_[data-icon]]:text-yellow-500 [&_[data-content]]:text-gray-700",
43680
+ info: "group-[.toaster]:border-blue-500 [&_[data-icon]]:text-blue-500 [&_[data-content]]:text-gray-700"
43681
+ }
43682
+ },
43683
+ ...props
43684
+ }
43685
+ );
43686
+ };
43475
43687
  let Alerts$1 = class Alerts {
43476
43688
  constructor(events2, map2 = {}) {
43477
43689
  this.events = events2;
@@ -43499,20 +43711,43 @@ let Alerts$1 = class Alerts {
43499
43711
  };
43500
43712
  }
43501
43713
  add(level, message, timeout = 8e3) {
43714
+ let id2;
43715
+ const toastMessage = typeof message === "string" ? message : React__default.createElement(message);
43716
+ switch (level) {
43717
+ case "success":
43718
+ id2 = toast.success(toastMessage, {
43719
+ duration: timeout
43720
+ });
43721
+ break;
43722
+ case "error":
43723
+ id2 = `${message}|${Date.now()}`;
43724
+ break;
43725
+ case "warn":
43726
+ id2 = toast.warning(toastMessage, {
43727
+ duration: timeout
43728
+ });
43729
+ break;
43730
+ case "info":
43731
+ default:
43732
+ id2 = toast.info(toastMessage, {
43733
+ duration: timeout
43734
+ });
43735
+ break;
43736
+ }
43502
43737
  const alert = {
43503
43738
  level,
43504
43739
  message,
43505
43740
  timeout,
43506
- id: `${message}|${Date.now()}`
43741
+ id: String(id2)
43507
43742
  };
43508
43743
  this.alerts.set(alert.id, alert);
43509
43744
  this.events.dispatch({ type: "alerts:add", alert });
43510
- let timeoutId = null;
43511
43745
  const dismiss = () => {
43512
- clearTimeout(timeoutId);
43746
+ if (level !== "error") {
43747
+ toast.dismiss(id2);
43748
+ }
43513
43749
  this.dismiss(alert);
43514
43750
  };
43515
- timeoutId = level !== "error" ? setTimeout(dismiss, alert.timeout) : null;
43516
43751
  return dismiss;
43517
43752
  }
43518
43753
  dismiss(alert) {
@@ -45457,7 +45692,7 @@ const Callout = ({
45457
45692
  className = "",
45458
45693
  ...props
45459
45694
  }) => {
45460
- const commonAlertStyles = "ml-8 text-sm px-4 py-3 rounded-md border";
45695
+ const commonAlertStyles = "text-sm px-4 py-3 rounded-md border";
45461
45696
  const styles = {
45462
45697
  warning: `text-amber-700 bg-amber-100 border-amber-700/20`,
45463
45698
  info: `text-blue-600 bg-blue-100/50 border-blue-600/20`,
@@ -46229,7 +46464,7 @@ function formatDistanceToNow(dirtyDate, options) {
46229
46464
  requiredArgs(1, arguments);
46230
46465
  return formatDistance2(dirtyDate, Date.now(), options);
46231
46466
  }
46232
- const version$1 = "2.9.3";
46467
+ const version$1 = "2.9.4";
46233
46468
  const VersionInfo = () => {
46234
46469
  var _a2, _b, _c, _d, _e, _f;
46235
46470
  const cms = useCMS();
@@ -47866,21 +48101,10 @@ const parseUrlsInText = (text) => {
47866
48101
  };
47867
48102
  function Alerts2({ alerts }) {
47868
48103
  useSubscribable(alerts);
47869
- if (!alerts.all.length) {
48104
+ if (alerts.all.length === 0) {
47870
48105
  return null;
47871
48106
  }
47872
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: "fixed bottom-0 left-0 right-0 p-6 flex flex-col items-center z-[999999]" }, alerts.all.filter((alert) => {
47873
- return alert.level !== "error";
47874
- }).map((alert) => {
47875
- 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(
47876
- CloseAlert,
47877
- {
47878
- onClick: () => {
47879
- alerts.dismiss(alert);
47880
- }
47881
- }
47882
- ));
47883
- })), alerts.all.filter((alert) => {
48107
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Toaster, null), alerts.all.filter((alert) => {
47884
48108
  return alert.level === "error";
47885
48109
  }).map((alert) => {
47886
48110
  const AlertMessage = typeof alert.message === "string" ? () => {
@@ -47908,51 +48132,6 @@ function Alerts2({ alerts }) {
47908
48132
  ))));
47909
48133
  }));
47910
48134
  }
47911
- const Alert = ({
47912
- level,
47913
- ...props
47914
- }) => {
47915
- const colorClasses = {
47916
- info: "bg-blue-100 border-blue-500 text-blue-600 fill-blue-500",
47917
- success: "bg-green-100 border-green-500 text-green-600 fill-green-500",
47918
- warn: "bg-yellow-100 border-yellow-500 text-yellow-600 fill-yellow-500",
47919
- error: "bg-red-100 border-red-500 text-red-600 fill-red-500"
47920
- };
47921
- const borderClasses = {
47922
- info: "border-blue-200",
47923
- success: "border-green-200",
47924
- warn: "border-yellow-200",
47925
- error: "border-red-200"
47926
- };
47927
- return /* @__PURE__ */ React__default.createElement(
47928
- "div",
47929
- {
47930
- 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]}}`,
47931
- style: {
47932
- animationName: "fly-in-up, fade-in",
47933
- animationTimingFunction: "ease-out",
47934
- animationIterationCount: 1,
47935
- animationFillMode: "both",
47936
- animationDuration: "150ms"
47937
- }
47938
- },
47939
- /* @__PURE__ */ React__default.createElement(
47940
- "div",
47941
- {
47942
- className: `flex items-center gap-1.5 min-w-[350px] rounded-md border p-2 ${borderClasses[level]}`,
47943
- ...props
47944
- }
47945
- )
47946
- );
47947
- };
47948
- const CloseAlert = ({ ...styleProps }) => /* @__PURE__ */ React__default.createElement(
47949
- "button",
47950
- {
47951
- className: "border-none bg-transparent p-0 outline-none flex items-center",
47952
- ...styleProps
47953
- },
47954
- /* @__PURE__ */ React__default.createElement(BiX, { className: "w-5 auto flex-grow-0 flex-shrink-0" })
47955
- );
47956
48135
  function CursorPaginator({
47957
48136
  navigateNext,
47958
48137
  navigatePrev,
@@ -48248,6 +48427,18 @@ const BranchPreviewButton = (props) => {
48248
48427
  /* @__PURE__ */ React.createElement(BiLinkExternal, { className: "h-5 w-auto" })
48249
48428
  );
48250
48429
  };
48430
+ const EDITORIAL_WORKFLOW_STATUS = {
48431
+ QUEUED: "queued",
48432
+ PROCESSING: "processing",
48433
+ SETTING_UP: "setting_up",
48434
+ CREATING_BRANCH: "creating_branch",
48435
+ INDEXING: "indexing",
48436
+ CONTENT_GENERATION: "content_generation",
48437
+ CREATING_PR: "creating_pr",
48438
+ COMPLETE: "complete",
48439
+ ERROR: "error",
48440
+ TIMEOUT: "timeout"
48441
+ };
48251
48442
  const num123 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
48252
48443
  const numFas = ["۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹", "۰"];
48253
48444
  const numKor = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
@@ -63661,367 +63852,6 @@ class TinaAdminApi {
63661
63852
  );
63662
63853
  }
63663
63854
  }
63664
- const ProgressBar = ({
63665
- progress,
63666
- className = "",
63667
- color = "blue"
63668
- }) => {
63669
- const clampedProgress = Math.min(Math.max(progress, 0), 100);
63670
- const colorClass = color === "green" ? "bg-green-500" : "bg-blue-500";
63671
- return /* @__PURE__ */ React.createElement("div", { className: `w-full ${className}` }, /* @__PURE__ */ React.createElement("div", { className: "w-full bg-gray-200 rounded-full h-2" }, /* @__PURE__ */ React.createElement(
63672
- "div",
63673
- {
63674
- className: `${colorClass} h-2 rounded-full transition-all duration-300 ease-out`,
63675
- style: { width: `${clampedProgress}%` }
63676
- }
63677
- )));
63678
- };
63679
- const EDITORIAL_WORKFLOW_STATUS = {
63680
- QUEUED: "queued",
63681
- PROCESSING: "processing",
63682
- SETTING_UP: "setting_up",
63683
- CREATING_BRANCH: "creating_branch",
63684
- INDEXING: "indexing",
63685
- CONTENT_GENERATION: "content_generation",
63686
- CREATING_PR: "creating_pr",
63687
- COMPLETE: "complete",
63688
- ERROR: "error",
63689
- TIMEOUT: "timeout"
63690
- };
63691
- const FormActionMenu = ({ actions, form }) => {
63692
- const [actionMenuVisibility, setActionMenuVisibility] = useState(false);
63693
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(MoreActionsButton, { onClick: () => setActionMenuVisibility((p2) => !p2) }), /* @__PURE__ */ React.createElement(ActionsOverlay, { open: actionMenuVisibility }, /* @__PURE__ */ React.createElement(
63694
- Dismissible,
63695
- {
63696
- click: true,
63697
- escape: true,
63698
- disabled: !actionMenuVisibility,
63699
- onDismiss: () => {
63700
- setActionMenuVisibility((p2) => !p2);
63701
- }
63702
- },
63703
- actions.map((Action, i2) => (
63704
- // TODO: `i` will suppress warnings but this indicates that maybe
63705
- // Actions should just be componets
63706
- /* @__PURE__ */ React.createElement(Action, { form, key: i2 })
63707
- ))
63708
- )));
63709
- };
63710
- const MoreActionsButton = ({ className = "", ...props }) => /* @__PURE__ */ React.createElement(
63711
- "button",
63712
- {
63713
- className: `h-16 w-10 self-stretch bg-transparent bg-center bg-[length:auto_18px] -mr-4 ml-2 outline-none cursor-pointer transition-opacity duration-100 ease-out flex justify-center items-center hover:bg-gray-50 hover:fill-gray-700 ${className}`,
63714
- ...props
63715
- },
63716
- /* @__PURE__ */ React.createElement(EllipsisVerticalIcon, null)
63717
- );
63718
- const ActionsOverlay = ({ open, className = "", style = {}, ...props }) => /* @__PURE__ */ React.createElement(
63719
- "div",
63720
- {
63721
- className: `min-w-[192px] rounded-3xl border border-solid border-[#efefef] block absolute bottom-5 right-5 ${open ? "opacity-100" : "opacity-0"} transition-all duration-100 ease-out origin-bottom-right shadow-[0_2px_3px_rgba(0,0,0,0.05)] bg-white overflow-hidden z-10 ${className}`,
63722
- style: {
63723
- transform: open ? "translate3d(0, -28px, 0) scale3d(1, 1, 1)" : "translate3d(0, 0, 0) scale3d(0.5, 0.5, 1)",
63724
- pointerEvents: open ? "all" : "none",
63725
- ...style
63726
- },
63727
- ...props
63728
- }
63729
- );
63730
- const ActionButton = ({ className = "", ...props }) => /* @__PURE__ */ React.createElement(
63731
- "button",
63732
- {
63733
- className: `relative text-center text-[13px] px-3 h-10 font-normal w-full bg-none cursor-pointer outline-none border-0 transition-all duration-[150ms] ease-out hover:text-blue-500 hover:bg-gray50 [&:not(:last-child)]: border-b-[1px] border-solid border-b-[#edecf3] ${className}`,
63734
- ...props
63735
- }
63736
- );
63737
- const FormPortalContext = React.createContext(() => {
63738
- return null;
63739
- });
63740
- function useFormPortal() {
63741
- return React.useContext(FormPortalContext);
63742
- }
63743
- const FormPortalProvider = ({
63744
- children
63745
- }) => {
63746
- const wrapperRef = React.useRef(null);
63747
- const zIndexRef = React.useRef(0);
63748
- const FormPortal = React.useCallback(
63749
- (props) => {
63750
- if (!wrapperRef.current)
63751
- return null;
63752
- return createPortal(
63753
- props.children({ zIndexShift: zIndexRef.current += 1 }),
63754
- wrapperRef.current
63755
- );
63756
- },
63757
- [wrapperRef, zIndexRef]
63758
- );
63759
- return /* @__PURE__ */ React.createElement(FormPortalContext.Provider, { value: FormPortal }, /* @__PURE__ */ React.createElement("div", { ref: wrapperRef, className: "relative w-full flex-1 overflow-hidden" }, children));
63760
- };
63761
- const LoadingDots = ({
63762
- dotSize = 8,
63763
- color = "white"
63764
- }) => {
63765
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(SingleDot, { dotSize, color }), /* @__PURE__ */ React.createElement(SingleDot, { dotSize, color, delay: 0.3 }), /* @__PURE__ */ React.createElement(SingleDot, { dotSize, color, delay: 0.5 }));
63766
- };
63767
- const SingleDot = ({ delay = 0, color, dotSize }) => /* @__PURE__ */ React.createElement(
63768
- "span",
63769
- {
63770
- className: "inline-block mr-1",
63771
- style: {
63772
- animation: "loading-dots-scale-up-and-down 2s linear infinite",
63773
- animationDelay: `${delay}s`,
63774
- background: color,
63775
- width: dotSize,
63776
- height: dotSize,
63777
- borderRadius: dotSize
63778
- }
63779
- }
63780
- );
63781
- const ResetForm = ({
63782
- pristine,
63783
- reset: reset2,
63784
- children,
63785
- ...props
63786
- }) => {
63787
- const [open, setOpen] = React.useState(false);
63788
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
63789
- Button$1,
63790
- {
63791
- onClick: () => {
63792
- setOpen((p2) => !p2);
63793
- },
63794
- disabled: pristine,
63795
- ...props
63796
- },
63797
- children
63798
- ), open && /* @__PURE__ */ React.createElement(ResetModal, { reset: reset2, close: () => setOpen(false) }));
63799
- };
63800
- const ResetModal = ({ close: close2, reset: reset2 }) => {
63801
- return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(ModalPopup, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "Reset"), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", null, "Are you sure you want to reset all changes?")), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
63802
- Button$1,
63803
- {
63804
- style: { flexGrow: 3 },
63805
- variant: "primary",
63806
- onClick: async () => {
63807
- await reset2();
63808
- close2();
63809
- }
63810
- },
63811
- "Reset"
63812
- ))));
63813
- };
63814
- const NoFieldsPlaceholder = () => /* @__PURE__ */ React.createElement(
63815
- "div",
63816
- {
63817
- className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
63818
- style: {
63819
- animationName: "fade-in",
63820
- animationDelay: "300ms",
63821
- animationTimingFunction: "ease-out",
63822
- animationIterationCount: 1,
63823
- animationFillMode: "both",
63824
- animationDuration: "150ms"
63825
- }
63826
- },
63827
- /* @__PURE__ */ React.createElement(Emoji, { className: "block pb-5" }, "🤔"),
63828
- /* @__PURE__ */ React.createElement("h3", { className: "font-sans font-normal text-lg block pb-5" }, "Hey, you don't have any fields added to this form."),
63829
- /* @__PURE__ */ React.createElement("p", { className: "block pb-5" }, /* @__PURE__ */ React.createElement(
63830
- "a",
63831
- {
63832
- className: "text-center rounded-3xl border border-solid border-gray-100 shadow-[0_2px_3px_rgba(0,0,0,0.12)] font-normal cursor-pointer text-[12px] transition-all duration-100 ease-out bg-white text-gray-700 py-3 pr-5 pl-14 relative no-underline inline-block hover:text-blue-500",
63833
- href: "https://tinacms.org/docs/fields",
63834
- target: "_blank",
63835
- rel: "noopener noreferrer"
63836
- },
63837
- /* @__PURE__ */ React.createElement(
63838
- Emoji,
63839
- {
63840
- className: "absolute left-5 top-1/2 origin-center -translate-y-1/2 transition-all duration-100 ease-out",
63841
- style: { fontSize: 24 }
63842
- },
63843
- "📖"
63844
- ),
63845
- " ",
63846
- "Field Setup Guide"
63847
- ))
63848
- );
63849
- const FormKeyBindings = ({ onSubmit }) => {
63850
- useEffect(() => {
63851
- const handleKeyDown = (e3) => {
63852
- if ((e3.metaKey || e3.ctrlKey) && e3.key === "s") {
63853
- e3.preventDefault();
63854
- onSubmit();
63855
- }
63856
- };
63857
- window.addEventListener("keydown", handleKeyDown);
63858
- return () => window.removeEventListener("keydown", handleKeyDown);
63859
- }, [onSubmit]);
63860
- return null;
63861
- };
63862
- const FormBuilder = ({
63863
- form,
63864
- onPristineChange,
63865
- ...rest
63866
- }) => {
63867
- const cms = useCMS$1();
63868
- const hideFooter = !!rest.hideFooter;
63869
- const [createBranchModalOpen, setCreateBranchModalOpen] = React.useState(false);
63870
- const tinaForm = form.tinaForm;
63871
- const finalForm = form.tinaForm.finalForm;
63872
- React.useEffect(() => {
63873
- var _a2;
63874
- const collection = cms.api.tina.schema.getCollectionByFullPath(
63875
- tinaForm.path
63876
- );
63877
- if ((_a2 = collection == null ? void 0 : collection.ui) == null ? void 0 : _a2.beforeSubmit) {
63878
- tinaForm.beforeSubmit = (values) => collection.ui.beforeSubmit({ cms, form: tinaForm, values });
63879
- } else {
63880
- tinaForm.beforeSubmit = void 0;
63881
- }
63882
- }, [tinaForm.path]);
63883
- const moveArrayItem = React.useCallback(
63884
- (result) => {
63885
- if (!result.destination || !finalForm)
63886
- return;
63887
- const name = result.type;
63888
- finalForm.mutators.move(
63889
- name,
63890
- result.source.index,
63891
- result.destination.index
63892
- );
63893
- },
63894
- [tinaForm]
63895
- );
63896
- React.useEffect(() => {
63897
- const unsubscribe = finalForm.subscribe(
63898
- ({ pristine }) => {
63899
- if (onPristineChange) {
63900
- onPristineChange(pristine);
63901
- }
63902
- },
63903
- { pristine: true }
63904
- );
63905
- return () => {
63906
- unsubscribe();
63907
- };
63908
- }, [finalForm]);
63909
- const fieldGroup = tinaForm.getActiveField(form.activeFieldName);
63910
- return /* @__PURE__ */ React.createElement(
63911
- Form$1,
63912
- {
63913
- key: tinaForm.id,
63914
- form: tinaForm.finalForm,
63915
- onSubmit: tinaForm.onSubmit
63916
- },
63917
- ({
63918
- handleSubmit,
63919
- pristine,
63920
- invalid,
63921
- submitting,
63922
- dirtySinceLastSubmit,
63923
- hasValidationErrors
63924
- }) => {
63925
- const usingProtectedBranch = cms.api.tina.usingProtectedBranch();
63926
- const canSubmit = !pristine && !submitting && !hasValidationErrors && !(invalid && !dirtySinceLastSubmit);
63927
- const safeSubmit = async () => {
63928
- if (canSubmit) {
63929
- await handleSubmit();
63930
- }
63931
- };
63932
- const safeHandleSubmit = async () => {
63933
- if (usingProtectedBranch) {
63934
- setCreateBranchModalOpen(true);
63935
- } else {
63936
- safeSubmit();
63937
- }
63938
- };
63939
- return /* @__PURE__ */ React.createElement(React.Fragment, null, createBranchModalOpen && /* @__PURE__ */ React.createElement(
63940
- CreateBranchModal,
63941
- {
63942
- safeSubmit,
63943
- crudType: tinaForm.crudType,
63944
- path: tinaForm.path,
63945
- values: tinaForm.values,
63946
- close: () => setCreateBranchModalOpen(false)
63947
- }
63948
- ), /* @__PURE__ */ React.createElement(DragDropContext, { onDragEnd: moveArrayItem }, /* @__PURE__ */ React.createElement(FormKeyBindings, { onSubmit: safeHandleSubmit }), /* @__PURE__ */ React.createElement(FormPortalProvider, null, /* @__PURE__ */ React.createElement(FormWrapper, { id: tinaForm.id }, (tinaForm == null ? void 0 : tinaForm.fields.length) ? /* @__PURE__ */ React.createElement(
63949
- FieldsBuilder,
63950
- {
63951
- form: tinaForm,
63952
- activeFieldName: form.activeFieldName,
63953
- fields: fieldGroup.fields
63954
- }
63955
- ) : /* @__PURE__ */ React.createElement(NoFieldsPlaceholder, null))), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: "relative flex-none w-full h-16 px-6 bg-white border-t border-gray-100 flex items-center justify-end" }, /* @__PURE__ */ React.createElement("div", { className: "flex-1 w-full justify-end gap-2 flex items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React.createElement(
63956
- ResetForm,
63957
- {
63958
- pristine,
63959
- reset: async () => {
63960
- finalForm.reset();
63961
- await tinaForm.reset();
63962
- }
63963
- },
63964
- tinaForm.buttons.reset
63965
- ), /* @__PURE__ */ React.createElement(
63966
- Button$1,
63967
- {
63968
- onClick: safeHandleSubmit,
63969
- disabled: !canSubmit,
63970
- busy: submitting,
63971
- variant: "primary"
63972
- },
63973
- submitting && /* @__PURE__ */ React.createElement(LoadingDots, null),
63974
- !submitting && tinaForm.buttons.save
63975
- ), tinaForm.actions.length > 0 && /* @__PURE__ */ React.createElement(
63976
- FormActionMenu,
63977
- {
63978
- form: tinaForm,
63979
- actions: tinaForm.actions
63980
- }
63981
- )))));
63982
- }
63983
- );
63984
- };
63985
- const FormStatus = ({ pristine }) => {
63986
- const pristineClass = pristine ? "text-green-500" : "text-red-500";
63987
- return /* @__PURE__ */ React.createElement(FaCircle, { className: cn("h-3", pristineClass) });
63988
- };
63989
- const FormWrapper = ({
63990
- id: id2,
63991
- children
63992
- }) => {
63993
- return /* @__PURE__ */ React.createElement(
63994
- "div",
63995
- {
63996
- "data-test": `form:${id2 == null ? void 0 : id2.replace(/\\/g, "/")}`,
63997
- className: "h-full overflow-y-auto max-h-full bg-gray-50"
63998
- },
63999
- /* @__PURE__ */ React.createElement("div", { className: "py-5 px-6" }, children)
64000
- );
64001
- };
64002
- const Emoji = ({ className = "", ...props }) => /* @__PURE__ */ React.createElement(
64003
- "span",
64004
- {
64005
- className: `text-[40px] leading-none inline-block ${className}`,
64006
- ...props
64007
- }
64008
- );
64009
- const CreateBranchModel = ({
64010
- close: close2,
64011
- safeSubmit,
64012
- relativePath: relativePath2,
64013
- values,
64014
- crudType
64015
- }) => /* @__PURE__ */ React.createElement(
64016
- CreateBranchModal,
64017
- {
64018
- close: close2,
64019
- safeSubmit,
64020
- path: relativePath2,
64021
- values,
64022
- crudType
64023
- }
64024
- );
64025
63855
  const pathRelativeToCollection = (collectionPath, fullPath) => {
64026
63856
  const normalizedCollectionPath = collectionPath.replace(/\\/g, "/");
64027
63857
  const normalizedFullPath = fullPath.replace(/\\/g, "/");
@@ -64050,7 +63880,6 @@ const CreateBranchModal = ({
64050
63880
  const [isExecuting, setIsExecuting] = React.useState(false);
64051
63881
  const [errorMessage, setErrorMessage] = React.useState("");
64052
63882
  const [currentStep, setCurrentStep] = React.useState(0);
64053
- const [statusMessage, setStatusMessage] = React.useState("");
64054
63883
  const [elapsedTime, setElapsedTime] = React.useState(0);
64055
63884
  React.useEffect(() => {
64056
63885
  let interval;
@@ -64094,7 +63923,6 @@ const CreateBranchModal = ({
64094
63923
  setDisabled(true);
64095
63924
  setIsExecuting(true);
64096
63925
  setCurrentStep(1);
64097
- setStatusMessage("Initializing workflow...");
64098
63926
  let graphql2 = "";
64099
63927
  if (crudType === "create") {
64100
63928
  graphql2 = CREATE_DOCUMENT_GQL;
@@ -64119,8 +63947,6 @@ const CreateBranchModal = ({
64119
63947
  }
64120
63948
  },
64121
63949
  onStatusUpdate: (status) => {
64122
- const message = status.message || `Status: ${status.status}`;
64123
- setStatusMessage(message);
64124
63950
  switch (status.status) {
64125
63951
  case EDITORIAL_WORKFLOW_STATUS.SETTING_UP:
64126
63952
  case EDITORIAL_WORKFLOW_STATUS.CREATING_BRANCH:
@@ -64157,9 +63983,7 @@ const CreateBranchModal = ({
64157
63983
  }
64158
63984
  };
64159
63985
  const renderProgressIndicator = () => {
64160
- var _a2;
64161
- const progressPercentage = (currentStep - 1) / steps.length * 100;
64162
- return /* @__PURE__ */ React.createElement("div", { className: "py-6" }, /* @__PURE__ */ React.createElement("div", { className: "flex justify-between mb-4 relative px-5 sm:gap-x-8" }, /* @__PURE__ */ React.createElement(
63986
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "flex justify-between my-8 relative px-5 sm:gap-x-8" }, /* @__PURE__ */ React.createElement(
64163
63987
  "div",
64164
63988
  {
64165
63989
  className: "absolute top-5 h-0.5 bg-gray-200 -z-10",
@@ -64168,7 +63992,7 @@ const CreateBranchModal = ({
64168
63992
  ), currentStep > 1 && currentStep <= steps.length && /* @__PURE__ */ React.createElement(
64169
63993
  "div",
64170
63994
  {
64171
- className: "absolute top-5 h-0.5 bg-blue-500 -z-10 transition-all duration-500",
63995
+ className: "absolute top-5 h-0.5 bg-tina-orange -z-10 transition-all duration-500",
64172
63996
  style: {
64173
63997
  left: "50px",
64174
63998
  width: `calc((100% - 100px) * ${(currentStep - 1) / (steps.length - 1)})`
@@ -64196,7 +64020,7 @@ const CreateBranchModal = ({
64196
64020
  /* @__PURE__ */ React.createElement(
64197
64021
  "div",
64198
64022
  {
64199
- className: `w-10 h-10 rounded-full flex items-center justify-center font-medium mb-3 border-2 transition-all duration-300 ${isCompleted ? "bg-green-500 border-green-500 text-white" : isActive ? "bg-blue-500 border-blue-500 text-white" : "bg-white border-gray-200 text-gray-400"}`
64023
+ className: `w-10 h-10 rounded-full flex items-center justify-center font-medium mb-3 border-2 transition-all duration-300 select-none ${isCompleted ? "bg-green-500 border-green-500 text-white" : isActive ? "bg-tina-orange border-tina-orange text-white" : "bg-white border-gray-200 text-gray-400"}`
64200
64024
  },
64201
64025
  isCompleted ? /* @__PURE__ */ React.createElement(
64202
64026
  "svg",
@@ -64217,7 +64041,7 @@ const CreateBranchModal = ({
64217
64041
  ),
64218
64042
  /* @__PURE__ */ React.createElement("div", { className: "text-center max-w-24" }, /* @__PURE__ */ React.createElement("div", { className: "text-sm font-semibold leading-tight" }, step.name), /* @__PURE__ */ React.createElement("div", { className: "text-xs text-gray-400 mt-1 leading-tight" }, step.description))
64219
64043
  );
64220
- })), /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-between mb-4" }, /* @__PURE__ */ React.createElement("div", { className: "text-sm font-medium text-gray-700" }, "Step ", currentStep > steps.length ? steps.length : currentStep, " of", " ", steps.length), isExecuting && currentStep > 0 && /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-1 text-sm text-gray-500" }, /* @__PURE__ */ React.createElement("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20" }, /* @__PURE__ */ React.createElement(
64044
+ })), /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React.createElement("div", { className: "text-xs text-gray-500" }, "Estimated time: 1-2 min "), isExecuting && currentStep > 0 && /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-1 text-sm text-gray-500" }, /* @__PURE__ */ React.createElement("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20" }, /* @__PURE__ */ React.createElement(
64221
64045
  "path",
64222
64046
  {
64223
64047
  fillRule: "evenodd",
@@ -64225,34 +64049,20 @@ const CreateBranchModal = ({
64225
64049
  clipRule: "evenodd"
64226
64050
  }
64227
64051
  )), formatTime(elapsedTime))), /* @__PURE__ */ React.createElement(
64228
- ProgressBar,
64229
- {
64230
- progress: progressPercentage,
64231
- className: "mb-4",
64232
- color: currentStep > steps.length ? "green" : "blue"
64233
- }
64234
- ), /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2 mb-2" }, currentStep >= 4 ? /* @__PURE__ */ React.createElement(
64235
- "svg",
64052
+ "a",
64236
64053
  {
64237
- className: "w-4 h-4 text-green-500",
64238
- fill: "currentColor",
64239
- viewBox: "0 0 20 20"
64054
+ className: "underline text-tina-orange-dark font-medium text-xs",
64055
+ href: "https://tina.io/docs/tinacloud/editorial-workflow",
64056
+ target: "_blank"
64240
64057
  },
64241
- /* @__PURE__ */ React.createElement(
64242
- "path",
64243
- {
64244
- fillRule: "evenodd",
64245
- d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
64246
- clipRule: "evenodd"
64247
- }
64248
- )
64249
- ) : /* @__PURE__ */ React.createElement(AiOutlineLoading, { className: "text-blue-500 animate-spin" }), /* @__PURE__ */ React.createElement("span", { className: "text-sm font-medium text-gray-700" }, statusMessage || `${(_a2 = steps[currentStep - 1]) == null ? void 0 : _a2.name}...`)), /* @__PURE__ */ React.createElement("div", { className: "text-left" }, /* @__PURE__ */ React.createElement("p", { className: "text-xs text-gray-500" }, "Estimated time: 1-2 minutes")));
64058
+ "Learn more about Editorial Workflow"
64059
+ ));
64250
64060
  };
64251
64061
  const renderStateContent = () => {
64252
64062
  if (isExecuting) {
64253
64063
  return renderProgressIndicator();
64254
64064
  } else {
64255
- return /* @__PURE__ */ React.createElement("div", { className: "max-w-sm" }, errorMessage && /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-1 text-red-700 py-2 px-3 mb-4 bg-red-50 border border-red-200 rounded" }, /* @__PURE__ */ React.createElement(BiError, { className: "w-5 h-auto text-red-400 flex-shrink-0" }), /* @__PURE__ */ React.createElement("span", { className: "text-sm" }, /* @__PURE__ */ React.createElement("b", null, "Error:"), " ", errorMessage)), /* @__PURE__ */ React.createElement("p", { className: "text-lg text-gray-700 font-bold mb-2" }, "First, let's create a copy"), /* @__PURE__ */ React.createElement("p", { className: "text-sm text-gray-700 mb-4 max-w-sm" }, "To make changes, create a copy then get it approved and merged for it to go live.", " ", /* @__PURE__ */ React.createElement(
64065
+ return /* @__PURE__ */ React.createElement("div", { className: "max-w-sm" }, errorMessage && /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-1 text-red-700 py-2 px-3 mb-4 bg-red-50 border border-red-200 rounded" }, /* @__PURE__ */ React.createElement(BiError, { className: "w-5 h-auto text-red-400 flex-shrink-0" }), /* @__PURE__ */ React.createElement("span", { className: "text-sm" }, /* @__PURE__ */ React.createElement("b", null, "Error:"), " ", errorMessage)), /* @__PURE__ */ React.createElement("p", { className: "text-lg text-gray-700 font-bold mb-2" }, "First, let's create a copy"), /* @__PURE__ */ React.createElement("p", { className: "text-sm text-gray-700 mb-4 max-w-sm" }, "To make changes, you need to create a copy then get it approved and merged for it to go live.", /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("span", { className: "text-gray-500" }, "Learn more about "), /* @__PURE__ */ React.createElement(
64256
64066
  "a",
64257
64067
  {
64258
64068
  className: "underline text-tina-orange-dark font-medium",
@@ -64260,7 +64070,7 @@ const CreateBranchModal = ({
64260
64070
  target: "_blank"
64261
64071
  },
64262
64072
  "Editorial Workflow"
64263
- )), /* @__PURE__ */ React.createElement(
64073
+ ), "."), /* @__PURE__ */ React.createElement(
64264
64074
  PrefixedTextField,
64265
64075
  {
64266
64076
  name: "new-branch-name",
@@ -64269,7 +64079,6 @@ const CreateBranchModal = ({
64269
64079
  value: newBranchName,
64270
64080
  onChange: (e3) => {
64271
64081
  setErrorMessage("");
64272
- setStatusMessage("");
64273
64082
  setNewBranchName(e3.target.value);
64274
64083
  }
64275
64084
  }
@@ -64320,6 +64129,217 @@ const PrefixedTextField = ({
64320
64129
  }
64321
64130
  )));
64322
64131
  };
64132
+ const NoFieldsPlaceholder = () => /* @__PURE__ */ React.createElement(
64133
+ "div",
64134
+ {
64135
+ className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
64136
+ style: {
64137
+ animationName: "fade-in",
64138
+ animationDelay: "300ms",
64139
+ animationTimingFunction: "ease-out",
64140
+ animationIterationCount: 1,
64141
+ animationFillMode: "both",
64142
+ animationDuration: "150ms"
64143
+ }
64144
+ },
64145
+ /* @__PURE__ */ React.createElement(Emoji, { className: "block pb-5" }, "🤔"),
64146
+ /* @__PURE__ */ React.createElement("h3", { className: "font-sans font-normal text-lg block pb-5" }, "Hey, you don't have any fields added to this form."),
64147
+ /* @__PURE__ */ React.createElement("p", { className: "block pb-5" }, /* @__PURE__ */ React.createElement(
64148
+ "a",
64149
+ {
64150
+ className: "text-center rounded-3xl border border-solid border-gray-100 shadow-[0_2px_3px_rgba(0,0,0,0.12)] font-normal cursor-pointer text-[12px] transition-all duration-100 ease-out bg-white text-gray-700 py-3 pr-5 pl-14 relative no-underline inline-block hover:text-blue-500",
64151
+ href: "https://tinacms.org/docs/fields",
64152
+ target: "_blank",
64153
+ rel: "noopener noreferrer"
64154
+ },
64155
+ /* @__PURE__ */ React.createElement(
64156
+ Emoji,
64157
+ {
64158
+ className: "absolute left-5 top-1/2 origin-center -translate-y-1/2 transition-all duration-100 ease-out",
64159
+ style: { fontSize: 24 }
64160
+ },
64161
+ "📖"
64162
+ ),
64163
+ " ",
64164
+ "Field Setup Guide"
64165
+ ))
64166
+ );
64167
+ const FormKeyBindings = ({ onSubmit }) => {
64168
+ useEffect(() => {
64169
+ const handleKeyDown = (e3) => {
64170
+ if ((e3.metaKey || e3.ctrlKey) && e3.key === "s") {
64171
+ e3.preventDefault();
64172
+ onSubmit();
64173
+ }
64174
+ };
64175
+ window.addEventListener("keydown", handleKeyDown);
64176
+ return () => window.removeEventListener("keydown", handleKeyDown);
64177
+ }, [onSubmit]);
64178
+ return null;
64179
+ };
64180
+ const FormBuilder = ({
64181
+ form,
64182
+ onPristineChange,
64183
+ ...rest
64184
+ }) => {
64185
+ const cms = useCMS$1();
64186
+ const hideFooter = !!rest.hideFooter;
64187
+ const [createBranchModalOpen, setCreateBranchModalOpen] = React.useState(false);
64188
+ const tinaForm = form.tinaForm;
64189
+ const finalForm = form.tinaForm.finalForm;
64190
+ React.useEffect(() => {
64191
+ var _a2;
64192
+ const collection = cms.api.tina.schema.getCollectionByFullPath(
64193
+ tinaForm.path
64194
+ );
64195
+ if ((_a2 = collection == null ? void 0 : collection.ui) == null ? void 0 : _a2.beforeSubmit) {
64196
+ tinaForm.beforeSubmit = (values) => collection.ui.beforeSubmit({ cms, form: tinaForm, values });
64197
+ } else {
64198
+ tinaForm.beforeSubmit = void 0;
64199
+ }
64200
+ }, [tinaForm.path]);
64201
+ const moveArrayItem = React.useCallback(
64202
+ (result) => {
64203
+ if (!result.destination || !finalForm)
64204
+ return;
64205
+ const name = result.type;
64206
+ finalForm.mutators.move(
64207
+ name,
64208
+ result.source.index,
64209
+ result.destination.index
64210
+ );
64211
+ },
64212
+ [tinaForm]
64213
+ );
64214
+ React.useEffect(() => {
64215
+ const unsubscribe = finalForm.subscribe(
64216
+ ({ pristine }) => {
64217
+ if (onPristineChange) {
64218
+ onPristineChange(pristine);
64219
+ }
64220
+ },
64221
+ { pristine: true }
64222
+ );
64223
+ return () => {
64224
+ unsubscribe();
64225
+ };
64226
+ }, [finalForm]);
64227
+ const fieldGroup = tinaForm.getActiveField(form.activeFieldName);
64228
+ return /* @__PURE__ */ React.createElement(
64229
+ Form$1,
64230
+ {
64231
+ key: tinaForm.id,
64232
+ form: tinaForm.finalForm,
64233
+ onSubmit: tinaForm.onSubmit
64234
+ },
64235
+ ({
64236
+ handleSubmit,
64237
+ pristine,
64238
+ invalid,
64239
+ submitting,
64240
+ dirtySinceLastSubmit,
64241
+ hasValidationErrors
64242
+ }) => {
64243
+ const usingProtectedBranch = cms.api.tina.usingProtectedBranch();
64244
+ const canSubmit = !pristine && !submitting && !hasValidationErrors && !(invalid && !dirtySinceLastSubmit);
64245
+ const safeSubmit = async () => {
64246
+ if (canSubmit) {
64247
+ await handleSubmit();
64248
+ }
64249
+ };
64250
+ const safeHandleSubmit = async () => {
64251
+ if (usingProtectedBranch) {
64252
+ setCreateBranchModalOpen(true);
64253
+ } else {
64254
+ safeSubmit();
64255
+ }
64256
+ };
64257
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, createBranchModalOpen && /* @__PURE__ */ React.createElement(
64258
+ CreateBranchModal,
64259
+ {
64260
+ safeSubmit,
64261
+ crudType: tinaForm.crudType,
64262
+ path: tinaForm.path,
64263
+ values: tinaForm.values,
64264
+ close: () => setCreateBranchModalOpen(false)
64265
+ }
64266
+ ), /* @__PURE__ */ React.createElement(DragDropContext, { onDragEnd: moveArrayItem }, /* @__PURE__ */ React.createElement(FormKeyBindings, { onSubmit: safeHandleSubmit }), /* @__PURE__ */ React.createElement(FormPortalProvider, null, /* @__PURE__ */ React.createElement(FormWrapper, { id: tinaForm.id }, (tinaForm == null ? void 0 : tinaForm.fields.length) ? /* @__PURE__ */ React.createElement(
64267
+ FieldsBuilder,
64268
+ {
64269
+ form: tinaForm,
64270
+ activeFieldName: form.activeFieldName,
64271
+ fields: fieldGroup.fields
64272
+ }
64273
+ ) : /* @__PURE__ */ React.createElement(NoFieldsPlaceholder, null))), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: "relative flex-none w-full h-16 px-6 bg-white border-t border-gray-100 flex items-center justify-end" }, /* @__PURE__ */ React.createElement("div", { className: "flex-1 w-full justify-end gap-2 flex items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React.createElement(
64274
+ ResetForm,
64275
+ {
64276
+ pristine,
64277
+ reset: async () => {
64278
+ finalForm.reset();
64279
+ await tinaForm.reset();
64280
+ }
64281
+ },
64282
+ tinaForm.buttons.reset
64283
+ ), /* @__PURE__ */ React.createElement(
64284
+ Button$1,
64285
+ {
64286
+ onClick: safeHandleSubmit,
64287
+ disabled: !canSubmit,
64288
+ busy: submitting,
64289
+ variant: "primary"
64290
+ },
64291
+ submitting && /* @__PURE__ */ React.createElement(LoadingDots, null),
64292
+ !submitting && tinaForm.buttons.save
64293
+ ), tinaForm.actions.length > 0 && /* @__PURE__ */ React.createElement(
64294
+ FormActionMenu,
64295
+ {
64296
+ form: tinaForm,
64297
+ actions: tinaForm.actions
64298
+ }
64299
+ )))));
64300
+ }
64301
+ );
64302
+ };
64303
+ const FormStatus = ({ pristine }) => {
64304
+ const pristineClass = pristine ? "text-green-500" : "text-red-500";
64305
+ return /* @__PURE__ */ React.createElement(FaCircle, { className: cn("h-3", pristineClass) });
64306
+ };
64307
+ const FormWrapper = ({
64308
+ id: id2,
64309
+ children
64310
+ }) => {
64311
+ return /* @__PURE__ */ React.createElement(
64312
+ "div",
64313
+ {
64314
+ "data-test": `form:${id2 == null ? void 0 : id2.replace(/\\/g, "/")}`,
64315
+ className: "h-full overflow-y-auto max-h-full bg-gray-50"
64316
+ },
64317
+ /* @__PURE__ */ React.createElement("div", { className: "py-5 px-6" }, children)
64318
+ );
64319
+ };
64320
+ const Emoji = ({ className = "", ...props }) => /* @__PURE__ */ React.createElement(
64321
+ "span",
64322
+ {
64323
+ className: `text-[40px] leading-none inline-block ${className}`,
64324
+ ...props
64325
+ }
64326
+ );
64327
+ const CreateBranchModel = ({
64328
+ close: close2,
64329
+ safeSubmit,
64330
+ relativePath: relativePath2,
64331
+ values,
64332
+ crudType
64333
+ }) => /* @__PURE__ */ React.createElement(
64334
+ CreateBranchModal,
64335
+ {
64336
+ close: close2,
64337
+ safeSubmit,
64338
+ path: relativePath2,
64339
+ values,
64340
+ crudType
64341
+ }
64342
+ );
64323
64343
  const NestedForm = (props) => {
64324
64344
  const FormPortal = useFormPortal();
64325
64345
  const id2 = React__default.useMemo(() => uuid(), [props.id, props.initialValues]);
@@ -121066,7 +121086,7 @@ const CollectionListPage = () => {
121066
121086
  },
121067
121087
  close: () => setFolderModalOpen(false)
121068
121088
  }
121069
- ), /* @__PURE__ */ React__default.createElement(PageHeader, null, /* @__PURE__ */ React__default.createElement("div", { className: "w-full" }, /* @__PURE__ */ React__default.createElement("h3", { className: "font-sans text-2xl text-tina-orange" }, collection.label ? collection.label : collection.name), /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col lg:flex-row justify-between lg:items-end pt-2" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col md:flex-row gap-2 md:gap-4 items-baseline" }, (fields == null ? void 0 : fields.length) > 0 && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, !search && /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col gap-2 items-start w-full md:w-auto" }, /* @__PURE__ */ React__default.createElement(
121089
+ ), /* @__PURE__ */ React__default.createElement(PageHeader, null, /* @__PURE__ */ React__default.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, /* @__PURE__ */ React__default.createElement("h3", { className: "font-sans text-2xl text-tina-orange" }, collection.label ? collection.label : collection.name), /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col lg:flex-row justify-between lg:items-end pt-2" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col md:flex-row gap-2 md:gap-4 items-baseline" }, (fields == null ? void 0 : fields.length) > 0 && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, !search && /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col gap-2 items-start w-full md:w-auto" }, /* @__PURE__ */ React__default.createElement(
121070
121090
  "label",
121071
121091
  {
121072
121092
  htmlFor: "sort",