@astryxdesign/core 0.7.6-canary.5ef8ecf → 0.7.6-canary.6224efd

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.
Files changed (53) hide show
  1. package/dist/Badge/Badge.d.ts.map +1 -1
  2. package/dist/Badge/Badge.js +2 -1
  3. package/dist/DateInput/MonthScroller.d.ts.map +1 -1
  4. package/dist/DateInput/MonthScroller.js +17 -18
  5. package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
  6. package/dist/DateRangeInput/DateRangeInput.js +8 -4
  7. package/dist/DropdownMenu/DropdownMenuGroup.d.ts.map +1 -1
  8. package/dist/DropdownMenu/DropdownMenuGroup.js +2 -1
  9. package/dist/Field/FieldLabel.d.ts.map +1 -1
  10. package/dist/Field/FieldLabel.js +27 -2
  11. package/dist/FileInput/FileInput.d.ts.map +1 -1
  12. package/dist/FileInput/FileInput.js +33 -22
  13. package/dist/Layer/useTouchTrigger.d.ts +9 -0
  14. package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
  15. package/dist/Layer/useTouchTrigger.js +1 -1
  16. package/dist/NumberInput/NumberInput.d.ts.map +1 -1
  17. package/dist/NumberInput/NumberInput.js +11 -15
  18. package/dist/Resizable/useResizable.d.ts.map +1 -1
  19. package/dist/Resizable/useResizable.js +53 -10
  20. package/dist/Slider/Slider.d.ts.map +1 -1
  21. package/dist/Slider/Slider.js +90 -10
  22. package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
  23. package/dist/Tokenizer/Tokenizer.js +51 -47
  24. package/dist/Tokenizer/TokenizerBottomSheet.d.ts.map +1 -1
  25. package/dist/Tokenizer/TokenizerBottomSheet.js +8 -14
  26. package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
  27. package/dist/Typeahead/BaseTypeahead.js +10 -3
  28. package/package.json +4 -4
  29. package/src/Badge/Badge.tsx +2 -1
  30. package/src/DateInput/MonthScroller.tsx +15 -17
  31. package/src/DateRangeInput/DateRangeInput.tsx +18 -3
  32. package/src/DropdownMenu/DropdownMenuGroup.tsx +2 -1
  33. package/src/Field/Field.doc.mjs +2 -1
  34. package/src/Field/FieldLabel.doc.mjs +4 -2
  35. package/src/Field/FieldLabel.spec.md +72 -55
  36. package/src/Field/FieldLabel.tsx +37 -3
  37. package/src/FileInput/FileInput.tsx +39 -23
  38. package/src/HoverCard/HoverCard.spec.md +96 -39
  39. package/src/InfoTip/InfoTip.spec.md +193 -0
  40. package/src/Layer/useTouchTrigger.ts +1 -1
  41. package/src/Layout/LayoutPanel.spec.md +60 -38
  42. package/src/Lightbox/Lightbox.spec.md +249 -61
  43. package/src/NumberInput/NumberInput.tsx +11 -18
  44. package/src/Resizable/Resizable.spec.md +41 -33
  45. package/src/Resizable/useResizable.ts +50 -7
  46. package/src/SideNav/SideNav.spec.md +8 -8
  47. package/src/Slider/Slider.spec.md +18 -16
  48. package/src/Slider/Slider.tsx +109 -9
  49. package/src/StatusDot/StatusDot.spec.md +77 -54
  50. package/src/Tokenizer/Tokenizer.tsx +54 -48
  51. package/src/Tokenizer/TokenizerBottomSheet.tsx +8 -14
  52. package/src/Tooltip/Tooltip.spec.md +139 -41
  53. package/src/Typeahead/BaseTypeahead.tsx +18 -2
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../src/Slider/Slider.tsx"],"names":[],"mappings":"AA2CA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAShD,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAU9C,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,mBAAmB,CAAC,cAAc,CAAC,EACnC,UAAU,CACX;IACC,mDAAmD;IACnD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,qEAAqE;IACrE,KAAK,EAAE,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,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,8CAA8C;IAC9C,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IAC7C,iEAAiE;IACjE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IAChD,8CAA8C;IAC9C,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,MAAM,WAAW,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAmT/D;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,EAAC,GAAG,EAAE,GAAG,KAAK,EAAC,EAAE,WAAW,+BAi6BlD;yBAj6Be,MAAM"}
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @file Slider.tsx
7
7
  * @input Uses React, useId, useRef, useCallback, useEffect, Field, Tooltip, useTooltip, VisuallyHidden
