@intlayer/design-system 8.4.0-canary.0 → 8.4.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.
Files changed (55) hide show
  1. package/dist/esm/components/ContentEditor/ContentEditorTextArea.mjs +1 -1
  2. package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +1 -1
  3. package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -1
  4. package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +1 -1
  5. package/dist/esm/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +1 -1
  6. package/dist/esm/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +1 -1
  7. package/dist/esm/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +1 -1
  8. package/dist/esm/components/DictionaryFieldEditor/StructureView/StructureView.mjs +1 -1
  9. package/dist/esm/components/Form/elements/OTPElement.mjs +1 -1
  10. package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +1 -1
  11. package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs.map +1 -1
  12. package/dist/esm/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs +1 -1
  13. package/dist/esm/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs.map +1 -1
  14. package/dist/esm/components/Modal/Modal.mjs +1 -1
  15. package/dist/esm/components/Navbar/MobileNavbar.mjs +1 -1
  16. package/dist/esm/components/Pagination/Pagination.mjs +1 -1
  17. package/dist/esm/components/RightDrawer/RightDrawer.mjs +1 -1
  18. package/dist/esm/hooks/index.mjs +1 -1
  19. package/dist/types/components/Badge/index.d.ts +1 -1
  20. package/dist/types/components/Breadcrumb/breadcrumb.content.d.ts +1 -1
  21. package/dist/types/components/Browser/Browser.content.d.ts +8 -8
  22. package/dist/types/components/Button/Button.d.ts +1 -1
  23. package/dist/types/components/Carousel/index.content.d.ts +3 -3
  24. package/dist/types/components/Command/index.d.ts +1 -1
  25. package/dist/types/components/Container/index.d.ts +4 -4
  26. package/dist/types/components/CopyButton/CopyButton.content.d.ts +1 -1
  27. package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts +12 -12
  28. package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.d.ts +4 -4
  29. package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +27 -27
  30. package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts +16 -16
  31. package/dist/types/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts +12 -12
  32. package/dist/types/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +16 -16
  33. package/dist/types/components/DictionaryFieldEditor/StructureView/structureView.content.d.ts +4 -4
  34. package/dist/types/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.d.ts +3 -3
  35. package/dist/types/components/DictionaryFieldEditor/dictionaryFieldEditor.content.d.ts +2 -2
  36. package/dist/types/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts +15 -15
  37. package/dist/types/components/ExpandCollapse/expandCollapse.content.d.ts +1 -1
  38. package/dist/types/components/IDE/code.content.d.ts +2 -2
  39. package/dist/types/components/IDE/copyCode.content.d.ts +2 -2
  40. package/dist/types/components/IDE/selectors.content.d.ts +6 -6
  41. package/dist/types/components/Input/Checkbox.d.ts +1 -1
  42. package/dist/types/components/Link/Link.d.ts +1 -1
  43. package/dist/types/components/Loader/index.content.d.ts +1 -1
  44. package/dist/types/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts +8 -8
  45. package/dist/types/components/LocaleSwitcherDropDown/localeSwitcher.content.d.ts +6 -6
  46. package/dist/types/components/Pagination/Pagination.d.ts +2 -2
  47. package/dist/types/components/Pagination/pagination.content.d.ts +5 -5
  48. package/dist/types/components/RightDrawer/rightDrawer.content.d.ts +2 -2
  49. package/dist/types/components/SwitchSelector/index.d.ts +1 -1
  50. package/dist/types/components/Tab/Tab.d.ts +2 -2
  51. package/dist/types/components/TabSelector/TabSelector.d.ts +1 -1
  52. package/dist/types/components/Table/table.content.d.ts +1 -1
  53. package/dist/types/components/Tag/index.d.ts +1 -1
  54. package/dist/types/components/Terminal/terminal.content.d.ts +2 -2
  55. package/package.json +16 -16
@@ -1,2 +1,2 @@
1
- "use client";import{useUser as e}from"../../hooks/useUser/index.mjs";import{Button as t,ButtonColor as n,ButtonSize as r,ButtonVariant as i}from"../Button/Button.mjs";import{AutoCompleteTextarea as a}from"../TextArea/AutocompleteTextArea.mjs";import{useEffect as o,useState as s}from"react";import{Check as c,X as l}from"lucide-react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";const p=({children:p,onContentChange:m,disabled:h,validate:g,additionalButtons:_,...v})=>{let{isAuthenticated:y}=e(),[b,x]=s(p),[S,C]=s(0),w=b!==p,T=()=>{x(p),C(e=>e+1)},E=()=>{m(b)},D=e=>x(e.currentTarget.value??``),O=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!h&&k?(e.preventDefault(),E()):e.key===`Escape`&&(e.preventDefault(),T())};o(()=>{x(p),C(e=>e+1)},[p]);let k=g?.(b)??!0;return f(`div`,{className:`flex size-full flex-col items-center justify-between gap-2`,role:`group`,"aria-label":`Content editor textarea`,children:[d(a,{onChange:D,onKeyDown:O,variant:`invisible`,className:`size-full`,value:p,isActive:y,disabled:h,"aria-label":`Editable textarea content`,"aria-describedby":w||_?`content-editor-textarea-actions`:void 0,"aria-invalid":!k,...v},S),(w||_)&&f(`div`,{id:`content-editor-textarea-actions`,className:`flex w-full items-center justify-end gap-2`,role:`group`,"aria-label":`Edit actions`,children:[w&&f(u,{children:[d(t,{Icon:c,label:`Save changes${k?``:` (invalid content)`}`,variant:i.HOVERABLE,color:n.TEXT,size:r.ICON_SM,className:`cursor-pointer hover:scale-110`,disabled:h||!k,onClick:E,"aria-describedby":k?void 0:`textarea-validation-error`}),d(t,{Icon:l,label:`Cancel changes`,variant:i.HOVERABLE,size:r.ICON_SM,color:n.TEXT,className:`cursor-pointer hover:scale-110`,onClick:T,disabled:h})]}),_]})]},p)};export{p as ContentEditorTextArea};
1
+ "use client";import{Button as e,ButtonColor as t,ButtonSize as n,ButtonVariant as r}from"../Button/Button.mjs";import{AutoCompleteTextarea as i}from"../TextArea/AutocompleteTextArea.mjs";import{useUser as a}from"../../hooks/useUser/index.mjs";import{useEffect as o,useState as s}from"react";import{Check as c,X as l}from"lucide-react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";const p=({children:p,onContentChange:m,disabled:h,validate:g,additionalButtons:_,...v})=>{let{isAuthenticated:y}=a(),[b,x]=s(p),[S,C]=s(0),w=b!==p,T=()=>{x(p),C(e=>e+1)},E=()=>{m(b)},D=e=>x(e.currentTarget.value??``),O=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!h&&k?(e.preventDefault(),E()):e.key===`Escape`&&(e.preventDefault(),T())};o(()=>{x(p),C(e=>e+1)},[p]);let k=g?.(b)??!0;return f(`div`,{className:`flex size-full flex-col items-center justify-between gap-2`,role:`group`,"aria-label":`Content editor textarea`,children:[d(i,{onChange:D,onKeyDown:O,variant:`invisible`,className:`size-full`,value:p,isActive:y,disabled:h,"aria-label":`Editable textarea content`,"aria-describedby":w||_?`content-editor-textarea-actions`:void 0,"aria-invalid":!k,...v},S),(w||_)&&f(`div`,{id:`content-editor-textarea-actions`,className:`flex w-full items-center justify-end gap-2`,role:`group`,"aria-label":`Edit actions`,children:[w&&f(u,{children:[d(e,{Icon:c,label:`Save changes${k?``:` (invalid content)`}`,variant:r.HOVERABLE,color:t.TEXT,size:n.ICON_SM,className:`cursor-pointer hover:scale-110`,disabled:h||!k,onClick:E,"aria-describedby":k?void 0:`textarea-validation-error`}),d(e,{Icon:l,label:`Cancel changes`,variant:r.HOVERABLE,size:n.ICON_SM,color:t.TEXT,className:`cursor-pointer hover:scale-110`,onClick:T,disabled:h})]}),_]})]},p)};export{p as ContentEditorTextArea};
2
2
  //# sourceMappingURL=ContentEditorTextArea.mjs.map
