@dbcdk/react-components 0.0.147 → 0.0.148

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.
@@ -8,7 +8,10 @@
8
8
  color: var(--color-fg-default);
9
9
  font-family: var(--font-family);
10
10
  font-weight: var(--font-weight-default);
11
- line-height: var(--line-height-tight);
11
+ /* All text here is single-line and vertically centered via flex, so use a
12
+ tight line-height instead of the paragraph-oriented default — that
13
+ avoids uneven leading around the glyphs at different font-sizes. */
14
+ line-height: 1;
12
15
  --attribute-chip-padding-inline: var(--spacing-xxs);
13
16
  --attribute-chip-value-bleed: calc(
14
17
  (var(--attribute-chip-padding-inline) - var(--spacing-2xs)) * -1
@@ -20,6 +23,7 @@
20
23
  .value {
21
24
  display: inline-flex;
22
25
  align-items: center;
26
+ height: 100%;
23
27
  }
24
28
 
25
29
  .label {
@@ -19,6 +19,8 @@ function Checkbox({
19
19
  disabled,
20
20
  label,
21
21
  labelAs = "label",
22
+ endAdornment,
23
+ endAdornmentAriaHidden = true,
22
24
  size = "md",
23
25
  modified,
24
26
  containerLabel,
@@ -70,7 +72,8 @@ function Checkbox({
70
72
  children: isChecked && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: styles__default.default.icon })
71
73
  }
72
74
  ) }),
73
- label && (labelAs === "label" ? /* @__PURE__ */ jsxRuntime.jsx("label", { className: styles__default.default.label, htmlFor: controlId, children: label }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.label, children: label }))
75
+ label && (labelAs === "label" ? /* @__PURE__ */ jsxRuntime.jsx("label", { className: styles__default.default.label, htmlFor: controlId, children: label }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.label, children: label })),
76
+ endAdornment && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.endAdornment, "aria-hidden": endAdornmentAriaHidden, children: endAdornment })
74
77
  ]
75
78
  }
76
79
  );
@@ -11,6 +11,16 @@ interface CheckboxProps {
11
11
  modified?: boolean;
12
12
  label?: ReactNode;
13
13
  labelAs?: 'label' | 'span';
14
+ /**
15
+ * Extra content rendered after the label (e.g. a status dot or badge).
16
+ * The component owns the layout/spacing for this slot.
17
+ */
18
+ endAdornment?: ReactNode;
19
+ /**
20
+ * Whether the endAdornment wrapper is hidden from assistive tech.
21
+ * Defaults to true since endAdornment is typically decorative.
22
+ */
23
+ endAdornmentAriaHidden?: boolean;
14
24
  size?: Size;
15
25
  containerLabel?: string;
16
26
  error?: string;
@@ -25,5 +35,5 @@ interface CheckboxProps {
25
35
  tooltip?: ReactNode;
26
36
  tooltipPlacement?: TooltipPlacement;
27
37
  }
28
- export declare function Checkbox({ checked: controlled, onChange, variant, disabled, label, labelAs, size, modified, containerLabel, error, helpText, orientation, labelWidth, fullWidth, required, noContainer, id, 'data-cy': dataCy, tooltip, tooltipPlacement, }: CheckboxProps): JSX.Element;
38
+ export declare function Checkbox({ checked: controlled, onChange, variant, disabled, label, labelAs, endAdornment, endAdornmentAriaHidden, size, modified, containerLabel, error, helpText, orientation, labelWidth, fullWidth, required, noContainer, id, 'data-cy': dataCy, tooltip, tooltipPlacement, }: CheckboxProps): JSX.Element;
29
39
  export {};
@@ -13,6 +13,8 @@ function Checkbox({
13
13
  disabled,
14
14
  label,
15
15
  labelAs = "label",
16
+ endAdornment,
17
+ endAdornmentAriaHidden = true,
16
18
  size = "md",
17
19
  modified,
18
20
  containerLabel,
@@ -64,7 +66,8 @@ function Checkbox({
64
66
  children: isChecked && /* @__PURE__ */ jsx(Check, { className: styles.icon })
65
67
  }
66
68
  ) }),
67
- label && (labelAs === "label" ? /* @__PURE__ */ jsx("label", { className: styles.label, htmlFor: controlId, children: label }) : /* @__PURE__ */ jsx("span", { className: styles.label, children: label }))
69
+ label && (labelAs === "label" ? /* @__PURE__ */ jsx("label", { className: styles.label, htmlFor: controlId, children: label }) : /* @__PURE__ */ jsx("span", { className: styles.label, children: label })),
70
+ endAdornment && /* @__PURE__ */ jsx("span", { className: styles.endAdornment, "aria-hidden": endAdornmentAriaHidden, children: endAdornment })
68
71
  ]
