Skip to content

Commit 6e677a2

Browse files
authored
fix(ItemButton): actions positioning for card type and pointer events (#1021)
1 parent 5304beb commit 6e677a2

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Fix ItemButton actions positioning for card type variant and disable pointer events when actions are not shown

src/components/actions/ItemAction/ItemAction.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ export const InsideItemButton: Story = {
490490

491491
// Find the last button (with autoHideActions)
492492
if (buttons.length > 0) {
493-
await userEvent.hover(buttons[buttons.length - 1]);
493+
await userEvent.hover(buttons[buttons.length - 4]);
494494
}
495495
},
496496
parameters: {

src/components/actions/ItemButton/ItemButton.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,18 @@ const ActionsWrapper = tasty({
5959
Actions: {
6060
$: '>',
6161
position: 'absolute',
62-
inset: '1bw 1bw auto auto',
62+
inset: {
63+
'': '1bw 1bw auto auto',
64+
'type=card': '(1bw + .5x) (1bw + .5x) auto auto',
65+
},
6366
display: 'flex',
6467
gap: '1bw',
6568
placeItems: 'center',
6669
placeContent: 'center end',
67-
pointerEvents: 'auto',
70+
pointerEvents: {
71+
'': 'auto',
72+
'!actions-shown': 'none',
73+
},
6874
padding: '0 $side-padding',
6975
height: 'min ($size - 2bw)',
7076
opacity: {
@@ -202,6 +208,8 @@ const ItemButton = forwardRef(function ItemButton(
202208
<ActionsWrapper
203209
{...hoverProps}
204210
data-size={size}
211+
data-type={type}
212+
data-theme={theme}
205213
mods={finalMods}
206214
styles={wrapperStyles}
207215
style={

0 commit comments

Comments
 (0)