Skip to content

Commit 9a36d4b

Browse files
authored
fix(ActionsPanel): correct styling of internal subcomponents (divider, badge, buttons) (DS-5174) (#385)
1 parent ae8ff6a commit 9a36d4b

10 files changed

Lines changed: 74 additions & 28 deletions

File tree

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
1-
.base {
1+
/* [data-slot] bumps specificity over Button's own rules */
2+
.base[data-slot='action'] {
23
flex-shrink: 0;
34
margin-inline-start: var(--kbq-size-xxs);
45
background-color: var(--kbq-background-transparent);
5-
}
66

7-
.base:first-child {
8-
margin-inline-start: unset;
9-
}
7+
&[data-hovered='true']:not([data-loading='true']) {
8+
background-color: var(--kbq-states-background-contrast-hover);
9+
}
10+
11+
&[data-pressed='true']:not([data-loading='true']) {
12+
background-color: var(--kbq-states-background-contrast-active);
13+
}
14+
15+
&[data-disabled='true'] {
16+
background-color: var(--kbq-states-background-disabled);
17+
}
18+
19+
&:first-child {
20+
margin-inline-start: unset;
21+
}
1022

11-
.base[aria-hidden='true'] {
12-
visibility: hidden;
13-
position: absolute;
14-
inset-inline-start: -300vw;
23+
&[aria-hidden='true'] {
24+
visibility: hidden;
25+
position: absolute;
26+
inset-inline-start: -300vw;
27+
}
1528
}

packages/components/src/components/ActionsPanel/components/ActionsPanelAction/ActionsPanelAction.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const ActionsPanelAction = (props: ActionsPanelActionProps) => {
1515
ref={ref}
1616
data-slot="action"
1717
startIcon={icon}
18+
variant="contrast-filled"
1819
className={clsx(s.base, className)}
1920
{...other}
2021
>
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
.base {
22
display: flex;
3-
margin-inline-start: auto;
43
align-items: center;
4+
margin-inline-start: auto;
55
}
66

7-
.clearButton {
7+
/* [data-slot] bumps specificity over Button's own rules */
8+
.clearButton[data-slot='clear-button'] {
89
background-color: var(--kbq-background-transparent);
10+
11+
&[data-hovered='true']:not([data-loading='true']) {
12+
background-color: var(--kbq-states-background-contrast-hover);
13+
}
14+
15+
&[data-pressed='true']:not([data-loading='true']) {
16+
background-color: var(--kbq-states-background-contrast-active);
17+
}
18+
19+
&[data-disabled='true'] {
20+
background-color: var(--kbq-states-background-disabled);
21+
}
922
}

packages/components/src/components/ActionsPanel/components/ActionsPanelClearButton/ActionsPanelClearButton.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export const ActionsPanelClearButton = ({
2626
<div className={clsx(s.base, className)} {...other}>
2727
<ActionsPanelDivider />
2828
<Button
29+
data-slot="clear-button"
2930
className={s.clearButton}
31+
variant="contrast-filled"
3032
aria-label={t.format('clear selection')}
3133
onPress={onClearSelection}
3234
startIcon={<IconCircleXmark16 />}

packages/components/src/components/ActionsPanel/components/ActionsPanelCounter/ActionsPanelCounter.module.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
order: -1;
33
display: flex;
44
align-items: center;
5+
6+
/* extra-counter */
7+
.extraCounter {
8+
margin-inline-start: var(--kbq-size-xs);
9+
color: inherit;
10+
}
511
}
612

713
.base[aria-hidden='true'] {
@@ -22,9 +28,3 @@
2228
min-inline-size: 1ch;
2329
display: inline-block;
2430
}
25-
26-
/* extra-counter */
27-
.extraCounter {
28-
margin-inline-start: var(--kbq-size-xs);
29-
color: inherit;
30-
}

packages/components/src/components/ActionsPanel/components/ActionsPanelCounter/ActionsPanelCounter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ export const ActionsPanelCounter = ({
3535
<Typography
3636
as="div"
3737
className={s.text}
38-
ellipsis
3938
color="on-contrast"
4039
variant="text-normal-medium"
40+
ellipsis
4141
>
4242
{isAll ? (
4343
t.format('all selected')

packages/components/src/components/ActionsPanel/components/ActionsPanelDivider/ActionsPanelDivider.module.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
.base {
1+
/* [data-slot] bumps specificity to override Divider's own --divider-color */
2+
.base[data-slot='divider'] {
23
--divider-color: var(--actions-panel-vertical-divider-color);
34

45
block-size: var(--kbq-size-m);

packages/components/src/components/ActionsPanel/components/ActionsPanelDivider/ActionsPanelDivider.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const ActionsPanelDivider = ({
1212
...other
1313
}: ActionsPanelCounterProps) => (
1414
<Divider
15+
data-slot="divider"
1516
orientation="vertical"
1617
className={clsx(s.base, className)}
1718
{...other}

packages/components/src/components/ActionsPanel/components/ActionsPanelMoreAction/ActionsPanelMoreAction.module.css

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
1-
.base {
1+
/* [data-slot] bumps specificity over Button's own rules */
2+
.base[data-slot='more-action'] {
23
flex-shrink: 0;
34
background-color: var(--kbq-background-transparent);
4-
}
55

6-
.base[aria-hidden='true'] {
7-
visibility: hidden;
8-
position: absolute;
9-
inset-inline-start: -300vw;
10-
}
6+
&[data-hovered='true']:not([data-loading='true']) {
7+
background-color: var(--kbq-states-background-contrast-hover);
8+
}
9+
10+
&[data-pressed='true']:not([data-loading='true']) {
11+
background-color: var(--kbq-states-background-contrast-active);
12+
}
13+
14+
&[data-disabled='true'] {
15+
background-color: var(--kbq-states-background-disabled);
16+
}
17+
18+
/* depends on Button's internal --button-bg-color-active */
19+
&[aria-expanded='true'] {
20+
background-color: var(--button-bg-color-active);
21+
}
1122

12-
.base[aria-expanded='true'] {
13-
background-color: var(--button-bg-color-active);
23+
&[aria-hidden='true'] {
24+
visibility: hidden;
25+
position: absolute;
26+
inset-inline-start: -300vw;
27+
}
1428
}
1529

1630
/* menu-header-title */

packages/components/src/components/ActionsPanel/components/ActionsPanelMoreAction/ActionsPanelMoreAction.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const ActionsPanelMoreAction = (props: ActionsPanelMoreActionProps) => {
4242
}) => (
4343
<Button
4444
data-slot="more-action"
45+
variant="contrast-filled"
4546
ref={mergeRefs(ref, controlRef)}
4647
aria-label={t.format('show more actions')}
4748
className={clsx(s.base, className)}

0 commit comments

Comments
 (0)