neko-ui 1.0.40 → 1.0.41
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/README.md +3 -3
- package/es/avatar/index.d.ts +4 -4
- package/es/avatar/index.js +1 -71
- package/es/avatar/style.d.ts +4 -0
- package/es/avatar/style.js +71 -0
- package/es/avatar-group/index.d.ts +2 -2
- package/es/avatar-group/index.js +1 -21
- package/es/avatar-group/style.d.ts +4 -0
- package/es/avatar-group/style.js +21 -0
- package/es/back-top/index.d.ts +2 -2
- package/es/back-top/index.js +1 -73
- package/es/back-top/style.d.ts +4 -0
- package/es/back-top/style.js +73 -0
- package/es/button/index.d.ts +5 -4
- package/es/button/index.js +1 -212
- package/es/button/style.d.ts +3 -0
- package/es/button/style.js +212 -0
- package/es/capture-screen/index.d.ts +3 -3
- package/es/capture-screen/index.js +1 -63
- package/es/capture-screen/style.d.ts +9 -0
- package/es/capture-screen/style.js +63 -0
- package/es/carousel/index.js +1 -153
- package/es/carousel/style.d.ts +11 -0
- package/es/carousel/style.js +153 -0
- package/es/code-block/index.d.ts +3 -3
- package/es/code-block/index.js +1 -1
- package/es/color-palette/index.d.ts +3 -3
- package/es/color-palette/index.js +1 -227
- package/es/color-palette/style.d.ts +15 -0
- package/es/color-palette/style.js +231 -0
- package/es/color-picker/index.d.ts +2 -2
- package/es/color-picker/index.js +1 -38
- package/es/color-picker/style.d.ts +7 -0
- package/es/color-picker/style.js +38 -0
- package/es/emotion/index.d.ts +10 -0
- package/es/emotion/index.js +1 -0
- package/es/highlight-text/index.d.ts +4 -4
- package/es/highlight-text/index.js +1 -8
- package/es/highlight-text/style.d.ts +4 -0
- package/es/highlight-text/style.js +8 -0
- package/es/index.d.ts +3 -0
- package/es/index.js +1 -1
- package/es/input/index.d.ts +5 -5
- package/es/input/index.js +7 -7
- package/es/input-number/index.d.ts +2 -2
- package/es/input-number/index.js +1 -10
- package/es/input-number/style.d.ts +3 -0
- package/es/input-number/style.js +10 -0
- package/es/markdown/index.css +52 -52
- package/es/markdown/index.d.ts +2 -2
- package/es/markdown/index.js +1 -1
- package/es/photo/index.js +1 -83
- package/es/photo/style.d.ts +10 -0
- package/es/photo/style.js +83 -0
- package/es/prism/prism.css +75 -75
- package/es/schema-to-tree-data/index.d.ts +3 -0
- package/es/schema-to-tree-data/index.js +1 -0
- package/es/skeleton/index.d.ts +3 -3
- package/es/skeleton/index.js +1 -80
- package/es/skeleton/style.d.ts +8 -0
- package/es/skeleton/style.js +80 -0
- package/es/tooltip/index.d.ts +6 -6
- package/es/tooltip/index.js +1 -83
- package/es/tooltip/style.d.ts +6 -0
- package/es/tooltip/style.js +83 -0
- package/es/tree/index.d.ts +25 -0
- package/es/tree/index.js +1 -0
- package/es/tree/style.d.ts +10 -0
- package/es/tree/style.js +103 -0
- package/es/wave-circle/index.d.ts +4 -4
- package/es/wave-circle/index.js +1 -65
- package/es/wave-circle/style.d.ts +6 -0
- package/es/wave-circle/style.js +65 -0
- package/lib/avatar/index.d.ts +4 -4
- package/lib/avatar/index.js +1 -1
- package/lib/avatar/style.d.ts +4 -0
- package/lib/avatar/style.js +1 -0
- package/lib/avatar-group/index.d.ts +2 -2
- package/lib/avatar-group/index.js +1 -1
- package/lib/avatar-group/style.d.ts +4 -0
- package/lib/avatar-group/style.js +1 -0
- package/lib/back-top/index.d.ts +2 -2
- package/lib/back-top/index.js +1 -1
- package/lib/back-top/style.d.ts +4 -0
- package/lib/back-top/style.js +1 -0
- package/lib/button/index.d.ts +5 -4
- package/lib/button/index.js +1 -1
- package/lib/button/style.d.ts +3 -0
- package/lib/button/style.js +1 -0
- package/lib/capture-screen/index.d.ts +3 -3
- package/lib/capture-screen/index.js +1 -1
- package/lib/capture-screen/style.d.ts +9 -0
- package/lib/capture-screen/style.js +1 -0
- package/lib/carousel/index.js +1 -1
- package/lib/carousel/style.d.ts +11 -0
- package/lib/carousel/style.js +1 -0
- package/lib/code-block/index.d.ts +3 -3
- package/lib/code-block/index.js +1 -1
- package/lib/color-palette/index.d.ts +3 -3
- package/lib/color-palette/index.js +1 -1
- package/lib/color-palette/style.d.ts +15 -0
- package/lib/color-palette/style.js +1 -0
- package/lib/color-picker/index.d.ts +2 -2
- package/lib/color-picker/index.js +1 -1
- package/lib/color-picker/style.d.ts +7 -0
- package/lib/color-picker/style.js +1 -0
- package/lib/emotion/index.d.ts +10 -0
- package/lib/emotion/index.js +1 -0
- package/lib/highlight-text/index.d.ts +4 -4
- package/lib/highlight-text/index.js +1 -1
- package/lib/highlight-text/style.d.ts +4 -0
- package/lib/highlight-text/style.js +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +1 -1
- package/lib/input/index.d.ts +5 -5
- package/lib/input/index.js +1 -1
- package/lib/input-number/index.d.ts +2 -2
- package/lib/input-number/index.js +1 -1
- package/lib/input-number/style.d.ts +3 -0
- package/lib/input-number/style.js +1 -0
- package/lib/markdown/index.css +52 -52
- package/lib/markdown/index.d.ts +2 -2
- package/lib/markdown/index.js +1 -1
- package/lib/photo/index.js +1 -1
- package/lib/photo/style.d.ts +10 -0
- package/lib/photo/style.js +1 -0
- package/lib/prism/prism.css +75 -75
- package/lib/schema-to-tree-data/index.d.ts +3 -0
- package/lib/schema-to-tree-data/index.js +1 -0
- package/lib/skeleton/index.d.ts +3 -3
- package/lib/skeleton/index.js +1 -1
- package/lib/skeleton/style.d.ts +8 -0
- package/lib/skeleton/style.js +1 -0
- package/lib/tooltip/index.d.ts +6 -6
- package/lib/tooltip/index.js +1 -1
- package/lib/tooltip/style.d.ts +6 -0
- package/lib/tooltip/style.js +1 -0
- package/lib/tree/index.d.ts +25 -0
- package/lib/tree/index.js +1 -0
- package/lib/tree/style.d.ts +10 -0
- package/lib/tree/style.js +1 -0
- package/lib/wave-circle/index.d.ts +4 -4
- package/lib/wave-circle/index.js +1 -1
- package/lib/wave-circle/style.d.ts +6 -0
- package/lib/wave-circle/style.js +1 -0
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Neko UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
!> UI组件库
|
|
4
4
|
|
|
5
5
|
[![version][version-tag]][npm-url]
|
|
6
6
|
[![install size][size-tag]][size-url]
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
[size-url]: https://packagephobia.com/result?p=neko-ui@latest
|
|
18
18
|
[download-tag]: https://img.shields.io/npm/dm/neko-ui.svg?logo=docusign
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
!> logo轮廓其实是双马尾
|
|
21
21
|
|
|
22
22
|
## 安装依赖
|
|
23
23
|
|
|
@@ -45,7 +45,7 @@ yarn build
|
|
|
45
45
|
|
|
46
46
|
## 打包项目`使用自定义配置`
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
!> 在打包其它有特殊配置的bundle时, 可以通过命令行参数来加载额外的配置文件;
|
|
49
49
|
|
|
50
50
|
例如: 使用 **config/index.ts** 与 **config/prod.ts** 合并后的配置进行编译.
|
|
51
51
|
|
package/es/avatar/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { type ComponentSize } from '../';
|
|
3
|
-
export interface AvatarProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
src?: ReactNode;
|
|
3
|
+
export interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
src?: React.ReactNode;
|
|
5
5
|
alt?: string;
|
|
6
6
|
size?: number | ComponentSize;
|
|
7
7
|
username?: string;
|
|
8
8
|
color?: string;
|
|
9
9
|
}
|
|
10
|
-
declare const Avatar: FC<AvatarProps>;
|
|
10
|
+
declare const Avatar: React.FC<AvatarProps>;
|
|
11
11
|
export default Avatar;
|
package/es/avatar/index.js
CHANGED
|
@@ -1,71 +1 @@
|
|
|
1
|
-
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}import React,{useEffect,useMemo,useRef,useState}from"react";import
|
|
2
|
-
.${avatarCls} {
|
|
3
|
-
position: relative;
|
|
4
|
-
display: inline-flex;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
align-items: center;
|
|
7
|
-
width: 32px;
|
|
8
|
-
height: 32px;
|
|
9
|
-
transition: transform 0.3s;
|
|
10
|
-
cursor: pointer;
|
|
11
|
-
user-select: none;
|
|
12
|
-
background-image: linear-gradient(45deg, #cabdeb 0%, #e9887c 100%);
|
|
13
|
-
animation: avatar-morph-effect 8s ease-in-out infinite;
|
|
14
|
-
|
|
15
|
-
&::before,
|
|
16
|
-
&::after {
|
|
17
|
-
position: absolute;
|
|
18
|
-
top: 0;
|
|
19
|
-
left: 0;
|
|
20
|
-
display: block;
|
|
21
|
-
width: 100%;
|
|
22
|
-
height: 100%;
|
|
23
|
-
content: '';
|
|
24
|
-
transition: transform 0.3s;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&::before {
|
|
28
|
-
background-color: var(--avatar-color);
|
|
29
|
-
clip-path: url('#clipPathAvatar');
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&::after {
|
|
33
|
-
background: url(${faviconBg}) no-repeat center/contain;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
span {
|
|
37
|
-
transition: transform 0.3s;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&:hover {
|
|
41
|
-
> *,
|
|
42
|
-
&::after,
|
|
43
|
-
&::before {
|
|
44
|
-
transform: scale(1.2);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
img {
|
|
49
|
-
position: absolute;
|
|
50
|
-
left: 0;
|
|
51
|
-
width: 100%;
|
|
52
|
-
height: 100%;
|
|
53
|
-
clip-path: url('#clipPathAvatar');
|
|
54
|
-
transition: transform 0.3s;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
@keyframes avatar-morph-effect {
|
|
59
|
-
0% {
|
|
60
|
-
border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
50% {
|
|
64
|
-
border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
100% {
|
|
68
|
-
border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
`;const avatarSize={small:24,normal:32,large:40};const Avatar=_param=>{var{className,src,alt,username,size,style={},color}=_param,props=_objectWithoutProperties(_param,["className","src","alt","username","size","style","color"]);const box=useRef(null);const label=useRef(null);const[scale,setScale]=useState(1);const cls=useMemo(()=>classNames(avatarCls,className),[className]);useEffect(()=>{injectGlobal([avatarCss]);const hasSvg=document.documentElement.querySelector("clipPath#clipPathAvatar");if(!hasSvg){const svg=document.createElement("a");svg.innerHTML=clip;document.body.insertBefore(svg.firstChild,document.body.firstChild)}},[]);const _style=useMemo(()=>{if(typeof size==="number"){style.width=size;style.height=size}else if(size&&avatarSize[size]){style.width=avatarSize[size];style.height=avatarSize[size]}if(color)Object.assign(style,{"--avatar-color":color});return style},[color,size,style]);const img=useMemo(()=>typeof src==="string"?React.createElement("img",{src:src,alt:alt}):src,[alt,src]);useEffect(()=>{if(label.current&&box.current){if(label.current.clientWidth+6>box.current.clientWidth){setScale((box.current.clientWidth-6)/label.current.clientWidth)}}},[]);return React.createElement("div",_extends({ref:box,className:cls,style:_style},props),img?img:username?React.createElement("span",{ref:label,style:{transform:`scale(${scale})`}},username):null)};export default Avatar;
|
|
1
|
+
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}import React,{useEffect,useMemo,useRef,useState}from"react";import clipPath from"./clip-path.svg";import{cls,svgPrefix}from"./style";import{cx}from"../emotion";const clip=decodeURIComponent(clipPath.replace(svgPrefix,""));const avatarSize={small:24,normal:32,large:40};const Avatar=_param=>{var{className,src,alt,username,size,style={},color}=_param,props=_objectWithoutProperties(_param,["className","src","alt","username","size","style","color"]);const box=useRef(null);const label=useRef(null);const[scale,setScale]=useState(1);useEffect(()=>{const hasSvg=document.documentElement.querySelector("clipPath#clipPathAvatar");if(!hasSvg){const svg=document.createElement("a");svg.innerHTML=clip;document.body.insertBefore(svg.firstChild,document.body.firstChild)}},[]);const _style=useMemo(()=>{if(typeof size==="number"){style.width=size;style.height=size}else if(size&&avatarSize[size]){style.width=avatarSize[size];style.height=avatarSize[size]}if(color)Object.assign(style,{"--avatar-color":color});return style},[color,size,style]);const img=useMemo(()=>typeof src==="string"?React.createElement("img",{src:src,alt:alt}):src,[alt,src]);useEffect(()=>{if(label.current&&box.current){if(label.current.clientWidth+6>box.current.clientWidth){setScale((box.current.clientWidth-6)/label.current.clientWidth)}}},[]);return React.createElement("div",_extends({ref:box,className:cx(cls.avatar,className),style:_style},props),img?img:username?React.createElement("span",{ref:label,style:{transform:`scale(${scale})`}},username):null)};export default Avatar;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import favicon from"./favicon.svg";import{injectGlobal}from"../emotion";import prefixCls from"../prefix-cls";export const svgPrefix="data:image/svg+xml,";export const cls={avatar:prefixCls("avatar")};const faviconBg=`data:image/svg+xml;base64,${window.btoa(decodeURIComponent(favicon.replace(svgPrefix,"")))}`;injectGlobal`
|
|
2
|
+
.${cls.avatar} {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
align-items: center;
|
|
7
|
+
inline-size: 32px;
|
|
8
|
+
block-size: 32px;
|
|
9
|
+
transition: transform 0.3s;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
user-select: none;
|
|
12
|
+
background-image: linear-gradient(45deg, #cabdeb 0%, #e9887c 100%);
|
|
13
|
+
animation: avatar-morph-effect 8s ease-in-out infinite;
|
|
14
|
+
|
|
15
|
+
&::before,
|
|
16
|
+
&::after {
|
|
17
|
+
position: absolute;
|
|
18
|
+
inset-block-start: 0;
|
|
19
|
+
inset-inline-start: 0;
|
|
20
|
+
display: block;
|
|
21
|
+
inline-size: 100%;
|
|
22
|
+
block-size: 100%;
|
|
23
|
+
content: '';
|
|
24
|
+
transition: transform 0.3s;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&::before {
|
|
28
|
+
background-color: var(--avatar-color);
|
|
29
|
+
clip-path: url('#clipPathAvatar');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&::after {
|
|
33
|
+
background: url(${faviconBg}) no-repeat center/contain;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
span {
|
|
37
|
+
transition: transform 0.3s;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:hover {
|
|
41
|
+
> *,
|
|
42
|
+
&::after,
|
|
43
|
+
&::before {
|
|
44
|
+
transform: scale(1.2);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
img {
|
|
49
|
+
position: absolute;
|
|
50
|
+
inset-inline-start: 0;
|
|
51
|
+
inline-size: 100%;
|
|
52
|
+
block-size: 100%;
|
|
53
|
+
clip-path: url('#clipPathAvatar');
|
|
54
|
+
transition: transform 0.3s;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@keyframes avatar-morph-effect {
|
|
59
|
+
0% {
|
|
60
|
+
border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
50% {
|
|
64
|
+
border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
100% {
|
|
68
|
+
border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { type AvatarProps } from '../index';
|
|
3
3
|
export interface AvatarGroupProps {
|
|
4
4
|
data: Omit<AvatarProps, 'size'>[];
|
|
@@ -6,5 +6,5 @@ export interface AvatarGroupProps {
|
|
|
6
6
|
className?: string;
|
|
7
7
|
maxCount?: number;
|
|
8
8
|
}
|
|
9
|
-
declare const AvatarGroup: FC<AvatarGroupProps>;
|
|
9
|
+
declare const AvatarGroup: React.FC<AvatarGroupProps>;
|
|
10
10
|
export default AvatarGroup;
|
package/es/avatar-group/index.js
CHANGED
|
@@ -1,21 +1 @@
|
|
|
1
|
-
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}import React,{useMemo
|
|
2
|
-
.${cls.group} {
|
|
3
|
-
display: inline-flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
|
|
6
|
-
& > *:not(:first-child) {
|
|
7
|
-
margin-left: -5%;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
.${cls.more} {
|
|
11
|
-
display: flex;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
align-items: center;
|
|
14
|
-
overflow-y: auto;
|
|
15
|
-
padding: 8px;
|
|
16
|
-
max-width: 60vw;
|
|
17
|
-
max-height: 80vh;
|
|
18
|
-
gap: 16px;
|
|
19
|
-
flex-wrap: wrap;
|
|
20
|
-
}
|
|
21
|
-
`;const AvatarGroup=props=>{const showAvatar=useMemo(()=>props.data.slice(0,props.maxCount),[props.data,props.maxCount]);const more=useMemo(()=>props.data.length-(props.maxCount||props.data.length),[props.data.length,props.maxCount]);useEffect(()=>{injectGlobal([avatarGroupCss])},[]);return React.createElement("div",{className:classNames(cls.group,props.className)},showAvatar.map((a,i)=>React.createElement(Avatar,_extends({key:`${i}-${a.src}`,size:props.size},a))),more>0?React.createElement(Tooltip,{title:React.createElement("div",{className:cls.more},props.data.slice(-more).map((a,i)=>React.createElement(Avatar,_extends({key:`${i}-${a.src}`,size:props.size},a))))},React.createElement(Avatar,{size:props.size,username:`+${more}`})):null)};export default AvatarGroup;
|
|
1
|
+
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}import React,{useMemo}from"react";import{cls}from"./style";import{cx}from"../emotion";import{Avatar,Tooltip}from"../index";const AvatarGroup=props=>{const showAvatar=useMemo(()=>props.data.slice(0,props.maxCount),[props.data,props.maxCount]);const more=useMemo(()=>props.data.length-(props.maxCount||props.data.length),[props.data.length,props.maxCount]);return React.createElement("div",{className:cx(cls.group,props.className)},showAvatar.map((a,i)=>React.createElement(Avatar,_extends({key:`${i}-${a.src}`,size:props.size},a))),more>0?React.createElement(Tooltip,{title:React.createElement("div",{className:cls.more},props.data.slice(-more).map((a,i)=>React.createElement(Avatar,_extends({key:`${i}-${a.src}`,size:props.size},a))))},React.createElement(Avatar,{size:props.size,username:`+${more}`})):null)};export default AvatarGroup;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{injectGlobal}from"../emotion";import prefixCls from"../prefix-cls";export const cls={group:prefixCls("avatar-group"),more:prefixCls("avatar-more")};injectGlobal`
|
|
2
|
+
.${cls.group} {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
|
|
6
|
+
& > *:not(:first-child) {
|
|
7
|
+
margin-inline-start: -5%;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
.${cls.more} {
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
overflow-y: auto;
|
|
15
|
+
padding: 8px;
|
|
16
|
+
max-inline-size: 60vi;
|
|
17
|
+
max-block-size: 80vb;
|
|
18
|
+
gap: 16px;
|
|
19
|
+
flex-wrap: wrap;
|
|
20
|
+
}
|
|
21
|
+
`;
|
package/es/back-top/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React
|
|
2
|
-
export interface BackTopProps extends HTMLAttributes<HTMLDivElement> {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface BackTopProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
/** 设置需要监听其滚动事件的元素,值为一个返回对应 DOM 元素 */
|
|
4
4
|
target?: () => HTMLElement;
|
|
5
5
|
/** 挂载到指定的元素,值为一个返回对应 DOM 元素 默认 document.body */
|
package/es/back-top/index.js
CHANGED
|
@@ -1,73 +1 @@
|
|
|
1
|
-
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}import React,{memo,useCallback,useEffect,useRef,useState}from"react";import{
|
|
2
|
-
:root {
|
|
3
|
-
--back-top-color: #fff;
|
|
4
|
-
--back-top-bg: var(--text-secondary, #4e4e4e);
|
|
5
|
-
--back-top-hover-bg: var(--text-color, rgb(0 0 0 / 65%));
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
[data-theme='dark'] {
|
|
9
|
-
--back-top-bg: rgb(255 255 255 / 45%);
|
|
10
|
-
}
|
|
11
|
-
.${cls.backtop} {
|
|
12
|
-
position: sticky;
|
|
13
|
-
bottom: 50px;
|
|
14
|
-
left: calc(100% - 100px);
|
|
15
|
-
z-index: 9;
|
|
16
|
-
display: flex;
|
|
17
|
-
justify-content: center;
|
|
18
|
-
align-items: center;
|
|
19
|
-
border-radius: 50%;
|
|
20
|
-
width: 40px;
|
|
21
|
-
min-width: 40px;
|
|
22
|
-
height: 40px;
|
|
23
|
-
min-height: 40px;
|
|
24
|
-
color: var(--back-top-color);
|
|
25
|
-
background-color: var(--back-top-bg);
|
|
26
|
-
box-shadow: var(--box-shadow-base);
|
|
27
|
-
transition: background-color var(--transition-duration), color var(--transition-duration);
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
animation: back-top-fade-in 1s forwards;
|
|
30
|
-
backdrop-filter: blur(16px);
|
|
31
|
-
|
|
32
|
-
&::before {
|
|
33
|
-
content: '';
|
|
34
|
-
display: block;
|
|
35
|
-
width: 16px;
|
|
36
|
-
height: 8px;
|
|
37
|
-
background-color: var(--back-top-color);
|
|
38
|
-
clip-path: polygon(0 100%, 50% 0, 100% 100%);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&:hover {
|
|
42
|
-
background-color: var(--back-top-hover-bg);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
.${cls.out} {
|
|
46
|
-
animation: back-top-fade-out 1s forwards;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@keyframes back-top-fade-in {
|
|
50
|
-
from {
|
|
51
|
-
transform: translate3d(0, 16px, 0) scale(1);
|
|
52
|
-
opacity: 0;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
to {
|
|
56
|
-
transform: translate3d(0, 0, 0) scale(1);
|
|
57
|
-
opacity: 1;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@keyframes back-top-fade-out {
|
|
62
|
-
0%,
|
|
63
|
-
20% {
|
|
64
|
-
transform: translate3d(0, 0, 0);
|
|
65
|
-
opacity: 1;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
100% {
|
|
69
|
-
transform: translate3d(0, 16px, 0);
|
|
70
|
-
opacity: 0;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
`;const BackTop=_param=>{var{target=()=>window,getPopupContainer,visibilityHeight=400,className}=_param,props=_objectWithoutProperties(_param,["target","getPopupContainer","visibilityHeight","className"]);const ref=useRef(null);const[show,setShow]=useState(null);const handleScrollY=useCallback(()=>{let scrollTop=0;let offsetHeight=0;if(isFunction(target)){const ele=target();if(ele){scrollTop=getScrollTop(ele);offsetHeight=ele.offsetHeight}}const nextShow=scrollTop>offsetHeight/3||scrollTop>visibilityHeight;if(Boolean(show)!==nextShow){setShow(nextShow)}},[show,target,visibilityHeight]);const handleBackTop=useCallback(()=>{var _target;(_target=target())===null||_target===void 0?void 0:_target.scrollTo({top:0,behavior:"smooth"})},[target]);useEffect(()=>{if(show&&ref.current){ref.current.style.zIndex=getMaxZindex().toString()}},[show]);useEffect(()=>{if(isFunction(target)){var _target;(_target=target())===null||_target===void 0?void 0:_target.addEventListener("scroll",handleScrollY,false)}return()=>{if(isFunction(target)){var _target;(_target=target())===null||_target===void 0?void 0:_target.removeEventListener("scroll",handleScrollY,false)}}},[handleScrollY,target]);const exit=useCallback(()=>{if(show===false){setShow(null)}},[show]);useEffect(()=>{injectGlobal([backTopCss])},[]);if(show===null)return null;return createPortal(React.createElement("div",_extends({},props,{ref:ref,onAnimationEnd:exit,className:classNames(className,cls.backtop,show===false&&cls.out),onClick:handleBackTop})),(getPopupContainer===null||getPopupContainer===void 0?void 0:getPopupContainer(target()))||document.body)};export default memo(BackTop,isEqual);
|
|
1
|
+
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}import React,{memo,useCallback,useEffect,useRef,useState}from"react";import{getMaxZindex,getScrollTop,isEqual,isFunction}from"@moneko/common";import{createPortal}from"react-dom";import{cls}from"./style";import{cx}from"../emotion";const BackTop=_param=>{var{target=()=>window,getPopupContainer,visibilityHeight=400,className}=_param,props=_objectWithoutProperties(_param,["target","getPopupContainer","visibilityHeight","className"]);const ref=useRef(null);const[show,setShow]=useState(null);const handleScrollY=useCallback(()=>{let scrollTop=0;let offsetHeight=0;if(isFunction(target)){const ele=target();if(ele){scrollTop=getScrollTop(ele);offsetHeight=ele.offsetHeight}}const nextShow=scrollTop>offsetHeight/3||scrollTop>visibilityHeight;if(Boolean(show)!==nextShow){setShow(nextShow)}},[show,target,visibilityHeight]);const handleBackTop=useCallback(()=>{var _target;(_target=target())===null||_target===void 0?void 0:_target.scrollTo({top:0,behavior:"smooth"})},[target]);useEffect(()=>{if(show&&ref.current){ref.current.style.zIndex=getMaxZindex().toString()}},[show]);useEffect(()=>{if(isFunction(target)){var _target;(_target=target())===null||_target===void 0?void 0:_target.addEventListener("scroll",handleScrollY,false)}return()=>{if(isFunction(target)){var _target;(_target=target())===null||_target===void 0?void 0:_target.removeEventListener("scroll",handleScrollY,false)}}},[handleScrollY,target]);const exit=useCallback(()=>{if(show===false){setShow(null)}},[show]);if(show===null)return null;return createPortal(React.createElement("div",_extends({},props,{ref:ref,onAnimationEnd:exit,className:cx(className,cls.backtop,show===false&&cls.out),onClick:handleBackTop})),(getPopupContainer===null||getPopupContainer===void 0?void 0:getPopupContainer(target()))||document.body)};export default memo(BackTop,isEqual);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import{injectGlobal}from"../emotion";import prefixCls from"../prefix-cls";export const cls={backtop:prefixCls("back-top"),out:prefixCls("back-top-out")};injectGlobal`
|
|
2
|
+
:root {
|
|
3
|
+
--back-top-color: #fff;
|
|
4
|
+
--back-top-bg: var(--text-secondary, #4e4e4e);
|
|
5
|
+
--back-top-hover-bg: var(--text-color, rgb(0 0 0 / 65%));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
[data-theme='dark'] {
|
|
9
|
+
--back-top-bg: rgb(255 255 255 / 45%);
|
|
10
|
+
}
|
|
11
|
+
.${cls.backtop} {
|
|
12
|
+
position: sticky;
|
|
13
|
+
inset-block-end: 50px;
|
|
14
|
+
inset-inline-start: calc(100% - 100px);
|
|
15
|
+
z-index: 9;
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
align-items: center;
|
|
19
|
+
border-radius: 50%;
|
|
20
|
+
inline-size: 40px;
|
|
21
|
+
min-inline-size: 40px;
|
|
22
|
+
block-size: 40px;
|
|
23
|
+
min-block-size: 40px;
|
|
24
|
+
color: var(--back-top-color);
|
|
25
|
+
background-color: var(--back-top-bg);
|
|
26
|
+
box-shadow: var(--box-shadow-base);
|
|
27
|
+
transition: background-color var(--transition-duration), color var(--transition-duration);
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
animation: back-top-fade-in 1s forwards;
|
|
30
|
+
backdrop-filter: blur(16px);
|
|
31
|
+
|
|
32
|
+
&::before {
|
|
33
|
+
content: '';
|
|
34
|
+
display: block;
|
|
35
|
+
inline-size: 16px;
|
|
36
|
+
block-size: 8px;
|
|
37
|
+
background-color: var(--back-top-color);
|
|
38
|
+
clip-path: polygon(0 100%, 50% 0, 100% 100%);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&:hover {
|
|
42
|
+
background-color: var(--back-top-hover-bg);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
.${cls.out} {
|
|
46
|
+
animation: back-top-fade-out 1s forwards;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@keyframes back-top-fade-in {
|
|
50
|
+
from {
|
|
51
|
+
transform: translate3d(0, 16px, 0) scale(1);
|
|
52
|
+
opacity: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
to {
|
|
56
|
+
transform: translate3d(0, 0, 0) scale(1);
|
|
57
|
+
opacity: 1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@keyframes back-top-fade-out {
|
|
62
|
+
0%,
|
|
63
|
+
20% {
|
|
64
|
+
transform: translate3d(0, 0, 0);
|
|
65
|
+
opacity: 1;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
100% {
|
|
69
|
+
transform: translate3d(0, 16px, 0);
|
|
70
|
+
opacity: 0;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
`;
|
package/es/button/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ButtonType } from './style';
|
|
2
3
|
import type { ComponentSize } from '../';
|
|
3
|
-
export type ButtonType
|
|
4
|
-
export interface ButtonProps extends HTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
export type { ButtonType } from './style';
|
|
5
|
+
export interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
5
6
|
/** 按钮类型 */
|
|
6
7
|
type?: ButtonType;
|
|
7
8
|
/** 无限动画 */
|
|
@@ -26,5 +27,5 @@ export interface ButtonProps extends HTMLAttributes<HTMLButtonElement> {
|
|
|
26
27
|
danger?: boolean;
|
|
27
28
|
size?: ComponentSize;
|
|
28
29
|
}
|
|
29
|
-
declare const Button: FC<ButtonProps>;
|
|
30
|
+
declare const Button: React.FC<ButtonProps>;
|
|
30
31
|
export default Button;
|