tinacms 2.5.1 → 2.6.0

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/client.js CHANGED
@@ -1,10 +1,7 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("fetch-ponyfill")) : typeof define === "function" && define.amd ? define(["exports", "fetch-ponyfill"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP));
3
- })(this, function(exports2, fetchPonyfill) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}));
3
+ })(this, function(exports2) {
4
4
  "use strict";
5
- const { fetch: fetchPonyfillFN, Headers: HeadersPonyfill } = fetchPonyfill();
6
- const fetchDefined = typeof fetch === "undefined" ? fetchPonyfillFN : fetch;
7
- const HeadersDefined = typeof Headers === "undefined" ? HeadersPonyfill : Headers;
8
5
  const TINA_HOST = "content.tinajs.io";
9
6
  class TinaClient {
10
7
  constructor({
@@ -39,7 +36,7 @@
39
36
  var _a;
40
37
  await this.init();
41
38
  const errorPolicyDefined = errorPolicy || this.errorPolicy;
42
- const headers = new HeadersDefined();
39
+ const headers = new Headers();
43
40
  if (this.readonlyToken) {
44
41
  headers.append("X-API-KEY", this.readonlyToken);
45
42
  }
@@ -72,7 +69,7 @@
72
69
  return value;
73
70
  }
74
71
  }
75
- const res = await fetchDefined(url, optionsObject);
72
+ const res = await fetch(url, optionsObject);
76
73
  if (!res.ok) {
77
74
  let additionalInfo = "";
78
75
  if (res.status === 401) {
package/dist/client.mjs CHANGED
@@ -1,7 +1,3 @@
1
- import fetchPonyfill from "fetch-ponyfill";
2
- const { fetch: fetchPonyfillFN, Headers: HeadersPonyfill } = fetchPonyfill();
3
- const fetchDefined = typeof fetch === "undefined" ? fetchPonyfillFN : fetch;
4
- const HeadersDefined = typeof Headers === "undefined" ? HeadersPonyfill : Headers;
5
1
  const TINA_HOST = "content.tinajs.io";
6
2
  class TinaClient {
7
3
  constructor({
@@ -36,7 +32,7 @@ class TinaClient {
36
32
  var _a;
37
33
  await this.init();
38
34
  const errorPolicyDefined = errorPolicy || this.errorPolicy;
39
- const headers = new HeadersDefined();
35
+ const headers = new Headers();
40
36
  if (this.readonlyToken) {
41
37
  headers.append("X-API-KEY", this.readonlyToken);
42
38
  }
@@ -69,7 +65,7 @@ class TinaClient {
69
65
  return value;
70
66
  }
71
67
  }
72
- const res = await fetchDefined(url, optionsObject);
68
+ const res = await fetch(url, optionsObject);
73
69
  if (!res.ok) {
74
70
  let additionalInfo = "";
75
71
  if (res.status === 401) {
package/dist/index.js CHANGED
@@ -3830,7 +3830,7 @@ flowchart TD
3830
3830
  function _objectWithoutProperties(source, excluded) {
3831
3831
  if (source == null)
3832
3832
  return {};
3833
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
3833
+ var target = _objectWithoutPropertiesLoose(source, excluded);
3834
3834
  var key, i;
3835
3835
  if (Object.getOwnPropertySymbols) {
3836
3836
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -3845,7 +3845,7 @@ flowchart TD
3845
3845
  }
3846
3846
  return target;
3847
3847
  }
3848
- function _objectWithoutPropertiesLoose$1(source, excluded) {
3848
+ function _objectWithoutPropertiesLoose(source, excluded) {
3849
3849
  if (source == null)
3850
3850
  return {};
3851
3851
  var target = {};
@@ -4935,7 +4935,28 @@ flowchart TD
4935
4935
  onChange,
4936
4936
  value,
4937
4937
  step
4938
- }) => /* @__PURE__ */ React__namespace.createElement(Input, { type: "number", step, value, onChange });
4938
+ }) => /* @__PURE__ */ React__namespace.createElement(
4939
+ Input,
4940
+ {
4941
+ type: "number",
4942
+ step,
4943
+ value,
4944
+ onChange: (event) => {
4945
+ const inputValue = event.target.value;
4946
+ const newValue = inputValue === "" ? void 0 : inputValue;
4947
+ if (onChange) {
4948
+ const syntheticEvent = {
4949
+ ...event,
4950
+ target: {
4951
+ ...event.target,
4952
+ value: newValue
4953
+ }
4954
+ };
4955
+ onChange(syntheticEvent);
4956
+ }
4957
+ }
4958
+ }
4959
+ );
4939
4960
  function useCMS() {
4940
4961
  return useCMS$1();
4941
4962
  }
@@ -7188,244 +7209,65 @@ flowchart TD
7188
7209
  str = "0" + str;
7189
7210
  return str;
7190
7211
  }
7191
- function _inheritsLoose(subClass, superClass) {
7192
- subClass.prototype = Object.create(superClass.prototype);
7193
- subClass.prototype.constructor = subClass;
7194
- _setPrototypeOf(subClass, superClass);
7195
- }
7196
- function _setPrototypeOf(o, p) {
7197
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
7198
- o2.__proto__ = p2;
7199
- return o2;
7200
- };
7201
- return _setPrototypeOf(o, p);
7202
- }
7203
- function _objectWithoutPropertiesLoose(source, excluded) {
7204
- if (source == null)
7205
- return {};
7206
- var target = {};
7207
- var sourceKeys = Object.keys(source);
7208
- var key, i;
7209
- for (i = 0; i < sourceKeys.length; i++) {
7210
- key = sourceKeys[i];
7211
- if (excluded.indexOf(key) >= 0)
7212
- continue;
7213
- target[key] = source[key];
7214
- }
7215
- return target;
7216
- }
7217
- function _assertThisInitialized(self2) {
7218
- if (self2 === void 0) {
7219
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
7220
- }
7221
- return self2;
7222
- }
7223
- function isNodeFound(current, componentNode, ignoreClass) {
7224
- if (current === componentNode) {
7225
- return true;
7226
- }
7227
- if (current.correspondingElement) {
7228
- return current.correspondingElement.classList.contains(ignoreClass);
7212
+ var useClickAway$1 = {};
7213
+ var util = {};
7214
+ Object.defineProperty(util, "__esModule", { value: true });
7215
+ util.isNavigator = util.isBrowser = util.off = util.on = util.noop = void 0;
7216
+ var noop = function() {
7217
+ };
7218
+ util.noop = noop;
7219
+ function on(obj) {
7220
+ var args = [];
7221
+ for (var _i = 1; _i < arguments.length; _i++) {
7222
+ args[_i - 1] = arguments[_i];
7229
7223
  }
7230
- return current.classList.contains(ignoreClass);
7231
- }
7232
- function findHighest(current, componentNode, ignoreClass) {
7233
- if (current === componentNode) {
7234
- return true;
7224
+ if (obj && obj.addEventListener) {
7225
+ obj.addEventListener.apply(obj, args);
7235
7226
  }
7236
- while (current.parentNode || current.host) {
7237
- if (current.parentNode && isNodeFound(current, componentNode, ignoreClass)) {
7238
- return true;
7239
- }
7240
- current = current.parentNode || current.host;
7241
- }
7242
- return current;
7243
- }
7244
- function clickedScrollbar(evt) {
7245
- return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;
7246
7227
  }
7247
- var testPassiveEventSupport = function testPassiveEventSupport2() {
7248
- if (typeof window === "undefined" || typeof window.addEventListener !== "function") {
7249
- return;
7228
+ util.on = on;
7229
+ function off(obj) {
7230
+ var args = [];
7231
+ for (var _i = 1; _i < arguments.length; _i++) {
7232
+ args[_i - 1] = arguments[_i];
7250
7233
  }
7251
- var passive = false;
7252
- var options = Object.defineProperty({}, "passive", {
7253
- get: function get2() {
7254
- passive = true;
7255
- }
7256
- });
7257
- var noop = function noop2() {
7258
- };
7259
- window.addEventListener("testPassiveEventSupport", noop, options);
7260
- window.removeEventListener("testPassiveEventSupport", noop, options);
7261
- return passive;
7262
- };
7263
- function autoInc(seed) {
7264
- if (seed === void 0) {
7265
- seed = 0;
7234
+ if (obj && obj.removeEventListener) {
7235
+ obj.removeEventListener.apply(obj, args);
7266
7236
  }
7267
- return function() {
7268
- return ++seed;
7269
- };
7270
7237
  }
7271
- var uid = autoInc();
7272
- var passiveEventSupport;
7273
- var handlersMap = {};
7274
- var enabledInstances = {};
7275
- var touchEvents = ["touchstart", "touchmove"];
7276
- var IGNORE_CLASS_NAME = "ignore-react-onclickoutside";
7277
- function getEventHandlerOptions(instance, eventName) {
7278
- var handlerOptions = {};
7279
- var isTouchEvent = touchEvents.indexOf(eventName) !== -1;
7280
- if (isTouchEvent && passiveEventSupport) {
7281
- handlerOptions.passive = !instance.props.preventDefault;
7282
- }
7283
- return handlerOptions;
7284
- }
7285
- function onClickOutsideHOC(WrappedComponent, config) {
7286
- var _class, _temp;
7287
- var componentName = WrappedComponent.displayName || WrappedComponent.name || "Component";
7288
- return _temp = _class = /* @__PURE__ */ function(_Component) {
7289
- _inheritsLoose(onClickOutside, _Component);
7290
- function onClickOutside(props) {
7291
- var _this;
7292
- _this = _Component.call(this, props) || this;
7293
- _this.__outsideClickHandler = function(event) {
7294
- if (typeof _this.__clickOutsideHandlerProp === "function") {
7295
- _this.__clickOutsideHandlerProp(event);
7296
- return;
7297
- }
7298
- var instance = _this.getInstance();
7299
- if (typeof instance.props.handleClickOutside === "function") {
7300
- instance.props.handleClickOutside(event);
7301
- return;
7302
- }
7303
- if (typeof instance.handleClickOutside === "function") {
7304
- instance.handleClickOutside(event);
7305
- return;
7306
- }
7307
- throw new Error("WrappedComponent: " + componentName + " lacks a handleClickOutside(event) function for processing outside click events.");
7308
- };
7309
- _this.__getComponentNode = function() {
7310
- var instance = _this.getInstance();
7311
- if (config && typeof config.setClickOutsideRef === "function") {
7312
- return config.setClickOutsideRef()(instance);
7313
- }
7314
- if (typeof instance.setClickOutsideRef === "function") {
7315
- return instance.setClickOutsideRef();
7316
- }
7317
- return reactDom.findDOMNode(instance);
7318
- };
7319
- _this.enableOnClickOutside = function() {
7320
- if (typeof document === "undefined" || enabledInstances[_this._uid]) {
7321
- return;
7322
- }
7323
- if (typeof passiveEventSupport === "undefined") {
7324
- passiveEventSupport = testPassiveEventSupport();
7325
- }
7326
- enabledInstances[_this._uid] = true;
7327
- var events = _this.props.eventTypes;
7328
- if (!events.forEach) {
7329
- events = [events];
7330
- }
7331
- handlersMap[_this._uid] = function(event) {
7332
- if (_this.componentNode === null)
7333
- return;
7334
- if (_this.initTimeStamp > event.timeStamp)
7335
- return;
7336
- if (_this.props.preventDefault) {
7337
- event.preventDefault();
7338
- }
7339
- if (_this.props.stopPropagation) {
7340
- event.stopPropagation();
7341
- }
7342
- if (_this.props.excludeScrollbar && clickedScrollbar(event))
7343
- return;
7344
- var current = event.composed && event.composedPath && event.composedPath().shift() || event.target;
7345
- if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {
7346
- return;
7347
- }
7348
- _this.__outsideClickHandler(event);
7349
- };
7350
- events.forEach(function(eventName) {
7351
- document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7352
- });
7353
- };
7354
- _this.disableOnClickOutside = function() {
7355
- delete enabledInstances[_this._uid];
7356
- var fn = handlersMap[_this._uid];
7357
- if (fn && typeof document !== "undefined") {
7358
- var events = _this.props.eventTypes;
7359
- if (!events.forEach) {
7360
- events = [events];
7361
- }
7362
- events.forEach(function(eventName) {
7363
- return document.removeEventListener(eventName, fn, getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7364
- });
7365
- delete handlersMap[_this._uid];
7366
- }
7367
- };
7368
- _this.getRef = function(ref) {
7369
- return _this.instanceRef = ref;
7370
- };
7371
- _this._uid = uid();
7372
- _this.initTimeStamp = performance.now();
7373
- return _this;
7374
- }
7375
- var _proto = onClickOutside.prototype;
7376
- _proto.getInstance = function getInstance() {
7377
- if (WrappedComponent.prototype && !WrappedComponent.prototype.isReactComponent) {
7378
- return this;
7379
- }
7380
- var ref = this.instanceRef;
7381
- return ref.getInstance ? ref.getInstance() : ref;
7382
- };
7383
- _proto.componentDidMount = function componentDidMount() {
7384
- if (typeof document === "undefined" || !document.createElement) {
7385
- return;
7386
- }
7387
- var instance = this.getInstance();
7388
- if (config && typeof config.handleClickOutside === "function") {
7389
- this.__clickOutsideHandlerProp = config.handleClickOutside(instance);
7390
- if (typeof this.__clickOutsideHandlerProp !== "function") {
7391
- throw new Error("WrappedComponent: " + componentName + " lacks a function for processing outside click events specified by the handleClickOutside config option.");
7392
- }
7393
- }
7394
- this.componentNode = this.__getComponentNode();
7395
- if (this.props.disableOnClickOutside)
7396
- return;
7397
- this.enableOnClickOutside();
7398
- };
7399
- _proto.componentDidUpdate = function componentDidUpdate() {
7400
- this.componentNode = this.__getComponentNode();
7238
+ util.off = off;
7239
+ util.isBrowser = typeof window !== "undefined";
7240
+ util.isNavigator = typeof navigator !== "undefined";
7241
+ Object.defineProperty(useClickAway$1, "__esModule", { value: true });
7242
+ var react_1 = React;
7243
+ var util_1 = util;
7244
+ var defaultEvents = ["mousedown", "touchstart"];
7245
+ var useClickAway = function(ref, onClickAway, events) {
7246
+ if (events === void 0) {
7247
+ events = defaultEvents;
7248
+ }
7249
+ var savedCallback = react_1.useRef(onClickAway);
7250
+ react_1.useEffect(function() {
7251
+ savedCallback.current = onClickAway;
7252
+ }, [onClickAway]);
7253
+ react_1.useEffect(function() {
7254
+ var handler = function(event) {
7255
+ var el = ref.current;
7256
+ el && !el.contains(event.target) && savedCallback.current(event);
7401
7257
  };
7402
- _proto.componentWillUnmount = function componentWillUnmount() {
7403
- this.disableOnClickOutside();
7404
- };
7405
- _proto.render = function render() {
7406
- var _this$props = this.props;
7407
- _this$props.excludeScrollbar;
7408
- var props = _objectWithoutPropertiesLoose(_this$props, ["excludeScrollbar"]);
7409
- if (WrappedComponent.prototype && WrappedComponent.prototype.isReactComponent) {
7410
- props.ref = this.getRef;
7411
- } else {
7412
- props.wrappedRef = this.getRef;
7258
+ for (var _i = 0, events_1 = events; _i < events_1.length; _i++) {
7259
+ var eventName = events_1[_i];
7260
+ util_1.on(document, eventName, handler);
7261
+ }
7262
+ return function() {
7263
+ for (var _i2 = 0, events_2 = events; _i2 < events_2.length; _i2++) {
7264
+ var eventName2 = events_2[_i2];
7265
+ util_1.off(document, eventName2, handler);
7413
7266
  }
7414
- props.disableOnClickOutside = this.disableOnClickOutside;
7415
- props.enableOnClickOutside = this.enableOnClickOutside;
7416
- return React.createElement(WrappedComponent, props);
7417
7267
  };
7418
- return onClickOutside;
7419
- }(React.Component), _class.displayName = "OnClickOutside(" + componentName + ")", _class.defaultProps = {
7420
- eventTypes: ["mousedown", "touchstart"],
7421
- excludeScrollbar: config && config.excludeScrollbar || false,
7422
- outsideClickIgnoreClass: IGNORE_CLASS_NAME,
7423
- preventDefault: false,
7424
- stopPropagation: false
7425
- }, _class.getClass = function() {
7426
- return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;
7427
- }, _temp;
7428
- }
7268
+ }, [events, ref]);
7269
+ };
7270
+ var _default = useClickAway$1.default = useClickAway;
7429
7271
  const viewModes = {
7430
7272
  YEARS: "years",
7431
7273
  MONTHS: "months",
@@ -7954,22 +7796,13 @@ flowchart TD
7954
7796
  }
7955
7797
  con[method]("***react-datetime:" + message);
7956
7798
  }
7957
- class ClickOutBase extends React.Component {
7958
- constructor() {
7959
- super(...arguments);
7960
- __publicField(this, "container", React.createRef());
7961
- }
7962
- render() {
7963
- return /* @__PURE__ */ React.createElement("div", { className: this.props.className, ref: this.container }, this.props.children);
7964
- }
7965
- handleClickOutside(e) {
7966
- this.props.onClickOut(e);
7967
- }
7968
- setClickOutsideRef() {
7969
- return this.container.current;
7970
- }
7799
+ function ClickableWrapper({ className, onClickOut, children }) {
7800
+ const containerRef = React.useRef(null);
7801
+ _default(containerRef, (event) => {
7802
+ onClickOut(event);
7803
+ });
7804
+ return /* @__PURE__ */ React.createElement("div", { className, ref: containerRef }, children);
7971
7805
  }
7972
- const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
7973
7806
  const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
7974
7807
  const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
7975
7808
  const format$1 = (val, _name, field) => {
@@ -8012,7 +7845,10 @@ flowchart TD
8012
7845
  ReactDateTimeWithStyles,
8013
7846
  {
8014
7847
  value: input.value,
8015
- onChange: input.onChange,
7848
+ onChange: (value) => {
7849
+ const newValue = value === "" ? void 0 : value;
7850
+ input.onChange(newValue);
7851
+ },
8016
7852
  dateFormat: dateFormat || DEFAULT_DATE_DISPLAY_FORMAT,
8017
7853
  timeFormat: timeFormat || false,
8018
7854
  inputProps: { className: textFieldClasses },
@@ -10343,7 +10179,7 @@ flowchart TD
10343
10179
  "Event Log"
10344
10180
  ));
10345
10181
  };
10346
- const version = "2.5.1";
10182
+ const version = "2.6.0";
10347
10183
  const Nav = ({
10348
10184
  isLocalMode,
10349
10185
  className = "",
@@ -14749,7 +14585,12 @@ flowchart TD
14749
14585
  const [itemsShown, setItemsShown] = React.useState(11);
14750
14586
  const { overrides, templates } = useToolbarContext();
14751
14587
  const showEmbedButton = templates.length > 0;
14752
- let items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14588
+ let items2 = [];
14589
+ if (Array.isArray(overrides)) {
14590
+ items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14591
+ } else {
14592
+ items2 = (overrides == null ? void 0 : overrides.toolbar) === void 0 ? Object.values(toolbarItems) : overrides.toolbar.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14593
+ }
14753
14594
  if (!showEmbedButton) {
14754
14595
  items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
14755
14596
  }
@@ -15077,6 +14918,9 @@ flowchart TD
15077
14918
  if (typeof string !== "string") {
15078
14919
  return false;
15079
14920
  }
14921
+ if (string.startsWith("#")) {
14922
+ return true;
14923
+ }
15080
14924
  const generalMatch = string.match(protocolAndDomainRE);
15081
14925
  const emailLinkMatch = string.match(emailLintRE);
15082
14926
  const localUrlMatch = string.match(localUrlRE);
@@ -15098,12 +14942,12 @@ flowchart TD
15098
14942
  }
15099
14943
  return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
15100
14944
  };
15101
- const RichEditor = (props) => {
14945
+ const RichEditor = ({ input, tinaForm, field }) => {
15102
14946
  var _a;
15103
14947
  const initialValue = React.useMemo(
15104
14948
  () => {
15105
14949
  var _a2, _b;
15106
- return ((_b = (_a2 = props.input.value) == null ? void 0 : _a2.children) == null ? void 0 : _b.length) ? props.input.value.children.map(helpers.normalize) : [{ type: "p", children: [{ type: "text", text: "" }] }];
14950
+ return ((_b = (_a2 = input.value) == null ? void 0 : _a2.children) == null ? void 0 : _b.length) ? input.value.children.map(helpers.normalize) : [{ type: "p", children: [{ type: "text", text: "" }] }];
15107
14951
  },
15108
14952
  []
15109
14953
  );
@@ -15131,7 +14975,7 @@ flowchart TD
15131
14975
  ),
15132
14976
  []
15133
14977
  );
15134
- const tempId = [props.tinaForm.id, props.input.name].join(".");
14978
+ const tempId = [tinaForm.id, input.name].join(".");
15135
14979
  const id = React.useMemo(() => uuid() + tempId, [tempId]);
15136
14980
  const ref = React.useRef(null);
15137
14981
  React.useEffect(() => {
@@ -15141,13 +14985,13 @@ flowchart TD
15141
14985
  const plateElement = (_a2 = ref.current) == null ? void 0 : _a2.querySelector(
15142
14986
  '[role="textbox"]'
15143
14987
  );
15144
- if (props.field.experimental_focusIntent && plateElement) {
14988
+ if (field.experimental_focusIntent && plateElement) {
15145
14989
  if (plateElement)
15146
14990
  plateElement.focus();
15147
14991
  }
15148
14992
  }, 100);
15149
14993
  }
15150
- }, [props.field.experimental_focusIntent, ref]);
14994
+ }, [field.experimental_focusIntent, ref]);
15151
14995
  return /* @__PURE__ */ React.createElement("div", { ref }, /* @__PURE__ */ React.createElement(
15152
14996
  plateCommon.Plate,
15153
14997
  {
@@ -15155,7 +14999,7 @@ flowchart TD
15155
14999
  initialValue,
15156
15000
  plugins: plugins$2,
15157
15001
  onChange: (value) => {
15158
- props.input.onChange({
15002
+ input.onChange({
15159
15003
  type: "root",
15160
15004
  children: value
15161
15005
  });
@@ -15164,12 +15008,12 @@ flowchart TD
15164
15008
  /* @__PURE__ */ React.createElement(TooltipProvider, null, /* @__PURE__ */ React.createElement(
15165
15009
  ToolbarProvider,
15166
15010
  {
15167
- tinaForm: props.tinaForm,
15168
- templates: props.field.templates,
15169
- overrides: (_a = props.field) == null ? void 0 : _a.toolbarOverride
15011
+ tinaForm,
15012
+ templates: field.templates,
15013
+ overrides: (field == null ? void 0 : field.toolbarOverride) ? field.toolbarOverride : field.overrides
15170
15014
  },
15171
15015
  /* @__PURE__ */ React.createElement(FixedToolbar, null, /* @__PURE__ */ React.createElement(FixedToolbarButtons, null)),
15172
- /* @__PURE__ */ React.createElement(FloatingToolbar, null, /* @__PURE__ */ React.createElement(FloatingToolbarButtons, null))
15016
+ ((_a = field == null ? void 0 : field.overrides) == null ? void 0 : _a.showFloatingToolbar) !== false ? /* @__PURE__ */ React.createElement(FloatingToolbar, null, /* @__PURE__ */ React.createElement(FloatingToolbarButtons, null)) : null
15173
15017
  ), /* @__PURE__ */ React.createElement(Editor, null))
15174
15018
  ));
15175
15019
  };
package/dist/index.mjs CHANGED
@@ -6,8 +6,8 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  import { z } from "zod";
8
8
  import * as React from "react";
9
- import React__default, { useState, useCallback, useEffect, useRef, createContext, forwardRef, useContext, useMemo, startTransition, createElement, Component } from "react";
10
- import { createPortal, findDOMNode } from "react-dom";
9
+ import React__default, { useState, useCallback, useEffect, useRef, createContext, forwardRef, useContext, useMemo, startTransition } from "react";
10
+ import { createPortal } from "react-dom";
11
11
  import { withRef, cn as cn$1, withVariants, withProps, withCn, createPrimitiveElement } from "@udecode/cn";
12
12
  import { toggleList, ELEMENT_UL, ELEMENT_OL, ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_PARAGRAPH, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_LI, ELEMENT_LINK, MARK_CODE, MARK_UNDERLINE, MARK_STRIKETHROUGH, MARK_ITALIC, MARK_BOLD, ELEMENT_HR, ELEMENT_TABLE, ELEMENT_TR, ELEMENT_TD, ELEMENT_TH, unwrapList, ELEMENT_TODO_LI, createTrailingBlockPlugin, createAutoformatPlugin, createExitBreakPlugin, KEYS_HEADING, createResetNodePlugin, createHeadingPlugin, createParagraphPlugin, createBlockquotePlugin, createBoldPlugin, createItalicPlugin, createUnderlinePlugin, createCodePlugin, createListPlugin, createIndentListPlugin, createHorizontalRulePlugin, createNodeIdPlugin, createTablePlugin, getListItemEntry, useListToolbarButtonState, useListToolbarButton } from "@udecode/plate";
13
13
  import { PlateElement, isCollapsed, findNodePath, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, getPointBefore, setNodes, isElement, PlateLeaf, createPluginFactory, useComposedRef, useEditorRef, createPointRef, insertText, moveSelection, toggleNodeType, useElement, useRemoveNodeButton, useEditorSelector, isSelectionExpanded, withHOC, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, getNodeEntries, useEditorState, collapseSelection, useMarkToolbarButtonState, useMarkToolbarButton, insertEmptyElement, usePlateSelectors, useEventEditorSelectors, PortalBody, useFormInputProps, createPlugins, Plate } from "@udecode/plate-common";
@@ -1358,8 +1358,8 @@ const ListElementVariants = withVariants(PlateElement, listVariants, [
1358
1358
  ]);
1359
1359
  const ListElement = withRef(
1360
1360
  ({ children, variant = "ul", ...props }, ref) => {
1361
- const Component2 = variant;
1362
- return /* @__PURE__ */ React__default.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React__default.createElement(Component2, null, children));
1361
+ const Component = variant;
1362
+ return /* @__PURE__ */ React__default.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React__default.createElement(Component, null, children));
1363
1363
  }
1364
1364
  );
1365
1365
  const ELEMENT_MERMAID = "mermaid";
@@ -3679,7 +3679,7 @@ function TinaForm({ form, children }) {
3679
3679
  }));
3680
3680
  }
3681
3681
  function TinaField({
3682
- Component: Component2,
3682
+ Component,
3683
3683
  children,
3684
3684
  ...fieldProps
3685
3685
  }) {
@@ -3687,7 +3687,7 @@ function TinaField({
3687
3687
  if (!isEditing)
3688
3688
  return children || null;
3689
3689
  return /* @__PURE__ */ React.createElement(Field, { ...fieldProps }, ({ input, meta }) => {
3690
- return /* @__PURE__ */ React.createElement(Component2, { input, meta, ...fieldProps });
3690
+ return /* @__PURE__ */ React.createElement(Component, { input, meta, ...fieldProps });
3691
3691
  });
3692
3692
  }
3693
3693
  TinaField.propTypes = {
@@ -3857,7 +3857,7 @@ var _excluded = ["attr", "size", "title"];
3857
3857
  function _objectWithoutProperties(source, excluded) {
3858
3858
  if (source == null)
3859
3859
  return {};
3860
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
3860
+ var target = _objectWithoutPropertiesLoose(source, excluded);
3861
3861
  var key, i;
3862
3862
  if (Object.getOwnPropertySymbols) {
3863
3863
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -3872,7 +3872,7 @@ function _objectWithoutProperties(source, excluded) {
3872
3872
  }
3873
3873
  return target;
3874
3874
  }
3875
- function _objectWithoutPropertiesLoose$1(source, excluded) {
3875
+ function _objectWithoutPropertiesLoose(source, excluded) {
3876
3876
  if (source == null)
3877
3877
  return {};
3878
3878
  var target = {};
@@ -4962,7 +4962,28 @@ const NumberInput = ({
4962
4962
  onChange,
4963
4963
  value,
4964
4964
  step
4965
- }) => /* @__PURE__ */ React.createElement(Input, { type: "number", step, value, onChange });
4965
+ }) => /* @__PURE__ */ React.createElement(
4966
+ Input,
4967
+ {
4968
+ type: "number",
4969
+ step,
4970
+ value,
4971
+ onChange: (event) => {
4972
+ const inputValue = event.target.value;
4973
+ const newValue = inputValue === "" ? void 0 : inputValue;
4974
+ if (onChange) {
4975
+ const syntheticEvent = {
4976
+ ...event,
4977
+ target: {
4978
+ ...event.target,
4979
+ value: newValue
4980
+ }
4981
+ };
4982
+ onChange(syntheticEvent);
4983
+ }
4984
+ }
4985
+ }
4986
+ );
4966
4987
  function useCMS() {
4967
4988
  return useCMS$1();
4968
4989
  }
@@ -7215,244 +7236,65 @@ function pad(type, value) {
7215
7236
  str = "0" + str;
7216
7237
  return str;
7217
7238
  }
7218
- function _inheritsLoose(subClass, superClass) {
7219
- subClass.prototype = Object.create(superClass.prototype);
7220
- subClass.prototype.constructor = subClass;
7221
- _setPrototypeOf(subClass, superClass);
7222
- }
7223
- function _setPrototypeOf(o, p) {
7224
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
7225
- o2.__proto__ = p2;
7226
- return o2;
7227
- };
7228
- return _setPrototypeOf(o, p);
7229
- }
7230
- function _objectWithoutPropertiesLoose(source, excluded) {
7231
- if (source == null)
7232
- return {};
7233
- var target = {};
7234
- var sourceKeys = Object.keys(source);
7235
- var key, i;
7236
- for (i = 0; i < sourceKeys.length; i++) {
7237
- key = sourceKeys[i];
7238
- if (excluded.indexOf(key) >= 0)
7239
- continue;
7240
- target[key] = source[key];
7241
- }
7242
- return target;
7243
- }
7244
- function _assertThisInitialized(self) {
7245
- if (self === void 0) {
7246
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
7247
- }
7248
- return self;
7249
- }
7250
- function isNodeFound(current, componentNode, ignoreClass) {
7251
- if (current === componentNode) {
7252
- return true;
7239
+ var useClickAway$1 = {};
7240
+ var util = {};
7241
+ Object.defineProperty(util, "__esModule", { value: true });
7242
+ util.isNavigator = util.isBrowser = util.off = util.on = util.noop = void 0;
7243
+ var noop = function() {
7244
+ };
7245
+ util.noop = noop;
7246
+ function on(obj) {
7247
+ var args = [];
7248
+ for (var _i = 1; _i < arguments.length; _i++) {
7249
+ args[_i - 1] = arguments[_i];
7253
7250
  }
7254
- if (current.correspondingElement) {
7255
- return current.correspondingElement.classList.contains(ignoreClass);
7251
+ if (obj && obj.addEventListener) {
7252
+ obj.addEventListener.apply(obj, args);
7256
7253
  }
7257
- return current.classList.contains(ignoreClass);
7258
7254
  }
7259
- function findHighest(current, componentNode, ignoreClass) {
7260
- if (current === componentNode) {
7261
- return true;
7255
+ util.on = on;
7256
+ function off(obj) {
7257
+ var args = [];
7258
+ for (var _i = 1; _i < arguments.length; _i++) {
7259
+ args[_i - 1] = arguments[_i];
7262
7260
  }
7263
- while (current.parentNode || current.host) {
7264
- if (current.parentNode && isNodeFound(current, componentNode, ignoreClass)) {
7265
- return true;
7266
- }
7267
- current = current.parentNode || current.host;
7261
+ if (obj && obj.removeEventListener) {
7262
+ obj.removeEventListener.apply(obj, args);
7268
7263
  }
7269
- return current;
7270
7264
  }
7271
- function clickedScrollbar(evt) {
7272
- return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;
7273
- }
7274
- var testPassiveEventSupport = function testPassiveEventSupport2() {
7275
- if (typeof window === "undefined" || typeof window.addEventListener !== "function") {
7276
- return;
7277
- }
7278
- var passive = false;
7279
- var options = Object.defineProperty({}, "passive", {
7280
- get: function get2() {
7281
- passive = true;
7282
- }
7283
- });
7284
- var noop = function noop2() {
7285
- };
7286
- window.addEventListener("testPassiveEventSupport", noop, options);
7287
- window.removeEventListener("testPassiveEventSupport", noop, options);
7288
- return passive;
7289
- };
7290
- function autoInc(seed) {
7291
- if (seed === void 0) {
7292
- seed = 0;
7293
- }
7294
- return function() {
7295
- return ++seed;
7296
- };
7297
- }
7298
- var uid = autoInc();
7299
- var passiveEventSupport;
7300
- var handlersMap = {};
7301
- var enabledInstances = {};
7302
- var touchEvents = ["touchstart", "touchmove"];
7303
- var IGNORE_CLASS_NAME = "ignore-react-onclickoutside";
7304
- function getEventHandlerOptions(instance, eventName) {
7305
- var handlerOptions = {};
7306
- var isTouchEvent = touchEvents.indexOf(eventName) !== -1;
7307
- if (isTouchEvent && passiveEventSupport) {
7308
- handlerOptions.passive = !instance.props.preventDefault;
7309
- }
7310
- return handlerOptions;
7311
- }
7312
- function onClickOutsideHOC(WrappedComponent, config) {
7313
- var _class, _temp;
7314
- var componentName = WrappedComponent.displayName || WrappedComponent.name || "Component";
7315
- return _temp = _class = /* @__PURE__ */ function(_Component) {
7316
- _inheritsLoose(onClickOutside, _Component);
7317
- function onClickOutside(props) {
7318
- var _this;
7319
- _this = _Component.call(this, props) || this;
7320
- _this.__outsideClickHandler = function(event) {
7321
- if (typeof _this.__clickOutsideHandlerProp === "function") {
7322
- _this.__clickOutsideHandlerProp(event);
7323
- return;
7324
- }
7325
- var instance = _this.getInstance();
7326
- if (typeof instance.props.handleClickOutside === "function") {
7327
- instance.props.handleClickOutside(event);
7328
- return;
7329
- }
7330
- if (typeof instance.handleClickOutside === "function") {
7331
- instance.handleClickOutside(event);
7332
- return;
7333
- }
7334
- throw new Error("WrappedComponent: " + componentName + " lacks a handleClickOutside(event) function for processing outside click events.");
7335
- };
7336
- _this.__getComponentNode = function() {
7337
- var instance = _this.getInstance();
7338
- if (config && typeof config.setClickOutsideRef === "function") {
7339
- return config.setClickOutsideRef()(instance);
7340
- }
7341
- if (typeof instance.setClickOutsideRef === "function") {
7342
- return instance.setClickOutsideRef();
7343
- }
7344
- return findDOMNode(instance);
7345
- };
7346
- _this.enableOnClickOutside = function() {
7347
- if (typeof document === "undefined" || enabledInstances[_this._uid]) {
7348
- return;
7349
- }
7350
- if (typeof passiveEventSupport === "undefined") {
7351
- passiveEventSupport = testPassiveEventSupport();
7352
- }
7353
- enabledInstances[_this._uid] = true;
7354
- var events = _this.props.eventTypes;
7355
- if (!events.forEach) {
7356
- events = [events];
7357
- }
7358
- handlersMap[_this._uid] = function(event) {
7359
- if (_this.componentNode === null)
7360
- return;
7361
- if (_this.initTimeStamp > event.timeStamp)
7362
- return;
7363
- if (_this.props.preventDefault) {
7364
- event.preventDefault();
7365
- }
7366
- if (_this.props.stopPropagation) {
7367
- event.stopPropagation();
7368
- }
7369
- if (_this.props.excludeScrollbar && clickedScrollbar(event))
7370
- return;
7371
- var current = event.composed && event.composedPath && event.composedPath().shift() || event.target;
7372
- if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {
7373
- return;
7374
- }
7375
- _this.__outsideClickHandler(event);
7376
- };
7377
- events.forEach(function(eventName) {
7378
- document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7379
- });
7380
- };
7381
- _this.disableOnClickOutside = function() {
7382
- delete enabledInstances[_this._uid];
7383
- var fn = handlersMap[_this._uid];
7384
- if (fn && typeof document !== "undefined") {
7385
- var events = _this.props.eventTypes;
7386
- if (!events.forEach) {
7387
- events = [events];
7388
- }
7389
- events.forEach(function(eventName) {
7390
- return document.removeEventListener(eventName, fn, getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7391
- });
7392
- delete handlersMap[_this._uid];
7393
- }
7394
- };
7395
- _this.getRef = function(ref) {
7396
- return _this.instanceRef = ref;
7397
- };
7398
- _this._uid = uid();
7399
- _this.initTimeStamp = performance.now();
7400
- return _this;
7401
- }
7402
- var _proto = onClickOutside.prototype;
7403
- _proto.getInstance = function getInstance() {
7404
- if (WrappedComponent.prototype && !WrappedComponent.prototype.isReactComponent) {
7405
- return this;
7406
- }
7407
- var ref = this.instanceRef;
7408
- return ref.getInstance ? ref.getInstance() : ref;
7265
+ util.off = off;
7266
+ util.isBrowser = typeof window !== "undefined";
7267
+ util.isNavigator = typeof navigator !== "undefined";
7268
+ Object.defineProperty(useClickAway$1, "__esModule", { value: true });
7269
+ var react_1 = React__default;
7270
+ var util_1 = util;
7271
+ var defaultEvents = ["mousedown", "touchstart"];
7272
+ var useClickAway = function(ref, onClickAway, events) {
7273
+ if (events === void 0) {
7274
+ events = defaultEvents;
7275
+ }
7276
+ var savedCallback = react_1.useRef(onClickAway);
7277
+ react_1.useEffect(function() {
7278
+ savedCallback.current = onClickAway;
7279
+ }, [onClickAway]);
7280
+ react_1.useEffect(function() {
7281
+ var handler = function(event) {
7282
+ var el = ref.current;
7283
+ el && !el.contains(event.target) && savedCallback.current(event);
7409
7284
  };
7410
- _proto.componentDidMount = function componentDidMount() {
7411
- if (typeof document === "undefined" || !document.createElement) {
7412
- return;
7413
- }
7414
- var instance = this.getInstance();
7415
- if (config && typeof config.handleClickOutside === "function") {
7416
- this.__clickOutsideHandlerProp = config.handleClickOutside(instance);
7417
- if (typeof this.__clickOutsideHandlerProp !== "function") {
7418
- throw new Error("WrappedComponent: " + componentName + " lacks a function for processing outside click events specified by the handleClickOutside config option.");
7419
- }
7420
- }
7421
- this.componentNode = this.__getComponentNode();
7422
- if (this.props.disableOnClickOutside)
7423
- return;
7424
- this.enableOnClickOutside();
7425
- };
7426
- _proto.componentDidUpdate = function componentDidUpdate() {
7427
- this.componentNode = this.__getComponentNode();
7428
- };
7429
- _proto.componentWillUnmount = function componentWillUnmount() {
7430
- this.disableOnClickOutside();
7431
- };
7432
- _proto.render = function render() {
7433
- var _this$props = this.props;
7434
- _this$props.excludeScrollbar;
7435
- var props = _objectWithoutPropertiesLoose(_this$props, ["excludeScrollbar"]);
7436
- if (WrappedComponent.prototype && WrappedComponent.prototype.isReactComponent) {
7437
- props.ref = this.getRef;
7438
- } else {
7439
- props.wrappedRef = this.getRef;
7285
+ for (var _i = 0, events_1 = events; _i < events_1.length; _i++) {
7286
+ var eventName = events_1[_i];
7287
+ util_1.on(document, eventName, handler);
7288
+ }
7289
+ return function() {
7290
+ for (var _i2 = 0, events_2 = events; _i2 < events_2.length; _i2++) {
7291
+ var eventName2 = events_2[_i2];
7292
+ util_1.off(document, eventName2, handler);
7440
7293
  }
7441
- props.disableOnClickOutside = this.disableOnClickOutside;
7442
- props.enableOnClickOutside = this.enableOnClickOutside;
7443
- return createElement(WrappedComponent, props);
7444
7294
  };
7445
- return onClickOutside;
7446
- }(Component), _class.displayName = "OnClickOutside(" + componentName + ")", _class.defaultProps = {
7447
- eventTypes: ["mousedown", "touchstart"],
7448
- excludeScrollbar: config && config.excludeScrollbar || false,
7449
- outsideClickIgnoreClass: IGNORE_CLASS_NAME,
7450
- preventDefault: false,
7451
- stopPropagation: false
7452
- }, _class.getClass = function() {
7453
- return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;
7454
- }, _temp;
7455
- }
7295
+ }, [events, ref]);
7296
+ };
7297
+ var _default = useClickAway$1.default = useClickAway;
7456
7298
  const viewModes = {
7457
7299
  YEARS: "years",
7458
7300
  MONTHS: "months",
@@ -7981,22 +7823,13 @@ function log(message, method) {
7981
7823
  }
7982
7824
  con[method]("***react-datetime:" + message);
7983
7825
  }
7984
- class ClickOutBase extends React__default.Component {
7985
- constructor() {
7986
- super(...arguments);
7987
- __publicField(this, "container", React__default.createRef());
7988
- }
7989
- render() {
7990
- return /* @__PURE__ */ React__default.createElement("div", { className: this.props.className, ref: this.container }, this.props.children);
7991
- }
7992
- handleClickOutside(e) {
7993
- this.props.onClickOut(e);
7994
- }
7995
- setClickOutsideRef() {
7996
- return this.container.current;
7997
- }
7826
+ function ClickableWrapper({ className, onClickOut, children }) {
7827
+ const containerRef = useRef(null);
7828
+ _default(containerRef, (event) => {
7829
+ onClickOut(event);
7830
+ });
7831
+ return /* @__PURE__ */ React__default.createElement("div", { className, ref: containerRef }, children);
7998
7832
  }
7999
- const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
8000
7833
  const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
8001
7834
  const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
8002
7835
  const format$1 = (val, _name, field) => {
@@ -8039,7 +7872,10 @@ const DateField = wrapFieldsWithMeta(
8039
7872
  ReactDateTimeWithStyles,
8040
7873
  {
8041
7874
  value: input.value,
8042
- onChange: input.onChange,
7875
+ onChange: (value) => {
7876
+ const newValue = value === "" ? void 0 : value;
7877
+ input.onChange(newValue);
7878
+ },
8043
7879
  dateFormat: dateFormat || DEFAULT_DATE_DISPLAY_FORMAT,
8044
7880
  timeFormat: timeFormat || false,
8045
7881
  inputProps: { className: textFieldClasses },
@@ -9850,7 +9686,7 @@ class SidebarState {
9850
9686
  }
9851
9687
  }
9852
9688
  function createScreen({
9853
- Component: Component2,
9689
+ Component,
9854
9690
  props,
9855
9691
  ...options
9856
9692
  }) {
@@ -9859,7 +9695,7 @@ function createScreen({
9859
9695
  layout: "popup",
9860
9696
  ...options,
9861
9697
  Component(screenProps) {
9862
- return /* @__PURE__ */ React__default.createElement(Component2, { ...screenProps, ...props });
9698
+ return /* @__PURE__ */ React__default.createElement(Component, { ...screenProps, ...props });
9863
9699
  }
9864
9700
  };
9865
9701
  }
@@ -10370,7 +10206,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
10370
10206
  "Event Log"
10371
10207
  ));
10372
10208
  };
10373
- const version = "2.5.1";
10209
+ const version = "2.6.0";
10374
10210
  const Nav = ({
10375
10211
  isLocalMode,
10376
10212
  className = "",
@@ -13299,9 +13135,9 @@ const EllipsisIcon = ({ title }) => {
13299
13135
  ));
13300
13136
  };
13301
13137
  const Wrapper$1 = ({ inline, children }) => {
13302
- const Component2 = inline ? "span" : "div";
13138
+ const Component = inline ? "span" : "div";
13303
13139
  return /* @__PURE__ */ React__default.createElement(
13304
- Component2,
13140
+ Component,
13305
13141
  {
13306
13142
  contentEditable: false,
13307
13143
  style: { userSelect: "none" },
@@ -14089,13 +13925,13 @@ const TooltipContent = withCn(
14089
13925
  }),
14090
13926
  "z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
14091
13927
  );
14092
- function withTooltip(Component2) {
13928
+ function withTooltip(Component) {
14093
13929
  return React__default.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
14094
13930
  const [mounted, setMounted] = React__default.useState(false);
14095
13931
  React__default.useEffect(() => {
14096
13932
  setMounted(true);
14097
13933
  }, []);
14098
- const component = /* @__PURE__ */ React__default.createElement(Component2, { ref, ...props });
13934
+ const component = /* @__PURE__ */ React__default.createElement(Component, { ref, ...props });
14099
13935
  if (tooltip && mounted) {
14100
13936
  return /* @__PURE__ */ React__default.createElement(Tooltip, { ...tooltipProps }, /* @__PURE__ */ React__default.createElement(TooltipTrigger, { asChild: true }, component), /* @__PURE__ */ React__default.createElement(TooltipPortal, null, /* @__PURE__ */ React__default.createElement(TooltipContent, { ...tooltipContentProps }, tooltip)));
14101
13937
  }
@@ -14776,7 +14612,12 @@ function FixedToolbarButtons() {
14776
14612
  const [itemsShown, setItemsShown] = React__default.useState(11);
14777
14613
  const { overrides, templates } = useToolbarContext();
14778
14614
  const showEmbedButton = templates.length > 0;
14779
- let items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14615
+ let items2 = [];
14616
+ if (Array.isArray(overrides)) {
14617
+ items2 = overrides === void 0 ? Object.values(toolbarItems) : overrides.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14618
+ } else {
14619
+ items2 = (overrides == null ? void 0 : overrides.toolbar) === void 0 ? Object.values(toolbarItems) : overrides.toolbar.map((item) => toolbarItems[item]).filter((item) => item !== void 0);
14620
+ }
14780
14621
  if (!showEmbedButton) {
14781
14622
  items2 = items2.filter((item) => item.label !== toolbarItems.embed.label);
14782
14623
  }
@@ -15104,6 +14945,9 @@ const isUrl = (string) => {
15104
14945
  if (typeof string !== "string") {
15105
14946
  return false;
15106
14947
  }
14948
+ if (string.startsWith("#")) {
14949
+ return true;
14950
+ }
15107
14951
  const generalMatch = string.match(protocolAndDomainRE);
15108
14952
  const emailLinkMatch = string.match(emailLintRE);
15109
14953
  const localUrlMatch = string.match(localUrlRE);
@@ -15125,12 +14969,12 @@ const isUrl = (string) => {
15125
14969
  }
15126
14970
  return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
15127
14971
  };
15128
- const RichEditor = (props) => {
14972
+ const RichEditor = ({ input, tinaForm, field }) => {
15129
14973
  var _a;
15130
14974
  const initialValue = React__default.useMemo(
15131
14975
  () => {
15132
14976
  var _a2, _b;
15133
- return ((_b = (_a2 = props.input.value) == null ? void 0 : _a2.children) == null ? void 0 : _b.length) ? props.input.value.children.map(helpers.normalize) : [{ type: "p", children: [{ type: "text", text: "" }] }];
14977
+ return ((_b = (_a2 = input.value) == null ? void 0 : _a2.children) == null ? void 0 : _b.length) ? input.value.children.map(helpers.normalize) : [{ type: "p", children: [{ type: "text", text: "" }] }];
15134
14978
  },
15135
14979
  []
15136
14980
  );
@@ -15158,7 +15002,7 @@ const RichEditor = (props) => {
15158
15002
  ),
15159
15003
  []
15160
15004
  );
15161
- const tempId = [props.tinaForm.id, props.input.name].join(".");
15005
+ const tempId = [tinaForm.id, input.name].join(".");
15162
15006
  const id = React__default.useMemo(() => uuid() + tempId, [tempId]);
15163
15007
  const ref = React__default.useRef(null);
15164
15008
  React__default.useEffect(() => {
@@ -15168,13 +15012,13 @@ const RichEditor = (props) => {
15168
15012
  const plateElement = (_a2 = ref.current) == null ? void 0 : _a2.querySelector(
15169
15013
  '[role="textbox"]'
15170
15014
  );
15171
- if (props.field.experimental_focusIntent && plateElement) {
15015
+ if (field.experimental_focusIntent && plateElement) {
15172
15016
  if (plateElement)
15173
15017
  plateElement.focus();
15174
15018
  }
15175
15019
  }, 100);
15176
15020
  }
15177
- }, [props.field.experimental_focusIntent, ref]);
15021
+ }, [field.experimental_focusIntent, ref]);
15178
15022
  return /* @__PURE__ */ React__default.createElement("div", { ref }, /* @__PURE__ */ React__default.createElement(
15179
15023
  Plate,
15180
15024
  {
@@ -15182,7 +15026,7 @@ const RichEditor = (props) => {
15182
15026
  initialValue,
15183
15027
  plugins: plugins$2,
15184
15028
  onChange: (value) => {
15185
- props.input.onChange({
15029
+ input.onChange({
15186
15030
  type: "root",
15187
15031
  children: value
15188
15032
  });
@@ -15191,12 +15035,12 @@ const RichEditor = (props) => {
15191
15035
  /* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(
15192
15036
  ToolbarProvider,
15193
15037
  {
15194
- tinaForm: props.tinaForm,
15195
- templates: props.field.templates,
15196
- overrides: (_a = props.field) == null ? void 0 : _a.toolbarOverride
15038
+ tinaForm,
15039
+ templates: field.templates,
15040
+ overrides: (field == null ? void 0 : field.toolbarOverride) ? field.toolbarOverride : field.overrides
15197
15041
  },
15198
15042
  /* @__PURE__ */ React__default.createElement(FixedToolbar, null, /* @__PURE__ */ React__default.createElement(FixedToolbarButtons, null)),
15199
- /* @__PURE__ */ React__default.createElement(FloatingToolbar, null, /* @__PURE__ */ React__default.createElement(FloatingToolbarButtons, null))
15043
+ ((_a = field == null ? void 0 : field.overrides) == null ? void 0 : _a.showFloatingToolbar) !== false ? /* @__PURE__ */ React__default.createElement(FloatingToolbar, null, /* @__PURE__ */ React__default.createElement(FloatingToolbarButtons, null)) : null
15200
15044
  ), /* @__PURE__ */ React__default.createElement(Editor, null))
15201
15045
  ));
15202
15046
  };
@@ -2,16 +2,18 @@ import React from 'react';
2
2
  import { type InputFieldType } from '../wrap-field-with-meta';
3
3
  import type { MdxTemplate } from './plate/types';
4
4
  import type { InputProps } from '../../../fields/components';
5
- import type { ToolbarOverrideType } from './plate/toolbar/toolbar-overrides';
5
+ import type { ToolbarOverrides, ToolbarOverrideType } from './plate/toolbar/toolbar-overrides';
6
6
  export type RichTextType = React.PropsWithChildren<InputFieldType<InputProps, {
7
7
  templates: MdxTemplate[];
8
8
  toolbarOverride?: ToolbarOverrideType[];
9
+ overrides?: ToolbarOverrides;
9
10
  }>>;
10
11
  export declare const MdxFieldPlugin: {
11
12
  name: string;
12
13
  Component: (props: InputFieldType<InputProps, {
13
14
  templates: MdxTemplate[];
14
15
  toolbarOverride?: ToolbarOverrideType[];
16
+ overrides?: ToolbarOverrides;
15
17
  }>) => React.JSX.Element;
16
18
  };
17
19
  export declare const MdxFieldPluginExtendible: {
@@ -20,5 +22,6 @@ export declare const MdxFieldPluginExtendible: {
20
22
  Component: (props: InputFieldType<InputProps, {
21
23
  templates: MdxTemplate[];
22
24
  toolbarOverride?: ToolbarOverrideType[];
25
+ overrides?: ToolbarOverrides;
23
26
  }>) => React.JSX.Element;
24
27
  };
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import type { RichTextType } from '..';
3
- export declare const RichEditor: (props: RichTextType) => React.JSX.Element;
3
+ export declare const RichEditor: ({ input, tinaForm, field }: RichTextType) => React.JSX.Element;
@@ -6,3 +6,7 @@ export declare const EMBED_ICON_WIDTH = 78;
6
6
  export declare const CONTAINER_MD_BREAKPOINT = 448;
7
7
  export declare const FLOAT_BUTTON_WIDTH = 25;
8
8
  export declare const HEADING_LABEL = "Headings";
9
+ export type ToolbarOverrides = {
10
+ toolbar?: ToolbarOverrideType[];
11
+ showFloatingToolbar?: boolean;
12
+ };
@@ -2,11 +2,11 @@ import React from 'react';
2
2
  import { type ReactNode } from 'react';
3
3
  import type { Form } from '../../../../../forms';
4
4
  import type { MdxTemplate } from '../types';
5
- import type { ToolbarOverrideType } from './toolbar-overrides';
5
+ import type { ToolbarOverrides, ToolbarOverrideType } from './toolbar-overrides';
6
6
  interface ToolbarContextProps {
7
7
  tinaForm: Form;
8
8
  templates: MdxTemplate[];
9
- overrides: ToolbarOverrideType[];
9
+ overrides: ToolbarOverrideType[] | ToolbarOverrides;
10
10
  }
11
11
  interface ToolbarProviderProps extends ToolbarContextProps {
12
12
  children: ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "2.5.1",
3
+ "version": "2.6.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "exports": {
@@ -98,7 +98,6 @@
98
98
  "color-string": "^1.9.1",
99
99
  "crypto-js": "^4.2.0",
100
100
  "date-fns": "2.30.0",
101
- "fetch-ponyfill": "^7.1.0",
102
101
  "final-form": "4.20.10",
103
102
  "final-form-arrays": "^3.1.0",
104
103
  "final-form-set-field-data": "^1.0.2",
@@ -119,8 +118,8 @@
119
118
  "react-dropzone": "14.2.3",
120
119
  "react-final-form": "^6.5.9",
121
120
  "react-icons": "^5.3.0",
122
- "react-onclickoutside": "^6.13.1",
123
121
  "react-router-dom": "6.3.0",
122
+ "react-use": "^17.6.0",
124
123
  "slate": "^0.103.0",
125
124
  "slate-history": "^0.100.0",
126
125
  "slate-hyperscript": "^0.100.0",
@@ -129,9 +128,9 @@
129
128
  "webfontloader": "1.6.28",
130
129
  "yup": "^1.4.0",
131
130
  "zod": "^3.23.8",
132
- "@tinacms/mdx": "1.5.2",
133
- "@tinacms/schema-tools": "1.6.8",
134
- "@tinacms/search": "1.0.35"
131
+ "@tinacms/mdx": "1.5.4",
132
+ "@tinacms/schema-tools": "1.7.0",
133
+ "@tinacms/search": "1.0.37"
135
134
  },
136
135
  "devDependencies": {
137
136
  "@graphql-tools/utils": "^10.5.6",