@officesdk/design 0.2.13 → 0.2.15
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/components/cjs/index.d.ts +10 -1
- package/dist/components/cjs/index.js +189 -42
- package/dist/components/cjs/index.js.map +1 -1
- package/dist/components/esm/index.d.ts +10 -1
- package/dist/components/esm/index.js +189 -43
- package/dist/components/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1604,6 +1604,10 @@ interface LoadingProps {
|
|
|
1604
1604
|
* Whether to use fullscreen overlay mode
|
|
1605
1605
|
*/
|
|
1606
1606
|
fullscreen?: boolean;
|
|
1607
|
+
/**
|
|
1608
|
+
* Whether overlay background should be transparent
|
|
1609
|
+
*/
|
|
1610
|
+
transparent?: boolean;
|
|
1607
1611
|
/**
|
|
1608
1612
|
* Custom className
|
|
1609
1613
|
*/
|
|
@@ -1659,6 +1663,11 @@ interface LoadingProps {
|
|
|
1659
1663
|
*/
|
|
1660
1664
|
declare const Loading: React$1.FC<LoadingProps>;
|
|
1661
1665
|
|
|
1666
|
+
interface LoadingOverlayProps extends Pick<LoadingProps, 'size' | 'spinning' | 'delay' | 'tip' | 'className' | 'indicator'> {
|
|
1667
|
+
transparent?: boolean;
|
|
1668
|
+
}
|
|
1669
|
+
declare const LoadingOverlay: React$1.FC<LoadingOverlayProps>;
|
|
1670
|
+
|
|
1662
1671
|
type DeepPartial<T extends object> = {
|
|
1663
1672
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
1664
1673
|
};
|
|
@@ -1945,4 +1954,4 @@ declare const styled: ThemedStyledInterface<Theme>;
|
|
|
1945
1954
|
|
|
1946
1955
|
declare const getGlobalTheme: () => Theme;
|
|
1947
1956
|
|
|
1948
|
-
export { type A11yConfig, type AnimationConfig, Button, type ButtonProps, Checkbox, type CheckboxProps, Dropdown, DropdownButton, type DropdownButtonProps, DropdownGlobalStyles, type DropdownProps, type I18nConfig, Icon, type IconComponent, type IconProps, IconProvider, type IconProviderProps, type IconRegistry, Input, type InputProps, Loading, type LoadingProps, Menu, type MenuDivider, MenuGlobalStyles, type MenuGroup, type MenuItem, type MenuItemType, type MenuProps, Modal, ModalGlobalStyles, type ModalProps, NumberInput, type NumberInputProps, Radio, type RadioProps, SearchInput, type SearchInputProps, Slider, type SliderProps, SpinButton, type SpinButtonProps, Switch, type SwitchProps, type TabItem, Tabs, type TabsProps, Toast, type ToastConfig, ToastContainer, type ToastContainerConfig, type ToastContainerProps, type ToastPosition, type ToastProps, ToolbarButton, type ToolbarButtonProps, Tooltip, type TooltipProps, type UIConfig, UIConfigProvider, type UIConfigProviderProps, UnderlinedInput, type InputProps as UnderlinedInputProps, type ZIndexConfig, createUIConfig, getGlobalIconRegistry, getGlobalTheme, getGlobalToastConfig, getUIConfig, initUIConfig, mergeUIConfig, styled, toast, useIconRegistry, useToast, useUIConfig };
|
|
1957
|
+
export { type A11yConfig, type AnimationConfig, Button, type ButtonProps, Checkbox, type CheckboxProps, Dropdown, DropdownButton, type DropdownButtonProps, DropdownGlobalStyles, type DropdownProps, type I18nConfig, Icon, type IconComponent, type IconProps, IconProvider, type IconProviderProps, type IconRegistry, Input, type InputProps, Loading, LoadingOverlay, type LoadingOverlayProps, type LoadingProps, Menu, type MenuDivider, MenuGlobalStyles, type MenuGroup, type MenuItem, type MenuItemType, type MenuProps, Modal, ModalGlobalStyles, type ModalProps, NumberInput, type NumberInputProps, Radio, type RadioProps, SearchInput, type SearchInputProps, Slider, type SliderProps, SpinButton, type SpinButtonProps, Switch, type SwitchProps, type TabItem, Tabs, type TabsProps, Toast, type ToastConfig, ToastContainer, type ToastContainerConfig, type ToastContainerProps, type ToastPosition, type ToastProps, ToolbarButton, type ToolbarButtonProps, Tooltip, type TooltipProps, type UIConfig, UIConfigProvider, type UIConfigProviderProps, UnderlinedInput, type InputProps as UnderlinedInputProps, type ZIndexConfig, createUIConfig, getGlobalIconRegistry, getGlobalTheme, getGlobalToastConfig, getUIConfig, initUIConfig, mergeUIConfig, styled, toast, useIconRegistry, useToast, useUIConfig };
|
|
@@ -1067,37 +1067,43 @@ var init_Slider = __esm({
|
|
|
1067
1067
|
position: absolute;
|
|
1068
1068
|
background: ${({ theme: theme2 }) => theme2.colors.palettes.transparency["20"]};
|
|
1069
1069
|
border-radius: 1000px;
|
|
1070
|
-
${({ $direction, theme: theme2 }) =>
|
|
1071
|
-
|
|
1072
|
-
|
|
1070
|
+
${({ $direction, theme: theme2 }) => {
|
|
1071
|
+
const thumbSize = theme2.components.slider.large.thumbSize;
|
|
1072
|
+
return $direction === "vertical" ? `
|
|
1073
|
+
top: 50%;
|
|
1073
1074
|
width: ${theme2.components.slider.track.height};
|
|
1075
|
+
height: calc(100% - ${thumbSize});
|
|
1074
1076
|
left: 50%;
|
|
1075
|
-
transform:
|
|
1077
|
+
transform: translate(-50%, -50%);
|
|
1076
1078
|
` : `
|
|
1077
|
-
left:
|
|
1078
|
-
|
|
1079
|
+
left: 50%;
|
|
1080
|
+
width: calc(100% - ${thumbSize});
|
|
1079
1081
|
height: ${theme2.components.slider.track.height};
|
|
1080
1082
|
top: 50%;
|
|
1081
|
-
transform:
|
|
1082
|
-
|
|
1083
|
+
transform: translate(-50%, -50%);
|
|
1084
|
+
`;
|
|
1085
|
+
}}
|
|
1083
1086
|
`;
|
|
1084
1087
|
SliderFill = exports.styled.div`
|
|
1085
1088
|
position: absolute;
|
|
1086
1089
|
border-radius: ${({ theme: theme2 }) => theme2.components.slider.track.borderRadius};
|
|
1087
1090
|
background: ${({ $disabled, theme: theme2 }) => $disabled ? theme2.components.slider.track.filledBackgroundDisabled : theme2.components.slider.track.filledBackground};
|
|
1088
|
-
${({ $direction, $percentage, theme: theme2 }) =>
|
|
1089
|
-
|
|
1091
|
+
${({ $direction, $percentage, theme: theme2 }) => {
|
|
1092
|
+
const thumbSize = theme2.components.slider.large.thumbSize;
|
|
1093
|
+
return $direction === "vertical" ? `
|
|
1094
|
+
bottom: calc(${thumbSize} / 2);
|
|
1090
1095
|
width: ${theme2.components.slider.track.height};
|
|
1091
1096
|
left: 50%;
|
|
1092
1097
|
transform: translateX(-50%);
|
|
1093
|
-
height: ${$percentage}
|
|
1098
|
+
height: calc((100% - ${thumbSize}) * ${$percentage / 100});
|
|
1094
1099
|
` : `
|
|
1095
|
-
left:
|
|
1100
|
+
left: calc(${thumbSize} / 2);
|
|
1096
1101
|
height: ${theme2.components.slider.track.height};
|
|
1097
1102
|
top: 50%;
|
|
1098
1103
|
transform: translateY(-50%);
|
|
1099
|
-
width: ${$percentage}
|
|
1100
|
-
|
|
1104
|
+
width: calc((100% - ${thumbSize}) * ${$percentage / 100});
|
|
1105
|
+
`;
|
|
1106
|
+
}}
|
|
1101
1107
|
`;
|
|
1102
1108
|
SliderThumb = exports.styled.div`
|
|
1103
1109
|
position: absolute;
|
|
@@ -1107,17 +1113,20 @@ var init_Slider = __esm({
|
|
|
1107
1113
|
background: ${({ $disabled, theme: theme2 }) => $disabled ? theme2.components.slider.thumb.backgroundDisabled : theme2.components.slider.thumb.background};
|
|
1108
1114
|
cursor: ${({ $disabled }) => $disabled ? "not-allowed" : "grab"};
|
|
1109
1115
|
box-shadow: ${({ theme: theme2 }) => theme2.components.slider.thumb.boxShadow};
|
|
1110
|
-
${({ $direction, $percentage, $isDragging }) =>
|
|
1111
|
-
|
|
1116
|
+
${({ $direction, $percentage, $isDragging, theme: theme2 }) => {
|
|
1117
|
+
const thumbSize = theme2.components.slider.large.thumbSize;
|
|
1118
|
+
return $direction === "vertical" ? `
|
|
1119
|
+
bottom: calc((100% - ${thumbSize}) * ${$percentage / 100} + ${thumbSize} / 2);
|
|
1112
1120
|
left: 50%;
|
|
1113
1121
|
transform: translate(-50%, 50%);
|
|
1114
1122
|
transition: ${$isDragging ? "none" : "bottom 0.1s ease"};
|
|
1115
1123
|
` : `
|
|
1116
|
-
left: ${$percentage}
|
|
1124
|
+
left: calc((100% - ${thumbSize}) * ${$percentage / 100} + ${thumbSize} / 2);
|
|
1117
1125
|
top: 50%;
|
|
1118
1126
|
transform: translate(-50%, -50%);
|
|
1119
1127
|
transition: ${$isDragging ? "none" : "left 0.1s ease"};
|
|
1120
|
-
|
|
1128
|
+
`;
|
|
1129
|
+
}}
|
|
1121
1130
|
|
|
1122
1131
|
${({ $disabled, theme: theme2 }) => !$disabled && `
|
|
1123
1132
|
&:hover {
|
|
@@ -1153,24 +1162,27 @@ var init_Slider = __esm({
|
|
|
1153
1162
|
}, [valueMapProp, min, max, step]);
|
|
1154
1163
|
const effectiveMin = extendedValueMap.start;
|
|
1155
1164
|
const effectiveMax = extendedValueMap.end;
|
|
1156
|
-
const [internalValue, setInternalValue] = React3.useState(
|
|
1157
|
-
controlledValue ?? defaultValue
|
|
1158
|
-
);
|
|
1165
|
+
const [internalValue, setInternalValue] = React3.useState(controlledValue ?? defaultValue);
|
|
1159
1166
|
const [isDragging, setIsDragging] = React3.useState(false);
|
|
1160
1167
|
const containerRef = React3.useRef(null);
|
|
1168
|
+
const thumbRef = React3.useRef(null);
|
|
1161
1169
|
const value = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
1162
1170
|
const percentage = valueToVisualPercentage(value, extendedValueMap) * 100;
|
|
1163
1171
|
const updateValue = React3.useCallback(
|
|
1164
1172
|
(clientX, clientY) => {
|
|
1165
1173
|
if (!containerRef.current || disabled) return;
|
|
1166
1174
|
const rect = containerRef.current.getBoundingClientRect();
|
|
1175
|
+
const thumbRect = thumbRef.current?.getBoundingClientRect();
|
|
1176
|
+
const thumbLength = direction === "vertical" ? thumbRect?.height ?? 0 : thumbRect?.width ?? 0;
|
|
1177
|
+
const containerLength = direction === "vertical" ? rect.height : rect.width;
|
|
1178
|
+
const trackLength = Math.max(containerLength - thumbLength, 0);
|
|
1167
1179
|
let visualPercent;
|
|
1168
1180
|
if (direction === "vertical") {
|
|
1169
|
-
const offsetY = rect.bottom - clientY;
|
|
1170
|
-
visualPercent = Math.max(0, Math.min(1, offsetY /
|
|
1181
|
+
const offsetY = rect.bottom - clientY - thumbLength / 2;
|
|
1182
|
+
visualPercent = trackLength === 0 ? 0 : Math.max(0, Math.min(1, offsetY / trackLength));
|
|
1171
1183
|
} else {
|
|
1172
|
-
const offsetX = clientX - rect.left;
|
|
1173
|
-
visualPercent = Math.max(0, Math.min(1, offsetX /
|
|
1184
|
+
const offsetX = clientX - rect.left - thumbLength / 2;
|
|
1185
|
+
visualPercent = trackLength === 0 ? 0 : Math.max(0, Math.min(1, offsetX / trackLength));
|
|
1174
1186
|
}
|
|
1175
1187
|
const rawValue = visualPercentToValue(visualPercent, extendedValueMap);
|
|
1176
1188
|
const snappedValue = snapToStep(rawValue, extendedValueMap);
|
|
@@ -1271,6 +1283,7 @@ var init_Slider = __esm({
|
|
|
1271
1283
|
/* @__PURE__ */ React3__default.default.createElement(
|
|
1272
1284
|
SliderThumb,
|
|
1273
1285
|
{
|
|
1286
|
+
ref: thumbRef,
|
|
1274
1287
|
$percentage: percentage,
|
|
1275
1288
|
$disabled: disabled,
|
|
1276
1289
|
$isDragging: isDragging,
|
|
@@ -4601,6 +4614,8 @@ var MenuContainer = exports.styled.div`
|
|
|
4601
4614
|
flex-direction: column;
|
|
4602
4615
|
box-sizing: border-box;
|
|
4603
4616
|
min-width: 220px;
|
|
4617
|
+
max-height: 100%;
|
|
4618
|
+
overflow: hidden;
|
|
4604
4619
|
|
|
4605
4620
|
${({ theme: theme2 }) => {
|
|
4606
4621
|
const dropdownConfig = theme2.components?.dropdown;
|
|
@@ -4628,9 +4643,20 @@ var MenuContainer = exports.styled.div`
|
|
|
4628
4643
|
}
|
|
4629
4644
|
`;
|
|
4630
4645
|
var SearchBoxContainer = exports.styled.div`
|
|
4646
|
+
flex-shrink: 0;
|
|
4631
4647
|
padding: 8px 12px;
|
|
4632
4648
|
border-bottom: 1px solid ${({ theme: theme2 }) => theme2.colors?.palettes?.transparency?.["10"]};
|
|
4633
4649
|
`;
|
|
4650
|
+
var MenuScrollContainer = exports.styled.div`
|
|
4651
|
+
flex: 1;
|
|
4652
|
+
min-height: 0;
|
|
4653
|
+
overflow-y: auto;
|
|
4654
|
+
overflow-x: hidden;
|
|
4655
|
+
`;
|
|
4656
|
+
var VirtualListContainer = exports.styled.div`
|
|
4657
|
+
max-height: 100%;
|
|
4658
|
+
overflow: hidden;
|
|
4659
|
+
`;
|
|
4634
4660
|
var MenuItemContent = exports.styled.div`
|
|
4635
4661
|
display: flex;
|
|
4636
4662
|
align-items: center;
|
|
@@ -4854,7 +4880,7 @@ var Menu = ({
|
|
|
4854
4880
|
};
|
|
4855
4881
|
const itemHeight = size === "medium" ? 28 : 36;
|
|
4856
4882
|
const menuKey = openKeys?.join(",") || "menu";
|
|
4857
|
-
return /* @__PURE__ */ React3__default.default.createElement(MenuContainer, { className, style }, searchable && /* @__PURE__ */ React3__default.default.createElement(SearchBoxContainer,
|
|
4883
|
+
return /* @__PURE__ */ React3__default.default.createElement(MenuContainer, { className, style: { maxHeight, ...style } }, searchable && /* @__PURE__ */ React3__default.default.createElement(SearchBoxContainer, { "data-testid": "menu-search-container" }, /* @__PURE__ */ React3__default.default.createElement(
|
|
4858
4884
|
Input,
|
|
4859
4885
|
{
|
|
4860
4886
|
lineType: "underlined",
|
|
@@ -4866,7 +4892,7 @@ var Menu = ({
|
|
|
4866
4892
|
onClear: () => handleSearch(""),
|
|
4867
4893
|
prefixNode: /* @__PURE__ */ React3__default.default.createElement(icons.SearchIcon, null)
|
|
4868
4894
|
}
|
|
4869
|
-
)), virtual && filteredItems.length > 10 ? /* @__PURE__ */ React3__default.default.createElement(
|
|
4895
|
+
)), /* @__PURE__ */ React3__default.default.createElement(MenuScrollContainer, { "data-testid": "menu-scroll-container" }, virtual && filteredItems.length > 10 ? /* @__PURE__ */ React3__default.default.createElement(VirtualListContainer, null, /* @__PURE__ */ React3__default.default.createElement(
|
|
4870
4896
|
VirtualList__default.default,
|
|
4871
4897
|
{
|
|
4872
4898
|
data: filteredItems,
|
|
@@ -4895,7 +4921,7 @@ var Menu = ({
|
|
|
4895
4921
|
},
|
|
4896
4922
|
renderItem(item)
|
|
4897
4923
|
)
|
|
4898
|
-
) : /* @__PURE__ */ React3__default.default.createElement(
|
|
4924
|
+
)) : /* @__PURE__ */ React3__default.default.createElement(
|
|
4899
4925
|
RcMenu__default.default,
|
|
4900
4926
|
{
|
|
4901
4927
|
key: menuKey,
|
|
@@ -4912,7 +4938,7 @@ var Menu = ({
|
|
|
4912
4938
|
}
|
|
4913
4939
|
},
|
|
4914
4940
|
filteredItems.map(renderItem)
|
|
4915
|
-
));
|
|
4941
|
+
)));
|
|
4916
4942
|
};
|
|
4917
4943
|
Menu.displayName = "Menu";
|
|
4918
4944
|
var Dropdown = ({
|
|
@@ -5110,6 +5136,7 @@ var Modal = ({
|
|
|
5110
5136
|
maskType = "light",
|
|
5111
5137
|
title,
|
|
5112
5138
|
width,
|
|
5139
|
+
height,
|
|
5113
5140
|
okText,
|
|
5114
5141
|
cancelText,
|
|
5115
5142
|
footer,
|
|
@@ -5140,9 +5167,8 @@ var Modal = ({
|
|
|
5140
5167
|
const modalWidth = width ?? modalConfig[variant].defaultWidth;
|
|
5141
5168
|
const classNames = {
|
|
5142
5169
|
...maskType === "dark" && { mask: `${prefixCls}-mask-dark` },
|
|
5143
|
-
content: `${prefixCls}-content-${variant}`
|
|
5170
|
+
...width === void 0 && height === void 0 && { content: `${prefixCls}-content-${variant}` }
|
|
5144
5171
|
};
|
|
5145
|
-
const styles = width !== void 0 ? { content: { width } } : void 0;
|
|
5146
5172
|
const renderFooter = () => {
|
|
5147
5173
|
if (footer !== void 0) return footer;
|
|
5148
5174
|
return /* @__PURE__ */ React3__default.default.createElement(React3__default.default.Fragment, null, cancelText !== null && /* @__PURE__ */ React3__default.default.createElement(exports.Button, { key: "cancel", variant: "outlined", colorType: "default", onClick: handleClose }, cancelText ?? "Cancel"), okText !== null && /* @__PURE__ */ React3__default.default.createElement(
|
|
@@ -5163,14 +5189,14 @@ var Modal = ({
|
|
|
5163
5189
|
...restProps,
|
|
5164
5190
|
visible,
|
|
5165
5191
|
title,
|
|
5166
|
-
width:
|
|
5192
|
+
width: modalWidth,
|
|
5193
|
+
height,
|
|
5167
5194
|
prefixCls,
|
|
5168
5195
|
closable,
|
|
5169
5196
|
closeIcon: closeIcon ?? /* @__PURE__ */ React3__default.default.createElement(exports.Icon, { size: 19.2 }, /* @__PURE__ */ React3__default.default.createElement(icons.CloseIcon, null)),
|
|
5170
5197
|
mask,
|
|
5171
5198
|
maskClosable,
|
|
5172
5199
|
classNames,
|
|
5173
|
-
styles,
|
|
5174
5200
|
className,
|
|
5175
5201
|
onClose: handleClose,
|
|
5176
5202
|
footer: renderFooter()
|
|
@@ -5227,19 +5253,23 @@ var CSSSpinner = exports.styled.div`
|
|
|
5227
5253
|
`;
|
|
5228
5254
|
}}
|
|
5229
5255
|
`;
|
|
5230
|
-
var
|
|
5256
|
+
var LoadingInlineContainer = exports.styled.span`
|
|
5231
5257
|
display: inline-flex;
|
|
5232
5258
|
flex-direction: column;
|
|
5233
5259
|
align-items: center;
|
|
5234
5260
|
justify-content: center;
|
|
5235
5261
|
gap: ${({ $hasTip, theme: theme2 }) => $hasTip ? theme2.components.loading.indicator.gap : "0"};
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5262
|
+
`;
|
|
5263
|
+
var LoadingFullscreenContainer = exports.styled.div`
|
|
5264
|
+
display: flex;
|
|
5265
|
+
flex-direction: column;
|
|
5266
|
+
align-items: center;
|
|
5267
|
+
justify-content: center;
|
|
5268
|
+
gap: ${({ $hasTip, theme: theme2 }) => $hasTip ? theme2.components.loading.indicator.gap : "0"};
|
|
5269
|
+
position: fixed;
|
|
5270
|
+
inset: 0;
|
|
5271
|
+
z-index: ${({ theme: theme2 }) => theme2.components.loading.fullscreen.zIndex};
|
|
5272
|
+
background: ${({ $transparent, theme: theme2 }) => $transparent ? "transparent" : theme2.components.loading.fullscreen.background};
|
|
5243
5273
|
`;
|
|
5244
5274
|
var Tip = exports.styled.span`
|
|
5245
5275
|
font-size: 14px;
|
|
@@ -5271,6 +5301,7 @@ var Loading = ({
|
|
|
5271
5301
|
delay = 0,
|
|
5272
5302
|
tip,
|
|
5273
5303
|
fullscreen = false,
|
|
5304
|
+
transparent = false,
|
|
5274
5305
|
className,
|
|
5275
5306
|
children,
|
|
5276
5307
|
indicator
|
|
@@ -5316,10 +5347,125 @@ var Loading = ({
|
|
|
5316
5347
|
return /* @__PURE__ */ React3__default.default.createElement(Wrapper, { className }, /* @__PURE__ */ React3__default.default.createElement(WrapperContent, { $spinning: shouldShow }, children), shouldShow && /* @__PURE__ */ React3__default.default.createElement(WrapperOverlay, { $hasTip: !!tip }, renderSpinner()));
|
|
5317
5348
|
}
|
|
5318
5349
|
if (!shouldShow) return null;
|
|
5319
|
-
|
|
5350
|
+
if (fullscreen) {
|
|
5351
|
+
return /* @__PURE__ */ React3__default.default.createElement(LoadingFullscreenContainer, { $hasTip: !!tip, $transparent: transparent, className }, renderSpinner());
|
|
5352
|
+
}
|
|
5353
|
+
return /* @__PURE__ */ React3__default.default.createElement(LoadingInlineContainer, { $hasTip: !!tip, className }, renderSpinner());
|
|
5320
5354
|
};
|
|
5321
5355
|
Loading.displayName = "Loading";
|
|
5322
5356
|
|
|
5357
|
+
// src/Loading/LoadingOverlay.tsx
|
|
5358
|
+
init_styled();
|
|
5359
|
+
init_loading();
|
|
5360
|
+
init_context();
|
|
5361
|
+
var getIndicatorSize2 = (size, theme2) => {
|
|
5362
|
+
const sizeConfig = theme2.components.loading[size || "medium"];
|
|
5363
|
+
return `
|
|
5364
|
+
width: ${sizeConfig.size};
|
|
5365
|
+
height: ${sizeConfig.size};
|
|
5366
|
+
`;
|
|
5367
|
+
};
|
|
5368
|
+
var SpinnerImage2 = exports.styled.img`
|
|
5369
|
+
display: inline-block;
|
|
5370
|
+
${({ $size, theme: theme2 }) => getIndicatorSize2($size, theme2)}
|
|
5371
|
+
object-fit: contain;
|
|
5372
|
+
`;
|
|
5373
|
+
var CustomIndicatorWrapper2 = exports.styled.span`
|
|
5374
|
+
display: inline-flex;
|
|
5375
|
+
align-items: center;
|
|
5376
|
+
justify-content: center;
|
|
5377
|
+
${({ $size, theme: theme2 }) => getIndicatorSize2($size, theme2)}
|
|
5378
|
+
`;
|
|
5379
|
+
var CSSSpinner2 = exports.styled.div`
|
|
5380
|
+
display: inline-block;
|
|
5381
|
+
border-radius: 50%;
|
|
5382
|
+
box-sizing: border-box;
|
|
5383
|
+
|
|
5384
|
+
${({ $size, theme: theme2 }) => {
|
|
5385
|
+
const loadingConfig = theme2.components.loading;
|
|
5386
|
+
const sizeConfig = loadingConfig[$size || "medium"];
|
|
5387
|
+
const { color, animation } = loadingConfig.indicator;
|
|
5388
|
+
const sizeValue = Number.parseFloat(sizeConfig.size);
|
|
5389
|
+
const borderWidth = Math.max(2, Math.round((Number.isNaN(sizeValue) ? 24 : sizeValue) / 12));
|
|
5390
|
+
return `
|
|
5391
|
+
width: ${sizeConfig.size};
|
|
5392
|
+
height: ${sizeConfig.size};
|
|
5393
|
+
border: ${borderWidth}px solid rgba(0, 0, 0, 0.1);
|
|
5394
|
+
border-top-color: ${color};
|
|
5395
|
+
animation: loading-spin ${animation.duration} ${animation.timingFunction} infinite;
|
|
5396
|
+
|
|
5397
|
+
@keyframes loading-spin {
|
|
5398
|
+
from { transform: rotate(0deg); }
|
|
5399
|
+
to { transform: rotate(360deg); }
|
|
5400
|
+
}
|
|
5401
|
+
`;
|
|
5402
|
+
}}
|
|
5403
|
+
`;
|
|
5404
|
+
var OverlayContainer = exports.styled.div`
|
|
5405
|
+
position: absolute;
|
|
5406
|
+
inset: 0;
|
|
5407
|
+
display: flex;
|
|
5408
|
+
flex-direction: column;
|
|
5409
|
+
align-items: center;
|
|
5410
|
+
justify-content: center;
|
|
5411
|
+
z-index: 1;
|
|
5412
|
+
background: ${({ $transparent, theme: theme2 }) => $transparent ? "transparent" : theme2.components.loading.wrapper.overlayBackground};
|
|
5413
|
+
gap: ${({ $hasTip, theme: theme2 }) => $hasTip ? theme2.components.loading.indicator.gap : "0"};
|
|
5414
|
+
`;
|
|
5415
|
+
var Tip2 = exports.styled.span`
|
|
5416
|
+
font-size: 14px;
|
|
5417
|
+
line-height: 1.5;
|
|
5418
|
+
color: ${({ theme: theme2 }) => theme2.components.loading.tipColor};
|
|
5419
|
+
`;
|
|
5420
|
+
var LoadingOverlay = ({
|
|
5421
|
+
size = "medium",
|
|
5422
|
+
spinning = true,
|
|
5423
|
+
delay = 0,
|
|
5424
|
+
tip,
|
|
5425
|
+
className,
|
|
5426
|
+
indicator,
|
|
5427
|
+
transparent = false
|
|
5428
|
+
}) => {
|
|
5429
|
+
const [shouldShow, setShouldShow] = React3.useState(delay === 0 && spinning);
|
|
5430
|
+
React3.useEffect(() => {
|
|
5431
|
+
if (!spinning) {
|
|
5432
|
+
setShouldShow(false);
|
|
5433
|
+
return;
|
|
5434
|
+
}
|
|
5435
|
+
if (delay <= 0) {
|
|
5436
|
+
setShouldShow(true);
|
|
5437
|
+
return;
|
|
5438
|
+
}
|
|
5439
|
+
const timer = setTimeout(() => setShouldShow(true), delay);
|
|
5440
|
+
return () => clearTimeout(timer);
|
|
5441
|
+
}, [spinning, delay]);
|
|
5442
|
+
const renderIndicator = () => {
|
|
5443
|
+
const a11yProps = { role: "status", "aria-label": "Loading" };
|
|
5444
|
+
if (typeof indicator === "string") {
|
|
5445
|
+
return /* @__PURE__ */ React3__default.default.createElement(SpinnerImage2, { $size: size, src: indicator, alt: "Loading", ...a11yProps });
|
|
5446
|
+
}
|
|
5447
|
+
if (indicator) {
|
|
5448
|
+
return /* @__PURE__ */ React3__default.default.createElement(CustomIndicatorWrapper2, { $size: size, ...a11yProps }, indicator);
|
|
5449
|
+
}
|
|
5450
|
+
const { indicator: indicatorConfig } = exports.getGlobalTheme().components.loading;
|
|
5451
|
+
if (indicatorConfig.defaultType === "css") {
|
|
5452
|
+
return /* @__PURE__ */ React3__default.default.createElement(CSSSpinner2, { $size: size, ...a11yProps });
|
|
5453
|
+
}
|
|
5454
|
+
return /* @__PURE__ */ React3__default.default.createElement(
|
|
5455
|
+
SpinnerImage2,
|
|
5456
|
+
{
|
|
5457
|
+
$size: size,
|
|
5458
|
+
src: indicatorConfig.defaultImage || loading_default,
|
|
5459
|
+
alt: "Loading",
|
|
5460
|
+
...a11yProps
|
|
5461
|
+
}
|
|
5462
|
+
);
|
|
5463
|
+
};
|
|
5464
|
+
if (!shouldShow) return null;
|
|
5465
|
+
return /* @__PURE__ */ React3__default.default.createElement(OverlayContainer, { $hasTip: !!tip, $transparent: transparent, className }, renderIndicator(), tip && /* @__PURE__ */ React3__default.default.createElement(Tip2, null, tip));
|
|
5466
|
+
};
|
|
5467
|
+
LoadingOverlay.displayName = "LoadingOverlay";
|
|
5468
|
+
|
|
5323
5469
|
// src/index.ts
|
|
5324
5470
|
init_UIConfigProvider2();
|
|
5325
5471
|
init_styled();
|
|
@@ -5331,6 +5477,7 @@ exports.DropdownButton = DropdownButton2;
|
|
|
5331
5477
|
exports.DropdownGlobalStyles = DropdownGlobalStyles;
|
|
5332
5478
|
exports.Input = Input;
|
|
5333
5479
|
exports.Loading = Loading;
|
|
5480
|
+
exports.LoadingOverlay = LoadingOverlay;
|
|
5334
5481
|
exports.Menu = Menu;
|
|
5335
5482
|
exports.MenuGlobalStyles = MenuGlobalStyles;
|
|
5336
5483
|
exports.Modal = Modal;
|