Skip to content

Commit

Permalink
fix(Suggestions): align border with dropdown components
Browse files Browse the repository at this point in the history
  • Loading branch information
zettca authored and plagoa committed Dec 16, 2024
1 parent 82d895d commit e52fea8
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const { staticClasses, useClasses } = createClasses("HvSuggestions", {
root: { position: "relative" },
list: {
backgroundColor: theme.colors.atmo1,
border: `1px solid ${theme.colors.secondary}`,
boxShadow: theme.colors.shadow,
padding: theme.space.xs,
width: "100%",
Expand Down
8 changes: 6 additions & 2 deletions packages/core/src/FormElement/Suggestions/Suggestions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import {
} from "@mui/base/ClickAwayListener";
import { Popper, PopperProps } from "@mui/base/Popper";
import { useForkRef } from "@mui/material/utils";
import { useTheme, type ExtractNames } from "@hitachivantara/uikit-react-utils";
import {
useDefaultProps,
useTheme,
type ExtractNames,
} from "@hitachivantara/uikit-react-utils";

import { HvListItem } from "../../ListContainer";
import { HvSelectionList } from "../../SelectionList";
Expand Down Expand Up @@ -72,7 +76,7 @@ export const HvSuggestions = forwardRef<
onSuggestionSelected,
popperProps,
...others
} = props;
} = useDefaultProps("HvSuggestions", props);

const { classes, cx } = useClasses(classesProp);

Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/ListContainer/ListItem/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ const applyClassNameToElement = (
};

/**
* ListItem description/documentation paragraph
* Implements the listitem pattern, akin to the `<li>` element.
* Should be composed within a `<HvListContainer>` component.
*/
export const HvListItem = forwardRef<
// no-indent
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/Select/Select.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ export const { staticClasses, useClasses } = createClasses("HvSelect", {
border: `1px solid ${theme.colors.secondary}`,
marginTop: -1,
marginBottom: -1,

// panel styles
position: "relative",
padding: theme.space.xs,
backgroundColor: theme.colors.atmo1,
overflowY: "auto",
borderRadius: "inherit",
},
panelOpenedUp: {
borderRadius: `${theme.radii.base} ${theme.radii.base} 0 0`,
Expand Down
15 changes: 6 additions & 9 deletions packages/core/src/Select/Select.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-use-before-define */
import { useRef, useState } from "react";
import { Popper } from "@mui/base/Popper";
import { SelectOption } from "@mui/base/useOption";
Expand Down Expand Up @@ -28,7 +27,6 @@ import {
} from "../FormElement";
import { useUniqueId } from "../hooks/useUniqueId";
import { HvListContainer } from "../ListContainer";
import { HvPanel } from "../Panel";
import { fixedForwardRef } from "../types/generic";
import { getContainerElement } from "../utils/document";
import { setId } from "../utils/setId";
Expand Down Expand Up @@ -297,7 +295,9 @@ export const HvSelect = fixedForwardRef(function HvSelect<
},
]}
>
<HvPanel
<HvListContainer
condensed
selectable
style={{
width: variableWidth
? "auto"
Expand All @@ -307,13 +307,10 @@ export const HvSelect = fixedForwardRef(function HvSelect<
[classes.panelOpenedUp]: placement.includes("top"),
[classes.panelOpenedDown]: placement.includes("bottom"),
})}
{...getListboxProps()}
>
<SelectProvider value={contextValue}>
<HvListContainer condensed selectable {...getListboxProps()}>
{children}
</HvListContainer>
</SelectProvider>
</HvPanel>
<SelectProvider value={contextValue}>{children}</SelectProvider>
</HvListContainer>
</Popper>
<input
{...getHiddenInputProps()}
Expand Down
27 changes: 18 additions & 9 deletions packages/styles/src/themes/pentahoPlus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ const inputColors = {
borderActive: ld(slate[700], slate[300]),
};

const inputBorder = `1px solid ${inputColors.border}`;

const pentahoPlus = makeTheme((theme) => ({
name: "pentahoPlus",
colors: {
Expand Down Expand Up @@ -557,7 +559,7 @@ const pentahoPlus = makeTheme((theme) => ({
classes: {
root: {
"&& .HvButton-secondarySubtle": {
border: `1px solid ${inputColors.border}`,
border: inputBorder,
backgroundColor: inputColors.bg,
},
"&& .HvDropdownButton-openUp": {
Expand All @@ -571,7 +573,14 @@ const pentahoPlus = makeTheme((theme) => ({
borderRadius: theme.radii.base,
},
panel: {
border: `1px solid ${inputColors.border}`,
border: inputBorder,
},
},
},
HvSuggestions: {
classes: {
list: {
border: inputBorder,
},
},
},
Expand Down Expand Up @@ -1009,12 +1018,12 @@ const pentahoPlus = makeTheme((theme) => ({
HvBaseInput: {
classes: {
inputRoot: {
border: `1px solid ${inputColors.border}`,
border: inputBorder,
backgroundColor: inputColors.bg,
},
inputRootMultiline: {
"&& textarea": {
border: `1px solid ${inputColors.border}`,
border: inputBorder,
backgroundColor: inputColors.bg,
},
},
Expand All @@ -1023,25 +1032,25 @@ const pentahoPlus = makeTheme((theme) => ({
HvBaseDropdown: {
classes: {
header: {
border: `1px solid ${inputColors.border}`,
border: inputBorder,
backgroundColor: inputColors.bg,
},
headerOpen: {
border: `1px solid ${inputColors.border}`,
border: inputBorder,
"&:hover": {
border: `1px solid ${inputColors.border}`,
border: inputBorder,
},
},
panel: {
border: `1px solid ${inputColors.border}`,
border: inputBorder,
},
},
},
HvDropDownMenu: {
classes: {
iconSelected: {
"&[data-color=secondary]": {
border: `1px solid ${inputColors.border}`,
border: inputBorder,
},
},
},
Expand Down

0 comments on commit e52fea8

Please sign in to comment.