import { ReactNode, useState } from 'react'; import classnames from 'classnames'; import { TOKEN_COLOR_BACKGROUND_FORMFIELD_PRIMARY } from '@swipebox/morphe-design-tokens'; import Box from './Box'; import IconCompact from './IconCompact'; import layout from './Layout.css'; import styles from './SelectList.css'; import SelectListGroup from './SelectList/SelectListGroup'; import SelectListOption from './SelectList/SelectListOption'; import VRSelectList from './SelectList/VRSelectList'; import formElement from './sharedSubcomponents/FormElement.css'; import FormErrorMessage from './sharedSubcomponents/FormErrorMessage'; import FormHelperText from './sharedSubcomponents/FormHelperText'; import FormLabel from './sharedSubcomponents/FormLabel'; import useExperimentalTheme from './utils/useExperimentalTheme'; type Props = { /** * Available for testing purposes, if needed. Consider [better queries](https://testing-library.com/docs/queries/about/#priority) before using this prop. */ dataTestId?: string; /** * One or more SelectList.Option components, which may be grouped using SelectList.Group. */ children: ReactNode; /** * Used to disable the entire SelectList. */ disabled?: boolean; /** * Used to communicate error information to the user. Be sure to localize the text. See the [error message](https://gestalt.pinterest.systems/web/selectlist#Error-message) variant to learn more. */ errorMessage?: string; /** * Used to provide more information about the form field. Be sure to localize the text. See the [helper text](https://gestalt.pinterest.systems/web/selectlist#Helper-text) variant to learn more. */ helperText?: string; /** * A unique identifier to connect the underlying ` {showPlaceholder && ( )} {children} {helperText && !errorMessage ? ( ) : null} {errorMessage && } ); } SelectList.Option = SelectListOption; SelectList.Group = SelectListGroup; SelectList.displayName = 'SelectList'; export default SelectList;