@lumx/react 4.19.1-alpha.6 → 4.19.1-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +14 -5
- package/index.js +289 -26
- package/index.js.map +1 -1
- package/package.json +5 -3
package/index.d.ts
CHANGED
|
@@ -797,7 +797,7 @@ interface ButtonProps extends GenericProps$1, ReactToJSX<ButtonProps$1> {
|
|
|
797
797
|
* @param ref Component ref.
|
|
798
798
|
* @return React element.
|
|
799
799
|
*/
|
|
800
|
-
declare const Button: Comp<ButtonProps,
|
|
800
|
+
declare const Button: Comp<ButtonProps, HTMLButtonElement | HTMLAnchorElement>;
|
|
801
801
|
|
|
802
802
|
interface IconButtonProps$1 extends BaseButtonProps {
|
|
803
803
|
/**
|
|
@@ -2166,6 +2166,13 @@ declare namespace ComboboxProvider {
|
|
|
2166
2166
|
|
|
2167
2167
|
/**
|
|
2168
2168
|
* Hook to subscribe to a combobox event via the handle's subscriber system.
|
|
2169
|
+
*
|
|
2170
|
+
* Uses `useSyncExternalStore` (shim, for React 17 support) reading the handle's synchronous
|
|
2171
|
+
* `getSnapshot`. This lets React pick up changes during its own commit — notably the
|
|
2172
|
+
* `optionsChange` snapshot, which the handle refreshes synchronously while coalescing the actual
|
|
2173
|
+
* subscriber push into a microtask. Reading the snapshot during commit avoids a state update
|
|
2174
|
+
* landing in the microtask outside `act` (which unit tests report as an un-acted update).
|
|
2175
|
+
*
|
|
2169
2176
|
* Re-subscribes when the handle changes (e.g. trigger mount/unmount).
|
|
2170
2177
|
*/
|
|
2171
2178
|
declare function useComboboxEvent<K extends keyof ComboboxEventMap>(event: K, initialValue: ComboboxEventMap[K]): ComboboxEventMap[K];
|
|
@@ -2200,7 +2207,7 @@ declare const Combobox: {
|
|
|
2200
2207
|
/** Provides shared combobox context (handle, listbox ID, anchor ref) to all sub-components. */
|
|
2201
2208
|
Provider: typeof ComboboxProvider;
|
|
2202
2209
|
/** Button trigger for select-only combobox mode with keyboard navigation and typeahead. */
|
|
2203
|
-
Button: (<E extends React$1.ElementType = Comp<ButtonProps,
|
|
2210
|
+
Button: (<E extends React$1.ElementType = Comp<ButtonProps, HTMLButtonElement | HTMLAnchorElement>>(props: Omit<HasPolymorphicAs$1<E>, "children" | "aria-expanded" | "aria-haspopup" | "role" | "aria-controls" | "aria-activedescendant"> & _lumx_core_js_types.HasRequiredLinkHref<E> & ReactToJSX<ComboboxButtonProps$1> & React$1.ComponentProps<E> & {
|
|
2204
2211
|
ref?: ComponentRef<E> | undefined;
|
|
2205
2212
|
}) => React.JSX.Element) & {
|
|
2206
2213
|
displayName: string;
|
|
@@ -2776,7 +2783,7 @@ declare const GenericBlockGapSize: Pick<{
|
|
|
2776
2783
|
readonly medium: "medium";
|
|
2777
2784
|
readonly big: "big";
|
|
2778
2785
|
readonly huge: "huge";
|
|
2779
|
-
}, "big" | "
|
|
2786
|
+
}, "big" | "medium" | "tiny" | "regular" | "huge">;
|
|
2780
2787
|
type GenericBlockGapSize = ValueOf<typeof GenericBlockGapSize>;
|
|
2781
2788
|
|
|
2782
2789
|
interface GenericBlockProps$1 extends FlexBoxProps$1 {
|
|
@@ -2971,7 +2978,7 @@ interface GridColumnProps extends GenericProps$1, ReactToJSX<GridColumnProps$1>
|
|
|
2971
2978
|
*/
|
|
2972
2979
|
declare const GridColumn: Comp<GridColumnProps, HTMLElement>;
|
|
2973
2980
|
|
|
2974
|
-
declare const ICON_SIZES: ("
|
|
2981
|
+
declare const ICON_SIZES: ("m" | "s" | "xxs" | "xs" | "l" | "xl" | "xxl")[];
|
|
2975
2982
|
|
|
2976
2983
|
type IconSizes = (typeof ICON_SIZES)[number];
|
|
2977
2984
|
/**
|
|
@@ -3392,6 +3399,8 @@ interface BaseLightboxProps extends HasClassName, HasTheme, Pick<AriaAttributes,
|
|
|
3392
3399
|
isOpen?: boolean;
|
|
3393
3400
|
/** Whether to keep the dialog open on clickaway or escape press. */
|
|
3394
3401
|
preventAutoClose?: boolean;
|
|
3402
|
+
/** Whether to keep the dialog open on clickaway (overridden by `preventAutoClose`). */
|
|
3403
|
+
preventCloseOnClick?: boolean;
|
|
3395
3404
|
/** Z-axis position. */
|
|
3396
3405
|
zIndex?: number;
|
|
3397
3406
|
}
|
|
@@ -3473,7 +3482,7 @@ interface LinkProps extends GenericProps$1, ReactToJSX<LinkProps$1> {
|
|
|
3473
3482
|
* @param ref Component ref.
|
|
3474
3483
|
* @return React element.
|
|
3475
3484
|
*/
|
|
3476
|
-
declare const Link: Comp<LinkProps,
|
|
3485
|
+
declare const Link: Comp<LinkProps, HTMLButtonElement | HTMLAnchorElement>;
|
|
3477
3486
|
|
|
3478
3487
|
/**
|
|
3479
3488
|
* Defines the props of the component.
|
package/index.js
CHANGED
|
@@ -6498,8 +6498,22 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
|
|
|
6498
6498
|
loadingAnnouncement: new Set()
|
|
6499
6499
|
};
|
|
6500
6500
|
|
|
6501
|
+
/**
|
|
6502
|
+
* Last value seen for each event, kept in sync so pull-based subscribers (React's
|
|
6503
|
+
* `useSyncExternalStore` via `handle.getSnapshot`) can read the current value during their
|
|
6504
|
+
* own render — without relying on a push landing inside a specific async boundary.
|
|
6505
|
+
*
|
|
6506
|
+
* `optionsChange` is special: its push is coalesced into a microtask (see
|
|
6507
|
+
* `notifyVisibilityChange`), but its snapshot here is refreshed synchronously so React can
|
|
6508
|
+
* pick up the change during the same commit that mounted the options, instead of via the
|
|
6509
|
+
* later microtask (which would fire outside `act` in tests). All other events push
|
|
6510
|
+
* synchronously, so caching in `notify` keeps their snapshot current.
|
|
6511
|
+
*/
|
|
6512
|
+
const latestValues = {};
|
|
6513
|
+
|
|
6501
6514
|
/** Notify all subscribers for a given event. */
|
|
6502
6515
|
function notify(event, value) {
|
|
6516
|
+
latestValues[event] = value;
|
|
6503
6517
|
subscribers[event].forEach(cb => cb(value));
|
|
6504
6518
|
}
|
|
6505
6519
|
|
|
@@ -6518,26 +6532,48 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
|
|
|
6518
6532
|
}
|
|
6519
6533
|
|
|
6520
6534
|
/**
|
|
6521
|
-
*
|
|
6522
|
-
*
|
|
6523
|
-
*
|
|
6524
|
-
*
|
|
6525
|
-
* (debounced in a microtask)
|
|
6535
|
+
* The current `optionsChange` snapshot. Refreshed synchronously by `refreshOptionsSnapshot`
|
|
6536
|
+
* (so React can read it via `handle.getSnapshot` during the commit that mounts the options)
|
|
6537
|
+
* and pushed to subscribers on a coalesced microtask by `flushVisibilityChange`
|
|
6538
|
+
* (so Vue reacts once to the final state instead of hitting its recursive-update guard).
|
|
6526
6539
|
*/
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6540
|
+
let optionsSnapshot;
|
|
6541
|
+
/** The last snapshot actually pushed to subscribers, to avoid redundant notifications. */
|
|
6542
|
+
let pushedOptionsSnapshot;
|
|
6543
|
+
|
|
6544
|
+
/**
|
|
6545
|
+
* Recompute the `optionsChange` snapshot when the visible option count changed, or when the
|
|
6546
|
+
* input value changed while the list is empty (so `emptyMessage` callbacks get the updated
|
|
6547
|
+
* query string). Runs synchronously; a new object is created only when the value actually
|
|
6548
|
+
* changes, keeping the reference stable for pull-based subscribers.
|
|
6549
|
+
*/
|
|
6550
|
+
function refreshOptionsSnapshot() {
|
|
6531
6551
|
const visibleCount = getVisibleOptionCount();
|
|
6532
6552
|
const inputValue = trigger?.value ?? '';
|
|
6533
6553
|
const isEmpty = visibleCount === 0;
|
|
6534
6554
|
if (visibleCount !== lastOptionsLength || isEmpty && inputValue !== lastInputValue) {
|
|
6535
6555
|
lastOptionsLength = visibleCount;
|
|
6536
6556
|
lastInputValue = inputValue;
|
|
6537
|
-
|
|
6557
|
+
optionsSnapshot = {
|
|
6538
6558
|
optionsLength: visibleCount,
|
|
6539
6559
|
inputValue
|
|
6540
|
-
}
|
|
6560
|
+
};
|
|
6561
|
+
latestValues.optionsChange = optionsSnapshot;
|
|
6562
|
+
}
|
|
6563
|
+
}
|
|
6564
|
+
|
|
6565
|
+
/**
|
|
6566
|
+
* Notify all registered sections, push `optionsChange` when the snapshot changed since the last
|
|
6567
|
+
* push, and re-evaluate `aria-expanded`. Coalesced into a microtask so many option
|
|
6568
|
+
* registrations in one tick collapse into a single subscriber notification.
|
|
6569
|
+
*/
|
|
6570
|
+
const flushVisibilityChange = debounceMicrotask(() => {
|
|
6571
|
+
for (const [sectionElement] of sectionRegistrations) {
|
|
6572
|
+
notifySection(sectionElement, sectionRegistrations, optionRegistrations);
|
|
6573
|
+
}
|
|
6574
|
+
if (optionsSnapshot !== pushedOptionsSnapshot) {
|
|
6575
|
+
pushedOptionsSnapshot = optionsSnapshot;
|
|
6576
|
+
notify('optionsChange', optionsSnapshot);
|
|
6541
6577
|
}
|
|
6542
6578
|
|
|
6543
6579
|
// Re-evaluate aria-expanded when the combobox is open — visible content may have
|
|
@@ -6547,6 +6583,16 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
|
|
|
6547
6583
|
}
|
|
6548
6584
|
});
|
|
6549
6585
|
|
|
6586
|
+
/**
|
|
6587
|
+
* Called whenever the set of visible options may have changed (option register/unregister,
|
|
6588
|
+
* filter change). Refreshes the snapshot synchronously (for pull-based/React subscribers) then
|
|
6589
|
+
* schedules the coalesced push (for push-based/Vue subscribers).
|
|
6590
|
+
*/
|
|
6591
|
+
function notifyVisibilityChange() {
|
|
6592
|
+
refreshOptionsSnapshot();
|
|
6593
|
+
flushVisibilityChange();
|
|
6594
|
+
}
|
|
6595
|
+
|
|
6550
6596
|
// ── Skeleton loading tracking ──────────────────────────────
|
|
6551
6597
|
|
|
6552
6598
|
/** Delay before announcing loading in the live region (ms). */
|
|
@@ -6931,6 +6977,9 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
|
|
|
6931
6977
|
subscribers[event].delete(callback);
|
|
6932
6978
|
};
|
|
6933
6979
|
},
|
|
6980
|
+
getSnapshot(event) {
|
|
6981
|
+
return latestValues[event];
|
|
6982
|
+
},
|
|
6934
6983
|
destroy() {
|
|
6935
6984
|
detach();
|
|
6936
6985
|
trigger = null;
|
|
@@ -6939,10 +6988,16 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
|
|
|
6939
6988
|
lastOptionsLength = 0;
|
|
6940
6989
|
lastInputValue = '';
|
|
6941
6990
|
lastLoadingState = false;
|
|
6991
|
+
optionsSnapshot = undefined;
|
|
6992
|
+
pushedOptionsSnapshot = undefined;
|
|
6993
|
+
// Drop cached snapshots so `getSnapshot` doesn't return stale values after destroy.
|
|
6994
|
+
for (const key of Object.keys(latestValues)) {
|
|
6995
|
+
delete latestValues[key];
|
|
6996
|
+
}
|
|
6942
6997
|
optionRegistrations.clear();
|
|
6943
6998
|
sectionRegistrations.clear();
|
|
6944
6999
|
skeletonCount = 0;
|
|
6945
|
-
|
|
7000
|
+
flushVisibilityChange.cancel();
|
|
6946
7001
|
clearTimeout(loadingTimer);
|
|
6947
7002
|
announcementSent = false;
|
|
6948
7003
|
// Clear all subscribers
|
|
@@ -7267,6 +7322,203 @@ const ComboboxButton$1 = (props, {
|
|
|
7267
7322
|
/** Same as `React.forwardRef` but inferring Ref type from the `as` prop. */
|
|
7268
7323
|
const forwardRefPolymorphic = React__default.forwardRef;
|
|
7269
7324
|
|
|
7325
|
+
var shim = {exports: {}};
|
|
7326
|
+
|
|
7327
|
+
var useSyncExternalStoreShim_production = {};
|
|
7328
|
+
|
|
7329
|
+
/**
|
|
7330
|
+
* @license React
|
|
7331
|
+
* use-sync-external-store-shim.production.js
|
|
7332
|
+
*
|
|
7333
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7334
|
+
*
|
|
7335
|
+
* This source code is licensed under the MIT license found in the
|
|
7336
|
+
* LICENSE file in the root directory of this source tree.
|
|
7337
|
+
*/
|
|
7338
|
+
|
|
7339
|
+
var hasRequiredUseSyncExternalStoreShim_production;
|
|
7340
|
+
|
|
7341
|
+
function requireUseSyncExternalStoreShim_production () {
|
|
7342
|
+
if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
|
|
7343
|
+
hasRequiredUseSyncExternalStoreShim_production = 1;
|
|
7344
|
+
var React = React__default;
|
|
7345
|
+
function is(x, y) {
|
|
7346
|
+
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
|
|
7347
|
+
}
|
|
7348
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
7349
|
+
useState = React.useState,
|
|
7350
|
+
useEffect = React.useEffect,
|
|
7351
|
+
useLayoutEffect = React.useLayoutEffect,
|
|
7352
|
+
useDebugValue = React.useDebugValue;
|
|
7353
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
7354
|
+
var value = getSnapshot(),
|
|
7355
|
+
_useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),
|
|
7356
|
+
inst = _useState[0].inst,
|
|
7357
|
+
forceUpdate = _useState[1];
|
|
7358
|
+
useLayoutEffect(
|
|
7359
|
+
function () {
|
|
7360
|
+
inst.value = value;
|
|
7361
|
+
inst.getSnapshot = getSnapshot;
|
|
7362
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
|
|
7363
|
+
},
|
|
7364
|
+
[subscribe, value, getSnapshot]
|
|
7365
|
+
);
|
|
7366
|
+
useEffect(
|
|
7367
|
+
function () {
|
|
7368
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
|
|
7369
|
+
return subscribe(function () {
|
|
7370
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
|
|
7371
|
+
});
|
|
7372
|
+
},
|
|
7373
|
+
[subscribe]
|
|
7374
|
+
);
|
|
7375
|
+
useDebugValue(value);
|
|
7376
|
+
return value;
|
|
7377
|
+
}
|
|
7378
|
+
function checkIfSnapshotChanged(inst) {
|
|
7379
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
7380
|
+
inst = inst.value;
|
|
7381
|
+
try {
|
|
7382
|
+
var nextValue = latestGetSnapshot();
|
|
7383
|
+
return !objectIs(inst, nextValue);
|
|
7384
|
+
} catch (error) {
|
|
7385
|
+
return true;
|
|
7386
|
+
}
|
|
7387
|
+
}
|
|
7388
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
7389
|
+
return getSnapshot();
|
|
7390
|
+
}
|
|
7391
|
+
var shim =
|
|
7392
|
+
"undefined" === typeof window ||
|
|
7393
|
+
"undefined" === typeof window.document ||
|
|
7394
|
+
"undefined" === typeof window.document.createElement
|
|
7395
|
+
? useSyncExternalStore$1
|
|
7396
|
+
: useSyncExternalStore$2;
|
|
7397
|
+
useSyncExternalStoreShim_production.useSyncExternalStore =
|
|
7398
|
+
void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
|
|
7399
|
+
return useSyncExternalStoreShim_production;
|
|
7400
|
+
}
|
|
7401
|
+
|
|
7402
|
+
var useSyncExternalStoreShim_development = {};
|
|
7403
|
+
|
|
7404
|
+
/**
|
|
7405
|
+
* @license React
|
|
7406
|
+
* use-sync-external-store-shim.development.js
|
|
7407
|
+
*
|
|
7408
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7409
|
+
*
|
|
7410
|
+
* This source code is licensed under the MIT license found in the
|
|
7411
|
+
* LICENSE file in the root directory of this source tree.
|
|
7412
|
+
*/
|
|
7413
|
+
|
|
7414
|
+
var hasRequiredUseSyncExternalStoreShim_development;
|
|
7415
|
+
|
|
7416
|
+
function requireUseSyncExternalStoreShim_development () {
|
|
7417
|
+
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
7418
|
+
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
7419
|
+
"production" !== process.env.NODE_ENV &&
|
|
7420
|
+
(function () {
|
|
7421
|
+
function is(x, y) {
|
|
7422
|
+
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
|
|
7423
|
+
}
|
|
7424
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
7425
|
+
didWarnOld18Alpha ||
|
|
7426
|
+
void 0 === React.startTransition ||
|
|
7427
|
+
((didWarnOld18Alpha = true),
|
|
7428
|
+
console.error(
|
|
7429
|
+
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
7430
|
+
));
|
|
7431
|
+
var value = getSnapshot();
|
|
7432
|
+
if (!didWarnUncachedGetSnapshot) {
|
|
7433
|
+
var cachedValue = getSnapshot();
|
|
7434
|
+
objectIs(value, cachedValue) ||
|
|
7435
|
+
(console.error(
|
|
7436
|
+
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
7437
|
+
),
|
|
7438
|
+
(didWarnUncachedGetSnapshot = true));
|
|
7439
|
+
}
|
|
7440
|
+
cachedValue = useState({
|
|
7441
|
+
inst: { value: value, getSnapshot: getSnapshot }
|
|
7442
|
+
});
|
|
7443
|
+
var inst = cachedValue[0].inst,
|
|
7444
|
+
forceUpdate = cachedValue[1];
|
|
7445
|
+
useLayoutEffect(
|
|
7446
|
+
function () {
|
|
7447
|
+
inst.value = value;
|
|
7448
|
+
inst.getSnapshot = getSnapshot;
|
|
7449
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
|
|
7450
|
+
},
|
|
7451
|
+
[subscribe, value, getSnapshot]
|
|
7452
|
+
);
|
|
7453
|
+
useEffect(
|
|
7454
|
+
function () {
|
|
7455
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
|
|
7456
|
+
return subscribe(function () {
|
|
7457
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
|
|
7458
|
+
});
|
|
7459
|
+
},
|
|
7460
|
+
[subscribe]
|
|
7461
|
+
);
|
|
7462
|
+
useDebugValue(value);
|
|
7463
|
+
return value;
|
|
7464
|
+
}
|
|
7465
|
+
function checkIfSnapshotChanged(inst) {
|
|
7466
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
7467
|
+
inst = inst.value;
|
|
7468
|
+
try {
|
|
7469
|
+
var nextValue = latestGetSnapshot();
|
|
7470
|
+
return !objectIs(inst, nextValue);
|
|
7471
|
+
} catch (error) {
|
|
7472
|
+
return true;
|
|
7473
|
+
}
|
|
7474
|
+
}
|
|
7475
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
7476
|
+
return getSnapshot();
|
|
7477
|
+
}
|
|
7478
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
|
|
7479
|
+
"function" ===
|
|
7480
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
|
|
7481
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
7482
|
+
var React = React__default,
|
|
7483
|
+
objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
7484
|
+
useState = React.useState,
|
|
7485
|
+
useEffect = React.useEffect,
|
|
7486
|
+
useLayoutEffect = React.useLayoutEffect,
|
|
7487
|
+
useDebugValue = React.useDebugValue,
|
|
7488
|
+
didWarnOld18Alpha = false,
|
|
7489
|
+
didWarnUncachedGetSnapshot = false,
|
|
7490
|
+
shim =
|
|
7491
|
+
"undefined" === typeof window ||
|
|
7492
|
+
"undefined" === typeof window.document ||
|
|
7493
|
+
"undefined" === typeof window.document.createElement
|
|
7494
|
+
? useSyncExternalStore$1
|
|
7495
|
+
: useSyncExternalStore$2;
|
|
7496
|
+
useSyncExternalStoreShim_development.useSyncExternalStore =
|
|
7497
|
+
void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
|
|
7498
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
|
|
7499
|
+
"function" ===
|
|
7500
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
|
|
7501
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
7502
|
+
})();
|
|
7503
|
+
return useSyncExternalStoreShim_development;
|
|
7504
|
+
}
|
|
7505
|
+
|
|
7506
|
+
var hasRequiredShim;
|
|
7507
|
+
|
|
7508
|
+
function requireShim () {
|
|
7509
|
+
if (hasRequiredShim) return shim.exports;
|
|
7510
|
+
hasRequiredShim = 1;
|
|
7511
|
+
|
|
7512
|
+
if (process.env.NODE_ENV === 'production') {
|
|
7513
|
+
shim.exports = requireUseSyncExternalStoreShim_production();
|
|
7514
|
+
} else {
|
|
7515
|
+
shim.exports = requireUseSyncExternalStoreShim_development();
|
|
7516
|
+
}
|
|
7517
|
+
return shim.exports;
|
|
7518
|
+
}
|
|
7519
|
+
|
|
7520
|
+
var shimExports = requireShim();
|
|
7521
|
+
|
|
7270
7522
|
/** Context value shared between Combobox sub-components. */
|
|
7271
7523
|
|
|
7272
7524
|
const ComboboxContext = /*#__PURE__*/createContext(undefined);
|
|
@@ -7286,17 +7538,28 @@ function useComboboxContext() {
|
|
|
7286
7538
|
|
|
7287
7539
|
/**
|
|
7288
7540
|
* Hook to subscribe to a combobox event via the handle's subscriber system.
|
|
7541
|
+
*
|
|
7542
|
+
* Uses `useSyncExternalStore` (shim, for React 17 support) reading the handle's synchronous
|
|
7543
|
+
* `getSnapshot`. This lets React pick up changes during its own commit — notably the
|
|
7544
|
+
* `optionsChange` snapshot, which the handle refreshes synchronously while coalescing the actual
|
|
7545
|
+
* subscriber push into a microtask. Reading the snapshot during commit avoids a state update
|
|
7546
|
+
* landing in the microtask outside `act` (which unit tests report as an un-acted update).
|
|
7547
|
+
*
|
|
7289
7548
|
* Re-subscribes when the handle changes (e.g. trigger mount/unmount).
|
|
7290
7549
|
*/
|
|
7291
7550
|
function useComboboxEvent(event, initialValue) {
|
|
7292
7551
|
const {
|
|
7293
7552
|
handle
|
|
7294
7553
|
} = useComboboxContext();
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7554
|
+
|
|
7555
|
+
// Stable fallback used until the event has fired at least once (or while there is no handle).
|
|
7556
|
+
const initialValueRef = useRef(initialValue);
|
|
7557
|
+
const subscribe = useCallback(onStoreChange => handle?.subscribe(event, onStoreChange) ?? (() => undefined), [handle, event]);
|
|
7558
|
+
const getSnapshot = useCallback(() => {
|
|
7559
|
+
const value = handle?.getSnapshot(event);
|
|
7560
|
+
return value === undefined ? initialValueRef.current : value;
|
|
7298
7561
|
}, [handle, event]);
|
|
7299
|
-
return
|
|
7562
|
+
return shimExports.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
7300
7563
|
}
|
|
7301
7564
|
|
|
7302
7565
|
/**
|
|
@@ -12152,19 +12415,18 @@ function useRegisterId(key, id) {
|
|
|
12152
12415
|
* Subscribe to the id currently registered under `key` in the enclosing ids registry. Re-renders
|
|
12153
12416
|
* the calling component only when that key's id changes.
|
|
12154
12417
|
*
|
|
12418
|
+
* Uses `useSyncExternalStore` (shim, for React 17 support) reading the registry's synchronous
|
|
12419
|
+
* `getId` snapshot: React re-reads it right after subscribing, so an id registered between render
|
|
12420
|
+
* and commit is never missed - no manual re-sync needed.
|
|
12421
|
+
*
|
|
12155
12422
|
* @param key Registry key to read.
|
|
12156
12423
|
* @return The registered id, or `undefined` when none is registered / outside any provider.
|
|
12157
12424
|
*/
|
|
12158
12425
|
function useRegisteredId(key) {
|
|
12159
12426
|
const registry = useContext(IdsRegistryContext);
|
|
12160
|
-
const
|
|
12161
|
-
|
|
12162
|
-
|
|
12163
|
-
// Sync once in case the id was registered between render and this effect running.
|
|
12164
|
-
setId(registry.getId(key));
|
|
12165
|
-
return registry.subscribe(key, () => setId(registry.getId(key)));
|
|
12166
|
-
}, [registry, key]);
|
|
12167
|
-
return id;
|
|
12427
|
+
const subscribe = useCallback(onStoreChange => registry?.subscribe(key, onStoreChange) ?? (() => undefined), [registry, key]);
|
|
12428
|
+
const getSnapshot = useCallback(() => registry?.getId(key), [registry, key]);
|
|
12429
|
+
return shimExports.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
12168
12430
|
}
|
|
12169
12431
|
|
|
12170
12432
|
/**
|
|
@@ -14349,7 +14611,7 @@ const Inner = forwardRef((props, ref) => {
|
|
|
14349
14611
|
focusElement: currentPaginationItemRef,
|
|
14350
14612
|
...forwardedProps,
|
|
14351
14613
|
// Disable the close on click away as we want a custom one here
|
|
14352
|
-
|
|
14614
|
+
preventCloseOnClick: true,
|
|
14353
14615
|
children: /*#__PURE__*/jsx(ClickAwayProvider, {
|
|
14354
14616
|
childrenRefs: clickAwayChildrenRefs,
|
|
14355
14617
|
callback: onClickAway,
|
|
@@ -14552,6 +14814,7 @@ const Lightbox$1 = props => {
|
|
|
14552
14814
|
focusElement,
|
|
14553
14815
|
labelId,
|
|
14554
14816
|
preventAutoClose,
|
|
14817
|
+
preventCloseOnClick,
|
|
14555
14818
|
theme,
|
|
14556
14819
|
zIndex,
|
|
14557
14820
|
isVisible,
|
|
@@ -14600,7 +14863,7 @@ const Lightbox$1 = props => {
|
|
|
14600
14863
|
children: /*#__PURE__*/jsx(ThemeProvider, {
|
|
14601
14864
|
value: undefined,
|
|
14602
14865
|
children: /*#__PURE__*/jsx(ClickAwayProvider, {
|
|
14603
|
-
callback: !preventAutoClose && handleClose,
|
|
14866
|
+
callback: !preventAutoClose && !preventCloseOnClick && handleClose,
|
|
14604
14867
|
childrenRefs: clickAwayRefs,
|
|
14605
14868
|
children: /*#__PURE__*/jsx("div", {
|
|
14606
14869
|
ref: childrenRef,
|