@lumx/react 3.7.6-test.1 → 3.8.0

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 CHANGED
@@ -394,8 +394,8 @@ interface CheckboxProps extends GenericProps, HasTheme {
394
394
  id?: string;
395
395
  /** Native input ref. */
396
396
  inputRef?: React.Ref<HTMLInputElement>;
397
- /** Whether it is checked or not. */
398
- isChecked?: boolean;
397
+ /** Whether it is checked or not or intermediate. */
398
+ isChecked?: boolean | 'intermediate';
399
399
  /** Whether the component is disabled or not. */
400
400
  isDisabled?: boolean;
401
401
  /** Label text. */
@@ -404,10 +404,10 @@ interface CheckboxProps extends GenericProps, HasTheme {
404
404
  name?: string;
405
405
  /** Native input value property. */
406
406
  value?: string;
407
- /** On change callback. */
408
- onChange?(isChecked: boolean, value?: string, name?: string, event?: SyntheticEvent): void;
409
407
  /** optional props for input */
410
408
  inputProps?: InputHTMLAttributes<HTMLInputElement>;
409
+ /** On change callback. */
410
+ onChange?(isChecked: boolean, value?: string, name?: string, event?: SyntheticEvent): void;
411
411
  }
412
412
  /**
413
413
  * Checkbox component.
@@ -1301,6 +1301,8 @@ interface ThumbnailProps extends GenericProps, HasTheme {
1301
1301
  size?: ThumbnailSize;
1302
1302
  /** Image loading mode. */
1303
1303
  loading?: ImgHTMLProps['loading'];
1304
+ /** Ref of an existing placeholder image to display while loading. */
1305
+ loadingPlaceholderImageRef?: React.RefObject<HTMLImageElement>;
1304
1306
  /** On click callback. */
1305
1307
  onClick?: MouseEventHandler<HTMLDivElement>;
1306
1308
  /** On key press callback. */
package/index.js CHANGED
@@ -341,7 +341,7 @@ var classnames = createCommonjsModule(function (module) {
341
341
  }());
342
342
  });
343
343
 
