@dt-dds/react-message 1.0.0-beta.55

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/dist/index.mjs ADDED
@@ -0,0 +1,399 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+
21
+ // src/Message.tsx
22
+ import { Typography } from "@dt-dds/react-typography";
23
+
24
+ // ../../dt-dds-react/core/assets/svgs/AllOut.tsx
25
+ import { jsx, jsxs } from "react/jsx-runtime";
26
+
27
+ // ../../dt-dds-react/core/assets/svgs/Apis.tsx
28
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
29
+
30
+ // ../../dt-dds-react/core/assets/svgs/Apps.tsx
31
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
32
+
33
+ // ../../dt-dds-react/core/assets/svgs/ArrowDropDown.tsx
34
+ import { jsx as jsx4 } from "react/jsx-runtime";
35
+
36
+ // ../../dt-dds-react/core/assets/svgs/ArrowDropUp.tsx
37
+ import { jsx as jsx5 } from "react/jsx-runtime";
38
+
39
+ // ../../dt-dds-react/core/assets/svgs/ArrowLeft.tsx
40
+ import { jsx as jsx6 } from "react/jsx-runtime";
41
+
42
+ // ../../dt-dds-react/core/assets/svgs/ArrowRight.tsx
43
+ import { jsx as jsx7 } from "react/jsx-runtime";
44
+
45
+ // ../../dt-dds-react/core/assets/svgs/AvatarThumbnail.tsx
46
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
47
+
48
+ // ../../dt-dds-react/core/assets/svgs/Bolt.tsx
49
+ import { jsx as jsx9 } from "react/jsx-runtime";
50
+
51
+ // ../../dt-dds-react/core/assets/svgs/CalendarMonth.tsx
52
+ import { jsx as jsx10 } from "react/jsx-runtime";
53
+
54
+ // ../../dt-dds-react/core/assets/svgs/Cancel.tsx
55
+ import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
56
+
57
+ // ../../dt-dds-react/core/assets/svgs/Check.tsx
58
+ import { jsx as jsx12 } from "react/jsx-runtime";
59
+
60
+ // ../../dt-dds-react/core/assets/svgs/CheckCircle.tsx
61
+ import { jsx as jsx13 } from "react/jsx-runtime";
62
+ var CheckCircleOutlineIcon = (props) => {
63
+ return /* @__PURE__ */ jsx13(
64
+ "svg",
65
+ __spreadProps(__spreadValues({
66
+ fill: "currentColor",
67
+ height: "24",
68
+ viewBox: "0 0 24 24",
69
+ width: "24",
70
+ xmlns: "http://www.w3.org/2000/svg"
71
+ }, props), {
72
+ children: /* @__PURE__ */ jsx13("path", { d: "M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM10 17L5 12L6.41 10.59L10 14.17L17.59 6.58L19 8L10 17Z" })
73
+ })
74
+ );
75
+ };
76
+ var CheckCircle_default = CheckCircleOutlineIcon;
77
+
78
+ // ../../dt-dds-react/core/assets/svgs/CheckCircleOutline.tsx
79
+ import { jsx as jsx14 } from "react/jsx-runtime";
80
+
81
+ // ../../dt-dds-react/core/assets/svgs/Close.tsx
82
+ import { jsx as jsx15 } from "react/jsx-runtime";
83
+ var CloseIcon = (props) => {
84
+ return /* @__PURE__ */ jsx15(
85
+ "svg",
86
+ __spreadProps(__spreadValues({
87
+ fill: "none",
88
+ height: "24",
89
+ viewBox: "0 0 24 24",
90
+ width: "24",
91
+ xmlns: "http://www.w3.org/2000/svg"
92
+ }, props), {
93
+ children: /* @__PURE__ */ jsx15(
94
+ "path",
95
+ {
96
+ d: "M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z",
97
+ fill: "currentColor"
98
+ }
99
+ )
100
+ })
101
+ );
102
+ };
103
+ var Close_default = CloseIcon;
104
+
105
+ // ../../dt-dds-react/core/assets/svgs/Copy.tsx
106
+ import { jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
107
+
108
+ // ../../dt-dds-react/core/assets/svgs/Delete.tsx
109
+ import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
110
+
111
+ // ../../dt-dds-react/core/assets/svgs/Edit.tsx
112
+ import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
113
+
114
+ // ../../dt-dds-react/core/assets/svgs/Email.tsx
115
+ import { jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
116
+
117
+ // ../../dt-dds-react/core/assets/svgs/EmailSend.tsx
118
+ import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
119
+
120
+ // ../../dt-dds-react/core/assets/svgs/Error.tsx
121
+ import { useTheme } from "@emotion/react";
122
+ import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
123
+ var Error2 = (props) => {
124
+ const theme = useTheme();
125
+ return /* @__PURE__ */ jsxs11(
126
+ "svg",
127
+ __spreadProps(__spreadValues({
128
+ color: theme.palette.error.default,
129
+ fill: "none",
130
+ height: "24",
131
+ viewBox: "0 0 24 24",
132
+ width: "24",
133
+ xmlns: "http://www.w3.org/2000/svg"
134
+ }, props), {
135
+ children: [
136
+ /* @__PURE__ */ jsx21(
137
+ "path",
138
+ {
139
+ d: "M19.0711 19.0711C17.1957 20.9464 14.6522 22 12 22C9.34784 22 6.8043 20.9464 4.92893 19.0711C3.05357 17.1957 2 14.6522 2 12C2 9.34784 3.05357 6.8043 4.92893 4.92893C6.8043 3.05357 9.34784 2 12 2C14.6522 2 17.1957 3.05357 19.0711 4.92893C20.9464 6.8043 22 9.34784 22 12C22 14.6522 20.9464 17.1957 19.0711 19.0711Z",
140
+ fill: "currentColor"
141
+ }
142
+ ),
143
+ /* @__PURE__ */ jsx21(
144
+ "path",
145
+ {
146
+ d: "M12.8797 13.6863L13.1157 6.48828H10.8997L11.0997 13.6863H12.8797ZM11.9907 17.5123C12.1621 17.5181 12.333 17.4894 12.4932 17.4281C12.6534 17.3667 12.7997 17.2739 12.9234 17.1551C13.0471 17.0362 13.1458 16.8938 13.2136 16.7362C13.2813 16.5786 13.3168 16.4091 13.318 16.2375C13.3191 16.066 13.2859 15.8959 13.2202 15.7375C13.1545 15.579 13.0577 15.4353 12.9356 15.3148C12.8135 15.1944 12.6684 15.0996 12.5091 15.0361C12.3497 14.9727 12.1792 14.9418 12.0077 14.9453C11.6733 14.9521 11.3547 15.0892 11.1198 15.3274C10.8849 15.5656 10.7522 15.886 10.75 16.2205C10.7478 16.555 10.8762 16.8772 11.1079 17.1184C11.3397 17.3597 11.6564 17.501 11.9907 17.5123Z",
147
+ fill: "white"
148
+ }
149
+ )
150
+ ]
151
+ })
152
+ );
153
+ };
154
+ var Error_default = Error2;
155
+
156
+ // ../../dt-dds-react/core/assets/svgs/ErrorOutline.tsx
157
+ import { jsx as jsx22 } from "react/jsx-runtime";
158
+
159
+ // ../../dt-dds-react/core/assets/svgs/EVStation.tsx
160
+ import { jsx as jsx23 } from "react/jsx-runtime";
161
+
162
+ // ../../dt-dds-react/core/assets/svgs/Info.tsx
163
+ import { jsx as jsx24 } from "react/jsx-runtime";
164
+ var Info = (props) => {
165
+ return /* @__PURE__ */ jsx24(
166
+ "svg",
167
+ __spreadProps(__spreadValues({
168
+ fill: "currentColor",
169
+ height: "24",
170
+ viewBox: "0 0 24 24",
171
+ width: "24",
172
+ xmlns: "http://www.w3.org/2000/svg"
173
+ }, props), {
174
+ children: /* @__PURE__ */ jsx24("path", { d: "M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM13 17H11V11H13V17ZM13 9H11V7H13V9Z" })
175
+ })
176
+ );
177
+ };
178
+ var Info_default = Info;
179
+
180
+ // ../../dt-dds-react/core/assets/svgs/InfoOutline.tsx
181
+ import { jsx as jsx25 } from "react/jsx-runtime";
182
+
183
+ // ../../dt-dds-react/core/assets/svgs/Input.tsx
184
+ import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
185
+
186
+ // ../../dt-dds-react/core/assets/svgs/Language.tsx
187
+ import { jsx as jsx27 } from "react/jsx-runtime";
188
+
189
+ // ../../dt-dds-react/core/assets/svgs/LocationOn.tsx
190
+ import { jsx as jsx28, jsxs as jsxs13 } from "react/jsx-runtime";
191
+
192
+ // ../../dt-dds-react/core/assets/svgs/LocationSearching.tsx
193
+ import { jsx as jsx29 } from "react/jsx-runtime";
194
+
195
+ // ../../dt-dds-react/core/assets/svgs/MenuCompact.tsx
196
+ import { jsx as jsx30 } from "react/jsx-runtime";
197
+
198
+ // ../../dt-dds-react/core/assets/svgs/MenuExpand.tsx
199
+ import { jsx as jsx31 } from "react/jsx-runtime";
200
+
201
+ // ../../dt-dds-react/core/assets/svgs/Menu.tsx
202
+ import { jsx as jsx32 } from "react/jsx-runtime";
203
+
204
+ // ../../dt-dds-react/core/assets/svgs/MoreHorizontal.tsx
205
+ import { jsx as jsx33 } from "react/jsx-runtime";
206
+
207
+ // ../../dt-dds-react/core/assets/svgs/MoreVertical.tsx
208
+ import { jsx as jsx34 } from "react/jsx-runtime";
209
+
210
+ // ../../dt-dds-react/core/assets/svgs/NoData.tsx
211
+ import { useTheme as useTheme2 } from "@emotion/react";
212
+ import { jsx as jsx35, jsxs as jsxs14 } from "react/jsx-runtime";
213
+
214
+ // ../../dt-dds-react/core/assets/svgs/NotFound.tsx
215
+ import { jsx as jsx36, jsxs as jsxs15 } from "react/jsx-runtime";
216
+
217
+ // ../../dt-dds-react/core/assets/svgs/OutlinedArrowDropDown.tsx
218
+ import { jsx as jsx37 } from "react/jsx-runtime";
219
+
220
+ // ../../dt-dds-react/core/assets/svgs/OutlinedArrowDropUp.tsx
221
+ import { jsx as jsx38 } from "react/jsx-runtime";
222
+
223
+ // ../../dt-dds-react/core/assets/svgs/PhoneOutlined.tsx
224
+ import { jsx as jsx39 } from "react/jsx-runtime";
225
+
226
+ // ../../dt-dds-react/core/assets/svgs/Payments.tsx
227
+ import { jsx as jsx40 } from "react/jsx-runtime";
228
+
229
+ // ../../dt-dds-react/core/assets/svgs/Products.tsx
230
+ import { jsx as jsx41, jsxs as jsxs16 } from "react/jsx-runtime";
231
+
232
+ // ../../dt-dds-react/core/assets/svgs/RemoveCircleOutline.tsx
233
+ import { jsx as jsx42 } from "react/jsx-runtime";
234
+
235
+ // ../../dt-dds-react/core/assets/svgs/Share.tsx
236
+ import { jsx as jsx43, jsxs as jsxs17 } from "react/jsx-runtime";
237
+
238
+ // ../../dt-dds-react/core/assets/svgs/Signout.tsx
239
+ import { jsx as jsx44 } from "react/jsx-runtime";
240
+
241
+ // ../../dt-dds-react/core/assets/svgs/Teams.tsx
242
+ import { jsx as jsx45, jsxs as jsxs18 } from "react/jsx-runtime";
243
+
244
+ // ../../dt-dds-react/core/assets/svgs/Timeline.tsx
245
+ import { jsx as jsx46, jsxs as jsxs19 } from "react/jsx-runtime";
246
+
247
+ // ../../dt-dds-react/core/assets/svgs/Topic.tsx
248
+ import { jsx as jsx47, jsxs as jsxs20 } from "react/jsx-runtime";
249
+
250
+ // ../../dt-dds-react/core/assets/svgs/UnfoldLess.tsx
251
+ import { jsx as jsx48 } from "react/jsx-runtime";
252
+
253
+ // ../../dt-dds-react/core/assets/svgs/UnfoldMore.tsx
254
+ import { jsx as jsx49 } from "react/jsx-runtime";
255
+
256
+ // ../../dt-dds-react/core/assets/svgs/Username.tsx
257
+ import { jsx as jsx50, jsxs as jsxs21 } from "react/jsx-runtime";
258
+
259
+ // ../../dt-dds-react/core/assets/svgs/ViewAgenda.tsx
260
+ import { jsx as jsx51, jsxs as jsxs22 } from "react/jsx-runtime";
261
+
262
+ // ../../dt-dds-react/core/assets/svgs/Visibility.tsx
263
+ import { jsx as jsx52, jsxs as jsxs23 } from "react/jsx-runtime";
264
+
265
+ // ../../dt-dds-react/core/assets/svgs/VisibilityOff.tsx
266
+ import { jsx as jsx53, jsxs as jsxs24 } from "react/jsx-runtime";
267
+
268
+ // ../../dt-dds-react/core/assets/svgs/WarningOutline.tsx
269
+ import { jsx as jsx54 } from "react/jsx-runtime";
270
+
271
+ // ../../dt-dds-react/core/assets/svgs/Warning.tsx
272
+ import { jsx as jsx55 } from "react/jsx-runtime";
273
+ var Warning = (props) => {
274
+ return /* @__PURE__ */ jsx55(
275
+ "svg",
276
+ __spreadProps(__spreadValues({
277
+ fill: "currentColor",
278
+ height: "24",
279
+ viewBox: "0 0 24 24",
280
+ width: "24",
281
+ xmlns: "http://www.w3.org/2000/svg"
282
+ }, props), {
283
+ children: /* @__PURE__ */ jsx55("path", { d: "M1 21.5H23L12 2.5L1 21.5ZM13 18.5H11V16.5H13V18.5ZM13 14.5H11V10.5H13V14.5Z" })
284
+ })
285
+ );
286
+ };
287
+ var Warning_default = Warning;
288
+
289
+ // ../../dt-dds-react/core/assets/svgs/Wifi.tsx
290
+ import { jsx as jsx56 } from "react/jsx-runtime";
291
+
292
+ // ../../dt-dds-react/core/assets/svgs/Settings.tsx
293
+ import { jsx as jsx57 } from "react/jsx-runtime";
294
+
295
+ // src/Message.styled.ts
296
+ import styled from "@emotion/styled";
297
+
298
+ // src/types/index.ts
299
+ var OMessageType = {
300
+ Default: "default",
301
+ Error: "error",
302
+ Info: "informative",
303
+ Success: "success",
304
+ Warning: "warning"
305
+ };
306
+
307
+ // src/Message.styled.ts
308
+ var MessageStyled = styled.div`
309
+ ${({ theme, type }) => `
310
+ padding: ${theme.spacing["3xs"]} ${theme.spacing["2xs"]};
311
+ background-color: ${type === OMessageType.Default ? theme.palette.surface.light : theme.palette[type].light};
312
+ display: flex;
313
+ align-items: flex-start;
314
+ justify-content: center;
315
+ border-radius: ${theme.shape.message};
316
+ border: 1px dashed ${type === OMessageType.Default ? theme.palette.border.default : theme.palette[type].default};
317
+ width: 100%;
318
+ height: 100%;
319
+ gap: ${theme.spacing["4xs"]};
320
+ `}
321
+ `;
322
+ var MessageContentStyled = styled.div`
323
+ ${({ theme }) => `
324
+ display: flex;
325
+ flex-direction: column;
326
+ flex: 1;
327
+ text-align: start;
328
+ gap: ${theme.spacing["6xs"]};
329
+ `}
330
+ `;
331
+ var MessageActionStyled = styled.div`
332
+ ${({ theme }) => `
333
+ padding-top: ${theme.spacing["4xs"]};
334
+ `}
335
+ `;
336
+ var MessageIconStyled = styled.div`
337
+ ${({ theme, type }) => `
338
+ height: 100%;
339
+ display: flex;
340
+ color: ${type === "default" ? theme.palette.content.default : theme.palette[type].default};
341
+ `}
342
+ `;
343
+ var MessageButtonCloseStyled = styled.button`
344
+ ${({ theme }) => `
345
+ color: ${theme.palette.content.default};
346
+ border: 0;
347
+ cursor: pointer;
348
+ background: transparent;
349
+ display: flex;
350
+
351
+ &:hover {
352
+ background-color: ${theme.palette.surface.contrast};
353
+ }
354
+ `}
355
+ `;
356
+
357
+ // src/Message.tsx
358
+ import { jsx as jsx58, jsxs as jsxs25 } from "react/jsx-runtime";
359
+ var MessageIcons = {
360
+ [OMessageType.Error]: Error_default,
361
+ [OMessageType.Info]: Info_default,
362
+ [OMessageType.Success]: CheckCircle_default,
363
+ [OMessageType.Warning]: Warning_default,
364
+ [OMessageType.Default]: null
365
+ };
366
+ var Message = ({
367
+ children,
368
+ dataTestId,
369
+ style,
370
+ type = OMessageType.Default,
371
+ onClose
372
+ }) => {
373
+ const isDismissable = !!onClose;
374
+ const Icon = MessageIcons[type];
375
+ return /* @__PURE__ */ jsxs25(
376
+ MessageStyled,
377
+ {
378
+ "data-testid": dataTestId != null ? dataTestId : "message",
379
+ style,
380
+ type,
381
+ children: [
382
+ Icon ? /* @__PURE__ */ jsx58(MessageIconStyled, { type, children: /* @__PURE__ */ jsx58(Icon, { "data-testid": "message-icon", height: "16px", width: "16px" }) }) : null,
383
+ /* @__PURE__ */ jsx58(MessageContentStyled, { children }),
384
+ isDismissable ? /* @__PURE__ */ jsx58(MessageButtonCloseStyled, { onClick: onClose, children: /* @__PURE__ */ jsx58(Close_default, { height: "16px", width: "16px" }) }) : null
385
+ ]
386
+ }
387
+ );
388
+ };
389
+ Message.Title = ({ children }) => {
390
+ return /* @__PURE__ */ jsx58(Typography, { color: "content.dark", element: "h2", fontStyles: "body2Bold", children });
391
+ };
392
+ Message.Description = ({ children }) => {
393
+ return /* @__PURE__ */ jsx58(Typography, { color: "content.default", fontStyles: "body3", children });
394
+ };
395
+ Message.Action = ({ children, dataTestId }) => /* @__PURE__ */ jsx58(MessageActionStyled, { "data-testid": dataTestId != null ? dataTestId : "message-action", children });
396
+ export {
397
+ Message,
398
+ MessageIcons
399
+ };
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@dt-dds/react-message",
3
+ "version": "1.0.0-beta.55",
4
+ "license": "MIT",
5
+ "exports": {
6
+ ".": "./dist/index.js"
7
+ },
8
+ "main": "./dist/index.js",
9
+ "module": "./dist/index.mjs",
10
+ "types": "./dist/index.d.ts",
11
+ "files": [
12
+ "dist/**"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsup",
16
+ "dev": "tsup --watch",
17
+ "lint": "eslint --cache .",
18
+ "test": "jest",
19
+ "test:report": "open ./jest-coverage/lcov-report/index.html",
20
+ "test:update:snapshot": "jest -u"
21
+ },
22
+ "dependencies": {
23
+ "@dt-dds/react-core": "1.0.0-beta.41",
24
+ "@dt-dds/react-typography": "1.0.0-beta.32",
25
+ "@dt-dds/react-link": "1.0.0-beta.16"
26
+ },
27
+ "devDependencies": {
28
+ "@babel/core": "^7.22.9",
29
+ "@babel/preset-env": "^7.22.9",
30
+ "@babel/preset-react": "^7.22.5",
31
+ "@babel/preset-typescript": "^7.23.3",
32
+ "@emotion/babel-plugin": "^11.11.0",
33
+ "@emotion/css": "^11.7.1",
34
+ "@emotion/jest": "^11.10.0",
35
+ "@emotion/react": "^11.8.2",
36
+ "@emotion/styled": "^11.8.1",
37
+ "@types/react": "^18.0.9",
38
+ "@types/react-dom": "^18.0.4",
39
+ "babel-loader": "^8.3.0",
40
+ "eslint-config-custom": "*",
41
+ "eslint-plugin-storybook": "^9.1.0",
42
+ "jest-config": "*",
43
+ "react": "^18.1.0",
44
+ "react-dom": "^18.2.0",
45
+ "tsconfig": "*",
46
+ "tsup": "^6.6.3",
47
+ "typescript": "^4.5.3"
48
+ },
49
+ "peerDependencies": {
50
+ "@emotion/css": "^11.7.1",
51
+ "@emotion/react": "^11.8.2",
52
+ "@emotion/styled": "^11.8.1",
53
+ "react": ">=17.0.2",
54
+ "react-dom": ">=17.0.2"
55
+ }
56
+ }