@eqtylab/equality 4.4.1 → 4.5.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 CHANGED
@@ -2,6 +2,28 @@
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.4.2 - 2026-09-25
6
+
7
+ ### Fixed
8
+
9
+ - A `Select` list is now exactly as wide as its trigger, not 10px wider. Options wider than the
10
+ trigger still widen it.
11
+ - A `Select` list scrolls with a native scrollbar. The scroll arrows are gone: the down arrow
12
+ stayed up after a search emptied the list, and the up arrow sat above the search box.
13
+ - In a searchable `Select` or `DropdownMenu`, <kbd>↓</kbd> on the last option returns to the
14
+ search box, as <kbd>↑</kbd> on the first already did.
15
+ - A searchable `Select` or `DropdownMenu` near the edge of the screen stays on screen while
16
+ searching. Locking its side also turned off collision handling, so the list shifted back to
17
+ its unadjusted position, partly off screen, until it reopened.
18
+ - `FilterDropdown` options no longer wrap onto a second line. The menu widens from `w-56` up to
19
+ `max-w-80` to fit them, and a longer label ends in an ellipsis, with the full label in its
20
+ tooltip.
21
+
22
+ ### Removed
23
+
24
+ - `SelectScrollUpButton` and `SelectScrollDownButton`. `SelectContent` owns the element they
25
+ must sit in, so they could only ever be rendered by `SelectContent` itself.
26
+
5
27
  ## 4.4.1 - 2026-09-25
6
28
 
7
29
  ### Fixed
@@ -31,6 +31,13 @@
31
31
  }
32
32
  .dropdown-menu-content {
33
33
  max-height: calc(0.25rem * 80);
34
- width: calc(0.25rem * 56);
34
+ max-width: calc(0.25rem * 80);
35
+ min-width: calc(0.25rem * 56);
35
36
  overflow: auto;
36
37
  }
38
+ .option-label {
39
+ min-width: calc(0.25rem * 0);
40
+ overflow: hidden;
41
+ text-overflow: ellipsis;
42
+ white-space: nowrap;
43
+ }
package/dist/index.cjs CHANGED
@@ -1877,7 +1877,7 @@ function useSearchSideLock(state, contentRef, {
1877
1877
  const placed = contentRef.current?.dataset.side;
1878
1878
  if (placed) lockSide?.(placed);
1879
1879
  }, [enabled, searching, lockedSide, lockSide, contentRef]);
1880
- return lockedSide && enabled ? { side: lockedSide, avoidCollisions: false } : { side, avoidCollisions };
1880
+ return { side: lockedSide && enabled ? lockedSide : side, avoidCollisions };
1881
1881
  }
1882
1882
  var isSearchActive = (state) => !!state && state.query.trim().length > 0;
1883
1883
  var isSearchEmpty = (state) => isSearchActive(state) && state.matchCount === 0;
@@ -1951,9 +1951,10 @@ function handleListKeyDown(state, event, { searchSelector, itemSelector }) {
1951
1951
  if (!state?.enabled) return;
1952
1952
  const target = event.target;
1953
1953
  if (target?.closest(searchSelector)) return;
1954
- if (event.key === "ArrowUp" && state.visible) {
1955
- const firstItem = event.currentTarget.querySelector(itemSelector);
1956
- if (firstItem && firstItem === target?.closest(itemSelector)) {
1954
+ if ((event.key === "ArrowUp" || event.key === "ArrowDown") && state.visible) {
1955
+ const items = event.currentTarget.querySelectorAll(itemSelector);
1956
+ const edgeItem = event.key === "ArrowUp" ? items[0] : items[items.length - 1];
1957
+ if (edgeItem && edgeItem === target?.closest(itemSelector)) {
1957
1958
  event.preventDefault();
1958
1959
  state.requestFocus();
1959
1960
  return;
@@ -2433,7 +2434,7 @@ var FilterDropdown = ({
2433
2434
  checked: isSelected,
2434
2435
  onCheckedChange: () => onToggleFilter(option.value),
2435
2436
  onSelect: (e) => e.preventDefault(),
2436
- children: option.label
2437
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles24__default.default["option-label"], title: option.label, children: option.label })
2437
2438
  },
2438
2439
  option.value
2439
2440
  );
@@ -2951,7 +2952,6 @@ var NotFound = ({
2951
2952
  };
2952
2953
  var CheckIcon3 = LucideIcons.Check;
2953
2954
  var ChevronDownIcon2 = LucideIcons.ChevronDown;
2954
- var ChevronUpIcon = LucideIcons.ChevronUp;
2955
2955
  var SearchIcon3 = LucideIcons.Search;
2956
2956
  var SEARCH_INPUT_SELECTOR2 = "[data-select-search]";
2957
2957
  var NAVIGABLE_OPTION_SELECTOR = '[role="option"]:not([data-disabled]):not([hidden])';
@@ -3004,26 +3004,6 @@ var SelectTrigger = React15__namespace.forwardRef(({ className, children, ...pro
3004
3004
  /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon2, { className: cn(styles37__default.default["select-icon"], styles37__default.default["select-icon--low-opacity"]) }) })
3005
3005
  ] }));
