@apify/ui-library 1.162.1 → 1.163.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": "1.162.1",
3
+ "version": "1.163.0",
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": "1b7ed3e37eae416924c8245dd5b66669512c0489"
98
+ "gitHead": "ed77920d4063cbbf7f04c953ab2c0dd69d7b8781"
99
99
  }
@@ -113,13 +113,14 @@ type DropdownMenuBaseComponentWithCountProps = {
113
113
  } & BoxProps;
114
114
 
115
115
  /**
116
- * Menu base component WITH dropdown icon and a selected-count badge.
117
- * Use this variant when the menu supports multi-select and you want to
118
- * display how many items are selected.
116
+ * Menu base component WITH dropdown icon, an optional selected-count badge and an optional clear button.
117
+ * Pass `selectedCount` for multi-select menus to show how many items are selected; single-select menus
118
+ * can omit it and still get the clear button by passing `onClear`.
119
119
  */
120
120
  export const DropdownMenuBaseComponentWithCount = forwardRef<HTMLElement, DropdownMenuBaseComponentWithCountProps>(
121
121
  ({ children, onClear, selectedCount, ...props }, ref) => {
122
- const showCount = onClear && selectedCount !== undefined && selectedCount > 0;
122
+ const showCount = selectedCount !== undefined && selectedCount > 0;
123
+ const showClear = !!onClear && (selectedCount === undefined || selectedCount > 0);
123
124
 
124
125
  return (
125
126
  <PlainMenuBaseComponent {...props} ref={ref}>
@@ -129,8 +130,8 @@ export const DropdownMenuBaseComponentWithCount = forwardRef<HTMLElement, Dropdo
129
130
  {selectedCount}
130
131
  </Badge>
131
132
  )}
132
- {showCount && <VerticalDivider />}
133
- {showCount ? (
133
+ {showClear && <VerticalDivider />}
134
+ {showClear ? (
134
135
  <CrossIcon
135
136
  size="16"
136
137
  color={theme.color.neutral.icon}