@altinn/altinn-components 0.31.0 → 0.32.0

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.
Files changed (44) hide show
  1. package/dist/assets/ModalBase.css +1 -0
  2. package/dist/components/ActivityLog/ActivityLog.js +24 -8
  3. package/dist/components/ActivityLog/ActivityLogItem.js +4 -5
  4. package/dist/components/ActivityLog/ActivityLogSegment.js +17 -0
  5. package/dist/components/ActivityLog/index.js +6 -4
  6. package/dist/components/Dialog/Dialog.js +33 -11
  7. package/dist/components/Dialog/DialogActivityLog.js +10 -4
  8. package/dist/components/Dialog/DialogBody.js +13 -32
  9. package/dist/components/Dialog/DialogHeader.js +31 -23
  10. package/dist/components/Dialog/DialogMetadata.js +117 -72
  11. package/dist/components/Dialog/index.js +5 -5
  12. package/dist/components/Modal/ModalBase.js +37 -0
  13. package/dist/components/Modal/ModalBody.js +11 -0
  14. package/dist/components/Modal/ModalHeader.js +30 -0
  15. package/dist/components/Modal/index.js +8 -0
  16. package/dist/components/index.js +71 -63
  17. package/dist/index.js +101 -93
  18. package/dist/types/lib/components/ActivityLog/ActivityLog.d.ts +8 -3
  19. package/dist/types/lib/components/ActivityLog/ActivityLog.stories.d.ts +1 -0
  20. package/dist/types/lib/components/ActivityLog/ActivityLogItem.d.ts +3 -2
  21. package/dist/types/lib/components/ActivityLog/ActivityLogSegment.d.ts +11 -0
  22. package/dist/types/lib/components/ActivityLog/index.d.ts +1 -0
  23. package/dist/types/lib/components/Button/Button.stories.d.ts +0 -1
  24. package/dist/types/lib/components/Dialog/Dialog.d.ts +13 -11
  25. package/dist/types/lib/components/Dialog/Dialog.stories.d.ts +5 -3
  26. package/dist/types/lib/components/Dialog/DialogActivityLog.d.ts +7 -10
  27. package/dist/types/lib/components/Dialog/DialogBody.d.ts +5 -17
  28. package/dist/types/lib/components/Dialog/DialogBody.stories.d.ts +1 -3
  29. package/dist/types/lib/components/Dialog/DialogHeader.d.ts +5 -3
  30. package/dist/types/lib/components/Dialog/DialogHeader.stories.d.ts +3 -1
  31. package/dist/types/lib/components/Dialog/DialogHistory.stories.d.ts +0 -2
  32. package/dist/types/lib/components/Dialog/DialogMetadata.d.ts +7 -2
  33. package/dist/types/lib/components/Dialog/DialogMetadata.stories.d.ts +5 -8
  34. package/dist/types/lib/components/Modal/ModalBase.d.ts +11 -0
  35. package/dist/types/lib/components/Modal/ModalBase.stories.d.ts +9 -0
  36. package/dist/types/lib/components/Modal/ModalBody.d.ts +6 -0
  37. package/dist/types/lib/components/Modal/ModalHeader.d.ts +9 -0
  38. package/dist/types/lib/components/Modal/index.d.ts +3 -0
  39. package/dist/types/lib/components/index.d.ts +1 -0
  40. package/package.json +1 -1
  41. package/dist/DialogActivityLog-BoPREh7Y.js +0 -37
  42. package/dist/components/Dialog/DialogActivity.js +0 -32
  43. package/dist/types/lib/components/Dialog/DialogActivity.d.ts +0 -22
  44. package/dist/types/lib/components/Dialog/DialogListItem.stories.d.ts +0 -260
