Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FieldBlock): remove max-width for label when width stretch #4406

Merged
merged 7 commits into from
Dec 13, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ function DatePickerCalendar(restOfProps: DatePickerCalendarProps) {
<CalendarButton
type="prev"
nr={nr}
date={minDate}
date={null}
langz marked this conversation as resolved.
Show resolved Hide resolved
langz marked this conversation as resolved.
Show resolved Hide resolved
month={month}
locale={locale}
showButton={prevBtn}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const stringProperties: PropertiesTableProps = {
status: 'optional',
},
width: {
doc: '`false` for no width (use browser default), small, medium or large for predefined standard widths, stretch for fill available width.',
doc: '`false` for no width (use browser default), small, medium or large for predefined standard widths, stretch to fill available width.',
type: ['string', 'false'],
status: 'optional',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,31 @@ import { Flex } from '../../../../../components'
export default {
title: 'Eufemia/Extensions/Forms/String',
}
export const StringAndLabelStretch = () => {
return (
<Form.Card stack>
langz marked this conversation as resolved.
Show resolved Hide resolved
<Form.SubHeading>Subheading</Form.SubHeading>
<Field.String
help={{ title: 'Help title', content: 'Help content' }}
path="/moreInfo"
label="Her kan du gi oss andre opplysninger som du tror kan være relevante for søknaden. Ønsker du for eksempel fastrente eller rammelån, kan du skrive det her."
multiline
autoresize
maxLength={250}
characterCounter={{
max: 250,
variant: 'down',
}}
/>
<Field.Number
label="Her kan du gi oss andre opplysninger som du tror kan være relevante for søknaden. Ønsker du for eksempel fastrente eller rammelån, kan du skrive det her."
placeholder="Enter a number..."
size="large"
width="stretch"
/>
</Form.Card>
)
}

export const String = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ fieldset.dnb-forms-field-block {
&--width {
&-stretch {
flex-grow: 1;
.dnb-forms-field-block__label.dnb-form-label {
max-width: none;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
max-width: none;
max-width: auto;

Copy link
Contributor Author

@langz langz Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto is not a possible value.
But perhaps I should use stretch?

https://developer.mozilla.org/en-US/docs/Web/CSS/max-width#syntax

@tujoworker

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stretch is not supported across all browsers yet.

}
}
@include allAbove(x-small) {
&-custom {
Expand Down
Loading