@apify/ui-library 0.73.1-fixa11yaudit-b2e9ed.18 → 0.74.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/ui-library",
3
- "version": "0.73.1-fixa11yaudit-b2e9ed.18+820f7f41382",
3
+ "version": "0.74.0",
4
4
  "description": "React UI library used by apify.com",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -66,5 +66,5 @@
66
66
  "typescript": "^5.1.6",
67
67
  "typescript-eslint": "^8.24.0"
68
68
  },
69
- "gitHead": "820f7f413825fb33b814c6b93708873edfd89257"
69
+ "gitHead": "275202abde49f18ecb5f20ffba07d52dbde6011e"
70
70
  }
@@ -1,4 +1,3 @@
1
- import type { AriaAttributes } from 'react';
2
1
  import React, { forwardRef } from 'react';
3
2
  import styled, { css } from 'styled-components';
4
3
 
@@ -28,10 +27,8 @@ export interface RegularButtonProps {
28
27
  disabled?: boolean;
29
28
  }
30
29
 
31
- type ButtonAriaProps = Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'>;
32
-
33
30
  // Props shared for both types of the button
34
- export type CommonButtonProps = RegularButtonProps & ButtonAriaProps & TransientButtonProps & MarginSpacingProps;
31
+ export type CommonButtonProps = RegularButtonProps & TransientButtonProps & MarginSpacingProps;
35
32
  // Regular button must have onClick defined
36
33
  export type ButtonProps = CommonButtonProps & WithRequired<RegularBoxProps, 'onClick'>;
37
34
  // OR it can pass to to become anchor link - in that case onClick is not needed
