@apify/ui-library 1.156.9 → 1.156.10

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.156.9",
3
+ "version": "1.156.10",
4
4
  "description": "React UI library used by apify.com",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -95,5 +95,5 @@
95
95
  "src",
96
96
  "style"
97
97
  ],
98
- "gitHead": "1adae28ecf6ce2903ae71e4f60b59a1588290985"
98
+ "gitHead": "0528af4cb95e4c06c13a994b55a6e6b4be3618f5"
99
99
  }
@@ -1,3 +1,6 @@
1
+ // Control (the clickable select box), keyed by the select's id, inputId, or name as fallbacks
2
+ export const selectControlTestId = (idOrName: string | undefined): string => `${idOrName}--control`;
3
+
1
4
  // Clear indicator button, keyed by the select's id (or name as a fallback)
2
5
  export const selectClearTestId = (idOrName: string | undefined): string => `${idOrName}--clear`;
3
6
 
@@ -2,6 +2,7 @@ import clsx from 'clsx';
2
2
  import { type FC, forwardRef, type ReactNode, useCallback, useMemo } from 'react';
3
3
  import type {
4
4
  ClearIndicatorProps,
5
+ ControlProps,
5
6
  DropdownIndicatorProps,
6
7
  IndicatorsContainerProps,
7
8
  MultiValueGenericProps,
@@ -17,7 +18,7 @@ import { CaretDownIcon, CaretUpIcon, CrossIcon, XCircleIcon } from '@apify/ui-ic
17
18
  import { theme } from '../../design_system/theme';
18
19
  import { IconButton } from '../icon_button';
19
20
  import { Text } from '../text';
20
- import { selectClearTestId, selectMultiValueLabelTestId } from './select.test_ids';
21
+ import { selectClearTestId, selectControlTestId, selectMultiValueLabelTestId } from './select.test_ids';
21
22
 
22
23
  const DEFAULT_Z_INDEX_IN_MODAL = 99;
23
24
  const DEFAULT_Z_INDEX_OUTSIDE_MODAL = 9;
@@ -255,6 +256,19 @@ const StyledOption = styled(withReactSelectTheme(selectComponents.Option))`
255
256
  ${theme.typography.shared.desktop.bodyM}
256
257
  `;
257
258
 
259
+ const Control: FC<ControlProps<SelectOption>> = ({ innerProps, selectProps, ...props }) => (
260
+ <StyledControl
261
+ {...props}
262
+ selectProps={selectProps}
263
+ innerProps={
264
+ {
265
+ ...innerProps,
266
+ 'data-test': selectControlTestId(selectProps?.id ?? selectProps?.inputId ?? selectProps?.name),
267
+ } as typeof innerProps
268
+ }
269
+ />
270
+ );
271
+
258
272
  const Option: FC<OptionProps<SelectOption>> = ({ children, data: { description }, ...props }) => (
259
273
  <StyledOption {...props}>
260
274
  {children}
@@ -401,7 +415,7 @@ export const SelectPrimitive = forwardRef<unknown, SelectPrimitiveProps>(
401
415
  MultiValueLabel: SelectMultiValueLabel,
402
416
  IndicatorsContainer,
403
417
  Option,
404
- Control: StyledControl,
418
+ Control,
405
419
  MenuPortal: StyledMenuPortal,
406
420
  ...components,
407
421
  }}
package/src/test_ids.ts CHANGED
@@ -10,7 +10,11 @@ export { prismHighlighterTestIds } from './components/code/prism_highlighter.tes
10
10
  export { collapsibleCardTestIds } from './components/collapsible_card/collapsible_card.test_ids.js';
11
11
  export { dropdownTestIds } from './components/dropdown/dropdown.test_ids.js';
12
12
  export { paginationTestIds } from './components/pagination/pagination.test_ids.js';
13
- export { selectClearTestId, selectMultiValueLabelTestId } from './components/select/select.test_ids.js';
13
+ export {
14
+ selectClearTestId,
15
+ selectControlTestId,
16
+ selectMultiValueLabelTestId,
17
+ } from './components/select/select.test_ids.js';
14
18
  export { spinnerTestIds } from './components/spinner/spinner.test_ids.js';
15
19
  export { storeActorHeaderTestIds } from './components/store/store_actor_header.test_ids.js';
16
20
  export { tableTestIds } from './components/table/table.test_ids.js';