3006
3006
  SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
3007
- var SelectScrollUpButton = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3008
- SelectPrimitive__namespace.ScrollUpButton,
3009
- {
3010
- ref,
3011
- className: cn(styles37__default.default["select-scroll-button"], className),
3012
- ...props,
3013
- children: /* @__PURE__ */ jsxRuntime.jsx(ChevronUpIcon, { className: styles37__default.default["select-icon"] })
3014
- }
3015
- ));
3016
- SelectScrollUpButton.displayName = SelectPrimitive__namespace.ScrollUpButton.displayName;
3017
- var SelectScrollDownButton = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3018
- SelectPrimitive__namespace.ScrollDownButton,
3019
- {
3020
- ref,
3021
- className: cn(styles37__default.default["select-scroll-button"], className),
3022
- ...props,
3023
- children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon2, { className: styles37__default.default["select-icon"] })
3024
- }
3025
- ));
3026
- SelectScrollDownButton.displayName = SelectPrimitive__namespace.ScrollDownButton.displayName;
3027
3007
  var SelectPortal = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { container: usePortalContainer(), children });
3028
3008
  var selectContentElevationVariants = generateElevationVariants(
3029
3009
  styles37__default.default,
@@ -3099,7 +3079,6 @@ var SelectContent = React15__namespace.forwardRef(
3099
3079
  ...props,
3100
3080
  children: [
3101
3081
  ctx?.enabled ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles37__default.default["select-sr-status"], role: "status", "aria-live": "polite", children: searching && resultCount > 0 ? formatResultCount(resultCount) : null }) : null,
3102
- /* @__PURE__ */ jsxRuntime.jsx(SelectScrollUpButton, {}),
3103
3082
  /* @__PURE__ */ jsxRuntime.jsx(
3104
3083
  SelectPrimitive__namespace.Viewport,
3105
3084
  {
@@ -3109,8 +3088,7 @@ var SelectContent = React15__namespace.forwardRef(
3109
3088
  ),
3110
3089
  children
3111
3090
  }
3112
- ),
3113
- /* @__PURE__ */ jsxRuntime.jsx(SelectScrollDownButton, {})
3091
+ )
3114
3092
  ]
3115
3093
  }
3116
3094
  ) });
