@officesdk/design 0.1.27 → 0.1.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/components/cjs/index.d.ts +9 -1
- package/dist/components/cjs/index.js +103 -36
- package/dist/components/cjs/index.js.map +1 -1
- package/dist/components/esm/index.d.ts +9 -1
- package/dist/components/esm/index.js +103 -36
- package/dist/components/esm/index.js.map +1 -1
- package/dist/theme/cjs/index.js +10 -9
- package/dist/theme/cjs/index.js.map +1 -1
- package/dist/theme/esm/index.js +10 -9
- package/dist/theme/esm/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -861,7 +861,7 @@ interface TabItem {
|
|
|
861
861
|
/**
|
|
862
862
|
* Tab label
|
|
863
863
|
*/
|
|
864
|
-
label: string;
|
|
864
|
+
label: string | React$1.ReactNode;
|
|
865
865
|
/**
|
|
866
866
|
* Whether the tab is disabled
|
|
867
867
|
*/
|
|
@@ -904,6 +904,14 @@ interface TabsProps {
|
|
|
904
904
|
* Custom style
|
|
905
905
|
*/
|
|
906
906
|
style?: React$1.CSSProperties;
|
|
907
|
+
/**
|
|
908
|
+
* Custom className for tab item
|
|
909
|
+
*/
|
|
910
|
+
tabItemClassName?: string;
|
|
911
|
+
/**
|
|
912
|
+
* Custom style for tab item
|
|
913
|
+
*/
|
|
914
|
+
tabItemStyle?: React$1.CSSProperties;
|
|
907
915
|
}
|
|
908
916
|
/**
|
|
909
917
|
* Tab Component
|
|
@@ -747,7 +747,6 @@ var init_Button = __esm({
|
|
|
747
747
|
justify-content: center;
|
|
748
748
|
cursor: pointer;
|
|
749
749
|
outline: none;
|
|
750
|
-
border: none;
|
|
751
750
|
width: ${({ $fullWidth }) => $fullWidth ? "100%" : "auto"};
|
|
752
751
|
|
|
753
752
|
/* Size variants */
|
|
@@ -773,34 +772,44 @@ var init_Button = __esm({
|
|
|
773
772
|
|
|
774
773
|
/* Variant and color type styles */
|
|
775
774
|
${({ $variant, $colorType, $iconBordered, theme: theme3 }) => {
|
|
775
|
+
const combineShadows = (insetBorder, externalShadow) => {
|
|
776
|
+
if (!insetBorder) {
|
|
777
|
+
return externalShadow || "none";
|
|
778
|
+
}
|
|
779
|
+
if (externalShadow === "none") {
|
|
780
|
+
return insetBorder;
|
|
781
|
+
}
|
|
782
|
+
return `${insetBorder}, ${externalShadow}`;
|
|
783
|
+
};
|
|
776
784
|
if ($variant === "icon") {
|
|
777
785
|
const baseVariant = $iconBordered ? "outlined" : "text";
|
|
778
786
|
const styles2 = theme3.components.button[baseVariant]["default"];
|
|
787
|
+
const borderColor2 = $iconBordered ? styles2.borderColor : "transparent";
|
|
788
|
+
const borderColorHover2 = $iconBordered ? styles2.borderColorHover : "transparent";
|
|
789
|
+
const borderColorActive2 = $iconBordered ? styles2.borderColorActive : "transparent";
|
|
790
|
+
const borderColorDisabled2 = $iconBordered ? styles2.borderColorDisabled : "transparent";
|
|
779
791
|
return `
|
|
780
792
|
background: ${styles2.background};
|
|
781
793
|
color: ${styles2.color};
|
|
782
|
-
border:
|
|
783
|
-
box-shadow: ${styles2.boxShadow};
|
|
794
|
+
border: none;
|
|
795
|
+
box-shadow: ${combineShadows(`inset 0 0 0 1px ${borderColor2}`, styles2.boxShadow)};
|
|
784
796
|
|
|
785
797
|
&:hover:not(:disabled) {
|
|
786
798
|
background: ${styles2.backgroundHover};
|
|
787
799
|
color: ${styles2.colorHover};
|
|
788
|
-
|
|
789
|
-
box-shadow: ${styles2.boxShadowHover};
|
|
800
|
+
box-shadow: ${combineShadows(`inset 0 0 0 1px ${borderColorHover2}`, styles2.boxShadowHover)};
|
|
790
801
|
}
|
|
791
802
|
|
|
792
803
|
&:active:not(:disabled) {
|
|
793
804
|
background: ${styles2.backgroundActive};
|
|
794
805
|
color: ${styles2.colorActive};
|
|
795
|
-
|
|
796
|
-
box-shadow: ${styles2.boxShadowActive};
|
|
806
|
+
box-shadow: ${combineShadows(`inset 0 0 0 1px ${borderColorActive2}`, styles2.boxShadowActive)};
|
|
797
807
|
}
|
|
798
808
|
|
|
799
809
|
&:disabled {
|
|
800
810
|
background: ${styles2.backgroundDisabled};
|
|
801
811
|
color: ${styles2.colorDisabled};
|
|
802
|
-
|
|
803
|
-
box-shadow: ${styles2.boxShadowDisabled};
|
|
812
|
+
box-shadow: ${combineShadows(`inset 0 0 0 1px ${borderColorDisabled2}`, styles2.boxShadowDisabled)};
|
|
804
813
|
cursor: not-allowed;
|
|
805
814
|
}
|
|
806
815
|
`;
|
|
@@ -814,32 +823,48 @@ var init_Button = __esm({
|
|
|
814
823
|
}
|
|
815
824
|
const effectiveColorType = colorType === "status" && variant !== "text" ? "default" : colorType;
|
|
816
825
|
const styles = theme3.components.button[variant][effectiveColorType];
|
|
826
|
+
const needsBorder = variant === "outlined";
|
|
827
|
+
const borderWidth = needsBorder ? "1px" : "0px";
|
|
828
|
+
const getBorderColor = (state = "normal") => {
|
|
829
|
+
if (!needsBorder) {
|
|
830
|
+
return "transparent";
|
|
831
|
+
}
|
|
832
|
+
const stateKey = state === "normal" ? "borderColor" : `borderColor${state.charAt(0).toUpperCase() + state.slice(1)}`;
|
|
833
|
+
return styles[stateKey];
|
|
834
|
+
};
|
|
835
|
+
const borderColor = getBorderColor("normal");
|
|
836
|
+
const borderColorHover = getBorderColor("hover");
|
|
837
|
+
const borderColorActive = getBorderColor("active");
|
|
838
|
+
const borderColorDisabled = getBorderColor("disabled");
|
|
839
|
+
const getInsetBorder = (color) => {
|
|
840
|
+
if (borderWidth === "0px") {
|
|
841
|
+
return "";
|
|
842
|
+
}
|
|
843
|
+
return `inset 0 0 0 ${borderWidth} ${color}`;
|
|
844
|
+
};
|
|
817
845
|
return `
|
|
818
846
|
background: ${styles.background};
|
|
819
847
|
color: ${styles.color};
|
|
820
|
-
border:
|
|
821
|
-
box-shadow: ${styles.boxShadow};
|
|
848
|
+
border: none;
|
|
849
|
+
box-shadow: ${combineShadows(getInsetBorder(borderColor), styles.boxShadow)};
|
|
822
850
|
font-weight: ${styles.fontWeight};
|
|
823
851
|
|
|
824
852
|
&:hover:not(:disabled) {
|
|
825
853
|
background: ${styles.backgroundHover};
|
|
826
854
|
color: ${styles.colorHover};
|
|
827
|
-
|
|
828
|
-
box-shadow: ${styles.boxShadowHover};
|
|
855
|
+
box-shadow: ${combineShadows(getInsetBorder(borderColorHover), styles.boxShadowHover)};
|
|
829
856
|
}
|
|
830
857
|
|
|
831
858
|
&:active:not(:disabled) {
|
|
832
859
|
background: ${styles.backgroundActive};
|
|
833
860
|
color: ${styles.colorActive};
|
|
834
|
-
|
|
835
|
-
box-shadow: ${styles.boxShadowActive};
|
|
861
|
+
box-shadow: ${combineShadows(getInsetBorder(borderColorActive), styles.boxShadowActive)};
|
|
836
862
|
}
|
|
837
863
|
|
|
838
864
|
&:disabled {
|
|
839
865
|
background: ${styles.backgroundDisabled};
|
|
840
866
|
color: ${styles.colorDisabled};
|
|
841
|
-
|
|
842
|
-
box-shadow: ${styles.boxShadowDisabled};
|
|
867
|
+
box-shadow: ${combineShadows(getInsetBorder(borderColorDisabled), styles.boxShadowDisabled)};
|
|
843
868
|
cursor: not-allowed;
|
|
844
869
|
}
|
|
845
870
|
`;
|
|
@@ -2638,11 +2663,24 @@ init_styled();
|
|
|
2638
2663
|
var TabContainer = exports.styled.div`
|
|
2639
2664
|
display: flex;
|
|
2640
2665
|
flex-direction: column;
|
|
2666
|
+
|
|
2667
|
+
${({ $variant, theme: theme3 }) => {
|
|
2668
|
+
const variantConfig = theme3.components.tab[$variant];
|
|
2669
|
+
const sizeConfig = theme3.components.tab.large;
|
|
2670
|
+
return `
|
|
2671
|
+
height: ${sizeConfig.height};
|
|
2672
|
+
border-radius: ${sizeConfig.borderRadius};
|
|
2673
|
+
background-color: ${variantConfig.backgroundColor};
|
|
2674
|
+
`;
|
|
2675
|
+
}}
|
|
2641
2676
|
`;
|
|
2642
2677
|
var TabList = exports.styled.div`
|
|
2643
2678
|
display: flex;
|
|
2644
2679
|
align-items: center;
|
|
2645
2680
|
position: relative;
|
|
2681
|
+
width: 100%;
|
|
2682
|
+
height: 100%;
|
|
2683
|
+
|
|
2646
2684
|
|
|
2647
2685
|
${({ $variant, theme: theme3 }) => {
|
|
2648
2686
|
const variantConfig = theme3.components.tab[$variant];
|
|
@@ -2675,8 +2713,7 @@ var TabItem = exports.styled.button`
|
|
|
2675
2713
|
${({ theme: theme3 }) => {
|
|
2676
2714
|
const sizeConfig = theme3.components.tab.large;
|
|
2677
2715
|
return `
|
|
2678
|
-
height:
|
|
2679
|
-
padding: ${sizeConfig.padding};
|
|
2716
|
+
height: 100%;
|
|
2680
2717
|
font-size: ${sizeConfig.fontSize};
|
|
2681
2718
|
line-height: ${sizeConfig.lineHeight};
|
|
2682
2719
|
border-radius: ${sizeConfig.borderRadius};
|
|
@@ -2690,15 +2727,14 @@ var TabItem = exports.styled.button`
|
|
|
2690
2727
|
if ($disabled) {
|
|
2691
2728
|
return `
|
|
2692
2729
|
background: ${itemConfig.backgroundDisabled};
|
|
2693
|
-
border-color: ${itemConfig.borderColorDisabled};
|
|
2694
2730
|
color: ${itemConfig.colorDisabled};
|
|
2695
2731
|
`;
|
|
2696
2732
|
}
|
|
2697
2733
|
if ($active) {
|
|
2698
2734
|
return `
|
|
2699
2735
|
background: ${itemConfig.backgroundActive};
|
|
2700
|
-
border-color: ${itemConfig.borderColorActive};
|
|
2701
2736
|
color: ${itemConfig.colorActive};
|
|
2737
|
+
font-weight: 500;
|
|
2702
2738
|
`;
|
|
2703
2739
|
}
|
|
2704
2740
|
return `
|
|
@@ -2708,20 +2744,21 @@ var TabItem = exports.styled.button`
|
|
|
2708
2744
|
`;
|
|
2709
2745
|
}}
|
|
2710
2746
|
|
|
2711
|
-
${({ $variant, $disabled, theme: theme3 }) => {
|
|
2747
|
+
${({ $variant, $disabled, theme: theme3, $active }) => {
|
|
2712
2748
|
if ($disabled) return "";
|
|
2713
2749
|
const variantConfig = theme3.components.tab[$variant];
|
|
2714
2750
|
const itemConfig = variantConfig.item;
|
|
2751
|
+
const isHoverNormal = !$active && !$disabled;
|
|
2715
2752
|
return `
|
|
2716
2753
|
&:hover {
|
|
2717
|
-
background: ${itemConfig.backgroundHover};
|
|
2718
|
-
border-color: ${itemConfig.borderColorHover};
|
|
2719
|
-
color: ${itemConfig.colorHover};
|
|
2754
|
+
background: ${isHoverNormal ? itemConfig.backgroundHover : ""};
|
|
2755
|
+
border-color: ${isHoverNormal ? itemConfig.borderColorHover : ""};
|
|
2756
|
+
color: ${isHoverNormal ? itemConfig.colorHover : ""};
|
|
2720
2757
|
}
|
|
2721
2758
|
`;
|
|
2722
2759
|
}}
|
|
2723
2760
|
|
|
2724
|
-
${({ $variant, $active }) => {
|
|
2761
|
+
${({ $variant, $active, $disabled, theme: theme3 }) => {
|
|
2725
2762
|
if ($variant === "line" && $active) {
|
|
2726
2763
|
return `
|
|
2727
2764
|
&::after {
|
|
@@ -2736,16 +2773,41 @@ var TabItem = exports.styled.button`
|
|
|
2736
2773
|
`;
|
|
2737
2774
|
}
|
|
2738
2775
|
if ($variant === "card") {
|
|
2776
|
+
const variantConfig = theme3.components.tab[$variant];
|
|
2777
|
+
const itemConfig = variantConfig.item;
|
|
2778
|
+
let borderColor;
|
|
2779
|
+
if ($disabled) {
|
|
2780
|
+
borderColor = itemConfig.borderColorDisabled;
|
|
2781
|
+
} else if ($active) {
|
|
2782
|
+
borderColor = itemConfig.borderColorActive;
|
|
2783
|
+
} else {
|
|
2784
|
+
borderColor = itemConfig.borderColor;
|
|
2785
|
+
}
|
|
2739
2786
|
return `
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2787
|
+
box-shadow: inset 0 0 0 1px ${borderColor};
|
|
2788
|
+
flex-grow: 1;
|
|
2789
|
+
flex-shrink: 1;
|
|
2790
|
+
&:hover {
|
|
2791
|
+
}
|
|
2745
2792
|
`;
|
|
2746
2793
|
}
|
|
2747
2794
|
return "";
|
|
2748
2795
|
}}
|
|
2796
|
+
|
|
2797
|
+
${({ $variant }) => {
|
|
2798
|
+
if ($variant === "line") {
|
|
2799
|
+
return `
|
|
2800
|
+
max-width: 160px;
|
|
2801
|
+
`;
|
|
2802
|
+
}
|
|
2803
|
+
return "";
|
|
2804
|
+
}}
|
|
2805
|
+
`;
|
|
2806
|
+
var TabItemLabel = exports.styled.span`
|
|
2807
|
+
overflow: hidden;
|
|
2808
|
+
text-overflow: ellipsis;
|
|
2809
|
+
white-space: nowrap;
|
|
2810
|
+
min-width: 0;
|
|
2749
2811
|
`;
|
|
2750
2812
|
var Tabs = ({
|
|
2751
2813
|
items,
|
|
@@ -2756,7 +2818,9 @@ var Tabs = ({
|
|
|
2756
2818
|
size: _size = "large",
|
|
2757
2819
|
onChange,
|
|
2758
2820
|
className,
|
|
2759
|
-
style
|
|
2821
|
+
style,
|
|
2822
|
+
tabItemClassName,
|
|
2823
|
+
tabItemStyle
|
|
2760
2824
|
}) => {
|
|
2761
2825
|
const [internalActiveKey, setInternalActiveKey] = React3.useState(
|
|
2762
2826
|
controlledActiveKey ?? defaultActiveKey ?? items[0]?.key ?? ""
|
|
@@ -2772,7 +2836,7 @@ var Tabs = ({
|
|
|
2772
2836
|
},
|
|
2773
2837
|
[controlledActiveKey, onChange]
|
|
2774
2838
|
);
|
|
2775
|
-
return /* @__PURE__ */ React3__default.default.createElement(TabContainer, { className, style }, /* @__PURE__ */ React3__default.default.createElement(TabList, { $variant: variant, role: "tablist" }, items.map((item) => /* @__PURE__ */ React3__default.default.createElement(
|
|
2839
|
+
return /* @__PURE__ */ React3__default.default.createElement(TabContainer, { $variant: variant, className, style }, /* @__PURE__ */ React3__default.default.createElement(TabList, { $variant: variant, role: "tablist" }, items.map((item) => /* @__PURE__ */ React3__default.default.createElement(
|
|
2776
2840
|
TabItem,
|
|
2777
2841
|
{
|
|
2778
2842
|
key: item.key,
|
|
@@ -2784,10 +2848,12 @@ var Tabs = ({
|
|
|
2784
2848
|
"aria-selected": activeKey === item.key,
|
|
2785
2849
|
"aria-disabled": item.disabled,
|
|
2786
2850
|
disabled: item.disabled,
|
|
2787
|
-
type: "button"
|
|
2851
|
+
type: "button",
|
|
2852
|
+
className: tabItemClassName,
|
|
2853
|
+
style: tabItemStyle
|
|
2788
2854
|
},
|
|
2789
|
-
item.icon &&
|
|
2790
|
-
item.label
|
|
2855
|
+
!!item.icon && item.icon,
|
|
2856
|
+
typeof item.label === "string" ? /* @__PURE__ */ React3__default.default.createElement(TabItemLabel, null, item.label) : item.label
|
|
2791
2857
|
))));
|
|
2792
2858
|
};
|
|
2793
2859
|
Tabs.displayName = "Tab";
|
|
@@ -3588,6 +3654,7 @@ var DropdownButtonContainer = exports.styled.button`
|
|
|
3588
3654
|
box-sizing: border-box;
|
|
3589
3655
|
transition: all 0.2s ease;
|
|
3590
3656
|
font-family: 'PingFang SC', sans-serif;
|
|
3657
|
+
width: 100%;
|
|
3591
3658
|
|
|
3592
3659
|
${({ $size, theme: theme3 }) => {
|
|
3593
3660
|
const config = theme3.components?.dropdownButton;
|