@dbcdk/react-components 0.0.143 → 0.0.145

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.
@@ -14,7 +14,10 @@ function AttributeChip({
14
14
  loading
15
15
  }) {
16
16
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.container} ${styles__default.default[size]}`, "aria-busy": loading, children: [
17
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.label, children: label }),
17
+ label ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
18
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.label, children: label }),
19
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.separator, "aria-hidden": "true", children: "|" })
20
+ ] }) : null,
18
21
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.value, children: loading ? "\u2014" : value == null ? void 0 : value.toString() })
19
22
  ] });
20
23
  }
@@ -1,6 +1,6 @@
1
1
  import type { JSX } from 'react';
2
2
  interface AttributeChipProps {
3
- label: string;
3
+ label?: string;
4
4
  value: string | number | boolean;
5
5
  loading?: boolean;
6
6
  size?: 'sm' | 'md' | 'lg';
@@ -1,4 +1,4 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import styles from './AttributeChip.module.css';
3
3
 
4
4
  function AttributeChip({
@@ -8,7 +8,10 @@ function AttributeChip({
8
8
  loading
9
9
  }) {
10
10
  return /* @__PURE__ */ jsxs("div", { className: `${styles.container} ${styles[size]}`, "aria-busy": loading, children: [
11
- /* @__PURE__ */ jsx("span", { className: styles.label, children: label }),
11
+ label ? /* @__PURE__ */ jsxs(Fragment, { children: [
12
+ /* @__PURE__ */ jsx("span", { className: styles.label, children: label }),
13
+ /* @__PURE__ */ jsx("span", { className: styles.separator, "aria-hidden": "true", children: "|" })
14
+ ] }) : null,
12
15
  /* @__PURE__ */ jsx("span", { className: styles.value, children: loading ? "\u2014" : value == null ? void 0 : value.toString() })
13
16
  ] });
14
17
  }
@@ -4,62 +4,49 @@
4
4
  white-space: nowrap;
5
5
  border-radius: var(--border-radius-default);
6
6
  border: 1px solid var(--color-border-subtle);
7
- overflow: hidden;
7
+ background: var(--color-neutral);
8
+ color: var(--color-fg-default);
8
9
  font-family: var(--font-family);
9
10
  font-weight: var(--font-weight-default);
10
11
  line-height: var(--line-height-tight);
12
+ padding-inline: var(--spacing-sm);
11
13
  }
12
14
 
13
15
  .label,
14
16
  .value {
15
17
  display: inline-flex;
16
18
  align-items: center;
17
- height: 100%;
18
- padding-inline: var(--spacing-sm);
19
19
  }
20
20
 
21
21
  .label {
22
- background: var(--color-bg-contextual);
22
+ color: var(--color-fg-subtle);
23
+ font-size: 0.85em;
23
24
  }
24
25
 
25
26
  .value {
26
- background: var(--color-bg-contextual-subtle);
27
- color: var(--color-fg-default);
28
27
  font-weight: var(--font-weight-medium);
29
28
  }
30
29
 
31
- /* Optional: separator between label and value */
32
- .value {
33
- border-left: 1px solid var(--color-border-subtle);
30
+ .separator {
31
+ color: var(--color-border-default);
32
+ margin-inline: var(--spacing-xxs);
34
33
  }
35
34
 
36
35
  /* Sizes */
37
36
  .sm {
38
37
  height: var(--component-size-xs);
39
38
  font-size: var(--font-size-xs);
39
+ padding-inline: var(--spacing-xs);
40
40
  }
41
41
 
42
42
  .md {
43
43
  height: var(--component-size-sm);
44
44
  font-size: var(--font-size-sm);
45
+ padding-inline: var(--spacing-sm);
45
46
  }
46
47
 
47
48
  .lg {
48
49
  height: var(--component-size-md);
49
50
  font-size: var(--font-size-md);
50
- }
51
-
52
- .sm .label,
53
- .sm .value {
54
- padding-inline: var(--spacing-xs);
55
- }
56
-
57
- .md .label,
58
- .md .value {
59
- padding-inline: var(--spacing-sm);
60
- }
61
-
62
- .lg .label,
63
- .lg .value {
64
51
  padding-inline: var(--spacing-md);
65
52
  }
@@ -31,10 +31,15 @@ var styles__default = /*#__PURE__*/_interopDefault(styles);
31
31
  function cx(...parts) {
32
32
  return parts.filter(Boolean).join(" ");
33
33
  }
34
- function renderInner(children, icon) {
35
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
36
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.content, children }),
37
- icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.icon, children: icon })
34
+ function renderInner(children, icon, iconPosition = "after") {
35
+ const iconEl = icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.icon, children: icon });
36
+ const contentEl = /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.content, children });
37
+ return iconPosition === "before" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
38
+ iconEl,
39
+ contentEl
40
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
41
+ contentEl,
42
+ iconEl
38
43
  ] });
39
44
  }
40
45
  function Hyperlink(props) {
@@ -42,6 +47,7 @@ function Hyperlink(props) {
42
47
  const {
43
48
  children,
44
49
  icon,
50
+ iconPosition = "after",
45
51
  className,
46
52
  asChild,
47
53
  as = "a",
@@ -67,7 +73,7 @@ function Hyperlink(props) {
67
73
  ...childProps,
68
74
  ...rest,
69
75
  className: cx(childProps.className, linkClassName),
70
- children: renderInner(childProps.children, icon),
76
+ children: renderInner(childProps.children, icon, iconPosition),
71
77
  "aria-disabled": disabled || void 0,
72
78
  onClick: (e) => {
73
79
  e.stopPropagation();
@@ -85,7 +91,7 @@ function Hyperlink(props) {
85
91
  className: linkClassName,
86
92
  disabled,
87
93
  ...rest,
88
- children: renderInner(children, icon)
94
+ children: renderInner(children, icon, iconPosition)
89
95
  }
90
96
  );
91
97
  }
@@ -99,7 +105,7 @@ function Hyperlink(props) {
99
105
  className: linkClassName,
100
106
  "aria-disabled": disabled || void 0,
101
107
  ...rest,
102
- children: renderInner(children, icon)
108
+ children: renderInner(children, icon, iconPosition)
103
109
  }
104
110
  );
105
111
  }
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  type BaseProps = {
3
3
  children: React.ReactNode;
4
4
  icon?: React.ReactNode;
5
+ iconPosition?: 'before' | 'after';
5
6
  className?: string;
6
7
  /**
7
8
  * If true, Hyperlink will NOT render <a>.
@@ -6,10 +6,15 @@ import styles from './Hyperlink.module.css';
6
6
  function cx(...parts) {
7
7
  return parts.filter(Boolean).join(" ");
8
8
  }
9
- function renderInner(children, icon) {
10
- return /* @__PURE__ */ jsxs(Fragment, { children: [
11
- /* @__PURE__ */ jsx("span", { className: styles.content, children }),
12
- icon && /* @__PURE__ */ jsx("span", { className: styles.icon, children: icon })
9
+ function renderInner(children, icon, iconPosition = "after") {
10
+ const iconEl = icon && /* @__PURE__ */ jsx("span", { className: styles.icon, children: icon });
11
+ const contentEl = /* @__PURE__ */ jsx("span", { className: styles.content, children });
12
+ return iconPosition === "before" ? /* @__PURE__ */ jsxs(Fragment, { children: [
13
+ iconEl,
14
+ contentEl
15
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
16
+ contentEl,
17
+ iconEl
13
18
  ] });
14
19
  }
15
20
  function Hyperlink(props) {
@@ -17,6 +22,7 @@ function Hyperlink(props) {
17
22
  const {
18
23
  children,
19
24
  icon,
25
+ iconPosition = "after",
20
26
  className,
21
27
  asChild,
22
28
  as = "a",
@@ -42,7 +48,7 @@ function Hyperlink(props) {
42
48
  ...childProps,
43
49
  ...rest,
44
50
  className: cx(childProps.className, linkClassName),
45
- children: renderInner(childProps.children, icon),
51
+ children: renderInner(childProps.children, icon, iconPosition),
46
52
  "aria-disabled": disabled || void 0,
47
53
  onClick: (e) => {
48
54
  e.stopPropagation();
@@ -60,7 +66,7 @@ function Hyperlink(props) {
60
66
  className: linkClassName,
61
67
  disabled,
62
68
  ...rest,
63
- children: renderInner(children, icon)
69
+ children: renderInner(children, icon, iconPosition)
64
70
  }
65
71
  );
66
72
  }
@@ -74,7 +80,7 @@ function Hyperlink(props) {
74
80
  className: linkClassName,
75
81
  "aria-disabled": disabled || void 0,
76
82
  ...rest,
77
- children: renderInner(children, icon)
83
+ children: renderInner(children, icon, iconPosition)
78
84
  }
79
85
  );
80
86
  }
@@ -1,7 +1,7 @@
1
1
  .link {
2
2
  display: inline-flex;
3
3
  align-items: center;
4
- gap: var(--spacing-xs);
4
+ gap: var(--spacing-2xs);
5
5
  position: relative;
6
6
  background: none;
7
7
  border: none;
@@ -5,3 +5,7 @@
5
5
  .dbc-strong-text {
6
6
  font-weight: var(--font-weight-semibold);
7
7
  }
8
+
9
+ .dbc-prose p {
10
+ line-height: var(--line-height-relaxed);
11
+ }
@@ -258,6 +258,10 @@ body.dbc-app {
258
258
  font-weight: var(--font-weight-medium);
259
259
  }
260
260
 
261
+ .dbc-bold-text {
262
+ font-weight: var(--font-weight-bold);
263
+ }
264
+
261
265
  /* ==========================================================================
262
266
  Layout utilities
263
267
  ========================================================================== */
package/dist/styles.css CHANGED
@@ -258,6 +258,10 @@ body.dbc-app {
258
258
  font-weight: var(--font-weight-medium);
259
259
  }
260
260
 
261
+ .dbc-bold-text {
262
+ font-weight: var(--font-weight-bold);
263
+ }
264
+
261
265
  /* ==========================================================================
262
266
  Layout utilities
263
267
  ========================================================================== */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.143",
3
+ "version": "0.0.145",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",