@hussmartinez/ui 0.12.0 → 0.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/README.md CHANGED
@@ -174,12 +174,12 @@ Every component follows one contract ([ADR 0003](https://github.com/ie-huss-mart
174
174
  | `TextField` | Single-line text: `text`, `search`, `email`, `url`, `tel` or `password`. Native input props pass through, plus `onValueChange(value)`. In a `Field`, it takes the field's label, description and error, and shows the error with its border |
175
175
  | `TextArea` | Multi-line text, styled like `TextField` and with its tokens. `rows` sets its height, three by default, and the user can drag it taller. Native textarea props pass through, plus `onValueChange(value)`; the value separates lines with `\n`. In a `Field`, it takes the field's label, description and error |
176
176
  | `ColorField` | A colour: a hex input (`#rrggbb` or `#rgb`, with or without the `#`) beside a preview, and optional `swatches` to pick from, each `{ value, label }`. Controlled with `value` and `onValueChange`, or uncontrolled from `defaultValue`; the value is always lowercase `#rrggbb`. Typing commits on Enter or blur, text that isn't a colour goes back to the last value, and Escape throws the typing away. The swatches are a radio group with one Tab stop, named after the field. It doesn't use the browser's own colour picker. In a `Field`, it takes the field's label, description and error |
177
- | `Slider` | A value in a range, such as volume or zoom, on the native `<input type="range">`: `value` or `defaultValue`, `onValueChange`, `min`, `max`, `step` and `largeStep`. `formatValue` gives screen readers the value as text, such as "−6 dB". Arrow keys, Page Up and Down, Home and End work the same in every browser, mirrored in right-to-left text. In a `Toolbar`, it keeps the arrow keys, so put it last |
177
+ | `Slider` | A value in a range, such as volume or zoom, on the native `<input type="range">`: `value` or `defaultValue`, `onValueChange`, `min`, `max`, `step` and `largeStep`. `formatValue` gives screen readers the value as text, such as "−6 dB". Arrow keys, Page Up and Down, Home and End work the same in every browser, mirrored in right-to-left text. In a `Toolbar`, it keeps the arrow keys, so put it last. `onValueCommit(value)` is called once when a gesture that changed the value ends: the pointer let go, the last key let go, however long it repeated, or focus leaving first. Use it for an undo step, and `onValueChange` for what follows the value as it moves |
178
178
  | `AnnouncerProvider`, `useAnnounce` | Announcements for screen readers, such as "Saved 1.3 MB": `announce(message, { politeness })`. The provider renders the live regions once, on the server too |
179
179
  | `usePlatform` | The platform for keyboard shortcuts: `"apple"` on macOS, iOS and iPadOS, where `Mod` is ⌘, otherwise `"other"`. It's `"other"` on the server and during hydration, then Apple devices switch right after, so hydration never mismatches. Pass it to sdk-core's `createShortcutRegistry({ platform })`, and never read `navigator` during render for this |
180
180
  | `Tooltip` | Short text about a control, shown on hover and on keyboard focus; Escape closes it (WCAG 1.4.13). While it's open, the first Escape closes only the tooltip, so an editor's own Escape action, such as cancelling a crop, runs on the second press; Escape handlers should skip events with `defaultPrevented`. `type="label"` makes it an icon-only button's name, and `description`, the default, describes the button. `shortcut` takes sdk-core's `registry.describe(toolId)[0]`, shows it in the platform's notation (⌘⇧Z or Ctrl+Shift+Z) and sets `aria-keyshortcuts`. It's in the top layer, so no stacking context hides it. Disabled triggers need `focusableWhenDisabled` |
181
- | `ReorderableList` and `ReorderableListItem` | A list whose items the user selects, reorders and removes, such as layers, tracks or pages: one Tab stop for the whole list, and room for `controls` in each row, such as a visibility toggle. ↑ and ↓ move between rows and select (with Ctrl or ⌘, without selecting); ← and → move between a row's cells; Alt+↑ and Alt+↓ (Option on macOS) move the focused item through `onMove(id, toIndex)`; Delete and Backspace remove it through `onRemove(id)`. You own the order and render the result; focus stays with a moved item, and moves are announced through `AnnouncerProvider` unless `announceMoves` is `false`. **Also render buttons that move the selected item**, with `aria-keyshortcuts`, for touch and for people who don't know the keys. It's a WAI-ARIA grid ([ADR 0009](https://github.com/ie-huss-martinez/ui/blob/main/docs/adr/0009-reorderable-list.md)) |
182
- | `Timeline`, `TimelineLane`, `TimelineClips`, `TimelinePlayhead` and `TimelineLayer` | A timeline over whole units, such as frames or samples ([ADR 0011](https://github.com/ie-huss-martinez/ui/blob/main/docs/adr/0011-timeline.md)): a scrolling track as wide as `length` at the current `zoom`, where 1 fits it to the width and `onMaxZoomChange` says where zooming stops. `TimelineClips` is the clip track, a horizontal listbox with one Tab stop: each clip is `{ key, length, label, content }`, as wide as its length; ← and → move between clips and select; with `selectionMode="multiple"`, Shift extends, Ctrl or ⌘ moves without selecting, Space adds or removes, and Ctrl or ⌘+A selects all. Give each clip a `label` with its place and range. `TimelinePlayhead` is a slider over the units with a line at its `position`; a press on the track moves it, snapping to the clips' boundaries and `snapTargets` within 8 px unless Alt is held, and `following` keeps it in view. `TimelineLayer` holds your own drawing, such as a waveform, and `useTimelineScale()` gives it the same mapping: `toPixels`, `unitAt`, `snap` and `visibleRange`. It formats no time: pass `formatValue` and the labels. **Editing is reported, not done:** `onMove(keys, direction)` for Alt+← and Alt+→ (Option on macOS), which the track always takes so the browser never goes back; `onTrim(key, edge, delta)` for Alt+`[` and Alt+`]` (with Shift, outward) and for dragging a clip's edge, which snaps, shows the new length as it goes and reports once on release; `onTrimToPlayhead(key, edge)` for `[` and `]`. Render the result. **Also render buttons that move and trim the selected clips**, with `aria-keyshortcuts`, and **offer zoom**: a clip narrower than 24 px is a small target, and zooming is how a pointer reaches it. **Several tracks are lanes:** wrap each track's layers and clips in a `TimelineLane` with an `id`, a `label` and a `header`, its controls, which the lane renders as a toolbar that stays in view as time scrolls. Lanes stack under one playhead; ↑ and ↓ on a clip go to the clip nearest in time on the next lane. **Give every lane's `TimelineClips` the same `selectedKeys`:** it's the timeline's selection, a plain choice replaces it on every lane, and adding or removing keeps the other lanes' clips. A layer written outside the lanes covers them all, and `useTimelineLanes()` tells it the lane under a pointer. Below 720 px of the timeline's width, headers sit above their lanes. A timeline without lanes works as before. **Clips can have a start:** give every clip of a track `at`, in time order and without overlap, and each is placed there, with room wherever no clip is; give it to none, and they lie back to back. The two kinds share a timeline, a lane each, and every lane's clip edges are snap targets for all of them. When clips run past `length`, pass `extent`: the track is drawn that far, the playhead still ends at `length`, and those clips carry `data-hm-past-end` for you to dim. **Moving clips:** with `onDrop`, a clip is dragged with a mouse or pen, along time and to another lane, snapping its start or end to other clips; it's reported once, on release, as `{ by, lane }`, and `canDrop` lets you refuse a place, such as an overlap. Alt+↑ and Alt+↓ (Option on macOS) move clips to the lane above or below, through `onMoveLane`. `moveHandle="title"` makes only a clip's title the handle, so a press on the rest reaches a layer beneath, such as a range selection. **Also render buttons that move clips earlier, later and between lanes:** on a touch screen, they're the way to move a clip |
181
+ | `ReorderableList` and `ReorderableListItem` | A list whose items the user selects, reorders and removes, such as layers, tracks or pages: one Tab stop for the whole list, and room for `controls` in each row, such as a visibility toggle. ↑ and ↓ move between rows and select (with Ctrl or ⌘, without selecting), and the row whose item receives focus is selected however focus arrives, including Tab; ← and → move between a row's cells; Alt+↑ and Alt+↓ (Option on macOS) move the focused item through `onMove(id, toIndex)`; Delete and Backspace remove it through `onRemove(id)`. You own the order and render the result; focus stays with a moved item, and moves are announced through `AnnouncerProvider` unless `announceMoves` is `false`. **Also render buttons that move the selected item**, with `aria-keyshortcuts`, for touch and for people who don't know the keys. It's a WAI-ARIA grid ([ADR 0009](https://github.com/ie-huss-martinez/ui/blob/main/docs/adr/0009-reorderable-list.md)) |
182
+ | `Timeline`, `TimelineLane`, `TimelineClips`, `TimelinePlayhead` and `TimelineLayer` | A timeline over whole units, such as frames or samples ([ADR 0011](https://github.com/ie-huss-martinez/ui/blob/main/docs/adr/0011-timeline.md)): a scrolling track as wide as `length` at the current `zoom`, where 1 fits it to the width and `onMaxZoomChange` says where zooming stops. `TimelineClips` is the clip track, a horizontal listbox with one Tab stop: each clip is `{ key, length, label, content }`, as wide as its length; ← and → move between clips and select, and with `selectionMode="single"` the focused clip is selected however focus arrives, including Tab and `focusClip`; with `selectionMode="multiple"`, Shift extends, Ctrl or ⌘ moves without selecting, Space adds or removes, and Ctrl or ⌘+A selects all. Give each clip a `label` with its place and range. `TimelinePlayhead` is a slider over the units with a line at its `position`; a press on the track moves it, snapping to the clips' boundaries and `snapTargets` within 8 px unless Alt is held, and `following` keeps it in view. `TimelineLayer` holds your own drawing, such as a waveform, and `useTimelineScale()` gives it the same mapping: `toPixels`, `unitAt`, `snap` and `visibleRange`. It formats no time: pass `formatValue` and the labels. **Editing is reported, not done:** `onMove(keys, direction)` for Alt+← and Alt+→ (Option on macOS), which the track always takes so the browser never goes back; `onTrim(key, edge, delta)` for Alt+`[` and Alt+`]` (with Shift, outward) and for dragging a clip's edge, which snaps, shows the new length as it goes and reports once on release; `onTrimToPlayhead(key, edge)` for `[` and `]`. Render the result. **Also render buttons that move and trim the selected clips**, with `aria-keyshortcuts`, and **offer zoom**: a clip narrower than 24 px is a small target, and zooming is how a pointer reaches it. **Several tracks are lanes:** wrap each track's layers and clips in a `TimelineLane` with an `id`, a `label` and a `header`, its controls, which the lane renders as a toolbar that stays in view as time scrolls. Lanes stack under one playhead; ↑ and ↓ on a clip go to the clip nearest in time on the next lane. **Give every lane's `TimelineClips` the same `selectedKeys`:** it's the timeline's selection, a plain choice replaces it on every lane, and adding or removing keeps the other lanes' clips. A layer written outside the lanes covers them all, and `useTimelineLanes()` tells it the lane under a pointer. Below 720 px of the timeline's width, headers sit above their lanes. A timeline without lanes works as before. **Clips can have a start:** give every clip of a track `at`, in time order and without overlap, and each is placed there, with room wherever no clip is; give it to none, and they lie back to back. The two kinds share a timeline, a lane each, and every lane's clip edges are snap targets for all of them. When clips run past `length`, pass `extent`: the track is drawn that far, the playhead still ends at `length`, and those clips carry `data-hm-past-end` for you to dim. **Moving clips:** with `onDrop`, a clip is dragged with a mouse or pen, along time and to another lane, snapping its start or end to other clips; it's reported once, on release, as `{ by, lane }`, and `canDrop` lets you refuse a place, such as an overlap. Alt+↑ and Alt+↓ (Option on macOS) move clips to the lane above or below, through `onMoveLane`. `moveHandle="title"` makes only a clip's title the handle, so a press on the rest reaches a layer beneath, such as a range selection. **Also render buttons that move clips earlier, later and between lanes:** on a touch screen, they're the way to move a clip |
183
183
 
184
184
  ```tsx
185
185
  import { Button, DownloadIcon, IconButton, RotateLeftIcon } from "@hussmartinez/ui/react";
package/dist/react.d.ts CHANGED
@@ -915,7 +915,9 @@ export declare function RemoveIcon(props: IconProps): ReactElement;
915
915
  * grid with one column of rows.
916
916
  *
917
917
  * - **↑ and ↓** move between rows and select; with Ctrl or ⌘, they move
918
- * without selecting. **← and →**, Home and End move between a row's
918
+ * without selecting. The selection follows focus however it reaches an
919
+ * item: the keys, Tab, a click, or your own `focus()`. Focus on a control
920
+ * never changes it. **← and →**, Home and End move between a row's
919
921
  * cells. Ctrl or ⌘ with Home or End goes to the first or last row.
920
922
  * Space or Enter on an item selects it.
921
923
  * - **Alt+↑ and Alt+↓** (Option on macOS) move the focused item, through
@@ -1147,6 +1149,11 @@ export declare function SkipForwardIcon(props: IconProps): ReactElement;
1147
1149
  * left and right arrows follow it, in every browser. `formatValue` gives
1148
1150
  * screen readers the value as text.
1149
1151
  *
1152
+ * `onValueChange` follows the value as it moves; `onValueCommit` is called
1153
+ * once when the gesture ends, for what should happen once, such as an undo
1154
+ * step: a drag let go, a key let go after one press or a held repeat, or
1155
+ * focus leaving first.
1156
+ *
1150
1157
  * Inside a `Toolbar`, the slider keeps the arrow keys, Home and End, so
1151
1158
  * they can't move focus past it: put it last in the toolbar. Tab still
1152
1159
  * leaves the toolbar.
@@ -1182,6 +1189,15 @@ export declare interface SliderProps extends Omit<InputHTMLAttributes<HTMLInputE
1182
1189
  readonly defaultValue?: number | undefined;
1183
1190
  /** Called with the new value as it changes, by pointer or keyboard. */
1184
1191
  readonly onValueChange?: ((value: number) => void) | undefined;
1192
+ /**
1193
+ * Called once when a gesture that changed the value ends, with the value
1194
+ * it ended on: when the pointer is let go, when the last key held is let
1195
+ * go, or when the slider loses focus first. Use it for what should happen
1196
+ * once per gesture, such as an undo step, and `onValueChange` for what
1197
+ * follows the value as it moves. A gesture that leaves the value where it
1198
+ * was calls nothing.
1199
+ */
1200
+ readonly onValueCommit?: ((value: number) => void) | undefined;
1185
1201
  /** Defaults to 0. */
1186
1202
  readonly min?: number | undefined;
1187
1203
  /** Defaults to 100. */
@@ -1542,7 +1558,10 @@ export declare type TimelineClipEdge = "start" | "end";
1542
1558
  * (docs/adr/0011).
1543
1559
  *
1544
1560
  * - **← and →** move between clips, and Home and End go to the first and
1545
- * last. They follow the reading direction. The selection follows focus.
1561
+ * last. They follow the reading direction. With `selectionMode="single"`,
1562
+ * the selection follows focus however it arrives: arrows, Tab, a click, or
1563
+ * your own `focus()` or `focusClip`. Ctrl or ⌘ with an arrow moves focus
1564
+ * without selecting.
1546
1565
  * - **With `selectionMode="multiple"`,** Shift extends the selection from
1547
1566
  * the last clip chosen; Ctrl or ⌘ moves focus without changing it; Space
1548
1567
  * adds or removes the focused clip, and Shift+Space selects up to it;
package/dist/react.js CHANGED
@@ -9,7 +9,7 @@ var REGISTRY = /* @__PURE__ */ Symbol.for("@hussmartinez/ui");
9
9
  var THIS_COPY = {};
10
10
  var checked = false;
11
11
  function ownVersion() {
12
- return "0.12.0";
12
+ return "0.13.0";
13
13
  }
14
14
  function checkSingleCopy() {
15
15
  if (checked || !(typeof process !== "undefined" && process.env.NODE_ENV !== "production")) return;
@@ -939,6 +939,7 @@ var ReorderableList = /* @__PURE__ */ forwardRef(function ReorderableList({ labe
939
939
  const list = useRef(null);
940
940
  const pending = useRef(void 0);
941
941
  const lastSelected = useRef(selectedId);
942
+ const quiet = useRef(false);
942
943
  const announce = useAnnounce();
943
944
  const messages = useUiMessages();
944
945
  useEffect(() => {
@@ -956,7 +957,12 @@ var ReorderableList = /* @__PURE__ */ forwardRef(function ReorderableList({ labe
956
957
  const cells = cellsOf(row);
957
958
  const target = cells[change.cell] ?? cells[0];
958
959
  syncTabStop(element, target);
959
- target?.focus();
960
+ quiet.current = change.kind === "move";
961
+ try {
962
+ target?.focus();
963
+ } finally {
964
+ quiet.current = false;
965
+ }
960
966
  }
961
967
  if (row && change.kind === "move" && announceMoves) announce(messages.t("reorderableList.moved", {
962
968
  label: cellsOf(row)[0]?.getAttribute("aria-label") ?? "",
@@ -977,7 +983,12 @@ var ReorderableList = /* @__PURE__ */ forwardRef(function ReorderableList({ labe
977
983
  const cells = cellsOf(row);
978
984
  const target = cells[cell] ?? cells[0];
979
985
  syncTabStop(list.current, target);
980
- target?.focus();
986
+ quiet.current = true;
987
+ try {
988
+ target?.focus();
989
+ } finally {
990
+ quiet.current = false;
991
+ }
981
992
  };
982
993
  const handleKeyDown = (event) => {
983
994
  onKeyDown?.(event);
@@ -1055,6 +1066,11 @@ var ReorderableList = /* @__PURE__ */ forwardRef(function ReorderableList({ labe
1055
1066
  const handleFocus = (event) => {
1056
1067
  onFocus?.(event);
1057
1068
  syncTabStop(event.currentTarget, event.target);
1069
+ const target = event.target;
1070
+ if (!quiet.current && target.dataset["hmCell"] === "item") {
1071
+ const row = rowsOf(event.currentTarget).find((candidate) => candidate.contains(target));
1072
+ if (row) select(idOf(row));
1073
+ }
1058
1074
  };
1059
1075
  const handleBlur = (event) => {
1060
1076
  onBlur?.(event);
@@ -1177,19 +1193,58 @@ function snap$1(value, min, max, step) {
1177
1193
  const inRange = stepped > upper && step > 0 ? round(stepped - step) : stepped;
1178
1194
  return Math.min(Math.max(inRange, min), upper);
1179
1195
  }
1180
- var Slider = /* @__PURE__ */ forwardRef(function Slider({ value: controlled, defaultValue, onValueChange, min = 0, max = 100, step = 1, largeStep, formatValue, label, className, classNames, unstyled, onKeyDown, ...props }, ref) {
1196
+ var Slider = /* @__PURE__ */ forwardRef(function Slider({ value: controlled, defaultValue, onValueChange, onValueCommit, min = 0, max = 100, step = 1, largeStep, formatValue, label, className, classNames, unstyled, onKeyDown, onKeyUp, onPointerDown, onBlur, ...props }, ref) {
1181
1197
  const [uncontrolled, setUncontrolled] = useState(() => snap$1(defaultValue ?? min, min, max, step));
1182
1198
  const value = snap$1(controlled ?? uncontrolled, min, max, step);
1183
1199
  const fieldProps = useFieldProps(props, label);
1184
1200
  if (label === void 0 && !props["aria-label"] && !props["aria-labelledby"] && fieldProps.id === void 0) {
1185
1201
  if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") warnInDevelopment("Slider needs an accessible name: pass label, or point a visible <label> at its id. Use text from your message catalogue.");
1186
1202
  }
1203
+ const pending = useRef(null);
1204
+ const held = useRef(/* @__PURE__ */ new Set());
1205
+ const commitRef = useRef(onValueCommit);
1206
+ commitRef.current = onValueCommit;
1207
+ const commit = () => {
1208
+ const last = pending.current;
1209
+ pending.current = null;
1210
+ if (last !== null) commitRef.current?.(last);
1211
+ };
1187
1212
  const change = (next) => {
1188
1213
  const snapped = snap$1(next, min, max, step);
1189
1214
  if (snapped === value) return;
1190
1215
  if (controlled === void 0) setUncontrolled(snapped);
1216
+ pending.current = snapped;
1191
1217
  onValueChange?.(snapped);
1192
1218
  };
1219
+ const input = useRef(null);
1220
+ const commitLater = useRef(commit);
1221
+ commitLater.current = commit;
1222
+ useEffect(() => {
1223
+ const element = input.current;
1224
+ if (!element) return;
1225
+ const onCommit = () => commitLater.current();
1226
+ element.addEventListener("change", onCommit);
1227
+ return () => element.removeEventListener("change", onCommit);
1228
+ }, []);
1229
+ const handlePointerDown = (event) => {
1230
+ onPointerDown?.(event);
1231
+ const release = () => {
1232
+ window.removeEventListener("pointerup", release, true);
1233
+ window.removeEventListener("pointercancel", release, true);
1234
+ commitLater.current();
1235
+ };
1236
+ window.addEventListener("pointerup", release, true);
1237
+ window.addEventListener("pointercancel", release, true);
1238
+ };
1239
+ const handleKeyUp = (event) => {
1240
+ onKeyUp?.(event);
1241
+ if (held.current.delete(event.key) && held.current.size === 0) commit();
1242
+ };
1243
+ const handleBlur = (event) => {
1244
+ onBlur?.(event);
1245
+ held.current.clear();
1246
+ commit();
1247
+ };
1193
1248
  const handleChange = (event) => {
1194
1249
  change(event.currentTarget.valueAsNumber);
1195
1250
  };
@@ -1210,12 +1265,17 @@ var Slider = /* @__PURE__ */ forwardRef(function Slider({ value: controlled, def
1210
1265
  }[event.key];
1211
1266
  if (next === void 0) return;
1212
1267
  event.preventDefault();
1268
+ held.current.add(event.key);
1213
1269
  change(next);
1214
1270
  };
1215
1271
  return /* @__PURE__ */ jsx("input", {
1216
1272
  ...props,
1217
1273
  ...fieldProps,
1218
- ref,
1274
+ ref: (node) => {
1275
+ input.current = node;
1276
+ if (typeof ref === "function") ref(node);
1277
+ else if (ref) ref.current = node;
1278
+ },
1219
1279
  type: "range",
1220
1280
  min,
1221
1281
  max,
@@ -1226,7 +1286,10 @@ var Slider = /* @__PURE__ */ forwardRef(function Slider({ value: controlled, def
1226
1286
  className: cx("hm-slider", classNames?.root, className),
1227
1287
  "data-hm-unstyled": unstyledAttribute(unstyled),
1228
1288
  onChange: handleChange,
1229
- onKeyDown: handleKeyDown
1289
+ onKeyDown: handleKeyDown,
1290
+ onKeyUp: handleKeyUp,
1291
+ onPointerDown: handlePointerDown,
1292
+ onBlur: handleBlur
1230
1293
  });
1231
1294
  });
1232
1295
  // src/components/spinner/Spinner.tsx
@@ -1692,6 +1755,15 @@ var TimelineClips = /* @__PURE__ */ forwardRef(function TimelineClips({ label, c
1692
1755
  return true;
1693
1756
  };
1694
1757
  useImperativeHandle(ref, () => ({ focusClip }));
1758
+ const quiet = useRef(false);
1759
+ const focusQuietly = (key) => {
1760
+ quiet.current = true;
1761
+ try {
1762
+ return focusClip(key);
1763
+ } finally {
1764
+ quiet.current = false;
1765
+ }
1766
+ };
1695
1767
  const laneId = useContext(TimelineLaneContext);
1696
1768
  const forLanes = useRef({
1697
1769
  any: () => false,
@@ -1700,7 +1772,7 @@ var TimelineClips = /* @__PURE__ */ forwardRef(function TimelineClips({ label, c
1700
1772
  });
1701
1773
  forLanes.current = {
1702
1774
  any: () => clips.length > 0,
1703
- focus: (key) => clips.some((clip) => clip.key === key) && focusClip(key),
1775
+ focus: (key) => clips.some((clip) => clip.key === key) && focusQuietly(key),
1704
1776
  focusNearest: (unit, andSelect) => {
1705
1777
  let nearest;
1706
1778
  let distance = Number.POSITIVE_INFINITY;
@@ -1713,7 +1785,7 @@ var TimelineClips = /* @__PURE__ */ forwardRef(function TimelineClips({ label, c
1713
1785
  distance = away;
1714
1786
  }
1715
1787
  });
1716
- if (nearest && focusClip(nearest.key) && andSelect) {
1788
+ if (nearest && focusQuietly(nearest.key) && andSelect) {
1717
1789
  anchor.current = nearest.key;
1718
1790
  select([nearest.key]);
1719
1791
  }
@@ -1770,7 +1842,7 @@ var TimelineClips = /* @__PURE__ */ forwardRef(function TimelineClips({ label, c
1770
1842
  if (!was) return;
1771
1843
  if (clips.some((clip) => clip.key === was.key)) {
1772
1844
  const active = document.activeElement;
1773
- if (moved.current && (!active || active === document.body)) focusClip(was.key);
1845
+ if (moved.current && (!active || active === document.body)) focusQuietly(was.key);
1774
1846
  moved.current = false;
1775
1847
  return;
1776
1848
  }
@@ -2044,7 +2116,7 @@ var TimelineClips = /* @__PURE__ */ forwardRef(function TimelineClips({ label, c
2044
2116
  if (to !== void 0 && target) {
2045
2117
  if (event.shiftKey && (mod || !multiple)) return;
2046
2118
  event.preventDefault();
2047
- focusClip(target.key);
2119
+ focusQuietly(target.key);
2048
2120
  if (event.shiftKey) select(range(to), true);
2049
2121
  else if (!mod) {
2050
2122
  anchor.current = target.key;
@@ -2092,6 +2164,10 @@ var TimelineClips = /* @__PURE__ */ forwardRef(function TimelineClips({ label, c
2092
2164
  };
2093
2165
  setFocusKey(key);
2094
2166
  anchor.current ??= key;
2167
+ if (!multiple && !quiet.current && !(selectedKeys.length === 1 && selectedKeys[0] === key)) {
2168
+ anchor.current = key;
2169
+ select([key]);
2170
+ }
2095
2171
  }
2096
2172
  };
2097
2173
  const handleBlur = (event) => {