@officesdk/design 0.1.25 → 0.1.27
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 +162 -7
- package/dist/components/cjs/index.js +325 -32
- package/dist/components/cjs/index.js.map +1 -1
- package/dist/components/esm/index.d.ts +162 -7
- package/dist/components/esm/index.js +327 -37
- package/dist/components/esm/index.js.map +1 -1
- package/dist/theme/cjs/index.d.ts +32 -1
- package/dist/theme/cjs/index.js +39 -2
- package/dist/theme/cjs/index.js.map +1 -1
- package/dist/theme/esm/index.d.ts +32 -1
- package/dist/theme/esm/index.js +39 -2
- package/dist/theme/esm/index.js.map +1 -1
- package/package.json +6 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ReactDOM from 'react-dom';
|
|
2
2
|
import React3, { forwardRef, useState, createContext, useEffect, useRef, useCallback, useContext, useMemo } from 'react';
|
|
3
3
|
import { lightTheme } from '@officesdk/design/theme';
|
|
4
|
-
import baseStyled, { createGlobalStyle } from 'styled-components';
|
|
4
|
+
import baseStyled, { createGlobalStyle as createGlobalStyle$1 } from 'styled-components';
|
|
5
5
|
import RcTooltip from 'rc-tooltip';
|
|
6
6
|
import 'rc-tooltip/assets/bootstrap.css';
|
|
7
7
|
import RcMenu, { Divider as Divider$1, ItemGroup, SubMenu, MenuItem } from 'rc-menu';
|
|
@@ -9,6 +9,7 @@ import VirtualList from 'rc-virtual-list';
|
|
|
9
9
|
import 'rc-menu/assets/index.css';
|
|
10
10
|
import RcDropdown from 'rc-dropdown';
|
|
11
11
|
import 'rc-dropdown/assets/index.css';
|
|
12
|
+
import RcDialog from 'rc-dialog';
|
|
12
13
|
|
|
13
14
|
var __defProp = Object.defineProperty;
|
|
14
15
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -634,7 +635,7 @@ var init_context = __esm({
|
|
|
634
635
|
};
|
|
635
636
|
}
|
|
636
637
|
});
|
|
637
|
-
var wrapWithTheme, styledFunction, styledWithBase, styled;
|
|
638
|
+
var wrapWithTheme, styledFunction, styledWithBase, styled, createGlobalStyle;
|
|
638
639
|
var init_styled = __esm({
|
|
639
640
|
"src/utils/styled.ts"() {
|
|
640
641
|
init_context();
|
|
@@ -663,6 +664,10 @@ var init_styled = __esm({
|
|
|
663
664
|
}
|
|
664
665
|
});
|
|
665
666
|
styled = styledWithBase;
|
|
667
|
+
createGlobalStyle = (...args) => {
|
|
668
|
+
const GlobalStyleComponent = createGlobalStyle$1(...args);
|
|
669
|
+
return wrapWithTheme(GlobalStyleComponent);
|
|
670
|
+
};
|
|
666
671
|
}
|
|
667
672
|
});
|
|
668
673
|
var IconWrapper2, TextWrapper, IconOnlyWrapper, StyledButton, Button;
|
|
@@ -2780,7 +2785,7 @@ var theme = getGlobalTheme();
|
|
|
2780
2785
|
var arrowSize = 5;
|
|
2781
2786
|
var paddingDistance = `${arrowSize}px`;
|
|
2782
2787
|
var arrowDistance = `${arrowSize}px`;
|
|
2783
|
-
var TooltipGlobalStyles = createGlobalStyle`
|
|
2788
|
+
var TooltipGlobalStyles = createGlobalStyle$1`
|
|
2784
2789
|
/* Base tooltip container */
|
|
2785
2790
|
.od-tooltip {
|
|
2786
2791
|
position: absolute;
|
|
@@ -3195,15 +3200,16 @@ var ToolbarButtonContainer = styled.div`
|
|
|
3195
3200
|
border-radius: 2px;
|
|
3196
3201
|
transition: border-color 0.15s ease;
|
|
3197
3202
|
box-sizing: border-box;
|
|
3203
|
+
overflow: hidden;
|
|
3198
3204
|
|
|
3199
|
-
${({ $disabled, $
|
|
3205
|
+
${({ $disabled, $isActive, theme: theme3 }) => {
|
|
3200
3206
|
const config = theme3.components.toolbarButton;
|
|
3201
3207
|
if ($disabled) {
|
|
3202
3208
|
return `
|
|
3203
3209
|
border-color: ${config.border.borderColorDisabled};
|
|
3204
3210
|
`;
|
|
3205
3211
|
}
|
|
3206
|
-
if ($
|
|
3212
|
+
if ($isActive) {
|
|
3207
3213
|
return `
|
|
3208
3214
|
border-color: ${config.border.borderColorActive};
|
|
3209
3215
|
|
|
@@ -3231,6 +3237,15 @@ var ToolbarButtonContainer = styled.div`
|
|
|
3231
3237
|
}
|
|
3232
3238
|
`;
|
|
3233
3239
|
}}
|
|
3240
|
+
|
|
3241
|
+
${({ theme: theme3 }) => {
|
|
3242
|
+
const config = theme3.components.toolbarButton;
|
|
3243
|
+
return `
|
|
3244
|
+
height: ${config.layout.height};
|
|
3245
|
+
padding: ${config.layout.padding};
|
|
3246
|
+
border-radius: ${config.layout.borderRadius};
|
|
3247
|
+
`;
|
|
3248
|
+
}}
|
|
3234
3249
|
`;
|
|
3235
3250
|
var MainButton = styled.button`
|
|
3236
3251
|
display: flex;
|
|
@@ -3239,17 +3254,17 @@ var MainButton = styled.button`
|
|
|
3239
3254
|
border: none;
|
|
3240
3255
|
cursor: pointer;
|
|
3241
3256
|
outline: none;
|
|
3257
|
+
height: 100%;
|
|
3242
3258
|
transition: background-color 0.15s ease;
|
|
3243
3259
|
|
|
3244
|
-
${({
|
|
3260
|
+
${({ theme: theme3 }) => {
|
|
3245
3261
|
const config = theme3.components.toolbarButton;
|
|
3246
3262
|
return `
|
|
3247
|
-
|
|
3248
|
-
padding: ${$hasLabel ? config.layout.content.padding : config.layout.padding};
|
|
3263
|
+
padding: ${config.layout.content.padding};
|
|
3249
3264
|
`;
|
|
3250
3265
|
}}
|
|
3251
3266
|
|
|
3252
|
-
${({ $disabled, $
|
|
3267
|
+
${({ $disabled, $isActive, theme: theme3 }) => {
|
|
3253
3268
|
const config = theme3.components.toolbarButton;
|
|
3254
3269
|
if ($disabled) {
|
|
3255
3270
|
return `
|
|
@@ -3257,7 +3272,7 @@ var MainButton = styled.button`
|
|
|
3257
3272
|
background: ${config.background.backgroundDisabled};
|
|
3258
3273
|
`;
|
|
3259
3274
|
}
|
|
3260
|
-
if ($
|
|
3275
|
+
if ($isActive) {
|
|
3261
3276
|
return `
|
|
3262
3277
|
background: ${config.background.backgroundActive};
|
|
3263
3278
|
`;
|
|
@@ -3289,13 +3304,8 @@ var IconWrapper4 = styled.span`
|
|
|
3289
3304
|
`;
|
|
3290
3305
|
}}
|
|
3291
3306
|
|
|
3292
|
-
${({ $disabled
|
|
3293
|
-
|
|
3294
|
-
return $disabled ? `
|
|
3295
|
-
color: ${config.color.colorDisabled};
|
|
3296
|
-
` : `
|
|
3297
|
-
color: ${config.color.color};
|
|
3298
|
-
`;
|
|
3307
|
+
${({ $disabled }) => {
|
|
3308
|
+
return $disabled ? `opacity: 0.3;` : ``;
|
|
3299
3309
|
}}
|
|
3300
3310
|
|
|
3301
3311
|
svg, img {
|
|
@@ -3402,14 +3412,14 @@ var Divider = styled.div`
|
|
|
3402
3412
|
`;
|
|
3403
3413
|
}}
|
|
3404
3414
|
|
|
3405
|
-
${({ $disabled, $
|
|
3415
|
+
${({ $disabled, $isActive, theme: theme3 }) => {
|
|
3406
3416
|
const config = theme3.components.toolbarButton;
|
|
3407
3417
|
if ($disabled) {
|
|
3408
3418
|
return `
|
|
3409
3419
|
background-color: ${config.border.borderColorDisabled};
|
|
3410
3420
|
`;
|
|
3411
3421
|
}
|
|
3412
|
-
if ($
|
|
3422
|
+
if ($isActive) {
|
|
3413
3423
|
return `
|
|
3414
3424
|
background-color: ${config.border.borderColorActive};
|
|
3415
3425
|
`;
|
|
@@ -3429,12 +3439,13 @@ var ArrowIcon = () => /* @__PURE__ */ React3.createElement("svg", { xmlns: "http
|
|
|
3429
3439
|
));
|
|
3430
3440
|
var ToolbarButton = ({
|
|
3431
3441
|
disabled = false,
|
|
3432
|
-
|
|
3442
|
+
isActive = false,
|
|
3433
3443
|
icon,
|
|
3434
3444
|
label,
|
|
3435
3445
|
hasDropdown = false,
|
|
3436
3446
|
splitDropdown = false,
|
|
3437
3447
|
onClick,
|
|
3448
|
+
onDoubleClick,
|
|
3438
3449
|
onDropdownClick,
|
|
3439
3450
|
className,
|
|
3440
3451
|
style
|
|
@@ -3443,11 +3454,29 @@ var ToolbarButton = ({
|
|
|
3443
3454
|
if (disabled) return;
|
|
3444
3455
|
onClick?.(e);
|
|
3445
3456
|
};
|
|
3457
|
+
const handleMainDoubleClick = (e) => {
|
|
3458
|
+
if (disabled) return;
|
|
3459
|
+
onDoubleClick?.(e);
|
|
3460
|
+
};
|
|
3446
3461
|
const handleDropdownClick = (e) => {
|
|
3447
3462
|
if (disabled) return;
|
|
3448
3463
|
e.stopPropagation();
|
|
3449
3464
|
onDropdownClick?.(e);
|
|
3450
3465
|
};
|
|
3466
|
+
const renderIcon = () => {
|
|
3467
|
+
if (!icon) return null;
|
|
3468
|
+
if (typeof icon === "string") {
|
|
3469
|
+
return /* @__PURE__ */ React3.createElement(IconWrapper4, { $disabled: disabled }, /* @__PURE__ */ React3.createElement("img", { src: icon, alt: "icon" }));
|
|
3470
|
+
}
|
|
3471
|
+
return /* @__PURE__ */ React3.createElement(IconWrapper4, { $disabled: disabled }, icon);
|
|
3472
|
+
};
|
|
3473
|
+
const renderLabel = () => {
|
|
3474
|
+
if (!label) return null;
|
|
3475
|
+
if (typeof label === "string") {
|
|
3476
|
+
return /* @__PURE__ */ React3.createElement(LabelText, { $disabled: disabled }, label);
|
|
3477
|
+
}
|
|
3478
|
+
return label;
|
|
3479
|
+
};
|
|
3451
3480
|
if (!splitDropdown && hasDropdown) {
|
|
3452
3481
|
return /* @__PURE__ */ React3.createElement(
|
|
3453
3482
|
ToolbarButtonContainer,
|
|
@@ -3455,19 +3484,20 @@ var ToolbarButton = ({
|
|
|
3455
3484
|
className,
|
|
3456
3485
|
style,
|
|
3457
3486
|
$disabled: disabled,
|
|
3458
|
-
$
|
|
3487
|
+
$isActive: isActive
|
|
3459
3488
|
},
|
|
3460
3489
|
/* @__PURE__ */ React3.createElement(
|
|
3461
3490
|
MainButton,
|
|
3462
3491
|
{
|
|
3463
3492
|
$disabled: disabled,
|
|
3464
|
-
$
|
|
3493
|
+
$isActive: isActive,
|
|
3465
3494
|
$hasLabel: !!label,
|
|
3466
3495
|
onClick: handleMainClick,
|
|
3496
|
+
onDoubleClick: handleMainDoubleClick,
|
|
3467
3497
|
disabled
|
|
3468
3498
|
},
|
|
3469
|
-
|
|
3470
|
-
|
|
3499
|
+
renderIcon(),
|
|
3500
|
+
renderLabel(),
|
|
3471
3501
|
/* @__PURE__ */ React3.createElement(DropdownArrow, { $disabled: disabled }, /* @__PURE__ */ React3.createElement(ArrowIcon, null))
|
|
3472
3502
|
)
|
|
3473
3503
|
);
|
|
@@ -3479,26 +3509,27 @@ var ToolbarButton = ({
|
|
|
3479
3509
|
className,
|
|
3480
3510
|
style,
|
|
3481
3511
|
$disabled: disabled,
|
|
3482
|
-
$
|
|
3512
|
+
$isActive: isActive
|
|
3483
3513
|
},
|
|
3484
3514
|
/* @__PURE__ */ React3.createElement(
|
|
3485
3515
|
MainButton,
|
|
3486
3516
|
{
|
|
3487
3517
|
$disabled: disabled,
|
|
3488
|
-
$
|
|
3518
|
+
$isActive: isActive,
|
|
3489
3519
|
$hasLabel: !!label,
|
|
3490
3520
|
onClick: handleMainClick,
|
|
3521
|
+
onDoubleClick: handleMainDoubleClick,
|
|
3491
3522
|
disabled
|
|
3492
3523
|
},
|
|
3493
|
-
|
|
3494
|
-
|
|
3524
|
+
renderIcon(),
|
|
3525
|
+
renderLabel()
|
|
3495
3526
|
),
|
|
3496
|
-
/* @__PURE__ */ React3.createElement(Divider, { $disabled: disabled, $
|
|
3527
|
+
/* @__PURE__ */ React3.createElement(Divider, { $disabled: disabled, $isActive: isActive }),
|
|
3497
3528
|
/* @__PURE__ */ React3.createElement(
|
|
3498
3529
|
DropdownButton,
|
|
3499
3530
|
{
|
|
3500
3531
|
$disabled: disabled,
|
|
3501
|
-
$
|
|
3532
|
+
$isActive: isActive,
|
|
3502
3533
|
$split: true,
|
|
3503
3534
|
onClick: handleDropdownClick,
|
|
3504
3535
|
disabled
|
|
@@ -3513,19 +3544,20 @@ var ToolbarButton = ({
|
|
|
3513
3544
|
className,
|
|
3514
3545
|
style,
|
|
3515
3546
|
$disabled: disabled,
|
|
3516
|
-
$
|
|
3547
|
+
$isActive: isActive
|
|
3517
3548
|
},
|
|
3518
3549
|
/* @__PURE__ */ React3.createElement(
|
|
3519
3550
|
MainButton,
|
|
3520
3551
|
{
|
|
3521
3552
|
$disabled: disabled,
|
|
3522
|
-
$
|
|
3553
|
+
$isActive: isActive,
|
|
3523
3554
|
$hasLabel: !!label,
|
|
3524
3555
|
onClick: handleMainClick,
|
|
3556
|
+
onDoubleClick: handleMainDoubleClick,
|
|
3525
3557
|
disabled
|
|
3526
3558
|
},
|
|
3527
|
-
|
|
3528
|
-
|
|
3559
|
+
renderIcon(),
|
|
3560
|
+
renderLabel()
|
|
3529
3561
|
)
|
|
3530
3562
|
);
|
|
3531
3563
|
};
|
|
@@ -3740,7 +3772,7 @@ init_Icon2();
|
|
|
3740
3772
|
// src/dropdown/globalStyle.ts
|
|
3741
3773
|
init_context();
|
|
3742
3774
|
var theme2 = getGlobalTheme();
|
|
3743
|
-
var DropdownGlobalStyles = createGlobalStyle`
|
|
3775
|
+
var DropdownGlobalStyles = createGlobalStyle$1`
|
|
3744
3776
|
/* Dropdown container */
|
|
3745
3777
|
.od-dropdown {
|
|
3746
3778
|
position: absolute;
|
|
@@ -3798,7 +3830,7 @@ var DropdownGlobalStyles = createGlobalStyle`
|
|
|
3798
3830
|
}
|
|
3799
3831
|
}
|
|
3800
3832
|
`;
|
|
3801
|
-
var MenuGlobalStyles = createGlobalStyle`
|
|
3833
|
+
var MenuGlobalStyles = createGlobalStyle$1`
|
|
3802
3834
|
/* Base menu container */
|
|
3803
3835
|
.od-menu {
|
|
3804
3836
|
margin: 0;
|
|
@@ -4416,6 +4448,264 @@ var Dropdown = ({
|
|
|
4416
4448
|
};
|
|
4417
4449
|
Dropdown.displayName = "Dropdown";
|
|
4418
4450
|
|
|
4451
|
+
// src/Modal/Modal.tsx
|
|
4452
|
+
init_Button2();
|
|
4453
|
+
init_Icon2();
|
|
4454
|
+
|
|
4455
|
+
// src/Modal/globalStyle.ts
|
|
4456
|
+
init_styled();
|
|
4457
|
+
var ModalGlobalStyles = createGlobalStyle`
|
|
4458
|
+
.osd-modal {
|
|
4459
|
+
position: relative;
|
|
4460
|
+
width: auto;
|
|
4461
|
+
max-height: 100%;
|
|
4462
|
+
}
|
|
4463
|
+
|
|
4464
|
+
.osd-modal-mask {
|
|
4465
|
+
position: fixed;
|
|
4466
|
+
top: 0;
|
|
4467
|
+
right: 0;
|
|
4468
|
+
left: 0;
|
|
4469
|
+
bottom: 0;
|
|
4470
|
+
background-color: ${(props) => props.theme.components.modal.message.maskLight};
|
|
4471
|
+
height: 100%;
|
|
4472
|
+
z-index: ${(props) => props.theme.components.modal.message.maskZIndex};
|
|
4473
|
+
}
|
|
4474
|
+
|
|
4475
|
+
.osd-modal-mask-dark {
|
|
4476
|
+
background-color: ${(props) => props.theme.components.modal.message.maskDark};
|
|
4477
|
+
}
|
|
4478
|
+
|
|
4479
|
+
.osd-modal-mask-hidden {
|
|
4480
|
+
display: none;
|
|
4481
|
+
}
|
|
4482
|
+
|
|
4483
|
+
.osd-modal-wrap {
|
|
4484
|
+
position: fixed;
|
|
4485
|
+
overflow: auto;
|
|
4486
|
+
top: 0;
|
|
4487
|
+
right: 0;
|
|
4488
|
+
bottom: 0;
|
|
4489
|
+
left: 0;
|
|
4490
|
+
display: flex;
|
|
4491
|
+
align-items: center;
|
|
4492
|
+
justify-content: center;
|
|
4493
|
+
z-index: ${(props) => props.theme.components.modal.message.maskZIndex};
|
|
4494
|
+
-webkit-overflow-scrolling: touch;
|
|
4495
|
+
outline: 0;
|
|
4496
|
+
}
|
|
4497
|
+
|
|
4498
|
+
.osd-modal-section {
|
|
4499
|
+
position: relative;
|
|
4500
|
+
display: flex;
|
|
4501
|
+
flex-direction: column;
|
|
4502
|
+
padding: ${(props) => props.theme.components.modal.message.padding};
|
|
4503
|
+
background: ${(props) => props.theme.components.modal.message.background};
|
|
4504
|
+
border: ${(props) => props.theme.components.modal.message.border};
|
|
4505
|
+
box-shadow: ${(props) => props.theme.components.modal.message.shadow};
|
|
4506
|
+
border-radius: ${(props) => props.theme.components.modal.message.borderRadius};
|
|
4507
|
+
box-sizing: border-box;
|
|
4508
|
+
}
|
|
4509
|
+
|
|
4510
|
+
.osd-modal-section-message {
|
|
4511
|
+
max-width: ${(props) => props.theme.components.modal.message.maxWidth};
|
|
4512
|
+
min-width: ${(props) => props.theme.components.modal.message.minWidth};
|
|
4513
|
+
max-height: ${(props) => props.theme.components.modal.message.maxHeight};
|
|
4514
|
+
min-height: ${(props) => props.theme.components.modal.message.minHeight};
|
|
4515
|
+
}
|
|
4516
|
+
|
|
4517
|
+
.osd-modal-section-functional {
|
|
4518
|
+
max-width: ${(props) => props.theme.components.modal.functional.maxWidth};
|
|
4519
|
+
min-width: ${(props) => props.theme.components.modal.functional.minWidth};
|
|
4520
|
+
max-height: ${(props) => props.theme.components.modal.functional.maxHeight};
|
|
4521
|
+
min-height: ${(props) => props.theme.components.modal.functional.minHeight};
|
|
4522
|
+
}
|
|
4523
|
+
|
|
4524
|
+
.osd-modal-content-message {
|
|
4525
|
+
max-width: ${(props) => props.theme.components.modal.message.maxWidth};
|
|
4526
|
+
min-width: ${(props) => props.theme.components.modal.message.minWidth};
|
|
4527
|
+
max-height: ${(props) => props.theme.components.modal.message.maxHeight};
|
|
4528
|
+
min-height: ${(props) => props.theme.components.modal.message.minHeight};
|
|
4529
|
+
}
|
|
4530
|
+
|
|
4531
|
+
.osd-modal-content-functional {
|
|
4532
|
+
max-width: ${(props) => props.theme.components.modal.functional.maxWidth};
|
|
4533
|
+
min-width: ${(props) => props.theme.components.modal.functional.minWidth};
|
|
4534
|
+
max-height: ${(props) => props.theme.components.modal.functional.maxHeight};
|
|
4535
|
+
min-height: ${(props) => props.theme.components.modal.functional.minHeight};
|
|
4536
|
+
}
|
|
4537
|
+
|
|
4538
|
+
.osd-modal-close {
|
|
4539
|
+
position: absolute;
|
|
4540
|
+
right: 16px;
|
|
4541
|
+
top: 16px;
|
|
4542
|
+
z-index: 10;
|
|
4543
|
+
padding: 4px;
|
|
4544
|
+
line-height: 1;
|
|
4545
|
+
border: 0;
|
|
4546
|
+
outline: 0;
|
|
4547
|
+
background: transparent;
|
|
4548
|
+
cursor: pointer;
|
|
4549
|
+
border-radius: 4px;
|
|
4550
|
+
transition: background-color 0.2s;
|
|
4551
|
+
display: flex;
|
|
4552
|
+
align-items: center;
|
|
4553
|
+
justify-content: center;
|
|
4554
|
+
}
|
|
4555
|
+
|
|
4556
|
+
.osd-modal-close:hover {
|
|
4557
|
+
background: ${(props) => props.theme.components.modal.message.closeButtonHoverBackground};
|
|
4558
|
+
}
|
|
4559
|
+
|
|
4560
|
+
.osd-modal-close:active {
|
|
4561
|
+
background: ${(props) => props.theme.components.modal.message.closeButtonActiveBackground};
|
|
4562
|
+
}
|
|
4563
|
+
|
|
4564
|
+
.osd-modal-header {
|
|
4565
|
+
margin-bottom: 16px;
|
|
4566
|
+
padding-right: 24px;
|
|
4567
|
+
}
|
|
4568
|
+
|
|
4569
|
+
.osd-modal-title {
|
|
4570
|
+
font-size: ${(props) => props.theme.components.modal.message.titleFontSize};
|
|
4571
|
+
font-weight: ${(props) => props.theme.components.modal.message.titleFontWeight};
|
|
4572
|
+
line-height: ${(props) => props.theme.components.modal.message.titleLineHeight};
|
|
4573
|
+
color: ${(props) => props.theme.components.modal.message.titleColor};
|
|
4574
|
+
}
|
|
4575
|
+
|
|
4576
|
+
.osd-modal-body {
|
|
4577
|
+
flex: 1;
|
|
4578
|
+
font-size: ${(props) => props.theme.components.modal.message.bodyFontSize};
|
|
4579
|
+
line-height: ${(props) => props.theme.components.modal.message.bodyLineHeight};
|
|
4580
|
+
color: ${(props) => props.theme.components.modal.message.bodyColor};
|
|
4581
|
+
}
|
|
4582
|
+
|
|
4583
|
+
.osd-modal-footer {
|
|
4584
|
+
margin-top: 16px;
|
|
4585
|
+
display: flex;
|
|
4586
|
+
justify-content: flex-end;
|
|
4587
|
+
gap: 8px;
|
|
4588
|
+
}
|
|
4589
|
+
|
|
4590
|
+
.osd-modal.zoom-enter,
|
|
4591
|
+
.osd-modal.zoom-appear {
|
|
4592
|
+
animation-duration: 0.3s;
|
|
4593
|
+
transform: none;
|
|
4594
|
+
opacity: 0;
|
|
4595
|
+
}
|
|
4596
|
+
|
|
4597
|
+
.osd-modal-open {
|
|
4598
|
+
overflow: hidden;
|
|
4599
|
+
}
|
|
4600
|
+
`;
|
|
4601
|
+
|
|
4602
|
+
// src/Modal/Modal.tsx
|
|
4603
|
+
init_context();
|
|
4604
|
+
var Modal = ({
|
|
4605
|
+
visible = false,
|
|
4606
|
+
variant = "message",
|
|
4607
|
+
maskType = "light",
|
|
4608
|
+
title,
|
|
4609
|
+
width,
|
|
4610
|
+
okText,
|
|
4611
|
+
cancelText,
|
|
4612
|
+
footer,
|
|
4613
|
+
onOk,
|
|
4614
|
+
onCancel,
|
|
4615
|
+
onClose,
|
|
4616
|
+
disabledOkButton = false,
|
|
4617
|
+
prefixCls = "osd-modal",
|
|
4618
|
+
closable = true,
|
|
4619
|
+
closeIcon,
|
|
4620
|
+
mask = true,
|
|
4621
|
+
maskClosable = true,
|
|
4622
|
+
className,
|
|
4623
|
+
children,
|
|
4624
|
+
...restProps
|
|
4625
|
+
}) => {
|
|
4626
|
+
const handleClose = useCallback(
|
|
4627
|
+
(e) => {
|
|
4628
|
+
onClose?.(e);
|
|
4629
|
+
onCancel?.(e);
|
|
4630
|
+
},
|
|
4631
|
+
[onClose, onCancel]
|
|
4632
|
+
);
|
|
4633
|
+
useEffect(() => {
|
|
4634
|
+
styleManager.inject("osd-modal-styles", ModalGlobalStyles);
|
|
4635
|
+
}, []);
|
|
4636
|
+
const theme3 = getGlobalTheme();
|
|
4637
|
+
const getDefaultWidth = () => {
|
|
4638
|
+
if (width !== void 0) return width;
|
|
4639
|
+
switch (variant) {
|
|
4640
|
+
case "functional":
|
|
4641
|
+
return theme3.components.modal.functional.defaultWidth;
|
|
4642
|
+
case "message":
|
|
4643
|
+
default:
|
|
4644
|
+
return theme3.components.modal.message.defaultWidth;
|
|
4645
|
+
}
|
|
4646
|
+
};
|
|
4647
|
+
const getContentClassName = () => {
|
|
4648
|
+
switch (variant) {
|
|
4649
|
+
case "message":
|
|
4650
|
+
return `${prefixCls}-content-message`;
|
|
4651
|
+
case "functional":
|
|
4652
|
+
return `${prefixCls}-content-functional`;
|
|
4653
|
+
default:
|
|
4654
|
+
return `${prefixCls}-content-message`;
|
|
4655
|
+
}
|
|
4656
|
+
};
|
|
4657
|
+
const contentClassName = getContentClassName();
|
|
4658
|
+
const maskClassName = maskType === "dark" ? `${prefixCls}-mask-dark` : void 0;
|
|
4659
|
+
let defaultFooter = null;
|
|
4660
|
+
if (footer === void 0) {
|
|
4661
|
+
const okButton = okText === null ? null : /* @__PURE__ */ React3.createElement(
|
|
4662
|
+
Button,
|
|
4663
|
+
{
|
|
4664
|
+
key: "confirm",
|
|
4665
|
+
variant: "solid",
|
|
4666
|
+
colorType: "guidance",
|
|
4667
|
+
onClick: onOk,
|
|
4668
|
+
disabled: disabledOkButton
|
|
4669
|
+
},
|
|
4670
|
+
okText ?? "OK"
|
|
4671
|
+
);
|
|
4672
|
+
const cancelButton = cancelText === null ? null : /* @__PURE__ */ React3.createElement(Button, { key: "cancel", variant: "outlined", colorType: "default", onClick: (e) => handleClose(e) }, cancelText ?? "Cancel");
|
|
4673
|
+
defaultFooter = /* @__PURE__ */ React3.createElement(React3.Fragment, null, cancelButton, okButton);
|
|
4674
|
+
}
|
|
4675
|
+
const semanticClassNames = {};
|
|
4676
|
+
if (maskClassName) {
|
|
4677
|
+
semanticClassNames.mask = maskClassName;
|
|
4678
|
+
}
|
|
4679
|
+
if (contentClassName) {
|
|
4680
|
+
semanticClassNames.content = contentClassName;
|
|
4681
|
+
}
|
|
4682
|
+
const semanticStyles = {};
|
|
4683
|
+
if (width !== void 0) {
|
|
4684
|
+
semanticStyles.content = { width };
|
|
4685
|
+
}
|
|
4686
|
+
return /* @__PURE__ */ React3.createElement(
|
|
4687
|
+
RcDialog,
|
|
4688
|
+
{
|
|
4689
|
+
...restProps,
|
|
4690
|
+
visible,
|
|
4691
|
+
title,
|
|
4692
|
+
width: width === void 0 ? getDefaultWidth() : void 0,
|
|
4693
|
+
prefixCls,
|
|
4694
|
+
closable,
|
|
4695
|
+
closeIcon: closeIcon ?? /* @__PURE__ */ React3.createElement(Icon, { name: "close", size: 16 }),
|
|
4696
|
+
mask,
|
|
4697
|
+
maskClosable,
|
|
4698
|
+
classNames: Object.keys(semanticClassNames).length > 0 ? semanticClassNames : void 0,
|
|
4699
|
+
styles: Object.keys(semanticStyles).length > 0 ? semanticStyles : void 0,
|
|
4700
|
+
className,
|
|
4701
|
+
onClose: handleClose,
|
|
4702
|
+
footer: footer === void 0 ? defaultFooter : footer
|
|
4703
|
+
},
|
|
4704
|
+
children
|
|
4705
|
+
);
|
|
4706
|
+
};
|
|
4707
|
+
Modal.displayName = "Modal";
|
|
4708
|
+
|
|
4419
4709
|
// src/UIConfigProvider/UIConfigProvider.tsx
|
|
4420
4710
|
init_IconProvider();
|
|
4421
4711
|
init_configManager();
|
|
@@ -4523,6 +4813,6 @@ init_configManager();
|
|
|
4523
4813
|
init_styled();
|
|
4524
4814
|
init_context();
|
|
4525
4815
|
|
|
4526
|
-
export { Button, Checkbox, Dropdown, DropdownButton2 as DropdownButton, DropdownGlobalStyles, Icon, IconProvider, Input, Menu, MenuGlobalStyles, 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 };
|
|
4816
|
+
export { Button, Checkbox, Dropdown, DropdownButton2 as DropdownButton, DropdownGlobalStyles, Icon, IconProvider, Input, 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 };
|
|
4527
4817
|
//# sourceMappingURL=index.js.map
|
|
4528
4818
|
//# sourceMappingURL=index.js.map
|