x-ui-design 0.8.11 → 0.8.13
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/DatePicker/RangePicker/RangePicker.d.ts +1 -1
- package/dist/esm/types/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/esm/types/components/Popover/Popover.d.ts +1 -1
- package/dist/esm/types/types/datepicker.d.ts +1 -1
- package/dist/esm/types/types/dropdown.d.ts +1 -2
- package/dist/esm/types/types/popover.d.ts +4 -1
- package/dist/index.esm.js +24 -19
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +24 -19
- package/dist/index.js.map +1 -1
- package/lib/components/DatePicker/RangePicker/RangePicker.tsx +4 -4
- package/lib/components/Dropdown/Dropdown.tsx +2 -3
- package/lib/components/Popover/Popover.tsx +25 -18
- package/lib/components/Popover/style.css +4 -0
- package/lib/types/datepicker.ts +1 -1
- package/lib/types/dropdown.ts +1 -2
- package/lib/types/popover.ts +4 -1
- package/package.json +1 -1
- package/src/app/page.tsx +1 -1
package/dist/index.js
CHANGED
|
@@ -2442,7 +2442,7 @@ const RangePicker = ({
|
|
|
2442
2442
|
picker = 'date',
|
|
2443
2443
|
locale,
|
|
2444
2444
|
disabledDate,
|
|
2445
|
-
|
|
2445
|
+
onVisibleChange,
|
|
2446
2446
|
onCalendarChange,
|
|
2447
2447
|
style = {},
|
|
2448
2448
|
className = '',
|
|
@@ -2482,7 +2482,7 @@ const RangePicker = ({
|
|
|
2482
2482
|
const handleClickOutside = event => {
|
|
2483
2483
|
if (popupRef.current && !popupRef.current.contains(event.target) && triggerRef.current && !triggerRef.current.contains(event.target)) {
|
|
2484
2484
|
setIsOpen(false);
|
|
2485
|
-
|
|
2485
|
+
onVisibleChange?.(false);
|
|
2486
2486
|
}
|
|
2487
2487
|
};
|
|
2488
2488
|
document.addEventListener('mousedown', handleClickOutside);
|
|
@@ -2507,7 +2507,7 @@ const RangePicker = ({
|
|
|
2507
2507
|
onChange?.([begin.toUTCString(), end.toUTCString()], [formatDate(begin), formatDate(end)]);
|
|
2508
2508
|
onCalendarChange?.([begin.toUTCString(), end.toUTCString()], [formatDate(begin), formatDate(end)], {});
|
|
2509
2509
|
setIsOpen(false);
|
|
2510
|
-
|
|
2510
|
+
onVisibleChange?.(false);
|
|
2511
2511
|
}
|
|
2512
2512
|
};
|
|
2513
2513
|
const isMonthDisabled = month => {
|
|
@@ -2703,7 +2703,7 @@ const RangePicker = ({
|
|
|
2703
2703
|
e.stopPropagation();
|
|
2704
2704
|
if (!isOpen) {
|
|
2705
2705
|
setIsOpen(!isOpen);
|
|
2706
|
-
|
|
2706
|
+
onVisibleChange?.(!isOpen);
|
|
2707
2707
|
}
|
|
2708
2708
|
}
|
|
2709
2709
|
}, prefix, /*#__PURE__*/React.createElement("input", {
|
|
@@ -4731,7 +4731,7 @@ const Dropdown = ({
|
|
|
4731
4731
|
menu,
|
|
4732
4732
|
open: controlledOpen,
|
|
4733
4733
|
defaultOpen = false,
|
|
4734
|
-
|
|
4734
|
+
onVisibleChange,
|
|
4735
4735
|
trigger = 'hover',
|
|
4736
4736
|
placement = 'bottomLeft',
|
|
4737
4737
|
overlayClassName = '',
|
|
@@ -4744,8 +4744,7 @@ const Dropdown = ({
|
|
|
4744
4744
|
popupRender,
|
|
4745
4745
|
className = '',
|
|
4746
4746
|
overlay,
|
|
4747
|
-
prefixCls = prefixClsDropdown
|
|
4748
|
-
onVisibleChange
|
|
4747
|
+
prefixCls = prefixClsDropdown
|
|
4749
4748
|
}) => {
|
|
4750
4749
|
const [open, setOpen] = React.useState(controlledOpen ?? defaultOpen);
|
|
4751
4750
|
const [_hover, setHover] = React.useState(controlledOpen ?? defaultOpen);
|
|
@@ -4785,7 +4784,7 @@ const Dropdown = ({
|
|
|
4785
4784
|
if (!isControlled) {
|
|
4786
4785
|
setOpen(next);
|
|
4787
4786
|
}
|
|
4788
|
-
|
|
4787
|
+
onVisibleChange?.(next);
|
|
4789
4788
|
onVisibleChange?.(next);
|
|
4790
4789
|
};
|
|
4791
4790
|
React.useEffect(() => {
|
|
@@ -4900,7 +4899,7 @@ var Dropdown$1 = /*#__PURE__*/Object.freeze({
|
|
|
4900
4899
|
default: Dropdown
|
|
4901
4900
|
});
|
|
4902
4901
|
|
|
4903
|
-
var css_248z = ".xUi-popover{&:before{content:\"\";height:8px;left:0;position:absolute;top:-8px;width:100%;z-index:10000}}.xUi-popover-wrapper{display:inline-block;position:relative}.xUi-popover-wrapper-content{cursor:pointer}.xUi-popover{background:var(--xui-background-color);border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,.15);padding:8px 12px;width:max-content;z-index:1000}.xUi-popover-inner{color:var(--xui-text-color);font-size:14px}.xUi-popover-arrow{background:var(--xui-background-color);border-left:.5px solid var(--xui-border-color);border-top:.5px solid var(--xui-border-color);height:10px;left:12px;position:absolute;top:-6px;transform:rotate(45deg);width:10px}.xUi-popover-arrow.bottom{border-bottom:.5px solid var(--xui-border-color);border-left:unset;border-right:.5px solid var(--xui-border-color);border-top:unset;bottom:-6px;top:unset}";
|
|
4902
|
+
var css_248z = ".xUi-popover{&:before{content:\"\";height:8px;left:0;position:absolute;top:-8px;width:100%;z-index:10000}}.xUi-popover-wrapper{display:inline-block;position:relative}.xUi-popover-wrapper-content{cursor:pointer}.xUi-popover{background:var(--xui-background-color);border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,.15);padding:8px 12px;width:max-content;z-index:1000}.xUi-popover-title{padding:4px}.xUi-popover-inner{color:var(--xui-text-color);font-size:14px}.xUi-popover-arrow{background:var(--xui-background-color);border-left:.5px solid var(--xui-border-color);border-top:.5px solid var(--xui-border-color);height:10px;left:12px;position:absolute;top:-6px;transform:rotate(45deg);width:10px}.xUi-popover-arrow.bottom{border-bottom:.5px solid var(--xui-border-color);border-left:unset;border-right:.5px solid var(--xui-border-color);border-top:unset;bottom:-6px;top:unset}";
|
|
4904
4903
|
styleInject(css_248z);
|
|
4905
4904
|
|
|
4906
4905
|
const Popover = ({
|
|
@@ -4910,15 +4909,18 @@ const Popover = ({
|
|
|
4910
4909
|
trigger = "click",
|
|
4911
4910
|
placement = "bottom",
|
|
4912
4911
|
open,
|
|
4912
|
+
visible,
|
|
4913
|
+
title,
|
|
4914
|
+
overlayClassName = '',
|
|
4913
4915
|
overlayStyle = {},
|
|
4914
|
-
|
|
4916
|
+
onVisibleChange,
|
|
4915
4917
|
getPopupContainer
|
|
4916
4918
|
}) => {
|
|
4917
4919
|
const triggerRef = React.useRef(null);
|
|
4918
4920
|
const popupRef = React.useRef(null);
|
|
4919
4921
|
const [innerOpen, setInnerOpen] = React.useState(false);
|
|
4920
|
-
const
|
|
4921
|
-
const
|
|
4922
|
+
const [hover, setHover] = React.useState(false);
|
|
4923
|
+
const isOpen = visible !== undefined ? visible : open !== undefined ? open : innerOpen;
|
|
4922
4924
|
const {
|
|
4923
4925
|
dropdownPosition,
|
|
4924
4926
|
shouldShowAbove
|
|
@@ -4931,18 +4933,19 @@ const Popover = ({
|
|
|
4931
4933
|
getPopupContainer: getPopupContainer?.(triggerRef.current)
|
|
4932
4934
|
});
|
|
4933
4935
|
const toggle = () => {
|
|
4934
|
-
|
|
4936
|
+
const newState = !isOpen;
|
|
4937
|
+
onVisibleChange ? onVisibleChange(newState) : setInnerOpen(newState);
|
|
4935
4938
|
};
|
|
4936
4939
|
const show = () => {
|
|
4937
4940
|
setHover(true);
|
|
4938
4941
|
if (trigger === "hover") {
|
|
4939
|
-
|
|
4942
|
+
onVisibleChange ? onVisibleChange(true) : setInnerOpen(true);
|
|
4940
4943
|
}
|
|
4941
4944
|
};
|
|
4942
4945
|
const hide = () => {
|
|
4943
4946
|
setHover(false);
|
|
4944
4947
|
if (trigger === "hover") {
|
|
4945
|
-
|
|
4948
|
+
onVisibleChange ? onVisibleChange(false) : setInnerOpen(false);
|
|
4946
4949
|
}
|
|
4947
4950
|
};
|
|
4948
4951
|
const childProps = trigger === "click" ? {
|
|
@@ -4958,18 +4961,20 @@ const Popover = ({
|
|
|
4958
4961
|
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
4959
4962
|
className: `${prefixCls}-wrapper-content`
|
|
4960
4963
|
}, childProps), children), isOpen && /*#__PURE__*/React.createElement(ConditionalWrapper, {
|
|
4961
|
-
condition: getPopupContainer
|
|
4964
|
+
condition: !!getPopupContainer,
|
|
4962
4965
|
wrapper: element => getPopupContainer ? /*#__PURE__*/reactDom.createPortal(element, getPopupContainer(popupRef.current)) : /*#__PURE__*/React.createElement(React.Fragment, null, element)
|
|
4963
4966
|
}, /*#__PURE__*/React.createElement("div", {
|
|
4964
4967
|
ref: popupRef,
|
|
4965
|
-
className: clsx(prefixCls, `${prefixCls}-${placement}
|
|
4968
|
+
className: clsx(prefixCls, `${prefixCls}-${placement}`, overlayClassName),
|
|
4966
4969
|
style: {
|
|
4967
|
-
zIndex:
|
|
4970
|
+
zIndex: hover ? 1000 : 1,
|
|
4968
4971
|
...overlayStyle,
|
|
4969
4972
|
position: "absolute",
|
|
4970
4973
|
...dropdownPosition
|
|
4971
4974
|
}
|
|
4972
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
4975
|
+
}, title && /*#__PURE__*/React.createElement("div", {
|
|
4976
|
+
className: `${prefixCls}-title`
|
|
4977
|
+
}, title), /*#__PURE__*/React.createElement("div", {
|
|
4973
4978
|
className: `${prefixCls}-inner`
|
|
4974
4979
|
}, content), /*#__PURE__*/React.createElement("div", {
|
|
4975
4980
|
className: `${prefixCls}-arrow ${shouldShowAbove ? 'bottom' : ''}`
|