@@ -1,2 +1,2 @@
1
- "use client";import{renameKey as e}from"../../../utils/object.mjs";import{useAuditContentDeclarationField as t}from"../../../hooks/reactQuery.mjs";import{Container as n}from"../../Container/index.mjs";import{Button as r,ButtonColor as i,ButtonSize as a,ButtonTextAlign as o,ButtonVariant as s}from"../../Button/Button.mjs";import{InputVariant as c}from"../../Input/Input.mjs";import{SwitchSelector as l,SwitchSelectorColor as u,SwitchSelectorSize as d}from"../../SwitchSelector/index.mjs";import{useLocaleSwitcherContent as f}from"../../LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs";import{ContentEditorInput as p}from"../../ContentEditor/ContentEditorInput.mjs";import{ContentEditorTextArea as m}from"../../ContentEditor/ContentEditorTextArea.mjs";import{Label as h}from"../../Label/index.mjs";import{MarkdownRenderer as g}from"../../MarkDownRender/MarkDownRender.mjs";import{EnumKeyInput as _}from"../EnumKeyInput.mjs";import{Fragment as v,useState as y}from"react";import{Plus as b,Trash as x,WandSparkles as S}from"lucide-react";import{Fragment as C,jsx as w,jsxs as T}from"react/jsx-runtime";import{useConfiguration as E,useEditedContent as D}from"@intlayer/editor-react";import{useIntlayer as O,useLocale as k}from"react-intlayer";import{getLocaleName as A}from"@intlayer/core/localization";import{getEmptyNode as j,getNodeType as M}from"@intlayer/core/dictionaryManipulator";import{NodeType as N}from"@intlayer/types/nodeType";const P=[`filePath`,`id`,`nodeType`],F=({keyPath:e,dictionary:n,...o})=>{let{editedContent:l,addEditedContent:u}=D(),d=E(),{mutate:f,isPending:p}=t();return w(m,{variant:c.DEFAULT,onContentChange:t=>u(n.localId,t,e),additionalButtons:w(r,{Icon:S,label:`Audit`,variant:s.HOVERABLE,size:a.ICON_SM,color:i.TEXT,className:`cursor-pointer hover:scale-110`,isLoading:p,onClick:()=>{f({fileContent:JSON.stringify({...n,...l?.[n.localId]??{}}),keyPath:e,locales:d?.internationalization.locales??[],aiOptions:{apiKey:d?.ai?.apiKey,model:d?.ai?.model,temperature:d?.ai?.temperature}},{onSuccess:t=>{if(t?.data)try{let r=t.data.fileContent;u(n.localId,r,e)}catch(e){console.error(e)}}})}}),...o})},I=({keyPath:e,dictionary:t,...n})=>{let{addEditedContent:r}=D();return w(p,{variant:c.DEFAULT,onContentChange:n=>r(t.localId,n,e),...n})},L=[{content:`False`,value:!1},{content:`True`,value:!0}],R=({dictionary:e,keyPath:t,...n})=>{let{addEditedContent:r}=D();return w(l,{choices:L,value:!0,onChange:n=>r(e.localId,n,t),color:u.TEXT,size:d.SM,...n})},z=({section:e,keyPath:t,dictionary:n,renderSection:r})=>{let{locale:i,defaultLocale:a}=k(),{selectedLocales:o,availableLocales:s}=f(),c=e[N.Translation],l=Object.keys(c),u=s.length>o.length?o:[...new Set([...s,...l])],d=e[N.Translation];return w(`table`,{className:`w-full`,children:w(`tbody`,{className:`flex w-full flex-col gap-2`,children:u.map(e=>{let o=`${JSON.stringify(t)}-translation-${e}`;return T(v,{children:[w(`tr`,{className:`mt-2 w-full p-2 text-xs`,children:w(`td`,{className:`flex w-full`,children:A(e,i)})}),w(`tr`,{className:`flex`,children:w(`td`,{className:`flex w-full`,children:w($,{section:d[e]??j(d[a]),keyPath:[...t,{type:N.Translation,key:e}],dictionary:n,renderSection:r})})})]},o)})})})},B=({section:t,keyPath:n,dictionary:a,renderSection:c})=>{let{addEditedContent:l}=D(),{addNewEnumeration:u,removeEnumeration:d}=O(`navigation-view`),f=t[N.Enumeration],p=Object.keys(f)[0];return T(`div`,{className:`flex flex-col gap-2`,children:[w(`table`,{className:`w-full`,children:w(`tbody`,{className:`flex w-full flex-col gap-2`,children:Object.keys(t[N.Enumeration]).map(i=>{let o=[...n,{type:N.Enumeration,key:i}],s=`${JSON.stringify(n)}-enumeration-${i}`;return T(v,{children:[w(`tr`,{className:`mt-2 w-full`,children:w(`td`,{className:`flex w-full`,children:w(`div`,{className:`flex flex-1`,children:w(r,{label:d.label.value,variant:`hoverable`,size:`sm`,color:`error`,className:`ml-auto text-neutral hover:text-error`,Icon:x,onClick:()=>l(a.localId,void 0,o),children:d.text})})})}),w(`tr`,{className:`w-full p-2`,children:w(`td`,{className:`flex w-full`,children:w(_,{value:i,onChange:r=>{let o=t[N.Enumeration],s=e(o,i,r),c={...t,[N.Enumeration]:s};console.log(`newValue`,c),l(a.localId,c,n)}})})}),w(`tr`,{className:`block w-full`,children:w(`td`,{className:`flex w-full`,children:w(Q,{section:f[i]??j(f[p]),keyPath:o,dictionary:a,renderSection:c})})})]},s)})})}),w(r,{label:u.label.value,variant:s.HOVERABLE,color:i.NEUTRAL,textAlign:o.LEFT,isFullWidth:!0,onClick:()=>l(a.localId,j(f[p])??``,[...n,{type:N.Enumeration,key:`unknown`}]),Icon:b,className:`m-2`,children:u.text})]})},V=({section:e,keyPath:t,dictionary:n,renderSection:r})=>{let i=e[N.Condition];return w(`table`,{className:`w-full`,children:w(`tbody`,{className:`flex w-full flex-col gap-2`,children:[`true`,`false`,`fallback`].map(e=>{let a=`${JSON.stringify(t)}-condition-${e}`;return T(v,{children:[w(`tr`,{className:`mt-2 block w-full p-2 text-xs`,children:w(`td`,{className:`flex w-full`,children:String(e)})}),w(`tr`,{className:`block w-full`,children:w(`td`,{className:`flex w-full`,children:w($,{section:i[e]??j(i.true),keyPath:[...t,{type:N.Condition,key:e}],dictionary:n,renderSection:r})})})]},a)})})})},H=({section:e,keyPath:t,dictionary:n,renderSection:r})=>{let i=e[N.Gender];return w(`table`,{className:`w-full`,children:w(`tbody`,{className:`flex w-full flex-col gap-2`,children:[`male`,`female`,`fallback`].map(e=>{let a=`${JSON.stringify(t)}-gender-${e}`;return T(v,{children:[w(`tr`,{className:`mt-2 block w-full p-2 text-xs`,children:w(`td`,{className:`flex w-full`,children:String(e)})}),w(`tr`,{className:`block w-full`,children:w(`td`,{className:`flex w-full`,children:w($,{section:i[e]??j(i.male),keyPath:[...t,{type:N.Gender,key:e}],dictionary:n,renderSection:r})})})]},a)})})})},U=({section:e,keyPath:t,dictionary:n,renderSection:a})=>{let{addEditedContent:c}=D(),{addNewElement:l,removeElement:u}=O(`navigation-view`);return T(`div`,{className:`flex flex-col gap-2`,children:[w(`table`,{className:`w-full`,children:w(`tbody`,{className:`flex w-full flex-col gap-2`,children:e.map((i,o)=>{let s=`${JSON.stringify(t)}-array-${o}`;return T(v,{children:[w(`tr`,{className:`mt-2 w-full p-2`,children:w(`td`,{className:`flex w-full`,children:T(`div`,{className:`flex w-full items-center justify-between gap-2`,children:[w(`span`,{className:`text-xs`,children:String(o)}),w(r,{label:u.label.value,variant:`hoverable`,size:`sm`,color:`error`,className:`ml-auto text-neutral hover:text-error`,onClick:()=>{let e=[...t,{type:N.Array,key:o}];c(n.localId,void 0,e)},Icon:x,children:u.text})]})})}),w(`tr`,{className:`block w-full`,children:w(`td`,{className:`flex w-full`,children:w($,{section:i??j(e[0]),keyPath:[...t,{type:N.Array,key:o}],dictionary:n,renderSection:a})})})]},s)})})}),w(r,{label:l.label.value,variant:s.HOVERABLE,color:i.NEUTRAL,textAlign:o.LEFT,isFullWidth:!0,onClick:()=>{let r=[...t,{type:N.Array,key:e.length}];c(n.localId,j(e[0])??``,r,!1)},Icon:b,children:l.text})]})},W=({section:e,keyPath:t,dictionary:n,renderSection:r})=>w(C,{children:w(`table`,{className:`w-full`,children:w(`tbody`,{className:`flex flex-col gap-2`,children:Object.keys(e).map(i=>{let a=[...t,{type:N.Object,key:i}],o=e,s=Object.keys(o)[0],c=o[i]??j(o[s]),l=`${JSON.stringify(t)}-object-${i}`;return T(v,{children:[w(`tr`,{className:`mt-2 p-2 text-xs`,children:w(`td`,{className:`flex w-full`,children:String(i)})}),w(`tr`,{className:`block w-full`,children:w(`td`,{className:`flex w-full`,children:w(Q,{section:c,keyPath:a,dictionary:n,renderSection:r})})})]},l)})})})});var G=function(e){return e[e.Edit=0]=`Edit`,e[e.Preview=1]=`Preview`,e}(G||{}),K=function(e){return e[e.Edit=0]=`Edit`,e[e.Preview=1]=`Preview`,e}(K||{});const q=({section:e,keyPath:t,dictionary:n})=>{let[r,i]=y(K.Edit),a=[{content:`Edit`,value:K.Edit},{content:`Preview`,value:K.Preview}],o=[...t,{type:N.HTML}],s=e[N.HTML];return T(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:[w(l,{choices:a,value:r,onChange:i,color:u.TEXT,size:d.SM,className:`ml-auto`}),w($,{section:s,keyPath:o,dictionary:n,renderSection:r===K.Preview?e=>w(`div`,{dangerouslySetInnerHTML:{__html:e}}):void 0})]})},J=({section:e,keyPath:t,dictionary:n,isDarkMode:r})=>{let[i,a]=y(G.Edit),o=[{content:`Edit`,value:G.Edit},{content:`Preview`,value:G.Preview}],s=[...t,{type:N.Markdown}],c=e[N.Markdown];return T(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:[w(l,{choices:o,value:i,onChange:a,color:u.TEXT,size:d.SM,className:`ml-auto`}),w($,{section:c,keyPath:s,dictionary:n,renderSection:i===G.Preview?e=>w(g,{isDarkMode:r,children:e}):void 0})]})},Y=({section:e,keyPath:t,...n})=>{let r=[...t,{type:N.Insertion}],i=e[N.Insertion];return w(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:w($,{section:i,keyPath:r,...n})})},X=({section:e,keyPath:t,...n})=>{let r=[...t,{type:N.File}],i=e[N.File],{content:a}=e;return T(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:[T(`span`,{className:`text-neutral text-sm`,children:[i,` `]}),w($,{section:a,keyPath:r,...n})]})},Z=({keyPath:e,dictionary:t,renderSection:n,section:r,...i})=>{let{addEditedContent:a}=D(),o=r[N.Nested],s=[...e,{type:N.Nested}];return T(`div`,{className:`flex w-full flex-col gap-4 p-2`,children:[w(h,{children:`Dictionary key`}),w(p,{"aria-label":`Edit field`,type:`text`,variant:c.DEFAULT,...i,onContentChange:e=>{a(t.localId,{...o,dictionaryKey:String(e)},s)},children:o.dictionaryKey??``}),w(h,{children:`Path (optional)`}),w(p,{"aria-label":`Edit field`,type:`text`,variant:c.DEFAULT,...i,onContentChange:e=>{a(t.localId,{...o,path:e===``?void 0:e},s)},children:o.path??``})]})},Q=({section:e,keyPath:t,dictionary:n,renderSection:r,isDarkMode:i})=>{let{tsxNotEditable:a}=O(`navigation-view`),o=M(e);return o===N.ReactNode?T(`div`,{className:`flex w-full flex-col gap-2`,children:[w(`span`,{children:`(React Node)`}),w(`span`,{className:`flex text-neutral text-xs`,children:a})]}):o===N.Nested?w(Z,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Translation?w(z,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Enumeration?w(B,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Condition?w(V,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Gender?w(H,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Insertion?w(Y,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Markdown?w(J,{dictionary:n,keyPath:t,section:e,isDarkMode:i}):o===N.HTML?w(q,{dictionary:n,keyPath:t,section:e}):o===N.File?w(X,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Array?w(U,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Object?w(W,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Number?w(`div`,{className:`w-full p-2`,children:w(I,{dictionary:n,keyPath:t,type:`number`,"aria-label":`Edit field`,children:e})}):o===N.Text?w(`div`,{className:`w-full p-2`,children:typeof r==`function`?r(e):w(F,{variant:c.DEFAULT,"aria-label":`Edit field`,keyPath:t,dictionary:n,children:e})}):o===N.Boolean?w(`div`,{className:`w-full p-2`,children:w(R,{dictionary:n,keyPath:t,value:e})}):T(`div`,{className:`w-full p-2`,children:[`Error. Format not supported.`,JSON.stringify(e,null,2),JSON.stringify(t,null,2),`NodeType : `,o]})},$=e=>w(n,{border:!0,background:`none`,className:`top-6 flex h-full flex-1 flex-col gap-6 overflow-hidden p-2 md:sticky`,roundedSize:`xl`,children:w(Q,{...e})});export{Q as TextEditor,$ as TextEditorContainer,P as traceKeys};
1
+ "use client";import{renameKey as e}from"../../../utils/object.mjs";import{Container as t}from"../../Container/index.mjs";import{Button as n,ButtonColor as r,ButtonSize as i,ButtonTextAlign as a,ButtonVariant as o}from"../../Button/Button.mjs";import{InputVariant as s}from"../../Input/Input.mjs";import{SwitchSelector as c,SwitchSelectorColor as l,SwitchSelectorSize as u}from"../../SwitchSelector/index.mjs";import{useAuditContentDeclarationField as d}from"../../../hooks/reactQuery.mjs";import{useLocaleSwitcherContent as f}from"../../LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs";import{ContentEditorInput as p}from"../../ContentEditor/ContentEditorInput.mjs";import{ContentEditorTextArea as m}from"../../ContentEditor/ContentEditorTextArea.mjs";import{Label as h}from"../../Label/index.mjs";import{MarkdownRenderer as g}from"../../MarkDownRender/MarkDownRender.mjs";import{EnumKeyInput as _}from"../EnumKeyInput.mjs";import{Fragment as v,useState as y}from"react";import{Plus as b,Trash as x,WandSparkles as S}from"lucide-react";import{Fragment as C,jsx as w,jsxs as T}from"react/jsx-runtime";import{useIntlayer as E,useLocale as D}from"react-intlayer";import{getLocaleName as O}from"@intlayer/core/localization";import{useConfiguration as k,useEditedContent as A}from"@intlayer/editor-react";import{getEmptyNode as j,getNodeType as M}from"@intlayer/core/dictionaryManipulator";import{NodeType as N}from"@intlayer/types/nodeType";const P=[`filePath`,`id`,`nodeType`],F=({keyPath:e,dictionary:t,...a})=>{let{editedContent:c,addEditedContent:l}=A(),u=k(),{mutate:f,isPending:p}=d();return w(m,{variant:s.DEFAULT,onContentChange:n=>l(t.localId,n,e),additionalButtons:w(n,{Icon:S,label:`Audit`,variant:o.HOVERABLE,size:i.ICON_SM,color:r.TEXT,className:`cursor-pointer hover:scale-110`,isLoading:p,onClick:()=>{f({fileContent:JSON.stringify({...t,...c?.[t.localId]??{}}),keyPath:e,locales:u?.internationalization.locales??[],aiOptions:{apiKey:u?.ai?.apiKey,model:u?.ai?.model,temperature:u?.ai?.temperature}},{onSuccess:n=>{if(n?.data)try{let r=n.data.fileContent;l(t.localId,r,e)}catch(e){console.error(e)}}})}}),...a})},I=({keyPath:e,dictionary:t,...n})=>{let{addEditedContent:r}=A();return w(p,{variant:s.DEFAULT,onContentChange:n=>r(t.localId,n,e),...n})},L=[{content:`False`,value:!1},{content:`True`,value:!0}],R=({dictionary:e,keyPath:t,...n})=>{let{addEditedContent:r}=A();return w(c,{choices:L,value:!0,onChange:n=>r(e.localId,n,t),color:l.TEXT,size:u.SM,...n})},z=({section:e,keyPath:t,dictionary:n,renderSection:r})=>{let{locale:i,defaultLocale:a}=D(),{selectedLocales:o,availableLocales:s}=f(),c=e[N.Translation],l=Object.keys(c),u=s.length>o.length?o:[...new Set([...s,...l])],d=e[N.Translation];return w(`table`,{className:`w-full`,children:w(`tbody`,{className:`flex w-full flex-col gap-2`,children:u.map(e=>{let o=`${JSON.stringify(t)}-translation-${e}`;return T(v,{children:[w(`tr`,{className:`mt-2 w-full p-2 text-xs`,children:w(`td`,{className:`flex w-full`,children:O(e,i)})}),w(`tr`,{className:`flex`,children:w(`td`,{className:`flex w-full`,children:w($,{section:d[e]??j(d[a]),keyPath:[...t,{type:N.Translation,key:e}],dictionary:n,renderSection:r})})})]},o)})})})},B=({section:t,keyPath:i,dictionary:s,renderSection:c})=>{let{addEditedContent:l}=A(),{addNewEnumeration:u,removeEnumeration:d}=E(`navigation-view`),f=t[N.Enumeration],p=Object.keys(f)[0];return T(`div`,{className:`flex flex-col gap-2`,children:[w(`table`,{className:`w-full`,children:w(`tbody`,{className:`flex w-full flex-col gap-2`,children:Object.keys(t[N.Enumeration]).map(r=>{let a=[...i,{type:N.Enumeration,key:r}],o=`${JSON.stringify(i)}-enumeration-${r}`;return T(v,{children:[w(`tr`,{className:`mt-2 w-full`,children:w(`td`,{className:`flex w-full`,children:w(`div`,{className:`flex flex-1`,children:w(n,{label:d.label.value,variant:`hoverable`,size:`sm`,color:`error`,className:`ml-auto text-neutral hover:text-error`,Icon:x,onClick:()=>l(s.localId,void 0,a),children:d.text})})})}),w(`tr`,{className:`w-full p-2`,children:w(`td`,{className:`flex w-full`,children:w(_,{value:r,onChange:n=>{let a=t[N.Enumeration],o=e(a,r,n),c={...t,[N.Enumeration]:o};console.log(`newValue`,c),l(s.localId,c,i)}})})}),w(`tr`,{className:`block w-full`,children:w(`td`,{className:`flex w-full`,children:w(Q,{section:f[r]??j(f[p]),keyPath:a,dictionary:s,renderSection:c})})})]},o)})})}),w(n,{label:u.label.value,variant:o.HOVERABLE,color:r.NEUTRAL,textAlign:a.LEFT,isFullWidth:!0,onClick:()=>l(s.localId,j(f[p])??``,[...i,{type:N.Enumeration,key:`unknown`}]),Icon:b,className:`m-2`,children:u.text})]})},V=({section:e,keyPath:t,dictionary:n,renderSection:r})=>{let i=e[N.Condition];return w(`table`,{className:`w-full`,children:w(`tbody`,{className:`flex w-full flex-col gap-2`,children:[`true`,`false`,`fallback`].map(e=>{let a=`${JSON.stringify(t)}-condition-${e}`;return T(v,{children:[w(`tr`,{className:`mt-2 block w-full p-2 text-xs`,children:w(`td`,{className:`flex w-full`,children:String(e)})}),w(`tr`,{className:`block w-full`,children:w(`td`,{className:`flex w-full`,children:w($,{section:i[e]??j(i.true),keyPath:[...t,{type:N.Condition,key:e}],dictionary:n,renderSection:r})})})]},a)})})})},H=({section:e,keyPath:t,dictionary:n,renderSection:r})=>{let i=e[N.Gender];return w(`table`,{className:`w-full`,children:w(`tbody`,{className:`flex w-full flex-col gap-2`,children:[`male`,`female`,`fallback`].map(e=>{let a=`${JSON.stringify(t)}-gender-${e}`;return T(v,{children:[w(`tr`,{className:`mt-2 block w-full p-2 text-xs`,children:w(`td`,{className:`flex w-full`,children:String(e)})}),w(`tr`,{className:`block w-full`,children:w(`td`,{className:`flex w-full`,children:w($,{section:i[e]??j(i.male),keyPath:[...t,{type:N.Gender,key:e}],dictionary:n,renderSection:r})})})]},a)})})})},U=({section:e,keyPath:t,dictionary:i,renderSection:s})=>{let{addEditedContent:c}=A(),{addNewElement:l,removeElement:u}=E(`navigation-view`);return T(`div`,{className:`flex flex-col gap-2`,children:[w(`table`,{className:`w-full`,children:w(`tbody`,{className:`flex w-full flex-col gap-2`,children:e.map((r,a)=>{let o=`${JSON.stringify(t)}-array-${a}`;return T(v,{children:[w(`tr`,{className:`mt-2 w-full p-2`,children:w(`td`,{className:`flex w-full`,children:T(`div`,{className:`flex w-full items-center justify-between gap-2`,children:[w(`span`,{className:`text-xs`,children:String(a)}),w(n,{label:u.label.value,variant:`hoverable`,size:`sm`,color:`error`,className:`ml-auto text-neutral hover:text-error`,onClick:()=>{let e=[...t,{type:N.Array,key:a}];c(i.localId,void 0,e)},Icon:x,children:u.text})]})})}),w(`tr`,{className:`block w-full`,children:w(`td`,{className:`flex w-full`,children:w($,{section:r??j(e[0]),keyPath:[...t,{type:N.Array,key:a}],dictionary:i,renderSection:s})})})]},o)})})}),w(n,{label:l.label.value,variant:o.HOVERABLE,color:r.NEUTRAL,textAlign:a.LEFT,isFullWidth:!0,onClick:()=>{let n=[...t,{type:N.Array,key:e.length}];c(i.localId,j(e[0])??``,n,!1)},Icon:b,children:l.text})]})},W=({section:e,keyPath:t,dictionary:n,renderSection:r})=>w(C,{children:w(`table`,{className:`w-full`,children:w(`tbody`,{className:`flex flex-col gap-2`,children:Object.keys(e).map(i=>{let a=[...t,{type:N.Object,key:i}],o=e,s=Object.keys(o)[0],c=o[i]??j(o[s]),l=`${JSON.stringify(t)}-object-${i}`;return T(v,{children:[w(`tr`,{className:`mt-2 p-2 text-xs`,children:w(`td`,{className:`flex w-full`,children:String(i)})}),w(`tr`,{className:`block w-full`,children:w(`td`,{className:`flex w-full`,children:w(Q,{section:c,keyPath:a,dictionary:n,renderSection:r})})})]},l)})})})});var G=function(e){return e[e.Edit=0]=`Edit`,e[e.Preview=1]=`Preview`,e}(G||{}),K=function(e){return e[e.Edit=0]=`Edit`,e[e.Preview=1]=`Preview`,e}(K||{});const q=({section:e,keyPath:t,dictionary:n})=>{let[r,i]=y(K.Edit),a=[{content:`Edit`,value:K.Edit},{content:`Preview`,value:K.Preview}],o=[...t,{type:N.HTML}],s=e[N.HTML];return T(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:[w(c,{choices:a,value:r,onChange:i,color:l.TEXT,size:u.SM,className:`ml-auto`}),w($,{section:s,keyPath:o,dictionary:n,renderSection:r===K.Preview?e=>w(`div`,{dangerouslySetInnerHTML:{__html:e}}):void 0})]})},J=({section:e,keyPath:t,dictionary:n,isDarkMode:r})=>{let[i,a]=y(G.Edit),o=[{content:`Edit`,value:G.Edit},{content:`Preview`,value:G.Preview}],s=[...t,{type:N.Markdown}],d=e[N.Markdown];return T(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:[w(c,{choices:o,value:i,onChange:a,color:l.TEXT,size:u.SM,className:`ml-auto`}),w($,{section:d,keyPath:s,dictionary:n,renderSection:i===G.Preview?e=>w(g,{isDarkMode:r,children:e}):void 0})]})},Y=({section:e,keyPath:t,...n})=>{let r=[...t,{type:N.Insertion}],i=e[N.Insertion];return w(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:w($,{section:i,keyPath:r,...n})})},X=({section:e,keyPath:t,...n})=>{let r=[...t,{type:N.File}],i=e[N.File],{content:a}=e;return T(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:[T(`span`,{className:`text-neutral text-sm`,children:[i,` `]}),w($,{section:a,keyPath:r,...n})]})},Z=({keyPath:e,dictionary:t,renderSection:n,section:r,...i})=>{let{addEditedContent:a}=A(),o=r[N.Nested],c=[...e,{type:N.Nested}];return T(`div`,{className:`flex w-full flex-col gap-4 p-2`,children:[w(h,{children:`Dictionary key`}),w(p,{"aria-label":`Edit field`,type:`text`,variant:s.DEFAULT,...i,onContentChange:e=>{a(t.localId,{...o,dictionaryKey:String(e)},c)},children:o.dictionaryKey??``}),w(h,{children:`Path (optional)`}),w(p,{"aria-label":`Edit field`,type:`text`,variant:s.DEFAULT,...i,onContentChange:e=>{a(t.localId,{...o,path:e===``?void 0:e},c)},children:o.path??``})]})},Q=({section:e,keyPath:t,dictionary:n,renderSection:r,isDarkMode:i})=>{let{tsxNotEditable:a}=E(`navigation-view`),o=M(e);return o===N.ReactNode?T(`div`,{className:`flex w-full flex-col gap-2`,children:[w(`span`,{children:`(React Node)`}),w(`span`,{className:`flex text-neutral text-xs`,children:a})]}):o===N.Nested?w(Z,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Translation?w(z,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Enumeration?w(B,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Condition?w(V,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Gender?w(H,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Insertion?w(Y,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Markdown?w(J,{dictionary:n,keyPath:t,section:e,isDarkMode:i}):o===N.HTML?w(q,{dictionary:n,keyPath:t,section:e}):o===N.File?w(X,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Array?w(U,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Object?w(W,{dictionary:n,renderSection:r,keyPath:t,section:e}):o===N.Number?w(`div`,{className:`w-full p-2`,children:w(I,{dictionary:n,keyPath:t,type:`number`,"aria-label":`Edit field`,children:e})}):o===N.Text?w(`div`,{className:`w-full p-2`,children:typeof r==`function`?r(e):w(F,{variant:s.DEFAULT,"aria-label":`Edit field`,keyPath:t,dictionary:n,children:e})}):o===N.Boolean?w(`div`,{className:`w-full p-2`,children:w(R,{dictionary:n,keyPath:t,value:e})}):T(`div`,{className:`w-full p-2`,children:[`Error. Format not supported.`,JSON.stringify(e,null,2),JSON.stringify(t,null,2),`NodeType : `,o]})},$=e=>w(t,{border:!0,background:`none`,className:`top-6 flex h-full flex-1 flex-col gap-6 overflow-hidden p-2 md:sticky`,roundedSize:`xl`,children:w(Q,{...e})});export{Q as TextEditor,$ as TextEditorContainer,P as traceKeys};
2
2
  //# sourceMappingURL=TextEditor.mjs.map
@@ -1,2 +1,2 @@
1
- "use client";import{useSession as e}from"../../../hooks/useAuth/useSession.mjs";import{useAddDictionary as t,useGetProjects as n}from"../../../hooks/reactQuery.mjs";import{ButtonColor as r}from"../../Button/Button.mjs";import{MultiSelect as i}from"../../Select/Multiselect.mjs";import{useForm as a}from"../../Form/FormBase.mjs";import{Form as o}from"../../Form/Form.mjs";import{useDictionarySchema as s}from"./useDictionaryFormSchema.mjs";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{useIntlayer as u}from"react-intlayer";const d=({onDictionaryCreated:d})=>{let{session:f}=e(),{project:p}=f??{},{mutate:m,isPending:h}=t(),{data:g}=n(),_=s(String(p?.id)),{form:v,isSubmitting:y}=a(_),{keyInput:b,createDictionaryButton:x,projectInput:S}=u(`dictionary-form`);return l(o,{schema:_,onSubmitSuccess:e=>{m({dictionary:e},{onSuccess:()=>{d?.()}})},className:`m-auto w-full max-w-[400px]`,...v,children:[c(o.Input,{name:`key`,label:b.label.value,placeholder:b.placeholder.value,isRequired:!0}),l(o.MultiSelect,{name:`projectIds`,label:S.label.value,children:[c(i.Trigger,{getBadgeValue:e=>g?.data?.find(t=>String(t.id)===e)?.name??e,children:c(i.Input,{placeholder:S.placeholder.value})}),c(i.Content,{children:c(i.List,{children:g?.data?.map(e=>c(i.Item,{value:String(e.id),children:e.name},String(e.id)))})})]}),c(o.Button,{className:`mt-12 ml-auto`,type:`submit`,color:r.TEXT,isLoading:y||h,label:x.ariaLabel.value,isFullWidth:!0,children:x.text})]})};export{d as DictionaryCreationForm};
1
+ "use client";import{ButtonColor as e}from"../../Button/Button.mjs";import{useSession as t}from"../../../hooks/useAuth/useSession.mjs";import{useAddDictionary as n,useGetProjects as r}from"../../../hooks/reactQuery.mjs";import{MultiSelect as i}from"../../Select/Multiselect.mjs";import{useForm as a}from"../../Form/FormBase.mjs";import{Form as o}from"../../Form/Form.mjs";import{useDictionarySchema as s}from"./useDictionaryFormSchema.mjs";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{useIntlayer as u}from"react-intlayer";const d=({onDictionaryCreated:d})=>{let{session:f}=t(),{project:p}=f??{},{mutate:m,isPending:h}=n(),{data:g}=r(),_=s(String(p?.id)),{form:v,isSubmitting:y}=a(_),{keyInput:b,createDictionaryButton:x,projectInput:S}=u(`dictionary-form`);return l(o,{schema:_,onSubmitSuccess:e=>{m({dictionary:e},{onSuccess:()=>{d?.()}})},className:`m-auto w-full max-w-[400px]`,...v,children:[c(o.Input,{name:`key`,label:b.label.value,placeholder:b.placeholder.value,isRequired:!0}),l(o.MultiSelect,{name:`projectIds`,label:S.label.value,children:[c(i.Trigger,{getBadgeValue:e=>g?.data?.find(t=>String(t.id)===e)?.name??e,children:c(i.Input,{placeholder:S.placeholder.value})}),c(i.Content,{children:c(i.List,{children:g?.data?.map(e=>c(i.Item,{value:String(e.id),children:e.name},String(e.id)))})})]}),c(o.Button,{className:`mt-12 ml-auto`,type:`submit`,color:e.TEXT,isLoading:y||h,label:x.ariaLabel.value,isFullWidth:!0,children:x.text})]})};export{d as DictionaryCreationForm};
2
2
  //# sourceMappingURL=DictionaryCreationForm.mjs.map
@@ -1,2 +1,2 @@
1
- "use client";import{useSession as e}from"../../../hooks/useAuth/useSession.mjs";import{useAuditContentDeclarationMetadata as t,useGetProjects as n,useGetTags as r}from"../../../hooks/reactQuery.mjs";import{Loader as i}from"../../Loader/index.mjs";import{ButtonColor as a,ButtonSize as o,ButtonVariant as s}from"../../Button/Button.mjs";import{Checkbox as c}from"../../Input/Checkbox.mjs";import{MultiSelect as l}from"../../Select/Multiselect.mjs";import{Select as u}from"../../Select/Select.mjs";import{useForm as d}from"../../Form/FormBase.mjs";import{Form as f}from"../../Form/Form.mjs";import{useDictionaryDetailsSchema as p}from"./useDictionaryDetailsSchema.mjs";import{useEffect as m}from"react";import{WandSparkles as h}from"lucide-react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{useEditedContent as v}from"@intlayer/editor-react";import{useIntlayer as y}from"react-intlayer";import{AnimatePresence as b,motion as x}from"framer-motion";import{useWatch as S}from"react-hook-form";const C=({dictionary:C,mode:w})=>{let{session:T}=e(),{project:E}=T??{},{data:D,isLoading:O}=n(),{data:k}=r(),A=D?.data??[],j=k?.data??[],M=p(String(E?.id)),{form:N,isSubmitting:P}=d(M,{defaultValues:{...C,location:C.location??`remote`}}),{editedContent:F,setEditedDictionary:I}=v(),{titleInput:L,keyInput:R,descriptionInput:z,projectInput:B,tagsSelect:V,locationSelect:H,importModeSelect:U,filePathInput:W,auditButton:G}=y(`dictionary-details`),{mutate:K,isPending:q}=t(),J=F?.[C.localId];m(()=>{N.reset({...C,location:C.location??`remote`})},[C,N?.reset]),m(()=>{J===void 0&&N.reset({...C,location:C.location??`remote`})},[J]);let Y=()=>{let e={...C,...J};K({fileContent:JSON.stringify(e)},{onSuccess:t=>{if(t?.data)try{let n=t.data.fileContent;I(t=>({...t,...e,...n})),N.reset({...e,...n})}catch(e){console.error(e)}}})},X=S({control:N.control,name:`location`}),Z=X===`local`||X===`hybrid`;return _(f,{className:`flex w-full flex-col gap-8`,...N,schema:M,children:[_(`div`,{className:`grid grid-cols-2 gap-8 max-md:grid-cols-1`,children:[g(f.EditableFieldInput,{name:`key`,label:R.label,placeholder:R.label.value,description:R.description,disabled:P,isRequired:!0,onSave:e=>{N.setValue(`key`,e,{shouldDirty:!0}),I(t=>({...C,...t??{},key:e}))}}),g(f.EditableFieldInput,{name:`title`,label:L.label,placeholder:L.placeholder.value,description:L.description,disabled:P,onSave:e=>{N.setValue(`title`,e,{shouldDirty:!0}),I(t=>({...C,...t??{},title:e}))}})]}),g(f.EditableFieldTextArea,{name:`description`,label:z.label,placeholder:z.placeholder.value,description:z.description,disabled:P,onSave:e=>{N.setValue(`description`,e,{shouldDirty:!0}),I(t=>({...C,...t??{},description:e}))}}),_(`div`,{className:`grid grid-cols-2 gap-8 px-1 max-md:grid-cols-1`,children:[g(f.Field,{control:N.control,name:`location`,render:({field:e})=>{let t=e.value,n=t===`local`||t===`hybrid`,r=t===`remote`||t===`hybrid`,i=t=>{if(!t&&!r)return;let n=t?r?`hybrid`:`local`:`remote`;e.onChange(n);let i=t?N.getValues(`filePath`)??C.filePath:void 0;t||N.setValue(`filePath`,void 0),I(e=>({...C,...e??{},location:n,filePath:i}))},a=t=>{if(!t&&!n)return;let r=t?n?`hybrid`:`remote`:`local`;e.onChange(r),I(e=>({...C,...e??{},location:r}))};return _(f.Item,{className:`flex flex-col gap-2 px-1`,children:[g(f.Label,{className:`ml-1`,children:H.label}),_(`div`,{className:`ml-2 flex items-center gap-4 py-2`,children:[g(c,{id:`location-local`,name:`location-local`,label:H.local.value,checked:n,disabled:!w.includes(`local`)&&!w.includes(`remote`),onChange:e=>i(e.target.checked)}),g(c,{id:`location-remote`,name:`location-remote`,label:H.remote.value,checked:r,disabled:!w.includes(`remote`)&&C.location!==`remote`&&C.location!==`hybrid`,onChange:e=>a(e.target.checked)})]}),g(f.Description,{children:H.testDescription}),g(f.Message,{})]})}}),g(b,{mode:`wait`,children:Z&&g(x.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.3},className:`overflow-hidden`,children:g(f.Input,{name:`filePath`,label:W.label.value,placeholder:W.placeholder.value,description:W.description.value,disabled:P||!Z,onChange:e=>{let t=e.target.value;I(e=>({...C,...e??{},filePath:t}))}})},`filePath-input`)})]}),g(`div`,{className:`grid grid-cols-2 gap-8 max-md:grid-cols-1`,children:_(f.Select,{name:`importMode`,label:U.label.value,description:U.description.value,onValueChange:e=>{N.setValue(`importMode`,e,{shouldDirty:!0}),I(t=>({...C,...t??{},importMode:e}))},children:[g(u.Trigger,{children:g(u.Value,{placeholder:U.label.value})}),_(u.Content,{children:[g(u.Item,{value:`static`,children:U.static.value}),g(u.Item,{value:`dynamic`,children:U.dynamic.value}),g(u.Item,{value:`live`,children:U.live.value})]})]})}),_(`div`,{className:`grid grid-cols-2 gap-8 max-md:grid-cols-1`,children:[_(f.MultiSelect,{name:`projectIds`,label:B.label.value,description:B.description,onValueChange:e=>{let t=[e].flat();N.setValue(`projectIds`,t,{shouldDirty:!0}),I(e=>({...C,...e??{},projectIds:t}))},children:[g(l.Trigger,{getBadgeValue:e=>A?.find(t=>String(t.id)===e)?.name??e,children:g(l.Input,{placeholder:B.placeholder.value})}),g(l.Content,{children:g(i,{isLoading:O,children:g(l.List,{children:A?.map(e=>g(l.Item,{value:String(e.id),children:e.name},String(e.id)))})})})]}),_(f.MultiSelect,{name:`tags`,label:V.label.value,description:V.description,onValueChange:e=>{let t=[e].flat();N.setValue(`tags`,t,{shouldDirty:!0}),I(e=>({...C,...e??{},tags:t}))},children:[g(l.Trigger,{getBadgeValue:e=>j?.find(t=>String(t.key)===e)?.name??e,children:g(l.Input,{placeholder:V.placeholder.value})}),g(l.Content,{children:g(i,{isLoading:O,children:g(l.List,{children:j?.map(e=>g(l.Item,{value:String(e.key),children:e.name??e.key},String(e.key)))})})})]})]}),g(`div`,{className:`flex flex-wrap items-center justify-end gap-2 max-md:flex-col`,children:g(f.Button,{type:`button`,size:o.ICON_MD,label:G.label.value,Icon:h,variant:s.OUTLINE,color:a.TEXT,className:`max-md:w-full`,onClick:Y,disabled:P||q,isLoading:q})})]})};export{C as DictionaryDetailsForm};
1
+ "use client";import{Loader as e}from"../../Loader/index.mjs";import{ButtonColor as t,ButtonSize as n,ButtonVariant as r}from"../../Button/Button.mjs";import{Checkbox as i}from"../../Input/Checkbox.mjs";import{useSession as a}from"../../../hooks/useAuth/useSession.mjs";import{useAuditContentDeclarationMetadata as o,useGetProjects as s,useGetTags as c}from"../../../hooks/reactQuery.mjs";import{MultiSelect as l}from"../../Select/Multiselect.mjs";import{Select as u}from"../../Select/Select.mjs";import{useForm as d}from"../../Form/FormBase.mjs";import{Form as f}from"../../Form/Form.mjs";import{useDictionaryDetailsSchema as p}from"./useDictionaryDetailsSchema.mjs";import{useEffect as m}from"react";import{WandSparkles as h}from"lucide-react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{useIntlayer as v}from"react-intlayer";import{useEditedContent as y}from"@intlayer/editor-react";import{AnimatePresence as b,motion as x}from"framer-motion";import{useWatch as S}from"react-hook-form";const C=({dictionary:C,mode:w})=>{let{session:T}=a(),{project:E}=T??{},{data:D,isLoading:O}=s(),{data:k}=c(),A=D?.data??[],j=k?.data??[],M=p(String(E?.id)),{form:N,isSubmitting:P}=d(M,{defaultValues:{...C,location:C.location??`remote`}}),{editedContent:F,setEditedDictionary:I}=y(),{titleInput:L,keyInput:R,descriptionInput:z,projectInput:B,tagsSelect:V,locationSelect:H,importModeSelect:U,filePathInput:W,auditButton:G}=v(`dictionary-details`),{mutate:K,isPending:q}=o(),J=F?.[C.localId];m(()=>{N.reset({...C,location:C.location??`remote`})},[C,N?.reset]),m(()=>{J===void 0&&N.reset({...C,location:C.location??`remote`})},[J]);let Y=()=>{let e={...C,...J};K({fileContent:JSON.stringify(e)},{onSuccess:t=>{if(t?.data)try{let n=t.data.fileContent;I(t=>({...t,...e,...n})),N.reset({...e,...n})}catch(e){console.error(e)}}})},X=S({control:N.control,name:`location`}),Z=X===`local`||X===`hybrid`;return _(f,{className:`flex w-full flex-col gap-8`,...N,schema:M,children:[_(`div`,{className:`grid grid-cols-2 gap-8 max-md:grid-cols-1`,children:[g(f.EditableFieldInput,{name:`key`,label:R.label,placeholder:R.label.value,description:R.description,disabled:P,isRequired:!0,onSave:e=>{N.setValue(`key`,e,{shouldDirty:!0}),I(t=>({...C,...t??{},key:e}))}}),g(f.EditableFieldInput,{name:`title`,label:L.label,placeholder:L.placeholder.value,description:L.description,disabled:P,onSave:e=>{N.setValue(`title`,e,{shouldDirty:!0}),I(t=>({...C,...t??{},title:e}))}})]}),g(f.EditableFieldTextArea,{name:`description`,label:z.label,placeholder:z.placeholder.value,description:z.description,disabled:P,onSave:e=>{N.setValue(`description`,e,{shouldDirty:!0}),I(t=>({...C,...t??{},description:e}))}}),_(`div`,{className:`grid grid-cols-2 gap-8 px-1 max-md:grid-cols-1`,children:[g(f.Field,{control:N.control,name:`location`,render:({field:e})=>{let t=e.value,n=t===`local`||t===`hybrid`,r=t===`remote`||t===`hybrid`,a=t=>{if(!t&&!r)return;let n=t?r?`hybrid`:`local`:`remote`;e.onChange(n);let i=t?N.getValues(`filePath`)??C.filePath:void 0;t||N.setValue(`filePath`,void 0),I(e=>({...C,...e??{},location:n,filePath:i}))},o=t=>{if(!t&&!n)return;let r=t?n?`hybrid`:`remote`:`local`;e.onChange(r),I(e=>({...C,...e??{},location:r}))};return _(f.Item,{className:`flex flex-col gap-2 px-1`,children:[g(f.Label,{className:`ml-1`,children:H.label}),_(`div`,{className:`ml-2 flex items-center gap-4 py-2`,children:[g(i,{id:`location-local`,name:`location-local`,label:H.local.value,checked:n,disabled:!w.includes(`local`)&&!w.includes(`remote`),onChange:e=>a(e.target.checked)}),g(i,{id:`location-remote`,name:`location-remote`,label:H.remote.value,checked:r,disabled:!w.includes(`remote`)&&C.location!==`remote`&&C.location!==`hybrid`,onChange:e=>o(e.target.checked)})]}),g(f.Description,{children:H.testDescription}),g(f.Message,{})]})}}),g(b,{mode:`wait`,children:Z&&g(x.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.3},className:`overflow-hidden`,children:g(f.Input,{name:`filePath`,label:W.label.value,placeholder:W.placeholder.value,description:W.description.value,disabled:P||!Z,onChange:e=>{let t=e.target.value;I(e=>({...C,...e??{},filePath:t}))}})},`filePath-input`)})]}),g(`div`,{className:`grid grid-cols-2 gap-8 max-md:grid-cols-1`,children:_(f.Select,{name:`importMode`,label:U.label.value,description:U.description.value,onValueChange:e=>{N.setValue(`importMode`,e,{shouldDirty:!0}),I(t=>({...C,...t??{},importMode:e}))},children:[g(u.Trigger,{children:g(u.Value,{placeholder:U.label.value})}),_(u.Content,{children:[g(u.Item,{value:`static`,children:U.static.value}),g(u.Item,{value:`dynamic`,children:U.dynamic.value}),g(u.Item,{value:`live`,children:U.live.value})]})]})}),_(`div`,{className:`grid grid-cols-2 gap-8 max-md:grid-cols-1`,children:[_(f.MultiSelect,{name:`projectIds`,label:B.label.value,description:B.description,onValueChange:e=>{let t=[e].flat();N.setValue(`projectIds`,t,{shouldDirty:!0}),I(e=>({...C,...e??{},projectIds:t}))},children:[g(l.Trigger,{getBadgeValue:e=>A?.find(t=>String(t.id)===e)?.name??e,children:g(l.Input,{placeholder:B.placeholder.value})}),g(l.Content,{children:g(e,{isLoading:O,children:g(l.List,{children:A?.map(e=>g(l.Item,{value:String(e.id),children:e.name},String(e.id)))})})})]}),_(f.MultiSelect,{name:`tags`,label:V.label.value,description:V.description,onValueChange:e=>{let t=[e].flat();N.setValue(`tags`,t,{shouldDirty:!0}),I(e=>({...C,...e??{},tags:t}))},children:[g(l.Trigger,{getBadgeValue:e=>j?.find(t=>String(t.key)===e)?.name??e,children:g(l.Input,{placeholder:V.placeholder.value})}),g(l.Content,{children:g(e,{isLoading:O,children:g(l.List,{children:j?.map(e=>g(l.Item,{value:String(e.key),children:e.name??e.key},String(e.key)))})})})]})]}),g(`div`,{className:`flex flex-wrap items-center justify-end gap-2 max-md:flex-col`,children:g(f.Button,{type:`button`,size:n.ICON_MD,label:G.label.value,Icon:h,variant:r.OUTLINE,color:t.TEXT,className:`max-md:w-full`,onClick:Y,disabled:P||q,isLoading:q})})]})};export{C as DictionaryDetailsForm};
2
2
  //# sourceMappingURL=DictionaryDetailsForm.mjs.map
@@ -1,2 +1,2 @@
1
- "use client";import{Button as e,ButtonColor as t,ButtonVariant as n}from"../Button/Button.mjs";import{CopyToClipboard as r}from"../CopyToClipboard/index.mjs";import{LocaleSwitcherContentProvider as i}from"../LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs";import{Tab as a}from"../Tab/Tab.mjs";import{ContentEditor as o}from"./ContentEditor.mjs";import{DictionaryDetailsForm as s}from"./DictionaryDetails/DictionaryDetailsForm.mjs";import{JSONEditor as c}from"./JSONEditor.mjs";import{SaveForm as l}from"./SaveForm/SaveForm.mjs";import{StructureEditor as u}from"./StructureEditor.mjs";import{useEffect as d}from"react";import{ArrowLeft as f}from"lucide-react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{useConfiguration as h,useDictionariesRecordActions as g,useFocusUnmergedDictionary as _}from"@intlayer/editor-react";import{useIntlayer as v}from"react-intlayer";const y=({dictionary:y,onClickDictionaryList:b,isDarkMode:x,mode:S,onDelete:C,onSave:w,showReturnButton:T=!0})=>{let E=h(),{returnToDictionaryList:D}=v(`dictionary-field-editor`),{focusedContent:O,setFocusedContent:k}=_(),{setLocaleDictionary:A}=g();return d(()=>{k({...O??{},dictionaryKey:y.key,dictionaryLocalId:y.localId}),A(y)},[]),p(i,{availableLocales:E?.internationalization.locales??[],children:m(`div`,{className:`relative flex h-full min-h-0 w-full flex-1 flex-col md:overflow-hidden`,children:[T&&p(e,{onClick:b,variant:n.HOVERABLE,className:`z-10 mr-auto mb-6 ml-5 shrink-0`,color:t.TEXT,Icon:f,label:D.label.value,children:D.text}),p(`div`,{className:`min-h-0 flex-1`,children:m(a,{defaultTab:`content`,variant:`ghost`,fullHeight:!0,headerClassName:`sticky top-0 z-10 rounded-xl bg-background/20 pb-4`,children:[S.includes(`remote`)&&p(a.Item,{label:`Details`,value:`details`,children:p(s,{dictionary:y,mode:S})}),p(a.Item,{label:`Structure`,value:`structure`,children:p(u,{dictionary:y})}),p(a.Item,{label:`Content`,value:`content`,children:p(o,{dictionary:y,isDarkMode:x})}),p(a.Item,{label:`JSON`,value:`json`,children:p(c,{dictionary:y,isDarkMode:x})})]})}),m(`div`,{className:`sticky bottom-16 z-20 flex shrink-0 flex-wrap items-center justify-end gap-10 border-card border-t p-4 md:bottom-0`,children:[p(r,{text:y.id,className:`text-nowrap text-neutral text-sm`,size:9,children:y.id}),p(l,{dictionary:y,mode:S,onDelete:()=>{k(null),C?.()},onSave:w})]})]})})};export{y as DictionaryFieldEditor};
1
+ "use client";import{Button as e,ButtonColor as t,ButtonVariant as n}from"../Button/Button.mjs";import{CopyToClipboard as r}from"../CopyToClipboard/index.mjs";import{LocaleSwitcherContentProvider as i}from"../LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs";import{Tab as a}from"../Tab/Tab.mjs";import{ContentEditor as o}from"./ContentEditor.mjs";import{DictionaryDetailsForm as s}from"./DictionaryDetails/DictionaryDetailsForm.mjs";import{JSONEditor as c}from"./JSONEditor.mjs";import{SaveForm as l}from"./SaveForm/SaveForm.mjs";import{StructureEditor as u}from"./StructureEditor.mjs";import{useEffect as d}from"react";import{ArrowLeft as f}from"lucide-react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{useIntlayer as h}from"react-intlayer";import{useConfiguration as g,useDictionariesRecordActions as _,useFocusUnmergedDictionary as v}from"@intlayer/editor-react";const y=({dictionary:y,onClickDictionaryList:b,isDarkMode:x,mode:S,onDelete:C,onSave:w,showReturnButton:T=!0})=>{let E=g(),{returnToDictionaryList:D}=h(`dictionary-field-editor`),{focusedContent:O,setFocusedContent:k}=v(),{setLocaleDictionary:A}=_();return d(()=>{k({...O??{},dictionaryKey:y.key,dictionaryLocalId:y.localId}),A(y)},[]),p(i,{availableLocales:E?.internationalization.locales??[],children:m(`div`,{className:`relative flex h-full min-h-0 w-full flex-1 flex-col md:overflow-hidden`,children:[T&&p(e,{onClick:b,variant:n.HOVERABLE,className:`z-10 mr-auto mb-6 ml-5 shrink-0`,color:t.TEXT,Icon:f,label:D.label.value,children:D.text}),p(`div`,{className:`min-h-0 flex-1`,children:m(a,{defaultTab:`content`,variant:`ghost`,fullHeight:!0,headerClassName:`sticky top-0 z-10 rounded-xl bg-background/20 pb-4`,children:[S.includes(`remote`)&&p(a.Item,{label:`Details`,value:`details`,children:p(s,{dictionary:y,mode:S})}),p(a.Item,{label:`Structure`,value:`structure`,children:p(u,{dictionary:y})}),p(a.Item,{label:`Content`,value:`content`,children:p(o,{dictionary:y,isDarkMode:x})}),p(a.Item,{label:`JSON`,value:`json`,children:p(c,{dictionary:y,isDarkMode:x})})]})}),m(`div`,{className:`sticky bottom-16 z-20 flex shrink-0 flex-wrap items-center justify-end gap-10 border-card border-t p-4 md:bottom-0`,children:[p(r,{text:y.id,className:`text-nowrap text-neutral text-sm`,size:9,children:y.id}),p(l,{dictionary:y,mode:S,onDelete:()=>{k(null),C?.()},onSave:w})]})]})})};export{y as DictionaryFieldEditor};
2
2
  //# sourceMappingURL=DictionaryFieldEditor.mjs.map
@@ -1,2 +1,2 @@
1
- import{Button as e,ButtonColor as t,ButtonTextAlign as n,ButtonVariant as r}from"../../Button/Button.mjs";import{Accordion as i}from"../../Accordion/Accordion.mjs";import{getIsEditableSection as a}from"../getIsEditableSection.mjs";import{ChevronRight as o,Plus as s}from"lucide-react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import d from"@intlayer/config/built";import{camelCaseToSentence as f}from"@intlayer/config/client";import{useEditedContentActions as p,useEditorLocale as m,useFocusUnmergedDictionary as h}from"@intlayer/editor-react";import{useIntlayer as g}from"react-intlayer";import{getContentNodeByKeyPath as _,getEmptyNode as v,getNodeType as y}from"@intlayer/core/dictionaryManipulator";import{NodeType as b}from"@intlayer/types/nodeType";import{isSameKeyPath as x}from"@intlayer/core/utils";const S=[`filePath`,`id`,`nodeType`],C=({section:S,keyPath:w,dictionary:T})=>{let{locales:E}=d.internationalization,D=_(S,w,m()),{addEditedContent:O}=p(),{setFocusedContentKeyPath:k,focusedContent:A}=h(),{addNewElement:j,goToField:M}=g(`navigation-view`),N=y(D),P=e=>(A?.keyPath?.length??0)>0&&x(e,A?.keyPath??[]),F=a(D);return D?F?l(e,{label:M.label.value,variant:r.HOVERABLE,color:t.TEXT,className:`w-full`,onClick:()=>k(w),IconRight:o,children:f(w[w.length-1].key)}):typeof D==`object`?N===b.ReactNode?l(c,{children:`React Node`}):N===b.Translation?l(`div`,{className:`flex flex-col justify-between gap-2`,children:E.map(e=>l(C,{keyPath:[...w,{type:b.Translation,key:e}],section:S,dictionary:T},e))}):N===b.Enumeration||N===b.Condition?l(`div`,{className:`flex flex-col justify-between gap-2`,children:Object.keys(D[N]).map(e=>l(C,{keyPath:[...w,{type:N,key:e}],section:S,dictionary:T},e))}):N===b.Array?u(`div`,{className:`flex flex-col justify-between gap-2`,children:[D.map((n,s)=>{let c=[...w,{type:b.Array,key:s}];return a(n)?u(e,{label:`${M.label.value} ${s}`,variant:r.HOVERABLE,color:t.TEXT,className:`w-full`,onClick:()=>k(c),IconRight:o,isActive:P(c),children:[`Item `,s]},JSON.stringify(c)):l(i,{label:`${M.label.value} ${s}`,header:`Item ${s}`,isActive:P(c),onClick:()=>k(c),children:l(`div`,{className:`mt-2 flex w-full max-w-full`,children:l(`div`,{className:`flex-1 pl-10`,children:l(C,{keyPath:c,section:S,dictionary:T})})})},JSON.stringify(c))}),l(e,{label:j.label.value,variant:r.HOVERABLE,color:t.NEUTRAL,textAlign:n.LEFT,onClick:()=>{let e=[...w,{type:b.Array,key:D.length}],t=D,n=v(t[t.length-1])??``;O(T.localId,n,e,!1),k(e)},Icon:s,children:j.text})]}):typeof D.nodeType==`string`?l(C,{keyPath:[...w,{type:D.nodeType}],section:S,dictionary:T}):l(`div`,{className:`flex w-full max-w-full flex-col justify-between gap-2`,children:Object.keys(D).map(n=>{let s=[...w,{type:b.Object,key:n}];return a(_(S,s))?l(e,{label:`${M.label.value} ${n}`,isActive:P(s),variant:r.HOVERABLE,color:t.TEXT,className:`w-full`,onClick:()=>k(s),IconRight:o,children:f(n)},n):l(i,{label:`${M.label.value} ${n}`,isActive:P(s),onClick:()=>k(s),header:f(n),children:l(`div`,{className:`mt-2 flex w-full max-w-full`,children:l(`div`,{className:`flex-1 pl-10`,children:l(C,{keyPath:s,section:S,dictionary:T})})})},n)})}):u(c,{children:[`Error loading section --`,N,`--`,JSON.stringify(D),`--`,JSON.stringify(w)]}):l(c,{})};export{C as NavigationViewNode,S as traceKeys};
1
+ import{Button as e,ButtonColor as t,ButtonTextAlign as n,ButtonVariant as r}from"../../Button/Button.mjs";import{Accordion as i}from"../../Accordion/Accordion.mjs";import{getIsEditableSection as a}from"../getIsEditableSection.mjs";import{ChevronRight as o,Plus as s}from"lucide-react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import d from"@intlayer/config/built";import{camelCaseToSentence as f}from"@intlayer/config/client";import{useIntlayer as p}from"react-intlayer";import{useEditedContentActions as m,useEditorLocale as h,useFocusUnmergedDictionary as g}from"@intlayer/editor-react";import{getContentNodeByKeyPath as _,getEmptyNode as v,getNodeType as y}from"@intlayer/core/dictionaryManipulator";import{NodeType as b}from"@intlayer/types/nodeType";import{isSameKeyPath as x}from"@intlayer/core/utils";const S=[`filePath`,`id`,`nodeType`],C=({section:S,keyPath:w,dictionary:T})=>{let{locales:E}=d.internationalization,D=_(S,w,h()),{addEditedContent:O}=m(),{setFocusedContentKeyPath:k,focusedContent:A}=g(),{addNewElement:j,goToField:M}=p(`navigation-view`),N=y(D),P=e=>(A?.keyPath?.length??0)>0&&x(e,A?.keyPath??[]),F=a(D);return D?F?l(e,{label:M.label.value,variant:r.HOVERABLE,color:t.TEXT,className:`w-full`,onClick:()=>k(w),IconRight:o,children:f(w[w.length-1].key)}):typeof D==`object`?N===b.ReactNode?l(c,{children:`React Node`}):N===b.Translation?l(`div`,{className:`flex flex-col justify-between gap-2`,children:E.map(e=>l(C,{keyPath:[...w,{type:b.Translation,key:e}],section:S,dictionary:T},e))}):N===b.Enumeration||N===b.Condition?l(`div`,{className:`flex flex-col justify-between gap-2`,children:Object.keys(D[N]).map(e=>l(C,{keyPath:[...w,{type:N,key:e}],section:S,dictionary:T},e))}):N===b.Array?u(`div`,{className:`flex flex-col justify-between gap-2`,children:[D.map((n,s)=>{let c=[...w,{type:b.Array,key:s}];return a(n)?u(e,{label:`${M.label.value} ${s}`,variant:r.HOVERABLE,color:t.TEXT,className:`w-full`,onClick:()=>k(c),IconRight:o,isActive:P(c),children:[`Item `,s]},JSON.stringify(c)):l(i,{label:`${M.label.value} ${s}`,header:`Item ${s}`,isActive:P(c),onClick:()=>k(c),children:l(`div`,{className:`mt-2 flex w-full max-w-full`,children:l(`div`,{className:`flex-1 pl-10`,children:l(C,{keyPath:c,section:S,dictionary:T})})})},JSON.stringify(c))}),l(e,{label:j.label.value,variant:r.HOVERABLE,color:t.NEUTRAL,textAlign:n.LEFT,onClick:()=>{let e=[...w,{type:b.Array,key:D.length}],t=D,n=v(t[t.length-1])??``;O(T.localId,n,e,!1),k(e)},Icon:s,children:j.text})]}):typeof D.nodeType==`string`?l(C,{keyPath:[...w,{type:D.nodeType}],section:S,dictionary:T}):l(`div`,{className:`flex w-full max-w-full flex-col justify-between gap-2`,children:Object.keys(D).map(n=>{let s=[...w,{type:b.Object,key:n}];return a(_(S,s))?l(e,{label:`${M.label.value} ${n}`,isActive:P(s),variant:r.HOVERABLE,color:t.TEXT,className:`w-full`,onClick:()=>k(s),IconRight:o,children:f(n)},n):l(i,{label:`${M.label.value} ${n}`,isActive:P(s),onClick:()=>k(s),header:f(n),children:l(`div`,{className:`mt-2 flex w-full max-w-full`,children:l(`div`,{className:`flex-1 pl-10`,children:l(C,{keyPath:s,section:S,dictionary:T})})})},n)})}):u(c,{children:[`Error loading section --`,N,`--`,JSON.stringify(D),`--`,JSON.stringify(w)]}):l(c,{})};export{C as NavigationViewNode,S as traceKeys};
2
2
  //# sourceMappingURL=NavigationViewNode.mjs.map
@@ -1,2 +1,2 @@
1
- "use client";import{cn as e}from"../../../utils/cn.mjs";import{useAuth as t}from"../../../hooks/useAuth/useAuth.mjs";import{useDeleteDictionary as n,usePushDictionaries as r,useWriteDictionary as i}from"../../../hooks/reactQuery.mjs";import{ButtonColor as a,ButtonVariant as o}from"../../Button/Button.mjs";import{Modal as s,ModalSize as c}from"../../Modal/Modal.mjs";import{Form as l}from"../../Form/Form.mjs";import{useState as u}from"react";import{ArrowUpFromLine as d,Download as f,RotateCcw as p,Save as m,Trash as h}from"lucide-react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{useDictionariesRecordActions as y,useEditedContent as b}from"@intlayer/editor-react";import{useIntlayer as x}from"react-intlayer";const S=({dictionary:S,mode:C,className:w,onDelete:T,onSave:E,...D})=>{let[O,k]=u(!1),{setLocaleDictionary:A}=y(),{mutate:j,isPending:M}=n(),{mutate:N,isPending:P}=i(),{mutate:F,isPending:I}=r(),L=P||I,{editedContent:R,restoreEditedContent:z}=b(),{deleteButton:B,resetButton:V,saveButton:H,publishButton:U,downloadButton:W,confirmation:G}=x(`save-dictionary-details`),{isAuthenticated:K}=t(),q=R?.[S.localId],J=q&&JSON.stringify(q)!==JSON.stringify(S),Y=S?.id!==void 0,X=async()=>{R?.[S.localId]&&N({dictionary:{...S,...R?.[S.localId]}},{onSuccess:()=>{A(R?.[S.localId]),z(S.localId),k(!1),E?.()}})},Z=()=>{let e={...S,...R?.[S.localId]};F({dictionaries:[e]},{onSuccess:t=>{t&&(A(e),z(S.localId),E?.())}})},Q=()=>{S.id&&j({dictionaryId:S.id},{onSuccess:e=>{e&&T?.()}})};return v(g,{children:[_(s,{isOpen:O,title:G.title.value,size:c.MD,onClose:()=>k(!1),padding:`md`,children:v(`form`,{className:`size-full`,children:[_(`p`,{className:`py-4 text-neutral text-sm`,children:G.message}),v(`div`,{className:`mt-12 flex justify-end gap-2 max-md:flex-col`,children:[_(l.Button,{label:G.cancelButton.label.value,disabled:!J||L,color:a.TEXT,className:`max-md:w-full`,variant:o.OUTLINE,onClick:()=>k(!1),children:G.cancelButton.text}),_(l.Button,{label:G.confirmButton.label.value,disabled:!J||L,Icon:m,color:a.TEXT,className:`max-md:w-full`,isLoading:I,onClick:X,children:G.confirmButton.text})]})]})}),v(`form`,{className:e(`flex justify-end gap-2 max-md:flex-col`,w),...D,children:[C.includes(`remote`)&&Y&&T&&K&&_(l.Button,{label:B.label.value,Icon:h,color:a.ERROR,variant:o.OUTLINE,className:`max-md:w-full`,isLoading:M,onClick:Q,children:B.text}),J&&_(l.Button,{label:V.label.value,disabled:!J,Icon:p,variant:o.OUTLINE,color:a.TEXT,className:`max-md:w-full`,onClick:()=>z(S.localId),children:V.text}),C.includes(`local`)&&_(l.Button,{label:W.label.value,disabled:!J||L,Icon:f,color:a.TEXT,variant:K?o.OUTLINE:o.DEFAULT,className:`max-md:w-full`,isLoading:P,onClick:()=>k(!0),children:W.text}),C.includes(`remote`)&&K&&!Y&&_(l.Button,{label:U.label.value,disabled:L,Icon:d,color:a.TEXT,className:`max-md:w-full`,isLoading:I,onClick:Z,children:U.text}),C.includes(`remote`)&&K&&Y&&J&&_(l.Button,{label:H.label.value,disabled:!J||L,Icon:m,color:`text`,className:`max-md:w-full`,isLoading:I,onClick:Z,children:H.text})]})]})};export{S as SaveForm};
1
+ "use client";import{cn as e}from"../../../utils/cn.mjs";import{ButtonColor as t,ButtonVariant as n}from"../../Button/Button.mjs";import{useAuth as r}from"../../../hooks/useAuth/useAuth.mjs";import{useDeleteDictionary as i,usePushDictionaries as a,useWriteDictionary as o}from"../../../hooks/reactQuery.mjs";import{Modal as s,ModalSize as c}from"../../Modal/Modal.mjs";import{Form as l}from"../../Form/Form.mjs";import{useState as u}from"react";import{ArrowUpFromLine as d,Download as f,RotateCcw as p,Save as m,Trash as h}from"lucide-react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{useIntlayer as y}from"react-intlayer";import{useDictionariesRecordActions as b,useEditedContent as x}from"@intlayer/editor-react";const S=({dictionary:S,mode:C,className:w,onDelete:T,onSave:E,...D})=>{let[O,k]=u(!1),{setLocaleDictionary:A}=b(),{mutate:j,isPending:M}=i(),{mutate:N,isPending:P}=o(),{mutate:F,isPending:I}=a(),L=P||I,{editedContent:R,restoreEditedContent:z}=x(),{deleteButton:B,resetButton:V,saveButton:H,publishButton:U,downloadButton:W,confirmation:G}=y(`save-dictionary-details`),{isAuthenticated:K}=r(),q=R?.[S.localId],J=q&&JSON.stringify(q)!==JSON.stringify(S),Y=S?.id!==void 0,X=async()=>{R?.[S.localId]&&N({dictionary:{...S,...R?.[S.localId]}},{onSuccess:()=>{A(R?.[S.localId]),z(S.localId),k(!1),E?.()}})},Z=()=>{let e={...S,...R?.[S.localId]};F({dictionaries:[e]},{onSuccess:t=>{t&&(A(e),z(S.localId),E?.())}})},Q=()=>{S.id&&j({dictionaryId:S.id},{onSuccess:e=>{e&&T?.()}})};return v(g,{children:[_(s,{isOpen:O,title:G.title.value,size:c.MD,onClose:()=>k(!1),padding:`md`,children:v(`form`,{className:`size-full`,children:[_(`p`,{className:`py-4 text-neutral text-sm`,children:G.message}),v(`div`,{className:`mt-12 flex justify-end gap-2 max-md:flex-col`,children:[_(l.Button,{label:G.cancelButton.label.value,disabled:!J||L,color:t.TEXT,className:`max-md:w-full`,variant:n.OUTLINE,onClick:()=>k(!1),children:G.cancelButton.text}),_(l.Button,{label:G.confirmButton.label.value,disabled:!J||L,Icon:m,color:t.TEXT,className:`max-md:w-full`,isLoading:I,onClick:X,children:G.confirmButton.text})]})]})}),v(`form`,{className:e(`flex justify-end gap-2 max-md:flex-col`,w),...D,children:[C.includes(`remote`)&&Y&&T&&K&&_(l.Button,{label:B.label.value,Icon:h,color:t.ERROR,variant:n.OUTLINE,className:`max-md:w-full`,isLoading:M,onClick:Q,children:B.text}),J&&_(l.Button,{label:V.label.value,disabled:!J,Icon:p,variant:n.OUTLINE,color:t.TEXT,className:`max-md:w-full`,onClick:()=>z(S.localId),children:V.text}),C.includes(`local`)&&_(l.Button,{label:W.label.value,disabled:!J||L,Icon:f,color:t.TEXT,variant:K?n.OUTLINE:n.DEFAULT,className:`max-md:w-full`,isLoading:P,onClick:()=>k(!0),children:W.text}),C.includes(`remote`)&&K&&!Y&&_(l.Button,{label:U.label.value,disabled:L,Icon:d,color:t.TEXT,className:`max-md:w-full`,isLoading:I,onClick:Z,children:U.text}),C.includes(`remote`)&&K&&Y&&J&&_(l.Button,{label:H.label.value,disabled:!J||L,Icon:m,color:`text`,className:`max-md:w-full`,isLoading:I,onClick:Z,children:H.text})]})]})};export{S as SaveForm};
2
2
  //# sourceMappingURL=SaveForm.mjs.map
@@ -1,2 +1,2 @@
1
- "use client";import{Container as e}from"../../Container/index.mjs";import{Button as t,ButtonColor as n,ButtonSize as r,ButtonVariant as i}from"../../Button/Button.mjs";import{InputVariant as a}from"../../Input/Input.mjs";import{EditableFieldInput as o}from"../../EditableField/EditableFieldInput.mjs";import{NodeTypeSelector as s}from"../NodeTypeSelector.mjs";import{Plus as c,Trash as l}from"lucide-react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import{camelCaseToSentence as p}from"@intlayer/config/client";import{useConfiguration as m,useEditedContentActions as h,useFocusUnmergedDictionary as g}from"@intlayer/editor-react";import{useIntlayer as _}from"react-intlayer";import{getDefaultNode as v,getNodeChildren as y,getNodeType as b}from"@intlayer/core/dictionaryManipulator";import{NodeType as x}from"@intlayer/types/nodeType";import{isSameKeyPath as S}from"@intlayer/core/utils";const C=({section:e,dictionaryLocalId:t,keyPath:n,onNodeTypeChange:r})=>{let i=m()?.internationalization.locales??[],a=b(e),o=y(e),c=e=>{r(v(a,i,e))};if(a===x.Translation||a===x.Condition||a===x.Gender||a===x.Enumeration){let l=Object.keys(e[a])[0],u=[...n,{type:a,key:l}];return f(`div`,{className:`flex w-full flex-col gap-1`,children:[d(s,{section:e,onValueChange:e=>r(v(e,i))}),d(C,{section:o,keyPath:u,dictionaryLocalId:t,onNodeTypeChange:c})]})}if(a===x.Array){let l=[...n,{type:a,key:0}];return f(`div`,{className:`flex w-full flex-col gap-1`,children:[d(s,{section:e,onValueChange:e=>r(v(e,i))}),d(C,{section:o,keyPath:l,dictionaryLocalId:t,onNodeTypeChange:c})]})}return a===x.Object?f(u,{children:[d(s,{section:e,onValueChange:e=>r(v(e,i))}),d(`div`,{className:`mt-6 ml-10`,children:d(E,{keyPath:n,section:e,dictionaryLocalId:t})})]}):d(s,{section:e,onValueChange:e=>r(v(e,i))})},w=({sectionKey:s,section:c,keyPath:u,dictionaryLocalId:m})=>{let{focusedContent:v,setFocusedContentKeyPath:y}=g(),{renameEditedContent:b,addEditedContent:x}=h(),{titleInput:w,deleteButton:T}=_(`structure-view`),E=e=>{b(m,e,u);let t=u.slice(0,-1),n=u[u.length-1];y([...t,{...n,key:e}])};return d(e,{transparency:`xl`,roundedSize:`xl`,className:`w-full min-w-80 gap-2 overflow-auto px-5 py-2`,border:!0,borderColor:`text`,background:`none`,"aria-selected":S(u,v?.keyPath??[]),onClick:()=>y(u),children:f(`div`,{className:`flex w-full flex-col items-start justify-between gap-3`,children:[typeof s==`string`&&f(`div`,{className:`w-full`,children:[f(`div`,{className:`flex w-full items-center justify-between gap-10`,children:[d(o,{name:`key`,"aria-label":`Key`,placeholder:w.placeholder.value,defaultValue:s,onSave:e=>E(e),variant:a.INVISIBLE}),d(t,{label:T.label.value,variant:i.HOVERABLE,size:r.ICON_SM,color:n.TEXT,className:`translate-x-2`,Icon:l,onClick:()=>{x(m,void 0,u),y(u.slice(0,-1))}})]}),f(`span`,{className:`ml-3 text-neutral text-sm`,children:[`( `,p(s),` )`]})]}),d(C,{keyPath:u,dictionaryLocalId:m,section:c,onNodeTypeChange:e=>{x(m,e,u)}})]})})},T=({section:e,keyPath:a,dictionaryLocalId:o})=>{let{addNodeButton:s}=_(`structure-view`),{setFocusedContentKeyPath:l}=g(),{addEditedContent:u}=h();return!e||typeof e!=`object`?d(`div`,{children:`Not an object`}):f(`div`,{className:`flex flex-col gap-2 overflow-y-auto`,children:[d(`ul`,{className:`mr-auto flex flex-col gap-4`,children:Object.keys(e).map(t=>d(`li`,{className:`flex w-full`,children:d(w,{sectionKey:t,section:e?.[t],keyPath:[...a,{type:x.Object,key:t}],dictionaryLocalId:o})},`${JSON.stringify(a)}-object-${t}`))}),d(t,{label:s.label.value,variant:i.HOVERABLE,size:r.MD,color:n.TEXT,Icon:c,className:`flex-1`,onClick:()=>{let e=[...a,{type:x.Object,key:`newKey`}];u(o,``,e),l(e)},children:s.text})]})},E=({section:e,keyPath:t,dictionaryLocalId:n})=>!e||typeof e!=`object`||typeof e.nodeType==`string`?d(w,{sectionKey:`content`,section:e,keyPath:t,dictionaryLocalId:n}):d(T,{section:e,keyPath:t,dictionaryLocalId:n});export{w as NodeView,T as ObjectView,E as StructureView};
1
+ "use client";import{Container as e}from"../../Container/index.mjs";import{Button as t,ButtonColor as n,ButtonSize as r,ButtonVariant as i}from"../../Button/Button.mjs";import{InputVariant as a}from"../../Input/Input.mjs";import{EditableFieldInput as o}from"../../EditableField/EditableFieldInput.mjs";import{NodeTypeSelector as s}from"../NodeTypeSelector.mjs";import{Plus as c,Trash as l}from"lucide-react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import{camelCaseToSentence as p}from"@intlayer/config/client";import{useIntlayer as m}from"react-intlayer";import{useConfiguration as h,useEditedContentActions as g,useFocusUnmergedDictionary as _}from"@intlayer/editor-react";import{getDefaultNode as v,getNodeChildren as y,getNodeType as b}from"@intlayer/core/dictionaryManipulator";import{NodeType as x}from"@intlayer/types/nodeType";import{isSameKeyPath as S}from"@intlayer/core/utils";const C=({section:e,dictionaryLocalId:t,keyPath:n,onNodeTypeChange:r})=>{let i=h()?.internationalization.locales??[],a=b(e),o=y(e),c=e=>{r(v(a,i,e))};if(a===x.Translation||a===x.Condition||a===x.Gender||a===x.Enumeration){let l=Object.keys(e[a])[0],u=[...n,{type:a,key:l}];return f(`div`,{className:`flex w-full flex-col gap-1`,children:[d(s,{section:e,onValueChange:e=>r(v(e,i))}),d(C,{section:o,keyPath:u,dictionaryLocalId:t,onNodeTypeChange:c})]})}if(a===x.Array){let l=[...n,{type:a,key:0}];return f(`div`,{className:`flex w-full flex-col gap-1`,children:[d(s,{section:e,onValueChange:e=>r(v(e,i))}),d(C,{section:o,keyPath:l,dictionaryLocalId:t,onNodeTypeChange:c})]})}return a===x.Object?f(u,{children:[d(s,{section:e,onValueChange:e=>r(v(e,i))}),d(`div`,{className:`mt-6 ml-10`,children:d(E,{keyPath:n,section:e,dictionaryLocalId:t})})]}):d(s,{section:e,onValueChange:e=>r(v(e,i))})},w=({sectionKey:s,section:c,keyPath:u,dictionaryLocalId:h})=>{let{focusedContent:v,setFocusedContentKeyPath:y}=_(),{renameEditedContent:b,addEditedContent:x}=g(),{titleInput:w,deleteButton:T}=m(`structure-view`),E=e=>{b(h,e,u);let t=u.slice(0,-1),n=u[u.length-1];y([...t,{...n,key:e}])};return d(e,{transparency:`xl`,roundedSize:`xl`,className:`w-full min-w-80 gap-2 overflow-auto px-5 py-2`,border:!0,borderColor:`text`,background:`none`,"aria-selected":S(u,v?.keyPath??[]),onClick:()=>y(u),children:f(`div`,{className:`flex w-full flex-col items-start justify-between gap-3`,children:[typeof s==`string`&&f(`div`,{className:`w-full`,children:[f(`div`,{className:`flex w-full items-center justify-between gap-10`,children:[d(o,{name:`key`,"aria-label":`Key`,placeholder:w.placeholder.value,defaultValue:s,onSave:e=>E(e),variant:a.INVISIBLE}),d(t,{label:T.label.value,variant:i.HOVERABLE,size:r.ICON_SM,color:n.TEXT,className:`translate-x-2`,Icon:l,onClick:()=>{x(h,void 0,u),y(u.slice(0,-1))}})]}),f(`span`,{className:`ml-3 text-neutral text-sm`,children:[`( `,p(s),` )`]})]}),d(C,{keyPath:u,dictionaryLocalId:h,section:c,onNodeTypeChange:e=>{x(h,e,u)}})]})})},T=({section:e,keyPath:a,dictionaryLocalId:o})=>{let{addNodeButton:s}=m(`structure-view`),{setFocusedContentKeyPath:l}=_(),{addEditedContent:u}=g();return!e||typeof e!=`object`?d(`div`,{children:`Not an object`}):f(`div`,{className:`flex flex-col gap-2 overflow-y-auto`,children:[d(`ul`,{className:`mr-auto flex flex-col gap-4`,children:Object.keys(e).map(t=>d(`li`,{className:`flex w-full`,children:d(w,{sectionKey:t,section:e?.[t],keyPath:[...a,{type:x.Object,key:t}],dictionaryLocalId:o})},`${JSON.stringify(a)}-object-${t}`))}),d(t,{label:s.label.value,variant:i.HOVERABLE,size:r.MD,color:n.TEXT,Icon:c,className:`flex-1`,onClick:()=>{let e=[...a,{type:x.Object,key:`newKey`}];u(o,``,e),l(e)},children:s.text})]})},E=({section:e,keyPath:t,dictionaryLocalId:n})=>!e||typeof e!=`object`||typeof e.nodeType==`string`?d(w,{sectionKey:`content`,section:e,keyPath:t,dictionaryLocalId:n}):d(T,{section:e,keyPath:t,dictionaryLocalId:n});export{w as NodeView,T as ObjectView,E as StructureView};
2
2
  //# sourceMappingURL=StructureView.mjs.map
@@ -1,2 +1,2 @@
1
- "use client";import{useItemSelector as e}from"../../../hooks/useItemSelector.mjs";import{InputIndicator as t,InputOTP as n,InputOTPGroup as r,InputOTPSeparator as i,InputOTPSlot as a}from"../../Input/OTPInput.mjs";import{useFormField as o}from"../FormField.mjs";import{FormItemLayout as s}from"../layout/FormItemLayout.mjs";import{Form as c}from"../Form.mjs";import{useEffect as l,useRef as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";import{useFormContext as m}from"react-hook-form";const h=e=>e?.getAttribute(`aria-selected`)===`true`,g=({field:c,name:m,label:g,description:_,isRequired:v,info:y,showErrorMessage:b,children:x,slots:S=6,maxLength:C=6,...w})=>{let{error:T}=o(),E=u([]),{choiceIndicatorPosition:D,calculatePosition:O}=e(E,{selector:h,isHoverable:!0});return l(()=>{O()},[]),f(s,{htmlFor:m,label:g,description:_,isRequired:v,info:y,showErrorMessage:b,"aria-invalid":!!T,children:f(n,{onChange:c.onChange,defaultValue:c.value,maxLength:C,pattern:`^[0-9]+$`,onActiveSlotChange:O,...w,children:x??p(d,{children:[p(r,{children:[f(a,{index:0,ref:e=>{E.current[0]=e}}),f(a,{index:1,ref:e=>{E.current[1]=e}}),f(a,{index:2,ref:e=>{E.current[2]=e}})]}),f(i,{}),p(r,{children:[f(a,{index:3,ref:e=>{E.current[3]=e}}),f(a,{index:4,ref:e=>{E.current[4]=e}}),f(a,{index:5,ref:e=>{E.current[5]=e}})]}),D&&f(t,{style:D})]})})})},_=({name:e,description:t,label:n,isRequired:r,info:i,showErrorMessage:a,children:o,slots:s=6,maxLength:l=6,...u})=>{let{control:d}=m();return f(c.Field,{control:d,name:e,render:({field:c})=>f(g,{field:c,name:e,label:n,description:t,isRequired:r,info:i,showErrorMessage:a,slots:s,maxLength:l,...u,children:o})})};export{_ as OTPElement};
1
+ "use client";import{InputIndicator as e,InputOTP as t,InputOTPGroup as n,InputOTPSeparator as r,InputOTPSlot as i}from"../../Input/OTPInput.mjs";import{useItemSelector as a}from"../../../hooks/useItemSelector.mjs";import{useFormField as o}from"../FormField.mjs";import{FormItemLayout as s}from"../layout/FormItemLayout.mjs";import{Form as c}from"../Form.mjs";import{useEffect as l,useRef as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";import{useFormContext as m}from"react-hook-form";const h=e=>e?.getAttribute(`aria-selected`)===`true`,g=({field:c,name:m,label:g,description:_,isRequired:v,info:y,showErrorMessage:b,children:x,slots:S=6,maxLength:C=6,...w})=>{let{error:T}=o(),E=u([]),{choiceIndicatorPosition:D,calculatePosition:O}=a(E,{selector:h,isHoverable:!0});return l(()=>{O()},[]),f(s,{htmlFor:m,label:g,description:_,isRequired:v,info:y,showErrorMessage:b,"aria-invalid":!!T,children:f(t,{onChange:c.onChange,defaultValue:c.value,maxLength:C,pattern:`^[0-9]+$`,onActiveSlotChange:O,...w,children:x??p(d,{children:[p(n,{children:[f(i,{index:0,ref:e=>{E.current[0]=e}}),f(i,{index:1,ref:e=>{E.current[1]=e}}),f(i,{index:2,ref:e=>{E.current[2]=e}})]}),f(r,{}),p(n,{children:[f(i,{index:3,ref:e=>{E.current[3]=e}}),f(i,{index:4,ref:e=>{E.current[4]=e}}),f(i,{index:5,ref:e=>{E.current[5]=e}})]}),D&&f(e,{style:D})]})})})},_=({name:e,description:t,label:n,isRequired:r,info:i,showErrorMessage:a,children:o,slots:s=6,maxLength:l=6,...u})=>{let{control:d}=m();return f(c.Field,{control:d,name:e,render:({field:c})=>f(g,{field:c,name:e,label:n,description:t,isRequired:r,info:i,showErrorMessage:a,slots:s,maxLength:l,...u,children:o})})};export{_ as OTPElement};
2
2
  //# sourceMappingURL=OTPElement.mjs.map
@@ -1,2 +1,2 @@
1
- "use client";import{usePersistedStore as e}from"../../hooks/usePersistedStore.mjs";import{Container as t}from"../Container/index.mjs";import{Button as n,ButtonColor as r,ButtonSize as i,ButtonTextAlign as a,ButtonVariant as o}from"../Button/Button.mjs";import{Input as s}from"../Input/Input.mjs";import{SwitchSelector as c,SwitchSelectorColor as l,SwitchSelectorSize as u}from"../SwitchSelector/index.mjs";import{DropDown as d}from"../DropDown/index.mjs";import{useLocaleSwitcherContent as f}from"./LocaleSwitcherContentContext.mjs";import{useMemo as p,useRef as m,useState as h}from"react";import{Check as g,Globe as _,MoveVertical as v}from"lucide-react";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";import{useIntlayer as S,useLocale as C}from"react-intlayer";import{getHTMLTextDir as w,getLocaleName as T}from"@intlayer/core/localization";import*as E from"@intlayer/types/locales";import D from"fuse.js";const O=`locale-switcher-content`,k=({panelProps:k,isMultilingual:A=!0})=>{let{switchTo:j,searchInput:M,localeSwitcherLabel:N,languageListLabel:P,seeAllLocalesSwitch:F}=S(`locale-switcher-content`),I=m(null),{locale:L}=C(),{availableLocales:R,selectedLocales:z,setSelectedLocales:B}=f(),V=p(()=>R.map(e=>({locale:e,englishName:T(e,E.ENGLISH),currentLocaleName:T(e,L),ownLocaleName:T(e)})),[R,L]),[H,U]=h(``),[W,G]=e(`locale-content-selector-see-all-locales`,!1),K=p(()=>new D(V,{keys:[{name:`ownLocaleName`,weight:.4},{name:`englishName`,weight:.2},{name:`currentLocaleName`,weight:.2},{name:`locale`,weight:.2}],threshold:.02}),[V]),q=p(()=>H?K.search(H).map(e=>e.item):V,[H,V,K]),J=e=>{A?z.includes(e)?z.length>1&&B(t=>t.filter(t=>t!==e)):B(t=>[...t,e]):B([e])},Y=e=>{G(e),B(e?R:[L])};return b(`div`,{className:`rounded-xl border border-text text-text transition-colors`,children:x(d,{identifier:O,children:[b(d.Trigger,{identifier:O,label:N.value,className:`p-0!`,roundedSize:`3xl`,color:`text`,children:x(`div`,{className:`flex w-full items-center justify-between text-text`,children:[b(`div`,{className:`px-2 py-1`,children:b(_,{size:16})}),b(v,{className:`self-center`,size:16})]})}),b(d.Panel,{identifier:O,isOverable:!0,isFocusable:!0,align:`end`,...k,children:x(t,{className:`max-h-[60vh] min-w-28`,separator:`y`,role:`listbox`,transparency:`xs`,border:!0,roundedSize:`3xl`,borderColor:`text`,"aria-label":P.value,children:[A&&b(`div`,{className:`m-auto p-2`,children:b(c,{defaultValue:W,onChange:Y,color:l.TEXT,size:u.SM,className:`!w-60`,choices:[{content:F.true.value,value:!0},{content:F.false.value,value:!1}]})}),!(A&&W)&&x(y,{children:[b(`div`,{className:`p-3`,children:b(s,{type:`search`,"aria-label":M.ariaLabel.value,placeholder:M.placeholder.value,onChange:e=>U(e.target.value),ref:I})}),b(`ol`,{className:`divide-y divide-dashed divide-text/20 overflow-y-auto p-1`,children:q.map(({locale:e,currentLocaleName:t,ownLocaleName:s})=>b(`li`,{className:`px-1.5 py-1`,children:b(n,{onClick:()=>J(e),label:`${j} ${t}`,disabled:!(R??R).includes(e),isActive:z.includes(e),variant:o.HOVERABLE,color:r.TEXT,isFullWidth:!0,textAlign:a.LEFT,size:i.SM,children:x(`div`,{className:`flex flex-row items-center justify-between gap-3 px-2 py-1`,children:[A&&b(`div`,{className:`w-4`,children:z.includes(e)&&b(g,{className:`size-full`})}),x(`div`,{className:`flex flex-1 flex-row items-center justify-between gap-3 px-2 py-1`,children:[x(`div`,{className:`flex flex-col text-nowrap`,children:[b(`span`,{dir:w(e),lang:e,children:s}),b(`span`,{className:`text-neutral text-xs`,children:t})]}),b(`span`,{className:`text-neutral text-sm`,children:e.toUpperCase()})]})]})})},e))})]})]})})]})})};export{k as LocaleSwitcherContent};
1
+ "use client";import{Container as e}from"../Container/index.mjs";import{Button as t,ButtonColor as n,ButtonSize as r,ButtonTextAlign as i,ButtonVariant as a}from"../Button/Button.mjs";import{Input as o}from"../Input/Input.mjs";import{SwitchSelector as s,SwitchSelectorColor as c,SwitchSelectorSize as l}from"../SwitchSelector/index.mjs";import{usePersistedStore as u}from"../../hooks/usePersistedStore.mjs";import{DropDown as d}from"../DropDown/index.mjs";import{useLocaleSwitcherContent as f}from"./LocaleSwitcherContentContext.mjs";import{useMemo as p,useRef as m,useState as h}from"react";import{Check as g,Globe as _,MoveVertical as v}from"lucide-react";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";import{useIntlayer as S,useLocale as C}from"react-intlayer";import{getHTMLTextDir as w,getLocaleName as T}from"@intlayer/core/localization";import{ENGLISH as E}from"@intlayer/types/locales";import D from"fuse.js";const O=`locale-switcher-content`,k=({panelProps:k,isMultilingual:A=!0})=>{let{switchTo:j,searchInput:M,localeSwitcherLabel:N,languageListLabel:P,seeAllLocalesSwitch:F}=S(`locale-switcher-content`),I=m(null),{locale:L}=C(),{availableLocales:R,selectedLocales:z,setSelectedLocales:B}=f(),V=p(()=>R.map(e=>({locale:e,englishName:T(e,E),currentLocaleName:T(e,L),ownLocaleName:T(e)})),[R,L]),[H,U]=h(``),[W,G]=u(`locale-content-selector-see-all-locales`,!1),K=p(()=>new D(V,{keys:[{name:`ownLocaleName`,weight:.4},{name:`englishName`,weight:.2},{name:`currentLocaleName`,weight:.2},{name:`locale`,weight:.2}],threshold:.02}),[V]),q=p(()=>H?K.search(H).map(e=>e.item):V,[H,V,K]),J=e=>{A?z.includes(e)?z.length>1&&B(t=>t.filter(t=>t!==e)):B(t=>[...t,e]):B([e])},Y=e=>{G(e),B(e?R:[L])};return b(`div`,{className:`rounded-xl border border-text text-text transition-colors`,children:x(d,{identifier:O,children:[b(d.Trigger,{identifier:O,label:N.value,className:`p-0!`,roundedSize:`3xl`,color:`text`,children:x(`div`,{className:`flex w-full items-center justify-between text-text`,children:[b(`div`,{className:`px-2 py-1`,children:b(_,{size:16})}),b(v,{className:`self-center`,size:16})]})}),b(d.Panel,{identifier:O,isOverable:!0,isFocusable:!0,align:`end`,...k,children:x(e,{className:`max-h-[60vh] min-w-28`,separator:`y`,role:`listbox`,transparency:`xs`,border:!0,roundedSize:`3xl`,borderColor:`text`,"aria-label":P.value,children:[A&&b(`div`,{className:`m-auto p-2`,children:b(s,{defaultValue:W,onChange:Y,color:c.TEXT,size:l.SM,className:`!w-60`,choices:[{content:F.true.value,value:!0},{content:F.false.value,value:!1}]})}),!(A&&W)&&x(y,{children:[b(`div`,{className:`p-3`,children:b(o,{type:`search`,"aria-label":M.ariaLabel.value,placeholder:M.placeholder.value,onChange:e=>U(e.target.value),ref:I})}),b(`ol`,{className:`divide-y divide-dashed divide-text/20 overflow-y-auto p-1`,children:q.map(({locale:e,currentLocaleName:o,ownLocaleName:s})=>b(`li`,{className:`px-1.5 py-1`,children:b(t,{onClick:()=>J(e),label:`${j} ${o}`,disabled:!(R??R).includes(e),isActive:z.includes(e),variant:a.HOVERABLE,color:n.TEXT,isFullWidth:!0,textAlign:i.LEFT,size:r.SM,children:x(`div`,{className:`flex flex-row items-center justify-between gap-3 px-2 py-1`,children:[A&&b(`div`,{className:`w-4`,children:z.includes(e)&&b(g,{className:`size-full`})}),x(`div`,{className:`flex flex-1 flex-row items-center justify-between gap-3 px-2 py-1`,children:[x(`div`,{className:`flex flex-col text-nowrap`,children:[b(`span`,{dir:w(e),lang:e,children:s}),b(`span`,{className:`text-neutral text-xs`,children:o})]}),b(`span`,{className:`text-neutral text-sm`,children:e.toUpperCase()})]})]})})},e))})]})]})})]})})};export{k as LocaleSwitcherContent};
2
2
  //# sourceMappingURL=LocaleSwitcherContent.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocaleSwitcherContent.mjs","names":[],"sources":["../../../../src/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.tsx"],"sourcesContent":["'use client';\n\nimport { usePersistedStore } from '@hooks/usePersistedStore';\nimport { getHTMLTextDir, getLocaleName } from '@intlayer/core/localization';\nimport * as Locales from '@intlayer/types/locales';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport Fuse, { type IFuseOptions } from 'fuse.js';\nimport { Check, Globe, MoveVertical } from 'lucide-react';\nimport { type FC, useMemo, useRef, useState } from 'react';\nimport { useIntlayer, useLocale } from 'react-intlayer';\nimport {\n Button,\n ButtonColor,\n ButtonSize,\n ButtonTextAlign,\n ButtonVariant,\n} from '../Button';\nimport { Container } from '../Container';\nimport { DropDown, type PanelProps } from '../DropDown';\nimport { Input } from '../Input';\nimport {\n SwitchSelector,\n SwitchSelectorColor,\n SwitchSelectorSize,\n} from '../SwitchSelector';\nimport { useLocaleSwitcherContent } from './LocaleSwitcherContentContext';\n\nexport type LocaleSwitcherContentProps = {\n panelProps?: Omit<PanelProps, 'identifier'>;\n isMultilingual?: boolean;\n};\n\nconst DROPDOWN_IDENTIFIER = 'locale-switcher-content';\n\ntype MultilingualAvailableLocales = {\n locale: LocalesValues;\n englishName: string;\n currentLocaleName: string;\n ownLocaleName: string;\n};\n\nexport const LocaleSwitcherContent: FC<LocaleSwitcherContentProps> = ({\n panelProps,\n isMultilingual = true,\n}) => {\n const {\n switchTo,\n searchInput,\n localeSwitcherLabel,\n languageListLabel,\n seeAllLocalesSwitch,\n } = useIntlayer('locale-switcher-content');\n const inputRef = useRef<HTMLInputElement>(null);\n const { locale } = useLocale();\n const { availableLocales, selectedLocales, setSelectedLocales } =\n useLocaleSwitcherContent();\n\n // 1. Memoize the list construction so it doesn't rebuild every render\n const multilingualAvailableLocales: MultilingualAvailableLocales[] = useMemo(\n () =>\n availableLocales.map((localeEl) => {\n const englishName = getLocaleName(localeEl, Locales.ENGLISH);\n const currentLocaleName = getLocaleName(localeEl, locale);\n const ownLocaleName = getLocaleName(localeEl);\n return {\n locale: localeEl,\n englishName,\n currentLocaleName,\n ownLocaleName,\n };\n }),\n [availableLocales, locale]\n );\n\n // 2. State for Search Query only (Source of Truth)\n const [searchQuery, setSearchQuery] = useState('');\n\n const [seeAllLocales, setSeeAllLocales] = usePersistedStore(\n 'locale-content-selector-see-all-locales',\n false\n );\n\n // 3. Memoize Fuse instance\n const fuse = useMemo(() => {\n const fuseOptions: IFuseOptions<MultilingualAvailableLocales> = {\n keys: [\n { name: 'ownLocaleName', weight: 0.4 },\n { name: 'englishName', weight: 0.2 },\n { name: 'currentLocaleName', weight: 0.2 },\n { name: 'locale', weight: 0.2 },\n ],\n threshold: 0.02,\n };\n return new Fuse(multilingualAvailableLocales, fuseOptions);\n }, [multilingualAvailableLocales]);\n\n // 4. Derive results from Search Query\n const results = useMemo(() => {\n if (!searchQuery) {\n return multilingualAvailableLocales;\n }\n return fuse.search(searchQuery).map((result) => result.item);\n }, [searchQuery, multilingualAvailableLocales, fuse]);\n\n const handleClickLocale = (localeItem: LocalesValues) => {\n if (isMultilingual) {\n if (selectedLocales.includes(localeItem)) {\n if (selectedLocales.length > 1) {\n setSelectedLocales((prev) => prev.filter((el) => el !== localeItem));\n }\n } else {\n setSelectedLocales((prev) => [...prev, localeItem]);\n }\n } else {\n setSelectedLocales([localeItem]);\n }\n };\n\n const handleSeeAllLocales = (value: boolean) => {\n setSeeAllLocales(value);\n\n if (value) {\n setSelectedLocales(availableLocales);\n } else {\n setSelectedLocales([locale]);\n }\n };\n\n return (\n <div className=\"rounded-xl border border-text text-text transition-colors\">\n <DropDown identifier={DROPDOWN_IDENTIFIER}>\n <DropDown.Trigger\n identifier={DROPDOWN_IDENTIFIER}\n label={localeSwitcherLabel.value}\n className=\"p-0!\"\n roundedSize=\"3xl\"\n color=\"text\"\n >\n <div className=\"flex w-full items-center justify-between text-text\">\n <div className=\"px-2 py-1\">\n <Globe size={16} />\n </div>\n <MoveVertical className=\"self-center\" size={16} />\n </div>\n </DropDown.Trigger>\n\n <DropDown.Panel\n identifier={DROPDOWN_IDENTIFIER}\n isOverable\n isFocusable\n align=\"end\"\n {...panelProps}\n >\n <Container\n className=\"max-h-[60vh] min-w-28\"\n separator=\"y\"\n role=\"listbox\"\n transparency=\"xs\"\n border\n roundedSize=\"3xl\"\n borderColor=\"text\"\n aria-label={languageListLabel.value}\n >\n {isMultilingual && (\n <div className=\"m-auto p-2\">\n <SwitchSelector\n defaultValue={seeAllLocales} // Ensure this uses the persisted state\n onChange={handleSeeAllLocales}\n color={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n className=\"!w-60\"\n choices={[\n {\n content: seeAllLocalesSwitch.true.value,\n value: true,\n },\n {\n content: seeAllLocalesSwitch.false.value,\n value: false,\n },\n ]}\n />\n </div>\n )}\n\n {!(isMultilingual && seeAllLocales) && (\n <>\n <div className=\"p-3\">\n <Input\n type=\"search\"\n aria-label={searchInput.ariaLabel.value}\n placeholder={searchInput.placeholder.value}\n // Update search query state directly\n onChange={(e) => setSearchQuery(e.target.value)}\n ref={inputRef}\n />\n </div>\n <ol className=\"divide-y divide-dashed divide-text/20 overflow-y-auto p-1\">\n {results.map(\n ({\n locale: localeItem,\n currentLocaleName,\n ownLocaleName,\n }) => (\n <li className=\"px-1.5 py-1\" key={localeItem}>\n <Button\n onClick={() => handleClickLocale(localeItem)}\n label={`${switchTo} ${currentLocaleName}`}\n disabled={\n !(availableLocales ?? availableLocales).includes(\n localeItem\n )\n }\n isActive={selectedLocales.includes(localeItem)}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n isFullWidth\n textAlign={ButtonTextAlign.LEFT}\n size={ButtonSize.SM}\n >\n <div className=\"flex flex-row items-center justify-between gap-3 px-2 py-1\">\n {isMultilingual && (\n <div className=\"w-4\">\n {selectedLocales.includes(localeItem) && (\n <Check className=\"size-full\" />\n )}\n </div>\n )}\n <div className=\"flex flex-1 flex-row items-center justify-between gap-3 px-2 py-1\">\n <div className=\"flex flex-col text-nowrap\">\n <span\n dir={getHTMLTextDir(localeItem)}\n lang={localeItem}\n >\n {ownLocaleName}\n </span>\n <span className=\"text-neutral text-xs\">\n {currentLocaleName}\n </span>\n </div>\n <span className=\"text-neutral text-sm\">\n {localeItem.toUpperCase()}\n </span>\n </div>\n </div>\n </Button>\n </li>\n )\n )}\n </ol>\n </>\n )}\n </Container>\n </DropDown.Panel>\n </DropDown>\n </div>\n );\n};\n"],"mappings":"85BAgCA,MAAM,EAAsB,0BASf,GAAyD,CACpE,aACA,iBAAiB,MACb,CACJ,GAAM,CACJ,WACA,cACA,sBACA,oBACA,uBACE,EAAY,0BAA0B,CACpC,EAAW,EAAyB,KAAK,CACzC,CAAE,UAAW,GAAW,CACxB,CAAE,mBAAkB,kBAAiB,sBACzC,GAA0B,CAGtB,EAA+D,MAEjE,EAAiB,IAAK,IAIb,CACL,OAAQ,EACR,YALkB,EAAc,EAAU,EAAQ,QAAQ,CAM1D,kBALwB,EAAc,EAAU,EAAO,CAMvD,cALoB,EAAc,EAAS,CAM5C,EACD,CACJ,CAAC,EAAkB,EAAO,CAC3B,CAGK,CAAC,EAAa,GAAkB,EAAS,GAAG,CAE5C,CAAC,EAAe,GAAoB,EACxC,0CACA,GACD,CAGK,EAAO,MAUJ,IAAI,EAAK,EATgD,CAC9D,KAAM,CACJ,CAAE,KAAM,gBAAiB,OAAQ,GAAK,CACtC,CAAE,KAAM,cAAe,OAAQ,GAAK,CACpC,CAAE,KAAM,oBAAqB,OAAQ,GAAK,CAC1C,CAAE,KAAM,SAAU,OAAQ,GAAK,CAChC,CACD,UAAW,IACZ,CACyD,CACzD,CAAC,EAA6B,CAAC,CAG5B,EAAU,MACT,EAGE,EAAK,OAAO,EAAY,CAAC,IAAK,GAAW,EAAO,KAAK,CAFnD,EAGR,CAAC,EAAa,EAA8B,EAAK,CAAC,CAE/C,EAAqB,GAA8B,CACnD,EACE,EAAgB,SAAS,EAAW,CAClC,EAAgB,OAAS,GAC3B,EAAoB,GAAS,EAAK,OAAQ,GAAO,IAAO,EAAW,CAAC,CAGtE,EAAoB,GAAS,CAAC,GAAG,EAAM,EAAW,CAAC,CAGrD,EAAmB,CAAC,EAAW,CAAC,EAI9B,EAAuB,GAAmB,CAC9C,EAAiB,EAAM,CAGrB,EADE,EACiB,EAEA,CAAC,EAAO,CAAC,EAIhC,OACE,EAAC,MAAD,CAAK,UAAU,qEACb,EAAC,EAAD,CAAU,WAAY,WAAtB,CACE,EAAC,EAAS,QAAV,CACE,WAAY,EACZ,MAAO,EAAoB,MAC3B,UAAU,OACV,YAAY,MACZ,MAAM,gBAEN,EAAC,MAAD,CAAK,UAAU,8DAAf,CACE,EAAC,MAAD,CAAK,UAAU,qBACb,EAAC,EAAD,CAAO,KAAM,GAAM,CAAA,CACf,CAAA,CACN,EAAC,EAAD,CAAc,UAAU,cAAc,KAAM,GAAM,CAAA,CAC9C,GACW,CAAA,CAEnB,EAAC,EAAS,MAAV,CACE,WAAY,EACZ,WAAA,GACA,YAAA,GACA,MAAM,MACN,GAAI,WAEJ,EAAC,EAAD,CACE,UAAU,wBACV,UAAU,IACV,KAAK,UACL,aAAa,KACb,OAAA,GACA,YAAY,MACZ,YAAY,OACZ,aAAY,EAAkB,eARhC,CAUG,GACC,EAAC,MAAD,CAAK,UAAU,sBACb,EAAC,EAAD,CACE,aAAc,EACd,SAAU,EACV,MAAO,EAAoB,KAC3B,KAAM,EAAmB,GACzB,UAAU,QACV,QAAS,CACP,CACE,QAAS,EAAoB,KAAK,MAClC,MAAO,GACR,CACD,CACE,QAAS,EAAoB,MAAM,MACnC,MAAO,GACR,CACF,CACD,CAAA,CACE,CAAA,CAGP,EAAE,GAAkB,IACnB,EAAA,EAAA,CAAA,SAAA,CACE,EAAC,MAAD,CAAK,UAAU,eACb,EAAC,EAAD,CACE,KAAK,SACL,aAAY,EAAY,UAAU,MAClC,YAAa,EAAY,YAAY,MAErC,SAAW,GAAM,EAAe,EAAE,OAAO,MAAM,CAC/C,IAAK,EACL,CAAA,CACE,CAAA,CACN,EAAC,KAAD,CAAI,UAAU,qEACX,EAAQ,KACN,CACC,OAAQ,EACR,oBACA,mBAEA,EAAC,KAAD,CAAI,UAAU,uBACZ,EAAC,EAAD,CACE,YAAe,EAAkB,EAAW,CAC5C,MAAO,GAAG,EAAS,GAAG,IACtB,SACE,EAAE,GAAoB,GAAkB,SACtC,EACD,CAEH,SAAU,EAAgB,SAAS,EAAW,CAC9C,QAAS,EAAc,UACvB,MAAO,EAAY,KACnB,YAAA,GACA,UAAW,EAAgB,KAC3B,KAAM,EAAW,YAEjB,EAAC,MAAD,CAAK,UAAU,sEAAf,CACG,GACC,EAAC,MAAD,CAAK,UAAU,eACZ,EAAgB,SAAS,EAAW,EACnC,EAAC,EAAD,CAAO,UAAU,YAAc,CAAA,CAE7B,CAAA,CAER,EAAC,MAAD,CAAK,UAAU,6EAAf,CACE,EAAC,MAAD,CAAK,UAAU,qCAAf,CACE,EAAC,OAAD,CACE,IAAK,EAAe,EAAW,CAC/B,KAAM,WAEL,EACI,CAAA,CACP,EAAC,OAAD,CAAM,UAAU,gCACb,EACI,CAAA,CACH,GACN,EAAC,OAAD,CAAM,UAAU,gCACb,EAAW,aAAa,CACpB,CAAA,CACH,GACF,GACC,CAAA,CACN,CA1C4B,EA0C5B,CAER,CACE,CAAA,CACJ,CAAA,CAAA,CAEK,GACG,CAAA,CACR,GACP,CAAA"}
1
+ {"version":3,"file":"LocaleSwitcherContent.mjs","names":[],"sources":["../../../../src/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.tsx"],"sourcesContent":["'use client';\n\nimport { usePersistedStore } from '@hooks/usePersistedStore';\nimport { getHTMLTextDir, getLocaleName } from '@intlayer/core/localization';\nimport { ENGLISH } from '@intlayer/types/locales';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport Fuse, { type IFuseOptions } from 'fuse.js';\nimport { Check, Globe, MoveVertical } from 'lucide-react';\nimport { type FC, useMemo, useRef, useState } from 'react';\nimport { useIntlayer, useLocale } from 'react-intlayer';\nimport {\n Button,\n ButtonColor,\n ButtonSize,\n ButtonTextAlign,\n ButtonVariant,\n} from '../Button';\nimport { Container } from '../Container';\nimport { DropDown, type PanelProps } from '../DropDown';\nimport { Input } from '../Input';\nimport {\n SwitchSelector,\n SwitchSelectorColor,\n SwitchSelectorSize,\n} from '../SwitchSelector';\nimport { useLocaleSwitcherContent } from './LocaleSwitcherContentContext';\n\nexport type LocaleSwitcherContentProps = {\n panelProps?: Omit<PanelProps, 'identifier'>;\n isMultilingual?: boolean;\n};\n\nconst DROPDOWN_IDENTIFIER = 'locale-switcher-content';\n\ntype MultilingualAvailableLocales = {\n locale: LocalesValues;\n englishName: string;\n currentLocaleName: string;\n ownLocaleName: string;\n};\n\nexport const LocaleSwitcherContent: FC<LocaleSwitcherContentProps> = ({\n panelProps,\n isMultilingual = true,\n}) => {\n const {\n switchTo,\n searchInput,\n localeSwitcherLabel,\n languageListLabel,\n seeAllLocalesSwitch,\n } = useIntlayer('locale-switcher-content');\n const inputRef = useRef<HTMLInputElement>(null);\n const { locale } = useLocale();\n const { availableLocales, selectedLocales, setSelectedLocales } =\n useLocaleSwitcherContent();\n\n // 1. Memoize the list construction so it doesn't rebuild every render\n const multilingualAvailableLocales: MultilingualAvailableLocales[] = useMemo(\n () =>\n availableLocales.map((localeEl) => {\n const englishName = getLocaleName(localeEl, ENGLISH);\n const currentLocaleName = getLocaleName(localeEl, locale);\n const ownLocaleName = getLocaleName(localeEl);\n return {\n locale: localeEl,\n englishName,\n currentLocaleName,\n ownLocaleName,\n };\n }),\n [availableLocales, locale]\n );\n\n // 2. State for Search Query only (Source of Truth)\n const [searchQuery, setSearchQuery] = useState('');\n\n const [seeAllLocales, setSeeAllLocales] = usePersistedStore(\n 'locale-content-selector-see-all-locales',\n false\n );\n\n // 3. Memoize Fuse instance\n const fuse = useMemo(() => {\n const fuseOptions: IFuseOptions<MultilingualAvailableLocales> = {\n keys: [\n { name: 'ownLocaleName', weight: 0.4 },\n { name: 'englishName', weight: 0.2 },\n { name: 'currentLocaleName', weight: 0.2 },\n { name: 'locale', weight: 0.2 },\n ],\n threshold: 0.02,\n };\n return new Fuse(multilingualAvailableLocales, fuseOptions);\n }, [multilingualAvailableLocales]);\n\n // 4. Derive results from Search Query\n const results = useMemo(() => {\n if (!searchQuery) {\n return multilingualAvailableLocales;\n }\n return fuse.search(searchQuery).map((result) => result.item);\n }, [searchQuery, multilingualAvailableLocales, fuse]);\n\n const handleClickLocale = (localeItem: LocalesValues) => {\n if (isMultilingual) {\n if (selectedLocales.includes(localeItem)) {\n if (selectedLocales.length > 1) {\n setSelectedLocales((prev) => prev.filter((el) => el !== localeItem));\n }\n } else {\n setSelectedLocales((prev) => [...prev, localeItem]);\n }\n } else {\n setSelectedLocales([localeItem]);\n }\n };\n\n const handleSeeAllLocales = (value: boolean) => {\n setSeeAllLocales(value);\n\n if (value) {\n setSelectedLocales(availableLocales);\n } else {\n setSelectedLocales([locale]);\n }\n };\n\n return (\n <div className=\"rounded-xl border border-text text-text transition-colors\">\n <DropDown identifier={DROPDOWN_IDENTIFIER}>\n <DropDown.Trigger\n identifier={DROPDOWN_IDENTIFIER}\n label={localeSwitcherLabel.value}\n className=\"p-0!\"\n roundedSize=\"3xl\"\n color=\"text\"\n >\n <div className=\"flex w-full items-center justify-between text-text\">\n <div className=\"px-2 py-1\">\n <Globe size={16} />\n </div>\n <MoveVertical className=\"self-center\" size={16} />\n </div>\n </DropDown.Trigger>\n\n <DropDown.Panel\n identifier={DROPDOWN_IDENTIFIER}\n isOverable\n isFocusable\n align=\"end\"\n {...panelProps}\n >\n <Container\n className=\"max-h-[60vh] min-w-28\"\n separator=\"y\"\n role=\"listbox\"\n transparency=\"xs\"\n border\n roundedSize=\"3xl\"\n borderColor=\"text\"\n aria-label={languageListLabel.value}\n >\n {isMultilingual && (\n <div className=\"m-auto p-2\">\n <SwitchSelector\n defaultValue={seeAllLocales} // Ensure this uses the persisted state\n onChange={handleSeeAllLocales}\n color={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n className=\"!w-60\"\n choices={[\n {\n content: seeAllLocalesSwitch.true.value,\n value: true,\n },\n {\n content: seeAllLocalesSwitch.false.value,\n value: false,\n },\n ]}\n />\n </div>\n )}\n\n {!(isMultilingual && seeAllLocales) && (\n <>\n <div className=\"p-3\">\n <Input\n type=\"search\"\n aria-label={searchInput.ariaLabel.value}\n placeholder={searchInput.placeholder.value}\n // Update search query state directly\n onChange={(e) => setSearchQuery(e.target.value)}\n ref={inputRef}\n />\n </div>\n <ol className=\"divide-y divide-dashed divide-text/20 overflow-y-auto p-1\">\n {results.map(\n ({\n locale: localeItem,\n currentLocaleName,\n ownLocaleName,\n }) => (\n <li className=\"px-1.5 py-1\" key={localeItem}>\n <Button\n onClick={() => handleClickLocale(localeItem)}\n label={`${switchTo} ${currentLocaleName}`}\n disabled={\n !(availableLocales ?? availableLocales).includes(\n localeItem\n )\n }\n isActive={selectedLocales.includes(localeItem)}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n isFullWidth\n textAlign={ButtonTextAlign.LEFT}\n size={ButtonSize.SM}\n >\n <div className=\"flex flex-row items-center justify-between gap-3 px-2 py-1\">\n {isMultilingual && (\n <div className=\"w-4\">\n {selectedLocales.includes(localeItem) && (\n <Check className=\"size-full\" />\n )}\n </div>\n )}\n <div className=\"flex flex-1 flex-row items-center justify-between gap-3 px-2 py-1\">\n <div className=\"flex flex-col text-nowrap\">\n <span\n dir={getHTMLTextDir(localeItem)}\n lang={localeItem}\n >\n {ownLocaleName}\n </span>\n <span className=\"text-neutral text-xs\">\n {currentLocaleName}\n </span>\n </div>\n <span className=\"text-neutral text-sm\">\n {localeItem.toUpperCase()}\n </span>\n </div>\n </div>\n </Button>\n </li>\n )\n )}\n </ol>\n </>\n )}\n </Container>\n </DropDown.Panel>\n </DropDown>\n </div>\n );\n};\n"],"mappings":"s6BAgCA,MAAM,EAAsB,0BASf,GAAyD,CACpE,aACA,iBAAiB,MACb,CACJ,GAAM,CACJ,WACA,cACA,sBACA,oBACA,uBACE,EAAY,0BAA0B,CACpC,EAAW,EAAyB,KAAK,CACzC,CAAE,UAAW,GAAW,CACxB,CAAE,mBAAkB,kBAAiB,sBACzC,GAA0B,CAGtB,EAA+D,MAEjE,EAAiB,IAAK,IAIb,CACL,OAAQ,EACR,YALkB,EAAc,EAAU,EAAQ,CAMlD,kBALwB,EAAc,EAAU,EAAO,CAMvD,cALoB,EAAc,EAAS,CAM5C,EACD,CACJ,CAAC,EAAkB,EAAO,CAC3B,CAGK,CAAC,EAAa,GAAkB,EAAS,GAAG,CAE5C,CAAC,EAAe,GAAoB,EACxC,0CACA,GACD,CAGK,EAAO,MAUJ,IAAI,EAAK,EATgD,CAC9D,KAAM,CACJ,CAAE,KAAM,gBAAiB,OAAQ,GAAK,CACtC,CAAE,KAAM,cAAe,OAAQ,GAAK,CACpC,CAAE,KAAM,oBAAqB,OAAQ,GAAK,CAC1C,CAAE,KAAM,SAAU,OAAQ,GAAK,CAChC,CACD,UAAW,IACZ,CACyD,CACzD,CAAC,EAA6B,CAAC,CAG5B,EAAU,MACT,EAGE,EAAK,OAAO,EAAY,CAAC,IAAK,GAAW,EAAO,KAAK,CAFnD,EAGR,CAAC,EAAa,EAA8B,EAAK,CAAC,CAE/C,EAAqB,GAA8B,CACnD,EACE,EAAgB,SAAS,EAAW,CAClC,EAAgB,OAAS,GAC3B,EAAoB,GAAS,EAAK,OAAQ,GAAO,IAAO,EAAW,CAAC,CAGtE,EAAoB,GAAS,CAAC,GAAG,EAAM,EAAW,CAAC,CAGrD,EAAmB,CAAC,EAAW,CAAC,EAI9B,EAAuB,GAAmB,CAC9C,EAAiB,EAAM,CAGrB,EADE,EACiB,EAEA,CAAC,EAAO,CAAC,EAIhC,OACE,EAAC,MAAD,CAAK,UAAU,qEACb,EAAC,EAAD,CAAU,WAAY,WAAtB,CACE,EAAC,EAAS,QAAV,CACE,WAAY,EACZ,MAAO,EAAoB,MAC3B,UAAU,OACV,YAAY,MACZ,MAAM,gBAEN,EAAC,MAAD,CAAK,UAAU,8DAAf,CACE,EAAC,MAAD,CAAK,UAAU,qBACb,EAAC,EAAD,CAAO,KAAM,GAAM,CAAA,CACf,CAAA,CACN,EAAC,EAAD,CAAc,UAAU,cAAc,KAAM,GAAM,CAAA,CAC9C,GACW,CAAA,CAEnB,EAAC,EAAS,MAAV,CACE,WAAY,EACZ,WAAA,GACA,YAAA,GACA,MAAM,MACN,GAAI,WAEJ,EAAC,EAAD,CACE,UAAU,wBACV,UAAU,IACV,KAAK,UACL,aAAa,KACb,OAAA,GACA,YAAY,MACZ,YAAY,OACZ,aAAY,EAAkB,eARhC,CAUG,GACC,EAAC,MAAD,CAAK,UAAU,sBACb,EAAC,EAAD,CACE,aAAc,EACd,SAAU,EACV,MAAO,EAAoB,KAC3B,KAAM,EAAmB,GACzB,UAAU,QACV,QAAS,CACP,CACE,QAAS,EAAoB,KAAK,MAClC,MAAO,GACR,CACD,CACE,QAAS,EAAoB,MAAM,MACnC,MAAO,GACR,CACF,CACD,CAAA,CACE,CAAA,CAGP,EAAE,GAAkB,IACnB,EAAA,EAAA,CAAA,SAAA,CACE,EAAC,MAAD,CAAK,UAAU,eACb,EAAC,EAAD,CACE,KAAK,SACL,aAAY,EAAY,UAAU,MAClC,YAAa,EAAY,YAAY,MAErC,SAAW,GAAM,EAAe,EAAE,OAAO,MAAM,CAC/C,IAAK,EACL,CAAA,CACE,CAAA,CACN,EAAC,KAAD,CAAI,UAAU,qEACX,EAAQ,KACN,CACC,OAAQ,EACR,oBACA,mBAEA,EAAC,KAAD,CAAI,UAAU,uBACZ,EAAC,EAAD,CACE,YAAe,EAAkB,EAAW,CAC5C,MAAO,GAAG,EAAS,GAAG,IACtB,SACE,EAAE,GAAoB,GAAkB,SACtC,EACD,CAEH,SAAU,EAAgB,SAAS,EAAW,CAC9C,QAAS,EAAc,UACvB,MAAO,EAAY,KACnB,YAAA,GACA,UAAW,EAAgB,KAC3B,KAAM,EAAW,YAEjB,EAAC,MAAD,CAAK,UAAU,sEAAf,CACG,GACC,EAAC,MAAD,CAAK,UAAU,eACZ,EAAgB,SAAS,EAAW,EACnC,EAAC,EAAD,CAAO,UAAU,YAAc,CAAA,CAE7B,CAAA,CAER,EAAC,MAAD,CAAK,UAAU,6EAAf,CACE,EAAC,MAAD,CAAK,UAAU,qCAAf,CACE,EAAC,OAAD,CACE,IAAK,EAAe,EAAW,CAC/B,KAAM,WAEL,EACI,CAAA,CACP,EAAC,OAAD,CAAM,UAAU,gCACb,EACI,CAAA,CACH,GACN,EAAC,OAAD,CAAM,UAAU,gCACb,EAAW,aAAa,CACpB,CAAA,CACH,GACF,GACC,CAAA,CACN,CA1C4B,EA0C5B,CAER,CACE,CAAA,CACJ,CAAA,CAAA,CAEK,GACG,CAAA,CACR,GACP,CAAA"}
@@ -1,2 +1,2 @@
1
- "use client";import{Container as e}from"../Container/index.mjs";import{Button as t,ButtonColor as n,ButtonTextAlign as r,ButtonVariant as i}from"../Button/Button.mjs";import{Input as a}from"../Input/Input.mjs";import{DropDown as o}from"../DropDown/index.mjs";import{useCallback as s,useMemo as c,useRef as l,useState as u}from"react";import{MoveVertical as d}from"lucide-react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{useIntlayer as m}from"react-intlayer";import{getHTMLTextDir as h,getLocaleName as g}from"@intlayer/core/localization";import*as _ from"@intlayer/types/locales";import v from"fuse.js";const y=`locale-switcher`,b=({locale:b,localeList:x,availableLocales:S,fullLocaleName:C=!0,setLocale:w,panelProps:T})=>{let E=`Select a locale`,{switchTo:D,searchInput:O,languageListLabel:k,localeSwitcherLabel:A}=m(`locale-switcher`),j=l(null),M=c(()=>x.map(e=>({locale:e,englishName:g(e,_.ENGLISH),currentLocaleName:g(e,b),ownLocaleName:g(e)})),[x,b]),[N,P]=u(M),F=c(()=>new v(M,{keys:[{name:`ownLocaleName`,weight:.4},{name:`englishName`,weight:.2},{name:`currentLocaleName`,weight:.2},{name:`locale`,weight:.2}],threshold:.02}),[M]),I=s(e=>{P(e?F.search(e).map(e=>e.item):M)},[F,M]);return b&&(E=C?g(b):b.toUpperCase()),f(`nav`,{className:`rounded-xl border border-text`,"aria-label":A.value,children:p(o,{identifier:y,children:[f(o.Trigger,{identifier:y,color:`text`,children:p(`div`,{className:`flex w-full items-center justify-between`,children:[f(`div`,{className:`text-nowrap px-2`,children:E}),f(d,{className:`w-5 self-center`})]})}),f(o.Panel,{identifier:y,isOverable:!0,isFocusable:!0,align:`end`,...T,children:p(e,{className:`max-h-[80vh] min-w-28`,separator:`y`,role:`listbox`,transparency:`xs`,"aria-label":k.value,children:[f(`div`,{className:`p-3`,children:f(a,{type:`search`,"aria-label":O.ariaLabel.value,placeholder:O.placeholder.value,onChange:e=>I(e.target.value),ref:j})}),f(`ol`,{className:`divide-y divide-dashed divide-text/20 overflow-y-auto p-1`,children:N.map(({locale:e,currentLocaleName:a,ownLocaleName:o})=>f(`li`,{className:`px-1.5 py-1`,children:f(t,{onClick:()=>w(e),label:`${D} ${a}`,disabled:!(S??x).includes(e),isActive:b===e,variant:i.HOVERABLE,color:n.TEXT,isFullWidth:!0,textAlign:r.LEFT,children:p(`div`,{className:`flex flex-row items-center justify-between gap-3 px-2 py-1`,children:[p(`div`,{className:`flex flex-col text-nowrap`,children:[f(`span`,{dir:h(e),lang:e,suppressHydrationWarning:!0,children:o}),f(`span`,{className:`text-neutral text-xs`,suppressHydrationWarning:!0,children:a})]}),f(`span`,{className:`text-neutral text-sm`,children:e.toUpperCase()})]})})},e))})]})})]})})};export{b as LocaleSwitcher};
1
+ "use client";import{Container as e}from"../Container/index.mjs";import{Button as t,ButtonColor as n,ButtonTextAlign as r,ButtonVariant as i}from"../Button/Button.mjs";import{Input as a}from"../Input/Input.mjs";import{DropDown as o}from"../DropDown/index.mjs";import{useCallback as s,useMemo as c,useRef as l,useState as u}from"react";import{MoveVertical as d}from"lucide-react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{useIntlayer as m}from"react-intlayer";import{getHTMLTextDir as h,getLocaleName as g}from"@intlayer/core/localization";import{ENGLISH as _}from"@intlayer/types/locales";import v from"fuse.js";const y=`locale-switcher`,b=({locale:b,localeList:x,availableLocales:S,fullLocaleName:C=!0,setLocale:w,panelProps:T})=>{let E=`Select a locale`,{switchTo:D,searchInput:O,languageListLabel:k,localeSwitcherLabel:A}=m(`locale-switcher`),j=l(null),M=c(()=>x.map(e=>({locale:e,englishName:g(e,_),currentLocaleName:g(e,b),ownLocaleName:g(e)})),[x,b]),[N,P]=u(M),F=c(()=>new v(M,{keys:[{name:`ownLocaleName`,weight:.4},{name:`englishName`,weight:.2},{name:`currentLocaleName`,weight:.2},{name:`locale`,weight:.2}],threshold:.02}),[M]),I=s(e=>{P(e?F.search(e).map(e=>e.item):M)},[F,M]);return b&&(E=C?g(b):b.toUpperCase()),f(`nav`,{className:`rounded-xl border border-text`,"aria-label":A.value,children:p(o,{identifier:y,children:[f(o.Trigger,{identifier:y,color:`text`,children:p(`div`,{className:`flex w-full items-center justify-between`,children:[f(`div`,{className:`text-nowrap px-2`,children:E}),f(d,{className:`w-5 self-center`})]})}),f(o.Panel,{identifier:y,isOverable:!0,isFocusable:!0,align:`end`,...T,children:p(e,{className:`max-h-[80vh] min-w-28`,separator:`y`,role:`listbox`,transparency:`xs`,"aria-label":k.value,children:[f(`div`,{className:`p-3`,children:f(a,{type:`search`,"aria-label":O.ariaLabel.value,placeholder:O.placeholder.value,onChange:e=>I(e.target.value),ref:j})}),f(`ol`,{className:`divide-y divide-dashed divide-text/20 overflow-y-auto p-1`,children:N.map(({locale:e,currentLocaleName:a,ownLocaleName:o})=>f(`li`,{className:`px-1.5 py-1`,children:f(t,{onClick:()=>w(e),label:`${D} ${a}`,disabled:!(S??x).includes(e),isActive:b===e,variant:i.HOVERABLE,color:n.TEXT,isFullWidth:!0,textAlign:r.LEFT,children:p(`div`,{className:`flex flex-row items-center justify-between gap-3 px-2 py-1`,children:[p(`div`,{className:`flex flex-col text-nowrap`,children:[f(`span`,{dir:h(e),lang:e,suppressHydrationWarning:!0,children:o}),f(`span`,{className:`text-neutral text-xs`,suppressHydrationWarning:!0,children:a})]}),f(`span`,{className:`text-neutral text-sm`,children:e.toUpperCase()})]})})},e))})]})})]})})};export{b as LocaleSwitcher};
2
2
  //# sourceMappingURL=LocaleSwitcher.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocaleSwitcher.mjs","names":[],"sources":["../../../../src/components/LocaleSwitcherDropDown/LocaleSwitcher.tsx"],"sourcesContent":["'use client';\n\nimport { getHTMLTextDir, getLocaleName } from '@intlayer/core/localization';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport * as Locales from '@intlayer/types/locales';\nimport Fuse, { type IFuseOptions } from 'fuse.js';\nimport { MoveVertical } from 'lucide-react';\nimport { type FC, useCallback, useMemo, useRef, useState } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Button, ButtonColor, ButtonTextAlign, ButtonVariant } from '../Button';\nimport { Container } from '../Container';\nimport { DropDown, type PanelProps } from '../DropDown';\nimport { Input } from '../Input';\n\nexport type LocaleSwitcherProps = {\n locale?: Locale;\n localeList: Locale[];\n availableLocales?: Locale[];\n fullLocaleName?: boolean;\n setLocale: (locale: Locale) => void;\n panelProps?: Omit<PanelProps, 'identifier'>;\n};\n\nconst DROPDOWN_IDENTIFIER = 'locale-switcher';\n\ntype MultilingualAvailableLocales = {\n locale: Locale;\n englishName: string;\n currentLocaleName: string;\n ownLocaleName: string;\n};\n\nexport const LocaleSwitcher: FC<LocaleSwitcherProps> = ({\n locale,\n localeList,\n availableLocales,\n fullLocaleName = true,\n setLocale,\n panelProps,\n}) => {\n let localeName = 'Select a locale';\n const { switchTo, searchInput, languageListLabel, localeSwitcherLabel } =\n useIntlayer('locale-switcher');\n const inputRef = useRef<HTMLInputElement>(null);\n\n const multilingualAvailableLocales: MultilingualAvailableLocales[] = useMemo(\n () =>\n localeList.map((localeEl) => {\n const englishName = getLocaleName(localeEl, Locales.ENGLISH);\n const currentLocaleName = getLocaleName(localeEl, locale);\n const ownLocaleName = getLocaleName(localeEl);\n return {\n locale: localeEl,\n englishName,\n currentLocaleName,\n ownLocaleName,\n };\n }),\n [localeList, locale]\n );\n\n const [results, setResults] = useState<MultilingualAvailableLocales[]>(\n multilingualAvailableLocales\n );\n\n // Create a new Fuse instance with the options and documentation data\n const fuse = useMemo(() => {\n const fuseOptions: IFuseOptions<MultilingualAvailableLocales> = {\n keys: [\n { name: 'ownLocaleName', weight: 0.4 },\n { name: 'englishName', weight: 0.2 },\n { name: 'currentLocaleName', weight: 0.2 },\n { name: 'locale', weight: 0.2 },\n ],\n threshold: 0.02, // Defines how fuzzy the matching should be (lower is more strict)\n };\n\n return new Fuse(multilingualAvailableLocales, fuseOptions);\n }, [multilingualAvailableLocales]);\n\n const handleSearch = useCallback(\n (searchQuery: string) => {\n if (searchQuery) {\n // Perform search on every input change\n const searchResults = fuse\n .search(searchQuery)\n .map((result) => result.item);\n setResults(searchResults);\n } else {\n setResults(multilingualAvailableLocales);\n }\n },\n [fuse, multilingualAvailableLocales]\n );\n\n if (locale) {\n localeName = fullLocaleName ? getLocaleName(locale) : locale.toUpperCase();\n }\n\n return (\n <nav\n className=\"rounded-xl border border-text\"\n aria-label={localeSwitcherLabel.value}\n >\n <DropDown identifier={DROPDOWN_IDENTIFIER}>\n <DropDown.Trigger identifier={DROPDOWN_IDENTIFIER} color=\"text\">\n <div className=\"flex w-full items-center justify-between\">\n <div className=\"text-nowrap px-2\">{localeName}</div>\n <MoveVertical className=\"w-5 self-center\" />\n </div>\n </DropDown.Trigger>\n\n <DropDown.Panel\n identifier={DROPDOWN_IDENTIFIER}\n isOverable\n isFocusable\n align=\"end\"\n {...panelProps}\n >\n <Container\n className=\"max-h-[80vh] min-w-28\"\n separator=\"y\"\n role=\"listbox\"\n transparency=\"xs\"\n aria-label={languageListLabel.value}\n >\n <div className=\"p-3\">\n <Input\n type=\"search\"\n aria-label={searchInput.ariaLabel.value}\n placeholder={searchInput.placeholder.value}\n onChange={(e) => handleSearch(e.target.value)}\n ref={inputRef}\n />\n </div>\n <ol className=\"divide-y divide-dashed divide-text/20 overflow-y-auto p-1\">\n {results.map(\n ({ locale: localeItem, currentLocaleName, ownLocaleName }) => (\n <li className=\"px-1.5 py-1\" key={localeItem}>\n <Button\n onClick={() => setLocale(localeItem)}\n label={`${switchTo} ${currentLocaleName}`}\n disabled={\n !(availableLocales ?? localeList).includes(localeItem)\n }\n isActive={locale === localeItem}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n isFullWidth\n textAlign={ButtonTextAlign.LEFT}\n >\n <div className=\"flex flex-row items-center justify-between gap-3 px-2 py-1\">\n <div className=\"flex flex-col text-nowrap\">\n <span\n dir={getHTMLTextDir(localeItem)}\n lang={localeItem}\n suppressHydrationWarning\n >\n {ownLocaleName}\n </span>\n <span\n className=\"text-neutral text-xs\"\n suppressHydrationWarning\n >\n {currentLocaleName}\n </span>\n </div>\n <span className=\"text-neutral text-sm\">\n {localeItem.toUpperCase()}\n </span>\n </div>\n </Button>\n </li>\n )\n )}\n </ol>\n </Container>\n </DropDown.Panel>\n </DropDown>\n </nav>\n );\n};\n"],"mappings":"0mBAuBA,MAAM,EAAsB,kBASf,GAA2C,CACtD,SACA,aACA,mBACA,iBAAiB,GACjB,YACA,gBACI,CACJ,IAAI,EAAa,kBACX,CAAE,WAAU,cAAa,oBAAmB,uBAChD,EAAY,kBAAkB,CAC1B,EAAW,EAAyB,KAAK,CAEzC,EAA+D,MAEjE,EAAW,IAAK,IAIP,CACL,OAAQ,EACR,YALkB,EAAc,EAAU,EAAQ,QAAQ,CAM1D,kBALwB,EAAc,EAAU,EAAO,CAMvD,cALoB,EAAc,EAAS,CAM5C,EACD,CACJ,CAAC,EAAY,EAAO,CACrB,CAEK,CAAC,EAAS,GAAc,EAC5B,EACD,CAGK,EAAO,MAWJ,IAAI,EAAK,EAVgD,CAC9D,KAAM,CACJ,CAAE,KAAM,gBAAiB,OAAQ,GAAK,CACtC,CAAE,KAAM,cAAe,OAAQ,GAAK,CACpC,CAAE,KAAM,oBAAqB,OAAQ,GAAK,CAC1C,CAAE,KAAM,SAAU,OAAQ,GAAK,CAChC,CACD,UAAW,IACZ,CAEyD,CACzD,CAAC,EAA6B,CAAC,CAE5B,EAAe,EAClB,GAAwB,CAMrB,EALE,EAEoB,EACnB,OAAO,EAAY,CACnB,IAAK,GAAW,EAAO,KAAK,CAGpB,EAA6B,EAG5C,CAAC,EAAM,EAA6B,CACrC,CAMD,OAJI,IACF,EAAa,EAAiB,EAAc,EAAO,CAAG,EAAO,aAAa,EAI1E,EAAC,MAAD,CACE,UAAU,gCACV,aAAY,EAAoB,eAEhC,EAAC,EAAD,CAAU,WAAY,WAAtB,CACE,EAAC,EAAS,QAAV,CAAkB,WAAY,EAAqB,MAAM,gBACvD,EAAC,MAAD,CAAK,UAAU,oDAAf,CACE,EAAC,MAAD,CAAK,UAAU,4BAAoB,EAAiB,CAAA,CACpD,EAAC,EAAD,CAAc,UAAU,kBAAoB,CAAA,CACxC,GACW,CAAA,CAEnB,EAAC,EAAS,MAAV,CACE,WAAY,EACZ,WAAA,GACA,YAAA,GACA,MAAM,MACN,GAAI,WAEJ,EAAC,EAAD,CACE,UAAU,wBACV,UAAU,IACV,KAAK,UACL,aAAa,KACb,aAAY,EAAkB,eALhC,CAOE,EAAC,MAAD,CAAK,UAAU,eACb,EAAC,EAAD,CACE,KAAK,SACL,aAAY,EAAY,UAAU,MAClC,YAAa,EAAY,YAAY,MACrC,SAAW,GAAM,EAAa,EAAE,OAAO,MAAM,CAC7C,IAAK,EACL,CAAA,CACE,CAAA,CACN,EAAC,KAAD,CAAI,UAAU,qEACX,EAAQ,KACN,CAAE,OAAQ,EAAY,oBAAmB,mBACxC,EAAC,KAAD,CAAI,UAAU,uBACZ,EAAC,EAAD,CACE,YAAe,EAAU,EAAW,CACpC,MAAO,GAAG,EAAS,GAAG,IACtB,SACE,EAAE,GAAoB,GAAY,SAAS,EAAW,CAExD,SAAU,IAAW,EACrB,QAAS,EAAc,UACvB,MAAO,EAAY,KACnB,YAAA,GACA,UAAW,EAAgB,cAE3B,EAAC,MAAD,CAAK,UAAU,sEAAf,CACE,EAAC,MAAD,CAAK,UAAU,qCAAf,CACE,EAAC,OAAD,CACE,IAAK,EAAe,EAAW,CAC/B,KAAM,EACN,yBAAA,YAEC,EACI,CAAA,CACP,EAAC,OAAD,CACE,UAAU,uBACV,yBAAA,YAEC,EACI,CAAA,CACH,GACN,EAAC,OAAD,CAAM,UAAU,gCACb,EAAW,aAAa,CACpB,CAAA,CACH,GACC,CAAA,CACN,CAlC4B,EAkC5B,CAER,CACE,CAAA,CACK,GACG,CAAA,CACR,GACP,CAAA"}
1
+ {"version":3,"file":"LocaleSwitcher.mjs","names":[],"sources":["../../../../src/components/LocaleSwitcherDropDown/LocaleSwitcher.tsx"],"sourcesContent":["'use client';\n\nimport { getHTMLTextDir, getLocaleName } from '@intlayer/core/localization';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { ENGLISH } from '@intlayer/types/locales';\nimport Fuse, { type IFuseOptions } from 'fuse.js';\nimport { MoveVertical } from 'lucide-react';\nimport { type FC, useCallback, useMemo, useRef, useState } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Button, ButtonColor, ButtonTextAlign, ButtonVariant } from '../Button';\nimport { Container } from '../Container';\nimport { DropDown, type PanelProps } from '../DropDown';\nimport { Input } from '../Input';\n\nexport type LocaleSwitcherProps = {\n locale?: Locale;\n localeList: Locale[];\n availableLocales?: Locale[];\n fullLocaleName?: boolean;\n setLocale: (locale: Locale) => void;\n panelProps?: Omit<PanelProps, 'identifier'>;\n};\n\nconst DROPDOWN_IDENTIFIER = 'locale-switcher';\n\ntype MultilingualAvailableLocales = {\n locale: Locale;\n englishName: string;\n currentLocaleName: string;\n ownLocaleName: string;\n};\n\nexport const LocaleSwitcher: FC<LocaleSwitcherProps> = ({\n locale,\n localeList,\n availableLocales,\n fullLocaleName = true,\n setLocale,\n panelProps,\n}) => {\n let localeName = 'Select a locale';\n const { switchTo, searchInput, languageListLabel, localeSwitcherLabel } =\n useIntlayer('locale-switcher');\n const inputRef = useRef<HTMLInputElement>(null);\n\n const multilingualAvailableLocales: MultilingualAvailableLocales[] = useMemo(\n () =>\n localeList.map((localeEl) => {\n const englishName = getLocaleName(localeEl, ENGLISH);\n const currentLocaleName = getLocaleName(localeEl, locale);\n const ownLocaleName = getLocaleName(localeEl);\n return {\n locale: localeEl,\n englishName,\n currentLocaleName,\n ownLocaleName,\n };\n }),\n [localeList, locale]\n );\n\n const [results, setResults] = useState<MultilingualAvailableLocales[]>(\n multilingualAvailableLocales\n );\n\n // Create a new Fuse instance with the options and documentation data\n const fuse = useMemo(() => {\n const fuseOptions: IFuseOptions<MultilingualAvailableLocales> = {\n keys: [\n { name: 'ownLocaleName', weight: 0.4 },\n { name: 'englishName', weight: 0.2 },\n { name: 'currentLocaleName', weight: 0.2 },\n { name: 'locale', weight: 0.2 },\n ],\n threshold: 0.02, // Defines how fuzzy the matching should be (lower is more strict)\n };\n\n return new Fuse(multilingualAvailableLocales, fuseOptions);\n }, [multilingualAvailableLocales]);\n\n const handleSearch = useCallback(\n (searchQuery: string) => {\n if (searchQuery) {\n // Perform search on every input change\n const searchResults = fuse\n .search(searchQuery)\n .map((result) => result.item);\n setResults(searchResults);\n } else {\n setResults(multilingualAvailableLocales);\n }\n },\n [fuse, multilingualAvailableLocales]\n );\n\n if (locale) {\n localeName = fullLocaleName ? getLocaleName(locale) : locale.toUpperCase();\n }\n\n return (\n <nav\n className=\"rounded-xl border border-text\"\n aria-label={localeSwitcherLabel.value}\n >\n <DropDown identifier={DROPDOWN_IDENTIFIER}>\n <DropDown.Trigger identifier={DROPDOWN_IDENTIFIER} color=\"text\">\n <div className=\"flex w-full items-center justify-between\">\n <div className=\"text-nowrap px-2\">{localeName}</div>\n <MoveVertical className=\"w-5 self-center\" />\n </div>\n </DropDown.Trigger>\n\n <DropDown.Panel\n identifier={DROPDOWN_IDENTIFIER}\n isOverable\n isFocusable\n align=\"end\"\n {...panelProps}\n >\n <Container\n className=\"max-h-[80vh] min-w-28\"\n separator=\"y\"\n role=\"listbox\"\n transparency=\"xs\"\n aria-label={languageListLabel.value}\n >\n <div className=\"p-3\">\n <Input\n type=\"search\"\n aria-label={searchInput.ariaLabel.value}\n placeholder={searchInput.placeholder.value}\n onChange={(e) => handleSearch(e.target.value)}\n ref={inputRef}\n />\n </div>\n <ol className=\"divide-y divide-dashed divide-text/20 overflow-y-auto p-1\">\n {results.map(\n ({ locale: localeItem, currentLocaleName, ownLocaleName }) => (\n <li className=\"px-1.5 py-1\" key={localeItem}>\n <Button\n onClick={() => setLocale(localeItem)}\n label={`${switchTo} ${currentLocaleName}`}\n disabled={\n !(availableLocales ?? localeList).includes(localeItem)\n }\n isActive={locale === localeItem}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n isFullWidth\n textAlign={ButtonTextAlign.LEFT}\n >\n <div className=\"flex flex-row items-center justify-between gap-3 px-2 py-1\">\n <div className=\"flex flex-col text-nowrap\">\n <span\n dir={getHTMLTextDir(localeItem)}\n lang={localeItem}\n suppressHydrationWarning\n >\n {ownLocaleName}\n </span>\n <span\n className=\"text-neutral text-xs\"\n suppressHydrationWarning\n >\n {currentLocaleName}\n </span>\n </div>\n <span className=\"text-neutral text-sm\">\n {localeItem.toUpperCase()}\n </span>\n </div>\n </Button>\n </li>\n )\n )}\n </ol>\n </Container>\n </DropDown.Panel>\n </DropDown>\n </nav>\n );\n};\n"],"mappings":"knBAuBA,MAAM,EAAsB,kBASf,GAA2C,CACtD,SACA,aACA,mBACA,iBAAiB,GACjB,YACA,gBACI,CACJ,IAAI,EAAa,kBACX,CAAE,WAAU,cAAa,oBAAmB,uBAChD,EAAY,kBAAkB,CAC1B,EAAW,EAAyB,KAAK,CAEzC,EAA+D,MAEjE,EAAW,IAAK,IAIP,CACL,OAAQ,EACR,YALkB,EAAc,EAAU,EAAQ,CAMlD,kBALwB,EAAc,EAAU,EAAO,CAMvD,cALoB,EAAc,EAAS,CAM5C,EACD,CACJ,CAAC,EAAY,EAAO,CACrB,CAEK,CAAC,EAAS,GAAc,EAC5B,EACD,CAGK,EAAO,MAWJ,IAAI,EAAK,EAVgD,CAC9D,KAAM,CACJ,CAAE,KAAM,gBAAiB,OAAQ,GAAK,CACtC,CAAE,KAAM,cAAe,OAAQ,GAAK,CACpC,CAAE,KAAM,oBAAqB,OAAQ,GAAK,CAC1C,CAAE,KAAM,SAAU,OAAQ,GAAK,CAChC,CACD,UAAW,IACZ,CAEyD,CACzD,CAAC,EAA6B,CAAC,CAE5B,EAAe,EAClB,GAAwB,CAMrB,EALE,EAEoB,EACnB,OAAO,EAAY,CACnB,IAAK,GAAW,EAAO,KAAK,CAGpB,EAA6B,EAG5C,CAAC,EAAM,EAA6B,CACrC,CAMD,OAJI,IACF,EAAa,EAAiB,EAAc,EAAO,CAAG,EAAO,aAAa,EAI1E,EAAC,MAAD,CACE,UAAU,gCACV,aAAY,EAAoB,eAEhC,EAAC,EAAD,CAAU,WAAY,WAAtB,CACE,EAAC,EAAS,QAAV,CAAkB,WAAY,EAAqB,MAAM,gBACvD,EAAC,MAAD,CAAK,UAAU,oDAAf,CACE,EAAC,MAAD,CAAK,UAAU,4BAAoB,EAAiB,CAAA,CACpD,EAAC,EAAD,CAAc,UAAU,kBAAoB,CAAA,CACxC,GACW,CAAA,CAEnB,EAAC,EAAS,MAAV,CACE,WAAY,EACZ,WAAA,GACA,YAAA,GACA,MAAM,MACN,GAAI,WAEJ,EAAC,EAAD,CACE,UAAU,wBACV,UAAU,IACV,KAAK,UACL,aAAa,KACb,aAAY,EAAkB,eALhC,CAOE,EAAC,MAAD,CAAK,UAAU,eACb,EAAC,EAAD,CACE,KAAK,SACL,aAAY,EAAY,UAAU,MAClC,YAAa,EAAY,YAAY,MACrC,SAAW,GAAM,EAAa,EAAE,OAAO,MAAM,CAC7C,IAAK,EACL,CAAA,CACE,CAAA,CACN,EAAC,KAAD,CAAI,UAAU,qEACX,EAAQ,KACN,CAAE,OAAQ,EAAY,oBAAmB,mBACxC,EAAC,KAAD,CAAI,UAAU,uBACZ,EAAC,EAAD,CACE,YAAe,EAAU,EAAW,CACpC,MAAO,GAAG,EAAS,GAAG,IACtB,SACE,EAAE,GAAoB,GAAY,SAAS,EAAW,CAExD,SAAU,IAAW,EACrB,QAAS,EAAc,UACvB,MAAO,EAAY,KACnB,YAAA,GACA,UAAW,EAAgB,cAE3B,EAAC,MAAD,CAAK,UAAU,sEAAf,CACE,EAAC,MAAD,CAAK,UAAU,qCAAf,CACE,EAAC,OAAD,CACE,IAAK,EAAe,EAAW,CAC/B,KAAM,EACN,yBAAA,YAEC,EACI,CAAA,CACP,EAAC,OAAD,CACE,UAAU,uBACV,yBAAA,YAEC,EACI,CAAA,CACH,GACN,EAAC,OAAD,CAAM,UAAU,gCACb,EAAW,aAAa,CACpB,CAAA,CACH,GACC,CAAA,CACN,CAlC4B,EAkC5B,CAER,CACE,CAAA,CACK,GACG,CAAA,CACR,GACP,CAAA"}
@@ -1,2 +1,2 @@
1
- "use client";import{cn as e}from"../../utils/cn.mjs";import{useGetElementOrWindow as t}from"../../hooks/useGetElementOrWindow.mjs";import{useScrollBlockage as n}from"../../hooks/useScrollBlockage/index.mjs";import{Container as r}from"../Container/index.mjs";import{Button as i,ButtonColor as a,ButtonSize as o,ButtonVariant as s}from"../Button/Button.mjs";import{H3 as c}from"../Headers/index.mjs";import{useEffect as l}from"react";import{cva as u}from"class-variance-authority";import{X as d}from"lucide-react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{motion as h}from"framer-motion";import{createPortal as g}from"react-dom";let _=function(e){return e.SM=`sm`,e.MD=`md`,e.LG=`lg`,e.XL=`xl`,e.UNSET=`unset`,e}({});const v=u(`flex cursor-default flex-col overflow-hidden shadow-sm`,{variants:{size:{sm:`h-auto max-h-[30vh] w-[95vw] max-w-xl`,md:`h-auto max-h-[50vh] w-[95vw] max-w-xl`,lg:`h-auto max-h-[70vh] w-[95vw] max-w-4xl`,xl:`h-auto max-h-[95vh] w-[95vw] max-w-6xl`,unset:`h-auto max-h-[95vh] w-[95vw]`}},defaultVariants:{size:`unset`}}),y={none:`p-0`,sm:`px-2 py-4`,md:`px-4 py-6`,lg:`px-6 py-8`,xl:`px-8 py-10`,"2xl":`px-10 py-12`},b=h.create(r),x=({children:r,isOpen:u,container:x,onClose:S,hasCloseButton:C=!1,title:w,size:T=_.MD,className:E,isScrollable:D=!1,disableScroll:O=!0,padding:k=`none`,...A})=>{let j=t(x);if(n({key:`modal`,disableScroll:u&&O}),l(()=>{let e=e=>{e.key===`Escape`&&u&&S&&S()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[u,S]),!j)return p(f,{});let M=!!w,N=y[k||`none`];return g(p(h.div,{className:`invisible fixed top-0 left-0 z-50 flex size-full cursor-pointer items-center justify-center overflow-hidden bg-background/40 backdrop-blur`,animate:u?`visible`:`invisible`,variants:{visible:{opacity:1,visibility:`visible`,transition:{duration:.1,when:`beforeChildren`}},invisible:{opacity:0,visibility:`hidden`,transition:{duration:.1,when:`afterChildren`}}},onClick:e=>{e.stopPropagation(),S?.()},"aria-hidden":!u,children:m(b,{onClick:e=>e.stopPropagation(),initial:{scale:u?.5:1},animate:{scale:u?1:.5},transition:{duration:.3},className:v({size:T,className:E}),role:`dialog`,"aria-modal":!0,roundedSize:`4xl`,padding:`none`,...A,children:[m(`div`,{className:e(`relative flex-none px-4 pt-4`,C&&M?`flex items-start`:C?`flex justify-end`:M?`items-center`:`hidden`),children:[M&&p(c,{className:`mb-2 ml-1 flex items-center justify-center font-bold text-lg`,children:w}),C&&p(i,{variant:s.HOVERABLE,color:a.TEXT,label:`Close modal`,className:`ml-auto`,onClick:e=>{e.stopPropagation(),S?.()},Icon:d,size:o.ICON_MD})]}),p(`div`,{className:e(`flex min-h-0 w-full flex-1 flex-col`,D===!0&&`overflow-auto`,D===`y`&&`overflow-y-auto overflow-x-hidden`,D===`x`&&`overflow-x-auto overflow-y-hidden`,!D&&`overflow-visible`),children:p(`div`,{className:e(`flex h-full w-full flex-1 flex-col`,N),children:r})})]})}),j)};export{x as Modal,_ as ModalSize};
1
+ "use client";import{cn as e}from"../../utils/cn.mjs";import{Container as t}from"../Container/index.mjs";import{Button as n,ButtonColor as r,ButtonSize as i,ButtonVariant as a}from"../Button/Button.mjs";import{H3 as o}from"../Headers/index.mjs";import{useGetElementOrWindow as s}from"../../hooks/useGetElementOrWindow.mjs";import{useScrollBlockage as c}from"../../hooks/useScrollBlockage/index.mjs";import{useEffect as l}from"react";import{cva as u}from"class-variance-authority";import{X as d}from"lucide-react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{motion as h}from"framer-motion";import{createPortal as g}from"react-dom";let _=function(e){return e.SM=`sm`,e.MD=`md`,e.LG=`lg`,e.XL=`xl`,e.UNSET=`unset`,e}({});const v=u(`flex cursor-default flex-col overflow-hidden shadow-sm`,{variants:{size:{sm:`h-auto max-h-[30vh] w-[95vw] max-w-xl`,md:`h-auto max-h-[50vh] w-[95vw] max-w-xl`,lg:`h-auto max-h-[70vh] w-[95vw] max-w-4xl`,xl:`h-auto max-h-[95vh] w-[95vw] max-w-6xl`,unset:`h-auto max-h-[95vh] w-[95vw]`}},defaultVariants:{size:`unset`}}),y={none:`p-0`,sm:`px-2 py-4`,md:`px-4 py-6`,lg:`px-6 py-8`,xl:`px-8 py-10`,"2xl":`px-10 py-12`},b=h.create(t),x=({children:t,isOpen:u,container:x,onClose:S,hasCloseButton:C=!1,title:w,size:T=_.MD,className:E,isScrollable:D=!1,disableScroll:O=!0,padding:k=`none`,...A})=>{let j=s(x);if(c({key:`modal`,disableScroll:u&&O}),l(()=>{let e=e=>{e.key===`Escape`&&u&&S&&S()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[u,S]),!j)return p(f,{});let M=!!w,N=y[k||`none`];return g(p(h.div,{className:`invisible fixed top-0 left-0 z-50 flex size-full cursor-pointer items-center justify-center overflow-hidden bg-background/40 backdrop-blur`,animate:u?`visible`:`invisible`,variants:{visible:{opacity:1,visibility:`visible`,transition:{duration:.1,when:`beforeChildren`}},invisible:{opacity:0,visibility:`hidden`,transition:{duration:.1,when:`afterChildren`}}},onClick:e=>{e.stopPropagation(),S?.()},"aria-hidden":!u,children:m(b,{onClick:e=>e.stopPropagation(),initial:{scale:u?.5:1},animate:{scale:u?1:.5},transition:{duration:.3},className:v({size:T,className:E}),role:`dialog`,"aria-modal":!0,roundedSize:`4xl`,padding:`none`,...A,children:[m(`div`,{className:e(`relative flex-none px-4 pt-4`,C&&M?`flex items-start`:C?`flex justify-end`:M?`items-center`:`hidden`),children:[M&&p(o,{className:`mb-2 ml-1 flex items-center justify-center font-bold text-lg`,children:w}),C&&p(n,{variant:a.HOVERABLE,color:r.TEXT,label:`Close modal`,className:`ml-auto`,onClick:e=>{e.stopPropagation(),S?.()},Icon:d,size:i.ICON_MD})]}),p(`div`,{className:e(`flex min-h-0 w-full flex-1 flex-col`,D===!0&&`overflow-auto`,D===`y`&&`overflow-y-auto overflow-x-hidden`,D===`x`&&`overflow-x-auto overflow-y-hidden`,!D&&`overflow-visible`),children:p(`div`,{className:e(`flex h-full w-full flex-1 flex-col`,N),children:t})})]})}),j)};export{x as Modal,_ as ModalSize};
2
2
  //# sourceMappingURL=Modal.mjs.map
@@ -1,2 +1,2 @@
1
- "use client";import{cn as e}from"../../utils/cn.mjs";import{useScrollBlockage as t}from"../../hooks/useScrollBlockage/index.mjs";import{useScrollDetection as n}from"../../hooks/useScrollDetection.mjs";import{MaxHeightSmoother as r}from"../MaxHeightSmoother/index.mjs";import{Burger as i}from"./Burger.mjs";import{useRef as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{m as l}from"framer-motion";const u={open:{transition:{staggerChildren:.07,delayChildren:.2}},closed:{transition:{staggerChildren:.05,staggerDirection:-1}}},d=`bg-card/95 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur`,f=({logo:f,topChildren:p,topSections:m=[],bottomChildren:h,bottomSections:g=[],rightItems:_,rollable:v=!0})=>{let[y,b]=o(!1),[x,S]=o(!1),C=a(null);t({disableScroll:v,key:`mobile_nav`}),n({onScrollUp:()=>b(!1),onScrollDown:()=>b(!0),isEnabled:!x&&v});let w=y?0:C.current?.clientHeight??0,T=m.length+g.length>0;return c(`nav`,{className:e(d,`sticky top-0 z-50 flex w-screen flex-col transition`,y?`-translate-y-full`:`translate-y-0`),id:`mobile-menu`,children:[c(`div`,{className:`flex w-full items-center justify-between gap-1 px-4 py-3 md:gap-[10vw]`,ref:C,children:[f,c(`div`,{className:`flex w-full flex-1 items-center justify-end gap-6`,children:[s(`div`,{className:`flex w-full items-center justify-end gap-1`,children:_}),T&&s(i,{isActive:x,onClick:()=>S(e=>!e)})]})]}),s(`div`,{className:e(d,`absolute bottom-0 left-0 w-full translate-y-full`),children:s(r,{isHidden:!x,children:c(l.div,{className:`flex w-full flex-col pt-10 pb-[20%] text-lg text-text tracking-wide`,onClick:()=>S(!1),animate:x?`open`:`closed`,variants:u,style:{height:`calc(100vh - ${w}px)`},children:[p,c(`div`,{className:`flex h-full flex-col justify-center`,children:[m,g]}),s(`div`,{className:`m-auto flex w-full max-w-[400px] items-center justify-center gap-1 px-5 py-3`,children:h})]})})})]})};export{f as MobileNavbar};
1
+ "use client";import{cn as e}from"../../utils/cn.mjs";import{MaxHeightSmoother as t}from"../MaxHeightSmoother/index.mjs";import{useScrollBlockage as n}from"../../hooks/useScrollBlockage/index.mjs";import{useScrollDetection as r}from"../../hooks/useScrollDetection.mjs";import{Burger as i}from"./Burger.mjs";import{useRef as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{m as l}from"framer-motion";const u={open:{transition:{staggerChildren:.07,delayChildren:.2}},closed:{transition:{staggerChildren:.05,staggerDirection:-1}}},d=`bg-card/95 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur`,f=({logo:f,topChildren:p,topSections:m=[],bottomChildren:h,bottomSections:g=[],rightItems:_,rollable:v=!0})=>{let[y,b]=o(!1),[x,S]=o(!1),C=a(null);n({disableScroll:v,key:`mobile_nav`}),r({onScrollUp:()=>b(!1),onScrollDown:()=>b(!0),isEnabled:!x&&v});let w=y?0:C.current?.clientHeight??0,T=m.length+g.length>0;return c(`nav`,{className:e(d,`sticky top-0 z-50 flex w-screen flex-col transition`,y?`-translate-y-full`:`translate-y-0`),id:`mobile-menu`,children:[c(`div`,{className:`flex w-full items-center justify-between gap-1 px-4 py-3 md:gap-[10vw]`,ref:C,children:[f,c(`div`,{className:`flex w-full flex-1 items-center justify-end gap-6`,children:[s(`div`,{className:`flex w-full items-center justify-end gap-1`,children:_}),T&&s(i,{isActive:x,onClick:()=>S(e=>!e)})]})]}),s(`div`,{className:e(d,`absolute bottom-0 left-0 w-full translate-y-full`),children:s(t,{isHidden:!x,children:c(l.div,{className:`flex w-full flex-col pt-10 pb-[20%] text-lg text-text tracking-wide`,onClick:()=>S(!1),animate:x?`open`:`closed`,variants:u,style:{height:`calc(100vh - ${w}px)`},children:[p,c(`div`,{className:`flex h-full flex-col justify-center`,children:[m,g]}),s(`div`,{className:`m-auto flex w-full max-w-[400px] items-center justify-center gap-1 px-5 py-3`,children:h})]})})})]})};export{f as MobileNavbar};
2
2
  //# sourceMappingURL=MobileNavbar.mjs.map
@@ -1,2 +1,2 @@
1
- "use client";import{cn as e}from"../../utils/cn.mjs";import{useItemSelector as t}from"../../hooks/useItemSelector.mjs";import{Button as n,ButtonColor as r,ButtonSize as i,ButtonVariant as a}from"../Button/Button.mjs";import{useEffect as o,useRef as s}from"react";import{cva as c}from"class-variance-authority";import{ChevronLeft as l,ChevronRight as u,MoreHorizontal as d}from"lucide-react";import{jsx as f,jsxs as p}from"react/jsx-runtime";const m=c(`flex items-center justify-center gap-1`,{variants:{size:{sm:`gap-1`,md:`gap-2`,lg:`gap-3`},color:{text:`background-text`,primary:`background-primary`,secondary:`background-secondary`,neutral:`background-neutral`,destructive:`background-destructive`},variant:{default:``,bordered:`rounded-lg border border-border p-2`,ghost:`bg-transparent`}},defaultVariants:{size:`md`,variant:`default`}});let h=function(e){return e.SM=`sm`,e.MD=`md`,e.LG=`lg`,e}({}),g=function(e){return e.DEFAULT=`default`,e.BORDERED=`bordered`,e.GHOST=`ghost`,e}({});const _=(e,t,n)=>{if(t<=n)return Array.from({length:t},(e,t)=>t+1);let r=[],i=Math.floor(n/2);if(r.push(1),e<=i+2){for(let e=2;e<=Math.min(n-1,t-1);e++)r.push(e);t>n&&r.push(`ellipsis`),t>1&&r.push(t)}else if(e>=t-i-1){t>n&&r.push(`ellipsis`);for(let e=Math.max(2,t-n+2);e<=t;e++)r.push(e)}else{r.push(`ellipsis`);let n=e-i,a=e+i;for(let e=n;e<=a;e++)r.push(e);r.push(`ellipsis`),r.push(t)}return r},v=e=>e?.getAttribute(`aria-current`)===`true`,y=e=>e===h.SM?i.ICON_SM:e===h.LG?i.ICON_LG:i.ICON_MD,b=e=>f(`div`,{className:`absolute top-0 z-0 h-full w-auto rounded-xl bg-text/20 ring-4 ring-text/10 transition-[left,width] duration-300 ease-in-out [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-2xl motion-reduce:transition-none`,...e}),x=({currentPage:i,totalPages:c,onPageChange:x,showFirstLast:S=!1,showPrevNext:C=!0,maxVisiblePages:w=5,disabled:T=!1,size:E=h.MD,variant:D=g.DEFAULT,color:O=r.TEXT,className:k,...A})=>{let j=_(i,c,w),M=y(E),N=i===1,P=i===c,F=s([]),I=s(null),{choiceIndicatorPosition:L,calculatePosition:R}=t(F,{selector:v,isHoverable:!0});if(o(()=>{let e=setTimeout(()=>{R()},300);return()=>clearTimeout(e)},[i,R]),c<=1)return null;let z=e=>{!T&&e>=1&&e<=c&&e!==i&&x(e)};return f(`div`,{className:e(m({size:E,variant:D}),k),...A,children:p(`div`,{className:`relative flex items-center gap-1`,children:[L&&f(b,{style:L,ref:I}),C&&f(n,{variant:a.OUTLINE,size:M,color:r.TEXT,onClick:()=>z(i-1),disabled:T||N,label:`Go to previous page`,Icon:l,ref:e=>{e&&(F.current[0]=e)},className:`min-w-0 px-2`}),f(`div`,{className:`flex items-center gap-1 max-md:gap-0.5`,children:j.map((t,o)=>{if(t===`ellipsis`)return f(`div`,{className:`flex h-8 min-w-8 items-center justify-center px-1`,children:f(d,{className:`h-4 w-4 text-muted-foreground`})},`ellipsis-${t}-${o}`);let s=t===i,c=(C?1:0)+j.slice(0,o).filter(e=>e!==`ellipsis`).length;return f(n,{variant:s?a.DEFAULT:a.OUTLINE,size:M,color:r.TEXT,onClick:()=>z(t),disabled:T,label:`Go to page ${t}`,"aria-current":s?`true`:`false`,ref:e=>{e&&(F.current[c]=e)},className:e(`flex aspect-square h-8 w-8 min-w-0 items-center justify-center p-0 text-sm`,E===`sm`&&`h-6 w-6 text-xs`,E===`lg`&&`h-10 w-10 text-base`,s&&`font-semibold`),children:t},t)})}),C&&f(n,{variant:a.OUTLINE,size:M,color:r.TEXT,onClick:()=>z(i+1),disabled:T||P,label:`Go to next page`,Icon:u,ref:e=>{let t=(C?1:0)+j.filter(e=>e!==`ellipsis`).length;e&&(F.current[t]=e)},className:`min-w-0 px-2`})]})})};export{x as Pagination,h as PaginationSize,g as PaginationVariant,m as paginationVariants};
1
+ "use client";import{cn as e}from"../../utils/cn.mjs";import{Button as t,ButtonColor as n,ButtonSize as r,ButtonVariant as i}from"../Button/Button.mjs";import{useItemSelector as a}from"../../hooks/useItemSelector.mjs";import{useEffect as o,useRef as s}from"react";import{cva as c}from"class-variance-authority";import{ChevronLeft as l,ChevronRight as u,MoreHorizontal as d}from"lucide-react";import{jsx as f,jsxs as p}from"react/jsx-runtime";const m=c(`flex items-center justify-center gap-1`,{variants:{size:{sm:`gap-1`,md:`gap-2`,lg:`gap-3`},color:{text:`background-text`,primary:`background-primary`,secondary:`background-secondary`,neutral:`background-neutral`,destructive:`background-destructive`},variant:{default:``,bordered:`rounded-lg border border-border p-2`,ghost:`bg-transparent`}},defaultVariants:{size:`md`,variant:`default`}});let h=function(e){return e.SM=`sm`,e.MD=`md`,e.LG=`lg`,e}({}),g=function(e){return e.DEFAULT=`default`,e.BORDERED=`bordered`,e.GHOST=`ghost`,e}({});const _=(e,t,n)=>{if(t<=n)return Array.from({length:t},(e,t)=>t+1);let r=[],i=Math.floor(n/2);if(r.push(1),e<=i+2){for(let e=2;e<=Math.min(n-1,t-1);e++)r.push(e);t>n&&r.push(`ellipsis`),t>1&&r.push(t)}else if(e>=t-i-1){t>n&&r.push(`ellipsis`);for(let e=Math.max(2,t-n+2);e<=t;e++)r.push(e)}else{r.push(`ellipsis`);let n=e-i,a=e+i;for(let e=n;e<=a;e++)r.push(e);r.push(`ellipsis`),r.push(t)}return r},v=e=>e?.getAttribute(`aria-current`)===`true`,y=e=>e===h.SM?r.ICON_SM:e===h.LG?r.ICON_LG:r.ICON_MD,b=e=>f(`div`,{className:`absolute top-0 z-0 h-full w-auto rounded-xl bg-text/20 ring-4 ring-text/10 transition-[left,width] duration-300 ease-in-out [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-2xl motion-reduce:transition-none`,...e}),x=({currentPage:r,totalPages:c,onPageChange:x,showFirstLast:S=!1,showPrevNext:C=!0,maxVisiblePages:w=5,disabled:T=!1,size:E=h.MD,variant:D=g.DEFAULT,color:O=n.TEXT,className:k,...A})=>{let j=_(r,c,w),M=y(E),N=r===1,P=r===c,F=s([]),I=s(null),{choiceIndicatorPosition:L,calculatePosition:R}=a(F,{selector:v,isHoverable:!0});if(o(()=>{let e=setTimeout(()=>{R()},300);return()=>clearTimeout(e)},[r,R]),c<=1)return null;let z=e=>{!T&&e>=1&&e<=c&&e!==r&&x(e)};return f(`div`,{className:e(m({size:E,variant:D}),k),...A,children:p(`div`,{className:`relative flex items-center gap-1`,children:[L&&f(b,{style:L,ref:I}),C&&f(t,{variant:i.OUTLINE,size:M,color:n.TEXT,onClick:()=>z(r-1),disabled:T||N,label:`Go to previous page`,Icon:l,ref:e=>{e&&(F.current[0]=e)},className:`min-w-0 px-2`}),f(`div`,{className:`flex items-center gap-1 max-md:gap-0.5`,children:j.map((a,o)=>{if(a===`ellipsis`)return f(`div`,{className:`flex h-8 min-w-8 items-center justify-center px-1`,children:f(d,{className:`h-4 w-4 text-muted-foreground`})},`ellipsis-${a}-${o}`);let s=a===r,c=(C?1:0)+j.slice(0,o).filter(e=>e!==`ellipsis`).length;return f(t,{variant:s?i.DEFAULT:i.OUTLINE,size:M,color:n.TEXT,onClick:()=>z(a),disabled:T,label:`Go to page ${a}`,"aria-current":s?`true`:`false`,ref:e=>{e&&(F.current[c]=e)},className:e(`flex aspect-square h-8 w-8 min-w-0 items-center justify-center p-0 text-sm`,E===`sm`&&`h-6 w-6 text-xs`,E===`lg`&&`h-10 w-10 text-base`,s&&`font-semibold`),children:a},a)})}),C&&f(t,{variant:i.OUTLINE,size:M,color:n.TEXT,onClick:()=>z(r+1),disabled:T||P,label:`Go to next page`,Icon:u,ref:e=>{let t=(C?1:0)+j.filter(e=>e!==`ellipsis`).length;e&&(F.current[t]=e)},className:`min-w-0 px-2`})]})})};export{x as Pagination,h as PaginationSize,g as PaginationVariant,m as paginationVariants};
2
2
  //# sourceMappingURL=Pagination.mjs.map
@@ -1,2 +1,2 @@
1
- "use client";import{useGetElementOrWindow as e}from"../../hooks/useGetElementOrWindow.mjs";import{useDevice as t}from"../../hooks/useDevice.mjs";import{useScrollBlockage as n}from"../../hooks/useScrollBlockage/index.mjs";import{Container as r}from"../Container/index.mjs";import{Button as i,ButtonColor as a,ButtonSize as o,ButtonVariant as s}from"../Button/Button.mjs";import{KeyboardShortcut as c}from"../KeyboardShortcut/KeyboardShortcut.mjs";import{Popover as l}from"../Popover/dynamic.mjs";import{MaxWidthSmoother as u}from"../MaxWidthSmoother/index.mjs";import{isElementAtTopAndNotCovered as d}from"./isElementAtTopAndNotCovered.mjs";import{useRightDrawer as f}from"./useRightDrawer.mjs";import{useEffect as p,useRef as m}from"react";import{ChevronLeft as h,X as g}from"lucide-react";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import{useIntlayer as b}from"react-intlayer";import{createPortal as x}from"react-dom";const S=({title:S,identifier:C,children:w,header:T,footer:E,closeOnOutsideClick:D=!0,backButton:O,isOpen:k,onClose:A,container:j})=>{let M=b(`right-drawer`),{isMobile:N}=t(`md`),P=m(null),F=m(null),I=e(j),{open:L,close:R,isOpen:z}=f(),B=z(C),V=B;n({disableScroll:V,key:C?`right_drawer_${C}`:`right_drawer`}),p(()=>{let e=e=>{try{if(!P.current)return;let t=V&&D,n=e.target&&!P.current.contains(e.target),r=d(P.current);(t&&n&&r||!e.target)&&(R(C),A?.())}catch{R(C),A?.()}};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[V,R,A,D,C]);let H=m(A);return p(()=>{H.current=A},[A]),p(()=>{k!==void 0&&k!==B&&(k?L(C):(R(C),H.current?.()))},[k,B,C,L,R]),I?x(v(`div`,{className:`fixed top-0 right-0 z-50 flex h-full justify-end`,children:v(u,{isHidden:!V,align:`right`,children:y(r,{className:`relative flex h-screen w-screen flex-col text-text md:w-[400px]`,ref:P,roundedSize:`none`,children:[y(`div`,{className:`flex shrink-0 flex-col gap-3 px-6 pt-6`,children:[y(`div`,{className:`flex justify-between gap-3`,children:[v(`div`,{children:O&&v(i,{variant:s.HOVERABLE,color:a.TEXT,label:O.text??M.goBack.value,onClick:O.onBack,Icon:h,children:O?.text})}),v(`div`,{children:y(l,{identifier:`close-drawer`,children:[v(i,{variant:s.HOVERABLE,color:a.TEXT,label:`Close`,className:`ml-auto`,onClick:()=>{R(C),A?.()},Icon:g,size:o.ICON_MD}),v(l.Detail,{identifier:`close-drawer`,children:y(`div`,{className:`flex items-center gap-2 p-2`,children:[v(`span`,{className:`whitespace-nowrap text-neutral text-xs`,children:M.closeDrawer}),v(c,{shortcut:`Escape`,size:`sm`,onTriggered:()=>{R(C),A?.()}})]})})]})})]}),S&&v(`h2`,{className:`flex items-center justify-center font-bold text-lg`,children:S}),T]}),v(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto p-2`,children:v(`div`,{className:`flex flex-1 flex-col outline-none`,onClick:e=>{e.target===e.currentTarget&&N&&(R(C),A?.())},onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),N&&(R(C),A?.()))},ref:F,role:`button`,tabIndex:0,children:w})}),E&&v(`div`,{className:`shrink-0`,children:E})]})})}),I):v(_,{})};export{S as RightDrawer};
1
+ "use client";import{Container as e}from"../Container/index.mjs";import{Button as t,ButtonColor as n,ButtonSize as r,ButtonVariant as i}from"../Button/Button.mjs";import{useDevice as a}from"../../hooks/useDevice.mjs";import{KeyboardShortcut as o}from"../KeyboardShortcut/KeyboardShortcut.mjs";import{Popover as s}from"../Popover/dynamic.mjs";import{useGetElementOrWindow as c}from"../../hooks/useGetElementOrWindow.mjs";import{useScrollBlockage as l}from"../../hooks/useScrollBlockage/index.mjs";import{MaxWidthSmoother as u}from"../MaxWidthSmoother/index.mjs";import{isElementAtTopAndNotCovered as d}from"./isElementAtTopAndNotCovered.mjs";import{useRightDrawer as f}from"./useRightDrawer.mjs";import{useEffect as p,useRef as m}from"react";import{ChevronLeft as h,X as g}from"lucide-react";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import{useIntlayer as b}from"react-intlayer";import{createPortal as x}from"react-dom";const S=({title:S,identifier:C,children:w,header:T,footer:E,closeOnOutsideClick:D=!0,backButton:O,isOpen:k,onClose:A,container:j})=>{let M=b(`right-drawer`),{isMobile:N}=a(`md`),P=m(null),F=m(null),I=c(j),{open:L,close:R,isOpen:z}=f(),B=z(C),V=B;l({disableScroll:V,key:C?`right_drawer_${C}`:`right_drawer`}),p(()=>{let e=e=>{try{if(!P.current)return;let t=V&&D,n=e.target&&!P.current.contains(e.target),r=d(P.current);(t&&n&&r||!e.target)&&(R(C),A?.())}catch{R(C),A?.()}};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[V,R,A,D,C]);let H=m(A);return p(()=>{H.current=A},[A]),p(()=>{k!==void 0&&k!==B&&(k?L(C):(R(C),H.current?.()))},[k,B,C,L,R]),I?x(v(`div`,{className:`fixed top-0 right-0 z-50 flex h-full justify-end`,children:v(u,{isHidden:!V,align:`right`,children:y(e,{className:`relative flex h-screen w-screen flex-col text-text md:w-[400px]`,ref:P,roundedSize:`none`,children:[y(`div`,{className:`flex shrink-0 flex-col gap-3 px-6 pt-6`,children:[y(`div`,{className:`flex justify-between gap-3`,children:[v(`div`,{children:O&&v(t,{variant:i.HOVERABLE,color:n.TEXT,label:O.text??M.goBack.value,onClick:O.onBack,Icon:h,children:O?.text})}),v(`div`,{children:y(s,{identifier:`close-drawer`,children:[v(t,{variant:i.HOVERABLE,color:n.TEXT,label:`Close`,className:`ml-auto`,onClick:()=>{R(C),A?.()},Icon:g,size:r.ICON_MD}),v(s.Detail,{identifier:`close-drawer`,children:y(`div`,{className:`flex items-center gap-2 p-2`,children:[v(`span`,{className:`whitespace-nowrap text-neutral text-xs`,children:M.closeDrawer}),v(o,{shortcut:`Escape`,size:`sm`,onTriggered:()=>{R(C),A?.()}})]})})]})})]}),S&&v(`h2`,{className:`flex items-center justify-center font-bold text-lg`,children:S}),T]}),v(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto p-2`,children:v(`div`,{className:`flex flex-1 flex-col outline-none`,onClick:e=>{e.target===e.currentTarget&&N&&(R(C),A?.())},onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),N&&(R(C),A?.()))},ref:F,role:`button`,tabIndex:0,children:w})}),E&&v(`div`,{className:`shrink-0`,children:E})]})})}),I):v(_,{})};export{S as RightDrawer};
2
2
  //# sourceMappingURL=RightDrawer.mjs.map
@@ -1 +1 @@
1
- import{useKeyboardDetector as e}from"./useKeyboardDetector.mjs";import{useGetElementOrWindow as t}from"./useGetElementOrWindow.mjs";import{useScrollY as n}from"./useScrollY.mjs";import{usePersistedStore as r}from"./usePersistedStore.mjs";import{useHorizontalSwipe as i}from"./useHorizontalSwipe.mjs";import{useItemSelector as a}from"./useItemSelector.mjs";import{calculateIsMobile as o,checkIsIOS as s,checkIsIphoneOrSafariDevice as c,checkIsMac as l,checkIsMobileScreen as u,checkIsMobileUserAgent as d,getBreakpointFromSize as f,useDevice as p}from"./useDevice.mjs";import{useOAuth2 as m}from"./useAuth/useOAuth2.mjs";import{useSession as h}from"./useAuth/useSession.mjs";import{useAuth as g}from"./useAuth/useAuth.mjs";import{useIntlayerAuth as _,useIntlayerOAuth as v}from"./useIntlayerAPI.mjs";import{useAddDictionary as y,useAddNewAccessKey as b,useAddOrganization as x,useAddOrganizationMember as S,useAddPasskey as C,useAddProject as w,useAddTag as T,useAppQuery as E,useAskDocQuestion as D,useAskResetPassword as O,useAuditContentDeclaration as k,useAuditContentDeclarationField as A,useAuditContentDeclarationMetadata as j,useAuditScan as M,useAuditTag as N,useAutocomplete as P,useBitbucketAuth as F,useBitbucketCheckConfig as I,useBitbucketGetConfigFile as L,useBitbucketRepos as R,useCancelSubscription as z,useChangePassword as B,useCreateUser as V,useDeleteAccessKey as H,useDeleteDictionary as U,useDeleteOrganization as W,useDeletePasskey as G,useDeleteProject as K,useDeleteSSOProvider as q,useDeleteShowcaseProject as J,useDeleteTag as Y,useDeleteUser as X,useDisableTwoFactor as Z,useEnableTwoFactor as Q,useGetCIConfig as $,useGetDictionaries as ee,useGetDictionariesKeys as te,useGetDictionary as ne,useGetDiscussions as re,useGetDiscussionsData as ie,useGetEditorDictionaries as ae,useGetNewsletterStatus as oe,useGetOrganizations as se,useGetOtherShowcaseProjects as ce,useGetPricing as le,useGetProjects as ue,useGetRecursiveAuditStatus as de,useGetShowcaseProjectById as fe,useGetShowcaseProjects as pe,useGetSubscription as me,useGetTags as he,useGetUserByAccount as ge,useGetUserById as _e,useGetUsers as ve,useGetVerifyEmailStatus as ye,useGithubAuth as be,useGithubCheckConfig as xe,useGithubGetAuthUrl as Se,useGithubGetConfigFile as Ce,useGithubRepos as we,useGitlabAuth as Te,useGitlabCheckConfig as Ee,useGitlabGetConfigFile as De,useGitlabProjects as Oe,useInfiniteGetDictionaries as ke,useListPasskeys as Ae,useListSSOProviders as je,useLogin as Me,useLogout as Ne,usePushCIConfig as Pe,usePushDictionaries as Fe,useQueryClient as Ie,useRefreshAccessKey as Le,useRegister as Re,useRegisterSSO as ze,useResetPassword as Be,useSearchDoc as Ve,useSelectOrganization as He,useSelectProject as Ue,useSignInMagicLink as We,useSignInPasskey as Ge,useSignInSSO as Ke,useStartRecursiveAudit as qe,useSubmitShowcaseProject as Je,useSubscribeToNewsletter as Ye,useToggleShowcaseDownvote as Xe,useToggleShowcaseUpvote as Ze,useTranslateJSONDeclaration as Qe,useTriggerBuild as $e,useTriggerWebhook as et,useUnselectOrganization as tt,useUnselectProject as nt,useUnsubscribeFromNewsletter as rt,useUpdateDictionary as it,useUpdateOrganization as at,useUpdateOrganizationMembers as ot,useUpdateOrganizationMembersById as st,useUpdateProject as ct,useUpdateProjectMembers as lt,useUpdateShowcaseProject as ut,useUpdateTag as dt,useUpdateUser as ft,useVerifyBackupCode as pt,useVerifyEmail as mt,useVerifyTotp as ht,useWriteDictionary as gt}from"./reactQuery.mjs";import{useSearch as _t}from"./useSearch.mjs";import{useIsMounted as vt}from"./useIsMounted.mjs";import{useGetElementById as yt}from"./useGetElementById.mjs";import{useIsDarkMode as bt}from"./useIsDarkMode.mjs";import{useScreenWidth as xt}from"./useScreenWidth.mjs";import{useScrollBlockage as St}from"./useScrollBlockage/index.mjs";import{useScrollDetection as Ct}from"./useScrollDetection.mjs";import{useUser as wt}from"./useUser/index.mjs";export{o as calculateIsMobile,s as checkIsIOS,c as checkIsIphoneOrSafariDevice,l as checkIsMac,u as checkIsMobileScreen,d as checkIsMobileUserAgent,f as getBreakpointFromSize,y as useAddDictionary,b as useAddNewAccessKey,x as useAddOrganization,S as useAddOrganizationMember,C as useAddPasskey,w as useAddProject,T as useAddTag,E as useAppQuery,D as useAskDocQuestion,O as useAskResetPassword,k as useAuditContentDeclaration,A as useAuditContentDeclarationField,j as useAuditContentDeclarationMetadata,M as useAuditScan,N as useAuditTag,g as useAuth,P as useAutocomplete,F as useBitbucketAuth,I as useBitbucketCheckConfig,L as useBitbucketGetConfigFile,R as useBitbucketRepos,z as useCancelSubscription,B as useChangePassword,V as useCreateUser,H as useDeleteAccessKey,U as useDeleteDictionary,W as useDeleteOrganization,G as useDeletePasskey,K as useDeleteProject,q as useDeleteSSOProvider,J as useDeleteShowcaseProject,Y as useDeleteTag,X as useDeleteUser,p as useDevice,Z as useDisableTwoFactor,Q as useEnableTwoFactor,$ as useGetCIConfig,ee as useGetDictionaries,te as useGetDictionariesKeys,ne as useGetDictionary,re as useGetDiscussions,ie as useGetDiscussionsData,ae as useGetEditorDictionaries,yt as useGetElementById,t as useGetElementOrWindow,oe as useGetNewsletterStatus,se as useGetOrganizations,ce as useGetOtherShowcaseProjects,le as useGetPricing,ue as useGetProjects,de as useGetRecursiveAuditStatus,fe as useGetShowcaseProjectById,pe as useGetShowcaseProjects,me as useGetSubscription,he as useGetTags,ge as useGetUserByAccount,_e as useGetUserById,ve as useGetUsers,ye as useGetVerifyEmailStatus,be as useGithubAuth,xe as useGithubCheckConfig,Se as useGithubGetAuthUrl,Ce as useGithubGetConfigFile,we as useGithubRepos,Te as useGitlabAuth,Ee as useGitlabCheckConfig,De as useGitlabGetConfigFile,Oe as useGitlabProjects,i as useHorizontalSwipe,ke as useInfiniteGetDictionaries,_ as useIntlayerAuth,v as useIntlayerOAuth,bt as useIsDarkMode,vt as useIsMounted,a as useItemSelector,e as useKeyboardDetector,Ae as useListPasskeys,je as useListSSOProviders,Me as useLogin,Ne as useLogout,m as useOAuth2,r as usePersistedStore,Pe as usePushCIConfig,Fe as usePushDictionaries,Ie as useQueryClient,Le as useRefreshAccessKey,Re as useRegister,ze as useRegisterSSO,Be as useResetPassword,xt as useScreenWidth,St as useScrollBlockage,Ct as useScrollDetection,n as useScrollY,_t as useSearch,Ve as useSearchDoc,He as useSelectOrganization,Ue as useSelectProject,h as useSession,We as useSignInMagicLink,Ge as useSignInPasskey,Ke as useSignInSSO,qe as useStartRecursiveAudit,Je as useSubmitShowcaseProject,Ye as useSubscribeToNewsletter,Xe as useToggleShowcaseDownvote,Ze as useToggleShowcaseUpvote,Qe as useTranslateJSONDeclaration,$e as useTriggerBuild,et as useTriggerWebhook,tt as useUnselectOrganization,nt as useUnselectProject,rt as useUnsubscribeFromNewsletter,it as useUpdateDictionary,at as useUpdateOrganization,ot as useUpdateOrganizationMembers,st as useUpdateOrganizationMembersById,ct as useUpdateProject,lt as useUpdateProjectMembers,ut as useUpdateShowcaseProject,dt as useUpdateTag,ft as useUpdateUser,wt as useUser,pt as useVerifyBackupCode,mt as useVerifyEmail,ht as useVerifyTotp,gt as useWriteDictionary};
1
+ import{calculateIsMobile as e,checkIsIOS as t,checkIsIphoneOrSafariDevice as n,checkIsMac as r,checkIsMobileScreen as i,checkIsMobileUserAgent as a,getBreakpointFromSize as o,useDevice as s}from"./useDevice.mjs";import{useItemSelector as c}from"./useItemSelector.mjs";import{useOAuth2 as l}from"./useAuth/useOAuth2.mjs";import{useSession as u}from"./useAuth/useSession.mjs";import{useAuth as d}from"./useAuth/useAuth.mjs";import{useIntlayerAuth as f,useIntlayerOAuth as p}from"./useIntlayerAPI.mjs";import{useAddDictionary as m,useAddNewAccessKey as h,useAddOrganization as g,useAddOrganizationMember as _,useAddPasskey as v,useAddProject as y,useAddTag as b,useAppQuery as x,useAskDocQuestion as S,useAskResetPassword as C,useAuditContentDeclaration as w,useAuditContentDeclarationField as T,useAuditContentDeclarationMetadata as E,useAuditScan as D,useAuditTag as O,useAutocomplete as k,useBitbucketAuth as A,useBitbucketCheckConfig as j,useBitbucketGetConfigFile as M,useBitbucketRepos as N,useCancelSubscription as P,useChangePassword as F,useCreateUser as I,useDeleteAccessKey as L,useDeleteDictionary as R,useDeleteOrganization as z,useDeletePasskey as B,useDeleteProject as V,useDeleteSSOProvider as H,useDeleteShowcaseProject as U,useDeleteTag as W,useDeleteUser as G,useDisableTwoFactor as K,useEnableTwoFactor as q,useGetCIConfig as J,useGetDictionaries as Y,useGetDictionariesKeys as X,useGetDictionary as Z,useGetDiscussions as Q,useGetDiscussionsData as $,useGetEditorDictionaries as ee,useGetNewsletterStatus as te,useGetOrganizations as ne,useGetOtherShowcaseProjects as re,useGetPricing as ie,useGetProjects as ae,useGetRecursiveAuditStatus as oe,useGetShowcaseProjectById as se,useGetShowcaseProjects as ce,useGetSubscription as le,useGetTags as ue,useGetUserByAccount as de,useGetUserById as fe,useGetUsers as pe,useGetVerifyEmailStatus as me,useGithubAuth as he,useGithubCheckConfig as ge,useGithubGetAuthUrl as _e,useGithubGetConfigFile as ve,useGithubRepos as ye,useGitlabAuth as be,useGitlabCheckConfig as xe,useGitlabGetConfigFile as Se,useGitlabProjects as Ce,useInfiniteGetDictionaries as we,useListPasskeys as Te,useListSSOProviders as Ee,useLogin as De,useLogout as Oe,usePushCIConfig as ke,usePushDictionaries as Ae,useQueryClient as je,useRefreshAccessKey as Me,useRegister as Ne,useRegisterSSO as Pe,useResetPassword as Fe,useSearchDoc as Ie,useSelectOrganization as Le,useSelectProject as Re,useSignInMagicLink as ze,useSignInPasskey as Be,useSignInSSO as Ve,useStartRecursiveAudit as He,useSubmitShowcaseProject as Ue,useSubscribeToNewsletter as We,useToggleShowcaseDownvote as Ge,useToggleShowcaseUpvote as Ke,useTranslateJSONDeclaration as qe,useTriggerBuild as Je,useTriggerWebhook as Ye,useUnselectOrganization as Xe,useUnselectProject as Ze,useUnsubscribeFromNewsletter as Qe,useUpdateDictionary as $e,useUpdateOrganization as et,useUpdateOrganizationMembers as tt,useUpdateOrganizationMembersById as nt,useUpdateProject as rt,useUpdateProjectMembers as it,useUpdateShowcaseProject as at,useUpdateTag as ot,useUpdateUser as st,useVerifyBackupCode as ct,useVerifyEmail as lt,useVerifyTotp as ut,useWriteDictionary as dt}from"./reactQuery.mjs";import{usePersistedStore as ft}from"./usePersistedStore.mjs";import{useUser as pt}from"./useUser/index.mjs";import{useHorizontalSwipe as mt}from"./useHorizontalSwipe.mjs";import{useGetElementById as ht}from"./useGetElementById.mjs";import{useGetElementOrWindow as gt}from"./useGetElementOrWindow.mjs";import{useIsDarkMode as _t}from"./useIsDarkMode.mjs";import{useIsMounted as vt}from"./useIsMounted.mjs";import{useKeyboardDetector as yt}from"./useKeyboardDetector.mjs";import{useScreenWidth as bt}from"./useScreenWidth.mjs";import{useScrollBlockage as xt}from"./useScrollBlockage/index.mjs";import{useScrollDetection as St}from"./useScrollDetection.mjs";import{useScrollY as Ct}from"./useScrollY.mjs";import{useSearch as wt}from"./useSearch.mjs";export{e as calculateIsMobile,t as checkIsIOS,n as checkIsIphoneOrSafariDevice,r as checkIsMac,i as checkIsMobileScreen,a as checkIsMobileUserAgent,o as getBreakpointFromSize,m as useAddDictionary,h as useAddNewAccessKey,g as useAddOrganization,_ as useAddOrganizationMember,v as useAddPasskey,y as useAddProject,b as useAddTag,x as useAppQuery,S as useAskDocQuestion,C as useAskResetPassword,w as useAuditContentDeclaration,T as useAuditContentDeclarationField,E as useAuditContentDeclarationMetadata,D as useAuditScan,O as useAuditTag,d as useAuth,k as useAutocomplete,A as useBitbucketAuth,j as useBitbucketCheckConfig,M as useBitbucketGetConfigFile,N as useBitbucketRepos,P as useCancelSubscription,F as useChangePassword,I as useCreateUser,L as useDeleteAccessKey,R as useDeleteDictionary,z as useDeleteOrganization,B as useDeletePasskey,V as useDeleteProject,H as useDeleteSSOProvider,U as useDeleteShowcaseProject,W as useDeleteTag,G as useDeleteUser,s as useDevice,K as useDisableTwoFactor,q as useEnableTwoFactor,J as useGetCIConfig,Y as useGetDictionaries,X as useGetDictionariesKeys,Z as useGetDictionary,Q as useGetDiscussions,$ as useGetDiscussionsData,ee as useGetEditorDictionaries,ht as useGetElementById,gt as useGetElementOrWindow,te as useGetNewsletterStatus,ne as useGetOrganizations,re as useGetOtherShowcaseProjects,ie as useGetPricing,ae as useGetProjects,oe as useGetRecursiveAuditStatus,se as useGetShowcaseProjectById,ce as useGetShowcaseProjects,le as useGetSubscription,ue as useGetTags,de as useGetUserByAccount,fe as useGetUserById,pe as useGetUsers,me as useGetVerifyEmailStatus,he as useGithubAuth,ge as useGithubCheckConfig,_e as useGithubGetAuthUrl,ve as useGithubGetConfigFile,ye as useGithubRepos,be as useGitlabAuth,xe as useGitlabCheckConfig,Se as useGitlabGetConfigFile,Ce as useGitlabProjects,mt as useHorizontalSwipe,we as useInfiniteGetDictionaries,f as useIntlayerAuth,p as useIntlayerOAuth,_t as useIsDarkMode,vt as useIsMounted,c as useItemSelector,yt as useKeyboardDetector,Te as useListPasskeys,Ee as useListSSOProviders,De as useLogin,Oe as useLogout,l as useOAuth2,ft as usePersistedStore,ke as usePushCIConfig,Ae as usePushDictionaries,je as useQueryClient,Me as useRefreshAccessKey,Ne as useRegister,Pe as useRegisterSSO,Fe as useResetPassword,bt as useScreenWidth,xt as useScrollBlockage,St as useScrollDetection,Ct as useScrollY,wt as useSearch,Ie as useSearchDoc,Le as useSelectOrganization,Re as useSelectProject,u as useSession,ze as useSignInMagicLink,Be as useSignInPasskey,Ve as useSignInSSO,He as useStartRecursiveAudit,Ue as useSubmitShowcaseProject,We as useSubscribeToNewsletter,Ge as useToggleShowcaseDownvote,Ke as useToggleShowcaseUpvote,qe as useTranslateJSONDeclaration,Je as useTriggerBuild,Ye as useTriggerWebhook,Xe as useUnselectOrganization,Ze as useUnselectProject,Qe as useUnsubscribeFromNewsletter,$e as useUpdateDictionary,et as useUpdateOrganization,tt as useUpdateOrganizationMembers,nt as useUpdateOrganizationMembersById,rt as useUpdateProject,it as useUpdateProjectMembers,at as useUpdateShowcaseProject,ot as useUpdateTag,st as useUpdateUser,pt as useUser,ct as useVerifyBackupCode,lt as useVerifyEmail,ut as useVerifyTotp,dt as useWriteDictionary};
@@ -43,7 +43,7 @@ declare enum BadgeSize {
43
43
  * @description Defines the styling variants for different badge combinations
44
44
  */
45
45
  declare const badgeVariants: (props?: {
46
- color?: "text" | "primary" | "secondary" | "destructive" | "neutral" | "light" | "dark" | "error" | "success" | "custom";
46
+ color?: "primary" | "secondary" | "destructive" | "neutral" | "light" | "dark" | "text" | "error" | "success" | "custom";
47
47
  variant?: "none" | "default" | "outline" | "hoverable";
48
48
  size?: "sm" | "md" | "lg";
49
49
  } & class_variance_authority_types0.ClassProp) => string;
@@ -24,7 +24,7 @@ declare const breadCrumbContent: {
24
24
  vi: string;
25
25
  uk: string;
26
26
  }, {
27
- nodeType: "translation" | _intlayer_types_nodeType0.NodeType.Translation;
27
+ nodeType: _intlayer_types_nodeType0.NodeType.Translation | "translation";
28
28
  } & {
29
29
  translation: {
30
30
  en: string;