From 1377384c20f9c5a2db0373d499e2e31cdb15ebe4 Mon Sep 17 00:00:00 2001 From: riccardoperra Date: Sun, 7 Jan 2024 18:43:14 +0100 Subject: [PATCH] fix: combobox --- .../src/components/Combobox/Combobox.css.ts | 17 ++- .../kit/src/components/Combobox/Combobox.tsx | 127 +++++++++++++----- .../src/stories/Combobox.stories.tsx | 2 - 3 files changed, 107 insertions(+), 39 deletions(-) diff --git a/packages/kit/src/components/Combobox/Combobox.css.ts b/packages/kit/src/components/Combobox/Combobox.css.ts index 47afa80..e755aee 100644 --- a/packages/kit/src/components/Combobox/Combobox.css.ts +++ b/packages/kit/src/components/Combobox/Combobox.css.ts @@ -183,9 +183,18 @@ export const comboboxInput = style({ appearance: "none", background: "transparent", outline: "none", + border: 0, display: "inline-flex", minWidth: 0, - flex: 1, + width: "100%", +}); + +export const comboboxTrigger = style({ + border: 0, + background: "transparent", + outline: "none", + padding: 0, + color: themeVars.foreground, }); export const itemIndicator = style({ @@ -194,3 +203,9 @@ export const itemIndicator = style({ width: selectThemeVars.indicatorSize, flexShrink: 0, }); + +export const comboboxInputWorkaround = style({ + width: 0, + height: 0, + opacity: 0, +}); diff --git a/packages/kit/src/components/Combobox/Combobox.tsx b/packages/kit/src/components/Combobox/Combobox.tsx index 51713ec..8891a3a 100644 --- a/packages/kit/src/components/Combobox/Combobox.tsx +++ b/packages/kit/src/components/Combobox/Combobox.tsx @@ -1,17 +1,17 @@ -import { Combobox as KCombobox } from "@kobalte/core"; +import { Combobox as KCombobox, createControllableBooleanSignal } from "@kobalte/core"; import { Accessor, JSX, JSXElement, Show, createSignal, splitProps } from "solid-js"; import { CheckIcon } from "../../icons/CheckIcon"; import { SelectorIcon } from "../../icons/SelectorIcon"; import { mergeClasses } from "../../utils/css"; -import { BaseFieldProps, createBaseFieldProps } from "../Field/createBaseFieldProps"; +import { highlight } from "../../utils/highlight/highlight"; import { - createFieldErrorMessageProps, FieldWithErrorMessageSupport, + createFieldErrorMessageProps, } from "../Field/FieldError/createFieldErrorMessageProps"; import { createFieldLabelProps } from "../Field/FieldLabel/createFieldLabelProps"; import { createFieldMessageProps } from "../Field/FieldMessage/createFieldMessageProps"; +import { BaseFieldProps, createBaseFieldProps } from "../Field/createBaseFieldProps"; import * as styles from "./Combobox.css"; -import { highlight } from "../../utils/highlight/highlight"; void highlight; @@ -29,10 +29,6 @@ export type ComboboxProps = KCombobox.ComboboxRootProp valueComponent?: (state: Accessor