@eqtylab/equality 4.12.0 → 4.13.0
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/CHANGELOG.md +17 -0
- package/dist/index.cjs +20 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +20 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Notable changes to Equality are recorded here, following [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
4
4
|
|
|
5
|
+
## 4.13.0 - 2026-10-13
|
|
6
|
+
|
|
7
|
+
`Tabs` can be controlled with a `value` prop, so the indicator from 4.12.0 slides when the active
|
|
8
|
+
tab comes from outside, such as the URL. Existing code keeps working, but code that remounts
|
|
9
|
+
`Tabs` with `key` to change the tab has to pass `value` instead to get the slide.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- A `value` prop on `Tabs`, so the active tab can be controlled. Code that remounts `Tabs` with
|
|
14
|
+
`key` to change the tab can pass `value` instead. The indicator then slides to the new tab
|
|
15
|
+
rather than jumping partway through.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- A click on a controlled tab calls `onValueChange` once. Radix requests the tab on both mousedown
|
|
20
|
+
and focus, so a parent that commits the new value later, as React Router does, was called twice.
|
|
21
|
+
|
|
5
22
|
## 4.12.0 - 2026-10-12
|
|
6
23
|
|
|
7
24
|
`Tabs` respond to hover, and filled `Tabs` match `SegmentedControls`. Two `SegmentedControls`
|
package/dist/index.cjs
CHANGED
|
@@ -4297,11 +4297,13 @@ var Tabs = ({
|
|
|
4297
4297
|
items,
|
|
4298
4298
|
className,
|
|
4299
4299
|
tabsListBackground = "transparent",
|
|
4300
|
+
value,
|
|
4300
4301
|
defaultValue,
|
|
4301
4302
|
onValueChange,
|
|
4302
4303
|
staticRender = false
|
|
4303
4304
|
}) => {
|
|
4304
|
-
const [
|
|
4305
|
+
const [uncontrolledTab, setUncontrolledTab] = React15.useState(defaultValue ?? items[0].value);
|
|
4306
|
+
const activeTab = value ?? uncontrolledTab;
|
|
4305
4307
|
const isFilled = tabsListBackground === "filled";
|
|
4306
4308
|
const listRef = React15.useRef(null);
|
|
4307
4309
|
const triggerRefs = React15.useRef({});
|
|
@@ -4340,8 +4342,14 @@ var Tabs = ({
|
|
|
4340
4342
|
}
|
|
4341
4343
|
return () => observer.disconnect();
|
|
4342
4344
|
}, [updateIndicator, itemValues, staticRender]);
|
|
4345
|
+
const requestedTab = React15.useRef(null);
|
|
4343
4346
|
const handleValueChange = (newTab) => {
|
|
4344
|
-
|
|
4347
|
+
if (newTab === requestedTab.current) return;
|
|
4348
|
+
requestedTab.current = newTab;
|
|
4349
|
+
setTimeout(() => {
|
|
4350
|
+
requestedTab.current = null;
|
|
4351
|
+
});
|
|
4352
|
+
if (value === void 0) setUncontrolledTab(newTab);
|
|
4345
4353
|
onValueChange?.(newTab);
|
|
4346
4354
|
};
|
|
4347
4355
|
const renderIcon = (icon) => {
|
|
@@ -4354,7 +4362,7 @@ var Tabs = ({
|
|
|
4354
4362
|
styles58__default.default["active-tab-indicator"],
|
|
4355
4363
|
isFilled ? styles58__default.default["active-tab-indicator--filled"] : styles58__default.default["active-tab-indicator--transparent"]
|
|
4356
4364
|
);
|
|
4357
|
-
const renderTriggerIndicator = (
|
|
4365
|
+
const renderTriggerIndicator = (value2) => {
|
|
4358
4366
|
if (staticRender) {
|
|
4359
4367
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4360
4368
|
"span",
|
|
@@ -4365,7 +4373,7 @@ var Tabs = ({
|
|
|
4365
4373
|
}
|
|
4366
4374
|
);
|
|
4367
4375
|
}
|
|
4368
|
-
if (!indicator &&
|
|
4376
|
+
if (!indicator && value2 === activeTab) {
|
|
4369
4377
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, "data-slot": "tabs-indicator", className: indicatorClass });
|
|
4370
4378
|
}
|
|
4371
4379
|
return null;
|
|
@@ -4386,16 +4394,16 @@ var Tabs = ({
|
|
|
4386
4394
|
isFilled ? styles58__default.default["tabs-list--filled"] : styles58__default.default["tabs-list--transparent"]
|
|
4387
4395
|
),
|
|
4388
4396
|
children: [
|
|
4389
|
-
items.map(({ label, value, icon, suffix, triggerProps }) => {
|
|
4397
|
+
items.map(({ label, value: value2, icon, suffix, triggerProps }) => {
|
|
4390
4398
|
return /* @__PURE__ */ React15.createElement(
|
|
4391
4399
|
TabsTrigger,
|
|
4392
4400
|
{
|
|
4393
4401
|
...triggerProps,
|
|
4394
|
-
key:
|
|
4402
|
+
key: value2,
|
|
4395
4403
|
ref: (el) => {
|
|
4396
|
-
triggerRefs.current[
|
|
4404
|
+
triggerRefs.current[value2] = el;
|
|
4397
4405
|
},
|
|
4398
|
-
value,
|
|
4406
|
+
value: value2,
|
|
4399
4407
|
className: cn(
|
|
4400
4408
|
styles58__default.default["tabs-trigger"],
|
|
4401
4409
|
isFilled ? styles58__default.default["tabs-trigger--filled"] : styles58__default.default["tabs-trigger--transparent"],
|
|
@@ -4405,7 +4413,7 @@ var Tabs = ({
|
|
|
4405
4413
|
renderIcon(icon),
|
|
4406
4414
|
label,
|
|
4407
4415
|
suffix,
|
|
4408
|
-
renderTriggerIndicator(
|
|
4416
|
+
renderTriggerIndicator(value2)
|
|
4409
4417
|
);
|
|
4410
4418
|
}),
|
|
4411
4419
|
!staticRender && indicator && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4428,15 +4436,15 @@ var Tabs = ({
|
|
|
4428
4436
|
]
|
|
4429
4437
|
}
|
|
4430
4438
|
),
|
|
4431
|
-
items.map(({ value, content }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4439
|
+
items.map(({ value: value2, content }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4432
4440
|
TabsContent,
|
|
4433
4441
|
{
|
|
4434
|
-
value,
|
|
4442
|
+
value: value2,
|
|
4435
4443
|
className: styles58__default.default["content"],
|
|
4436
4444
|
forceMount: staticRender || void 0,
|
|
4437
4445
|
children: content
|
|
4438
4446
|
},
|
|
4439
|
-
|
|
4447
|
+
value2
|
|
4440
4448
|
))
|
|
4441
4449
|
]
|
|
4442
4450
|
}
|