@@ -1,4 +1,8 @@
1
- import { AvatarProps, DialogActivityLogProps, DialogSeenByProps, DialogStatusProps } from '..';
1
+ import { AvatarProps, DialogSeenByProps, DialogStatusProps } from '..';
2
+ interface DialogMetadataButtonProps {
3
+ label: string;
4
+ onClick?: () => void;
5
+ }
2
6
  export type DialogMetadataProps = {
3
7
  className?: string;
4
8
  /** Metadata is loading */
@@ -42,9 +46,10 @@ export type DialogMetadataProps = {
42
46
  /** Transmissions label */
43
47
  transmissionsLabel?: string;
44
48
  /** Activity Log */
45
- activityLog?: DialogActivityLogProps;
49
+ activityLog?: DialogMetadataButtonProps;
46
50
  };
47
51
  /**
48
52
  * Metadata for a dialog in list view.
49
53
  */
50
54
  export declare const DialogMetadata: ({ className, loading, status, sender, updatedAt, updatedAtLabel, dueAt, dueAtLabel, archivedAt, archivedAtLabel, trashedAt, trashedAtLabel, seenBy, draftsLabel, sentCount, receivedCount, attachmentsCount, attachmentsLabel, transmissionsLabel, activityLog, }: DialogMetadataProps) => import("react/jsx-runtime").JSX.Element;
55
+ export {};
@@ -12,12 +12,9 @@ declare const meta: {
12
12
  export default meta;
13
13
  type Story = StoryObj<typeof meta>;
14
14
  export declare const Draft: Story;
15
- export declare const Sent: Story;
16
- export declare const DueDate: Story;
17
- export declare const SeenByEndUser: Story;
18
- export declare const SeenByOthers: Story;
19
- export declare const SeenByEndUserAndOthers: Story;
20
- export declare const SeenByAndActivityLog: Story;
21
- export declare const SeenByLog: Story;
15
+ export declare const RequiresAttention: Story;
16
+ export declare const InProgress: Story;
17
+ export declare const Completed: Story;
18
+ export declare const NotApplicable: Story;
19
+ export declare const Transmissions: Story;
22
20
  export declare const ActivityLog: Story;
23
- export declare const SentAndReceivedCount: Story;
@@ -0,0 +1,11 @@
1
+ import { BackdropColor } from '../';
2
+ export interface ModalBaseProps {
3
+ open: boolean;
4
+ onClose: () => void;
5
+ children?: React.ReactNode;
6
+ backdropColor?: BackdropColor;
7
+ variant?: 'default' | 'content' | 'full';
8
+ size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
9
+ color?: 'default' | 'primary' | 'secondary' | 'tertiary' | 'inherit';
10
+ }
11
+ export declare const ModalBase: ({ open, onClose, children, backdropColor, size, color, variant, }: ModalBaseProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { ModalBase } from './';
3
+ declare const meta: Meta<typeof ModalBase>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof ModalBase>;
6
+ export declare const Default: Story;
7
+ export declare const NoContent: Story;
8
+ export declare const Content: Story;
9
+ export declare const Full: Story;
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ import { SectionProps } from '../';
3
+ export interface ModalBodyProps extends SectionProps {
4
+ children?: ReactNode;
5
+ }
6
+ export declare const ModalBody: ({ children, ...props }: ModalBodyProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ export interface ModalHeaderProps {
3
+ title: string;
4
+ closeTitle?: string;
5
+ onClose?: () => void;
6
+ children?: ReactNode;
7
+ sticky?: boolean;
8
+ }
9
+ export declare const ModalHeader: ({ title, onClose, closeTitle, children }: ModalHeaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export * from './ModalBase';
2
+ export * from './ModalHeader';
3
+ export * from './ModalBody';
@@ -38,4 +38,5 @@ export * from './Settings';
38
38
  export * from './Dashboard';
39
39
  export * from './ActivityLog';
40
40
  export * from './Article';
41
+ export * from './Modal';
41
42
  export * from './DsComponents';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",
@@ -1,37 +0,0 @@
1
- "use client";
2
- import { jsx as n } from "react/jsx-runtime";
3
- import "./index-L8X2o7IH.js";
4
- import * as a from "react";
5
- import { forwardRef as m } from "react";
6
- import "./components/RootProvider/RootProvider.js";
7
- import "./components/Searchbar/AutocompleteBase.js";
8
- import "./components/Snackbar/useSnackbar.js";
9
- import { MetaItem as c } from "./components/Metadata/MetaItem.js";
10
- import { u as f } from "./useId-BVFxCjkq.js";
11
- var d = function(t, o) {
12
- var r = {};
13
- for (var e in t) Object.prototype.hasOwnProperty.call(t, e) && o.indexOf(e) < 0 && (r[e] = t[e]);
14
- if (t != null && typeof Object.getOwnPropertySymbols == "function")
15
- for (var l = 0, e = Object.getOwnPropertySymbols(t); l < e.length; l++)
16
- o.indexOf(e[l]) < 0 && Object.prototype.propertyIsEnumerable.call(t, e[l]) && (r[e[l]] = t[e[l]]);
17
- return r;
18
- };
19
- const p = m((t, o) => {
20
- var { title: r, titleId: e } = t, l = d(t, ["title", "titleId"]);
21
- let i = f();
22
- return i = r ? e || "title-" + i : void 0, a.createElement(
23
- "svg",
24
- Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: o, "aria-labelledby": i }, l),
25
- r ? a.createElement("title", { id: i }, r) : null,
26
- a.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M4.5 1.75a.75.75 0 0 1 .75.75v2.464a9.75 9.75 0 1 1 12.342 15.023.75.75 0 1 1-.86-1.229A8.251 8.251 0 1 0 6.084 6.25H9a.75.75 0 0 1 0 1.5H4.5A.75.75 0 0 1 3.75 7V2.5a.75.75 0 0 1 .75-.75M12.75 6a.75.75 0 0 0-1.5 0v6c0 .199.079.39.22.53l2.5 2.5a.75.75 0 1 0 1.06-1.06l-2.28-2.28zM3 11.25a.75.75 0 0 1 .75.75q0 .66.105 1.31a.75.75 0 0 1-1.481.24A10 10 0 0 1 2.25 12a.75.75 0 0 1 .75-.75m1.855 4.875a.75.75 0 0 0-1.299.75q.39.675.882 1.28a.75.75 0 1 0 1.163-.947 8 8 0 0 1-.746-1.083m1.995 3.294a.75.75 0 0 1 1.025-.274q.57.33 1.188.564a.75.75 0 1 1-.535 1.402 10 10 0 0 1-1.403-.667.75.75 0 0 1-.275-1.025m6.7 2.207a.75.75 0 1 0-.24-1.48q-.65.104-1.31.104a.75.75 0 0 0 0 1.5q.78 0 1.55-.124", clipRule: "evenodd" })
27
- );
28
- }), h = ({
29
- size: t = "xs",
30
- label: o = "Activity log",
31
- onClick: r,
32
- ...e
33
- }) => /* @__PURE__ */ n(c, { ...e, size: t, icon: p, children: o });
34
- export {
35
- h as D,
36
- p as S
37
- };
@@ -1,32 +0,0 @@
1
- import { jsx as m, jsxs as n } from "react/jsx-runtime";
2
- import "../../index-L8X2o7IH.js";
3
- import "react";
4
- import { Byline as e } from "../Byline/Byline.js";
5
- import "../RootProvider/RootProvider.js";
6
- import { TimelineBase as h } from "../Timeline/TimelineBase.js";
7
- import { Typography as g } from "../Typography/Typography.js";
8
- import "../Searchbar/AutocompleteBase.js";
9
- import "../Snackbar/useSnackbar.js";
10
- import { Section as c } from "../Page/Section.js";
11
- import { TransmissionList as x } from "../Transmission/TransmissionList.js";
12
- import { S } from "../../CircleFill-BkDF4Wm0.js";
13
- const y = ({
14
- icon: p = S,
15
- color: l = "neutral",
16
- size: s = "sm",
17
- createdBy: i,
18
- createdAt: f,
19
- createdAtLabel: o,
20
- description: r,
21
- transmissions: t
22
- }) => /* @__PURE__ */ m(h, { color: l, icon: s === "md" ? i : p, children: /* @__PURE__ */ n(c, { style: { marginBottom: ".5em" }, children: [
23
- o && /* @__PURE__ */ n(e, { datetime: f, children: [
24
- /* @__PURE__ */ m("strong", { children: i == null ? void 0 : i.name }),
25
- o
26
- ] }),
27
- r && /* @__PURE__ */ m(g, { children: r }),
28
- t && /* @__PURE__ */ m(x, { items: t })
29
- ] }) });
30
- export {
31
- y as DialogActivity
32
- };
@@ -1,22 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { AvatarProps, BadgeProps, Color, SvgElement, TransmissionProps } from '..';
3
- export interface DialogActivityBadge {
4
- label?: string;
5
- value?: string;
6
- }
7
- export type DialogActivitySize = 'sm' | 'md';
8
- export interface DialogActivityProps {
9
- type?: string;
10
- size?: DialogActivitySize;
11
- icon?: SvgElement;
12
- color?: Color;
13
- badge?: BadgeProps;
14
- createdAt?: string;
15
- createdAtLabel?: string;
16
- createdBy?: AvatarProps;
17
- description?: string | ReactNode;
18
- transmissions?: TransmissionProps[];
19
- collapsed?: boolean;
20
- children?: ReactNode;
21
- }
22
- export declare const DialogActivity: ({ icon, color, size, createdBy, createdAt, createdAtLabel, description, transmissions, }: DialogActivityProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,260 +0,0 @@
1
- import { DialogListItemProps, DialogListItemSize } from '..';
2
- declare const meta: {
3
- title: string;
4
- component: ({ size, state, loading, controls, select, selected, status, sender, recipient, recipientLabel, grouped, updatedAt, updatedAtLabel, archived, archivedAt, archivedAtLabel, trashed, trashedAt, trashedAtLabel, badge, dueAt, dueAtLabel, unread, seenBy, seenByLog, draftsLabel, sentCount, receivedCount, attachmentsCount, attachmentsLabel, title, description, summary, variant, id, ...rest }: DialogListItemProps) => import("react/jsx-runtime").JSX.Element;
5
- tags: string[];
6
- argTypes: {};
7
- args: {
8
- title: string;
9
- summary: string;
10
- sender: import('..').AvatarProps;
11
- recipient: {
12
- type: "person";
13
- name: string;
14
- };
15
- updatedAt: string;
16
- updatedAtLabel: string;
17
- status: {};
18
- };
19
- decorators: ((Story: import('storybook/internal/csf').PartialStoryFn<import('@storybook/react-vite').ReactRenderer, {
20
- title: string;
21
- id?: string | undefined;
22
- sender?: import('..').AvatarProps | undefined;
23
- recipient?: import('..').AvatarProps | undefined;
24
- recipientLabel?: string | undefined;
25
- grouped?: boolean | undefined;
26
- description?: string | undefined;
27
- summary?: string | undefined;
28
- size?: DialogListItemSize | undefined;
29
- controls?: React.ReactNode;
30
- selected?: boolean | undefined;
31
- state?: import('./DialogListItem').DialogListItemState | undefined;
32
- tabIndex?: number | undefined;
33
- badge?: import('..').BadgeProps | undefined;
34
- unread?: boolean | undefined;
35
- seenBy?: import('./DialogSeenBy').DialogSeenByProps | undefined;
36
- seenByLog?: import('./SeenByLog').SeenByLogProps | undefined;
37
- attachmentsCount?: number | undefined;
38
- attachmentsLabel?: string | undefined;
39
- groupId?: string | undefined;
40
- theme?: import('./DialogListItem').DialogListItemTheme | undefined;
41
- color?: import('..').Color | undefined;
42
- variant?: import('..').ListItemVariant | undefined;
43
- className?: string | undefined;
44
- loading?: boolean | undefined;
45
- ariaLabel?: string | undefined;
46
- icon?: import('..').SvgElement | import('..').IconProps | React.ReactNode | import('..').AvatarProps | import('..').AvatarGroupProps;
47
- linkIcon?: boolean | undefined;
48
- label?: React.ReactNode | (() => React.ReactElement);
49
- interactive?: boolean | undefined;
50
- as?: React.ElementType | undefined;
51
- shadow?: import('..').Shadow | undefined;
52
- border?: import('..').ListItemBorder | undefined;
53
- disabled?: boolean | undefined;
54
- hidden?: boolean | undefined;
55
- active?: boolean | undefined;
56
- expanded?: boolean | undefined;
57
- onMouseEnter?: React.MouseEventHandler<HTMLDivElement> | undefined;
58
- children?: React.ReactNode;
59
- select?: import('..').ListItemSelectProps | undefined;
60
- collapsible?: boolean | undefined;
61
- href?: string | undefined;
62
- onClick?: (() => void) | undefined;
63
- onKeyPress?: React.KeyboardEventHandler | undefined;
64
- status?: import('./DialogStatus').DialogStatusProps | undefined;
65
- updatedAt?: string | undefined;
66
- updatedAtLabel?: string | undefined;
67
- dueAt?: string | undefined;
68
- dueAtLabel?: string | undefined;
69
- archived?: boolean | undefined;
70
- archivedAt?: string | undefined;
71
- archivedAtLabel?: string | undefined;
72
- trashed?: boolean | undefined;
73
- trashedAt?: string | undefined;
74
- trashedAtLabel?: string | undefined;
75
- draftsLabel?: string | undefined;
76
- sentCount?: number | undefined;
77
- receivedCount?: number | undefined;
78
- transmissionsLabel?: string | undefined;
79
- activityLog?: import('./DialogActivityLog').DialogActivityLogProps | undefined;
80
- }>) => import("react/jsx-runtime").JSX.Element)[];
81
- };
82
- export default meta;
83
- export declare const Default: {
84
- args: {};
85
- };
86
- export declare const Unread: {
87
- args: {
88
- unread: boolean;
89
- badge: {
90
- label: string;
91
- };
92
- };
93
- };
94
- export declare const SeenByEndUser: {
95
- args: {
96
- seenByLog: {
97
- title: string;
98
- items: {
99
- id: string;
100
- name: string;
101
- seenAt: string;
102
- seenAtLabel: string;
103
- isEndUser: boolean;
104
- }[];
105
- };
106
- };
107
- };
108
- export declare const SeenByMultiple: {
109
- args: {
110
- seenByLog: import('./SeenByLog').SeenByLogProps;
111
- };
112
- };
113
- export declare const UnopenedContent: {
114
- args: {
115
- seenByLog: import('./SeenByLog').SeenByLogProps;
116
- badge: {
117
- label: string;
118
- };
119
- };
120
- };
121
- export declare const MarkedAsUnread: {
122
- args: {
123
- seenByLog: import('./SeenByLog').SeenByLogProps;
124
- unread: boolean;
125
- };
126
- };
127
- export declare const GroupedAvatars: {
128
- args: {
129
- grouped: boolean;
130
- };
131
- };
132
- export declare const RequiresAttention: {
133
- args: {
134
- status: {
135
- value: string;
136
- label: string;
137
- };
138
- };
139
- };
140
- export declare const DueAt: {
141
- args: {
142
- dueAt: string;
143
- dueAtLabel: string;
144
- status: {
145
- value: string;
146
- label: string;
147
- };
148
- };
149
- };
150
- export declare const InProgress: {
151
- args: {
152
- status: {
153
- value: string;
154
- label: string;
155
- };
156
- };
157
- };
158
- export declare const Completed: {
159
- args: {
160
- status: {
161
- value: string;
162
- label: string;
163
- };
164
- };
165
- };
166
- export declare const AttachmentsCount: {
167
- args: {
168
- attachmentsCount: number;
169
- status: {
170
- value: string;
171
- label: string;
172
- };
173
- };
174
- };
175
- export declare const AttachmentsLabel: {
176
- args: {
177
- attachmentsLabel: string;
178
- attachmentsCount: number;
179
- status: {
180
- value: string;
181
- label: string;
182
- };
183
- };
184
- };
185
- export declare const Draft: {
186
- args: {
187
- summary: undefined;
188
- recipient: undefined;
189
- draftsLabel: string;
190
- };
191
- };
192
- export declare const DraftAndStatus: {
193
- args: {
194
- draftsLabel: string;
195
- status: {
196
- value: string;
197
- label: string;
198
- };
199
- };
200
- };
201
- export declare const SentCount: {
202
- args: {
203
- sentCount: number;
204
- status: {
205
- value: string;
206
- label: string;
207
- };
208
- };
209
- };
210
- export declare const ReceivedCount: {
211
- args: {
212
- receivedCount: number;
213
- status: {
214
- value: string;
215
- label: string;
216
- };
217
- };
218
- };
219
- export declare const Transmissions: {
220
- args: {
221
- summary: undefined;
222
- sentCount: number;
223
- receivedCount: number;
224
- };
225
- };
226
- export declare const Archived: {
227
- args: {
228
- summary: undefined;
229
- archived: boolean;
230
- archivedAt: string;
231
- archivedAtLabel: string;
232
- };
233
- };
234
- export declare const Trashed: {
235
- args: {
236
- summary: undefined;
237
- trashed: boolean;
238
- trashedAt: string;
239
- trashedAtLabel: string;
240
- };
241
- };
242
- export declare const Loading: {
243
- args: {
244
- loading: boolean;
245
- };
246
- };
247
- export declare const LongTitle: {
248
- args: {
249
- title: string;
250
- };
251
- };
252
- export declare const LongSummary: {
253
- args: {
254
- summary: string;
255
- };
256
- };
257
- export declare const Selectable: (args: DialogListItemProps) => import("react/jsx-runtime").JSX.Element[];
258
- export declare const Sizes: (args: DialogListItemProps) => import("react/jsx-runtime").JSX.Element[];
259
- export declare const AsLink: (args: DialogListItemProps) => import("react/jsx-runtime").JSX.Element;
260
- export declare const CustomControls: (args: DialogListItemProps) => import("react/jsx-runtime").JSX.Element;