lingee-ui 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-M37T4ADR.mjs → chunk-BIETJXHD.mjs} +1 -1
- package/dist/chunk-FHQEJ42C.js +1 -0
- package/dist/chunk-G4FASWRJ.mjs +1 -0
- package/dist/{chunk-LSZ4P7R5.js → chunk-GLNNJIRF.js} +1 -1
- package/dist/{chunk-6QCL57T5.mjs → chunk-HJ7XGNWS.mjs} +1 -1
- package/dist/chunk-IFHC5A33.mjs +1 -0
- package/dist/{chunk-TL6FYFGR.js → chunk-MIVVBEBP.js} +1 -1
- package/dist/{chunk-XOVQPZCB.js → chunk-WYTTL6TA.js} +1 -1
- package/dist/chunk-X65SV4WZ.js +1 -0
- package/dist/{chunk-56AGGSSV.mjs → chunk-YLMME3Z2.mjs} +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.mts +104 -1
- package/dist/index.d.ts +104 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/input/index.css +1 -1
- package/dist/input/index.js +1 -1
- package/dist/input/index.mjs +1 -1
- package/dist/popover/index.js +1 -1
- package/dist/popover/index.mjs +1 -1
- package/dist/tabs/index.css +1 -1
- package/dist/tabs/index.js +1 -1
- package/dist/tabs/index.mjs +1 -1
- package/dist/toast/index.css +1 -1
- package/dist/toast/index.js +1 -1
- package/dist/toast/index.mjs +1 -1
- package/dist/tree/index.css +1 -1
- package/dist/tree/index.js +1 -1
- package/dist/tree/index.mjs +1 -1
- package/package.json +1 -1
- package/skill/AGENTS-SNIPPET.md +2 -2
- package/skill/SKILL.md +5 -5
- package/skill/VERSION.json +3 -3
- package/skill/references/components/dialog.md +13 -0
- package/skill/references/components/sidebar.md +33 -2
- package/skill/references/icons.md +3 -2
- package/skill/references/setup.md +1 -1
- package/skill/references/tokens.md +1 -1
- package/dist/chunk-DHCCF3XI.mjs +0 -1
- package/dist/chunk-FTEVUZKX.js +0 -1
- package/dist/chunk-LBNA6G3N.js +0 -1
- package/dist/chunk-N524EGAL.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {j}from'./chunk-
|
|
1
|
+
import {j}from'./chunk-G4FASWRJ.mjs';import {a}from'./chunk-DN2VKVCV.mjs';import G,{useState,useRef,useCallback,useEffect}from'react';import {XCircleFill}from'lingee-icon';import {jsxs,jsx}from'react/jsx-runtime';var U=G.forwardRef(({className:l,style:o,size:a$1="md",shape:M="default",prefix:d,suffix:s,allowClear:T=false,error:C=false,disabled:r=false,collapsed:t=false,value:g,defaultValue:L,onChange:c,onFocus:_,onBlur:f,onPressEnter:v,onKeyDown:h,onClick:b,...H},S)=>{let m=j("Input"),[N,x]=useState(false),[D,y]=useState(L?.toString()??""),e=useRef(null),F=Y(S,e),u=g!==void 0,w=u?g?.toString()??"":D,O=useCallback(n=>{u||y(n.target.value),c?.(n);},[u,c]),P=useCallback(()=>{if(r)return;u||y("");let n=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value")?.set;if(e.current&&n){n.call(e.current,"");let A=new Event("input",{bubbles:true});e.current.dispatchEvent(A);}e.current?.focus();},[r,u]),V=useCallback(n=>{x(true),_?.(n);},[_]),j$1=useCallback(n=>{x(false),f?.(n);},[f]),B=useCallback(n=>{n.key==="Enter"&&v?.(n),h?.(n);},[v,h]),K=T&&w.length>0&&!r&&!t,W=!!s&&!(t&&d),k=useRef(t);useEffect(()=>{let n=k.current;k.current=t,n!==t&&(t?e.current===document.activeElement&&e.current?.blur():r||e.current?.focus());},[t,r]);let X=useCallback(n=>{t||e.current?.focus(),b?.(n);},[t,b]),$=a("lg-input",`lg-input--${a$1}`,M==="round"&&"lg-input--round",N&&!t&&"lg-input--focused",C&&"lg-input--error",r&&"lg-input--disabled",t&&"lg-input--collapsed",l),q=t?{...o,width:void 0,minWidth:void 0,maxWidth:void 0}:o;return jsxs("div",{className:$,style:q,onClick:X,role:t?"button":void 0,tabIndex:t&&!r?0:void 0,"aria-expanded":t?false:void 0,"aria-label":t?m.expand:void 0,children:[d&&jsx("span",{className:"lg-input__prefix",children:d}),jsx("input",{ref:F,className:"lg-input__inner",disabled:r,value:w,onChange:O,onFocus:V,onBlur:j$1,onKeyDown:B,tabIndex:t?-1:void 0,"aria-hidden":t||void 0,...H}),K&&jsx("span",{className:"lg-input__clear",onMouseDown:n=>n.preventDefault(),onClick:P,role:"button","aria-label":m.clear,children:jsx(XCircleFill,{})}),W&&jsx("span",{className:"lg-input__suffix",children:s})]})});U.displayName="Input";function Y(...l){return useCallback(o=>{l.forEach(a=>{a&&(typeof a=="function"?a(o):a.current=o);});},l)}export{U as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkYSWFM6ML_js=require('./chunk-YSWFM6ML.js'),chunkDCDWEVW4_js=require('./chunk-DCDWEVW4.js'),ze=require('react'),sonner=require('sonner'),lingeeIcon=require('lingee-icon'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var ze__default=/*#__PURE__*/_interopDefault(ze);var ce={locale:"zh-CN",Button:{},Breadcrumb:{more:"\u66F4\u591A",back:"\u8FD4\u56DE"},Select:{loading:"\u52A0\u8F7D\u4E2D",loadError:"\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",loadFailed:"\u52A0\u8F7D\u5931\u8D25",notFound:"\u641C\u7D22\u65E0\u7ED3\u679C",clear:"\u6E05\u7A7A"},Dropdown:{clear:"\u6E05\u9664",loading:"\u52A0\u8F7D\u4E2D",loadError:"\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",empty:"\u6682\u65E0\u6570\u636E"},Tabs:{scrollLeft:"\u5411\u5DE6\u6EDA\u52A8",scrollRight:"\u5411\u53F3\u6EDA\u52A8"},Carousel:{carousel:"\u8F6E\u64AD",prev:"\u4E0A\u4E00\u5F20",next:"\u4E0B\u4E00\u5F20",goToPage:"\u8DF3\u8F6C\u5230\u7B2C {page} \u5F20"},Form:{required:"{label}\u4E0D\u80FD\u4E3A\u7A7A",requiredNoLabel:"\u6B64\u9879\u4E0D\u80FD\u4E3A\u7A7A"},Tag:{close:"\u5173\u95ED"},Upload:{retry:"\u91CD\u65B0\u4E0A\u4F20",remove:"\u79FB\u9664\u6587\u4EF6",removeShort:"\u79FB\u9664",dragText:"\u62D6\u62FD\u6587\u4EF6\u5230\u6B64\u5904\uFF0C\u6216",clickUpload:"\u70B9\u51FB\u4E0A\u4F20"},ColorPicker:{placeholder:"\u8BF7\u9009\u62E9\u989C\u8272"},DatePicker:{placeholder:"\u5E74/\u6708/\u65E5",today:"\u4ECA\u5929",prevYear:"\u4E0A\u4E00\u5E74",nextYear:"\u4E0B\u4E00\u5E74",prevMonth:"\u4E0A\u4E00\u6708",nextMonth:"\u4E0B\u4E00\u6708",prevDecade:"\u4E0A\u4E00\u7EC4\u5E74\u4EFD",nextDecade:"\u4E0B\u4E00\u7EC4\u5E74\u4EFD",months:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],yearFormat:"{year}\u5E74",monthFormat:"{month}\u6708"},RangePicker:{startPlaceholder:"\u5E74/\u6708/\u65E5",endPlaceholder:"\u5E74/\u6708/\u65E5"},TimePicker:{now:"\u73B0\u5728",confirm:"\u786E\u5B9A",placeholder:"\u65F6:\u5206",placeholderFull:"\u65F6:\u5206:\u79D2"},Table:{empty:"\u6682\u65E0\u6570\u636E"},Tree:{empty:"\u6682\u65E0\u6570\u636E"},Pagination:{total:"\u5171 {total} \u6761",prevPage:"\u4E0A\u4E00\u9875",nextPage:"\u4E0B\u4E00\u9875",itemsPerPage:"{size}\u6761/\u9875",jumpTo:"\u8DF3\u81F3",page:"\u9875"},Dialog:{close:"\u5173\u95ED"},Drawer:{close:"\u5173\u95ED"},Input:{clear:"\u6E05\u7A7A",expand:"\u5C55\u5F00\u8F93\u5165\u6846"},Alert:{close:"\u5173\u95ED"},Toast:{close:"\u5173\u95ED\u6D88\u606F"},Spin:{loading:"\u52A0\u8F7D\u4E2D"},Empty:{retry:"\u91CD\u8BD5"},Sidebar:{expand:"\u5C55\u5F00",collapse:"\u6536\u8D77",loading:"\u52A0\u8F7D\u4E2D",empty:"\u6682\u65E0\u6570\u636E",loadError:"\u52A0\u8F7D\u5931\u8D25"}},v=ce;var _=new Map,F=0;function A(){return F+=1,{id:F}}function z(e,o,t){_.set(e.id,{site:o,depth:t});}function Y(e){_.delete(e.id);}function pe(){let e;for(let o of _.values())(!e||o.depth>=e.depth)&&(e=o);return e?.site}function E(){return pe()==="lingee"}var U={dialog:{}},h=ze.createContext(U),D=new Map,B=0;function G(){return B+=1,{id:B}}function q(e,o,t){D.set(e.id,{config:o,depth:t});}function j(e){D.delete(e.id);}function ge(){let e;for(let o of D.values())(!e||o.depth>=e.depth)&&(e=o);return e?.config??U}function me(){return ze.useContext(h)}var Te={locale:"en-US",Button:{},Breadcrumb:{more:"More",back:"Back"},Select:{loading:"Loading",loadError:"Failed to load, please retry",loadFailed:"Failed to load",notFound:"No results found",clear:"Clear"},Dropdown:{clear:"Clear",loading:"Loading",loadError:"Failed to load, please retry",empty:"No data"},Tabs:{scrollLeft:"Scroll left",scrollRight:"Scroll right"},Carousel:{carousel:"Carousel",prev:"Previous slide",next:"Next slide",goToPage:"Go to slide {page}"},Form:{required:"{label} is required",requiredNoLabel:"This field is required"},Tag:{close:"Close"},Upload:{retry:"Retry upload",remove:"Remove file",removeShort:"Remove",dragText:"Drag files here, or ",clickUpload:"click to upload"},ColorPicker:{placeholder:"Select a color"},DatePicker:{placeholder:"YYYY/MM/DD",today:"Today",prevYear:"Previous year",nextYear:"Next year",prevMonth:"Previous month",nextMonth:"Next month",prevDecade:"Previous decade",nextDecade:"Next decade",months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yearFormat:"{year}",monthFormat:"{month}"},RangePicker:{startPlaceholder:"Start date",endPlaceholder:"End date"},TimePicker:{now:"Now",confirm:"OK",placeholder:"HH:mm",placeholderFull:"HH:mm:ss"},Table:{empty:"No data"},Tree:{empty:"No data"},Pagination:{total:"{total} items",prevPage:"Previous page",nextPage:"Next page",itemsPerPage:"{size} / page",jumpTo:"Go to",page:""},Dialog:{close:"Close"},Drawer:{close:"Close"},Input:{clear:"Clear",expand:"Expand input"},Alert:{close:"Close"},Toast:{close:"Close message"},Spin:{loading:"Loading"},Empty:{retry:"Retry"},Sidebar:{expand:"Expand",collapse:"Collapse",loading:"Loading",empty:"No data",loadError:"Failed to load"}},xe=Te;var V=ze.createContext(v),Z=ze.createContext(void 0),X=ze.createContext(-1);function ve({locale:e=v,site:o,dialog:t,children:n}){let r=ze.useContext(X)+1,a=ze.useContext(h),i=t?.zIndex,s=a.dialog.zIndex,l=ze.useMemo(()=>({dialog:{zIndex:i??s}}),[i,s]),c=ze.useRef();c.current||(c.current=A());let p=c.current,g=ze.useRef();g.current||(g.current=G());let m=g.current;z(p,o,r),q(m,l,r),ze.useEffect(()=>()=>{Y(p),j(m);},[m,p]);let d=jsxRuntime.jsx(X.Provider,{value:r,children:jsxRuntime.jsx(h.Provider,{value:l,children:jsxRuntime.jsx(Z.Provider,{value:o,children:jsxRuntime.jsxs(V.Provider,{value:e,children:[n,r===0&&jsxRuntime.jsx(J,{})]})})})});return r===0?jsxRuntime.jsx(chunkYSWFM6ML_js.c,{children:d}):d}ve.displayName="LingeeProvider";function he(){return ze.useContext(V)}function W(e){return he()[e]}function oo(){return ze.useContext(Z)}var _e={info:jsxRuntime.jsx(lingeeIcon.ExclamationCircleFill,{size:20}),success:jsxRuntime.jsx(lingeeIcon.CheckCircleFill,{size:20}),warning:jsxRuntime.jsx(lingeeIcon.ExclamationCircleFill1,{size:20}),error:jsxRuntime.jsx(lingeeIcon.XCircleFill,{size:20})};function $({type:e,content:o,icon:t,closable:n,className:r,onClose:a}){let i=W("Toast"),s=()=>{if(t===null)return null;let l=t!==void 0?t:_e[e];return jsxRuntime.jsx("span",{className:"lg-toast__icon",children:l})};return jsxRuntime.jsxs("div",{className:chunkDCDWEVW4_js.a("lg-toast",`lg-toast--${e}`,r),children:[s(),jsxRuntime.jsx("span",{className:"lg-toast__content",children:o}),n&&jsxRuntime.jsx("button",{className:"lg-toast__close",onClick:a,"aria-label":i.close,type:"button",children:jsxRuntime.jsx(lingeeIcon.XLg,{size:16})})]})}var ee="lingee-web-bridge",oe="1.0.0",De="host",Ne="iframe",Re="lingee-web-bridge:host-toast-show",He="lingee-web-bridge:host-toast-dismiss",Ie="lingee-web-bridge:host-toast-probe",Me="lingee-web-bridge:host-toast-ready";function te(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();let e=Date.now();return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,o=>{let t=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(o==="x"?t:t&3|8).toString(16)})}function Oe(e,o){return {_protocol:ee,_version:oe,_source:e,_nonce:te(),_traceId:"",payload:o}}function Fe(e,o){if(typeof e!="object"||e===null)return false;let t=e;return t._protocol===ee&&t._version===oe&&t._source===o&&typeof t._nonce=="string"&&"payload"in t}function y(){return typeof window<"u"&&window.parent!==window}var C=false,f=new Map,Q=false;function Ae(e){if(!Fe(e,De))return false;let o=e.payload;return !!o&&typeof o=="object"&&o.type===Me}function R(e){window.parent.postMessage(Oe(Ne,e),"*");}function w(){Q||!y()||(Q=true,window.addEventListener("message",e=>{e.source===window.parent&&Ae(e.data)&&(C=true);}),window.addEventListener("pagehide",()=>{!C||f.size===0||k();}),R({type:Ie}));}function H(){return w(),C}function ne(e){if(w(),!C||!e.content)return null;let o=te();R({type:Re,toastId:o,content:e.content.slice(0,500),level:e.level,duration:e.duration,key:e.key});let t=e.duration??3e3,n=t>0?window.setTimeout(()=>f.delete(o),t+500):void 0;return f.set(o,n),o}function k(e){if(w(),!!C){if(e){let o=f.get(e);o!==void 0&&window.clearTimeout(o),f.delete(e);}else f.forEach(o=>{o!==void 0&&window.clearTimeout(o);}),f.clear();R({type:He,toastId:e});}}w();function I(){if(!(typeof window>"u"))return window.lingeeBridge}function re(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e)}function ie(e,o={}){return !(!(y()?H():E()&&typeof I()?.showToast=="function")||re(e.content)===void 0||e.icon!==void 0||e.className!==void 0||e.closable||o.getContainer!==void 0||o.top!==void 0||o.maxCount!==void 0)}function ae(e,o,t,n={}){let r=re(o.content);if(r===void 0)return null;let a={level:e,content:r,duration:t,key:o.key};if(y()){let d=ne(a);return d?(n.onAccepted?.(),{dismiss:()=>k(d)}):null}let i=I(),s=i?.showToast;if(!s)return null;let l=null,c=null,p=false,g=false,m=()=>{p||g||c||(c=n.onFallback?.()??null);};return Promise.resolve().then(()=>s(a)).then(d=>{if(!d?.ok||!d.toastId){m();return}if(g=true,l=d.toastId,p){i?.dismissToast?.(l);return}n.onAccepted?.();}).catch(d=>{console.error("[lingee-ui] showToast failed:",d),m();}),{dismiss:()=>{if(!p){if(p=true,c){c(),c=null;return}l&&i?.dismissToast?.(l);}}}}function se(){if(y())return H()?(k(),true):false;let e=I();return !E()||typeof e?.dismissToast!="function"?false:(e.dismissToast().catch(o=>{console.error("[lingee-ui] dismissToast failed:",o);}),true)}var T={};function J(){let e=T.top??16;return jsxRuntime.jsx(sonner.Toaster,{position:"top-center",offset:e,gap:8,closeButton:false,toastOptions:{unstyled:true,className:"lg-toast-wrapper"},style:{"--width":"560px"}})}function Be(e){let o=e[0];return typeof o=="object"&&o!==null&&!ze__default.default.isValidElement(o)?o:{content:o,duration:e[1],onClose:e[2]}}function le(e,o,t,n=()=>o.onClose?.()){let r=t===0?1/0:t,a=false,i=()=>{a||(a=true,n());},s=sonner.toast.custom(l=>jsxRuntime.jsx($,{type:e,content:o.content,icon:o.icon,closable:o.closable,className:o.className,onClose:()=>sonner.toast.dismiss(l)}),{...o.key!==void 0&&{id:o.key},duration:r,onAutoClose:i,onDismiss:i});return ()=>{sonner.toast.dismiss(s),i();}}var L=new Set;function Ue(e,o){let t=o.duration!==void 0?o.duration<0?T.duration??3e3:o.duration:T.duration??3e3;if(ie(o,T)){let n=false,r,a=()=>{},i=()=>{n||(n=true,r!==void 0&&clearTimeout(r),L.delete(a),o.onClose?.());},s=ae(e,o,t,{onAccepted:()=>{t>0&&!n&&(r=setTimeout(i,t));},onFallback:()=>le(e,{...o,onClose:void 0},t,i)});if(s)return a=()=>{n||(s.dismiss(),i());},L.add(a),a}return le(e,o,t)}function S(e){return (...o)=>{let t=Be(o);return Ue(e,t)}}var ko={info:S("info"),success:S("success"),warning:S("warning"),error:S("error"),destroy:()=>{Array.from(L).forEach(e=>e()),L.clear(),se(),sonner.toast.dismiss();},config:e=>{T={...T,...e};}};exports.a=E;exports.b=J;exports.c=ko;exports.d=v;exports.e=ge;exports.f=me;exports.g=xe;exports.h=ve;exports.i=he;exports.j=W;exports.k=oo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {c}from'./chunk-VV2IBN64.mjs';import {a}from'./chunk-DN2VKVCV.mjs';import ze,{createContext,useContext,useMemo,useRef,useEffect}from'react';import {Toaster,toast}from'sonner';import {XCircleFill,ExclamationCircleFill1,CheckCircleFill,ExclamationCircleFill,XLg}from'lingee-icon';import {jsx,jsxs}from'react/jsx-runtime';var ce={locale:"zh-CN",Button:{},Breadcrumb:{more:"\u66F4\u591A",back:"\u8FD4\u56DE"},Select:{loading:"\u52A0\u8F7D\u4E2D",loadError:"\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",loadFailed:"\u52A0\u8F7D\u5931\u8D25",notFound:"\u641C\u7D22\u65E0\u7ED3\u679C",clear:"\u6E05\u7A7A"},Dropdown:{clear:"\u6E05\u9664",loading:"\u52A0\u8F7D\u4E2D",loadError:"\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",empty:"\u6682\u65E0\u6570\u636E"},Tabs:{scrollLeft:"\u5411\u5DE6\u6EDA\u52A8",scrollRight:"\u5411\u53F3\u6EDA\u52A8"},Carousel:{carousel:"\u8F6E\u64AD",prev:"\u4E0A\u4E00\u5F20",next:"\u4E0B\u4E00\u5F20",goToPage:"\u8DF3\u8F6C\u5230\u7B2C {page} \u5F20"},Form:{required:"{label}\u4E0D\u80FD\u4E3A\u7A7A",requiredNoLabel:"\u6B64\u9879\u4E0D\u80FD\u4E3A\u7A7A"},Tag:{close:"\u5173\u95ED"},Upload:{retry:"\u91CD\u65B0\u4E0A\u4F20",remove:"\u79FB\u9664\u6587\u4EF6",removeShort:"\u79FB\u9664",dragText:"\u62D6\u62FD\u6587\u4EF6\u5230\u6B64\u5904\uFF0C\u6216",clickUpload:"\u70B9\u51FB\u4E0A\u4F20"},ColorPicker:{placeholder:"\u8BF7\u9009\u62E9\u989C\u8272"},DatePicker:{placeholder:"\u5E74/\u6708/\u65E5",today:"\u4ECA\u5929",prevYear:"\u4E0A\u4E00\u5E74",nextYear:"\u4E0B\u4E00\u5E74",prevMonth:"\u4E0A\u4E00\u6708",nextMonth:"\u4E0B\u4E00\u6708",prevDecade:"\u4E0A\u4E00\u7EC4\u5E74\u4EFD",nextDecade:"\u4E0B\u4E00\u7EC4\u5E74\u4EFD",months:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],yearFormat:"{year}\u5E74",monthFormat:"{month}\u6708"},RangePicker:{startPlaceholder:"\u5E74/\u6708/\u65E5",endPlaceholder:"\u5E74/\u6708/\u65E5"},TimePicker:{now:"\u73B0\u5728",confirm:"\u786E\u5B9A",placeholder:"\u65F6:\u5206",placeholderFull:"\u65F6:\u5206:\u79D2"},Table:{empty:"\u6682\u65E0\u6570\u636E"},Tree:{empty:"\u6682\u65E0\u6570\u636E"},Pagination:{total:"\u5171 {total} \u6761",prevPage:"\u4E0A\u4E00\u9875",nextPage:"\u4E0B\u4E00\u9875",itemsPerPage:"{size}\u6761/\u9875",jumpTo:"\u8DF3\u81F3",page:"\u9875"},Dialog:{close:"\u5173\u95ED"},Drawer:{close:"\u5173\u95ED"},Input:{clear:"\u6E05\u7A7A",expand:"\u5C55\u5F00\u8F93\u5165\u6846"},Alert:{close:"\u5173\u95ED"},Toast:{close:"\u5173\u95ED\u6D88\u606F"},Spin:{loading:"\u52A0\u8F7D\u4E2D"},Empty:{retry:"\u91CD\u8BD5"},Sidebar:{expand:"\u5C55\u5F00",collapse:"\u6536\u8D77",loading:"\u52A0\u8F7D\u4E2D",empty:"\u6682\u65E0\u6570\u636E",loadError:"\u52A0\u8F7D\u5931\u8D25"}},v=ce;var _=new Map,F=0;function A(){return F+=1,{id:F}}function z(e,o,t){_.set(e.id,{site:o,depth:t});}function Y(e){_.delete(e.id);}function pe(){let e;for(let o of _.values())(!e||o.depth>=e.depth)&&(e=o);return e?.site}function E(){return pe()==="lingee"}var U={dialog:{}},h=createContext(U),D=new Map,B=0;function G(){return B+=1,{id:B}}function q(e,o,t){D.set(e.id,{config:o,depth:t});}function j(e){D.delete(e.id);}function ge(){let e;for(let o of D.values())(!e||o.depth>=e.depth)&&(e=o);return e?.config??U}function me(){return useContext(h)}var Te={locale:"en-US",Button:{},Breadcrumb:{more:"More",back:"Back"},Select:{loading:"Loading",loadError:"Failed to load, please retry",loadFailed:"Failed to load",notFound:"No results found",clear:"Clear"},Dropdown:{clear:"Clear",loading:"Loading",loadError:"Failed to load, please retry",empty:"No data"},Tabs:{scrollLeft:"Scroll left",scrollRight:"Scroll right"},Carousel:{carousel:"Carousel",prev:"Previous slide",next:"Next slide",goToPage:"Go to slide {page}"},Form:{required:"{label} is required",requiredNoLabel:"This field is required"},Tag:{close:"Close"},Upload:{retry:"Retry upload",remove:"Remove file",removeShort:"Remove",dragText:"Drag files here, or ",clickUpload:"click to upload"},ColorPicker:{placeholder:"Select a color"},DatePicker:{placeholder:"YYYY/MM/DD",today:"Today",prevYear:"Previous year",nextYear:"Next year",prevMonth:"Previous month",nextMonth:"Next month",prevDecade:"Previous decade",nextDecade:"Next decade",months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yearFormat:"{year}",monthFormat:"{month}"},RangePicker:{startPlaceholder:"Start date",endPlaceholder:"End date"},TimePicker:{now:"Now",confirm:"OK",placeholder:"HH:mm",placeholderFull:"HH:mm:ss"},Table:{empty:"No data"},Tree:{empty:"No data"},Pagination:{total:"{total} items",prevPage:"Previous page",nextPage:"Next page",itemsPerPage:"{size} / page",jumpTo:"Go to",page:""},Dialog:{close:"Close"},Drawer:{close:"Close"},Input:{clear:"Clear",expand:"Expand input"},Alert:{close:"Close"},Toast:{close:"Close message"},Spin:{loading:"Loading"},Empty:{retry:"Retry"},Sidebar:{expand:"Expand",collapse:"Collapse",loading:"Loading",empty:"No data",loadError:"Failed to load"}},xe=Te;var V=createContext(v),Z=createContext(void 0),X=createContext(-1);function ve({locale:e=v,site:o,dialog:t,children:n}){let r=useContext(X)+1,a=useContext(h),i=t?.zIndex,s=a.dialog.zIndex,l=useMemo(()=>({dialog:{zIndex:i??s}}),[i,s]),c$1=useRef();c$1.current||(c$1.current=A());let p=c$1.current,g=useRef();g.current||(g.current=G());let m=g.current;z(p,o,r),q(m,l,r),useEffect(()=>()=>{Y(p),j(m);},[m,p]);let d=jsx(X.Provider,{value:r,children:jsx(h.Provider,{value:l,children:jsx(Z.Provider,{value:o,children:jsxs(V.Provider,{value:e,children:[n,r===0&&jsx(J,{})]})})})});return r===0?jsx(c,{children:d}):d}ve.displayName="LingeeProvider";function he(){return useContext(V)}function W(e){return he()[e]}function oo(){return useContext(Z)}var _e={info:jsx(ExclamationCircleFill,{size:20}),success:jsx(CheckCircleFill,{size:20}),warning:jsx(ExclamationCircleFill1,{size:20}),error:jsx(XCircleFill,{size:20})};function $({type:e,content:o,icon:t,closable:n,className:r,onClose:a$1}){let i=W("Toast"),s=()=>{if(t===null)return null;let l=t!==void 0?t:_e[e];return jsx("span",{className:"lg-toast__icon",children:l})};return jsxs("div",{className:a("lg-toast",`lg-toast--${e}`,r),children:[s(),jsx("span",{className:"lg-toast__content",children:o}),n&&jsx("button",{className:"lg-toast__close",onClick:a$1,"aria-label":i.close,type:"button",children:jsx(XLg,{size:16})})]})}var ee="lingee-web-bridge",oe="1.0.0",De="host",Ne="iframe",Re="lingee-web-bridge:host-toast-show",He="lingee-web-bridge:host-toast-dismiss",Ie="lingee-web-bridge:host-toast-probe",Me="lingee-web-bridge:host-toast-ready";function te(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();let e=Date.now();return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,o=>{let t=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(o==="x"?t:t&3|8).toString(16)})}function Oe(e,o){return {_protocol:ee,_version:oe,_source:e,_nonce:te(),_traceId:"",payload:o}}function Fe(e,o){if(typeof e!="object"||e===null)return false;let t=e;return t._protocol===ee&&t._version===oe&&t._source===o&&typeof t._nonce=="string"&&"payload"in t}function y(){return typeof window<"u"&&window.parent!==window}var C=false,f=new Map,Q=false;function Ae(e){if(!Fe(e,De))return false;let o=e.payload;return !!o&&typeof o=="object"&&o.type===Me}function R(e){window.parent.postMessage(Oe(Ne,e),"*");}function w(){Q||!y()||(Q=true,window.addEventListener("message",e=>{e.source===window.parent&&Ae(e.data)&&(C=true);}),window.addEventListener("pagehide",()=>{!C||f.size===0||k();}),R({type:Ie}));}function H(){return w(),C}function ne(e){if(w(),!C||!e.content)return null;let o=te();R({type:Re,toastId:o,content:e.content.slice(0,500),level:e.level,duration:e.duration,key:e.key});let t=e.duration??3e3,n=t>0?window.setTimeout(()=>f.delete(o),t+500):void 0;return f.set(o,n),o}function k(e){if(w(),!!C){if(e){let o=f.get(e);o!==void 0&&window.clearTimeout(o),f.delete(e);}else f.forEach(o=>{o!==void 0&&window.clearTimeout(o);}),f.clear();R({type:He,toastId:e});}}w();function I(){if(!(typeof window>"u"))return window.lingeeBridge}function re(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e)}function ie(e,o={}){return !(!(y()?H():E()&&typeof I()?.showToast=="function")||re(e.content)===void 0||e.icon!==void 0||e.className!==void 0||e.closable||o.getContainer!==void 0||o.top!==void 0||o.maxCount!==void 0)}function ae(e,o,t,n={}){let r=re(o.content);if(r===void 0)return null;let a={level:e,content:r,duration:t,key:o.key};if(y()){let d=ne(a);return d?(n.onAccepted?.(),{dismiss:()=>k(d)}):null}let i=I(),s=i?.showToast;if(!s)return null;let l=null,c=null,p=false,g=false,m=()=>{p||g||c||(c=n.onFallback?.()??null);};return Promise.resolve().then(()=>s(a)).then(d=>{if(!d?.ok||!d.toastId){m();return}if(g=true,l=d.toastId,p){i?.dismissToast?.(l);return}n.onAccepted?.();}).catch(d=>{console.error("[lingee-ui] showToast failed:",d),m();}),{dismiss:()=>{if(!p){if(p=true,c){c(),c=null;return}l&&i?.dismissToast?.(l);}}}}function se(){if(y())return H()?(k(),true):false;let e=I();return !E()||typeof e?.dismissToast!="function"?false:(e.dismissToast().catch(o=>{console.error("[lingee-ui] dismissToast failed:",o);}),true)}var T={};function J(){let e=T.top??16;return jsx(Toaster,{position:"top-center",offset:e,gap:8,closeButton:false,toastOptions:{unstyled:true,className:"lg-toast-wrapper"},style:{"--width":"560px"}})}function Be(e){let o=e[0];return typeof o=="object"&&o!==null&&!ze.isValidElement(o)?o:{content:o,duration:e[1],onClose:e[2]}}function le(e,o,t,n=()=>o.onClose?.()){let r=t===0?1/0:t,a=false,i=()=>{a||(a=true,n());},s=toast.custom(l=>jsx($,{type:e,content:o.content,icon:o.icon,closable:o.closable,className:o.className,onClose:()=>toast.dismiss(l)}),{...o.key!==void 0&&{id:o.key},duration:r,onAutoClose:i,onDismiss:i});return ()=>{toast.dismiss(s),i();}}var L=new Set;function Ue(e,o){let t=o.duration!==void 0?o.duration<0?T.duration??3e3:o.duration:T.duration??3e3;if(ie(o,T)){let n=false,r,a=()=>{},i=()=>{n||(n=true,r!==void 0&&clearTimeout(r),L.delete(a),o.onClose?.());},s=ae(e,o,t,{onAccepted:()=>{t>0&&!n&&(r=setTimeout(i,t));},onFallback:()=>le(e,{...o,onClose:void 0},t,i)});if(s)return a=()=>{n||(s.dismiss(),i());},L.add(a),a}return le(e,o,t)}function S(e){return (...o)=>{let t=Be(o);return Ue(e,t)}}var ko={info:S("info"),success:S("success"),warning:S("warning"),error:S("error"),destroy:()=>{Array.from(L).forEach(e=>e()),L.clear(),se(),toast.dismiss();},config:e=>{T={...T,...e};}};export{E as a,J as b,ko as c,v as d,ge as e,me as f,xe as g,ve as h,he as i,W as j,oo as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var chunkHYN4Y4AW_js=require('./chunk-HYN4Y4AW.js'),
|
|
1
|
+
'use strict';var chunkHYN4Y4AW_js=require('./chunk-HYN4Y4AW.js'),chunkFHQEJ42C_js=require('./chunk-FHQEJ42C.js'),chunkDCDWEVW4_js=require('./chunk-DCDWEVW4.js'),Bl=require('react'),classVarianceAuthority=require('class-variance-authority'),s=require('@radix-ui/react-tabs'),lingeeIcon=require('lingee-icon'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Bl__default=/*#__PURE__*/_interopDefault(Bl);var s__namespace=/*#__PURE__*/_interopNamespace(s);var C={arrows:true,step:200,fade:true,scrollIntoView:true},Sl=classVarianceAuthority.cva("lg-tabs",{variants:{variant:{segmented:"lg-tabs--segmented",rounded:"lg-tabs--rounded",solid:"lg-tabs--solid",outline:"lg-tabs--outline",underline:"lg-tabs--underline"},size:{sm:"lg-tabs--sm",md:"lg-tabs--md"}},defaultVariants:{variant:"segmented",size:"md"}}),ol=typeof window<"u"?Bl.useLayoutEffect:Bl.useEffect;function Ll({items:o,activeKey:d,defaultActiveKey:tl,onChange:N,variant:i="segmented",size:nl="md",overflow:sl,scrollOptions:y,wrap:il=false,scrollable:bl=false,glassy:cl=false,transparent:dl=false,animated:B=true,destroyInactivePanel:M=false,className:ul,dir:fl,...vl},pl){let V=chunkFHQEJ42C_js.j("Tabs"),O=sl??(bl?"scroll":il?"wrap":"none"),X=O==="wrap"&&(i==="segmented"||i==="rounded")?"none":O,a=X==="scroll",A=X==="wrap",P=y?.arrows??C.arrows,T=y?.step??C.step,H=y?.fade??C.fade,$=y?.scrollIntoView??C.scrollIntoView,u=d!==void 0,ml=o.find(l=>!l.disabled)?.key,W=u?void 0:tl??ml,[hl,wl]=Bl.useState(W),t=u?d:hl,k=Bl.useRef(o.findIndex(l=>l.key===t)),[j,x]=Bl.useState("right"),_l=Bl.useCallback(l=>{let g=o.findIndex(_=>_.key===l),r=k.current;g>r?x("right"):g<r&&x("left"),k.current=g,u||wl(l),N?.(l);},[u,N,o]);Bl.useEffect(()=>{if(u&&d){let l=o.findIndex(r=>r.key===d),g=k.current;l!==g&&(l>g?x("right"):x("left"),k.current=l);}},[u,d,o]);let q=o.some(l=>l.children!=null),n=Bl.useRef(null),E=Bl.useRef(new Map),[Fl,R]=Bl.useState({opacity:0}),h=Bl.useRef(false),U=Bl.useRef(0),yl=Bl.useCallback(l=>g=>{g?E.current.set(l,g):E.current.delete(l);},[]),w=Bl.useCallback(l=>{let g=n.current,r=t?E.current.get(t):void 0;if(!g||!r){R(al=>al.opacity===0?al:{opacity:0});return}let _=g.getBoundingClientRect(),v=(i==="underline"?r.querySelector(".lg-tabs__tab-label")??r:r).getBoundingClientRect(),rl=v.left-_.left+g.scrollLeft;if(!A){R({width:v.width,transform:`translateX(${rl}px)`,opacity:1,transition:l?"transform var(--_tabs-slider-duration) var(--lg-transition-timing), width var(--_tabs-slider-duration) var(--lg-transition-timing)":"none"});return}let S=i==="underline",Cl=S?r.getBoundingClientRect():v,L=S?Cl.bottom-_.top:v.top-_.top,Dl=l&&Math.abs(L-U.current)>1;U.current=L,R({width:v.width,...S?null:{height:v.height},top:0,bottom:"auto",transform:`translate(${rl}px, ${L}px)`,opacity:1,transition:Dl?"opacity var(--_tabs-slider-duration) var(--lg-transition-timing)":l?"transform var(--_tabs-slider-duration) var(--lg-transition-timing), width var(--_tabs-slider-duration) var(--lg-transition-timing)":"none"});},[t,i,A]),Y=Bl.useRef(w);Y.current=w;let G=Bl.useRef(0);ol(()=>{let l=h.current;w(l),l&&(G.current=Date.now()),h.current=true;},[w,t]);let J=o.map(l=>`${l.key}:${l.disabled?1:0}`).join("|");ol(()=>{let l=h.current;h.current=false,w(false),h.current=l;},[J]),Bl.useEffect(()=>{if(!n.current)return;let l=new ResizeObserver(()=>{Date.now()-G.current<350||Y.current(false);});return l.observe(n.current),()=>l.disconnect()},[]);let[kl,Q]=Bl.useState(false),[Z,xl]=Bl.useState(false),[K,El]=Bl.useState(false),f=Bl.useCallback(()=>{let l=n.current;!l||!a||(Q(l.scrollWidth>l.clientWidth+1),xl(l.scrollLeft>1),El(l.scrollLeft+l.clientWidth<l.scrollWidth-1));},[a]);Bl.useEffect(()=>{if(!a){Q(false);return}let l=n.current;if(l)return f(),l.addEventListener("scroll",f),()=>l.removeEventListener("scroll",f)},[a,f,J]),Bl.useEffect(()=>{let l=n.current;if(!a||!l)return;let g=new ResizeObserver(()=>f());return g.observe(l),()=>g.disconnect()},[a,f]),Bl.useEffect(()=>{if(!a||!$||!t)return;let l=E.current.get(t);typeof l?.scrollIntoView=="function"&&l.scrollIntoView({behavior:"smooth",inline:"nearest",block:"nearest"});},[a,$,t]);let ll=Bl.useCallback((l,g)=>{let r=n.current;r&&(r.scrollBy({left:l==="left"?-T:T,behavior:"smooth"}),g&&g.detail>0&&g.currentTarget.blur());},[T]),z=a&&kl&&P!==false,gl=jsxRuntime.jsxs(s__namespace.List,{className:chunkDCDWEVW4_js.a("lg-tabs__list",a&&"lg-tabs__list--scrollable"),ref:n,children:[jsxRuntime.jsx("span",{className:chunkDCDWEVW4_js.a(`lg-tabs__slider lg-tabs__slider--${i}`,cl&&"lg-tabs__slider--glassy"),style:Fl,"aria-hidden":true}),o.map(l=>jsxRuntime.jsxs(s__namespace.Trigger,{value:l.key,disabled:l.disabled,ref:yl(l.key),"aria-label":l.ariaLabel,className:chunkDCDWEVW4_js.a("lg-tabs__tab",l.disabled&&"lg-tabs__tab--disabled"),children:[l.icon&&jsxRuntime.jsx("span",{className:"lg-tabs__tab-icon",children:l.icon}),jsxRuntime.jsx("span",{className:"lg-tabs__tab-label",children:l.label}),l.suffix!=null&&jsxRuntime.jsx("span",{className:"lg-tabs__tab-suffix",children:l.suffix})]},l.key))]});return jsxRuntime.jsxs(s__namespace.Root,{ref:pl,className:chunkDCDWEVW4_js.a(Sl({variant:i,size:nl}),A&&"lg-tabs--wrap",a&&"lg-tabs--scrollable",dl&&"lg-tabs--transparent",q&&"lg-tabs--has-content",ul),value:d,defaultValue:W,onValueChange:_l,dir:fl,...vl,children:[a?jsxRuntime.jsxs("div",{className:chunkDCDWEVW4_js.a("lg-tabs__scroll-wrapper",P==="hover"&&"lg-tabs__scroll-wrapper--hover-controls",!z&&"lg-tabs__scroll-wrapper--no-arrows"),children:[z&&jsxRuntime.jsx(chunkHYN4Y4AW_js.b,{shape:"circle",size:"sm",variant:"text",icon:jsxRuntime.jsx(lingeeIcon.ChevronLeft,{}),tooltip:V.scrollLeft,disabled:!Z,onClick:l=>ll("left",l),className:"lg-tabs__scroll-arrow lg-tabs__scroll-arrow--left"}),H&&Z&&jsxRuntime.jsx("span",{className:"lg-tabs__fade lg-tabs__fade--left","aria-hidden":true}),gl,H&&K&&jsxRuntime.jsx("span",{className:"lg-tabs__fade lg-tabs__fade--right","aria-hidden":true}),z&&jsxRuntime.jsx(chunkHYN4Y4AW_js.b,{shape:"circle",size:"sm",variant:"text",icon:jsxRuntime.jsx(lingeeIcon.ChevronRight,{}),tooltip:V.scrollRight,disabled:!K,onClick:l=>ll("right",l),className:"lg-tabs__scroll-arrow lg-tabs__scroll-arrow--right"})]}):gl,q&&jsxRuntime.jsx("div",{className:"lg-tabs__content-wrapper",children:o.map(l=>{if(l.children==null)return null;let g=l.key===t;return M&&!g?null:jsxRuntime.jsx(s__namespace.Content,{value:l.key,forceMount:M?void 0:true,className:chunkDCDWEVW4_js.a("lg-tabs__panel",B&&"lg-tabs__panel--animated",g&&"lg-tabs__panel--active",!g&&"lg-tabs__panel--inactive",B&&j==="right"&&"lg-tabs__panel--slide-right",B&&j==="left"&&"lg-tabs__panel--slide-left"),children:l.children},l.key)})})]})}var ql=Bl__default.default.forwardRef(Ll);exports.a=Sl;exports.b=ql;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {j}from'./chunk-
|
|
1
|
+
import {j}from'./chunk-G4FASWRJ.mjs';import {a}from'./chunk-DN2VKVCV.mjs';import ke,{useEffect,useMemo,useCallback}from'react';import Pe from'@rc-component/tree';import {DocumentLibrary,ChevronDown,Inbox,ExclamationCircle,LoaderCircle}from'lingee-icon';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var A=ke.forwardRef(({className:e,size:r="md",spinning:o=true,children:n,tip:a$1,...c},p)=>{let s=j("Spin"),i=n!=null,g=jsx("div",{className:"lg-spin__indicator"});return i?jsxs("div",{ref:p,className:a("lg-spin","lg-spin--nested",e),...c,children:[jsx("div",{className:a("lg-spin__content",o&&"lg-spin__content--loading"),children:n}),o&&jsxs("div",{className:"lg-spin__overlay",role:"status","aria-label":a$1||s.loading,children:[jsx("div",{className:a("lg-spin",`lg-spin--${r}`),children:g}),a$1&&jsx("span",{className:"lg-spin__tip",children:a$1})]})]}):jsx("div",{ref:p,className:a("lg-spin",`lg-spin--${r}`,!o&&"lg-spin--paused",e),role:"status","aria-label":a$1||s.loading,...c,children:g})});A.displayName="Spin";var Z="lg-empty-gradient",U=`url(#${Z})`,X=0,D=null;function Te(){if(X++>0||typeof document>"u")return;let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("width","0"),e.setAttribute("height","0"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.overflow="hidden",e.innerHTML=`<defs><linearGradient id="${Z}" x1="12" y1="2" x2="12" y2="22" gradientUnits="userSpaceOnUse"><stop style="stop-color: var(--__lg-empty-gradient-from)"/><stop offset="1" style="stop-color: var(--__lg-empty-gradient-to)"/></linearGradient></defs>`,document.body.appendChild(e),D=e;}function Ce(){--X>0||D&&(D.remove(),D=null);}var M={lg:56,md:24,sm:16};function De(e){return typeof e=="function"||typeof e=="object"&&e!==null&&"render"in e&&typeof e.render=="function"}var w=ke.forwardRef(({size:e="md",icon:r,description:o,className:n,style:a$1,...c},p)=>{useEffect(()=>(Te(),Ce),[]);let s=M[e],i;return r?De(r)?i=jsx(r,{size:s,fill:U}):i=r:i=jsx(DocumentLibrary,{size:s,fill:U}),jsxs("div",{ref:p,className:a("lg-empty",`lg-empty--${e}`,n),style:a$1,...c,children:[jsx("span",{className:"lg-empty__icon",children:i}),jsx("span",{className:"lg-empty__text",children:o})]})});w.displayName="Empty";function Ae(e,r){switch(e){case "loading":return jsx(LoaderCircle,{size:r,spin:true});case "error":return jsx(ExclamationCircle,{size:r});default:return jsx(Inbox,{size:r})}}var K=ke.forwardRef(({status:e,description:r,icon:o,size:n="sm",variant:a$1="block",spacing:c="normal",onRetry:p,className:s,style:i,...g},_)=>{let R=j("Empty"),I=o===null?null:o??Ae(e,M[n]),y=e==="error"&&typeof p=="function",E=a("lg-empty-card",`lg-empty-card--${n}`,`lg-empty-card--${a$1}`,`lg-empty-card--${e}`,`lg-empty-card--spacing-${c}`,y&&"lg-empty-card--retryable",s),N=y?jsxs(Fragment,{children:[r,jsx("span",{className:"lg-empty-card__retry",children:R.retry})]}):r,b=jsx(w,{size:n,icon:I??jsx(Fragment,{}),description:N,className:"lg-empty-card__body"});return y?jsx("button",{ref:_,type:"button",className:E,style:i,onClick:p,...g,children:b}):jsx("div",{ref:_,className:E,style:i,role:e==="empty"?void 0:"status","aria-live":e==="empty"?void 0:"polite",...g,children:b})});K.displayName="Empty.Card";var J=Object.assign(w,{Card:K});var Ge={sm:30,md:34,lg:38},P=()=>({height:0,opacity:0}),W=e=>{let r=Array.from(e.children);return r.length===0?0:r.reduce((o,n)=>{let a=parseFloat(getComputedStyle(n).marginTop)||0;return o+n.getBoundingClientRect().height+a},0)},Q=e=>({height:W(e),opacity:1}),$e={motionName:"lg-tree-motion",motionDeadline:300,onAppearStart:P,onAppearActive:Q,onEnterStart:P,onEnterActive:Q,onLeaveStart:e=>({height:W(e),opacity:1}),onLeaveActive:P},je=ke.forwardRef((e,r)=>{let{treeData:o,fieldNames:n,size:a$1="md",expandedKeys:c,defaultExpandedKeys:p,defaultExpandAll:s,autoExpandParent:i,expandAction:g="click",onExpand:_,selectable:R=true,multiple:I=false,selectedKeys:y,defaultSelectedKeys:E,onSelect:N,checkable:b=false,checkStrictly:Y=false,checkedKeys:H,defaultCheckedKeys:ee,onCheck:G,showIcon:te=false,icon:x,switcherIcon:v,indentGuide:re="line",titleRender:oe,loadData:ne,loadedKeys:$,draggable:T=false,allowDrop:L,onDrop:j$1,height:ae,itemHeight:ie,virtual:le,disabled:B=false,loading:O=false,empty:de,onRightClick:ce,animated:pe=true,className:se,style:ge}=e,me=j("Tree"),ye=useMemo(()=>{if(x)return typeof x!="function"?x:t=>x(t.data,{expanded:!!t.expanded,isLeaf:!!t.isLeaf})},[x]),fe=useMemo(()=>v!==void 0?typeof v!="function"?v:t=>v({expanded:!!t.expanded,isLeaf:!!t.isLeaf}):t=>t.isLeaf?null:jsx(ChevronDown,{className:"lg-tree__switcher-icon",size:16,"aria-hidden":true}),[v]),he=useMemo(()=>{if(T)return {icon:false,nodeDraggable:typeof T=="function"?t=>T(t):void 0}},[T]),ue=useCallback((t,l)=>{_?.(t,{node:l.node,expanded:l.expanded});},[_]),_e=useCallback((t,l)=>{N?.(t,{node:l.node,selected:l.selected,selectedNodes:l.selectedNodes});},[N]),be=useCallback((t,l)=>{G?.(t,{node:l.node,checked:l.checked,checkedNodes:l.checkedNodes,halfCheckedKeys:l.halfCheckedKeys});},[G]),xe=useCallback(t=>{j$1?.({dragNode:t.dragNode,node:t.node,dropPosition:t.dropPosition,dropToGap:t.dropToGap});},[j$1]),F=useMemo(()=>{if(L)return t=>L({dragNode:t.dragNode,dropNode:t.dropNode,dropPosition:t.dropPosition})},[L]),ve=!o||o.length===0,f={};return c!==void 0&&(f.expandedKeys=c),y!==void 0&&(f.selectedKeys=y),H!==void 0&&(f.checkedKeys=H),$!==void 0&&(f.loadedKeys=$),F!==void 0&&(f.allowDrop=F),jsxs("div",{ref:r,className:a("lg-tree",`lg-tree--${a$1}`,`lg-tree--guide-${re}`,b&&"lg-tree--checkable",B&&"lg-tree--disabled",O&&"lg-tree--loading",se),style:ge,children:[O&&jsx("div",{className:"lg-tree__loading-mask",children:jsx(A,{size:"md"})}),ve?jsx("div",{className:"lg-tree__empty",children:de??jsx(J,{size:"sm",description:me.empty})}):jsx(Pe,{prefixCls:"lg-tree",treeData:o,fieldNames:n,defaultExpandedKeys:p,defaultExpandAll:s,autoExpandParent:i,expandAction:g,onExpand:ue,selectable:R,multiple:I,defaultSelectedKeys:E,onSelect:_e,checkable:b,checkStrictly:Y,defaultCheckedKeys:ee,onCheck:be,showIcon:te,icon:ye,switcherIcon:fe,titleRender:oe,loadData:ne,draggable:he,onDrop:xe,height:ae,itemHeight:ie??Ge[a$1],virtual:le,disabled:B,onRightClick:ce,motion:pe?$e:void 0,...f})]})});je.displayName="Tree";
|
|
2
2
|
export{K as a,J as b,A as c,je as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-DN2VKVCV.mjs';import p from'react';import*as e from'@radix-ui/react-popover';import {jsx}from'react/jsx-runtime';var d="data-lg-modality",c=false;function l(o){document.documentElement.setAttribute(d,o);}function N(){return typeof document>"u"?false:document.documentElement.getAttribute(d)==="keyboard"}function v(){c||typeof document>"u"||(c=true,document.documentElement.hasAttribute(d)||l("keyboard"),document.addEventListener("pointerdown",()=>l("pointer"),true),document.addEventListener("keydown",o=>{(o.key==="Enter"||o.key===" "||o.key==="Tab"||o.key.startsWith("Arrow"))&&l("keyboard");},true));}function C({children:o,open:r,defaultOpen:t,onOpenChange:a,modal:i=false}){return p.useEffect(()=>{v();},[]),jsx(e.Root,{open:r,defaultOpen:t,onOpenChange:a,modal:i,children:o})}C.displayName="Popover";var k=p.forwardRef(({children:o,asChild:r=true,...t},a)=>jsx(e.Trigger,{ref:a,asChild:r,...t,children:o}));k.displayName="PopoverTrigger";var T=p.forwardRef(({children:o,asChild:r=true,...t},a)=>jsx(e.Anchor,{ref:a,asChild:r,...t,children:o}));T.displayName="PopoverAnchor";var E=p.forwardRef(({children:o,className:r,side:t="bottom",align:a$1="center",sideOffset:i=4,alignOffset:P=0,container:m,collisionPadding:g=8,onEscapeKeyDown:u,onPointerDownOutside:y,onFocusOutside:x,onInteractOutside:h,onOpenAutoFocus:w,onCloseAutoFocus:b,...R},A)=>{let f=jsx(e.Content,{ref:A,className:a("lg-popover",r),side:t,align:a$1,sideOffset:i,alignOffset:P,collisionPadding:g,onEscapeKeyDown:u,onPointerDownOutside:y,onFocusOutside:x,onInteractOutside:h,onOpenAutoFocus:w,onCloseAutoFocus:b,...R,children:o});return m===null?f:jsx(e.Portal,{container:m,children:f})});E.displayName="PopoverContent";var L=p.forwardRef(({className:o,width:r=10,height:t=5,...a$1},i)=>jsx(e.Arrow,{ref:i,className:a("lg-popover__arrow",o),width:r,height:t,...a$1}));L.displayName="PopoverArrow";var M=p.forwardRef(({children:o,asChild:r=true,...t},a)=>jsx(e.Close,{ref:a,asChild:r,...t,children:o}));M.displayName="PopoverClose";export{N as a,v as b,C as c,k as d,T as e,E as f,L as g,M as h};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkFHQEJ42C_js=require('./chunk-FHQEJ42C.js'),chunkDCDWEVW4_js=require('./chunk-DCDWEVW4.js'),ke=require('react'),Pe=require('@rc-component/tree'),lingeeIcon=require('lingee-icon'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var ke__default=/*#__PURE__*/_interopDefault(ke);var Pe__default=/*#__PURE__*/_interopDefault(Pe);var A=ke__default.default.forwardRef(({className:e,size:r="md",spinning:o=true,children:n,tip:a,...c},p)=>{let s=chunkFHQEJ42C_js.j("Spin"),i=n!=null,g=jsxRuntime.jsx("div",{className:"lg-spin__indicator"});return i?jsxRuntime.jsxs("div",{ref:p,className:chunkDCDWEVW4_js.a("lg-spin","lg-spin--nested",e),...c,children:[jsxRuntime.jsx("div",{className:chunkDCDWEVW4_js.a("lg-spin__content",o&&"lg-spin__content--loading"),children:n}),o&&jsxRuntime.jsxs("div",{className:"lg-spin__overlay",role:"status","aria-label":a||s.loading,children:[jsxRuntime.jsx("div",{className:chunkDCDWEVW4_js.a("lg-spin",`lg-spin--${r}`),children:g}),a&&jsxRuntime.jsx("span",{className:"lg-spin__tip",children:a})]})]}):jsxRuntime.jsx("div",{ref:p,className:chunkDCDWEVW4_js.a("lg-spin",`lg-spin--${r}`,!o&&"lg-spin--paused",e),role:"status","aria-label":a||s.loading,...c,children:g})});A.displayName="Spin";var Z="lg-empty-gradient",U=`url(#${Z})`,X=0,D=null;function Te(){if(X++>0||typeof document>"u")return;let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("width","0"),e.setAttribute("height","0"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.overflow="hidden",e.innerHTML=`<defs><linearGradient id="${Z}" x1="12" y1="2" x2="12" y2="22" gradientUnits="userSpaceOnUse"><stop style="stop-color: var(--__lg-empty-gradient-from)"/><stop offset="1" style="stop-color: var(--__lg-empty-gradient-to)"/></linearGradient></defs>`,document.body.appendChild(e),D=e;}function Ce(){--X>0||D&&(D.remove(),D=null);}var M={lg:56,md:24,sm:16};function De(e){return typeof e=="function"||typeof e=="object"&&e!==null&&"render"in e&&typeof e.render=="function"}var w=ke__default.default.forwardRef(({size:e="md",icon:r,description:o,className:n,style:a,...c},p)=>{ke.useEffect(()=>(Te(),Ce),[]);let s=M[e],i;return r?De(r)?i=jsxRuntime.jsx(r,{size:s,fill:U}):i=r:i=jsxRuntime.jsx(lingeeIcon.DocumentLibrary,{size:s,fill:U}),jsxRuntime.jsxs("div",{ref:p,className:chunkDCDWEVW4_js.a("lg-empty",`lg-empty--${e}`,n),style:a,...c,children:[jsxRuntime.jsx("span",{className:"lg-empty__icon",children:i}),jsxRuntime.jsx("span",{className:"lg-empty__text",children:o})]})});w.displayName="Empty";function Ae(e,r){switch(e){case "loading":return jsxRuntime.jsx(lingeeIcon.LoaderCircle,{size:r,spin:true});case "error":return jsxRuntime.jsx(lingeeIcon.ExclamationCircle,{size:r});default:return jsxRuntime.jsx(lingeeIcon.Inbox,{size:r})}}var K=ke__default.default.forwardRef(({status:e,description:r,icon:o,size:n="sm",variant:a="block",spacing:c="normal",onRetry:p,className:s,style:i,...g},_)=>{let R=chunkFHQEJ42C_js.j("Empty"),I=o===null?null:o??Ae(e,M[n]),y=e==="error"&&typeof p=="function",E=chunkDCDWEVW4_js.a("lg-empty-card",`lg-empty-card--${n}`,`lg-empty-card--${a}`,`lg-empty-card--${e}`,`lg-empty-card--spacing-${c}`,y&&"lg-empty-card--retryable",s),N=y?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r,jsxRuntime.jsx("span",{className:"lg-empty-card__retry",children:R.retry})]}):r,b=jsxRuntime.jsx(w,{size:n,icon:I??jsxRuntime.jsx(jsxRuntime.Fragment,{}),description:N,className:"lg-empty-card__body"});return y?jsxRuntime.jsx("button",{ref:_,type:"button",className:E,style:i,onClick:p,...g,children:b}):jsxRuntime.jsx("div",{ref:_,className:E,style:i,role:e==="empty"?void 0:"status","aria-live":e==="empty"?void 0:"polite",...g,children:b})});K.displayName="Empty.Card";var J=Object.assign(w,{Card:K});var Ge={sm:30,md:34,lg:38},P=()=>({height:0,opacity:0}),W=e=>{let r=Array.from(e.children);return r.length===0?0:r.reduce((o,n)=>{let a=parseFloat(getComputedStyle(n).marginTop)||0;return o+n.getBoundingClientRect().height+a},0)},Q=e=>({height:W(e),opacity:1}),$e={motionName:"lg-tree-motion",motionDeadline:300,onAppearStart:P,onAppearActive:Q,onEnterStart:P,onEnterActive:Q,onLeaveStart:e=>({height:W(e),opacity:1}),onLeaveActive:P},je=ke__default.default.forwardRef((e,r)=>{let{treeData:o,fieldNames:n,size:a="md",expandedKeys:c,defaultExpandedKeys:p,defaultExpandAll:s,autoExpandParent:i,expandAction:g="click",onExpand:_,selectable:R=true,multiple:I=false,selectedKeys:y,defaultSelectedKeys:E,onSelect:N,checkable:b=false,checkStrictly:Y=false,checkedKeys:H,defaultCheckedKeys:ee,onCheck:G,showIcon:te=false,icon:x,switcherIcon:v,indentGuide:re="line",titleRender:oe,loadData:ne,loadedKeys:$,draggable:T=false,allowDrop:L,onDrop:j,height:ae,itemHeight:ie,virtual:le,disabled:B=false,loading:O=false,empty:de,onRightClick:ce,animated:pe=true,className:se,style:ge}=e,me=chunkFHQEJ42C_js.j("Tree"),ye=ke.useMemo(()=>{if(x)return typeof x!="function"?x:t=>x(t.data,{expanded:!!t.expanded,isLeaf:!!t.isLeaf})},[x]),fe=ke.useMemo(()=>v!==void 0?typeof v!="function"?v:t=>v({expanded:!!t.expanded,isLeaf:!!t.isLeaf}):t=>t.isLeaf?null:jsxRuntime.jsx(lingeeIcon.ChevronDown,{className:"lg-tree__switcher-icon",size:16,"aria-hidden":true}),[v]),he=ke.useMemo(()=>{if(T)return {icon:false,nodeDraggable:typeof T=="function"?t=>T(t):void 0}},[T]),ue=ke.useCallback((t,l)=>{_?.(t,{node:l.node,expanded:l.expanded});},[_]),_e=ke.useCallback((t,l)=>{N?.(t,{node:l.node,selected:l.selected,selectedNodes:l.selectedNodes});},[N]),be=ke.useCallback((t,l)=>{G?.(t,{node:l.node,checked:l.checked,checkedNodes:l.checkedNodes,halfCheckedKeys:l.halfCheckedKeys});},[G]),xe=ke.useCallback(t=>{j?.({dragNode:t.dragNode,node:t.node,dropPosition:t.dropPosition,dropToGap:t.dropToGap});},[j]),F=ke.useMemo(()=>{if(L)return t=>L({dragNode:t.dragNode,dropNode:t.dropNode,dropPosition:t.dropPosition})},[L]),ve=!o||o.length===0,f={};return c!==void 0&&(f.expandedKeys=c),y!==void 0&&(f.selectedKeys=y),H!==void 0&&(f.checkedKeys=H),$!==void 0&&(f.loadedKeys=$),F!==void 0&&(f.allowDrop=F),jsxRuntime.jsxs("div",{ref:r,className:chunkDCDWEVW4_js.a("lg-tree",`lg-tree--${a}`,`lg-tree--guide-${re}`,b&&"lg-tree--checkable",B&&"lg-tree--disabled",O&&"lg-tree--loading",se),style:ge,children:[O&&jsxRuntime.jsx("div",{className:"lg-tree__loading-mask",children:jsxRuntime.jsx(A,{size:"md"})}),ve?jsxRuntime.jsx("div",{className:"lg-tree__empty",children:de??jsxRuntime.jsx(J,{size:"sm",description:me.empty})}):jsxRuntime.jsx(Pe__default.default,{prefixCls:"lg-tree",treeData:o,fieldNames:n,defaultExpandedKeys:p,defaultExpandAll:s,autoExpandParent:i,expandAction:g,onExpand:ue,selectable:R,multiple:I,defaultSelectedKeys:E,onSelect:_e,checkable:b,checkStrictly:Y,defaultCheckedKeys:ee,onCheck:be,showIcon:te,icon:ye,switcherIcon:fe,titleRender:oe,loadData:ne,draggable:he,onDrop:xe,height:ae,itemHeight:ie??Ge[a],virtual:le,disabled:B,onRightClick:ce,motion:pe?$e:void 0,...f})]})});je.displayName="Tree";
|
|
2
2
|
exports.a=K;exports.b=J;exports.c=A;exports.d=je;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkFHQEJ42C_js=require('./chunk-FHQEJ42C.js'),chunkDCDWEVW4_js=require('./chunk-DCDWEVW4.js'),G=require('react'),lingeeIcon=require('lingee-icon'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var G__default=/*#__PURE__*/_interopDefault(G);var U=G__default.default.forwardRef(({className:l,style:o,size:a="md",shape:M="default",prefix:d,suffix:s,allowClear:T=false,error:C=false,disabled:r=false,collapsed:t=false,value:g,defaultValue:L,onChange:c,onFocus:_,onBlur:f,onPressEnter:v,onKeyDown:h,onClick:b,...H},S)=>{let m=chunkFHQEJ42C_js.j("Input"),[N,x]=G.useState(false),[D,y]=G.useState(L?.toString()??""),e=G.useRef(null),F=Y(S,e),u=g!==void 0,w=u?g?.toString()??"":D,O=G.useCallback(n=>{u||y(n.target.value),c?.(n);},[u,c]),P=G.useCallback(()=>{if(r)return;u||y("");let n=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value")?.set;if(e.current&&n){n.call(e.current,"");let A=new Event("input",{bubbles:true});e.current.dispatchEvent(A);}e.current?.focus();},[r,u]),V=G.useCallback(n=>{x(true),_?.(n);},[_]),j=G.useCallback(n=>{x(false),f?.(n);},[f]),B=G.useCallback(n=>{n.key==="Enter"&&v?.(n),h?.(n);},[v,h]),K=T&&w.length>0&&!r&&!t,W=!!s&&!(t&&d),k=G.useRef(t);G.useEffect(()=>{let n=k.current;k.current=t,n!==t&&(t?e.current===document.activeElement&&e.current?.blur():r||e.current?.focus());},[t,r]);let X=G.useCallback(n=>{t||e.current?.focus(),b?.(n);},[t,b]),$=chunkDCDWEVW4_js.a("lg-input",`lg-input--${a}`,M==="round"&&"lg-input--round",N&&!t&&"lg-input--focused",C&&"lg-input--error",r&&"lg-input--disabled",t&&"lg-input--collapsed",l),q=t?{...o,width:void 0,minWidth:void 0,maxWidth:void 0}:o;return jsxRuntime.jsxs("div",{className:$,style:q,onClick:X,role:t?"button":void 0,tabIndex:t&&!r?0:void 0,"aria-expanded":t?false:void 0,"aria-label":t?m.expand:void 0,children:[d&&jsxRuntime.jsx("span",{className:"lg-input__prefix",children:d}),jsxRuntime.jsx("input",{ref:F,className:"lg-input__inner",disabled:r,value:w,onChange:O,onFocus:V,onBlur:j,onKeyDown:B,tabIndex:t?-1:void 0,"aria-hidden":t||void 0,...H}),K&&jsxRuntime.jsx("span",{className:"lg-input__clear",onMouseDown:n=>n.preventDefault(),onClick:P,role:"button","aria-label":m.clear,children:jsxRuntime.jsx(lingeeIcon.XCircleFill,{})}),W&&jsxRuntime.jsx("span",{className:"lg-input__suffix",children:s})]})});U.displayName="Input";function Y(...l){return G.useCallback(o=>{l.forEach(a=>{a&&(typeof a=="function"?a(o):a.current=o);});},l)}exports.a=U;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkDCDWEVW4_js=require('./chunk-DCDWEVW4.js'),p=require('react'),e=require('@radix-ui/react-popover'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var p__default=/*#__PURE__*/_interopDefault(p);var e__namespace=/*#__PURE__*/_interopNamespace(e);var d="data-lg-modality",c=false;function l(o){document.documentElement.setAttribute(d,o);}function N(){return typeof document>"u"?false:document.documentElement.getAttribute(d)==="keyboard"}function v(){c||typeof document>"u"||(c=true,document.documentElement.hasAttribute(d)||l("keyboard"),document.addEventListener("pointerdown",()=>l("pointer"),true),document.addEventListener("keydown",o=>{(o.key==="Enter"||o.key===" "||o.key==="Tab"||o.key.startsWith("Arrow"))&&l("keyboard");},true));}function C({children:o,open:r,defaultOpen:t,onOpenChange:a,modal:i=false}){return p__default.default.useEffect(()=>{v();},[]),jsxRuntime.jsx(e__namespace.Root,{open:r,defaultOpen:t,onOpenChange:a,modal:i,children:o})}C.displayName="Popover";var k=p__default.default.forwardRef(({children:o,asChild:r=true,...t},a)=>jsxRuntime.jsx(e__namespace.Trigger,{ref:a,asChild:r,...t,children:o}));k.displayName="PopoverTrigger";var T=p__default.default.forwardRef(({children:o,asChild:r=true,...t},a)=>jsxRuntime.jsx(e__namespace.Anchor,{ref:a,asChild:r,...t,children:o}));T.displayName="PopoverAnchor";var E=p__default.default.forwardRef(({children:o,className:r,side:t="bottom",align:a="center",sideOffset:i=4,alignOffset:P=0,container:m,collisionPadding:g=8,onEscapeKeyDown:u,onPointerDownOutside:y,onFocusOutside:x,onInteractOutside:h,onOpenAutoFocus:w,onCloseAutoFocus:b,...R},A)=>{let f=jsxRuntime.jsx(e__namespace.Content,{ref:A,className:chunkDCDWEVW4_js.a("lg-popover",r),side:t,align:a,sideOffset:i,alignOffset:P,collisionPadding:g,onEscapeKeyDown:u,onPointerDownOutside:y,onFocusOutside:x,onInteractOutside:h,onOpenAutoFocus:w,onCloseAutoFocus:b,...R,children:o});return m===null?f:jsxRuntime.jsx(e__namespace.Portal,{container:m,children:f})});E.displayName="PopoverContent";var L=p__default.default.forwardRef(({className:o,width:r=10,height:t=5,...a},i)=>jsxRuntime.jsx(e__namespace.Arrow,{ref:i,className:chunkDCDWEVW4_js.a("lg-popover__arrow",o),width:r,height:t,...a}));L.displayName="PopoverArrow";var M=p__default.default.forwardRef(({children:o,asChild:r=true,...t},a)=>jsxRuntime.jsx(e__namespace.Close,{ref:a,asChild:r,...t,children:o}));M.displayName="PopoverClose";exports.a=N;exports.b=v;exports.c=C;exports.d=k;exports.e=T;exports.f=E;exports.g=L;exports.h=M;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-B6CAD73P.mjs';import {j}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-B6CAD73P.mjs';import {j}from'./chunk-G4FASWRJ.mjs';import {a}from'./chunk-DN2VKVCV.mjs';import Bl,{useState,useRef,useCallback,useEffect,useLayoutEffect}from'react';import {cva}from'class-variance-authority';import*as s from'@radix-ui/react-tabs';import {ChevronLeft,ChevronRight}from'lingee-icon';import {jsxs,jsx}from'react/jsx-runtime';var C={arrows:true,step:200,fade:true,scrollIntoView:true},Sl=cva("lg-tabs",{variants:{variant:{segmented:"lg-tabs--segmented",rounded:"lg-tabs--rounded",solid:"lg-tabs--solid",outline:"lg-tabs--outline",underline:"lg-tabs--underline"},size:{sm:"lg-tabs--sm",md:"lg-tabs--md"}},defaultVariants:{variant:"segmented",size:"md"}}),ol=typeof window<"u"?useLayoutEffect:useEffect;function Ll({items:o,activeKey:d,defaultActiveKey:tl,onChange:N,variant:i="segmented",size:nl="md",overflow:sl,scrollOptions:y,wrap:il=false,scrollable:bl=false,glassy:cl=false,transparent:dl=false,animated:B=true,destroyInactivePanel:M=false,className:ul,dir:fl,...vl},pl){let V=j("Tabs"),O=sl??(bl?"scroll":il?"wrap":"none"),X=O==="wrap"&&(i==="segmented"||i==="rounded")?"none":O,a$1=X==="scroll",A=X==="wrap",P=y?.arrows??C.arrows,T=y?.step??C.step,H=y?.fade??C.fade,$=y?.scrollIntoView??C.scrollIntoView,u=d!==void 0,ml=o.find(l=>!l.disabled)?.key,W=u?void 0:tl??ml,[hl,wl]=useState(W),t=u?d:hl,k=useRef(o.findIndex(l=>l.key===t)),[j$1,x]=useState("right"),_l=useCallback(l=>{let g=o.findIndex(_=>_.key===l),r=k.current;g>r?x("right"):g<r&&x("left"),k.current=g,u||wl(l),N?.(l);},[u,N,o]);useEffect(()=>{if(u&&d){let l=o.findIndex(r=>r.key===d),g=k.current;l!==g&&(l>g?x("right"):x("left"),k.current=l);}},[u,d,o]);let q=o.some(l=>l.children!=null),n=useRef(null),E=useRef(new Map),[Fl,R]=useState({opacity:0}),h=useRef(false),U=useRef(0),yl=useCallback(l=>g=>{g?E.current.set(l,g):E.current.delete(l);},[]),w=useCallback(l=>{let g=n.current,r=t?E.current.get(t):void 0;if(!g||!r){R(al=>al.opacity===0?al:{opacity:0});return}let _=g.getBoundingClientRect(),v=(i==="underline"?r.querySelector(".lg-tabs__tab-label")??r:r).getBoundingClientRect(),rl=v.left-_.left+g.scrollLeft;if(!A){R({width:v.width,transform:`translateX(${rl}px)`,opacity:1,transition:l?"transform var(--_tabs-slider-duration) var(--lg-transition-timing), width var(--_tabs-slider-duration) var(--lg-transition-timing)":"none"});return}let S=i==="underline",Cl=S?r.getBoundingClientRect():v,L=S?Cl.bottom-_.top:v.top-_.top,Dl=l&&Math.abs(L-U.current)>1;U.current=L,R({width:v.width,...S?null:{height:v.height},top:0,bottom:"auto",transform:`translate(${rl}px, ${L}px)`,opacity:1,transition:Dl?"opacity var(--_tabs-slider-duration) var(--lg-transition-timing)":l?"transform var(--_tabs-slider-duration) var(--lg-transition-timing), width var(--_tabs-slider-duration) var(--lg-transition-timing)":"none"});},[t,i,A]),Y=useRef(w);Y.current=w;let G=useRef(0);ol(()=>{let l=h.current;w(l),l&&(G.current=Date.now()),h.current=true;},[w,t]);let J=o.map(l=>`${l.key}:${l.disabled?1:0}`).join("|");ol(()=>{let l=h.current;h.current=false,w(false),h.current=l;},[J]),useEffect(()=>{if(!n.current)return;let l=new ResizeObserver(()=>{Date.now()-G.current<350||Y.current(false);});return l.observe(n.current),()=>l.disconnect()},[]);let[kl,Q]=useState(false),[Z,xl]=useState(false),[K,El]=useState(false),f=useCallback(()=>{let l=n.current;!l||!a$1||(Q(l.scrollWidth>l.clientWidth+1),xl(l.scrollLeft>1),El(l.scrollLeft+l.clientWidth<l.scrollWidth-1));},[a$1]);useEffect(()=>{if(!a$1){Q(false);return}let l=n.current;if(l)return f(),l.addEventListener("scroll",f),()=>l.removeEventListener("scroll",f)},[a$1,f,J]),useEffect(()=>{let l=n.current;if(!a$1||!l)return;let g=new ResizeObserver(()=>f());return g.observe(l),()=>g.disconnect()},[a$1,f]),useEffect(()=>{if(!a$1||!$||!t)return;let l=E.current.get(t);typeof l?.scrollIntoView=="function"&&l.scrollIntoView({behavior:"smooth",inline:"nearest",block:"nearest"});},[a$1,$,t]);let ll=useCallback((l,g)=>{let r=n.current;r&&(r.scrollBy({left:l==="left"?-T:T,behavior:"smooth"}),g&&g.detail>0&&g.currentTarget.blur());},[T]),z=a$1&&kl&&P!==false,gl=jsxs(s.List,{className:a("lg-tabs__list",a$1&&"lg-tabs__list--scrollable"),ref:n,children:[jsx("span",{className:a(`lg-tabs__slider lg-tabs__slider--${i}`,cl&&"lg-tabs__slider--glassy"),style:Fl,"aria-hidden":true}),o.map(l=>jsxs(s.Trigger,{value:l.key,disabled:l.disabled,ref:yl(l.key),"aria-label":l.ariaLabel,className:a("lg-tabs__tab",l.disabled&&"lg-tabs__tab--disabled"),children:[l.icon&&jsx("span",{className:"lg-tabs__tab-icon",children:l.icon}),jsx("span",{className:"lg-tabs__tab-label",children:l.label}),l.suffix!=null&&jsx("span",{className:"lg-tabs__tab-suffix",children:l.suffix})]},l.key))]});return jsxs(s.Root,{ref:pl,className:a(Sl({variant:i,size:nl}),A&&"lg-tabs--wrap",a$1&&"lg-tabs--scrollable",dl&&"lg-tabs--transparent",q&&"lg-tabs--has-content",ul),value:d,defaultValue:W,onValueChange:_l,dir:fl,...vl,children:[a$1?jsxs("div",{className:a("lg-tabs__scroll-wrapper",P==="hover"&&"lg-tabs__scroll-wrapper--hover-controls",!z&&"lg-tabs__scroll-wrapper--no-arrows"),children:[z&&jsx(b,{shape:"circle",size:"sm",variant:"text",icon:jsx(ChevronLeft,{}),tooltip:V.scrollLeft,disabled:!Z,onClick:l=>ll("left",l),className:"lg-tabs__scroll-arrow lg-tabs__scroll-arrow--left"}),H&&Z&&jsx("span",{className:"lg-tabs__fade lg-tabs__fade--left","aria-hidden":true}),gl,H&&K&&jsx("span",{className:"lg-tabs__fade lg-tabs__fade--right","aria-hidden":true}),z&&jsx(b,{shape:"circle",size:"sm",variant:"text",icon:jsx(ChevronRight,{}),tooltip:V.scrollRight,disabled:!K,onClick:l=>ll("right",l),className:"lg-tabs__scroll-arrow lg-tabs__scroll-arrow--right"})]}):gl,q&&jsx("div",{className:"lg-tabs__content-wrapper",children:o.map(l=>{if(l.children==null)return null;let g=l.key===t;return M&&!g?null:jsx(s.Content,{value:l.key,forceMount:M?void 0:true,className:a("lg-tabs__panel",B&&"lg-tabs__panel--animated",g&&"lg-tabs__panel--active",!g&&"lg-tabs__panel--inactive",B&&j$1==="right"&&"lg-tabs__panel--slide-right",B&&j$1==="left"&&"lg-tabs__panel--slide-left"),children:l.children},l.key)})})]})}var ql=Bl.forwardRef(Ll);export{Sl as a,ql as b};
|