Skip to content

Commit

Permalink
feat(Forms): add layoutOptions for enhanced horizontal label layout
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Nov 5, 2024
1 parent 6f80ed9 commit b44573b
Show file tree
Hide file tree
Showing 133 changed files with 1,086 additions and 843 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ export const RadioExampleGroupStatus = () => (

export const RadioExampleWithoutGroup = () => (
<ComponentBox data-visual-test="radio-group-plain">
<FieldBlock label="Plain Radio group" layout="horizontal">
<FieldBlock
label="Plain Radio group"
layout="horizontal"
labelHeight="small"
>
<Radio
value="first"
label="First"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,22 @@ import ComponentBox from '../../../../../../shared/tags/ComponentBox'
import { P } from '@dnb/eufemia/src'
import { Value } from '@dnb/eufemia/src/extensions/forms'

export const Empty = () => {
return (
<ComponentBox>
<Value.Date showEmpty />
</ComponentBox>
)
}

export const Placeholder = () => {
return (
<ComponentBox>
<Value.Date placeholder="The value was not filled in" />
</ComponentBox>
)
}

export const WithValue = () => {
return (
<ComponentBox>
<Value.Date value="2023-01-16" />
</ComponentBox>
)
}

export const VariantShort = () => {
return (
<ComponentBox>
<Value.Date value="2023-01-16" variant="short" />
<Value.Date label="Label text" value="2023-01-16" variant="short" />
</ComponentBox>
)
}

export const VariantNumeric = () => {
return (
<ComponentBox>
<Value.Date value="2023-01-16" variant="numeric" />
</ComponentBox>
)
}

export const Label = () => {
return (
<ComponentBox>
<Value.Date label="Label text" showEmpty />
<Value.Date
label="Label text"
value="2023-01-16"
variant="numeric"
/>
</ComponentBox>
)
}
Expand All @@ -63,7 +35,7 @@ export const Inline = () => {
<ComponentBox>
<P>
This is before the component
<Value.Date value="2023-01-16" inline />
<Value.Date label="Label text" value="2023-01-16" inline />
This is after the component
</P>
</ComponentBox>
Expand All @@ -73,7 +45,7 @@ export const Inline = () => {
export const Range = () => {
return (
<ComponentBox>
<Value.Date value="2023-01-16|2023-04-01" />
<Value.Date label="Label text" value="2023-01-16|2023-04-01" />
</ComponentBox>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,9 @@ import * as Examples from './Examples'

## Demos

### Empty

<Examples.Empty />

### Placeholder

<Examples.Placeholder />

### Value
### Label and value

<Examples.WithValue />
<Examples.LabelAndValue />

### Variant short

Expand All @@ -26,14 +18,6 @@ import * as Examples from './Examples'

<Examples.VariantNumeric />

### Label

<Examples.Label />

### Label and value

<Examples.LabelAndValue />

### Date range

<Examples.Range />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ showTabs: true
---

import PropertiesTable from 'dnb-design-system-portal/src/shared/parts/PropertiesTable'
import { fieldEvents } from '@dnb/eufemia/src/extensions/forms/Field/FieldDocs'
import { FieldEvents } from '@dnb/eufemia/src/extensions/forms/Field/FieldDocs'

## Events

<PropertiesTable props={fieldEvents} />
<PropertiesTable props={FieldEvents} />
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ showTabs: true

import PropertiesTable from 'dnb-design-system-portal/src/shared/parts/PropertiesTable'
import { arraySelectionProperties } from '@dnb/eufemia/src/extensions/forms/Field/ArraySelection/ArraySelectionDocs'
import { fieldProperties } from '@dnb/eufemia/src/extensions/forms/Field/FieldDocs'
import { FieldProperties } from '@dnb/eufemia/src/extensions/forms/Field/FieldDocs'

## Properties

Expand All @@ -15,6 +15,6 @@ import { fieldProperties } from '@dnb/eufemia/src/extensions/forms/Field/FieldDo
### General properties

<PropertiesTable
props={fieldProperties}
props={FieldProperties}
valueType="Array<string | number>"
/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ showTabs: true
---

import PropertiesTable from 'dnb-design-system-portal/src/shared/parts/PropertiesTable'
import { fieldEvents } from '@dnb/eufemia/src/extensions/forms/Field/FieldDocs'
import { FieldEvents } from '@dnb/eufemia/src/extensions/forms/Field/FieldDocs'

## Events

<PropertiesTable props={fieldEvents} />
<PropertiesTable props={FieldEvents} />
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ showTabs: true

import TranslationsTable from 'dnb-design-system-portal/src/shared/parts/TranslationsTable'
import PropertiesTable from 'dnb-design-system-portal/src/shared/parts/PropertiesTable'
import { fieldProperties } from '@dnb/eufemia/src/extensions/forms/Field/FieldDocs'
import { FieldProperties } from '@dnb/eufemia/src/extensions/forms/Field/FieldDocs'
import { BooleanProperties } from '@dnb/eufemia/src/extensions/forms/Field/Boolean/BooleanDocs'

## Properties
Expand All @@ -15,7 +15,11 @@ import { BooleanProperties } from '@dnb/eufemia/src/extensions/forms/Field/Boole

### General properties

<PropertiesTable props={fieldProperties} valueType="boolean" />
<PropertiesTable
props={FieldProperties}
valueType="boolean"
omit={['layout', 'layoutOptions']}
/>

## Translations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ showTabs: true
---

import PropertiesTable from 'dnb-design-system-portal/src/shared/parts/PropertiesTable'
import { fieldProperties } from '@dnb/eufemia/src/extensions/forms/Field/FieldDocs'
import { FieldProperties } from '@dnb/eufemia/src/extensions/forms/Field/FieldDocs'
import { IndeterminateProperties } from '@dnb/eufemia/src/extensions/forms/Field/Indeterminate/IndeterminateDocs'

## Properties
Expand All @@ -14,4 +14,4 @@ import { IndeterminateProperties } from '@dnb/eufemia/src/extensions/forms/Field

### General properties

<PropertiesTable props={fieldProperties} valueType="any" />
<PropertiesTable props={FieldProperties} valueType="any" />
Loading

0 comments on commit b44573b

Please sign in to comment.