diff --git a/src/components/SearchBar/SearchBar.module.css b/src/components/SearchBar/SearchBar.module.css index 924c31471..e20281db0 100644 --- a/src/components/SearchBar/SearchBar.module.css +++ b/src/components/SearchBar/SearchBar.module.css @@ -9,3 +9,56 @@ display: flex; gap: var(--eds-size-1); } + +/** + * Button to trigger search in a Search Bar. + */ +.search-button { + padding-top: 1px; + padding-bottom: 1px; + height: var(--eds-size-5); + box-sizing: content-box; + border: 0; +} + +/** + * Search Input Field for gathering input text. + */ +.search-field { + flex: 1; + position: relative; +} + +/** + * The Input component. + */ +.search-field > .search-field__input { + padding-left: 2.25rem; +} +.search-field__input::-webkit-search-cancel-button { + display: none; +} + +/** + * The search icon that overlays the Input. + */ +.search-field__icon { + color: var(--eds-theme-color-icon-neutral-default); + position: absolute; + top: 0.6875rem; + left: 0.625rem; +} + +/** + * Focused variant of the Search Icon. + */ +.search-field__input:focus + .search-field__icon { + color: var(--eds-theme-color-icon-brand-primary); +} + +/** + * Disabled variant of the Search Icon. + */ +.search-field__icon--disabled { + color: var(--eds-theme-color-icon-disabled); +} diff --git a/src/components/SearchBar/SearchBar.stories.tsx b/src/components/SearchBar/SearchBar.stories.tsx index 9366d7844..127224c07 100644 --- a/src/components/SearchBar/SearchBar.stories.tsx +++ b/src/components/SearchBar/SearchBar.stories.tsx @@ -8,7 +8,7 @@ export default { title: 'Components/SearchBar', component: SearchBar, parameters: { - badges: ['1.1', BADGE.BETA], + badges: ['1.1', BADGE.NEEDS_REVISION], }, decorators: [ (Story) => ( diff --git a/src/components/SearchBar/SearchBar.tsx b/src/components/SearchBar/SearchBar.tsx index d8607723f..78b565ec0 100644 --- a/src/components/SearchBar/SearchBar.tsx +++ b/src/components/SearchBar/SearchBar.tsx @@ -1,11 +1,12 @@ import clsx from 'clsx'; -import type { ReactNode } from 'react'; +import type { MouseEventHandler, ReactNode } from 'react'; import React from 'react'; -import SearchButton from '../SearchButton'; -import SearchField from '../SearchField'; +import Button from '../Button'; +import Icon from '../Icon'; +import Input, { type InputProps } from '../Input'; import styles from './SearchBar.module.css'; -export type Props = { +type SearchBarProps = { /** * SearchBar subcomponents to be wrapped. */ @@ -16,14 +17,72 @@ export type Props = { className?: string; }; +type SearchButtonProps = { + /** + * CSS class names that can be appended to the component. + */ + className?: string; + /** + * Disables the button and prevents button use. + */ + disabled?: boolean; + /** + * On click handler for component + */ + onClick?: MouseEventHandler; +}; + +/** + * A search Input component styled for use with the SearchBar. + */ +const SearchField = ({ className, disabled, ...other }: InputProps) => { + const inputClassName = clsx(styles['search-field__input'], className); + const iconClassName = clsx( + styles['search-field__icon'], + disabled && styles['search-field__icon--disabled'], + ); + + return ( +
+ + +
+ ); +}; + +/** + * A button styled for use with the SearchBar. + */ +const SearchButton = ({ className, ...other }: SearchButtonProps) => { + const componentClassName = clsx(styles['search-button'], className); + + return ( + + ); +}; + /** - * BETA: This component is still a work in progress and is subject to change. + * In Review: This component is in design review and is subject to change. * * `import {SearchBar} from "@chanzuckerberg/eds";` * * Input field and button used for searching through various data fields. */ -export const SearchBar = ({ children, className }: Props) => { +export const SearchBar = ({ children, className }: SearchBarProps) => { const componentClassName = clsx(styles['search-bar'], className); return
{children}
; diff --git a/src/components/SearchButton/SearchButton.module.css b/src/components/SearchButton/SearchButton.module.css deleted file mode 100644 index c0c31e9ef..000000000 --- a/src/components/SearchButton/SearchButton.module.css +++ /dev/null @@ -1,14 +0,0 @@ -/*------------------------------------*\ - # SEARCH BUTTON -\*------------------------------------*/ - -/** - * Button to trigger search in a Search Bar. - */ -.search-button { - padding-top: 1px; - padding-bottom: 1px; - height: var(--eds-size-5); - box-sizing: content-box; - border: 0; -} diff --git a/src/components/SearchButton/SearchButton.tsx b/src/components/SearchButton/SearchButton.tsx deleted file mode 100644 index 2fc668261..000000000 --- a/src/components/SearchButton/SearchButton.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import clsx from 'clsx'; -import type { MouseEventHandler } from 'react'; -import React from 'react'; -import Button from '../Button'; -import styles from './SearchButton.module.css'; - -export type SearchButtonProps = { - /** - * CSS class names that can be appended to the component. - */ - className?: string; - /** - * Disables the button and prevents button use. - */ - disabled?: boolean; - /** - * On click handler for component - */ - onClick?: MouseEventHandler; -}; - -/** - * BETA: This component is still a work in progress and is subject to change. - * - * `import {SearchButton} from "@chanzuckerberg/eds";` - * - * A button styled for use with the SearchBar. - */ -export const SearchButton = ({ className, ...other }: SearchButtonProps) => { - const componentClassName = clsx(styles['search-button'], className); - - return ( - - ); -}; diff --git a/src/components/SearchButton/index.ts b/src/components/SearchButton/index.ts deleted file mode 100644 index d853af5d0..000000000 --- a/src/components/SearchButton/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { SearchButton as default } from './SearchButton'; diff --git a/src/components/SearchField/SearchField.module.css b/src/components/SearchField/SearchField.module.css deleted file mode 100644 index 8466ed662..000000000 --- a/src/components/SearchField/SearchField.module.css +++ /dev/null @@ -1,45 +0,0 @@ -/*------------------------------------*\ - # SEARCH FIELD -\*------------------------------------*/ - -/** - * Search Input Field for gathering input text. - */ -.search-field { - flex: 1; - position: relative; -} - -/** - * The Input component. - */ -.search-field > .search-field__input { - padding-left: 2.25rem; -} -.search-field__input::-webkit-search-cancel-button { - display: none; -} - -/** - * The search icon that overlays the Input. - */ -.search-field__icon { - color: var(--eds-theme-color-icon-neutral-default); - position: absolute; - top: 0.6875rem; - left: 0.625rem; -} - -/** - * Focused variant of the Search Icon. - */ -.search-field__input:focus + .search-field__icon { - color: var(--eds-theme-color-icon-brand-primary); -} - -/** - * Disabled variant of the Search Icon. - */ -.search-field__icon--disabled { - color: var(--eds-theme-color-icon-disabled); -} diff --git a/src/components/SearchField/SearchField.tsx b/src/components/SearchField/SearchField.tsx deleted file mode 100644 index 1207facfc..000000000 --- a/src/components/SearchField/SearchField.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import clsx from 'clsx'; -import React from 'react'; -import Icon from '../Icon'; -import type { InputProps } from '../Input'; -import Input from '../Input'; -import styles from './SearchField.module.css'; - -/** - * BETA: This component is still a work in progress and is subject to change. - * - * `import {SearchField} from "@chanzuckerberg/eds";` - * - * A search Input component styled for use with the SearchBar. - */ -export const SearchField = ({ className, disabled, ...other }: InputProps) => { - const inputClassName = clsx(styles['search-field__input'], className); - const iconClassName = clsx( - styles['search-field__icon'], - disabled && styles['search-field__icon--disabled'], - ); - - return ( -
- - -
- ); -}; diff --git a/src/components/SearchField/index.ts b/src/components/SearchField/index.ts deleted file mode 100644 index 8e5e54550..000000000 --- a/src/components/SearchField/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { SearchField as default } from './SearchField'; diff --git a/src/index.ts b/src/index.ts index 60cb4ad16..7d2c97594 100644 --- a/src/index.ts +++ b/src/index.ts @@ -71,8 +71,6 @@ export { default as RadioInput } from './components/RadioInput'; export { default as RadioLabel } from './components/RadioLabel'; export { default as Score } from './components/Score'; export { default as SearchBar } from './components/SearchBar'; -export { default as SearchButton } from './components/SearchButton'; -export { default as SearchField } from './components/SearchField'; export { default as Section } from './components/Section'; export { default as Select } from './components/Select'; export { default as Skeleton } from './components/Skeleton';