@blocknote/mantine 0.17.1 → 0.18.1

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.
@@ -1,31 +1,2 @@
1
- (function(R,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("react"),require("@blocknote/core"),require("@blocknote/react"),require("@mantine/core"),require("@mantine/hooks")):typeof define=="function"&&define.amd?define(["exports","react","@blocknote/core","@blocknote/react","@mantine/core","@mantine/hooks"],p):(R=typeof globalThis<"u"?globalThis:R||self,p(R["blocknote-mantine"]={},R.React,R.core,R.react,R.core$1,R.hooks))})(this,function(R,p,h,L,d,A){"use strict";const D=(t=>t&&typeof t=="object"&&"default"in t?t:{default:t})(p);var ee={exports:{}},W={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var de;function Xe(){if(de)return W;de=1;var t=D.default,n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function m(c,f,b){var E,k={},C=null,J=null;b!==void 0&&(C=""+b),f.key!==void 0&&(C=""+f.key),f.ref!==void 0&&(J=f.ref);for(E in f)a.call(f,E)&&!u.hasOwnProperty(E)&&(k[E]=f[E]);if(c&&c.defaultProps)for(E in f=c.defaultProps,f)k[E]===void 0&&(k[E]=f[E]);return{$$typeof:n,type:c,key:C,ref:J,props:k,_owner:s.current}}return W.Fragment=r,W.jsx=m,W.jsxs=m,W}var G={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var me;function Ze(){return me||(me=1,process.env.NODE_ENV!=="production"&&function(){var t=D.default,n=Symbol.for("react.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),J=Symbol.for("react.offscreen"),Te=Symbol.iterator,Vt="@@iterator";function Wt(e){if(e===null||typeof e!="object")return null;var o=Te&&e[Te]||e[Vt];return typeof o=="function"?o:null}var B=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function _(e){{for(var o=arguments.length,i=new Array(o>1?o-1:0),v=1;v<o;v++)i[v-1]=arguments[v];Gt("error",e,i)}}function Gt(e,o,i){{var v=B.ReactDebugCurrentFrame,w=v.getStackAddendum();w!==""&&(o+="%s",i=i.concat([w]));var j=i.map(function(y){return String(y)});j.unshift("Warning: "+o),Function.prototype.apply.call(console[e],console,j)}}var Yt=!1,Ut=!1,qt=!1,Kt=!1,Ht=!1,ke;ke=Symbol.for("react.module.reference");function Jt(e){return!!(typeof e=="string"||typeof e=="function"||e===a||e===u||Ht||e===s||e===b||e===E||Kt||e===J||Yt||Ut||qt||typeof e=="object"&&e!==null&&(e.$$typeof===C||e.$$typeof===k||e.$$typeof===m||e.$$typeof===c||e.$$typeof===f||e.$$typeof===ke||e.getModuleId!==void 0))}function Xt(e,o,i){var v=e.displayName;if(v)return v;var w=o.displayName||o.name||"";return w!==""?i+"("+w+")":i}function Re(e){return e.displayName||"Context"}function M(e){if(e==null)return null;if(typeof e.tag=="number"&&_("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case a:return"Fragment";case r:return"Portal";case u:return"Profiler";case s:return"StrictMode";case b:return"Suspense";case E:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case c:var o=e;return Re(o)+".Consumer";case m:var i=e;return Re(i._context)+".Provider";case f:return Xt(e,e.render,"ForwardRef");case k:var v=e.displayName||null;return v!==null?v:M(e.type)||"Memo";case C:{var w=e,j=w._payload,y=w._init;try{return M(y(j))}catch{return null}}}return null}var N=Object.assign,Y=0,Ce,_e,Pe,Oe,Fe,Me,De;function Ne(){}Ne.__reactDisabledLog=!0;function Zt(){{if(Y===0){Ce=console.log,_e=console.info,Pe=console.warn,Oe=console.error,Fe=console.group,Me=console.groupCollapsed,De=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ne,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Y++}}function Qt(){{if(Y--,Y===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:N({},e,{value:Ce}),info:N({},e,{value:_e}),warn:N({},e,{value:Pe}),error:N({},e,{value:Oe}),group:N({},e,{value:Fe}),groupCollapsed:N({},e,{value:Me}),groupEnd:N({},e,{value:De})})}Y<0&&_("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ne=B.ReactCurrentDispatcher,ae;function X(e,o,i){{if(ae===void 0)try{throw Error()}catch(w){var v=w.stack.trim().match(/\n( *(at )?)/);ae=v&&v[1]||""}return`
18
- `+ae+e}}var oe=!1,Z;{var $t=typeof WeakMap=="function"?WeakMap:Map;Z=new $t}function Ie(e,o){if(!e||oe)return"";{var i=Z.get(e);if(i!==void 0)return i}var v;oe=!0;var w=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var j;j=ne.current,ne.current=null,Zt();try{if(o){var y=function(){throw Error()};if(Object.defineProperty(y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(y,[])}catch(O){v=O}Reflect.construct(e,[],y)}else{try{y.call()}catch(O){v=O}e.call(y.prototype)}}else{try{throw Error()}catch(O){v=O}e()}}catch(O){if(O&&v&&typeof O.stack=="string"){for(var g=O.stack.split(`
19
- `),P=v.stack.split(`
20
- `),S=g.length-1,T=P.length-1;S>=1&&T>=0&&g[S]!==P[T];)T--;for(;S>=1&&T>=0;S--,T--)if(g[S]!==P[T]){if(S!==1||T!==1)do if(S--,T--,T<0||g[S]!==P[T]){var F=`
21
- `+g[S].replace(" at new "," at ");return e.displayName&&F.includes("<anonymous>")&&(F=F.replace("<anonymous>",e.displayName)),typeof e=="function"&&Z.set(e,F),F}while(S>=1&&T>=0);break}}}finally{oe=!1,ne.current=j,Qt(),Error.prepareStackTrace=w}var V=e?e.displayName||e.name:"",I=V?X(V):"";return typeof e=="function"&&Z.set(e,I),I}function er(e,o,i){return Ie(e,!1)}function tr(e){var o=e.prototype;return!!(o&&o.isReactComponent)}function Q(e,o,i){if(e==null)return"";if(typeof e=="function")return Ie(e,tr(e));if(typeof e=="string")return X(e);switch(e){case b:return X("Suspense");case E:return X("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return er(e.render);case k:return Q(e.type,o,i);case C:{var v=e,w=v._payload,j=v._init;try{return Q(j(w),o,i)}catch{}}}return""}var U=Object.prototype.hasOwnProperty,Le={},Ae=B.ReactDebugCurrentFrame;function $(e){if(e){var o=e._owner,i=Q(e.type,e._source,o?o.type:null);Ae.setExtraStackFrame(i)}else Ae.setExtraStackFrame(null)}function rr(e,o,i,v,w){{var j=Function.call.bind(U);for(var y in e)if(j(e,y)){var g=void 0;try{if(typeof e[y]!="function"){var P=Error((v||"React class")+": "+i+" type `"+y+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[y]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw P.name="Invariant Violation",P}g=e[y](o,y,v,i,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(S){g=S}g&&!(g instanceof Error)&&($(w),_("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",v||"React class",i,y,typeof g),$(null)),g instanceof Error&&!(g.message in Le)&&(Le[g.message]=!0,$(w),_("Failed %s type: %s",i,g.message),$(null))}}}var nr=Array.isArray;function se(e){return nr(e)}function ar(e){{var o=typeof Symbol=="function"&&Symbol.toStringTag,i=o&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i}}function or(e){try{return Be(e),!1}catch{return!0}}function Be(e){return""+e}function ze(e){if(or(e))return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ar(e)),Be(e)}var q=B.ReactCurrentOwner,sr={key:!0,ref:!0,__self:!0,__source:!0},Ve,We,ie;ie={};function ir(e){if(U.call(e,"ref")){var o=Object.getOwnPropertyDescriptor(e,"ref").get;if(o&&o.isReactWarning)return!1}return e.ref!==void 0}function lr(e){if(U.call(e,"key")){var o=Object.getOwnPropertyDescriptor(e,"key").get;if(o&&o.isReactWarning)return!1}return e.key!==void 0}function ur(e,o){if(typeof e.ref=="string"&&q.current&&o&&q.current.stateNode!==o){var i=M(q.current.type);ie[i]||(_('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',M(q.current.type),e.ref),ie[i]=!0)}}function cr(e,o){{var i=function(){Ve||(Ve=!0,_("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",o))};i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}}function fr(e,o){{var i=function(){We||(We=!0,_("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",o))};i.isReactWarning=!0,Object.defineProperty(e,"ref",{get:i,configurable:!0})}}var dr=function(e,o,i,v,w,j,y){var g={$$typeof:n,type:e,key:o,ref:i,props:y,_owner:j};return g._store={},Object.defineProperty(g._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(g,"_self",{configurable:!1,enumerable:!1,writable:!1,value:v}),Object.defineProperty(g,"_source",{configurable:!1,enumerable:!1,writable:!1,value:w}),Object.freeze&&(Object.freeze(g.props),Object.freeze(g)),g};function mr(e,o,i,v,w){{var j,y={},g=null,P=null;i!==void 0&&(ze(i),g=""+i),lr(o)&&(ze(o.key),g=""+o.key),ir(o)&&(P=o.ref,ur(o,w));for(j in o)U.call(o,j)&&!sr.hasOwnProperty(j)&&(y[j]=o[j]);if(e&&e.defaultProps){var S=e.defaultProps;for(j in S)y[j]===void 0&&(y[j]=S[j])}if(g||P){var T=typeof e=="function"?e.displayName||e.name||"Unknown":e;g&&cr(y,T),P&&fr(y,T)}return dr(e,g,P,w,v,q.current,y)}}var le=B.ReactCurrentOwner,Ge=B.ReactDebugCurrentFrame;function z(e){if(e){var o=e._owner,i=Q(e.type,e._source,o?o.type:null);Ge.setExtraStackFrame(i)}else Ge.setExtraStackFrame(null)}var ue;ue=!1;function ce(e){return typeof e=="object"&&e!==null&&e.$$typeof===n}function Ye(){{if(le.current){var e=M(le.current.type);if(e)return`
22
-
23
- Check the render method of \``+e+"`."}return""}}function vr(e){return""}var Ue={};function pr(e){{var o=Ye();if(!o){var i=typeof e=="string"?e:e.displayName||e.name;i&&(o=`
24
-
25
- Check the top-level render call using <`+i+">.")}return o}}function qe(e,o){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var i=pr(o);if(Ue[i])return;Ue[i]=!0;var v="";e&&e._owner&&e._owner!==le.current&&(v=" It was passed a child from "+M(e._owner.type)+"."),z(e),_('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',i,v),z(null)}}function Ke(e,o){{if(typeof e!="object")return;if(se(e))for(var i=0;i<e.length;i++){var v=e[i];ce(v)&&qe(v,o)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var w=Wt(e);if(typeof w=="function"&&w!==e.entries)for(var j=w.call(e),y;!(y=j.next()).done;)ce(y.value)&&qe(y.value,o)}}}function br(e){{var o=e.type;if(o==null||typeof o=="string")return;var i;if(typeof o=="function")i=o.propTypes;else if(typeof o=="object"&&(o.$$typeof===f||o.$$typeof===k))i=o.propTypes;else return;if(i){var v=M(o);rr(i,e.props,"prop",v,e)}else if(o.PropTypes!==void 0&&!ue){ue=!0;var w=M(o);_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",w||"Unknown")}typeof o.getDefaultProps=="function"&&!o.getDefaultProps.isReactClassApproved&&_("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function gr(e){{for(var o=Object.keys(e.props),i=0;i<o.length;i++){var v=o[i];if(v!=="children"&&v!=="key"){z(e),_("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),z(null);break}}e.ref!==null&&(z(e),_("Invalid attribute `ref` supplied to `React.Fragment`."),z(null))}}var He={};function Je(e,o,i,v,w,j){{var y=Jt(e);if(!y){var g="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(g+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var P=vr();P?g+=P:g+=Ye();var S;e===null?S="null":se(e)?S="array":e!==void 0&&e.$$typeof===n?(S="<"+(M(e.type)||"Unknown")+" />",g=" Did you accidentally export a JSX literal instead of a component?"):S=typeof e,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",S,g)}var T=mr(e,o,i,w,j);if(T==null)return T;if(y){var F=o.children;if(F!==void 0)if(v)if(se(F)){for(var V=0;V<F.length;V++)Ke(F[V],e);Object.freeze&&Object.freeze(F)}else _("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ke(F,e)}if(U.call(o,"key")){var I=M(e),O=Object.keys(o).filter(function(jr){return jr!=="key"}),fe=O.length>0?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}";if(!He[I+fe]){var wr=O.length>0?"{"+O.join(": ..., ")+": ...}":"{}";_(`A props object containing a "key" prop is being spread into JSX:
26
- let props = %s;
27
- <%s {...props} />
28
- React keys must be passed directly to JSX without using spread:
29
- let props = %s;
30
- <%s key={someKey} {...props} />`,fe,I,wr,I),He[I+fe]=!0}}return e===a?gr(T):br(T),T}}function hr(e,o,i){return Je(e,o,i,!0)}function yr(e,o,i){return Je(e,o,i,!1)}var xr=yr,Er=hr;G.Fragment=a,G.jsx=xr,G.jsxs=Er}()),G}process.env.NODE_ENV==="production"?ee.exports=Xe():ee.exports=Ze();var l=ee.exports;const ve=(t,n,r=!1)=>{const a=[];function s(u,m="--bn"){for(const c in u){const f=c.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),b=`${m}-${f}`;typeof u[c]!="object"?(typeof u[c]=="number"&&(u[c]=`${u[c]}px`),r?n.style.removeProperty(b):n.style.setProperty(b,u[c].toString())):s(u[c],b)}}return s(t),a},te=(t,n)=>ve(t,n),Qe={colors:{editor:{text:void 0,background:void 0},menu:{text:void 0,background:void 0},tooltip:{text:void 0,background:void 0},hovered:{text:void 0,background:void 0},selected:{text:void 0,background:void 0},disabled:{text:void 0,background:void 0},shadow:void 0,border:void 0,sideMenu:void 0,highlights:{gray:{text:void 0,background:void 0},brown:{text:void 0,background:void 0},red:{text:void 0,background:void 0},orange:{text:void 0,background:void 0},yellow:{text:void 0,background:void 0},green:{text:void 0,background:void 0},blue:{text:void 0,background:void 0},purple:{text:void 0,background:void 0},pink:{text:void 0,background:void 0}}},borderRadius:void 0,fontFamily:void 0},pe=t=>ve(Qe,t,!0),$e=p.forwardRef((t,n)=>{const{className:r,name:a,label:s,icon:u,value:m,autoFocus:c,placeholder:f,onKeyDown:b,onChange:E,onSubmit:k,...C}=t;return h.assertEmpty(C),l.jsx(d.TextInput,{size:"xs",className:r,ref:n,name:a,label:s,leftSection:u,value:m,autoFocus:c,"data-autofocus":c?"true":void 0,placeholder:f,onKeyDown:b,onChange:E,onSubmit:k})});var be={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ge=D.default.createContext&&D.default.createContext(be),et=["attr","size","title"];function tt(t,n){if(t==null)return{};var r=rt(t,n),a,s;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(t);for(s=0;s<u.length;s++)a=u[s],!(n.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}function rt(t,n){if(t==null)return{};var r={};for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){if(n.indexOf(a)>=0)continue;r[a]=t[a]}return r}function K(){return K=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},K.apply(this,arguments)}function he(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);n&&(a=a.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,a)}return r}function H(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?he(Object(r),!0).forEach(function(a){nt(t,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):he(Object(r)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(r,a))})}return t}function nt(t,n,r){return n=at(n),n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}function at(t){var n=ot(t,"string");return typeof n=="symbol"?n:n+""}function ot(t,n){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,n||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(t)}function ye(t){return t&&t.map((n,r)=>D.default.createElement(n.tag,H({key:r},n.attr),ye(n.child)))}function xe(t){return n=>D.default.createElement(st,K({attr:H({},t.attr)},n),ye(t.child))}function st(t){var n=r=>{var{attr:a,size:s,title:u}=t,m=tt(t,et),c=s||r.size||"1em",f;return r.className&&(f=r.className),t.className&&(f=(f?f+" ":"")+t.className),D.default.createElement("svg",K({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,a,m,{className:f,style:H(H({color:t.color||r.color},r.style),t.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),u&&D.default.createElement("title",null,u),t.children)};return ge!==void 0?D.default.createElement(ge.Consumer,null,r=>n(r)):n(be)}function it(t){return xe({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"},child:[]}]})(t)}function lt(t){return xe({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"},child:[]}]})(t)}const Ee=p.createContext(void 0),ut=p.forwardRef((t,n)=>{const{children:r,onOpenChange:a,position:s,sub:u,...m}=t;h.assertEmpty(m);const[c,f]=p.useState(!1),b=p.useRef(null),E=p.useRef(),k=p.useCallback(()=>{E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{f(!1)},250)},[]),C=p.useCallback(()=>{E.current&&clearTimeout(E.current),f(!0)},[]);return l.jsx(Ee.Provider,{value:{onMenuMouseOver:C,onMenuMouseLeave:k},children:l.jsx(d.Menu.Item,{className:"bn-menu-item bn-mt-sub-menu-item",ref:A.mergeRefs(n,b),onMouseOver:C,onMouseLeave:k,children:l.jsx(d.Menu,{portalProps:{target:b.current?b.current.parentElement:void 0},middlewares:{flip:!0,shift:!0,inline:!1,size:!0},trigger:"hover",opened:c,onClose:()=>a==null?void 0:a(!1),onOpen:()=>a==null?void 0:a(!0),position:s,children:r})})})}),ct=t=>{const{children:n,onOpenChange:r,position:a,sub:s,...u}=t;return h.assertEmpty(u),s?l.jsx(ut,{...t}):l.jsx(d.Menu,{withinPortal:!1,middlewares:{flip:!0,shift:!0,inline:!1,size:!0},onClose:()=>r==null?void 0:r(!1),onOpen:()=>r==null?void 0:r(!0),position:a,children:n})},ft=p.forwardRef((t,n)=>{const{className:r,children:a,icon:s,checked:u,subTrigger:m,onClick:c,...f}=t;return h.assertEmpty(f,!1),m?l.jsxs("div",{ref:n,...f,children:[a,l.jsx(lt,{size:15})]}):l.jsx(d.Menu.Item,{className:r,ref:n,leftSection:s,rightSection:u?l.jsx(d.CheckIcon,{size:10}):u===!1?l.jsx("div",{className:"bn-tick-space"}):null,onClick:c,...f,children:a})}),dt=t=>{const{children:n,sub:r,...a}=t;return h.assertEmpty(a),l.jsx(d.Menu.Target,{children:n})},mt=p.forwardRef((t,n)=>{const{className:r,children:a,sub:s,...u}=t;h.assertEmpty(u);const m=p.useContext(Ee);return l.jsx(d.Menu.Dropdown,{className:r,ref:n,onMouseOver:m==null?void 0:m.onMenuMouseOver,onMouseLeave:m==null?void 0:m.onMenuMouseLeave,children:a})}),vt=p.forwardRef((t,n)=>{const{className:r,...a}=t;return h.assertEmpty(a),l.jsx(d.Menu.Divider,{className:r,ref:n})}),pt=p.forwardRef((t,n)=>{const{className:r,children:a,...s}=t;return h.assertEmpty(s),l.jsx(d.Menu.Label,{className:r,ref:n,children:a})}),bt=p.forwardRef((t,n)=>{const{className:r,tabs:a,defaultOpenTab:s,openTab:u,setOpenTab:m,loading:c,...f}=t;return h.assertEmpty(f),l.jsx(d.Group,{className:r,ref:n,children:l.jsxs(d.Tabs,{value:u,defaultValue:s,onChange:m,children:[c&&l.jsx(d.LoadingOverlay,{visible:c}),l.jsx(d.Tabs.List,{children:a.map(b=>l.jsx(d.Tabs.Tab,{"data-test":`${b.name.toLowerCase()}-tab`,value:b.name,children:b.name},b.name))}),a.map(b=>l.jsx(d.Tabs.Panel,{value:b.name,children:b.tabPanel},b.name))]})})}),gt=p.forwardRef((t,n)=>{const{className:r,children:a,onClick:s,label:u,...m}=t;return h.assertEmpty(m),l.jsx(d.Button,{size:"xs","aria-label":u,className:r,ref:n,onClick:s,...m,children:a})}),ht=p.forwardRef((t,n)=>{const{className:r,accept:a,value:s,placeholder:u,onChange:m,...c}=t;return h.assertEmpty(c),l.jsx(d.FileInput,{size:"xs",className:r,ref:n,accept:a,value:s,placeholder:u,onChange:m,...c})}),yt=p.forwardRef((t,n)=>{const{className:r,children:a,...s}=t;return h.assertEmpty(s),l.jsx("div",{className:r,ref:n,children:a})}),xt=p.forwardRef((t,n)=>{const{className:r,value:a,placeholder:s,onKeyDown:u,onChange:m,...c}=t;return h.assertEmpty(c),l.jsx(d.TextInput,{size:"xs","data-test":"embed-input",className:r,ref:n,value:a,placeholder:s,onKeyDown:u,onChange:m})}),Et=t=>{const{children:n,opened:r,position:a,...s}=t;return h.assertEmpty(s),l.jsx(d.Popover,{withinPortal:!1,zIndex:1e4,opened:r,position:a,children:n})},wt=t=>{const{children:n,...r}=t;return h.assertEmpty(r),l.jsx(d.PopoverTarget,{children:n})},jt=p.forwardRef((t,n)=>{const{className:r,children:a,variant:s,...u}=t;return h.assertEmpty(u),l.jsx(d.PopoverDropdown,{className:r,ref:n,children:a})}),St=p.forwardRef((t,n)=>{const{className:r,children:a,...s}=t;return h.assertEmpty(s,!1),l.jsx(d.Group,{align:"center",gap:0,className:r,ref:n,...s,children:a})}),Tt=p.forwardRef((t,n)=>{const{className:r,children:a,icon:s,onClick:u,onDragEnd:m,onDragStart:c,draggable:f,label:b,...E}=t;return h.assertEmpty(E,!1),s?l.jsx(d.ActionIcon,{size:24,className:r,ref:n,onClick:u,onDragEnd:m,onDragStart:c,draggable:f,"aria-label":b,...E,children:s}):l.jsx(d.Button,{className:r,ref:n,onClick:u,onDragEnd:m,onDragStart:c,draggable:f,"aria-label":b,...E,children:a})}),kt=p.forwardRef((t,n)=>{const{className:r,children:a,id:s,columns:u,...m}=t;return h.assertEmpty(m),l.jsx("div",{className:r,style:{gridTemplateColumns:`repeat(${u}, 1fr)`},ref:n,id:s,role:"grid",children:a})}),Rt=p.forwardRef((t,n)=>{const{className:r,children:a,columns:s,...u}=t;return h.assertEmpty(u),l.jsx(d.Group,{className:r,style:{gridColumn:`1 / ${s+1}`},ref:n,children:l.jsx(d.Group,{className:"bn-mt-suggestion-menu-item-title",children:a})})}),Ct=p.forwardRef((t,n)=>{const{className:r,isSelected:a,onClick:s,item:u,id:m,...c}=t;h.assertEmpty(c);const f=p.useRef(null);return p.useEffect(()=>{if(!f.current||!a)return;const b=L.elementOverflow(f.current,document.querySelector(".bn-grid-suggestion-menu"));b==="top"?f.current.scrollIntoView(!0):b==="bottom"&&f.current.scrollIntoView(!1)},[a]),l.jsx("div",{className:r,ref:A.mergeRefs(n,f),id:m,role:"option",onClick:s,"aria-selected":a||void 0,children:u.icon})}),_t=p.forwardRef((t,n)=>{const{className:r,children:a,columns:s,...u}=t;return h.assertEmpty(u),l.jsx(d.Loader,{className:r,style:{gridColumn:`1 / ${s+1}`},type:"dots",ref:n})}),Pt=p.forwardRef((t,n)=>{const{className:r,children:a,id:s,...u}=t;return h.assertEmpty(u),l.jsx(d.Stack,{gap:0,className:r,ref:n,id:s,role:"listbox",children:a})}),Ot=p.forwardRef((t,n)=>{const{className:r,children:a,...s}=t;return h.assertEmpty(s),l.jsx(d.Group,{className:r,ref:n,children:l.jsx(d.Group,{className:"bn-mt-suggestion-menu-item-title",children:a})})}),Ft=p.forwardRef((t,n)=>{const{className:r,isSelected:a,onClick:s,item:u,id:m,...c}=t;h.assertEmpty(c);const f=p.useRef(null);return p.useEffect(()=>{if(!f.current||!a)return;const b=L.elementOverflow(f.current,document.querySelector(".bn-suggestion-menu"));b==="top"?f.current.scrollIntoView(!0):b==="bottom"&&f.current.scrollIntoView(!1)},[a]),l.jsxs(d.Group,{gap:0,className:r,ref:A.mergeRefs(n,f),id:m,role:"option",onClick:s,"aria-selected":a||void 0,children:[u.icon&&l.jsx(d.Group,{className:"bn-mt-suggestion-menu-item-section","data-position":"left",children:u.icon}),l.jsxs(d.Stack,{gap:0,className:"bn-mt-suggestion-menu-item-body",children:[l.jsx(d.Text,{className:"bn-mt-suggestion-menu-item-title",children:u.title}),l.jsx(d.Text,{className:"bn-mt-suggestion-menu-item-subtitle",children:u.subtext})]}),u.badge&&l.jsx(d.Group,{"data-position":"right",className:"bn-mt-suggestion-menu-item-section",children:l.jsx(d.Badge,{size:"xs",children:u.badge})})]})}),Mt=p.forwardRef((t,n)=>{const{className:r,children:a,...s}=t;return h.assertEmpty(s),l.jsx(d.Group,{className:r,ref:n,children:a})}),Dt=p.forwardRef((t,n)=>{const{className:r,children:a,...s}=t;return h.assertEmpty(s),l.jsx(d.Loader,{className:r,type:"dots",ref:n})}),Nt=p.forwardRef((t,n)=>{const{className:r,children:a,draggable:s,onDragStart:u,onDragEnd:m,style:c,label:f,...b}=t;return h.assertEmpty(b,!1),l.jsx(d.Button,{className:r,ref:n,"aria-label":f,draggable:s,onDragStart:u,onDragEnd:m,style:c,...b,children:a})}),we=p.forwardRef((t,n)=>{const{className:r,children:a,onMouseEnter:s,onMouseLeave:u,...m}=t;h.assertEmpty(m);const{ref:c,focused:f}=A.useFocusWithin(),b=A.useFocusTrap(f),E=A.mergeRefs(n,c,b);return l.jsx(d.Group,{className:r,ref:E,role:"toolbar",onMouseEnter:s,onMouseLeave:u,children:a})}),It=t=>l.jsxs(d.Stack,{gap:0,className:"bn-tooltip",children:[l.jsx(d.Text,{size:"sm",children:t.mainTooltip}),t.secondaryTooltip&&l.jsx(d.Text,{size:"xs",children:t.secondaryTooltip})]}),je=p.forwardRef((t,n)=>{const{className:r,children:a,mainTooltip:s,secondaryTooltip:u,icon:m,isSelected:c,isDisabled:f,onClick:b,label:E,...k}=t;return h.assertEmpty(k,!1),l.jsx(d.Tooltip,{withinPortal:!1,label:l.jsx(It,{mainTooltip:s,secondaryTooltip:u}),children:a?l.jsx(d.Button,{"aria-label":E,className:r,onMouseDown:C=>{h.isSafari()&&C.currentTarget.focus()},onClick:b,"aria-pressed":c,"data-selected":c||void 0,"data-test":s.slice(0,1).toLowerCase()+s.replace(/\s+/g,"").slice(1),size:"xs",disabled:f||!1,ref:n,...k,children:a}):l.jsx(d.ActionIcon,{className:r,"aria-label":E,onMouseDown:C=>{h.isSafari()&&C.currentTarget.focus()},onClick:b,"aria-pressed":c,"data-selected":c||void 0,"data-test":s.slice(0,1).toLowerCase()+s.replace(/\s+/g,"").slice(1),size:30,disabled:f||!1,ref:n,...k,children:m})})}),Lt=p.forwardRef((t,n)=>{const{className:r,items:a,isDisabled:s,...u}=t;h.assertEmpty(u);const m=a.filter(c=>c.isSelected)[0];return m?l.jsxs(d.Menu,{withinPortal:!1,transitionProps:{exitDuration:0},disabled:s,middlewares:{flip:!0,shift:!0,inline:!1,size:!0},children:[l.jsx(d.Menu.Target,{children:l.jsx(d.Button,{onMouseDown:c=>{h.isSafari()&&c.currentTarget.focus()},leftSection:m.icon,rightSection:l.jsx(it,{}),size:"xs",variant:"subtle",disabled:s,children:m.text})}),l.jsx(d.Menu.Dropdown,{className:r,ref:n,children:a.map(c=>l.jsx(d.Menu.Item,{onClick:c.onClick,leftSection:c.icon,rightSection:c.isSelected?l.jsx(d.CheckIcon,{size:10,className:"bn-tick-icon"}):l.jsx("div",{className:"bn-tick-space"}),disabled:c.isDisabled,children:c.text},c.text))})]}):null}),x=["#FFFFFF","#EFEFEF","#CFCFCF","#AFAFAF","#7F7F7F","#3F3F3F","#1F1F1F","#161616","#0F0F0F","#000000"],re={colors:{editor:{text:x[5],background:x[0]},menu:{text:x[5],background:x[0]},tooltip:{text:x[5],background:x[1]},hovered:{text:x[5],background:x[1]},selected:{text:x[0],background:x[5]},disabled:{text:x[3],background:x[1]},shadow:x[2],border:x[1],sideMenu:x[2],highlights:{gray:{text:"#9b9a97",background:"#ebeced"},brown:{text:"#64473a",background:"#e9e5e3"},red:{text:"#e03e3e",background:"#fbe4e4"},orange:{text:"#d9730d",background:"#f6e9d9"},yellow:{text:"#dfab01",background:"#fbf3db"},green:{text:"#4d6461",background:"#ddedea"},blue:{text:"#0b6e99",background:"#ddebf1"},purple:{text:"#6940a5",background:"#eae4f2"},pink:{text:"#ad1a72",background:"#f4dfeb"}}},borderRadius:6,fontFamily:'"Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Open Sans", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif'},At={colors:{editor:{text:x[2],background:x[6]},menu:{text:x[2],background:x[6]},tooltip:{text:x[2],background:x[7]},hovered:{text:x[2],background:x[7]},selected:{text:x[2],background:x[8]},disabled:{text:x[5],background:x[7]},shadow:x[8],border:x[7],sideMenu:x[4],highlights:{gray:{text:"#bebdb8",background:"#9b9a97"},brown:{text:"#8e6552",background:"#64473a"},red:{text:"#ec4040",background:"#be3434"},orange:{text:"#e3790d",background:"#b7600a"},yellow:{text:"#dfab01",background:"#b58b00"},green:{text:"#6b8b87",background:"#4d6461"},blue:{text:"#0e87bc",background:"#0b6e99"},purple:{text:"#8552d7",background:"#6940a5"},pink:{text:"#da208f",background:"#ad1a72"}}},borderRadius:re.borderRadius,fontFamily:re.fontFamily},Se={FormattingToolbar:{Root:we,Button:je,Select:Lt},FilePanel:{Root:bt,Button:gt,FileInput:ht,TabPanel:yt,TextInput:xt},GridSuggestionMenu:{Root:kt,Item:Ct,EmptyItem:Rt,Loader:_t},LinkToolbar:{Root:we,Button:je},SideMenu:{Root:St,Button:Tt},SuggestionMenu:{Root:Pt,Item:Ft,EmptyItem:Ot,Label:Mt,Loader:Dt},TableHandle:{Root:Nt},Generic:{Form:{Root:t=>l.jsx("div",{children:t.children}),TextInput:$e},Menu:{Root:ct,Trigger:dt,Dropdown:mt,Divider:vt,Label:pt,Item:ft},Popover:{Root:Et,Trigger:wt,Content:jt}}},Bt={activeClassName:""},zt=t=>{const{className:n,theme:r,...a}=t,s=L.useBlockNoteContext(),u=L.usePrefersColorScheme(),m=(s==null?void 0:s.colorSchemePreference)||u,c=p.useCallback(f=>{if(f&&(pe(f),typeof r=="object")){if("light"in r&&"dark"in r){te(r[m==="dark"?"dark":"light"],f);return}te(r,f);return}},[m,r]);return l.jsx(L.ComponentsContext.Provider,{value:Se,children:l.jsx(d.MantineProvider,{theme:Bt,cssVariablesSelector:".bn-mantine",getRootElement:()=>{},children:l.jsx(L.BlockNoteViewRaw,{className:h.mergeCSSClasses("bn-mantine",n||""),theme:typeof r=="object"?void 0:r,...a,ref:c})})})};R.BlockNoteView=zt,R.applyBlockNoteCSSVariablesFromTheme=te,R.components=Se,R.darkDefaultTheme=At,R.defaultColorScheme=x,R.lightDefaultTheme=re,R.removeBlockNoteCSSVariables=pe,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
1
+ (function(m,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react/jsx-runtime"),require("@blocknote/core"),require("@blocknote/react"),require("@mantine/core"),require("react"),require("@mantine/hooks")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@blocknote/core","@blocknote/react","@mantine/core","react","@mantine/hooks"],s):(m=typeof globalThis<"u"?globalThis:m||self,s(m["blocknote-mantine"]={},m.jsxRuntime,m.core,m.react,m.core$1,m.React,m.hooks))})(this,function(m,s,f,w,l,c,k){"use strict";const y=(e=>e&&typeof e=="object"&&"default"in e?e:{default:e})(c),M=(e,r,t=!1)=>{const n=[];function o(a,d="--bn"){for(const i in a){const u=i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),b=`${d}-${u}`;typeof a[i]!="object"?(typeof a[i]=="number"&&(a[i]=`${a[i]}px`),t?r.style.removeProperty(b):r.style.setProperty(b,a[i].toString())):o(a[i],b)}}return o(e),n},T=(e,r)=>M(e,r),z={colors:{editor:{text:void 0,background:void 0},menu:{text:void 0,background:void 0},tooltip:{text:void 0,background:void 0},hovered:{text:void 0,background:void 0},selected:{text:void 0,background:void 0},disabled:{text:void 0,background:void 0},shadow:void 0,border:void 0,sideMenu:void 0,highlights:{gray:{text:void 0,background:void 0},brown:{text:void 0,background:void 0},red:{text:void 0,background:void 0},orange:{text:void 0,background:void 0},yellow:{text:void 0,background:void 0},green:{text:void 0,background:void 0},blue:{text:void 0,background:void 0},purple:{text:void 0,background:void 0},pink:{text:void 0,background:void 0}}},borderRadius:void 0,fontFamily:void 0},N=e=>M(z,e,!0),G=c.forwardRef((e,r)=>{const{className:t,name:n,label:o,icon:a,value:d,autoFocus:i,placeholder:u,onKeyDown:b,onChange:p,onSubmit:h,...v}=e;return f.assertEmpty(v),s.jsx(l.TextInput,{size:"xs",className:t,ref:r,name:n,label:o,leftSection:a,value:d,autoFocus:i,"data-autofocus":i?"true":void 0,placeholder:u,onKeyDown:b,onChange:p,onSubmit:h})});var E={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},P=y.default.createContext&&y.default.createContext(E),V=["attr","size","title"];function _(e,r){if(e==null)return{};var t=q(e,r),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(r.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}function q(e,r){if(e==null)return{};var t={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(r.indexOf(n)>=0)continue;t[n]=e[n]}return t}function x(){return x=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},x.apply(this,arguments)}function F(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function S(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?F(Object(t),!0).forEach(function(n){A(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):F(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function A(e,r,t){return r=H(r),r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function H(e){var r=K(e,"string");return typeof r=="symbol"?r:r+""}function K(e,r){if(typeof e!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,r||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function O(e){return e&&e.map((r,t)=>y.default.createElement(r.tag,S({key:t},r.attr),O(r.child)))}function I(e){return r=>y.default.createElement(W,x({attr:S({},e.attr)},r),O(e.child))}function W(e){var r=t=>{var{attr:n,size:o,title:a}=e,d=_(e,V),i=o||t.size||"1em",u;return t.className&&(u=t.className),e.className&&(u=(u?u+" ":"")+e.className),y.default.createElement("svg",x({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,n,d,{className:u,style:S(S({color:e.color||t.color},t.style),e.style),height:i,width:i,xmlns:"http://www.w3.org/2000/svg"}),a&&y.default.createElement("title",null,a),e.children)};return P!==void 0?y.default.createElement(P.Consumer,null,t=>r(t)):r(E)}function U(e){return I({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"},child:[]}]})(e)}function Z(e){return I({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"},child:[]}]})(e)}const D=c.createContext(void 0),J=c.forwardRef((e,r)=>{const{children:t,onOpenChange:n,position:o,sub:a,...d}=e;f.assertEmpty(d);const[i,u]=c.useState(!1),b=c.useRef(null),p=c.useRef(),h=c.useCallback(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{u(!1)},250)},[]),v=c.useCallback(()=>{p.current&&clearTimeout(p.current),u(!0)},[]);return s.jsx(D.Provider,{value:{onMenuMouseOver:v,onMenuMouseLeave:h},children:s.jsx(l.Menu.Item,{className:"bn-menu-item bn-mt-sub-menu-item",ref:k.mergeRefs(r,b),onMouseOver:v,onMouseLeave:h,children:s.jsx(l.Menu,{portalProps:{target:b.current?b.current.parentElement:void 0},middlewares:{flip:!0,shift:!0,inline:!1,size:!0},trigger:"hover",opened:i,onClose:()=>n==null?void 0:n(!1),onOpen:()=>n==null?void 0:n(!0),position:o,children:t})})})}),Q=e=>{const{children:r,onOpenChange:t,position:n,sub:o,...a}=e;return f.assertEmpty(a),o?s.jsx(J,{...e}):s.jsx(l.Menu,{withinPortal:!1,middlewares:{flip:!0,shift:!0,inline:!1,size:!0},onClose:()=>t==null?void 0:t(!1),onOpen:()=>t==null?void 0:t(!0),position:n,children:r})},X=c.forwardRef((e,r)=>{const{className:t,children:n,icon:o,checked:a,subTrigger:d,onClick:i,...u}=e;return f.assertEmpty(u,!1),d?s.jsxs("div",{ref:r,...u,children:[n,s.jsx(Z,{size:15})]}):s.jsx(l.Menu.Item,{className:t,ref:r,leftSection:o,rightSection:a?s.jsx(l.CheckIcon,{size:10}):a===!1?s.jsx("div",{className:"bn-tick-space"}):null,onClick:i,...u,children:n})}),Y=e=>{const{children:r,sub:t,...n}=e;return f.assertEmpty(n),s.jsx(l.Menu.Target,{children:r})},R=c.forwardRef((e,r)=>{const{className:t,children:n,sub:o,...a}=e;f.assertEmpty(a);const d=c.useContext(D);return s.jsx(l.Menu.Dropdown,{className:t,ref:r,onMouseOver:d==null?void 0:d.onMenuMouseOver,onMouseLeave:d==null?void 0:d.onMenuMouseLeave,children:n})}),$=c.forwardRef((e,r)=>{const{className:t,...n}=e;return f.assertEmpty(n),s.jsx(l.Menu.Divider,{className:t,ref:r})}),ee=c.forwardRef((e,r)=>{const{className:t,children:n,...o}=e;return f.assertEmpty(o),s.jsx(l.Menu.Label,{className:t,ref:r,children:n})}),te=c.forwardRef((e,r)=>{const{className:t,tabs:n,defaultOpenTab:o,openTab:a,setOpenTab:d,loading:i,...u}=e;return f.assertEmpty(u),s.jsx(l.Group,{className:t,ref:r,children:s.jsxs(l.Tabs,{value:a,defaultValue:o,onChange:d,children:[i&&s.jsx(l.LoadingOverlay,{visible:i}),s.jsx(l.Tabs.List,{children:n.map(b=>s.jsx(l.Tabs.Tab,{"data-test":`${b.name.toLowerCase()}-tab`,value:b.name,children:b.name},b.name))}),n.map(b=>s.jsx(l.Tabs.Panel,{value:b.name,children:b.tabPanel},b.name))]})})}),re=c.forwardRef((e,r)=>{const{className:t,children:n,onClick:o,label:a,...d}=e;return f.assertEmpty(d),s.jsx(l.Button,{size:"xs","aria-label":a,className:t,ref:r,onClick:o,...d,children:n})}),ne=c.forwardRef((e,r)=>{const{className:t,accept:n,value:o,placeholder:a,onChange:d,...i}=e;return f.assertEmpty(i),s.jsx(l.FileInput,{size:"xs",className:t,ref:r,accept:n,value:o,placeholder:a,onChange:d,...i})}),oe=c.forwardRef((e,r)=>{const{className:t,children:n,...o}=e;return f.assertEmpty(o),s.jsx("div",{className:t,ref:r,children:n})}),se=c.forwardRef((e,r)=>{const{className:t,value:n,placeholder:o,onKeyDown:a,onChange:d,...i}=e;return f.assertEmpty(i),s.jsx(l.TextInput,{size:"xs","data-test":"embed-input",className:t,ref:r,value:n,placeholder:o,onKeyDown:a,onChange:d})}),ae=e=>{const{children:r,opened:t,position:n,...o}=e;return f.assertEmpty(o),s.jsx(l.Popover,{withinPortal:!1,zIndex:1e4,opened:t,position:n,children:r})},le=e=>{const{children:r,...t}=e;return f.assertEmpty(t),s.jsx(l.PopoverTarget,{children:r})},ie=c.forwardRef((e,r)=>{const{className:t,children:n,variant:o,...a}=e;return f.assertEmpty(a),s.jsx(l.PopoverDropdown,{className:t,ref:r,children:n})}),de=c.forwardRef((e,r)=>{const{className:t,children:n,...o}=e;return f.assertEmpty(o,!1),s.jsx(l.Group,{align:"center",gap:0,className:t,ref:r,...o,children:n})}),ue=c.forwardRef((e,r)=>{const{className:t,children:n,icon:o,onClick:a,onDragEnd:d,onDragStart:i,draggable:u,label:b,...p}=e;return f.assertEmpty(p,!1),o?s.jsx(l.ActionIcon,{size:24,className:t,ref:r,onClick:a,onDragEnd:d,onDragStart:i,draggable:u,"aria-label":b,...p,children:o}):s.jsx(l.Button,{className:t,ref:r,onClick:a,onDragEnd:d,onDragStart:i,draggable:u,"aria-label":b,...p,children:n})}),ce=c.forwardRef((e,r)=>{const{className:t,children:n,id:o,columns:a,...d}=e;return f.assertEmpty(d),s.jsx("div",{className:t,style:{gridTemplateColumns:`repeat(${a}, 1fr)`},ref:r,id:o,role:"grid",children:n})}),fe=c.forwardRef((e,r)=>{const{className:t,children:n,columns:o,...a}=e;return f.assertEmpty(a),s.jsx(l.Group,{className:t,style:{gridColumn:`1 / ${o+1}`},ref:r,children:s.jsx(l.Group,{className:"bn-mt-suggestion-menu-item-title",children:n})})}),be=c.forwardRef((e,r)=>{const{className:t,isSelected:n,onClick:o,item:a,id:d,...i}=e;f.assertEmpty(i);const u=c.useRef(null);return c.useEffect(()=>{if(!u.current||!n)return;const b=w.elementOverflow(u.current,document.querySelector(".bn-grid-suggestion-menu"));b==="top"?u.current.scrollIntoView(!0):b==="bottom"&&u.current.scrollIntoView(!1)},[n]),s.jsx("div",{className:t,ref:k.mergeRefs(r,u),id:d,role:"option",onClick:o,"aria-selected":n||void 0,children:a.icon})}),ge=c.forwardRef((e,r)=>{const{className:t,children:n,columns:o,...a}=e;return f.assertEmpty(a),s.jsx(l.Loader,{className:t,style:{gridColumn:`1 / ${o+1}`},type:"dots",ref:r})}),me=c.forwardRef((e,r)=>{const{className:t,children:n,id:o,...a}=e;return f.assertEmpty(a),s.jsx(l.Stack,{gap:0,className:t,ref:r,id:o,role:"listbox",children:n})}),pe=c.forwardRef((e,r)=>{const{className:t,children:n,...o}=e;return f.assertEmpty(o),s.jsx(l.Group,{className:t,ref:r,children:s.jsx(l.Group,{className:"bn-mt-suggestion-menu-item-title",children:n})})}),he=c.forwardRef((e,r)=>{const{className:t,isSelected:n,onClick:o,item:a,id:d,...i}=e;f.assertEmpty(i);const u=c.useRef(null);return c.useEffect(()=>{if(!u.current||!n)return;const b=w.elementOverflow(u.current,document.querySelector(".bn-suggestion-menu"));b==="top"?u.current.scrollIntoView(!0):b==="bottom"&&u.current.scrollIntoView(!1)},[n]),s.jsxs(l.Group,{gap:0,className:t,ref:k.mergeRefs(r,u),id:d,role:"option",onClick:o,"aria-selected":n||void 0,children:[a.icon&&s.jsx(l.Group,{className:"bn-mt-suggestion-menu-item-section","data-position":"left",children:a.icon}),s.jsxs(l.Stack,{gap:0,className:"bn-mt-suggestion-menu-item-body",children:[s.jsx(l.Text,{className:"bn-mt-suggestion-menu-item-title",children:a.title}),s.jsx(l.Text,{className:"bn-mt-suggestion-menu-item-subtitle",children:a.subtext})]}),a.badge&&s.jsx(l.Group,{"data-position":"right",className:"bn-mt-suggestion-menu-item-section",children:s.jsx(l.Badge,{size:"xs",children:a.badge})})]})}),ve=c.forwardRef((e,r)=>{const{className:t,children:n,...o}=e;return f.assertEmpty(o),s.jsx(l.Group,{className:t,ref:r,children:n})}),ye=c.forwardRef((e,r)=>{const{className:t,children:n,...o}=e;return f.assertEmpty(o),s.jsx(l.Loader,{className:t,type:"dots",ref:r})}),we=c.forwardRef((e,r)=>{const{className:t,children:n,draggable:o,onDragStart:a,onDragEnd:d,style:i,label:u,...b}=e;return f.assertEmpty(b,!1),s.jsx(l.Button,{className:t,ref:r,"aria-label":u,draggable:o,onDragStart:a,onDragEnd:d,style:i,...b,children:n})}),ke=c.forwardRef((e,r)=>{const{children:t,className:n,onMouseDown:o,onClick:a,...d}=e;return f.assertEmpty(d,!1),s.jsx(l.Button,{className:n,ref:r,onMouseDown:o,onClick:a,...d,children:t})}),j=c.forwardRef((e,r)=>{const{className:t,children:n,onMouseEnter:o,onMouseLeave:a,...d}=e;f.assertEmpty(d);const{ref:i,focused:u}=k.useFocusWithin(),b=k.useFocusTrap(u),p=k.mergeRefs(r,i,b);return s.jsx(l.Group,{className:t,ref:p,role:"toolbar",onMouseEnter:o,onMouseLeave:a,children:n})}),xe=e=>s.jsxs(l.Stack,{gap:0,className:"bn-tooltip",children:[s.jsx(l.Text,{size:"sm",children:e.mainTooltip}),e.secondaryTooltip&&s.jsx(l.Text,{size:"xs",children:e.secondaryTooltip})]}),B=c.forwardRef((e,r)=>{const{className:t,children:n,mainTooltip:o,secondaryTooltip:a,icon:d,isSelected:i,isDisabled:u,onClick:b,label:p,...h}=e;return f.assertEmpty(h,!1),s.jsx(l.Tooltip,{withinPortal:!1,label:s.jsx(xe,{mainTooltip:o,secondaryTooltip:a}),children:n?s.jsx(l.Button,{"aria-label":p,className:t,onMouseDown:v=>{f.isSafari()&&v.currentTarget.focus()},onClick:b,"aria-pressed":i,"data-selected":i||void 0,"data-test":o.slice(0,1).toLowerCase()+o.replace(/\s+/g,"").slice(1),size:"xs",disabled:u||!1,ref:r,...h,children:n}):s.jsx(l.ActionIcon,{className:t,"aria-label":p,onMouseDown:v=>{f.isSafari()&&v.currentTarget.focus()},onClick:b,"aria-pressed":i,"data-selected":i||void 0,"data-test":o.slice(0,1).toLowerCase()+o.replace(/\s+/g,"").slice(1),size:30,disabled:u||!1,ref:r,...h,children:d})})}),Se=c.forwardRef((e,r)=>{const{className:t,items:n,isDisabled:o,...a}=e;f.assertEmpty(a);const d=n.filter(i=>i.isSelected)[0];return d?s.jsxs(l.Menu,{withinPortal:!1,transitionProps:{exitDuration:0},disabled:o,middlewares:{flip:!0,shift:!0,inline:!1,size:!0},children:[s.jsx(l.Menu.Target,{children:s.jsx(l.Button,{onMouseDown:i=>{f.isSafari()&&i.currentTarget.focus()},leftSection:d.icon,rightSection:s.jsx(U,{}),size:"xs",variant:"subtle",disabled:o,children:d.text})}),s.jsx(l.Menu.Dropdown,{className:t,ref:r,children:n.map(i=>s.jsx(l.Menu.Item,{onClick:i.onClick,leftSection:i.icon,rightSection:i.isSelected?s.jsx(l.CheckIcon,{size:10,className:"bn-tick-icon"}):s.jsx("div",{className:"bn-tick-space"}),disabled:i.isDisabled,children:i.text},i.text))})]}):null}),g=["#FFFFFF","#EFEFEF","#CFCFCF","#AFAFAF","#7F7F7F","#3F3F3F","#1F1F1F","#161616","#0F0F0F","#000000"],C={colors:{editor:{text:g[5],background:g[0]},menu:{text:g[5],background:g[0]},tooltip:{text:g[5],background:g[1]},hovered:{text:g[5],background:g[1]},selected:{text:g[0],background:g[5]},disabled:{text:g[3],background:g[1]},shadow:g[2],border:g[1],sideMenu:g[2],highlights:{gray:{text:"#9b9a97",background:"#ebeced"},brown:{text:"#64473a",background:"#e9e5e3"},red:{text:"#e03e3e",background:"#fbe4e4"},orange:{text:"#d9730d",background:"#f6e9d9"},yellow:{text:"#dfab01",background:"#fbf3db"},green:{text:"#4d6461",background:"#ddedea"},blue:{text:"#0b6e99",background:"#ddebf1"},purple:{text:"#6940a5",background:"#eae4f2"},pink:{text:"#ad1a72",background:"#f4dfeb"}}},borderRadius:6,fontFamily:'"Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Open Sans", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif'},Te={colors:{editor:{text:g[2],background:g[6]},menu:{text:g[2],background:g[6]},tooltip:{text:g[2],background:g[7]},hovered:{text:g[2],background:g[7]},selected:{text:g[2],background:g[8]},disabled:{text:g[5],background:g[7]},shadow:g[8],border:g[7],sideMenu:g[4],highlights:{gray:{text:"#bebdb8",background:"#9b9a97"},brown:{text:"#8e6552",background:"#64473a"},red:{text:"#ec4040",background:"#be3434"},orange:{text:"#e3790d",background:"#b7600a"},yellow:{text:"#dfab01",background:"#b58b00"},green:{text:"#6b8b87",background:"#4d6461"},blue:{text:"#0e87bc",background:"#0b6e99"},purple:{text:"#8552d7",background:"#6940a5"},pink:{text:"#da208f",background:"#ad1a72"}}},borderRadius:C.borderRadius,fontFamily:C.fontFamily},L={FormattingToolbar:{Root:j,Button:B,Select:Se},FilePanel:{Root:te,Button:re,FileInput:ne,TabPanel:oe,TextInput:se},GridSuggestionMenu:{Root:ce,Item:be,EmptyItem:fe,Loader:ge},LinkToolbar:{Root:j,Button:B},SideMenu:{Root:de,Button:ue},SuggestionMenu:{Root:me,Item:he,EmptyItem:pe,Label:ve,Loader:ye},TableHandle:{Root:we,ExtendButton:ke},Generic:{Form:{Root:e=>s.jsx("div",{children:e.children}),TextInput:G},Menu:{Root:Q,Trigger:Y,Dropdown:R,Divider:$,Label:ee,Item:X},Popover:{Root:ae,Trigger:le,Content:ie}}},Ce={activeClassName:""},Me=e=>{const{className:r,theme:t,...n}=e,o=w.useBlockNoteContext(),a=w.usePrefersColorScheme(),d=(o==null?void 0:o.colorSchemePreference)||a,i=c.useCallback(u=>{if(u&&(N(u),typeof t=="object")){if("light"in t&&"dark"in t){T(t[d==="dark"?"dark":"light"],u);return}T(t,u);return}},[d,t]);return s.jsx(w.ComponentsContext.Provider,{value:L,children:s.jsx(l.MantineProvider,{theme:Ce,cssVariablesSelector:".bn-mantine",getRootElement:()=>{},children:s.jsx(w.BlockNoteViewRaw,{className:f.mergeCSSClasses("bn-mantine",r||""),theme:typeof t=="object"?void 0:t,...n,ref:i})})})};m.BlockNoteView=Me,m.applyBlockNoteCSSVariablesFromTheme=T,m.components=L,m.darkDefaultTheme=Te,m.defaultColorScheme=g,m.lightDefaultTheme=C,m.removeBlockNoteCSSVariables=N,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
31
2
  //# sourceMappingURL=blocknote-mantine.umd.cjs.map