8
- * @output Exports Slider and its props; unfilled marks share the track token; modifier-only key presses do not restore the thumb focus ring; a drag belongs to the pointer that started it
8
+ * @output Exports Slider and its props; unfilled marks share the track token; modifier-only key presses do not restore the thumb focus ring; a drag belongs to the pointer that started it; two coincident range thumbs separate toward the press or the first movement
9
9
  * @position Core implementation; consumed by index.ts, tested by Slider.test.tsx
10
10
  *
11
11
  * SYNC: When modified, update these files to stay in sync:
@@ -422,7 +422,19 @@ export function Slider({
422
422
  // Prefer the lower thumb if equidistant
423
423
  return d0 <= d1 ? 0 : 1;
424
424
  }, [isRange, values]);
425
- const updateValue = useCallback((thumbIndex, newVal, snap = true) => {
425
+
426
+ // The pointer's value at a press on two coincident thumbs, while no
427
+ // movement has said which way the drag goes; the first value off it picks
428
+ // the thumb that can travel that way (see handlePointerMove).
429
+ const coincidentDragRef = useRef(null);
430
+ // Whether the drag in progress began on two coincident thumbs: such a drag
431
+ // can always follow the pointer, so when the dragged thumb is held against
432
+ // the other one and the pointer passes it, the other thumb takes the drag.
433
+ const coincidentOriginRef = useRef(false);
434
+ const updateValue = useCallback((thumbIndex, newVal, snap = true,
435
+ // The other thumb's values to start from, when one event moves both
436
+ // (a drag handed from one coincident thumb to the other).
437
+ from = values) => {
426
438
  if (isDisabled) {
427
439
  return;
428
440
  }
@@ -431,7 +443,7 @@ export function Slider({
431
443
  // grid (max 100 with step 3 snapped End to 99, not 100).
432
444
  const clamped = clamp(snap ? snapToStep(newVal, min, step) : newVal, min, max);
433
445
  if (isRange) {
434
- const currentValues = [...values];
446
+ const currentValues = [...from];
435
447
  currentValues[thumbIndex] = clamped;
436
448
 
437
449
  // Enforce minStepsBetweenThumbs
@@ -479,6 +491,8 @@ export function Slider({
479
491
  detachLostCaptureRef.current = null;
480
492
  draggingThumbRef.current = null;
481
493
  dragPointerRef.current = null;
494
+ coincidentDragRef.current = null;
495
+ coincidentOriginRef.current = false;
482
496
  setDraggingThumb(null);
483
497
  fireChangeEnd();
484
498
  }
@@ -505,12 +519,37 @@ export function Slider({
505
519
  const thumbs = track?.querySelectorAll('[role="slider"]');
506
520
  const pressedThumb = e.target.closest('[role="slider"]');
507
521
  const pressedThumbIndex = pressedThumb == null || thumbs == null ? -1 : Array.from(thumbs).indexOf(pressedThumb);
508
- // A direct thumb press owns that thumb even when range values coincide.
509
- // Track and mark presses still choose the nearest value.
510
- const thumbIndex = pressedThumbIndex >= 0 ? pressedThumbIndex : getClosestThumb(newVal);
522
+ // A direct thumb press owns that thumb; track and mark presses choose
523
+ // the nearest value. Two thumbs on one value are the exception: only
524
+ // one of them can travel toward where the pointer goes. A track press
525
+ // beside them picks the thumb on its side. A press on the thumbs
526
+ // themselves (or on their shared value) moves nothing: the pressed
527
+ // thumb holds the press until the pointer moves, and the direction of
528
+ // that first movement from the press picks the thumb.
529
+ const isCoincident = isRange && values[0] === values[1];
530
+ let thumbIndex = pressedThumbIndex >= 0 ? pressedThumbIndex : getClosestThumb(newVal);
531
+ const parks = isCoincident && (pressedThumbIndex >= 0 || newVal === values[0]);
532
+ // Until the first movement, a parked press is held by the upper thumb,
533
+ // the one drawn over the lower one, wherever it landed: on the thumbs
534
+ // (which the upper thumb covers) or on their shared value elsewhere,
535
+ // such as its mark label. So its pressed paint shows, and a press that
536
+ // never moves leaves focus on the same thumb.
537
+ if (parks && pressedThumbIndex < 0) {
538
+ thumbIndex = 1;
539
+ }
540
+ // The first movement is measured from the pointer itself, not from a
541
+ // mark it pressed (a wide label sits away from its mark's value).
542
+ coincidentDragRef.current = parks ? getValueFromPosition(e.clientX, e.clientY) : null;
543
+ // Only a drag that began on the shared thumbs, the press that waited for
544
+ // the first movement, hands itself to the other thumb (FR6); a track
545
+ // press beside them already picked its thumb.
546
+ coincidentOriginRef.current = parks;
547
+ if (isCoincident && !parks) {
548
+ thumbIndex = newVal > values[0] ? 1 : 0;
549
+ }
511
550
  draggingThumbRef.current = thumbIndex;
512
551
  setDraggingThumb(thumbIndex);
513
- updateValue(thumbIndex, newVal);
552
+ updateValue(thumbIndex, parks ? values[thumbIndex] : newVal);
514
553
 
515
554
  // Focus the thumb that owns this drag.
516
555
  thumbs?.[thumbIndex]?.focus();
@@ -533,12 +572,50 @@ export function Slider({
533
572
  if (typeof e.currentTarget.setPointerCapture === 'function') {
534
573
  e.currentTarget.setPointerCapture(e.pointerId);
535
574
  }
536
- }, [isDisabled, getValueFromPosition, getClosestThumb, updateValue, endDrag]);
575
+ }, [isDisabled, isRange, values, getValueFromPosition, getClosestThumb, updateValue, endDrag]);
537
576
  const handlePointerMove = useCallback(e => {
538
577
  if (draggingThumbRef.current === null || e.pointerId !== dragPointerRef.current || isDisabled) {
539
578
  return;
540
579
  }
541
580
  const newVal = getValueFromPosition(e.clientX, e.clientY);
581
+ // Hands the drag to a thumb, with its focus and pressed paint.
582
+ const handTo = thumbIndex => {
583
+ if (thumbIndex === draggingThumbRef.current) {
584
+ return;
585
+ }
586
+ draggingThumbRef.current = thumbIndex;
587
+ setDraggingThumb(thumbIndex);
588
+ const thumbs = trackRef.current?.querySelectorAll('[role="slider"]');
589
+ thumbs?.[thumbIndex]?.focus();
590
+ setKeyboardFocusThumb(null);
591
+ };
592
+ const pressValue = coincidentDragRef.current;
593
+ if (pressValue !== null) {
594
+ if (newVal === pressValue) {
595
+ return;
596
+ }
597
+ // The first movement from a press on coincident thumbs hands the
598
+ // drag to the thumb that can travel that way.
599
+ coincidentDragRef.current = null;
600
+ handTo(newVal > pressValue ? 1 : 0);
601
+ } else if (coincidentOriginRef.current) {
602
+ // A drag that began on coincident thumbs follows the pointer either
603
+ // way: once the pointer passes the other thumb, the dragged one stops
604
+ // against it and the other takes the drag (a first step that drifted
605
+ // the wrong way never sticks the drag).
606
+ const current = valuesRef.current;
607
+ const dragging = draggingThumbRef.current;
608
+ const other = dragging === 0 ? 1 : 0;
609
+ if (dragging === 0 && newVal > current[1] || dragging === 1 && newVal < current[0]) {
610
+ // The dragged thumb ends against the other one, as if it had
611
+ // followed the pointer there, and the other follows the pointer on.
612
+ const from = [...current];
613
+ from[dragging] = current[other];
614
+ handTo(other);
615
+ updateValue(other, newVal, true, from);
616
+ return;
617
+ }
618
+ }
542
619
  updateValue(draggingThumbRef.current, newVal);
543
620
  }, [isDisabled, getValueFromPosition, updateValue]);
544
621
  const handlePointerUp = useCallback(e => endDrag(e.pointerId), [endDrag]);
@@ -685,8 +762,11 @@ export function Slider({
685
762
  content: displayValue(val),
686
763
  placement: tooltipPlacement,
687
764
  delay: 0,
688
- focusTrigger: "always",
689
- isOpen: draggingThumb === thumbIndex ? true : undefined,
765
+ focusTrigger: "always"
766
+ // A drag keeps its own thumb's value showing and closes the other
767
+ // thumb's, which a drag handed over from it may have forced open.
768
+ ,
769
+ isOpen: draggingThumb === null ? undefined : draggingThumb === thumbIndex,
690
770
  children: thumbElement
691
771
  }, thumbIndex);
692
772
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Tokenizer.d.ts","sourceRo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C;CACvD,CAAC;AAmXF,wBAAgB,SAAS,CAAC,CAAC,SAAS,cAAc,EAChD,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,GACvB,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;yBAFL,SAAS;;;AA0iCzB;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,EAAgB,CACpD,CAAC,SAAS,cAAc,EAExB,KAAK,EAAE,8BAA8B,CAAC,CAAC,CAAC,KACrC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC"}
@@ -50,6 +50,7 @@ import "../theme/tokens.stylex.js";
50
50
  import { colorVars, spacingVars, sizeVars, typeScaleVars } from "../theme/tokens.stylex.js";
51
51
  import { composeEventHandlers, mergeProps } from "../utils/index.js";
52
52
  import { joinAriaIDs } from "../utils/inputAria.js";
53
+ import { isFocusDetached } from "../utils/focusReturn.js";
53
54
  import { themeProps } from "../utils/themeProps.js";
54
55
  import { useTranslator } from "../i18n/index.js";
55
56
  import { useResolvedRequired } from "../hooks/useResolvedRequired.js";
@@ -506,14 +507,6 @@ export function Tokenizer({
506
507
  sheetQueryRef.current = query;
507
508
  onChangeQuery?.(query);
508
509
  }, [onChangeQuery]);
509
- // Whether the field's control — the inline input or the trigger — holds
510
- // focus. Kept in a ref by the focus and blur handlers of both, because a
511
- // control unmounted while focused fires no blur: when a presentation swap
512
- // removes the focused control (the latch releasing into the popover, or
513
- // `adaptive` changing while the sheet is closed), the new presentation's
514
- // control takes the focus over once it has mounted, so focus never lands on
515
- // the page body (`component:Tokenizer` FR16, `spec:AST-085` FR4).
516
- const isControlFocusedRef = useRef(false);
517
510
  // Set around a focus move the field makes itself — a presentation swap
518
511
  // handing focus from one control to the other — so the receiving control
519
512
  // does not report it as focus entering from outside.
@@ -524,35 +517,33 @@ export function Tokenizer({
524
517
  // entry, and the one focus the trigger then gets — BottomSheet's return
525
518
  // focus — is the entry to report.
526
519
  const hasReportedFocusRef = useRef(false);
527
- // A control can hold focus without the field having seen a focus event:
528
- // the inline input server-rendered with `autofocus` (`hasAutoFocus`) is
529
- // focused before hydration, and the swap to the trigger in the first
530
- // render after it removes that input. React detaches the old control
531
- // before any effect of the swapping commit runs, so the live focus is
532
- // read during that render, while the control is still in the document —
533
- // a read of `document.activeElement` only, with no update made in render.
534
- const previousPresentationRef = useRef(isSheetPresentation);
535
- if (previousPresentationRef.current !== isSheetPresentation) {
536
- previousPresentationRef.current = isSheetPresentation;
537
- if (typeof document !== 'undefined') {
538
- const active = document.activeElement;
539
- if (active != null && (active === inputRef.current || active === triggerRef.current)) {
540
- isControlFocusedRef.current = true;
541
- }
542
- }
543
- }
544
- useEffect(() => {
545
- if (!isControlFocusedRef.current) {
520
+ // When a presentation swap removes the focused control (the latch
521
+ // releasing into the popover, or `adaptive` changing while the sheet is
522
+ // closed), the new presentation's control takes the focus over, so focus
523
+ // never lands on the page body (`component:Tokenizer` FR16, `spec:AST-085`
524
+ // FR4). Both controls' callback refs own the hand-off
525
+ // (`architecture:react-component-runtime` INV6): the detaching control
526
+ // notes that it held focus — it is still in the document then, so this also
527
+ // covers a control focused before hydration (`hasAutoFocus`), which no focus
528
+ // event reported — and the attaching control takes it.
529
+ const isFocusPendingHandOffRef = useRef(false);
530
+ const handOffFocusRef = useCallback(node => {
531
+ if (node == null) {
546
532
  return;
547
533
  }
548
- const active = document.activeElement;
549
- if (active != null && active !== document.body) {
550
- return;
534
+ const takesFocus = isFocusPendingHandOffRef.current;
535
+ isFocusPendingHandOffRef.current = false;
536
+ if (takesFocus && isFocusDetached(node.ownerDocument)) {
537
+ isHandingOffFocusRef.current = true;
538
+ node.focus();
539
+ isHandingOffFocusRef.current = false;
551
540
  }
552
- isHandingOffFocusRef.current = true;
553
- (isSheetPresentation ? triggerRef.current : inputRef.current)?.focus();
554
- isHandingOffFocusRef.current = false;
555
- }, [isSheetPresentation]);
541
+ return () => {
542
+ if (node.ownerDocument.activeElement === node) {
543
+ isFocusPendingHandOffRef.current = true;
544
+ }
545
+ };
546
+ }, []);
556
547
  // The trigger's accessible description names the selected tokens: the
557
548
  // button's children are tokens whose own content assistive technology
558
549
  // leaves out of a button's name (`spec:AST-020` FR1).
@@ -603,10 +594,30 @@ export function Tokenizer({
603
594
  focusTrigger: 'always',
604
595
  isEnabled: showsDisabledMessage
605
596
  });
597
+ // The inline field's wrapper holds every control a swap removes with the
598
+ // input — a token's Remove button, the inline Clear all — so it notes focus
599
+ // anywhere inside it for the hand-off above. It also anchors the
600
+ // disabled-message tooltip, whose handlers are gated internally by
601
+ // isEnabled, so attaching unconditionally is safe.
602
+ const tooltipAnchorRef = disabledMessageTooltip.ref;
603
+ const wrapperCallbackRef = useCallback(el => {
604
+ wrapperRef.current = el;
605
+ tooltipAnchorRef(el);
606
+ if (el == null) {
607
+ return;
608
+ }
609
+ return () => {
610
+ if (el.contains(el.ownerDocument.activeElement)) {
611
+ isFocusPendingHandOffRef.current = true;
612
+ }
613
+ wrapperRef.current = null;
614
+ tooltipAnchorRef(null);
615
+ };
616
+ }, [tooltipAnchorRef]);
606
617
 
607
618
  // The sheet presentation has no input; the public ref reaches the trigger,
608
619
  // the control it stands for (`family:input-fields` FR10).
609
- const triggerMergedRef = useMergedRefs(triggerRef, ref, disabledMessageTooltip.ref);
620
+ const triggerMergedRef = useMergedRefs(triggerRef, ref, disabledMessageTooltip.ref, handOffFocusRef);
610
621
  useImperativeHandle(handleRef, () => ({
611
622
  focus() {
612
623
  (isSheetPresentation ? triggerRef : inputRef).current?.focus();
@@ -678,7 +689,6 @@ export function Tokenizer({
678
689
  layer.show();
679
690
  }
680
691
  if (comingFromOutside) {
681
- isControlFocusedRef.current = true;
682
692
  if (!isHandingOffFocusRef.current) {
683
693
  hasReportedFocusRef.current = true;
684
694
  onFocus?.(e);
@@ -692,8 +702,9 @@ export function Tokenizer({
692
702
  }, [isLayerMode, layer, isFocusInTokenizer, onFocus]);
693
703
  const handleBlurCapture = useCallback(e => {
694
704
  if (!isFocusInTokenizer(e.relatedTarget)) {
695
- isControlFocusedRef.current = false;
696
705
  hasReportedFocusRef.current = false;
706
+ // Focus left the field: no hand-off is owed any more.
707
+ isFocusPendingHandOffRef.current = false;
697
708
  setIsFocusedWithin(false);
698
709
  onBlur?.(e);
699
710
  if (isLayerMode) {
@@ -915,13 +926,7 @@ export function Tokenizer({
915
926
  left: 'anchor(start)'
916
927
  };
917
928
  const wrapperContent = /*#__PURE__*/_jsxs("div", {
918
- ref: el => {
919
- wrapperRef.current = el;
920
- // Anchor + hover/focus listeners for the disabled-message tooltip.
921
- // Handlers are gated internally by isEnabled, so attaching
922
- // unconditionally is safe.
923
- disabledMessageTooltip.ref(el);
924
- },
929
+ ref: wrapperCallbackRef,
925
930
  role: "group",
926
931
  "aria-label": label,
927
932
  onClick: handleWrapperClick,
@@ -971,7 +976,7 @@ export function Tokenizer({
971
976
  ref: useMergedRefs(inputRef,
972
977
  // With `experimental`, the ref type admits the trigger too; in
973
978
  // this presentation it receives the input.
974
- ref),
979
+ ref, handOffFocusRef),
975
980
  searchSource: isAtMax ? emptySource : filteredSource,
976
981
  value: null,
977
982
  onChange: handleAdd,
@@ -1079,7 +1084,6 @@ export function Tokenizer({
1079
1084
  // trigger button, and the handler only reads the event.
1080
1085
  callerOnClick),
1081
1086
  onFocus: event => {
1082
- isControlFocusedRef.current = true;
1083
1087
  // BottomSheet focuses the trigger only after its exit completes;
1084
1088
  // that focus is the signal that the retained sheet can leave. If
1085
1089
  // the resolution moved to the popover meanwhile, the inline input
@@ -1106,8 +1110,8 @@ export function Tokenizer({
1106
1110
  if (isSheetOpen) {
1107
1111
  return;
1108
1112
  }
1109
- isControlFocusedRef.current = false;
1110
1113
  hasReportedFocusRef.current = false;
1114
+ isFocusPendingHandOffRef.current = false;
1111
1115
  onBlur?.(event);
1112
1116
  },
1113
1117
  onKeyDown: onKeyDown,
@@ -1 +1 @@
1
- {"version":3,"file":"TokenizerBottomSheet.d.ts","sourceRoot":"","sources":["../../src/Tokenizer/TokenizerBottomSheet.tsx"],"names":[],"mappings":"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IAC3B;;;;;OAKG;IACH,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE;QAAC,MAAM,EAAE,IAAI,CAAA;KAAC,KAAK,OAAO,CAAC;IACrD,2DAA2D;IAC3D,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE;QAAC,MAAM,EAAE,IAAI,CAAA;KAAC,KAAK,OAAO,CAAC;IACxD,kCAAkC;IAClC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;GAOG;AACH;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,cAAc,EAAE,EAC7D,MAAM,EACN,YAAY,EACZ,aAAa,EACb,KAAK,EACL,GAAG,OAAO,EACX,EAAE,yBAAyB,CAAC,CAAC,CAAC,+BAgC9B;yBAtCe,oBAAoB"}
@@ -26,6 +26,7 @@
26
26
  * - /packages/core/src/Tokenizer/Tokenizer.spec.md (FR16–FR24, AR6, PR6)
27
27
  */
28
28
  import { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
29
+ import { flushSync } from 'react-dom';
29
30
  import * as stylex from '@stylexjs/stylex';
30
31
  import { AlertDialog } from "../AlertDialog/AlertDialog.js";
31
32
  import { BottomSheet } from "../BottomSheet/BottomSheet.js";
@@ -176,8 +177,9 @@ function TokenizerSheetContent({
176
177
  // trigger's press — so an open sheet with no confirmation pending carries
177
178
  // no closed dialog (`architecture:component-style-authoring` INV7). Dialog
178
179
  // has an entrance animation and no exit, so a close is its unmount; the
179
- // sheet then places focus itself, in the Effect below, once the modal is
180
- // gone and the sheet's content can take focus again: on the search field
180
+ // close handler commits that unmount at once and then places focus itself,
181
+ // now that the modal is gone and the sheet's content can take focus again
182
+ // (`architecture:react-component-runtime` INV2): on the search field
181
183
  // after a confirmed clear — the clear is spent, and the search field is
182
184
  // where the next selection starts (FR24, `spec:AST-085` FR4) — and back on
183
185
  // Clear all after a cancel. A confirmed clear is announced there too — a
@@ -189,25 +191,17 @@ function TokenizerSheetContent({
189
191
  // dialog, so FR14 routes the words into it while the sheet is open.
190
192
  const [isClearConfirmationOpen, setIsClearConfirmationOpen] = useState(false);
191
193
  const clearAllRef = useRef(null);
192
- const afterConfirmationRef = useRef(null);
193
194
  const announce = useAnnounce();
194
195
  const closeClearConfirmation = confirmed => {
195
- afterConfirmationRef.current = confirmed ? 'search' : 'clear-all';
196
- setIsClearConfirmationOpen(false);
197
- };
198
- useEffect(() => {
199
- if (isClearConfirmationOpen || afterConfirmationRef.current == null) {
200
- return;
201
- }
202
- const destination = afterConfirmationRef.current;
203
- afterConfirmationRef.current = null;
204
- if (destination === 'search') {
196
+ // eslint-disable-next-line @eslint-react/dom-no-flush-sync -- the confirmation must be gone before focus moves into the sheet and the words are routed into it
197
+ flushSync(() => setIsClearConfirmationOpen(false));
198
+ if (confirmed) {
205
199
  searchRef.current?.focus();
206
200
  announce(t('@astryx.tokenizer.allRemoved'));
207
201
  } else {
208
202
  clearAllRef.current?.focus();
209
203
  }
210
- }, [announce, isClearConfirmationOpen, t]);
204
+ };
211
205
  const selectedIds = useMemo(() => new Set(value.map(v => v.id)), [value]);
212
206
 
213
207
  // ---- sheet session ----
@@ -1 +1 @@
1
- {"version":3,"file":"BaseTypeahead.d.ts","sourceRoot":"","sources":["../../src/Typeahead/BaseTypeahead.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAMZ,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AA2BnD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,cAAc,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC;AAY1D,MAAM,WAAW,kBA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AM,CAAC;IAEjB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,YAAY,CAAC;IAE3B;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAE1C;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAE/D;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC3B;AAoKD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,aAAa,EAi8BrB,CAAC,CAAC,SAAS,cAAc,EAC5B,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,KACzB,KAAK,CAAC,YAAY,CAAC"}
@@ -715,14 +715,21 @@ export const BaseTypeahead = function BaseTypeahead({
715
715
  if (!popover.isOpen) {
716
716
  if (e.key === 'ArrowDown' && (hasEntriesOnFocus || query.length > 0)) {
717
717
  e.preventDefault();
718
- if (results.length > 0) {
718
+ // Results held from a replaced search source are not current
719
+ // (spec:AST-092 FR4): they count as none, so the new source loads.
720
+ const hasResultsFromCurrentSource = results.length > 0 && resultsGenRef.current >= sourceGenRef.current;
721
+ const isQueryBelowMinLength = isBelowMinQueryLength(query, minQueryLength);
722
+ if (hasResultsFromCurrentSource) {
719
723
  popover.show();
720
724
  setHighlightedIndex(0);
725
+ } else if (results.length > 0 && query.length > 0 && !isQueryBelowMinLength) {
726
+ // The typed query runs again against the new source.
727
+ void performSearch(query);
721
728
  } else if (hasEntriesOnFocus &&
722
729
  // A below-threshold query was never searched; falling back to the
723
730
  // bootstrap entries here would open a menu of suggestions that
724
731
  // ignore what the user has already typed.
725
- !isBelowMinQueryLength(query, minQueryLength)) {
732
+ !isQueryBelowMinLength) {
726
733
  void performBootstrap();
727
734
  }
728
735
  }
@@ -776,7 +783,7 @@ export const BaseTypeahead = function BaseTypeahead({
776
783
  }
777
784
  break;
778
785
  }
779
- }, [isDisabled, popover, results, highlightedIndex, handleSelect, hasEntriesOnFocus, query, minQueryLength, performBootstrap, externalOnKeyDown]);
786
+ }, [isDisabled, popover, results, highlightedIndex, handleSelect, hasEntriesOnFocus, query, minQueryLength, performBootstrap, performSearch, externalOnKeyDown]);
780
787
 
781
788
  // Generate item ID for accessibility
782
789
  const getItemId = useCallback(index => `${listboxId}-option-${index}`, [listboxId]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/core",
3
- "version": "0.7.6-canary.5ef8ecf",
3
+ "version": "0.7.6-canary.6224efd",
4
4
  "displayName": "Astryx Core",
5
5
  "description": "The component library. Accessible, themeable React components with built-in spacing, dark mode, and StyleX styling.",
6
6
  "author": "Meta Open Source",
@@ -860,9 +860,9 @@
860
860
  "react-dom": ">=19.0.0"
861
861
  },
862
862
  "devDependencies": {
863
- "@astryxdesign/a11y-spec": "0.7.6-canary.5ef8ecf",
864
- "@astryxdesign/cli": "0.7.6-canary.5ef8ecf",
865
- "@astryxdesign/interaction-harness": "0.7.6-canary.5ef8ecf",
863
+ "@astryxdesign/a11y-spec": "0.7.6-canary.6224efd",
864
+ "@astryxdesign/cli": "0.7.6-canary.6224efd",
865
+ "@astryxdesign/interaction-harness": "0.7.6-canary.6224efd",
866
866
  "@babel/cli": "^7.29.7",
867
867
  "@babel/core": "^7.29.7",
868
868
  "@babel/preset-react": "^7.29.7",
@@ -26,6 +26,7 @@ import {
26
26
  } from '../theme/tokens.stylex';
27
27
  import {mergeProps} from '../utils';
28
28
  import {themeProps} from '../utils/themeProps';
29
+ import {isRenderable} from '../utils/isRenderable';
29
30
  import type {BadgeVariantMap} from './index';
30
31
 
31
32
  /**
@@ -249,7 +250,7 @@ export function Badge({
249
250
  ? label
250
251
  : undefined;
251
252
  // Whether the label renders anything, which is when the badge grows with it.
252
- const hasLabel = label !== '' && label != null && typeof label !== 'boolean';
253
+ const hasLabel = isRenderable(label);
253
254
 
254
255
  return (
255
256
  <span
@@ -85,13 +85,8 @@ const DAY_SIZE = dateInputTouchSizes.daySize;
85
85
  */
86
86
  const OVERSCAN = 3;
87
87
 
88
- /** Input on the scroller that ends a steer: the user's from here. */
89
- const USER_INPUT_EVENTS = [
90
- 'touchstart',
91
- 'wheel',
92
- 'pointerdown',
93
- 'keydown',
94
- ] as const;
88
+ /** Every listener on the scroller is passive; one options object serves all. */
89
+ const PASSIVE: AddEventListenerOptions = {passive: true};
95
90
 
96
91
  const styles = stylex.create({
97
92
  scroller: {
@@ -682,17 +677,20 @@ export function MonthScroller({
682
677
  onVisibleMonthChangeRef.current(minMonthIndex + row);
683
678
  });
684
679
  };
685
- scroller.addEventListener('scroll', onScroll, {passive: true});
686
- for (const type of USER_INPUT_EVENTS) {
687
- scroller.addEventListener(type, endSteer, {passive: true});
688
- }
689
- scroller.addEventListener('touchstart', onTouchStart, {passive: true});
680
+ scroller.addEventListener('scroll', onScroll, PASSIVE);
681
+ // The user's input on the scroller ends a steer: from here, it's theirs.
682
+ scroller.addEventListener('touchstart', endSteer, PASSIVE);
683
+ scroller.addEventListener('wheel', endSteer, PASSIVE);
684
+ scroller.addEventListener('pointerdown', endSteer, PASSIVE);
685
+ scroller.addEventListener('keydown', endSteer, PASSIVE);
686
+ scroller.addEventListener('touchstart', onTouchStart, PASSIVE);
690
687
  return () => {
691
- scroller.removeEventListener('scroll', onScroll);
692
- for (const type of USER_INPUT_EVENTS) {
693
- scroller.removeEventListener(type, endSteer);
694
- }
695
- scroller.removeEventListener('touchstart', onTouchStart);
688
+ scroller.removeEventListener('scroll', onScroll, PASSIVE);
689
+ scroller.removeEventListener('touchstart', endSteer, PASSIVE);
690
+ scroller.removeEventListener('wheel', endSteer, PASSIVE);
691
+ scroller.removeEventListener('pointerdown', endSteer, PASSIVE);
692
+ scroller.removeEventListener('keydown', endSteer, PASSIVE);
693
+ scroller.removeEventListener('touchstart', onTouchStart, PASSIVE);
696
694
  if (frameRef.current != null) {
697
695
  cancelAnimationFrame(frameRef.current);
698
696
  frameRef.current = undefined;
@@ -613,7 +613,7 @@ export function DateRangeInput({
613
613
 
614
614
  const fireChange = useCallback(
615
615
  (newValue: DateRange | null) => {
616
- if (isBusy) {
616
+ if (isEffectivelyDisabled) {
617
617
  return;
618
618
  }
619
619
  onChange(newValue);
@@ -624,7 +624,13 @@ export function DateRangeInput({
624
624
  });
625
625
  }
626
626
  },
627
- [isBusy, onChange, changeAction, startTransition, setOptimisticValue],
627
+ [
628
+ isEffectivelyDisabled,
629
+ onChange,
630
+ changeAction,
631
+ startTransition,
632
+ setOptimisticValue,
633
+ ],
628
634
  );
629
635
 
630
636
  const handleToggle = useCallback(() => {
@@ -639,10 +645,13 @@ export function DateRangeInput({
639
645
 
640
646
  const handleRangeSelect = useCallback(
641
647
  (range: DateRange) => {
648
+ if (isDisabled) {
649
+ return;
650
+ }
642
651
  fireChange(range);
643
652
  popover.hide();
644
653
  },
645
- [fireChange, popover],
654
+ [isDisabled, fireChange, popover],
646
655
  );
647
656
 
648
657
  const triggerRef = useRef<HTMLButtonElement>(null);
@@ -813,6 +822,7 @@ export function DateRangeInput({
813
822
  const presetRange = preset.getRange();
814
823
  const isActive = isRangeEqual(value, presetRange);
815
824
  const isPresetDisabled =
825
+ isDisabled ||
816
826
  !isRangeWithinSpan(presetRange, maxRangeSpan, minRangeSpan) ||
817
827
  isDateDisabled(plainDateFromISO(presetRange.start)) ||
818
828
  isDateDisabled(plainDateFromISO(presetRange.end));
@@ -828,6 +838,11 @@ export function DateRangeInput({
828
838
  aria-current={isActive ? 'true' : undefined}
829
839
  // Focusable while disabled (AR3, spec:AST-085 FR1).
830
840
  aria-disabled={isPresetDisabled || undefined}
841
+ aria-describedby={
842
+ showsDisabledMessage
843
+ ? disabledMessageTooltip.describedBy
844
+ : undefined
845
+ }
831
846
  onClick={() => {
832
847
  if (!isPresetDisabled) {
833
848
  handleRangeSelect(presetRange);
@@ -35,6 +35,7 @@ import {
35
35
  import type {BaseProps} from '../BaseProps';
36
36
  import {mergeProps} from '../utils';
37
37
  import {themeProps} from '../utils/themeProps';
38
+ import {isRenderable} from '../utils/isRenderable';
38
39
 
39
40
  const styles = stylex.create({
40
41
  heading: {
@@ -98,7 +99,7 @@ export function DropdownMenuGroup({
98
99
  ...rest
99
100
  }: DropdownMenuGroupProps) {
100
101
  const headingId = useId();
101
- const hasTitle = title != null && title !== '' && title !== false;
102
+ const hasTitle = isRenderable(title);
102
103
 
103
104
  return (
104
105
  <div
@@ -120,7 +120,8 @@ export const docs = {
120
120
  {
121
121
  name: 'labelTooltip',
122
122
  type: 'string',
123
- description: 'Tooltip text to display in an info icon at the end of the label.',
123
+ description:
124
+ 'Tooltip text to display in an info icon at the end of the label. Hover shows it; on a touch screen a tap on the icon opens it without focusing the field, while a mouse click on the icon focuses the field like the rest of the label.',
124
125
  },
125
126
  {
126
127
  name: 'status',