diff --git a/packages/react/src/components/DropdownSelector/Divider.tsx b/packages/react/src/components/DropdownSelector/Divider.tsx deleted file mode 100644 index 1be948a58..000000000 --- a/packages/react/src/components/DropdownSelector/Divider.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import styled from 'styled-components' - -/** - * 水平方向の直線 - */ -export const Divider = styled.div.attrs({ role: 'separator' })` - display: flex; - - &:before { - content: ''; - display: block; - width: 100%; - height: 1px; - background: #00000014; - } -` diff --git a/packages/react/src/components/DropdownSelector/Divider/index.css b/packages/react/src/components/DropdownSelector/Divider/index.css new file mode 100644 index 000000000..12055dfa2 --- /dev/null +++ b/packages/react/src/components/DropdownSelector/Divider/index.css @@ -0,0 +1,11 @@ +.charcoal-menu-group-divider { + display: flex; +} + +.charcoal-menu-group-divider::before { + content: ''; + display: block; + width: 100%; + height: 1px; + background: #00000014; +} diff --git a/packages/react/src/components/DropdownSelector/Divider/index.tsx b/packages/react/src/components/DropdownSelector/Divider/index.tsx new file mode 100644 index 000000000..b75a8b478 --- /dev/null +++ b/packages/react/src/components/DropdownSelector/Divider/index.tsx @@ -0,0 +1,5 @@ +import './index.css' + +export function Divider() { + return
+} diff --git a/packages/react/src/components/DropdownSelector/DropdownMenuItem.tsx b/packages/react/src/components/DropdownSelector/DropdownMenuItem.tsx deleted file mode 100644 index 882e4f199..000000000 --- a/packages/react/src/components/DropdownSelector/DropdownMenuItem.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import styled from 'styled-components' -import MenuItem, { MenuItemProps } from './MenuItem' -import { MenuListContext } from './MenuList/MenuListContext' -import { useContext } from 'react' -import Icon from '../Icon' - -export type DropdownMenuItemProps = Omit, 'as'> - -/** - * DropdownSelectorの選択肢として使うMenuItem - */ -export default function DropdownMenuItem(props: DropdownMenuItemProps) { - const { value: ctxValue } = useContext(MenuListContext) - const isSelected = props.value === ctxValue - const { children, ...rest } = props - - return ( - - {isSelected && } - {props.children} - - ) -} - -/** - * アイコンがない時を考慮して20px(16pxのwidthと4pxのgap)の余白をとる - */ -const StyledSpan = styled.span<{ isSelected?: boolean }>` - font-size: 14px; - line-height: 22px; - color: var(--charcoal-text2); - padding: 9px 0; - - display: flex; - align-items: center; - width: 100%; - margin-left: ${({ isSelected }) => (isSelected === true ? 0 : 20)}px; -` - -const Text2ColorIcon = styled(Icon)` - color: var(--charcoal-text2); - padding-right: 4px; -` diff --git a/packages/react/src/components/DropdownSelector/DropdownMenuItem/index.css b/packages/react/src/components/DropdownSelector/DropdownMenuItem/index.css new file mode 100644 index 000000000..6c3c8f3d6 --- /dev/null +++ b/packages/react/src/components/DropdownSelector/DropdownMenuItem/index.css @@ -0,0 +1,20 @@ +.charcoal-dropdown-selector-menu-item { + font-size: 14px; + line-height: 22px; + color: var(--charcoal-text2); + padding: 9px 0; + + display: flex; + align-items: center; + width: 100%; + margin-left: 20px; +} + +.charcoal-dropdown-selector-menu-item[data-selected='true'] { + margin-left: 0px; +} + +.charcoal-dropdown-selector-menu-item-icon { + color: var(--charcoal-text2); + padding-right: 4px; +} diff --git a/packages/react/src/components/DropdownSelector/DropdownMenuItem/index.tsx b/packages/react/src/components/DropdownSelector/DropdownMenuItem/index.tsx new file mode 100644 index 000000000..9c021fadf --- /dev/null +++ b/packages/react/src/components/DropdownSelector/DropdownMenuItem/index.tsx @@ -0,0 +1,34 @@ +import './index.css' + +import MenuItem, { MenuItemProps } from '../MenuItem' +import { MenuListContext } from '../MenuList/MenuListContext' +import { useContext } from 'react' +import Icon from '../../Icon' + +export type DropdownMenuItemProps = Omit + +/** + * DropdownSelectorの選択肢として使うMenuItem + */ +export default function DropdownMenuItem(props: DropdownMenuItemProps) { + const { value: ctxValue } = useContext(MenuListContext) + const isSelected = props.value === ctxValue + const { children, ...rest } = props + + return ( + + {isSelected && ( + + )} + + {props.children} + + + ) +} diff --git a/packages/react/src/components/DropdownSelector/DropdownPopover.tsx b/packages/react/src/components/DropdownSelector/DropdownPopover.tsx index 5a19a903e..d2e87fea8 100644 --- a/packages/react/src/components/DropdownSelector/DropdownPopover.tsx +++ b/packages/react/src/components/DropdownSelector/DropdownPopover.tsx @@ -19,15 +19,22 @@ export function DropdownPopover({ children, ...props }: DropdownPopoverProps) { }, [props.triggerRef, props.isOpen]) useEffect(() => { - if (props.isOpen && props.value !== undefined) { - // windowのスクロールを維持したまま選択肢をPopoverの中心に表示する - const windowScrollY = window.scrollY - const windowScrollX = window.scrollX - const selectedElement = document.querySelector( - `[data-key="${props.value.toString()}"]` - ) as HTMLElement | undefined - selectedElement?.focus() - window.scrollTo(windowScrollX, windowScrollY) + if (props.isOpen) { + if (props.value !== undefined && props.value !== '') { + // windowのスクロールを維持したまま選択肢をPopoverの中心に表示する + const windowScrollY = window.scrollY + const windowScrollX = window.scrollX + const selectedElement = document.querySelector( + `[data-key="${props.value.toString()}"]` + ) as HTMLElement | undefined + selectedElement?.focus() + window.scrollTo(windowScrollX, windowScrollY) + } else { + const el = ref.current?.querySelector("[role='option']") + if (el instanceof HTMLElement) { + el.focus() + } + } } }, [props.value, props.isOpen]) diff --git a/packages/react/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot b/packages/react/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot index 33282ef02..ac3ed059e 100644 --- a/packages/react/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +++ b/packages/react/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot @@ -2,40 +2,6 @@ exports[`Storybook Tests react/internals/ListItem Basic 1`] = ` .c0 { - list-style: none; -} - -.c1 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - min-height: 40px; - cursor: pointer; - outline: none; - padding-right: 16px; - padding-left: 16px; - -webkit-transition: background-color 0.2s; - transition: background-color 0.2s; -} - -.c1:disabled, -.c1[aria-disabled]:not([aria-disabled='false']) { - opacity: 0.32; - cursor: default; -} - -.c1:hover:not(disabled):not([aria-disabled='true']), -.c1:focus:not(disabled):not([aria-disabled='true']), -.c1:focus-within:not(disabled):not([aria-disabled='true']) { - background-color: var(--charcoal-surface3); -} - -.c2 { color: red; } @@ -43,77 +9,52 @@ exports[`Storybook Tests react/internals/ListItem Basic 1`] = ` data-dark={false} >
  • -
    - Item -
    + Item
  • -
    - - Add -
    + + Add
  • -
  • - - Normal Link - -
  • -
  • + - - Custom Link - -
  • + Custom Link +
  • + Switch
    - Switch -
    - -
    + } + > +
  • diff --git a/packages/react/src/components/DropdownSelector/ListItem/index.css b/packages/react/src/components/DropdownSelector/ListItem/index.css new file mode 100644 index 000000000..4fabf12bb --- /dev/null +++ b/packages/react/src/components/DropdownSelector/ListItem/index.css @@ -0,0 +1,24 @@ +.charcoal-list-item { + list-style: none; + display: flex; + align-items: center; + min-height: 40px; + cursor: pointer; + outline: none; + + padding-right: 16px; + padding-left: 16px; + + transition: background-color 0.2s; +} + +.charcoal-list-item:not([aria-disabled='true']):hover, +.charcoal-list-item:not([aria-disabled='true']):focus, +.charcoal-list-item:not([aria-disabled='true']):focus-within { + background-color: var(--charcoal-surface3); +} + +.charcoal-list-item[aria-disabled='true'] { + opacity: 0.32; + cursor: default; +} diff --git a/packages/react/src/components/DropdownSelector/ListItem/index.tsx b/packages/react/src/components/DropdownSelector/ListItem/index.tsx index 6fff0581f..21021b2da 100644 --- a/packages/react/src/components/DropdownSelector/ListItem/index.tsx +++ b/packages/react/src/components/DropdownSelector/ListItem/index.tsx @@ -1,64 +1,25 @@ -import { ReactNode } from 'react' -import styled from 'styled-components' +import './index.css' + +import { ForwardedRef, forwardRef, ReactNode, useMemo } from 'react' +import { useClassNames } from '../../../_lib/useClassNames' export type CustomJSXElement = | keyof JSX.IntrinsicElements // eslint-disable-next-line @typescript-eslint/no-explicit-any | React.JSXElementConstructor -export type ListItemProps = { +export type ListItemProps = { children?: ReactNode as?: T -} & Omit, 'children'> +} & Omit, 'children' | 'as'> -/** - * リストのある要素を示すコンポーネント - * - * asを用いて拡張することができる - * @example - * ``` - * Link - * NextLink - * ``` - */ -export default function ListItem( - props: ListItemProps +const ListItem = forwardRef(function ListItem( + { as, className, ...props }: ListItemProps, + ref: ForwardedRef ) { - const { children, ...rest } = props - return ( - - {props.children} - - ) -} - -const StyledLi = styled.li` - list-style: none; -` - -const ItemDiv = styled.div` - display: flex; - align-items: center; - min-height: 40px; - cursor: pointer; - outline: none; - - padding-right: 16px; - padding-left: 16px; - - transition: background-color 0.2s; - - &:disabled, - &[aria-disabled]:not([aria-disabled='false']) { - opacity: 0.32; - cursor: default; - } + const Component = useMemo(() => as ?? 'li', [as]) + const classNames = useClassNames('charcoal-list-item', className) + return +}) as (p: ListItemProps) => JSX.Element - :hover, - :focus, - :focus-within { - &:not(disabled):not([aria-disabled='true']) { - background-color: var(--charcoal-surface3); - } - } -` +export default ListItem diff --git a/packages/react/src/components/DropdownSelector/MenuItem/index.tsx b/packages/react/src/components/DropdownSelector/MenuItem/index.tsx index b4d0d05e7..5ef50f0d4 100644 --- a/packages/react/src/components/DropdownSelector/MenuItem/index.tsx +++ b/packages/react/src/components/DropdownSelector/MenuItem/index.tsx @@ -1,7 +1,8 @@ -import ListItem, { CustomJSXElement, ListItemProps } from '../ListItem' +import { ForwardedRef, forwardRef } from 'react' +import ListItem, { ListItemProps } from '../ListItem' import { useMenuItemHandleKeyDown } from './internals/useMenuItemHandleKeyDown' -export type MenuItemProps = { +export type MenuItemProps = { value?: string disabled?: boolean } & ListItemProps @@ -10,22 +11,26 @@ export type MenuItemProps = { * 上下キーでフォーカス移動でき、エンターキーで選択できるリストの項目 * 基本的に``, ``と合わせて使用する */ -export default function MenuItem( - props: MenuItemProps +const MenuItem = forwardRef(function MenuItem< + T extends React.ElementType = 'li' +>( + { className, value, disabled, ...props }: MenuItemProps, + ref: ForwardedRef ) { - const { children, as, ...rest } = props - const [handleKeyDown, setContextValue] = useMenuItemHandleKeyDown(props.value) + const [handleKeyDown, setContextValue] = useMenuItemHandleKeyDown(value) return ( {props.children} ) -} +}) +export default MenuItem diff --git a/packages/react/src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx b/packages/react/src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx index fcebcf815..3a145e3d0 100644 --- a/packages/react/src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx +++ b/packages/react/src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx @@ -11,14 +11,14 @@ import { MenuListContext } from '../../MenuList/MenuListContext' */ export function useMenuItemHandleKeyDown( value?: string -): [(e: React.KeyboardEvent) => void, () => void] { +): [(e: React.KeyboardEvent) => void, () => void] { const { setValue, root, propsArray } = useContext(MenuListContext) const setContextValue = useCallback(() => { if (value !== undefined) setValue(value) }, [value, setValue]) const handleKeyDown = useCallback( - (e: React.KeyboardEvent) => { + (e: React.KeyboardEvent) => { if (e.key === 'Enter') { setContextValue() } else if (e.key === 'ArrowUp' || e.key === 'ArrowDown') { diff --git a/packages/react/src/components/DropdownSelector/MenuItemGroup/index.css b/packages/react/src/components/DropdownSelector/MenuItemGroup/index.css new file mode 100644 index 000000000..a34d43442 --- /dev/null +++ b/packages/react/src/components/DropdownSelector/MenuItemGroup/index.css @@ -0,0 +1,19 @@ +.charcoal-menu-item-group { + display: block; +} + +.charcoal-menu-item-group > span { + display: block; + color: var(--charcoal-text3); + font-size: 12px; + font-weight: bold; + padding: 12px 0 8px 16px; +} + +.charcoal-menu-item-group > ul { + padding-left: 0; + margin: 0; + box-sizing: border-box; + list-style: none; + overflow: hidden; +} diff --git a/packages/react/src/components/DropdownSelector/MenuItemGroup/index.tsx b/packages/react/src/components/DropdownSelector/MenuItemGroup/index.tsx index c15927427..7e3c94d4d 100644 --- a/packages/react/src/components/DropdownSelector/MenuItemGroup/index.tsx +++ b/packages/react/src/components/DropdownSelector/MenuItemGroup/index.tsx @@ -1,4 +1,5 @@ -import styled from 'styled-components' +import './index.css' + import MenuItem from '../MenuItem' import { Divider } from '../Divider' @@ -9,34 +10,11 @@ export type MenuItemGroupProps = { children: MenuItemGroupChild | MenuItemGroupChild[] } -/** - * 項目のリストを分類する見出しをつけるコンテナ要素 - */ export default function MenuItemGroup(props: MenuItemGroupProps) { return ( - - {props.text} - {props.children} - +
  • + {props.text} +
      {props.children}
    +
  • ) } - -const TextSpan = styled.span` - display: block; - color: var(--charcoal-text3); - font-size: 12px; - font-weight: bold; - padding: 12px 0 8px 16px; -` - -const StyledUl = styled.ul` - padding-left: 0; - margin: 0; - box-sizing: border-box; - list-style: none; - overflow: hidden; -` - -const StyledLi = styled.li` - display: block; -` diff --git a/packages/react/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot b/packages/react/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot index 7a273dfc3..59b43724e 100644 --- a/packages/react/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +++ b/packages/react/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot @@ -1,549 +1,295 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Storybook Tests react/internals/MenuList Basic 1`] = ` -.c0 { - padding: 0; - margin: 0; -} - -.c1 { - list-style: none; -} - -.c2 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - min-height: 40px; - cursor: pointer; - outline: none; - padding-right: 16px; - padding-left: 16px; - -webkit-transition: background-color 0.2s; - transition: background-color 0.2s; -} - -.c2:disabled, -.c2[aria-disabled]:not([aria-disabled='false']) { - opacity: 0.32; - cursor: default; -} - -.c2:hover:not(disabled):not([aria-disabled='true']), -.c2:focus:not(disabled):not([aria-disabled='true']), -.c2:focus-within:not(disabled):not([aria-disabled='true']) { - background-color: var(--charcoal-surface3); -} -
    • -
      - Menu - 0 -
      + Menu + 0
    • -
      - Menu - 1 -
      + Menu + 1
    • -
      - Menu - 2 -
      + Menu + 2
    • -
      - Menu - 3 -
      + Menu + 3
    • -
      - Menu - 4 -
      + Menu + 4
    • -
      - Menu - 5 -
      + Menu + 5
    • -
      - Menu - 6 -
      + Menu + 6
    • -
      - Menu - 7 -
      + Menu + 7
    • -
      - Menu - 8 -
      + Menu + 8
    • -
      - Menu - 9 -
      + Menu + 9
    `; exports[`Storybook Tests react/internals/MenuList Disabled 1`] = ` -.c0 { - padding: 0; - margin: 0; -} - -.c1 { - list-style: none; -} - -.c2 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - min-height: 40px; - cursor: pointer; - outline: none; - padding-right: 16px; - padding-left: 16px; - -webkit-transition: background-color 0.2s; - transition: background-color 0.2s; -} - -.c2:disabled, -.c2[aria-disabled]:not([aria-disabled='false']) { - opacity: 0.32; - cursor: default; -} - -.c2:hover:not(disabled):not([aria-disabled='true']), -.c2:focus:not(disabled):not([aria-disabled='true']), -.c2:focus-within:not(disabled):not([aria-disabled='true']) { - background-color: var(--charcoal-surface3); -} -
    • -
      - MenuItem -
      + MenuItem
    • -
      - Disabled MenuItem -
      + Disabled MenuItem
    `; exports[`Storybook Tests react/internals/MenuList Group 1`] = ` -.c0 { - padding: 0; - margin: 0; -} - -.c2 { - display: block; - color: var(--charcoal-text3); - font-size: 12px; - font-weight: bold; - padding: 12px 0 8px 16px; -} - -.c3 { - padding-left: 0; - margin: 0; - box-sizing: border-box; - list-style: none; - overflow: hidden; -} - -.c1 { - display: block; -} - -.c4 { - list-style: none; -} - -.c5 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - min-height: 40px; - cursor: pointer; - outline: none; - padding-right: 16px; - padding-left: 16px; - -webkit-transition: background-color 0.2s; - transition: background-color 0.2s; -} - -.c5:disabled, -.c5[aria-disabled]:not([aria-disabled='false']) { - opacity: 0.32; - cursor: default; -} - -.c5:hover:not(disabled):not([aria-disabled='true']), -.c5:focus:not(disabled):not([aria-disabled='true']), -.c5:focus-within:not(disabled):not([aria-disabled='true']) { - background-color: var(--charcoal-surface3); -} -
    • - + Section1
      • -
        - Menu - 0 -
        + Menu + 0
      • -
        - Menu - 1 -
        + Menu + 1
      • -
        - Menu - 2 -
        + Menu + 2
      • -
        - Menu - 3 -
        + Menu + 3
      • -
        - Menu - 4 -
        + Menu + 4
    • - + Section2
      • -
        - Menu - 5 -
        + Menu + 5
      • -
        - Menu - 6 -
        + Menu + 6
      • -
        - Menu - 7 -
        + Menu + 7
      • -
        - Menu - 8 -
        + Menu + 8
      • -
        - Menu - 9 -
        + Menu + 9
    • diff --git a/packages/react/src/components/DropdownSelector/MenuList/index.css b/packages/react/src/components/DropdownSelector/MenuList/index.css new file mode 100644 index 000000000..33cdef0cd --- /dev/null +++ b/packages/react/src/components/DropdownSelector/MenuList/index.css @@ -0,0 +1,4 @@ +.charcoal-menu-list { + padding: 0; + margin: 0; +} diff --git a/packages/react/src/components/DropdownSelector/MenuList/index.tsx b/packages/react/src/components/DropdownSelector/MenuList/index.tsx index dc5acb06b..06011133d 100644 --- a/packages/react/src/components/DropdownSelector/MenuList/index.tsx +++ b/packages/react/src/components/DropdownSelector/MenuList/index.tsx @@ -1,5 +1,6 @@ +import './index.css' + import { useMemo, useRef } from 'react' -import styled from 'styled-components' import { MenuListContext } from './MenuListContext' import { getValuesRecursive } from './internals/getValuesRecursive' import MenuItem from '../MenuItem' @@ -18,10 +19,6 @@ export type MenuListProps = { onChange?: (v: string) => void } -/** - * 上下キーでフォーカス移動でき、エンターキーで選択できるリストの項目 - * 基本的に``, ``と合わせて使用する - */ export default function MenuList(props: MenuListProps) { const root = useRef(null) const propsArray = useMemo( @@ -30,7 +27,7 @@ export default function MenuList(props: MenuListProps) { ) return ( - +
        {props.children} - +
      ) } - -const StyledUl = styled.ul` - padding: 0; - margin: 0; -` diff --git a/packages/react/src/components/DropdownSelector/Popover/index.css b/packages/react/src/components/DropdownSelector/Popover/index.css new file mode 100644 index 000000000..e8fc9d795 --- /dev/null +++ b/packages/react/src/components/DropdownSelector/Popover/index.css @@ -0,0 +1,11 @@ +.charcoal-popover { + margin: 4px 0; + list-style: none; + overflow: auto; + max-height: inherit; + background-color: var(--charcoal-background1); + border: solid 1px var(--charcoal-border-default); + border-radius: 8px; + padding-top: 8px; + padding-bottom: 8px; +} diff --git a/packages/react/src/components/DropdownSelector/Popover/index.tsx b/packages/react/src/components/DropdownSelector/Popover/index.tsx index c018d750f..928b080ae 100644 --- a/packages/react/src/components/DropdownSelector/Popover/index.tsx +++ b/packages/react/src/components/DropdownSelector/Popover/index.tsx @@ -1,6 +1,7 @@ +import './index.css' + import { RefObject, useContext, useRef, ReactNode } from 'react' import { DismissButton, Overlay, usePopover } from '@react-aria/overlays' -import styled from 'styled-components' import { ModalBackgroundContext } from '../../Modal/ModalBackgroundContext' import { usePreventScroll } from './usePreventScroll' @@ -58,23 +59,13 @@ export default function Popover(props: PopoverProps) { inset: 0, }} /> - +
      props.onClose()} /> +
      {props.children} +
      props.onClose()} /> - +
      ) } - -const DropdownPopoverDiv = styled.div` - margin: 4px 0; - list-style: none; - overflow: auto; - max-height: inherit; - background-color: var(--charcoal-background1); - border: solid 1px var(--charcoal-border-default); - border-radius: 8px; - padding-top: 8px; - padding-bottom: 8px; -` diff --git a/packages/react/src/components/DropdownSelector/__snapshots__/index.story.storyshot b/packages/react/src/components/DropdownSelector/__snapshots__/index.story.storyshot index d766e2128..10c3efb8f 100644 --- a/packages/react/src/components/DropdownSelector/__snapshots__/index.story.storyshot +++ b/packages/react/src/components/DropdownSelector/__snapshots__/index.story.storyshot @@ -1,90 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Storybook Tests react/DropdownSelector AssistiveText 1`] = ` -.c0 { - display: grid; - grid-template-columns: 1fr; - grid-gap: 4px; - width: 100%; -} - -.c0:disabled, -.c0[aria-disabled]:not([aria-disabled=false]) { - cursor: default; - opacity: 0.32; -} - -.c1 { - display: grid; - grid-template-columns: 1fr auto; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - height: 40px; - width: 100%; - box-sizing: border-box; - border: none; - cursor: pointer; - gap: 4px; - padding-right: 8px; - padding-left: 8px; - background-color: var(--charcoal-surface3); - border-radius: 4px; - -webkit-transition: 0.2s box-shadow,0.2s background-color; - transition: 0.2s box-shadow,0.2s background-color; -} - -.c1:disabled, -.c1[aria-disabled]:not([aria-disabled=false]) { - cursor: default; -} - -.c1:not(:disabled):not([aria-disabled]):focus, -.c1[aria-disabled='false']:focus { - outline: none; - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible), -.c1[aria-disabled='false']:focus:not(:focus-visible) { - box-shadow: none; -} - -.c1:not(:disabled):not([aria-disabled]):focus-visible, -.c1[aria-disabled='false']:focus-visible { - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):hover, -.c1[aria-disabled='false']:hover { - background-color: var(--charcoal-surface3-hover); -} - -.c1:not(:disabled):not([aria-disabled]):active, -.c1[aria-disabled='false']:active { - background-color: var(--charcoal-surface3-press); -} - -.c2 { - text-align: left; - font-size: 14px; - line-height: 22px; - display: flow-root; - color: var(--charcoal-text2); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.c3 { - color: var(--charcoal-text2); -} -
      @@ -96,8 +12,37 @@ exports[`Storybook Tests react/DropdownSelector AssistiveText 1`] = ` } >
      +
      + +
      + +
      +
      assistiveText
      @@ -164,90 +114,6 @@ exports[`Storybook Tests react/DropdownSelector AssistiveText 1`] = ` `; exports[`Storybook Tests react/DropdownSelector CustomChildren 1`] = ` -.c0 { - display: grid; - grid-template-columns: 1fr; - grid-gap: 4px; - width: 100%; -} - -.c0:disabled, -.c0[aria-disabled]:not([aria-disabled=false]) { - cursor: default; - opacity: 0.32; -} - -.c1 { - display: grid; - grid-template-columns: 1fr auto; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - height: 40px; - width: 100%; - box-sizing: border-box; - border: none; - cursor: pointer; - gap: 4px; - padding-right: 8px; - padding-left: 8px; - background-color: var(--charcoal-surface3); - border-radius: 4px; - -webkit-transition: 0.2s box-shadow,0.2s background-color; - transition: 0.2s box-shadow,0.2s background-color; -} - -.c1:disabled, -.c1[aria-disabled]:not([aria-disabled=false]) { - cursor: default; -} - -.c1:not(:disabled):not([aria-disabled]):focus, -.c1[aria-disabled='false']:focus { - outline: none; - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible), -.c1[aria-disabled='false']:focus:not(:focus-visible) { - box-shadow: none; -} - -.c1:not(:disabled):not([aria-disabled]):focus-visible, -.c1[aria-disabled='false']:focus-visible { - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):hover, -.c1[aria-disabled='false']:hover { - background-color: var(--charcoal-surface3-hover); -} - -.c1:not(:disabled):not([aria-disabled]):active, -.c1[aria-disabled='false']:active { - background-color: var(--charcoal-surface3-press); -} - -.c2 { - text-align: left; - font-size: 14px; - line-height: 22px; - display: flow-root; - color: var(--charcoal-text2); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.c3 { - color: var(--charcoal-text2); -} -
      @@ -259,8 +125,37 @@ exports[`Storybook Tests react/DropdownSelector CustomChildren 1`] = ` } >
      +
      + +
      + +
      +
      @@ -329,90 +227,6 @@ exports[`Storybook Tests react/DropdownSelector CustomChildren 1`] = ` `; exports[`Storybook Tests react/DropdownSelector Default 1`] = ` -.c0 { - display: grid; - grid-template-columns: 1fr; - grid-gap: 4px; - width: 100%; -} - -.c0:disabled, -.c0[aria-disabled]:not([aria-disabled=false]) { - cursor: default; - opacity: 0.32; -} - -.c1 { - display: grid; - grid-template-columns: 1fr auto; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - height: 40px; - width: 100%; - box-sizing: border-box; - border: none; - cursor: pointer; - gap: 4px; - padding-right: 8px; - padding-left: 8px; - background-color: var(--charcoal-surface3); - border-radius: 4px; - -webkit-transition: 0.2s box-shadow,0.2s background-color; - transition: 0.2s box-shadow,0.2s background-color; -} - -.c1:disabled, -.c1[aria-disabled]:not([aria-disabled=false]) { - cursor: default; -} - -.c1:not(:disabled):not([aria-disabled]):focus, -.c1[aria-disabled='false']:focus { - outline: none; - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible), -.c1[aria-disabled='false']:focus:not(:focus-visible) { - box-shadow: none; -} - -.c1:not(:disabled):not([aria-disabled]):focus-visible, -.c1[aria-disabled='false']:focus-visible { - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):hover, -.c1[aria-disabled='false']:hover { - background-color: var(--charcoal-surface3-hover); -} - -.c1:not(:disabled):not([aria-disabled]):active, -.c1[aria-disabled='false']:active { - background-color: var(--charcoal-surface3-press); -} - -.c2 { - text-align: left; - font-size: 14px; - line-height: 22px; - display: flow-root; - color: var(--charcoal-text3); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.c3 { - color: var(--charcoal-text2); -} -
      @@ -424,8 +238,35 @@ exports[`Storybook Tests react/DropdownSelector Default 1`] = ` } >
      +
      +
      @@ -486,90 +328,6 @@ exports[`Storybook Tests react/DropdownSelector Default 1`] = ` `; exports[`Storybook Tests react/DropdownSelector Disabled 1`] = ` -.c0 { - display: grid; - grid-template-columns: 1fr; - grid-gap: 4px; - width: 100%; -} - -.c0:disabled, -.c0[aria-disabled]:not([aria-disabled=false]) { - cursor: default; - opacity: 0.32; -} - -.c1 { - display: grid; - grid-template-columns: 1fr auto; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - height: 40px; - width: 100%; - box-sizing: border-box; - border: none; - cursor: pointer; - gap: 4px; - padding-right: 8px; - padding-left: 8px; - background-color: var(--charcoal-surface3); - border-radius: 4px; - -webkit-transition: 0.2s box-shadow,0.2s background-color; - transition: 0.2s box-shadow,0.2s background-color; -} - -.c1:disabled, -.c1[aria-disabled]:not([aria-disabled=false]) { - cursor: default; -} - -.c1:not(:disabled):not([aria-disabled]):focus, -.c1[aria-disabled='false']:focus { - outline: none; - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible), -.c1[aria-disabled='false']:focus:not(:focus-visible) { - box-shadow: none; -} - -.c1:not(:disabled):not([aria-disabled]):focus-visible, -.c1[aria-disabled='false']:focus-visible { - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):hover, -.c1[aria-disabled='false']:hover { - background-color: var(--charcoal-surface3-hover); -} - -.c1:not(:disabled):not([aria-disabled]):active, -.c1[aria-disabled='false']:active { - background-color: var(--charcoal-surface3-press); -} - -.c2 { - text-align: left; - font-size: 14px; - line-height: 22px; - display: flow-root; - color: var(--charcoal-text2); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.c3 { - color: var(--charcoal-text2); -} -
      @@ -582,8 +340,37 @@ exports[`Storybook Tests react/DropdownSelector Disabled 1`] = ` >
      +
      + +
      + +
      +
      @@ -645,90 +435,6 @@ exports[`Storybook Tests react/DropdownSelector Disabled 1`] = ` `; exports[`Storybook Tests react/DropdownSelector DisabledItem 1`] = ` -.c0 { - display: grid; - grid-template-columns: 1fr; - grid-gap: 4px; - width: 100%; -} - -.c0:disabled, -.c0[aria-disabled]:not([aria-disabled=false]) { - cursor: default; - opacity: 0.32; -} - -.c1 { - display: grid; - grid-template-columns: 1fr auto; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - height: 40px; - width: 100%; - box-sizing: border-box; - border: none; - cursor: pointer; - gap: 4px; - padding-right: 8px; - padding-left: 8px; - background-color: var(--charcoal-surface3); - border-radius: 4px; - -webkit-transition: 0.2s box-shadow,0.2s background-color; - transition: 0.2s box-shadow,0.2s background-color; -} - -.c1:disabled, -.c1[aria-disabled]:not([aria-disabled=false]) { - cursor: default; -} - -.c1:not(:disabled):not([aria-disabled]):focus, -.c1[aria-disabled='false']:focus { - outline: none; - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible), -.c1[aria-disabled='false']:focus:not(:focus-visible) { - box-shadow: none; -} - -.c1:not(:disabled):not([aria-disabled]):focus-visible, -.c1[aria-disabled='false']:focus-visible { - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):hover, -.c1[aria-disabled='false']:hover { - background-color: var(--charcoal-surface3-hover); -} - -.c1:not(:disabled):not([aria-disabled]):active, -.c1[aria-disabled='false']:active { - background-color: var(--charcoal-surface3-press); -} - -.c2 { - text-align: left; - font-size: 14px; - line-height: 22px; - display: flow-root; - color: var(--charcoal-text2); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.c3 { - color: var(--charcoal-text2); -} -
      @@ -740,8 +446,37 @@ exports[`Storybook Tests react/DropdownSelector DisabledItem 1`] = ` } >
      +
      + +
      + +
      +
      @@ -813,90 +551,6 @@ exports[`Storybook Tests react/DropdownSelector DisabledItem 1`] = ` `; exports[`Storybook Tests react/DropdownSelector InFormTag 1`] = ` -.c0 { - display: grid; - grid-template-columns: 1fr; - grid-gap: 4px; - width: 100%; -} - -.c0:disabled, -.c0[aria-disabled]:not([aria-disabled=false]) { - cursor: default; - opacity: 0.32; -} - -.c1 { - display: grid; - grid-template-columns: 1fr auto; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - height: 40px; - width: 100%; - box-sizing: border-box; - border: none; - cursor: pointer; - gap: 4px; - padding-right: 8px; - padding-left: 8px; - background-color: var(--charcoal-surface3); - border-radius: 4px; - -webkit-transition: 0.2s box-shadow,0.2s background-color; - transition: 0.2s box-shadow,0.2s background-color; -} - -.c1:disabled, -.c1[aria-disabled]:not([aria-disabled=false]) { - cursor: default; -} - -.c1:not(:disabled):not([aria-disabled]):focus, -.c1[aria-disabled='false']:focus { - outline: none; - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible), -.c1[aria-disabled='false']:focus:not(:focus-visible) { - box-shadow: none; -} - -.c1:not(:disabled):not([aria-disabled]):focus-visible, -.c1[aria-disabled='false']:focus-visible { - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):hover, -.c1[aria-disabled='false']:hover { - background-color: var(--charcoal-surface3-hover); -} - -.c1:not(:disabled):not([aria-disabled]):active, -.c1[aria-disabled='false']:active { - background-color: var(--charcoal-surface3-press); -} - -.c2 { - text-align: left; - font-size: 14px; - line-height: 22px; - display: flow-root; - color: var(--charcoal-text2); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.c3 { - color: var(--charcoal-text2); -} -
      @@ -910,8 +564,37 @@ exports[`Storybook Tests react/DropdownSelector InFormTag 1`] = ` } >
      +
      + +
      + +
      +
      @@ -1005,95 +691,6 @@ exports[`Storybook Tests react/DropdownSelector InModal 1`] = ` `; exports[`Storybook Tests react/DropdownSelector Invalid 1`] = ` -.c0 { - display: grid; - grid-template-columns: 1fr; - grid-gap: 4px; - width: 100%; -} - -.c0:disabled, -.c0[aria-disabled]:not([aria-disabled=false]) { - cursor: default; - opacity: 0.32; -} - -.c1 { - display: grid; - grid-template-columns: 1fr auto; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - height: 40px; - width: 100%; - box-sizing: border-box; - border: none; - cursor: pointer; - gap: 4px; - padding-right: 8px; - padding-left: 8px; - background-color: var(--charcoal-surface3); - border-radius: 4px; - -webkit-transition: 0.2s box-shadow,0.2s background-color; - transition: 0.2s box-shadow,0.2s background-color; -} - -.c1:disabled, -.c1[aria-disabled]:not([aria-disabled=false]) { - cursor: default; -} - -.c1:not(:disabled):not([aria-disabled]):focus, -.c1[aria-disabled='false']:focus { - outline: none; - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible), -.c1[aria-disabled='false']:focus:not(:focus-visible) { - box-shadow: none; -} - -.c1:not(:disabled):not([aria-disabled]):focus-visible, -.c1[aria-disabled='false']:focus-visible { - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):hover, -.c1[aria-disabled='false']:hover { - background-color: var(--charcoal-surface3-hover); -} - -.c1:not(:disabled):not([aria-disabled]):active, -.c1[aria-disabled='false']:active { - background-color: var(--charcoal-surface3-press); -} - -.c1:not(:disabled):not([aria-disabled]), -.c1[aria-disabled='false'] { - box-shadow: 0 0 0 4px rgba(255,43,0,0.32); -} - -.c2 { - text-align: left; - font-size: 14px; - line-height: 22px; - display: flow-root; - color: var(--charcoal-text2); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.c3 { - color: var(--charcoal-text2); -} -
      @@ -1105,8 +702,37 @@ exports[`Storybook Tests react/DropdownSelector Invalid 1`] = ` } >
      +
      + +
      + +
      +
      @@ -1167,95 +797,6 @@ exports[`Storybook Tests react/DropdownSelector Invalid 1`] = ` `; exports[`Storybook Tests react/DropdownSelector InvalidAssistiveText 1`] = ` -.c0 { - display: grid; - grid-template-columns: 1fr; - grid-gap: 4px; - width: 100%; -} - -.c0:disabled, -.c0[aria-disabled]:not([aria-disabled=false]) { - cursor: default; - opacity: 0.32; -} - -.c1 { - display: grid; - grid-template-columns: 1fr auto; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - height: 40px; - width: 100%; - box-sizing: border-box; - border: none; - cursor: pointer; - gap: 4px; - padding-right: 8px; - padding-left: 8px; - background-color: var(--charcoal-surface3); - border-radius: 4px; - -webkit-transition: 0.2s box-shadow,0.2s background-color; - transition: 0.2s box-shadow,0.2s background-color; -} - -.c1:disabled, -.c1[aria-disabled]:not([aria-disabled=false]) { - cursor: default; -} - -.c1:not(:disabled):not([aria-disabled]):focus, -.c1[aria-disabled='false']:focus { - outline: none; - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible), -.c1[aria-disabled='false']:focus:not(:focus-visible) { - box-shadow: none; -} - -.c1:not(:disabled):not([aria-disabled]):focus-visible, -.c1[aria-disabled='false']:focus-visible { - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):hover, -.c1[aria-disabled='false']:hover { - background-color: var(--charcoal-surface3-hover); -} - -.c1:not(:disabled):not([aria-disabled]):active, -.c1[aria-disabled='false']:active { - background-color: var(--charcoal-surface3-press); -} - -.c1:not(:disabled):not([aria-disabled]), -.c1[aria-disabled='false'] { - box-shadow: 0 0 0 4px rgba(255,43,0,0.32); -} - -.c2 { - text-align: left; - font-size: 14px; - line-height: 22px; - display: flow-root; - color: var(--charcoal-text2); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.c3 { - color: var(--charcoal-text2); -} -
      @@ -1267,8 +808,37 @@ exports[`Storybook Tests react/DropdownSelector InvalidAssistiveText 1`] = ` } >
      +
      + +
      + +
      +
      assistiveText
      @@ -1335,90 +911,6 @@ exports[`Storybook Tests react/DropdownSelector InvalidAssistiveText 1`] = ` `; exports[`Storybook Tests react/DropdownSelector Label 1`] = ` -.c0 { - display: grid; - grid-template-columns: 1fr; - grid-gap: 4px; - width: 100%; -} - -.c0:disabled, -.c0[aria-disabled]:not([aria-disabled=false]) { - cursor: default; - opacity: 0.32; -} - -.c1 { - display: grid; - grid-template-columns: 1fr auto; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - height: 40px; - width: 100%; - box-sizing: border-box; - border: none; - cursor: pointer; - gap: 4px; - padding-right: 8px; - padding-left: 8px; - background-color: var(--charcoal-surface3); - border-radius: 4px; - -webkit-transition: 0.2s box-shadow,0.2s background-color; - transition: 0.2s box-shadow,0.2s background-color; -} - -.c1:disabled, -.c1[aria-disabled]:not([aria-disabled=false]) { - cursor: default; -} - -.c1:not(:disabled):not([aria-disabled]):focus, -.c1[aria-disabled='false']:focus { - outline: none; - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible), -.c1[aria-disabled='false']:focus:not(:focus-visible) { - box-shadow: none; -} - -.c1:not(:disabled):not([aria-disabled]):focus-visible, -.c1[aria-disabled='false']:focus-visible { - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):hover, -.c1[aria-disabled='false']:hover { - background-color: var(--charcoal-surface3-hover); -} - -.c1:not(:disabled):not([aria-disabled]):active, -.c1[aria-disabled='false']:active { - background-color: var(--charcoal-surface3-press); -} - -.c2 { - text-align: left; - font-size: 14px; - line-height: 22px; - display: flow-root; - color: var(--charcoal-text2); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.c3 { - color: var(--charcoal-text2); -} -
      @@ -1430,13 +922,14 @@ exports[`Storybook Tests react/DropdownSelector Label 1`] = ` } >
      @@ -1486,17 +979,20 @@ exports[`Storybook Tests react/DropdownSelector Label 1`] = `
      @@ -1506,90 +1002,6 @@ exports[`Storybook Tests react/DropdownSelector Label 1`] = ` `; exports[`Storybook Tests react/DropdownSelector LongNames 1`] = ` -.c0 { - display: grid; - grid-template-columns: 1fr; - grid-gap: 4px; - width: 100%; -} - -.c0:disabled, -.c0[aria-disabled]:not([aria-disabled=false]) { - cursor: default; - opacity: 0.32; -} - -.c1 { - display: grid; - grid-template-columns: 1fr auto; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - height: 40px; - width: 100%; - box-sizing: border-box; - border: none; - cursor: pointer; - gap: 4px; - padding-right: 8px; - padding-left: 8px; - background-color: var(--charcoal-surface3); - border-radius: 4px; - -webkit-transition: 0.2s box-shadow,0.2s background-color; - transition: 0.2s box-shadow,0.2s background-color; -} - -.c1:disabled, -.c1[aria-disabled]:not([aria-disabled=false]) { - cursor: default; -} - -.c1:not(:disabled):not([aria-disabled]):focus, -.c1[aria-disabled='false']:focus { - outline: none; - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible), -.c1[aria-disabled='false']:focus:not(:focus-visible) { - box-shadow: none; -} - -.c1:not(:disabled):not([aria-disabled]):focus-visible, -.c1[aria-disabled='false']:focus-visible { - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):hover, -.c1[aria-disabled='false']:hover { - background-color: var(--charcoal-surface3-hover); -} - -.c1:not(:disabled):not([aria-disabled]):active, -.c1[aria-disabled='false']:active { - background-color: var(--charcoal-surface3-press); -} - -.c2 { - text-align: left; - font-size: 14px; - line-height: 22px; - display: flow-root; - color: var(--charcoal-text2); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.c3 { - color: var(--charcoal-text2); -} -
      @@ -1601,8 +1013,37 @@ exports[`Storybook Tests react/DropdownSelector LongNames 1`] = ` } >
      +
      + +
      + +
      +
      @@ -1663,95 +1107,6 @@ exports[`Storybook Tests react/DropdownSelector LongNames 1`] = ` `; exports[`Storybook Tests react/DropdownSelector RequiredText 1`] = ` -.c0 { - display: grid; - grid-template-columns: 1fr; - grid-gap: 4px; - width: 100%; -} - -.c0:disabled, -.c0[aria-disabled]:not([aria-disabled=false]) { - cursor: default; - opacity: 0.32; -} - -.c1 { - display: grid; - grid-template-columns: 1fr auto; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - height: 40px; - width: 100%; - box-sizing: border-box; - border: none; - cursor: pointer; - gap: 4px; - padding-right: 8px; - padding-left: 8px; - background-color: var(--charcoal-surface3); - border-radius: 4px; - -webkit-transition: 0.2s box-shadow,0.2s background-color; - transition: 0.2s box-shadow,0.2s background-color; -} - -.c1:disabled, -.c1[aria-disabled]:not([aria-disabled=false]) { - cursor: default; -} - -.c1:not(:disabled):not([aria-disabled]):focus, -.c1[aria-disabled='false']:focus { - outline: none; - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible), -.c1[aria-disabled='false']:focus:not(:focus-visible) { - box-shadow: none; -} - -.c1:not(:disabled):not([aria-disabled]):focus-visible, -.c1[aria-disabled='false']:focus-visible { - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):hover, -.c1[aria-disabled='false']:hover { - background-color: var(--charcoal-surface3-hover); -} - -.c1:not(:disabled):not([aria-disabled]):active, -.c1[aria-disabled='false']:active { - background-color: var(--charcoal-surface3-press); -} - -.c1:not(:disabled):not([aria-disabled]), -.c1[aria-disabled='false'] { - box-shadow: 0 0 0 4px rgba(255,43,0,0.32); -} - -.c2 { - text-align: left; - font-size: 14px; - line-height: 22px; - display: flow-root; - color: var(--charcoal-text2); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.c3 { - color: var(--charcoal-text2); -} -
      @@ -1763,13 +1118,14 @@ exports[`Storybook Tests react/DropdownSelector RequiredText 1`] = ` } >
      @@ -1824,17 +1180,20 @@ exports[`Storybook Tests react/DropdownSelector RequiredText 1`] = `
      @@ -1844,90 +1203,6 @@ exports[`Storybook Tests react/DropdownSelector RequiredText 1`] = ` `; exports[`Storybook Tests react/DropdownSelector Section 1`] = ` -.c0 { - display: grid; - grid-template-columns: 1fr; - grid-gap: 4px; - width: 100%; -} - -.c0:disabled, -.c0[aria-disabled]:not([aria-disabled=false]) { - cursor: default; - opacity: 0.32; -} - -.c1 { - display: grid; - grid-template-columns: 1fr auto; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - height: 40px; - width: 100%; - box-sizing: border-box; - border: none; - cursor: pointer; - gap: 4px; - padding-right: 8px; - padding-left: 8px; - background-color: var(--charcoal-surface3); - border-radius: 4px; - -webkit-transition: 0.2s box-shadow,0.2s background-color; - transition: 0.2s box-shadow,0.2s background-color; -} - -.c1:disabled, -.c1[aria-disabled]:not([aria-disabled=false]) { - cursor: default; -} - -.c1:not(:disabled):not([aria-disabled]):focus, -.c1[aria-disabled='false']:focus { - outline: none; - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible), -.c1[aria-disabled='false']:focus:not(:focus-visible) { - box-shadow: none; -} - -.c1:not(:disabled):not([aria-disabled]):focus-visible, -.c1[aria-disabled='false']:focus-visible { - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):hover, -.c1[aria-disabled='false']:hover { - background-color: var(--charcoal-surface3-hover); -} - -.c1:not(:disabled):not([aria-disabled]):active, -.c1[aria-disabled='false']:active { - background-color: var(--charcoal-surface3-press); -} - -.c2 { - text-align: left; - font-size: 14px; - line-height: 22px; - display: flow-root; - color: var(--charcoal-text2); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.c3 { - color: var(--charcoal-text2); -} -
      @@ -1939,8 +1214,37 @@ exports[`Storybook Tests react/DropdownSelector Section 1`] = ` } >
      +
      + +
      + +
      +
      @@ -2016,95 +1323,6 @@ exports[`Storybook Tests react/DropdownSelector Section 1`] = ` `; exports[`Storybook Tests react/DropdownSelector SubLabel 1`] = ` -.c0 { - display: grid; - grid-template-columns: 1fr; - grid-gap: 4px; - width: 100%; -} - -.c0:disabled, -.c0[aria-disabled]:not([aria-disabled=false]) { - cursor: default; - opacity: 0.32; -} - -.c1 { - display: grid; - grid-template-columns: 1fr auto; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - height: 40px; - width: 100%; - box-sizing: border-box; - border: none; - cursor: pointer; - gap: 4px; - padding-right: 8px; - padding-left: 8px; - background-color: var(--charcoal-surface3); - border-radius: 4px; - -webkit-transition: 0.2s box-shadow,0.2s background-color; - transition: 0.2s box-shadow,0.2s background-color; -} - -.c1:disabled, -.c1[aria-disabled]:not([aria-disabled=false]) { - cursor: default; -} - -.c1:not(:disabled):not([aria-disabled]):focus, -.c1[aria-disabled='false']:focus { - outline: none; - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible), -.c1[aria-disabled='false']:focus:not(:focus-visible) { - box-shadow: none; -} - -.c1:not(:disabled):not([aria-disabled]):focus-visible, -.c1[aria-disabled='false']:focus-visible { - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c1:not(:disabled):not([aria-disabled]):hover, -.c1[aria-disabled='false']:hover { - background-color: var(--charcoal-surface3-hover); -} - -.c1:not(:disabled):not([aria-disabled]):active, -.c1[aria-disabled='false']:active { - background-color: var(--charcoal-surface3-press); -} - -.c1:not(:disabled):not([aria-disabled]), -.c1[aria-disabled='false'] { - box-shadow: 0 0 0 4px rgba(255,43,0,0.32); -} - -.c2 { - text-align: left; - font-size: 14px; - line-height: 22px; - display: flow-root; - color: var(--charcoal-text2); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.c3 { - color: var(--charcoal-text2); -} -
      @@ -2116,13 +1334,14 @@ exports[`Storybook Tests react/DropdownSelector SubLabel 1`] = ` } >
      @@ -2174,17 +1393,20 @@ exports[`Storybook Tests react/DropdownSelector SubLabel 1`] = `
      diff --git a/packages/react/src/components/DropdownSelector/index.css b/packages/react/src/components/DropdownSelector/index.css new file mode 100644 index 000000000..0a0fc9298 --- /dev/null +++ b/packages/react/src/components/DropdownSelector/index.css @@ -0,0 +1,84 @@ +.charcoal-dropdown-selector-root { + display: grid; + grid-template-columns: 1fr; + grid-gap: 4px; + width: 100%; +} + +.charcoal-dropdown-selector-root[aria-disabled='true'] { + cursor: default; + opacity: 0.32; +} + +.charcoal-dropdown-selector-button { + display: grid; + grid-template-columns: 1fr auto; + justify-content: space-between; + align-items: center; + + height: 40px; + width: 100%; + box-sizing: border-box; + border: none; + cursor: pointer; + gap: 4px; + + padding-right: 8px; + padding-left: 8px; + background-color: var(--charcoal-surface3); + border-radius: 4px; + + transition: 0.2s box-shadow, 0.2s background-color; +} + +.charcoal-dropdown-selector-button:disabled { + cursor: default; +} + +.charcoal-dropdown-selector-button:not(:disabled):focus { + outline: none; + box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32); +} + +.charcoal-dropdown-selector-button:not(:disabled):focus-visible { + box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32); +} + +.charcoal-dropdown-selector-button:not(:disabled)[data-active='true'], +.charcoal-dropdown-selector-button:not(:disabled):active { + background-color: var(--charcoal-surface3-press); +} + +.charcoal-dropdown-selector-button:not(:disabled):hover { + background-color: var(--charcoal-surface3-hover); +} + +.charcoal-dropdown-selector-button:not(:disabled):focus:not(:focus-visible) { + box-shadow: none; +} + +.charcoal-dropdown-selector-button[aria-invalid='true'], +.charcoal-dropdown-selector-button:not( + :disabled + )[aria-invalid='true']:focus:not(:focus-visible) { + box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32); +} + +.charcoal-ui-dropdown-selector-text { + text-align: left; + font-size: 14px; + line-height: 22px; + display: flow-root; + color: var(--charcoal-text2); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.charcoal-ui-dropdown-selector-text[data-placeholder='true'] { + color: var(--charcoal-text3); +} + +.charcoal-ui-dropdown-selector-icon { + color: var(--charcoal-text2); +} diff --git a/packages/react/src/components/DropdownSelector/index.story.tsx b/packages/react/src/components/DropdownSelector/index.story.tsx index 364198691..48c92b469 100644 --- a/packages/react/src/components/DropdownSelector/index.story.tsx +++ b/packages/react/src/components/DropdownSelector/index.story.tsx @@ -25,8 +25,6 @@ export const Default: StoryObj = { {...args} onChange={setSelected} value={args.value ? args.value : selected} - placeholder="Placeholder" - label="Label" > Option 1 Option 2 @@ -164,7 +162,6 @@ export const RequiredText: StoryObj = {
      = {
      void + className?: string } -const defaultRequiredText = '*必須' - export default function DropdownSelector({ onChange, + showLabel = false, ...props }: DropdownSelectorProps) { const triggerRef = useRef(null) @@ -56,16 +57,24 @@ export default function DropdownSelector({ [onChange] ) + const labelId = useId() + const describedbyId = useId() + + const classNames = useClassNames( + 'charcoal-dropdown-selector-root', + props.className + ) + return ( - - {props.showLabel === true && ( - - )} +
      + @@ -493,90 +413,6 @@ exports[`Storybook Tests react/Modal BottomSheet 1`] = ` `; exports[`Storybook Tests react/Modal Default 1`] = ` -.c2 { - display: grid; - grid-template-columns: 1fr; - grid-gap: 4px; - width: 100%; -} - -.c2:disabled, -.c2[aria-disabled]:not([aria-disabled=false]) { - cursor: default; - opacity: 0.32; -} - -.c3 { - display: grid; - grid-template-columns: 1fr auto; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - height: 40px; - width: 100%; - box-sizing: border-box; - border: none; - cursor: pointer; - gap: 4px; - padding-right: 8px; - padding-left: 8px; - background-color: var(--charcoal-surface3); - border-radius: 4px; - -webkit-transition: 0.2s box-shadow,0.2s background-color; - transition: 0.2s box-shadow,0.2s background-color; -} - -.c3:disabled, -.c3[aria-disabled]:not([aria-disabled=false]) { - cursor: default; -} - -.c3:not(:disabled):not([aria-disabled]):focus, -.c3[aria-disabled='false']:focus { - outline: none; - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c3:not(:disabled):not([aria-disabled]):focus:not(:focus-visible), -.c3[aria-disabled='false']:focus:not(:focus-visible) { - box-shadow: none; -} - -.c3:not(:disabled):not([aria-disabled]):focus-visible, -.c3[aria-disabled='false']:focus-visible { - box-shadow: 0 0 0 4px rgba(0,150,250,0.32); -} - -.c3:not(:disabled):not([aria-disabled]):hover, -.c3[aria-disabled='false']:hover { - background-color: var(--charcoal-surface3-hover); -} - -.c3:not(:disabled):not([aria-disabled]):active, -.c3[aria-disabled='false']:active { - background-color: var(--charcoal-surface3-press); -} - -.c4 { - text-align: left; - font-size: 14px; - line-height: 22px; - display: flow-root; - color: var(--charcoal-text2); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.c5 { - color: var(--charcoal-text2); -} - .c0 { display: grid; gap: 24px; @@ -743,13 +579,14 @@ exports[`Storybook Tests react/Modal Default 1`] = ` className="charcoal-modal-align" >
      @@ -799,17 +636,20 @@ exports[`Storybook Tests react/Modal Default 1`] = `