@@ -3953,6 +3931,7 @@ var SegmentedControls = ({
3953
3931
  value,
3954
3932
  onValueChange,
3955
3933
  display = "both",
3934
+ size = "md",
3956
3935
  className
3957
3936
  }) => {
3958
3937
  const allHaveIcons = options.every((option) => option.icon != null);
@@ -3964,6 +3943,7 @@ var SegmentedControls = ({
3964
3943
  left: 0,
3965
3944
  width: 0
3966
3945
  });
3946
+ const [animateIndicator, setAnimateIndicator] = React15.useState(false);
3967
3947
  const updateIndicator = React15.useCallback(() => {
3968
3948
  const activeSegment = segmentRefs.current[value];
3969
3949
  if (activeSegment) {
@@ -3972,7 +3952,11 @@ var SegmentedControls = ({
3972
3952
  }, [value]);
3973
3953
  React15.useLayoutEffect(() => {
3974
3954
  updateIndicator();
3975
- }, [updateIndicator, options, effectiveDisplay]);
3955
+ }, [updateIndicator, options, effectiveDisplay, size]);
3956
+ React15.useEffect(() => {
3957
+ const frame = requestAnimationFrame(() => setAnimateIndicator(true));
3958
+ return () => cancelAnimationFrame(frame);
3959
+ }, []);
3976
3960
  React15.useLayoutEffect(() => {
3977
3961
  const container = containerRef.current;
3978
3962
  if (!container) return;
@@ -3980,44 +3964,57 @@ var SegmentedControls = ({
3980
3964
  observer.observe(container);
3981
3965
  return () => observer.disconnect();
3982
3966
  }, [updateIndicator]);
3983
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: cn(styles49__default.default["segmented-controls"], className), children: [
3984
- options.map((option) => {
3985
- const currentlyActive = option.value === value;
3986
- const showIcon = option.icon != null && effectiveDisplay !== "text-only";
3987
- const showLabel = effectiveDisplay !== "icon-only";
3988
- return /* @__PURE__ */ jsxRuntime.jsxs(
3989
- "button",
3990
- {
3991
- ref: (el) => {
3992
- segmentRefs.current[option.value] = el;
3993
- },
3994
- type: "button",
3995
- "aria-pressed": currentlyActive,
3996
- "aria-label": isIconOnly ? option.label : void 0,
3997
- title: isIconOnly ? option.label : void 0,
3998
- className: cn(
3999
- styles49__default.default["segment"],
4000
- isIconOnly && styles49__default.default["segment--icon-only"],
4001
- currentlyActive ? styles49__default.default["segment--active"] : styles49__default.default["segment--inactive"]
4002
- ),
4003
- onClick: () => onValueChange(option.value),
4004
- children: [
4005
- showIcon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { icon: option.icon, size: "xs", className: styles49__default.default["segment-icon"] }),
4006
- showLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label }),
4007
- !isIconOnly && option.suffix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles49__default.default["segment-suffix"], children: option.suffix })
4008
- ]
4009
- },
4010
- option.value
4011
- );
4012
- }),
4013
- /* @__PURE__ */ jsxRuntime.jsx(
4014
- "div",
4015
- {
4016
- className: styles49__default.default["active-segment-indicator"],
4017
- style: { transform: `translateX(${indicator.left}px)`, width: `${indicator.width}px` }
4018
- }
4019
- )
4020
- ] });
3967
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3968
+ "div",
3969
+ {
3970
+ ref: containerRef,
3971
+ className: cn(styles49__default.default["segmented-controls"], styles49__default.default[`size--${size}`], className),
3972
+ children: [
3973
+ options.map((option) => {
3974
+ const currentlyActive = option.value === value;
3975
+ const showIcon = option.icon != null && effectiveDisplay !== "text-only";
3976
+ const showLabel = effectiveDisplay !== "icon-only";
3977
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3978
+ "button",
3979
+ {
3980
+ ref: (el) => {
3981
+ segmentRefs.current[option.value] = el;
3982
+ },
3983
+ type: "button",
3984
+ "aria-pressed": currentlyActive,
3985
+ "aria-label": isIconOnly ? option.label : void 0,
3986
+ title: isIconOnly ? option.label : void 0,
3987
+ className: cn(
3988
+ styles49__default.default["segment"],
3989
+ isIconOnly && styles49__default.default["segment--icon-only"],
3990
+ currentlyActive ? styles49__default.default["segment--active"] : styles49__default.default["segment--inactive"]
3991
+ ),
3992
+ onClick: () => onValueChange(option.value),
3993
+ children: [
3994
+ showIcon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { icon: option.icon, size: "xs", className: styles49__default.default["segment-icon"] }),
3995
+ showLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label }),
3996
+ !isIconOnly && option.suffix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles49__default.default["segment-suffix"], children: option.suffix })
3997
+ ]
3998
+ },
3999
+ option.value
4000
+ );
4001
+ }),
4002
+ /* @__PURE__ */ jsxRuntime.jsx(
4003
+ "div",
4004
+ {
4005
+ className: cn(
4006
+ styles49__default.default["active-segment-indicator"],
4007
+ animateIndicator && styles49__default.default["active-segment-indicator--animated"]
4008
+ ),
4009
+ style: {
4010
+ transform: `translateX(${indicator.left}px)`,
4011
+ "--indicator-width": `${indicator.width}px`
4012
+ }
4013
+ }
4014
+ )
4015
+ ]
4016
+ }
4017
+ );
4021
4018
  };
4022
4019
  var Separator3 = React15__namespace.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4023
4020
  SeparatorPrimitive__namespace.Root,
@@ -4886,8 +4883,6 @@ exports.SelectEmpty = SelectEmpty;
4886
4883
  exports.SelectGroup = SelectGroup;
4887
4884
  exports.SelectItem = SelectItem;
4888
4885
  exports.SelectLabel = SelectLabel;
4889
- exports.SelectScrollDownButton = SelectScrollDownButton;
4890
- exports.SelectScrollUpButton = SelectScrollUpButton;
4891
4886
  exports.SelectSearch = SelectSearch;
4892
4887
  exports.SelectSeparator = SelectSeparator;
4893
4888
  exports.SelectTrigger = SelectTrigger;