react-better-html 1.1.81 → 1.1.83
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/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +22 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -638,10 +638,15 @@ type TabsProps = {
|
|
|
638
638
|
name?: string;
|
|
639
639
|
accentColor?: Color;
|
|
640
640
|
style?: "default" | "borderRadiusTop" | "box";
|
|
641
|
+
onChange?: (tab: string) => void;
|
|
641
642
|
children?: React.ReactNode;
|
|
642
643
|
} & ComponentMarginProps;
|
|
644
|
+
type TabsRef = {
|
|
645
|
+
selectedTab: string;
|
|
646
|
+
setSelectedTab: (tab: string) => void;
|
|
647
|
+
};
|
|
643
648
|
type TabsComponent = {
|
|
644
|
-
(props: TabsProps): React.ReactElement;
|
|
649
|
+
(props: ComponentPropWithRef<TabsRef, TabsProps>): React.ReactElement;
|
|
645
650
|
content: (props: TabsContentProps) => React.ReactElement;
|
|
646
651
|
};
|
|
647
652
|
declare const TabsComponent: TabsComponent;
|
|
@@ -649,6 +654,7 @@ type TabsContentProps = {
|
|
|
649
654
|
tab: string;
|
|
650
655
|
tabWithDot?: boolean;
|
|
651
656
|
tabsGroupName?: string;
|
|
657
|
+
isInitialTab?: boolean;
|
|
652
658
|
children?: React.ReactNode;
|
|
653
659
|
};
|
|
654
660
|
declare const Tabs: typeof TabsComponent & {
|
|
@@ -662,6 +668,7 @@ type FoldableProps = {
|
|
|
662
668
|
description?: string;
|
|
663
669
|
icon?: IconName | AnyOtherString;
|
|
664
670
|
image?: AssetName | AnyOtherString;
|
|
671
|
+
headerPaddingBlock?: React.CSSProperties["paddingBlock"];
|
|
665
672
|
headerPaddingInline?: React.CSSProperties["paddingInline"];
|
|
666
673
|
renderHeader?: (isOpen: boolean, toggleOpen: () => void) => React.ReactNode;
|
|
667
674
|
onOpenChange?: (isOpen: boolean) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -638,10 +638,15 @@ type TabsProps = {
|
|
|
638
638
|
name?: string;
|
|
639
639
|
accentColor?: Color;
|
|
640
640
|
style?: "default" | "borderRadiusTop" | "box";
|
|
641
|
+
onChange?: (tab: string) => void;
|
|
641
642
|
children?: React.ReactNode;
|
|
642
643
|
} & ComponentMarginProps;
|
|
644
|
+
type TabsRef = {
|
|
645
|
+
selectedTab: string;
|
|
646
|
+
setSelectedTab: (tab: string) => void;
|
|
647
|
+
};
|
|
643
648
|
type TabsComponent = {
|
|
644
|
-
(props: TabsProps): React.ReactElement;
|
|
649
|
+
(props: ComponentPropWithRef<TabsRef, TabsProps>): React.ReactElement;
|
|
645
650
|
content: (props: TabsContentProps) => React.ReactElement;
|
|
646
651
|
};
|
|
647
652
|
declare const TabsComponent: TabsComponent;
|
|
@@ -649,6 +654,7 @@ type TabsContentProps = {
|
|
|
649
654
|
tab: string;
|
|
650
655
|
tabWithDot?: boolean;
|
|
651
656
|
tabsGroupName?: string;
|
|
657
|
+
isInitialTab?: boolean;
|
|
652
658
|
children?: React.ReactNode;
|
|
653
659
|
};
|
|
654
660
|
declare const Tabs: typeof TabsComponent & {
|
|
@@ -662,6 +668,7 @@ type FoldableProps = {
|
|
|
662
668
|
description?: string;
|
|
663
669
|
icon?: IconName | AnyOtherString;
|
|
664
670
|
image?: AssetName | AnyOtherString;
|
|
671
|
+
headerPaddingBlock?: React.CSSProperties["paddingBlock"];
|
|
665
672
|
headerPaddingInline?: React.CSSProperties["paddingInline"];
|
|
666
673
|
renderHeader?: (isOpen: boolean, toggleOpen: () => void) => React.ReactNode;
|
|
667
674
|
onOpenChange?: (isOpen: boolean) => void;
|
package/dist/index.js
CHANGED
|
@@ -6600,14 +6600,7 @@ var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
|
6600
6600
|
var tabBottomLineWidth = 2;
|
|
6601
6601
|
var tabDotSize = 6;
|
|
6602
6602
|
var defaultTabName = "tab";
|
|
6603
|
-
var TabsComponent = function Tabs({
|
|
6604
|
-
tabs,
|
|
6605
|
-
name,
|
|
6606
|
-
accentColor,
|
|
6607
|
-
style = "default",
|
|
6608
|
-
children,
|
|
6609
|
-
...props
|
|
6610
|
-
}) {
|
|
6603
|
+
var TabsComponent = (0, import_react24.forwardRef)(function Tabs({ tabs, name, accentColor, style = "default", onChange, children, ...props }, ref) {
|
|
6611
6604
|
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
6612
6605
|
const theme2 = useTheme();
|
|
6613
6606
|
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
@@ -6628,13 +6621,14 @@ var TabsComponent = function Tabs({
|
|
|
6628
6621
|
const onClickTab = (0, import_react24.useCallback)(
|
|
6629
6622
|
(tab) => {
|
|
6630
6623
|
setSelectedTab(tab);
|
|
6624
|
+
onChange?.(tab);
|
|
6631
6625
|
if (urlQuery) {
|
|
6632
6626
|
urlQuery.setQuery({
|
|
6633
6627
|
[name ?? defaultTabName]: tab
|
|
6634
6628
|
});
|
|
6635
6629
|
}
|
|
6636
6630
|
},
|
|
6637
|
-
[name, urlQuery]
|
|
6631
|
+
[onChange, name, urlQuery]
|
|
6638
6632
|
);
|
|
6639
6633
|
const width = (0, import_react24.useMemo)(
|
|
6640
6634
|
() => tabsRef.current[selectedTab]?.getBoundingClientRect().width ?? 0,
|
|
@@ -6684,6 +6678,16 @@ var TabsComponent = function Tabs({
|
|
|
6684
6678
|
block: "nearest"
|
|
6685
6679
|
});
|
|
6686
6680
|
}, [selectedTab]);
|
|
6681
|
+
(0, import_react24.useImperativeHandle)(
|
|
6682
|
+
ref,
|
|
6683
|
+
() => {
|
|
6684
|
+
return {
|
|
6685
|
+
selectedTab,
|
|
6686
|
+
setSelectedTab: onClickTab
|
|
6687
|
+
};
|
|
6688
|
+
},
|
|
6689
|
+
[selectedTab, onClickTab]
|
|
6690
|
+
);
|
|
6687
6691
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
|
|
6688
6692
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
|
|
6689
6693
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
|
|
@@ -6705,8 +6709,8 @@ var TabsComponent = function Tabs({
|
|
|
6705
6709
|
cursor: "pointer",
|
|
6706
6710
|
isTabAccessed: true,
|
|
6707
6711
|
onClickWithValue: onClickTab,
|
|
6708
|
-
ref: (
|
|
6709
|
-
tabsRef.current[tab] =
|
|
6712
|
+
ref: (ref2) => {
|
|
6713
|
+
tabsRef.current[tab] = ref2;
|
|
6710
6714
|
},
|
|
6711
6715
|
children: [
|
|
6712
6716
|
componentsState.tabs.tabsWithDots.includes(tab) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
@@ -6752,8 +6756,8 @@ var TabsComponent = function Tabs({
|
|
|
6752
6756
|
] }),
|
|
6753
6757
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Div_default, { width: "100%", children })
|
|
6754
6758
|
] });
|
|
6755
|
-
};
|
|
6756
|
-
TabsComponent.content = function Content({ tab, tabWithDot, tabsGroupName, children }) {
|
|
6759
|
+
});
|
|
6760
|
+
TabsComponent.content = function Content({ tab, tabWithDot, tabsGroupName, isInitialTab, children }) {
|
|
6757
6761
|
const { componentsState } = useBetterHtmlContextInternal();
|
|
6758
6762
|
const thisTabGroupData = (0, import_react24.useMemo)(
|
|
6759
6763
|
() => componentsState.tabs.tabGroups.find((item) => item.name === (tabsGroupName ?? defaultTabName)),
|
|
@@ -6768,7 +6772,7 @@ TabsComponent.content = function Content({ tab, tabWithDot, tabsGroupName, child
|
|
|
6768
6772
|
);
|
|
6769
6773
|
}
|
|
6770
6774
|
}, [tabWithDot]);
|
|
6771
|
-
return thisTabGroupData
|
|
6775
|
+
return (thisTabGroupData ? thisTabGroupData.selectedTab === tab : isInitialTab) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Div_default, { width: "100%", children }) : void 0;
|
|
6772
6776
|
};
|
|
6773
6777
|
var Tabs2 = (0, import_react24.memo)(TabsComponent);
|
|
6774
6778
|
Tabs2.content = TabsComponent.content;
|
|
@@ -6786,6 +6790,7 @@ var FoldableComponent = (0, import_react25.forwardRef)(function Foldable({
|
|
|
6786
6790
|
description,
|
|
6787
6791
|
icon,
|
|
6788
6792
|
image,
|
|
6793
|
+
headerPaddingBlock,
|
|
6789
6794
|
headerPaddingInline,
|
|
6790
6795
|
renderHeader,
|
|
6791
6796
|
onOpenChange,
|
|
@@ -6832,7 +6837,7 @@ var FoldableComponent = (0, import_react25.forwardRef)(function Foldable({
|
|
|
6832
6837
|
width: "100%",
|
|
6833
6838
|
alignItems: "center",
|
|
6834
6839
|
gap: theme2.styles.gap,
|
|
6835
|
-
paddingBlock: theme2.styles.gap,
|
|
6840
|
+
paddingBlock: headerPaddingBlock ?? theme2.styles.gap,
|
|
6836
6841
|
paddingInline: headerPaddingInline,
|
|
6837
6842
|
cursor: "pointer",
|
|
6838
6843
|
onClick: toggleOpen,
|
|
@@ -6842,7 +6847,7 @@ var FoldableComponent = (0, import_react25.forwardRef)(function Foldable({
|
|
|
6842
6847
|
icon && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon_default, { name: icon, size: 20, flexShrink: 0 }),
|
|
6843
6848
|
image && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Image_default.profileImage, { name: image, size: 24, flexShrink: 0 }),
|
|
6844
6849
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
6845
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default, { as: "h3", fontWeight: 700, children: title }),
|
|
6850
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default, { as: "h3", fontWeight: 700, lineHeight: "20px", children: title }),
|
|
6846
6851
|
description && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default, { color: theme2.colors.textSecondary, children: description })
|
|
6847
6852
|
] })
|
|
6848
6853
|
] }),
|
|
@@ -6880,6 +6885,7 @@ FoldableComponent.box = (0, import_react25.forwardRef)(function Box3({ ...props
|
|
|
6880
6885
|
backgroundColor: theme2.colors.backgroundContent,
|
|
6881
6886
|
border: `1px solid ${theme2.colors.border}`,
|
|
6882
6887
|
borderRadius: theme2.styles.borderRadius,
|
|
6888
|
+
headerPaddingBlock: (theme2.styles.gap + theme2.styles.space) / 2,
|
|
6883
6889
|
headerPaddingInline: theme2.styles.space,
|
|
6884
6890
|
...props,
|
|
6885
6891
|
ref
|