@officesdk/design 0.1.25 → 0.1.26
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 +20 -6
- package/dist/components/cjs/index.js +58 -31
- package/dist/components/cjs/index.js.map +1 -1
- package/dist/components/esm/index.d.ts +20 -6
- package/dist/components/esm/index.js +58 -31
- package/dist/components/esm/index.js.map +1 -1
- package/dist/theme/cjs/index.js +2 -1
- package/dist/theme/cjs/index.js.map +1 -1
- package/dist/theme/esm/index.js +2 -1
- package/dist/theme/esm/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -969,7 +969,7 @@ interface TooltipProps extends Omit<Partial<TooltipProps$1>, 'prefixCls'> {
|
|
|
969
969
|
*/
|
|
970
970
|
declare const Tooltip: React$1.FC<TooltipProps>;
|
|
971
971
|
|
|
972
|
-
interface ToolbarButtonProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'onClick'> {
|
|
972
|
+
interface ToolbarButtonProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'onClick' | 'onDoubleClick'> {
|
|
973
973
|
/**
|
|
974
974
|
* Whether the button is disabled
|
|
975
975
|
*/
|
|
@@ -977,15 +977,17 @@ interface ToolbarButtonProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
|
|
|
977
977
|
/**
|
|
978
978
|
* Whether the button is in active state
|
|
979
979
|
*/
|
|
980
|
-
|
|
980
|
+
isActive?: boolean;
|
|
981
981
|
/**
|
|
982
982
|
* Icon to display
|
|
983
|
+
* - If string: image URL
|
|
984
|
+
* - If ReactNode: custom icon component
|
|
983
985
|
*/
|
|
984
|
-
icon?: React$1.ReactNode;
|
|
986
|
+
icon?: string | React$1.ReactNode;
|
|
985
987
|
/**
|
|
986
|
-
* Label text
|
|
988
|
+
* Label text or custom node
|
|
987
989
|
*/
|
|
988
|
-
label?: string;
|
|
990
|
+
label?: string | React$1.ReactNode;
|
|
989
991
|
/**
|
|
990
992
|
* Whether to show dropdown arrow
|
|
991
993
|
*/
|
|
@@ -998,6 +1000,10 @@ interface ToolbarButtonProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
|
|
|
998
1000
|
* Click handler for main button
|
|
999
1001
|
*/
|
|
1000
1002
|
onClick?: (e: React$1.MouseEvent<HTMLButtonElement>) => void;
|
|
1003
|
+
/**
|
|
1004
|
+
* Double click handler for main button
|
|
1005
|
+
*/
|
|
1006
|
+
onDoubleClick?: (e: React$1.MouseEvent<HTMLButtonElement>) => void;
|
|
1001
1007
|
/**
|
|
1002
1008
|
* Click handler for dropdown section
|
|
1003
1009
|
*/
|
|
@@ -1017,14 +1023,22 @@ interface ToolbarButtonProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
|
|
|
1017
1023
|
* A toolbar button with optional icon, label, and dropdown functionality
|
|
1018
1024
|
*
|
|
1019
1025
|
* @example
|
|
1020
|
-
* // Icon
|
|
1026
|
+
* // Icon component
|
|
1021
1027
|
* <ToolbarButton icon={<Icon />} />
|
|
1022
1028
|
*
|
|
1023
1029
|
* @example
|
|
1030
|
+
* // Icon from URL
|
|
1031
|
+
* <ToolbarButton icon="https://example.com/icon.png" />
|
|
1032
|
+
*
|
|
1033
|
+
* @example
|
|
1024
1034
|
* // Button with label and dropdown
|
|
1025
1035
|
* <ToolbarButton icon={<Icon />} label="Format" hasDropdown />
|
|
1026
1036
|
*
|
|
1027
1037
|
* @example
|
|
1038
|
+
* // Button with custom label node
|
|
1039
|
+
* <ToolbarButton icon={<Icon />} label={<CustomLabel />} />
|
|
1040
|
+
*
|
|
1041
|
+
* @example
|
|
1028
1042
|
* // Button with split dropdown
|
|
1029
1043
|
* <ToolbarButton
|
|
1030
1044
|
* icon={<Icon />}
|
|
@@ -3207,15 +3207,16 @@ var ToolbarButtonContainer = exports.styled.div`
|
|
|
3207
3207
|
border-radius: 2px;
|
|
3208
3208
|
transition: border-color 0.15s ease;
|
|
3209
3209
|
box-sizing: border-box;
|
|
3210
|
+
overflow: hidden;
|
|
3210
3211
|
|
|
3211
|
-
${({ $disabled, $
|
|
3212
|
+
${({ $disabled, $isActive, theme: theme3 }) => {
|
|
3212
3213
|
const config = theme3.components.toolbarButton;
|
|
3213
3214
|
if ($disabled) {
|
|
3214
3215
|
return `
|
|
3215
3216
|
border-color: ${config.border.borderColorDisabled};
|
|
3216
3217
|
`;
|
|
3217
3218
|
}
|
|
3218
|
-
if ($
|
|
3219
|
+
if ($isActive) {
|
|
3219
3220
|
return `
|
|
3220
3221
|
border-color: ${config.border.borderColorActive};
|
|
3221
3222
|
|
|
@@ -3243,6 +3244,15 @@ var ToolbarButtonContainer = exports.styled.div`
|
|
|
3243
3244
|
}
|
|
3244
3245
|
`;
|
|
3245
3246
|
}}
|
|
3247
|
+
|
|
3248
|
+
${({ theme: theme3 }) => {
|
|
3249
|
+
const config = theme3.components.toolbarButton;
|
|
3250
|
+
return `
|
|
3251
|
+
height: ${config.layout.height};
|
|
3252
|
+
padding: ${config.layout.padding};
|
|
3253
|
+
border-radius: ${config.layout.borderRadius};
|
|
3254
|
+
`;
|
|
3255
|
+
}}
|
|
3246
3256
|
`;
|
|
3247
3257
|
var MainButton = exports.styled.button`
|
|
3248
3258
|
display: flex;
|
|
@@ -3251,17 +3261,17 @@ var MainButton = exports.styled.button`
|
|
|
3251
3261
|
border: none;
|
|
3252
3262
|
cursor: pointer;
|
|
3253
3263
|
outline: none;
|
|
3264
|
+
height: 100%;
|
|
3254
3265
|
transition: background-color 0.15s ease;
|
|
3255
3266
|
|
|
3256
|
-
${({
|
|
3267
|
+
${({ theme: theme3 }) => {
|
|
3257
3268
|
const config = theme3.components.toolbarButton;
|
|
3258
3269
|
return `
|
|
3259
|
-
|
|
3260
|
-
padding: ${$hasLabel ? config.layout.content.padding : config.layout.padding};
|
|
3270
|
+
padding: ${config.layout.content.padding};
|
|
3261
3271
|
`;
|
|
3262
3272
|
}}
|
|
3263
3273
|
|
|
3264
|
-
${({ $disabled, $
|
|
3274
|
+
${({ $disabled, $isActive, theme: theme3 }) => {
|
|
3265
3275
|
const config = theme3.components.toolbarButton;
|
|
3266
3276
|
if ($disabled) {
|
|
3267
3277
|
return `
|
|
@@ -3269,7 +3279,7 @@ var MainButton = exports.styled.button`
|
|
|
3269
3279
|
background: ${config.background.backgroundDisabled};
|
|
3270
3280
|
`;
|
|
3271
3281
|
}
|
|
3272
|
-
if ($
|
|
3282
|
+
if ($isActive) {
|
|
3273
3283
|
return `
|
|
3274
3284
|
background: ${config.background.backgroundActive};
|
|
3275
3285
|
`;
|
|
@@ -3301,13 +3311,8 @@ var IconWrapper4 = exports.styled.span`
|
|
|
3301
3311
|
`;
|
|
3302
3312
|
}}
|
|
3303
3313
|
|
|
3304
|
-
${({ $disabled
|
|
3305
|
-
|
|
3306
|
-
return $disabled ? `
|
|
3307
|
-
color: ${config.color.colorDisabled};
|
|
3308
|
-
` : `
|
|
3309
|
-
color: ${config.color.color};
|
|
3310
|
-
`;
|
|
3314
|
+
${({ $disabled }) => {
|
|
3315
|
+
return $disabled ? `opacity: 0.3;` : ``;
|
|
3311
3316
|
}}
|
|
3312
3317
|
|
|
3313
3318
|
svg, img {
|
|
@@ -3414,14 +3419,14 @@ var Divider = exports.styled.div`
|
|
|
3414
3419
|
`;
|
|
3415
3420
|
}}
|
|
3416
3421
|
|
|
3417
|
-
${({ $disabled, $
|
|
3422
|
+
${({ $disabled, $isActive, theme: theme3 }) => {
|
|
3418
3423
|
const config = theme3.components.toolbarButton;
|
|
3419
3424
|
if ($disabled) {
|
|
3420
3425
|
return `
|
|
3421
3426
|
background-color: ${config.border.borderColorDisabled};
|
|
3422
3427
|
`;
|
|
3423
3428
|
}
|
|
3424
|
-
if ($
|
|
3429
|
+
if ($isActive) {
|
|
3425
3430
|
return `
|
|
3426
3431
|
background-color: ${config.border.borderColorActive};
|
|
3427
3432
|
`;
|
|
@@ -3441,12 +3446,13 @@ var ArrowIcon = () => /* @__PURE__ */ React3__default.default.createElement("svg
|
|
|
3441
3446
|
));
|
|
3442
3447
|
var ToolbarButton = ({
|
|
3443
3448
|
disabled = false,
|
|
3444
|
-
|
|
3449
|
+
isActive = false,
|
|
3445
3450
|
icon,
|
|
3446
3451
|
label,
|
|
3447
3452
|
hasDropdown = false,
|
|
3448
3453
|
splitDropdown = false,
|
|
3449
3454
|
onClick,
|
|
3455
|
+
onDoubleClick,
|
|
3450
3456
|
onDropdownClick,
|
|
3451
3457
|
className,
|
|
3452
3458
|
style
|
|
@@ -3455,11 +3461,29 @@ var ToolbarButton = ({
|
|
|
3455
3461
|
if (disabled) return;
|
|
3456
3462
|
onClick?.(e);
|
|
3457
3463
|
};
|
|
3464
|
+
const handleMainDoubleClick = (e) => {
|
|
3465
|
+
if (disabled) return;
|
|
3466
|
+
onDoubleClick?.(e);
|
|
3467
|
+
};
|
|
3458
3468
|
const handleDropdownClick = (e) => {
|
|
3459
3469
|
if (disabled) return;
|
|
3460
3470
|
e.stopPropagation();
|
|
3461
3471
|
onDropdownClick?.(e);
|
|
3462
3472
|
};
|
|
3473
|
+
const renderIcon = () => {
|
|
3474
|
+
if (!icon) return null;
|
|
3475
|
+
if (typeof icon === "string") {
|
|
3476
|
+
return /* @__PURE__ */ React3__default.default.createElement(IconWrapper4, { $disabled: disabled }, /* @__PURE__ */ React3__default.default.createElement("img", { src: icon, alt: "icon" }));
|
|
3477
|
+
}
|
|
3478
|
+
return /* @__PURE__ */ React3__default.default.createElement(IconWrapper4, { $disabled: disabled }, icon);
|
|
3479
|
+
};
|
|
3480
|
+
const renderLabel = () => {
|
|
3481
|
+
if (!label) return null;
|
|
3482
|
+
if (typeof label === "string") {
|
|
3483
|
+
return /* @__PURE__ */ React3__default.default.createElement(LabelText, { $disabled: disabled }, label);
|
|
3484
|
+
}
|
|
3485
|
+
return label;
|
|
3486
|
+
};
|
|
3463
3487
|
if (!splitDropdown && hasDropdown) {
|
|
3464
3488
|
return /* @__PURE__ */ React3__default.default.createElement(
|
|
3465
3489
|
ToolbarButtonContainer,
|
|
@@ -3467,19 +3491,20 @@ var ToolbarButton = ({
|
|
|
3467
3491
|
className,
|
|
3468
3492
|
style,
|
|
3469
3493
|
$disabled: disabled,
|
|
3470
|
-
$
|
|
3494
|
+
$isActive: isActive
|
|
3471
3495
|
},
|
|
3472
3496
|
/* @__PURE__ */ React3__default.default.createElement(
|
|
3473
3497
|
MainButton,
|
|
3474
3498
|
{
|
|
3475
3499
|
$disabled: disabled,
|
|
3476
|
-
$
|
|
3500
|
+
$isActive: isActive,
|
|
3477
3501
|
$hasLabel: !!label,
|
|
3478
3502
|
onClick: handleMainClick,
|
|
3503
|
+
onDoubleClick: handleMainDoubleClick,
|
|
3479
3504
|
disabled
|
|
3480
3505
|
},
|
|
3481
|
-
|
|
3482
|
-
|
|
3506
|
+
renderIcon(),
|
|
3507
|
+
renderLabel(),
|
|
3483
3508
|
/* @__PURE__ */ React3__default.default.createElement(DropdownArrow, { $disabled: disabled }, /* @__PURE__ */ React3__default.default.createElement(ArrowIcon, null))
|
|
3484
3509
|
)
|
|
3485
3510
|
);
|
|
@@ -3491,26 +3516,27 @@ var ToolbarButton = ({
|
|
|
3491
3516
|
className,
|
|
3492
3517
|
style,
|
|
3493
3518
|
$disabled: disabled,
|
|
3494
|
-
$
|
|
3519
|
+
$isActive: isActive
|
|
3495
3520
|
},
|
|
3496
3521
|
/* @__PURE__ */ React3__default.default.createElement(
|
|
3497
3522
|
MainButton,
|
|
3498
3523
|
{
|
|
3499
3524
|
$disabled: disabled,
|
|
3500
|
-
$
|
|
3525
|
+
$isActive: isActive,
|
|
3501
3526
|
$hasLabel: !!label,
|
|
3502
3527
|
onClick: handleMainClick,
|
|
3528
|
+
onDoubleClick: handleMainDoubleClick,
|
|
3503
3529
|
disabled
|
|
3504
3530
|
},
|
|
3505
|
-
|
|
3506
|
-
|
|
3531
|
+
renderIcon(),
|
|
3532
|
+
renderLabel()
|
|
3507
3533
|
),
|
|
3508
|
-
/* @__PURE__ */ React3__default.default.createElement(Divider, { $disabled: disabled, $
|
|
3534
|
+
/* @__PURE__ */ React3__default.default.createElement(Divider, { $disabled: disabled, $isActive: isActive }),
|
|
3509
3535
|
/* @__PURE__ */ React3__default.default.createElement(
|
|
3510
3536
|
DropdownButton,
|
|
3511
3537
|
{
|
|
3512
3538
|
$disabled: disabled,
|
|
3513
|
-
$
|
|
3539
|
+
$isActive: isActive,
|
|
3514
3540
|
$split: true,
|
|
3515
3541
|
onClick: handleDropdownClick,
|
|
3516
3542
|
disabled
|
|
@@ -3525,19 +3551,20 @@ var ToolbarButton = ({
|
|
|
3525
3551
|
className,
|
|
3526
3552
|
style,
|
|
3527
3553
|
$disabled: disabled,
|
|
3528
|
-
$
|
|
3554
|
+
$isActive: isActive
|
|
3529
3555
|
},
|
|
3530
3556
|
/* @__PURE__ */ React3__default.default.createElement(
|
|
3531
3557
|
MainButton,
|
|
3532
3558
|
{
|
|
3533
3559
|
$disabled: disabled,
|
|
3534
|
-
$
|
|
3560
|
+
$isActive: isActive,
|
|
3535
3561
|
$hasLabel: !!label,
|
|
3536
3562
|
onClick: handleMainClick,
|
|
3563
|
+
onDoubleClick: handleMainDoubleClick,
|
|
3537
3564
|
disabled
|
|
3538
3565
|
},
|
|
3539
|
-
|
|
3540
|
-
|
|
3566
|
+
renderIcon(),
|
|
3567
|
+
renderLabel()
|
|
3541
3568
|
)
|
|
3542
3569
|
);
|
|
3543
3570
|
};
|