@apify/ui-library 1.161.1 → 1.161.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/ui-library",
3
- "version": "1.161.1",
3
+ "version": "1.161.3",
4
4
  "description": "React UI library used by apify.com",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -75,7 +75,7 @@
75
75
  "styled-components": "^6.1.19"
76
76
  },
77
77
  "devDependencies": {
78
- "@apify-packages/types": "^3.415.0",
78
+ "@apify-packages/types": "^3.416.1",
79
79
  "@storybook/react-vite": "^10.3.5",
80
80
  "@testing-library/react": "^16.3.2",
81
81
  "@types/hast": "^3.0.4",
@@ -95,5 +95,5 @@
95
95
  "src",
96
96
  "style"
97
97
  ],
98
- "gitHead": "e72ff34a4b2974f25ef488ef2e068d6bb44d1ec5"
98
+ "gitHead": "e835dd09f3ebc261b64ca43834a24434bb60e20c"
99
99
  }
@@ -1,4 +1,4 @@
1
- import { forwardRef } from 'react';
1
+ import { forwardRef, useCallback } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
 
4
4
  import type { IconComponent, IconSize } from '@apify/ui-icons';
@@ -239,6 +239,11 @@ export const IconButton = forwardRef(
239
239
  const component: React.ElementType = as === 'a' ? Link : as;
240
240
  const { iconSize, spinnerSize } = iconButtonSizeConfig[size];
241
241
 
242
+ const LeftIcon = useCallback(
243
+ () => (isLoading ? <InlineSpinner size={spinnerSize} /> : <Icon size={iconSize} />),
244
+ [isLoading, spinnerSize, Icon, iconSize],
245
+ );
246
+
242
247
  const button = (
243
248
  <StyledButton
244
249
  forwardedAs={component}
@@ -246,7 +251,7 @@ export const IconButton = forwardRef(
246
251
  disabled={disabled || isLoading}
247
252
  type="button"
248
253
  aria-label={title}
249
- LeftIcon={isLoading ? () => <InlineSpinner size={spinnerSize} /> : () => <Icon size={iconSize} />}
254
+ LeftIcon={LeftIcon}
250
255
  // We apply our own styles to the button, so we need to override the default variant
251
256
  variant="tertiary"
252
257
  $size={size}