diff --git a/app/client/packages/design-system/widgets/src/components/Select/src/Select.tsx b/app/client/packages/design-system/widgets/src/components/Select/src/Select.tsx index 50171e79909..4a7b3c7342c 100644 --- a/app/client/packages/design-system/widgets/src/components/Select/src/Select.tsx +++ b/app/client/packages/design-system/widgets/src/components/Select/src/Select.tsx @@ -1,19 +1,19 @@ -import React, { useRef } from "react"; -import clsx from "clsx"; +import { Icon, Label, Popover, Spinner, Text } from "@appsmith/wds"; import { getTypographyClassName } from "@appsmith/wds-theming"; +import clsx from "clsx"; +import React, { useRef } from "react"; import { Button, - ListBox, + FieldError, Select as HeadlessSelect, + ListBox, SelectValue, - FieldError, } from "react-aria-components"; -import { Text, Icon, Spinner, Popover, Label } from "@appsmith/wds"; import { ListBoxItem } from "./ListBoxItem"; import styles from "./styles.module.css"; import type { SelectProps } from "./types"; -export const Select = (props: SelectProps) => { +export const Select = (props: SelectProps) => { const { contextualHelp, description, @@ -53,7 +53,15 @@ export const Select = (props: SelectProps) => { styles.fieldValue, getTypographyClassName("body"), )} - /> + > + {({ defaultChildren, isPlaceholder }) => { + if (isPlaceholder) { + return props.placeholder; + } + + return defaultChildren; + }} + {!Boolean(isLoading) && } {Boolean(isLoading) && } diff --git a/app/client/packages/design-system/widgets/src/components/Select/src/index.ts b/app/client/packages/design-system/widgets/src/components/Select/src/index.ts index b6e8a07c267..b252bd3f677 100644 --- a/app/client/packages/design-system/widgets/src/components/Select/src/index.ts +++ b/app/client/packages/design-system/widgets/src/components/Select/src/index.ts @@ -1 +1,2 @@ export * from "./Select"; +export type { SelectProps } from "./types"; diff --git a/app/client/packages/design-system/widgets/src/components/Select/src/styles.module.css b/app/client/packages/design-system/widgets/src/components/Select/src/styles.module.css index 75f563e2eb3..10412f1d14a 100644 --- a/app/client/packages/design-system/widgets/src/components/Select/src/styles.module.css +++ b/app/client/packages/design-system/widgets/src/components/Select/src/styles.module.css @@ -8,6 +8,7 @@ display: flex; position: relative; padding: 0; + height: var(--sizing-9); border: none; align-items: center; border-radius: var(--border-radius-elevation-3); @@ -43,7 +44,7 @@ .textField [data-icon] { position: absolute; - right: var(--inner-spacing-2); + right: var(--inner-spacing-1); } .necessityIndicator { @@ -66,6 +67,10 @@ flex: 1; } +.fieldValue[data-placeholder] { + color: var(--color-fg-neutral-subtle); +} + .fieldValue [data-icon] { display: none; } diff --git a/app/client/packages/design-system/widgets/src/components/Select/src/types.ts b/app/client/packages/design-system/widgets/src/components/Select/src/types.ts index c3220aa5b05..4e88e56cac3 100644 --- a/app/client/packages/design-system/widgets/src/components/Select/src/types.ts +++ b/app/client/packages/design-system/widgets/src/components/Select/src/types.ts @@ -5,10 +5,10 @@ import type { } from "react-aria-components"; import type { IconProps, SIZES } from "@appsmith/wds"; -export interface SelectProps - extends Omit, "slot"> { +export interface SelectProps + extends Omit, "slot"> { /** Item objects in the collection. */ - items: Iterable; + items: SelectItem[]; /** The content to display as the label. */ label?: string; /** The content to display as the description. */ diff --git a/app/client/src/components/propertyControls/KeyValueComponent.tsx b/app/client/src/components/propertyControls/KeyValueComponent.tsx index 0ec815db0ec..a2f3add9a92 100644 --- a/app/client/src/components/propertyControls/KeyValueComponent.tsx +++ b/app/client/src/components/propertyControls/KeyValueComponent.tsx @@ -214,6 +214,8 @@ export function KeyValueComponent(props: KeyValueComponentProps) { />