@lumx/react 3.20.1-alpha.36 → 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.
Files changed (106) hide show
  1. package/index.d.ts +4 -15
  2. package/index.js +13966 -64
  3. package/index.js.map +1 -0
  4. package/package.json +3 -3
  5. package/utils/index.js +159 -3
  6. package/utils/index.js.map +1 -0
  7. package/_internal/035c132d.js +0 -314
  8. package/_internal/0b9c76cb.js +0 -5
  9. package/_internal/0ea95af1.js +0 -819
  10. package/_internal/230173a8.js +0 -12
  11. package/_internal/2a3d237c.js +0 -11
  12. package/_internal/2c2b6a89.js +0 -51
  13. package/_internal/3181f000.js +0 -13
  14. package/_internal/36bd7352.js +0 -218
  15. package/_internal/3864a6c1.js +0 -436
  16. package/_internal/3a1facc0.js +0 -17
  17. package/_internal/49bbeed3.js +0 -5
  18. package/_internal/4daccdd5.js +0 -24
  19. package/_internal/4f4c0582.js +0 -2169
  20. package/_internal/5cef5e8c.js +0 -74
  21. package/_internal/6a60381c.js +0 -117
  22. package/_internal/6f084a40.js +0 -111
  23. package/_internal/76ddefd4.js +0 -61
  24. package/_internal/78df9309.js +0 -19
  25. package/_internal/7ad474e4.js +0 -98
  26. package/_internal/7b293665.js +0 -19
  27. package/_internal/7daf0f24.js +0 -76
  28. package/_internal/825ac334.js +0 -129
  29. package/_internal/827b804a.js +0 -5
  30. package/_internal/8bce732e.js +0 -8
  31. package/_internal/9d1336a1.js +0 -18
  32. package/_internal/a38bdcd0.js +0 -49
  33. package/_internal/b326655a.js +0 -682
  34. package/_internal/b83e864b.js +0 -76
  35. package/_internal/bace1bf1.js +0 -103
  36. package/_internal/c57190eb.js +0 -146
  37. package/_internal/components/alert-dialog/index-284fed80.js +0 -163
  38. package/_internal/components/autocomplete/__mockData__/index-96fc7ea7.js +0 -27
  39. package/_internal/components/autocomplete/index-27a49d5d.js +0 -261
  40. package/_internal/components/avatar/index-b8bc3cae.js +0 -83
  41. package/_internal/components/badge/index-9880f056.js +0 -81
  42. package/_internal/components/button/index-d919f96d.js +0 -47
  43. package/_internal/components/checkbox/index-dd478de9.js +0 -143
  44. package/_internal/components/chip/index-7f84cdbd.js +0 -102
  45. package/_internal/components/comment-block/index-e942de30.js +0 -138
  46. package/_internal/components/date-picker/index-a258d3ce.js +0 -596
  47. package/_internal/components/dialog/index-c7066813.js +0 -238
  48. package/_internal/components/divider/index-b6934baf.js +0 -50
  49. package/_internal/components/drag-handle/index-80e5af6c.js +0 -52
  50. package/_internal/components/dropdown/index-cebfc268.js +0 -147
  51. package/_internal/components/expansion-panel/index-9d45a211.js +0 -167
  52. package/_internal/components/flag/index-33e9d909.js +0 -59
  53. package/_internal/components/flex-box/index-0d6b6b43.js +0 -56
  54. package/_internal/components/generic-block/index-836c4352.js +0 -124
  55. package/_internal/components/grid/index-8c16a4f1.js +0 -104
  56. package/_internal/components/grid-column/index-4a2f56bb.js +0 -59
  57. package/_internal/components/heading/index-fd558a9a.js +0 -53
  58. package/_internal/components/icon/index-e7b9b40e.js +0 -1
  59. package/_internal/components/image-block/index-7021c2f1.js +0 -110
  60. package/_internal/components/image-lightbox/index-27017547.js +0 -759
  61. package/_internal/components/inline-list/index-52efec7f.js +0 -74
  62. package/_internal/components/input-helper/index-5a837e7c.js +0 -71
  63. package/_internal/components/input-label/index-0113f382.js +0 -59
  64. package/_internal/components/lightbox/index-fad5a9f2.js +0 -155
  65. package/_internal/components/link/index-008bae4b.js +0 -72
  66. package/_internal/components/link-preview/index-3e9c32f2.js +0 -117
  67. package/_internal/components/list/index-da88c6e9.js +0 -71
  68. package/_internal/components/message/index-17b568f2.js +0 -98
  69. package/_internal/components/mosaic/index-2d40e01c.js +0 -95
  70. package/_internal/components/navigation/index-dc17c639.js +0 -225
  71. package/_internal/components/notification/index-a1101015.js +0 -146
  72. package/_internal/components/popover/index-dbca63f1.js +0 -2
  73. package/_internal/components/popover-dialog/index-654d2abc.js +0 -66
  74. package/_internal/components/post-block/index-4b6b4dcb.js +0 -109
  75. package/_internal/components/progress/index-6f578c31.js +0 -182
  76. package/_internal/components/progress-tracker/index-700bc4c2.js +0 -309
  77. package/_internal/components/radio-button/index-89b725af.js +0 -149
  78. package/_internal/components/select/index-2755aa32.js +0 -458
  79. package/_internal/components/side-navigation/index-0bbe1fdd.js +0 -165
  80. package/_internal/components/skeleton/index-b2f8501c.js +0 -166
  81. package/_internal/components/slider/index-4f9b891b.js +0 -311
  82. package/_internal/components/slideshow/index-d4604589.js +0 -150
  83. package/_internal/components/switch/index-58fe0f0c.js +0 -122
  84. package/_internal/components/table/index-d541aa88.js +0 -297
  85. package/_internal/components/tabs/index-af1538d6.js +0 -298
  86. package/_internal/components/text/index-5bfc6d5e.js +0 -1
  87. package/_internal/components/text-field/index-47c98d09.js +0 -360
  88. package/_internal/components/thumbnail/index-71545d95.js +0 -41
  89. package/_internal/components/toolbar/index-7041a5a6.js +0 -61
  90. package/_internal/components/tooltip/index-8bb97e60.js +0 -327
  91. package/_internal/components/uploader/index-8f6f55de.js +0 -153
  92. package/_internal/components/user-block/index-70d4ce8f.js +0 -145
  93. package/_internal/d0e3f49e.js +0 -23
  94. package/_internal/de24f857.js +0 -3
  95. package/_internal/e806b848.js +0 -8
  96. package/_internal/e913a3af.js +0 -117
  97. package/_internal/ea04260d.js +0 -28
  98. package/_internal/eaf6c45a.js +0 -3
  99. package/_internal/ebdcb0c7.js +0 -60
  100. package/_internal/ef5d1aac.js +0 -3
  101. package/_internal/f0d7d6ea.js +0 -29
  102. package/_internal/utils/ClickAwayProvider/index-1234ce76.js +0 -94
  103. package/_internal/utils/MaterialThemeSwitcher/index-8d22de5a.js +0 -48
  104. package/_internal/utils/Portal/index-6e0a7404.js +0 -44
  105. package/_internal/utils/disabled/index-075b99c3.js +0 -36
  106. package/_internal/utils/type/index-ea9fc197.js +0 -2
