x-ui-design 0.1.97 → 0.1.98
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/esm/types/components/Button/Button.d.ts +2 -6
- package/dist/esm/types/components/Button/index.d.ts +1 -1
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +33 -43
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +33 -43
- package/dist/index.js.map +1 -1
- package/lib/components/Button/Button.tsx +37 -17
- package/lib/components/Button/index.ts +1 -1
- package/lib/index.ts +1 -1
- package/package.json +1 -1
- package/dist/esm/types/components/Button/Button.client.d.ts +0 -3
- package/lib/components/Button/Button.client.tsx +0 -39
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { ButtonProps } from '../../types/button';
|
|
3
3
|
import './style.css';
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
isLoading?: boolean;
|
|
7
|
-
};
|
|
8
|
-
declare const ButtonBase: ({ type, variant, color, shape, size, htmlType, className, rootClassName, classNames: customClassNames, styles, prefixCls, iconPosition, disabled, ghost, danger, block, children, href, iconNode, isLoading, ...restProps }: ButtonBaseProps) => ReactElement;
|
|
9
|
-
export default ButtonBase;
|
|
4
|
+
declare const ButtonComponent: ({ type, variant, color, shape, size, htmlType, className, rootClassName, classNames: customClassNames, styles, prefixCls, icon, iconPosition, loading, disabled, ghost, danger, block, children, href, ...restProps }: ButtonProps) => ReactElement;
|
|
5
|
+
export default ButtonComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Button } from './Button
|
|
1
|
+
export { default as Button } from './Button';
|
|
@@ -18,7 +18,7 @@ export { default as SkeletonInput } from "./components/Skeleton/Input/Input";
|
|
|
18
18
|
export { default as SkeletonAvatar } from "./components/Skeleton/Avatar/Avatar";
|
|
19
19
|
export { default as SkeletonButton } from "./components/Skeleton/Button/Button";
|
|
20
20
|
export { default as Empty } from "./components/Empty/Empty";
|
|
21
|
-
export { default as Button } from "./components/Button/Button
|
|
21
|
+
export { default as Button } from "./components/Button/Button";
|
|
22
22
|
export { default as Upload } from "./components/Upload/Upload";
|
|
23
23
|
export { default as Checkbox } from "./components/Checkbox/Checkbox";
|
|
24
24
|
export { ClearIcon, ArrowIcon, LoadingIcon, CheckIcon, SearchIcon, CalendarIcon, SuccessIcon, ErrorIcon, DateDistanceIcon, TimeIcon, StampleIcon, TrashIcon, SpinerIcon } from './components/Icons/Icons';
|
package/dist/index.d.ts
CHANGED
|
@@ -593,7 +593,7 @@ interface ButtonProps extends BaseButtonProps, Omit<ButtonHTMLAttributes<HTMLBut
|
|
|
593
593
|
htmlType?: ButtonHTMLType;
|
|
594
594
|
}
|
|
595
595
|
|
|
596
|
-
declare const
|
|
596
|
+
declare const ButtonComponent: ({ type, variant, color, shape, size, htmlType, className, rootClassName, classNames: customClassNames, styles, prefixCls, icon, iconPosition, loading, disabled, ghost, danger, block, children, href, ...restProps }: ButtonProps) => ReactElement;
|
|
597
597
|
|
|
598
598
|
interface RcFile extends File {
|
|
599
599
|
uid: string;
|
|
@@ -697,4 +697,4 @@ type UseWatchProps = {
|
|
|
697
697
|
};
|
|
698
698
|
declare const useWatch: ({ name, defaultValue, form }: UseWatchProps) => any;
|
|
699
699
|
|
|
700
|
-
export { ArrowIcon,
|
|
700
|
+
export { ArrowIcon, ButtonComponent as Button, CalendarIcon, CheckIcon, Checkbox, ClearIcon, DateDistanceIcon, DatePicker, EmptyContent as Empty, ErrorIcon, Form, FormItem, Input, LoadingIcon, Option, Radio, RadioButton, RadioGroup, RangePicker, SearchIcon, Select, Skeleton, SkeletonAvatar, SkeletonButton, SkeletonImage, SkeletonInput, SpinerIcon, StampleIcon, SuccessIcon, Tag, Textarea, TimeIcon, TimePicker, TrashIcon, Upload, useForm, useWatch };
|
package/dist/index.esm.js
CHANGED
|
@@ -2547,7 +2547,7 @@ Skeleton.Button = SkeletonButton;
|
|
|
2547
2547
|
var css_248z$2 = ".xUi-button{border:1px solid transparent;border-radius:6px;cursor:pointer;font-weight:400;line-height:1.5715;transition:all .3s ease;user-select:none;vertical-align:middle;white-space:nowrap}.xUi-button,.xUi-button-content,.xUi-button-icon{align-items:center;display:inline-flex;justify-content:center}.xUi-button-icon{line-height:0;margin-right:.5em}.xUi-button-icon:last-child{margin-left:.5em;margin-right:0}.xUi-button-spinner{animation:xUi-spin 1s linear infinite;border:1px solid transparent;border-radius:50%;border-top:1px solid var(--xui-text-color);height:1em;width:1em}@keyframes xUi-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.xUi-button-size-small{font-size:12px;height:24px;padding:4px 12px}.xUi-button-size-middle{font-size:14px;height:32px;padding:0 16px}.xUi-button-size-large{font-size:16px;height:40px;padding:8px 20px}.xUi-button-circle{border-radius:50%;justify-content:center;padding:0}.xUi-button-circle.xUi-button-size-small{height:24px;width:24px}.xUi-button-circle.xUi-button-size-large{height:40px;width:40px}.xUi-button-round{border-radius:9999px}.xUi-button-default{background-color:#fff;border-color:var(--xui-border-color);color:rgba(0,0,0,.85)}.xUi-button-default:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-primary{background-color:var(--xui-primary-color);border-color:var(--xui-primary-color);color:#fff}.xUi-button-primary:hover{background-color:var(--xui-primary-color-light);border-color:var(--xui-primary-color-light);color:#fff}.xUi-button-dashed{background-color:#fff;border-color:var(--xui-border-color);border-style:dashed;color:rgba(0,0,0,.85)}.xUi-button-dashed:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-text{background-color:transparent;border-color:transparent!important;color:rgba(0,0,0,.88)}.xUi-button-text:hover{background-color:rgba(0,0,0,.04);border-color:transparent;color:rgba(0,0,0,.88)}.xUi-button-link{background-color:transparent;border-color:transparent!important;color:var(--xui-primary-color)}.xUi-button-link:hover{border-color:transparent;color:var(--xui-primary-color-light)}.xUi-button-outlined{color:#fff}.xUi-button-filled,.xUi-button-outlined{background-color:transparent;border-color:var(--xui-border-color)}.xUi-button-filled{color:var(--xui-text-color)}.xUi-button-danger{background-color:transparent;border-color:var(--xui-error-color);color:var(--xui-error-color)}.xUi-button-danger:hover{border-color:var(--xui-error-color-light);color:var(--xui-error-color-light)}.xUi-button-ghost{opacity:0}.xUi-button-ghost:hover{opacity:1}.xUi-button-block{display:flex;width:100%}.xUi-button-disabled,.xUi-button-loading{background-color:var(--xui-color-disabled);border-color:var(--xui-border-color);color:var(--xui-text-color);cursor:not-allowed;opacity:.5;pointer-events:none}.xUi-button-loading{background-color:transparent}";
|
|
2548
2548
|
styleInject(css_248z$2);
|
|
2549
2549
|
|
|
2550
|
-
const
|
|
2550
|
+
const ButtonComponent = ({
|
|
2551
2551
|
type = 'default',
|
|
2552
2552
|
variant = 'solid',
|
|
2553
2553
|
color = 'default',
|
|
@@ -2559,34 +2559,52 @@ const ButtonBase = ({
|
|
|
2559
2559
|
classNames: customClassNames = {},
|
|
2560
2560
|
styles = {},
|
|
2561
2561
|
prefixCls = prefixClsButton,
|
|
2562
|
+
icon,
|
|
2562
2563
|
iconPosition = 'start',
|
|
2564
|
+
loading = false,
|
|
2563
2565
|
disabled = false,
|
|
2564
2566
|
ghost = false,
|
|
2565
2567
|
danger = false,
|
|
2566
2568
|
block = false,
|
|
2567
2569
|
children,
|
|
2568
2570
|
href,
|
|
2569
|
-
iconNode,
|
|
2570
|
-
isLoading = false,
|
|
2571
2571
|
...restProps
|
|
2572
2572
|
}) => {
|
|
2573
|
+
const [innerLoading, setInnerLoading] = useState(false);
|
|
2574
|
+
useEffect(() => {
|
|
2575
|
+
if (typeof loading === 'boolean') {
|
|
2576
|
+
setInnerLoading(loading);
|
|
2577
|
+
} else if (typeof loading === 'object' && loading.delay) {
|
|
2578
|
+
const timeout = setTimeout(() => setInnerLoading(true), loading.delay);
|
|
2579
|
+
return () => clearTimeout(timeout);
|
|
2580
|
+
} else {
|
|
2581
|
+
setInnerLoading(!!loading);
|
|
2582
|
+
}
|
|
2583
|
+
}, [loading]);
|
|
2573
2584
|
const classes = clsx(prefixCls, rootClassName, `${prefixCls}-${type}`, `${prefixCls}-${variant}`, `${prefixCls}-${color}`, `${prefixCls}-${shape}`, `${prefixCls}-size-${size}`, {
|
|
2574
2585
|
[`${prefixCls}-block`]: block,
|
|
2575
2586
|
[`${prefixCls}-ghost`]: ghost,
|
|
2576
2587
|
[`${prefixCls}-danger`]: danger,
|
|
2577
|
-
[`${prefixCls}-loading`]:
|
|
2588
|
+
[`${prefixCls}-loading`]: innerLoading,
|
|
2578
2589
|
[`${prefixCls}-disabled`]: disabled
|
|
2579
2590
|
}, className);
|
|
2580
|
-
const
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
},
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2591
|
+
const iconNode = useMemo(() => {
|
|
2592
|
+
return innerLoading ? typeof loading === 'object' && loading.icon || /*#__PURE__*/React.createElement("span", {
|
|
2593
|
+
className: `${prefixCls}-spinner`
|
|
2594
|
+
}) : icon;
|
|
2595
|
+
}, [icon, innerLoading, loading, prefixCls]);
|
|
2596
|
+
const content = useMemo(() => {
|
|
2597
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, iconNode && iconPosition === 'start' && /*#__PURE__*/React.createElement("span", {
|
|
2598
|
+
className: clsx(`${prefixCls}-icon`, customClassNames.icon),
|
|
2599
|
+
style: styles.icon
|
|
2600
|
+
}, iconNode), /*#__PURE__*/React.createElement("span", {
|
|
2601
|
+
className: `${prefixCls}-content`
|
|
2602
|
+
}, children), iconNode && iconPosition === 'end' && /*#__PURE__*/React.createElement("span", {
|
|
2603
|
+
className: clsx(`${prefixCls}-icon`, customClassNames.icon),
|
|
2604
|
+
style: styles.icon
|
|
2605
|
+
}, iconNode));
|
|
2606
|
+
}, [children, customClassNames.icon, iconNode, iconPosition, prefixCls, styles.icon]);
|
|
2607
|
+
const mergedDisabled = disabled || innerLoading;
|
|
2590
2608
|
if (href) {
|
|
2591
2609
|
return /*#__PURE__*/React.createElement("a", {
|
|
2592
2610
|
className: classes,
|
|
@@ -2601,34 +2619,6 @@ const ButtonBase = ({
|
|
|
2601
2619
|
}, restProps), content);
|
|
2602
2620
|
};
|
|
2603
2621
|
|
|
2604
|
-
const MyButton = props => {
|
|
2605
|
-
const {
|
|
2606
|
-
loading = false,
|
|
2607
|
-
icon,
|
|
2608
|
-
prefixCls = prefixClsButton
|
|
2609
|
-
} = props;
|
|
2610
|
-
const [innerLoading, setInnerLoading] = useState(false);
|
|
2611
|
-
useEffect(() => {
|
|
2612
|
-
if (typeof loading === 'boolean') {
|
|
2613
|
-
setInnerLoading(loading);
|
|
2614
|
-
} else if (typeof loading === 'object' && loading.delay) {
|
|
2615
|
-
const timeout = setTimeout(() => setInnerLoading(true), loading.delay);
|
|
2616
|
-
return () => clearTimeout(timeout);
|
|
2617
|
-
} else {
|
|
2618
|
-
setInnerLoading(!!loading);
|
|
2619
|
-
}
|
|
2620
|
-
}, [loading]);
|
|
2621
|
-
const iconNode = useMemo(() => {
|
|
2622
|
-
return innerLoading ? typeof loading === 'object' && loading.icon || /*#__PURE__*/React.createElement("span", {
|
|
2623
|
-
className: `${prefixCls}-spinner`
|
|
2624
|
-
}) : icon;
|
|
2625
|
-
}, [icon, innerLoading, loading, prefixCls]);
|
|
2626
|
-
return /*#__PURE__*/React.createElement(ButtonBase, _extends({}, props, {
|
|
2627
|
-
isLoading: innerLoading,
|
|
2628
|
-
iconNode: iconNode
|
|
2629
|
-
}));
|
|
2630
|
-
};
|
|
2631
|
-
|
|
2632
2622
|
var css_248z$1 = ".xUi-upload-wrapper{font-family:Arial,sans-serif;width:100%}.xUi-upload{align-items:center;border-radius:6px;color:#666;cursor:pointer;display:flex;justify-content:flex-start;text-align:center;transition:all .3s}.xUi-upload:hover{border-color:var(--xui-primary-color,var(--xui-primary-color));color:var(--xui-primary-color,var(--xui-primary-color))}.xUi-upload-disabled{cursor:not-allowed;opacity:.6}.xUi-upload-disabled .xUi-upload-picture button{cursor:not-allowed}.xUi-upload-input{display:none}.xUi-upload-list{list-style:none;margin:0;padding:0}.xUi-upload-list-picture .xUi-upload-item{border:1px dashed var(--xui-border-color);line-height:unset;margin-top:8px;padding:8px}.xUi-upload-list-picture .xUi-upload-item-done{border:1px solid var(--xui-border-color)}.xUi-upload-list-picture .xUi-upload-item-error{border:1px solid var(--xui-error-color)}.xUi-upload-list-picture .xUi-upload-item-error .xUi-upload-item-title{color:var(--xui-error-color)}.xUi-upload-item{align-items:center;border-radius:8px;color:#333;display:flex;font-size:14px;gap:8px;line-height:35px;margin:0;transition:background .3s}.xUi-upload-item.uploading{color:var(--xui-primary-color)}.xUi-upload-item.done{color:var(--xui-success-color)}.xUi-upload-item.error{color:var(--xui-error-color)}.xUi-upload-remove{color:rgba(0,0,0,.45)}.xUi-upload-item-title{align-items:center;color:var(--xui-text-color);display:flex;justify-content:space-between}.xUi-upload-item-title svg{color:var(--xui-error-color)}.xUi-upload-list-picture-card{display:flex;flex-wrap:wrap;gap:8px}.xUi-upload-list-picture-card .xUi-upload-item{align-items:center;border-radius:4px;display:flex;flex-direction:column;height:104px;justify-content:center;position:relative;width:104px}.xUi-upload-list-picture-card .xUi-upload-item img{max-height:100%;max-width:100%;object-fit:cover}.xUi-upload-list-picture-card .xUi-upload-remove{border-radius:50%;color:#fff;font-size:12px;line-height:1;padding:2px 6px;position:absolute;right:4px;top:4px}.xUi-upload-item-thumbnail{border-radius:4px;height:40px;object-fit:cover;width:40px}.xUi-upload-item-progress-line{border:1px solid var(--xui-border-color);height:0;width:calc(100% - 8px)}.xUi-upload-item-progress-line-percent{border:1px solid red;height:0;position:relative;top:-2px}";
|
|
2633
2623
|
styleInject(css_248z$1);
|
|
2634
2624
|
|
|
@@ -2942,5 +2932,5 @@ const useWatch = ({
|
|
|
2942
2932
|
return value;
|
|
2943
2933
|
};
|
|
2944
2934
|
|
|
2945
|
-
export { ArrowIcon,
|
|
2935
|
+
export { ArrowIcon, ButtonComponent as Button, CalendarIcon, CheckIcon, Checkbox, ClearIcon, DateDistanceIcon, DatePicker, EmptyContent as Empty, ErrorIcon, Form, FormItem, Input, LoadingIcon, Option, Radio, RadioButton, RadioGroup, RangePicker, SearchIcon, Select, Skeleton, SkeletonAvatar, SkeletonButton, SkeletonImage, SkeletonInput, SpinerIcon, StampleIcon, SuccessIcon, Tag, Textarea, TimeIcon, TimePicker, TrashIcon, Upload, useForm, useWatch };
|
|
2946
2936
|
//# sourceMappingURL=index.esm.js.map
|