+
+ )
+ }
+ return
+ }}
+
+)
+
+export const MediaQueryLiveExample = () => (
+
+ {() => {
+ const Playground = () => {
+ const [query, updateQuery] = React.useState({
+ screen: true,
+ not: true,
+ min: 'small',
+ max: 'large',
+ })
+
+ const match1 = useMediaQuery({
+ matchOnSSR: true,
+ when: query,
+ })
+ const match2 = useMediaQuery({
+ matchOnSSR: true,
+ not: true,
+ when: query,
+ })
+
+ React.useEffect(() => {
+ console.log('mediaQuery:', match1, match2)
+ }, [match1, match2])
+
+ return (
+ <>
+
+
+ when
+
+
+ not when
+
+ >
+ )
+ }
+ return
+ }}
+
+)
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/flex/container.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/container.mdx
new file mode 100644
index 00000000000..6c5da492f09
--- /dev/null
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/container.mdx
@@ -0,0 +1,19 @@
+---
+title: 'Flex.Container'
+description: '`Flex.Container` is a building block for CSS Grid based layouts.'
+hideInMenu: true
+showTabs: true
+tabs:
+ - title: Info
+ key: '/info'
+ - title: Demos
+ key: '/demos'
+ - title: Properties
+ key: '/properties'
+---
+
+import Info from 'Docs/uilib/components/flex/container/info'
+import Demos from 'Docs/uilib/components/flex/container/demos'
+
+
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexContainer/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/container/Examples.tsx
similarity index 57%
rename from packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexContainer/Examples.tsx
rename to packages/dnb-design-system-portal/src/docs/uilib/components/flex/container/Examples.tsx
index 2538e50ddcc..542290bc348 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexContainer/Examples.tsx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/container/Examples.tsx
@@ -1,24 +1,24 @@
import ComponentBox from '../../../../../shared/tags/ComponentBox'
-import { Card, Layout } from '@dnb/eufemia/src'
+import { Card, Flex } from '@dnb/eufemia/src'
import { TestElement, Field } from '@dnb/eufemia/src/extensions/forms'
export const Default = () => {
return (
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+
)
}
@@ -27,12 +27,12 @@ export const HorizontalWithFieldString = () => {
return (
-
+
-
+
)
}
@@ -40,20 +40,20 @@ export const HorizontalWithFieldString = () => {
export const HorizontalWithFlexItem = () => {
return (
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+
)
}
@@ -61,20 +61,20 @@ export const HorizontalWithFlexItem = () => {
export const HorizontalWithFlexItemJustifyCenter = () => {
return (
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+
)
}
@@ -82,20 +82,20 @@ export const HorizontalWithFlexItemJustifyCenter = () => {
export const HorizontalWithFlexItemJustifyFlexEnd = () => {
return (
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+
)
}
@@ -103,20 +103,20 @@ export const HorizontalWithFlexItemJustifyFlexEnd = () => {
export const VerticalWithFlexItem = () => {
return (
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+
)
}
@@ -124,11 +124,11 @@ export const VerticalWithFlexItem = () => {
export const VerticalWithCard = () => {
return (
-
+ Card contentsCard contentsCard contents
-
+
)
}
@@ -137,10 +137,10 @@ export const VerticalWithFieldString = () => {
return (
-
+
-
+
)
@@ -150,13 +150,13 @@ export const VerticalSpaceDivider = () => {
return (
-
+
-
+
)
@@ -165,26 +165,26 @@ export const VerticalSpaceDivider = () => {
export const LayoutHorizontalFlexGrowItems = () => {
return (
-
-
+
+ Card contents
-
-
+
+ Card contents
-
-
+
+ Card contents
-
-
+
+ Card contents
-
-
+
+ Card contents
-
-
+
+ Card contents
-
-
+
+
)
}
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexContainer/demos.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/container/demos.mdx
similarity index 82%
rename from packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexContainer/demos.mdx
rename to packages/dnb-design-system-portal/src/docs/uilib/components/flex/container/demos.mdx
index 29023ce8cec..5b23568b6c7 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexContainer/demos.mdx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/container/demos.mdx
@@ -10,15 +10,15 @@ import * as Examples from './Examples'
-### Horizontal FlexItem
+### Horizontal Flex.Item
-### Horizontal FlexItem, `justify="center"`
+### Horizontal Flex.Item, `justify="center"`
-### Horizontal FlexItem, `justify="flex-end"`
+### Horizontal Flex.Item, `justify="flex-end"`
@@ -32,7 +32,7 @@ Will wrap on small screens.
-### Vertical FlexItem
+### Vertical Flex.Item
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/flex/container/info.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/container/info.mdx
new file mode 100644
index 00000000000..96a8b492232
--- /dev/null
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/container/info.mdx
@@ -0,0 +1,51 @@
+---
+showTabs: true
+---
+
+## Description
+
+`Flex.Container` is a building block for [CSS flexbox](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flexible_box_layout) based layout of contents and components.
+
+Ideally, use [Flex.Item](/uilib/components/flex/item) or [Card](/uilib/components/card) for you inner wrappers.
+
+```jsx
+import { Flex } from '@dnb/eufemia'
+
+render(
+
+ content
+ ,
+)
+```
+
+## How spacing is applied
+
+Nested components should preferably support [spacing properties](/uilib/components/space/).
+
+When a element or component was given, that does not support spacing, it will still work out of the box as it gets wrapped in a spacing block.
+
+You may else wrap your custom component in a `Flex.Item` – this way, you still can change the spacing per component basis.
+
+Technically, `Flex.Container` checks if a nested component has a property called `_supportsEufemiaSpacingProps`. So if you have a component that supports the [spacing properties](/uilib/components/space/), you can add this property `ComponentName._supportsEufemiaSpacingProps = true`.
+
+### Horizontal and Vertical aliases
+
+For shortening the usage of `direction="..."`, you can use:
+
+- `` instead of ``
+
+```jsx
+
+ part of vertical alignment
+ part of vertical alignment
+
+```
+
+- `` instead of ``
+
+```jsx
+
+ part of horizontal alignment
+ part of horizontal alignment
+
+```
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexContainer/properties.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/container/properties.mdx
similarity index 96%
rename from packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexContainer/properties.mdx
rename to packages/dnb-design-system-portal/src/docs/uilib/components/flex/container/properties.mdx
index 47ad414f1fa..cf170f7dab2 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexContainer/properties.mdx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/container/properties.mdx
@@ -12,7 +12,7 @@ showTabs: true
| `justify` | `string` | _(optional)_ How to place sub components if there is space available in the container. Can be: `flex-start`, `flex-end`, `center`, `space-between`, `space-around` or `space-evenly`. |
| `align` | `string` | _(optional)_ How to align sub components. Can be: `flex-start`, `flex-end`, `center`, `stretch` or `baseline`. |
| `divider` | `string` | _(optional)_ How to separate sub components. Can be: `space` or `line`. |
-| `sizeCount` | `number` | _(optional)_ Define how many parts your layout should be divided in. Should be used in combination with a [Layout.FlexItem](/uilib/components/layout/FlexItem). Defaults to `12`. |
+| `sizeCount` | `number` | _(optional)_ Define how many parts your layout should be divided in. Should be used in combination with a [Flex.Item](/uilib/components/flex/item). Defaults to `12`. |
| `rowGap` | `string` or `false` | _(optional)_ Defines how much the gap between rows should be. Can be `large`, `medium`, `small` or `false` for no gap. |
| `spacing` | `string` or `false` | _(optional)_ How much space between sub components. Can be `medium`, `small` or `false` for no spacing. |
| `element` | `string` or `React.Element` | _(optional)_ Define the type of element. Defaults to `div`. |
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/flex/demos.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/demos.mdx
new file mode 100644
index 00000000000..54601c350c7
--- /dev/null
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/demos.mdx
@@ -0,0 +1,27 @@
+---
+showTabs: true
+---
+
+import * as Examples from './Examples'
+
+## Demos
+
+### Used in forms
+
+
+
+### Responsive forms
+
+
+
+### Responsive Flex.Item
+
+With the default `sizeCount` of 12 parts.
+
+
+
+### Customized Flex.Item sizes
+
+With a custom amount of 4 parts (`sizeCount`) as well as custom breakpoints and media queries.
+
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/flex/info.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/info.mdx
new file mode 100644
index 00000000000..f0bcfb17e43
--- /dev/null
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/info.mdx
@@ -0,0 +1,18 @@
+---
+showTabs: true
+---
+
+## Description
+
+To make it easier to build application layout and [form](/uilib/extensions/forms)-views in line with defined design sketches, there are a number of components for layout.
+
+- **[Flex.Container](/uilib/components/flex/container)** is a building block for CSS flexbox based layout of contents and components.
+
+ - **`Flex.Vertical`** can be used as an alias instead of the property `direction="vertical"`.
+ - **`Flex.Horizontal`** can be used as an alias instead of the property `direction="horizontal"`.
+
+- **[Flex.Item](/uilib/components/flex/item)** is a building block for CSS flexbox based layout of contents and components.
+
+- **[Flex.Stack](/uilib/components/flex/stack)** is an outer block element for wrapping content to get the correct layout and spacing between region and region headings.
+
+You find more related information in the [Layout](/uilib/components/layout) pages.
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/flex/item.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/item.mdx
new file mode 100644
index 00000000000..d378ad15017
--- /dev/null
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/item.mdx
@@ -0,0 +1,19 @@
+---
+title: 'Flex.Item'
+description: '`Flex.Item` is a building block for flexbox based layout of contents and components.'
+hideInMenu: true
+showTabs: true
+tabs:
+ - title: Info
+ key: '/info'
+ - title: Demos
+ key: '/demos'
+ - title: Properties
+ key: '/properties'
+---
+
+import Info from 'Docs/uilib/components/flex/item/info'
+import Demos from 'Docs/uilib/components/flex/item/demos'
+
+
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexItem/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/item/Examples.tsx
similarity index 59%
rename from packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexItem/Examples.tsx
rename to packages/dnb-design-system-portal/src/docs/uilib/components/flex/item/Examples.tsx
index 592d2635539..a62fbe144da 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexItem/Examples.tsx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/item/Examples.tsx
@@ -1,24 +1,24 @@
import React from 'react'
import ComponentBox from '../../../../../shared/tags/ComponentBox'
-import { Layout } from '@dnb/eufemia/src'
+import { Flex } from '@dnb/eufemia/src'
import { TestElement } from '@dnb/eufemia/src/extensions/forms'
import {
HorizontalFlexItemResponsiveSize,
HorizontalFlexItemResponsiveSizeCustomColumns,
HorizontalAutoSize,
-} from '../Examples'
+} from '../../layout/Examples'
export const Default = () => {
return (
-
-
+
+ FlexItem
-
-
+
+ FlexItem
-
-
+
+
)
}
@@ -26,10 +26,10 @@ export const Default = () => {
export const BasicSize = () => {
return (
-
- uses 50% in width
- uses 50% in width
-
+
+ uses 50% in width
+ uses 50% in width
+
)
}
@@ -37,14 +37,14 @@ export const BasicSize = () => {
export const ResponsiveSize = () => {
return (
-
-
+
+
uses 50% or 100% based on the screen size
-
-
+
+
uses 50% or 100% based on the screen size
-
-
+
+
)
}
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexItem/demos.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/item/demos.mdx
similarity index 100%
rename from packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexItem/demos.mdx
rename to packages/dnb-design-system-portal/src/docs/uilib/components/flex/item/demos.mdx
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexItem/info.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/item/info.mdx
similarity index 61%
rename from packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexItem/info.mdx
rename to packages/dnb-design-system-portal/src/docs/uilib/components/flex/item/info.mdx
index 2087d1a0945..be83be67294 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexItem/info.mdx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/item/info.mdx
@@ -6,11 +6,21 @@ import * as Examples from './Examples'
## Description
-`Layout.FlexItem` is a building block for [CSS flexbox](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flexible_box_layout) based layout of contents and components. Should be used in combination with [FlexContainer](/uilib/components/layout/FlexContainer/).
+`Flex.Item` is a building block for [CSS flexbox](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flexible_box_layout) based layout of contents and components. Should be used in combination with [Flex.Container](/uilib/components/flex/container/).
+
+```jsx
+import { Flex } from '@dnb/eufemia'
+
+render(
+
+ content
+ ,
+)
+```
### Size adjustment
-You can provide a `size` prop with a number from 1 to 12 (can be changed in [FlexContainer](/uilib/components/layout/FlexContainer/) with the `sizeCount` property).
+You can provide a `size` prop with a number from 1 to 12 (can be changed in [Flex.Container](/uilib/components/flex/container/) with the `sizeCount` property).
The number will be used to set the item size (a part of the container). It set a percentage unit and apply it on the item via CSS. When the container is tilled to 100%, the remaining items will wrap to a new row.
@@ -26,4 +36,4 @@ For doing so, provide a `size` prop with an object containing [Media Query](/uil
-You need to ensure that `flex-wrap: wrap` is set, so the remaining items wrap to a new row when needed. This is enabled by default in the [FlexContainer](/uilib/components/layout/FlexContainer/).
+You need to ensure that `flex-wrap: wrap` is set, so the remaining items wrap to a new row when needed. This is enabled by default in the [Flex.Container](/uilib/components/flex/container/).
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexItem/properties.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/item/properties.mdx
similarity index 93%
rename from packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexItem/properties.mdx
rename to packages/dnb-design-system-portal/src/docs/uilib/components/flex/item/properties.mdx
index 126a2c035ae..58558c98d1e 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexItem/properties.mdx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/item/properties.mdx
@@ -4,11 +4,11 @@ showTabs: true
## Properties
-| Property | Type | Description |
-| ----------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `className` | `string` | _(optional)_ Outer DOM element class name |
-| `grow` | `boolean` | _(optional)_ True to expand in width/height when there is more space available. |
-| `shrink` | `boolean` | _(optional)_ True to shrink in width/height when there is not enough space available for all components within the container. |
-| `size` | `object` or `number` | _(optional)_ To set the size (parts) in "percentage" with numbers from 1 to 12 (`sizeCount`). You can also provide [Media Query](/uilib/usage/layout/media-queries/) types in an object. You can also use the value `auto` to disable it on a specific screen size. Wrap your FlexItem's inside a [Layout.FlexContainer](/uilib/components/layout/FlexContainer). |
-| `element` | `string` or `React.Element` | _(optional)_ Define the type of element. Defaults to `div`. |
-| `children` | `React.Node` | _(optional)_ Contents. |
+| Property | Type | Description |
+| ----------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `className` | `string` | _(optional)_ Outer DOM element class name |
+| `grow` | `boolean` | _(optional)_ True to expand in width/height when there is more space available. |
+| `shrink` | `boolean` | _(optional)_ True to shrink in width/height when there is not enough space available for all components within the container. |
+| `size` | `object` or `number` | _(optional)_ To set the size (parts) in "percentage" with numbers from 1 to 12 (`sizeCount`). You can also provide [Media Query](/uilib/usage/layout/media-queries/) types in an object. You can also use the value `auto` to disable it on a specific screen size. Wrap your Flex.Item's inside a [Flex.Container](/uilib/components/flex/container). |
+| `element` | `string` or `React.Element` | _(optional)_ Define the type of element. Defaults to `div`. |
+| `children` | `React.Node` | _(optional)_ Contents. |
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/flex/stack.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/stack.mdx
new file mode 100644
index 00000000000..2e7afde1e7b
--- /dev/null
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/stack.mdx
@@ -0,0 +1,19 @@
+---
+title: 'Flex.Stack'
+description: '`Flex.Stack` is an outer block element for wrapping content to get the correct layout and spacing between region and region headings.'
+hideInMenu: true
+showTabs: true
+tabs:
+ - title: Info
+ key: '/info'
+ - title: Demos
+ key: '/demos'
+ - title: Properties
+ key: '/properties'
+---
+
+import Info from 'Docs/uilib/components/flex/stack/info'
+import Demos from 'Docs/uilib/components/flex/stack/demos'
+
+
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/Stack/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/stack/Examples.tsx
similarity index 89%
rename from packages/dnb-design-system-portal/src/docs/uilib/components/layout/Stack/Examples.tsx
rename to packages/dnb-design-system-portal/src/docs/uilib/components/flex/stack/Examples.tsx
index d557f14bdc6..9591e5dd8b0 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/Stack/Examples.tsx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/stack/Examples.tsx
@@ -1,17 +1,17 @@
import { Form } from '@dnb/eufemia/src/extensions/forms'
import ComponentBox from '../../../../../shared/tags/ComponentBox'
-import { Card, Layout, P } from '@dnb/eufemia/src'
+import { Card, Flex, P } from '@dnb/eufemia/src'
export const Default = () => {
return (
-
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
cursus pharetra elit in bibendum. Vivamus tincidunt eleifend
tellus at tempus.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
cursus pharetra elit in bibendum. Vivamus tincidunt eleifend
@@ -32,7 +32,7 @@ export const WithParagraphs = () => {
finibus, lacus leo lobortis lorem, maximus posuere mi justo et
ipsum.
-
+
)
}
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/Stack/demos.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/stack/demos.mdx
similarity index 100%
rename from packages/dnb-design-system-portal/src/docs/uilib/components/layout/Stack/demos.mdx
rename to packages/dnb-design-system-portal/src/docs/uilib/components/flex/stack/demos.mdx
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/Stack/info.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/stack/info.mdx
similarity index 54%
rename from packages/dnb-design-system-portal/src/docs/uilib/components/layout/Stack/info.mdx
rename to packages/dnb-design-system-portal/src/docs/uilib/components/flex/stack/info.mdx
index 305822d30ba..225625b0a89 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/Stack/info.mdx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/stack/info.mdx
@@ -6,9 +6,9 @@ import * as Examples from './Examples'
## Description
-`Layout.Stack` is an outer block element for wrapping content to get the correct layout and spacing between region and region headings.
+`Flex.Stack` is an outer block element for wrapping content to get the correct layout and spacing between region and region headings.
-It uses [Layout.FlexContainer](/uilib/components/layout/FlexContainer) under the hood.
+It uses [Flex.Container](/uilib/components/flex/container) under the hood.
## Accessibility
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/flex/stack/properties.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/stack/properties.mdx
new file mode 100644
index 00000000000..dde8504e79d
--- /dev/null
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/flex/stack/properties.mdx
@@ -0,0 +1,13 @@
+---
+showTabs: true
+---
+
+## Properties
+
+| Property | Type | Description |
+| -------------------------------------------------- | --------------------------- | --------------------------------------------------------------------- |
+| `direction` | `string` | _(optional)_ Defaults to `vertical`. |
+| `align` | `string` | _(optional)_ Defaults to `stretch`. |
+| `element` | `string` or `React.Element` | _(optional)_ Define the type of element. Defaults to `section`. |
+| [Flex.Container](/uilib/components/flex/container) | Various | _(optional)_ Flex.Container properties. |
+| [Space](/uilib/components/space/properties) | Various | _(optional)_ Spacing properties like `top` or `bottom` are supported. |
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/components/layout/Examples.tsx
index a08835f057c..c7590237d0e 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/Examples.tsx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/layout/Examples.tsx
@@ -2,7 +2,7 @@ import React from 'react'
import styled from '@emotion/styled'
import ComponentBox from '../../../../shared/tags/ComponentBox'
import MediaQuery from '@dnb/eufemia/src/shared/MediaQuery'
-import { Layout, Slider, Code, Button, Card } from '@dnb/eufemia/src'
+import { Layout, Slider, Code, Button, Card, Flex } from '@dnb/eufemia/src'
import {
TestElement,
Field,
@@ -21,7 +21,7 @@ export const LayoutComponents = () => {
Form,
}}
>
-
+ Profile
@@ -38,7 +38,7 @@ export const LayoutComponents = () => {
-
+
)
}
@@ -54,26 +54,26 @@ export const HorizontalFlexItemResponsiveSize = () => {
return (
-
-
+
+ FlexItem (8)
-
-
+
+ FlexItem (4)
-
-
+
+
FlexItem (small: 8, medium: 4)
-
-
+
+
FlexItem (small: 4, medium: 8)
-
-
+
+
)
}
@@ -88,7 +88,7 @@ export const HorizontalFlexItemResponsiveSizeCustomColumns = () => {
defaultBreakpoints,
defaultQueries,
}}
- data-visual-test="layout-flex-item-custom-size"
+ data-visual-test="flex-item-custom-size"
>
{() => {
const breakpoints = {
@@ -105,37 +105,37 @@ export const HorizontalFlexItemResponsiveSizeCustomColumns = () => {
const CustomMediaQuery = styled.div`
display: flex;
flex-direction: column;
- .dnb-layout-flex-container[data-media-key='xsmall']
- .dnb-layout-flex-item--responsive {
+ .dnb-flex-container[data-media-key='xsmall']
+ .dnb-flex-item--responsive {
--size: var(--xsmall);
}
`
return (
-
-
+ FlexItem
-
-
+
+ FlexItem
-
-
+ FlexItem
-
-
+ FlexItem
-
-
+
+
)
}}
@@ -153,24 +153,24 @@ export const HorizontalAutoSize = () => {
hideCode
>
-
-
+
+
-
-
+
+
-
-
+
+ {
alwaysShowTooltip
/>
-
-
+
+
)
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexContainer.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexContainer.mdx
deleted file mode 100644
index 84b9873a06a..00000000000
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexContainer.mdx
+++ /dev/null
@@ -1,24 +0,0 @@
----
-title: 'FlexContainer'
-description: '`Layout.FlexContainer` is a building block for CSS Grid based layouts.'
-hideInMenu: true
-showTabs: true
-tabs:
- - title: Info
- key: '/info'
- - title: Demos
- key: '/demos'
- - title: Properties
- key: '/properties'
-breadcrumb:
- - text: Layout
- href: /uilib/components/layout/
- - text: FlexContainer
- href: /uilib/components/layout/FlexContainer/
----
-
-import Info from 'Docs/uilib/components/layout/FlexContainer/info'
-import Demos from 'Docs/uilib/components/layout/FlexContainer/demos'
-
-
-
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexContainer/info.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexContainer/info.mdx
deleted file mode 100644
index 5d8a87854dd..00000000000
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexContainer/info.mdx
+++ /dev/null
@@ -1,41 +0,0 @@
----
-showTabs: true
----
-
-## Description
-
-`Layout.FlexContainer` is a building block for [CSS flexbox](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flexible_box_layout) based layout of contents and components.
-
-Ideally, use [Layout.FlexItem](/uilib/components/layout/FlexItem) or [Card](/uilib/components/card) for you inner wrappers.
-
-## How spacing is applied
-
-Nested components should preferably support [spacing properties](/uilib/components/space/).
-
-When a element or component was given, that does not support spacing, it will still work out of the box as it gets wrapped in a spacing block.
-
-You may else wrap your custom component in a `FlexItem` – this way, you still can change the spacing per component basis.
-
-Technically, `FlexContainer` checks if a nested component has a property called `_supportsEufemiaSpacingProps`. So if you have a component that supports the [spacing properties](/uilib/components/space/), you can add this property `ComponentName._supportsEufemiaSpacingProps = true`.
-
-### Horizontal and Vertical aliases
-
-For shortening the usage of `direction="..."`, you can use:
-
-- `` instead of ``
-
-```jsx
-
- part of vertical alignment
- part of vertical alignment
-
-```
-
-- `` instead of ``
-
-```jsx
-
- part of horizontal alignment
- part of horizontal alignment
-
-```
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexItem.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexItem.mdx
deleted file mode 100644
index 5f02ea35c79..00000000000
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/FlexItem.mdx
+++ /dev/null
@@ -1,24 +0,0 @@
----
-title: 'FlexItem'
-description: '`Layout.FlexItem` is a building block for flexbox based layout of contents and components.'
-hideInMenu: true
-showTabs: true
-tabs:
- - title: Info
- key: '/info'
- - title: Demos
- key: '/demos'
- - title: Properties
- key: '/properties'
-breadcrumb:
- - text: Layout
- href: /uilib/components/layout/
- - text: FlexItem
- href: /uilib/components/layout/FlexItem/
----
-
-import Info from 'Docs/uilib/components/layout/FlexItem/info'
-import Demos from 'Docs/uilib/components/layout/FlexItem/demos'
-
-
-
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/Stack.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/layout/Stack.mdx
deleted file mode 100644
index 53a2d411616..00000000000
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/Stack.mdx
+++ /dev/null
@@ -1,24 +0,0 @@
----
-title: 'Stack'
-description: '`Layout.Stack` is an outer block element for wrapping content to get the correct layout and spacing between region and region headings.'
-hideInMenu: true
-showTabs: true
-tabs:
- - title: Info
- key: '/info'
- - title: Demos
- key: '/demos'
- - title: Properties
- key: '/properties'
-breadcrumb:
- - text: Layout
- href: /uilib/components/layout/
- - text: Stack
- href: /uilib/components/layout/Stack/
----
-
-import Info from 'Docs/uilib/components/layout/Stack/info'
-import Demos from 'Docs/uilib/components/layout/Stack/demos'
-
-
-
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/Stack/properties.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/layout/Stack/properties.mdx
deleted file mode 100644
index 594980f1832..00000000000
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/Stack/properties.mdx
+++ /dev/null
@@ -1,13 +0,0 @@
----
-showTabs: true
----
-
-## Properties
-
-| Property | Type | Description |
-| -------------------------------------------------------------- | --------------------------- | --------------------------------------------------------------------- |
-| `direction` | `string` | _(optional)_ Defaults to `vertical`. |
-| `align` | `string` | _(optional)_ Defaults to `stretch`. |
-| `element` | `string` or `React.Element` | _(optional)_ Define the type of element. Defaults to `section`. |
-| [Layout.FlexContainer](/uilib/components/layout/FlexContainer) | Various | _(optional)_ FlexContainer properties. |
-| [Space](/uilib/components/space/properties) | Various | _(optional)_ Spacing properties like `top` or `bottom` are supported. |
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/demos.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/layout/demos.mdx
index fd2f02f281e..e7502f08612 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/demos.mdx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/layout/demos.mdx
@@ -18,13 +18,13 @@ import * as Examples from './Examples'
-### Responsive FlexItem
+### Responsive Flex.Item
With the default `sizeCount` of 12 parts.
-### Customized FlexItem sizes
+### Customized Flex.Item sizes
With a custom amount of 4 parts (`sizeCount`) as well as custom breakpoints and media queries.
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/info.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/layout/info.mdx
index 4e99e72e93b..8bfe8710d09 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/components/layout/info.mdx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/components/layout/info.mdx
@@ -10,16 +10,16 @@ To make it easier to build application layout and [form](/uilib/extensions/forms
- **[Card](/uilib/components/card)** is a block section element showing the white box with rounded gray borders, adding spacing automatically.
-- **[Stack](/uilib/components/layout/Stack)** is an outer block element for wrapping content to get the correct layout and spacing between region and region headings.
+- **[Stack](/uilib/components/flex/stack)** is an outer block element for wrapping content to get the correct layout and spacing between region and region headings.
### Flex layout
-- **[FlexContainer](/uilib/components/layout/FlexContainer)** is a building block for CSS flexbox based layout of contents and components.
+- **[Flex.Container](/uilib/components/flex/container)** is a building block for CSS flexbox based layout of contents and components.
- - **``** can be used as an alias instead of the property `direction="vertical"`.
- - **``** can be used as an alias instead of the property `direction="horizontal"`.
+ - **``** can be used as an alias instead of the property `direction="vertical"`.
+ - **``** can be used as an alias instead of the property `direction="horizontal"`.
-- **[FlexItem](/uilib/components/layout/FlexItem)** is a building block for CSS flexbox based layout of contents and components.
+- **[Flex.Item](/uilib/components/flex/item)** is a building block for CSS flexbox based layout of contents and components.
### Grid layout
@@ -48,12 +48,12 @@ Uses CSS `flexbox`.
- When a size (percentage) is given, they stack horizontally.
```jsx
-import { Layout } from '@dnb/eufemia'
+import { Flex } from '@dnb/eufemia'
render(
-
- content
+
+ contentcontent
- ,
+ ,
)
```
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms.mdx b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms.mdx
index 4f2508a4b43..822898ea836 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms.mdx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms.mdx
@@ -40,7 +40,7 @@ The goal of the Forms extension is to make it easy to build forms and other data
When building your application forms, preferably use the following layout components. They seamlessly places all the fields and components of Eufemia Forms correctly into place.
-- [Layout](/uilib/components/layout) for easy and consistent application forms.
+- [Flex](/uilib/components/flex) layout component for easy and consistent application forms.
- [Card](/uilib/components/card) for the default card outline of forms.
### Additional features
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Examples.tsx
index de27931fcd6..98aac31b8c5 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Examples.tsx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Examples.tsx
@@ -1,6 +1,6 @@
import React from 'react'
import ComponentBox from '../../../../shared/tags/ComponentBox'
-import { Layout, Input, Slider, Card } from '@dnb/eufemia/src'
+import { Input, Slider, Card, Flex } from '@dnb/eufemia/src'
import {
Form,
StepsLayout,
@@ -98,7 +98,7 @@ export const CreateComposedFieldComponent = () => {
return (
-
+ {
tooltip
/>
-
+
)
}
@@ -214,7 +214,7 @@ export const LayoutComponents = () => {
Visibility,
}}
>
-
+ Profile
@@ -231,7 +231,7 @@ export const LayoutComponents = () => {
-
+
)
}
@@ -262,7 +262,7 @@ export const VisibilityBasedOnData = () => {
}
onSubmit={(data) => console.log('onSubmit', data)}
>
-
+ Profile
@@ -271,14 +271,14 @@ export const VisibilityBasedOnData = () => {
-
+
-
+ More information
@@ -286,7 +286,7 @@ export const VisibilityBasedOnData = () => {
-
+
@@ -438,10 +438,10 @@ export const WithSteps = () => {
Profile
-
+
-
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/DataContext/Provider/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/DataContext/Provider/Examples.tsx
index 3f39ce06919..6a4c5386ba6 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/DataContext/Provider/Examples.tsx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/DataContext/Provider/Examples.tsx
@@ -6,7 +6,7 @@ import {
Field,
Value,
} from '@dnb/eufemia/src/extensions/forms'
-import { Card, Layout } from '@dnb/eufemia/src'
+import { Card, Flex } from '@dnb/eufemia/src'
export const TestdataSchema: JSONSchema7 = {
type: 'object',
@@ -97,9 +97,9 @@ export const Default = () => {
onSubmitRequest={() => console.log('onSubmitRequest')}
sessionStorageId="provider-example-1"
>
-
+
-
+ {
/>
-
+
-
+
)
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/FieldBlock.mdx b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/FieldBlock.mdx
index a081a746aa1..72d8ba2277f 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/FieldBlock.mdx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/FieldBlock.mdx
@@ -1,6 +1,6 @@
---
title: 'FieldBlock'
-description: '`FieldBlock` is a reusable wrapper for building Field-components. It shows surrounding elements through properties from `FieldProps` like `label` and `error`, and ensure that spacing between different fields work as required when put into surrounding components like `FlexContainer` or `Card`. It can also be used to group multiple inner FieldBlock component, composing error messages together as one component.'
+description: '`FieldBlock` is a reusable wrapper for building Field-components. It shows surrounding elements through properties from `FieldProps` like `label` and `error`, and ensure that spacing between different fields work as required when put into surrounding components like `Flex.Container` or `Card`. It can also be used to group multiple inner FieldBlock component, composing error messages together as one component.'
componentType: 'basis-api'
hideInMenu: true
showTabs: true
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/FieldBlock/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/FieldBlock/Examples.tsx
index ed845afb631..a12c3ebded6 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/FieldBlock/Examples.tsx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/FieldBlock/Examples.tsx
@@ -4,7 +4,7 @@ import {
Field,
TestElement,
} from '@dnb/eufemia/src/extensions/forms'
-import { Layout } from '@dnb/eufemia/src'
+import { Flex } from '@dnb/eufemia/src'
export const Default = () => {
return (
@@ -136,10 +136,10 @@ export const GroupMultipleFields = () => {
return (
-
+
-
+
)
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/FieldBlock/info.mdx b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/FieldBlock/info.mdx
index 0a8f4aa4304..9127a1ce987 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/FieldBlock/info.mdx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/create-component/FieldBlock/info.mdx
@@ -8,7 +8,7 @@ import Demos from 'Docs/uilib/extensions/forms/create-component/FieldBlock/demos
`FieldBlock` is a reusable wrapper for building [Field](/uilib/extensions/forms/create-component/Field) or [Value](/uilib/extensions/forms/create-component/Value) components.
-It shows surrounding elements through properties from `FieldProps` like `label` and `error`, and ensure that spacing between different fields work as required when put into surrounding components like [FlexContainer](/uilib//components/layout/FlexContainer/) or [Card](/uilib/components/card/).
+It shows surrounding elements through properties from `FieldProps` like `label` and `error`, and ensure that spacing between different fields work as required when put into surrounding components like [Flex.Container](/uilib/components/flex/container/) or [Card](/uilib/components/card/).
It can also be used to group multiple inner FieldBlock components, composing status (error) messages together as one component.
@@ -18,10 +18,10 @@ import { FieldBlock } from '@dnb/eufemia/extensions/forms'
const YourFieldComponent = () => {
return (
-
+ ......
-
+
)
}
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/demo-cases/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/demo-cases/Examples.tsx
index 56166d34b82..de9b8dbf01e 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/demo-cases/Examples.tsx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/demo-cases/Examples.tsx
@@ -1,11 +1,5 @@
import ComponentBox from '../../../../../shared/tags/ComponentBox'
-import {
- GlobalStatus,
- Section,
- Code,
- Layout,
- Card,
-} from '@dnb/eufemia/src'
+import { GlobalStatus, Section, Code, Card, Flex } from '@dnb/eufemia/src'
import * as React from 'react'
import {
Form,
@@ -160,10 +154,10 @@ export const BecomeCorporateCustomer = () => {
Profile
-
+
-
+
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Form/MainHeading/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Form/MainHeading/Examples.tsx
index d0b5094d169..e92da6b588f 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Form/MainHeading/Examples.tsx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Form/MainHeading/Examples.tsx
@@ -1,5 +1,5 @@
import ComponentBox from '../../../../../../../shared/tags/ComponentBox'
-import { Card, Layout, P } from '@dnb/eufemia/src'
+import { Card, Flex, P } from '@dnb/eufemia/src'
import { Form } from '@dnb/eufemia/src/extensions/forms'
export const Default = () => {
@@ -17,9 +17,9 @@ export const OverStack = () => {
data-visual-test="layout-main-heading-over-stack"
>
This is a main heading
-
+
Stack contents
-
+
)
}
@@ -31,11 +31,11 @@ export const OverStackWithCard = () => {
data-visual-test="layout-main-heading-over-card"
>
This is a main heading
-
+
Card contents
-
+
)
}
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Form/SubHeading/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Form/SubHeading/Examples.tsx
index b51fb64e93e..d85ee552e70 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Form/SubHeading/Examples.tsx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Form/SubHeading/Examples.tsx
@@ -1,5 +1,5 @@
import ComponentBox from '../../../../../../../shared/tags/ComponentBox'
-import { Card, Layout, P } from '@dnb/eufemia/src'
+import { Card, Flex, P } from '@dnb/eufemia/src'
import { Form } from '@dnb/eufemia/src/extensions/forms'
export const TextOnly = () => {
@@ -26,9 +26,9 @@ export const OverStack = () => {
return (
This is a sub heading
-
+
Stack contents
-
+
)
}
@@ -40,10 +40,10 @@ export const InsideCard = () => {
data-visual-test="layout-sub-heading-inside-card"
>
-
+ This is a sub heading
Card contents
-
+
)
@@ -56,11 +56,11 @@ export const OverStackWithCard = () => {
data-visual-test="layout-sub-heading-over-card"
>
This is a sub heading
-
+
Card contents
-
+
)
}
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Form/info.mdx b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Form/info.mdx
index 76fc78b729c..6b560084c81 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Form/info.mdx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Form/info.mdx
@@ -7,7 +7,7 @@ showTabs: true
`Form` provides the main forms-helpers including data provider and event handling.
```jsx
-import { Layout } from '@dnb/eufemia'
+import { Card } from '@dnb/eufemia'
import { Form, Field } from '@dnb/eufemia/extensions/forms'
render(
diff --git a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Iterate/Array/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Iterate/Array/Examples.tsx
index dbce7387b91..fe7523db4a2 100644
--- a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Iterate/Array/Examples.tsx
+++ b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/extended-features/Iterate/Array/Examples.tsx
@@ -1,5 +1,5 @@
import ComponentBox from '../../../../../../../shared/tags/ComponentBox'
-import { Layout } from '@dnb/eufemia/src'
+import { Flex, Layout } from '@dnb/eufemia/src'
import {
Iterate,
Field,
@@ -43,10 +43,10 @@ export const ObjectElements = () => {