@yoopta/ui 6.0.0-beta.5 → 6.0.0-beta.7
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/action-menu-list.js +1 -1
- package/dist/block-options/block-options.d.ts +68 -8
- package/dist/block-options/block-options.d.ts.map +1 -1
- package/dist/block-options/context.d.ts +11 -0
- package/dist/block-options/context.d.ts.map +1 -0
- package/dist/block-options/hooks.d.ts +14 -894
- package/dist/block-options/hooks.d.ts.map +1 -1
- package/dist/block-options/index.d.ts +2 -3
- package/dist/block-options/index.d.ts.map +1 -1
- package/dist/block-options.js +1 -1
- package/dist/chunks/floating-ui.react-33212df0.js +5 -0
- package/dist/chunks/highlight-color-picker-ea799f50.js +1 -0
- package/dist/chunks/{hooks-8cbb0736.js → hooks-814f49b9.js} +1 -1
- package/dist/chunks/hooks-ad9169d0.js +1 -0
- package/dist/chunks/index-e0185864.js +1 -0
- package/dist/element-options/components/element-options-color-picker.d.ts +6 -0
- package/dist/element-options/components/element-options-color-picker.d.ts.map +1 -0
- package/dist/element-options/components/element-options-content.d.ts +6 -0
- package/dist/element-options/components/element-options-content.d.ts.map +1 -0
- package/dist/element-options/components/element-options-group.d.ts +6 -0
- package/dist/element-options/components/element-options-group.d.ts.map +1 -0
- package/dist/element-options/components/element-options-input.d.ts +6 -0
- package/dist/element-options/components/element-options-input.d.ts.map +1 -0
- package/dist/element-options/components/element-options-label.d.ts +6 -0
- package/dist/element-options/components/element-options-label.d.ts.map +1 -0
- package/dist/element-options/components/element-options-root.d.ts +6 -0
- package/dist/element-options/components/element-options-root.d.ts.map +1 -0
- package/dist/element-options/components/element-options-select.d.ts +6 -0
- package/dist/element-options/components/element-options-select.d.ts.map +1 -0
- package/dist/element-options/components/element-options-separator.d.ts +6 -0
- package/dist/element-options/components/element-options-separator.d.ts.map +1 -0
- package/dist/element-options/components/element-options-slider.d.ts +6 -0
- package/dist/element-options/components/element-options-slider.d.ts.map +1 -0
- package/dist/element-options/components/element-options-toggle.d.ts +6 -0
- package/dist/element-options/components/element-options-toggle.d.ts.map +1 -0
- package/dist/element-options/components/element-options-trigger.d.ts +6 -0
- package/dist/element-options/components/element-options-trigger.d.ts.map +1 -0
- package/dist/element-options/context/element-options-context.d.ts +13 -0
- package/dist/element-options/context/element-options-context.d.ts.map +1 -0
- package/dist/element-options/index.d.ts +64 -0
- package/dist/element-options/index.d.ts.map +1 -0
- package/dist/element-options/types.d.ts +107 -0
- package/dist/element-options/types.d.ts.map +1 -0
- package/dist/element-options.js +14 -0
- package/dist/highlight-color-picker.js +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/overlay.js +1 -1
- package/dist/portal.js +1 -1
- package/dist/selection-box/SelectionBox.d.ts +19 -0
- package/dist/selection-box/SelectionBox.d.ts.map +1 -0
- package/dist/selection-box/hooks.d.ts +7 -0
- package/dist/selection-box/hooks.d.ts.map +1 -0
- package/dist/selection-box/index.d.ts +4 -0
- package/dist/selection-box/index.d.ts.map +1 -0
- package/dist/selection-box.js +1 -0
- package/dist/slash-command-menu.js +1 -1
- package/dist/toolbar/index.d.ts +1 -1
- package/dist/toolbar/index.d.ts.map +1 -1
- package/dist/toolbar.js +1 -1
- package/package.json +16 -4
- package/dist/block-options/store.d.ts +0 -15
- package/dist/block-options/store.d.ts.map +0 -1
- package/dist/block-options/store.test.d.ts +0 -2
- package/dist/block-options/store.test.d.ts.map +0 -1
- package/dist/chunks/floating-ui.react-0123aadf.js +0 -5
- package/dist/chunks/highlight-color-picker-13e8f1eb.js +0 -1
- package/dist/chunks/hooks-907f8ea7.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/ui",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.7",
|
|
4
4
|
"description": "UI components for Yoopta Editor",
|
|
5
5
|
"author": "Darginec05 <devopsbanda@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
|
|
@@ -30,6 +30,12 @@
|
|
|
30
30
|
"highlight-color-picker": [
|
|
31
31
|
"./dist/highlight-color-picker/index.d.ts"
|
|
32
32
|
],
|
|
33
|
+
"selection-box": [
|
|
34
|
+
"./dist/selection-box/index.d.ts"
|
|
35
|
+
],
|
|
36
|
+
"element-options": [
|
|
37
|
+
"./dist/element-options/index.d.ts"
|
|
38
|
+
],
|
|
33
39
|
"portal": [
|
|
34
40
|
"./dist/portal/index.d.ts"
|
|
35
41
|
],
|
|
@@ -73,6 +79,14 @@
|
|
|
73
79
|
"types": "./dist/highlight-color-picker/index.d.ts",
|
|
74
80
|
"import": "./dist/highlight-color-picker.js"
|
|
75
81
|
},
|
|
82
|
+
"./selection-box": {
|
|
83
|
+
"types": "./dist/selection-box/index.d.ts",
|
|
84
|
+
"import": "./dist/selection-box.js"
|
|
85
|
+
},
|
|
86
|
+
"./element-options": {
|
|
87
|
+
"types": "./dist/element-options/index.d.ts",
|
|
88
|
+
"import": "./dist/element-options.js"
|
|
89
|
+
},
|
|
76
90
|
"./portal": {
|
|
77
91
|
"types": "./dist/portal/index.d.ts",
|
|
78
92
|
"import": "./dist/portal.js"
|
|
@@ -95,8 +109,6 @@
|
|
|
95
109
|
"react-dom": ">=18.2.0"
|
|
96
110
|
},
|
|
97
111
|
"dependencies": {
|
|
98
|
-
"@dnd-kit/core": "^6.1.0",
|
|
99
|
-
"@dnd-kit/sortable": "^8.0.0",
|
|
100
112
|
"@floating-ui/react": "^0.26.9",
|
|
101
113
|
"class-variance-authority": "^0.7.0",
|
|
102
114
|
"clsx": "^2.0.0",
|
|
@@ -123,5 +135,5 @@
|
|
|
123
135
|
"bugs": {
|
|
124
136
|
"url": "https://github.com/Darginec05/Yoopta-Editor/issues"
|
|
125
137
|
},
|
|
126
|
-
"gitHead": "
|
|
138
|
+
"gitHead": "7cc1d045b5737a810e4f7820c495f7a42dfcc09d"
|
|
127
139
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type BlockOptionsStore = {
|
|
2
|
-
blockId: string | null;
|
|
3
|
-
state: 'open' | 'closed';
|
|
4
|
-
reference: HTMLElement | null;
|
|
5
|
-
open: (options: {
|
|
6
|
-
reference: HTMLElement;
|
|
7
|
-
blockId?: string;
|
|
8
|
-
}) => void;
|
|
9
|
-
close: () => void;
|
|
10
|
-
toggle: (actionState: 'open' | 'closed', reference?: HTMLElement | null, blockId?: string | null) => void;
|
|
11
|
-
setReference: (node: HTMLElement | null) => void;
|
|
12
|
-
reset: () => void;
|
|
13
|
-
};
|
|
14
|
-
export declare const useBlockOptionsStore: import("zustand").UseBoundStore<import("zustand").StoreApi<BlockOptionsStore>>;
|
|
15
|
-
//# sourceMappingURL=store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/block-options/store.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC;IACzB,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAE9B,IAAI,EAAE,CAAC,OAAO,EAAE;QAAE,SAAS,EAAE,WAAW,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACtE,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,CACN,WAAW,EAAE,MAAM,GAAG,QAAQ,EAC9B,SAAS,CAAC,EAAE,WAAW,GAAG,IAAI,EAC9B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,KACpB,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACjD,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,oBAAoB,gFAkD9B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.test.d.ts","sourceRoot":"","sources":["../../src/block-options/store.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import*as t from"react";import{useLayoutEffect as e,useEffect as n,useRef as o}from"react";import*as r from"react-dom";function i(){return"undefined"!=typeof window}function l(t){return s(t)?(t.nodeName||"").toLowerCase():"#document"}function c(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function a(t){var e;return null==(e=(s(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function s(t){return!!i()&&(t instanceof Node||t instanceof c(t).Node)}function u(t){return!!i()&&(t instanceof Element||t instanceof c(t).Element)}function f(t){return!!i()&&(t instanceof HTMLElement||t instanceof c(t).HTMLElement)}function d(t){return!(!i()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof c(t).ShadowRoot)}const p=new Set(["inline","contents"]);function m(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=A(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!p.has(r)}const h=new Set(["table","td","th"]);function g(t){return h.has(l(t))}const y=[":popover-open",":modal"];function v(t){return y.some(e=>{try{return t.matches(e)}catch(t){return!1}})}const w=["transform","translate","scale","rotate","perspective"],b=["transform","translate","scale","rotate","perspective","filter"],x=["paint","layout","strict","content"];function R(t){const e=S(),n=u(t)?A(t):t;return w.some(t=>!!n[t]&&"none"!==n[t])||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||b.some(t=>(n.willChange||"").includes(t))||x.some(t=>(n.contain||"").includes(t))}function S(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const E=new Set(["html","body","#document"]);function C(t){return E.has(l(t))}function A(t){return c(t).getComputedStyle(t)}function T(t){return u(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function L(t){if("html"===l(t))return t;const e=t.assignedSlot||t.parentNode||d(t)&&t.host||a(t);return d(e)?e.host:e}function O(t){const e=L(t);return C(e)?t.ownerDocument?t.ownerDocument.body:t.body:f(e)&&m(e)?e:O(e)}function D(t,e,n){var o;void 0===e&&(e=[]),void 0===n&&(n=!0);const r=O(t),i=r===(null==(o=t.ownerDocument)?void 0:o.body),l=c(r);if(i){const t=P(l);return e.concat(l,l.visualViewport||[],m(r)?r:[],t&&n?D(t):[])}return e.concat(r,D(r,[],n))}function P(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const k=Math.min,M=Math.max,F=Math.round,N=Math.floor,I=t=>({x:t,y:t}),B={left:"right",right:"left",bottom:"top",top:"bottom"},j={start:"end",end:"start"};function V(t,e,n){return M(t,k(e,n))}function W(t,e){return"function"==typeof t?t(e):t}function z(t){return t.split("-")[0]}function H(t){return t.split("-")[1]}function q(t){return"x"===t?"y":"x"}function $(t){return"y"===t?"height":"width"}const U=new Set(["top","bottom"]);function X(t){return U.has(z(t))?"y":"x"}function Y(t){return q(X(t))}function _(t){return t.replace(/start|end/g,t=>j[t])}const Z=["left","right"],G=["right","left"],J=["top","bottom"],K=["bottom","top"];function Q(t,e,n,o){const r=H(t);let i=function(t,e,n){switch(t){case"top":case"bottom":return n?e?G:Z:e?Z:G;case"left":case"right":return e?J:K;default:return[]}}(z(t),"start"===n,o);return r&&(i=i.map(t=>t+"-"+r),e&&(i=i.concat(i.map(_)))),i}function tt(t){return t.replace(/left|right|bottom|top/g,t=>B[t])}function et(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}function nt(t){const{x:e,y:n,width:o,height:r}=t;return{width:o,height:r,top:n,left:e,right:e+o,bottom:n+r,x:e,y:n}}
|
|
2
|
-
/*!
|
|
3
|
-
* tabbable 6.4.0
|
|
4
|
-
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
|
-
*/var ot=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"].join(","),rt="undefined"==typeof Element,it=rt?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,lt=!rt&&Element.prototype.getRootNode?function(t){var e;return null==t||null===(e=t.getRootNode)||void 0===e?void 0:e.call(t)}:function(t){return null==t?void 0:t.ownerDocument},ct=function(t,e){var n;void 0===e&&(e=!0);var o=null==t||null===(n=t.getAttribute)||void 0===n?void 0:n.call(t,"inert");return""===o||"true"===o||e&&t&&("function"==typeof t.closest?t.closest("[inert]"):ct(t.parentNode))},at=function(t,e,n){for(var o=[],r=Array.from(t);r.length;){var i=r.shift();if(!ct(i,!1))if("SLOT"===i.tagName){var l=i.assignedElements(),c=l.length?l:i.children,a=at(c,!0,n);n.flatten?o.push.apply(o,a):o.push({scopeParent:i,candidates:a})}else{it.call(i,ot)&&n.filter(i)&&(e||!t.includes(i))&&o.push(i);var s=i.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(i),u=!ct(s,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(i));if(s&&u){var f=at(!0===s?i.children:s.children,!0,n);n.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else r.unshift.apply(r,i.children)}}return o},st=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},ut=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||function(t){var e,n=null==t||null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"contenteditable");return""===n||"true"===n}(t))&&!st(t)?0:t.tabIndex},ft=function(t,e){return t.tabIndex===e.tabIndex?t.documentOrder-e.documentOrder:t.tabIndex-e.tabIndex},dt=function(t){return"INPUT"===t.tagName},pt=function(t){return function(t){return dt(t)&&"radio"===t.type}(t)&&!function(t){if(!t.name)return!0;var e,n=t.form||lt(t),o=function(t){return n.querySelectorAll('input[type="radio"][name="'+t+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)e=o(window.CSS.escape(t.name));else try{e=o(t.name)}catch(t){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",t.message),!1}var r=function(t,e){for(var n=0;n<t.length;n++)if(t[n].checked&&t[n].form===e)return t[n]}(e,t.form);return!r||r===t}(t)},mt=function(t){var e=t.getBoundingClientRect(),n=e.width,o=e.height;return 0===n&&0===o},ht=function(t,e){var n=e.displayCheck,o=e.getShadowRoot;if("full-native"===n&&"checkVisibility"in t)return!t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if("hidden"===getComputedStyle(t).visibility)return!0;var r=it.call(t,"details>summary:first-of-type")?t.parentElement:t;if(it.call(r,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"full-native"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return mt(t)}else{if("function"==typeof o){for(var i=t;t;){var l=t.parentElement,c=lt(t);if(l&&!l.shadowRoot&&!0===o(l))return mt(t);t=t.assignedSlot?t.assignedSlot:l||c===t.ownerDocument?l:c.host}t=i}if(function(t){var e,n,o,r,i=t&<(t),l=null===(e=i)||void 0===e?void 0:e.host,c=!1;if(i&&i!==t)for(c=!!(null!==(n=l)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=t&&null!==(r=t.ownerDocument)&&void 0!==r&&r.contains(t));!c&&l;){var a,s,u;c=!(null===(s=l=null===(a=i=lt(l))||void 0===a?void 0:a.host)||void 0===s||null===(u=s.ownerDocument)||void 0===u||!u.contains(l))}return c}(t))return!t.getClientRects().length;if("legacy-full"!==n)return!0}return!1},gt=function(t,e){return!(e.disabled||function(t){return dt(t)&&"hidden"===t.type}(e)||ht(e,t)||function(t){return"DETAILS"===t.tagName&&Array.prototype.slice.apply(t.children).some(function(t){return"SUMMARY"===t.tagName})}(e)||function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var e=t.parentElement;e;){if("FIELDSET"===e.tagName&&e.disabled){for(var n=0;n<e.children.length;n++){var o=e.children.item(n);if("LEGEND"===o.tagName)return!!it.call(e,"fieldset[disabled] *")||!o.contains(t)}return!0}e=e.parentElement}return!1}(e))},yt=function(t,e){return!(pt(e)||ut(e)<0||!gt(t,e))},vt=function(t){var e=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(e)||e>=0)},wt=function(t){var e=[],n=[];return t.forEach(function(t,o){var r=!!t.scopeParent,i=r?t.scopeParent:t,l=function(t,e){var n=ut(t);return n<0&&e&&!st(t)?0:n}(i,r),c=r?wt(t.candidates):i;0===l?r?e.push.apply(e,c):e.push(i):n.push({documentOrder:o,tabIndex:l,item:t,isScope:r,content:c})}),n.sort(ft).reduce(function(t,e){return e.isScope?t.push.apply(t,e.content):t.push(e.content),t},[]).concat(e)},bt=function(t,e){var n;return n=(e=e||{}).getShadowRoot?at([t],e.includeContainer,{filter:yt.bind(null,e),flatten:!1,getShadowRoot:e.getShadowRoot,shadowRootFilter:vt}):function(t,e,n){if(ct(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(ot));return e&&it.call(t,ot)&&o.unshift(t),o.filter(n)}(t,e.includeContainer,yt.bind(null,e)),wt(n)};function xt(t,e,n){let{reference:o,floating:r}=t;const i=X(e),l=Y(e),c=$(l),a=z(e),s="y"===i,u=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,d=o[c]/2-r[c]/2;let p;switch(a){case"top":p={x:u,y:o.y-r.height};break;case"bottom":p={x:u,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:f};break;case"left":p={x:o.x-r.width,y:f};break;default:p={x:o.x,y:o.y}}switch(H(e)){case"start":p[l]-=d*(n&&s?-1:1);break;case"end":p[l]+=d*(n&&s?-1:1)}return p}async function Rt(t,e){var n;void 0===e&&(e={});const{x:o,y:r,platform:i,rects:l,elements:c,strategy:a}=t,{boundary:s="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=W(e,t),m=et(p),h=c[d?"floating"===f?"reference":"floating":f],g=nt(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:s,rootBoundary:u,strategy:a})),y="floating"===f?{x:o,y:r,width:l.floating.width,height:l.floating.height}:l.reference,v=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),w=await(null==i.isElement?void 0:i.isElement(v))&&await(null==i.getScale?void 0:i.getScale(v))||{x:1,y:1},b=nt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:v,strategy:a}):y);return{top:(g.top-b.top+m.top)/w.y,bottom:(b.bottom-g.bottom+m.bottom)/w.y,left:(g.left-b.left+m.left)/w.x,right:(b.right-g.right+m.right)/w.x}}function St(t){const e=k(...t.map(t=>t.left)),n=k(...t.map(t=>t.top));return{x:e,y:n,width:M(...t.map(t=>t.right))-e,height:M(...t.map(t=>t.bottom))-n}}const Et=new Set(["left","top"]);function Ct(t){const e=A(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=f(t),i=r?t.offsetWidth:n,l=r?t.offsetHeight:o,c=F(n)!==i||F(o)!==l;return c&&(n=i,o=l),{width:n,height:o,$:c}}function At(t){return u(t)?t:t.contextElement}function Tt(t){const e=At(t);if(!f(e))return I(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:i}=Ct(e);let l=(i?F(n.width):n.width)/o,c=(i?F(n.height):n.height)/r;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const Lt=I(0);function Ot(t){const e=c(t);return S()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:Lt}function Dt(t,e,n,o){void 0===e&&(e=!1),void 0===n&&(n=!1);const r=t.getBoundingClientRect(),i=At(t);let l=I(1);e&&(o?u(o)&&(l=Tt(o)):l=Tt(t));const a=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==c(t))&&e}(i,n,o)?Ot(i):I(0);let s=(r.left+a.x)/l.x,f=(r.top+a.y)/l.y,d=r.width/l.x,p=r.height/l.y;if(i){const t=c(i),e=o&&u(o)?c(o):o;let n=t,r=P(n);for(;r&&o&&e!==n;){const t=Tt(r),e=r.getBoundingClientRect(),o=A(r),i=e.left+(r.clientLeft+parseFloat(o.paddingLeft))*t.x,l=e.top+(r.clientTop+parseFloat(o.paddingTop))*t.y;s*=t.x,f*=t.y,d*=t.x,p*=t.y,s+=i,f+=l,n=c(r),r=P(n)}}return nt({width:d,height:p,x:s,y:f})}function Pt(t,e){const n=T(t).scrollLeft;return e?e.left+n:Dt(a(t)).left+n}function kt(t,e){const n=t.getBoundingClientRect();return{x:n.left+e.scrollLeft-Pt(t,n),y:n.top+e.scrollTop}}const Mt=new Set(["absolute","fixed"]);function Ft(t,e,n){let o;if("viewport"===e)o=function(t,e){const n=c(t),o=a(t),r=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,s=0,u=0;if(r){i=r.width,l=r.height;const t=S();(!t||t&&"fixed"===e)&&(s=r.offsetLeft,u=r.offsetTop)}const f=Pt(o);if(f<=0){const t=o.ownerDocument,e=t.body,n=getComputedStyle(e),r="CSS1Compat"===t.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,l=Math.abs(o.clientWidth-e.clientWidth-r);l<=25&&(i-=l)}else f<=25&&(i+=f);return{width:i,height:l,x:s,y:u}}(t,n);else if("document"===e)o=function(t){const e=a(t),n=T(t),o=t.ownerDocument.body,r=M(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=M(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+Pt(t);const c=-n.scrollTop;return"rtl"===A(o).direction&&(l+=M(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:l,y:c}}(a(t));else if(u(e))o=function(t,e){const n=Dt(t,!0,"fixed"===e),o=n.top+t.clientTop,r=n.left+t.clientLeft,i=f(t)?Tt(t):I(1);return{width:t.clientWidth*i.x,height:t.clientHeight*i.y,x:r*i.x,y:o*i.y}}(e,n);else{const n=Ot(t);o={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return nt(o)}function Nt(t,e){const n=L(t);return!(n===e||!u(n)||C(n))&&("fixed"===A(n).position||Nt(n,e))}function It(t,e,n){const o=f(e),r=a(e),i="fixed"===n,c=Dt(t,!0,i,e);let s={scrollLeft:0,scrollTop:0};const u=I(0);function d(){u.x=Pt(r)}if(o||!o&&!i)if(("body"!==l(e)||m(r))&&(s=T(e)),o){const t=Dt(e,!0,i,e);u.x=t.x+e.clientLeft,u.y=t.y+e.clientTop}else r&&d();i&&!o&&r&&d();const p=!r||o||i?I(0):kt(r,s);return{x:c.left+s.scrollLeft-u.x-p.x,y:c.top+s.scrollTop-u.y-p.y,width:c.width,height:c.height}}function Bt(t){return"static"===A(t).position}function jt(t,e){if(!f(t)||"fixed"===A(t).position)return null;if(e)return e(t);let n=t.offsetParent;return a(t)===n&&(n=n.ownerDocument.body),n}function Vt(t,e){const n=c(t);if(v(t))return n;if(!f(t)){let e=L(t);for(;e&&!C(e);){if(u(e)&&!Bt(e))return e;e=L(e)}return n}let o=jt(t,e);for(;o&&g(o)&&Bt(o);)o=jt(o,e);return o&&C(o)&&Bt(o)&&!R(o)?n:o||function(t){let e=L(t);for(;f(e)&&!C(e);){if(R(e))return e;if(v(e))return null;e=L(e)}return null}(t)||n}const Wt={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const i="fixed"===r,c=a(o),s=!!e&&v(e.floating);if(o===c||s&&i)return n;let u={scrollLeft:0,scrollTop:0},d=I(1);const p=I(0),h=f(o);if((h||!h&&!i)&&(("body"!==l(o)||m(c))&&(u=T(o)),f(o))){const t=Dt(o);d=Tt(o),p.x=t.x+o.clientLeft,p.y=t.y+o.clientTop}const g=!c||h||i?I(0):kt(c,u);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-u.scrollLeft*d.x+p.x+g.x,y:n.y*d.y-u.scrollTop*d.y+p.y+g.y}},getDocumentElement:a,getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const i=[..."clippingAncestors"===n?v(e)?[]:function(t,e){const n=e.get(t);if(n)return n;let o=D(t,[],!1).filter(t=>u(t)&&"body"!==l(t)),r=null;const i="fixed"===A(t).position;let c=i?L(t):t;for(;u(c)&&!C(c);){const e=A(c),n=R(c);n||"fixed"!==e.position||(r=null),(i?!n&&!r:!n&&"static"===e.position&&r&&Mt.has(r.position)||m(c)&&!n&&Nt(t,c))?o=o.filter(t=>t!==c):r=e,c=L(c)}return e.set(t,o),o}(e,this._c):[].concat(n),o],c=i[0],a=i.reduce((t,n)=>{const o=Ft(e,n,r);return t.top=M(o.top,t.top),t.right=k(o.right,t.right),t.bottom=k(o.bottom,t.bottom),t.left=M(o.left,t.left),t},Ft(e,c,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Vt,getElementRects:async function(t){const e=this.getOffsetParent||Vt,n=this.getDimensions,o=await n(t.floating);return{reference:It(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:n}=Ct(t);return{width:e,height:n}},getScale:Tt,isElement:u,isRTL:function(t){return"rtl"===A(t).direction}};function zt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Ht(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=o,u=At(t),f=r||i?[...u?D(u):[],...D(e)]:[];f.forEach(t=>{r&&t.addEventListener("scroll",n,{passive:!0}),i&&t.addEventListener("resize",n)});const d=u&&c?function(t,e){let n,o=null;const r=a(t);function i(){var t;clearTimeout(n),null==(t=o)||t.disconnect(),o=null}return function l(c,a){void 0===c&&(c=!1),void 0===a&&(a=1),i();const s=t.getBoundingClientRect(),{left:u,top:f,width:d,height:p}=s;if(c||e(),!d||!p)return;const m={rootMargin:-N(f)+"px "+-N(r.clientWidth-(u+d))+"px "+-N(r.clientHeight-(f+p))+"px "+-N(u)+"px",threshold:M(0,k(1,a))||1};let h=!0;function g(e){const o=e[0].intersectionRatio;if(o!==a){if(!h)return l();o?l(!1,o):n=setTimeout(()=>{l(!1,1e-7)},1e3)}1!==o||zt(s,t.getBoundingClientRect())||l(),h=!1}try{o=new IntersectionObserver(g,{...m,root:r.ownerDocument})}catch(t){o=new IntersectionObserver(g,m)}o.observe(t)}(!0),i}(u,n):null;let p,m=-1,h=null;l&&(h=new ResizeObserver(t=>{let[o]=t;o&&o.target===u&&h&&(h.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var t;null==(t=h)||t.observe(e)})),n()}),u&&!s&&h.observe(u),h.observe(e));let g=s?Dt(t):null;return s&&function e(){const o=Dt(t);g&&!zt(g,o)&&n();g=o,p=requestAnimationFrame(e)}(),n(),()=>{var t;f.forEach(t=>{r&&t.removeEventListener("scroll",n),i&&t.removeEventListener("resize",n)}),null==d||d(),null==(t=h)||t.disconnect(),h=null,s&&cancelAnimationFrame(p)}}const qt=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:i,placement:l,middlewareData:c}=e,a=await async function(t,e){const{placement:n,platform:o,elements:r}=t,i=await(null==o.isRTL?void 0:o.isRTL(r.floating)),l=z(n),c=H(n),a="y"===X(n),s=Et.has(l)?-1:1,u=i&&a?-1:1,f=W(e,t);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&"number"==typeof m&&(p="end"===c?-1*m:m),a?{x:p*u,y:d*s}:{x:d*s,y:p*u}}(e,t);return l===(null==(n=c.offset)?void 0:n.placement)&&null!=(o=c.arrow)&&o.alignmentOffset?{}:{x:r+a.x,y:i+a.y,data:{...a,placement:l}}}}},$t=function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r}=e,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...a}=W(t,e),s={x:n,y:o},u=await Rt(e,a),f=X(z(r)),d=q(f);let p=s[d],m=s[f];if(i){const t="y"===d?"bottom":"right";p=V(p+u["y"===d?"top":"left"],p,p-u[t])}if(l){const t="y"===f?"bottom":"right";m=V(m+u["y"===f?"top":"left"],m,m-u[t])}const h=c.fn({...e,[d]:p,[f]:m});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[d]:i,[f]:l}}}}}},Ut=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:i,rects:l,initialPlacement:c,platform:a,elements:s}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=W(t,e);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=z(r),v=X(c),w=z(c)===c,b=await(null==a.isRTL?void 0:a.isRTL(s.floating)),x=d||(w||!h?[tt(c)]:function(t){const e=tt(t);return[_(t),e,_(e)]}(c)),R="none"!==m;!d&&R&&x.push(...Q(c,h,m,b));const S=[c,...x],E=await Rt(e,g),C=[];let A=(null==(o=i.flip)?void 0:o.overflows)||[];if(u&&C.push(E[y]),f){const t=function(t,e,n){void 0===n&&(n=!1);const o=H(t),r=Y(t),i=$(r);let l="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return e.reference[i]>e.floating[i]&&(l=tt(l)),[l,tt(l)]}(r,l,b);C.push(E[t[0]],E[t[1]])}if(A=[...A,{placement:r,overflows:C}],!C.every(t=>t<=0)){var T,L;const t=((null==(T=i.flip)?void 0:T.index)||0)+1,e=S[t];if(e){if(!("alignment"===f&&v!==X(e))||A.every(t=>X(t.placement)!==v||t.overflows[0]>0))return{data:{index:t,overflows:A},reset:{placement:e}}}let n=null==(L=A.filter(t=>t.overflows[0]<=0).sort((t,e)=>t.overflows[1]-e.overflows[1])[0])?void 0:L.placement;if(!n)switch(p){case"bestFit":{var O;const t=null==(O=A.filter(t=>{if(R){const e=X(t.placement);return e===v||"y"===e}return!0}).map(t=>[t.placement,t.overflows.filter(t=>t>0).reduce((t,e)=>t+e,0)]).sort((t,e)=>t[1]-e[1])[0])?void 0:O[0];t&&(n=t);break}case"initialPlacement":n=c}if(r!==n)return{reset:{placement:n}}}return{}}}},Xt=function(t){return void 0===t&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:r,rects:i,platform:l,elements:c}=e,{apply:a=()=>{},...s}=W(t,e),u=await Rt(e,s),f=z(r),d=H(r),p="y"===X(r),{width:m,height:h}=i.floating;let g,y;"top"===f||"bottom"===f?(g=f,y=d===(await(null==l.isRTL?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(y=f,g="end"===d?"top":"bottom");const v=h-u.top-u.bottom,w=m-u.left-u.right,b=k(h-u[g],v),x=k(m-u[y],w),R=!e.middlewareData.shift;let S=b,E=x;if(null!=(n=e.middlewareData.shift)&&n.enabled.x&&(E=w),null!=(o=e.middlewareData.shift)&&o.enabled.y&&(S=v),R&&!d){const t=M(u.left,0),e=M(u.right,0),n=M(u.top,0),o=M(u.bottom,0);p?E=m-2*(0!==t||0!==e?t+e:M(u.left,u.right)):S=h-2*(0!==n||0!==o?n+o:M(u.top,u.bottom))}await a({...e,availableWidth:E,availableHeight:S});const C=await l.getDimensions(c.floating);return m!==C.width||h!==C.height?{reset:{rects:!0}}:{}}}},Yt=function(t){return void 0===t&&(t={}),{name:"inline",options:t,async fn(e){const{placement:n,elements:o,rects:r,platform:i,strategy:l}=e,{padding:c=2,x:a,y:s}=W(t,e),u=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(o.reference))||[]),f=function(t){const e=t.slice().sort((t,e)=>t.y-e.y),n=[];let o=null;for(let t=0;t<e.length;t++){const r=e[t];!o||r.y-o.y>o.height/2?n.push([r]):n[n.length-1].push(r),o=r}return n.map(t=>nt(St(t)))}(u),d=nt(St(u)),p=et(c);const m=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===f.length&&f[0].left>f[1].right&&null!=a&&null!=s)return f.find(t=>a>t.left-p.left&&a<t.right+p.right&&s>t.top-p.top&&s<t.bottom+p.bottom)||d;if(f.length>=2){if("y"===X(n)){const t=f[0],e=f[f.length-1],o="top"===z(n),r=t.top,i=e.bottom,l=o?t.left:e.left,c=o?t.right:e.right;return{top:r,bottom:i,left:l,right:c,width:c-l,height:i-r,x:l,y:r}}const t="left"===z(n),e=M(...f.map(t=>t.right)),o=k(...f.map(t=>t.left)),r=f.filter(n=>t?n.left===o:n.right===e),i=r[0].top,l=r[r.length-1].bottom;return{top:i,bottom:l,left:o,right:e,width:e-o,height:l-i,x:o,y:i}}return d}},floating:o.floating,strategy:l});return r.reference.x!==m.reference.x||r.reference.y!==m.reference.y||r.reference.width!==m.reference.width||r.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}},_t=(t,e,n)=>{const o=new Map,r={platform:Wt,...n},i={...r.platform,_c:o};return(async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:l}=n,c=i.filter(Boolean),a=await(null==l.isRTL?void 0:l.isRTL(e));let s=await l.getElementRects({reference:t,floating:e,strategy:r}),{x:u,y:f}=xt(s,o,a),d=o,p={},m=0;for(let n=0;n<c.length;n++){const{name:i,fn:h}=c[n],{x:g,y:y,data:v,reset:w}=await h({x:u,y:f,initialPlacement:o,placement:d,strategy:r,middlewareData:p,rects:s,platform:l,elements:{reference:t,floating:e}});u=null!=g?g:u,f=null!=y?y:f,p={...p,[i]:{...p[i],...v}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(s=!0===w.rects?await l.getElementRects({reference:t,floating:e,strategy:r}):w.rects),({x:u,y:f}=xt(s,d,a))),n=-1)}return{x:u,y:f,placement:d,strategy:r,middlewareData:p}})(t,e,{...r,platform:i})};var Zt="undefined"!=typeof document?e:function(){};function Gt(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if("function"==typeof t&&t.toString()===e.toString())return!0;let n,o,r;if(t&&e&&"object"==typeof t){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;0!==o--;)if(!Gt(t[o],e[o]))return!1;return!0}if(r=Object.keys(t),n=r.length,n!==Object.keys(e).length)return!1;for(o=n;0!==o--;)if(!{}.hasOwnProperty.call(e,r[o]))return!1;for(o=n;0!==o--;){const n=r[o];if(("_owner"!==n||!t.$$typeof)&&!Gt(t[n],e[n]))return!1}return!0}return t!=t&&e!=e}function Jt(t){if("undefined"==typeof window)return 1;return(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Kt(t,e){const n=Jt(t);return Math.round(e*n)/n}function Qt(e){const n=t.useRef(e);return Zt(()=>{n.current=e}),n}const te=(t,e)=>({...qt(t),options:[t,e]}),ee=(t,e)=>({...$t(t),options:[t,e]}),ne=(t,e)=>({...Ut(t),options:[t,e]}),oe=(t,e)=>({...Xt(t),options:[t,e]}),re=(t,e)=>({...Yt(t),options:[t,e]}),ie={...t},le=ie.useInsertionEffect||(t=>t());var ce="undefined"!=typeof document?e:n;function ae(){return ae=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},ae.apply(this,arguments)}let se=!1,ue=0;const fe=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+ue++;const de=ie.useId||function(){const[e,n]=t.useState(()=>se?fe():void 0);return ce(()=>{null==e&&n(fe())},[]),t.useEffect(()=>{se=!0},[]),e};const pe=t.createContext(null),me=t.createContext(null);function he(t){return"data-floating-ui-"+t}function ge(t){const e=o(t);return ce(()=>{e.current=t}),e}const ye=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ve(t,e){const n=bt(t,ye());"prev"===e&&n.reverse();const o=n.indexOf(function(t){let e=t.activeElement;for(;null!=(null==(n=e)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;e=e.shadowRoot.activeElement}return e}((null==(r=t)?void 0:r.ownerDocument)||document));var r;return n.slice(o+1)[0]}function we(t,e){const n=e||t.currentTarget,o=t.relatedTarget;return!o||!function(t,e){if(!t||!e)return!1;const n=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&d(n)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}(n,o)}function be(t){bt(t,ye()).forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")})}function xe(t){t.querySelectorAll("[data-tabindex]").forEach(t=>{const e=t.dataset.tabindex;delete t.dataset.tabindex,e?t.setAttribute("tabindex",e):t.removeAttribute("tabindex")})}const Re={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function Se(t){"Tab"===t.key&&(t.target,clearTimeout(undefined))}const Ee=t.forwardRef(function(e,n){const[o,r]=t.useState();ce(()=>(/apple/i.test(navigator.vendor)&&r("button"),document.addEventListener("keydown",Se),()=>{document.removeEventListener("keydown",Se)}),[]);const i={ref:n,tabIndex:0,role:o,"aria-hidden":!o||void 0,[he("focus-guard")]:"",style:Re};return t.createElement("span",ae({},e,i))}),Ce=t.createContext(null),Ae=he("portal");function Te(e){const{children:n,id:o,root:i,preserveTabOrder:l=!0}=e,c=function(e){void 0===e&&(e={});const{id:n,root:o}=e,r=de(),i=Le(),[l,c]=t.useState(null),a=t.useRef(null);return ce(()=>()=>{null==l||l.remove(),queueMicrotask(()=>{a.current=null})},[l]),ce(()=>{if(!r)return;if(a.current)return;const t=n?document.getElementById(n):null;if(!t)return;const e=document.createElement("div");e.id=r,e.setAttribute(Ae,""),t.appendChild(e),a.current=e,c(e)},[n,r]),ce(()=>{if(null===o)return;if(!r)return;if(a.current)return;let t=o||(null==i?void 0:i.portalNode);t&&!u(t)&&(t=t.current),t=t||document.body;let e=null;n&&(e=document.createElement("div"),e.id=n,t.appendChild(e));const l=document.createElement("div");l.id=r,l.setAttribute(Ae,""),t=e||t,t.appendChild(l),a.current=l,c(l)},[n,o,r,i]),l}({id:o,root:i}),[a,s]=t.useState(null),f=t.useRef(null),d=t.useRef(null),p=t.useRef(null),m=t.useRef(null),h=null==a?void 0:a.modal,g=null==a?void 0:a.open,y=!!a&&!a.modal&&a.open&&l&&!(!i&&!c);return t.useEffect(()=>{if(c&&l&&!h)return c.addEventListener("focusin",t,!0),c.addEventListener("focusout",t,!0),()=>{c.removeEventListener("focusin",t,!0),c.removeEventListener("focusout",t,!0)};function t(t){if(c&&we(t)){("focusin"===t.type?xe:be)(c)}}},[c,l,h]),t.useEffect(()=>{c&&(g||xe(c))},[g,c]),t.createElement(Ce.Provider,{value:t.useMemo(()=>({preserveTabOrder:l,beforeOutsideRef:f,afterOutsideRef:d,beforeInsideRef:p,afterInsideRef:m,portalNode:c,setFocusManagerState:s}),[l,c])},y&&c&&t.createElement(Ee,{"data-type":"outside",ref:f,onFocus:t=>{if(we(t,c)){var e;null==(e=p.current)||e.focus()}else{const t=ve(document.body,"prev")||(null==a?void 0:a.refs.domReference.current);null==t||t.focus()}}}),y&&c&&t.createElement("span",{"aria-owns":c.id,style:Re}),c&&r.createPortal(n,c),y&&c&&t.createElement(Ee,{"data-type":"outside",ref:d,onFocus:t=>{if(we(t,c)){var e;null==(e=m.current)||e.focus()}else{const e=ve(document.body,"next")||(null==a?void 0:a.refs.domReference.current);null==e||e.focus(),(null==a?void 0:a.closeOnFocusOut)&&(null==a||a.onOpenChange(!1,t.nativeEvent,"focus-out"))}}}))}const Le=()=>t.useContext(Ce);let Oe=0;function De(){const t=/iP(hone|ad|od)|iOS/.test(function(){const t=navigator.userAgentData;return null!=t&&t.platform?t.platform:navigator.platform}()),e=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,r=e.left?parseFloat(e.left):window.scrollX,i=e.top?parseFloat(e.top):window.scrollY;if(e.overflow="hidden",o&&(e[n]=o+"px"),t){var l,c;const t=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(e,{position:"fixed",top:-(i-Math.floor(n))+"px",left:-(r-Math.floor(t))+"px",right:"0"})}return()=>{Object.assign(e,{overflow:"",[n]:""}),t&&(Object.assign(e,{position:"",top:"",left:"",right:""}),window.scrollTo(r,i))}}let Pe=()=>{};const ke=t.forwardRef(function(e,n){const{lockScroll:o=!1,...r}=e;return ce(()=>{if(o)return Oe++,1===Oe&&(Pe=De()),()=>{Oe--,0===Oe&&Pe()}},[o]),t.createElement("div",ae({ref:n},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))});function Me(e){const{open:n=!1,onOpenChange:o,elements:r}=e,i=de(),l=t.useRef({}),[c]=t.useState(()=>function(){const t=new Map;return{emit(e,n){var o;null==(o=t.get(e))||o.forEach(t=>t(n))},on(e,n){t.set(e,[...t.get(e)||[],n])},off(e,n){var o;t.set(e,(null==(o=t.get(e))?void 0:o.filter(t=>t!==n))||[])}}}()),a=null!=((null==(s=t.useContext(pe))?void 0:s.id)||null);var s;const[u,f]=t.useState(r.reference),d=function(e){const n=t.useRef(()=>{});return le(()=>{n.current=e}),t.useCallback(function(){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];return null==n.current?void 0:n.current(...e)},[])}((t,e,n)=>{l.current.openEvent=t?e:void 0,c.emit("openchange",{open:t,event:e,reason:n,nested:a}),null==o||o(t,e,n)}),p=t.useMemo(()=>({setPositionReference:f}),[]),m=t.useMemo(()=>({reference:u||r.reference||null,floating:r.floating||null,domReference:r.reference}),[u,r.reference,r.floating]);return t.useMemo(()=>({dataRef:l,open:n,onOpenChange:d,elements:m,events:c,floatingId:i,refs:p}),[n,d,m,c,i,p])}function Fe(e){void 0===e&&(e={});const{nodeId:n}=e,o=Me({...e,elements:{reference:null,floating:null,...e.elements}}),i=e.rootContext||o,l=i.elements,[c,a]=t.useState(null),[s,f]=t.useState(null),d=(null==l?void 0:l.domReference)||c,p=t.useRef(null),m=t.useContext(me);ce(()=>{d&&(p.current=d)},[d]);const h=function(e){void 0===e&&(e={});const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:l,elements:{reference:c,floating:a}={},transform:s=!0,whileElementsMounted:u,open:f}=e,[d,p]=t.useState({x:0,y:0,strategy:o,placement:n,middlewareData:{},isPositioned:!1}),[m,h]=t.useState(i);Gt(m,i)||h(i);const[g,y]=t.useState(null),[v,w]=t.useState(null),b=t.useCallback(t=>{t!==E.current&&(E.current=t,y(t))},[]),x=t.useCallback(t=>{t!==C.current&&(C.current=t,w(t))},[]),R=c||g,S=a||v,E=t.useRef(null),C=t.useRef(null),A=t.useRef(d),T=null!=u,L=Qt(u),O=Qt(l),D=Qt(f),P=t.useCallback(()=>{if(!E.current||!C.current)return;const t={placement:n,strategy:o,middleware:m};O.current&&(t.platform=O.current),_t(E.current,C.current,t).then(t=>{const e={...t,isPositioned:!1!==D.current};k.current&&!Gt(A.current,e)&&(A.current=e,r.flushSync(()=>{p(e)}))})},[m,n,o,O,D]);Zt(()=>{!1===f&&A.current.isPositioned&&(A.current.isPositioned=!1,p(t=>({...t,isPositioned:!1})))},[f]);const k=t.useRef(!1);Zt(()=>(k.current=!0,()=>{k.current=!1}),[]),Zt(()=>{if(R&&(E.current=R),S&&(C.current=S),R&&S){if(L.current)return L.current(R,S,P);P()}},[R,S,P,L,T]);const M=t.useMemo(()=>({reference:E,floating:C,setReference:b,setFloating:x}),[b,x]),F=t.useMemo(()=>({reference:R,floating:S}),[R,S]),N=t.useMemo(()=>{const t={position:o,left:0,top:0};if(!F.floating)return t;const e=Kt(F.floating,d.x),n=Kt(F.floating,d.y);return s?{...t,transform:"translate("+e+"px, "+n+"px)",...Jt(F.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:e,top:n}},[o,s,F.floating,d.x,d.y]);return t.useMemo(()=>({...d,update:P,refs:M,elements:F,floatingStyles:N}),[d,P,M,F,N])}({...e,elements:{...l,...s&&{reference:s}}}),g=t.useCallback(t=>{const e=u(t)?{getBoundingClientRect:()=>t.getBoundingClientRect(),contextElement:t}:t;f(e),h.refs.setReference(e)},[h.refs]),y=t.useCallback(t=>{(u(t)||null===t)&&(p.current=t,a(t)),(u(h.refs.reference.current)||null===h.refs.reference.current||null!==t&&!u(t))&&h.refs.setReference(t)},[h.refs]),v=t.useMemo(()=>({...h.refs,setReference:y,setPositionReference:g,domReference:p}),[h.refs,y,g]),w=t.useMemo(()=>({...h.elements,domReference:d}),[h.elements,d]),b=t.useMemo(()=>({...h,...i,refs:v,elements:w,nodeId:n}),[h,v,w,n,i]);return ce(()=>{i.dataRef.current.floatingContext=b;const t=null==m?void 0:m.nodesRef.current.find(t=>t.id===n);t&&(t.context=b)}),t.useMemo(()=>({...h,context:b,refs:v,elements:w}),[h,v,w,b])}const Ne=t=>t.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,e)=>(e?"-":"")+t.toLowerCase());function Ie(t,e){return"function"==typeof t?t(e):t}function Be(e,n){void 0===n&&(n={});const{open:o,elements:{floating:r}}=e,{duration:i=250}=n,l=("number"==typeof i?i:i.close)||0,[c,a]=t.useState("unmounted"),s=function(e,n){const[o,r]=t.useState(e);return e&&!o&&r(!0),t.useEffect(()=>{if(!e&&o){const t=setTimeout(()=>r(!1),n);return()=>clearTimeout(t)}},[e,o,n]),o}(o,l);return s||"close"!==c||a("unmounted"),ce(()=>{if(r){if(o){a("initial");const t=requestAnimationFrame(()=>{a("open")});return()=>{cancelAnimationFrame(t)}}a("close")}},[o,r]),{isMounted:s,status:c}}function je(e,n){void 0===n&&(n={});const{initial:o={opacity:0},open:r,close:i,common:l,duration:c=250}=n,a=e.placement,s=a.split("-")[0],u=t.useMemo(()=>({side:s,placement:a}),[s,a]),f="number"==typeof c,d=(f?c:c.open)||0,p=(f?c:c.close)||0,[m,h]=t.useState(()=>({...Ie(l,u),...Ie(o,u)})),{isMounted:g,status:y}=Be(e,{duration:c}),v=ge(o),w=ge(r),b=ge(i),x=ge(l);return ce(()=>{const t=Ie(v.current,u),e=Ie(b.current,u),n=Ie(x.current,u),o=Ie(w.current,u)||Object.keys(t).reduce((t,e)=>(t[e]="",t),{});if("initial"===y&&h(e=>({transitionProperty:e.transitionProperty,...n,...t})),"open"===y&&h({transitionProperty:Object.keys(o).map(Ne).join(","),transitionDuration:d+"ms",...n,...o}),"close"===y){const o=e||t;h({transitionProperty:Object.keys(o).map(Ne).join(","),transitionDuration:p+"ms",...n,...o})}},[p,b,v,w,x,d,y,u]),{isMounted:g,styles:m}}export{Te as F,Ht as a,je as b,oe as c,ke as d,ne as f,re as i,te as o,ee as s,Fe as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as r,jsx as o}from"react/jsx-runtime";import t,{useRef as n,useMemo as a,useEffect as c,useCallback as l,useState as i,useLayoutEffect as u,forwardRef as s,cloneElement as f}from"react";import{u as h,o as d,f as p,s as g,a as v}from"./floating-ui.react-0123aadf.js";function m(){return(m=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e}).apply(this,arguments)}function b(e,r){if(null==e)return{};var o,t,n={},a=Object.keys(e);for(t=0;t<a.length;t++)r.indexOf(o=a[t])>=0||(n[o]=e[o]);return n}function _(e){var r=n(e),o=n(function(e){r.current&&r.current(e)});return r.current=e,o.current}var C=function(e,r,o){return void 0===r&&(r=0),void 0===o&&(o=1),e>o?o:e<r?r:e},k=function(e){return"touches"in e},x=function(e){return e&&e.ownerDocument.defaultView||self},w=function(e,r,o){var t=e.getBoundingClientRect(),n=k(r)?function(e,r){for(var o=0;o<e.length;o++)if(e[o].identifier===r)return e[o];return e[0]}(r.touches,o):r;return{left:C((n.pageX-(t.left+x(e).pageXOffset))/t.width),top:C((n.pageY-(t.top+x(e).pageYOffset))/t.height)}},y=function(e){!k(e)&&e.preventDefault()},F=t.memo(function(e){var r=e.onMove,o=e.onKey,l=b(e,["onMove","onKey"]),i=n(null),u=_(r),s=_(o),f=n(null),h=n(!1),d=a(function(){var e=function(e){y(e),(k(e)?e.touches.length>0:e.buttons>0)&&i.current?u(w(i.current,e,f.current)):o(!1)},r=function(){return o(!1)};function o(o){var t=h.current,n=x(i.current),a=o?n.addEventListener:n.removeEventListener;a(t?"touchmove":"mousemove",e),a(t?"touchend":"mouseup",r)}return[function(e){var r=e.nativeEvent,t=i.current;if(t&&(y(r),!function(e,r){return r&&!k(e)}(r,h.current)&&t)){if(k(r)){h.current=!0;var n=r.changedTouches||[];n.length&&(f.current=n[0].identifier)}t.focus(),u(w(t,r,f.current)),o(!0)}},function(e){var r=e.which||e.keyCode;r<37||r>40||(e.preventDefault(),s({left:39===r?.05:37===r?-.05:0,top:40===r?.05:38===r?-.05:0}))},o]},[s,u]),p=d[0],g=d[1],v=d[2];return c(function(){return v},[v]),t.createElement("div",m({},l,{onTouchStart:p,onMouseDown:p,className:"react-colorful__interactive",ref:i,onKeyDown:g,tabIndex:0,role:"slider"}))}),N=function(e){return e.filter(Boolean).join(" ")},E=function(e){var r=e.color,o=e.left,n=e.top,a=void 0===n?.5:n,c=N(["react-colorful__pointer",e.className]);return t.createElement("div",{className:c,style:{top:100*a+"%",left:100*o+"%"}},t.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:r}}))},O=function(e,r,o){return void 0===r&&(r=0),void 0===o&&(o=Math.pow(10,r)),Math.round(o*e)/o},M=function(e){return"#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?O(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?O(parseInt(e.substring(6,8),16)/255,2):1}},j=function(e){var r=function(e){var r=e.s,o=e.v,t=e.a,n=(200-r)*o/100;return{h:O(e.h),s:O(n>0&&n<200?r*o/100/(n<=100?n:200-n)*100:0),l:O(n/2),a:O(t,2)}}(e);return"hsl("+r.h+", "+r.s+"%, "+r.l+"%)"},H=function(e){var r=e.h,o=e.s,t=e.v,n=e.a;r=r/360*6,o/=100,t/=100;var a=Math.floor(r),c=t*(1-o),l=t*(1-(r-a)*o),i=t*(1-(1-r+a)*o),u=a%6;return{r:O(255*[t,l,c,c,i,t][u]),g:O(255*[i,t,t,l,c,c][u]),b:O(255*[c,c,i,t,t,l][u]),a:O(n,2)}},I=function(e){var r=e.toString(16);return r.length<2?"0"+r:r},L=function(e){var r=e.r,o=e.g,t=e.b,n=e.a,a=n<1?I(O(255*n)):"";return"#"+I(r)+I(o)+I(t)+a},B=function(e){var r=e.r,o=e.g,t=e.b,n=e.a,a=Math.max(r,o,t),c=a-Math.min(r,o,t),l=c?a===r?(o-t)/c:a===o?2+(t-r)/c:4+(r-o)/c:0;return{h:O(60*(l<0?l+6:l)),s:O(a?c/a*100:0),v:O(a/255*100),a:n}},z=t.memo(function(e){var r=e.hue,o=e.onChange,n=N(["react-colorful__hue",e.className]);return t.createElement("div",{className:n},t.createElement(F,{onMove:function(e){o({h:360*e.left})},onKey:function(e){o({h:C(r+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":O(r),"aria-valuemax":"360","aria-valuemin":"0"},t.createElement(E,{className:"react-colorful__hue-pointer",left:r/360,color:j({h:r,s:100,v:100,a:1})})))}),D=t.memo(function(e){var r=e.hsva,o=e.onChange,n={backgroundColor:j({h:r.h,s:100,v:100,a:1})};return t.createElement("div",{className:"react-colorful__saturation",style:n},t.createElement(F,{onMove:function(e){o({s:100*e.left,v:100-100*e.top})},onKey:function(e){o({s:C(r.s+100*e.left,0,100),v:C(r.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+O(r.s)+"%, Brightness "+O(r.v)+"%"},t.createElement(E,{className:"react-colorful__saturation-pointer",top:1-r.v/100,left:r.s/100,color:j(r)})))}),K=function(e,r){if(e===r)return!0;for(var o in e)if(e[o]!==r[o])return!1;return!0};function P(e,r,o){var t=_(o),a=i(function(){return e.toHsva(r)}),u=a[0],s=a[1],f=n({color:r,hsva:u});c(function(){if(!e.equal(r,f.current.color)){var o=e.toHsva(r);f.current={hsva:o,color:r},s(o)}},[r,e]),c(function(){var r;K(u,f.current.hsva)||e.equal(r=e.fromHsva(u),f.current.color)||(f.current={hsva:u,color:r},t(r))},[u,e,t]);var h=l(function(e){s(function(r){return Object.assign({},r,e)})},[]);return[u,h]}var S="undefined"!=typeof window?u:c,T=new Map,q=function(e){S(function(){var r=e.current?e.current.ownerDocument:document;if(void 0!==r&&!T.has(r)){var o=r.createElement("style");o.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',T.set(r,o);var t="undefined"!=typeof __webpack_nonce__?__webpack_nonce__:void 0;t&&o.setAttribute("nonce",t),r.head.appendChild(o)}},[])},A=function(e){var r=e.className,o=e.colorModel,a=e.color,c=void 0===a?o.defaultColor:a,l=e.onChange,i=b(e,["className","colorModel","color","onChange"]),u=n(null);q(u);var s=P(o,c,l),f=s[0],h=s[1],d=N(["react-colorful",r]);return t.createElement("div",m({},i,{ref:u,className:d}),t.createElement(D,{hsva:f,onChange:h}),t.createElement(z,{hue:f.h,onChange:h,className:"react-colorful__last-control"}))},$={defaultColor:"000",toHsva:function(e){return B(M(e))},fromHsva:function(e){return function(e){return L(H(e))}({h:e.h,s:e.s,v:e.v,a:1})},equal:function(e,r){return e.toLowerCase()===r.toLowerCase()||K(M(e),M(r))}},R=function(e){return t.createElement(A,m({},e,{colorModel:$}))},X=/^#?([0-9A-F]{3,8})$/i,Y=function(e){var r=e.color,o=void 0===r?"":r,n=e.onChange,a=e.onBlur,u=e.escape,s=e.validate,f=e.format,h=e.process,d=b(e,["color","onChange","onBlur","escape","validate","format","process"]),p=i(function(){return u(o)}),g=p[0],v=p[1],C=_(n),k=_(a),x=l(function(e){var r=u(e.target.value);v(r),s(r)&&C(h?h(r):r)},[u,h,s,C]),w=l(function(e){s(e.target.value)||v(u(o)),k(e)},[o,u,s,k]);return c(function(){v(u(o))},[o,u]),t.createElement("input",m({},d,{value:f?f(g):g,spellCheck:"false",onChange:x,onBlur:w}))},V=function(e){return"#"+e},G=function(e){var r=e.prefixed,o=e.alpha,n=b(e,["prefixed","alpha"]),a=l(function(e){return e.replace(/([^0-9A-F]+)/gi,"").substring(0,o?8:6)},[o]),c=l(function(e){return function(e,r){var o=X.exec(e),t=o?o[1].length:0;return 3===t||6===t||!!r&&4===t||!!r&&8===t}(e,o)},[o]);return t.createElement(Y,m({},n,{escape:a,format:r?V:void 0,process:V,validate:c}))};const J=["#FFFF00","#FFE066","#FFCC99","#FF9999","#99CCFF","#99FF99","#FF99FF","#CC99FF"],Q=s(({value:t={backgroundColor:"#FFFF00"},onChange:n,presets:a=J,showInput:l=!0,className:u,children:s,placement:m="bottom",offset:b=8},_)=>{const[C,k]=i(!1),[x,w]=i("backgroundColor"),[y,F]=i(t.backgroundColor),[N,E]=i(t.color),{refs:O,floatingStyles:M}=h({open:C,onOpenChange:k,placement:m,middleware:[d(b),p(),g()],whileElementsMounted:v});c(()=>{t.backgroundColor&&F(t.backgroundColor),t.color&&E(t.color)},[t]),c(()=>{if(!C)return;const e=e=>{const r=e.target,o=O.reference.current,t=O.floating.current;o&&o instanceof Element&&o.contains(r)||(null==t?void 0:t.contains(r))||k(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[C,O.floating,O.reference]);const j=e=>{"backgroundColor"===x?(F(e),null==n||n(Object.assign(Object.assign({},t),{backgroundColor:e}))):(E(e),null==n||n(Object.assign(Object.assign({},t),{color:e})))},H="backgroundColor"===x?y:N,I=f(s,{ref:O.setReference,onClick:e=>{var r,o;e.stopPropagation(),k(e=>!e),null===(o=(r=s.props).onClick)||void 0===o||o.call(r,e)}});return e(r,{children:[I,C&&e("div",Object.assign({ref:e=>{O.setFloating(e),_&&("function"==typeof _?_(e):_.current=e)},style:M,className:`yoopta-highlight-color-picker ${null!=u?u:""}`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()},{children:[e("div",Object.assign({className:"yoopta-highlight-color-picker__mode-toggle"},{children:[o("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"backgroundColor"===x,onClick:()=>w("backgroundColor"),"aria-label":"Background color"},{children:"Background"})),o("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"color"===x,onClick:()=>w("color"),"aria-label":"Text color"},{children:"Text"}))]})),o("div",Object.assign({className:"yoopta-highlight-color-picker__picker"},{children:o(R,{color:H,onChange:j,className:"yoopta-highlight-color-picker__react-colorful"})})),a.length>0&&o("div",Object.assign({className:"yoopta-highlight-color-picker__presets"},{children:a.map(e=>{const r=(null==H?void 0:H.toLowerCase())===e.toLowerCase();return o("button",{type:"button",className:"yoopta-highlight-color-picker__preset","data-selected":r,style:{backgroundColor:e},onClick:()=>j(e),"aria-label":`Select color ${e}`},e)})})),l&&e("div",Object.assign({className:"yoopta-highlight-color-picker__hex-row"},{children:[o("div",{className:"yoopta-highlight-color-picker__swatch",style:{backgroundColor:H}}),o(G,{color:H,onChange:j,className:"yoopta-highlight-color-picker__hex-input",prefixed:!0})]}))]}))]})});Q.displayName="HighlightColorPicker";export{Q as H};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e}from"./_tslib-5e145dfd.js";import{jsx as t}from"react/jsx-runtime";import{forwardRef as o,useCallback as a,useMemo as s,useEffect as n}from"react";import{Portal as r}from"../portal.js";import{u as i,i as l,f as c,s as d,o as p,a as u,b as m}from"./floating-ui.react-0123aadf.js";import{useYooptaEditor as f}from"@yoopta/editor";import{c as g}from"./index-06d5c4e7.js";import{t as h}from"./throttle-dea4a39e.js";const v=o((o,a)=>{var{className:s,children:n}=o,i=e(o,["className","children"]);return t(r,Object.assign({id:"yoopta-ui-toolbar-portal"},{children:t("div",Object.assign({ref:a,className:`yoopta-ui-toolbar ${s||""}`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()},i,{children:n}))}))});v.displayName="Toolbar.Root";const b=o((o,a)=>{var{className:s,children:n}=o,r=e(o,["className","children"]);return t("div",Object.assign({ref:a,className:`yoopta-ui-toolbar-group ${s}`},r,{children:n}))});b.displayName="Toolbar.Group";const y=o((o,a)=>{var{className:s}=o,n=e(o,["className"]);return t("div",Object.assign({ref:a,className:`yoopta-ui-toolbar-separator ${s}`},n))});y.displayName="Toolbar.Separator";const N=o((o,a)=>{var{className:s,children:n,active:r,disabled:i,type:l="button"}=o,c=e(o,["className","children","active","disabled","type"]);return t("button",Object.assign({ref:a,type:l,disabled:i,"data-active":r,className:`yoopta-ui-toolbar-button ${s}`},c,{children:n}))});N.displayName="Toolbar.Button";const j={Root:v,Group:b,Separator:y,Button:N},w=g()(e=>({state:"closed",frozen:!1,open(){e({state:"open"})},close(){e({state:"closed",frozen:!1})},toggle(t){e({state:t})},setFrozen(t){e({frozen:t})},reset(){e({state:"closed",frozen:!1})}})),O=()=>{const e=f(),{state:t,frozen:o,open:r,close:g,setFrozen:v,toggle:b,reset:y}=w(),{refs:N,floatingStyles:j,context:O}=i({placement:"top",open:"open"===t,middleware:[l(),c(),d(),p(10)],whileElementsMounted:u}),{isMounted:R,styles:z}=m(O,{duration:100}),A=a(()=>{var a,s;if(o)return;const n=N.floating.current;if(n&&n.contains(document.activeElement))return;const i=window.getSelection();if(!i||(null==i?void 0:i.isCollapsed)||(null==i?void 0:i.anchorOffset)===(null==i?void 0:i.focusOffset))return void("open"===t&&g());const l=i.getRangeAt(0),c=l.getBoundingClientRect(),d=l.toString().trim(),p=null==l?void 0:l.commonAncestorContainer,u=!!(null===(a=null==p?void 0:p.closest)||void 0===a?void 0:a.call(p,"[data-custom-editor]"));if((null===(s=e.refElement)||void 0===s?void 0:s.contains(p))&&!u){if(l&&d.length>0){const e={getBoundingClientRect:()=>c,getClientRects:()=>l.getClientRects()};N.setReference(e),"open"!==t&&r()}}else"open"===t&&g()},[o,N,e.refElement,g,r,t]),C=a(()=>{var o;if(!Array.isArray(e.path.selected)||0===e.path.selected.length||"mousemove"!==e.path.source&&"keyboard"!==e.path.source)return void("open"===t&&g());const a=Math.min(...e.path.selected),s=Math.max(...e.path.selected);let n=!0;"number"==typeof e.path.current&&(n=Math.abs(e.path.current-s)<=Math.abs(e.path.current-a));const i=e.getBlock({at:n?s:a});if(!i)return;const l=null===(o=e.refElement)||void 0===o?void 0:o.querySelector(`[data-yoopta-block-id="${i.id}"]`);l&&(N.setReference(l),"open"!==t&&r())},[e,N,g,r,t]),M=s(()=>h(A,200,{leading:!0,trailing:!0}),[A]);n(()=>{if(Array.isArray(e.path.selected)||e.path.selection){if(!Array.isArray(e.path.selected)||e.path.selection)return window.document.addEventListener("selectionchange",M),()=>window.document.removeEventListener("selectionchange",M);C()}else"open"===t&&g()},[e.path.selected,e.path.selection,t,M,g,C]);const E=s(()=>Object.assign(Object.assign({},j),z),[j,z]);return{isOpen:R,state:t,frozen:o,open:r,close:g,toggle:b,setFrozen:v,reset:y,getRootProps:()=>({ref:N.setFloating,style:E,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()})}};export{j as T,w as a,O as u};
|