@plexui/ui 0.52.0 → 0.53.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.
@@ -8,8 +8,25 @@ import { useLatestValue } from "../../hooks/useLatestValue.js";
8
8
  const SLOP = 10;
9
9
  /** The width an open row moves by is the border box of its actions, edge and content gaps included. */
10
10
  const BORDER_BOX = { box: "border-box" };
11
+ /** A finger lifting faster than this (px/ms) opens the side it moves toward, or closes the row when it moves back, however short the swipe. */
12
+ const FLICK = 0.3;
13
+ /** A finger that stopped this long (ms) before it lifted flicks nothing. */
14
+ const FLICK_WINDOW = 100;
15
+ /** A trackpad swipe (horizontal wheel) ends when no wheel event has come for this long (ms). */
16
+ const WHEEL_IDLE = 120;
11
17
  /** Controls that take a horizontal drag themselves. */
12
18
  const OWN_DRAG = 'input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="slider"]';
19
+ /** Whether a wheel over `target` belongs to a control or a box inside the row that scrolls across itself. */
20
+ const scrollsAcross = (target, row) => {
21
+ for (let element = target instanceof Element ? target : null; element && element !== row; element = element.parentElement) {
22
+ if (element.matches(OWN_DRAG))
23
+ return true;
24
+ const overflow = getComputedStyle(element).overflowX;
25
+ if ((overflow === "auto" || overflow === "scroll") && element.scrollWidth > element.clientWidth)
26
+ return true;
27
+ }
28
+ return false;
29
+ };
13
30
  /** The open row: opening another one closes it, as a list keeps one row open. */
14
31
  let closeOpenRow = null;
15
32
  /** The row keeps the finger past its edges; a pointer that is no longer active (it lifted between events) cannot be held. */
@@ -22,6 +39,26 @@ const capture = (element, pointerId) => {
22
39
  }
23
40
  };
24
41
  const sideOf = (offset) => offset > 0 ? "leading" : offset < 0 ? "trailing" : undefined;
42
+ /**
43
+ * Where a swipe that ended at `offset` settles: a flick (`velocity` px/ms, toward the trailing edge when positive)
44
+ * opens the side it moves toward and closes the row when it moves back; a slow one opens a side moved past half its
45
+ * `width`.
46
+ */
47
+ export const swipeActionsSettle = (offset, velocity, width) => {
48
+ if (Math.abs(velocity) >= FLICK)
49
+ return Math.sign(velocity) === Math.sign(offset);
50
+ return Math.abs(offset) >= width / 2;
51
+ };
52
+ /** The duration (ms) the row moves in, none when the motion is reduced. */
53
+ const durationOf = (element) => {
54
+ if (typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches)
55
+ return 0;
56
+ const value = getComputedStyle(element).getPropertyValue("--swipe-actions-duration").trim();
57
+ const time = parseFloat(value);
58
+ if (!Number.isFinite(time))
59
+ return 0;
60
+ return value.endsWith("ms") ? time : time * 1000;
61
+ };
25
62
  /**
26
63
  * Where the content goes for a swipe of `raw` px toward the trailing edge (negative: toward the leading edge), and
27
64
  * whether that is a full swipe. A side without actions stays shut. Past its actions the content follows the finger
@@ -54,12 +91,20 @@ export function SwipeActions({ leading = [], trailing = [], labelPlacement = "hi
54
91
  const [swiping, setSwiping] = useState(false);
55
92
  const [rtl, setRtl] = useState(false);
56
93
  const [round, setRound] = useState(false);
94
+ const [removing, setRemoving] = useState(false);
95
+ const [height, setHeight] = useState(undefined);
57
96
  const root = useRef(null);
58
97
  const sides = useRef({ leading: null, trailing: null });
59
98
  const gesture = useRef(null);
60
99
  const current = useRef({ offset: 0, full: false });
61
100
  const suppressClick = useRef(false);
62
101
  const observer = useRef(null);
102
+ /** The timers of a removal and of a trackpad swipe, cleared when the row goes. */
103
+ const timers = useRef({ timeouts: [], wheel: 0 });
104
+ /** The row is being removed: nothing moves it back until the action has run. */
105
+ const removal = useRef(false);
106
+ /** A trackpad swipe: where it started, how far it went, the widths at its start. `locked` drops the momentum after it. */
107
+ const wheel = useRef(null);
63
108
  const actionsRef = useLatestValue({ leading, trailing });
64
109
  const revealed = sideOf(offset);
65
110
  const widthOf = (side) => sides.current[side]?.getBoundingClientRect().width ?? 0;