344
- const mdiAlert='M13 14h-2V9h2m0 9h-2v-2h2M1 21h22L12 2z';const mdiAlertCircle='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2';const mdiArrowDown='M11 4h2v12l5.5-5.5 1.42 1.42L12 19.84l-7.92-7.92L5.5 10.5 11 16z';const mdiArrowUp='M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z';const mdiCheck='M21 7 9 19l-5.5-5.5 1.41-1.41L9 16.17 19.59 5.59z';const mdiCheckCircle='M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2m-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z';const mdiChevronDown='M7.41 8.58 12 13.17l4.59-4.59L18 10l-6 6-6-6z';const mdiChevronLeft='M15.41 16.58 10.83 12l4.58-4.59L14 6l-6 6 6 6z';const mdiChevronRight='M8.59 16.58 13.17 12 8.59 7.41 10 6l6 6-6 6z';const mdiChevronUp='M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z';const mdiClose='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z';const mdiCloseCircle='M12 2a10 10 0 1 1 0 20 10 10 0 1 1 0-20m3.59 5L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z';const mdiDragVertical='M9 3h2v2H9zm4 0h2v2h-2zM9 7h2v2H9zm4 0h2v2h-2zm-4 4h2v2H9zm4 0h2v2h-2zm-4 4h2v2H9zm4 0h2v2h-2zm-4 4h2v2H9zm4 0h2v2h-2z';const mdiImageBroken='M19 3a2 2 0 0 1 2 2v6h-2v2h-2v2h-2v2h-2v2h-2v2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm2 12v4a2 2 0 0 1-2 2h-4v-2h2v-2h2v-2zm-2-6.5a.5.5 0 0 0-.5-.5h-13a.5.5 0 0 0-.5.5v7a.5.5 0 0 0 .5.5H11v-1h2v-2h2v-2h2V9h2z';const mdiInformation='M13 9h-2V7h2m0 10h-2v-6h2m-1-9A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2';const mdiMenuDown='m7 10 5 5 5-5z';const mdiPauseCircleOutline='M13 16V8h2v8zm-4 0V8h2v8zm3-14a10 10 0 0 1 10 10 10 10 0 0 1-10 10A10 10 0 0 1 2 12 10 10 0 0 1 12 2m0 2a8 8 0 0 0-8 8 8 8 0 0 0 8 8 8 8 0 0 0 8-8 8 8 0 0 0-8-8';const mdiPlayCircleOutline='M12 20a8.01 8.01 0 0 1 0-16 8.01 8.01 0 0 1 0 16m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-2 14.5 6-4.5-6-4.5z';const mdiRadioboxBlank='M12 20a8 8 0 0 1-8-8 8 8 0 0 1 8-8 8 8 0 0 1 8 8 8 8 0 0 1-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2';const mdiRadioboxMarked='M12 20a8 8 0 0 1-8-8 8 8 0 0 1 8-8 8 8 0 0 1 8 8 8 8 0 0 1-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 5a5 5 0 0 0-5 5 5 5 0 0 0 5 5 5 5 0 0 0 5-5 5 5 0 0 0-5-5';
344
+ const mdiAlert='M13 14h-2V9h2m0 9h-2v-2h2M1 21h22L12 2z';const mdiAlertCircle='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2';const mdiArrowDown='M11 4h2v12l5.5-5.5 1.42 1.42L12 19.84l-7.92-7.92L5.5 10.5 11 16z';const mdiArrowUp='M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z';const mdiCheck='M21 7 9 19l-5.5-5.5 1.41-1.41L9 16.17 19.59 5.59z';const mdiCheckCircle='M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2m-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z';const mdiChevronDown='M7.41 8.58 12 13.17l4.59-4.59L18 10l-6 6-6-6z';const mdiChevronLeft='M15.41 16.58 10.83 12l4.58-4.59L14 6l-6 6 6 6z';const mdiChevronRight='M8.59 16.58 13.17 12 8.59 7.41 10 6l6 6-6 6z';const mdiChevronUp='M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z';const mdiClose='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z';const mdiCloseCircle='M12 2a10 10 0 1 1 0 20 10 10 0 1 1 0-20m3.59 5L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z';const mdiDragVertical='M9 3h2v2H9zm4 0h2v2h-2zM9 7h2v2H9zm4 0h2v2h-2zm-4 4h2v2H9zm4 0h2v2h-2zm-4 4h2v2H9zm4 0h2v2h-2zm-4 4h2v2H9zm4 0h2v2h-2z';const mdiImageBroken='M19 3a2 2 0 0 1 2 2v6h-2v2h-2v2h-2v2h-2v2h-2v2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm2 12v4a2 2 0 0 1-2 2h-4v-2h2v-2h2v-2zm-2-6.5a.5.5 0 0 0-.5-.5h-13a.5.5 0 0 0-.5.5v7a.5.5 0 0 0 .5.5H11v-1h2v-2h2v-2h2V9h2z';const mdiInformation='M13 9h-2V7h2m0 10h-2v-6h2m-1-9A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2';const mdiMenuDown='m7 10 5 5 5-5z';const mdiMinus='M19 13H5v-2h14z';const mdiPauseCircleOutline='M13 16V8h2v8zm-4 0V8h2v8zm3-14a10 10 0 0 1 10 10 10 10 0 0 1-10 10A10 10 0 0 1 2 12 10 10 0 0 1 12 2m0 2a8 8 0 0 0-8 8 8 8 0 0 0 8 8 8 8 0 0 0 8-8 8 8 0 0 0-8-8';const mdiPlayCircleOutline='M12 20a8.01 8.01 0 0 1 0-16 8.01 8.01 0 0 1 0 16m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-2 14.5 6-4.5-6-4.5z';const mdiRadioboxBlank='M12 20a8 8 0 0 1-8-8 8 8 0 0 1 8-8 8 8 0 0 1 8 8 8 8 0 0 1-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2';const mdiRadioboxMarked='M12 20a8 8 0 0 1-8-8 8 8 0 0 1 8-8 8 8 0 0 1 8 8 8 8 0 0 1-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 5a5 5 0 0 0-5 5 5 5 0 0 0 5 5 5 5 0 0 0 5-5 5 5 0 0 0-5-5';
345
345
 
346
346
  var IDX=256, HEX=[], SIZE=256, BUFFER;
347
347
  while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);
@@ -1589,6 +1589,11 @@ ButtonGroup.defaultProps = DEFAULT_PROPS$7;
1589
1589
 
1590
1590
  const _excluded$b = ["checked", "className", "disabled", "helper", "id", "inputRef", "isChecked", "isDisabled", "label", "name", "onChange", "theme", "value", "inputProps"];
