react-better-html 1.1.82 → 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 +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +16 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -17
- 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,16 @@ var TabsComponent = function Tabs({
|
|
|
6609
6603
|
block: "nearest"
|
|
6610
6604
|
});
|
|
6611
6605
|
}, [selectedTab]);
|
|
6606
|
+
useImperativeHandle2(
|
|
6607
|
+
ref,
|
|
6608
|
+
() => {
|
|
6609
|
+
return {
|
|
6610
|
+
selectedTab,
|
|
6611
|
+
setSelectedTab: onClickTab
|
|
6612
|
+
};
|
|
6613
|
+
},
|
|
6614
|
+
[selectedTab, onClickTab]
|
|
6615
|
+
);
|
|
6612
6616
|
return /* @__PURE__ */ jsxs16(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
|
|
6613
6617
|
/* @__PURE__ */ jsxs16(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
|
|
6614
6618
|
/* @__PURE__ */ jsx21(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
|
|
@@ -6630,8 +6634,8 @@ var TabsComponent = function Tabs({
|
|
|
6630
6634
|
cursor: "pointer",
|
|
6631
6635
|
isTabAccessed: true,
|
|
6632
6636
|
onClickWithValue: onClickTab,
|
|
6633
|
-
ref: (
|
|
6634
|
-
tabsRef.current[tab] =
|
|
6637
|
+
ref: (ref2) => {
|
|
6638
|
+
tabsRef.current[tab] = ref2;
|
|
6635
6639
|
},
|
|
6636
6640
|
children: [
|
|
6637
6641
|
componentsState.tabs.tabsWithDots.includes(tab) && /* @__PURE__ */ jsx21(
|
|
@@ -6677,7 +6681,7 @@ var TabsComponent = function Tabs({
|
|
|
6677
6681
|
] }),
|
|
6678
6682
|
/* @__PURE__ */ jsx21(Div_default, { width: "100%", children })
|
|
6679
6683
|
] });
|
|
6680
|
-
};
|
|
6684
|
+
});
|
|
6681
6685
|
TabsComponent.content = function Content({ tab, tabWithDot, tabsGroupName, isInitialTab, children }) {
|
|
6682
6686
|
const { componentsState } = useBetterHtmlContextInternal();
|
|
6683
6687
|
const thisTabGroupData = useMemo8(
|
|
@@ -6700,11 +6704,11 @@ Tabs2.content = TabsComponent.content;
|
|
|
6700
6704
|
var Tabs_default = Tabs2;
|
|
6701
6705
|
|
|
6702
6706
|
// src/components/Foldable.tsx
|
|
6703
|
-
import { forwardRef as
|
|
6707
|
+
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
6708
|
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6705
6709
|
var animationDurationClose = 0.15;
|
|
6706
6710
|
var animationDurationOpen = animationDurationClose * 2;
|
|
6707
|
-
var FoldableComponent =
|
|
6711
|
+
var FoldableComponent = forwardRef13(function Foldable({
|
|
6708
6712
|
isOpen: controlledIsOpen,
|
|
6709
6713
|
defaultOpen = false,
|
|
6710
6714
|
title,
|
|
@@ -6739,7 +6743,7 @@ var FoldableComponent = forwardRef12(function Foldable({
|
|
|
6739
6743
|
if (!bodyRef.current) return;
|
|
6740
6744
|
setBodyVirtualHeight(Math.min(500, bodyRef.current.scrollHeight * 2));
|
|
6741
6745
|
}, [isOpen]);
|
|
6742
|
-
|
|
6746
|
+
useImperativeHandle3(
|
|
6743
6747
|
ref,
|
|
6744
6748
|
() => {
|
|
6745
6749
|
return {
|
|
@@ -6798,7 +6802,7 @@ var FoldableComponent = forwardRef12(function Foldable({
|
|
|
6798
6802
|
)
|
|
6799
6803
|
] });
|
|
6800
6804
|
});
|
|
6801
|
-
FoldableComponent.box =
|
|
6805
|
+
FoldableComponent.box = forwardRef13(function Box3({ ...props }, ref) {
|
|
6802
6806
|
const theme2 = useTheme();
|
|
6803
6807
|
return /* @__PURE__ */ jsx22(
|
|
6804
6808
|
FoldableComponent,
|