@dt-dds/react-message 1.0.0-beta.90 → 1.0.0-beta.91

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,15 @@
1
1
  # @dt-ui/react-message
2
2
 
3
+ ## 1.0.0-beta.91
4
+
5
+ ### Minor Changes
6
+
7
+ - feat: add breakpoint to message
8
+
9
+ ### Patch Changes
10
+
11
+ - @dt-dds/react-button@1.0.0-beta.75
12
+
3
13
  ## 1.0.0-beta.90
4
14
 
5
15
  ### Patch Changes
package/README.md CHANGED
@@ -39,7 +39,7 @@ export const App = () => {
39
39
  | `title` | `string` | - | Optional Text to be presented as Title within the Message.Content, It should have text character count limit: 50. |
40
40
  | `description` | `string` | - | Text to be presented as Description within the Message.Content, It should have text character count limit: 230. |
41
41
  | `onClose` | `function` | - | When provided, a close button is displayed and, when clicked, it triggers this function. |
42
- | `orientation` | `Orientation` | `'horizontal'` | Sets the orientation of the message component. |
42
+ | `orientation` | `Orientation` | `'horizontal'` | Sets the orientation of the message component. On mobile the orientation is vertical |
43
43
 
44
44
  ### Message.Actions
45
45
 
package/dist/index.d.mts CHANGED
@@ -23,7 +23,7 @@ interface ActionsProps extends BaseProps {
23
23
  }
24
24
 
25
25
  declare const Message: {
26
- ({ children, dataTestId, style, type, onClose, description, title, orientation, }: MessageProps): react_jsx_runtime.JSX.Element;
26
+ ({ children, dataTestId, style, type, onClose, description, title, orientation: propOrientation, }: MessageProps): react_jsx_runtime.JSX.Element;
27
27
  Actions({ children, dataTestId, type }: ActionsProps): react_jsx_runtime.JSX.Element;
28
28
  };
29
29
 
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ interface ActionsProps extends BaseProps {
23
23
  }
24
24
 
25
25
  declare const Message: {
26
- ({ children, dataTestId, style, type, onClose, description, title, orientation, }: MessageProps): react_jsx_runtime.JSX.Element;
26
+ ({ children, dataTestId, style, type, onClose, description, title, orientation: propOrientation, }: MessageProps): react_jsx_runtime.JSX.Element;
27
27
  Actions({ children, dataTestId, type }: ActionsProps): react_jsx_runtime.JSX.Element;
28
28
  };
29
29
 
package/dist/index.js CHANGED
@@ -110,6 +110,7 @@ module.exports = __toCommonJS(index_exports);
110
110
 
111
111
  // src/Message.tsx
112
112
  var import_react_box = __toESM(require_dist());
113
+ var import_react_core = require("@dt-dds/react-core");
113
114
  var import_react_icon = require("@dt-dds/react-icon");
114
115
  var import_react_typography = require("@dt-dds/react-typography");
115
116
  var import_react = require("@emotion/react");
@@ -233,10 +234,12 @@ var Message = ({
233
234
  onClose,
234
235
  description,
235
236
  title,
236
- orientation = "horizontal"
237
+ orientation: propOrientation = "horizontal"
237
238
  }) => {
238
239
  const theme = (0, import_react.useTheme)();
239
240
  const isDefault = type === OMessageType.Default;
241
+ const isMobile = (0, import_react_core.useMedia)(`(max-width: ${theme.breakpoints.mq2}px)`);
242
+ const orientation = isMobile ? "vertical" : propOrientation || "horizontal";
240
243
  const isHorizontal = orientation === "horizontal";
241
244
  const isDismissible = !!onClose;
242
245
  const textColor = isDefault ? "content.default" : `${type}.dark`;
@@ -277,10 +280,16 @@ var Message = ({
277
280
  alignItems: isHorizontal ? "center" : "start"
278
281
  },
279
282
  children: [
280
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_box.Box, { style: { alignItems: "flex-start" }, children: [
281
- title ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_typography.Typography, { color: textColor, fontStyles: "bodyLgBold", children: title }) : null,
282
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_typography.Typography, { color: textColor, fontStyles: "bodyLgRegular", children: description })
283
- ] }),
283
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
284
+ import_react_box.Box,
285
+ {
286
+ style: { alignItems: "flex-start", gap: theme.spacing.spacing_10 },
287
+ children: [
288
+ title ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_typography.Typography, { color: textColor, fontStyles: "bodyLgBold", children: title }) : null,
289
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_typography.Typography, { color: textColor, fontStyles: "bodyLgRegular", children: description })
290
+ ]
291
+ }
292
+ ),
284
293
  clonedChildren
285
294
  ]
286
295
  }
package/dist/index.mjs CHANGED
@@ -103,6 +103,7 @@ var require_dist = __commonJS({
103
103
 
104
104
  // src/Message.tsx
105
105
  var import_react_box = __toESM(require_dist());
106
+ import { useMedia } from "@dt-dds/react-core";
106
107
  import { Icon } from "@dt-dds/react-icon";
107
108
  import { Typography } from "@dt-dds/react-typography";
108
109
  import { useTheme } from "@emotion/react";
@@ -226,10 +227,12 @@ var Message = ({
226
227
  onClose,
227
228
  description,
228
229
  title,
229
- orientation = "horizontal"
230
+ orientation: propOrientation = "horizontal"
230
231
  }) => {
231
232
  const theme = useTheme();
232
233
  const isDefault = type === OMessageType.Default;
234
+ const isMobile = useMedia(`(max-width: ${theme.breakpoints.mq2}px)`);
235
+ const orientation = isMobile ? "vertical" : propOrientation || "horizontal";
233
236
  const isHorizontal = orientation === "horizontal";
234
237
  const isDismissible = !!onClose;
235
238
  const textColor = isDefault ? "content.default" : `${type}.dark`;
@@ -270,10 +273,16 @@ var Message = ({
270
273
  alignItems: isHorizontal ? "center" : "start"
271
274
  },
272
275
  children: [
273
- /* @__PURE__ */ jsxs(import_react_box.Box, { style: { alignItems: "flex-start" }, children: [
274
- title ? /* @__PURE__ */ jsx(Typography, { color: textColor, fontStyles: "bodyLgBold", children: title }) : null,
275
- /* @__PURE__ */ jsx(Typography, { color: textColor, fontStyles: "bodyLgRegular", children: description })
276
- ] }),
276
+ /* @__PURE__ */ jsxs(
277
+ import_react_box.Box,
278
+ {
279
+ style: { alignItems: "flex-start", gap: theme.spacing.spacing_10 },
280
+ children: [
281
+ title ? /* @__PURE__ */ jsx(Typography, { color: textColor, fontStyles: "bodyLgBold", children: title }) : null,
282
+ /* @__PURE__ */ jsx(Typography, { color: textColor, fontStyles: "bodyLgRegular", children: description })
283
+ ]
284
+ }
285
+ ),
277
286
  clonedChildren
278
287
  ]
279
288
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dt-dds/react-message",
3
- "version": "1.0.0-beta.90",
3
+ "version": "1.0.0-beta.91",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js"
@@ -20,7 +20,7 @@
20
20
  "test:update:snapshot": "jest -u"
21
21
  },
22
22
  "dependencies": {
23
- "@dt-dds/react-button": "1.0.0-beta.74",
23
+ "@dt-dds/react-button": "1.0.0-beta.75",
24
24
  "@dt-dds/react-core": "1.0.0-beta.50",
25
25
  "@dt-dds/react-icon": "1.0.0-beta.51",
26
26
  "@dt-dds/react-typography": "1.0.0-beta.41",