@lumx/react 3.20.1-alpha.38 → 3.20.1-alpha.39
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/_internal/Portal.js +159 -0
- package/_internal/Portal.js.map +1 -0
- package/index.d.ts +19 -7
- package/index.js +102 -83
- package/index.js.map +1 -1
- package/package.json +7 -7
- package/utils/index.d.ts +2 -1
- package/utils/index.js +1 -158
- package/utils/index.js.map +1 -1
package/index.js
CHANGED
|
@@ -1,22 +1,34 @@
|
|
|
1
|
-
import { Kind,
|
|
1
|
+
import { Kind, Size, ColorPalette, Emphasis, Theme, AspectRatio, CSS_PREFIX, DIALOG_TRANSITION_DURATION, Orientation, Typography, Alignment, ColorVariant, NOTIFICATION_TRANSITION_DURATION, TOOLTIP_LONG_PRESS_DELAY, TOOLTIP_HOVER_DELAY } from '@lumx/core/js/constants';
|
|
2
2
|
export * from '@lumx/core/js/constants';
|
|
3
3
|
export * from '@lumx/core/js/types';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import React__default, { useState, useEffect, useMemo, useRef, useCallback, Children, isValidElement, cloneElement, useLayoutEffect, createContext, useContext, useReducer } from 'react';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import {
|
|
7
|
+
import { handleBasicClasses, getRootClassName, getBasicClass, getTypographyClassName, fontColorClass, resolveColorWithVariants } from '@lumx/core/js/utils/className';
|
|
8
8
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
import { onEnterPressed, onEscapePressed, onButtonPressed, detectHorizontalSwipe } from '@lumx/core/js/utils';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
10
|
+
import last from 'lodash/last';
|
|
11
|
+
import pull from 'lodash/pull';
|
|
12
|
+
import get from 'lodash/get';
|
|
13
|
+
import concat from 'lodash/concat';
|
|
14
|
+
import dropRight from 'lodash/dropRight';
|
|
15
|
+
import partition from 'lodash/partition';
|
|
16
|
+
import reduce from 'lodash/reduce';
|
|
17
|
+
import { u as useDisabledStateContext, P as Portal, C as ClickAwayProvider } from './_internal/Portal.js';
|
|
18
|
+
import isEmpty from 'lodash/isEmpty';
|
|
13
19
|
import memoize from 'lodash/memoize';
|
|
14
|
-
import
|
|
15
|
-
import
|
|
20
|
+
import isFunction from 'lodash/isFunction';
|
|
21
|
+
import castArray from 'lodash/castArray';
|
|
22
|
+
import pick from 'lodash/pick';
|
|
23
|
+
import noop from 'lodash/noop';
|
|
24
|
+
import isInteger from 'lodash/isInteger';
|
|
16
25
|
import throttle from 'lodash/throttle';
|
|
17
|
-
import
|
|
18
|
-
import
|
|
26
|
+
import range from 'lodash/range';
|
|
27
|
+
import chunk from 'lodash/chunk';
|
|
19
28
|
import ReactDOM from 'react-dom';
|
|
29
|
+
import take from 'lodash/take';
|
|
30
|
+
import isObject from 'lodash/isObject';
|
|
31
|
+
import set from 'lodash/set';
|
|
20
32
|
|
|
21
33
|
const mdiAlert = 'M13 14h-2V9h2m0 9h-2v-2h2M1 21h22L12 2z';
|
|
22
34
|
|
|
@@ -710,7 +722,7 @@ BadgeWrapper.displayName = 'BadgeWrapper';
|
|
|
710
722
|
BadgeWrapper.className = CLASSNAME$1f;
|
|
711
723
|
|
|
712
724
|
/**
|
|
713
|
-
* Properties of a component to use to determine
|
|
725
|
+
* Properties of a component to use to determine it's name.
|
|
714
726
|
* In the order of preference.
|
|
715
727
|
*/
|
|
716
728
|
const NAME_PROPERTIES = ['type', 'type.displayName', 'displayName', 'name', 'type.name', 'props.mdxType', '_reactInternalFiber.elementType.name'];
|
|
@@ -722,7 +734,7 @@ const NAME_PROPERTIES = ['type', 'type.displayName', 'displayName', 'name', 'typ
|
|
|
722
734
|
*/
|
|
723
735
|
const isComponent = component => instance => {
|
|
724
736
|
const componentName = typeof component === 'string' ? component : component.displayName;
|
|
725
|
-
return !!instance
|
|
737
|
+
return !!get(instance, '$$typeof') && NAME_PROPERTIES.some(nameProperty => get(instance, nameProperty) === componentName);
|
|
726
738
|
};
|
|
727
739
|
|
|
728
740
|
/**
|
|
@@ -950,11 +962,11 @@ const Button = forwardRef((props, ref) => {
|
|
|
950
962
|
const buttonClassName = classNames(className, getBasicClass({
|
|
951
963
|
prefix: CLASSNAME$1e,
|
|
952
964
|
type: 'hasLeftIcon',
|
|
953
|
-
value:
|
|
965
|
+
value: !isEmpty(leftIcon)
|
|
954
966
|
}), getBasicClass({
|
|
955
967
|
prefix: CLASSNAME$1e,
|
|
956
968
|
type: 'hasRightIcon',
|
|
957
|
-
value:
|
|
969
|
+
value: !isEmpty(rightIcon)
|
|
958
970
|
}));
|
|
959
971
|
return /*#__PURE__*/jsxs(ButtonRoot, {
|
|
960
972
|
ref: ref,
|
|
@@ -964,7 +976,7 @@ const Button = forwardRef((props, ref) => {
|
|
|
964
976
|
...forwardedProps,
|
|
965
977
|
className: buttonClassName,
|
|
966
978
|
variant: "button",
|
|
967
|
-
children: [leftIcon &&
|
|
979
|
+
children: [leftIcon && !isEmpty(leftIcon) &&
|
|
968
980
|
/*#__PURE__*/
|
|
969
981
|
// Theme is handled in the button scss
|
|
970
982
|
jsx(ThemeProvider, {
|
|
@@ -974,7 +986,7 @@ const Button = forwardRef((props, ref) => {
|
|
|
974
986
|
})
|
|
975
987
|
}), children && (isComponent(Text)(children) ? children : /*#__PURE__*/jsx("span", {
|
|
976
988
|
children: children
|
|
977
|
-
})), rightIcon &&
|
|
989
|
+
})), rightIcon && !isEmpty(rightIcon) &&
|
|
978
990
|
/*#__PURE__*/
|
|
979
991
|
// Theme is handled in the button scss
|
|
980
992
|
jsx(ThemeProvider, {
|
|
@@ -1226,7 +1238,7 @@ Checkbox.defaultProps = DEFAULT_PROPS$X;
|
|
|
1226
1238
|
*/
|
|
1227
1239
|
function useStopPropagation(handler) {
|
|
1228
1240
|
return useCallback(evt => {
|
|
1229
|
-
if (!evt || !handler) {
|
|
1241
|
+
if (!evt || !isFunction(handler)) {
|
|
1230
1242
|
return;
|
|
1231
1243
|
}
|
|
1232
1244
|
handler(evt);
|
|
@@ -1283,7 +1295,9 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1283
1295
|
onKeyDown,
|
|
1284
1296
|
...forwardedProps
|
|
1285
1297
|
} = otherProps;
|
|
1286
|
-
const
|
|
1298
|
+
const hasAfterClick = isFunction(onAfterClick);
|
|
1299
|
+
const hasBeforeClick = isFunction(onBeforeClick);
|
|
1300
|
+
const hasOnClick = isFunction(props.onClick);
|
|
1287
1301
|
const isButton = hasOnClick && !href;
|
|
1288
1302
|
const isClickable = Boolean(hasOnClick) || Boolean(href) || propIsClickable;
|
|
1289
1303
|
|
|
@@ -1293,7 +1307,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1293
1307
|
const handleOnAfterClick = useStopPropagation(onAfterClick);
|
|
1294
1308
|
const handleKeyDown = evt => {
|
|
1295
1309
|
onKeyDown?.(evt);
|
|
1296
|
-
if (
|
|
1310
|
+
if (hasOnClick) {
|
|
1297
1311
|
onEnterPressed(onClick)(evt);
|
|
1298
1312
|
}
|
|
1299
1313
|
};
|
|
@@ -1319,14 +1333,14 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1319
1333
|
unselected: Boolean(!isSelected)
|
|
1320
1334
|
})),
|
|
1321
1335
|
"aria-disabled": isClickable && isAnyDisabled || undefined,
|
|
1322
|
-
onClick: onClick
|
|
1336
|
+
onClick: hasOnClick ? onClick : undefined,
|
|
1323
1337
|
onKeyDown: handleKeyDown,
|
|
1324
1338
|
children: [before &&
|
|
1325
1339
|
/*#__PURE__*/
|
|
1326
1340
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
1327
1341
|
jsx("div", {
|
|
1328
1342
|
className: classNames(`${CLASSNAME$1a}__before`, {
|
|
1329
|
-
[`${CLASSNAME$1a}__before--is-clickable`]:
|
|
1343
|
+
[`${CLASSNAME$1a}__before--is-clickable`]: hasBeforeClick
|
|
1330
1344
|
}),
|
|
1331
1345
|
onClick: handleOnBeforeClick,
|
|
1332
1346
|
children: before
|
|
@@ -1338,7 +1352,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1338
1352
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
1339
1353
|
jsx("div", {
|
|
1340
1354
|
className: classNames(`${CLASSNAME$1a}__after`, {
|
|
1341
|
-
[`${CLASSNAME$1a}__after--is-clickable`]:
|
|
1355
|
+
[`${CLASSNAME$1a}__after--is-clickable`]: hasAfterClick
|
|
1342
1356
|
}),
|
|
1343
1357
|
onClick: handleOnAfterClick,
|
|
1344
1358
|
children: after
|
|
@@ -1727,7 +1741,7 @@ const getMonthCalendar = (locale, referenceDate = new Date(), rangeMinDate, rang
|
|
|
1727
1741
|
if (iterDate.getMonth() === month) {
|
|
1728
1742
|
week[weekDayNumber] = day;
|
|
1729
1743
|
}
|
|
1730
|
-
if (weekDayNumber === lastDayOfWeek
|
|
1744
|
+
if (weekDayNumber === lastDayOfWeek.number) {
|
|
1731
1745
|
weeks.push(week);
|
|
1732
1746
|
rowCount += 1;
|
|
1733
1747
|
week = {};
|
|
@@ -2031,7 +2045,7 @@ const DatePicker = forwardRef((props, ref) => {
|
|
|
2031
2045
|
}
|
|
2032
2046
|
const [selectedMonth, setSelectedMonth] = useState(referenceDate);
|
|
2033
2047
|
const setPrevMonth = () => setSelectedMonth(current => addMonthResetDay(current, -1));
|
|
2034
|
-
const setNextMonth = () => setSelectedMonth(current => addMonthResetDay(current,
|
|
2048
|
+
const setNextMonth = () => setSelectedMonth(current => addMonthResetDay(current, 1));
|
|
2035
2049
|
const onDatePickerChange = newDate => {
|
|
2036
2050
|
onChange(newDate);
|
|
2037
2051
|
};
|
|
@@ -2173,10 +2187,7 @@ function makeListenerTowerContext() {
|
|
|
2173
2187
|
// Disable current listener.
|
|
2174
2188
|
listener.disable();
|
|
2175
2189
|
// Remove current listener.
|
|
2176
|
-
|
|
2177
|
-
if (index > -1) {
|
|
2178
|
-
LISTENERS.splice(index, 1);
|
|
2179
|
-
}
|
|
2190
|
+
pull(LISTENERS, listener);
|
|
2180
2191
|
// Enable previous listener.
|
|
2181
2192
|
last(LISTENERS)?.enable();
|
|
2182
2193
|
}
|
|
@@ -2357,6 +2368,23 @@ function useIntersectionObserver(elements, options) {
|
|
|
2357
2368
|
return intersections;
|
|
2358
2369
|
}
|
|
2359
2370
|
|
|
2371
|
+
/**
|
|
2372
|
+
* Similar to lodash `partition` function but working with multiple predicates.
|
|
2373
|
+
*
|
|
2374
|
+
* @example
|
|
2375
|
+
* const isString = (s) => typeof s === 'string'
|
|
2376
|
+
* const isNumber = (s) => typeof s === 'number'
|
|
2377
|
+
* const [strings, numbers, others] = partitionMulti(['a', 1, 'b', false], [isString, isNumber])
|
|
2378
|
+
* //=> [['a', 'b'], [1], [false]]
|
|
2379
|
+
*
|
|
2380
|
+
* @param elements array of elements
|
|
2381
|
+
* @param predicates array of predicates to apply on elements
|
|
2382
|
+
* @return partitioned elements by the given predicates
|
|
2383
|
+
*/
|
|
2384
|
+
function partitionMulti(elements, predicates) {
|
|
2385
|
+
return reduce(predicates, (partitioned, predicate) => concat(dropRight(partitioned), partition(last(partitioned), predicate)), [elements]);
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2360
2388
|
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
2361
2389
|
|
|
2362
2390
|
// Older browsers don't support event options, feature detect it.
|
|
@@ -2418,7 +2446,7 @@ var preventDefault = function preventDefault(rawEvent) {
|
|
|
2418
2446
|
var setOverflowHidden = function setOverflowHidden(options) {
|
|
2419
2447
|
// If previousBodyPaddingRight is already set, don't set it again.
|
|
2420
2448
|
if (previousBodyPaddingRight === undefined) {
|
|
2421
|
-
var _reserveScrollBarGap =
|
|
2449
|
+
var _reserveScrollBarGap = false;
|
|
2422
2450
|
var scrollBarGap = window.innerWidth - document.documentElement.clientWidth;
|
|
2423
2451
|
|
|
2424
2452
|
if (_reserveScrollBarGap && scrollBarGap > 0) {
|
|
@@ -2495,7 +2523,7 @@ var disableBodyScroll = function disableBodyScroll(targetElement, options) {
|
|
|
2495
2523
|
|
|
2496
2524
|
var lock = {
|
|
2497
2525
|
targetElement: targetElement,
|
|
2498
|
-
options:
|
|
2526
|
+
options: {}
|
|
2499
2527
|
};
|
|
2500
2528
|
|
|
2501
2529
|
locks = [].concat(_toConsumableArray(locks), [lock]);
|
|
@@ -2519,7 +2547,7 @@ var disableBodyScroll = function disableBodyScroll(targetElement, options) {
|
|
|
2519
2547
|
documentListenerAdded = true;
|
|
2520
2548
|
}
|
|
2521
2549
|
} else {
|
|
2522
|
-
setOverflowHidden(
|
|
2550
|
+
setOverflowHidden();
|
|
2523
2551
|
}
|
|
2524
2552
|
};
|
|
2525
2553
|
|
|
@@ -2982,7 +3010,7 @@ const useKeyboardListNavigation = (items, ref, onListItemSelected, onListItemNav
|
|
|
2982
3010
|
onListItemSelected(selectedItem);
|
|
2983
3011
|
resetActiveIndex();
|
|
2984
3012
|
} else if (activeItemIndex === initialIndex && onEnterPressed) {
|
|
2985
|
-
const value = evt.
|
|
3013
|
+
const value = get(evt, 'target.value');
|
|
2986
3014
|
onEnterPressed(value);
|
|
2987
3015
|
resetActiveIndex();
|
|
2988
3016
|
}
|
|
@@ -2993,7 +3021,7 @@ const useKeyboardListNavigation = (items, ref, onListItemSelected, onListItemNav
|
|
|
2993
3021
|
* @param evt - key pressed event
|
|
2994
3022
|
*/
|
|
2995
3023
|
const onTabKeyPressed = evt => {
|
|
2996
|
-
const value = evt.
|
|
3024
|
+
const value = get(evt, 'target.value');
|
|
2997
3025
|
if (preventTabOnEnteredValue && value && value.length > 0) {
|
|
2998
3026
|
preventDefaultAndStopPropagation(evt);
|
|
2999
3027
|
}
|
|
@@ -3089,7 +3117,7 @@ function isClickable({
|
|
|
3089
3117
|
linkProps,
|
|
3090
3118
|
onItemSelected
|
|
3091
3119
|
}) {
|
|
3092
|
-
return
|
|
3120
|
+
return !isEmpty(linkProps?.href) || !!onItemSelected;
|
|
3093
3121
|
}
|
|
3094
3122
|
|
|
3095
3123
|
/**
|
|
@@ -3202,9 +3230,9 @@ function requireReactIs_production_min () {
|
|
|
3202
3230
|
hasRequiredReactIs_production_min = 1;
|
|
3203
3231
|
var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");
|
|
3204
3232
|
function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=g;reactIs_production_min.Element=b;reactIs_production_min.ForwardRef=l;reactIs_production_min.Fragment=d;reactIs_production_min.Lazy=q;reactIs_production_min.Memo=p;reactIs_production_min.Portal=c;reactIs_production_min.Profiler=f;reactIs_production_min.StrictMode=e;reactIs_production_min.Suspense=m;
|
|
3205
|
-
reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return
|
|
3233
|
+
reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return false};reactIs_production_min.isConcurrentMode=function(){return false};reactIs_production_min.isContextConsumer=function(a){return v(a)===h};reactIs_production_min.isContextProvider=function(a){return v(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return v(a)===l};reactIs_production_min.isFragment=function(a){return v(a)===d};reactIs_production_min.isLazy=function(a){return v(a)===q};reactIs_production_min.isMemo=function(a){return v(a)===p};
|
|
3206
3234
|
reactIs_production_min.isPortal=function(a){return v(a)===c};reactIs_production_min.isProfiler=function(a){return v(a)===f};reactIs_production_min.isStrictMode=function(a){return v(a)===e};reactIs_production_min.isSuspense=function(a){return v(a)===m};reactIs_production_min.isSuspenseList=function(a){return v(a)===n};
|
|
3207
|
-
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)
|
|
3235
|
+
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?true:false};reactIs_production_min.typeOf=v;
|
|
3208
3236
|
return reactIs_production_min;
|
|
3209
3237
|
}
|
|
3210
3238
|
|
|
@@ -3468,7 +3496,7 @@ var reactIsExports = requireReactIs();
|
|
|
3468
3496
|
function flattenChildren(children) {
|
|
3469
3497
|
function recur(nodes, keys = []) {
|
|
3470
3498
|
return Children.toArray(nodes).reduce((acc, node, index) => {
|
|
3471
|
-
const nodeKeys = keys.concat(node
|
|
3499
|
+
const nodeKeys = keys.concat(get(node, 'key') ?? index);
|
|
3472
3500
|
if (reactIsExports.isFragment(node)) {
|
|
3473
3501
|
acc.push(...recur(node.props.children, nodeKeys));
|
|
3474
3502
|
} else if (/*#__PURE__*/isValidElement(node)) {
|
|
@@ -3578,7 +3606,7 @@ const useInteractiveList = options => {
|
|
|
3578
3606
|
setActiveItemIndex(nextIndex);
|
|
3579
3607
|
evt.preventDefault();
|
|
3580
3608
|
evt.stopPropagation();
|
|
3581
|
-
onListItemNavigated?.(nextIndex, items[nextIndex]
|
|
3609
|
+
onListItemNavigated?.(nextIndex, get(items, [nextIndex, 'key']));
|
|
3582
3610
|
};
|
|
3583
3611
|
|
|
3584
3612
|
/**
|
|
@@ -4673,7 +4701,6 @@ function detectOverflow(state, options) {
|
|
|
4673
4701
|
var popperOffsets = computeOffsets({
|
|
4674
4702
|
reference: referenceClientRect,
|
|
4675
4703
|
element: popperRect,
|
|
4676
|
-
strategy: 'absolute',
|
|
4677
4704
|
placement: placement
|
|
4678
4705
|
});
|
|
4679
4706
|
var popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
|
|
@@ -5009,7 +5036,6 @@ function popperOffsets(_ref) {
|
|
|
5009
5036
|
state.modifiersData[name] = computeOffsets({
|
|
5010
5037
|
reference: state.rects.reference,
|
|
5011
5038
|
element: state.rects.popper,
|
|
5012
|
-
strategy: 'absolute',
|
|
5013
5039
|
placement: state.placement
|
|
5014
5040
|
});
|
|
5015
5041
|
} // eslint-disable-next-line import/no-unused-modules
|
|
@@ -5920,10 +5946,7 @@ const Placement = {
|
|
|
5920
5946
|
* Popover fit anchor width options.
|
|
5921
5947
|
*/
|
|
5922
5948
|
const FitAnchorWidth = {
|
|
5923
|
-
|
|
5924
|
-
MIN_WIDTH: 'minWidth',
|
|
5925
|
-
WIDTH: 'width'
|
|
5926
|
-
};
|
|
5949
|
+
MIN_WIDTH: 'minWidth'};
|
|
5927
5950
|
/**
|
|
5928
5951
|
* Arrow size (in pixel).
|
|
5929
5952
|
*/
|
|
@@ -6445,7 +6468,7 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
6445
6468
|
|
|
6446
6469
|
// Either take the header in children or create one with the label.
|
|
6447
6470
|
const headerProps = /*#__PURE__*/React__default.isValidElement(header) ? header.props : {};
|
|
6448
|
-
const headerContent =
|
|
6471
|
+
const headerContent = !isEmpty(headerProps.children) ? headerProps.children : /*#__PURE__*/jsx("span", {
|
|
6449
6472
|
className: `${CLASSNAME$$}__label`,
|
|
6450
6473
|
children: label
|
|
6451
6474
|
});
|
|
@@ -6464,7 +6487,7 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
6464
6487
|
const color = theme === Theme.dark ? ColorPalette.light : ColorPalette.dark;
|
|
6465
6488
|
const rootClassName = classNames(className, handleBasicClasses({
|
|
6466
6489
|
hasBackground,
|
|
6467
|
-
hasHeader: !isEmpty(headerProps.children),
|
|
6490
|
+
hasHeader: Boolean(!isEmpty(headerProps.children)),
|
|
6468
6491
|
hasHeaderDivider,
|
|
6469
6492
|
isClose: !isOpen,
|
|
6470
6493
|
isDraggable: Boolean(dragHandle),
|
|
@@ -6659,11 +6682,11 @@ const DEFAULT_PROPS$L = {
|
|
|
6659
6682
|
gap: Size.big,
|
|
6660
6683
|
orientation: Orientation.horizontal
|
|
6661
6684
|
};
|
|
6662
|
-
const Figure = (
|
|
6685
|
+
const Figure = noop.bind({});
|
|
6663
6686
|
const isFigure = isComponentType(Figure);
|
|
6664
|
-
const Content = (
|
|
6687
|
+
const Content = noop.bind({});
|
|
6665
6688
|
const isContent = isComponentType(Content);
|
|
6666
|
-
const Actions = (
|
|
6689
|
+
const Actions = noop.bind({});
|
|
6667
6690
|
const isActions = isComponentType(Actions);
|
|
6668
6691
|
|
|
6669
6692
|
/**
|
|
@@ -6700,7 +6723,7 @@ const BaseGenericBlock = forwardRef((props, ref) => {
|
|
|
6700
6723
|
contentChildProps: contentChild?.props,
|
|
6701
6724
|
actionsChild,
|
|
6702
6725
|
actionsChildProps: actionsChild?.props,
|
|
6703
|
-
otherChildren: otherChildren.filter(child =>
|
|
6726
|
+
otherChildren: otherChildren.filter(child => !isEmpty(child))
|
|
6704
6727
|
};
|
|
6705
6728
|
}, [children]);
|
|
6706
6729
|
return /*#__PURE__*/jsxs(FlexBox, {
|
|
@@ -6750,13 +6773,7 @@ const GenericBlock = Object.assign(BaseGenericBlock, {
|
|
|
6750
6773
|
/**
|
|
6751
6774
|
* Accepted gap sizes for the generic block.
|
|
6752
6775
|
*/
|
|
6753
|
-
const GenericBlockGapSize =
|
|
6754
|
-
tiny: Size.tiny,
|
|
6755
|
-
regular: Size.regular,
|
|
6756
|
-
medium: Size.medium,
|
|
6757
|
-
big: Size.big,
|
|
6758
|
-
huge: Size.huge
|
|
6759
|
-
};
|
|
6776
|
+
const GenericBlockGapSize = pick(Size, ['tiny', 'regular', 'medium', 'big', 'huge']);
|
|
6760
6777
|
|
|
6761
6778
|
const DEFAULT_VALUE = {};
|
|
6762
6779
|
|
|
@@ -7129,7 +7146,7 @@ const GridColumn = forwardRef((props, ref) => {
|
|
|
7129
7146
|
className: classNames(className, CLASSNAME$T),
|
|
7130
7147
|
style: {
|
|
7131
7148
|
...style,
|
|
7132
|
-
['--lumx-grid-column-item-min-width']:
|
|
7149
|
+
['--lumx-grid-column-item-min-width']: isInteger(itemMinWidth) && `${itemMinWidth}px`,
|
|
7133
7150
|
['--lumx-grid-column-columns']: maxColumns,
|
|
7134
7151
|
['--lumx-grid-column-gap']: gap && `var(--lumx-spacing-unit-${gap})`
|
|
7135
7152
|
},
|
|
@@ -8822,7 +8839,7 @@ const Mosaic = forwardRef((props, ref) => {
|
|
|
8822
8839
|
}),
|
|
8823
8840
|
children: /*#__PURE__*/jsx("div", {
|
|
8824
8841
|
className: `${CLASSNAME$G}__wrapper`,
|
|
8825
|
-
children: thumbnails
|
|
8842
|
+
children: take(thumbnails, 4).map((thumbnail, index) => {
|
|
8826
8843
|
const {
|
|
8827
8844
|
image,
|
|
8828
8845
|
onClick,
|
|
@@ -9138,7 +9155,9 @@ const Notification = forwardRef((props, ref) => {
|
|
|
9138
9155
|
const isVisible = useTransitionVisibility(rootRef, !!isOpen, NOTIFICATION_TRANSITION_DURATION);
|
|
9139
9156
|
const hasAction = Boolean(onActionClick) && Boolean(actionLabel);
|
|
9140
9157
|
const handleCallback = evt => {
|
|
9141
|
-
onActionClick
|
|
9158
|
+
if (isFunction(onActionClick)) {
|
|
9159
|
+
onActionClick();
|
|
9160
|
+
}
|
|
9142
9161
|
evt.stopPropagation();
|
|
9143
9162
|
};
|
|
9144
9163
|
if (!type || !isVisible) {
|
|
@@ -9287,13 +9306,6 @@ const PostBlock = forwardRef((props, ref) => {
|
|
|
9287
9306
|
title,
|
|
9288
9307
|
...forwardedProps
|
|
9289
9308
|
} = props;
|
|
9290
|
-
|
|
9291
|
-
// Display text as string or HTML
|
|
9292
|
-
const textContent = typeof text === 'string' ? {
|
|
9293
|
-
children: text
|
|
9294
|
-
} : {
|
|
9295
|
-
dangerouslySetInnerHTML: text
|
|
9296
|
-
};
|
|
9297
9309
|
return /*#__PURE__*/jsxs("div", {
|
|
9298
9310
|
ref: ref,
|
|
9299
9311
|
className: classNames(className, handleBasicClasses({
|
|
@@ -9322,9 +9334,15 @@ const PostBlock = forwardRef((props, ref) => {
|
|
|
9322
9334
|
}), meta && /*#__PURE__*/jsx("span", {
|
|
9323
9335
|
className: `${CLASSNAME$A}__meta`,
|
|
9324
9336
|
children: meta
|
|
9325
|
-
}),
|
|
9337
|
+
}), isObject(text) && text.__html ?
|
|
9338
|
+
/*#__PURE__*/
|
|
9339
|
+
// eslint-disable-next-line react/no-danger
|
|
9340
|
+
jsx("p", {
|
|
9341
|
+
dangerouslySetInnerHTML: text,
|
|
9342
|
+
className: `${CLASSNAME$A}__text`
|
|
9343
|
+
}) : /*#__PURE__*/jsx("p", {
|
|
9326
9344
|
className: `${CLASSNAME$A}__text`,
|
|
9327
|
-
|
|
9345
|
+
children: text
|
|
9328
9346
|
}), attachments && /*#__PURE__*/jsx("div", {
|
|
9329
9347
|
className: `${CLASSNAME$A}__attachments`,
|
|
9330
9348
|
children: attachments
|
|
@@ -10411,8 +10429,8 @@ const SelectField = props => {
|
|
|
10411
10429
|
* @return React element.
|
|
10412
10430
|
*/
|
|
10413
10431
|
const Select = forwardRef((props, ref) => {
|
|
10414
|
-
const isEmpty =
|
|
10415
|
-
const hasInputClear = props.onClear && props.clearButtonProps && !isEmpty;
|
|
10432
|
+
const isEmpty$1 = isEmpty(props.value);
|
|
10433
|
+
const hasInputClear = props.onClear && props.clearButtonProps && !isEmpty$1;
|
|
10416
10434
|
return WithSelectContext(SelectField, {
|
|
10417
10435
|
...DEFAULT_PROPS$n,
|
|
10418
10436
|
...props,
|
|
@@ -10422,7 +10440,7 @@ const Select = forwardRef((props, ref) => {
|
|
|
10422
10440
|
prefix: CLASSNAME$q
|
|
10423
10441
|
})),
|
|
10424
10442
|
hasInputClear,
|
|
10425
|
-
isEmpty
|
|
10443
|
+
isEmpty: isEmpty$1
|
|
10426
10444
|
}, ref);
|
|
10427
10445
|
});
|
|
10428
10446
|
Select.displayName = COMPONENT_NAME$q;
|
|
@@ -10654,7 +10672,7 @@ const SideNavigationItem = forwardRef((props, ref) => {
|
|
|
10654
10672
|
...forwardedProps
|
|
10655
10673
|
} = props;
|
|
10656
10674
|
const content = children && Children.toArray(children).filter(isComponent(SideNavigationItem));
|
|
10657
|
-
const hasContent =
|
|
10675
|
+
const hasContent = !isEmpty(content);
|
|
10658
10676
|
const shouldSplitActions = Boolean(onActionClick);
|
|
10659
10677
|
const showChildren = hasContent && isOpen;
|
|
10660
10678
|
const contentId = useId();
|
|
@@ -11195,7 +11213,9 @@ function useInterval(callback, delay) {
|
|
|
11195
11213
|
useEffect(() => {
|
|
11196
11214
|
if (delay === null) return undefined;
|
|
11197
11215
|
function tick() {
|
|
11198
|
-
savedCallback.current
|
|
11216
|
+
if (isFunction(savedCallback.current)) {
|
|
11217
|
+
savedCallback.current();
|
|
11218
|
+
}
|
|
11199
11219
|
}
|
|
11200
11220
|
const id = setInterval(tick, delay);
|
|
11201
11221
|
return () => clearInterval(id);
|
|
@@ -12071,7 +12091,7 @@ const Switch = forwardRef((props, ref) => {
|
|
|
12071
12091
|
theme: theme,
|
|
12072
12092
|
className: `${CLASSNAME$e}__label`,
|
|
12073
12093
|
children: children
|
|
12074
|
-
}), helper && /*#__PURE__*/jsx(InputHelper, {
|
|
12094
|
+
}), !isEmpty(helper) && /*#__PURE__*/jsx(InputHelper, {
|
|
12075
12095
|
id: `${inputId}-helper`,
|
|
12076
12096
|
theme: theme,
|
|
12077
12097
|
className: `${CLASSNAME$e}__helper`,
|
|
@@ -12744,7 +12764,7 @@ const renderInputNative = props => {
|
|
|
12744
12764
|
setFocus(false);
|
|
12745
12765
|
};
|
|
12746
12766
|
const handleChange = event => {
|
|
12747
|
-
onChange(event
|
|
12767
|
+
onChange(get(event, 'target.value'), name, event);
|
|
12748
12768
|
};
|
|
12749
12769
|
const Component = multiline ? 'textarea' : 'input';
|
|
12750
12770
|
const inputProps = {
|
|
@@ -13889,7 +13909,7 @@ const UserBlock = forwardRef((props, ref) => {
|
|
|
13889
13909
|
const isLink = Boolean(linkProps?.href || linkAs);
|
|
13890
13910
|
const isClickable = !!onClick || isLink;
|
|
13891
13911
|
const nameBlock = React__default.useMemo(() => {
|
|
13892
|
-
if (
|
|
13912
|
+
if (isEmpty(name)) {
|
|
13893
13913
|
return null;
|
|
13894
13914
|
}
|
|
13895
13915
|
let NameComponent = 'span';
|
|
@@ -13906,11 +13926,15 @@ const UserBlock = forwardRef((props, ref) => {
|
|
|
13906
13926
|
color: ColorPalette.dark
|
|
13907
13927
|
});
|
|
13908
13928
|
}
|
|
13929
|
+
// Disable avatar focus since the name block is the same link / same button.
|
|
13930
|
+
if (avatarProps) {
|
|
13931
|
+
set(avatarProps, ['thumbnailProps', 'tabIndex'], -1);
|
|
13932
|
+
}
|
|
13909
13933
|
return /*#__PURE__*/jsx(NameComponent, {
|
|
13910
13934
|
...nProps,
|
|
13911
13935
|
children: name
|
|
13912
13936
|
});
|
|
13913
|
-
}, [isClickable, linkAs, linkProps, name, nameProps, onClick]);
|
|
13937
|
+
}, [avatarProps, isClickable, linkAs, linkProps, name, nameProps, onClick]);
|
|
13914
13938
|
const shouldDisplayFields = componentSize !== Size.s && componentSize !== Size.xs;
|
|
13915
13939
|
const fieldsBlock = fields && shouldDisplayFields && /*#__PURE__*/jsx("div", {
|
|
13916
13940
|
className: `${CLASSNAME}__fields`,
|
|
@@ -13939,12 +13963,7 @@ const UserBlock = forwardRef((props, ref) => {
|
|
|
13939
13963
|
className: classNames(`${CLASSNAME}__avatar`, avatarProps.className),
|
|
13940
13964
|
size: componentSize,
|
|
13941
13965
|
onClick: onClick,
|
|
13942
|
-
theme: theme
|
|
13943
|
-
thumbnailProps: {
|
|
13944
|
-
...avatarProps?.thumbnailProps,
|
|
13945
|
-
// Disable avatar focus since the name block is the same link / same button.
|
|
13946
|
-
tabIndex: avatarProps ? -1 : undefined
|
|
13947
|
-
}
|
|
13966
|
+
theme: theme
|
|
13948
13967
|
}), (fields || name || children || additionalFields) && /*#__PURE__*/jsxs("div", {
|
|
13949
13968
|
className: `${CLASSNAME}__wrapper`,
|
|
13950
13969
|
children: [children || nameBlock, fieldsBlock, shouldDisplayFields ? additionalFields : null]
|