-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Dialog): add
verticalAlignment
property with top
alignment s…
…upport (#4190) This is useful for when a Dialog contains changes to its content, where the `center` aligned Dialog will move its placement on the screen. A top aligned Dialog will keep its position. [Example](https://eufemia-git-feat-dialog-placement-eufemia.vercel.app/uilib/components/dialog/#top-aligned-dialog) --------- Co-authored-by: Anders <[email protected]>
- Loading branch information
1 parent
9b38904
commit 3ace8b0
Showing
19 changed files
with
190 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 6 additions & 23 deletions
29
packages/dnb-design-system-portal/src/docs/uilib/components/dialog/prop-table.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,6 @@ | ||
| Properties | Description | | ||
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `variant` | _(optional)_ The dialog variant. Can either be `information` or `confirmation`. Defaults to `information`. | | ||
| `title` | _(optional)_ The dialog title. Displays on the very top of the content. | | ||
| `minWidth` | _(optional)_ The minimum Dialog content width, defined by a CSS width value like `50vw` (50% of the viewport). Be careful on using fixed `minWidth` so you don't break responsiveness. Defaults to `30rem` (average width is set to `60vw`). | | ||
| `maxWidth` | _(optional)_ The maximum Dialog content width, defined by a CSS width value like `20rem`. Defaults to `60rem` (average width is set to `60vw`). | | ||
| `className` | _(optional)_ Give the Dialog content a class name (maps to `dnb-dialog`). | | ||
| `spacing` | _(optional)_ If set to `false` then the dialog content will be shown without any spacing. Defaults to `true`. | | ||
| `preventCoreStyle` | _(optional)_ By default the dialog content gets added the core style class `dnb-core-style`. Use `false` to disable this behavior. | | ||
| `navContent` | _(optional)_ The content which will appear in the navigation, above the header, and side-by-side the close button. | | ||
| `headerContent` | _(optional)_ The content which will appear in the header of the dialog. | | ||
| `modalContent` | _(optional)_ The content which will appear when triggering the dialog. | | ||
| `description` | _(optional)_ A description will be positioned below the title, but before the content. Used for Dialog variant `confirmation` to further describe what the actions will do. | | ||
| `alignContent` | _(optional)_ Define the inner horizontal alignment of the content. Can be set to `left`, `center`, `right` and `centered`. If `centered`, then the content will also be centered vertically. Defaults to `left`. | | ||
| `fullscreen` | _(optional)_ If set to `true` then the dialog content will be shown as fullscreen, without showing the original content behind. Can be set to `false` to omit the auto fullscreen. Defaults to `auto`. | | ||
| `icon` | _(optional)_ An icon to display at the top of the component. Should be of size medium, so make sure you import the `_medium` version of the Eufemia icon. | | ||
| `confirmType` | _(optional)_ For variant confirmation, the dialog is either an informational (`info`) or a warning (`warning`) message. Defaults to 'info'. | | ||
| `declineText` | _(optional)_ For dialog actions, give a custom text for the decline button. | | ||
| `confirmText` | _(optional)_ For dialog actions, give a custom text for the confirmation button. | | ||
| `hideDecline` | _(optional)_ For variant confirmation, hide the default decline button and only show the confirmation button. | | ||
| `hideConfirm` | _(optional)_ For variant confirmation, hide the default confirm button and only show the decline button. | | ||
| `scrollRef` | _(optional)_ To get the scroll Element, pass in your own React ref. | | ||
| `contentRef` | _(optional)_ To get the inner content Element, pass in your own React ref. | | ||
import PropertiesTable from 'dnb-design-system-portal/src/shared/parts/PropertiesTable' | ||
import { DialogProperties } from '@dnb/eufemia/src/components/dialog/DialogDocs' | ||
|
||
## Properties | ||
|
||
<PropertiesTable props={DialogProperties} /> |
3 changes: 0 additions & 3 deletions
3
packages/dnb-design-system-portal/src/docs/uilib/components/drawer/prop-table.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
...design-system-portal/src/docs/uilib/components/modal/event-table-camel-case.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
packages/dnb-design-system-portal/src/docs/uilib/components/modal/event-table.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
packages/dnb-eufemia/src/components/dialog/DialogDocs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import { PropertiesTableProps } from '../../shared/types' | ||
|
||
export const DialogProperties: PropertiesTableProps = { | ||
variant: { | ||
doc: 'The dialog variant. Can either be `information` or `confirmation`. Defaults to `information`.', | ||
type: 'string', | ||
status: 'optional', | ||
}, | ||
title: { | ||
doc: 'The dialog title. Displays on the very top of the content.', | ||
type: 'string', | ||
status: 'optional', | ||
}, | ||
minWidth: { | ||
doc: "The minimum Dialog content width, defined by a CSS width value like `50vw` (50% of the viewport). Be careful on using fixed `minWidth` so you don't break responsiveness. Defaults to `30rem` (average width is set to `60vw`).", | ||
type: 'string', | ||
status: 'optional', | ||
}, | ||
maxWidth: { | ||
doc: 'The maximum Dialog content width, defined by a CSS width value like `20rem`. Defaults to `60rem` (average width is set to `60vw`).', | ||
type: 'string', | ||
status: 'optional', | ||
}, | ||
className: { | ||
doc: 'Give the Dialog content a class name (maps to `dnb-dialog`).', | ||
type: 'string', | ||
status: 'optional', | ||
}, | ||
spacing: { | ||
doc: 'If set to `false` then the dialog content will be shown without any spacing. Defaults to `true`.', | ||
type: 'boolean', | ||
status: 'optional', | ||
}, | ||
preventCoreStyle: { | ||
doc: 'By default the dialog content gets added the core style class `dnb-core-style`. Use `false` to disable this behavior.', | ||
type: 'boolean', | ||
status: 'optional', | ||
}, | ||
navContent: { | ||
doc: 'The content which will appear in the navigation, above the header, and side-by-side the close button.', | ||
type: 'React.Node', | ||
status: 'optional', | ||
}, | ||
headerContent: { | ||
doc: 'The content which will appear in the header of the dialog.', | ||
type: 'React.Node', | ||
status: 'optional', | ||
}, | ||
modalContent: { | ||
doc: 'The content which will appear when triggering the dialog.', | ||
type: 'React.Node', | ||
status: 'optional', | ||
}, | ||
description: { | ||
doc: 'A description will be positioned below the title, but before the content. Used for Dialog variant `confirmation` to further describe what the actions will do.', | ||
type: 'string', | ||
status: 'optional', | ||
}, | ||
verticalAlignment: { | ||
doc: 'Define the vertical alignment of the container. Can be set to `top` or `center`. Defaults to `center`.', | ||
type: 'string', | ||
status: 'optional', | ||
}, | ||
alignContent: { | ||
doc: 'Define the inner horizontal alignment of the content. Can be set to `left`, `center`, `right` and `centered`. If `centered`, then the content will also be centered vertically. Defaults to `left`.', | ||
type: 'string', | ||
status: 'optional', | ||
}, | ||
fullscreen: { | ||
doc: 'If set to `true` then the dialog content will be shown as fullscreen, without showing the original content behind. Can be set to `false` to omit the auto fullscreen. Defaults to `auto`.', | ||
type: 'boolean', | ||
status: 'optional', | ||
}, | ||
icon: { | ||
doc: 'An icon to display at the top of the component. Should be of size medium, so make sure you import the `_medium` version of the Eufemia icon.', | ||
type: 'React.Node', | ||
status: 'optional', | ||
}, | ||
confirmType: { | ||
doc: 'For variant confirmation, the dialog is either an informational (`info`) or a warning (`warning`) message. Defaults to `info`.', | ||
type: 'string', | ||
status: 'optional', | ||
}, | ||
declineText: { | ||
doc: 'For dialog actions, give a custom text for the decline button.', | ||
type: 'string', | ||
status: 'optional', | ||
}, | ||
confirmText: { | ||
doc: 'For dialog actions, give a custom text for the confirmation button.', | ||
type: 'string', | ||
status: 'optional', | ||
}, | ||
hideDecline: { | ||
doc: 'For variant confirmation, hide the default decline button and only show the confirmation button.', | ||
type: 'boolean', | ||
status: 'optional', | ||
}, | ||
hideConfirm: { | ||
doc: 'For variant confirmation, hide the default confirm button and only show the decline button.', | ||
type: 'boolean', | ||
status: 'optional', | ||
}, | ||
scrollRef: { | ||
doc: 'To get the scroll Element, pass in your own React ref.', | ||
type: 'React.Ref', | ||
status: 'optional', | ||
}, | ||
contentRef: { | ||
doc: 'To get the inner content Element, pass in your own React ref.', | ||
type: 'React.Ref', | ||
status: 'optional', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+35.8 KB
...mage_snapshots__/dialog-for-sbanken-have-to-match-a-top-aligned-dialog.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+33.2 KB
..._/__image_snapshots__/dialog-for-ui-have-to-match-a-top-aligned-dialog.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters