react-better-html 1.1.82 → 1.1.84
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 +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +24 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6520,19 +6520,12 @@ var Table2 = memo20(TableComponent);
|
|
|
6520
6520
|
var Table_default = Table2;
|
|
6521
6521
|
|
|
6522
6522
|
// src/components/Tabs.tsx
|
|
6523
|
-
import { memo as memo21, useCallback as useCallback11, useEffect as useEffect9, useMemo as useMemo8, useRef as useRef5, useState as useState9 } from "react";
|
|
6523
|
+
import { forwardRef as forwardRef12, memo as memo21, useCallback as useCallback11, useEffect as useEffect9, useImperativeHandle as useImperativeHandle2, useMemo as useMemo8, useRef as useRef5, useState as useState9 } from "react";
|
|
6524
6524
|
import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6525
6525
|
var tabBottomLineWidth = 2;
|
|
6526
6526
|
var tabDotSize = 6;
|
|
6527
6527
|
var defaultTabName = "tab";
|
|
6528
|
-
var TabsComponent = function Tabs({
|
|
6529
|
-
tabs,
|
|
6530
|
-
name,
|
|
6531
|
-
accentColor,
|
|
6532
|
-
style = "default",
|
|
6533
|
-
children,
|
|
6534
|
-
...props
|
|
6535
|
-
}) {
|
|
6528
|
+
var TabsComponent = forwardRef12(function Tabs({ tabs, name, accentColor, style = "default", onChange, children, ...props }, ref) {
|
|
6536
6529
|
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
6537
6530
|
const theme2 = useTheme();
|
|
6538
6531
|
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
@@ -6553,13 +6546,14 @@ var TabsComponent = function Tabs({
|
|
|
6553
6546
|
const onClickTab = useCallback11(
|
|
6554
6547
|
(tab) => {
|
|
6555
6548
|
setSelectedTab(tab);
|
|
6549
|
+
onChange?.(tab);
|
|
6556
6550
|
if (urlQuery) {
|
|
6557
6551
|
urlQuery.setQuery({
|
|
6558
6552
|
[name ?? defaultTabName]: tab
|
|
6559
6553
|
});
|
|
6560
6554
|
}
|
|
6561
6555
|
},
|
|
6562
|
-
[name, urlQuery]
|
|
6556
|
+
[onChange, name, urlQuery]
|
|
6563
6557
|
);
|
|
6564
6558
|
const width = useMemo8(
|
|
6565
6559
|
() => tabsRef.current[selectedTab]?.getBoundingClientRect().width ?? 0,
|
|
@@ -6609,6 +6603,23 @@ var TabsComponent = function Tabs({
|
|
|
6609
6603
|
block: "nearest"
|
|
6610
6604
|
});
|
|
6611
6605
|
}, [selectedTab]);
|
|
6606
|
+
useEffect9(() => {
|
|
6607
|
+
return () => {
|
|
6608
|
+
componentsState.tabs.setTabGroups(
|
|
6609
|
+
(oldValue) => oldValue.filter((item) => item.name !== (name ?? defaultTabName))
|
|
6610
|
+
);
|
|
6611
|
+
};
|
|
6612
|
+
}, []);
|
|
6613
|
+
useImperativeHandle2(
|
|
6614
|
+
ref,
|
|
6615
|
+
() => {
|
|
6616
|
+
return {
|
|
6617
|
+
selectedTab,
|
|
6618
|
+
selectTab: onClickTab
|
|
6619
|
+
};
|
|
6620
|
+
},
|
|
6621
|
+
[selectedTab, onClickTab]
|
|
6622
|
+
);
|
|
6612
6623
|
return /* @__PURE__ */ jsxs16(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
|
|
6613
6624
|
/* @__PURE__ */ jsxs16(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
|
|
6614
6625
|
/* @__PURE__ */ jsx21(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
|
|
@@ -6630,8 +6641,8 @@ var TabsComponent = function Tabs({
|
|
|
6630
6641
|
cursor: "pointer",
|
|
6631
6642
|
isTabAccessed: true,
|
|
6632
6643
|
onClickWithValue: onClickTab,
|
|
6633
|
-
ref: (
|
|
6634
|
-
tabsRef.current[tab] =
|
|
6644
|
+
ref: (ref2) => {
|
|
6645
|
+
tabsRef.current[tab] = ref2;
|
|
6635
6646
|
},
|
|
6636
6647
|
children: [
|
|
6637
6648
|
componentsState.tabs.tabsWithDots.includes(tab) && /* @__PURE__ */ jsx21(
|
|
@@ -6675,9 +6686,9 @@ var TabsComponent = function Tabs({
|
|
|
6675
6686
|
}
|
|
6676
6687
|
)
|
|
6677
6688
|
] }),
|
|
6678
|
-
/* @__PURE__ */ jsx21(Div_default, { width: "100%", children })
|
|
6689
|
+
children && /* @__PURE__ */ jsx21(Div_default, { width: "100%", children })
|
|
6679
6690
|
] });
|
|
6680
|
-
};
|
|
6691
|
+
});
|
|
6681
6692
|
TabsComponent.content = function Content({ tab, tabWithDot, tabsGroupName, isInitialTab, children }) {
|
|
6682
6693
|
const { componentsState } = useBetterHtmlContextInternal();
|
|
6683
6694
|
const thisTabGroupData = useMemo8(
|
|
@@ -6700,11 +6711,11 @@ Tabs2.content = TabsComponent.content;
|
|
|
6700
6711
|
var Tabs_default = Tabs2;
|
|
6701
6712
|
|
|
6702
6713
|
// src/components/Foldable.tsx
|
|
6703
|
-
import { forwardRef as
|
|
6714
|
+
import { forwardRef as forwardRef13, memo as memo22, useCallback as useCallback12, useEffect as useEffect10, useImperativeHandle as useImperativeHandle3, useRef as useRef6, useState as useState10 } from "react";
|
|
6704
6715
|
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6705
6716
|
var animationDurationClose = 0.15;
|
|
6706
6717
|
var animationDurationOpen = animationDurationClose * 2;
|
|
6707
|
-
var FoldableComponent =
|
|
6718
|
+
var FoldableComponent = forwardRef13(function Foldable({
|
|
6708
6719
|
isOpen: controlledIsOpen,
|
|
6709
6720
|
defaultOpen = false,
|
|
6710
6721
|
title,
|
|
@@ -6739,7 +6750,7 @@ var FoldableComponent = forwardRef12(function Foldable({
|
|
|
6739
6750
|
if (!bodyRef.current) return;
|
|
6740
6751
|
setBodyVirtualHeight(Math.min(500, bodyRef.current.scrollHeight * 2));
|
|
6741
6752
|
}, [isOpen]);
|
|
6742
|
-
|
|
6753
|
+
useImperativeHandle3(
|
|
6743
6754
|
ref,
|
|
6744
6755
|
() => {
|
|
6745
6756
|
return {
|
|
@@ -6798,7 +6809,7 @@ var FoldableComponent = forwardRef12(function Foldable({
|
|
|
6798
6809
|
)
|
|
6799
6810
|
] });
|
|
6800
6811
|
});
|
|
6801
|
-
FoldableComponent.box =
|
|
6812
|
+
FoldableComponent.box = forwardRef13(function Box3({ ...props }, ref) {
|
|
6802
6813
|
const theme2 = useTheme();
|
|
6803
6814
|
return /* @__PURE__ */ jsx22(
|
|
6804
6815
|
FoldableComponent,
|