@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 };
|
|
@@ -1054,37 +1054,43 @@ var init_Slider = __esm({
|
|
|
1054
1054
|
position: absolute;
|
|
1055
1055
|
background: ${({ theme: theme2 }) => theme2.colors.palettes.transparency["20"]};
|
|
1056
1056
|
border-radius: 1000px;
|
|
1057
|
-
${({ $direction, theme: theme2 }) =>
|
|
1058
|
-
|
|
1059
|
-
|
|
1057
|
+
${({ $direction, theme: theme2 }) => {
|
|
1058
|
+
const thumbSize = theme2.components.slider.large.thumbSize;
|
|
1059
|
+
return $direction === "vertical" ? `
|
|
1060
|
+
top: 50%;
|
|
1060
1061
|
width: ${theme2.components.slider.track.height};
|
|
1062
|
+
height: calc(100% - ${thumbSize});
|
|
1061
1063
|
left: 50%;
|
|
1062
|
-
transform:
|
|
1064
|
+
transform: translate(-50%, -50%);
|
|
1063
1065
|
` : `
|
|
1064
|
-
left:
|
|
1065
|
-
|
|
1066
|
+
left: 50%;
|
|
1067
|
+
width: calc(100% - ${thumbSize});
|
|
1066
1068
|
height: ${theme2.components.slider.track.height};
|
|
1067
1069
|
top: 50%;
|
|
1068
|
-
transform:
|
|
1069
|
-
|
|
1070
|
+
transform: translate(-50%, -50%);
|
|
1071
|
+
`;
|
|
1072
|
+
}}
|
|
1070
1073
|
`;
|
|
1071
1074
|
SliderFill = styled.div`
|
|
1072
1075
|
position: absolute;
|
|
1073
1076
|
border-radius: ${({ theme: theme2 }) => theme2.components.slider.track.borderRadius};
|
|
1074
1077
|
background: ${({ $disabled, theme: theme2 }) => $disabled ? theme2.components.slider.track.filledBackgroundDisabled : theme2.components.slider.track.filledBackground};
|
|
1075
|
-
${({ $direction, $percentage, theme: theme2 }) =>
|
|
1076
|
-
|
|
1078
|
+
${({ $direction, $percentage, theme: theme2 }) => {
|
|
1079
|
+
const thumbSize = theme2.components.slider.large.thumbSize;
|
|
1080
|
+
return $direction === "vertical" ? `
|
|
1081
|
+
bottom: calc(${thumbSize} / 2);
|
|
1077
1082
|
width: ${theme2.components.slider.track.height};
|
|
1078
1083
|
left: 50%;
|
|
1079
1084
|
transform: translateX(-50%);
|
|
1080
|
-
height: ${$percentage}
|
|
1085
|
+
height: calc((100% - ${thumbSize}) * ${$percentage / 100});
|
|
1081
1086
|
` : `
|
|
1082
|
-
left:
|
|
1087
|
+
left: calc(${thumbSize} / 2);
|
|
1083
1088
|
height: ${theme2.components.slider.track.height};
|
|
1084
1089
|
top: 50%;
|
|
1085
1090
|
transform: translateY(-50%);
|
|
1086
|
-
width: ${$percentage}
|
|
1087
|
-
|
|
1091
|
+
width: calc((100% - ${thumbSize}) * ${$percentage / 100});
|
|
1092
|
+
`;
|
|
1093
|
+
}}
|
|
1088
1094
|
`;
|
|
1089
1095
|
SliderThumb = styled.div`
|
|
1090
1096
|
position: absolute;
|
|
@@ -1094,17 +1100,20 @@ var init_Slider = __esm({
|
|
|
1094
1100
|
background: ${({ $disabled, theme: theme2 }) => $disabled ? theme2.components.slider.thumb.backgroundDisabled : theme2.components.slider.thumb.background};
|
|
1095
1101
|
cursor: ${({ $disabled }) => $disabled ? "not-allowed" : "grab"};
|
|
1096
1102
|
box-shadow: ${({ theme: theme2 }) => theme2.components.slider.thumb.boxShadow};
|
|
1097
|
-
${({ $direction, $percentage, $isDragging }) =>
|
|
1098
|
-
|
|
1103
|
+
${({ $direction, $percentage, $isDragging, theme: theme2 }) => {
|
|
1104
|
+
const thumbSize = theme2.components.slider.large.thumbSize;
|
|
1105
|
+
return $direction === "vertical" ? `
|
|
1106
|
+
bottom: calc((100% - ${thumbSize}) * ${$percentage / 100} + ${thumbSize} / 2);
|
|
1099
1107
|
left: 50%;
|
|
1100
1108
|
transform: translate(-50%, 50%);
|
|
1101
1109
|
transition: ${$isDragging ? "none" : "bottom 0.1s ease"};
|
|
1102
1110
|
` : `
|
|
1103
|
-
left: ${$percentage}
|
|
1111
|
+
left: calc((100% - ${thumbSize}) * ${$percentage / 100} + ${thumbSize} / 2);
|
|
1104
1112
|
top: 50%;
|
|
1105
1113
|
transform: translate(-50%, -50%);
|
|
1106
1114
|
transition: ${$isDragging ? "none" : "left 0.1s ease"};
|
|
1107
|
-
|
|
1115
|
+
`;
|
|
1116
|
+
}}
|
|
1108
1117
|
|
|
1109
1118
|
${({ $disabled, theme: theme2 }) => !$disabled && `
|
|
1110
1119
|
&:hover {
|
|
@@ -1140,24 +1149,27 @@ var init_Slider = __esm({
|
|
|
1140
1149
|
}, [valueMapProp, min, max, step]);
|
|
1141
1150
|
const effectiveMin = extendedValueMap.start;
|
|
1142
1151
|
const effectiveMax = extendedValueMap.end;
|
|
1143
|
-
const [internalValue, setInternalValue] = useState(
|
|
1144
|
-
controlledValue ?? defaultValue
|
|
1145
|
-
);
|
|
1152
|
+
const [internalValue, setInternalValue] = useState(controlledValue ?? defaultValue);
|
|
1146
1153
|
const [isDragging, setIsDragging] = useState(false);
|
|
1147
1154
|
const containerRef = useRef(null);
|
|
1155
|
+
const thumbRef = useRef(null);
|
|
1148
1156
|
const value = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
1149
1157
|
const percentage = valueToVisualPercentage(value, extendedValueMap) * 100;
|
|
1150
1158
|
const updateValue = useCallback(
|
|
1151
1159
|
(clientX, clientY) => {
|
|
1152
1160
|
if (!containerRef.current || disabled) return;
|
|
1153
1161
|
const rect = containerRef.current.getBoundingClientRect();
|
|
1162
|
+
const thumbRect = thumbRef.current?.getBoundingClientRect();
|
|
1163
|
+
const thumbLength = direction === "vertical" ? thumbRect?.height ?? 0 : thumbRect?.width ?? 0;
|
|
1164
|
+
const containerLength = direction === "vertical" ? rect.height : rect.width;
|
|
1165
|
+
const trackLength = Math.max(containerLength - thumbLength, 0);
|
|
1154
1166
|
let visualPercent;
|
|
1155
1167
|
if (direction === "vertical") {
|
|
1156
|
-
const offsetY = rect.bottom - clientY;
|
|
1157
|
-
visualPercent = Math.max(0, Math.min(1, offsetY /
|
|
1168
|
+
const offsetY = rect.bottom - clientY - thumbLength / 2;
|
|
1169
|
+
visualPercent = trackLength === 0 ? 0 : Math.max(0, Math.min(1, offsetY / trackLength));
|
|
1158
1170
|
} else {
|
|
1159
|
-
const offsetX = clientX - rect.left;
|
|
1160
|
-
visualPercent = Math.max(0, Math.min(1, offsetX /
|
|
1171
|
+
const offsetX = clientX - rect.left - thumbLength / 2;
|
|
1172
|
+
visualPercent = trackLength === 0 ? 0 : Math.max(0, Math.min(1, offsetX / trackLength));
|
|
1161
1173
|
}
|
|
1162
1174
|
const rawValue = visualPercentToValue(visualPercent, extendedValueMap);
|
|
1163
1175
|
const snappedValue = snapToStep(rawValue, extendedValueMap);
|
|
@@ -1258,6 +1270,7 @@ var init_Slider = __esm({
|
|
|
1258
1270
|
/* @__PURE__ */ React3.createElement(
|
|
1259
1271
|
SliderThumb,
|
|
1260
1272
|
{
|
|
1273
|
+
ref: thumbRef,
|
|
1261
1274
|
$percentage: percentage,
|
|
1262
1275
|
$disabled: disabled,
|
|
1263
1276
|
$isDragging: isDragging,
|
|
@@ -4588,6 +4601,8 @@ var MenuContainer = styled.div`
|
|
|
4588
4601
|
flex-direction: column;
|
|
4589
4602
|
box-sizing: border-box;
|
|
4590
4603
|
min-width: 220px;
|
|
4604
|
+
max-height: 100%;
|
|
4605
|
+
overflow: hidden;
|
|
4591
4606
|
|
|
4592
4607
|
${({ theme: theme2 }) => {
|
|
4593
4608
|
const dropdownConfig = theme2.components?.dropdown;
|
|
@@ -4615,9 +4630,20 @@ var MenuContainer = styled.div`
|
|
|
4615
4630
|
}
|
|
4616
4631
|
`;
|
|
4617
4632
|
var SearchBoxContainer = styled.div`
|
|
4633
|
+
flex-shrink: 0;
|
|
4618
4634
|
padding: 8px 12px;
|
|
4619
4635
|
border-bottom: 1px solid ${({ theme: theme2 }) => theme2.colors?.palettes?.transparency?.["10"]};
|
|
4620
4636
|
`;
|
|
4637
|
+
var MenuScrollContainer = styled.div`
|
|
4638
|
+
flex: 1;
|
|
4639
|
+
min-height: 0;
|
|
4640
|
+
overflow-y: auto;
|
|
4641
|
+
overflow-x: hidden;
|
|
4642
|
+
`;
|
|
4643
|
+
var VirtualListContainer = styled.div`
|
|
4644
|
+
max-height: 100%;
|
|
4645
|
+
overflow: hidden;
|
|
4646
|
+
`;
|
|
4621
4647
|
var MenuItemContent = styled.div`
|
|
4622
4648
|
display: flex;
|
|
4623
4649
|
align-items: center;
|
|
@@ -4841,7 +4867,7 @@ var Menu = ({
|
|
|
4841
4867
|
};
|
|
4842
4868
|
const itemHeight = size === "medium" ? 28 : 36;
|
|
4843
4869
|
const menuKey = openKeys?.join(",") || "menu";
|
|
4844
|
-
return /* @__PURE__ */ React3.createElement(MenuContainer, { className, style }, searchable && /* @__PURE__ */ React3.createElement(SearchBoxContainer,
|
|
4870
|
+
return /* @__PURE__ */ React3.createElement(MenuContainer, { className, style: { maxHeight, ...style } }, searchable && /* @__PURE__ */ React3.createElement(SearchBoxContainer, { "data-testid": "menu-search-container" }, /* @__PURE__ */ React3.createElement(
|
|
4845
4871
|
Input,
|
|
4846
4872
|
{
|
|
4847
4873
|
lineType: "underlined",
|
|
@@ -4853,7 +4879,7 @@ var Menu = ({
|
|
|
4853
4879
|
onClear: () => handleSearch(""),
|
|
4854
4880
|
prefixNode: /* @__PURE__ */ React3.createElement(SearchIcon, null)
|
|
4855
4881
|
}
|
|
4856
|
-
)), virtual && filteredItems.length > 10 ? /* @__PURE__ */ React3.createElement(
|
|
4882
|
+
)), /* @__PURE__ */ React3.createElement(MenuScrollContainer, { "data-testid": "menu-scroll-container" }, virtual && filteredItems.length > 10 ? /* @__PURE__ */ React3.createElement(VirtualListContainer, null, /* @__PURE__ */ React3.createElement(
|
|
4857
4883
|
VirtualList,
|
|
4858
4884
|
{
|
|
4859
4885
|
data: filteredItems,
|
|
@@ -4882,7 +4908,7 @@ var Menu = ({
|
|
|
4882
4908
|
},
|
|
4883
4909
|
renderItem(item)
|
|
4884
4910
|
)
|
|
4885
|
-
) : /* @__PURE__ */ React3.createElement(
|
|
4911
|
+
)) : /* @__PURE__ */ React3.createElement(
|
|
4886
4912
|
RcMenu,
|
|
4887
4913
|
{
|
|
4888
4914
|
key: menuKey,
|
|
@@ -4899,7 +4925,7 @@ var Menu = ({
|
|
|
4899
4925
|
}
|
|
4900
4926
|
},
|
|
4901
4927
|
filteredItems.map(renderItem)
|
|
4902
|
-
));
|
|
4928
|
+
)));
|
|
4903
4929
|
};
|
|
4904
4930
|
Menu.displayName = "Menu";
|
|
4905
4931
|
var Dropdown = ({
|
|
@@ -5097,6 +5123,7 @@ var Modal = ({
|
|
|
5097
5123
|
maskType = "light",
|
|
5098
5124
|
title,
|
|
5099
5125
|
width,
|
|
5126
|
+
height,
|
|
5100
5127
|
okText,
|
|
5101
5128
|
cancelText,
|
|
5102
5129
|
footer,
|
|
@@ -5127,9 +5154,8 @@ var Modal = ({
|
|
|
5127
5154
|
const modalWidth = width ?? modalConfig[variant].defaultWidth;
|
|
5128
5155
|
const classNames = {
|
|
5129
5156
|
...maskType === "dark" && { mask: `${prefixCls}-mask-dark` },
|
|
5130
|
-
content: `${prefixCls}-content-${variant}`
|
|
5157
|
+
...width === void 0 && height === void 0 && { content: `${prefixCls}-content-${variant}` }
|
|
5131
5158
|
};
|
|
5132
|
-
const styles = width !== void 0 ? { content: { width } } : void 0;
|
|
5133
5159
|
const renderFooter = () => {
|
|
5134
5160
|
if (footer !== void 0) return footer;
|
|
5135
5161
|
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, cancelText !== null && /* @__PURE__ */ React3.createElement(Button, { key: "cancel", variant: "outlined", colorType: "default", onClick: handleClose }, cancelText ?? "Cancel"), okText !== null && /* @__PURE__ */ React3.createElement(
|
|
@@ -5150,14 +5176,14 @@ var Modal = ({
|
|
|
5150
5176
|
...restProps,
|
|
5151
5177
|
visible,
|
|
5152
5178
|
title,
|
|
5153
|
-
width:
|
|
5179
|
+
width: modalWidth,
|
|
5180
|
+
height,
|
|
5154
5181
|
prefixCls,
|
|
5155
5182
|
closable,
|
|
5156
5183
|
closeIcon: closeIcon ?? /* @__PURE__ */ React3.createElement(Icon, { size: 19.2 }, /* @__PURE__ */ React3.createElement(CloseIcon, null)),
|
|
5157
5184
|
mask,
|
|
5158
5185
|
maskClosable,
|
|
5159
5186
|
classNames,
|
|
5160
|
-
styles,
|
|
5161
5187
|
className,
|
|
5162
5188
|
onClose: handleClose,
|
|
5163
5189
|
footer: renderFooter()
|
|
@@ -5214,19 +5240,23 @@ var CSSSpinner = styled.div`
|
|
|
5214
5240
|
`;
|
|
5215
5241
|
}}
|
|
5216
5242
|
`;
|
|
5217
|
-
var
|
|
5243
|
+
var LoadingInlineContainer = styled.span`
|
|
5218
5244
|
display: inline-flex;
|
|
5219
5245
|
flex-direction: column;
|
|
5220
5246
|
align-items: center;
|
|
5221
5247
|
justify-content: center;
|
|
5222
5248
|
gap: ${({ $hasTip, theme: theme2 }) => $hasTip ? theme2.components.loading.indicator.gap : "0"};
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5249
|
+
`;
|
|
5250
|
+
var LoadingFullscreenContainer = styled.div`
|
|
5251
|
+
display: flex;
|
|
5252
|
+
flex-direction: column;
|
|
5253
|
+
align-items: center;
|
|
5254
|
+
justify-content: center;
|
|
5255
|
+
gap: ${({ $hasTip, theme: theme2 }) => $hasTip ? theme2.components.loading.indicator.gap : "0"};
|
|
5256
|
+
position: fixed;
|
|
5257
|
+
inset: 0;
|
|
5258
|
+
z-index: ${({ theme: theme2 }) => theme2.components.loading.fullscreen.zIndex};
|
|
5259
|
+
background: ${({ $transparent, theme: theme2 }) => $transparent ? "transparent" : theme2.components.loading.fullscreen.background};
|
|
5230
5260
|
`;
|
|
5231
5261
|
var Tip = styled.span`
|
|
5232
5262
|
font-size: 14px;
|
|
@@ -5258,6 +5288,7 @@ var Loading = ({
|
|
|
5258
5288
|
delay = 0,
|
|
5259
5289
|
tip,
|
|
5260
5290
|
fullscreen = false,
|
|
5291
|
+
transparent = false,
|
|
5261
5292
|
className,
|
|
5262
5293
|
children,
|
|
5263
5294
|
indicator
|
|
@@ -5303,15 +5334,130 @@ var Loading = ({
|
|
|
5303
5334
|
return /* @__PURE__ */ React3.createElement(Wrapper, { className }, /* @__PURE__ */ React3.createElement(WrapperContent, { $spinning: shouldShow }, children), shouldShow && /* @__PURE__ */ React3.createElement(WrapperOverlay, { $hasTip: !!tip }, renderSpinner()));
|
|
5304
5335
|
}
|
|
5305
5336
|
if (!shouldShow) return null;
|
|
5306
|
-
|
|
5337
|
+
if (fullscreen) {
|
|
5338
|
+
return /* @__PURE__ */ React3.createElement(LoadingFullscreenContainer, { $hasTip: !!tip, $transparent: transparent, className }, renderSpinner());
|
|
5339
|
+
}
|
|
5340
|
+
return /* @__PURE__ */ React3.createElement(LoadingInlineContainer, { $hasTip: !!tip, className }, renderSpinner());
|
|
5307
5341
|
};
|
|
5308
5342
|
Loading.displayName = "Loading";
|
|
5309
5343
|
|
|
5344
|
+
// src/Loading/LoadingOverlay.tsx
|
|
5345
|
+
init_styled();
|
|
5346
|
+
init_loading();
|
|
5347
|
+
init_context();
|
|
5348
|
+
var getIndicatorSize2 = (size, theme2) => {
|
|
5349
|
+
const sizeConfig = theme2.components.loading[size || "medium"];
|
|
5350
|
+
return `
|
|
5351
|
+
width: ${sizeConfig.size};
|
|
5352
|
+
height: ${sizeConfig.size};
|
|
5353
|
+
`;
|
|
5354
|
+
};
|
|
5355
|
+
var SpinnerImage2 = styled.img`
|
|
5356
|
+
display: inline-block;
|
|
5357
|
+
${({ $size, theme: theme2 }) => getIndicatorSize2($size, theme2)}
|
|
5358
|
+
object-fit: contain;
|
|
5359
|
+
`;
|
|
5360
|
+
var CustomIndicatorWrapper2 = styled.span`
|
|
5361
|
+
display: inline-flex;
|
|
5362
|
+
align-items: center;
|
|
5363
|
+
justify-content: center;
|
|
5364
|
+
${({ $size, theme: theme2 }) => getIndicatorSize2($size, theme2)}
|
|
5365
|
+
`;
|
|
5366
|
+
var CSSSpinner2 = styled.div`
|
|
5367
|
+
display: inline-block;
|
|
5368
|
+
border-radius: 50%;
|
|
5369
|
+
box-sizing: border-box;
|
|
5370
|
+
|
|
5371
|
+
${({ $size, theme: theme2 }) => {
|
|
5372
|
+
const loadingConfig = theme2.components.loading;
|
|
5373
|
+
const sizeConfig = loadingConfig[$size || "medium"];
|
|
5374
|
+
const { color, animation } = loadingConfig.indicator;
|
|
5375
|
+
const sizeValue = Number.parseFloat(sizeConfig.size);
|
|
5376
|
+
const borderWidth = Math.max(2, Math.round((Number.isNaN(sizeValue) ? 24 : sizeValue) / 12));
|
|
5377
|
+
return `
|
|
5378
|
+
width: ${sizeConfig.size};
|
|
5379
|
+
height: ${sizeConfig.size};
|
|
5380
|
+
border: ${borderWidth}px solid rgba(0, 0, 0, 0.1);
|
|
5381
|
+
border-top-color: ${color};
|
|
5382
|
+
animation: loading-spin ${animation.duration} ${animation.timingFunction} infinite;
|
|
5383
|
+
|
|
5384
|
+
@keyframes loading-spin {
|
|
5385
|
+
from { transform: rotate(0deg); }
|
|
5386
|
+
to { transform: rotate(360deg); }
|
|
5387
|
+
}
|
|
5388
|
+
`;
|
|
5389
|
+
}}
|
|
5390
|
+
`;
|
|
5391
|
+
var OverlayContainer = styled.div`
|
|
5392
|
+
position: absolute;
|
|
5393
|
+
inset: 0;
|
|
5394
|
+
display: flex;
|
|
5395
|
+
flex-direction: column;
|
|
5396
|
+
align-items: center;
|
|
5397
|
+
justify-content: center;
|
|
5398
|
+
z-index: 1;
|
|
5399
|
+
background: ${({ $transparent, theme: theme2 }) => $transparent ? "transparent" : theme2.components.loading.wrapper.overlayBackground};
|
|
5400
|
+
gap: ${({ $hasTip, theme: theme2 }) => $hasTip ? theme2.components.loading.indicator.gap : "0"};
|
|
5401
|
+
`;
|
|
5402
|
+
var Tip2 = styled.span`
|
|
5403
|
+
font-size: 14px;
|
|
5404
|
+
line-height: 1.5;
|
|
5405
|
+
color: ${({ theme: theme2 }) => theme2.components.loading.tipColor};
|
|
5406
|
+
`;
|
|
5407
|
+
var LoadingOverlay = ({
|
|
5408
|
+
size = "medium",
|
|
5409
|
+
spinning = true,
|
|
5410
|
+
delay = 0,
|
|
5411
|
+
tip,
|
|
5412
|
+
className,
|
|
5413
|
+
indicator,
|
|
5414
|
+
transparent = false
|
|
5415
|
+
}) => {
|
|
5416
|
+
const [shouldShow, setShouldShow] = useState(delay === 0 && spinning);
|
|
5417
|
+
useEffect(() => {
|
|
5418
|
+
if (!spinning) {
|
|
5419
|
+
setShouldShow(false);
|
|
5420
|
+
return;
|
|
5421
|
+
}
|
|
5422
|
+
if (delay <= 0) {
|
|
5423
|
+
setShouldShow(true);
|
|
5424
|
+
return;
|
|
5425
|
+
}
|
|
5426
|
+
const timer = setTimeout(() => setShouldShow(true), delay);
|
|
5427
|
+
return () => clearTimeout(timer);
|
|
5428
|
+
}, [spinning, delay]);
|
|
5429
|
+
const renderIndicator = () => {
|
|
5430
|
+
const a11yProps = { role: "status", "aria-label": "Loading" };
|
|
5431
|
+
if (typeof indicator === "string") {
|
|
5432
|
+
return /* @__PURE__ */ React3.createElement(SpinnerImage2, { $size: size, src: indicator, alt: "Loading", ...a11yProps });
|
|
5433
|
+
}
|
|
5434
|
+
if (indicator) {
|
|
5435
|
+
return /* @__PURE__ */ React3.createElement(CustomIndicatorWrapper2, { $size: size, ...a11yProps }, indicator);
|
|
5436
|
+
}
|
|
5437
|
+
const { indicator: indicatorConfig } = getGlobalTheme().components.loading;
|
|
5438
|
+
if (indicatorConfig.defaultType === "css") {
|
|
5439
|
+
return /* @__PURE__ */ React3.createElement(CSSSpinner2, { $size: size, ...a11yProps });
|
|
5440
|
+
}
|
|
5441
|
+
return /* @__PURE__ */ React3.createElement(
|
|
5442
|
+
SpinnerImage2,
|
|
5443
|
+
{
|
|
5444
|
+
$size: size,
|
|
5445
|
+
src: indicatorConfig.defaultImage || loading_default,
|
|
5446
|
+
alt: "Loading",
|
|
5447
|
+
...a11yProps
|
|
5448
|
+
}
|
|
5449
|
+
);
|
|
5450
|
+
};
|
|
5451
|
+
if (!shouldShow) return null;
|
|
5452
|
+
return /* @__PURE__ */ React3.createElement(OverlayContainer, { $hasTip: !!tip, $transparent: transparent, className }, renderIndicator(), tip && /* @__PURE__ */ React3.createElement(Tip2, null, tip));
|
|
5453
|
+
};
|
|
5454
|
+
LoadingOverlay.displayName = "LoadingOverlay";
|
|
5455
|
+
|
|
5310
5456
|
// src/index.ts
|
|
5311
5457
|
init_UIConfigProvider2();
|
|
5312
5458
|
init_styled();
|
|
5313
5459
|
init_context();
|
|
5314
5460
|
|
|
5315
|
-
export { Button, Checkbox, Dropdown, DropdownButton2 as DropdownButton, DropdownGlobalStyles, Icon, IconProvider, Input, Loading, Menu, MenuGlobalStyles, Modal, ModalGlobalStyles, NumberInput, Radio, SearchInput, Slider, SpinButton, Switch, Tabs, Toast, ToastContainer2 as ToastContainer, ToolbarButton, Tooltip, UIConfigProvider, UnderlinedInput, createUIConfig, getGlobalIconRegistry, getGlobalTheme, getGlobalToastConfig, getUIConfig, initUIConfig, mergeUIConfig, styled, toast, useIconRegistry, useToast, useUIConfig };
|
|
5461
|
+
export { Button, Checkbox, Dropdown, DropdownButton2 as DropdownButton, DropdownGlobalStyles, Icon, IconProvider, Input, Loading, LoadingOverlay, Menu, MenuGlobalStyles, Modal, ModalGlobalStyles, NumberInput, Radio, SearchInput, Slider, SpinButton, Switch, Tabs, Toast, ToastContainer2 as ToastContainer, ToolbarButton, Tooltip, UIConfigProvider, UnderlinedInput, createUIConfig, getGlobalIconRegistry, getGlobalTheme, getGlobalToastConfig, getUIConfig, initUIConfig, mergeUIConfig, styled, toast, useIconRegistry, useToast, useUIConfig };
|
|
5316
5462
|
//# sourceMappingURL=index.js.map
|
|
5317
5463
|
//# sourceMappingURL=index.js.map
|