react-better-html 1.1.246 → 1.1.248
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 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +19 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4423,11 +4423,13 @@ var TextareaElement = styled10.textarea.withConfig({
|
|
|
4423
4423
|
color: ${(props) => props.theme.colors.textSecondary}80;
|
|
4424
4424
|
}
|
|
4425
4425
|
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4426
|
+
&:focus {
|
|
4427
|
+
${(props) => props.withNoBorder ? css3`
|
|
4428
|
+
filter: ${props.hoverStyle.filter ?? filterHover().z1};
|
|
4429
|
+
` : css3`
|
|
4430
|
+
border-color: ${props.theme.colors.primary};
|
|
4431
|
+
`}
|
|
4432
|
+
}
|
|
4431
4433
|
|
|
4432
4434
|
${(props) => props.style}
|
|
4433
4435
|
|
|
@@ -7363,23 +7365,23 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
|
|
|
7363
7365
|
const firstRenderPassedRef = useRef8(false);
|
|
7364
7366
|
const tabsRef = useRef8({});
|
|
7365
7367
|
const [selectedTab, setSelectedTab] = useState13(() => {
|
|
7366
|
-
const
|
|
7368
|
+
const selectedTabId = tabs[0]?.id ?? "";
|
|
7367
7369
|
if (urlQuery) {
|
|
7368
7370
|
const tabQueryValue = urlQuery.getQuery(name ?? defaultTabName);
|
|
7369
|
-
if (!tabQueryValue) return
|
|
7370
|
-
if (tabs.
|
|
7371
|
+
if (!tabQueryValue) return selectedTabId;
|
|
7372
|
+
if (tabs.some((tab) => tab.id === tabQueryValue)) return tabQueryValue;
|
|
7371
7373
|
}
|
|
7372
|
-
return
|
|
7374
|
+
return selectedTabId;
|
|
7373
7375
|
});
|
|
7374
7376
|
const [rerenderState, setRerenderState] = useState13(0);
|
|
7375
7377
|
const tabsGap = style === "box" ? theme2.styles.gap / 2 : 0;
|
|
7376
7378
|
const onClickTab = useCallback16(
|
|
7377
7379
|
(tab) => {
|
|
7378
|
-
setSelectedTab(tab);
|
|
7380
|
+
setSelectedTab(tab.id);
|
|
7379
7381
|
onChange?.(tab);
|
|
7380
7382
|
if (urlQuery) {
|
|
7381
7383
|
urlQuery.setQuery({
|
|
7382
|
-
[name ?? defaultTabName]: tab
|
|
7384
|
+
[name ?? defaultTabName]: tab.id
|
|
7383
7385
|
});
|
|
7384
7386
|
}
|
|
7385
7387
|
},
|
|
@@ -7390,7 +7392,7 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
|
|
|
7390
7392
|
[rerenderState, selectedTab]
|
|
7391
7393
|
);
|
|
7392
7394
|
const leftSpacing = useMemo11(() => {
|
|
7393
|
-
const selectedTabIndex = tabs.findIndex((tab) => tab === selectedTab);
|
|
7395
|
+
const selectedTabIndex = tabs.findIndex((tab) => tab.id === selectedTab);
|
|
7394
7396
|
let spacing = 0;
|
|
7395
7397
|
Object.values(tabsRef.current).forEach((tab, index) => {
|
|
7396
7398
|
if (index < selectedTabIndex) spacing += (tab?.getBoundingClientRect().width ?? 0) + tabsGap;
|
|
@@ -7449,7 +7451,7 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
|
|
|
7449
7451
|
return /* @__PURE__ */ jsxs22(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
|
|
7450
7452
|
/* @__PURE__ */ jsxs22(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
|
|
7451
7453
|
/* @__PURE__ */ jsx25(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
|
|
7452
|
-
const selected = tab === selectedTab;
|
|
7454
|
+
const selected = tab.id === selectedTab;
|
|
7453
7455
|
return /* @__PURE__ */ jsxs22(
|
|
7454
7456
|
Div_default,
|
|
7455
7457
|
{
|
|
@@ -7468,10 +7470,10 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
|
|
|
7468
7470
|
isTabAccessed: true,
|
|
7469
7471
|
onClickWithValue: onClickTab,
|
|
7470
7472
|
ref: (ref2) => {
|
|
7471
|
-
tabsRef.current[tab] = ref2;
|
|
7473
|
+
tabsRef.current[tab.id] = ref2;
|
|
7472
7474
|
},
|
|
7473
7475
|
children: [
|
|
7474
|
-
componentsState.tabs.tabsWithDots.includes(tab) && /* @__PURE__ */ jsx25(
|
|
7476
|
+
componentsState.tabs.tabsWithDots.includes(tab.id) && /* @__PURE__ */ jsx25(
|
|
7475
7477
|
Div_default,
|
|
7476
7478
|
{
|
|
7477
7479
|
position: "absolute",
|
|
@@ -7491,12 +7493,12 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
|
|
|
7491
7493
|
color: !selected ? theme2.colors.textSecondary : style === "box" ? theme2.colors.base : void 0,
|
|
7492
7494
|
transition: theme2.styles.transition,
|
|
7493
7495
|
whiteSpace: "nowrap",
|
|
7494
|
-
children: tab
|
|
7496
|
+
children: tab.label ?? tab.id
|
|
7495
7497
|
}
|
|
7496
7498
|
)
|
|
7497
7499
|
]
|
|
7498
7500
|
},
|
|
7499
|
-
tab
|
|
7501
|
+
tab.id
|
|
7500
7502
|
);
|
|
7501
7503
|
}) }),
|
|
7502
7504
|
style !== "box" && /* @__PURE__ */ jsx25(
|