@apify/ui-library 1.124.0 → 1.124.2

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.124.0",
3
+ "version": "1.124.2",
4
4
  "description": "React UI library used by apify.com",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -17,6 +17,7 @@
17
17
  "build": "npm run clean && npm run compile",
18
18
  "clean": "rimraf ./dist",
19
19
  "compile": "tsc -p tsconfig.build.json",
20
+ "type-check": "tsc --noEmit",
20
21
  "generate-theme": "node src/codemods/generate_typograpy_tokens_files.mjs && npm run lint:fix",
21
22
  "build-color-tokens": "node src/design_system/colors/build_color_tokens.js",
22
23
  "postpublish": "npm run clean"
@@ -26,7 +27,7 @@
26
27
  "It's not nice, but helps us to get around the problem of multiple react instances."
27
28
  ],
28
29
  "dependencies": {
29
- "@apify/ui-icons": "^1.27.2",
30
+ "@apify/ui-icons": "^1.27.3",
30
31
  "@floating-ui/react": "^0.26.2",
31
32
  "@react-hook/resize-observer": "^2.0.2",
32
33
  "clsx": "^2.0.0",
@@ -65,5 +66,5 @@
65
66
  "src",
66
67
  "style"
67
68
  ],
68
- "gitHead": "ff2c20e23c4cf3a03725bd4b5f293d9f121174a3"
69
+ "gitHead": "c8c84eea89ee014b908267a67d8cc6395db18a60"
69
70
  }
@@ -59,6 +59,8 @@ type ButtonColorCombinations = {
59
59
 
60
60
  // hover state effects override
61
61
  hoverColor?: string,
62
+ // Optional gradient overlay on hover (e.g., for primaryBlack)
63
+ hoverGradient?: string,
62
64
 
63
65
  // active state effects override
64
66
  activeColor?: string,
@@ -104,7 +106,7 @@ export const BUTTON_COLOR_VARIANTS_CSS: ButtonColorCombinations = {
104
106
  textColor: theme.color.neutral.textOnPrimary,
105
107
  backgroundColor: theme.color.primaryBlack.action,
106
108
  borderColor: theme.color.primaryBlack.action,
107
- hoverColor: theme.color.primaryBlack.actionHover,
109
+ hoverGradient: `linear-gradient(to bottom, color-mix(in srgb, ${theme.color.neutral.textOnPrimary} 16%, transparent), transparent)`,
108
110
  activeColor: theme.color.primaryBlack.actionActive,
109
111
  },
110
112
  },
@@ -138,7 +140,7 @@ export const BUTTON_COLOR_VARIANTS_CSS: ButtonColorCombinations = {
138
140
  textColor: theme.color.neutral.textOnPrimary,
139
141
  backgroundColor: theme.color.primaryBlack.action,
140
142
  borderColor: theme.color.primaryBlack.action,
141
- hoverColor: theme.color.primaryBlack.actionHover,
143
+ hoverGradient: `linear-gradient(to bottom, color-mix(in srgb, ${theme.color.neutral.textOnPrimary} 16%, transparent), transparent)`,
142
144
  activeColor: theme.color.primaryBlack.actionActive,
143
145
  },
144
146
  },
@@ -169,7 +171,7 @@ export const BUTTON_COLOR_VARIANTS_CSS: ButtonColorCombinations = {
169
171
  textColor: theme.color.neutral.textOnPrimary,
170
172
  backgroundColor: theme.color.primaryBlack.action,
171
173
  borderColor: theme.color.primaryBlack.action,
172
- hoverColor: theme.color.primaryBlack.actionHover,
174
+ hoverGradient: `linear-gradient(to bottom, color-mix(in srgb, ${theme.color.neutral.textOnPrimary} 16%, transparent), transparent)`,
173
175
  activeColor: theme.color.primaryBlack.actionActive,
174
176
  },
175
177
  },
@@ -221,6 +223,7 @@ export const getButtonColorStyles = (variant: ButtonVariant = 'primary', color:
221
223
  actionBorderColor,
222
224
  actionTextColor,
223
225
  hoverColor,
226
+ hoverGradient,
224
227
  activeColor,
225
228
  activeTextColor,
226
229
  } = BUTTON_COLOR_VARIANTS_CSS[variant][color];
