@dbcdk/react-components 0.0.107 → 0.0.108

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.
@@ -15,12 +15,25 @@ const GAP_TOKEN = {
15
15
  lg: "var(--spacing-lg)",
16
16
  xl: "var(--spacing-xl)"
17
17
  };
18
- function Grid({ children, gap = "md", equalHeight = false, className, style }) {
18
+ function Grid({
19
+ children,
20
+ gap = "md",
21
+ equalHeight = false,
22
+ maxWidth,
23
+ className,
24
+ style
25
+ }) {
19
26
  return /* @__PURE__ */ jsxRuntime.jsx(
20
27
  "div",
21
28
  {
22
29
  className: [styles__default.default.grid, equalHeight && styles__default.default.equalHeight, className].filter(Boolean).join(" "),
23
- style: { gap: GAP_TOKEN[gap], ...style },
30
+ style: {
31
+ gap: GAP_TOKEN[gap],
32
+ ...(maxWidth == null ? void 0 : maxWidth.base) != null ? { "--max-width-base": maxWidth.base } : {},
33
+ ...(maxWidth == null ? void 0 : maxWidth.md) != null ? { "--max-width-md": maxWidth.md } : {},
34
+ ...(maxWidth == null ? void 0 : maxWidth.lg) != null ? { "--max-width-lg": maxWidth.lg } : {},
35
+ ...style
36
+ },
24
37
  children
25
38
  }
26
39
  );
@@ -1,14 +1,20 @@
1
1
  import type { CSSProperties, ReactNode } from 'react';
2
2
  export type GridGap = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
3
+ export interface GridMaxWidth {
4
+ base?: string;
5
+ md?: string;
6
+ lg?: string;
7
+ }
3
8
  export interface GridProps {
4
9
  children?: ReactNode;
5
10
  gap?: GridGap;
6
11
  /** Stretch direct children so cards/items in the same row get equal height */
7
12
  equalHeight?: boolean;
13
+ maxWidth?: GridMaxWidth;
8
14
  className?: string;
9
15
  style?: CSSProperties;
10
16
  }
11
- export declare function Grid({ children, gap, equalHeight, className, style }: GridProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function Grid({ children, gap, equalHeight, maxWidth, className, style, }: GridProps): import("react/jsx-runtime").JSX.Element;
12
18
  export interface GridItemProps {
13
19
  children?: ReactNode;
14
20
  /** Default span: <768px */
@@ -9,12 +9,25 @@ const GAP_TOKEN = {
9
9
  lg: "var(--spacing-lg)",
10
10
  xl: "var(--spacing-xl)"
11
11
  };
12
- function Grid({ children, gap = "md", equalHeight = false, className, style }) {
12
+ function Grid({
13
+ children,
14
+ gap = "md",
15
+ equalHeight = false,
16
+ maxWidth,
17
+ className,
18
+ style
19
+ }) {
13
20
  return /* @__PURE__ */ jsx(
14
21
  "div",
15
22
  {
16
23
  className: [styles.grid, equalHeight && styles.equalHeight, className].filter(Boolean).join(" "),
17
- style: { gap: GAP_TOKEN[gap], ...style },
24
+ style: {
25
+ gap: GAP_TOKEN[gap],
26
+ ...(maxWidth == null ? void 0 : maxWidth.base) != null ? { "--max-width-base": maxWidth.base } : {},
27
+ ...(maxWidth == null ? void 0 : maxWidth.md) != null ? { "--max-width-md": maxWidth.md } : {},
28
+ ...(maxWidth == null ? void 0 : maxWidth.lg) != null ? { "--max-width-lg": maxWidth.lg } : {},
29
+ ...style
30
+ },
18
31
  children
19
32
  }
20
33
  );
@@ -2,6 +2,7 @@
2
2
  display: grid;
3
3
  grid-template-columns: repeat(12, minmax(0, 1fr));
4
4
  align-items: start;
5
+ max-width: var(--max-width-base);
5
6
  }
6
7
 
7
8
  .equalHeight {
@@ -23,12 +24,20 @@
23
24
  }
24
25
 
25
26
  @media (min-width: 768px) {
27
+ .grid {
28
+ max-width: var(--max-width-md, var(--max-width-base));
29
+ }
30
+
26
31
  .item {
27
32
  grid-column: span var(--span-md, var(--span-base, 12));
28
33
  }
29
34
  }
30
35
 
31
36
  @media (min-width: 1200px) {
37
+ .grid {
38
+ max-width: var(--max-width-lg, var(--max-width-md, var(--max-width-base)));
39
+ }
40
+
32
41
  .item {
33
42
  grid-column: span var(--span-lg, var(--span-md, var(--span-base, 12)));
34
43
  }
@@ -45,7 +45,7 @@ function Headline({
45
45
  },
46
46
  className: headlineClassName,
47
47
  children: [
48
- icon || severity$1 && !marker ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.icon, children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { customIcon: icon, severity: severity$1 }) }) : null,
48
+ icon || severity$1 && !marker ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.icon, children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { customIcon: icon, severity: icon ? void 0 : severity$1 }) }) : null,
49
49
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: textClassName, children })
50
50
  ]
