@eqtylab/equality 4.4.2 → 4.5.1

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 CHANGED
@@ -2,6 +2,22 @@
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.5.1 - 2026-09-25
6
+
7
+ ### Fixed
8
+
9
+ - The search box in a searchable `Select` or `DropdownMenu` stays at the top of the list while
10
+ it scrolls. In a `Select` it scrolled away with the options, and in a `DropdownMenu` it was
11
+ never pinned.
12
+ - <kbd>↓</kbd> on the last option of a searchable `Select` or `DropdownMenu` scrolls the list back
13
+ to the top as it returns to the search box. The list stayed scrolled to the bottom.
14
+
15
+ ## 4.5.0 - 2026-09-25
16
+
17
+ ### Added
18
+
19
+ - Segmented controls now have `sm`, `md`, and `lg` `size` variants
20
+
5
21
  ## 4.4.2 - 2026-09-25
6
22
 
7
23
  ### Fixed
@@ -373,6 +373,9 @@
373
373
  }
374
374
  }
375
375
  .dropdown-menu-search {
376
+ position: sticky;
377
+ top: calc(0.25rem * 0);
378
+ z-index: 10;
376
379
  display: flex;
377
380
  align-items: center;
378
381
  justify-content: center;
@@ -382,7 +385,9 @@
382
385
  margin-bottom: calc(0.25rem * 1);
383
386
  border-bottom-style: var(--tw-border-style);
384
387
  border-bottom-width: 1px;
388
+ top: calc(0.25rem * -1);
385
389
  border-color: var(--color-border-overlay, color(display-p3 0.8011 0.807 0.814));
390
+ background-color: var(--color-background-overlay, color(display-p3 0.9946 0.9998 0.9999));
386
391
  }
