@zjpcy/simple-design 1.5.5 → 1.5.6
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/es/Button/Button.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e,__assign as t}from"../node_modules/tslib/tslib.es6.js";import{jsxs as i,jsx as n}from"react/jsx-runtime";import l from"react";import
|
|
1
|
+
import{__rest as e,__assign as t}from"../node_modules/tslib/tslib.es6.js";import{jsxs as i,jsx as n}from"react/jsx-runtime";import l from"react";import r from"classnames";import a from"../Icon/Icon.js";var s=l.forwardRef(function(l,s){var o=l.children,c=l.variant,d=l.type,m=l.size,p=void 0===m?"medium":m,y=l.disabled,f=void 0!==y&&y,u=l.loading,g=void 0!==u&&u,h=l.onClick,b=l.className,v=l.style,j=l.icon,k=l.htmlType,x=void 0===k?"button":k,z=l.href,N=l.title,C=e(l,["children","variant","type","size","disabled","loading","onClick","className","style","icon","htmlType","href","title"]),R=null!=c?c:d&&["primary","secondary","danger","success","warning","link"].includes(d)?d:"secondary",I=r("zjpcy-btn","zjpcy-btn--".concat(R),"zjpcy-btn--".concat(p),{"zjpcy-btn--disabled":f||g},b),w=function(e){f||g?null==e||e.preventDefault():h&&h()},T=function(){return g?n(a,{type:"loading",style:{marginRight:o?"2px":0}}):j?"string"==typeof j?n(a,{type:j,style:{marginRight:o?"2px":0}}):n("span",{style:{marginRight:o?"8px":0,display:"inline-flex",alignItems:"center"},children:j}):null};return"link"===R&&z?i("a",t({ref:s,href:f?void 0:z,className:I,onClick:w,style:v,title:N},C,{children:[T(),o]})):i("button",t({ref:s,type:x,className:I,onClick:w,disabled:f,style:v,title:N},C,{children:[T(),o]}))});s.displayName="Button";var o=s;export{o as default};
|
package/dist/es/Modal/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{__assign as o}from"../node_modules/tslib/tslib.es6.js";import{jsx as n,jsxs as e}from"react/jsx-runtime";import{useState as i,useRef as t,useEffect as r}from"react";import{createPortal as c}from"react-dom";import a from"classnames";import l from"../Icon/Icon.js";import d from"../Flex/index.js";import m from"../Button/Button.js";var s=function(s){var u,p=s.visible,
|
|
1
|
+
"use client";import{__assign as o}from"../node_modules/tslib/tslib.es6.js";import{jsx as n,jsxs as e}from"react/jsx-runtime";import{useState as i,useRef as t,useEffect as r}from"react";import{createPortal as c}from"react-dom";import a from"classnames";import l from"../Icon/Icon.js";import d from"../Flex/index.js";import m from"../Button/Button.js";var s=function(s){var u,p=s.visible,v=s.title,y=void 0===v?"标题":v,f=s.width,h=void 0===f?600:f,g=s.height,j=void 0===g?"auto":g,x=s.headerHeight,z=void 0===x?40:x,b=s.footerHeight,N=void 0===b?40:b,w=s.confirmLoading,k=void 0!==w&&w,C=s.direction,_=void 0===C?"normal":C,H=s.top,T=s.triggerRef,I=s.onCancel,B=s.onOk,W=s.children,L=s.footer,O=void 0===L?null:L,E=s.bordered,R=void 0!==E&&E,S=s.className,F=s.style,M=s.okText,P=void 0===M?"确认":M,X=s.cancelText,Y=void 0===X?"取消":X,$=s.getContainer,q=void 0===$?function(){return document.body}:$,A=s.maskStyle,D=s.maskClassName,G=s.zIndex,J=void 0===G?1e3:G,K=s.contentClassName,Q=s.contentStyle,U=s.destroyOnClose,V=void 0!==U&&U,Z=s.loading,oo=void 0!==Z&&Z,no=s.loadingIcon,eo=i(!1),io=eo[0],to=eo[1],ro=i(!1),co=ro[0],ao=ro[1],lo=i(!1),mo=lo[0],so=lo[1],uo=i({x:0,y:0}),po=uo[0],vo=uo[1],yo=t(null),fo=_,ho=function(o){if("number"==typeof o)return o;var n=o.match(/^(\d+)px$/);return n?parseInt(n[1],10):0},go=function(){var o=function(){if(null==T?void 0:T.current){var o=T.current.getBoundingClientRect();return{x:o.left+o.width/2,y:o.top+o.height/2}}return yo.current||null}();if(!o||"undefined"==typeof window)return{x:0,y:0};if(void 0!==H||"normal"===fo){var n=window.innerWidth/2,e=void 0!==H?H+(j?ho(j)/2:0):window.innerHeight/2;return{x:o.x-n,y:o.y-e}}if("center"===fo){n=window.innerWidth/2;var i=window.innerHeight/2;return{x:o.x-n,y:o.y-i}}return{x:0,y:0}};r(function(){var o=function(o){yo.current={x:o.clientX,y:o.clientY}};return document.addEventListener("mousedown",o,!0),function(){document.removeEventListener("mousedown",o,!0)}},[]),r(function(){if(p){var o=go();vo(o),ao(!1),to(!0);var n=setTimeout(function(){so(!0)},30);return function(){return clearTimeout(n)}}ao(!0),so(!1);var e=setTimeout(function(){to(!1),ao(!1)},400);return function(){return clearTimeout(e)}},[p,400,j,H,V]);var jo=function(){ao(!0);var o=setTimeout(function(){to(!1),ao(!1),null==I||I()},400);return function(){return clearTimeout(o)}},xo=function(){null==B||B()},zo=o(((u={width:"number"==typeof h?"".concat(h,"px"):h,top:void 0!==H?"".concat(H,"px"):void 0})["--zjpcy-modal-origin-x"]="".concat(po.x,"px"),u["--zjpcy-modal-origin-y"]="".concat(po.y,"px"),u.visibility=mo?"visible":"hidden",u),F),bo={height:"number"==typeof z?"".concat(z,"px"):z},No=j?ho(j):0,wo=ho(z),ko=ho(N),Co=No>0?Math.max(0,No-wo-ko):void 0,_o=o({},Q);if(!_o.maxHeight&&j){var Ho=ho(j);_o.maxHeight="".concat(Ho,"px")}!_o.maxHeight&&Co&&(_o.maxHeight="".concat(Co,"px"));var To={height:"number"==typeof N?"".concat(N,"px"):N},Io=function(){if(!io&&!co)return null;var i=o({zIndex:J},A);return n("div",{className:a("zjpcy-modal-overlay",{"zjpcy-modal-overlay--visible":io&&!co,"zjpcy-modal-overlay--closing":co,"zjpcy-modal-overlay--custom-top":void 0!==H},S,D),onClick:jo,style:i,children:e("div",{className:a("zjpcy-modal-container",{"zjpcy-modal-container--normal":mo&&!co&&("normal"===fo||void 0!==H),"zjpcy-modal-container--center":mo&&!co&&"center"===fo&&void 0===H,"zjpcy-modal-container--top-right":mo&&!co&&"top-right"===fo&&void 0===H,"zjpcy-modal-container--bottom-right":mo&&!co&&"bottom-right"===fo&&void 0===H,"zjpcy-modal-container--bottom-left":mo&&!co&&"bottom-left"===fo&&void 0===H,"zjpcy-modal-container--closing-normal":co&&("normal"===fo||void 0!==H),"zjpcy-modal-container--closing-center":co&&"center"===fo&&void 0===H,"zjpcy-modal-container--closing-top-right":co&&"top-right"===fo&&void 0===H,"zjpcy-modal-container--closing-bottom-right":co&&"bottom-right"===fo&&void 0===H,"zjpcy-modal-container--closing-bottom-left":co&&"bottom-left"===fo&&void 0===H,"zjpcy-modal-container--bordered":R,"zjpcy-modal-container--has-height":void 0!==j}),style:zo,onClick:function(o){return o.stopPropagation()},children:[oo?n("div",no?{className:"zjpcy-modal-loading",children:n("div",{className:"zjpcy-modal-loading-content",children:no})}:{className:"zjpcy-modal-loading",children:n("div",{className:"zjpcy-modal-loading-content",children:n("div",{className:"zjpcy-modal-loading-spinner",children:e("svg",{viewBox:"0 0 24 24",className:"zjpcy-modal-loading-icon",children:[n("circle",{className:"zjpcy-modal-loading-track",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"2"}),n("circle",{className:"zjpcy-modal-loading-indicator",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"2"})]})})})}):null,e("div",{className:"zjpcy-modal-header",style:bo,children:[n("div",{className:"zjpcy-modal-header__left",children:n("span",{className:"zjpcy-modal-header__title",children:y})}),n("div",{className:"zjpcy-modal-header__right",children:n("div",{className:"zjpcy-modal-close-btn",onClick:jo,children:n(l,{type:"close",size:20,color:"currentColor"})})})]}),io&&n("div",{className:a("zjpcy-modal-content",K),style:_o,children:V&&co?null:W}),n(d,{className:"zjpcy-modal-footer",align:"center",justify:"flex-end",style:Object.assign({},To,{padding:"0px 10px"}),gap:12,children:null===O?e(d,{className:"zjpcy-modal-footer__actions",justify:"flex-end",gap:12,children:[n(m,{variant:"secondary",onClick:jo,disabled:k,children:Y||"取消"}),n(m,{variant:"primary",onClick:xo,loading:k,children:P||"确认"})]}):O})]})})}();if(!Io)return null;if(!1===q)return Io;var Bo="function"==typeof q?q():q;return Bo?c(Io,Bo):Io};export{s as default};
|
package/dist/es/index.css
CHANGED
|
@@ -3629,11 +3629,6 @@
|
|
|
3629
3629
|
animation: centerAnimateIn 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
|
|
3630
3630
|
}
|
|
3631
3631
|
|
|
3632
|
-
/* 从浏览器顶部滑入到指定 top 位置的动画 */
|
|
3633
|
-
.zjpcy-modal-container--from-top {
|
|
3634
|
-
animation: fromTopAnimateIn 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
|
|
3635
|
-
}
|
|
3636
|
-
|
|
3637
3632
|
@keyframes centerAnimateIn {
|
|
3638
3633
|
from {
|
|
3639
3634
|
transform: scale(0.85);
|
|
@@ -3645,17 +3640,6 @@
|
|
|
3645
3640
|
}
|
|
3646
3641
|
}
|
|
3647
3642
|
|
|
3648
|
-
@keyframes fromTopAnimateIn {
|
|
3649
|
-
from {
|
|
3650
|
-
transform: translateY(-100vh) scale(0.7);
|
|
3651
|
-
opacity: 0;
|
|
3652
|
-
}
|
|
3653
|
-
to {
|
|
3654
|
-
transform: translateY(0) scale(1);
|
|
3655
|
-
opacity: 1;
|
|
3656
|
-
}
|
|
3657
|
-
}
|
|
3658
|
-
|
|
3659
3643
|
/* 正常动画(从触发器位置缓慢过渡到中心) */
|
|
3660
3644
|
.zjpcy-modal-container--normal {
|
|
3661
3645
|
animation: normalAnimateIn 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
|
|
@@ -3729,11 +3713,6 @@
|
|
|
3729
3713
|
animation: centerAnimateOut 0.3s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
|
|
3730
3714
|
}
|
|
3731
3715
|
|
|
3732
|
-
/* 从 top 位置回到浏览器顶部的消失动画 */
|
|
3733
|
-
.zjpcy-modal-container--closing-from-top {
|
|
3734
|
-
animation: fromTopAnimateOut 0.3s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
|
|
3735
|
-
}
|
|
3736
|
-
|
|
3737
3716
|
@keyframes centerAnimateOut {
|
|
3738
3717
|
from {
|
|
3739
3718
|
transform: scale(1);
|
|
@@ -3745,17 +3724,6 @@
|
|
|
3745
3724
|
}
|
|
3746
3725
|
}
|
|
3747
3726
|
|
|
3748
|
-
@keyframes fromTopAnimateOut {
|
|
3749
|
-
from {
|
|
3750
|
-
transform: translateY(0) scale(1);
|
|
3751
|
-
opacity: 1;
|
|
3752
|
-
}
|
|
3753
|
-
to {
|
|
3754
|
-
transform: translateY(-100vh) scale(0.7);
|
|
3755
|
-
opacity: 0;
|
|
3756
|
-
}
|
|
3757
|
-
}
|
|
3758
|
-
|
|
3759
3727
|
/* 正常消失(回到触发器位置缓慢消失) */
|
|
3760
3728
|
.zjpcy-modal-container--closing-normal {
|
|
3761
3729
|
animation: normalAnimateOut 0.3s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
|
|
@@ -3,6 +3,8 @@ import './Button.css';
|
|
|
3
3
|
export interface ButtonProps {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
5
|
variant?: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' | 'link';
|
|
6
|
+
/** @deprecated 请使用 variant 代替 */
|
|
7
|
+
type?: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' | 'link' | 'button' | 'submit' | 'reset';
|
|
6
8
|
size?: 'small' | 'medium' | 'large';
|
|
7
9
|
disabled?: boolean;
|
|
8
10
|
loading?: boolean;
|
|
@@ -10,7 +12,7 @@ export interface ButtonProps {
|
|
|
10
12
|
className?: string;
|
|
11
13
|
style?: React.CSSProperties;
|
|
12
14
|
icon?: string | React.ReactNode;
|
|
13
|
-
|
|
15
|
+
htmlType?: 'button' | 'submit' | 'reset';
|
|
14
16
|
href?: string;
|
|
15
17
|
title?: string;
|
|
16
18
|
}
|