@lumx/react 3.14.0 → 3.14.1-alpha.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
@@ -583,7 +583,7 @@ type HTMLButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>
583
583
  * Button size definition.
584
584
  */
585
585
  type ButtonSize = Extract<Size, 's' | 'm'>;
586
- interface BaseButtonProps extends GenericProps, Pick<AriaAttributes, 'aria-expanded' | 'aria-haspopup' | 'aria-pressed' | 'aria-label'>, HasTheme {
586
+ interface BaseButtonProps extends GenericProps, Pick<AriaAttributes, 'aria-expanded' | 'aria-haspopup' | 'aria-pressed' | 'aria-label' | 'aria-disabled'>, HasTheme {
587
587
  /** Color variant. */
588
588
  color?: ColorPalette;
589
589
  /** Emphasis variant. */
package/index.js CHANGED
@@ -5141,7 +5141,7 @@ BadgeWrapper.displayName = 'BadgeWrapper';
5141
5141
  BadgeWrapper.className = CLASSNAME$19;
5142
5142
  BadgeWrapper.defaultProps = DEFAULT_PROPS$W;
5143
5143
 
5144
- const _excluded$1f = ["aria-label", "children", "className", "color", "disabled", "emphasis", "hasBackground", "href", "isDisabled", "isSelected", "isActive", "isFocused", "isHovered", "linkAs", "name", "size", "target", "theme", "variant", "type", "fullWidth"];
5144
+ const _excluded$1f = ["aria-label", "children", "className", "color", "disabled", "emphasis", "hasBackground", "href", "isDisabled", "aria-disabled", "isSelected", "isActive", "isFocused", "isHovered", "linkAs", "name", "size", "target", "theme", "variant", "type", "fullWidth"];
5145
5145
 
5146
5146
  /**
5147
5147
  * Button size definition.
@@ -5200,6 +5200,7 @@ const ButtonRoot = forwardRef((props, ref) => {
5200
5200
  hasBackground,
5201
5201
  href,
5202
5202
  isDisabled = disabled,
5203
+ 'aria-disabled': ariaDisabled = isDisabled,
5203
5204
  isSelected,
5204
5205
  isActive,
5205
5206
  isFocused,
@@ -5254,9 +5255,11 @@ const ButtonRoot = forwardRef((props, ref) => {
5254
5255
  ref: ref
5255
5256
  }), children);
5256
5257
  }
5257
- return /*#__PURE__*/React__default.createElement("button", _extends({}, forwardedProps, {
5258
+ return /*#__PURE__*/React__default.createElement("button", _extends({}, forwardedProps, ariaDisabled ? {
5259
+ onClick: undefined
5260
+ } : undefined, {
5258
5261
  disabled: isDisabled,
5259
- "aria-disabled": isDisabled,
5262
+ "aria-disabled": ariaDisabled,
5260
5263
  "aria-label": ariaLabel,
5261
5264
  ref: ref,
5262
5265
  className: buttonClassName,
@@ -13615,23 +13618,20 @@ const useFocusPointStyle = (_ref2, element, isLoaded) => {
13615
13618
  }, [element === null || element === void 0 ? void 0 : element.offsetHeight, element === null || element === void 0 ? void 0 : element.offsetWidth, imageSize]);
13616
13619
 
13617
13620
  // Compute style.
13618
- const [style, setStyle] = useState({});
13619
- useEffect(() => {
13621
+ const style = useMemo(() => {
13620
13622
  // Focus point is not applicable => exit early
13621
13623
  if (!image || aspectRatio === AspectRatio.original || !(focusPoint !== null && focusPoint !== void 0 && focusPoint.x) && !(focusPoint !== null && focusPoint !== void 0 && focusPoint.y)) {
13622
- return;
13624
+ return {};
13623
13625
  }
13624
13626
  if (!element || !imageSize) {
13625
13627
  // Focus point can be computed but now right now (image size unknown).
13626
- setStyle({
13628
+ return {
13627
13629
  visibility: 'hidden'
13628
- });
13629
- return;
13630
+ };
13630
13631
  }
13631
13632
  if (!containerSize || !imageSize.height || !imageSize.width) {
13632
13633
  // Missing container or image size abort focus point compute.
13633
- setStyle({});
13634
- return;
13634
+ return {};
13635
13635
  }
13636
13636
  const heightScale = imageSize.height / containerSize.height;
13637
13637
  const widthScale = imageSize.width / containerSize.width;
@@ -13655,10 +13655,9 @@ const useFocusPointStyle = (_ref2, element, isLoaded) => {
13655
13655
  containerSize: containerSize.width
13656
13656
  });
13657
13657
  const objectPosition = `${x}% ${y}%`;
13658
- // Update only if needed.
13659
- setStyle(oldStyle => oldStyle.objectPosition === objectPosition ? oldStyle : {
13658
+ return {
13660
13659
  objectPosition
13661
- });
13660
+ };
13662
13661
  }, [aspectRatio, containerSize, element, focusPoint === null || focusPoint === void 0 ? void 0 : focusPoint.x, focusPoint === null || focusPoint === void 0 ? void 0 : focusPoint.y, image, imageSize]);
13663
13662
  return style;
13664
13663
  };