@@ -1,59 +0,0 @@
1
- import classNames from 'classnames';
2
- import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
3
- import { u as useTheme } from '../../3181f000.js';
4
- import { f as forwardRef } from '../../8bce732e.js';
5
- import { jsxs, jsx } from 'react/jsx-runtime';
6
- import { Theme, ColorPalette, Size } from '@lumx/core/js/constants';
7
- import { I as Icon } from '../../bace1bf1.js';
8
- import { T as Text } from '../../e913a3af.js';
9
-
10
- const COMPONENT_NAME = 'Flag';
11
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
12
- const DEFAULT_PROPS = {};
13
-
14
- /**
15
- * Flag component.
16
- *
17
- * @param props Component props.
18
- * @param ref Component ref.
19
- * @return React element.
20
- */
21
- const Flag = forwardRef((props, ref) => {
22
- const defaultTheme = useTheme() || Theme.light;
23
- const {
24
- label,
25
- icon,
26
- color,
27
- className,
28
- theme = defaultTheme,
29
- truncate,
30
- ...forwardedProps
31
- } = props;
32
- const flagColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);
33
- const isTruncated = !!truncate;
34
- return /*#__PURE__*/jsxs("div", {
35
- ...forwardedProps,
36
- className: classNames(className, handleBasicClasses({
37
- prefix: CLASSNAME,
38
- color: flagColor,
39
- isTruncated
40
- })),
41
- ref: ref,
42
- children: [icon && /*#__PURE__*/jsx(Icon, {
43
- icon: icon,
44
- size: Size.xxs,
45
- className: `${CLASSNAME}__icon`
46
- }), /*#__PURE__*/jsx(Text, {
47
- as: "span",
48
- truncate: isTruncated,
49
- typography: "overline",
50
- className: `${CLASSNAME}__label`,
51
- children: label
52
- })]
53
- });
54
- });
55
- Flag.displayName = COMPONENT_NAME;
56
- Flag.className = CLASSNAME;
57
- Flag.defaultProps = DEFAULT_PROPS;
58
-
59
- export { Flag };
@@ -1,56 +0,0 @@
1
- import classNames from 'classnames';
2
- import castArray from 'lodash/castArray';
3
- import { Orientation } from '@lumx/core/js/constants';
4
- import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
5
- import { f as forwardRef } from '../../8bce732e.js';
6
- import { jsx } from 'react/jsx-runtime';
7
-
8
- /**
9
- * Component display name.
10
- */
11
- const COMPONENT_NAME = 'FlexBox';
12
-
13
- /**
14
- * Component default class name and class prefix.
15
- */
16
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
17
-
18
- /**
19
- * FlexBox component.
20
- *
21
- * @param props Component props.
22
- * @param ref Component ref.
23
- * @return React element.
24
- */
25
- const FlexBox = forwardRef((props, ref) => {
26
- const {
27
- as: Component = 'div',
28
- children,
29
- className,
30
- fillSpace,
31
- gap,
32
- hAlign,
33
- marginAuto,
34
- noShrink,
35
- orientation,
36
- vAlign,
37
- wrap,
38
- ...forwardedProps
39
- } = props;
40
- return /*#__PURE__*/jsx(Component, {
41
- ref: ref,
42
- ...forwardedProps,
43
- className: classNames(className, handleBasicClasses({
44
- prefix: CLASSNAME,
45
- orientation: orientation ?? (wrap || hAlign || vAlign ? Orientation.horizontal : null),
46
- vAlign,
47
- hAlign,
48
- gap
49
- }), wrap && `${CLASSNAME}--wrap`, fillSpace && `${CLASSNAME}--fill-space`, noShrink && `${CLASSNAME}--no-shrink`, marginAuto && castArray(marginAuto).map(align => `${CLASSNAME}--margin-auto-${align}`)),
50
- children: children
51
- });
52
- });
53
- FlexBox.displayName = COMPONENT_NAME;
54
- FlexBox.className = CLASSNAME;
55
-
56
- export { FlexBox };
@@ -1,124 +0,0 @@
1
- import React__default, { Children } from 'react';
2
- import classNames from 'classnames';
3
- import isEmpty from 'lodash/isEmpty';
4
- import noop from 'lodash/noop';
5
- import { getRootClassName } from '@lumx/core/js/utils/className';
6
- import { p as partitionMulti } from '../../4daccdd5.js';
7
- import { f as forwardRef } from '../../8bce732e.js';
8
- import { jsxs } from 'react/jsx-runtime';
9
- import { i as isComponentType } from '../../e806b848.js';
10
- import { Size, Orientation } from '@lumx/core/js/constants';
11
- import { FlexBox } from '../flex-box/index-0d6b6b43.js';
12
- import pick from 'lodash/pick';
13
-
14
- /**
15
- * Component display name.
16
- */
17
- const COMPONENT_NAME = 'GenericBlock';
18
-
19
- /**
20
- * Component default class name and class prefix.
21
- */
22
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
23
-
24
- /**
25
- * Component default props.
26
- */
27
- const DEFAULT_PROPS = {
28
- gap: Size.big,
29
- orientation: Orientation.horizontal
30
- };
31
- const Figure = noop.bind({});
32
- const isFigure = isComponentType(Figure);
33
- const Content = noop.bind({});
34
- const isContent = isComponentType(Content);
35
- const Actions = noop.bind({});
36
- const isActions = isComponentType(Actions);
37
-
38
- /**
39
- * The GenericBlock is a layout component made of 3 sections that can be
40
- * displayed either horizontally of vertically with the same gap between each section.
41
- *
42
- * The sections are:
43
- * - `Figure` => A visual element to display before the main content.
44
- * - `Content` => The main content displayed
45
- * - `Actions` => One or more actions to set after the element.
46
- *
47
- * @see https://www.figma.com/file/lzzrQmsfaXRaOyRfoEogPZ/DS%3A-playground?node-id=1%3A4076
48
- */
49
- const BaseGenericBlock = forwardRef((props, ref) => {
50
- const {
51
- className,
52
- figure,
53
- figureProps,
54
- children,
55
- actions,
56
- actionsProps,
57
- gap = DEFAULT_PROPS.gap,
58
- orientation = DEFAULT_PROPS.orientation,
59
- contentProps,
60
- ...forwardedProps
61
- } = props;
62
- const sections = React__default.useMemo(() => {
63
- // Split children by section type
64
- const [[figureChild], [contentChild], [actionsChild], ...otherChildren] = partitionMulti(Children.toArray(children), [isFigure, isContent, isActions]);
65
- return {
66
- figureChild,
67
- figureChildProps: figureChild?.props,
68
- contentChild,
69
- contentChildProps: contentChild?.props,
70
- actionsChild,
71
- actionsChildProps: actionsChild?.props,
72
- otherChildren: otherChildren.filter(child => !isEmpty(child))
73
- };
74
- }, [children]);
75
- return /*#__PURE__*/jsxs(FlexBox, {
76
- ref: ref,
77
- className: classNames(className, CLASSNAME),
78
- gap: gap,
79
- orientation: orientation,
80
- ...forwardedProps,
81
- children: [(figure || sections.figureChildProps?.children) && /*#__PURE__*/jsxs(FlexBox, {
82
- ref: sections.figureChild?.ref,
83
- vAlign: forwardedProps.vAlign,
84
- hAlign: forwardedProps.hAlign,
85
- ...figureProps,
86
- ...sections.figureChildProps,
87
- className: classNames(figureProps?.className, sections.figureChildProps?.className, `${CLASSNAME}__figure`),
88
- children: [figure, sections.figureChildProps?.children]
89
- }), (sections.contentChildProps?.children || sections.otherChildren.length > 0) && /*#__PURE__*/jsxs(FlexBox, {
90
- ref: sections.contentChild?.ref,
91
- orientation: Orientation.vertical,
92
- fillSpace: true,
93
- vAlign: forwardedProps.vAlign,
94
- hAlign: forwardedProps.hAlign,
95
- ...contentProps,
96
- ...sections.contentChildProps,
97
- className: classNames(contentProps?.className, sections.contentChildProps?.className, `${CLASSNAME}__content`),
98
- children: [sections.contentChildProps?.children, sections.otherChildren]
99
- }), (actions || sections.actionsChildProps?.children) && /*#__PURE__*/jsxs(FlexBox, {
100
- ref: sections.actionsChild?.ref,
101
- vAlign: forwardedProps.vAlign,
102
- hAlign: forwardedProps.hAlign,
103
- ...actionsProps,
104
- ...sections.actionsChildProps,
105
- className: classNames(actionsProps?.className, sections.actionsChildProps?.className, `${CLASSNAME}__actions`),
106
- children: [actions, sections.actionsChildProps?.children]
107
- })]
108
- });
109
- });
110
- BaseGenericBlock.displayName = COMPONENT_NAME;
111
- BaseGenericBlock.className = CLASSNAME;
112
- BaseGenericBlock.defaultProps = DEFAULT_PROPS;
113
- const GenericBlock = Object.assign(BaseGenericBlock, {
114
- Figure,
115
- Content,
116
- Actions
117
- });
118
-
119
- /**
120
- * Accepted gap sizes for the generic block.
121
- */
122
- const GenericBlockGapSize = pick(Size, ['tiny', 'regular', 'medium', 'big', 'huge']);
123
-
124
- export { GenericBlock, GenericBlockGapSize };
@@ -1,104 +0,0 @@
1
- import classNames from 'classnames';
2
- import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
3
- import { f as forwardRef } from '../../8bce732e.js';
4
- import { jsx } from 'react/jsx-runtime';
5
- import { Orientation } from '@lumx/core/js/constants';
6
-
7
- /**
8
- * Component display name.
9
- */
10
- const COMPONENT_NAME$1 = 'Grid';
11
-
12
- /**
13
- * Component default class name and class prefix.
14
- */
15
- const CLASSNAME$1 = getRootClassName(COMPONENT_NAME$1);
16
-
17
- /**
18
- * Component default props.
19
- */
20
- const DEFAULT_PROPS = {
21
- orientation: Orientation.horizontal,
22
- wrap: 'nowrap'
23
- };
24
-
25
- /**
26
- * Grid component.
27
- *
28
- * @param props Component props.
29
- * @param ref Component ref.
30
- * @return React element.
31
- */
32
- const Grid = forwardRef((props, ref) => {
33
- const {
34
- children,
35
- className,
36
- gutter,
37
- hAlign,
38
- orientation = DEFAULT_PROPS.orientation,
39
- vAlign,
40
- wrap = DEFAULT_PROPS.wrap,
41
- ...forwardedProps
42
- } = props;
43
- return /*#__PURE__*/jsx("div", {
44
- ref: ref,
45
- ...forwardedProps,
46
- className: classNames(className, `${CLASSNAME$1}-container`, {
47
- [`${CLASSNAME$1}--h-align-${hAlign}`]: hAlign
48
- }, {
49
- [`${CLASSNAME$1}--v-align-${vAlign}`]: vAlign
50
- }, handleBasicClasses({
51
- prefix: CLASSNAME$1,
52
- orientation,
53
- wrap,
54
- gutter
55
- })),
56
- children: children
57
- });
58
- });
59
- Grid.displayName = COMPONENT_NAME$1;
60
- Grid.className = CLASSNAME$1;
61
- Grid.defaultProps = DEFAULT_PROPS;
62
-
63
- /**
64
- * Component display name.
65
- */
66
- const COMPONENT_NAME = 'GridItem';
67
-
68
- /**
69
- * Component default class name and class prefix.
70
- */
71
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
72
-
73
- /**
74
- * GridItem component.
75
- *
76
- * @param props Component props.
77
- * @param ref Component ref.
78
- * @return React element.
79
- */
80
- const GridItem = forwardRef((props, ref) => {
81
- const {
82
- children,
83
- className,
84
- width,
85
- align,
86
- order,
87
- ...forwardedProps
88
- } = props;
89
- return /*#__PURE__*/jsx("div", {
90
- ref: ref,
91
- ...forwardedProps,
92
- className: classNames(className, handleBasicClasses({
93
- prefix: CLASSNAME,
94
- width,
95
- order,
96
- align
97
- })),
98
- children: children
99
- });
100
- });
101
- GridItem.displayName = COMPONENT_NAME;
102
- GridItem.className = CLASSNAME;
103
-
104
- export { Grid, GridItem };
@@ -1,59 +0,0 @@
1
- import isInteger from 'lodash/isInteger';
2
- import classNames from 'classnames';
3
- import { getRootClassName } from '@lumx/core/js/utils/className';
4
- import { f as forwardRef } from '../../8bce732e.js';
5
- import { jsx } from 'react/jsx-runtime';
6
-
7
- /**
8
- * Component display name.
9
- */
10
- const COMPONENT_NAME = 'GridColumn';
11
-
12
- /**
13
- * Component default class name and class prefix.
14
- */
15
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
16
-
17
- /**
18
- * Component default props.
19
- */
20
- const DEFAULT_PROPS = {};
21
-
22
- /**
23
- * The GridColumn is a layout component that can display children in a grid
24
- * with custom display properties. It also comes with a responsive design,
25
- * with a number of column that reduce when there is not enough space for each item.
26
- *
27
- * @param props Component props.
28
- * @param ref Component ref.
29
- * @return React element.
30
- */
31
- const GridColumn = forwardRef((props, ref) => {
32
- const {
33
- as: Component = 'div',
34
- gap,
35
- maxColumns,
36
- itemMinWidth,
37
- children,
38
- className,
39
- style = {},
40
- ...forwardedProps
41
- } = props;
42
- return /*#__PURE__*/jsx(Component, {
43
- ...forwardedProps,
44
- ref: ref,
45
- className: classNames(className, CLASSNAME),
46
- style: {
47
- ...style,
48
- ['--lumx-grid-column-item-min-width']: isInteger(itemMinWidth) && `${itemMinWidth}px`,
49
- ['--lumx-grid-column-columns']: maxColumns,
50
- ['--lumx-grid-column-gap']: gap && `var(--lumx-spacing-unit-${gap})`
51
- },
52
- children: children
53
- });
54
- });
55
- GridColumn.displayName = COMPONENT_NAME;
56
- GridColumn.className = CLASSNAME;
57
- GridColumn.defaultProps = DEFAULT_PROPS;
58
-
59
- export { GridColumn };
@@ -1,53 +0,0 @@
1
- import classNames from 'classnames';
2
- import { getRootClassName } from '@lumx/core/js/utils/className';
3
- import { f as forwardRef } from '../../8bce732e.js';
4
- import { u as useHeadingLevel, D as DEFAULT_TYPOGRAPHY_BY_LEVEL } from '../../ebdcb0c7.js';
5
- export { H as HeadingLevelProvider } from '../../ebdcb0c7.js';
6
- import { jsx } from 'react/jsx-runtime';
7
- import { T as Text } from '../../e913a3af.js';
8
-
9
- /**
10
- * Component display name.
11
- */
12
- const COMPONENT_NAME = 'Heading';
13
-
14
- /**
15
- * Component default class name and class prefix.
16
- */
17
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
18
-
19
- /**
20
- * Component default props.
21
- */
22
- const DEFAULT_PROPS = {};
23
-
24
- /**
25
- * Renders a heading component.
26
- * Extends the `Text` Component with the heading level automatically computed based on
27
- * the current level provided by the context.
28
- */
29
- const Heading = forwardRef((props, ref) => {
30
- const {
31
- children,
32
- as,
33
- className,
34
- ...forwardedProps
35
- } = props;
36
- const {
37
- headingElement
38
- } = useHeadingLevel();
39
- const computedHeadingElement = as || headingElement;
40
- return /*#__PURE__*/jsx(Text, {
41
- ref: ref,
42
- className: classNames(className, CLASSNAME),
43
- as: computedHeadingElement,
44
- typography: DEFAULT_TYPOGRAPHY_BY_LEVEL[computedHeadingElement],
45
- ...forwardedProps,
46
- children: children
47
- });
48
- });
49
- Heading.displayName = COMPONENT_NAME;
50
- Heading.className = CLASSNAME;
51
- Heading.defaultProps = DEFAULT_PROPS;
52
-
53
- export { Heading, useHeadingLevel };
@@ -1 +0,0 @@
1
- export { I as Icon } from '../../bace1bf1.js';
@@ -1,110 +0,0 @@
1
- import classNames from 'classnames';
2
- import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
3
- import { f as forwardRef } from '../../8bce732e.js';
4
- import { u as useTheme } from '../../3181f000.js';
5
- import { I as ImageCaption } from '../../5cef5e8c.js';
6
- import { jsxs, jsx } from 'react/jsx-runtime';
7
- import { Alignment, Theme } from '@lumx/core/js/constants';
8
- import { T as Thumbnail } from '../../035c132d.js';
9
-
10
- const ImageBlockCaptionPosition = {
11
- below: 'below',
12
- over: 'over'
13
- };
14
-
15
- /**
16
- * Image block sizes.
17
- */
18
-
19
- /**
20
- * Defines the props of the component.
21
- */
22
-
23
- /**
24
- * Component display name.
25
- */
26
- const COMPONENT_NAME = 'ImageBlock';
27
-
28
- /**
29
- * Component default class name and class prefix.
30
- */
31
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
32
-
33
- /**
34
- * Component default props.
35
- */
36
- const DEFAULT_PROPS = {
37
- captionPosition: ImageBlockCaptionPosition.below,
38
- align: Alignment.left
39
- };
40
-
41
- /**
42
- * ImageBlock component.
43
- *
44
- * @param props Component props.
45
- * @param ref Component ref.
46
- * @return React element.
47
- */
48
- const ImageBlock = forwardRef((props, ref) => {
49
- const defaultTheme = useTheme() || Theme.light;
50
- const {
51
- actions,
52
- align = DEFAULT_PROPS.align,
53
- alt,
54
- captionPosition = DEFAULT_PROPS.captionPosition,
55
- captionStyle,
56
- className,
57
- description,
58
- descriptionProps,
59
- fillHeight,
60
- image,
61
- size,
62
- tags,
63
- theme = defaultTheme,
64
- thumbnailProps,
65
- title,
66
- titleProps,
67
- ...forwardedProps
68
- } = props;
69
- return /*#__PURE__*/jsxs("figure", {
70
- ref: ref,
71
- ...forwardedProps,
72
- className: classNames(className, handleBasicClasses({
73
- prefix: CLASSNAME,
74
- captionPosition,
75
- align,
76
- size,
77
- theme
78
- }), fillHeight && `${CLASSNAME}--fill-height`),
79
- children: [/*#__PURE__*/jsx(Thumbnail, {
80
- ...thumbnailProps,
81
- className: classNames(`${CLASSNAME}__image`, thumbnailProps?.className),
82
- fillHeight: fillHeight,
83
- align: align,
84
- image: image,
85
- size: size,
86
- theme: theme,
87
- alt: alt || title
88
- }), /*#__PURE__*/jsx(ImageCaption, {
89
- as: "figcaption",
90
- baseClassName: CLASSNAME,
91
- theme: theme,
92
- title: title,
93
- titleProps: titleProps,
94
- description: description,
95
- descriptionProps: descriptionProps,
96
- tags: tags,
97
- captionStyle: captionStyle,
98
- align: align,
99
- truncate: captionPosition === 'over'
100
- }), actions && /*#__PURE__*/jsx("div", {
101
- className: `${CLASSNAME}__actions`,
102
- children: actions
103
- })]
104
- });
105
- });
106
- ImageBlock.displayName = COMPONENT_NAME;
107
- ImageBlock.className = CLASSNAME;
108
- ImageBlock.defaultProps = DEFAULT_PROPS;
109
-
110
- export { ImageBlock, ImageBlockCaptionPosition };