@@ -89,7 +89,7 @@ interface CopyButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>
89
89
  export const CopyButton = ({ code, ...props }: CopyButtonProps) => {
90
90
  const [isCopied, handleClick] = useCopyToClipboard({ text: code });
91
91
  return (
92
- <ActionButton onClick={handleClick} data-test='copy_to_clipboard' aria-label="Copy to clipboard" {...props}>
92
+ <ActionButton onClick={handleClick} data-test='copy_to_clipboard' {...props}>
93
93
  {isCopied ? <CheckIcon size="16" /> : <CopyIcon size="16" />}
94
94
  </ActionButton>
95
95
  );
@@ -46,24 +46,33 @@ const loadLanguages = async () => {
46
46
 
47
47
  void loadLanguages();
48
48
 
49
- type PreWrapperProps = {
49
+ type StyledPreProps = {
50
50
  $hasLinePrefixes: boolean,
51
51
  $isSingleLine: boolean
52
52
  };
53
53
 
54
- const PreWrapper = styled.pre<PreWrapperProps>`
54
+ const StyledPre = styled.pre<StyledPreProps>`
55
55
  width: 100%;
56
56
  position: relative;
57
- overflow: auto;
58
57
  z-index: 2;
59
58
  padding: ${({ $isSingleLine }) => ($isSingleLine ? 0 : `${theme.space.space16} 0`)};
60
59
  margin: 0;
60
+ overflow: auto;
61
61
 
62
62
  code {
63
63
  min-width: 100%;
64
64
  display: inline-block;
65
65
  vertical-align: middle;
66
66
 
67
+ /* The following CSS deal with https://github.com/apify/apify-core/issues/20920 */
68
+ ${({ $isSingleLine }) => ($isSingleLine ? css`
69
+ overflow-y: hidden;
70
+ scrollbar-width: none;
71
+ ` : css`
72
+ scrollbar-width: thin;
73
+ overflow: hidden;
74
+ `)};
75
+
67
76
  *,
68
77
  *::before,
69
78
  *::after {
@@ -93,10 +102,10 @@ const PreWrapper = styled.pre<PreWrapperProps>`
93
102
  }
94
103
  `}
95
104
 
96
- ${({ $isSingleLine }) => ($isSingleLine ? css<PreWrapperProps>`
105
+ ${({ $isSingleLine }) => ($isSingleLine ? css<StyledPreProps>`
97
106
  white-space: nowrap;
98
107
  vertical-align: text-top;
99
- ` : css<PreWrapperProps>`
108
+ ` : css<StyledPreProps>`
100
109
  padding-left: ${({ $hasLinePrefixes }) => ($hasLinePrefixes ? theme.space.space8 : theme.space.space16)};
101
110
  padding-right: ${theme.space.space16};
102
111
 
@@ -153,8 +162,7 @@ export const PrismSyntaxHighlighter = forwardRef<HTMLPreElement, SyntaxHighlight
153
162
  {...rest}
154
163
  >
155
164
  {({ className: prismClassName, tokens, getLineProps, getTokenProps }) => (
156
- <PreWrapper
157
- tabIndex={0}
165
+ <StyledPre
158
166
  className={clsx(className, prismClassName)}
159
167
  $hasLinePrefixes={hasLinePrefixes}
160
168
  $isSingleLine={isSingleLine}
@@ -174,7 +182,7 @@ export const PrismSyntaxHighlighter = forwardRef<HTMLPreElement, SyntaxHighlight
174
182
  </div>
175
183
  ))}
176
184
  </Text>
177
- </PreWrapper>
185
+ </StyledPre>
178
186
  )}
179
187
  </Highlight>
180
188
  );
@@ -44,7 +44,6 @@ export interface MenuOption {
44
44
  }
45
45
 
46
46
  export interface MenuProps<T = MenuOption> {
47
- ariaLabel?: string,
48
47
  options: T[],
49
48
  value?: string,
50
49
  onSelect: (newValue: string, selectedBy: SelectActionType) => void,
@@ -65,7 +64,6 @@ const defaultRenderOption = ({ label }: MenuOption) => (<Text as='span'>{label}<
65
64
  * It tries to mimic API of react-select as closely as possible
66
65
  */
67
66
  export const Menu = <T extends MenuOption>({
68
- ariaLabel,
69
67
  options,
70
68
  value,
71
69
  onSelect,
@@ -131,8 +129,7 @@ export const Menu = <T extends MenuOption>({
131
129
  {...rest}
132
130
  >
133
131
  <MenuBaseComponent
134
- aria-label={ariaLabel}
135
- aria-labelledby={ariaLabel ? undefined : 'select-label'}
132
+ aria-labelledby="select-label"
136
133
  aria-autocomplete="none"
137
134
  ref={refs.setReference}
138
135
  {...getReferenceProps()}
@@ -66,7 +66,7 @@ const TabsWrapper = styled(Box)<TabsWrapperProps>`
66
66
  display: flex;
67
67
  position: relative;
68
68
 
69
- [role='tablist'] {
69
+ [role='tabpanel'] {
70
70
  min-width: 0;
71
71
  display: flex;
72
72
  flex-grow: 1;
@@ -152,9 +152,9 @@ export const Tabs = ({ variant = 'default', tabs, activeTab, onSelect, ...props
152
152
  setOveflowState(isTabsOverflowing(event.currentTarget as HTMLDivElement));
153
153
  }, []);
154
154
 
155
- return <TabsWrapper {...props} data-test="tabs-wrapper" $variant={variant}>
155
+ return <TabsWrapper {...props} role="tablist" data-test="tabs-wrapper" $variant={variant}>
156
156
  <div role="cell" aria-hidden={!overflowState?.left} />
157
- <div ref={ref} role="tablist" onScroll={scrollHandler}>
157
+ <div ref={ref} role="tabpanel" onScroll={scrollHandler}>
158
158
  {tabs.map((tab) => (
159
159
  <Tab
160
160
  {...tab}
@@ -83,7 +83,6 @@ export const PaginationButtons: FC<PaginationButtonsProps> = ({
83
83
  disabled={page <= 0}
84
84
  onClick={() => onPageChange(page - 1)}
85
85
  trackingId='PaginationPrevPage'
86
- aria-label="Previous page"
87
86
  >
88
87
  <ChevronLeftIcon size="16" />
89
88
  </PaginationButtonBase>
@@ -129,7 +128,6 @@ export const PaginationButtons: FC<PaginationButtonsProps> = ({
129
128
  disabled={page >= totalPages - 1}
130
129
  onClick={() => onPageChange(page + 1)}
131
130
  trackingId='PaginationNextPage'
132
- aria-label="Next page"
133
131
  >
134
132
  <ChevronRightIcon size="16" />
135
133
  </PaginationButtonBase>