@altinn/altinn-components 0.2.0 → 0.2.1

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.1](https://github.com/Altinn/altinn-components/compare/v0.2.0...v0.2.1) (2024-11-06)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * export members and add use client if needed for next support ([#26](https://github.com/Altinn/altinn-components/issues/26)) ([cb2c52e](https://github.com/Altinn/altinn-components/commit/cb2c52e8f8bd3b2633b439285bb8f4e5dc36d2ed))
9
+
3
10
  ## [0.2.0](https://github.com/Altinn/altinn-components/compare/v0.1.0...v0.2.0) (2024-11-06)
4
11
 
5
12
 
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import cx from 'classnames';
2
3
  import { useMemo } from 'react';
3
4
  import { Avatar, type AvatarProps, type AvatarSize, type AvatarType } from '.';
@@ -0,0 +1 @@
1
+ export * from './ContextMenu';
@@ -10,7 +10,7 @@ import { DialogHeader } from './DialogHeader';
10
10
  import { DialogSeenBy, type DialogSeenByProps } from './DialogSeenBy';
11
11
 
12
12
  import type { ReactNode } from 'react';
13
- import { DialogAction, type DialogActionButtonProps } from './DialogAction';
13
+ import { type DialogActionButtonProps, DialogActions } from './DialogActions.tsx';
14
14
  import type { DialogRecipientProps, DialogSenderProps } from './DialogHeadings.tsx';
15
15
  import { DialogHistory, type DialogHistoryProps } from './DialogHistory';
16
16
  import { type DialogBackButtonProps, DialogNav } from './DialogNav';
@@ -87,7 +87,7 @@ export const Dialog = ({
87
87
  <DialogBodyBase>
88
88
  <DialogContent updatedAt={updatedAt} updatedByName={updatedByName} summary={summary} body={body} />
89
89
  {attachments && <DialogAttachments {...attachments} />}
90
- {actions?.length > 0 && <DialogAction items={actions} />}
90
+ {actions?.length > 0 && <DialogActions items={actions} />}
91
91
  <MetaBase>
92
92
  {seenBy && <DialogSeenBy {...seenBy} />}
93
93
  {activityLog && <DialogActivityLog {...activityLog} />}
@@ -1,23 +1,25 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import { DialogAction } from './DialogAction';
2
+ import { DialogActions } from './DialogActions';
3
3
 
4
4
  const meta = {
5
- title: 'Dialog/Sections/DialogAction',
6
- component: DialogAction,
5
+ title: 'Dialog/Sections/DialogActions',
6
+ component: DialogActions,
7
7
  tags: ['autodocs'],
8
8
  args: {
9
9
  items: [
10
10
  {
11
11
  label: 'Primary',
12
12
  priority: 'primary',
13
+ id: 'primary',
13
14
  },
14
15
  {
15
16
  label: 'Secondary',
16
17
  priority: 'secondary',
18
+ id: 'secondary',
17
19
  },
18
20
  ],
19
21
  },
20
- } satisfies Meta<typeof DialogAction>;
22
+ } satisfies Meta<typeof DialogActions>;
21
23
 
22
24
  export default meta;
23
25
  type Story = StoryObj<typeof meta>;
@@ -34,18 +36,22 @@ export const MultipleButtons: Story = {
34
36
  args: {
35
37
  items: [
36
38
  {
39
+ id: 'primary',
37
40
  label: 'Primary',
38
41
  priority: 'primary',
39
42
  },
40
43
  {
44
+ id: 'secondary-1',
41
45
  label: 'Secondary',
42
46
  priority: 'secondary',
43
47
  },
44
48
  {
49
+ id: 'tertiary-1',
45
50
  label: 'Third action',
46
51
  priority: 'tertiary',
47
52
  },
48
53
  {
54
+ id: 'tertiary-2',
49
55
  label: 'Fourth action',
50
56
  priority: 'tertiary',
51
57
  },
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { type MouseEventHandler, useMemo, useState } from 'react';
2
3
  import { Button, ComboButton } from '../Button';
3
4
  import { Menu, type MenuItemProps } from '../Menu';
@@ -13,14 +14,14 @@ export interface DialogActionButtonProps {
13
14
  loading?: boolean;
14
15
  }
15
16
 
16
- export interface DialogActionProps {
17
+ export interface DialogActionsProps {
17
18
  /** List of actions */
18
19
  items: DialogActionButtonProps[];
19
20
  /** How many actions to display before turning into a ComboButton */
20
21
  maxItems?: number;
21
22
  }
22
23
 
23
- export const DialogAction = ({ items, maxItems = 2 }: DialogActionProps) => {
24
+ export const DialogActions = ({ items, maxItems = 2 }: DialogActionsProps) => {
24
25
  const [expanded, setExpanded] = useState<boolean>(false);
25
26
  const sortedItems = useMemo(() => {
26
27
  return (items || []).sort((a, b) => {
@@ -1,10 +1,10 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import styles from './dialogHeaderBase.module.css';
3
3
 
4
- export interface DialogHeaderProps {
4
+ export interface DialogHeaderBaseProps {
5
5
  children?: ReactNode;
6
6
  }
7
7
 
8
- export const DialogHeaderBase = ({ children }: DialogHeaderProps) => {
8
+ export const DialogHeaderBase = ({ children }: DialogHeaderBaseProps) => {
9
9
  return <header className={styles.header}>{children}</header>;
10
10
  };
@@ -1,2 +1,24 @@
1
+ export * from './Dialog';
2
+ export * from './DialogList';
1
3
  export * from './DialogMetadata';
2
4
  export * from './DialogListItem';
5
+ export * from './DialogListItemBase';
6
+ export * from './DialogActions.tsx';
7
+ export * from './DialogActivityLog';
8
+ export * from './DialogArticleBase';
9
+ export * from './DialogBase';
10
+ export * from './DialogBodyBase';
11
+ export * from './DialogBorder';
12
+ export * from './DialogContent';
13
+ export * from './DialogFooter';
14
+ export * from './DialogHeader';
15
+ export * from './DialogHeaderBase';
16
+ export * from './DialogHeadings';
17
+ export * from './DialogHistory';
18
+ export * from './DialogNav';
19
+ export * from './DialogSectionBase';
20
+ export * from './DialogSeenBy';
21
+ export * from './DialogSelect';
22
+ export * from './DialogStatus';
23
+ export * from './DialogTitle';
24
+ export * from './DialogTouchedBy';
@@ -2,3 +2,5 @@ export * from './ListItemBase';
2
2
  export * from './ListItem';
3
3
  export * from './ListBase';
4
4
  export * from './List';
5
+ export * from './ListItemLabel';
6
+ export * from './ListItemMedia';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { type RefObject, useEffect } from 'react';
2
3
 
3
4
  export const useClickOutside = (ref: RefObject<HTMLDivElement>, callback: () => void) => {
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { useEffect } from 'react';
2
3
 
3
4
  export const useEscapeKey = (onEscape: () => void): void => {
@@ -1,6 +1,8 @@
1
1
  export * from './MetaBase';
2
2
  export * from './MetaList';
3
3
  export * from './MetaItemBase';
4
+ export * from './MetaItemMedia';
5
+ export * from './MetaItemLabel';
4
6
  export * from './MetaItem';
5
7
  export * from './MetaProgress';
6
8
  export * from './MetaTimestamp';
@@ -1,10 +1,15 @@
1
+ export * from './Attachment';
1
2
  export * from './Avatar';
2
- export * from './Button';
3
3
  export * from './Badge';
4
+ export * from './Button';
5
+ export * from './ContextMenu';
6
+ export * from './Dialog';
4
7
  export * from './Header';
8
+ export * from './History';
5
9
  export * from './Icon';
6
10
  export * from './Layout';
7
11
  export * from './List';
8
12
  export * from './Menu';
9
13
  export * from './Meta';
10
14
  export * from './Toolbar';
15
+ export * from './Typography';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "main": "lib/index.ts",
5
5
  "description": "Reusable react components",
6
6
  "publishConfig": {