@soul-refiner/design-system 2.14.164 → 2.14.165

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,4 +1,4 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("styled-components"),n=require("@udecode/plate-common"),o=require("@udecode/plate-media"),i=require("../../feedback/tooltip/tooltip.js"),c=require("../navbar/alignment_dropdown.js"),s=require("../navbar/style_dropdown.js"),l=require("../../../icons/basic/bold.js"),d=require("../../../icons/basic/image.js"),a=require("../../../icons/basic/italic.js"),u=require("../../../icons/basic/link.js"),p=require("../../../icons/text/list_ordered.js"),x=require("../../../icons/text/list_unordered.js"),j=require("../../../icons/arrow/redo.js"),g=require("../../../icons/basic/underline.js"),h=require("../../../icons/arrow/undo.js"),y=require("../../../icons/audio_video/microphone.js"),f=require("../constants.js"),v=require("../styles/menu_button.js");function M(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var E=M(t);const k="undefined"!=typeof window?window.SpeechRecognition||window.webkitSpeechRecognition:void 0,m=r.styled.nav`
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("styled-components"),n=require("@udecode/plate-common"),o=require("@udecode/plate-media"),i=require("@udecode/plate-link"),c=require("../../feedback/tooltip/tooltip.js"),s=require("../navbar/alignment_dropdown.js"),l=require("../navbar/style_dropdown.js"),d=require("../../../icons/basic/bold.js"),a=require("../../../icons/basic/image.js"),u=require("../../../icons/basic/italic.js"),p=require("../../../icons/basic/link.js"),x=require("../../../icons/text/list_ordered.js"),j=require("../../../icons/text/list_unordered.js"),g=require("../../../icons/arrow/redo.js"),h=require("../../../icons/basic/underline.js"),f=require("../../../icons/arrow/undo.js"),y=require("../../../icons/audio_video/microphone.js"),v=require("../constants.js"),E=require("../styles/menu_button.js");function M(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var k=M(t);const T="undefined"!=typeof window?window.SpeechRecognition||window.webkitSpeechRecognition:void 0,m=r.styled.nav`
2
2
  display: flex;
3
3
  gap: 12px;
4
4
  justify-content: center;
@@ -15,8 +15,8 @@
15
15
  align-items: center;
16
16
  width: fit-content;
17
17
  flex-shrink: 0;
18
- `,R=r.styled.div`
18
+ `,L=r.styled.div`
19
19
  width: 1px;
20
20
  height: 28px;
21
21
  background-color: var(--color-grey-9);
22
- `;exports.EditorBar=({handleUploadImage:t,showLink:r=!0,showImage:M=!0})=>{const T=n.useEditorRef("main"),L=E.default.useRef(null),[b,A]=E.default.useState(!1),q=E.default.useRef(null),_=E.default.useRef(""),N=n.useEditorSelector(e=>n.isMarkActive(e,f.MARK_BOLD),[]),B=n.useEditorSelector(e=>n.isMarkActive(e,f.MARK_ITALIC),[]),I=n.useEditorSelector(e=>n.isMarkActive(e,f.MARK_UNDERLINE),[]),S=n.useEditorSelector(e=>n.isMarkActive(e,f.MARK_LINK),[]),C=n.useEditorSelector(e=>n.someNode(e,{match:{type:n.getPluginType(e,f.ELEMENT_OL)}}),[]),U=n.useEditorSelector(e=>n.someNode(e,{match:{type:n.getPluginType(e,f.ELEMENT_UL)}}),[]),z=E.default.useRef(T.selection);E.default.useEffect(()=>{T.selection&&(z.current=T.selection)},[T.selection]),E.default.useEffect(()=>()=>{q.current&&(q.current.stop(),q.current=null)},[]);const $=E.default.useCallback(e=>{if(!e)return;const t=z.current;t?(T.select(t),T.insertText(e+" ")):n.insertNode(T,{type:f.ELEMENT_PARAGRAPH,children:[{text:e+" "}]})},[T]);return e.jsxs(m,{"aria-label":"editor-navigation",children:[e.jsxs(w,{children:[e.jsx(i.Tooltip,{content:"Undo",place:"top",children:e.jsx(v.MenuButton,{$active:!1,onClick:()=>T.undo(),children:e.jsx(h.Undo,{size:24,color:"grey-5"})})}),e.jsx(i.Tooltip,{content:"Redo",place:"top",children:e.jsx(v.MenuButton,{$active:!1,onClick:()=>T.redo(),children:e.jsx(j.Redo,{size:24,color:"grey-5"})})})]}),e.jsx(R,{}),e.jsx(w,{children:e.jsx(s.StyleDropdown,{editorRef:T})}),e.jsx(R,{}),e.jsx(w,{children:e.jsx(v.MenuButton,{$active:!1,as:"div",children:e.jsx(c.AlignmentDropdown,{editorRef:T})})}),e.jsx(R,{}),e.jsxs(w,{children:[e.jsx(i.Tooltip,{content:"Bold",place:"top",children:e.jsx(v.MenuButton,{$active:N,onClick:()=>{T&&n.toggleMark(T,{key:f.MARK_BOLD})},children:e.jsx(l.Bold,{size:24,color:"grey-5"})})}),e.jsx(i.Tooltip,{content:"Italic",place:"top",children:e.jsx(v.MenuButton,{$active:B,onClick:()=>{T&&n.toggleMark(T,{key:f.MARK_ITALIC})},children:e.jsx(a.Italic,{size:24,color:"grey-5"})})}),e.jsx(i.Tooltip,{content:"Underline",place:"top",children:e.jsx(v.MenuButton,{$active:I,onClick:()=>{T&&n.toggleMark(T,{key:f.MARK_UNDERLINE})},children:e.jsx(g.Underline,{size:24,color:"grey-5"})})})]}),e.jsx(R,{}),e.jsxs(w,{children:[r&&e.jsx(i.Tooltip,{content:"Link",place:"top",children:e.jsx(v.MenuButton,{$active:S,onClick:()=>{const e=window.prompt("Enter URL:");e&&T&&n.toggleMark(T,{key:f.MARK_LINK,value:{url:e}})},children:e.jsx(u.Link,{size:24,color:"grey-5"})})}),M&&e.jsx(i.Tooltip,{content:"Image",place:"top",children:e.jsx(v.MenuButton,{$active:!1,as:"label",onChange:async()=>{const e=L.current?.files;if(!e)return;const r=await t(e);r&&(o.insertImage(T,r),n.insertNode(T,{type:f.ELEMENT_PARAGRAPH,children:[{text:" "}]}))},children:e.jsxs("div",{children:[e.jsx("input",{accept:"image/*",ref:L,style:{display:"none"},type:"file"}),e.jsx(d.Image,{size:24,color:"grey-5"})]})})}),k&&e.jsx(i.Tooltip,{content:b?"Stop and insert speech":"Speech to text",place:"top",children:e.jsx(v.MenuButton,{$active:b,onClick:()=>{if(!T)return;if(b)return q.current?void q.current.stop():void A(!1);if(q.current&&!b&&(q.current.stop(),q.current=null),!k)return;_.current="";const e=new k;e.continuous=!0,e.interimResults=!1,e.lang=navigator.language||"en-US",e.onresult=e=>{for(let t=e.resultIndex;t<e.results.length;t++){const r=e.results[t];if(r.isFinal&&r.length>0){const e=r[0].transcript;"string"==typeof e&&(_.current+=e)}}},e.onend=()=>{if(q.current===e){q.current=null,A(!1);const e=_.current.trim();_.current="",e&&$(e)}},e.onerror=e=>{console.error("Speech recognition error:",e.error),q.current=null,A(!1),_.current="","not-allowed"!==e.error&&"service-not-allowed"!==e.error||console.warn("Microphone access denied or not available")};try{e.start(),q.current=e,A(!0)}catch{A(!1)}},"aria-pressed":b,children:e.jsx(y.Microphone,{size:24,color:"grey-5"})})})]}),e.jsx(R,{}),e.jsxs(w,{children:[e.jsx(i.Tooltip,{content:"Unordered List",place:"top",children:e.jsx(v.MenuButton,{$active:U,onClick:()=>{T&&n.toggleNodeType(T,{activeType:n.getPluginType(T,f.ELEMENT_UL)})},children:e.jsx(x.ListUnordered,{size:24,color:"grey-5"})})}),e.jsx(i.Tooltip,{content:"Ordered List",place:"top",children:e.jsx(v.MenuButton,{$active:C,onClick:()=>{T&&n.toggleNodeType(T,{activeType:n.getPluginType(T,f.ELEMENT_OL)})},children:e.jsx(p.ListOrdered,{size:24,color:"grey-5"})})})]})]})};
22
+ `;exports.EditorBar=({handleUploadImage:t,showLink:r=!0,showImage:M=!0})=>{const R=n.useEditorRef("main"),b=k.default.useRef(null),[q,A]=k.default.useState(!1),_=k.default.useRef(null),B=k.default.useRef(""),N=n.useEditorSelector(e=>n.isMarkActive(e,v.MARK_BOLD),[]),I=n.useEditorSelector(e=>n.isMarkActive(e,v.MARK_ITALIC),[]),C=n.useEditorSelector(e=>n.isMarkActive(e,v.MARK_UNDERLINE),[]),S=n.useEditorSelector(e=>n.someNode(e,{match:{type:n.getPluginType(e,v.ELEMENT_OL)}}),[]),U=n.useEditorSelector(e=>n.someNode(e,{match:{type:n.getPluginType(e,v.ELEMENT_UL)}}),[]),z=k.default.useRef(R.selection);k.default.useEffect(()=>{R.selection&&(z.current=R.selection)},[R.selection]),k.default.useEffect(()=>()=>{_.current&&(_.current.stop(),_.current=null)},[]);const $=k.default.useCallback(e=>{if(!e)return;const t=z.current;t?(R.select(t),R.insertText(e+" ")):n.insertNode(R,{type:v.ELEMENT_PARAGRAPH,children:[{text:e+" "}]})},[R]);return e.jsxs(m,{"aria-label":"editor-navigation",children:[e.jsxs(w,{children:[e.jsx(c.Tooltip,{content:"Undo",place:"top",children:e.jsx(E.MenuButton,{$active:!1,onClick:()=>R.undo(),children:e.jsx(f.Undo,{size:24,color:"grey-5"})})}),e.jsx(c.Tooltip,{content:"Redo",place:"top",children:e.jsx(E.MenuButton,{$active:!1,onClick:()=>R.redo(),children:e.jsx(g.Redo,{size:24,color:"grey-5"})})})]}),e.jsx(L,{}),e.jsx(w,{children:e.jsx(l.StyleDropdown,{editorRef:R})}),e.jsx(L,{}),e.jsx(w,{children:e.jsx(E.MenuButton,{$active:!1,as:"div",children:e.jsx(s.AlignmentDropdown,{editorRef:R})})}),e.jsx(L,{}),e.jsxs(w,{children:[e.jsx(c.Tooltip,{content:"Bold",place:"top",children:e.jsx(E.MenuButton,{$active:N,onClick:()=>{R&&n.toggleMark(R,{key:v.MARK_BOLD})},children:e.jsx(d.Bold,{size:24,color:"grey-5"})})}),e.jsx(c.Tooltip,{content:"Italic",place:"top",children:e.jsx(E.MenuButton,{$active:I,onClick:()=>{R&&n.toggleMark(R,{key:v.MARK_ITALIC})},children:e.jsx(u.Italic,{size:24,color:"grey-5"})})}),e.jsx(c.Tooltip,{content:"Underline",place:"top",children:e.jsx(E.MenuButton,{$active:C,onClick:()=>{R&&n.toggleMark(R,{key:v.MARK_UNDERLINE})},children:e.jsx(h.Underline,{size:24,color:"grey-5"})})})]}),e.jsx(L,{}),e.jsxs(w,{children:[r&&e.jsx(c.Tooltip,{content:"Link",place:"top",children:e.jsx(E.MenuButton,{$active:!1,onClick:()=>{R&&i.triggerFloatingLink(R,{focused:!0})},children:e.jsx(p.Link,{size:24,color:"grey-5"})})}),M&&e.jsx(c.Tooltip,{content:"Image",place:"top",children:e.jsx(E.MenuButton,{$active:!1,as:"label",onChange:async()=>{const e=b.current?.files;if(!e)return;const r=await t(e);r&&(o.insertImage(R,r),n.insertNode(R,{type:v.ELEMENT_PARAGRAPH,children:[{text:" "}]}))},children:e.jsxs("div",{children:[e.jsx("input",{accept:"image/*",ref:b,style:{display:"none"},type:"file"}),e.jsx(a.Image,{size:24,color:"grey-5"})]})})}),T&&e.jsx(c.Tooltip,{content:q?"Stop and insert speech":"Speech to text",place:"top",children:e.jsx(E.MenuButton,{$active:q,onClick:()=>{if(!R)return;if(q)return _.current?void _.current.stop():void A(!1);if(_.current&&!q&&(_.current.stop(),_.current=null),!T)return;B.current="";const e=new T;e.continuous=!0,e.interimResults=!1,e.lang=navigator.language||"en-US",e.onresult=e=>{for(let t=e.resultIndex;t<e.results.length;t++){const r=e.results[t];if(r.isFinal&&r.length>0){const e=r[0].transcript;"string"==typeof e&&(B.current+=e)}}},e.onend=()=>{if(_.current===e){_.current=null,A(!1);const e=B.current.trim();B.current="",e&&$(e)}},e.onerror=e=>{console.error("Speech recognition error:",e.error),_.current=null,A(!1),B.current="","not-allowed"!==e.error&&"service-not-allowed"!==e.error||console.warn("Microphone access denied or not available")};try{e.start(),_.current=e,A(!0)}catch{A(!1)}},"aria-pressed":q,children:e.jsx(y.Microphone,{size:24,color:"grey-5"})})})]}),e.jsx(L,{}),e.jsxs(w,{children:[e.jsx(c.Tooltip,{content:"Unordered List",place:"top",children:e.jsx(E.MenuButton,{$active:U,onClick:()=>{R&&n.toggleNodeType(R,{activeType:n.getPluginType(R,v.ELEMENT_UL)})},children:e.jsx(j.ListUnordered,{size:24,color:"grey-5"})})}),e.jsx(c.Tooltip,{content:"Ordered List",place:"top",children:e.jsx(E.MenuButton,{$active:S,onClick:()=>{R&&n.toggleNodeType(R,{activeType:n.getPluginType(R,v.ELEMENT_OL)})},children:e.jsx(x.ListOrdered,{size:24,color:"grey-5"})})})]})]})};
@@ -1 +1 @@
1
- {"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../../../../../src/components/editor/simple_editor/navbar.tsx"],"names":[],"mappings":"AAoCA,MAAM,WAAW,cAAc;IAC7B,iBAAiB,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACxD,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAYD,eAAO,MAAM,SAAS,gDAInB,cAAc,4CA+ShB,CAAC"}
1
+ {"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../../../../../src/components/editor/simple_editor/navbar.tsx"],"names":[],"mappings":"AAoCA,MAAM,WAAW,cAAc;IAC7B,iBAAiB,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACxD,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAYD,eAAO,MAAM,SAAS,gDAInB,cAAc,4CAuShB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soul-refiner/design-system",
3
- "version": "2.14.164",
3
+ "version": "2.14.165",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "license": "MIT",