@zjpcy/simple-design 1.3.7 → 1.3.8
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/cjs/index.js +1 -1
- package/dist/es/Menu/index.js +1 -1
- package/package.json +19 -1
package/dist/es/Menu/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__spreadArray as e}from"../node_modules/tslib/tslib.es6.js";import{jsxs as n,jsx as i,Fragment as t}from"react/jsx-runtime";import l,{useCallback as o,useRef as c,useState as a,useMemo as r,useEffect as d}from"react";import{useClickOutside as s}from"../Hooks/useClickOutside.js";var m=l.memo(function(e){var l,c,r,s
|
|
1
|
+
import{__spreadArray as e}from"../node_modules/tslib/tslib.es6.js";import{jsxs as n,jsx as i,Fragment as t}from"react/jsx-runtime";import l,{useCallback as o,useRef as c,useState as a,useMemo as r,useEffect as d}from"react";import{useClickOutside as s}from"../Hooks/useClickOutside.js";var m=function(e){var n,i=e.trim();return i&&(null===(n=Array.from(i)[0])||void 0===n?void 0:n.toUpperCase())||""},u=l.memo(function(e){var l,c,r,s=e.item,p=e.level,h=e.mode,v=e.collapsed,f=e.theme,g=e.openKeySet,y=e.selectedKey,b=e.onItemClick,N=e.onToggleOpen,k=!!s.children&&s.children.length>0,C=g.has(s.key),K=y===s.key,w="horizontal"===h,z="inline"===h,x="vertical-flat"===h,O=0===p,S=o(function(e){e.stopPropagation(),s.disabled||(k&&!x&&N(s.key),x&&k||b(s,s.key))},[s,b,N,k,x]),T=w&&O?16:z?12+24*p:v?0:12+16*p,A=C&&(!v||w),I=function(e){var n=a(e),i=n[0],t=n[1],l=a(e),o=l[0],c=l[1];return d(function(){var n;return e?(c(!0),n=requestAnimationFrame(function(){t(!0)})):(t(!1),n=setTimeout(function(){c(!1)},150)),function(){"number"==typeof n?cancelAnimationFrame(n):clearTimeout(n)}},[e]),{isVisible:i,shouldRender:o}}(A&&w&&O),j=I.isVisible,F=I.shouldRender,H=k&&(!v||!O)&&!x,M=f||"light";return n("div",{className:"idp-menu-item-wrapper ".concat(O?"root":""),children:[i("div",{className:"\n idp-menu-item\n ".concat(K?"selected":"","\n ").concat(s.disabled?"disabled":"","\n ").concat(k?"has-children":"","\n ").concat(O?"root":"","\n ").concat(v&&O?"collapsed":"","\n ").concat(h,"\n ").concat(M,"\n "),style:{padding:"0px ".concat(T,"px")},title:v&&O?s.label:void 0,onClick:S,children:n("div",{className:"idp-menu-item-content",children:[v?i(t,{children:s.icon?i("span",{className:"idp-menu-item-icon collapsed",children:s.icon}):i("span",{className:"idp-menu-item-collapsed-label",children:m(s.label)})}):n(t,{children:[s.icon&&i("span",{className:"idp-menu-item-icon",children:s.icon}),n("div",{className:"idp-menu-item-text",children:[i("span",{className:"idp-menu-item-label",children:s.label}),s.description&&!k&&i("span",{className:"idp-menu-item-description",children:s.description})]})]}),H&&i("span",{className:"idp-menu-item-arrow ".concat(A?"open":""," ").concat(h),children:i("svg",{viewBox:"0 0 1024 1024",width:"10",height:"10",fill:"currentColor",children:i("path",{d:"M840.4 300H183.6c-19.7 0-30.7 25.7-18.5 40.5l328.4 402.4c9.4 11.6 26.7 11.6 36.1 0l328.4-402.4c12.2-14.8 1.2-40.5-18.5-40.5z"})})})]})}),k&&(!w||!O||F)&&i("div",{className:"idp-menu-submenu-wrapper ".concat(h," ").concat(w&&O?"horizontal-popup-wrapper":""," ").concat(x?"vertical-flat":""),children:i("div",{className:"idp-menu-submenu ".concat((c=w&&O?"horizontal-popup":"",r=z&&A?"open inline":"",x?"open vertical-flat":w&&O?"".concat(w&&O?j?"open":"":A?"open":""," ").concat(c).trim():z?r:A?"open":"")," ").concat(h),children:i("div",{className:"idp-menu-submenu-content",children:null===(l=s.children)||void 0===l?void 0:l.map(function(e){return i(u,{item:e,level:p+1,mode:h,collapsed:v,theme:f,openKeySet:g,selectedKey:y,onItemClick:b,onToggleOpen:N},e.key)})})})})]})});u.displayName="MenuItemComponent";var p=function(n){var t=n.mode,l=void 0===t?"vertical":t,m=n.items,p=n.className,h=void 0===p?"":p,v=n.style,f=n.selectedKey,g=n.defaultOpenKeys,y=void 0===g?[]:g,b=n.openKeys,N=n.collapsed,k=void 0!==N&&N,C=n.open,K=n.theme,w=void 0===K?"light":K,z=n.onChange,x=n.onOpenChange,O=c(null),S=a(!0)[0],T=a(y),A=T[0],I=T[1],j=a(""),F=j[0],H=j[1],M=void 0!==b,R=void 0!==f,V=M?b:A,q=R?f:F,B=void 0!==C?C:S,P=r(function(){return new Set(V)},[V]);d(function(){void 0!==f&&H(f)},[f]),d(function(){if(q&&!M&&"horizontal"!==l&&"vertical-flat"!==l){var n=function(i,t,l){void 0===l&&(l=[]);for(var o=0,c=i;o<c.length;o++){var a=c[o];if(a.key===t)return l;if(a.children&&a.children.length>0){var r=n(a.children,t,e(e([],l,!0),[a.key],!1));if(r.length>0)return r}}return[]},i=n(m,q);i.length>0&&I(function(n){var t=new Set(e(e([],n,!0),i,!0));return Array.from(t)})}},[q,m,M,l]);var U=o(function(e,n){R||H(n),null==z||z(e,n),"horizontal"===l&&(!e.children||0===e.children.length)&&V.length>0&&(M||I([]),null==x||x([]))},[z,R,l,V.length,M,x]),_=o(function(n){if(M){var i=P.has(n)?V.filter(function(e){return e!==n}):e(e([],V,!0),[n],!1);null==x||x(i)}else I(function(i){var t=i.includes(n)?i.filter(function(e){return e!==n}):e(e([],i,!0),[n],!1);return null==x||x(t),t})},[P,V,M,x]),D="horizontal"!==l&&k;return s(O,o(function(){"horizontal"===l&&V.length>0&&(M||I([]),null==x||x([]))},[l,V.length,M,x])),B?i("div",{ref:O,className:"idp-menu idp-menu-".concat(w," idp-menu-").concat(l," ").concat(D?"collapsed":""," ").concat(h),style:v,role:"menu",children:m.map(function(e){return i(u,{item:e,level:0,mode:l,collapsed:D,theme:w,openKeySet:P,selectedKey:q,onItemClick:U,onToggleOpen:_},e.key)})}):null};export{p as default};
|
package/package.json
CHANGED
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zjpcy/simple-design",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"description": "IDP Studio Design System - React Component Library",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/es/index.js",
|
|
7
7
|
"types": "dist/types/components/index.d.ts",
|
|
8
8
|
"type": "module",
|
|
9
|
+
"style": "dist/es/index.css",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/types/components/index.d.ts",
|
|
14
|
+
"default": "./dist/es/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/types/components/index.d.ts",
|
|
18
|
+
"default": "./dist/cjs/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./dist/*.css": {
|
|
22
|
+
"import": "./dist/es/*.css",
|
|
23
|
+
"require": "./dist/cjs/*.css"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
9
27
|
"files": [
|
|
10
28
|
"dist/**"
|
|
11
29
|
],
|