From be09ef506b54eb8fe271568ad4516d3bf6382b3d Mon Sep 17 00:00:00 2001 From: Christian Vuerings Date: Mon, 18 Mar 2024 09:44:24 -0700 Subject: [PATCH] RichSelectList: fix classic & cambio styling --- .changeset/five-impalas-tan.md | 6 ++ .../src/RichSelect/RichSelectList.tsx | 72 +++++++++++-------- .../src/SelectList/SelectList.module.css | 1 + 3 files changed, 50 insertions(+), 29 deletions(-) create mode 100644 .changeset/five-impalas-tan.md diff --git a/.changeset/five-impalas-tan.md b/.changeset/five-impalas-tan.md new file mode 100644 index 00000000..abe6579a --- /dev/null +++ b/.changeset/five-impalas-tan.md @@ -0,0 +1,6 @@ +--- +"@cambly/syntax-core": minor +"@syntax/storybook": minor +--- + +RichSelectList: fix styling for cambio & classic diff --git a/packages/syntax-core/src/RichSelect/RichSelectList.tsx b/packages/syntax-core/src/RichSelect/RichSelectList.tsx index 83fb6c32..5e263abe 100644 --- a/packages/syntax-core/src/RichSelect/RichSelectList.tsx +++ b/packages/syntax-core/src/RichSelect/RichSelectList.tsx @@ -33,6 +33,7 @@ import RichSelectSection from "./RichSelectSection"; import RichSelectChip from "./RichSelectChip"; import RichSelectRadioButton from "./RichSelectRadioButton"; import { useField } from "react-aria"; +import { useTheme } from "../ThemeProvider/ThemeProvider"; const NOOP = () => undefined; @@ -61,7 +62,7 @@ export type RichSelectListProps = RichSelectBoxProps & { */ id?: string; /** Text shown above select box */ - label?: string; + label: string; /** * Text showing in select box if no option has been chosen. * There should always have a placeholder unless there is a default option selected @@ -124,6 +125,7 @@ function RichSelectList(props: RichSelectListProps): ReactElement { const inputId = id ?? reactId; const isHydrated = useIsHydrated(); const disabled = !isHydrated || disabledProp; + const { themeName } = useTheme(); // passed to popover, which attached open/close methods const overlayHandlerRef = useRef({}); @@ -176,31 +178,31 @@ function RichSelectList(props: RichSelectListProps): ReactElement {
- { - if (disabled) return; - fieldRef.current?.focus(); - setInteractionModality("keyboard"); // Show the focus ring so the user knows where focus went - }} - > - {label && ( - - )} - + + + )}
{selectedTextValue}
@@ -264,7 +278,7 @@ function RichSelectList(props: RichSelectListProps): ReactElement { {(helperText || errorText) && ( -
+ {errorText ? errorText : helperText} -
+ )}
diff --git a/packages/syntax-core/src/SelectList/SelectList.module.css b/packages/syntax-core/src/SelectList/SelectList.module.css index 33388582..cecc6aa7 100644 --- a/packages/syntax-core/src/SelectList/SelectList.module.css +++ b/packages/syntax-core/src/SelectList/SelectList.module.css @@ -52,6 +52,7 @@ .selectBoxCambio { border: 1px solid var(--color-cambio-gray-370); border-radius: 8px; + box-sizing: border-box; font-size: 14px; height: 48px; padding: 12px 36px 0 12px;