@dbcdk/react-components 0.0.151 → 0.0.153

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.
@@ -95,3 +95,9 @@
95
95
  --alert-fg: var(--color-brand);
96
96
  --alert-border: color-mix(in srgb, var(--color-brand) 35%, transparent);
97
97
  }
98
+
99
+ .accent {
100
+ --alert-bg: var(--color-accent-bg);
101
+ --alert-fg: var(--color-accent-fg);
102
+ --alert-border: var(--color-accent-border);
103
+ }
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
+ var severity = require('../../constants/severity');
4
5
  var styles = require('./AttributeChip.module.css');
5
6
 
6
7
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -12,15 +13,23 @@ function AttributeChip({
12
13
  value,
13
14
  size = "md",
14
15
  loading,
15
- severity = "neutral"
16
+ severity: severity$1
16
17
  }) {
17
- const valueClassName = [styles__default.default.value, styles__default.default[severity], !label && styles__default.default.valueStandalone].filter(Boolean).join(" ");
18
+ const markerSeverity = severity$1 && severity$1 !== "neutral" ? severity$1 : void 0;
18
19
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.container} ${styles__default.default[size]}`, "aria-busy": loading, children: [
19
20
  label ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
20
21
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.label, children: label }),
21
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.separator, "aria-hidden": "true", children: "|" })
22
+ !markerSeverity ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.separator, "aria-hidden": "true", children: "|" }) : null
22
23
  ] }) : null,
23
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: valueClassName, children: loading ? "\u2014" : value == null ? void 0 : value.toString() })
24
+ markerSeverity ? /* @__PURE__ */ jsxRuntime.jsx(
25
+ "span",
26
+ {
27
+ className: styles__default.default.marker,
28
+ "aria-hidden": "true",
29
+ style: { "--attribute-chip-marker-color": severity.SeverityBgColor[markerSeverity] }
30
+ }
31
+ ) : null,
32
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.value, children: loading ? "\u2014" : value == null ? void 0 : value.toString() })
24
33
  ] });
25
34
  }
26
35
 
@@ -1,4 +1,5 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { SeverityBgColor } from '../../constants/severity';
2
3
  import styles from './AttributeChip.module.css';
3
4
 
4
5
  function AttributeChip({
@@ -6,15 +7,23 @@ function AttributeChip({
6
7
  value,
7
8
  size = "md",
8
9
  loading,
9
- severity = "neutral"
10
+ severity
10
11
  }) {
11
- const valueClassName = [styles.value, styles[severity], !label && styles.valueStandalone].filter(Boolean).join(" ");
12
+ const markerSeverity = severity && severity !== "neutral" ? severity : void 0;
12
13
  return /* @__PURE__ */ jsxs("div", { className: `${styles.container} ${styles[size]}`, "aria-busy": loading, children: [
13
14
  label ? /* @__PURE__ */ jsxs(Fragment, { children: [
14
15
  /* @__PURE__ */ jsx("span", { className: styles.label, children: label }),
15
- /* @__PURE__ */ jsx("span", { className: styles.separator, "aria-hidden": "true", children: "|" })
16
+ !markerSeverity ? /* @__PURE__ */ jsx("span", { className: styles.separator, "aria-hidden": "true", children: "|" }) : null
16
17
  ] }) : null,
17
- /* @__PURE__ */ jsx("span", { className: valueClassName, children: loading ? "\u2014" : value == null ? void 0 : value.toString() })
18
+ markerSeverity ? /* @__PURE__ */ jsx(
19
+ "span",
20
+ {
21
+ className: styles.marker,
22
+ "aria-hidden": "true",
23
+ style: { "--attribute-chip-marker-color": SeverityBgColor[markerSeverity] }
24
+ }
25
+ ) : null,
26
+ /* @__PURE__ */ jsx("span", { className: styles.value, children: loading ? "\u2014" : value == null ? void 0 : value.toString() })
18
27
  ] });
19
28
  }
20
29
 
@@ -1,6 +1,7 @@
1
1
  .container {
2
2
  display: inline-flex;
3
3
  align-items: center;
4
+ gap: var(--spacing-2xs);
4
5
  white-space: nowrap;
5
6
  border-radius: var(--border-radius-default);
6
7
  border: 1px solid var(--color-border-subtle);
@@ -13,14 +14,12 @@
13
14
  avoids uneven leading around the glyphs at different font-sizes. */
14
15
  line-height: 1;
15
16
  --attribute-chip-padding-inline: var(--spacing-xxs);
16
- --attribute-chip-value-bleed: calc(
17
- (var(--attribute-chip-padding-inline) - var(--spacing-2xs)) * -1
18
- );
19
17
  padding-inline: var(--attribute-chip-padding-inline);
20
18
  }
21
19
 
22
20
  .label,
23
- .value {
21
+ .value,
22
+ .marker {
24
23
  display: inline-flex;
25
24
  align-items: center;
26
25
  height: 100%;
@@ -32,28 +31,20 @@
32
31
  }
33
32
 
34
33
  .value {
35
- height: calc(100% - 2 * var(--spacing-2xs));
36
- margin-block: var(--spacing-2xs);
37
34
  font-weight: var(--font-weight-medium);
38
- padding-inline: var(--attribute-chip-padding-inline);
39
- margin-inline-end: var(--attribute-chip-value-bleed);
40
- border-radius: 0 var(--border-radius-default) var(--border-radius-default) 0;
41
- background: var(--value-bg, transparent);
42
- color: var(--value-fg, inherit);
43
35
  }
44
36
 
45
- /* When there's no label/separator before it, the value is the only content,
46
- so it bleeds into the left padding too and becomes a full pill. A thin
47
- sliver of the container's own background stays visible around it. */
48
- .valueStandalone {
49
- margin-inline-start: var(--attribute-chip-value-bleed);
50
- border-radius: var(--border-radius-default);
37
+ .marker {
38
+ inline-size: var(--border-width-medium);
39
+ block-size: 0.9em;
40
+ flex: 0 0 auto;
41
+ border-radius: var(--border-radius-sm);
42
+ background: var(--attribute-chip-marker-color, var(--color-brand));
43
+ margin-inline: var(--spacing-2xs) var(--spacing-2xs);
51
44
  }
52
45
 
53
46
  .separator {
54
47
  color: var(--color-border-default);
55
- margin-inline-start: var(--spacing-xxs);
56
- margin-inline-end: var(--spacing-2xs);
57
48
  }
58
49
 
59
50
  /* Sizes */
@@ -71,35 +62,3 @@
71
62
  height: var(--component-size-md);
72
63
  font-size: var(--font-size-md);
73
64
  }
74
-
75
- /* Severity colors for the value */
76
-
77
- .neutral {
78
- --value-bg: transparent;
79
- --value-fg: inherit;
80
- }
81
-
82
- .success {
83
- --value-bg: var(--color-status-success-bg);
84
- --value-fg: var(--color-status-success-fg);
85
- }
86
-
87
- .warning {
88
- --value-bg: var(--color-status-warning-bg);
89
- --value-fg: var(--color-status-warning-fg);
90
- }
91
-
92
- .error {
93
- --value-bg: var(--color-status-error-bg);
94
- --value-fg: var(--color-status-error-fg);
95
- }
96
-
97
- .info {
98
- --value-bg: var(--color-status-info-bg);
99
- --value-fg: var(--color-status-info-fg);
100
- }
101
-
102
- .brand {
103
- --value-bg: var(--color-brand);
104
- --value-fg: var(--color-fg-on-brand);
105
- }
@@ -172,6 +172,17 @@
172
172
  box-shadow: inset 0 0 0 1px transparent;
173
173
  }
174
174
 
175
+ .accent {
176
+ --chip-bg: var(--color-accent-bg);
177
+ --chip-fg: var(--color-accent-fg);
178
+ --chip-border: transparent;
179
+ --chip-outlined-border: var(--color-accent-border);
180
+ --chip-outlined-border-hover: var(--color-accent-border);
181
+ --chip-outlined-fg: var(--color-accent-fg);
182
+ --chip-outlined-fg-hover: var(--color-accent-fg);
183
+ box-shadow: inset 0 0 0 1px var(--color-accent-border);
184
+ }
185
+
175
186
  /* Selected */
176
187
 
177
188
  .selected {
@@ -40,6 +40,9 @@
40
40
  .brand {
41
41
  background-color: var(--color-brand);
42
42
  }
43
+ .accent {
44
+ background-color: var(--color-accent);
45
+ }
43
46
  .success {
44
47
  background-color: var(--color-status-success);
45
48
  }
@@ -57,6 +60,10 @@
57
60
  box-shadow: 0 0 0 2px var(--color-bg-selected);
58
61
  }
59
62
 
63
+ .accent[data-glow='true'] {
64
+ box-shadow: 0 0 0 2px var(--color-accent-bg);
65
+ }
66
+
60
67
  .success[data-glow='true'] {
61
68
  box-shadow: 0 0 0 2px var(--color-status-success-bg);
62
69
  }
@@ -43,6 +43,11 @@
43
43
  --env-banner-fg: var(--color-fg-on-brand);
44
44
  }
45
45
 
46
+ .banner[data-severity='accent'] {
47
+ --env-banner-bg: var(--color-accent);
48
+ --env-banner-fg: var(--color-fg-on-accent);
49
+ }
50
+
46
51
  .banner[data-severity='neutral'] {
47
52
  --env-banner-bg: var(--color-neutral);
48
53
  --env-banner-fg: var(--color-fg-default);
@@ -25,7 +25,8 @@ function MultiSelect({
25
25
  disabled = false,
26
26
  searchable = false,
27
27
  searchPlaceholder = "S\xF8g",
28
- emptyMessage = "Ingen resultater"
28
+ emptyMessage = "Ingen resultater",
29
+ popoverWidth
29
30
  }) {
30
31
  const selectedSet = react.useMemo(() => new Set(selectedValues), [selectedValues]);
31
32
  const popoverRef = react.useRef(null);
@@ -116,6 +117,7 @@ function MultiSelect({
116
117
  {
117
118
  ref: popoverRef,
118
119
  open,
120
+ minWidth: popoverWidth,
119
121
  onOpenChange: (next) => {
120
122
  setOpen(next);
121
123
  if (next) {
@@ -20,6 +20,7 @@ interface MultiSelectProps<T> {
20
20
  searchable?: boolean;
21
21
  searchPlaceholder?: string;
22
22
  emptyMessage?: string;
23
+ popoverWidth?: string;
23
24
  }
24
- export declare function MultiSelect<T extends string | number>({ options, selectedValues, onChange, placeholder, children, variant, size, onClear, dataCy, fullWidth, disabled, searchable, searchPlaceholder, emptyMessage, }: MultiSelectProps<T>): ReactNode;
25
+ export declare function MultiSelect<T extends string | number>({ options, selectedValues, onChange, placeholder, children, variant, size, onClear, dataCy, fullWidth, disabled, searchable, searchPlaceholder, emptyMessage, popoverWidth, }: MultiSelectProps<T>): ReactNode;
25
26
  export {};
@@ -23,7 +23,8 @@ function MultiSelect({
23
23
  disabled = false,
24
24
  searchable = false,
25
25
  searchPlaceholder = "S\xF8g",
26
- emptyMessage = "Ingen resultater"
26
+ emptyMessage = "Ingen resultater",
27
+ popoverWidth
27
28
  }) {
28
29
  const selectedSet = useMemo(() => new Set(selectedValues), [selectedValues]);
29
30
  const popoverRef = useRef(null);
@@ -114,6 +115,7 @@ function MultiSelect({
114
115
  {
115
116
  ref: popoverRef,
116
117
  open,
118
+ minWidth: popoverWidth,
117
119
  onOpenChange: (next) => {
118
120
  setOpen(next);
119
121
  if (next) {
@@ -14,7 +14,8 @@ const SeverityIcon = {
14
14
  error: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleX, {}),
15
15
  info: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, {}),
16
16
  warning: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleAlert, {}),
17
- brand: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Building2, {})
17
+ brand: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Building2, {}),
18
+ accent: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, {})
18
19
  };
19
20
  function Icon({ severity, label, customIcon }) {
20
21
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.container}`, children: [
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { Building2, CircleAlert, Info, CircleX, CircleCheck } from 'lucide-react';
2
+ import { Sparkles, Building2, CircleAlert, Info, CircleX, CircleCheck } from 'lucide-react';
3
3
  import styles from './Icon.module.css';
4
4
 
5
5
  const SeverityIcon = {
@@ -8,7 +8,8 @@ const SeverityIcon = {
8
8
  error: /* @__PURE__ */ jsx(CircleX, {}),
9
9
  info: /* @__PURE__ */ jsx(Info, {}),
10
10
  warning: /* @__PURE__ */ jsx(CircleAlert, {}),
11
- brand: /* @__PURE__ */ jsx(Building2, {})
11
+ brand: /* @__PURE__ */ jsx(Building2, {}),
12
+ accent: /* @__PURE__ */ jsx(Sparkles, {})
12
13
  };
13
14
  function Icon({ severity, label, customIcon }) {
14
15
  return /* @__PURE__ */ jsxs("div", { className: `${styles.container}`, children: [
@@ -35,3 +35,7 @@
35
35
  .brand {
36
36
  color: var(--color-fg-on-brand);
37
37
  }
38
+
39
+ .accent {
40
+ color: var(--color-accent);
41
+ }
@@ -90,3 +90,9 @@
90
90
  --inline-status-fg: var(--color-brand);
91
91
  --inline-status-border: color-mix(in srgb, var(--color-brand) 35%, transparent);
92
92
  }
93
+
94
+ .accent {
95
+ --inline-status-bg: var(--color-accent-bg);
96
+ --inline-status-fg: var(--color-accent-fg);
97
+ --inline-status-border: var(--color-accent-border);
98
+ }
@@ -57,6 +57,11 @@
57
57
  color: var(--color-fg-on-brand);
58
58
  }
59
59
 
60
+ .tile[data-severity='accent'] {
61
+ background-color: var(--color-accent-bg-soft);
62
+ color: var(--color-accent-fg-soft);
63
+ }
64
+
60
65
  .label {
61
66
  font-size: var(--font-size-xs);
62
67
  font-weight: var(--font-weight-semibold, 600);
@@ -16,6 +16,7 @@
16
16
  --progress-fill-info: color-mix(in srgb, var(--color-status-info) 70%, transparent);
17
17
  --progress-fill-warning: color-mix(in srgb, var(--color-status-warning) 70%, transparent);
18
18
  --progress-fill-error: color-mix(in srgb, var(--color-status-error) 75%, transparent);
19
+ --progress-fill-accent: color-mix(in srgb, var(--color-accent) 75%, transparent);
19
20
 
20
21
  position: relative;
21
22
  width: 100%;
@@ -106,6 +107,10 @@
106
107
  background: var(--progress-fill-error);
107
108
  }
108
109
 
110
+ .progressSegment[data-severity='accent'] {
111
+ background: var(--progress-fill-accent);
112
+ }
113
+
109
114
  /* Label overlay */
110
115
  .progressCenter {
111
116
  position: absolute;
@@ -41,6 +41,10 @@
41
41
  border-left-color: var(--color-brand);
42
42
  }
43
43
 
44
+ .accent {
45
+ border-left-color: var(--color-accent);
46
+ }
47
+
44
48
  .success {
45
49
  border-left-color: var(--color-status-success);
46
50
  }
@@ -3,6 +3,7 @@
3
3
  const SeverityBgColor = {
4
4
  neutral: "var(--color-neutral-strong)",
5
5
  brand: "var(--color-brand)",
6
+ accent: "var(--color-accent)",
6
7
  success: "var(--color-status-success)",
7
8
  error: "var(--color-status-error)",
8
9
  info: "var(--color-status-info)",
@@ -11,6 +12,7 @@ const SeverityBgColor = {
11
12
  const SeverityBorderColor = {
12
13
  neutral: "var(--color-neutral-strong)",
13
14
  brand: "var(--color-brand)",
15
+ accent: "var(--color-accent-border)",
14
16
  success: "var(--color-status-success-border)",
15
17
  error: "var(--color-status-error-border)",
16
18
  info: "var(--color-status-info-border)",
@@ -19,6 +21,7 @@ const SeverityBorderColor = {
19
21
  const SeverityTextColor = {
20
22
  neutral: "var(--color-neutral-strong-fg)",
21
23
  brand: "var(--color-fg-on-brand)",
24
+ accent: "var(--color-accent-fg)",
22
25
  success: "var(--color-status-success-fg)",
23
26
  error: "var(--color-status-error-fg)",
24
27
  info: "var(--color-status-info-fg)",
@@ -1,6 +1,7 @@
1
1
  const SeverityBgColor = {
2
2
  neutral: "var(--color-neutral-strong)",
3
3
  brand: "var(--color-brand)",
4
+ accent: "var(--color-accent)",
4
5
  success: "var(--color-status-success)",
5
6
  error: "var(--color-status-error)",
6
7
  info: "var(--color-status-info)",
@@ -9,6 +10,7 @@ const SeverityBgColor = {
9
10
  const SeverityBorderColor = {
10
11
  neutral: "var(--color-neutral-strong)",
11
12
  brand: "var(--color-brand)",
13
+ accent: "var(--color-accent-border)",
12
14
  success: "var(--color-status-success-border)",
13
15
  error: "var(--color-status-error-border)",
14
16
  info: "var(--color-status-info-border)",
@@ -17,6 +19,7 @@ const SeverityBorderColor = {
17
19
  const SeverityTextColor = {
18
20
  neutral: "var(--color-neutral-strong-fg)",
19
21
  brand: "var(--color-fg-on-brand)",
22
+ accent: "var(--color-accent-fg)",
20
23
  success: "var(--color-status-success-fg)",
21
24
  error: "var(--color-status-error-fg)",
22
25
  info: "var(--color-status-info-fg)",
@@ -1 +1 @@
1
- export type Severity = 'neutral' | 'brand' | 'success' | 'error' | 'info' | 'warning';
1
+ export type Severity = 'neutral' | 'brand' | 'accent' | 'success' | 'error' | 'info' | 'warning';
@@ -43,6 +43,9 @@ html {
43
43
  /* Accents */
44
44
  --dbc-pink-500: light-dark(#ec4899, #f472b6);
45
45
  --dbc-pink-600: light-dark(#be185d, #db2777);
46
+ --dbc-magenta-500: light-dark(#d946ef, #e879f9);
47
+ --dbc-magenta-100: light-dark(#fae8ff, #3b0a45);
48
+ --dbc-magenta-700: light-dark(#a21caf, #f5d0fe);
46
49
 
47
50
  --dbc-gray-500: light-dark(#6b7280, #9ca3af);
48
51
  --dbc-gray-600: light-dark(#4b5563, #6b7280);
@@ -77,6 +80,11 @@ html {
77
80
  --color-brand: var(--dbc-blue-500);
78
81
  --color-brand-hover: var(--dbc-blue-600);
79
82
  --color-brand-strong: var(--dbc-blue-600);
83
+ --color-accent: var(--dbc-magenta-500);
84
+ --color-accent-bg: var(--dbc-magenta-100);
85
+ --color-accent-border: color-mix(in srgb, var(--dbc-magenta-500) 24%, transparent);
86
+ --color-accent-fg: var(--dbc-magenta-700);
87
+ --color-fg-on-accent: light-dark(#ffffff, #111827);
80
88
 
81
89
  /* Backgrounds & surfaces */
82
90
  --color-bg-page: light-dark(#ffffff, #111827);
@@ -176,6 +184,8 @@ html {
176
184
  --color-status-warning-fg-soft: var(--color-status-warning-fg);
177
185
  --color-status-error-fg-soft: var(--color-status-error-fg);
178
186
  --color-status-info-fg-soft: var(--color-status-info-fg);
187
+ --color-accent-bg-soft: color-mix(in srgb, var(--color-accent) 10%, var(--color-bg-surface));
188
+ --color-accent-fg-soft: var(--color-accent-fg);
179
189
 
180
190
  /* Chart colors */
181
191
  --color-chart-empty: color-mix(in srgb, var(--color-fg-muted) 10%, rgb(255 255 255 / 0));
@@ -184,6 +194,7 @@ html {
184
194
  --color-chart-success: color-mix(in srgb, var(--dbc-green-500) 75%, rgb(255 255 255 / 0));
185
195
  --color-chart-warning: color-mix(in srgb, var(--dbc-amber-400) 75%, rgb(255 255 255 / 0));
186
196
  --color-chart-brand: color-mix(in srgb, var(--dbc-pink-500) 75%, rgb(255 255 255 / 0));
197
+ --color-chart-accent: color-mix(in srgb, var(--dbc-magenta-500) 75%, rgb(255 255 255 / 0));
187
198
  --color-chart-info: color-mix(in srgb, var(--dbc-info-500) 75%, rgb(255 255 255 / 0));
188
199
  --color-chart-error: color-mix(in srgb, var(--dbc-red-600) 75%, rgb(255 255 255 / 0));
189
200
 
@@ -192,6 +203,7 @@ html {
192
203
  --color-chart-green: var(--color-chart-success);
193
204
  --color-chart-amber: var(--color-chart-warning);
194
205
  --color-chart-pink: var(--color-chart-brand);
206
+ --color-chart-magenta: var(--color-chart-accent);
195
207
  --color-chart-sky: var(--color-chart-info);
196
208
  --color-chart-red: var(--color-chart-error);
197
209
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.151",
3
+ "version": "0.0.153",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",