69
72
  }
70
73
  );
@@ -44,6 +44,12 @@
44
44
  word-break: break-word;
45
45
  }
46
46
 
47
+ .endAdornment {
48
+ display: inline-flex;
49
+ align-items: center;
50
+ flex: 0 0 auto;
51
+ }
52
+
47
53
  .checkbox:hover {
48
54
  border-color: var(--color-fg-default);
49
55
  }
@@ -18,6 +18,8 @@ function RadioButton({
18
18
  onChange,
19
19
  disabled,
20
20
  label,
21
+ endAdornment,
22
+ endAdornmentAriaHidden = true,
21
23
  variant = "outlined",
22
24
  size = "md",
23
25
  containerLabel,
@@ -69,7 +71,8 @@ function RadioButton({
69
71
  }
70
72
  )
71
73
  ] }),
72
- label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: styles__default.default.label, htmlFor: controlId, children: label })
74
+ label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: styles__default.default.label, htmlFor: controlId, children: label }),
75
+ endAdornment && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.endAdornment, "aria-hidden": endAdornmentAriaHidden, children: endAdornment })
73
76
  ] });
74
77
  if (noContainer || !containerLabel && !error) return content;
75
78
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -15,6 +15,16 @@ export interface RadioButtonProps {
15
15
  onChange?: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;
16
16
  disabled?: boolean;
17
17
  label?: string;
18
+ /**
19
+ * Extra content rendered after the label (e.g. a status dot or badge).
20
+ * The component owns the layout/spacing for this slot.
21
+ */
22
+ endAdornment?: React.ReactNode;
23
+ /**
24
+ * Whether the endAdornment wrapper is hidden from assistive tech.
25
+ * Defaults to true since endAdornment is typically decorative.
26
+ */
27
+ endAdornmentAriaHidden?: boolean;
18
28
  variant?: Variant;
19
29
  size?: Size;
20
30
  containerLabel?: string;
@@ -32,5 +42,5 @@ export interface RadioButtonProps {
32
42
  id?: string;
33
43
  'data-cy'?: string;
34
44
  }
35
- export declare function RadioButton({ name, value, selectedValue, checked, onChange, disabled, label, variant, size, containerLabel, error, helpText, orientation, labelWidth, fullWidth, required, noContainer, id, 'data-cy': dataCy, }: RadioButtonProps): JSX.Element;
45
+ export declare function RadioButton({ name, value, selectedValue, checked, onChange, disabled, label, endAdornment, endAdornmentAriaHidden, variant, size, containerLabel, error, helpText, orientation, labelWidth, fullWidth, required, noContainer, id, 'data-cy': dataCy, }: RadioButtonProps): JSX.Element;
36
46
  export {};
@@ -12,6 +12,8 @@ function RadioButton({
12
12
  onChange,
13
13
  disabled,
14
14
  label,
15
+ endAdornment,
16
+ endAdornmentAriaHidden = true,
15
17
  variant = "outlined",
16
18
  size = "md",
17
19
  containerLabel,
@@ -63,7 +65,8 @@ function RadioButton({
63
65
  }
64
66
  )
65
67
  ] }),
66
- label && /* @__PURE__ */ jsx("label", { className: styles.label, htmlFor: controlId, children: label })
68
+ label && /* @__PURE__ */ jsx("label", { className: styles.label, htmlFor: controlId, children: label }),
69
+ endAdornment && /* @__PURE__ */ jsx("span", { className: styles.endAdornment, "aria-hidden": endAdornmentAriaHidden, children: endAdornment })
67
70
  ] });
68
71
  if (noContainer || !containerLabel && !error) return content;
69
72
  return /* @__PURE__ */ jsx(
@@ -81,6 +81,12 @@
81
81
  flex: 1;
82
82
  }
83
83
 
84
+ .endAdornment {
85
+ display: inline-flex;
86
+ align-items: center;
87
+ flex: 0 0 auto;
88
+ }
89
+
84
90
  .primary.checked {
85
91
  background: color-mix(in srgb, var(--color-brand) 10%, var(--color-bg-surface));
86
92
  }
