x-ui-design 0.3.26 → 0.3.28
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/index.esm.js +34 -23
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +34 -23
- package/dist/index.js.map +1 -1
- package/lib/components/Select/Option/style.css +1 -0
- package/lib/components/Select/Select.tsx +40 -27
- package/lib/components/Skeleton/Image/style.css +2 -0
- package/package.json +1 -1
- package/src/app/page.tsx +20 -16
package/dist/index.esm.js
CHANGED
|
@@ -2842,7 +2842,7 @@ var Radio$2 = /*#__PURE__*/Object.freeze({
|
|
|
2842
2842
|
default: Radio$1
|
|
2843
2843
|
});
|
|
2844
2844
|
|
|
2845
|
-
var css_248z$7 = ".xUi-select-options{list-style:none;margin:0;padding:4px}.xUi-select-option,.xUi-select-options{border-radius:var(--xui-border-radius-sm)}.xUi-select-option{align-items:center;color:var(--xui-text-color);cursor:pointer;display:flex;font-size:var(--xui-font-size-md);padding:8px 16px}.xUi-select-option.xUi-select-focused,.xUi-select-option:hover{background-color:var(--xui-primary-color);color:var(--xui-background-color)}.xUi-select-option.xUi-select-focused{align-items:center;display:flex;font-weight:600;justify-content:space-between}.xUi-select-option.xUi-select-disabled{color:rgba(0,0,0,.25);cursor:not-allowed}.xUi-select-option.selected{background-color:var(--xui-primary-color);color:var(--xui-background-color)}.xUi-select-option.selected:hover{background-color:var(--xui-primary-color-light)}";
|
|
2845
|
+
var css_248z$7 = ".xUi-select-options{list-style:none;margin:0;padding:4px}.xUi-select-option,.xUi-select-options{border-radius:var(--xui-border-radius-sm)}.xUi-select-option{align-items:center;color:var(--xui-text-color);cursor:pointer;display:flex;font-size:var(--xui-font-size-md);margin-bottom:2px;padding:8px 16px}.xUi-select-option.xUi-select-focused,.xUi-select-option:hover{background-color:var(--xui-primary-color);color:var(--xui-background-color)}.xUi-select-option.xUi-select-focused{align-items:center;display:flex;font-weight:600;justify-content:space-between}.xUi-select-option.xUi-select-disabled{color:rgba(0,0,0,.25);cursor:not-allowed}.xUi-select-option.selected{background-color:var(--xui-primary-color);color:var(--xui-background-color)}.xUi-select-option.selected:hover{background-color:var(--xui-primary-color-light)}";
|
|
2846
2846
|
styleInject(css_248z$7);
|
|
2847
2847
|
|
|
2848
2848
|
const Option = ({
|
|
@@ -3040,21 +3040,21 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3040
3040
|
const spaceBelow = windowHeight - selectBox.bottom;
|
|
3041
3041
|
const spaceAbove = selectBox.top;
|
|
3042
3042
|
let positionStyle = {
|
|
3043
|
-
...(getPopupContainer ? {
|
|
3044
|
-
top: `${selectBox.bottom}px`,
|
|
3045
|
-
left: `${selectBox.left}px`
|
|
3046
|
-
} : {}),
|
|
3047
3043
|
width: `${selectBox.width}px`,
|
|
3048
3044
|
position: 'absolute'
|
|
3049
3045
|
};
|
|
3050
|
-
|
|
3046
|
+
const shouldShowAbove = spaceBelow < dropdownHeight && spaceAbove > dropdownHeight;
|
|
3047
|
+
if (getPopupContainer) {
|
|
3051
3048
|
positionStyle = {
|
|
3052
|
-
...
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3049
|
+
...positionStyle,
|
|
3050
|
+
top: shouldShowAbove ? `${selectBox.top - dropdownHeight}px` : `${selectBox.bottom}px`,
|
|
3051
|
+
left: `${selectBox.left}px`
|
|
3052
|
+
};
|
|
3053
|
+
} else {
|
|
3054
|
+
positionStyle = {
|
|
3055
|
+
...positionStyle,
|
|
3056
|
+
top: shouldShowAbove ? `${selectRef.current.clientHeight - dropdownHeight - PADDING_PLACEMENT}px` : `${selectBox.height}px`,
|
|
3057
|
+
left: `${window.scrollX}px`
|
|
3058
3058
|
};
|
|
3059
3059
|
}
|
|
3060
3060
|
setDropdownPosition(positionStyle);
|
|
@@ -3062,21 +3062,26 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3062
3062
|
useEffect(() => {
|
|
3063
3063
|
if (!isOpen) return;
|
|
3064
3064
|
updateDropdownPosition();
|
|
3065
|
+
const controller = new AbortController();
|
|
3065
3066
|
const scrollableParents = getScrollParents(selectRef.current);
|
|
3066
3067
|
const handleScroll = () => {
|
|
3067
3068
|
updateDropdownPosition();
|
|
3068
3069
|
};
|
|
3069
3070
|
scrollableParents.forEach(el => {
|
|
3070
3071
|
el.addEventListener('scroll', handleScroll, {
|
|
3071
|
-
passive: true
|
|
3072
|
+
passive: true,
|
|
3073
|
+
signal: controller.signal
|
|
3072
3074
|
});
|
|
3073
3075
|
});
|
|
3074
|
-
window.addEventListener('
|
|
3076
|
+
window.addEventListener('scroll', handleScroll, {
|
|
3077
|
+
passive: true,
|
|
3078
|
+
signal: controller.signal
|
|
3079
|
+
});
|
|
3080
|
+
window.addEventListener('resize', updateDropdownPosition, {
|
|
3081
|
+
signal: controller.signal
|
|
3082
|
+
});
|
|
3075
3083
|
return () => {
|
|
3076
|
-
|
|
3077
|
-
el.removeEventListener('scroll', handleScroll);
|
|
3078
|
-
});
|
|
3079
|
-
window.removeEventListener('resize', updateDropdownPosition);
|
|
3084
|
+
controller.abort();
|
|
3080
3085
|
};
|
|
3081
3086
|
}, [isOpen, getPopupContainer, updateDropdownPosition]);
|
|
3082
3087
|
const getScrollParents = element => {
|
|
@@ -3279,10 +3284,16 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3279
3284
|
}]),
|
|
3280
3285
|
style: {
|
|
3281
3286
|
...dropdownPosition,
|
|
3282
|
-
maxHeight: listHeight
|
|
3283
|
-
...(['topLeft', 'topRight'].includes(placement)
|
|
3284
|
-
|
|
3285
|
-
|
|
3287
|
+
maxHeight: listHeight
|
|
3288
|
+
// ...(['topLeft', 'topRight'].includes(placement)
|
|
3289
|
+
// ? {
|
|
3290
|
+
// top:
|
|
3291
|
+
// -(
|
|
3292
|
+
// (selectRef.current?.querySelector(`.${prefixCls}-dropdown`)
|
|
3293
|
+
// ?.clientHeight || listHeight) + PADDING_PLACEMENT
|
|
3294
|
+
// ) + (selectRef.current?.clientHeight || 0)
|
|
3295
|
+
// }
|
|
3296
|
+
// : {})
|
|
3286
3297
|
}
|
|
3287
3298
|
}, filterable && /*#__PURE__*/React$1.createElement("input", {
|
|
3288
3299
|
type: "text",
|
|
@@ -3484,7 +3495,7 @@ var Avatar = /*#__PURE__*/Object.freeze({
|
|
|
3484
3495
|
default: SkeletonAvatar
|
|
3485
3496
|
});
|
|
3486
3497
|
|
|
3487
|
-
var css_248z$2 = ".xUi-skeleton-image{align-items:center;background:hsla(0,0%,75%,.2);display:flex;height:96px;justify-content:center;line-height:96px;vertical-align:top;width:96px}.xUi-skeleton-image .xUi-skeleton-icon{font-size:inherit!important}.xUi-skeleton-image svg{height:100%;line-height:48px;max-width:192px;width:48px}";
|
|
3498
|
+
var css_248z$2 = ".xUi-skeleton-image{align-items:center;background:hsla(0,0%,75%,.2);display:flex;height:96px;justify-content:center;line-height:96px;vertical-align:top;width:96px}.xUi-skeleton-image .xUi-skeleton-icon{font-size:inherit!important}.xUi-skeleton-image svg{display:flex;height:100%;line-height:48px;margin:0 auto;max-width:192px;width:48px}";
|
|
3488
3499
|
styleInject(css_248z$2);
|
|
3489
3500
|
|
|
3490
3501
|
const CUSTOm_ICON_SIZE = 48;
|