@@ -77,7 +122,16 @@ export function SwipeActions({ leading = [], trailing = [], labelPlacement = "hi
77
122
  return state;
78
123
  };
79
124
  /** The handlers of the latest render, for listeners and observers set up once. */
80
- const latest = useRef({ close: () => { }, release, finish: () => { }, cancel: () => { }, sync: () => { }, fit: () => { } });
125
+ const latest = useRef({
126
+ close: () => { },
127
+ release,
128
+ finish: () => { },
129
+ cancel: () => { },
130
+ sync: () => { },
131
+ fit: () => { },
132
+ wheel: (_event) => { },
133
+ lockWheel: () => { },
134
+ });
81
135
  /** One function for the life of the row, so the list knows which row is open; another row that opens ends this one's gesture too. */
82
136
  const closer = useRef(() => {
83
137
  const state = latest.current.release();
@@ -87,9 +141,22 @@ export function SwipeActions({ leading = [], trailing = [], labelPlacement = "hi
87
141
  if (state.swiping)
88
142
  suppressClick.current = true;
89
143
  }
144
+ latest.current.lockWheel();
90
145
  latest.current.close();
91
146
  }).current;
147
+ /** No action of the row keeps the focus. */
148
+ const blurActions = () => {
149
+ const focused = document.activeElement;
150
+ if (focused instanceof HTMLElement && (sides.current.leading?.contains(focused) || sides.current.trailing?.contains(focused)))
151
+ focused.blur();
152
+ };
92
153
  const close = () => {
154
+ if (removal.current)
155
+ return;
156
+ // Whatever closes or opens the row (a press, the focus, another row) ends a trackpad swipe and its momentum.
157
+ lockWheel();
158
+ // A closed row hides its actions, so none keeps the focus (Enter would run a hidden action).
159
+ blurActions();
93
160
  if (closeOpenRow === closer)
94
161
  closeOpenRow = null;
95
162
  move(0);
@@ -102,8 +169,11 @@ export function SwipeActions({ leading = [], trailing = [], labelPlacement = "hi
102
169
  };
103
170
  /** Shows a side as wide as its actions (`width` when known), or closes the row when that side has none (any more). */
104
171
  const open = (side, width = widthOf(side)) => {
172
+ if (removal.current)
173
+ return;
105
174
  if (!(width > 0))
106
175
  return close();
176
+ lockWheel();
107
177
  claim();
108
178
  setRtl(isRtl());
109
179
  move(side === "leading" ? width : -width);
@@ -111,7 +181,7 @@ export function SwipeActions({ leading = [], trailing = [], labelPlacement = "hi
111
181
  /** An open row follows its actions: more of them, other labels or another width move it to their new width. */
112
182
  const sync = () => {
113
183
  const side = sideOf(current.current.offset);
114
- if (!side || gesture.current?.swiping || current.current.full)
184
+ if (!side || removal.current || gesture.current?.swiping || (wheel.current && wheel.current !== "locked") || current.current.full)
115
185
  return;
116
186
  const width = widthOf(side);
117
187
  if (!(width > 0))
@@ -135,17 +205,59 @@ export function SwipeActions({ leading = [], trailing = [], labelPlacement = "hi
135
205
  const max = parseFloat(getComputedStyle(capsule).maxHeight);
136
206
  setRound(max > 0 && capsule.getBoundingClientRect().height >= max - 0.5);
137
207
  };
138
- const settle = (state) => {
208
+ /**
209
+ * A destructive action: the content slides out to the side it was swiped to (the trailing one when pressed from
210
+ * the keys) and the row collapses, then the action runs; a row the list keeps comes back closed.
211
+ */
212
+ const remove = (action, side) => {
213
+ const element = root.current;
214
+ if (!element || removal.current)
215
+ return;
216
+ const duration = durationOf(element);
217
+ const width = element.clientWidth;
218
+ claim();
219
+ setHeight(element.getBoundingClientRect().height);
220
+ setRemoving(true);
221
+ setRtl(isRtl());
222
+ move(side === "leading" ? width : -width, current.current.full);
223
+ removal.current = true;
224
+ lockWheel();
225
+ const { timeouts } = timers.current;
226
+ timeouts.push(window.setTimeout(() => {
227
+ action.onSelect?.();
228
+ // A row the list dropped is gone by now; one it keeps comes back.
229
+ timeouts.push(window.setTimeout(() => {
230
+ removal.current = false;
231
+ setRemoving(false);
232
+ setHeight(undefined);
233
+ // An action that keeps the focus (chosen from the keys) keeps its side open, so the focus is never on a hidden action.
234
+ const focused = document.activeElement;
235
+ const side = ["leading", "trailing"].find((name) => !!focused && !!sides.current[name]?.contains(focused));
236
+ if (side)
237
+ open(side);
238
+ else
239
+ close();
240
+ }));
241
+ }, duration));
242
+ };
243
+ /** Runs an action from its side: a destructive one removes the row first. */
244
+ const run = (action, side) => {
245
+ if (!action)
246
+ return close();
247
+ if (action.role === "destructive")
248
+ return remove(action, side);
249
+ action.onSelect?.();
250
+ close();
251
+ };
252
+ const settle = (state, velocity = 0) => {
139
253
  const { offset: last, full: wasFull } = current.current;
140
254
  const side = sideOf(last);
141
255
  if (!side)
142
256
  return close();
143
- if (wasFull) {
144
- actionsRef.current[side][0]?.onSelect?.();
145
- return close();
146
- }
257
+ if (wasFull)
258
+ return run(actionsRef.current[side][0], side);
147
259
  // The widths from the start of the swipe: a full swipe may have stretched the actions since.
148
- if (Math.abs(last) >= state.widths[side] / 2)
260
+ if (swipeActionsSettle(last, velocity, state.widths[side]))
149
261
  open(side, state.widths[side]);
150
262
  else
151
263
  close();
@@ -158,7 +270,7 @@ export function SwipeActions({ leading = [], trailing = [], labelPlacement = "hi
158
270
  if (state.swiping) {
159
271
  suppressClick.current = true;
160
272
  setSwiping(false);
161
- settle(state);
273
+ settle(state, performance.now() - state.time <= FLICK_WINDOW ? state.velocity : 0);
162
274
  }
163
275
  else if (state.start !== 0) {
164
276
  if (state.swiping === undefined)
@@ -178,7 +290,78 @@ export function SwipeActions({ leading = [], trailing = [], labelPlacement = "hi
178
290
  else
179
291
  close();
180
292
  };
181
- latest.current = { close, release, finish, cancel, sync, fit };
293
+ /** A trackpad swipe that has not settled yet settles no more, where it stands (a press or a removal takes over). */
294
+ const stopWheel = () => {
295
+ window.clearTimeout(timers.current.wheel);
296
+ if (wheel.current && wheel.current !== "locked")
297
+ setSwiping(false);
298
+ wheel.current = null;
299
+ };
300
+ /** Another row took over: this row's trackpad swipe ends here, and the momentum after it moves nothing. */
301
+ const lockWheel = () => {
302
+ if (!wheel.current || wheel.current === "locked")
303
+ return;
304
+ stopWheel();
305
+ wheel.current = "locked";
306
+ timers.current.wheel = window.setTimeout(() => {
307
+ wheel.current = null;
308
+ }, WHEEL_IDLE);
309
+ };
310
+ /**
311
+ * A two-finger swipe on a trackpad moves the row as a finger does, without a full swipe (the momentum after the
312
+ * fingers lift would run an action), and settles when the wheel stops. A swipe down scrolls the page.
313
+ */
314
+ const handleWheel = (event) => {
315
+ if (event.ctrlKey)
316
+ return;
317
+ const horizontal = Math.abs(event.deltaX) > Math.abs(event.deltaY);
318
+ let state = wheel.current;
319
+ // The momentum after a swipe keeps the lock until it stops, a removal or not.
320
+ if (state === "locked") {
321
+ window.clearTimeout(timers.current.wheel);
322
+ if (horizontal)
323
+ event.preventDefault();
324
+ timers.current.wheel = window.setTimeout(() => {
325
+ wheel.current = null;
326
+ }, WHEEL_IDLE);
327
+ return;
328
+ }
329
+ if (removal.current || gesture.current || (leading.length < 1 && trailing.length < 1))
330
+ return;
331
+ if (!state && (!horizontal || scrollsAcross(event.target, root.current)))
332
+ return;
333
+ window.clearTimeout(timers.current.wheel);
334
+ event.preventDefault();
335
+ if (!state) {
336
+ // The row moves under the focus: an action that has it lets it go, as a closed row does.
337
+ const start = current.current.offset;
338
+ blurActions();
339
+ state = { start, across: 0, widths: { leading: widthOf("leading"), trailing: widthOf("trailing") }, rowWidth: root.current?.clientWidth ?? 0 };
340
+ wheel.current = state;
341
+ claim();
342
+ setRtl(isRtl());
343
+ setSwiping(true);
344
+ }
345
+ const scale = event.deltaMode === 1 ? 16 : event.deltaMode === 2 ? state.rowWidth : 1;
346
+ // The page scrolls the other way the fingers move: fingers moving left give a positive deltaX.
347
+ state.across -= event.deltaX * scale * (isRtl() ? -1 : 1);
348
+ const next = swipeActionsOffset(state.start + state.across, state.widths, state.rowWidth, false);
349
+ move(next.offset);
350
+ const widths = state.widths;
351
+ timers.current.wheel = window.setTimeout(() => {
352
+ wheel.current = "locked";
353
+ setSwiping(false);
354
+ const side = sideOf(current.current.offset);
355
+ if (side && swipeActionsSettle(current.current.offset, 0, widths[side]))
356
+ open(side, widths[side]);
357
+ else
358
+ close();
359
+ timers.current.wheel = window.setTimeout(() => {
360
+ wheel.current = null;
361
+ }, WHEEL_IDLE);
362
+ }, WHEEL_IDLE);
363
+ };
364
+ latest.current = { close, release, finish, cancel, sync, fit, wheel: handleWheel, lockWheel };
182
365
  // After each render, and whenever the actions change size, an open row takes their width and a symbol its shape.
183
366
  useEffect(() => {
184
367
  latest.current.fit();
@@ -196,29 +379,40 @@ export function SwipeActions({ leading = [], trailing = [], labelPlacement = "hi
196
379
  for (const element of [sides.current.leading, sides.current.trailing])
197
380
  if (element)
198
381
  observer.current?.observe(element, BORDER_BOX);
382
+ // A trackpad swipe has to stop the page's own scroll and back gesture, which a passive listener cannot.
383
+ const element = root.current;
384
+ const handleWheel = (event) => latest.current.wheel(event);
385
+ element?.addEventListener("wheel", handleWheel, { passive: false });
386
+ const pending = timers.current;
199
387
  // The open row lets go of the list, and of the finger, when it goes away.
200
388
  return () => {
389
+ element?.removeEventListener("wheel", handleWheel);
390
+ for (const id of pending.timeouts)
391
+ window.clearTimeout(id);
392
+ window.clearTimeout(pending.wheel);
201
393
  observer.current?.disconnect();
202
394
  observer.current = null;
203
395
  latest.current.release();
204
396
  if (closeOpenRow === closer)
205
397
  closeOpenRow = null;
206
398
  };
207
- }, [closer, latest]);
208
- // A press anywhere outside the open row closes it.
399
+ }, [closer, latest, timers]);
400
+ // A press anywhere outside the open row closes it, while a trackpad moves it too; a finger's own swipe keeps it.
209
401
  useEffect(() => {
210
- if (!revealed || swiping)
402
+ if (!revealed)
211
403
  return;
212
404
  const handlePointerDown = (event) => {
213
405
  if (event.target instanceof Node && root.current?.contains(event.target))
214
406
  return;
407
+ if (gesture.current?.swiping)
408
+ return;
215
409
  latest.current.close();
216
410
  };
217
411
  document.addEventListener("pointerdown", handlePointerDown, true);
218
412
  return () => document.removeEventListener("pointerdown", handlePointerDown, true);
219
- }, [revealed, swiping, latest]);
413
+ }, [revealed, latest]);
220
414
  const handlePointerDown = (event) => {
221
- if (event.button !== 0 || gesture.current)
415
+ if (event.button !== 0 || gesture.current || removal.current)
222
416
  return;
223
417
  // A new press of the primary pointer starts clean: a swipe that another row ended and that was then cancelled leaves
224
418
  // no click to swallow. Another finger's press keeps it, as only the primary pointer clicks.
@@ -226,6 +420,8 @@ export function SwipeActions({ leading = [], trailing = [], labelPlacement = "hi
226
420
  suppressClick.current = false;
227
421
  if (leading.length < 1 && trailing.length < 1)
228
422
  return;
423
+ // Any press ends a trackpad swipe still moving the row, and its momentum.
424
+ lockWheel();
229
425
  // A drag in a text field or along a slider belongs to that control.
230
426
  if (event.target instanceof Element && event.target.closest(OWN_DRAG))
231
427
  return;
@@ -250,6 +446,9 @@ export function SwipeActions({ leading = [], trailing = [], labelPlacement = "hi
250
446
  rtl: isRtl(),
251
447
  widths: { leading: widthOf("leading"), trailing: widthOf("trailing") },
252
448
  rowWidth: root.current?.clientWidth ?? 0,
449
+ across: 0,
450
+ time: performance.now(),
451
+ velocity: 0,
253
452
  detach: () => {
254
453
  window.removeEventListener("pointerup", handleUp, true);
255
454
  window.removeEventListener("pointercancel", handleCancel, true);
@@ -262,6 +461,12 @@ export function SwipeActions({ leading = [], trailing = [], labelPlacement = "hi
262
461
  return;
263
462
  const across = (event.clientX - state.x) * (state.rtl ? -1 : 1);
264
463
  const down = event.clientY - state.y;
464
+ // The speed is the finger's latest, from every move, the ones within the slop too.
465
+ const now = performance.now();
466
+ if (now > state.time)
467
+ state.velocity = (across - state.across) / (now - state.time);
468
+ state.across = across;
469
+ state.time = now;
265
470
  if (state.swiping === undefined) {
266
471
  if (Math.abs(across) < SLOP && Math.abs(down) < SLOP)
267
472
  return;
@@ -294,11 +499,13 @@ export function SwipeActions({ leading = [], trailing = [], labelPlacement = "hi
294
499
  };
295
500
  /** The focus on an action shows its side; on the content it closes the row. */
296
501
  const handleFocus = (event) => {
297
- if (gesture.current?.swiping)
502
+ if (gesture.current?.swiping || removal.current)
298
503
  return;
299
504
  const side = ["leading", "trailing"].find((name) => sides.current[name]?.contains(event.target));
300
505
  if (side) {
301
- if (sideOf(current.current.offset) !== side)
506
+ // A trackpad swipe still moving the row ends with the side fully open.
507
+ const wheeling = !!wheel.current && wheel.current !== "locked";
508
+ if (wheeling || sideOf(current.current.offset) !== side)
302
509
  open(side);
303
510
  }
304
511
  else if (current.current.offset !== 0) {
@@ -306,20 +513,29 @@ export function SwipeActions({ leading = [], trailing = [], labelPlacement = "hi
306
513
  }
307
514
  };
308
515
  const handleBlur = (event) => {
309
- if (gesture.current?.swiping)
516
+ if (gesture.current?.swiping || removal.current)
310
517
  return;
311
518
  if (event.relatedTarget instanceof Node && root.current?.contains(event.relatedTarget))
312
519
  return;
313
520
  if (current.current.offset !== 0)
314
521
  close();
315
522
  };
316
- const select = (action, event) => {
523
+ const select = (action, side, event) => {
524
+ // A row being removed runs nothing more, from the keys either.
525
+ if (removal.current)
526
+ return;
527
+ // A press ends a trackpad swipe still moving the row.
528
+ lockWheel();
529
+ // A pointer leaves no focus on the action, so a row the list keeps closes.
530
+ if (event.detail !== 0)
531
+ event.currentTarget.blur();
532
+ if (action.role === "destructive")
533
+ return remove(action, side);
317
534
  action.onSelect?.();
318
535
  // A press closes the row, as iOS does. From the keys the action keeps the focus, so its side stays open until
319
536
  // the focus leaves the row.
320
537
  if (event.detail === 0)
321
538
  return;
322
- event.currentTarget.blur();
323
539
  close();
324
540
  };
325
541
  const renderSide = (side, actions) => {
@@ -335,9 +551,11 @@ export function SwipeActions({ leading = [], trailing = [], labelPlacement = "hi
335
551
  const shape = !action.Icon ? "text" : labelPlacement === "inside" ? "label" : "symbol";
336
552
  const labelInside = shape !== "symbol";
337
553
  const labelBelow = shape === "symbol" && labelPlacement === "below";
338
- return (_jsxs("button", { type: "button", className: s.Action, "data-color": color, "data-shape": shape, "data-first": action === actions[0] ? "" : undefined, "aria-label": labelInside || labelBelow ? undefined : action.label, onClick: (event) => select(action, event), children: [_jsxs("span", { className: s.Capsule, children: [action.Icon && _jsx(action.Icon, { className: s.Icon, "aria-hidden": "true" }), labelInside && _jsx("span", { className: s.Label, children: action.label })] }), labelBelow && _jsx("span", { className: s.Caption, children: action.label })] }, action.id));
554
+ return (_jsxs("button", { type: "button", className: s.Action, "data-color": color, "data-shape": shape, "data-first": action === actions[0] ? "" : undefined, "aria-label": labelInside || labelBelow ? undefined : action.label, onClick: (event) => select(action, side, event), children: [_jsxs("span", { className: s.Capsule, children: [action.Icon && _jsx(action.Icon, { className: s.Icon, "aria-hidden": "true" }), labelInside && _jsx("span", { className: s.Label, children: action.label })] }), labelBelow && _jsx("span", { className: s.Caption, children: action.label })] }, action.id));
339
555
  }) }));
340
556
  };
341
- return (_jsxs("div", { ref: root, className: clsx(s.SwipeActions, className), "data-row": "", "data-swipe-actions": "", "data-label-placement": labelPlacement, "data-round": round ? "" : undefined, "data-revealed": revealed, "data-swiping": swiping ? "" : undefined, onFocus: handleFocus, onBlur: handleBlur, children: [renderSide("leading", leading), _jsx("div", { className: s.Content, "data-swipe-content": "", style: offset !== 0 ? { "--swipe-actions-offset": `${rtl ? -offset : offset}px` } : undefined, onPointerDown: handlePointerDown, onPointerMove: handlePointerMove, onLostPointerCapture: handleLostPointerCapture, onClickCapture: handleClickCapture, children: children }), renderSide("trailing", trailing)] }));
557
+ return (_jsxs("div", { ref: root, className: clsx(s.SwipeActions, className), "data-row": "", "data-swipe-actions": "", "data-label-placement": labelPlacement, "data-round": round ? "" : undefined, "data-revealed": revealed, "data-swiping": swiping ? "" : undefined, "data-removing": removing ? "" : undefined,
558
+ // The row collapses from its height (keyframes in the CSS), so no frame has to pass first.
559
+ style: height !== undefined ? { "--swipe-actions-row-height": `${height}px` } : undefined, onFocus: handleFocus, onBlur: handleBlur, children: [renderSide("leading", leading), _jsx("div", { className: s.Content, "data-swipe-content": "", style: offset !== 0 ? { "--swipe-actions-offset": `${rtl ? -offset : offset}px` } : undefined, onPointerDown: handlePointerDown, onPointerMove: handlePointerMove, onLostPointerCapture: handleLostPointerCapture, onClickCapture: handleClickCapture, children: children }), renderSide("trailing", trailing)] }));
342
560
  }
343
561
  //# sourceMappingURL=SwipeActions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SwipeActions.js","sourceRoot":"","sources":["../../../../src/components/SwipeActions/SwipeActions.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAQL,SAAS,EACT,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAA;AACd,OAAO,CAAC,MAAM,gEAAgE,CAAA;AAC9E,OAAO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,EACN,UAAU,IAAI,eAAM,SAAS,EAAE,CAAC,CAAC,OAAO,YAAG,MAAM,CAAC,KAAK,GAAQ,KAb3D,MAAM,CAAC,EAAE,CAcP,CACV,CAAA;YACH,CAAC,CAAC,GACE,CACP,CAAA;IACH,CAAC,CAAA;IAED,OAAO,CACL,eACE,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,cACjC,EAAE,wBACQ,EAAE,0BACC,cAAc,gBACxB,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,mBACnB,QAAQ,kBACT,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EACtC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,UAAU,aAEjB,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,EAC/B,cACE,SAAS,EAAE,CAAC,CAAC,OAAO,wBACD,EAAE,EACrB,KAAK,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,wBAAwB,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,IAAI,EAAmB,CAAC,CAAC,CAAC,SAAS,EAC9G,aAAa,EAAE,iBAAiB,EAChC,aAAa,EAAE,iBAAiB,EAChC,oBAAoB,EAAE,wBAAwB,EAC9C,cAAc,EAAE,kBAAkB,YAEjC,QAAQ,GACL,EACL,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,IAC7B,CACP,CAAA;AACH,CAAC","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport {\n type ComponentType,\n type CSSProperties,\n type FocusEvent,\n type MouseEvent,\n type PointerEvent,\n type ReactNode,\n type SVGProps,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport s from \"@plexui/styles/components/SwipeActions/SwipeActions.module.css\"\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\n\nexport type SwipeActionColor =\n | \"primary\"\n | \"secondary\"\n | \"danger\"\n | \"success\"\n | \"info\"\n | \"discovery\"\n | \"caution\"\n | \"warning\"\n\nexport type SwipeAction = {\n /** Unique ID of the action within its side */\n id: string\n /** Name of the action: shown with `labelPlacement` `\"inside\"` or `\"below\"` (and on an action without an icon), and its accessible name always */\n label: string\n /** Icon of the action */\n Icon?: ComponentType<SVGProps<SVGSVGElement>>\n /** Solid color of the action. @default \"secondary\" */\n color?: SwipeActionColor\n /** Called when the action is pressed, or by a full swipe when it is the first action of its side */\n onSelect?: () => void\n}\n\nexport type SwipeActionsSide = \"leading\" | \"trailing\"\n\nexport type SwipeActionsProps = {\n /** Actions revealed by a swipe toward the trailing edge, the first one at the leading edge */\n leading?: SwipeAction[]\n /** Actions revealed by a swipe toward the leading edge, the first one at the trailing edge */\n trailing?: SwipeAction[]\n /** Where the actions show their labels: `\"hidden\"` (symbols only), `\"inside\"` the capsule, or `\"below\"` it (for rows of 60px and taller, as iOS sets them). @default \"hidden\" */\n labelPlacement?: \"hidden\" | \"inside\" | \"below\"\n /** A swipe past the middle between the open actions and the far edge runs the first action of that side. @default true */\n fullSwipe?: boolean\n /** CSS classes applied to the row */\n className?: string\n /** The content of the row */\n children?: ReactNode\n}\n\n/** A finger has to travel this far, and farther across than down, before the row follows it. */\nconst SLOP = 10\n\n/** The width an open row moves by is the border box of its actions, edge and content gaps included. */\nconst BORDER_BOX: ResizeObserverOptions = { box: \"border-box\" }\n\n/** Controls that take a horizontal drag themselves. */\nconst OWN_DRAG = 'input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"slider\"]'\n\ntype Gesture = {\n pointerId: number\n x: number\n y: number\n start: number\n /** Undecided while within the slop, then a swipe (true) or a scroll (false). */\n swiping: boolean | undefined\n rtl: boolean\n widths: Record<SwipeActionsSide, number>\n rowWidth: number\n /** Removes the listeners for the end of the gesture. */\n detach: () => void\n}\n\n/** The open row: opening another one closes it, as a list keeps one row open. */\nlet closeOpenRow: (() => void) | null = null\n\n/** The row keeps the finger past its edges; a pointer that is no longer active (it lifted between events) cannot be held. */\nconst capture = (element: Element, pointerId: number) => {\n try {\n element.setPointerCapture?.(pointerId)\n } catch {\n // The swipe goes on with the events the row still gets.\n }\n}\n\nconst sideOf = (offset: number): SwipeActionsSide | undefined =>\n offset > 0 ? \"leading\" : offset < 0 ? \"trailing\" : undefined\n\n/**\n * Where the content goes for a swipe of `raw` px toward the trailing edge (negative: toward the leading edge), and\n * whether that is a full swipe. A side without actions stays shut. Past its actions the content follows the finger\n * where a full swipe is allowed, and a third as fast where it is not; past the middle between the open actions and\n * the far edge of the row the swipe is full.\n */\nexport const swipeActionsOffset = (\n raw: number,\n widths: Record<SwipeActionsSide, number>,\n rowWidth: number,\n fullSwipe: boolean,\n): { offset: number; full: boolean } => {\n const side = sideOf(raw)\n const width = side ? widths[side] : 0\n if (!side || !(width > 0)) return { offset: 0, full: false }\n const sign = Math.sign(raw)\n const distance = Math.abs(raw)\n if (distance <= width) return { offset: raw, full: false }\n if (!fullSwipe) return { offset: sign * (width + (distance - width) / 3), full: false }\n const travel = Math.min(distance, Math.max(width, rowWidth))\n return { offset: sign * travel, full: travel >= (width + rowWidth) / 2 }\n}\n\n/**\n * Actions behind a row of a list, as the swipe actions of an iOS list: a swipe toward the leading edge reveals the\n * trailing actions, a swipe toward the trailing edge the leading ones, and a full swipe runs the first action of\n * that side. The row is a `data-row` of a FieldGroup. Each action is also a button in the order of the screen, and\n * the focus on one shows its side.\n */\nexport function SwipeActions({\n leading = [],\n trailing = [],\n labelPlacement = \"hidden\",\n fullSwipe = true,\n className,\n children,\n}: SwipeActionsProps) {\n const [offset, setOffset] = useState(0)\n const [full, setFull] = useState(false)\n const [swiping, setSwiping] = useState(false)\n const [rtl, setRtl] = useState(false)\n const [round, setRound] = useState(false)\n const root = useRef<HTMLDivElement>(null)\n const sides = useRef<Record<SwipeActionsSide, HTMLDivElement | null>>({ leading: null, trailing: null })\n const gesture = useRef<Gesture | null>(null)\n const current = useRef({ offset: 0, full: false })\n const suppressClick = useRef(false)\n const observer = useRef<ResizeObserver | null>(null)\n const actionsRef = useLatestValue({ leading, trailing })\n const revealed = sideOf(offset)\n\n const widthOf = (side: SwipeActionsSide) => sides.current[side]?.getBoundingClientRect().width ?? 0\n\n const isRtl = () => !!root.current && getComputedStyle(root.current).direction === \"rtl\"\n\n const move = (next: number, nextFull = false) => {\n current.current = { offset: next, full: nextFull }\n setOffset(next)\n setFull(nextFull)\n }\n\n /** Lets go of the gesture: the listeners for its end go, and the row no longer follows the finger. */\n const release = () => {\n const state = gesture.current\n gesture.current = null\n state?.detach()\n return state\n }\n\n /** The handlers of the latest render, for listeners and observers set up once. */\n const latest = useRef({ close: () => {}, release, finish: () => {}, cancel: () => {}, sync: () => {}, fit: () => {} })\n\n /** One function for the life of the row, so the list knows which row is open; another row that opens ends this one's gesture too. */\n const closer = useRef(() => {\n const state = latest.current.release()\n if (state) {\n setSwiping(false)\n // The finger of the ended swipe still lifts over this row: its click is not a click on the content.\n if (state.swiping) suppressClick.current = true\n }\n latest.current.close()\n }).current\n\n const close = () => {\n if (closeOpenRow === closer) closeOpenRow = null\n move(0)\n }\n\n /** This row takes the place of the open one. */\n const claim = () => {\n if (closeOpenRow && closeOpenRow !== closer) closeOpenRow()\n closeOpenRow = closer\n }\n\n /** Shows a side as wide as its actions (`width` when known), or closes the row when that side has none (any more). */\n const open = (side: SwipeActionsSide, width = widthOf(side)) => {\n if (!(width > 0)) return close()\n claim()\n setRtl(isRtl())\n move(side === \"leading\" ? width : -width)\n }\n\n /** An open row follows its actions: more of them, other labels or another width move it to their new width. */\n const sync = () => {\n const side = sideOf(current.current.offset)\n if (!side || gesture.current?.swiping || current.current.full) return\n const width = widthOf(side)\n if (!(width > 0)) return close()\n const target = side === \"leading\" ? width : -width\n if (target !== current.current.offset) move(target)\n }\n\n /**\n * A symbol that has grown as tall as its circle (its max-height) is one, as iOS draws a circle from there. The\n * measure is a capsule that is laid out: a full swipe hides all but the first action of its side, and while none\n * is laid out the shape stays.\n */\n const fit = () => {\n const capsules = [...(root.current?.querySelectorAll<HTMLElement>('[data-shape=\"symbol\"] > :first-child') ?? [])]\n if (capsules.length < 1) return setRound(false)\n const capsule = capsules.find((element) => element.getBoundingClientRect().height > 0)\n if (!capsule) return\n const max = parseFloat(getComputedStyle(capsule).maxHeight)\n setRound(max > 0 && capsule.getBoundingClientRect().height >= max - 0.5)\n }\n\n const settle = (state: Gesture) => {\n const { offset: last, full: wasFull } = current.current\n const side = sideOf(last)\n if (!side) return close()\n if (wasFull) {\n actionsRef.current[side][0]?.onSelect?.()\n return close()\n }\n // The widths from the start of the swipe: a full swipe may have stretched the actions since.\n if (Math.abs(last) >= state.widths[side] / 2) open(side, state.widths[side])\n else close()\n }\n\n /** The finger lifted (anywhere): a swipe settles, a press on an open row closes it. */\n const finish = () => {\n const state = release()\n if (!state) return\n if (state.swiping) {\n suppressClick.current = true\n setSwiping(false)\n settle(state)\n } else if (state.start !== 0) {\n if (state.swiping === undefined) suppressClick.current = true\n close()\n }\n }\n\n /** The browser took the gesture (a scroll) or the row lost the finger: the row goes back to where it was. */\n const cancel = () => {\n const state = release()\n if (!state) return\n setSwiping(false)\n const side = sideOf(state.start)\n if (state.swiping && side) open(side, state.widths[side])\n else close()\n }\n\n latest.current = { close, release, finish, cancel, sync, fit }\n\n // After each render, and whenever the actions change size, an open row takes their width and a symbol its shape.\n useEffect(() => {\n latest.current.fit()\n latest.current.sync()\n for (const element of [sides.current.leading, sides.current.trailing]) if (element) observer.current?.observe(element, BORDER_BOX)\n })\n\n useEffect(() => {\n if (typeof ResizeObserver !== \"undefined\") observer.current = new ResizeObserver(() => {\n latest.current.fit()\n latest.current.sync()\n })\n for (const element of [sides.current.leading, sides.current.trailing]) if (element) observer.current?.observe(element, BORDER_BOX)\n // The open row lets go of the list, and of the finger, when it goes away.\n return () => {\n observer.current?.disconnect()\n observer.current = null\n latest.current.release()\n if (closeOpenRow === closer) closeOpenRow = null\n }\n }, [closer, latest])\n\n // A press anywhere outside the open row closes it.\n useEffect(() => {\n if (!revealed || swiping) return\n const handlePointerDown = (event: globalThis.PointerEvent) => {\n if (event.target instanceof Node && root.current?.contains(event.target)) return\n latest.current.close()\n }\n document.addEventListener(\"pointerdown\", handlePointerDown, true)\n return () => document.removeEventListener(\"pointerdown\", handlePointerDown, true)\n }, [revealed, swiping, latest])\n\n const handlePointerDown = (event: PointerEvent<HTMLDivElement>) => {\n if (event.button !== 0 || gesture.current) return\n // A new press of the primary pointer starts clean: a swipe that another row ended and that was then cancelled leaves\n // no click to swallow. Another finger's press keeps it, as only the primary pointer clicks.\n if (event.isPrimary) suppressClick.current = false\n if (leading.length < 1 && trailing.length < 1) return\n // A drag in a text field or along a slider belongs to that control.\n if (event.target instanceof Element && event.target.closest(OWN_DRAG)) return\n const pointerId = event.pointerId\n // The end of the gesture is heard wherever the finger lifts, inside the row or not.\n const handleUp = (end: globalThis.PointerEvent) => {\n if (end.pointerId === pointerId) latest.current.finish()\n }\n const handleCancel = (end: globalThis.PointerEvent) => {\n if (end.pointerId === pointerId) latest.current.cancel()\n }\n window.addEventListener(\"pointerup\", handleUp, true)\n window.addEventListener(\"pointercancel\", handleCancel, true)\n gesture.current = {\n pointerId,\n x: event.clientX,\n y: event.clientY,\n start: current.current.offset,\n swiping: undefined,\n rtl: isRtl(),\n widths: { leading: widthOf(\"leading\"), trailing: widthOf(\"trailing\") },\n rowWidth: root.current?.clientWidth ?? 0,\n detach: () => {\n window.removeEventListener(\"pointerup\", handleUp, true)\n window.removeEventListener(\"pointercancel\", handleCancel, true)\n },\n }\n }\n\n const handlePointerMove = (event: PointerEvent<HTMLDivElement>) => {\n const state = gesture.current\n if (!state || state.pointerId !== event.pointerId || state.swiping === false) return\n const across = (event.clientX - state.x) * (state.rtl ? -1 : 1)\n const down = event.clientY - state.y\n if (state.swiping === undefined) {\n if (Math.abs(across) < SLOP && Math.abs(down) < SLOP) return\n if (Math.abs(across) <= Math.abs(down)) {\n state.swiping = false\n return\n }\n state.swiping = true\n capture(event.currentTarget, event.pointerId)\n window.getSelection?.()?.removeAllRanges()\n claim()\n setRtl(state.rtl)\n setSwiping(true)\n }\n const next = swipeActionsOffset(state.start + across, state.widths, state.rowWidth, fullSwipe)\n move(next.offset, next.full)\n }\n\n /** The content lost the finger it held. A child that loses the finger to the content (as a touch moves its implicit capture) ends nothing. */\n const handleLostPointerCapture = (event: PointerEvent<HTMLDivElement>) => {\n if (event.target === event.currentTarget && gesture.current?.pointerId === event.pointerId) cancel()\n }\n\n /** A swipe or a press that closed the row is not a click on the content; a click from the keys still is. */\n const handleClickCapture = (event: MouseEvent<HTMLDivElement>) => {\n if (!suppressClick.current || event.detail === 0) return\n suppressClick.current = false\n event.preventDefault()\n event.stopPropagation()\n }\n\n /** The focus on an action shows its side; on the content it closes the row. */\n const handleFocus = (event: FocusEvent<HTMLDivElement>) => {\n if (gesture.current?.swiping) return\n const side = ([\"leading\", \"trailing\"] as const).find((name) => sides.current[name]?.contains(event.target))\n if (side) {\n if (sideOf(current.current.offset) !== side) open(side)\n } else if (current.current.offset !== 0) {\n close()\n }\n }\n\n const handleBlur = (event: FocusEvent<HTMLDivElement>) => {\n if (gesture.current?.swiping) return\n if (event.relatedTarget instanceof Node && root.current?.contains(event.relatedTarget)) return\n if (current.current.offset !== 0) close()\n }\n\n const select = (action: SwipeAction, event: MouseEvent<HTMLButtonElement>) => {\n action.onSelect?.()\n // A press closes the row, as iOS does. From the keys the action keeps the focus, so its side stays open until\n // the focus leaves the row.\n if (event.detail === 0) return\n event.currentTarget.blur()\n close()\n }\n\n const renderSide = (side: SwipeActionsSide, actions: SwipeAction[]) => {\n if (actions.length < 1) return null\n const shown = side === \"leading\" ? actions : [...actions].reverse()\n const isFull = full && revealed === side\n return (\n <div\n ref={(element) => {\n sides.current[side] = element\n }}\n className={s.Actions}\n data-side={side}\n data-full={isFull ? \"\" : undefined}\n style={isFull ? { width: Math.abs(offset) } : undefined}\n >\n {shown.map((action) => {\n const color = action.color ?? \"secondary\"\n // A label alone (text), a symbol with its label inside (label), or a symbol with its label hidden or below.\n const shape = !action.Icon ? \"text\" : labelPlacement === \"inside\" ? \"label\" : \"symbol\"\n const labelInside = shape !== \"symbol\"\n const labelBelow = shape === \"symbol\" && labelPlacement === \"below\"\n return (\n <button\n key={action.id}\n type=\"button\"\n className={s.Action}\n data-color={color}\n data-shape={shape}\n data-first={action === actions[0] ? \"\" : undefined}\n aria-label={labelInside || labelBelow ? undefined : action.label}\n onClick={(event) => select(action, event)}\n >\n <span className={s.Capsule}>\n {action.Icon && <action.Icon className={s.Icon} aria-hidden=\"true\" />}\n {labelInside && <span className={s.Label}>{action.label}</span>}\n </span>\n {labelBelow && <span className={s.Caption}>{action.label}</span>}\n </button>\n )\n })}\n </div>\n )\n }\n\n return (\n <div\n ref={root}\n className={clsx(s.SwipeActions, className)}\n data-row=\"\"\n data-swipe-actions=\"\"\n data-label-placement={labelPlacement}\n data-round={round ? \"\" : undefined}\n data-revealed={revealed}\n data-swiping={swiping ? \"\" : undefined}\n onFocus={handleFocus}\n onBlur={handleBlur}\n >\n {renderSide(\"leading\", leading)}\n <div\n className={s.Content}\n data-swipe-content=\"\"\n style={offset !== 0 ? { \"--swipe-actions-offset\": `${rtl ? -offset : offset}px` } as CSSProperties : undefined}\n onPointerDown={handlePointerDown}\n onPointerMove={handlePointerMove}\n onLostPointerCapture={handleLostPointerCapture}\n onClickCapture={handleClickCapture}\n >\n {children}\n </div>\n {renderSide(\"trailing\", trailing)}\n </div>\n )\n}\n"]}
1
+ {"version":3,"file":"SwipeActions.js","sourceRoot":"","sources":["../../../../src/components/SwipeActions/SwipeActions.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAQL,SAAS,EACT,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAA;AACd,OAAO,CAAC,MAAM,gEAAgE,CAAA;AAC9E,OAAO,EAAE,cAAc,E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AAC,KAAK,GAAQ,KAb3D,MAAM,CAAC,EAAE,CAcP,CACV,CAAA;YACH,CAAC,CAAC,GACE,CACP,CAAA;IACH,CAAC,CAAA;IAED,OAAO,CACL,eACE,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,cACjC,EAAE,wBACQ,EAAE,0BACC,cAAc,gBACxB,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,mBACnB,QAAQ,kBACT,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,mBACvB,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QACxC,2FAA2F;QAC3F,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,4BAA4B,EAAE,GAAG,MAAM,IAAI,EAAmB,CAAC,CAAC,CAAC,SAAS,EAC1G,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,UAAU,aAEjB,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,EAC/B,cACE,SAAS,EAAE,CAAC,CAAC,OAAO,wBACD,EAAE,EACrB,KAAK,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,wBAAwB,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,IAAI,EAAmB,CAAC,CAAC,CAAC,SAAS,EAC9G,aAAa,EAAE,iBAAiB,EAChC,aAAa,EAAE,iBAAiB,EAChC,oBAAoB,EAAE,wBAAwB,EAC9C,cAAc,EAAE,kBAAkB,YAEjC,QAAQ,GACL,EACL,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,IAC7B,CACP,CAAA;AACH,CAAC","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport {\n type ComponentType,\n type CSSProperties,\n type FocusEvent,\n type MouseEvent,\n type PointerEvent,\n type ReactNode,\n type SVGProps,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport s from \"@plexui/styles/components/SwipeActions/SwipeActions.module.css\"\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\n\nexport type SwipeActionColor =\n | \"primary\"\n | \"secondary\"\n | \"danger\"\n | \"success\"\n | \"info\"\n | \"discovery\"\n | \"caution\"\n | \"warning\"\n\nexport type SwipeAction = {\n /** Unique ID of the action within its side */\n id: string\n /** Name of the action: shown with `labelPlacement` `\"inside\"` or `\"below\"` (and on an action without an icon), and its accessible name always */\n label: string\n /** Icon of the action */\n Icon?: ComponentType<SVGProps<SVGSVGElement>>\n /** Solid color of the action. @default \"secondary\" */\n color?: SwipeActionColor\n /** Called when the action is pressed, or by a full swipe when it is the first action of its side */\n onSelect?: () => void\n /** `\"destructive\"`: the action removes the row, so the row slides out and its height collapses, as iOS deletes a row, and `onSelect` comes at the end of that for the list to drop it. A row the list keeps comes back. */\n role?: \"destructive\"\n}\n\nexport type SwipeActionsSide = \"leading\" | \"trailing\"\n\nexport type SwipeActionsProps = {\n /** Actions revealed by a swipe toward the trailing edge, the first one at the leading edge */\n leading?: SwipeAction[]\n /** Actions revealed by a swipe toward the leading edge, the first one at the trailing edge */\n trailing?: SwipeAction[]\n /** Where the actions show their labels: `\"hidden\"` (symbols only), `\"inside\"` the capsule, or `\"below\"` it (for rows of 60px and taller, as iOS sets them). @default \"hidden\" */\n labelPlacement?: \"hidden\" | \"inside\" | \"below\"\n /** A swipe past the middle between the open actions and the far edge runs the first action of that side. @default true */\n fullSwipe?: boolean\n /** CSS classes applied to the row */\n className?: string\n /** The content of the row */\n children?: ReactNode\n}\n\n/** A finger has to travel this far, and farther across than down, before the row follows it. */\nconst SLOP = 10\n\n/** The width an open row moves by is the border box of its actions, edge and content gaps included. */\nconst BORDER_BOX: ResizeObserverOptions = { box: \"border-box\" }\n\n/** A finger lifting faster than this (px/ms) opens the side it moves toward, or closes the row when it moves back, however short the swipe. */\nconst FLICK = 0.3\n\n/** A finger that stopped this long (ms) before it lifted flicks nothing. */\nconst FLICK_WINDOW = 100\n\n/** A trackpad swipe (horizontal wheel) ends when no wheel event has come for this long (ms). */\nconst WHEEL_IDLE = 120\n\n/** Controls that take a horizontal drag themselves. */\nconst OWN_DRAG = 'input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"slider\"]'\n\n/** Whether a wheel over `target` belongs to a control or a box inside the row that scrolls across itself. */\nconst scrollsAcross = (target: EventTarget | null, row: Element | null): boolean => {\n for (let element = target instanceof Element ? target : null; element && element !== row; element = element.parentElement) {\n if (element.matches(OWN_DRAG)) return true\n const overflow = getComputedStyle(element).overflowX\n if ((overflow === \"auto\" || overflow === \"scroll\") && element.scrollWidth > element.clientWidth) return true\n }\n return false\n}\n\ntype Gesture = {\n pointerId: number\n x: number\n y: number\n start: number\n /** Undecided while within the slop, then a swipe (true) or a scroll (false). */\n swiping: boolean | undefined\n rtl: boolean\n widths: Record<SwipeActionsSide, number>\n rowWidth: number\n /** Where the finger last was across (px) and when (ms), and how fast it moved there (px/ms). */\n across: number\n time: number\n velocity: number\n /** Removes the listeners for the end of the gesture. */\n detach: () => void\n}\n\n/** The open row: opening another one closes it, as a list keeps one row open. */\nlet closeOpenRow: (() => void) | null = null\n\n/** The row keeps the finger past its edges; a pointer that is no longer active (it lifted between events) cannot be held. */\nconst capture = (element: Element, pointerId: number) => {\n try {\n element.setPointerCapture?.(pointerId)\n } catch {\n // The swipe goes on with the events the row still gets.\n }\n}\n\nconst sideOf = (offset: number): SwipeActionsSide | undefined =>\n offset > 0 ? \"leading\" : offset < 0 ? \"trailing\" : undefined\n\n/**\n * Where a swipe that ended at `offset` settles: a flick (`velocity` px/ms, toward the trailing edge when positive)\n * opens the side it moves toward and closes the row when it moves back; a slow one opens a side moved past half its\n * `width`.\n */\nexport const swipeActionsSettle = (offset: number, velocity: number, width: number): boolean => {\n if (Math.abs(velocity) >= FLICK) return Math.sign(velocity) === Math.sign(offset)\n return Math.abs(offset) >= width / 2\n}\n\n/** The duration (ms) the row moves in, none when the motion is reduced. */\nconst durationOf = (element: Element) => {\n if (typeof matchMedia === \"function\" && matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return 0\n const value = getComputedStyle(element).getPropertyValue(\"--swipe-actions-duration\").trim()\n const time = parseFloat(value)\n if (!Number.isFinite(time)) return 0\n return value.endsWith(\"ms\") ? time : time * 1000\n}\n\n/**\n * Where the content goes for a swipe of `raw` px toward the trailing edge (negative: toward the leading edge), and\n * whether that is a full swipe. A side without actions stays shut. Past its actions the content follows the finger\n * where a full swipe is allowed, and a third as fast where it is not; past the middle between the open actions and\n * the far edge of the row the swipe is full.\n */\nexport const swipeActionsOffset = (\n raw: number,\n widths: Record<SwipeActionsSide, number>,\n rowWidth: number,\n fullSwipe: boolean,\n): { offset: number; full: boolean } => {\n const side = sideOf(raw)\n const width = side ? widths[side] : 0\n if (!side || !(width > 0)) return { offset: 0, full: false }\n const sign = Math.sign(raw)\n const distance = Math.abs(raw)\n if (distance <= width) return { offset: raw, full: false }\n if (!fullSwipe) return { offset: sign * (width + (distance - width) / 3), full: false }\n const travel = Math.min(distance, Math.max(width, rowWidth))\n return { offset: sign * travel, full: travel >= (width + rowWidth) / 2 }\n}\n\n/**\n * Actions behind a row of a list, as the swipe actions of an iOS list: a swipe toward the leading edge reveals the\n * trailing actions, a swipe toward the trailing edge the leading ones, and a full swipe runs the first action of\n * that side. The row is a `data-row` of a FieldGroup. Each action is also a button in the order of the screen, and\n * the focus on one shows its side.\n */\nexport function SwipeActions({\n leading = [],\n trailing = [],\n labelPlacement = \"hidden\",\n fullSwipe = true,\n className,\n children,\n}: SwipeActionsProps) {\n const [offset, setOffset] = useState(0)\n const [full, setFull] = useState(false)\n const [swiping, setSwiping] = useState(false)\n const [rtl, setRtl] = useState(false)\n const [round, setRound] = useState(false)\n const [removing, setRemoving] = useState(false)\n const [height, setHeight] = useState<number | undefined>(undefined)\n const root = useRef<HTMLDivElement>(null)\n const sides = useRef<Record<SwipeActionsSide, HTMLDivElement | null>>({ leading: null, trailing: null })\n const gesture = useRef<Gesture | null>(null)\n const current = useRef({ offset: 0, full: false })\n const suppressClick = useRef(false)\n const observer = useRef<ResizeObserver | null>(null)\n /** The timers of a removal and of a trackpad swipe, cleared when the row goes. */\n const timers = useRef<{ timeouts: number[]; wheel: number }>({ timeouts: [], wheel: 0 })\n /** The row is being removed: nothing moves it back until the action has run. */\n const removal = useRef(false)\n /** A trackpad swipe: where it started, how far it went, the widths at its start. `locked` drops the momentum after it. */\n const wheel = useRef<{ start: number; across: number; widths: Record<SwipeActionsSide, number>; rowWidth: number } | \"locked\" | null>(null)\n const actionsRef = useLatestValue({ leading, trailing })\n const revealed = sideOf(offset)\n\n const widthOf = (side: SwipeActionsSide) => sides.current[side]?.getBoundingClientRect().width ?? 0\n\n const isRtl = () => !!root.current && getComputedStyle(root.current).direction === \"rtl\"\n\n const move = (next: number, nextFull = false) => {\n current.current = { offset: next, full: nextFull }\n setOffset(next)\n setFull(nextFull)\n }\n\n /** Lets go of the gesture: the listeners for its end go, and the row no longer follows the finger. */\n const release = () => {\n const state = gesture.current\n gesture.current = null\n state?.detach()\n return state\n }\n\n /** The handlers of the latest render, for listeners and observers set up once. */\n const latest = useRef({\n close: () => {},\n release,\n finish: () => {},\n cancel: () => {},\n sync: () => {},\n fit: () => {},\n wheel: (_event: globalThis.WheelEvent) => {},\n lockWheel: () => {},\n })\n\n /** One function for the life of the row, so the list knows which row is open; another row that opens ends this one's gesture too. */\n const closer = useRef(() => {\n const state = latest.current.release()\n if (state) {\n setSwiping(false)\n // The finger of the ended swipe still lifts over this row: its click is not a click on the content.\n if (state.swiping) suppressClick.current = true\n }\n latest.current.lockWheel()\n latest.current.close()\n }).current\n\n /** No action of the row keeps the focus. */\n const blurActions = () => {\n const focused = document.activeElement\n if (focused instanceof HTMLElement && (sides.current.leading?.contains(focused) || sides.current.trailing?.contains(focused))) focused.blur()\n }\n\n const close = () => {\n if (removal.current) return\n // Whatever closes or opens the row (a press, the focus, another row) ends a trackpad swipe and its momentum.\n lockWheel()\n // A closed row hides its actions, so none keeps the focus (Enter would run a hidden action).\n blurActions()\n if (closeOpenRow === closer) closeOpenRow = null\n move(0)\n }\n\n /** This row takes the place of the open one. */\n const claim = () => {\n if (closeOpenRow && closeOpenRow !== closer) closeOpenRow()\n closeOpenRow = closer\n }\n\n /** Shows a side as wide as its actions (`width` when known), or closes the row when that side has none (any more). */\n const open = (side: SwipeActionsSide, width = widthOf(side)) => {\n if (removal.current) return\n if (!(width > 0)) return close()\n lockWheel()\n claim()\n setRtl(isRtl())\n move(side === \"leading\" ? width : -width)\n }\n\n /** An open row follows its actions: more of them, other labels or another width move it to their new width. */\n const sync = () => {\n const side = sideOf(current.current.offset)\n if (!side || removal.current || gesture.current?.swiping || (wheel.current && wheel.current !== \"locked\") || current.current.full) return\n const width = widthOf(side)\n if (!(width > 0)) return close()\n const target = side === \"leading\" ? width : -width\n if (target !== current.current.offset) move(target)\n }\n\n /**\n * A symbol that has grown as tall as its circle (its max-height) is one, as iOS draws a circle from there. The\n * measure is a capsule that is laid out: a full swipe hides all but the first action of its side, and while none\n * is laid out the shape stays.\n */\n const fit = () => {\n const capsules = [...(root.current?.querySelectorAll<HTMLElement>('[data-shape=\"symbol\"] > :first-child') ?? [])]\n if (capsules.length < 1) return setRound(false)\n const capsule = capsules.find((element) => element.getBoundingClientRect().height > 0)\n if (!capsule) return\n const max = parseFloat(getComputedStyle(capsule).maxHeight)\n setRound(max > 0 && capsule.getBoundingClientRect().height >= max - 0.5)\n }\n\n /**\n * A destructive action: the content slides out to the side it was swiped to (the trailing one when pressed from\n * the keys) and the row collapses, then the action runs; a row the list keeps comes back closed.\n */\n const remove = (action: SwipeAction, side: SwipeActionsSide) => {\n const element = root.current\n if (!element || removal.current) return\n const duration = durationOf(element)\n const width = element.clientWidth\n claim()\n setHeight(element.getBoundingClientRect().height)\n setRemoving(true)\n setRtl(isRtl())\n move(side === \"leading\" ? width : -width, current.current.full)\n removal.current = true\n lockWheel()\n const { timeouts } = timers.current\n timeouts.push(window.setTimeout(() => {\n action.onSelect?.()\n // A row the list dropped is gone by now; one it keeps comes back.\n timeouts.push(window.setTimeout(() => {\n removal.current = false\n setRemoving(false)\n setHeight(undefined)\n // An action that keeps the focus (chosen from the keys) keeps its side open, so the focus is never on a hidden action.\n const focused = document.activeElement\n const side = ([\"leading\", \"trailing\"] as const).find((name) => !!focused && !!sides.current[name]?.contains(focused))\n if (side) open(side)\n else close()\n }))\n }, duration))\n }\n\n /** Runs an action from its side: a destructive one removes the row first. */\n const run = (action: SwipeAction | undefined, side: SwipeActionsSide) => {\n if (!action) return close()\n if (action.role === \"destructive\") return remove(action, side)\n action.onSelect?.()\n close()\n }\n\n const settle = (state: Gesture, velocity = 0) => {\n const { offset: last, full: wasFull } = current.current\n const side = sideOf(last)\n if (!side) return close()\n if (wasFull) return run(actionsRef.current[side][0], side)\n // The widths from the start of the swipe: a full swipe may have stretched the actions since.\n if (swipeActionsSettle(last, velocity, state.widths[side])) open(side, state.widths[side])\n else close()\n }\n\n /** The finger lifted (anywhere): a swipe settles, a press on an open row closes it. */\n const finish = () => {\n const state = release()\n if (!state) return\n if (state.swiping) {\n suppressClick.current = true\n setSwiping(false)\n settle(state, performance.now() - state.time <= FLICK_WINDOW ? state.velocity : 0)\n } else if (state.start !== 0) {\n if (state.swiping === undefined) suppressClick.current = true\n close()\n }\n }\n\n /** The browser took the gesture (a scroll) or the row lost the finger: the row goes back to where it was. */\n const cancel = () => {\n const state = release()\n if (!state) return\n setSwiping(false)\n const side = sideOf(state.start)\n if (state.swiping && side) open(side, state.widths[side])\n else close()\n }\n\n /** A trackpad swipe that has not settled yet settles no more, where it stands (a press or a removal takes over). */\n const stopWheel = () => {\n window.clearTimeout(timers.current.wheel)\n if (wheel.current && wheel.current !== \"locked\") setSwiping(false)\n wheel.current = null\n }\n\n /** Another row took over: this row's trackpad swipe ends here, and the momentum after it moves nothing. */\n const lockWheel = () => {\n if (!wheel.current || wheel.current === \"locked\") return\n stopWheel()\n wheel.current = \"locked\"\n timers.current.wheel = window.setTimeout(() => {\n wheel.current = null\n }, WHEEL_IDLE)\n }\n\n /**\n * A two-finger swipe on a trackpad moves the row as a finger does, without a full swipe (the momentum after the\n * fingers lift would run an action), and settles when the wheel stops. A swipe down scrolls the page.\n */\n const handleWheel = (event: globalThis.WheelEvent) => {\n if (event.ctrlKey) return\n const horizontal = Math.abs(event.deltaX) > Math.abs(event.deltaY)\n let state = wheel.current\n // The momentum after a swipe keeps the lock until it stops, a removal or not.\n if (state === \"locked\") {\n window.clearTimeout(timers.current.wheel)\n if (horizontal) event.preventDefault()\n timers.current.wheel = window.setTimeout(() => {\n wheel.current = null\n }, WHEEL_IDLE)\n return\n }\n if (removal.current || gesture.current || (leading.length < 1 && trailing.length < 1)) return\n if (!state && (!horizontal || scrollsAcross(event.target, root.current))) return\n window.clearTimeout(timers.current.wheel)\n event.preventDefault()\n if (!state) {\n // The row moves under the focus: an action that has it lets it go, as a closed row does.\n const start = current.current.offset\n blurActions()\n state = { start, across: 0, widths: { leading: widthOf(\"leading\"), trailing: widthOf(\"trailing\") }, rowWidth: root.current?.clientWidth ?? 0 }\n wheel.current = state\n claim()\n setRtl(isRtl())\n setSwiping(true)\n }\n const scale = event.deltaMode === 1 ? 16 : event.deltaMode === 2 ? state.rowWidth : 1\n // The page scrolls the other way the fingers move: fingers moving left give a positive deltaX.\n state.across -= event.deltaX * scale * (isRtl() ? -1 : 1)\n const next = swipeActionsOffset(state.start + state.across, state.widths, state.rowWidth, false)\n move(next.offset)\n const widths = state.widths\n timers.current.wheel = window.setTimeout(() => {\n wheel.current = \"locked\"\n setSwiping(false)\n const side = sideOf(current.current.offset)\n if (side && swipeActionsSettle(current.current.offset, 0, widths[side])) open(side, widths[side])\n else close()\n timers.current.wheel = window.setTimeout(() => {\n wheel.current = null\n }, WHEEL_IDLE)\n }, WHEEL_IDLE)\n }\n\n latest.current = { close, release, finish, cancel, sync, fit, wheel: handleWheel, lockWheel }\n\n // After each render, and whenever the actions change size, an open row takes their width and a symbol its shape.\n useEffect(() => {\n latest.current.fit()\n latest.current.sync()\n for (const element of [sides.current.leading, sides.current.trailing]) if (element) observer.current?.observe(element, BORDER_BOX)\n })\n\n useEffect(() => {\n if (typeof ResizeObserver !== \"undefined\") observer.current = new ResizeObserver(() => {\n latest.current.fit()\n latest.current.sync()\n })\n for (const element of [sides.current.leading, sides.current.trailing]) if (element) observer.current?.observe(element, BORDER_BOX)\n // A trackpad swipe has to stop the page's own scroll and back gesture, which a passive listener cannot.\n const element = root.current\n const handleWheel = (event: globalThis.WheelEvent) => latest.current.wheel(event)\n element?.addEventListener(\"wheel\", handleWheel, { passive: false })\n const pending = timers.current\n // The open row lets go of the list, and of the finger, when it goes away.\n return () => {\n element?.removeEventListener(\"wheel\", handleWheel)\n for (const id of pending.timeouts) window.clearTimeout(id)\n window.clearTimeout(pending.wheel)\n observer.current?.disconnect()\n observer.current = null\n latest.current.release()\n if (closeOpenRow === closer) closeOpenRow = null\n }\n }, [closer, latest, timers])\n\n // A press anywhere outside the open row closes it, while a trackpad moves it too; a finger's own swipe keeps it.\n useEffect(() => {\n if (!revealed) return\n const handlePointerDown = (event: globalThis.PointerEvent) => {\n if (event.target instanceof Node && root.current?.contains(event.target)) return\n if (gesture.current?.swiping) return\n latest.current.close()\n }\n document.addEventListener(\"pointerdown\", handlePointerDown, true)\n return () => document.removeEventListener(\"pointerdown\", handlePointerDown, true)\n }, [revealed, latest])\n\n const handlePointerDown = (event: PointerEvent<HTMLDivElement>) => {\n if (event.button !== 0 || gesture.current || removal.current) return\n // A new press of the primary pointer starts clean: a swipe that another row ended and that was then cancelled leaves\n // no click to swallow. Another finger's press keeps it, as only the primary pointer clicks.\n if (event.isPrimary) suppressClick.current = false\n if (leading.length < 1 && trailing.length < 1) return\n // Any press ends a trackpad swipe still moving the row, and its momentum.\n lockWheel()\n // A drag in a text field or along a slider belongs to that control.\n if (event.target instanceof Element && event.target.closest(OWN_DRAG)) return\n const pointerId = event.pointerId\n // The end of the gesture is heard wherever the finger lifts, inside the row or not.\n const handleUp = (end: globalThis.PointerEvent) => {\n if (end.pointerId === pointerId) latest.current.finish()\n }\n const handleCancel = (end: globalThis.PointerEvent) => {\n if (end.pointerId === pointerId) latest.current.cancel()\n }\n window.addEventListener(\"pointerup\", handleUp, true)\n window.addEventListener(\"pointercancel\", handleCancel, true)\n gesture.current = {\n pointerId,\n x: event.clientX,\n y: event.clientY,\n start: current.current.offset,\n swiping: undefined,\n rtl: isRtl(),\n widths: { leading: widthOf(\"leading\"), trailing: widthOf(\"trailing\") },\n rowWidth: root.current?.clientWidth ?? 0,\n across: 0,\n time: performance.now(),\n velocity: 0,\n detach: () => {\n window.removeEventListener(\"pointerup\", handleUp, true)\n window.removeEventListener(\"pointercancel\", handleCancel, true)\n },\n }\n }\n\n const handlePointerMove = (event: PointerEvent<HTMLDivElement>) => {\n const state = gesture.current\n if (!state || state.pointerId !== event.pointerId || state.swiping === false) return\n const across = (event.clientX - state.x) * (state.rtl ? -1 : 1)\n const down = event.clientY - state.y\n // The speed is the finger's latest, from every move, the ones within the slop too.\n const now = performance.now()\n if (now > state.time) state.velocity = (across - state.across) / (now - state.time)\n state.across = across\n state.time = now\n if (state.swiping === undefined) {\n if (Math.abs(across) < SLOP && Math.abs(down) < SLOP) return\n if (Math.abs(across) <= Math.abs(down)) {\n state.swiping = false\n return\n }\n state.swiping = true\n capture(event.currentTarget, event.pointerId)\n window.getSelection?.()?.removeAllRanges()\n claim()\n setRtl(state.rtl)\n setSwiping(true)\n }\n const next = swipeActionsOffset(state.start + across, state.widths, state.rowWidth, fullSwipe)\n move(next.offset, next.full)\n }\n\n /** The content lost the finger it held. A child that loses the finger to the content (as a touch moves its implicit capture) ends nothing. */\n const handleLostPointerCapture = (event: PointerEvent<HTMLDivElement>) => {\n if (event.target === event.currentTarget && gesture.current?.pointerId === event.pointerId) cancel()\n }\n\n /** A swipe or a press that closed the row is not a click on the content; a click from the keys still is. */\n const handleClickCapture = (event: MouseEvent<HTMLDivElement>) => {\n if (!suppressClick.current || event.detail === 0) return\n suppressClick.current = false\n event.preventDefault()\n event.stopPropagation()\n }\n\n /** The focus on an action shows its side; on the content it closes the row. */\n const handleFocus = (event: FocusEvent<HTMLDivElement>) => {\n if (gesture.current?.swiping || removal.current) return\n const side = ([\"leading\", \"trailing\"] as const).find((name) => sides.current[name]?.contains(event.target))\n if (side) {\n // A trackpad swipe still moving the row ends with the side fully open.\n const wheeling = !!wheel.current && wheel.current !== \"locked\"\n if (wheeling || sideOf(current.current.offset) !== side) open(side)\n } else if (current.current.offset !== 0) {\n close()\n }\n }\n\n const handleBlur = (event: FocusEvent<HTMLDivElement>) => {\n if (gesture.current?.swiping || removal.current) return\n if (event.relatedTarget instanceof Node && root.current?.contains(event.relatedTarget)) return\n if (current.current.offset !== 0) close()\n }\n\n const select = (action: SwipeAction, side: SwipeActionsSide, event: MouseEvent<HTMLButtonElement>) => {\n // A row being removed runs nothing more, from the keys either.\n if (removal.current) return\n // A press ends a trackpad swipe still moving the row.\n lockWheel()\n // A pointer leaves no focus on the action, so a row the list keeps closes.\n if (event.detail !== 0) event.currentTarget.blur()\n if (action.role === \"destructive\") return remove(action, side)\n action.onSelect?.()\n // A press closes the row, as iOS does. From the keys the action keeps the focus, so its side stays open until\n // the focus leaves the row.\n if (event.detail === 0) return\n close()\n }\n\n const renderSide = (side: SwipeActionsSide, actions: SwipeAction[]) => {\n if (actions.length < 1) return null\n const shown = side === \"leading\" ? actions : [...actions].reverse()\n const isFull = full && revealed === side\n return (\n <div\n ref={(element) => {\n sides.current[side] = element\n }}\n className={s.Actions}\n data-side={side}\n data-full={isFull ? \"\" : undefined}\n style={isFull ? { width: Math.abs(offset) } : undefined}\n >\n {shown.map((action) => {\n const color = action.color ?? \"secondary\"\n // A label alone (text), a symbol with its label inside (label), or a symbol with its label hidden or below.\n const shape = !action.Icon ? \"text\" : labelPlacement === \"inside\" ? \"label\" : \"symbol\"\n const labelInside = shape !== \"symbol\"\n const labelBelow = shape === \"symbol\" && labelPlacement === \"below\"\n return (\n <button\n key={action.id}\n type=\"button\"\n className={s.Action}\n data-color={color}\n data-shape={shape}\n data-first={action === actions[0] ? \"\" : undefined}\n aria-label={labelInside || labelBelow ? undefined : action.label}\n onClick={(event) => select(action, side, event)}\n >\n <span className={s.Capsule}>\n {action.Icon && <action.Icon className={s.Icon} aria-hidden=\"true\" />}\n {labelInside && <span className={s.Label}>{action.label}</span>}\n </span>\n {labelBelow && <span className={s.Caption}>{action.label}</span>}\n </button>\n )\n })}\n </div>\n )\n }\n\n return (\n <div\n ref={root}\n className={clsx(s.SwipeActions, className)}\n data-row=\"\"\n data-swipe-actions=\"\"\n data-label-placement={labelPlacement}\n data-round={round ? \"\" : undefined}\n data-revealed={revealed}\n data-swiping={swiping ? \"\" : undefined}\n data-removing={removing ? \"\" : undefined}\n // The row collapses from its height (keyframes in the CSS), so no frame has to pass first.\n style={height !== undefined ? { \"--swipe-actions-row-height\": `${height}px` } as CSSProperties : undefined}\n onFocus={handleFocus}\n onBlur={handleBlur}\n >\n {renderSide(\"leading\", leading)}\n <div\n className={s.Content}\n data-swipe-content=\"\"\n style={offset !== 0 ? { \"--swipe-actions-offset\": `${rtl ? -offset : offset}px` } as CSSProperties : undefined}\n onPointerDown={handlePointerDown}\n onPointerMove={handlePointerMove}\n onLostPointerCapture={handleLostPointerCapture}\n onClickCapture={handleClickCapture}\n >\n {children}\n </div>\n {renderSide(\"trailing\", trailing)}\n </div>\n )\n}\n"]}