@@ -153,6 +153,8 @@ const MenuCheckItem = React__namespace.forwardRef(
153
153
  interactiveRef,
154
154
  interactiveProps,
155
155
  onCheckedChange,
156
+ endAdornment,
157
+ endAdornmentAriaHidden,
156
158
  className,
157
159
  ...liProps
158
160
  }, ref) => {
@@ -200,6 +202,8 @@ const MenuCheckItem = React__namespace.forwardRef(
200
202
  disabled,
201
203
  labelAs: "span",
202
204
  label,
205
+ endAdornment,
206
+ endAdornmentAriaHidden,
203
207
  onChange: (next, _e) => onCheckedChange == null ? void 0 : onCheckedChange(next)
204
208
  }
205
209
  )
@@ -221,6 +225,8 @@ const MenuRadioItem = React__namespace.forwardRef(
221
225
  interactiveRef,
222
226
  interactiveProps,
223
227
  onValueChange,
228
+ endAdornment,
229
+ endAdornmentAriaHidden,
224
230
  className,
225
231
  ...liProps
226
232
  }, ref) => {
@@ -277,6 +283,8 @@ const MenuRadioItem = React__namespace.forwardRef(
277
283
  checked,
278
284
  disabled,
279
285
  label,
286
+ endAdornment,
287
+ endAdornmentAriaHidden,
280
288
  onChange: (v, _e) => onValueChange == null ? void 0 : onValueChange(v)
281
289
  }
282
290
  )
@@ -35,6 +35,13 @@ export interface MenuCheckItemProps extends Omit<React.LiHTMLAttributes<HTMLLIEl
35
35
  interactiveRef?: React.Ref<HTMLDivElement>;
36
36
  interactiveProps?: React.HTMLAttributes<HTMLDivElement>;
37
37
  onCheckedChange?: (checked: boolean) => void;
38
+ /**
39
+ * Extra content rendered after the label (e.g. a status dot or badge).
40
+ * Forwarded to the underlying Checkbox, which owns the layout/spacing.
41
+ */
42
+ endAdornment?: React.ReactNode;
43
+ /** Forwarded to the underlying Checkbox. Defaults to true. */
44
+ endAdornmentAriaHidden?: boolean;
38
45
  }
39
46
  export interface MenuRadioItemProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, 'onChange'> {
40
47
  name: string;
@@ -46,6 +53,13 @@ export interface MenuRadioItemProps extends Omit<React.LiHTMLAttributes<HTMLLIEl
46
53
  interactiveRef?: React.Ref<HTMLDivElement>;
47
54
  interactiveProps?: React.HTMLAttributes<HTMLDivElement>;
48
55
  onValueChange?: (value: string) => void;
56
+ /**
57
+ * Extra content rendered after the label (e.g. a status dot or badge).
58
+ * Forwarded to the underlying RadioButton, which owns the layout/spacing.
59
+ */
60
+ endAdornment?: React.ReactNode;
61
+ /** Forwarded to the underlying RadioButton. Defaults to true. */
62
+ endAdornmentAriaHidden?: boolean;
49
63
  }
50
64
  export declare const Menu: React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<HTMLUListElement>> & {
51
65
  Item: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLLIElement>>;
@@ -128,6 +128,8 @@ const MenuCheckItem = React.forwardRef(
128
128
  interactiveRef,
129
129
  interactiveProps,
130
130
  onCheckedChange,
131
+ endAdornment,
132
+ endAdornmentAriaHidden,
131
133
  className,
132
134
  ...liProps
133
135
  }, ref) => {
@@ -175,6 +177,8 @@ const MenuCheckItem = React.forwardRef(
175
177
  disabled,
176
178
  labelAs: "span",
177
179
  label,
180
+ endAdornment,
181
+ endAdornmentAriaHidden,
178
182
  onChange: (next, _e) => onCheckedChange == null ? void 0 : onCheckedChange(next)
179
183
  }
180
184
  )
@@ -196,6 +200,8 @@ const MenuRadioItem = React.forwardRef(
196
200
  interactiveRef,
197
201
  interactiveProps,
198
202
  onValueChange,
203
+ endAdornment,
204
+ endAdornmentAriaHidden,
199
205
  className,
200
206
  ...liProps
201
207
  }, ref) => {
@@ -252,6 +258,8 @@ const MenuRadioItem = React.forwardRef(
252
258
  checked,
253
259
  disabled,
254
260
  label,
261
+ endAdornment,
262
+ endAdornmentAriaHidden,
255
263
  onChange: (v, _e) => onValueChange == null ? void 0 : onValueChange(v)
256
264
  }
257
265
  )
@@ -176,7 +176,7 @@
176
176
  display: flex;
177
177
  justify-content: center;
178
178
  width: 100%;
179
- padding-inline: var(--spacing-xl);
179
+ padding-inline: var(--spacing-md);
180
180
  }
181
181
 
182
182
  .headerContent {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.147",
3
+ "version": "0.0.148",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",