@lumx/react 4.17.1-alpha.0 → 4.18.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +11 -52
  2. package/index.js.map +1 -1
  3. package/package.json +3 -3
package/index.js CHANGED
@@ -6460,12 +6460,6 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
6460
6460
  /** Last notified input value, to re-fire `optionsChange` when the user keeps typing while empty. */
6461
6461
  let lastInputValue = '';
6462
6462
 
6463
- /** Last notified loading state, used to replay current state to late subscribers. */
6464
- let lastLoadingState = false;
6465
-
6466
- /** Number of currently mounted skeleton placeholders. */
6467
- let skeletonCount = 0;
6468
-
6469
6463
  /** Event subscribers managed by the handle. */
6470
6464
  const subscribers = {
6471
6465
  open: new Set(),
@@ -6480,20 +6474,6 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
6480
6474
  subscribers[event].forEach(cb => cb(value));
6481
6475
  }
6482
6476
 
6483
- /** Count visible (non-filtered) options. */
6484
- function getVisibleOptionCount() {
6485
- let count = 0;
6486
- for (const reg of optionRegistrations.values()) {
6487
- if (!reg.lastFiltered) count += 1;
6488
- }
6489
- return count;
6490
- }
6491
-
6492
- /** True when the popup has visible content (options or skeletons). */
6493
- function hasVisibleContent() {
6494
- return getVisibleOptionCount() > 0 || skeletonCount > 0;
6495
- }
6496
-
6497
6477
  /**
6498
6478
  * Notify all registered sections and fire `optionsChange` if the visible option count changed
6499
6479
  * or if the input value changed while the list is empty (so `emptyMessage` callbacks get
@@ -6504,7 +6484,10 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
6504
6484
  for (const [sectionElement] of sectionRegistrations) {
6505
6485
  notifySection(sectionElement, sectionRegistrations, optionRegistrations);
6506
6486
  }
6507
- const visibleCount = getVisibleOptionCount();
6487
+ let visibleCount = 0;
6488
+ for (const reg of optionRegistrations.values()) {
6489
+ if (!reg.lastFiltered) visibleCount += 1;
6490
+ }
6508
6491
  const inputValue = trigger?.value ?? '';
6509
6492
  const isEmpty = visibleCount === 0;
6510
6493
  if (visibleCount !== lastOptionsLength || isEmpty && inputValue !== lastInputValue) {
@@ -6515,12 +6498,6 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
6515
6498
  inputValue
6516
6499
  });
6517
6500
  }
6518
-
6519
- // Re-evaluate aria-expanded when the combobox is open — visible content may have
6520
- // changed due to filtering, option register/unregister, or skeleton transitions.
6521
- if (isOpenState) {
6522
- trigger?.setAttribute('aria-expanded', String(hasVisibleContent()));
6523
- }
6524
6501
  }
6525
6502
 
6526
6503
  // ── Skeleton loading tracking ──────────────────────────────
@@ -6528,6 +6505,9 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
6528
6505
  /** Delay before announcing loading in the live region (ms). */
6529
6506
  const LOADING_ANNOUNCEMENT_DELAY = 500;
6530
6507
 
6508
+ /** Number of currently mounted skeleton placeholders. */
6509
+ let skeletonCount = 0;
6510
+
6531
6511
  /** Timer for debounced loading announcement. */
6532
6512
  let loadingTimer;
6533
6513
 
@@ -6553,7 +6533,6 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
6553
6533
  */
6554
6534
  function onSkeletonCountChange() {
6555
6535
  const isLoading = skeletonCount > 0;
6556
- lastLoadingState = isLoading;
6557
6536
  notify('loadingChange', isLoading);
6558
6537
  if (isLoading) {
6559
6538
  startLoadingAnnouncementTimer();
@@ -6756,8 +6735,8 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
6756
6735
  startLoadingAnnouncementTimer();
6757
6736
  }
6758
6737
 
6759
- // Update aria-expanded on trigger (false when no visible options or skeletons)
6760
- trigger?.setAttribute('aria-expanded', String(isOpen && hasVisibleContent()));
6738
+ // Update aria-expanded on trigger
6739
+ trigger?.setAttribute('aria-expanded', String(isOpen));
6761
6740
  notify('open', isOpen);
6762
6741
  },
6763
6742
  select(option) {
@@ -6892,17 +6871,6 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
6892
6871
  },
6893
6872
  subscribe(event, callback) {
6894
6873
  subscribers[event].add(callback);
6895
- // Replay current loading state to late subscribers so that framework wrappers
6896
- // that subscribe after initial mount (e.g. async Vue watchers) don't miss the
6897
- // initial events fired during mount.
6898
- if (event === 'open' && isOpenState) {
6899
- callback(true);
6900
- }
6901
- if (event === 'loadingChange' && lastLoadingState) {
6902
- callback(true);
6903
- }
6904
-
6905
- // Cleanup function
6906
6874
  return () => {
6907
6875
  subscribers[event].delete(callback);
6908
6876
  };
@@ -6914,7 +6882,6 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
6914
6882
  filterValue = '';
6915
6883
  lastOptionsLength = 0;
6916
6884
  lastInputValue = '';
6917
- lastLoadingState = false;
6918
6885
  optionRegistrations.clear();
6919
6886
  sectionRegistrations.clear();
6920
6887
  skeletonCount = 0;
@@ -7311,10 +7278,6 @@ const ComboboxButton = Object.assign(forwardRefPolymorphic((props, ref) => {
7311
7278
  setHandle
7312
7279
  } = useComboboxContext();
7313
7280
  const [isOpen] = useComboboxOpen();
7314
- const state = useComboboxEvent('optionsChange', {
7315
- optionsLength: 0
7316
- });
7317
- const isLoading = useComboboxEvent('loadingChange', false);
7318
7281
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7319
7282
  const {
7320
7283
  as,
@@ -7356,7 +7319,7 @@ const ComboboxButton = Object.assign(forwardRefPolymorphic((props, ref) => {
7356
7319
  value,
7357
7320
  labelDisplayMode,
7358
7321
  listboxId,
7359
- isOpen: isOpen && (!!state?.optionsLength || isLoading),
7322
+ isOpen,
7360
7323
  ref: mergedRef
7361
7324
  }, {
7362
7325
  Button: ButtonComp,
@@ -8149,10 +8112,6 @@ const ComboboxInput = forwardRef((props, ref) => {
8149
8112
  setHandle
8150
8113
  } = useComboboxContext();
8151
8114
  const [isOpen, setIsOpen] = useComboboxOpen();
8152
- const state = useComboboxEvent('optionsChange', {
8153
- optionsLength: 0
8154
- });
8155
- const isLoading = useComboboxEvent('loadingChange', false);
8156
8115
  const {
8157
8116
  inputRef: externalInputRef,
8158
8117
  toggleButtonProps,
@@ -8201,7 +8160,7 @@ const ComboboxInput = forwardRef((props, ref) => {
8201
8160
  ...otherProps,
8202
8161
  ref,
8203
8162
  listboxId,
8204
- isOpen: isOpen && (!!state?.optionsLength || isLoading),
8163
+ isOpen,
8205
8164
  filter,
8206
8165
  inputRef: mergedInputRef,
8207
8166
  textFieldRef: anchorRef,