@altinn/altinn-components 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.2](https://github.com/Altinn/altinn-components/compare/v0.2.1...v0.2.2) (2024-11-06)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * dialog-props ([#28](https://github.com/Altinn/altinn-components/issues/28)) ([59b6a8f](https://github.com/Altinn/altinn-components/commit/59b6a8fb04abece013218402587f93863c1b9012))
9
+
3
10
  ## [0.2.1](https://github.com/Altinn/altinn-components/compare/v0.2.0...v0.2.1) (2024-11-06)
4
11
 
5
12
 
@@ -4,7 +4,7 @@ import { Icon } from '../Icon';
4
4
  import { Menu, type MenuGroups, type MenuItemProps } from '../Menu';
5
5
  import styles from './contextMenu.module.css';
6
6
 
7
- export interface DialogContextMenuProps {
7
+ export interface ContextMenuProps {
8
8
  onToggle?: MouseEventHandler;
9
9
  label: string;
10
10
  value: string | number;
@@ -14,7 +14,7 @@ export interface DialogContextMenuProps {
14
14
  className?: string;
15
15
  }
16
16
 
17
- export const ContextMenu = ({ expanded = true, onToggle, groups = {}, items }: DialogContextMenuProps) => {
17
+ export const ContextMenu = ({ expanded = true, onToggle, groups = {}, items }: ContextMenuProps) => {
18
18
  return (
19
19
  <div className={styles.toggle}>
20
20
  <ButtonBase className={styles.button} as="button" color="secondary" onClick={onToggle}>
@@ -10,7 +10,13 @@ const meta = {
10
10
  parameters: {},
11
11
  argTypes: { body: { control: 'text' } },
12
12
  args: {
13
+ menu: [
14
+ {
15
+ items: [{ label: 'Menu 1' }],
16
+ },
17
+ ],
13
18
  updatedAt: '1999-05-26',
19
+ updatedAtLabel: '26. mai 1999',
14
20
  title: 'Title',
15
21
  summary: 'Summary',
16
22
  },
@@ -9,6 +9,8 @@ import { DialogFooter } from './DialogFooter';
9
9
  import { DialogHeader } from './DialogHeader';
10
10
  import { DialogSeenBy, type DialogSeenByProps } from './DialogSeenBy';
11
11
 
12
+ import type { ContextMenuProps } from '../ContextMenu/';
13
+
12
14
  import type { ReactNode } from 'react';
13
15
  import { type DialogActionButtonProps, DialogActions } from './DialogActions.tsx';
14
16
  import type { DialogRecipientProps, DialogSenderProps } from './DialogHeadings.tsx';
@@ -21,14 +23,18 @@ export interface DialogProps {
21
23
  title: string;
22
24
  /** Back button */
23
25
  backButton?: DialogBackButtonProps;
26
+ /** Context menu */
27
+ menu?: ContextMenuProps;
24
28
  /** Dialog status */
25
29
  status?: DialogStatusProps;
26
30
  /** Updated date time */
27
31
  updatedAt?: string;
28
- /** Latest updated by name */
29
- updatedByName?: string;
32
+ /** Updated label */
33
+ updatedAtLabel?: string;
30
34
  /** Due date */
31
35
  dueAt?: string;
36
+ /** Due at label */
37
+ dueAtLabel?: string;
32
38
  /** Sender */
33
39
  sender?: DialogSenderProps;
34
40
  /** Recipient */
@@ -57,9 +63,11 @@ export interface DialogProps {
57
63
 
58
64
  export const Dialog = ({
59
65
  backButton,
66
+ menu,
60
67
  updatedAt,
61
- updatedByName,
68
+ updatedAtLabel,
62
69
  dueAt,
70
+ dueAtLabel,
63
71
  status,
64
72
  title,
65
73
  sender,
@@ -75,7 +83,7 @@ export const Dialog = ({
75
83
  }: DialogProps) => {
76
84
  return (
77
85
  <DialogBase>
78
- <DialogNav status={status} dueAt={dueAt} backButton={backButton} />
86
+ <DialogNav status={status} dueAt={dueAt} dueAtLabel={dueAtLabel} backButton={backButton} menu={menu} />
79
87
  <DialogArticleBase>
80
88
  <DialogHeader
81
89
  title={title}
@@ -85,7 +93,7 @@ export const Dialog = ({
85
93
  variant="neutral"
86
94
  />
87
95
  <DialogBodyBase>
88
- <DialogContent updatedAt={updatedAt} updatedByName={updatedByName} summary={summary} body={body} />
96
+ <DialogContent updatedAt={updatedAt} updatedAtLabel={updatedAtLabel} summary={summary} body={body} />
89
97
  {attachments && <DialogAttachments {...attachments} />}
90
98
  {actions?.length > 0 && <DialogActions items={actions} />}
91
99
  <MetaBase>
@@ -3,7 +3,6 @@ import { Typography } from '../Typography';
3
3
  import { DialogMetadata } from './DialogMetadata';
4
4
 
5
5
  export interface DialogContentProps {
6
- updatedByName?: string;
7
6
  updatedAt?: string;
8
7
  updatedAtLabel?: string;
9
8
  summary?: string;
@@ -2,7 +2,7 @@
2
2
  import { useState } from 'react';
3
3
  import type { ElementType } from 'react';
4
4
  import { Button } from '../Button';
5
- import { ContextMenu, type DialogContextMenuProps } from '../ContextMenu/ContextMenu.tsx';
5
+ import { ContextMenu, type ContextMenuProps } from '../ContextMenu/ContextMenu.tsx';
6
6
  import { MetaTimestamp } from '../Meta';
7
7
  import { DialogStatus, type DialogStatusProps } from './DialogStatus';
8
8
  import { DialogTouchedBy, type DialogTouchedByActor } from './DialogTouchedBy';
@@ -17,10 +17,10 @@ export interface DialogBackButtonProps {
17
17
  export interface DialogNavProps {
18
18
  status?: DialogStatusProps;
19
19
  dueAt?: string;
20
- duaAtLabel?: string;
20
+ dueAtLabel?: string;
21
21
  touchedBy?: DialogTouchedByActor[];
22
22
  backButton?: DialogBackButtonProps;
23
- menu?: DialogContextMenuProps;
23
+ menu?: ContextMenuProps;
24
24
  }
25
25
 
26
26
  /**
@@ -33,8 +33,8 @@ export const DialogNav = ({
33
33
  },
34
34
  status,
35
35
  dueAt,
36
+ dueAtLabel,
36
37
  touchedBy,
37
- duaAtLabel,
38
38
  menu,
39
39
  }: DialogNavProps) => {
40
40
  const [expandedItem, setexpandedItem] = useState<boolean>(false);
@@ -46,9 +46,9 @@ export const DialogNav = ({
46
46
  {backButton?.label || 'Back'}
47
47
  </Button>
48
48
  <div className={styles.action}>
49
- {duaAtLabel && duaAtLabel && (
49
+ {dueAt && dueAtLabel && (
50
50
  <MetaTimestamp datetime={dueAt} size="xs">
51
- {duaAtLabel}
51
+ {dueAtLabel}
52
52
  </MetaTimestamp>
53
53
  )}
54
54
  {status && <DialogStatus {...status} />}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "main": "lib/index.ts",
5
5
  "description": "Reusable react components",
6
6
  "publishConfig": {