@lotte-innovate/ui-component-test 0.0.144 → 0.0.145
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use
|
|
1
|
+
"use server";
|
|
2
2
|
import{jsxs as e,jsx as r}from"react/jsx-runtime";import{cva as t}from"class-variance-authority";import{primaryColorStyle as n}from"../../constants.mjs";import o,{useState as l,useRef as a,useCallback as i,useEffect as c}from"react";import{StaticTreeDataProvider as u,UncontrolledTreeEnvironment as s,Tree as f}from"react-complex-tree";import"../../node_modules/react-complex-tree/lib/style-modern.mjs";import d from"../TextField/index.mjs";import{Button as m}from"../Button/index.mjs";import{MAIN_COLOR as p}from"../../color/constants.mjs";import{useTheme as h}from"../../theme/ThemeProvider.mjs";var v=function(){return v=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},v.apply(this,arguments)},y=function(e,r,t,n){return new(t||(t=Promise))((function(o,l){function a(e){try{c(n.next(e))}catch(e){l(e)}}function i(e){try{c(n.throw(e))}catch(e){l(e)}}function c(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(a,i)}c((n=n.apply(e,r||[])).next())}))},b=function(e,r){var t,n,o,l,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return l={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(i){return function(c){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;l&&(l=0,i[0]&&(a=0)),a;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},x=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t},w=function(e,r,t){if(t||2===arguments.length)for(var n,o=0,l=r.length;o<l;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return e.concat(n||Array.prototype.slice.call(r))};function g(e,r){var t=[];return Object.values(e).forEach((function(e){e[r]&&t.push(e.index)})),t}t("",{variants:{color:n()}});var j=null,I=o.forwardRef((function(t,n){var o,I,O,S=t.items,P=t.treeId;t.className;var k=t.color,T=t.isSearch,E=x(t,["items","treeId","className","color","isSearch"]),N=l(""),C=N[0],F=N[1],R=a(null),B=l({}),L=B[0],A=B[1],q=g(S,"isFocusd"),z=g(S,"isExpanded"),D=g(S,"isSelected");j=new u(L,(function(e,r){return v(v({},e),{data:r})}));var G=h().theme,_={color:null!==(I=null!=k?k:G.themeColor)&&void 0!==I?I:p},H=i((function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return y(void 0,w([e],r,!0),void 0,(function(e,r){var t,n,o,l,a;return void 0===r&&(r="root"),b(this,(function(i){switch(i.label){case 0:return j?[4,j.getTreeItem(r)]:[2];case 1:return(t=i.sent()).data.toLowerCase().includes(e.toLowerCase())?[2,[t.index]]:[4,Promise.all(null!==(a=null===(l=t.children)||void 0===l?void 0:l.map((function(r){return H(e,r)})))&&void 0!==a?a:[])];case 2:return n=i.sent(),o=n.find((function(e){return null!==e})),o?[2,w([t.index],o,!0)]:[2,null]}}))}))}),[j]),J=i((function(e){e.preventDefault(),C&&H(C).then((function(e){var r;e&&(null===(r=R.current)||void 0===r||r.expandSubsequently(e).then((function(){var r,t;null===(r=R.current)||void 0===r||r.selectItems([e[e.length-1]]),null===(t=R.current)||void 0===t||t.focusItem(e[e.length-1])})))}))}),[H,C]);return c((function(){if(S){var e=[],r=[];S.map((function(e){r.push.apply(r,e.children)})),S.forEach((function(t){r.includes(t.index)||e.push(t.index)}));var t={};t.root={index:"root",isFolder:!0,children:e,data:"Root item"},S.map((function(e){t[e.index]=v(v({},e),{isFolder:e.children.length>0})})),A(t)}}),[S]),e("div",{className:"text-slate-12",children:[T&&e("div",{className:"flex",children:[r(d.Root,{color:_.color,value:C,onChange:function(e){return F(e.target.value)},placeholder:"검색어를 입력하세요",className:"mr-2"}),r(m,{color:_.color,onClick:J,children:"검색"})]}),r(s,v({ref:n,dataProvider:j,viewState:(o={},o[P]={focusedItem:null!==(O=q[0])&&void 0!==O?O:"",expandedItems:z,selectedItems:D},o),keyboardBindings:v({renameItem:["enter"],abortRenameItem:["control+z"]},E.keyboardBindings)},E,{canSearch:!1,children:r(f,{ref:R,treeId:P,rootItem:"root",treeLabel:"Tree Example"})}))]})}));I.displayName="Tree";export{I as Tree,j as treeProvider};
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|