-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add new ContentMenuButton, which is MenuButton with only custom content, such as Checkbox. - Add new FilterCheckbox component, which is a row with checkbox designed for the filter. - Add common focus outline CSS property to theme. - Add common focus outline to checkbox. This should be applied to all focusable elements, but we are starting with checkbox.
- Loading branch information
1 parent
5032fbf
commit eb8e14b
Showing
15 changed files
with
149 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/elements/src/components/ui/buttons/menu-button/ContentMenuButton.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.contentMenuButton { | ||
--current-outline: none; | ||
|
||
display: flex; | ||
flex-direction: row; | ||
justify-content: flex-start; | ||
align-items: center; | ||
|
||
border-radius: var(--swui-max-border-radius); | ||
min-height: 40px; | ||
padding: 4px 0; | ||
outline: none; | ||
|
||
&:hover { | ||
background: var(--lhds-color-ui-400); | ||
} | ||
|
||
&:focus { | ||
background: var(--lhds-color-ui-500); | ||
} | ||
|
||
&:active { | ||
background: var(--lhds-color-ui-500); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/elements/src/components/ui/buttons/menu-button/ContentMenuButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as React from "react"; | ||
import { forwardRef, ReactNode } from "react"; | ||
import { LabelElementProps, Row } from "@stenajs-webui/core"; | ||
import styles from "./ContentMenuButton.module.css"; | ||
|
||
export interface ContentMenuButtonProps extends LabelElementProps { | ||
children?: ReactNode; | ||
} | ||
|
||
export const ContentMenuButton = forwardRef< | ||
HTMLLabelElement, | ||
ContentMenuButtonProps | ||
>(({ children, ...labelProps }, ref) => { | ||
return ( | ||
<label className={styles.contentMenuButton} ref={ref} {...labelProps}> | ||
<Row justifyContent={"flex-start"} alignItems={"center"} indent={2}> | ||
{children} | ||
</Row> | ||
</label> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...buttons/menu-button/MenuButtonContent.tsx → ...enu-button/internal/MenuButtonContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/filter/src/features/search-filter/features/filter-checkbox/FilterCheckbox.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import * as React from "react"; | ||
import { Row, Text } from "@stenajs-webui/core"; | ||
import { ContentMenuButton } from "@stenajs-webui/elements"; | ||
import { Checkbox, CheckboxProps } from "@stenajs-webui/forms"; | ||
|
||
export interface FilterCheckboxProps extends CheckboxProps { | ||
label: string; | ||
} | ||
|
||
export const FilterCheckbox: React.FC<FilterCheckboxProps> = ({ | ||
label, | ||
...checkboxProps | ||
}) => { | ||
return ( | ||
<ContentMenuButton> | ||
<Row gap={2} alignItems={"center"} justifyContent={"flex-start"}> | ||
<Checkbox {...checkboxProps} /> | ||
<Text>{label}</Text> | ||
</Row> | ||
</ContentMenuButton> | ||
); | ||
}; |
23 changes: 23 additions & 0 deletions
23
packages/filter/src/features/search-filter/features/filter-checkbox/FilterCheckboxList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as React from "react"; | ||
import { PropsWithChildren } from "react"; | ||
import { Column } from "@stenajs-webui/core"; | ||
|
||
export interface FilterCheckboxListProps extends PropsWithChildren { | ||
maxHeight?: string; | ||
} | ||
|
||
export const FilterCheckboxList: React.FC<FilterCheckboxListProps> = ({ | ||
children, | ||
maxHeight, | ||
}) => { | ||
return ( | ||
<Column | ||
maxHeight={maxHeight} | ||
overflowY={maxHeight ? "auto" : undefined} | ||
gap={1} | ||
spacing={1} | ||
> | ||
{children} | ||
</Column> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters