@lumx/react 4.3.2-alpha.2 → 4.3.2-alpha.3

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.js CHANGED
@@ -1,13 +1,13 @@
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
- export * from '@lumx/core/js/constants';
3
- export * from '@lumx/core/js/types';
1
+ import { Kind as Kind$1, Size as Size$1, ColorPalette as ColorPalette$1, Emphasis as Emphasis$1, Theme as Theme$1, AspectRatio as AspectRatio$1, ColorVariant, DIALOG_TRANSITION_DURATION, Orientation as Orientation$1, Alignment, NOTIFICATION_TRANSITION_DURATION, TOOLTIP_LONG_PRESS_DELAY, TOOLTIP_HOVER_DELAY } from '@lumx/core/js/constants/index.js';
2
+ export * from '@lumx/core/js/constants/index.js';
3
+ export * from '@lumx/core/js/types/index.js';
4
4
  import * as React from 'react';
5
5
  import React__default, { useState, useEffect, useMemo, useRef, useCallback, Children, useLayoutEffect, cloneElement, createContext, isValidElement, useContext, useReducer } from 'react';
6
- import { mdiAlert } from '@lumx/icons/esm/alert';
7
- import { mdiAlertCircle } from '@lumx/icons/esm/alert-circle';
8
- import { mdiCheckCircle } from '@lumx/icons/esm/check-circle';
9
- import { mdiInformation } from '@lumx/icons/esm/information';
10
- import { classNames, onEnterPressed, onEscapePressed, onButtonPressed, detectHorizontalSwipe } from '@lumx/core/js/utils';
6
+ import { mdiAlert } from '@lumx/icons/esm/alert.js';
7
+ import { mdiAlertCircle } from '@lumx/icons/esm/alert-circle.js';
8
+ import { mdiCheckCircle } from '@lumx/icons/esm/check-circle.js';
9
+ import { mdiInformation } from '@lumx/icons/esm/information.js';
10
+ import { classNames, onEnterPressed, onEscapePressed, onButtonPressed, detectHorizontalSwipe } from '@lumx/core/js/utils/index.js';
11
11
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
12
12
  import last from 'lodash/last';
13
13
  import pull from 'lodash/pull';
@@ -18,38 +18,38 @@ import partition from 'lodash/partition';
18
18
  import reduce from 'lodash/reduce';
19
19
  import { u as useDisabledStateContext, P as Portal, C as ClickAwayProvider } from './_internal/DpdvhbTO.js';
20
20
  import isEmpty from 'lodash/isEmpty';
21
- import { getDisabledState } from '@lumx/core/js/utils/disabledState';
22
- import { mdiCloseCircle } from '@lumx/icons/esm/close-circle';
21
+ import { getDisabledState } from '@lumx/core/js/utils/disabledState/index.js';
22
+ import { mdiCloseCircle } from '@lumx/icons/esm/close-circle.js';
23
23
  import memoize from 'lodash/memoize';
24
- import { mdiClose } from '@lumx/icons/esm/close';
24
+ import { mdiClose } from '@lumx/icons/esm/close.js';
25
25
  import isFunction from 'lodash/isFunction';
26
- import { mdiImageBroken } from '@lumx/icons/esm/image-broken';
27
- import { mdiCheck } from '@lumx/icons/esm/check';
28
- import { mdiMinus } from '@lumx/icons/esm/minus';
29
- import { mdiChevronLeft } from '@lumx/icons/esm/chevron-left';
30
- import { mdiChevronRight } from '@lumx/icons/esm/chevron-right';
26
+ import { mdiImageBroken } from '@lumx/icons/esm/image-broken.js';
27
+ import { mdiCheck } from '@lumx/icons/esm/check.js';
28
+ import { mdiMinus } from '@lumx/icons/esm/minus.js';
29
+ import { mdiChevronLeft } from '@lumx/icons/esm/chevron-left.js';
30
+ import { mdiChevronRight } from '@lumx/icons/esm/chevron-right.js';
31
31
  import castArray from 'lodash/castArray';
32
- import { mdiDragVertical } from '@lumx/icons/esm/drag-vertical';
33
- import { mdiChevronDown } from '@lumx/icons/esm/chevron-down';
34
- import { mdiChevronUp } from '@lumx/icons/esm/chevron-up';
32
+ import { mdiDragVertical } from '@lumx/icons/esm/drag-vertical.js';
33
+ import { mdiChevronDown } from '@lumx/icons/esm/chevron-down.js';
34
+ import { mdiChevronUp } from '@lumx/icons/esm/chevron-up.js';
35
35
  import noop from 'lodash/noop';
36
36
  import pick from 'lodash/pick';
37
37
  import isInteger from 'lodash/isInteger';
38
- import { mdiMagnifyMinusOutline } from '@lumx/icons/esm/magnify-minus-outline';
39
- import { mdiMagnifyPlusOutline } from '@lumx/icons/esm/magnify-plus-outline';
38
+ import { mdiMagnifyMinusOutline } from '@lumx/icons/esm/magnify-minus-outline.js';
39
+ import { mdiMagnifyPlusOutline } from '@lumx/icons/esm/magnify-plus-outline.js';
40
40
  import throttle from 'lodash/throttle';
41
41
  import range from 'lodash/range';
42
- import { mdiPlayCircleOutline } from '@lumx/icons/esm/play-circle-outline';
43
- import { mdiPauseCircleOutline } from '@lumx/icons/esm/pause-circle-outline';
42
+ import { mdiPlayCircleOutline } from '@lumx/icons/esm/play-circle-outline.js';
43
+ import { mdiPauseCircleOutline } from '@lumx/icons/esm/pause-circle-outline.js';
44
44
  import chunk from 'lodash/chunk';
45
45
  import ReactDOM from 'react-dom';
46
46
  import take from 'lodash/take';
47
- import { mdiRadioboxBlank } from '@lumx/icons/esm/radiobox-blank';
48
- import { mdiRadioboxMarked } from '@lumx/icons/esm/radiobox-marked';
49
- import { mdiMenuDown } from '@lumx/icons/esm/menu-down';
50
- import { getWithSelector } from '@lumx/core/js/utils/selectors/getWithSelector';
51
- import { mdiArrowDown } from '@lumx/icons/esm/arrow-down';
52
- import { mdiArrowUp } from '@lumx/icons/esm/arrow-up';
47
+ import { mdiRadioboxBlank } from '@lumx/icons/esm/radiobox-blank.js';
48
+ import { mdiRadioboxMarked } from '@lumx/icons/esm/radiobox-marked.js';
49
+ import { mdiMenuDown } from '@lumx/icons/esm/menu-down.js';
50
+ import { getWithSelector } from '@lumx/core/js/utils/selectors/getWithSelector/index.js';
51
+ import { mdiArrowDown } from '@lumx/icons/esm/arrow-down.js';
52
+ import { mdiArrowUp } from '@lumx/icons/esm/arrow-up.js';
53
53
  import set from 'lodash/set';
54
54
 
55
55
  let i = 0;