@@ -232,13 +235,20 @@ export const getButtonColorStyles = (variant: ButtonVariant = 'primary', color:
232
235
 
233
236
  &:hover {
234
237
  color: ${actionTextColor || textColor};
235
- background-color: ${hoverColor};
236
- border-color: ${actionBorderColor || hoverColor};
238
+ ${hoverGradient
239
+ ? css`
240
+ background-image: ${hoverGradient};
241
+ background-color: ${backgroundColor};
242
+ `
243
+ : css`background-color: ${hoverColor};`
244
+ }
245
+ border-color: ${actionBorderColor || (hoverGradient ? borderColor : hoverColor)};
237
246
  }
238
247
 
239
248
  &:active {
240
249
  color: ${activeTextColor || actionTextColor || textColor};
241
250
  background-color: ${activeColor};
251
+ ${hoverGradient && 'background-image: none;'}
242
252
  border-color: ${actionBorderColor || activeColor};
243
253
  }
244
254
 
@@ -21,7 +21,20 @@ export const ICON_BUTTON_VARIANTS = {
21
21
  } as const;
22
22
  export type ICON_BUTTON_VARIANTS = ValueOf<typeof ICON_BUTTON_VARIANTS>;
23
23
 
24
- const iconButtonVariantStyle = {
24
+ type IconButtonVariantStyle = {
25
+ backgroundColor: string;
26
+ backgroundHoverColor: string;
27
+ backgroundHoverGradient?: string;
28
+ backgroundActiveColor: string;
29
+ backgroundDisabledColor: string;
30
+ borderColor: string;
31
+ borderHoverColor: string;
32
+ borderActiveColor: string;
33
+ borderDisabledColor: string;
34
+ iconColor: string;
35
+ };
36
+
37
+ const iconButtonVariantStyle: Record<ICON_BUTTON_VARIANTS, IconButtonVariantStyle> = {
25
38
  [ICON_BUTTON_VARIANTS.DEFAULT]: {
26
39
  backgroundColor: 'transparent',
27
40
  backgroundHoverColor: theme.color.neutral.hover,
@@ -69,6 +82,7 @@ const iconButtonVariantStyle = {
69
82
  [ICON_BUTTON_VARIANTS.PRIMARY_BLACK]: {
70
83
  backgroundColor: theme.color.primaryBlack.action,
71
84
  backgroundHoverColor: theme.color.primaryBlack.actionHover,
85
+ backgroundHoverGradient: `linear-gradient(to bottom, color-mix(in srgb, ${theme.color.neutral.textOnPrimary} 16%, transparent), transparent)`,
72
86
  backgroundActiveColor: theme.color.primaryBlack.actionActive,
73
87
  backgroundDisabledColor: theme.color.neutral.disabled,
74
88
  borderColor: theme.color.primaryBlack.action,
@@ -77,7 +91,7 @@ const iconButtonVariantStyle = {
77
91
  borderDisabledColor: theme.color.neutral.disabled,
78
92
  iconColor: theme.color.neutral.textOnPrimary,
79
93
  },
80
- } satisfies Record<ICON_BUTTON_VARIANTS, unknown>;
94
+ };
81
95
 
82
96
  type IconButtonSizeConfig = {
83
97
  iconSize: IconSize;
@@ -111,6 +125,7 @@ const getIconButtonColorStyles = (variant: ICON_BUTTON_VARIANTS) => {
111
125
  const {
112
126
  backgroundColor,
113
127
  backgroundHoverColor,
128
+ backgroundHoverGradient,
114
129
  backgroundActiveColor,
115
130
  backgroundDisabledColor,
116
131
  borderDisabledColor,
@@ -126,7 +141,13 @@ const getIconButtonColorStyles = (variant: ICON_BUTTON_VARIANTS) => {
126
141
  border-color: ${borderColor};
127
142
 
128
143
  &:hover {
129
- background-color: ${backgroundHoverColor};
144
+ ${backgroundHoverGradient
145
+ ? css`
146
+ background-image: ${backgroundHoverGradient};
147
+ background-color: ${backgroundColor};
148
+ `
149
+ : css`background-color: ${backgroundHoverColor};`
150
+ }
130
151
  border-color: ${borderHoverColor || borderColor};
131
152
  color: ${iconColor};
132
153
  }
@@ -137,6 +158,7 @@ const getIconButtonColorStyles = (variant: ICON_BUTTON_VARIANTS) => {
137
158
 
138
159
  &:active {
139
160
  background-color: ${backgroundActiveColor};
161
+ ${backgroundHoverGradient && 'background-image: none;'}
140
162
  border-color: ${borderActiveColor || backgroundActiveColor};
141
163
  }
142
164