From 252039b4196f547237182be5a1d51ceec27e571c Mon Sep 17 00:00:00 2001 From: Severin Landolt <41927988+severinlandolt@users.noreply.github.com> Date: Sat, 7 Dec 2024 17:27:46 +0100 Subject: [PATCH] fix: minimum select width (#1143) --- .../input-elements/DatePicker/DatePicker.tsx | 2 +- .../input-elements/MultiSelect/MultiSelect.tsx | 2 +- .../SearchSelect/SearchSelect.tsx | 18 +++++++++--------- .../input-elements/Select/Select.tsx | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/input-elements/DatePicker/DatePicker.tsx b/src/components/input-elements/DatePicker/DatePicker.tsx index cce231ff1..bdf3507ab 100644 --- a/src/components/input-elements/DatePicker/DatePicker.tsx +++ b/src/components/input-elements/DatePicker/DatePicker.tsx @@ -1,6 +1,6 @@ "use client"; -import React, { useMemo } from "react"; import { tremorTwMerge } from "lib"; +import React, { useMemo } from "react"; import { DayPickerSingleProps } from "react-day-picker"; import { startOfMonth, startOfToday } from "date-fns"; diff --git a/src/components/input-elements/MultiSelect/MultiSelect.tsx b/src/components/input-elements/MultiSelect/MultiSelect.tsx index cb64a7571..e4aa162dd 100644 --- a/src/components/input-elements/MultiSelect/MultiSelect.tsx +++ b/src/components/input-elements/MultiSelect/MultiSelect.tsx @@ -265,7 +265,7 @@ const MultiSelect = React.forwardRef((props, anchor="bottom start" className={tremorTwMerge( // common - "z-10 divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]", + "z-10 divide-y w-[var(--button-width)] overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]", // light "bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown", // dark diff --git a/src/components/input-elements/SearchSelect/SearchSelect.tsx b/src/components/input-elements/SearchSelect/SearchSelect.tsx index 6faa05a55..572221e74 100644 --- a/src/components/input-elements/SearchSelect/SearchSelect.tsx +++ b/src/components/input-elements/SearchSelect/SearchSelect.tsx @@ -1,7 +1,14 @@ "use client"; -import React, { isValidElement, useMemo, useRef } from "react"; import { useInternalState } from "hooks"; +import React, { isValidElement, useMemo, useRef } from "react"; +import { + Combobox, + ComboboxButton, + ComboboxInput, + ComboboxOptions, + Transition, +} from "@headlessui/react"; import { ArrowDownHeadIcon, XCircleIcon } from "assets"; import { makeClassName, tremorTwMerge } from "lib"; import { @@ -10,13 +17,6 @@ import { getSelectButtonColors, hasValue, } from "../selectUtils"; -import { - Combobox, - ComboboxButton, - ComboboxInput, - ComboboxOptions, - Transition, -} from "@headlessui/react"; const makeSearchSelectClassName = makeClassName("SearchSelect"); @@ -237,7 +237,7 @@ const SearchSelect = React.forwardRef((prop anchor="bottom start" className={tremorTwMerge( // common - "z-10 divide-y overflow-y-auto outline-none rounded-tremor-default text-tremor-default max-h-[228px] border [--anchor-gap:4px]", + "z-10 divide-y w-[var(--button-width)] overflow-y-auto outline-none rounded-tremor-default text-tremor-default max-h-[228px] border [--anchor-gap:4px]", // light "bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown", // dark diff --git a/src/components/input-elements/Select/Select.tsx b/src/components/input-elements/Select/Select.tsx index 496f94bc5..6d4e4e1de 100644 --- a/src/components/input-elements/Select/Select.tsx +++ b/src/components/input-elements/Select/Select.tsx @@ -1,8 +1,8 @@ "use client"; -import React, { isValidElement, useMemo, Children, useRef } from "react"; import { ArrowDownHeadIcon, XCircleIcon } from "assets"; import { makeClassName, tremorTwMerge } from "lib"; +import React, { Children, isValidElement, useMemo, useRef } from "react"; import { constructValueToNameMapping, getSelectButtonColors, hasValue } from "../selectUtils"; import { Listbox, ListboxButton, ListboxOptions, Transition } from "@headlessui/react"; @@ -199,7 +199,7 @@ const Select = React.forwardRef((props, ref) => { anchor="bottom start" className={tremorTwMerge( // common - "z-10 divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]", + "z-10 w-[var(--button-width)] divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]", // light "bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown", // dark