@lumx/react 3.9.2 → 3.9.3

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.js CHANGED
@@ -389,6 +389,11 @@ const DOCUMENT = typeof document !== 'undefined' ? document : undefined;
389
389
  */
390
390
  const IS_BROWSER = typeof navigator !== 'undefined' && !navigator.userAgent.includes('jsdom');
391
391
 
392
+ /**
393
+ * Visually hidden a11y utility class name
394
+ */
395
+ const VISUALLY_HIDDEN = 'visually-hidden';
396
+
392
397
  const _excluded$1s = ["prefix"];
393
398
 
394
399
  /**
@@ -2422,7 +2427,7 @@ const DatePickerControlled = /*#__PURE__*/forwardRef((props, ref) => {
2422
2427
  })),
2423
2428
  label: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
2424
2429
  "aria-live": labelAriaLive,
2425
- className: onMonthChange ? 'visually-hidden' : '',
2430
+ className: onMonthChange ? VISUALLY_HIDDEN : '',
2426
2431
  dir: "auto"
2427
2432
  }, monthYear), onMonthChange && /*#__PURE__*/React__default.createElement(FlexBox, {
2428
2433
  className: `${CLASSNAME$17}__month`,
@@ -2491,7 +2496,7 @@ const DatePickerControlled = /*#__PURE__*/forwardRef((props, ref) => {
2491
2496
  }, /*#__PURE__*/React__default.createElement("span", {
2492
2497
  "aria-hidden": true
2493
2498
  }, formatDayNumber(locale, date)), /*#__PURE__*/React__default.createElement("span", {
2494
- className: "visually-hidden"
2499
+ className: VISUALLY_HIDDEN
2495
2500
  }, date.toLocaleDateString(locale, {
2496
2501
  day: 'numeric',
2497
2502
  month: 'long',
@@ -8356,9 +8361,21 @@ function unref(maybeElement) {
8356
8361
  return maybeElement === null || maybeElement === void 0 ? void 0 : maybeElement.current;
8357
8362
  }
8358
8363
 
8359
- function setTransitionViewName(elementRef, name) {
8360
- const element = unref(elementRef);
8361
- if (element) element.style.viewTransitionName = name;
8364
+ function setupViewTransitionName(elementRef, name) {
8365
+ let originalName = null;
8366
+ return {
8367
+ set() {
8368
+ const element = unref(elementRef);
8369
+ if (!element) return;
8370
+ originalName = element.style.viewTransitionName;
8371
+ element.style.viewTransitionName = name;
8372
+ },
8373
+ unset() {
8374
+ const element = unref(elementRef);
8375
+ if (!element || originalName === null) return;
8376
+ element.style.viewTransitionName = originalName;
8377
+ }
8378
+ };
8362
8379
  }
8363
8380
 
8364
8381
  /**
@@ -8385,21 +8402,18 @@ async function startViewTransition(_ref) {
8385
8402
  return;
8386
8403
  }
8387
8404
 
8388
- // Set transition name on source element
8389
- setTransitionViewName(viewTransitionName.source, viewTransitionName.name);
8405
+ // Setup set/unset transition name on source & target
8406
+ const sourceTransitionName = setupViewTransitionName(viewTransitionName.source, viewTransitionName.name);
8407
+ const targetTransitionName = setupViewTransitionName(viewTransitionName.target, viewTransitionName.name);
8408
+ sourceTransitionName.set();
8390
8409
 
8391
8410
  // Start view transition, apply changes & flush to DOM
8392
8411
  await start(() => {
8393
- // Un-set transition name on source element
8394
- setTransitionViewName(viewTransitionName.source, null);
8412
+ sourceTransitionName.unset();
8395
8413
  flushSync(changes);
8396
-
8397
- // Set transition name on target element
8398
- setTransitionViewName(viewTransitionName.target, viewTransitionName.name);
8414
+ targetTransitionName.set();
8399
8415
  }).updateCallbackDone;
8400
-
8401
- // Un-set transition name on target element
8402
- setTransitionViewName(viewTransitionName.target, null);
8416
+ targetTransitionName.unset();
8403
8417
  }
8404
8418
 
8405
8419
  /** Find image in element including the element */
@@ -8491,9 +8505,9 @@ function useImageLightbox(props) {
8491
8505
  },
8492
8506
  isOpen: true,
8493
8507
  onClose: () => {
8494
- var _prevProps$onClose;
8508
+ var _propsRef$current2, _propsRef$current2$on;
8495
8509
  close();
8496
- prevProps === null || prevProps === void 0 ? void 0 : (_prevProps$onClose = prevProps.onClose) === null || _prevProps$onClose === void 0 ? void 0 : _prevProps$onClose.call(prevProps);
8510
+ (_propsRef$current2 = propsRef.current) === null || _propsRef$current2 === void 0 ? void 0 : (_propsRef$current2$on = _propsRef$current2.onClose) === null || _propsRef$current2$on === void 0 ? void 0 : _propsRef$current2$on.call(_propsRef$current2);
8497
8511
  },
8498
8512
  images,
8499
8513
  activeImageIndex: activeImageIndex || 0
@@ -8564,7 +8578,10 @@ const Inner = /*#__PURE__*/forwardRef((props, ref) => {
8564
8578
  onClose: onClose,
8565
8579
  closeButtonProps: closeButtonProps,
8566
8580
  focusElement: currentPaginationItemRef
8567
- }, forwardedProps), /*#__PURE__*/React__default.createElement(ClickAwayProvider, {
8581
+ }, forwardedProps, {
8582
+ // Disable the close on click away as we want a custom one here
8583
+ preventAutoClose: true
8584
+ }), /*#__PURE__*/React__default.createElement(ClickAwayProvider, {
8568
8585
  childrenRefs: clickAwayChildrenRefs,
8569
8586
  callback: onClickAway
8570
8587
  }, /*#__PURE__*/React__default.createElement(ImageSlideshow, {
@@ -14195,6 +14212,7 @@ const Tooltip = /*#__PURE__*/forwardRef((props, ref) => {
14195
14212
  } = useTooltipOpen(delay, anchorElement);
14196
14213
  const isOpen = (isActivated || forceOpen) && !!label;
14197
14214
  const isMounted = !!label && (isOpen || closeMode === 'hide');
14215
+ const isHidden = !isOpen && closeMode === 'hide';
14198
14216
  const wrappedChildren = useInjectTooltipRef({
14199
14217
  children,
14200
14218
  setAnchorElement,
@@ -14218,9 +14236,8 @@ const Tooltip = /*#__PURE__*/forwardRef((props, ref) => {
14218
14236
  "aria-label": label || '',
14219
14237
  className: classnames(className, handleBasicClasses({
14220
14238
  prefix: CLASSNAME$2,
14221
- position,
14222
- hidden: !isOpen && closeMode === 'hide'
14223
- })),
14239
+ position
14240
+ }), isHidden && VISUALLY_HIDDEN),
14224
14241
  style: _objectSpread2(_objectSpread2({}, styles.popper), {}, {
14225
14242
  zIndex
14226
14243
  })