51
51
  }
@@ -39,7 +39,7 @@ function Headline({
39
39
  },
40
40
  className: headlineClassName,
41
41
  children: [
42
- icon || severity && !marker ? /* @__PURE__ */ jsx("span", { className: styles.icon, children: /* @__PURE__ */ jsx(Icon, { customIcon: icon, severity }) }) : null,
42
+ icon || severity && !marker ? /* @__PURE__ */ jsx("span", { className: styles.icon, children: /* @__PURE__ */ jsx(Icon, { customIcon: icon, severity: icon ? void 0 : severity }) }) : null,
43
43
  /* @__PURE__ */ jsx("span", { className: textClassName, children })
44
44
  ]
45
45
  }
@@ -22,10 +22,18 @@ const Stack = react.forwardRef(function Stack2({
22
22
  mobileAlign,
23
23
  mobileJustify,
24
24
  mobileWrap = false,
25
+ maxWidth,
25
26
  className,
27
+ style,
26
28
  ...rest
27
29
  }, ref) {
28
30
  const Tag = as != null ? as : "div";
31
+ const resolvedStyle = maxWidth != null ? {
32
+ ...maxWidth.base != null ? { "--max-width-base": maxWidth.base } : {},
33
+ ...maxWidth.md != null ? { "--max-width-md": maxWidth.md } : {},
34
+ ...maxWidth.lg != null ? { "--max-width-lg": maxWidth.lg } : {},
35
+ ...style
36
+ } : style;
29
37
  const classes = [
30
38
  "dbc-flex",
31
39
  direction === "column" ? "dbc-flex-column" : void 0,
@@ -39,9 +47,10 @@ const Stack = react.forwardRef(function Stack2({
39
47
  mobileAlign ? styles__default.default[`mobileAlign${mobileAlign.charAt(0).toUpperCase()}${mobileAlign.slice(1)}`] : void 0,
40
48
  mobileJustify ? styles__default.default[`mobileJustify${mobileJustify.charAt(0).toUpperCase()}${mobileJustify.slice(1)}`] : void 0,
41
49
  mobileWrap ? styles__default.default.mobileWrap : void 0,
50
+ maxWidth != null ? styles__default.default.maxWidth : void 0,
42
51
  className
43
52
  ].filter(Boolean).join(" ");
44
- return /* @__PURE__ */ jsxRuntime.jsx(Tag, { ref, className: classes, ...rest });
53
+ return /* @__PURE__ */ jsxRuntime.jsx(Tag, { ref, className: classes, style: resolvedStyle, ...rest });
45
54
  });
46
55
 
47
56
  exports.Stack = Stack;
@@ -1,4 +1,5 @@
1
1
  import React, { ElementType } from 'react';
2
+ import type { GridMaxWidth } from '../../components/grid/Grid';
2
3
  type GapSize = 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
3
4
  type StackDirection = 'row' | 'column';
4
5
  type StackAlign = 'start' | 'center' | 'end';
@@ -15,6 +16,7 @@ type StackOwnProps = {
15
16
  mobileAlign?: StackAlign;
16
17
  mobileJustify?: StackJustify;
17
18
  mobileWrap?: boolean;
19
+ maxWidth?: GridMaxWidth;
18
20
  };
19
21
  export type StackProps<C extends ElementType = 'div'> = StackOwnProps & {
20
22
  as?: C;
@@ -16,10 +16,18 @@ const Stack = forwardRef(function Stack2({
16
16
  mobileAlign,
17
17
  mobileJustify,
18
18
  mobileWrap = false,
19
+ maxWidth,
19
20
  className,
21
+ style,
20
22
  ...rest
21
23
  }, ref) {
22
24
  const Tag = as != null ? as : "div";
25
+ const resolvedStyle = maxWidth != null ? {
26
+ ...maxWidth.base != null ? { "--max-width-base": maxWidth.base } : {},
27
+ ...maxWidth.md != null ? { "--max-width-md": maxWidth.md } : {},
28
+ ...maxWidth.lg != null ? { "--max-width-lg": maxWidth.lg } : {},
29
+ ...style
30
+ } : style;
23
31
  const classes = [
24
32
  "dbc-flex",
25
33
  direction === "column" ? "dbc-flex-column" : void 0,
@@ -33,9 +41,10 @@ const Stack = forwardRef(function Stack2({
33
41
  mobileAlign ? styles[`mobileAlign${mobileAlign.charAt(0).toUpperCase()}${mobileAlign.slice(1)}`] : void 0,
34
42
  mobileJustify ? styles[`mobileJustify${mobileJustify.charAt(0).toUpperCase()}${mobileJustify.slice(1)}`] : void 0,
35
43
  mobileWrap ? styles.mobileWrap : void 0,
44
+ maxWidth != null ? styles.maxWidth : void 0,
36
45
  className
37
46
  ].filter(Boolean).join(" ");
38
- return /* @__PURE__ */ jsx(Tag, { ref, className: classes, ...rest });
47
+ return /* @__PURE__ */ jsx(Tag, { ref, className: classes, style: resolvedStyle, ...rest });
39
48
  });
40
49
 
41
50
  export { Stack };
@@ -1,3 +1,19 @@
1
+ .maxWidth {
2
+ max-width: var(--max-width-base);
3
+ }
4
+
5
+ @media (min-width: 768px) {
6
+ .maxWidth {
7
+ max-width: var(--max-width-md, var(--max-width-base));
8
+ }
9
+ }
10
+
11
+ @media (min-width: 1200px) {
12
+ .maxWidth {
13
+ max-width: var(--max-width-lg, var(--max-width-md, var(--max-width-base)));
14
+ }
15
+ }
16
+
1
17
  @media (max-width: 767px) {
2
18
  .mobileDirectionRow {
3
19
  flex-direction: row;
@@ -83,11 +83,7 @@
83
83
  transparent
84
84
  );
85
85
  --table-component-row-bg-hover: var(--color-bg-contextual-subtle);
86
- --table-component-row-bg-selected: color-mix(
87
- in srgb,
88
- var(--color-bg-selected) 55%,
89
- transparent
90
- );
86
+ --table-component-row-bg-selected: color-mix(in srgb, var(--color-bg-selected) 55%, transparent);
91
87
  --table-component-row-bg-selected-hover: color-mix(
92
88
  in srgb,
93
89
  var(--color-bg-selected-hover) 60%,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.107",
3
+ "version": "0.0.108",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",