@dbcdk/react-components 0.0.144 → 0.0.146

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.
@@ -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 :is(p, ol, li) {
10
+ line-height: var(--line-height-relaxed);
11
+ }
@@ -229,7 +229,18 @@ body.dbc-app {
229
229
  color: var(--color-highlight-fg, inherit);
230
230
  background-color: var(--color-highlight-bg, var(--color-status-warning-bg));
231
231
  border-radius: var(--border-radius-sm);
232
- padding-inline: var(--spacing-2xs);
232
+ padding-inline: var(--spacing-xs);
233
+ box-decoration-break: clone;
234
+ -webkit-box-decoration-break: clone;
235
+ }
236
+
237
+ .dbc-code {
238
+ color: var(--color-code-fg, inherit);
239
+ background-color: var(--color-code-bg, var(--color-bg-contextual));
240
+ border-radius: var(--border-radius-sm);
241
+ padding-inline: var(--spacing-xs);
242
+ font-family: var(--font-family-mono);
243
+ font-size: 0.9em;
233
244
  box-decoration-break: clone;
234
245
  -webkit-box-decoration-break: clone;
235
246
  }
package/dist/styles.css CHANGED
@@ -229,7 +229,18 @@ body.dbc-app {
229
229
  color: var(--color-highlight-fg, inherit);
230
230
  background-color: var(--color-highlight-bg, var(--color-status-warning-bg));
231
231
  border-radius: var(--border-radius-sm);
232
- padding-inline: var(--spacing-2xs);
232
+ padding-inline: var(--spacing-xs);
233
+ box-decoration-break: clone;
234
+ -webkit-box-decoration-break: clone;
235
+ }
236
+
237
+ .dbc-code {
238
+ color: var(--color-code-fg, inherit);
239
+ background-color: var(--color-code-bg, var(--color-bg-contextual));
240
+ border-radius: var(--border-radius-sm);
241
+ padding-inline: var(--spacing-xs);
242
+ font-family: var(--font-family-mono);
243
+ font-size: 0.9em;
233
244
  box-decoration-break: clone;
234
245
  -webkit-box-decoration-break: clone;
235
246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.144",
3
+ "version": "0.0.146",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",