@lumx/react 3.15.1 → 3.15.2-alpha.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.
- package/index.js +170 -246
- package/index.js.map +1 -1
- package/package.json +3 -8
- package/utils/index.js +13 -15
- package/utils/index.js.map +1 -1
package/index.js
CHANGED
|
@@ -339,12 +339,11 @@ const _isEmpty = value => {
|
|
|
339
339
|
* @param value The value of the type of the CSS class (e.g.: 'primary', 'button', ...).
|
|
340
340
|
* @return The basic CSS class.
|
|
341
341
|
*/
|
|
342
|
-
function getBasicClass(
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
} = _ref;
|
|
342
|
+
function getBasicClass({
|
|
343
|
+
prefix,
|
|
344
|
+
type,
|
|
345
|
+
value
|
|
346
|
+
}) {
|
|
348
347
|
if (isBoolean(value)) {
|
|
349
348
|
if (!value) {
|
|
350
349
|
// False value should not return a class.
|
|
@@ -370,11 +369,11 @@ function getBasicClass(_ref) {
|
|
|
370
369
|
* be used in the classname to represent the value of the given prop.
|
|
371
370
|
* @return All LumX basic CSS classes.
|
|
372
371
|
*/
|
|
373
|
-
function handleBasicClasses(
|
|
372
|
+
function handleBasicClasses(_ref) {
|
|
374
373
|
let {
|
|
375
374
|
prefix
|
|
376
|
-
} =
|
|
377
|
-
props = _objectWithoutProperties(
|
|
375
|
+
} = _ref,
|
|
376
|
+
props = _objectWithoutProperties(_ref, _excluded$1t);
|
|
378
377
|
const otherClasses = {};
|
|
379
378
|
if (!isEmpty(props)) {
|
|
380
379
|
Object.keys(props).forEach(prop => {
|
|
@@ -751,8 +750,7 @@ AlertDialog.defaultProps = DEFAULT_PROPS$13;
|
|
|
751
750
|
* @param element Element to focus.
|
|
752
751
|
* @param shouldFocus Boolean flag to trigger the focus
|
|
753
752
|
*/
|
|
754
|
-
function useFocus(element) {
|
|
755
|
-
let shouldFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
753
|
+
function useFocus(element, shouldFocus = true) {
|
|
756
754
|
const [wasFocus, setWasFocus] = useState(false);
|
|
757
755
|
useEffect(() => {
|
|
758
756
|
if (shouldFocus && wasFocus !== shouldFocus && element) {
|
|
@@ -770,10 +768,7 @@ function useFocus(element) {
|
|
|
770
768
|
* @param refs React references to merge.
|
|
771
769
|
* @return the merged ref.
|
|
772
770
|
*/
|
|
773
|
-
function mergeRefs() {
|
|
774
|
-
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
775
|
-
refs[_key] = arguments[_key];
|
|
776
|
-
}
|
|
771
|
+
function mergeRefs(...refs) {
|
|
777
772
|
return value => refs.forEach(ref => {
|
|
778
773
|
if (typeof ref === 'function') {
|
|
779
774
|
ref(value);
|
|
@@ -787,10 +782,7 @@ function mergeRefs() {
|
|
|
787
782
|
/**
|
|
788
783
|
* Same as `mergeRefs` but memoized
|
|
789
784
|
*/
|
|
790
|
-
const useMergeRefs =
|
|
791
|
-
for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
792
|
-
refs[_key2] = arguments[_key2];
|
|
793
|
-
}
|
|
785
|
+
const useMergeRefs = (...refs) => {
|
|
794
786
|
return useMemo(() => mergeRefs(...refs),
|
|
795
787
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
796
788
|
refs);
|
|
@@ -1263,14 +1255,11 @@ const _excluded$1m = ["linkAs"];
|
|
|
1263
1255
|
* @param children Link children.
|
|
1264
1256
|
* @return A link.
|
|
1265
1257
|
*/
|
|
1266
|
-
const renderLink =
|
|
1258
|
+
const renderLink = (_ref, ...children) => {
|
|
1267
1259
|
let {
|
|
1268
1260
|
linkAs
|
|
1269
1261
|
} = _ref,
|
|
1270
1262
|
forwardedProps = _objectWithoutProperties(_ref, _excluded$1m);
|
|
1271
|
-
for (var _len = arguments.length, children = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1272
|
-
children[_key - 1] = arguments[_key];
|
|
1273
|
-
}
|
|
1274
1263
|
return /*#__PURE__*/React__default.createElement(linkAs || 'a', forwardedProps, ...children);
|
|
1275
1264
|
};
|
|
1276
1265
|
|
|
@@ -1862,8 +1851,7 @@ const INITIAL_STATE_ACTIVE_CHIP = -1;
|
|
|
1862
1851
|
*
|
|
1863
1852
|
* @return chip navigation tools.
|
|
1864
1853
|
*/
|
|
1865
|
-
const useChipGroupNavigation =
|
|
1866
|
-
let initialActiveChip = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : INITIAL_STATE_ACTIVE_CHIP;
|
|
1854
|
+
const useChipGroupNavigation = (chips, onChipDeleted, initialActiveChip = INITIAL_STATE_ACTIVE_CHIP) => {
|
|
1867
1855
|
const [wasBackspacePressed, setWasBackspacePressed] = useState(false);
|
|
1868
1856
|
const [activeChip, setActiveChip] = useState(initialActiveChip);
|
|
1869
1857
|
|
|
@@ -2121,8 +2109,7 @@ const FIRST_DAY_FOR_LOCALES = [{
|
|
|
2121
2109
|
}];
|
|
2122
2110
|
|
|
2123
2111
|
/** Find first day of week for locale from the constant */
|
|
2124
|
-
const getFromConstant =
|
|
2125
|
-
let searchBy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'code';
|
|
2112
|
+
const getFromConstant = (locale, searchBy = 'code') => {
|
|
2126
2113
|
// Search for locale (lang + region)
|
|
2127
2114
|
for (const {
|
|
2128
2115
|
localeRX,
|
|
@@ -2194,10 +2181,7 @@ const MONTH_ROW_COUNT = 6;
|
|
|
2194
2181
|
* Get month calendar.
|
|
2195
2182
|
* A list of weeks with days indexed by week day number
|
|
2196
2183
|
*/
|
|
2197
|
-
const getMonthCalendar =
|
|
2198
|
-
let referenceDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date();
|
|
2199
|
-
let rangeMinDate = arguments.length > 2 ? arguments[2] : undefined;
|
|
2200
|
-
let rangeMaxDate = arguments.length > 3 ? arguments[3] : undefined;
|
|
2184
|
+
const getMonthCalendar = (locale, referenceDate = new Date(), rangeMinDate, rangeMaxDate) => {
|
|
2201
2185
|
const month = referenceDate.getMonth();
|
|
2202
2186
|
const iterDate = new Date(referenceDate);
|
|
2203
2187
|
iterDate.setDate(1);
|
|
@@ -2452,22 +2436,19 @@ const DatePickerControlled = forwardRef((props, ref) => {
|
|
|
2452
2436
|
className: `${CLASSNAME$17}__calendar`
|
|
2453
2437
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2454
2438
|
className: `${CLASSNAME$17}__week-days ${CLASSNAME$17}__days-wrapper`
|
|
2455
|
-
}, weekDays.map(
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
className: "visually-hidden"
|
|
2469
|
-
}, long));
|
|
2470
|
-
})), /*#__PURE__*/React__default.createElement("div", {
|
|
2439
|
+
}, weekDays.map(({
|
|
2440
|
+
letter,
|
|
2441
|
+
number,
|
|
2442
|
+
long
|
|
2443
|
+
}) => /*#__PURE__*/React__default.createElement("div", {
|
|
2444
|
+
key: number,
|
|
2445
|
+
className: `${CLASSNAME$17}__day-wrapper`
|
|
2446
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
2447
|
+
className: `${CLASSNAME$17}__week-day`,
|
|
2448
|
+
"aria-hidden": true
|
|
2449
|
+
}, letter.toLocaleUpperCase()), /*#__PURE__*/React__default.createElement("span", {
|
|
2450
|
+
className: "visually-hidden"
|
|
2451
|
+
}, long)))), /*#__PURE__*/React__default.createElement("div", {
|
|
2471
2452
|
className: `${CLASSNAME$17}__month-days ${CLASSNAME$17}__days-wrapper`
|
|
2472
2453
|
}, weeks.flatMap((week, weekIndex) => {
|
|
2473
2454
|
return weekDays.map((weekDay, dayIndex) => {
|
|
@@ -2692,8 +2673,7 @@ const LISTENERS = makeListenerTowerContext();
|
|
|
2692
2673
|
* @param callback Callback
|
|
2693
2674
|
* @param closeOnEscape Disables the hook when false
|
|
2694
2675
|
*/
|
|
2695
|
-
function useCallbackOnEscape(callback) {
|
|
2696
|
-
let closeOnEscape = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2676
|
+
function useCallbackOnEscape(callback, closeOnEscape = true) {
|
|
2697
2677
|
useEffect(() => {
|
|
2698
2678
|
const rootElement = DOCUMENT === null || DOCUMENT === void 0 ? void 0 : DOCUMENT.body;
|
|
2699
2679
|
if (!closeOnEscape || !callback || !rootElement) {
|
|
@@ -3424,10 +3404,7 @@ const INITIAL_INDEX$1 = -1;
|
|
|
3424
3404
|
* @param preventTabOnEnteredValue determines whether upon TAB, if there is a value entered, the event is prevented or not.
|
|
3425
3405
|
* @return useKeyboardListNavigation helpers.
|
|
3426
3406
|
*/
|
|
3427
|
-
const useKeyboardListNavigation =
|
|
3428
|
-
let keepFocusAfterSelection = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
3429
|
-
let initialIndex = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : INITIAL_INDEX$1;
|
|
3430
|
-
let preventTabOnEnteredValue = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
|
|
3407
|
+
const useKeyboardListNavigation = (items, ref, onListItemSelected, onListItemNavigated, onEnterPressed, onBackspacePressed, keepFocusAfterSelection = false, initialIndex = INITIAL_INDEX$1, preventTabOnEnteredValue = true) => {
|
|
3431
3408
|
const [activeItemIndex, setActiveItemIndex] = useState(initialIndex);
|
|
3432
3409
|
|
|
3433
3410
|
/**
|
|
@@ -3601,11 +3578,10 @@ const DEFAULT_PROPS$R = {
|
|
|
3601
3578
|
* Check if the list item is clickable.
|
|
3602
3579
|
* @return `true` if the list item is clickable; `false` otherwise.
|
|
3603
3580
|
*/
|
|
3604
|
-
function isClickable(
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
} = _ref;
|
|
3581
|
+
function isClickable({
|
|
3582
|
+
linkProps,
|
|
3583
|
+
onItemSelected
|
|
3584
|
+
}) {
|
|
3609
3585
|
return !isEmpty(linkProps === null || linkProps === void 0 ? void 0 : linkProps.href) || !!onItemSelected;
|
|
3610
3586
|
}
|
|
3611
3587
|
|
|
@@ -3942,8 +3918,7 @@ if (process.env.NODE_ENV === 'production') {
|
|
|
3942
3918
|
* remove this function and then remove react-is from the dependencies
|
|
3943
3919
|
*/
|
|
3944
3920
|
function flattenChildren(children) {
|
|
3945
|
-
function recur(nodes) {
|
|
3946
|
-
let keys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
3921
|
+
function recur(nodes, keys = []) {
|
|
3947
3922
|
return Children.toArray(nodes).reduce((acc, node, index) => {
|
|
3948
3923
|
var _get;
|
|
3949
3924
|
const nodeKeys = keys.concat((_get = get(node, 'key')) !== null && _get !== void 0 ? _get : index);
|
|
@@ -4202,10 +4177,9 @@ const skipRender = (predicate, Component) => {
|
|
|
4202
4177
|
*
|
|
4203
4178
|
* The callback must be wrapped in a React ref to avoid updating the `useLayoutEffect` before the un-mount
|
|
4204
4179
|
*/
|
|
4205
|
-
const OnBeforeUnmount =
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
} = _ref;
|
|
4180
|
+
const OnBeforeUnmount = ({
|
|
4181
|
+
callbackRef
|
|
4182
|
+
}) => {
|
|
4209
4183
|
useLayoutEffect(() => {
|
|
4210
4184
|
return () => {
|
|
4211
4185
|
var _callbackRef$current;
|
|
@@ -4223,12 +4197,11 @@ const OnBeforeUnmount = _ref => {
|
|
|
4223
4197
|
* Provides an unmount sentinel to inject in the popover to detect when it closes and restore the focus to the
|
|
4224
4198
|
* anchor if needed.
|
|
4225
4199
|
*/
|
|
4226
|
-
function useRestoreFocusOnClose(
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
} = _ref;
|
|
4200
|
+
function useRestoreFocusOnClose({
|
|
4201
|
+
focusAnchorOnClose,
|
|
4202
|
+
anchorRef,
|
|
4203
|
+
parentElement
|
|
4204
|
+
}, popoverElement) {
|
|
4232
4205
|
const onBeforeUnmountRef = React__default.useRef();
|
|
4233
4206
|
React__default.useEffect(() => {
|
|
4234
4207
|
if (!popoverElement || !focusAnchorOnClose) {
|
|
@@ -6345,23 +6318,20 @@ var usePopper$1 = function usePopper(referenceElement, popperElement, options) {
|
|
|
6345
6318
|
};
|
|
6346
6319
|
|
|
6347
6320
|
/** Stub usePopper for use outside of browsers */
|
|
6348
|
-
const useStubPopper = (_a, _p,
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
popper: {
|
|
6355
|
-
'data-popper-placement': placement
|
|
6356
|
-
}
|
|
6357
|
-
},
|
|
6358
|
-
styles: {
|
|
6359
|
-
popper: {
|
|
6360
|
-
transform: 'translate(1, 1)'
|
|
6361
|
-
}
|
|
6321
|
+
const useStubPopper = (_a, _p, {
|
|
6322
|
+
placement
|
|
6323
|
+
}) => ({
|
|
6324
|
+
attributes: {
|
|
6325
|
+
popper: {
|
|
6326
|
+
'data-popper-placement': placement
|
|
6362
6327
|
}
|
|
6363
|
-
}
|
|
6364
|
-
|
|
6328
|
+
},
|
|
6329
|
+
styles: {
|
|
6330
|
+
popper: {
|
|
6331
|
+
transform: 'translate(1, 1)'
|
|
6332
|
+
}
|
|
6333
|
+
}
|
|
6334
|
+
});
|
|
6365
6335
|
|
|
6366
6336
|
/** Switch hook implementation between environment */
|
|
6367
6337
|
const usePopper = IS_BROWSER ? usePopper$1 : useStubPopper;
|
|
@@ -6421,17 +6391,15 @@ const sameWidth = memoize(anchorWidthOption => ({
|
|
|
6421
6391
|
enabled: true,
|
|
6422
6392
|
phase: 'beforeWrite',
|
|
6423
6393
|
requires: ['computeStyles'],
|
|
6424
|
-
fn(
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
} = _ref;
|
|
6394
|
+
fn({
|
|
6395
|
+
state
|
|
6396
|
+
}) {
|
|
6428
6397
|
// eslint-disable-next-line no-param-reassign
|
|
6429
6398
|
state.styles.popper[anchorWidthOption] = `${state.rects.reference.width}px`;
|
|
6430
6399
|
},
|
|
6431
|
-
effect(
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
} = _ref2;
|
|
6400
|
+
effect({
|
|
6401
|
+
state
|
|
6402
|
+
}) {
|
|
6435
6403
|
// eslint-disable-next-line no-param-reassign
|
|
6436
6404
|
state.elements.popper.style[anchorWidthOption] = `${state.elements.reference.offsetWidth}px`;
|
|
6437
6405
|
}
|
|
@@ -6445,12 +6413,11 @@ const maxSize = {
|
|
|
6445
6413
|
enabled: true,
|
|
6446
6414
|
phase: 'main',
|
|
6447
6415
|
requiresIfExists: ['offset', 'preventOverflow', 'flip'],
|
|
6448
|
-
fn(
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
} = _ref3;
|
|
6416
|
+
fn({
|
|
6417
|
+
state,
|
|
6418
|
+
name,
|
|
6419
|
+
options
|
|
6420
|
+
}) {
|
|
6454
6421
|
const overflow = detectOverflow(state, options);
|
|
6455
6422
|
const {
|
|
6456
6423
|
y = 0,
|
|
@@ -6479,10 +6446,9 @@ const applyMaxHeight = {
|
|
|
6479
6446
|
enabled: true,
|
|
6480
6447
|
phase: 'beforeWrite',
|
|
6481
6448
|
requires: ['maxSize'],
|
|
6482
|
-
fn(
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
} = _ref4;
|
|
6449
|
+
fn({
|
|
6450
|
+
state
|
|
6451
|
+
}) {
|
|
6486
6452
|
const {
|
|
6487
6453
|
height
|
|
6488
6454
|
} = state.modifiersData.maxSize;
|
|
@@ -6490,19 +6456,18 @@ const applyMaxHeight = {
|
|
|
6490
6456
|
state.elements.popper.style.maxHeight = `${height - ARROW_SIZE$1}px`;
|
|
6491
6457
|
}
|
|
6492
6458
|
};
|
|
6493
|
-
function usePopoverStyle(
|
|
6459
|
+
function usePopoverStyle({
|
|
6460
|
+
offset,
|
|
6461
|
+
hasArrow,
|
|
6462
|
+
fitToAnchorWidth,
|
|
6463
|
+
fitWithinViewportHeight,
|
|
6464
|
+
boundaryRef,
|
|
6465
|
+
anchorRef,
|
|
6466
|
+
placement,
|
|
6467
|
+
style,
|
|
6468
|
+
zIndex
|
|
6469
|
+
}) {
|
|
6494
6470
|
var _offset$along, _offset$away, _state$placement, _state$rects$popper$y, _state$rects, _state$rects$popper;
|
|
6495
|
-
let {
|
|
6496
|
-
offset,
|
|
6497
|
-
hasArrow,
|
|
6498
|
-
fitToAnchorWidth,
|
|
6499
|
-
fitWithinViewportHeight,
|
|
6500
|
-
boundaryRef,
|
|
6501
|
-
anchorRef,
|
|
6502
|
-
placement,
|
|
6503
|
-
style,
|
|
6504
|
-
zIndex
|
|
6505
|
-
} = _ref5;
|
|
6506
6471
|
const [popperElement, setPopperElement] = useState(null);
|
|
6507
6472
|
const [arrowElement, setArrowElement] = useState(null);
|
|
6508
6473
|
const actualOffset = [(_offset$along = offset === null || offset === void 0 ? void 0 : offset.along) !== null && _offset$along !== void 0 ? _offset$along : 0, ((_offset$away = offset === null || offset === void 0 ? void 0 : offset.away) !== null && _offset$away !== void 0 ? _offset$away : 0) + (hasArrow ? ARROW_SIZE$1 : 0)];
|
|
@@ -6752,9 +6717,7 @@ const SCROLL_TRIGGER_MARGIN = 5;
|
|
|
6752
6717
|
* @param [callback] A callback function to call when the bottom of the reference element is reached.
|
|
6753
6718
|
* @param [callbackOnMount] A callback function to call when the component is mounted.
|
|
6754
6719
|
*/
|
|
6755
|
-
const useInfiniteScroll =
|
|
6756
|
-
let callbackOnMount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
6757
|
-
let scrollTriggerMargin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : SCROLL_TRIGGER_MARGIN;
|
|
6720
|
+
const useInfiniteScroll = (ref, callback, callbackOnMount = false, scrollTriggerMargin = SCROLL_TRIGGER_MARGIN) => {
|
|
6758
6721
|
useEffect(() => {
|
|
6759
6722
|
const {
|
|
6760
6723
|
current
|
|
@@ -7238,14 +7201,11 @@ const DEFAULT_VALUE = {};
|
|
|
7238
7201
|
* Tooltip react context simply used as a marker to know when parent react node have a tooltip
|
|
7239
7202
|
*/
|
|
7240
7203
|
const TooltipContext = /*#__PURE__*/React__default.createContext(undefined);
|
|
7241
|
-
const TooltipContextProvider =
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
value: DEFAULT_VALUE
|
|
7247
|
-
}, children);
|
|
7248
|
-
};
|
|
7204
|
+
const TooltipContextProvider = ({
|
|
7205
|
+
children
|
|
7206
|
+
}) => /*#__PURE__*/React__default.createElement(TooltipContext.Provider, {
|
|
7207
|
+
value: DEFAULT_VALUE
|
|
7208
|
+
}, children);
|
|
7249
7209
|
const useTooltipContext = () => React__default.useContext(TooltipContext);
|
|
7250
7210
|
|
|
7251
7211
|
/**
|
|
@@ -7449,11 +7409,10 @@ Heading.defaultProps = DEFAULT_PROPS$J;
|
|
|
7449
7409
|
/**
|
|
7450
7410
|
* Provide a new heading level context.
|
|
7451
7411
|
*/
|
|
7452
|
-
const HeadingLevelProvider =
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
} = _ref;
|
|
7412
|
+
const HeadingLevelProvider = ({
|
|
7413
|
+
children,
|
|
7414
|
+
level
|
|
7415
|
+
}) => {
|
|
7457
7416
|
const {
|
|
7458
7417
|
level: contextLevel
|
|
7459
7418
|
} = useHeadingLevel();
|
|
@@ -8020,18 +7979,12 @@ function usePointerZoom(scrollAreaRef, onScaleChange, animateScroll) {
|
|
|
8020
7979
|
|
|
8021
7980
|
// Centered point between all pointers
|
|
8022
7981
|
const centerPoint = {
|
|
8023
|
-
x: pointers.reduce((x,
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
}, 0) / pointers.length
|
|
8029
|
-
y: pointers.reduce((y, _ref2) => {
|
|
8030
|
-
let {
|
|
8031
|
-
clientY
|
|
8032
|
-
} = _ref2;
|
|
8033
|
-
return y + clientY;
|
|
8034
|
-
}, 0) / pointers.length
|
|
7982
|
+
x: pointers.reduce((x, {
|
|
7983
|
+
clientX
|
|
7984
|
+
}) => x + clientX, 0) / pointers.length,
|
|
7985
|
+
y: pointers.reduce((y, {
|
|
7986
|
+
clientY
|
|
7987
|
+
}) => y + clientY, 0) / pointers.length
|
|
8035
7988
|
};
|
|
8036
7989
|
|
|
8037
7990
|
// Movement of the center point
|
|
@@ -8235,19 +8188,18 @@ const ImageSlide = /*#__PURE__*/React__default.memo(props => {
|
|
|
8235
8188
|
|
|
8236
8189
|
const _excluded$V = ["image", "imgRef"];
|
|
8237
8190
|
/** Internal image slideshow component for ImageLightbox */
|
|
8238
|
-
const ImageSlideshow =
|
|
8191
|
+
const ImageSlideshow = ({
|
|
8192
|
+
activeImageIndex,
|
|
8193
|
+
images,
|
|
8194
|
+
slideGroupLabel,
|
|
8195
|
+
zoomInButtonProps,
|
|
8196
|
+
zoomOutButtonProps,
|
|
8197
|
+
slideshowControlsProps,
|
|
8198
|
+
currentPaginationItemRef,
|
|
8199
|
+
footerRef,
|
|
8200
|
+
activeImageRef
|
|
8201
|
+
}) => {
|
|
8239
8202
|
var _images$activeIndex, _images$activeIndex2, _images$activeIndex3;
|
|
8240
|
-
let {
|
|
8241
|
-
activeImageIndex,
|
|
8242
|
-
images,
|
|
8243
|
-
slideGroupLabel,
|
|
8244
|
-
zoomInButtonProps,
|
|
8245
|
-
zoomOutButtonProps,
|
|
8246
|
-
slideshowControlsProps,
|
|
8247
|
-
currentPaginationItemRef,
|
|
8248
|
-
footerRef,
|
|
8249
|
-
activeImageRef
|
|
8250
|
-
} = _ref;
|
|
8251
8203
|
const {
|
|
8252
8204
|
activeIndex,
|
|
8253
8205
|
slideshowId,
|
|
@@ -8300,10 +8252,7 @@ const ImageSlideshow = _ref => {
|
|
|
8300
8252
|
const onScaleChange = React__default.useMemo(() => {
|
|
8301
8253
|
if (!zoomEnabled) return undefined;
|
|
8302
8254
|
return newScale => {
|
|
8303
|
-
setScale(
|
|
8304
|
-
let prevScale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
8305
|
-
return Math.max(1, newScale * prevScale);
|
|
8306
|
-
});
|
|
8255
|
+
setScale((prevScale = 1) => Math.max(1, newScale * prevScale));
|
|
8307
8256
|
};
|
|
8308
8257
|
}, [zoomEnabled]);
|
|
8309
8258
|
const zoomIn = React__default.useCallback(() => onScaleChange === null || onScaleChange === void 0 ? void 0 : onScaleChange(1.5), [onScaleChange]);
|
|
@@ -8326,12 +8275,7 @@ const ImageSlideshow = _ref => {
|
|
|
8326
8275
|
return mergeRefs(images === null || images === void 0 ? void 0 : images[index].imgRef, isActive ? activeImageRef : undefined);
|
|
8327
8276
|
},
|
|
8328
8277
|
// memoize based on both arguments
|
|
8329
|
-
|
|
8330
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8331
|
-
args[_key] = arguments[_key];
|
|
8332
|
-
}
|
|
8333
|
-
return args.join();
|
|
8334
|
-
}), [images, activeImageRef]);
|
|
8278
|
+
(...args) => args.join()), [images, activeImageRef]);
|
|
8335
8279
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Slides, {
|
|
8336
8280
|
activeIndex: activeIndex,
|
|
8337
8281
|
slideGroupLabel: slideGroupLabel,
|
|
@@ -8340,12 +8284,12 @@ const ImageSlideshow = _ref => {
|
|
|
8340
8284
|
ref: setSlideshow,
|
|
8341
8285
|
slidesId: slideshowSlidesId,
|
|
8342
8286
|
toggleAutoPlay: toggleAutoPlay
|
|
8343
|
-
}, images.map((
|
|
8287
|
+
}, images.map((_ref, index) => {
|
|
8344
8288
|
let {
|
|
8345
8289
|
image,
|
|
8346
8290
|
imgRef
|
|
8347
|
-
} =
|
|
8348
|
-
imageProps = _objectWithoutProperties(
|
|
8291
|
+
} = _ref,
|
|
8292
|
+
imageProps = _objectWithoutProperties(_ref, _excluded$V);
|
|
8349
8293
|
const isActive = index === activeIndex;
|
|
8350
8294
|
return /*#__PURE__*/React__default.createElement(ImageSlide, {
|
|
8351
8295
|
isActive: isActive,
|
|
@@ -8400,12 +8344,11 @@ function setupViewTransitionName(elementRef, name) {
|
|
|
8400
8344
|
* @param changes callback containing the changes to apply within the view transition.
|
|
8401
8345
|
* @param setViewTransitionName set the `viewTransitionName` style on a `source` & `target` to morph these elements.
|
|
8402
8346
|
*/
|
|
8403
|
-
async function startViewTransition(
|
|
8347
|
+
async function startViewTransition({
|
|
8348
|
+
changes,
|
|
8349
|
+
viewTransitionName
|
|
8350
|
+
}) {
|
|
8404
8351
|
var _document, _document$startViewTr;
|
|
8405
|
-
let {
|
|
8406
|
-
changes,
|
|
8407
|
-
viewTransitionName
|
|
8408
|
-
} = _ref;
|
|
8409
8352
|
const start = (_document = document) === null || _document === void 0 ? void 0 : (_document$startViewTr = _document.startViewTransition) === null || _document$startViewTr === void 0 ? void 0 : _document$startViewTr.bind(document);
|
|
8410
8353
|
const prefersReducedMotion = isReducedMotion();
|
|
8411
8354
|
const {
|
|
@@ -8483,11 +8426,10 @@ function useImageLightbox(props) {
|
|
|
8483
8426
|
}
|
|
8484
8427
|
});
|
|
8485
8428
|
}
|
|
8486
|
-
async function open(triggerElement
|
|
8429
|
+
async function open(triggerElement, {
|
|
8430
|
+
activeImageIndex
|
|
8431
|
+
} = {}) {
|
|
8487
8432
|
var _triggerImageRefs, _propsRef$current, _propsRef$current$ima;
|
|
8488
|
-
let {
|
|
8489
|
-
activeImageIndex
|
|
8490
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8491
8433
|
// If we find an image inside the trigger, animate it in transition with the opening image
|
|
8492
8434
|
const triggerImage = ((_triggerImageRefs = triggerImageRefs[activeImageIndex]) === null || _triggerImageRefs === void 0 ? void 0 : _triggerImageRefs.current) || findImage(triggerElement);
|
|
8493
8435
|
|
|
@@ -10217,14 +10159,13 @@ const ProgressTrackerProvider = props => {
|
|
|
10217
10159
|
};
|
|
10218
10160
|
ProgressTrackerProvider.defaultProps = DEFAULT_PROPS$s;
|
|
10219
10161
|
|
|
10220
|
-
const useRovingTabIndex =
|
|
10221
|
-
|
|
10222
|
-
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
} = _ref;
|
|
10162
|
+
const useRovingTabIndex = ({
|
|
10163
|
+
parentRef,
|
|
10164
|
+
elementSelector,
|
|
10165
|
+
keepTabIndex,
|
|
10166
|
+
onElementFocus,
|
|
10167
|
+
extraDependencies = []
|
|
10168
|
+
}) => {
|
|
10228
10169
|
useEffect(() => {
|
|
10229
10170
|
const parent = parentRef === null || parentRef === void 0 ? void 0 : parentRef.current;
|
|
10230
10171
|
if (!parent) {
|
|
@@ -11105,15 +11046,12 @@ const _excluded$q = ["linkAs", "href"];
|
|
|
11105
11046
|
/**
|
|
11106
11047
|
* Render <button> HTML component, fallbacks to `<a>` when a `href` is provided or a custom component with `linkAs`.
|
|
11107
11048
|
*/
|
|
11108
|
-
const renderButtonOrLink =
|
|
11049
|
+
const renderButtonOrLink = (props, ...children) => {
|
|
11109
11050
|
const {
|
|
11110
11051
|
linkAs,
|
|
11111
11052
|
href
|
|
11112
11053
|
} = props,
|
|
11113
11054
|
forwardedProps = _objectWithoutProperties(props, _excluded$q);
|
|
11114
|
-
for (var _len = arguments.length, children = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
11115
|
-
children[_key - 1] = arguments[_key];
|
|
11116
|
-
}
|
|
11117
11055
|
if (linkAs || href) return renderLink(props, ...children);
|
|
11118
11056
|
return /*#__PURE__*/React__default.createElement('button', _objectSpread2({
|
|
11119
11057
|
type: 'button'
|
|
@@ -11468,10 +11406,7 @@ const DEFAULT_PROPS$h = {
|
|
|
11468
11406
|
* @param precision Precision.
|
|
11469
11407
|
* @return Value in range min - max
|
|
11470
11408
|
*/
|
|
11471
|
-
const computeValueFromPercent =
|
|
11472
|
-
let precision = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
11473
|
-
return Number((min + percent * (max - min)).toFixed(precision));
|
|
11474
|
-
};
|
|
11409
|
+
const computeValueFromPercent = (percent, min, max, precision = 0) => Number((min + percent * (max - min)).toFixed(precision));
|
|
11475
11410
|
|
|
11476
11411
|
/**
|
|
11477
11412
|
* Convert a value in range min - max to a percent value.
|
|
@@ -11599,8 +11534,7 @@ const Slider = forwardRef((props, ref) => {
|
|
|
11599
11534
|
* Move to the next or previous value (i.e. + or - 10%) or next step
|
|
11600
11535
|
* @param previous Should seek the previous value.
|
|
11601
11536
|
*/
|
|
11602
|
-
const hopToValue =
|
|
11603
|
-
let previous = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
11537
|
+
const hopToValue = (previous = false) => {
|
|
11604
11538
|
const oldPercent = computePercentFromValue(value, min, max);
|
|
11605
11539
|
let percent = clamp(oldPercent + (previous ? -0.1 : 0.1), 0, 1);
|
|
11606
11540
|
if (steps) {
|
|
@@ -11753,18 +11687,17 @@ const DEFAULT_OPTIONS = {
|
|
|
11753
11687
|
groupBy: 1,
|
|
11754
11688
|
interval: AUTOPLAY_DEFAULT_INTERVAL
|
|
11755
11689
|
};
|
|
11756
|
-
const useSlideshowControls =
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
|
|
11764
|
-
|
|
11765
|
-
|
|
11766
|
-
|
|
11767
|
-
} = _ref;
|
|
11690
|
+
const useSlideshowControls = ({
|
|
11691
|
+
activeIndex = DEFAULT_OPTIONS.activeIndex,
|
|
11692
|
+
groupBy = DEFAULT_OPTIONS.groupBy,
|
|
11693
|
+
interval = DEFAULT_OPTIONS.interval,
|
|
11694
|
+
autoPlay,
|
|
11695
|
+
defaultActiveIndex,
|
|
11696
|
+
onChange,
|
|
11697
|
+
itemsCount,
|
|
11698
|
+
id,
|
|
11699
|
+
slidesId
|
|
11700
|
+
}) => {
|
|
11768
11701
|
const [currentIndex, setCurrentIndex] = useState(activeIndex);
|
|
11769
11702
|
// Use state instead of a ref to make the slideshow controls update directly when the element is set.
|
|
11770
11703
|
const [element, setElement] = useState(null);
|
|
@@ -11773,8 +11706,7 @@ const useSlideshowControls = _ref => {
|
|
|
11773
11706
|
const slidesCount = Math.ceil(itemsCount / Math.min(groupBy, itemsCount));
|
|
11774
11707
|
|
|
11775
11708
|
// Change current index to display next slide.
|
|
11776
|
-
const goToNextSlide = useCallback(
|
|
11777
|
-
let loopback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
11709
|
+
const goToNextSlide = useCallback((loopback = true) => {
|
|
11778
11710
|
setCurrentIndex(index => {
|
|
11779
11711
|
if (loopback && index === slidesCount - 1) {
|
|
11780
11712
|
// Loopback to the start.
|
|
@@ -11789,8 +11721,7 @@ const useSlideshowControls = _ref => {
|
|
|
11789
11721
|
}, [slidesCount, setCurrentIndex]);
|
|
11790
11722
|
|
|
11791
11723
|
// Change current index to display previous slide.
|
|
11792
|
-
const goToPreviousSlide = useCallback(
|
|
11793
|
-
let loopback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
11724
|
+
const goToPreviousSlide = useCallback((loopback = true) => {
|
|
11794
11725
|
setCurrentIndex(index => {
|
|
11795
11726
|
if (loopback && index === 0) {
|
|
11796
11727
|
// Loopback to the end.
|
|
@@ -11834,16 +11765,14 @@ const useSlideshowControls = _ref => {
|
|
|
11834
11765
|
}, [slidesCount, setCurrentIndex]);
|
|
11835
11766
|
|
|
11836
11767
|
// Handle click or keyboard event to go to next slide.
|
|
11837
|
-
const onNextClick = useCallback(
|
|
11838
|
-
let loopback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
11768
|
+
const onNextClick = useCallback((loopback = true) => {
|
|
11839
11769
|
stopAutoPlay();
|
|
11840
11770
|
setIsForcePaused(true);
|
|
11841
11771
|
goToNextSlide(loopback);
|
|
11842
11772
|
}, [goToNextSlide]);
|
|
11843
11773
|
|
|
11844
11774
|
// Handle click or keyboard event to go to previous slide.
|
|
11845
|
-
const onPreviousClick = useCallback(
|
|
11846
|
-
let loopback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
11775
|
+
const onPreviousClick = useCallback((loopback = true) => {
|
|
11847
11776
|
stopAutoPlay();
|
|
11848
11777
|
setIsForcePaused(true);
|
|
11849
11778
|
goToPreviousSlide(loopback);
|
|
@@ -11910,12 +11839,11 @@ const useSlideshowControls = _ref => {
|
|
|
11910
11839
|
* that any element within the given target will trigger the focus in and focus out events.
|
|
11911
11840
|
* @param options - UseFocusWithinOptions
|
|
11912
11841
|
*/
|
|
11913
|
-
const useFocusWithin =
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
|
|
11917
|
-
|
|
11918
|
-
} = _ref;
|
|
11842
|
+
const useFocusWithin = ({
|
|
11843
|
+
element,
|
|
11844
|
+
onFocusIn,
|
|
11845
|
+
onFocusOut
|
|
11846
|
+
}) => {
|
|
11919
11847
|
useEffect(() => {
|
|
11920
11848
|
if (element) {
|
|
11921
11849
|
element.addEventListener('focusin', onFocusIn);
|
|
@@ -11941,11 +11869,10 @@ const BLOCKED_FOCUS_CLASSNAME = 'focus-blocked';
|
|
|
11941
11869
|
* Manage how slides must behave when visible or not.
|
|
11942
11870
|
* When not visible, they should be hidden from screen readers and not focusable.
|
|
11943
11871
|
*/
|
|
11944
|
-
const useSlideFocusManagement =
|
|
11945
|
-
|
|
11946
|
-
|
|
11947
|
-
|
|
11948
|
-
} = _ref;
|
|
11872
|
+
const useSlideFocusManagement = ({
|
|
11873
|
+
isSlideDisplayed,
|
|
11874
|
+
slideRef
|
|
11875
|
+
}) => {
|
|
11949
11876
|
useEffect(() => {
|
|
11950
11877
|
const element = slideRef === null || slideRef === void 0 ? void 0 : slideRef.current;
|
|
11951
11878
|
if (!element) {
|
|
@@ -13558,13 +13485,12 @@ function useImageLoad(imageURL, imgRef) {
|
|
|
13558
13485
|
}
|
|
13559
13486
|
|
|
13560
13487
|
// Calculate shift to center the focus point in the container.
|
|
13561
|
-
function shiftPosition(
|
|
13562
|
-
|
|
13563
|
-
|
|
13564
|
-
|
|
13565
|
-
|
|
13566
|
-
|
|
13567
|
-
} = _ref;
|
|
13488
|
+
function shiftPosition({
|
|
13489
|
+
scale,
|
|
13490
|
+
focusPoint,
|
|
13491
|
+
imageSize,
|
|
13492
|
+
containerSize
|
|
13493
|
+
}) {
|
|
13568
13494
|
const scaledSize = imageSize / scale;
|
|
13569
13495
|
if (scaledSize === containerSize) return 0;
|
|
13570
13496
|
const scaledFocusHeight = focusPoint * scaledSize;
|
|
@@ -13574,16 +13500,15 @@ function shiftPosition(_ref) {
|
|
|
13574
13500
|
}
|
|
13575
13501
|
|
|
13576
13502
|
// Compute CSS properties to apply the focus point.
|
|
13577
|
-
const useFocusPointStyle = (
|
|
13578
|
-
|
|
13579
|
-
|
|
13580
|
-
|
|
13581
|
-
|
|
13582
|
-
|
|
13583
|
-
|
|
13584
|
-
|
|
13585
|
-
|
|
13586
|
-
} = _ref2;
|
|
13503
|
+
const useFocusPointStyle = ({
|
|
13504
|
+
image,
|
|
13505
|
+
aspectRatio,
|
|
13506
|
+
focusPoint,
|
|
13507
|
+
imgProps: {
|
|
13508
|
+
width,
|
|
13509
|
+
height
|
|
13510
|
+
} = {}
|
|
13511
|
+
}, element, isLoaded) => {
|
|
13587
13512
|
// Get natural image size from imgProps or img element.
|
|
13588
13513
|
const imageSize = useMemo(() => {
|
|
13589
13514
|
// Focus point is not applicable => exit early
|
|
@@ -14018,8 +13943,7 @@ function useTooltipOpen(delay, anchorElement) {
|
|
|
14018
13943
|
};
|
|
14019
13944
|
|
|
14020
13945
|
// Close or cancel opening of tooltip
|
|
14021
|
-
const getClose =
|
|
14022
|
-
let overrideDelay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : closeDelay;
|
|
13946
|
+
const getClose = (overrideDelay = closeDelay) => {
|
|
14023
13947
|
if (!shouldOpen && !timer) return;
|
|
14024
13948
|
shouldOpen = false;
|
|
14025
13949
|
deferUpdate(overrideDelay);
|