@apify/ui-library 1.161.4 → 1.162.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.
@@ -1,6 +1,6 @@
1
1
  interface UseCopyToClipboard {
2
2
  isCopied: boolean;
3
- copyToClipboard(textToCopy: string): Promise<void>;
3
+ copyToClipboard: (textToCopy: string) => Promise<void>;
4
4
  }
5
5
  export declare function useCopyToClipboard(timeoutMs?: number): UseCopyToClipboard;
6
6
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"copy_to_clipboard.d.ts","sourceRoot":"","sources":["../../src/utils/copy_to_clipboard.ts"],"names":[],"mappings":"AAEA,UAAU,kBAAkB;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD;AAED,wBAAgB,kBAAkB,CAAC,SAAS,SAAO,GAAG,kBAAkB,CAyBvE"}
1
+ {"version":3,"file":"copy_to_clipboard.d.ts","sourceRoot":"","sources":["../../src/utils/copy_to_clipboard.ts"],"names":[],"mappings":"AAEA,UAAU,kBAAkB;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1D;AAED,wBAAgB,kBAAkB,CAAC,SAAS,SAAO,GAAG,kBAAkB,CAyBvE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/ui-library",
3
- "version": "1.161.4",
3
+ "version": "1.162.0",
4
4
  "description": "React UI library used by apify.com",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -42,7 +42,7 @@
42
42
  "It's not nice, but helps us to get around the problem of multiple react instances."
43
43
  ],
44
44
  "dependencies": {
45
- "@apify/ui-icons": "^1.49.0",
45
+ "@apify/ui-icons": "^1.50.0",
46
46
  "@floating-ui/react": "^0.27.19",
47
47
  "@floating-ui/react-dom": "^2.1.8",
48
48
  "@radix-ui/react-checkbox": "^1.3.3",
@@ -75,7 +75,7 @@
75
75
  "styled-components": "^6.1.19"
76
76
  },
77
77
  "devDependencies": {
78
- "@apify-packages/types": "^3.416.2",
78
+ "@apify-packages/types": "^3.417.0",
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": "e0e3f8bc723aaf346198ef7f4e929ce0dc7549c8"
98
+ "gitHead": "4151861eb12b7ae59e86d583830d7ffbac4e92f7"
99
99
  }
@@ -7,6 +7,7 @@ import type { HttpMethod } from '@apify-packages/types';
7
7
 
8
8
  import { theme } from '../../../design_system/theme';
9
9
  import type { BoxProps } from '../../box';
10
+ import { InlineSpinner } from '../../spinner';
10
11
  import { Text } from '../../text';
11
12
  import type { SharedTextSize } from '../../text/text_shared';
12
13
  import { ActionButton, CopyButton } from '../action_button';
@@ -151,6 +152,8 @@ export type OneLineCodeProps = Omit<BoxProps, 'children'> & {
151
152
  fullWidth?: boolean;
152
153
  secretPlaceholder?: string;
153
154
  secret?: string;
155
+ hideSecretButton?: boolean;
156
+ isCopyLoading?: boolean;
154
157
  disabled?: boolean;
155
158
  hideCopyButton?: boolean;
156
159
  trackingBundle?: OneLineCodeTrackingBundle;
@@ -166,6 +169,8 @@ export function OneLineCode({
166
169
  fullWidth,
167
170
  secretPlaceholder = '***',
168
171
  secret,
172
+ hideSecretButton,
173
+ isCopyLoading,
169
174
  disabled,
170
175
  hideCopyButton,
171
176
  trackingBundle,
@@ -212,7 +217,7 @@ export function OneLineCode({
212
217
  <div className={oneLineCodeClassNames.gradient} />
213
218
  </div>
214
219
  <div className={oneLineCodeClassNames.buttons}>
215
- {hasSecret && (
220
+ {hasSecret && !hideSecretButton && (
216
221
  <ActionButton
217
222
  onClick={() => setShowSecret((prev) => !prev)}
218
223
  trackingId={trackingBundle?.secret?.trackingId}
@@ -222,13 +227,18 @@ export function OneLineCode({
222
227
  {showSecret ? <EyeOffIcon size="16" /> : <EyeIcon size="16" />}
223
228
  </ActionButton>
224
229
  )}
225
- {!hideCopyButton && (
226
- <CopyButton
227
- code={codeWithSecret}
228
- trackingId={trackingBundle?.copy?.trackingId}
229
- trackingData={trackingBundle?.copy?.trackingData}
230
- />
231
- )}
230
+ {!hideCopyButton &&
231
+ (isCopyLoading ? (
232
+ <ActionButton disabled aria-label="Loading">
233
+ <InlineSpinner size={theme.space.space16} />
234
+ </ActionButton>
235
+ ) : (
236
+ <CopyButton
237
+ code={codeWithSecret}
238
+ trackingId={trackingBundle?.copy?.trackingId}
239
+ trackingData={trackingBundle?.copy?.trackingData}
240
+ />
241
+ ))}
232
242
  {!!onActionButtonClick && (
233
243
  <ActionButton
234
244
  onClick={onActionButtonClick}
@@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react';
2
2
 
3
3
  interface UseCopyToClipboard {
4
4
  isCopied: boolean;
5
- copyToClipboard(textToCopy: string): Promise<void>;
5
+ copyToClipboard: (textToCopy: string) => Promise<void>;
6
6
  }
7
7
 
8
8
  export function useCopyToClipboard(timeoutMs = 1000): UseCopyToClipboard {