diff --git a/components/Forms/Edit/Profile/FormContent/index.tsx b/components/Forms/Edit/Profile/FormContent/index.tsx index ad26f1087..40dbdb1ae 100644 --- a/components/Forms/Edit/Profile/FormContent/index.tsx +++ b/components/Forms/Edit/Profile/FormContent/index.tsx @@ -62,7 +62,6 @@ export default function FormContent() { items={languageSelect} label={intl.formatMessage({ id: "Language" })} name="language" - placeholder={intl.formatMessage({ id: "Select language" })} /> diff --git a/components/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx b/components/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx index c609d7d6e..67ebf4aa7 100644 --- a/components/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx +++ b/components/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx @@ -20,8 +20,10 @@ const ageList = [...Array(13)].map((_, i) => ({ value: i, })) +const childDefaultValues = { age: -1, bed: -1 } + export default function ChildInfoSelector({ - child = { age: -1, bed: -1 }, + child, childrenInAdultsBed, adults, index = 0, @@ -89,11 +91,10 @@ export default function ChildInfoSelector({ items={ageList} label={ageLabel} aria-label={ageLabel} - value={child.age} + value={child.age ?? childDefaultValues.age} onSelect={(key) => { updateSelectedAge(key as number) }} - placeholder={ageLabel} maxHeight={180} name={ageFieldName} isNestedInModal={true} @@ -105,11 +106,10 @@ export default function ChildInfoSelector({ items={getAvailableBeds(child.age)} label={bedLabel} aria-label={bedLabel} - value={child.bed} + value={child.bed ?? childDefaultValues.bed} onSelect={(key) => { updateSelectedBed(key as number) }} - placeholder={bedLabel} name={bedFieldName} isNestedInModal={true} /> diff --git a/components/TempDesignSystem/Form/Date/index.tsx b/components/TempDesignSystem/Form/Date/index.tsx index b7849c472..ae9d98818 100644 --- a/components/TempDesignSystem/Form/Date/index.tsx +++ b/components/TempDesignSystem/Form/Date/index.tsx @@ -138,7 +138,6 @@ export default function DateSelect({ name, registerOptions = {} }: DateProps) { onSelect={(key: Key) => setValue(DateName.day, Number(key)) } - placeholder={dayLabel} required tabIndex={3} value={segment.isPlaceholder ? undefined : segment.value} @@ -158,7 +157,6 @@ export default function DateSelect({ name, registerOptions = {} }: DateProps) { onSelect={(key: Key) => setValue(DateName.month, Number(key)) } - placeholder={monthLabel} required tabIndex={2} value={segment.isPlaceholder ? undefined : segment.value} @@ -178,7 +176,6 @@ export default function DateSelect({ name, registerOptions = {} }: DateProps) { onSelect={(key: Key) => setValue(DateName.year, Number(key)) } - placeholder={yearLabel} required tabIndex={1} value={segment.isPlaceholder ? undefined : segment.value} diff --git a/components/TempDesignSystem/Form/Input/AriaInputWithLabel/input.module.css b/components/TempDesignSystem/Form/Input/AriaInputWithLabel/input.module.css index aa7e157cb..35ff6bdbc 100644 --- a/components/TempDesignSystem/Form/Input/AriaInputWithLabel/input.module.css +++ b/components/TempDesignSystem/Form/Input/AriaInputWithLabel/input.module.css @@ -37,6 +37,11 @@ padding: 0; } +.container:has(.input:not(:placeholder-shown)) { + align-content: space-around; + gap: var(--Spacing-x-half); +} + .input:not(:active, :focus):placeholder-shown { height: 0px; transition: height 150ms ease; diff --git a/components/TempDesignSystem/Form/Label/label.module.css b/components/TempDesignSystem/Form/Label/label.module.css index 8d87f44c5..645f62f2f 100644 --- a/components/TempDesignSystem/Form/Label/label.module.css +++ b/components/TempDesignSystem/Form/Label/label.module.css @@ -24,48 +24,47 @@ span.discreet { order: unset; } +/* Handle input and textarea fields */ input:active ~ .label, -input:not(:placeholder-shown) ~ .label { - display: block; - font-size: 12px; -} - -input:focus ~ .label { - font-size: 12px; -} - -input:placeholder-shown ~ .label { - grid-row: 1/-1; -} - -input:placeholder-shown:focus ~ .label, -input:placeholder-shown:active ~ .label { - margin-bottom: var(--Spacing-x-half); -} - -input:disabled ~ .label { - color: var(--Main-Grey-40); -} - +input:not(:placeholder-shown) ~ .label, textarea:active ~ .label, textarea:not(:placeholder-shown) ~ .label { display: block; font-size: 12px; } +input:focus ~ .label, textarea:focus ~ .label { font-size: 12px; } +input:placeholder-shown ~ .label, textarea:placeholder-shown ~ .label { grid-row: 1/-1; } -textarea:placeholder-shown:focus ~ .label, +input:placeholder-shown:focus ~ .label, +input:placeholder-shown:active ~ .label, +textarea:placeholder-shown.label, textarea:placeholder-shown:active ~ .label { margin-bottom: var(--Spacing-x-half); } -textarea:disabled ~ .label { +input:disabled ~ .label, +textarea:disabled ~ .label, +:global(.select-container)[data-disabled] .label { color: var(--Main-Grey-40); } + +/* Handle select fields */ +:global(.select-button) .label { + order: unset; +} + +:global(.select-container)[data-open="true"] .label:not(.discreet), +:global(.react-aria-SelectValue):has(:nth-child(2)) .label:not(.discreet), +:global(.select-button):active .label:not(.discreet) { + display: grid; + font-size: 12px; + margin-bottom: var(--Spacing-x-half); +} diff --git a/components/TempDesignSystem/Form/Select/index.tsx b/components/TempDesignSystem/Form/Select/index.tsx index 8170bc946..536bcfc14 100644 --- a/components/TempDesignSystem/Form/Select/index.tsx +++ b/components/TempDesignSystem/Form/Select/index.tsx @@ -9,8 +9,8 @@ export default function Select({ className, items, label, + disabled, name, - placeholder, registerOptions = {}, }: SelectProps) { const { control } = useFormContext() @@ -24,14 +24,13 @@ export default function Select({ diff --git a/components/TempDesignSystem/Form/Select/select.ts b/components/TempDesignSystem/Form/Select/select.ts index 030f7b587..2d55cef99 100644 --- a/components/TempDesignSystem/Form/Select/select.ts +++ b/components/TempDesignSystem/Form/Select/select.ts @@ -5,7 +5,7 @@ import type { SelectProps as ReactAriaSelectProps } from "@/components/TempDesig export interface SelectProps extends Omit< React.SelectHTMLAttributes, - "name" | "onSelect" + "name" | "onSelect" | "placeholder" >, Omit { registerOptions?: RegisterOptions diff --git a/components/TempDesignSystem/Select/index.tsx b/components/TempDesignSystem/Select/index.tsx index 3a162e012..ef287d4cc 100644 --- a/components/TempDesignSystem/Select/index.tsx +++ b/components/TempDesignSystem/Select/index.tsx @@ -32,7 +32,7 @@ export default function Select({ label, name, onSelect, - placeholder, + disabled, required = false, tabIndex, value, @@ -54,45 +54,46 @@ export default function Select({ onSelect(key) } + let chevronProps = {} + + if (discreet) { + chevronProps = { color: "baseButtonTextOnFillNormal" } + } else if (disabled) { + chevronProps = { color: "disabled" } + } + return (
- diff --git a/components/TempDesignSystem/Select/select.module.css b/components/TempDesignSystem/Select/select.module.css index 7692a9154..60251bc41 100644 --- a/components/TempDesignSystem/Select/select.module.css +++ b/components/TempDesignSystem/Select/select.module.css @@ -33,11 +33,11 @@ gap: var(--Spacing-x1); } -.select.discreet .inputContentWrapper { - align-items: center; - justify-content: flex-end; - flex-direction: row; - font-weight: 500; +.select[data-disabled], +.select[data-disabled] .input { + background-color: var(--UI-Input-Controls-Surface-Disabled); + border: none; + pointer-events: none; } .input { @@ -54,14 +54,21 @@ text-align: left; } -.inputContentWrapper { +.input :global(.react-aria-SelectValue) { align-items: flex-start; display: flex; flex-direction: column; - gap: var(--Spacing-x-half); flex: 1 0 0; } +.select.discreet :global(.react-aria-SelectValue) { + align-items: center; + justify-content: flex-end; + flex-direction: row; + font-weight: 500; + gap: var(--Spacing-x-half); +} + .popover { background-color: var(--Main-Grey-White); border-radius: var(--Corner-radius-Medium); @@ -110,3 +117,20 @@ .listBoxItem[data-selected="true"].showRadioButton:before { box-shadow: inset 0 0 0 8px var(--UI-Input-Controls-Fill-Selected); } + +/* Use global react aria classnames here since setting a css modules classname overrides + the class set by react aria.We use that class to style the child label component. */ +.select:not(.discreet) :global(.react-aria-SelectValue) { + display: grid; + transition: height 200ms ease; +} + +.input :global(.react-aria-SelectValue) { + height: 18px; + overflow: hidden; +} + +.input :global(.react-aria-SelectValue):has(:nth-child(2)) { + height: 38px; + overflow: visible; +} diff --git a/components/TempDesignSystem/Select/select.ts b/components/TempDesignSystem/Select/select.ts index 7a0d8b6c7..8246aa0ef 100644 --- a/components/TempDesignSystem/Select/select.ts +++ b/components/TempDesignSystem/Select/select.ts @@ -7,7 +7,6 @@ export interface SelectProps label: string name: string onSelect: (key: Key) => void - placeholder?: string value?: string | number maxHeight?: number showRadioButton?: boolean