@@ -96,7 +96,7 @@ const CONFIG$1 = {
96
96
  /**
97
97
  * Component display name.
98
98
  */
99
- const COMPONENT_NAME$1k = 'AlertDialog';
99
+ const COMPONENT_NAME$1l = 'AlertDialog';
100
100
 
101
101
  /**
102
102
  * Component default class name and class prefix.
@@ -217,7 +217,7 @@ const AlertDialog = forwardRef((props, ref) => {
217
217
  })]
218
218
  });
219
219
  });
220
- AlertDialog.displayName = COMPONENT_NAME$1k;
220
+ AlertDialog.displayName = COMPONENT_NAME$1l;
221
221
  AlertDialog.className = CLASSNAME$1j;
222
222
  AlertDialog.defaultProps = DEFAULT_PROPS$1a;
223
223
 
@@ -311,7 +311,7 @@ function useDisableStateProps(props) {
311
311
  /**
312
312
  * Component display name.
313
313
  */
314
- const COMPONENT_NAME$1j = 'Autocomplete';
314
+ const COMPONENT_NAME$1k = 'Autocomplete';
315
315
 
316
316
  /**
317
317
  * Component default class name and class prefix.
@@ -423,14 +423,14 @@ const Autocomplete = forwardRef((props, ref) => {
423
423
  })]
424
424
  });
425
425
  });
426
- Autocomplete.displayName = COMPONENT_NAME$1j;
426
+ Autocomplete.displayName = COMPONENT_NAME$1k;
427
427
  Autocomplete.className = CLASSNAME$1i;
428
428
  Autocomplete.defaultProps = DEFAULT_PROPS$19;
429
429
 
430
430
  /**
431
431
  * Component display name.
432
432
  */
433
- const COMPONENT_NAME$1i = 'AutocompleteMultiple';
433
+ const COMPONENT_NAME$1j = 'AutocompleteMultiple';
434
434
 
435
435
  /**
436
436
  * Component default class name and class prefix.
@@ -548,14 +548,14 @@ const AutocompleteMultiple = forwardRef((props, ref) => {
548
548
  children: children
549
549
  });
550
550
  });
551
- AutocompleteMultiple.displayName = COMPONENT_NAME$1i;
551
+ AutocompleteMultiple.displayName = COMPONENT_NAME$1j;
552
552
  AutocompleteMultiple.className = CLASSNAME$1h;
553
553
  AutocompleteMultiple.defaultProps = DEFAULT_PROPS$18;
554
554
 
555
555
  /**
556
556
  * Component display name.
557
557
  */
558
- const COMPONENT_NAME$1h = 'Avatar';
558
+ const COMPONENT_NAME$1i = 'Avatar';
559
559
 
560
560
  /**
561
561
  * Component default class name and class prefix.
@@ -611,7 +611,7 @@ const Avatar = forwardRef((props, ref) => {
611
611
  onClick: onClick,
612
612
  onKeyPress: onKeyPress,
613
613
  ...thumbnailProps,
614
- aspectRatio: AspectRatio.square,
614
+ aspectRatio: AspectRatio$1.square,
615
615
  size: size,
616
616
  image: image,
617
617
  alt: alt,
@@ -625,85 +625,10 @@ const Avatar = forwardRef((props, ref) => {
625
625
  })]
626
626
  });
627
627
  });
628
- Avatar.displayName = COMPONENT_NAME$1h;
628
+ Avatar.displayName = COMPONENT_NAME$1i;
629
629
  Avatar.className = CLASSNAME$1g;
630
630
  Avatar.defaultProps = DEFAULT_PROPS$17;
631
631
 
632
- /**
633
- * Component display name.
634
- */
635
- const COMPONENT_NAME$1g = 'Badge';
636
-
637
- /**
638
- * Component default class name and class prefix.
639
- */
640
- const CLASSNAME$1f = 'lumx-badge';
641
- const {
642
- block: block$12
643
- } = classNames.bem(CLASSNAME$1f);
644
-
645
- /**
646
- * Component default props.
647
- */
648
- const DEFAULT_PROPS$16 = {
649
- color: ColorPalette$1.primary
650
- };
651
-
652
- /**
653
- * Badge component.
654
- *
655
- * @param props Component props.
656
- * @param ref Component ref.
657
- * @return React element.
658
- */
659
- const Badge = forwardRef((props, ref) => {
660
- const {
661
- children,
662
- className,
663
- color = DEFAULT_PROPS$16.color,
664
- ...forwardedProps
665
- } = props;
666
- return /*#__PURE__*/jsx("div", {
667
- ref: ref,
668
- ...forwardedProps,
669
- className: classNames.join(className, block$12({
670
- [`color-${color}`]: Boolean(color)
671
- })),
672
- children: children
673
- });
674
- });
675
- Badge.displayName = COMPONENT_NAME$1g;
676
- Badge.className = CLASSNAME$1f;
677
- Badge.defaultProps = DEFAULT_PROPS$16;
678
-
679
- /**
680
- * Component default class name and class prefix.
681
- */
682
- const CLASSNAME$1e = 'lumx-badge-wrapper';
683
- const {
684
- block: block$11,
685
- element: element$M
686
- } = classNames.bem(CLASSNAME$1e);
687
- const BadgeWrapper = forwardRef((props, ref) => {
688
- const {
689
- badge,
690
- children,
691
- className,
692
- ...forwardedProps
693
- } = props;
694
- return /*#__PURE__*/jsxs("div", {
695
- ref: ref,
696
- ...forwardedProps,
697
- className: classNames.join(className, block$11()),
698
- children: [children, badge && /*#__PURE__*/jsx("div", {
699
- className: element$M('badge'),
700
- children: badge
701
- })]
702
- });
703
- });
704
- BadgeWrapper.displayName = 'BadgeWrapper';
705
- BadgeWrapper.className = CLASSNAME$1e;
706
-
707
632
  /**
708
633
  * Alignments.
709
634
  */
@@ -743,6 +668,12 @@ const TypographyInterface = {
743
668
  */
744
669
  const Typography = {
745
670
  ...TypographyInterface};
671
+ /**
672
+ * All available aspect ratios.
673
+ */
674
+ const AspectRatio = {
675
+ /** Intrinsic content ratio. */
676
+ original: 'original'};
746
677
  /**
747
678
  * Semantic info about the purpose of the component
748
679
  */
@@ -926,7 +857,7 @@ function modifier$1(baseName, modifiers) {
926
857
  * block('button', { active: true, disabled: false }); // 'button button--active'
927
858
  */
928
859
 
929
- function block$10(baseName, modifiersOrAdditionalClasses, additionalClasses) {
860
+ function block$12(baseName, modifiersOrAdditionalClasses, additionalClasses) {
930
861
  let modifiers;
931
862
  let classes;
932
863
  if (Array.isArray(modifiersOrAdditionalClasses)) {
@@ -961,11 +892,11 @@ function block$10(baseName, modifiersOrAdditionalClasses, additionalClasses) {
961
892
  * element('my-button', 'icon', { active: true }); // 'my-button__icon my-button__icon--active'
962
893
  */
963
894
 
964
- function element$L(baseClass, elem, modifiersOrAdditionalClasses, additionalClasses) {
895
+ function element$M(baseClass, elem, modifiersOrAdditionalClasses, additionalClasses) {
965
896
  if (Array.isArray(modifiersOrAdditionalClasses)) {
966
- return block$10(`${baseClass}__${elem}`, modifiersOrAdditionalClasses);
897
+ return block$12(`${baseClass}__${elem}`, modifiersOrAdditionalClasses);
967
898
  }
968
- return block$10(`${baseClass}__${elem}`, modifiersOrAdditionalClasses, additionalClasses);
899
+ return block$12(`${baseClass}__${elem}`, modifiersOrAdditionalClasses, additionalClasses);
969
900
  }
970
901
 
971
902
  /**
@@ -974,15 +905,15 @@ function element$L(baseClass, elem, modifiersOrAdditionalClasses, additionalClas
974
905
  function bem(baseName) {
975
906
  function blockFn(modifiersOrAdditionalClasses, additionalClasses) {
976
907
  if (Array.isArray(modifiersOrAdditionalClasses)) {
977
- return block$10(baseName, modifiersOrAdditionalClasses);
908
+ return block$12(baseName, modifiersOrAdditionalClasses);
978
909
  }
979
- return block$10(baseName, modifiersOrAdditionalClasses, additionalClasses);
910
+ return block$12(baseName, modifiersOrAdditionalClasses, additionalClasses);
980
911
  }
981
912
  function elementFn(elem, modifiersOrAdditionalClasses, additionalClasses) {
982
913
  if (Array.isArray(modifiersOrAdditionalClasses)) {
983
- return element$L(baseName, elem, modifiersOrAdditionalClasses);
914
+ return element$M(baseName, elem, modifiersOrAdditionalClasses);
984
915
  }
985
- return element$L(baseName, elem, modifiersOrAdditionalClasses, additionalClasses);
916
+ return element$M(baseName, elem, modifiersOrAdditionalClasses, additionalClasses);
986
917
  }
987
918
  return {
988
919
  block: blockFn,
@@ -991,6 +922,108 @@ function bem(baseName) {
991
922
  };
992
923
  }
993
924
 
925
+ /**
926
+ * Component display name.
927
+ */
928
+ const COMPONENT_NAME$1h = 'Badge';
929
+
930
+ /**
931
+ * Component default class name and class prefix.
932
+ */
933
+ const CLASSNAME$1f = 'lumx-badge';
934
+ const {
935
+ block: block$11
936
+ } = bem(CLASSNAME$1f);
937
+
938
+ /**
939
+ * Component default props.
940
+ */
941
+ const DEFAULT_PROPS$16 = {
942
+ color: ColorPalette.primary
943
+ };
944
+
945
+ /**
946
+ * Badge component.
947
+ *
948
+ * @param props Component props.
949
+ * @return JSX element.
950
+ */
951
+ const Badge$1 = props => {
952
+ const {
953
+ children,
954
+ className,
955
+ color = DEFAULT_PROPS$16.color,
956
+ ref,
957
+ ...forwardedProps
958
+ } = props;
959
+ return /*#__PURE__*/jsx("div", {
960
+ ref: ref,
961
+ ...forwardedProps,
962
+ className: classnames(className, block$11({
963
+ [`color-${color}`]: Boolean(color)
964
+ })),
965
+ children: children
966
+ });
967
+ };
968
+ Badge$1.displayName = COMPONENT_NAME$1h;
969
+ Badge$1.className = CLASSNAME$1f;
970
+ Badge$1.defaultProps = DEFAULT_PROPS$16;
971
+
972
+ /**
973
+ * Defines the props of the component.
974
+ */
975
+
976
+ /**
977
+ * Badge component.
978
+ *
979
+ * @param props Component props.
980
+ * @param ref Component ref.
981
+ * @return React element.
982
+ */
983
+ const Badge = forwardRef((props, ref) => {
984
+ return Badge$1({
985
+ ...props,
986
+ ref
987
+ });
988
+ });
989
+ Badge.displayName = Badge$1.displayName;
990
+ Badge.className = Badge$1.className;
991
+ Badge.defaultProps = Badge$1.defaultProps;
992
+
993
+ const COMPONENT_NAME$1g = 'BadgeWrapper';
994
+ const CLASSNAME$1e = 'lumx-badge-wrapper';
995
+ const {
996
+ block: block$10,
997
+ element: element$L
998
+ } = bem(CLASSNAME$1e);
999
+ const BadgeWrapper$1 = props => {
1000
+ const {
1001
+ badge,
1002
+ children,
1003
+ className,
1004
+ ref,
1005
+ ...forwardedProps
1006
+ } = props;
1007
+ return /*#__PURE__*/jsxs("div", {
1008
+ ref: ref,
1009
+ ...forwardedProps,
1010
+ className: classnames(className, block$10()),
1011
+ children: [children, badge && /*#__PURE__*/jsx("div", {
1012
+ className: element$L('badge'),
1013
+ children: badge
1014
+ })]
1015
+ });
1016
+ };
1017
+
1018
+ const BadgeWrapper = forwardRef((props, ref) => {
1019
+ return BadgeWrapper$1({
1020
+ ...props,
1021
+ ref
1022
+ });
1023
+ });
1024
+ BadgeWrapper.displayName = COMPONENT_NAME$1g;
1025
+ BadgeWrapper.className = CLASSNAME$1e;
1026
+
994
1027
  /**
995
1028
  * Render clickable element (link, button or custom element)
996
1029
  * (also does some basic disabled state handling)
@@ -4041,7 +4074,7 @@ function getNodeName(element) {
4041
4074
  return element ? (element.nodeName || '').toLowerCase() : null;
4042
4075
  }
4043
4076
 
4044
- /*:: import type { Window } from '../types'; */
4077
+ /*:: import type { Window } from '../types.js'; */
4045
4078
 
4046
4079
  /*:: declare function getWindow(node: Node | Window): Window; */
4047
4080
  function getWindow(node) {
@@ -8887,7 +8920,7 @@ const LinkPreview = forwardRef((props, ref) => {
8887
8920
  // Avoid redundant links in focus order
8888
8921
  tabIndex: -1
8889
8922
  },
8890
- aspectRatio: AspectRatio.free,
8923
+ aspectRatio: AspectRatio$1.free,
8891
8924
  fillHeight: true
8892
8925
  })
8893
8926
  }), /*#__PURE__*/jsxs("div", {
@@ -9296,7 +9329,7 @@ const Mosaic = forwardRef((props, ref) => {
9296
9329
  align: align || Alignment.left,
9297
9330
  image: image,
9298
9331
  theme: theme,
9299
- aspectRatio: AspectRatio.free,
9332
+ aspectRatio: AspectRatio$1.free,
9300
9333
  fillHeight: true,
9301
9334
  onClick: handleImageClick?.(index, onClick) || onClick
9302
9335
  }), thumbnails.length > 4 && index === 3 && /*#__PURE__*/jsx("div", {
@@ -11075,6 +11108,8 @@ const SelectMultipleField = props => {
11075
11108
  const defaultTheme = useTheme();
11076
11109
  const {
11077
11110
  anchorRef,
11111
+ // We don't have a clear button in select multiple but it must be removed from the forwardedProps
11112
+ clearButtonProps,
11078
11113
  handleKeyboardNav,
11079
11114
  hasError,
11080
11115
  icon,
@@ -13071,7 +13106,7 @@ const CLASSNAME$c = 'lumx-table';
13071
13106
 
13072
13107
  const {
13073
13108
  block: block$d
13074
- } = classNames.bem(CLASSNAME$c);
13109
+ } = bem(CLASSNAME$c);
13075
13110
 
13076
13111
  /**
13077
13112
  * Defines the props of the component.
@@ -13086,29 +13121,54 @@ const DEFAULT_PROPS$f = {};
13086
13121
  * Table component.
13087
13122
  *
13088
13123
  * @param props Component props.
13089
- * @param ref Component ref.
13090
13124
  * @return React element.
13091
13125
  */
13092
- const Table = forwardRef((props, ref) => {
13093
- const defaultTheme = useTheme() || Theme$1.light;
13126
+ const Table$1 = props => {
13094
13127
  const {
13095
13128
  children,
13096
13129
  className,
13097
13130
  hasBefore,
13098
13131
  hasDividers,
13099
- theme = defaultTheme,
13132
+ ref,
13133
+ theme,
13100
13134
  ...forwardedProps
13101
13135
  } = props;
13102
13136
  return /*#__PURE__*/jsx("table", {
13103
13137
  ref: ref,
13104
13138
  ...forwardedProps,
13105
- className: classNames.join(className, block$d({
13139
+ className: classnames(className, block$d({
13106
13140
  'has-before': hasBefore,
13107
13141
  'has-dividers': hasDividers,
13108
13142
  [`theme-${theme}`]: Boolean(theme)
13109
13143
  })),
13110
13144
  children: children
13111
13145
  });
13146
+ };
13147
+
13148
+ /**
13149
+ * Defines the props of the component.
13150
+ */
13151
+
13152
+ /**
13153
+ * Table component.
13154
+ *
13155
+ * @param props Component props.
13156
+ * @param ref Component ref.
13157
+ * @return React element.
13158
+ */
13159
+ const Table = forwardRef((props, ref) => {
13160
+ const defaultTheme = useTheme() || Theme$1.light;
13161
+ const {
13162
+ children,
13163
+ theme = defaultTheme,
13164
+ ...otherProps
13165
+ } = props;
13166
+ return Table$1({
13167
+ ref,
13168
+ theme,
13169
+ children,
13170
+ ...otherProps
13171
+ });
13112
13172
  });
13113
13173
  Table.displayName = COMPONENT_NAME$d;
13114
13174
  Table.className = CLASSNAME$c;
@@ -13128,21 +13188,44 @@ const CLASSNAME$b = `${CLASSNAME$c}__body`;
13128
13188
  * TableBody component.
13129
13189
  *
13130
13190
  * @param props Component props.
13131
- * @param ref Component ref.
13132
13191
  * @return React element.
13133
13192
  */
13134
- const TableBody = forwardRef((props, ref) => {
13193
+ const TableBody$1 = props => {
13135
13194
  const {
13136
13195
  children,
13137
13196
  className,
13197
+ ref,
13138
13198
  ...forwardedProps
13139
13199
  } = props;
13140
13200
  return /*#__PURE__*/jsx("tbody", {
13141
13201
  ref: ref,
13142
13202
  ...forwardedProps,
13143
- className: classNames.join(className, CLASSNAME$b),
13203
+ className: classnames(className, CLASSNAME$b),
13144
13204
  children: children
13145
13205
  });
13206
+ };
13207
+
13208
+ /**
13209
+ * Defines the props of the component.
13210
+ */
13211
+
13212
+ /**
13213
+ * TableBody component.
13214
+ *
13215
+ * @param props Component props.
13216
+ * @param ref Component ref.
13217
+ * @return React element.
13218
+ */
13219
+ const TableBody = forwardRef((props, ref) => {
13220
+ const {
13221
+ children,
13222
+ ...otherProps
13223
+ } = props;
13224
+ return TableBody$1({
13225
+ ref,
13226
+ children,
13227
+ ...otherProps
13228
+ });
13146
13229
  });
13147
13230
  TableBody.displayName = COMPONENT_NAME$c;
13148
13231
  TableBody.className = CLASSNAME$b;
@@ -13174,7 +13257,7 @@ const COMPONENT_NAME$b = 'TableCell';
13174
13257
  const CLASSNAME$a = `${CLASSNAME$c}__cell`;
13175
13258
  const {
13176
13259
  block: block$c
13177
- } = classNames.bem(CLASSNAME$a);
13260
+ } = bem(CLASSNAME$a);
13178
13261
 
13179
13262
  /**
13180
13263
  * Component default props.
@@ -13187,16 +13270,16 @@ const DEFAULT_PROPS$e = {
13187
13270
  * TableCell component.
13188
13271
  *
13189
13272
  * @param props Component props.
13190
- * @param ref Component ref.
13191
13273
  * @return React element.
13192
13274
  */
13193
- const TableCell = forwardRef((props, ref) => {
13275
+ const TableCell$1 = props => {
13194
13276
  const {
13195
13277
  children,
13196
13278
  className,
13197
13279
  icon,
13198
13280
  isSortable,
13199
13281
  onHeaderClick,
13282
+ ref,
13200
13283
  sortOrder,
13201
13284
  variant = DEFAULT_PROPS$e.variant,
13202
13285
  ...forwardedProps
@@ -13220,7 +13303,7 @@ const TableCell = forwardRef((props, ref) => {
13220
13303
  children: [variant === TableCellVariant.head && /*#__PURE__*/jsx("th", {
13221
13304
  ref: ref,
13222
13305
  ...forwardedProps,
13223
- className: classNames.join(className, block$c({
13306
+ className: classnames(className, block$c({
13224
13307
  'is-sortable': isSortable,
13225
13308
  'is-sorted': isSortable && !!sortOrder,
13226
13309
  head: true
@@ -13229,26 +13312,27 @@ const TableCell = forwardRef((props, ref) => {
13229
13312
  children: /*#__PURE__*/jsxs(Wrapper, {
13230
13313
  className: `${CLASSNAME$a}-wrapper`,
13231
13314
  ...wrapperProps,
13232
- children: [icon && !isSortable && /*#__PURE__*/jsx(Icon, {
13315
+ children: [icon && !isSortable && Icon$1({
13233
13316
  className: `${CLASSNAME$a}-icon`,
13234
- icon: icon,
13235
- size: Size$1.xxs
13236
- }), isSortable && sortOrder === ThOrder.asc && /*#__PURE__*/jsx(Icon, {
13317
+ icon,
13318
+ size: Size.xxs
13319
+ }), isSortable && sortOrder === ThOrder.asc && Icon$1({
13237
13320
  className: `${CLASSNAME$a}-icon`,
13238
13321
  icon: mdiArrowUp,
13239
- size: Size$1.xxs
13240
- }), isSortable && sortOrder === ThOrder.desc && /*#__PURE__*/jsx(Icon, {
13322
+ size: Size.xxs
13323
+ }), isSortable && sortOrder === ThOrder.desc && Icon$1({
13241
13324
  className: `${CLASSNAME$a}-icon`,
13242
13325
  icon: mdiArrowDown,
13243
- size: Size$1.xxs
13326
+ size: Size.xxs
13244
13327
  }), /*#__PURE__*/jsx("div", {
13245
13328
  className: `${CLASSNAME$a}-content`,
13246
13329
  children: children
13247
13330
  })]
13248
13331
  })
13249
13332
  }), variant === TableCellVariant.body && /*#__PURE__*/jsx("td", {
13333
+ ref: ref,
13250
13334
  ...forwardedProps,
13251
- className: classNames.join(className, block$c({
13335
+ className: classnames(className, block$c({
13252
13336
  body: true
13253
13337
  })),
13254
13338
  children: /*#__PURE__*/jsx("div", {
@@ -13257,6 +13341,29 @@ const TableCell = forwardRef((props, ref) => {
13257
13341
  })
13258
13342
  })]
13259
13343
  });
13344
+ };
13345
+
13346
+ /**
13347
+ * Defines the props of the component.
13348
+ */
13349
+
13350
+ /**
13351
+ * TableCell component.
13352
+ *
13353
+ * @param props Component props.
13354
+ * @param ref Component ref.
13355
+ * @return React element.
13356
+ */
13357
+ const TableCell = forwardRef((props, ref) => {
13358
+ const {
13359
+ children,
13360
+ ...otherProps
13361
+ } = props;
13362
+ return TableCell$1({
13363
+ ref,
13364
+ children,
13365
+ ...otherProps
13366
+ });
13260
13367
  });
13261
13368
  TableCell.displayName = COMPONENT_NAME$b;
13262
13369
  TableCell.className = CLASSNAME$a;
@@ -13281,21 +13388,44 @@ const DEFAULT_PROPS$d = {};
13281
13388
  * TableHeader component.
13282
13389
  *
13283
13390
  * @param props Component props.
13284
- * @param ref Component ref.
13285
13391
  * @return React element.
13286
13392
  */
13287
- const TableHeader = forwardRef((props, ref) => {
13393
+ const TableHeader$1 = props => {
13288
13394
  const {
13289
13395
  children,
13290
13396
  className,
13397
+ ref,
13291
13398
  ...forwardedProps
13292
13399
  } = props;
13293
13400
  return /*#__PURE__*/jsx("thead", {
13294
13401
  ref: ref,
13295
13402
  ...forwardedProps,
13296
- className: classNames.join(className, CLASSNAME$9),
13403
+ className: classnames(className, CLASSNAME$9),
13297
13404
  children: children
13298
13405
  });
13406
+ };
13407
+
13408
+ /**
13409
+ * Defines the props of the component.
13410
+ */
13411
+
13412
+ /**
13413
+ * TableHeader component.
13414
+ *
13415
+ * @param props Component props.
13416
+ * @param ref Component ref.
13417
+ * @return React element.
13418
+ */
13419
+ const TableHeader = forwardRef((props, ref) => {
13420
+ const {
13421
+ children,
13422
+ ...otherProps
13423
+ } = props;
13424
+ return TableHeader$1({
13425
+ ref,
13426
+ children,
13427
+ ...otherProps
13428
+ });
13299
13429
  });
13300
13430
  TableHeader.displayName = COMPONENT_NAME$a;
13301
13431
  TableHeader.className = CLASSNAME$9;
@@ -13312,7 +13442,7 @@ const COMPONENT_NAME$9 = 'TableRow';
13312
13442
  const CLASSNAME$8 = `${CLASSNAME$c}__row`;
13313
13443
  const {
13314
13444
  block: block$b
13315
- } = classNames.bem(CLASSNAME$8);
13445
+ } = bem(CLASSNAME$8);
13316
13446
 
13317
13447
  /**
13318
13448
  * Component default props.
@@ -13323,34 +13453,69 @@ const DEFAULT_PROPS$c = {};
13323
13453
  * TableRow component.
13324
13454
  *
13325
13455
  * @param props Component props.
13326
- * @param ref Component ref.
13327
13456
  * @return React element.
13328
13457
  */
13329
- const TableRow = forwardRef((props, ref) => {
13330
- const {
13331
- isAnyDisabled,
13332
- disabledStateProps,
13333
- otherProps
13334
- } = useDisableStateProps(props);
13458
+ const TableRow$1 = props => {
13335
13459
  const {
13336
13460
  children,
13337
13461
  className,
13338
13462
  isClickable,
13339
13463
  isSelected,
13464
+ ref,
13465
+ tabIndex,
13466
+ 'aria-disabled': ariaDisabled,
13340
13467
  ...forwardedProps
13341
- } = otherProps;
13468
+ } = props;
13469
+ const isDisabled = Boolean(ariaDisabled);
13470
+
13471
+ // Use object spread for tabIndex to ensure cross-framework compatibility (Vue JSX expects lowercase 'tabindex')
13472
+ const tabIndexProps = tabIndex !== undefined ? {
13473
+ tabIndex
13474
+ } : {};
13342
13475
  return /*#__PURE__*/jsx("tr", {
13343
13476
  ref: ref,
13344
- tabIndex: isClickable && !disabledStateProps.disabled ? 0 : -1,
13477
+ "aria-disabled": ariaDisabled,
13478
+ ...tabIndexProps,
13345
13479
  ...forwardedProps,
13346
- className: classNames.join(className, block$b({
13347
- 'is-clickable': isClickable && !isAnyDisabled,
13348
- 'is-disabled': isAnyDisabled,
13349
- 'is-selected': isSelected && !isAnyDisabled
13480
+ className: classnames(className, block$b({
13481
+ 'is-clickable': isClickable && !isDisabled,
13482
+ 'is-disabled': isDisabled,
13483
+ 'is-selected': isSelected && !isDisabled
13350
13484
  })),
13351
- "aria-disabled": isAnyDisabled,
13352
13485
  children: children
13353
13486
  });
13487
+ };
13488
+
13489
+ /**
13490
+ * Defines the props of the component.
13491
+ */
13492
+
13493
+ /**
13494
+ * TableRow component.
13495
+ *
13496
+ * @param props Component props.
13497
+ * @param ref Component ref.
13498
+ * @return React element.
13499
+ */
13500
+ const TableRow = forwardRef((props, ref) => {
13501
+ const {
13502
+ isAnyDisabled,
13503
+ otherProps
13504
+ } = useDisableStateProps(props);
13505
+ const {
13506
+ children,
13507
+ isClickable,
13508
+ 'aria-disabled': _ariaDisabled,
13509
+ ...forwardedProps
13510
+ } = otherProps;
13511
+ return TableRow$1({
13512
+ ref,
13513
+ children,
13514
+ isClickable,
13515
+ tabIndex: isClickable && !isAnyDisabled ? 0 : -1,
13516
+ 'aria-disabled': isAnyDisabled,
13517
+ ...forwardedProps
13518
+ });
13354
13519
  });
13355
13520
  TableRow.displayName = COMPONENT_NAME$9;
13356
13521
  TableRow.className = CLASSNAME$8;
@@ -14015,7 +14180,14 @@ TextField.displayName = COMPONENT_NAME$5;
14015
14180
  TextField.className = CLASSNAME$5;
14016
14181
  TextField.defaultProps = DEFAULT_PROPS$5;
14017
14182
 
14018
- function getState(img, event) {
14183
+ /**
14184
+ * Determines the loading state of an HTML image element.
14185
+ *
14186
+ * @param img - The HTML image element to check
14187
+ * @param event - Optional event (load or error) that triggered the state check
14188
+ * @returns The current loading state: 'hasError', 'isLoading', or 'isLoaded'
14189
+ */
14190
+ function getImageLoadingState(img, event) {
14019
14191
  // Error event occurred or image has no source.
14020
14192
  if (event?.type === 'error' || img?.complete && !img.getAttribute('src')) {
14021
14193
  return 'hasError';
@@ -14027,30 +14199,58 @@ function getState(img, event) {
14027
14199
  // Else loaded.
14028
14200
  return 'isLoaded';
14029
14201
  }
14030
- function useImageLoad(imageURL, imgRef) {
14031
- const [state, setState] = useState(getState(imgRef));
14032
14202
 
14033
- // Update state when changing image URL or DOM reference.
14034
- useEffect(() => {
14035
- setState(getState(imgRef));
14036
- }, [imageURL, imgRef]);
14203
+ /**
14204
+ * Parameters for getting image size.
14205
+ */
14037
14206
 
14038
- // Listen to `load` and `error` event on image
14039
- useEffect(() => {
14040
- const img = imgRef;
14041
- if (!img) return undefined;
14042
- const update = event => setState(getState(img, event));
14043
- img.addEventListener('load', update);
14044
- img.addEventListener('error', update);
14045
- return () => {
14046
- img.removeEventListener('load', update);
14047
- img.removeEventListener('error', update);
14207
+ /**
14208
+ * Gets the natural image size from props or element.
14209
+ * Returns undefined if focus point is not applicable or size cannot be determined.
14210
+ *
14211
+ * @param params - Image size parameters
14212
+ * @returns Image size or undefined
14213
+ */
14214
+ function getImageSize({
14215
+ image,
14216
+ aspectRatio,
14217
+ focusPoint,
14218
+ width,
14219
+ height,
14220
+ element,
14221
+ isLoaded
14222
+ }) {
14223
+ // Focus point is not applicable => exit early
14224
+ if (!image || aspectRatio === AspectRatio.original || !focusPoint?.x && !focusPoint?.y) {
14225
+ return undefined;
14226
+ }
14227
+ // Size provided via props
14228
+ if (typeof width === 'number' && typeof height === 'number') {
14229
+ return {
14230
+ width,
14231
+ height
14048
14232
  };
14049
- }, [imgRef, imgRef?.src]);
14050
- return state;
14233
+ }
14234
+ // Size from loaded element
14235
+ if (element && isLoaded) {
14236
+ return {
14237
+ width: element.naturalWidth,
14238
+ height: element.naturalHeight
14239
+ };
14240
+ }
14241
+ return undefined;
14051
14242
  }
14052
14243
 
14053
- // Calculate shift to center the focus point in the container.
14244
+ /**
14245
+ * Calculate shift position to center the focus point in the container.
14246
+ *
14247
+ * This function computes the percentage offset needed to position an image
14248
+ * such that a specific focus point on the image aligns with the center of
14249
+ * the container, taking into account the image's scale.
14250
+ *
14251
+ * @param params - Focus point shift calculation parameters
14252
+ * @returns Percentage shift (0-100) for CSS positioning
14253
+ */
14054
14254
  function shiftPosition({
14055
14255
  scale,
14056
14256
  focusPoint,
@@ -14065,92 +14265,64 @@ function shiftPosition({
14065
14265
  return Math.floor(Math.max(Math.min(shift, 1), 0) * 100);
14066
14266
  }
14067
14267
 
14068
- // Compute CSS properties to apply the focus point.
14069
- const useFocusPointStyle = ({
14268
+ /**
14269
+ * Parameters for calculating focus point style.
14270
+ */
14271
+
14272
+ /**
14273
+ * Calculates CSS style for applying focus point positioning.
14274
+ *
14275
+ * @param params - Focus point style parameters
14276
+ * @returns CSS properties to apply to the image
14277
+ */
14278
+ function calculateFocusPointStyle({
14070
14279
  image,
14071
14280
  aspectRatio,
14072
14281
  focusPoint,
14073
- imgProps: {
14074
- width,
14075
- height
14076
- } = {}
14077
- }, element, isLoaded) => {
14078
- // Get natural image size from imgProps or img element.
14079
- const imageSize = useMemo(() => {
14080
- // Focus point is not applicable => exit early
14081
- if (!image || aspectRatio === AspectRatio.original || !focusPoint?.x && !focusPoint?.y) return undefined;
14082
- if (typeof width === 'number' && typeof height === 'number') return {
14083
- width,
14084
- height
14085
- };
14086
- if (element && isLoaded) return {
14087
- width: element.naturalWidth,
14088
- height: element.naturalHeight
14282
+ element,
14283
+ imageSize,
14284
+ containerSize
14285
+ }) {
14286
+ // Focus point is not applicable => exit early
14287
+ if (!image || aspectRatio === AspectRatio.original || !focusPoint?.x && !focusPoint?.y) {
14288
+ return {};
14289
+ }
14290
+ if (!element || !imageSize) {
14291
+ // Focus point can be computed but not right now (image size unknown).
14292
+ return {
14293
+ visibility: 'hidden'
14089
14294
  };
14090
- return undefined;
14091
- }, [aspectRatio, element, focusPoint?.x, focusPoint?.y, height, image, isLoaded, width]);
14092
-
14093
- // Get container size (dependant on imageSize).
14094
- const [containerSize, setContainerSize] = useState(undefined);
14095
- useEffect(function updateContainerSize() {
14096
- const cWidth = element?.offsetWidth;
14097
- const cHeight = element?.offsetHeight;
14098
- if (cWidth && cHeight) {
14099
- // Update only if needed.
14100
- setContainerSize(oldContainerSize => oldContainerSize?.width === cWidth && oldContainerSize.height === cHeight ? oldContainerSize : {
14101
- width: cWidth,
14102
- height: cHeight
14103
- });
14104
- } else if (imageSize) {
14105
- // Wait for a render (in case the container size is dependent on the image size).
14106
- requestAnimationFrame(updateContainerSize);
14107
- }
14108
- }, [element?.offsetHeight, element?.offsetWidth, imageSize]);
14295
+ }
14296
+ if (!containerSize || !imageSize.height || !imageSize.width) {
14297
+ // Missing container or image size, abort focus point compute.
14298
+ return {};
14299
+ }
14300
+ const heightScale = imageSize.height / containerSize.height;
14301
+ const widthScale = imageSize.width / containerSize.width;
14302
+ const scale = Math.min(widthScale, heightScale);
14109
14303
 
14110
- // Compute style.
14111
- const style = useMemo(() => {
14112
- // Focus point is not applicable => exit early
14113
- if (!image || aspectRatio === AspectRatio.original || !focusPoint?.x && !focusPoint?.y) {
14114
- return {};
14115
- }
14116
- if (!element || !imageSize) {
14117
- // Focus point can be computed but now right now (image size unknown).
14118
- return {
14119
- visibility: 'hidden'
14120
- };
14121
- }
14122
- if (!containerSize || !imageSize.height || !imageSize.width) {
14123
- // Missing container or image size abort focus point compute.
14124
- return {};
14125
- }
14126
- const heightScale = imageSize.height / containerSize.height;
14127
- const widthScale = imageSize.width / containerSize.width;
14128
- const scale = Math.min(widthScale, heightScale);
14129
-
14130
- // Focus Y relative to the top (instead of the center)
14131
- const focusPointFromTop = Math.abs((focusPoint?.y || 0) - 1) / 2;
14132
- const y = shiftPosition({
14133
- scale,
14134
- focusPoint: focusPointFromTop,
14135
- imageSize: imageSize.height,
14136
- containerSize: containerSize.height
14137
- });
14304
+ // Focus Y relative to the top (instead of the center)
14305
+ const focusPointFromTop = Math.abs((focusPoint?.y || 0) - 1) / 2;
14306
+ const y = shiftPosition({
14307
+ scale,
14308
+ focusPoint: focusPointFromTop,
14309
+ imageSize: imageSize.height,
14310
+ containerSize: containerSize.height
14311
+ });
14138
14312
 
14139
- // Focus X relative to the left (instead of the center)
14140
- const focusPointFromLeft = Math.abs((focusPoint?.x || 0) + 1) / 2;
14141
- const x = shiftPosition({
14142
- scale,
14143
- focusPoint: focusPointFromLeft,
14144
- imageSize: imageSize.width,
14145
- containerSize: containerSize.width
14146
- });
14147
- const objectPosition = `${x}% ${y}%`;
14148
- return {
14149
- objectPosition
14150
- };
14151
- }, [aspectRatio, containerSize, element, focusPoint?.x, focusPoint?.y, image, imageSize]);
14152
- return style;
14153
- };
14313
+ // Focus X relative to the left (instead of the center)
14314
+ const focusPointFromLeft = Math.abs((focusPoint?.x || 0) + 1) / 2;
14315
+ const x = shiftPosition({
14316
+ scale,
14317
+ focusPoint: focusPointFromLeft,
14318
+ imageSize: imageSize.width,
14319
+ containerSize: containerSize.width
14320
+ });
14321
+ const objectPosition = `${x}% ${y}%`;
14322
+ return {
14323
+ objectPosition
14324
+ };
14325
+ }
14154
14326
 
14155
14327
  /**
14156
14328
  * Component display name.
@@ -14181,25 +14353,18 @@ const DEFAULT_PROPS$4 = {
14181
14353
  * @param ref Component ref.
14182
14354
  * @return React element.
14183
14355
  */
14184
- const Thumbnail = forwardRef((props, ref) => {
14185
- const {
14186
- isAnyDisabled,
14187
- otherProps,
14188
- disabledStateProps
14189
- } = useDisableStateProps(props);
14190
- const defaultTheme = useTheme() || Theme$1.light;
14356
+ const Thumbnail$1 = props => {
14191
14357
  const {
14192
14358
  align,
14193
14359
  alt,
14194
- aspectRatio = AspectRatio.original,
14360
+ aspectRatio = AspectRatio$1.original,
14195
14361
  badge,
14196
14362
  className,
14197
14363
  crossOrigin,
14364
+ ref,
14198
14365
  fallback = DEFAULT_PROPS$4.fallback,
14366
+ focusPointStyle,
14199
14367
  fillHeight,
14200
- // `focusPoint` needs to be here to remove it from `forwardedProps`.
14201
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
14202
- focusPoint,
14203
14368
  image,
14204
14369
  imgProps,
14205
14370
  imgRef: propImgRef,
@@ -14207,23 +14372,18 @@ const Thumbnail = forwardRef((props, ref) => {
14207
14372
  objectFit,
14208
14373
  loading = DEFAULT_PROPS$4.loading,
14209
14374
  loadingPlaceholderImageRef,
14375
+ isAnyDisabled,
14376
+ disabledStateProps,
14210
14377
  size,
14211
- theme = defaultTheme,
14378
+ theme,
14379
+ loadingState,
14212
14380
  variant,
14213
14381
  linkProps,
14214
14382
  linkAs,
14215
14383
  ...forwardedProps
14216
- } = otherProps;
14217
- const [imgElement, setImgElement] = useState();
14218
-
14219
- // Image loading state.
14220
- const loadingState = useImageLoad(image, imgElement);
14221
- const isLoaded = loadingState === 'isLoaded';
14384
+ } = props;
14222
14385
  const isLoading = isLoadingProp || loadingState === 'isLoading';
14223
14386
  const hasError = loadingState === 'hasError';
14224
-
14225
- // Focus point.
14226
- const focusPointStyle = useFocusPointStyle(props, imgElement, isLoaded);
14227
14387
  const hasIconErrorFallback = hasError && typeof fallback === 'string';
14228
14388
  const hasCustomErrorFallback = hasError && !hasIconErrorFallback;
14229
14389
  const imageErrorStyle = {};
@@ -14236,7 +14396,6 @@ const Thumbnail = forwardRef((props, ref) => {
14236
14396
  }
14237
14397
  const isLink = Boolean(linkProps?.href || linkAs);
14238
14398
  const isClickable = !isAnyDisabled && Boolean(isLink || !!forwardedProps.onClick);
14239
- const Wrapper = isClickable ? RawClickable : 'div';
14240
14399
  const wrapperProps = {
14241
14400
  ...forwardedProps
14242
14401
  };
@@ -14250,6 +14409,21 @@ const Thumbnail = forwardRef((props, ref) => {
14250
14409
  wrapperProps['aria-label'] = forwardedProps['aria-label'] || alt;
14251
14410
  }
14252
14411
  }
14412
+ const wrapperClassName = classNames.join(linkProps?.className, className, block$4({
14413
+ [`align-${align}`]: Boolean(align),
14414
+ [`aspect-ratio-${aspectRatio}`]: Boolean(aspectRatio),
14415
+ [`size-${size}`]: Boolean(size),
14416
+ [`theme-${theme}`]: Boolean(theme),
14417
+ [`variant-${variant}`]: Boolean(variant),
14418
+ 'is-clickable': isClickable,
14419
+ 'has-error': hasError,
14420
+ 'has-icon-error-fallback': hasIconErrorFallback,
14421
+ 'has-custom-error-fallback': hasCustomErrorFallback,
14422
+ 'is-loading': isLoading,
14423
+ [`object-fit-${objectFit}`]: Boolean(objectFit),
14424
+ 'has-badge': !!badge,
14425
+ 'fill-height': fillHeight
14426
+ }));
14253
14427
 
14254
14428
  // If we have a loading placeholder image that is really loaded (complete)
14255
14429
  const loadingPlaceholderImage = isLoading && loadingPlaceholderImageRef?.current?.complete && loadingPlaceholderImageRef?.current || undefined;
@@ -14258,24 +14432,7 @@ const Thumbnail = forwardRef((props, ref) => {
14258
14432
  const loadingStyle = loadingPlaceholderImage ? {
14259
14433
  backgroundImage: `url(${loadingPlaceholderImage.src})`
14260
14434
  } : undefined;
14261
- return /*#__PURE__*/jsxs(Wrapper, {
14262
- ...wrapperProps,
14263
- ref: ref,
14264
- className: classNames.join(linkProps?.className, className, block$4({
14265
- [`align-${align}`]: Boolean(align),
14266
- [`aspect-ratio-${aspectRatio}`]: Boolean(aspectRatio),
14267
- [`size-${size}`]: Boolean(size),
14268
- [`theme-${theme}`]: Boolean(theme),
14269
- [`variant-${variant}`]: Boolean(variant),
14270
- 'is-clickable': isClickable,
14271
- 'has-error': hasError,
14272
- 'has-icon-error-fallback': hasIconErrorFallback,
14273
- 'has-custom-error-fallback': hasCustomErrorFallback,
14274
- 'is-loading': isLoading,
14275
- [`object-fit-${objectFit}`]: Boolean(objectFit),
14276
- 'has-badge': !!badge,
14277
- 'fill-height': fillHeight
14278
- })),
14435
+ const innerImage = /*#__PURE__*/jsxs(Fragment, {
14279
14436
  children: [/*#__PURE__*/jsxs("span", {
14280
14437
  className: element$4('background'),
14281
14438
  children: [/*#__PURE__*/jsx("img", {
@@ -14291,26 +14448,165 @@ const Thumbnail = forwardRef((props, ref) => {
14291
14448
  ...focusPointStyle,
14292
14449
  ...loadingStyle
14293
14450
  },
14294
- ref: useMergeRefs(setImgElement, propImgRef),
14451
+ ref: propImgRef,
14295
14452
  className: classNames.join(element$4('image', {
14296
14453
  'is-loading': isLoading,
14297
14454
  'has-defined-size': Boolean(imgProps?.height && imgProps.width)
14298
- }), imgProps?.className),
14455
+ }), imgProps?.className)
14456
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
14457
+ // @ts-ignore - crossOrigin prop compatibility between React and Vue JSX
14458
+ ,
14299
14459
  crossOrigin: crossOrigin,
14300
14460
  src: image,
14301
14461
  alt: alt,
14302
14462
  loading: loading
14303
14463
  }), !isLoading && hasError && /*#__PURE__*/jsx("span", {
14304
14464
  className: element$4('fallback'),
14305
- children: hasIconErrorFallback ? /*#__PURE__*/jsx(Icon, {
14465
+ children: hasIconErrorFallback ? Icon$1({
14306
14466
  icon: fallback,
14307
14467
  size: Size$1.xxs,
14308
- theme: theme
14468
+ theme
14309
14469
  }) : fallback
14310
14470
  })]
14311
- }), badge && /*#__PURE__*/React__default.cloneElement(badge, {
14471
+ }), badge]
14472
+ });
14473
+
14474
+ /** Render `RawClickable` as a function since it is a core component which needs to be treated as such */
14475
+ if (isClickable) {
14476
+ return RawClickable$1({
14477
+ ref,
14478
+ ...wrapperProps,
14479
+ className: wrapperClassName,
14480
+ children: innerImage
14481
+ });
14482
+ }
14483
+ return /*#__PURE__*/jsx("div", {
14484
+ ref: ref,
14485
+ ...wrapperProps,
14486
+ className: wrapperClassName,
14487
+ children: innerImage
14488
+ });
14489
+ };
14490
+
14491
+ function useImageLoad(imageURL, imgRef) {
14492
+ const [state, setState] = useState(getImageLoadingState(imgRef));
14493
+
14494
+ // Update state when changing image URL or DOM reference.
14495
+ useEffect(() => {
14496
+ setState(getImageLoadingState(imgRef));
14497
+ }, [imageURL, imgRef]);
14498
+
14499
+ // Listen to `load` and `error` event on image
14500
+ useEffect(() => {
14501
+ const img = imgRef;
14502
+ if (!img) return undefined;
14503
+ const update = event => setState(getImageLoadingState(img, event));
14504
+ img.addEventListener('load', update);
14505
+ img.addEventListener('error', update);
14506
+ return () => {
14507
+ img.removeEventListener('load', update);
14508
+ img.removeEventListener('error', update);
14509
+ };
14510
+ }, [imgRef, imgRef?.src]);
14511
+ return state;
14512
+ }
14513
+
14514
+ // Compute CSS properties to apply the focus point.
14515
+ const useFocusPointStyle = ({
14516
+ image,
14517
+ aspectRatio,
14518
+ focusPoint,
14519
+ imgProps: {
14520
+ width,
14521
+ height
14522
+ } = {}
14523
+ }, element, isLoaded) => {
14524
+ // Get natural image size from imgProps or img element.
14525
+ const imageSize = useMemo(() => getImageSize({
14526
+ image,
14527
+ aspectRatio,
14528
+ focusPoint,
14529
+ width: typeof width === 'number' ? width : undefined,
14530
+ height: typeof height === 'number' ? height : undefined,
14531
+ element,
14532
+ isLoaded
14533
+ }), [aspectRatio, element, focusPoint, height, image, isLoaded, width]);
14534
+
14535
+ // Get container size (dependant on imageSize).
14536
+ const [containerSize, setContainerSize] = useState(undefined);
14537
+ useEffect(function updateContainerSize() {
14538
+ const cWidth = element?.offsetWidth;
14539
+ const cHeight = element?.offsetHeight;
14540
+ if (cWidth && cHeight) {
14541
+ // Update only if needed.
14542
+ setContainerSize(oldContainerSize => oldContainerSize?.width === cWidth && oldContainerSize.height === cHeight ? oldContainerSize : {
14543
+ width: cWidth,
14544
+ height: cHeight
14545
+ });
14546
+ } else if (imageSize) {
14547
+ // Wait for a render (in case the container size is dependent on the image size).
14548
+ requestAnimationFrame(updateContainerSize);
14549
+ }
14550
+ }, [element?.offsetHeight, element?.offsetWidth, imageSize]);
14551
+
14552
+ // Compute style.
14553
+ const style = useMemo(() => calculateFocusPointStyle({
14554
+ image,
14555
+ aspectRatio,
14556
+ focusPoint,
14557
+ element,
14558
+ imageSize,
14559
+ containerSize
14560
+ }), [aspectRatio, containerSize, element, focusPoint, image, imageSize]);
14561
+ return style;
14562
+ };
14563
+
14564
+ /**
14565
+ * Defines the props of the component.
14566
+ */
14567
+
14568
+ /**
14569
+ * Thumbnail component.
14570
+ *
14571
+ * @param props Component props.
14572
+ * @param ref Component ref.
14573
+ * @return React element.
14574
+ */
14575
+ const Thumbnail = forwardRef((props, ref) => {
14576
+ const {
14577
+ isAnyDisabled,
14578
+ otherProps,
14579
+ disabledStateProps
14580
+ } = useDisableStateProps(props);
14581
+ const defaultTheme = useTheme() || Theme$1.light;
14582
+ const {
14583
+ badge,
14584
+ focusPoint,
14585
+ image,
14586
+ imgRef: propImgRef,
14587
+ ...forwardedProps
14588
+ } = otherProps;
14589
+ const [imgElement, setImgElement] = useState();
14590
+
14591
+ // Image loading state.
14592
+ const loadingState = useImageLoad(image, imgElement);
14593
+ const isLoaded = loadingState === 'isLoaded';
14594
+
14595
+ // Focus point.
14596
+ const focusPointStyle = useFocusPointStyle(props, imgElement, isLoaded);
14597
+ return Thumbnail$1({
14598
+ ref,
14599
+ ...forwardedProps,
14600
+ theme: forwardedProps.theme || defaultTheme,
14601
+ isAnyDisabled,
14602
+ disabledStateProps,
14603
+ focusPointStyle,
14604
+ loadingState,
14605
+ imgRef: useMergeRefs(setImgElement, propImgRef),
14606
+ image,
14607
+ badge: badge && /*#__PURE__*/React__default.cloneElement(badge, {
14312
14608
  className: classNames.join(element$4('badge'), badge.props.className)
14313
- })]
14609
+ })
14314
14610
  });
14315
14611
  });
14316
14612
  Thumbnail.displayName = COMPONENT_NAME$4;
@@ -14332,7 +14628,7 @@ Thumbnail.defaultProps = DEFAULT_PROPS$4;
14332
14628
  * @deprecated
14333
14629
  */
14334
14630
  const ThumbnailAspectRatio = {
14335
- ...AspectRatio
14631
+ ...AspectRatio$1
14336
14632
  };
14337
14633
 
14338
14634
  /**
@@ -14763,7 +15059,7 @@ const {
14763
15059
  * Component default props.
14764
15060
  */
14765
15061
  const DEFAULT_PROPS$1 = {
14766
- aspectRatio: AspectRatio.horizontal,
15062
+ aspectRatio: AspectRatio$1.horizontal,
14767
15063
  size: Size$1.xl,
14768
15064
  variant: UploaderVariant.square
14769
15065
  };
@@ -14795,7 +15091,7 @@ const Uploader = forwardRef((props, ref) => {
14795
15091
  ...forwardedProps
14796
15092
  } = otherProps;
14797
15093
  // Adjust to square aspect ratio when using circle variants.
14798
- const adjustedAspectRatio = variant === UploaderVariant.circle ? AspectRatio.square : aspectRatio;
15094
+ const adjustedAspectRatio = variant === UploaderVariant.circle ? AspectRatio$1.square : aspectRatio;
14799
15095
  const handleClick = React__default.useCallback(evt => {
14800
15096
  if (isAnyDisabled) {
14801
15097
  evt.preventDefault();