387
392
  .dropdown-menu-search-input {
388
393
  min-width: calc(0.25rem * 0);
package/dist/index.cjs CHANGED
@@ -1956,6 +1956,12 @@ function handleListKeyDown(state, event, { searchSelector, itemSelector }) {
1956
1956
  const edgeItem = event.key === "ArrowUp" ? items[0] : items[items.length - 1];
1957
1957
  if (edgeItem && edgeItem === target?.closest(itemSelector)) {
1958
1958
  event.preventDefault();
1959
+ if (event.key === "ArrowDown") {
1960
+ for (let el = target; el; el = el.parentElement) {
1961
+ el.scrollTop = 0;
1962
+ if (el === event.currentTarget) break;
1963
+ }
1964
+ }
1959
1965
  state.requestFocus();
1960
1966
  return;
1961
1967
  }
@@ -3931,6 +3937,7 @@ var SegmentedControls = ({
3931
3937
  value,
3932
3938
  onValueChange,
3933
3939
  display = "both",
3940
+ size = "md",
3934
3941
  className
3935
3942
  }) => {
3936
3943
  const allHaveIcons = options.every((option) => option.icon != null);
@@ -3942,6 +3949,7 @@ var SegmentedControls = ({
3942
3949
  left: 0,
3943
3950
  width: 0
3944
3951
  });
3952
+ const [animateIndicator, setAnimateIndicator] = React15.useState(false);
3945
3953
  const updateIndicator = React15.useCallback(() => {
3946
3954
  const activeSegment = segmentRefs.current[value];
3947
3955
  if (activeSegment) {
@@ -3950,7 +3958,11 @@ var SegmentedControls = ({
3950
3958
  }, [value]);
3951
3959
  React15.useLayoutEffect(() => {
3952
3960
  updateIndicator();
3953
- }, [updateIndicator, options, effectiveDisplay]);
3961
+ }, [updateIndicator, options, effectiveDisplay, size]);
3962
+ React15.useEffect(() => {
3963
+ const frame = requestAnimationFrame(() => setAnimateIndicator(true));
3964
+ return () => cancelAnimationFrame(frame);
3965
+ }, []);
3954
3966
  React15.useLayoutEffect(() => {
3955
3967
  const container = containerRef.current;
3956
3968
  if (!container) return;
@@ -3958,44 +3970,57 @@ var SegmentedControls = ({
3958
3970
  observer.observe(container);
3959
3971
  return () => observer.disconnect();
3960
3972
  }, [updateIndicator]);
3961
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: cn(styles49__default.default["segmented-controls"], className), children: [
3962
- options.map((option) => {
3963
- const currentlyActive = option.value === value;
3964
- const showIcon = option.icon != null && effectiveDisplay !== "text-only";
3965
- const showLabel = effectiveDisplay !== "icon-only";
3966
- return /* @__PURE__ */ jsxRuntime.jsxs(
3967
- "button",
3968
- {
3969
- ref: (el) => {
3970
- segmentRefs.current[option.value] = el;
3971
- },
3972
- type: "button",
3973
- "aria-pressed": currentlyActive,
3974
- "aria-label": isIconOnly ? option.label : void 0,
3975
- title: isIconOnly ? option.label : void 0,
3976
- className: cn(
3977
- styles49__default.default["segment"],
3978
- isIconOnly && styles49__default.default["segment--icon-only"],
3979
- currentlyActive ? styles49__default.default["segment--active"] : styles49__default.default["segment--inactive"]
3980
- ),
3981
- onClick: () => onValueChange(option.value),
3982
- children: [
3983
- showIcon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { icon: option.icon, size: "xs", className: styles49__default.default["segment-icon"] }),
3984
- showLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label }),
3985
- !isIconOnly && option.suffix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles49__default.default["segment-suffix"], children: option.suffix })
3986
- ]
3987
- },
3988
- option.value
3989
- );
3990
- }),
3991
- /* @__PURE__ */ jsxRuntime.jsx(
3992
- "div",
3993
- {
3994
- className: styles49__default.default["active-segment-indicator"],
3995
- style: { transform: `translateX(${indicator.left}px)`, width: `${indicator.width}px` }
3996
- }
3997
- )
3998
- ] });
3973
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3974
+ "div",
3975
+ {
3976
+ ref: containerRef,
3977
+ className: cn(styles49__default.default["segmented-controls"], styles49__default.default[`size--${size}`], className),
3978
+ children: [
3979
+ options.map((option) => {
3980
+ const currentlyActive = option.value === value;
3981
+ const showIcon = option.icon != null && effectiveDisplay !== "text-only";
3982
+ const showLabel = effectiveDisplay !== "icon-only";
3983
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3984
+ "button",
3985
+ {
3986
+ ref: (el) => {
3987
+ segmentRefs.current[option.value] = el;
3988
+ },
3989
+ type: "button",
3990
+ "aria-pressed": currentlyActive,
3991
+ "aria-label": isIconOnly ? option.label : void 0,
3992
+ title: isIconOnly ? option.label : void 0,
3993
+ className: cn(
3994
+ styles49__default.default["segment"],
3995
+ isIconOnly && styles49__default.default["segment--icon-only"],
3996
+ currentlyActive ? styles49__default.default["segment--active"] : styles49__default.default["segment--inactive"]
3997
+ ),
3998
+ onClick: () => onValueChange(option.value),
3999
+ children: [
4000
+ showIcon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { icon: option.icon, size: "xs", className: styles49__default.default["segment-icon"] }),
4001
+ showLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label }),
4002
+ !isIconOnly && option.suffix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles49__default.default["segment-suffix"], children: option.suffix })
4003
+ ]
4004
+ },
4005
+ option.value
4006
+ );
4007
+ }),
4008
+ /* @__PURE__ */ jsxRuntime.jsx(
4009
+ "div",
4010
+ {
4011
+ className: cn(
4012
+ styles49__default.default["active-segment-indicator"],
4013
+ animateIndicator && styles49__default.default["active-segment-indicator--animated"]
4014
+ ),
4015
+ style: {
4016
+ transform: `translateX(${indicator.left}px)`,
4017
+ "--indicator-width": `${indicator.width}px`
4018
+ }
4019
+ }
4020
+ )
4021
+ ]
4022
+ }
4023
+ );
3999
4024
  };
4000
4025
  var Separator3 = React15__namespace.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4001
4026
  SeparatorPrimitive__namespace.Root,