@lumx/react 3.20.1-alpha.37 → 3.20.1-alpha.38
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 +4 -15
- package/index.js +68 -92
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/utils/index.js +1 -1
- package/utils/index.js.map +1 -1
package/index.d.ts
CHANGED
|
@@ -1042,24 +1042,13 @@ interface FlexBoxProps extends GenericProps {
|
|
|
1042
1042
|
*/
|
|
1043
1043
|
declare const FlexBox: Comp<FlexBoxProps, HTMLDivElement>;
|
|
1044
1044
|
|
|
1045
|
+
type GenericBlockGapSize = Extract<Size, 'tiny' | 'regular' | 'medium' | 'big' | 'huge'>;
|
|
1045
1046
|
/**
|
|
1046
1047
|
* Accepted gap sizes for the generic block.
|
|
1047
1048
|
*/
|
|
1048
|
-
declare const GenericBlockGapSize:
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
readonly s: "s";
|
|
1052
|
-
readonly m: "m";
|
|
1053
|
-
readonly l: "l";
|
|
1054
|
-
readonly xl: "xl";
|
|
1055
|
-
readonly xxl: "xxl";
|
|
1056
|
-
readonly tiny: "tiny";
|
|
1057
|
-
readonly regular: "regular";
|
|
1058
|
-
readonly medium: "medium";
|
|
1059
|
-
readonly big: "big";
|
|
1060
|
-
readonly huge: "huge";
|
|
1061
|
-
}, "tiny" | "regular" | "medium" | "big" | "huge">;
|
|
1062
|
-
type GenericBlockGapSize = ValueOf<typeof GenericBlockGapSize>;
|
|
1049
|
+
declare const GenericBlockGapSize: {
|
|
1050
|
+
[S in GenericBlockGapSize]: S;
|
|
1051
|
+
};
|
|
1063
1052
|
|
|
1064
1053
|
interface GenericBlockProps extends FlexBoxProps {
|
|
1065
1054
|
/**
|
package/index.js
CHANGED
|
@@ -7,28 +7,16 @@ import classNames from 'classnames';
|
|
|
7
7
|
import { getRootClassName, handleBasicClasses, 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 last from '
|
|
11
|
-
import
|
|
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';
|
|
10
|
+
import { last } from '@lumx/core/js/utils/collection/last';
|
|
11
|
+
import { partitionMulti } from '@lumx/core/js/utils/collection/partitionMulti';
|
|
17
12
|
import { useDisabledStateContext, Portal, ClickAwayProvider } from './utils/index.js';
|
|
18
|
-
import isEmpty from 'lodash/isEmpty';
|
|
19
13
|
import memoize from 'lodash/memoize';
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import pick from 'lodash/pick';
|
|
23
|
-
import noop from 'lodash/noop';
|
|
24
|
-
import isInteger from 'lodash/isInteger';
|
|
14
|
+
import { castArray } from '@lumx/core/js/utils/collection/castArray';
|
|
15
|
+
import { isEmpty } from '@lumx/core/js/utils/collection/isEmpty';
|
|
25
16
|
import throttle from 'lodash/throttle';
|
|
26
|
-
import range from '
|
|
27
|
-
import chunk from '
|
|
17
|
+
import { range } from '@lumx/core/js/utils/collection/range';
|
|
18
|
+
import { chunk } from '@lumx/core/js/utils/collection/chunk';
|
|
28
19
|
import ReactDOM from 'react-dom';
|
|
29
|
-
import take from 'lodash/take';
|
|
30
|
-
import isObject from 'lodash/isObject';
|
|
31
|
-
import set from 'lodash/set';
|
|
32
20
|
|
|
33
21
|
const mdiAlert = 'M13 14h-2V9h2m0 9h-2v-2h2M1 21h22L12 2z';
|
|
34
22
|
|
|
@@ -722,7 +710,7 @@ BadgeWrapper.displayName = 'BadgeWrapper';
|
|
|
722
710
|
BadgeWrapper.className = CLASSNAME$1f;
|
|
723
711
|
|
|
724
712
|
/**
|
|
725
|
-
* Properties of a component to use to determine
|
|
713
|
+
* Properties of a component to use to determine its name.
|
|
726
714
|
* In the order of preference.
|
|
727
715
|
*/
|
|
728
716
|
const NAME_PROPERTIES = ['type', 'type.displayName', 'displayName', 'name', 'type.name', 'props.mdxType', '_reactInternalFiber.elementType.name'];
|
|
@@ -734,7 +722,7 @@ const NAME_PROPERTIES = ['type', 'type.displayName', 'displayName', 'name', 'typ
|
|
|
734
722
|
*/
|
|
735
723
|
const isComponent = component => instance => {
|
|
736
724
|
const componentName = typeof component === 'string' ? component : component.displayName;
|
|
737
|
-
return !!
|
|
725
|
+
return !!instance.$$typeof && NAME_PROPERTIES.some(nameProperty => instance[nameProperty] === componentName);
|
|
738
726
|
};
|
|
739
727
|
|
|
740
728
|
/**
|
|
@@ -962,11 +950,11 @@ const Button = forwardRef((props, ref) => {
|
|
|
962
950
|
const buttonClassName = classNames(className, getBasicClass({
|
|
963
951
|
prefix: CLASSNAME$1e,
|
|
964
952
|
type: 'hasLeftIcon',
|
|
965
|
-
value:
|
|
953
|
+
value: !!leftIcon
|
|
966
954
|
}), getBasicClass({
|
|
967
955
|
prefix: CLASSNAME$1e,
|
|
968
956
|
type: 'hasRightIcon',
|
|
969
|
-
value:
|
|
957
|
+
value: !!rightIcon
|
|
970
958
|
}));
|
|
971
959
|
return /*#__PURE__*/jsxs(ButtonRoot, {
|
|
972
960
|
ref: ref,
|
|
@@ -976,7 +964,7 @@ const Button = forwardRef((props, ref) => {
|
|
|
976
964
|
...forwardedProps,
|
|
977
965
|
className: buttonClassName,
|
|
978
966
|
variant: "button",
|
|
979
|
-
children: [leftIcon &&
|
|
967
|
+
children: [leftIcon &&
|
|
980
968
|
/*#__PURE__*/
|
|
981
969
|
// Theme is handled in the button scss
|
|
982
970
|
jsx(ThemeProvider, {
|
|
@@ -986,7 +974,7 @@ const Button = forwardRef((props, ref) => {
|
|
|
986
974
|
})
|
|
987
975
|
}), children && (isComponent(Text)(children) ? children : /*#__PURE__*/jsx("span", {
|
|
988
976
|
children: children
|
|
989
|
-
})), rightIcon &&
|
|
977
|
+
})), rightIcon &&
|
|
990
978
|
/*#__PURE__*/
|
|
991
979
|
// Theme is handled in the button scss
|
|
992
980
|
jsx(ThemeProvider, {
|
|
@@ -1238,7 +1226,7 @@ Checkbox.defaultProps = DEFAULT_PROPS$X;
|
|
|
1238
1226
|
*/
|
|
1239
1227
|
function useStopPropagation(handler) {
|
|
1240
1228
|
return useCallback(evt => {
|
|
1241
|
-
if (!evt || !
|
|
1229
|
+
if (!evt || !handler) {
|
|
1242
1230
|
return;
|
|
1243
1231
|
}
|
|
1244
1232
|
handler(evt);
|
|
@@ -1295,9 +1283,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1295
1283
|
onKeyDown,
|
|
1296
1284
|
...forwardedProps
|
|
1297
1285
|
} = otherProps;
|
|
1298
|
-
const
|
|
1299
|
-
const hasBeforeClick = isFunction(onBeforeClick);
|
|
1300
|
-
const hasOnClick = isFunction(props.onClick);
|
|
1286
|
+
const hasOnClick = Boolean(props.onClick);
|
|
1301
1287
|
const isButton = hasOnClick && !href;
|
|
1302
1288
|
const isClickable = Boolean(hasOnClick) || Boolean(href) || propIsClickable;
|
|
1303
1289
|
|
|
@@ -1307,7 +1293,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1307
1293
|
const handleOnAfterClick = useStopPropagation(onAfterClick);
|
|
1308
1294
|
const handleKeyDown = evt => {
|
|
1309
1295
|
onKeyDown?.(evt);
|
|
1310
|
-
if (
|
|
1296
|
+
if (onClick) {
|
|
1311
1297
|
onEnterPressed(onClick)(evt);
|
|
1312
1298
|
}
|
|
1313
1299
|
};
|
|
@@ -1333,14 +1319,14 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1333
1319
|
unselected: Boolean(!isSelected)
|
|
1334
1320
|
})),
|
|
1335
1321
|
"aria-disabled": isClickable && isAnyDisabled || undefined,
|
|
1336
|
-
onClick:
|
|
1322
|
+
onClick: onClick || undefined,
|
|
1337
1323
|
onKeyDown: handleKeyDown,
|
|
1338
1324
|
children: [before &&
|
|
1339
1325
|
/*#__PURE__*/
|
|
1340
1326
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
1341
1327
|
jsx("div", {
|
|
1342
1328
|
className: classNames(`${CLASSNAME$1a}__before`, {
|
|
1343
|
-
[`${CLASSNAME$1a}__before--is-clickable`]:
|
|
1329
|
+
[`${CLASSNAME$1a}__before--is-clickable`]: !!onBeforeClick
|
|
1344
1330
|
}),
|
|
1345
1331
|
onClick: handleOnBeforeClick,
|
|
1346
1332
|
children: before
|
|
@@ -1352,7 +1338,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
1352
1338
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
1353
1339
|
jsx("div", {
|
|
1354
1340
|
className: classNames(`${CLASSNAME$1a}__after`, {
|
|
1355
|
-
[`${CLASSNAME$1a}__after--is-clickable`]:
|
|
1341
|
+
[`${CLASSNAME$1a}__after--is-clickable`]: !!onAfterClick
|
|
1356
1342
|
}),
|
|
1357
1343
|
onClick: handleOnAfterClick,
|
|
1358
1344
|
children: after
|
|
@@ -1741,7 +1727,7 @@ const getMonthCalendar = (locale, referenceDate = new Date(), rangeMinDate, rang
|
|
|
1741
1727
|
if (iterDate.getMonth() === month) {
|
|
1742
1728
|
week[weekDayNumber] = day;
|
|
1743
1729
|
}
|
|
1744
|
-
if (weekDayNumber === lastDayOfWeek
|
|
1730
|
+
if (weekDayNumber === lastDayOfWeek?.number) {
|
|
1745
1731
|
weeks.push(week);
|
|
1746
1732
|
rowCount += 1;
|
|
1747
1733
|
week = {};
|
|
@@ -2187,7 +2173,10 @@ function makeListenerTowerContext() {
|
|
|
2187
2173
|
// Disable current listener.
|
|
2188
2174
|
listener.disable();
|
|
2189
2175
|
// Remove current listener.
|
|
2190
|
-
|
|
2176
|
+
const index = LISTENERS.indexOf(listener);
|
|
2177
|
+
if (index > -1) {
|
|
2178
|
+
LISTENERS.splice(index, 1);
|
|
2179
|
+
}
|
|
2191
2180
|
// Enable previous listener.
|
|
2192
2181
|
last(LISTENERS)?.enable();
|
|
2193
2182
|
}
|
|
@@ -2368,23 +2357,6 @@ function useIntersectionObserver(elements, options) {
|
|
|
2368
2357
|
return intersections;
|
|
2369
2358
|
}
|
|
2370
2359
|
|
|
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
|
-
|
|
2388
2360
|
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); } }
|
|
2389
2361
|
|
|
2390
2362
|
// Older browsers don't support event options, feature detect it.
|
|
@@ -3010,7 +2982,7 @@ const useKeyboardListNavigation = (items, ref, onListItemSelected, onListItemNav
|
|
|
3010
2982
|
onListItemSelected(selectedItem);
|
|
3011
2983
|
resetActiveIndex();
|
|
3012
2984
|
} else if (activeItemIndex === initialIndex && onEnterPressed) {
|
|
3013
|
-
const value =
|
|
2985
|
+
const value = evt.target?.value;
|
|
3014
2986
|
onEnterPressed(value);
|
|
3015
2987
|
resetActiveIndex();
|
|
3016
2988
|
}
|
|
@@ -3021,7 +2993,7 @@ const useKeyboardListNavigation = (items, ref, onListItemSelected, onListItemNav
|
|
|
3021
2993
|
* @param evt - key pressed event
|
|
3022
2994
|
*/
|
|
3023
2995
|
const onTabKeyPressed = evt => {
|
|
3024
|
-
const value =
|
|
2996
|
+
const value = evt.target?.value;
|
|
3025
2997
|
if (preventTabOnEnteredValue && value && value.length > 0) {
|
|
3026
2998
|
preventDefaultAndStopPropagation(evt);
|
|
3027
2999
|
}
|
|
@@ -3117,7 +3089,7 @@ function isClickable({
|
|
|
3117
3089
|
linkProps,
|
|
3118
3090
|
onItemSelected
|
|
3119
3091
|
}) {
|
|
3120
|
-
return
|
|
3092
|
+
return !!linkProps?.href || !!onItemSelected;
|
|
3121
3093
|
}
|
|
3122
3094
|
|
|
3123
3095
|
/**
|
|
@@ -3496,7 +3468,7 @@ var reactIsExports = requireReactIs();
|
|
|
3496
3468
|
function flattenChildren(children) {
|
|
3497
3469
|
function recur(nodes, keys = []) {
|
|
3498
3470
|
return Children.toArray(nodes).reduce((acc, node, index) => {
|
|
3499
|
-
const nodeKeys = keys.concat(
|
|
3471
|
+
const nodeKeys = keys.concat(node?.key ?? index);
|
|
3500
3472
|
if (reactIsExports.isFragment(node)) {
|
|
3501
3473
|
acc.push(...recur(node.props.children, nodeKeys));
|
|
3502
3474
|
} else if (/*#__PURE__*/isValidElement(node)) {
|
|
@@ -3606,7 +3578,7 @@ const useInteractiveList = options => {
|
|
|
3606
3578
|
setActiveItemIndex(nextIndex);
|
|
3607
3579
|
evt.preventDefault();
|
|
3608
3580
|
evt.stopPropagation();
|
|
3609
|
-
onListItemNavigated?.(nextIndex,
|
|
3581
|
+
onListItemNavigated?.(nextIndex, items[nextIndex]?.key);
|
|
3610
3582
|
};
|
|
3611
3583
|
|
|
3612
3584
|
/**
|
|
@@ -6473,7 +6445,7 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
6473
6445
|
|
|
6474
6446
|
// Either take the header in children or create one with the label.
|
|
6475
6447
|
const headerProps = /*#__PURE__*/React__default.isValidElement(header) ? header.props : {};
|
|
6476
|
-
const headerContent =
|
|
6448
|
+
const headerContent = React__default.Children.count(headerProps.children) > 0 ? headerProps.children : /*#__PURE__*/jsx("span", {
|
|
6477
6449
|
className: `${CLASSNAME$$}__label`,
|
|
6478
6450
|
children: label
|
|
6479
6451
|
});
|
|
@@ -6492,7 +6464,7 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
6492
6464
|
const color = theme === Theme.dark ? ColorPalette.light : ColorPalette.dark;
|
|
6493
6465
|
const rootClassName = classNames(className, handleBasicClasses({
|
|
6494
6466
|
hasBackground,
|
|
6495
|
-
hasHeader:
|
|
6467
|
+
hasHeader: !isEmpty(headerProps.children),
|
|
6496
6468
|
hasHeaderDivider,
|
|
6497
6469
|
isClose: !isOpen,
|
|
6498
6470
|
isDraggable: Boolean(dragHandle),
|
|
@@ -6687,11 +6659,11 @@ const DEFAULT_PROPS$L = {
|
|
|
6687
6659
|
gap: Size.big,
|
|
6688
6660
|
orientation: Orientation.horizontal
|
|
6689
6661
|
};
|
|
6690
|
-
const Figure =
|
|
6662
|
+
const Figure = () => {};
|
|
6691
6663
|
const isFigure = isComponentType(Figure);
|
|
6692
|
-
const Content =
|
|
6664
|
+
const Content = () => {};
|
|
6693
6665
|
const isContent = isComponentType(Content);
|
|
6694
|
-
const Actions =
|
|
6666
|
+
const Actions = () => {};
|
|
6695
6667
|
const isActions = isComponentType(Actions);
|
|
6696
6668
|
|
|
6697
6669
|
/**
|
|
@@ -6728,7 +6700,7 @@ const BaseGenericBlock = forwardRef((props, ref) => {
|
|
|
6728
6700
|
contentChildProps: contentChild?.props,
|
|
6729
6701
|
actionsChild,
|
|
6730
6702
|
actionsChildProps: actionsChild?.props,
|
|
6731
|
-
otherChildren: otherChildren.filter(child =>
|
|
6703
|
+
otherChildren: otherChildren.filter(child => React__default.Children.count(child) > 0)
|
|
6732
6704
|
};
|
|
6733
6705
|
}, [children]);
|
|
6734
6706
|
return /*#__PURE__*/jsxs(FlexBox, {
|
|
@@ -6778,7 +6750,13 @@ const GenericBlock = Object.assign(BaseGenericBlock, {
|
|
|
6778
6750
|
/**
|
|
6779
6751
|
* Accepted gap sizes for the generic block.
|
|
6780
6752
|
*/
|
|
6781
|
-
const GenericBlockGapSize =
|
|
6753
|
+
const GenericBlockGapSize = {
|
|
6754
|
+
tiny: Size.tiny,
|
|
6755
|
+
regular: Size.regular,
|
|
6756
|
+
medium: Size.medium,
|
|
6757
|
+
big: Size.big,
|
|
6758
|
+
huge: Size.huge
|
|
6759
|
+
};
|
|
6782
6760
|
|
|
6783
6761
|
const DEFAULT_VALUE = {};
|
|
6784
6762
|
|
|
@@ -7151,7 +7129,7 @@ const GridColumn = forwardRef((props, ref) => {
|
|
|
7151
7129
|
className: classNames(className, CLASSNAME$T),
|
|
7152
7130
|
style: {
|
|
7153
7131
|
...style,
|
|
7154
|
-
['--lumx-grid-column-item-min-width']: isInteger(itemMinWidth) && `${itemMinWidth}px`,
|
|
7132
|
+
['--lumx-grid-column-item-min-width']: Number.isInteger(itemMinWidth) && `${itemMinWidth}px`,
|
|
7155
7133
|
['--lumx-grid-column-columns']: maxColumns,
|
|
7156
7134
|
['--lumx-grid-column-gap']: gap && `var(--lumx-spacing-unit-${gap})`
|
|
7157
7135
|
},
|
|
@@ -8844,7 +8822,7 @@ const Mosaic = forwardRef((props, ref) => {
|
|
|
8844
8822
|
}),
|
|
8845
8823
|
children: /*#__PURE__*/jsx("div", {
|
|
8846
8824
|
className: `${CLASSNAME$G}__wrapper`,
|
|
8847
|
-
children:
|
|
8825
|
+
children: thumbnails.slice(0, 4).map((thumbnail, index) => {
|
|
8848
8826
|
const {
|
|
8849
8827
|
image,
|
|
8850
8828
|
onClick,
|
|
@@ -9160,9 +9138,7 @@ const Notification = forwardRef((props, ref) => {
|
|
|
9160
9138
|
const isVisible = useTransitionVisibility(rootRef, !!isOpen, NOTIFICATION_TRANSITION_DURATION);
|
|
9161
9139
|
const hasAction = Boolean(onActionClick) && Boolean(actionLabel);
|
|
9162
9140
|
const handleCallback = evt => {
|
|
9163
|
-
|
|
9164
|
-
onActionClick();
|
|
9165
|
-
}
|
|
9141
|
+
onActionClick?.();
|
|
9166
9142
|
evt.stopPropagation();
|
|
9167
9143
|
};
|
|
9168
9144
|
if (!type || !isVisible) {
|
|
@@ -9311,6 +9287,13 @@ const PostBlock = forwardRef((props, ref) => {
|
|
|
9311
9287
|
title,
|
|
9312
9288
|
...forwardedProps
|
|
9313
9289
|
} = props;
|
|
9290
|
+
|
|
9291
|
+
// Display text as string or HTML
|
|
9292
|
+
const textContent = typeof text === 'string' ? {
|
|
9293
|
+
children: text
|
|
9294
|
+
} : {
|
|
9295
|
+
dangerouslySetInnerHTML: text
|
|
9296
|
+
};
|
|
9314
9297
|
return /*#__PURE__*/jsxs("div", {
|
|
9315
9298
|
ref: ref,
|
|
9316
9299
|
className: classNames(className, handleBasicClasses({
|
|
@@ -9339,15 +9322,9 @@ const PostBlock = forwardRef((props, ref) => {
|
|
|
9339
9322
|
}), meta && /*#__PURE__*/jsx("span", {
|
|
9340
9323
|
className: `${CLASSNAME$A}__meta`,
|
|
9341
9324
|
children: meta
|
|
9342
|
-
}),
|
|
9343
|
-
/*#__PURE__*/
|
|
9344
|
-
// eslint-disable-next-line react/no-danger
|
|
9345
|
-
jsx("p", {
|
|
9346
|
-
dangerouslySetInnerHTML: text,
|
|
9347
|
-
className: `${CLASSNAME$A}__text`
|
|
9348
|
-
}) : /*#__PURE__*/jsx("p", {
|
|
9325
|
+
}), /*#__PURE__*/jsx("p", {
|
|
9349
9326
|
className: `${CLASSNAME$A}__text`,
|
|
9350
|
-
|
|
9327
|
+
...textContent
|
|
9351
9328
|
}), attachments && /*#__PURE__*/jsx("div", {
|
|
9352
9329
|
className: `${CLASSNAME$A}__attachments`,
|
|
9353
9330
|
children: attachments
|
|
@@ -10434,8 +10411,8 @@ const SelectField = props => {
|
|
|
10434
10411
|
* @return React element.
|
|
10435
10412
|
*/
|
|
10436
10413
|
const Select = forwardRef((props, ref) => {
|
|
10437
|
-
const isEmpty
|
|
10438
|
-
const hasInputClear = props.onClear && props.clearButtonProps && !isEmpty
|
|
10414
|
+
const isEmpty = !props.value;
|
|
10415
|
+
const hasInputClear = props.onClear && props.clearButtonProps && !isEmpty;
|
|
10439
10416
|
return WithSelectContext(SelectField, {
|
|
10440
10417
|
...DEFAULT_PROPS$n,
|
|
10441
10418
|
...props,
|
|
@@ -10445,7 +10422,7 @@ const Select = forwardRef((props, ref) => {
|
|
|
10445
10422
|
prefix: CLASSNAME$q
|
|
10446
10423
|
})),
|
|
10447
10424
|
hasInputClear,
|
|
10448
|
-
isEmpty
|
|
10425
|
+
isEmpty
|
|
10449
10426
|
}, ref);
|
|
10450
10427
|
});
|
|
10451
10428
|
Select.displayName = COMPONENT_NAME$q;
|
|
@@ -10677,7 +10654,7 @@ const SideNavigationItem = forwardRef((props, ref) => {
|
|
|
10677
10654
|
...forwardedProps
|
|
10678
10655
|
} = props;
|
|
10679
10656
|
const content = children && Children.toArray(children).filter(isComponent(SideNavigationItem));
|
|
10680
|
-
const hasContent =
|
|
10657
|
+
const hasContent = Boolean(content);
|
|
10681
10658
|
const shouldSplitActions = Boolean(onActionClick);
|
|
10682
10659
|
const showChildren = hasContent && isOpen;
|
|
10683
10660
|
const contentId = useId();
|
|
@@ -11218,9 +11195,7 @@ function useInterval(callback, delay) {
|
|
|
11218
11195
|
useEffect(() => {
|
|
11219
11196
|
if (delay === null) return undefined;
|
|
11220
11197
|
function tick() {
|
|
11221
|
-
|
|
11222
|
-
savedCallback.current();
|
|
11223
|
-
}
|
|
11198
|
+
savedCallback.current?.();
|
|
11224
11199
|
}
|
|
11225
11200
|
const id = setInterval(tick, delay);
|
|
11226
11201
|
return () => clearInterval(id);
|
|
@@ -12096,7 +12071,7 @@ const Switch = forwardRef((props, ref) => {
|
|
|
12096
12071
|
theme: theme,
|
|
12097
12072
|
className: `${CLASSNAME$e}__label`,
|
|
12098
12073
|
children: children
|
|
12099
|
-
}),
|
|
12074
|
+
}), helper && /*#__PURE__*/jsx(InputHelper, {
|
|
12100
12075
|
id: `${inputId}-helper`,
|
|
12101
12076
|
theme: theme,
|
|
12102
12077
|
className: `${CLASSNAME$e}__helper`,
|
|
@@ -12769,7 +12744,7 @@ const renderInputNative = props => {
|
|
|
12769
12744
|
setFocus(false);
|
|
12770
12745
|
};
|
|
12771
12746
|
const handleChange = event => {
|
|
12772
|
-
onChange(
|
|
12747
|
+
onChange(event.target.value, name, event);
|
|
12773
12748
|
};
|
|
12774
12749
|
const Component = multiline ? 'textarea' : 'input';
|
|
12775
12750
|
const inputProps = {
|
|
@@ -13914,7 +13889,7 @@ const UserBlock = forwardRef((props, ref) => {
|
|
|
13914
13889
|
const isLink = Boolean(linkProps?.href || linkAs);
|
|
13915
13890
|
const isClickable = !!onClick || isLink;
|
|
13916
13891
|
const nameBlock = React__default.useMemo(() => {
|
|
13917
|
-
if (
|
|
13892
|
+
if (!name) {
|
|
13918
13893
|
return null;
|
|
13919
13894
|
}
|
|
13920
13895
|
let NameComponent = 'span';
|
|
@@ -13931,15 +13906,11 @@ const UserBlock = forwardRef((props, ref) => {
|
|
|
13931
13906
|
color: ColorPalette.dark
|
|
13932
13907
|
});
|
|
13933
13908
|
}
|
|
13934
|
-
// Disable avatar focus since the name block is the same link / same button.
|
|
13935
|
-
if (avatarProps) {
|
|
13936
|
-
set(avatarProps, ['thumbnailProps', 'tabIndex'], -1);
|
|
13937
|
-
}
|
|
13938
13909
|
return /*#__PURE__*/jsx(NameComponent, {
|
|
13939
13910
|
...nProps,
|
|
13940
13911
|
children: name
|
|
13941
13912
|
});
|
|
13942
|
-
}, [
|
|
13913
|
+
}, [isClickable, linkAs, linkProps, name, nameProps, onClick]);
|
|
13943
13914
|
const shouldDisplayFields = componentSize !== Size.s && componentSize !== Size.xs;
|
|
13944
13915
|
const fieldsBlock = fields && shouldDisplayFields && /*#__PURE__*/jsx("div", {
|
|
13945
13916
|
className: `${CLASSNAME}__fields`,
|
|
@@ -13968,7 +13939,12 @@ const UserBlock = forwardRef((props, ref) => {
|
|
|
13968
13939
|
className: classNames(`${CLASSNAME}__avatar`, avatarProps.className),
|
|
13969
13940
|
size: componentSize,
|
|
13970
13941
|
onClick: onClick,
|
|
13971
|
-
theme: theme
|
|
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
|
+
}
|
|
13972
13948
|
}), (fields || name || children || additionalFields) && /*#__PURE__*/jsxs("div", {
|
|
13973
13949
|
className: `${CLASSNAME}__wrapper`,
|
|
13974
13950
|
children: [children || nameBlock, fieldsBlock, shouldDisplayFields ? additionalFields : null]
|