@lumx/react 4.1.1-alpha.2 → 4.1.1-alpha.4
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 +54 -14
- package/index.js +142 -40
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Kind as Kind$1, HorizontalAlignment, Size as Size$1, ColorPalette as ColorPalette$1, VerticalAlignment, Alignment, Orientation, ColorWithVariants as ColorWithVariants$1, ColorVariant as ColorVariant$1, Typography as Typography$1,
|
|
1
|
+
import { Kind as Kind$1, HorizontalAlignment, Size as Size$1, ColorPalette as ColorPalette$1, VerticalAlignment, Alignment, Orientation, AspectRatio, ColorWithVariants as ColorWithVariants$1, ColorVariant as ColorVariant$1, Typography as Typography$1, Emphasis as Emphasis$1, GlobalSize, TypographyInterface as TypographyInterface$1, Theme as Theme$1 } from '@lumx/core/js/constants';
|
|
2
2
|
export * from '@lumx/core/js/constants';
|
|
3
3
|
import * as _lumx_core_js_types from '@lumx/core/js/types';
|
|
4
|
-
import { GenericProps as GenericProps$1, HasTheme as HasTheme$1, ValueOf, HasAriaDisabled as HasAriaDisabled$1, HasCloseMode,
|
|
4
|
+
import { GenericProps as GenericProps$1, HasTheme as HasTheme$1, ValueOf, HasAriaDisabled as HasAriaDisabled$1, HasCloseMode, HeadingElement as HeadingElement$1, Falsy, HasClassName as HasClassName$1, HasRequiredLinkHref, HasAriaLabelOrLabelledBy, ObjectValues as ObjectValues$1 } from '@lumx/core/js/types';
|
|
5
5
|
export * from '@lumx/core/js/types';
|
|
6
6
|
import * as React$1 from 'react';
|
|
7
7
|
import React__default, { Ref, ReactElement, ReactNode, SyntheticEvent, MouseEventHandler, KeyboardEventHandler, AriaAttributes, InputHTMLAttributes, RefObject, ImgHTMLAttributes, CSSProperties, SetStateAction, Key, ElementType, ComponentProps } from 'react';
|
|
@@ -416,6 +416,18 @@ declare const Kind: {
|
|
|
416
416
|
readonly error: "error";
|
|
417
417
|
};
|
|
418
418
|
type Kind = ValueOf<typeof Kind>;
|
|
419
|
+
/**
|
|
420
|
+
* All available white-space values
|
|
421
|
+
* */
|
|
422
|
+
declare const WhiteSpace: {
|
|
423
|
+
normal: string;
|
|
424
|
+
nowrap: string;
|
|
425
|
+
pre: string;
|
|
426
|
+
'pre-wrap': string;
|
|
427
|
+
'pre-line': string;
|
|
428
|
+
'break-spaces': string;
|
|
429
|
+
};
|
|
430
|
+
type WhiteSpace = ValueOf<typeof WhiteSpace>;
|
|
419
431
|
/**
|
|
420
432
|
* See SCSS variable $lumx-color-palette
|
|
421
433
|
*/
|
|
@@ -475,12 +487,24 @@ interface GenericProps extends HasClassName {
|
|
|
475
487
|
|
|
476
488
|
type JSXElement = boolean | number | string | React__default.JSX.Element | Iterable<JSXElement> | undefined | null;
|
|
477
489
|
|
|
490
|
+
/** Union type of all heading elements */
|
|
491
|
+
type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
492
|
+
|
|
493
|
+
/** Union type of all text elements */
|
|
494
|
+
type TextElement = 'span' | 'p' | HeadingElement;
|
|
495
|
+
|
|
478
496
|
/** Transform a string literal into kebab case */
|
|
479
497
|
type KebabCase<S> = S extends `${infer C}${infer T}` ? T extends Uncapitalize<T> ? `${Uncapitalize<C>}${KebabCase<T>}` : `${Uncapitalize<C>}-${KebabCase<T>}` : S;
|
|
480
498
|
|
|
481
499
|
/** Transform the component name into the lumx class name. */
|
|
482
500
|
type LumxClassName<TComponentName extends string> = `lumx-${KebabCase<TComponentName>}`;
|
|
483
501
|
|
|
502
|
+
/**
|
|
503
|
+
* Returns a union type of the given generic values.
|
|
504
|
+
*
|
|
505
|
+
*/
|
|
506
|
+
type ObjectValues<T> = T[keyof T];
|
|
507
|
+
|
|
484
508
|
type Booleanish = boolean | 'true' | 'false';
|
|
485
509
|
|
|
486
510
|
interface HasAriaDisabled {
|
|
@@ -1323,19 +1347,19 @@ declare const GenericBlock: GenericBlock;
|
|
|
1323
1347
|
/**
|
|
1324
1348
|
* Defines the props of the component.
|
|
1325
1349
|
*/
|
|
1326
|
-
interface TextProps extends GenericProps
|
|
1350
|
+
interface TextProps extends GenericProps {
|
|
1327
1351
|
/**
|
|
1328
1352
|
* Color variant.
|
|
1329
1353
|
*/
|
|
1330
|
-
color?: ColorWithVariants
|
|
1354
|
+
color?: ColorWithVariants;
|
|
1331
1355
|
/**
|
|
1332
1356
|
* Lightened or darkened variant of the selected color.
|
|
1333
1357
|
*/
|
|
1334
|
-
colorVariant?: ColorVariant
|
|
1358
|
+
colorVariant?: ColorVariant;
|
|
1335
1359
|
/**
|
|
1336
1360
|
* Typography variant.
|
|
1337
1361
|
*/
|
|
1338
|
-
typography?: Typography
|
|
1362
|
+
typography?: Typography;
|
|
1339
1363
|
/**
|
|
1340
1364
|
* Custom component to render the text.
|
|
1341
1365
|
*/
|
|
@@ -1362,8 +1386,9 @@ interface TextProps extends GenericProps$1 {
|
|
|
1362
1386
|
/**
|
|
1363
1387
|
* Children
|
|
1364
1388
|
*/
|
|
1365
|
-
children?:
|
|
1389
|
+
children?: JSXElement;
|
|
1366
1390
|
}
|
|
1391
|
+
|
|
1367
1392
|
/**
|
|
1368
1393
|
* Text component.
|
|
1369
1394
|
*
|
|
@@ -1380,7 +1405,7 @@ interface HeadingProps extends Partial<TextProps> {
|
|
|
1380
1405
|
/**
|
|
1381
1406
|
* Display a specific heading level instead of the one provided by parent context provider.
|
|
1382
1407
|
*/
|
|
1383
|
-
as?: HeadingElement;
|
|
1408
|
+
as?: HeadingElement$1;
|
|
1384
1409
|
/**
|
|
1385
1410
|
* Children
|
|
1386
1411
|
*/
|
|
@@ -1486,7 +1511,9 @@ interface GridColumnProps extends GenericProps$1 {
|
|
|
1486
1511
|
*/
|
|
1487
1512
|
declare const GridColumn: Comp<GridColumnProps, HTMLElement>;
|
|
1488
1513
|
|
|
1489
|
-
|
|
1514
|
+
declare const ICON_SIZES: ("xxs" | "xs" | "s" | "m" | "l" | "xl" | "xxl")[];
|
|
1515
|
+
|
|
1516
|
+
type IconSizes = ObjectValues<typeof ICON_SIZES>;
|
|
1490
1517
|
/**
|
|
1491
1518
|
* Defines the props of the component.
|
|
1492
1519
|
*/
|
|
@@ -1506,6 +1533,8 @@ interface IconProps extends GenericProps, HasTheme {
|
|
|
1506
1533
|
size?: IconSizes;
|
|
1507
1534
|
/** Sets an alternative text on the svg. Will set an `img` role to the svg. */
|
|
1508
1535
|
alt?: string;
|
|
1536
|
+
/** Vertical alignment of the icon (only applies for icons nested in Text/Heading). */
|
|
1537
|
+
verticalAlign?: null | 'middle';
|
|
1509
1538
|
}
|
|
1510
1539
|
|
|
1511
1540
|
/**
|
|
@@ -1902,7 +1931,7 @@ interface LinkPreviewProps extends GenericProps$1, HasTheme$1 {
|
|
|
1902
1931
|
/** Title. */
|
|
1903
1932
|
title?: string;
|
|
1904
1933
|
/** Customize the title heading tag. */
|
|
1905
|
-
titleHeading?: HeadingElement;
|
|
1934
|
+
titleHeading?: HeadingElement$1;
|
|
1906
1935
|
}
|
|
1907
1936
|
/**
|
|
1908
1937
|
* LinkPreview component.
|
|
@@ -2664,12 +2693,23 @@ declare const Slider: Comp<SliderProps, HTMLDivElement>;
|
|
|
2664
2693
|
*/
|
|
2665
2694
|
declare const clamp: (value: number, min: number, max: number) => number;
|
|
2666
2695
|
|
|
2696
|
+
/**
|
|
2697
|
+
* Slide mode
|
|
2698
|
+
*/
|
|
2699
|
+
declare const SlideMode: {
|
|
2700
|
+
/** Move slides with CSS transform translate */
|
|
2701
|
+
readonly transformTranslate: "transform-translate";
|
|
2702
|
+
/** Move slides native scroll snap (available only on supported browsers) */
|
|
2703
|
+
readonly scrollSnap: "scroll-snap";
|
|
2704
|
+
};
|
|
2705
|
+
type SlideMode = ObjectValues$1<typeof SlideMode>;
|
|
2706
|
+
|
|
2667
2707
|
/**
|
|
2668
2708
|
* Defines the props of the component.
|
|
2669
2709
|
*/
|
|
2670
2710
|
interface SlideshowProps extends GenericProps$1, Pick<SlidesProps, 'autoPlay' | 'slidesId' | 'id' | 'theme' | 'fillHeight' | 'groupBy' | 'slideGroupLabel'> {
|
|
2671
|
-
/** Whether to use CSS transform or native scroll snap. */
|
|
2672
|
-
|
|
2711
|
+
/** Whether to use CSS transform translate or native scroll snap. */
|
|
2712
|
+
slideMode?: SlideMode;
|
|
2673
2713
|
/** current slide active */
|
|
2674
2714
|
activeIndex?: SlidesProps['activeIndex'];
|
|
2675
2715
|
/** Interval between each slide when automatic rotation is enabled. */
|
|
@@ -2846,10 +2886,10 @@ interface SlidesCommonProps extends GenericProps$1, HasTheme$1 {
|
|
|
2846
2886
|
children?: React__default.ReactNode;
|
|
2847
2887
|
}
|
|
2848
2888
|
interface SlidesTransformProps extends SlidesCommonProps {
|
|
2849
|
-
|
|
2889
|
+
slideMode?: Extract<SlideMode, 'transform-translate'>;
|
|
2850
2890
|
}
|
|
2851
2891
|
interface SlidesScrollSnapProps extends SlidesCommonProps {
|
|
2852
|
-
|
|
2892
|
+
slideMode: Extract<SlideMode, 'scroll-snap'>;
|
|
2853
2893
|
onChange: (index: number) => void;
|
|
2854
2894
|
}
|
|
2855
2895
|
type SlidesProps = SlidesTransformProps | SlidesScrollSnapProps;
|
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, DIALOG_TRANSITION_DURATION, Orientation, Typography, Alignment,
|
|
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, Typography, 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';
|
|
@@ -878,6 +878,41 @@ function resolveColorWithVariants(colorWithVariants, colorVariant) {
|
|
|
878
878
|
return [color, colorVariant || baseColorVariant];
|
|
879
879
|
}
|
|
880
880
|
|
|
881
|
+
/**
|
|
882
|
+
* Generates a Lumx color class name for the given type, color and variant.
|
|
883
|
+
* This is the base function used by font() and background() utilities.
|
|
884
|
+
*
|
|
885
|
+
* @param type - The color class type ('font' or 'background')
|
|
886
|
+
* @param propColor - The color palette name (e.g., 'primary', 'dark') with optional variant suffix (e.g., 'primary-L2')
|
|
887
|
+
* @param propColorVariant - Optional color variant override (e.g., 'L1', 'L2', 'D1', 'N')
|
|
888
|
+
* @returns The Lumx color class name or undefined if no color is provided
|
|
889
|
+
*
|
|
890
|
+
* @example
|
|
891
|
+
* color('font', 'dark', 'L2'); // 'lumx-color-font-dark-L2'
|
|
892
|
+
* color('background', 'primary'); // 'lumx-color-background-primary-N'
|
|
893
|
+
* color('font', 'primary-L2'); // 'lumx-color-font-primary-L2'
|
|
894
|
+
* color('font', undefined); // undefined
|
|
895
|
+
*/
|
|
896
|
+
function color(type, propColor, propColorVariant) {
|
|
897
|
+
const [cColor, cColorVariant = ColorVariant.N] = resolveColorWithVariants(propColor, propColorVariant);
|
|
898
|
+
return `lumx-color-${type}-${cColor}-${cColorVariant}`;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* Generates a Lumx font color class name for the given color and variant.
|
|
903
|
+
*
|
|
904
|
+
* @param propColor - The color palette name (e.g., 'primary', 'dark') with optional variant suffix (e.g., 'primary-L2')
|
|
905
|
+
* @param propColorVariant - Optional color variant override (e.g., 'L1', 'L2', 'D1', 'N')
|
|
906
|
+
* @returns The Lumx font color class name or undefined if no color is provided
|
|
907
|
+
*
|
|
908
|
+
* @example
|
|
909
|
+
* font('dark', 'L2'); // 'lumx-color-font-dark-L2'
|
|
910
|
+
* font('primary-L2'); // 'lumx-color-font-primary-L2'
|
|
911
|
+
* font('primary'); // 'lumx-color-font-primary-N'
|
|
912
|
+
* font(undefined); // undefined
|
|
913
|
+
*/
|
|
914
|
+
const font = (propColor, propColorVariant) => color('font', propColor, propColorVariant);
|
|
915
|
+
|
|
881
916
|
/**
|
|
882
917
|
* Returns the classname associated to the given typography. For example, for Typography.title it returns
|
|
883
918
|
* lumx-typography-title
|
|
@@ -1185,6 +1220,7 @@ const Icon$1 = props => {
|
|
|
1185
1220
|
ref,
|
|
1186
1221
|
theme,
|
|
1187
1222
|
alt,
|
|
1223
|
+
verticalAlign,
|
|
1188
1224
|
...forwardedProps
|
|
1189
1225
|
} = props;
|
|
1190
1226
|
const [color, colorVariant] = resolveColorWithVariants(propColor, propColorVariant);
|
|
@@ -1221,7 +1257,8 @@ const Icon$1 = props => {
|
|
|
1221
1257
|
hasShape,
|
|
1222
1258
|
prefix: CLASSNAME$1b,
|
|
1223
1259
|
theme,
|
|
1224
|
-
size: iconSize
|
|
1260
|
+
size: iconSize,
|
|
1261
|
+
verticalAlign
|
|
1225
1262
|
}), !hasShape && `${CLASSNAME$1b}--no-shape`, !hasShape && iconColor === ColorPalette.yellow && icon === mdiAlertCircle && `${CLASSNAME$1b}--has-dark-layer`, `${CLASSNAME$1b}--path`),
|
|
1226
1263
|
children: /*#__PURE__*/jsx("svg", {
|
|
1227
1264
|
"aria-hidden": alt ? undefined : 'true',
|
|
@@ -1230,7 +1267,7 @@ const Icon$1 = props => {
|
|
|
1230
1267
|
height: "1em",
|
|
1231
1268
|
preserveAspectRatio: "xMidYMid meet",
|
|
1232
1269
|
style: {
|
|
1233
|
-
verticalAlign: '-0.125em'
|
|
1270
|
+
verticalAlign: verticalAlign ? undefined : '-0.125em'
|
|
1234
1271
|
},
|
|
1235
1272
|
viewBox: "0 0 24 24",
|
|
1236
1273
|
width: "1em",
|
|
@@ -6540,6 +6577,10 @@ function wrapChildrenIconWithSpaces(children) {
|
|
|
6540
6577
|
});
|
|
6541
6578
|
}
|
|
6542
6579
|
|
|
6580
|
+
/**
|
|
6581
|
+
* Defines the props of the component.
|
|
6582
|
+
*/
|
|
6583
|
+
|
|
6543
6584
|
/**
|
|
6544
6585
|
* Component display name.
|
|
6545
6586
|
*/
|
|
@@ -6556,25 +6597,21 @@ const CLASSNAME$V = 'lumx-text';
|
|
|
6556
6597
|
const DEFAULT_PROPS$N = {};
|
|
6557
6598
|
|
|
6558
6599
|
/**
|
|
6559
|
-
* Text component
|
|
6600
|
+
* Text component common props
|
|
6560
6601
|
*
|
|
6561
6602
|
* @param props Component props.
|
|
6562
|
-
* @
|
|
6563
|
-
* @return React element.
|
|
6603
|
+
* @return Common Props
|
|
6564
6604
|
*/
|
|
6565
|
-
const
|
|
6605
|
+
const getTextProps = props => {
|
|
6566
6606
|
const {
|
|
6567
|
-
as: Component,
|
|
6568
|
-
children,
|
|
6569
6607
|
className,
|
|
6570
6608
|
color,
|
|
6571
6609
|
colorVariant,
|
|
6572
6610
|
noWrap,
|
|
6573
|
-
typography,
|
|
6611
|
+
typography: typography$1,
|
|
6574
6612
|
truncate,
|
|
6575
6613
|
whiteSpace,
|
|
6576
|
-
style
|
|
6577
|
-
...forwardedProps
|
|
6614
|
+
style
|
|
6578
6615
|
} = props;
|
|
6579
6616
|
|
|
6580
6617
|
// Truncate mode
|
|
@@ -6592,24 +6629,53 @@ const Text = forwardRef((props, ref) => {
|
|
|
6592
6629
|
const whiteSpaceStyle = !noWrap && !(isTruncated && !isTruncatedMultiline) && whiteSpace && {
|
|
6593
6630
|
'--lumx-text-white-space': whiteSpace
|
|
6594
6631
|
};
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
labelRef
|
|
6598
|
-
} = useOverflowTooltipLabel(children);
|
|
6599
|
-
return /*#__PURE__*/jsx(Component, {
|
|
6600
|
-
ref: useMergeRefs(ref, labelRef),
|
|
6601
|
-
className: classNames.join(className, handleBasicClasses({
|
|
6632
|
+
return {
|
|
6633
|
+
className: classnames(className, handleBasicClasses({
|
|
6602
6634
|
prefix: CLASSNAME$V,
|
|
6603
6635
|
isTruncated: isTruncated && !isTruncatedMultiline,
|
|
6604
6636
|
isTruncatedMultiline
|
|
6605
|
-
}), typography &&
|
|
6606
|
-
title: tooltipLabel,
|
|
6637
|
+
}), typography$1 && typography(typography$1), color && font(color, colorVariant), noWrap && `${CLASSNAME$V}--no-wrap`),
|
|
6607
6638
|
style: {
|
|
6608
6639
|
...truncateLinesStyle,
|
|
6609
6640
|
...whiteSpaceStyle,
|
|
6610
6641
|
...style
|
|
6611
|
-
}
|
|
6642
|
+
}
|
|
6643
|
+
};
|
|
6644
|
+
};
|
|
6645
|
+
|
|
6646
|
+
/**
|
|
6647
|
+
* Text component.
|
|
6648
|
+
*
|
|
6649
|
+
* @param props Component props.
|
|
6650
|
+
* @param ref Component ref.
|
|
6651
|
+
* @return React element.
|
|
6652
|
+
*/
|
|
6653
|
+
const Text = forwardRef((props, ref) => {
|
|
6654
|
+
const {
|
|
6655
|
+
as: Component,
|
|
6656
|
+
children,
|
|
6657
|
+
color,
|
|
6658
|
+
colorVariant,
|
|
6659
|
+
noWrap,
|
|
6660
|
+
typography,
|
|
6661
|
+
truncate,
|
|
6662
|
+
whiteSpace,
|
|
6663
|
+
...forwardedProps
|
|
6664
|
+
} = props;
|
|
6665
|
+
const {
|
|
6666
|
+
tooltipLabel,
|
|
6667
|
+
labelRef
|
|
6668
|
+
} = useOverflowTooltipLabel(children);
|
|
6669
|
+
const {
|
|
6670
|
+
className,
|
|
6671
|
+
style
|
|
6672
|
+
} = React__default.useMemo(() => getTextProps(props), [props]);
|
|
6673
|
+
return /*#__PURE__*/jsx(Component, {
|
|
6674
|
+
ref: useMergeRefs(ref, labelRef),
|
|
6675
|
+
title: tooltipLabel,
|
|
6612
6676
|
...forwardedProps,
|
|
6677
|
+
className: className,
|
|
6678
|
+
style: style,
|
|
6613
6679
|
children: wrapChildrenIconWithSpaces(children)
|
|
6614
6680
|
});
|
|
6615
6681
|
});
|
|
@@ -11037,6 +11103,16 @@ const PAGINATION_ITEMS_MAX = 5;
|
|
|
11037
11103
|
*/
|
|
11038
11104
|
const PAGINATION_ITEM_SIZE = 12;
|
|
11039
11105
|
|
|
11106
|
+
/**
|
|
11107
|
+
* Slide mode
|
|
11108
|
+
*/
|
|
11109
|
+
const SlideMode = {
|
|
11110
|
+
/** Move slides with CSS transform translate */
|
|
11111
|
+
transformTranslate: 'transform-translate',
|
|
11112
|
+
/** Move slides native scroll snap (available only on supported browsers) */
|
|
11113
|
+
scrollSnap: 'scroll-snap'
|
|
11114
|
+
};
|
|
11115
|
+
|
|
11040
11116
|
const DEFAULT_OPTIONS = {
|
|
11041
11117
|
activeIndex: 0,
|
|
11042
11118
|
groupBy: 1,
|
|
@@ -11213,6 +11289,11 @@ const useFocusWithin = ({
|
|
|
11213
11289
|
}, [onFocusIn, element, onFocusOut]);
|
|
11214
11290
|
};
|
|
11215
11291
|
|
|
11292
|
+
/** Check if browser supports CSS scroll-snap */
|
|
11293
|
+
function isScrollSnapSupported() {
|
|
11294
|
+
return WINDOW?.CSS?.supports?.('scroll-snap-type', 'x mandatory') ?? false;
|
|
11295
|
+
}
|
|
11296
|
+
|
|
11216
11297
|
/**
|
|
11217
11298
|
* Classname set on elements whose focus was blocked.
|
|
11218
11299
|
* This is to easily find elements that have been tempered with,
|
|
@@ -11351,7 +11432,7 @@ SlideshowItemGroup.className = CLASSNAME$h;
|
|
|
11351
11432
|
*/
|
|
11352
11433
|
const DEFAULT_PROPS$j = {
|
|
11353
11434
|
...DEFAULT_OPTIONS,
|
|
11354
|
-
|
|
11435
|
+
slideMode: SlideMode.transformTranslate
|
|
11355
11436
|
};
|
|
11356
11437
|
|
|
11357
11438
|
/**
|
|
@@ -11377,7 +11458,7 @@ const Slideshow = forwardRef((props, ref) => {
|
|
|
11377
11458
|
id,
|
|
11378
11459
|
slidesId,
|
|
11379
11460
|
slideGroupLabel,
|
|
11380
|
-
|
|
11461
|
+
slideMode = DEFAULT_PROPS$j.slideMode,
|
|
11381
11462
|
...forwardedProps
|
|
11382
11463
|
} = props;
|
|
11383
11464
|
// Number of slideshow items.
|
|
@@ -11414,9 +11495,21 @@ const Slideshow = forwardRef((props, ref) => {
|
|
|
11414
11495
|
onFocusOut: startAutoPlay
|
|
11415
11496
|
});
|
|
11416
11497
|
const showControls = slideshowControlsProps && slidesCount > 1;
|
|
11498
|
+
|
|
11499
|
+
// Slide mode props switch
|
|
11500
|
+
let slideModeProps;
|
|
11501
|
+
if (slideMode === SlideMode.scrollSnap && isScrollSnapSupported()) {
|
|
11502
|
+
slideModeProps = {
|
|
11503
|
+
slideMode,
|
|
11504
|
+
onChange: onPaginationClick
|
|
11505
|
+
};
|
|
11506
|
+
} else {
|
|
11507
|
+
slideModeProps = {
|
|
11508
|
+
slideMode: SlideMode.transformTranslate
|
|
11509
|
+
};
|
|
11510
|
+
}
|
|
11417
11511
|
return /*#__PURE__*/jsx(Slides, {
|
|
11418
|
-
|
|
11419
|
-
onChange: mode === 'scroll-snap' ? onPaginationClick : undefined,
|
|
11512
|
+
...slideModeProps,
|
|
11420
11513
|
activeIndex: currentIndex,
|
|
11421
11514
|
id: slideshowId,
|
|
11422
11515
|
className: className,
|
|
@@ -11832,7 +11925,7 @@ const CLASSNAME$e = 'lumx-slideshow';
|
|
|
11832
11925
|
* Component default props.
|
|
11833
11926
|
*/
|
|
11834
11927
|
const DEFAULT_PROPS$h = {
|
|
11835
|
-
|
|
11928
|
+
slideMode: SlideMode.transformTranslate
|
|
11836
11929
|
};
|
|
11837
11930
|
|
|
11838
11931
|
/**
|
|
@@ -11858,24 +11951,36 @@ const Slides = forwardRef((props, ref) => {
|
|
|
11858
11951
|
afterSlides,
|
|
11859
11952
|
hasControls,
|
|
11860
11953
|
slideGroupLabel,
|
|
11861
|
-
|
|
11954
|
+
slideMode = DEFAULT_PROPS$h.slideMode,
|
|
11862
11955
|
onChange,
|
|
11863
11956
|
...forwardedProps
|
|
11864
11957
|
} = props;
|
|
11865
11958
|
const wrapperRef = React__default.useRef(null);
|
|
11866
11959
|
const startIndexVisible = activeIndex;
|
|
11867
11960
|
const endIndexVisible = startIndexVisible + 1;
|
|
11961
|
+
|
|
11962
|
+
// Only enable scroll-snap if requested and browser supports it
|
|
11963
|
+
const isScrollSnapEnabled = slideMode === SlideMode.scrollSnap && isScrollSnapSupported();
|
|
11868
11964
|
useSlideScroll({
|
|
11869
11965
|
activeIndex,
|
|
11870
|
-
enabled:
|
|
11966
|
+
enabled: isScrollSnapEnabled,
|
|
11871
11967
|
wrapperRef,
|
|
11872
11968
|
onChange
|
|
11873
11969
|
});
|
|
11874
|
-
|
|
11875
|
-
|
|
11876
|
-
|
|
11877
|
-
|
|
11878
|
-
|
|
11970
|
+
let wrapperProps;
|
|
11971
|
+
if (isScrollSnapEnabled) {
|
|
11972
|
+
// Make scroll zone focusable (a11y recommendation)
|
|
11973
|
+
wrapperProps = {
|
|
11974
|
+
tabIndex: 0
|
|
11975
|
+
};
|
|
11976
|
+
} else {
|
|
11977
|
+
// Transform translate to display the current slide
|
|
11978
|
+
wrapperProps = {
|
|
11979
|
+
style: {
|
|
11980
|
+
transform: `translateX(-${FULL_WIDTH_PERCENT * activeIndex}%)`
|
|
11981
|
+
}
|
|
11982
|
+
};
|
|
11983
|
+
}
|
|
11879
11984
|
const groups = React__default.useMemo(() => {
|
|
11880
11985
|
const childrenArray = Children.toArray(children);
|
|
11881
11986
|
return groupBy && groupBy > 1 ? chunk(childrenArray, groupBy) : childrenArray;
|
|
@@ -11900,8 +12005,8 @@ const Slides = forwardRef((props, ref) => {
|
|
|
11900
12005
|
"aria-live": isAutoPlaying ? 'off' : 'polite',
|
|
11901
12006
|
children: /*#__PURE__*/jsx("div", {
|
|
11902
12007
|
ref: wrapperRef,
|
|
11903
|
-
className: `${CLASSNAME$e}__wrapper
|
|
11904
|
-
|
|
12008
|
+
className: classNames.join(`${CLASSNAME$e}__wrapper`, isScrollSnapEnabled && `${CLASSNAME$e}__wrapper--${slideMode}`),
|
|
12009
|
+
...wrapperProps,
|
|
11905
12010
|
children: groups.map((group, index) => /*#__PURE__*/jsx(SlideshowItemGroup, {
|
|
11906
12011
|
id: slidesId && buildSlideShowGroupId(slidesId, index),
|
|
11907
12012
|
role: hasControls ? 'tabpanel' : 'group',
|
|
@@ -13860,18 +13965,15 @@ const UserBlock = forwardRef((props, ref) => {
|
|
|
13860
13965
|
...nProps,
|
|
13861
13966
|
children: /*#__PURE__*/jsx(Text, {
|
|
13862
13967
|
as: "span",
|
|
13863
|
-
truncate: true,
|
|
13864
13968
|
children: name
|
|
13865
13969
|
})
|
|
13866
13970
|
});
|
|
13867
13971
|
}, [avatarProps, isClickable, linkAs, linkProps, name, nameProps, onClick]);
|
|
13868
13972
|
const shouldDisplayFields = componentSize !== Size$1.s && componentSize !== Size$1.xs;
|
|
13869
|
-
const fieldsBlock = fields && shouldDisplayFields && /*#__PURE__*/jsx(
|
|
13973
|
+
const fieldsBlock = fields && shouldDisplayFields && /*#__PURE__*/jsx("div", {
|
|
13870
13974
|
className: `${CLASSNAME}__fields`,
|
|
13871
|
-
wrap: true,
|
|
13872
13975
|
children: fields.map((field, idx) => /*#__PURE__*/jsx(Text, {
|
|
13873
13976
|
as: "span",
|
|
13874
|
-
truncate: true,
|
|
13875
13977
|
className: `${CLASSNAME}__field`,
|
|
13876
13978
|
children: field
|
|
13877
13979
|
}, idx))
|