@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
|
|
@@ -734,7 +734,6 @@ var init_Button = __esm({
|
|
|
734
734
|
justify-content: center;
|
|
735
735
|
cursor: pointer;
|
|
736
736
|
outline: none;
|
|
737
|
-
border: none;
|
|
738
737
|
width: ${({ $fullWidth }) => $fullWidth ? "100%" : "auto"};
|
|
739
738
|
|
|
740
739
|
/* Size variants */
|
|
@@ -760,34 +759,44 @@ var init_Button = __esm({
|
|
|
760
759
|
|
|
761
760
|
/* Variant and color type styles */
|
|
762
761
|
${({ $variant, $colorType, $iconBordered, theme: theme3 }) => {
|
|
762
|
+
const combineShadows = (insetBorder, externalShadow) => {
|
|
763
|
+
if (!insetBorder) {
|
|
764
|
+
return externalShadow || "none";
|
|
765
|
+
}
|
|
766
|
+
if (externalShadow === "none") {
|
|
767
|
+
return insetBorder;
|
|
768
|
+
}
|
|
769
|
+
return `${insetBorder}, ${externalShadow}`;
|
|
770
|
+
};
|
|
763
771
|
if ($variant === "icon") {
|
|
764
772
|
const baseVariant = $iconBordered ? "outlined" : "text";
|
|
765
773
|
const styles2 = theme3.components.button[baseVariant]["default"];
|
|
774
|
+
const borderColor2 = $iconBordered ? styles2.borderColor : "transparent";
|
|
775
|
+
const borderColorHover2 = $iconBordered ? styles2.borderColorHover : "transparent";
|
|
776
|
+
const borderColorActive2 = $iconBordered ? styles2.borderColorActive : "transparent";
|
|
777
|
+
const borderColorDisabled2 = $iconBordered ? styles2.borderColorDisabled : "transparent";
|
|
766
778
|
return `
|
|
767
779
|
background: ${styles2.background};
|
|
768
780
|
color: ${styles2.color};
|
|
769
|
-
border:
|
|
770
|
-
box-shadow: ${styles2.boxShadow};
|
|
781
|
+
border: none;
|
|
782
|
+
box-shadow: ${combineShadows(`inset 0 0 0 1px ${borderColor2}`, styles2.boxShadow)};
|
|
771
783
|
|
|
772
784
|
&:hover:not(:disabled) {
|
|
773
785
|
background: ${styles2.backgroundHover};
|
|
774
786
|
color: ${styles2.colorHover};
|
|
775
|
-
|
|
776
|
-
box-shadow: ${styles2.boxShadowHover};
|
|
787
|
+
box-shadow: ${combineShadows(`inset 0 0 0 1px ${borderColorHover2}`, styles2.boxShadowHover)};
|
|
777
788
|
}
|
|
778
789
|
|
|
779
790
|
&:active:not(:disabled) {
|
|
780
791
|
background: ${styles2.backgroundActive};
|
|
781
792
|
color: ${styles2.colorActive};
|
|
782
|
-
|
|
783
|
-
box-shadow: ${styles2.boxShadowActive};
|
|
793
|
+
box-shadow: ${combineShadows(`inset 0 0 0 1px ${borderColorActive2}`, styles2.boxShadowActive)};
|
|
784
794
|
}
|
|
785
795
|
|
|
786
796
|
&:disabled {
|
|
787
797
|
background: ${styles2.backgroundDisabled};
|
|
788
798
|
color: ${styles2.colorDisabled};
|
|
789
|
-
|
|
790
|
-
box-shadow: ${styles2.boxShadowDisabled};
|
|
799
|
+
box-shadow: ${combineShadows(`inset 0 0 0 1px ${borderColorDisabled2}`, styles2.boxShadowDisabled)};
|
|
791
800
|
cursor: not-allowed;
|
|
792
801
|
}
|
|
793
802
|
`;
|
|
@@ -801,32 +810,48 @@ var init_Button = __esm({
|
|
|
801
810
|
}
|
|
802
811
|
const effectiveColorType = colorType === "status" && variant !== "text" ? "default" : colorType;
|
|
803
812
|
const styles = theme3.components.button[variant][effectiveColorType];
|
|
813
|
+
const needsBorder = variant === "outlined";
|
|
814
|
+
const borderWidth = needsBorder ? "1px" : "0px";
|
|
815
|
+
const getBorderColor = (state = "normal") => {
|
|
816
|
+
if (!needsBorder) {
|
|
817
|
+
return "transparent";
|
|
818
|
+
}
|
|
819
|
+
const stateKey = state === "normal" ? "borderColor" : `borderColor${state.charAt(0).toUpperCase() + state.slice(1)}`;
|
|
820
|
+
return styles[stateKey];
|
|
821
|
+
};
|
|
822
|
+
const borderColor = getBorderColor("normal");
|
|
823
|
+
const borderColorHover = getBorderColor("hover");
|
|
824
|
+
const borderColorActive = getBorderColor("active");
|
|
825
|
+
const borderColorDisabled = getBorderColor("disabled");
|
|
826
|
+
const getInsetBorder = (color) => {
|
|
827
|
+
if (borderWidth === "0px") {
|
|
828
|
+
return "";
|
|
829
|
+
}
|
|
830
|
+
return `inset 0 0 0 ${borderWidth} ${color}`;
|
|
831
|
+
};
|
|
804
832
|
return `
|
|
805
833
|
background: ${styles.background};
|
|
806
834
|
color: ${styles.color};
|
|
807
|
-
border:
|
|
808
|
-
box-shadow: ${styles.boxShadow};
|
|
835
|
+
border: none;
|
|
836
|
+
box-shadow: ${combineShadows(getInsetBorder(borderColor), styles.boxShadow)};
|
|
809
837
|
font-weight: ${styles.fontWeight};
|
|
810
838
|
|
|
811
839
|
&:hover:not(:disabled) {
|
|
812
840
|
background: ${styles.backgroundHover};
|
|
813
841
|
color: ${styles.colorHover};
|
|
814
|
-
|
|
815
|
-
box-shadow: ${styles.boxShadowHover};
|
|
842
|
+
box-shadow: ${combineShadows(getInsetBorder(borderColorHover), styles.boxShadowHover)};
|
|
816
843
|
}
|
|
817
844
|
|
|
818
845
|
&:active:not(:disabled) {
|
|
819
846
|
background: ${styles.backgroundActive};
|
|
820
847
|
color: ${styles.colorActive};
|
|
821
|
-
|
|
822
|
-
box-shadow: ${styles.boxShadowActive};
|
|
848
|
+
box-shadow: ${combineShadows(getInsetBorder(borderColorActive), styles.boxShadowActive)};
|
|
823
849
|
}
|
|
824
850
|
|
|
825
851
|
&:disabled {
|
|
826
852
|
background: ${styles.backgroundDisabled};
|
|
827
853
|
color: ${styles.colorDisabled};
|
|
828
|
-
|
|
829
|
-
box-shadow: ${styles.boxShadowDisabled};
|
|
854
|
+
box-shadow: ${combineShadows(getInsetBorder(borderColorDisabled), styles.boxShadowDisabled)};
|
|
830
855
|
cursor: not-allowed;
|
|
831
856
|
}
|
|
832
857
|
`;
|
|
@@ -2625,11 +2650,24 @@ init_styled();
|
|
|
2625
2650
|
var TabContainer = styled.div`
|
|
2626
2651
|
display: flex;
|
|
2627
2652
|
flex-direction: column;
|
|
2653
|
+
|
|
2654
|
+
${({ $variant, theme: theme3 }) => {
|
|
2655
|
+
const variantConfig = theme3.components.tab[$variant];
|
|
2656
|
+
const sizeConfig = theme3.components.tab.large;
|
|
2657
|
+
return `
|
|
2658
|
+
height: ${sizeConfig.height};
|
|
2659
|
+
border-radius: ${sizeConfig.borderRadius};
|
|
2660
|
+
background-color: ${variantConfig.backgroundColor};
|
|
2661
|
+
`;
|
|
2662
|
+
}}
|
|
2628
2663
|
`;
|
|
2629
2664
|
var TabList = styled.div`
|
|
2630
2665
|
display: flex;
|
|
2631
2666
|
align-items: center;
|
|
2632
2667
|
position: relative;
|
|
2668
|
+
width: 100%;
|
|
2669
|
+
height: 100%;
|
|
2670
|
+
|
|
2633
2671
|
|
|
2634
2672
|
${({ $variant, theme: theme3 }) => {
|
|
2635
2673
|
const variantConfig = theme3.components.tab[$variant];
|
|
@@ -2662,8 +2700,7 @@ var TabItem = styled.button`
|
|
|
2662
2700
|
${({ theme: theme3 }) => {
|
|
2663
2701
|
const sizeConfig = theme3.components.tab.large;
|
|
2664
2702
|
return `
|
|
2665
|
-
height:
|
|
2666
|
-
padding: ${sizeConfig.padding};
|
|
2703
|
+
height: 100%;
|
|
2667
2704
|
font-size: ${sizeConfig.fontSize};
|
|
2668
2705
|
line-height: ${sizeConfig.lineHeight};
|
|
2669
2706
|
border-radius: ${sizeConfig.borderRadius};
|
|
@@ -2677,15 +2714,14 @@ var TabItem = styled.button`
|
|
|
2677
2714
|
if ($disabled) {
|
|
2678
2715
|
return `
|
|
2679
2716
|
background: ${itemConfig.backgroundDisabled};
|
|
2680
|
-
border-color: ${itemConfig.borderColorDisabled};
|
|
2681
2717
|
color: ${itemConfig.colorDisabled};
|
|
2682
2718
|
`;
|
|
2683
2719
|
}
|
|
2684
2720
|
if ($active) {
|
|
2685
2721
|
return `
|
|
2686
2722
|
background: ${itemConfig.backgroundActive};
|
|
2687
|
-
border-color: ${itemConfig.borderColorActive};
|
|
2688
2723
|
color: ${itemConfig.colorActive};
|
|
2724
|
+
font-weight: 500;
|
|
2689
2725
|
`;
|
|
2690
2726
|
}
|
|
2691
2727
|
return `
|
|
@@ -2695,20 +2731,21 @@ var TabItem = styled.button`
|
|
|
2695
2731
|
`;
|
|
2696
2732
|
}}
|
|
2697
2733
|
|
|
2698
|
-
${({ $variant, $disabled, theme: theme3 }) => {
|
|
2734
|
+
${({ $variant, $disabled, theme: theme3, $active }) => {
|
|
2699
2735
|
if ($disabled) return "";
|
|
2700
2736
|
const variantConfig = theme3.components.tab[$variant];
|
|
2701
2737
|
const itemConfig = variantConfig.item;
|
|
2738
|
+
const isHoverNormal = !$active && !$disabled;
|
|
2702
2739
|
return `
|
|
2703
2740
|
&:hover {
|
|
2704
|
-
background: ${itemConfig.backgroundHover};
|
|
2705
|
-
border-color: ${itemConfig.borderColorHover};
|
|
2706
|
-
color: ${itemConfig.colorHover};
|
|
2741
|
+
background: ${isHoverNormal ? itemConfig.backgroundHover : ""};
|
|
2742
|
+
border-color: ${isHoverNormal ? itemConfig.borderColorHover : ""};
|
|
2743
|
+
color: ${isHoverNormal ? itemConfig.colorHover : ""};
|
|
2707
2744
|
}
|
|
2708
2745
|
`;
|
|
2709
2746
|
}}
|
|
2710
2747
|
|
|
2711
|
-
${({ $variant, $active }) => {
|
|
2748
|
+
${({ $variant, $active, $disabled, theme: theme3 }) => {
|
|
2712
2749
|
if ($variant === "line" && $active) {
|
|
2713
2750
|
return `
|
|
2714
2751
|
&::after {
|
|
@@ -2723,16 +2760,41 @@ var TabItem = styled.button`
|
|
|
2723
2760
|
`;
|
|
2724
2761
|
}
|
|
2725
2762
|
if ($variant === "card") {
|
|
2763
|
+
const variantConfig = theme3.components.tab[$variant];
|
|
2764
|
+
const itemConfig = variantConfig.item;
|
|
2765
|
+
let borderColor;
|
|
2766
|
+
if ($disabled) {
|
|
2767
|
+
borderColor = itemConfig.borderColorDisabled;
|
|
2768
|
+
} else if ($active) {
|
|
2769
|
+
borderColor = itemConfig.borderColorActive;
|
|
2770
|
+
} else {
|
|
2771
|
+
borderColor = itemConfig.borderColor;
|
|
2772
|
+
}
|
|
2726
2773
|
return `
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2774
|
+
box-shadow: inset 0 0 0 1px ${borderColor};
|
|
2775
|
+
flex-grow: 1;
|
|
2776
|
+
flex-shrink: 1;
|
|
2777
|
+
&:hover {
|
|
2778
|
+
}
|
|
2732
2779
|
`;
|
|
2733
2780
|
}
|
|
2734
2781
|
return "";
|
|
2735
2782
|
}}
|
|
2783
|
+
|
|
2784
|
+
${({ $variant }) => {
|
|
2785
|
+
if ($variant === "line") {
|
|
2786
|
+
return `
|
|
2787
|
+
max-width: 160px;
|
|
2788
|
+
`;
|
|
2789
|
+
}
|
|
2790
|
+
return "";
|
|
2791
|
+
}}
|
|
2792
|
+
`;
|
|
2793
|
+
var TabItemLabel = styled.span`
|
|
2794
|
+
overflow: hidden;
|
|
2795
|
+
text-overflow: ellipsis;
|
|
2796
|
+
white-space: nowrap;
|
|
2797
|
+
min-width: 0;
|
|
2736
2798
|
`;
|
|
2737
2799
|
var Tabs = ({
|
|
2738
2800
|
items,
|
|
@@ -2743,7 +2805,9 @@ var Tabs = ({
|
|
|
2743
2805
|
size: _size = "large",
|
|
2744
2806
|
onChange,
|
|
2745
2807
|
className,
|
|
2746
|
-
style
|
|
2808
|
+
style,
|
|
2809
|
+
tabItemClassName,
|
|
2810
|
+
tabItemStyle
|
|
2747
2811
|
}) => {
|
|
2748
2812
|
const [internalActiveKey, setInternalActiveKey] = useState(
|
|
2749
2813
|
controlledActiveKey ?? defaultActiveKey ?? items[0]?.key ?? ""
|
|
@@ -2759,7 +2823,7 @@ var Tabs = ({
|
|
|
2759
2823
|
},
|
|
2760
2824
|
[controlledActiveKey, onChange]
|
|
2761
2825
|
);
|
|
2762
|
-
return /* @__PURE__ */ React3.createElement(TabContainer, { className, style }, /* @__PURE__ */ React3.createElement(TabList, { $variant: variant, role: "tablist" }, items.map((item) => /* @__PURE__ */ React3.createElement(
|
|
2826
|
+
return /* @__PURE__ */ React3.createElement(TabContainer, { $variant: variant, className, style }, /* @__PURE__ */ React3.createElement(TabList, { $variant: variant, role: "tablist" }, items.map((item) => /* @__PURE__ */ React3.createElement(
|
|
2763
2827
|
TabItem,
|
|
2764
2828
|
{
|
|
2765
2829
|
key: item.key,
|
|
@@ -2771,10 +2835,12 @@ var Tabs = ({
|
|
|
2771
2835
|
"aria-selected": activeKey === item.key,
|
|
2772
2836
|
"aria-disabled": item.disabled,
|
|
2773
2837
|
disabled: item.disabled,
|
|
2774
|
-
type: "button"
|
|
2838
|
+
type: "button",
|
|
2839
|
+
className: tabItemClassName,
|
|
2840
|
+
style: tabItemStyle
|
|
2775
2841
|
},
|
|
2776
|
-
item.icon &&
|
|
2777
|
-
item.label
|
|
2842
|
+
!!item.icon && item.icon,
|
|
2843
|
+
typeof item.label === "string" ? /* @__PURE__ */ React3.createElement(TabItemLabel, null, item.label) : item.label
|
|
2778
2844
|
))));
|
|
2779
2845
|
};
|
|
2780
2846
|
Tabs.displayName = "Tab";
|
|
@@ -3575,6 +3641,7 @@ var DropdownButtonContainer = styled.button`
|
|
|
3575
3641
|
box-sizing: border-box;
|
|
3576
3642
|
transition: all 0.2s ease;
|
|
3577
3643
|
font-family: 'PingFang SC', sans-serif;
|
|
3644
|
+
width: 100%;
|
|
3578
3645
|
|
|
3579
3646
|
${({ $size, theme: theme3 }) => {
|
|
3580
3647
|
const config = theme3.components?.dropdownButton;
|