@lumx/react 4.2.1-alpha.0 → 4.2.1-alpha.10
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/README.md +1 -2
- package/index.d.ts +191 -89
- package/index.js +55 -35
- package/index.js.map +1 -1
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Kind as Kind$1, Size as Size$1, ColorPalette as ColorPalette$1, Emphasis as Emphasis$1, Theme as Theme$1, AspectRatio, ColorVariant, DIALOG_TRANSITION_DURATION, Orientation, Alignment, NOTIFICATION_TRANSITION_DURATION, TOOLTIP_LONG_PRESS_DELAY, TOOLTIP_HOVER_DELAY } from '@lumx/core/js/constants';
|
|
1
|
+
import { Kind as Kind$1, Size as Size$1, ColorPalette as ColorPalette$1, Emphasis as Emphasis$1, Theme as Theme$1, AspectRatio, ColorVariant, DIALOG_TRANSITION_DURATION, Orientation as Orientation$1, Alignment, 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';
|
|
@@ -717,6 +717,8 @@ const Size = {
|
|
|
717
717
|
m: 'm',
|
|
718
718
|
xl: 'xl',
|
|
719
719
|
xxl: 'xxl'};
|
|
720
|
+
const Orientation = {
|
|
721
|
+
horizontal: 'horizontal'};
|
|
720
722
|
const Emphasis = {
|
|
721
723
|
low: 'low',
|
|
722
724
|
high: 'high'
|
|
@@ -1016,9 +1018,9 @@ const RawClickable$1 = props => {
|
|
|
1016
1018
|
};
|
|
1017
1019
|
}
|
|
1018
1020
|
return /*#__PURE__*/jsx(Component, {
|
|
1019
|
-
"aria-disabled": isAnyDisabled || undefined,
|
|
1020
1021
|
...forwardedProps,
|
|
1021
1022
|
...clickableProps,
|
|
1023
|
+
"aria-disabled": isAnyDisabled || undefined,
|
|
1022
1024
|
onClick: event => {
|
|
1023
1025
|
if (isAnyDisabled) {
|
|
1024
1026
|
event.stopPropagation();
|
|
@@ -6447,10 +6449,7 @@ const {
|
|
|
6447
6449
|
* @param props Component props.
|
|
6448
6450
|
* @return JSX element.
|
|
6449
6451
|
*/
|
|
6450
|
-
const Flag$1 =
|
|
6451
|
-
const {
|
|
6452
|
-
Text
|
|
6453
|
-
} = nestedComponents || {};
|
|
6452
|
+
const Flag$1 = props => {
|
|
6454
6453
|
const {
|
|
6455
6454
|
children,
|
|
6456
6455
|
icon,
|
|
@@ -6458,6 +6457,7 @@ const Flag$1 = (props, nestedComponents) => {
|
|
|
6458
6457
|
className,
|
|
6459
6458
|
theme,
|
|
6460
6459
|
truncate,
|
|
6460
|
+
Text,
|
|
6461
6461
|
...forwardedProps
|
|
6462
6462
|
} = props;
|
|
6463
6463
|
const flagColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);
|
|
@@ -6474,7 +6474,7 @@ const Flag$1 = (props, nestedComponents) => {
|
|
|
6474
6474
|
className: element$B('icon')
|
|
6475
6475
|
}), /*#__PURE__*/jsx(Text, {
|
|
6476
6476
|
as: "span",
|
|
6477
|
-
truncate: !!
|
|
6477
|
+
truncate: !!truncate,
|
|
6478
6478
|
typography: "overline",
|
|
6479
6479
|
className: element$B('label'),
|
|
6480
6480
|
children: children
|
|
@@ -6495,8 +6495,7 @@ const Flag = forwardRef((props, ref) => {
|
|
|
6495
6495
|
...props,
|
|
6496
6496
|
theme: props.theme || defaultTheme,
|
|
6497
6497
|
ref,
|
|
6498
|
-
children: props.label
|
|
6499
|
-
}, {
|
|
6498
|
+
children: props.label,
|
|
6500
6499
|
Text
|
|
6501
6500
|
});
|
|
6502
6501
|
});
|
|
@@ -6504,6 +6503,10 @@ Flag.displayName = COMPONENT_NAME$Y;
|
|
|
6504
6503
|
Flag.className = CLASSNAME$Y;
|
|
6505
6504
|
Flag.defaultProps = DEFAULT_PROPS$P;
|
|
6506
6505
|
|
|
6506
|
+
/**
|
|
6507
|
+
* Defines the props of the component.
|
|
6508
|
+
*/
|
|
6509
|
+
|
|
6507
6510
|
/**
|
|
6508
6511
|
* Component display name.
|
|
6509
6512
|
*/
|
|
@@ -6515,19 +6518,16 @@ const COMPONENT_NAME$X = 'FlexBox';
|
|
|
6515
6518
|
const CLASSNAME$X = 'lumx-flex-box';
|
|
6516
6519
|
const {
|
|
6517
6520
|
block: block$O
|
|
6518
|
-
} =
|
|
6521
|
+
} = bem(CLASSNAME$X);
|
|
6519
6522
|
|
|
6520
6523
|
/**
|
|
6521
|
-
* FlexBox component.
|
|
6524
|
+
* Get FlexBox component props (className computation).
|
|
6522
6525
|
*
|
|
6523
6526
|
* @param props Component props.
|
|
6524
|
-
* @
|
|
6525
|
-
* @return React element.
|
|
6527
|
+
* @return Computed props with className.
|
|
6526
6528
|
*/
|
|
6527
|
-
|
|
6529
|
+
function getFlexBoxProps(props) {
|
|
6528
6530
|
const {
|
|
6529
|
-
as: Component = 'div',
|
|
6530
|
-
children,
|
|
6531
6531
|
className,
|
|
6532
6532
|
fillSpace,
|
|
6533
6533
|
gap,
|
|
@@ -6540,10 +6540,9 @@ const FlexBox = forwardRef((props, ref) => {
|
|
|
6540
6540
|
...forwardedProps
|
|
6541
6541
|
} = props;
|
|
6542
6542
|
const adjustedOrientation = orientation ?? (wrap || hAlign || vAlign ? Orientation.horizontal : null);
|
|
6543
|
-
return
|
|
6544
|
-
ref: ref,
|
|
6543
|
+
return {
|
|
6545
6544
|
...forwardedProps,
|
|
6546
|
-
className:
|
|
6545
|
+
className: classnames(className, block$O({
|
|
6547
6546
|
[`orientation-${adjustedOrientation}`]: Boolean(adjustedOrientation),
|
|
6548
6547
|
[`v-align-${vAlign}`]: Boolean(vAlign),
|
|
6549
6548
|
[`h-align-${hAlign}`]: Boolean(hAlign),
|
|
@@ -6552,7 +6551,26 @@ const FlexBox = forwardRef((props, ref) => {
|
|
|
6552
6551
|
'fill-space': fillSpace,
|
|
6553
6552
|
'no-shrink': noShrink,
|
|
6554
6553
|
...Object.fromEntries(castArray(marginAuto).filter(Boolean).map(align => [`margin-auto-${align}`, true]))
|
|
6555
|
-
}))
|
|
6554
|
+
}))
|
|
6555
|
+
};
|
|
6556
|
+
}
|
|
6557
|
+
|
|
6558
|
+
/**
|
|
6559
|
+
* FlexBox component.
|
|
6560
|
+
*
|
|
6561
|
+
* @param props Component props.
|
|
6562
|
+
* @param ref Component ref.
|
|
6563
|
+
* @return React element.
|
|
6564
|
+
*/
|
|
6565
|
+
const FlexBox = forwardRef((props, ref) => {
|
|
6566
|
+
const {
|
|
6567
|
+
as: Component = 'div',
|
|
6568
|
+
children,
|
|
6569
|
+
...forwardedProps
|
|
6570
|
+
} = props;
|
|
6571
|
+
return /*#__PURE__*/jsx(Component, {
|
|
6572
|
+
ref: ref,
|
|
6573
|
+
...getFlexBoxProps(forwardedProps),
|
|
6556
6574
|
children: children
|
|
6557
6575
|
});
|
|
6558
6576
|
});
|
|
@@ -6578,7 +6596,7 @@ const {
|
|
|
6578
6596
|
*/
|
|
6579
6597
|
const DEFAULT_PROPS$O = {
|
|
6580
6598
|
gap: Size$1.big,
|
|
6581
|
-
orientation: Orientation.horizontal
|
|
6599
|
+
orientation: Orientation$1.horizontal
|
|
6582
6600
|
};
|
|
6583
6601
|
const Figure = noop.bind({});
|
|
6584
6602
|
const isFigure = isComponentType(Figure);
|
|
@@ -6640,7 +6658,7 @@ const BaseGenericBlock = forwardRef((props, ref) => {
|
|
|
6640
6658
|
children: [figure, sections.figureChildProps?.children]
|
|
6641
6659
|
}), (sections.contentChildProps?.children || sections.otherChildren.length > 0) && /*#__PURE__*/jsxs(FlexBox, {
|
|
6642
6660
|
ref: sections.contentChild?.ref,
|
|
6643
|
-
orientation: Orientation.vertical,
|
|
6661
|
+
orientation: Orientation$1.vertical,
|
|
6644
6662
|
fillSpace: true,
|
|
6645
6663
|
vAlign: forwardedProps.vAlign,
|
|
6646
6664
|
hAlign: forwardedProps.hAlign,
|
|
@@ -6986,7 +7004,7 @@ const {
|
|
|
6986
7004
|
* Component default props.
|
|
6987
7005
|
*/
|
|
6988
7006
|
const DEFAULT_PROPS$L = {
|
|
6989
|
-
orientation: Orientation.horizontal,
|
|
7007
|
+
orientation: Orientation$1.horizontal,
|
|
6990
7008
|
wrap: 'nowrap'
|
|
6991
7009
|
};
|
|
6992
7010
|
|
|
@@ -7802,7 +7820,7 @@ function setupViewTransitionName(elementRef, name) {
|
|
|
7802
7820
|
return {
|
|
7803
7821
|
set() {
|
|
7804
7822
|
const element = unref(elementRef);
|
|
7805
|
-
if (!element) return;
|
|
7823
|
+
if (!element || !name) return;
|
|
7806
7824
|
originalName = element.style.viewTransitionName;
|
|
7807
7825
|
element.style.viewTransitionName = name;
|
|
7808
7826
|
},
|
|
@@ -7830,15 +7848,15 @@ async function startViewTransition({
|
|
|
7830
7848
|
const {
|
|
7831
7849
|
flushSync
|
|
7832
7850
|
} = ReactDOM;
|
|
7833
|
-
if (prefersReducedMotion || !start || !flushSync || !viewTransitionName?.source || !viewTransitionName?.target) {
|
|
7851
|
+
if (prefersReducedMotion || !start || !flushSync || viewTransitionName && (!viewTransitionName?.source || !viewTransitionName?.target)) {
|
|
7834
7852
|
// Skip, apply changes without a transition
|
|
7835
7853
|
changes();
|
|
7836
7854
|
return;
|
|
7837
7855
|
}
|
|
7838
7856
|
|
|
7839
7857
|
// Setup set/unset transition name on source & target
|
|
7840
|
-
const sourceTransitionName = setupViewTransitionName(viewTransitionName
|
|
7841
|
-
const targetTransitionName = setupViewTransitionName(viewTransitionName
|
|
7858
|
+
const sourceTransitionName = setupViewTransitionName(viewTransitionName?.source, viewTransitionName?.name);
|
|
7859
|
+
const targetTransitionName = setupViewTransitionName(viewTransitionName?.target, viewTransitionName?.name);
|
|
7842
7860
|
sourceTransitionName.set();
|
|
7843
7861
|
|
|
7844
7862
|
// Start view transition, apply changes & flush to DOM
|
|
@@ -8830,6 +8848,7 @@ const Message$1 = props => {
|
|
|
8830
8848
|
kind,
|
|
8831
8849
|
icon: customIcon,
|
|
8832
8850
|
closeButtonProps,
|
|
8851
|
+
ref,
|
|
8833
8852
|
...forwardedProps
|
|
8834
8853
|
} = props;
|
|
8835
8854
|
const {
|
|
@@ -8843,6 +8862,7 @@ const Message$1 = props => {
|
|
|
8843
8862
|
const isCloseButtonDisplayed = hasBackground && kind === 'info' && onClick && closeButtonLabel;
|
|
8844
8863
|
return /*#__PURE__*/jsxs("div", {
|
|
8845
8864
|
...forwardedProps,
|
|
8865
|
+
ref: ref,
|
|
8846
8866
|
className: classnames(className, block$B({
|
|
8847
8867
|
[`color-${color}`]: Boolean(color),
|
|
8848
8868
|
'has-background': hasBackground
|
|
@@ -8970,7 +8990,7 @@ Mosaic.className = CLASSNAME$E;
|
|
|
8970
8990
|
Mosaic.defaultProps = DEFAULT_PROPS$D;
|
|
8971
8991
|
|
|
8972
8992
|
const NavigationContext = /*#__PURE__*/createContext({
|
|
8973
|
-
orientation: Orientation.vertical
|
|
8993
|
+
orientation: Orientation$1.vertical
|
|
8974
8994
|
});
|
|
8975
8995
|
|
|
8976
8996
|
/**
|
|
@@ -9015,7 +9035,7 @@ const NavigationSection = forwardRef((props, ref) => {
|
|
|
9015
9035
|
orientation
|
|
9016
9036
|
} = useContext(NavigationContext) || {};
|
|
9017
9037
|
const theme = useTheme();
|
|
9018
|
-
const isDropdown = orientation === Orientation.horizontal;
|
|
9038
|
+
const isDropdown = orientation === Orientation$1.horizontal;
|
|
9019
9039
|
return /*#__PURE__*/jsxs("li", {
|
|
9020
9040
|
className: classNames.join(className, sectionBlock(), itemBlock({
|
|
9021
9041
|
[`theme-${theme}`]: Boolean(theme)
|
|
@@ -9065,7 +9085,7 @@ const NavigationSection = forwardRef((props, ref) => {
|
|
|
9065
9085
|
id: sectionId,
|
|
9066
9086
|
children: /*#__PURE__*/jsx(NavigationContext.Provider, {
|
|
9067
9087
|
value: {
|
|
9068
|
-
orientation: Orientation.vertical
|
|
9088
|
+
orientation: Orientation$1.vertical
|
|
9069
9089
|
},
|
|
9070
9090
|
children: children
|
|
9071
9091
|
})
|
|
@@ -9157,7 +9177,7 @@ const {
|
|
|
9157
9177
|
* Component default props
|
|
9158
9178
|
*/
|
|
9159
9179
|
const DEFAULT_PROPS$C = {
|
|
9160
|
-
orientation: Orientation.vertical
|
|
9180
|
+
orientation: Orientation$1.vertical
|
|
9161
9181
|
};
|
|
9162
9182
|
const Navigation = forwardRef((props, ref) => {
|
|
9163
9183
|
const defaultTheme = useTheme() || Theme$1.light;
|
|
@@ -9404,7 +9424,7 @@ const {
|
|
|
9404
9424
|
* Component default props.
|
|
9405
9425
|
*/
|
|
9406
9426
|
const DEFAULT_PROPS$z = {
|
|
9407
|
-
orientation: Orientation.horizontal
|
|
9427
|
+
orientation: Orientation$1.horizontal
|
|
9408
9428
|
};
|
|
9409
9429
|
|
|
9410
9430
|
/**
|
|
@@ -14276,7 +14296,7 @@ const {
|
|
|
14276
14296
|
* Component default props.
|
|
14277
14297
|
*/
|
|
14278
14298
|
const DEFAULT_PROPS = {
|
|
14279
|
-
orientation: Orientation.horizontal,
|
|
14299
|
+
orientation: Orientation$1.horizontal,
|
|
14280
14300
|
size: Size$1.m
|
|
14281
14301
|
};
|
|
14282
14302
|
|
|
@@ -14313,10 +14333,10 @@ const UserBlock = forwardRef((props, ref) => {
|
|
|
14313
14333
|
let componentSize = size;
|
|
14314
14334
|
|
|
14315
14335
|
// Special case - When using vertical orientation force the size to be Sizes.l.
|
|
14316
|
-
if (orientation === Orientation.vertical) {
|
|
14336
|
+
if (orientation === Orientation$1.vertical) {
|
|
14317
14337
|
componentSize = Size$1.l;
|
|
14318
14338
|
}
|
|
14319
|
-
const shouldDisplayActions = orientation === Orientation.vertical;
|
|
14339
|
+
const shouldDisplayActions = orientation === Orientation$1.vertical;
|
|
14320
14340
|
const isLink = Boolean(linkProps?.href || linkAs);
|
|
14321
14341
|
const isClickable = !!onClick || isLink;
|
|
14322
14342
|
const nameBlock = React__default.useMemo(() => {
|