1591
1591
 
1592
+ /**
1593
+ * Intermediate state of checkbox.
1594
+ */
1595
+ const INTERMEDIATE_STATE = 'intermediate';
1596
+
1592
1597
  /**
1593
1598
  * Defines the props of the component.
1594
1599
  */
@@ -1635,17 +1640,24 @@ const Checkbox = /*#__PURE__*/forwardRef((props, ref) => {
1635
1640
  inputProps = {}
1636
1641
  } = props,
1637
1642
  forwardedProps = _objectWithoutProperties(props, _excluded$b);
1643
+ const localInputRef = React.useRef(null);
1638
1644
  const inputId = useMemo(() => id || `${CLASSNAME$8.toLowerCase()}-${uid()}`, [id]);
1639
1645
  const handleChange = event => {
1640
1646
  if (onChange) {
1641
1647
  onChange(!isChecked, value, name, event);
1642
1648
  }
1643
1649
  };
1650
+ const intermediateState = isChecked === INTERMEDIATE_STATE;
1651
+ React.useEffect(() => {
1652
+ const input = localInputRef.current;
1653
+ if (input) input.indeterminate = intermediateState;
1654
+ }, [intermediateState]);
1644
1655
  return /*#__PURE__*/React.createElement("div", _extends({
1645
1656
  ref: ref
1646
1657
  }, forwardedProps, {
1647
1658
  className: classnames(className, handleBasicClasses({
1648
- isChecked,
1659
+ // Whether state is intermediate class name will "-checked"
1660
+ isChecked: intermediateState ? true : isChecked,
1649
1661
  isDisabled,
1650
1662
  isUnchecked: !isChecked,
1651
1663
  prefix: CLASSNAME$8,
@@ -1654,7 +1666,7 @@ const Checkbox = /*#__PURE__*/forwardRef((props, ref) => {
1654
1666
  }), /*#__PURE__*/React.createElement("div", {
1655
1667
  className: `${CLASSNAME$8}__input-wrapper`
1656
1668
  }, /*#__PURE__*/React.createElement("input", _extends({
1657
- ref: inputRef,
1669
+ ref: useMergeRefs(inputRef, localInputRef),
1658
1670
  type: "checkbox",
1659
1671
  id: inputId,
1660
1672
  className: `${CLASSNAME$8}__input-native`,
@@ -1664,7 +1676,8 @@ const Checkbox = /*#__PURE__*/forwardRef((props, ref) => {
1664
1676
  value: value,
1665
1677
  checked: isChecked,
1666
1678
  onChange: handleChange,
1667
- "aria-describedby": helper ? `${inputId}-helper` : undefined
1679
+ "aria-describedby": helper ? `${inputId}-helper` : undefined,
1680
+ "aria-checked": intermediateState ? 'mixed' : Boolean(isChecked)
1668
1681
  }, inputProps)), /*#__PURE__*/React.createElement("div", {
1669
1682
  className: `${CLASSNAME$8}__input-placeholder`
1670
1683
  }, /*#__PURE__*/React.createElement("div", {
@@ -1672,7 +1685,7 @@ const Checkbox = /*#__PURE__*/forwardRef((props, ref) => {
1672
1685
  }), /*#__PURE__*/React.createElement("div", {
1673
1686
  className: `${CLASSNAME$8}__input-indicator`
1674
1687
  }, /*#__PURE__*/React.createElement(Icon, {
1675
- icon: mdiCheck
1688
+ icon: intermediateState ? mdiMinus : mdiCheck
1676
1689
  })))), /*#__PURE__*/React.createElement("div", {
1677
1690
  className: `${CLASSNAME$8}__content`
1678
1691
  }, label && /*#__PURE__*/React.createElement(InputLabel, {
@@ -12872,7 +12885,7 @@ const useFocusPointStyle = (_ref2, element, isLoaded) => {
12872
12885
  return style;
12873
12886
  };
12874
12887
 
12875
- const _excluded$1m = ["align", "alt", "aspectRatio", "badge", "className", "crossOrigin", "fallback", "fillHeight", "focusPoint", "image", "imgProps", "imgRef", "isLoading", "objectFit", "loading", "size", "theme", "variant", "linkProps", "linkAs"];
12888
+ const _excluded$1m = ["align", "alt", "aspectRatio", "badge", "className", "crossOrigin", "fallback", "fillHeight", "focusPoint", "image", "imgProps", "imgRef", "isLoading", "objectFit", "loading", "loadingPlaceholderImageRef", "size", "theme", "variant", "linkProps", "linkAs"];
12876
12889
 
12877
12890
  /**
12878
12891
  * Defines the props of the component.
@@ -12905,6 +12918,7 @@ const DEFAULT_PROPS$$ = {
12905
12918
  * @return React element.
12906
12919
  */
12907
12920
  const Thumbnail = /*#__PURE__*/forwardRef((props, ref) => {
12921
+ var _loadingPlaceholderIm;
12908
12922
  const {
12909
12923
  align,
12910
12924
  alt,
@@ -12923,6 +12937,7 @@ const Thumbnail = /*#__PURE__*/forwardRef((props, ref) => {
12923
12937
  isLoading: isLoadingProp,
12924
12938
  objectFit,
12925
12939
  loading,
12940
+ loadingPlaceholderImageRef,
12926
12941
  size,
12927
12942
  theme,
12928
12943
  variant,
@@ -12963,6 +12978,14 @@ const Thumbnail = /*#__PURE__*/forwardRef((props, ref) => {
12963
12978
  wrapperProps.type = forwardedProps.type || 'button';
12964
12979
  wrapperProps['aria-label'] = forwardedProps['aria-label'] || alt;
12965
12980
  }
12981
+
12982
+ // If we have a loading placeholder image that is really loaded (complete)
12983
+ const loadingPlaceholderImage = isLoading && (loadingPlaceholderImageRef === null || loadingPlaceholderImageRef === void 0 ? void 0 : (_loadingPlaceholderIm = loadingPlaceholderImageRef.current) === null || _loadingPlaceholderIm === void 0 ? void 0 : _loadingPlaceholderIm.complete) && (loadingPlaceholderImageRef === null || loadingPlaceholderImageRef === void 0 ? void 0 : loadingPlaceholderImageRef.current) || undefined;
12984
+
12985
+ // Set loading placeholder image as background
12986
+ const loadingStyle = loadingPlaceholderImage ? {
12987
+ backgroundImage: `url(${loadingPlaceholderImage.src})`
12988
+ } : undefined;
12966
12989
  return /*#__PURE__*/React.createElement(Wrapper, _extends({}, wrapperProps, {
12967
12990
  ref: ref,
12968
12991
  className: classnames(linkProps === null || linkProps === void 0 ? void 0 : linkProps.className, className, handleBasicClasses({
@@ -12982,9 +13005,16 @@ const Thumbnail = /*#__PURE__*/forwardRef((props, ref) => {
12982
13005
  }), fillHeight && `${CLASSNAME$1e}--fill-height`)
12983
13006
  }), /*#__PURE__*/React.createElement("span", {
12984
13007
  className: `${CLASSNAME$1e}__background`
12985
- }, /*#__PURE__*/React.createElement("img", _extends({}, imgProps, {
12986
- style: _objectSpread2(_objectSpread2(_objectSpread2({}, imgProps === null || imgProps === void 0 ? void 0 : imgProps.style), imageErrorStyle), focusPointStyle),
12987
- ref: mergeRefs(setImgElement, propImgRef),
13008
+ }, /*#__PURE__*/React.createElement("img", _extends({
13009
+ // Use placeholder image size
13010
+ width: loadingPlaceholderImage === null || loadingPlaceholderImage === void 0 ? void 0 : loadingPlaceholderImage.naturalWidth,
13011
+ height: loadingPlaceholderImage === null || loadingPlaceholderImage === void 0 ? void 0 : loadingPlaceholderImage.naturalHeight
13012
+ }, imgProps, {
13013
+ style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
13014
+ // Reserve space while loading (when possible)
13015
+ width: isLoading ? (imgProps === null || imgProps === void 0 ? void 0 : imgProps.width) || (loadingPlaceholderImage === null || loadingPlaceholderImage === void 0 ? void 0 : loadingPlaceholderImage.naturalWidth) : undefined
13016
+ }, imgProps === null || imgProps === void 0 ? void 0 : imgProps.style), imageErrorStyle), focusPointStyle), loadingStyle),
13017
+ ref: useMergeRefs(setImgElement, propImgRef),
12988
13018
  className: classnames(handleBasicClasses({
12989
13019
  prefix: `${CLASSNAME$1e}__image`,
12990
13020
  isLoading,