@synerise/ds-radio 2.0.11 → 2.1.0

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.1.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-radio@2.0.11...@synerise/ds-radio@2.1.0) (2026-10-29)
7
+
8
+
9
+ ### Features
10
+
11
+ * integrate Token Studio design tokens across the design system ([aabb447](https://github.com/synerise/synerise-design/commit/aabb447edfb2d0c85e3de1f07e809ef84083453b))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [2.0.11](https://github.com/synerise/synerise-design/compare/@synerise/ds-radio@2.0.10...@synerise/ds-radio@2.0.11) (2026-10-28)
7
18
 
8
19
  **Note:** Version bump only for package @synerise/ds-radio
package/CLAUDE.md CHANGED
@@ -29,6 +29,8 @@ Compound component: `Radio` + `Radio.Group` + `Radio.Button`.
29
29
  | Prop | Type | Default | Description |
30
30
  |------|------|---------|-------------|
31
31
  | `label` | `ReactNode` | `undefined` | Renders label text via `FormFieldLabel`. Takes precedence over `children` |
32
+ | `tooltip` | `ReactNode` | `undefined` | Info-icon tooltip next to `label` (via `FormFieldLabel`). Use it instead of nesting a `FormFieldLabel` in `children`: that renders a second `<label>`, and clicks on its text no longer select the radio |
33
+ | `tooltipConfig` | `TooltipProps` | `undefined` | Tooltip config for `tooltip`, as on `FormFieldLabel` |
32
34
  | `description` | `ReactNode` | `undefined` | Additional text rendered below the radio in small grey text |
33
35
  | `children` | `ReactNode` | `undefined` | **@deprecated** — use `label` instead. Only rendered when `label` is not provided |
34
36
  | `checked` | `boolean` | `undefined` | Controlled checked state |
@@ -86,11 +88,11 @@ import Radio from '@synerise/ds-radio';
86
88
 
87
89
  ## Styling
88
90
 
89
- Styles live in `Radio.styles.tsx`. **Each element is its own styled-component and owns its styles** — the `.ant-radio-*` / `ds-radio-*` class names are kept on the elements purely as hooks (ui-tests / interim external CSS), never used as styling selectors; state is passed in as transient `$`-props. Uses `@synerise/ds-core` theme tokens:
90
- - `grey-600` — `Description` text colour; `opacity: 0.4` applied on `disabled` to `Label`/`Description`/`RadioText`
91
+ Styles live in `Radio.styles.tsx`. **Each element is its own styled-component and owns its styles** — the `.ant-radio-*` / `ds-radio-*` class names are kept on the elements purely as hooks (ui-tests / interim external CSS), never used as styling selectors; state is passed in as transient `$`-props. The dot uses the `var(--ds-form-control-*)` tokens it shares with checkbox, the texts the shared `form-*` text tokens:
92
+ - `var(--ds-form-description-text-color)` — `Description` text colour; `RadioText` is `var(--ds-form-label-text-color)` in every state. `opacity: var(--ds-opacity-disabled)` is applied on `disabled` to `Description`/`RadioText`/`RadioInner`
91
93
  - `Label` extends `FormFieldLabel` from `@synerise/ds-form-field`
92
- - radio dot: `RadioBox` / `RadioInput` / `RadioInner` / `RadioText`. `RadioInner` is the 16px circle (`grey-300` border, blue-600 dot scaled in on `$checked`, greyed on `$disabled`); `RadioLabel` holds the cross-element hover-preview + focus-ring rules (`${RadioInput}:focus + ${RadioInner}`, white centre once `$checked`).
93
- - segmented button: `RadioButtonLabel` (+ `RadioButtonInput`) owns the full segment visual including the connected-border `:first-child`/`:last-child` rules and the `$solid`/`$checked`/`$disabled` variants — driven by `$`-props read from the group context, not by group-level `.ant-radio-button-*` selectors.
94
+ - radio dot: `RadioBox` / `RadioInput` / `RadioInner` / `RadioText`. `RadioInner` is the 16px circle (`var(--ds-form-control-bg-default)` fill, `var(--ds-form-control-border-default)` border; on `$checked` a `var(--ds-form-control-bg-selected)` border and dot scaled in). `$disabled` has no colours of its own — the circle keeps its resting or selected look and fades. `RadioLabel` holds the cross-element hover + focus-ring rules (`var(--ds-form-control-border-hover)` on an enabled input's hover; `${RadioInput}:focus + ${RadioInner}`, `var(--ds-form-control-bg-default)` centre once `$checked`).
95
+ - segmented button: `RadioButtonLabel` (+ `RadioButtonInput`) owns the full segment visual including the connected-border `:first-child`/`:last-child` rules and the `$solid`/`$checked`/`$disabled` variants — driven by `$`-props read from the group context, not by group-level `.ant-radio-button-*` selectors. It follows Button Toggle on the button tokens: unselected (incl. hover and focus) is `var(--ds-buttons-variant-secondary-*)`, selected solid is `var(--ds-buttons-variant-primary-*)`, selected outline is `var(--ds-color-background-brand-subtle)` + `var(--ds-color-text-brand-default)` with a `var(--ds-color-border-brand-default)` border.
94
96
  - `RadioGroupWrapper` is `inline-block` (vertical stacking) and, with `fullWidth`, switches to flex and stretches `${RadioLabel}`/`${RadioButtonLabel}` (`big` → 48px height).
95
97
  - `AdditionalData` is the margin wrapper for `Description`
96
98
 
package/dist/Radio.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * DS-native, antd-free radio. `Radio` (radio + label + description) with `Radio.Group` (single-select
3
3
  * context) and `Radio.Button` (segmented control) attached as static members.
4
4
  */
5
- declare const Radio: (({ value, checked, defaultChecked, disabled, name, id, autoFocus, tabIndex, onChange, onClick, label, description, children, className, style, ...rest }: import('./Radio.types').RadioProps) => import("react").JSX.Element) & {
5
+ declare const Radio: (({ value, checked, defaultChecked, disabled, name, id, autoFocus, tabIndex, onChange, onClick, label, tooltip, tooltipConfig, description, children, className, style, ...rest }: import('./Radio.types').RadioProps) => import("react").JSX.Element) & {
6
6
  Group: ({ value, defaultValue, onChange, options, optionType, buttonStyle, size, disabled, name, fullWidth, big, children, className, style, id, onFocus, onBlur, onMouseEnter, onMouseLeave, ...rest }: import('./Radio.types').RadioGroupProps) => import("react").JSX.Element;
7
7
  Button: ({ value, disabled, children, className, checked, onChange, onClick, style, ...rest }: import('./Radio.types').RadioButtonProps) => import("react").JSX.Element;
8
8
  };
@@ -2,9 +2,7 @@ export declare const RadioWrapper: import('styled-components').StyledComponent<"
2
2
  export declare const Description: import('styled-components').StyledComponent<"div", any, {
3
3
  disabled?: boolean;
4
4
  }, never>;
5
- export declare const Label: import('styled-components').StyledComponent<({ id, label, tooltip, tooltipConfig, children, ...htmlAttributes }: import('@synerise/ds-form-field').FormFieldLabelProps) => React.JSX.Element, any, {
6
- disabled?: boolean;
7
- }, never>;
5
+ export declare const Label: import('styled-components').StyledComponent<({ id, label, tooltip, tooltipConfig, children, ...htmlAttributes }: import('@synerise/ds-form-field').FormFieldLabelProps) => React.JSX.Element, any, {}, never>;
8
6
  export declare const AdditionalData: import('styled-components').StyledComponent<"div", any, {}, never>;
9
7
  export declare const RadioInput: import('styled-components').StyledComponent<"input", any, {}, never>;
10
8
  export declare const RadioInner: import('styled-components').StyledComponent<"span", any, {
@@ -12,7 +10,6 @@ export declare const RadioInner: import('styled-components').StyledComponent<"sp
12
10
  $disabled?: boolean;
13
11
  }, never>;
14
12
  export declare const RadioText: import('styled-components').StyledComponent<"span", any, {
15
- $checked?: boolean;
16
13
  $disabled?: boolean;
17
14
  }, never>;
18
15
  export declare const RadioBox: import('styled-components').StyledComponent<"span", any, {}, never>;
@@ -8,11 +8,11 @@ const RadioWrapper = /* @__PURE__ */ styled.div.withConfig({
8
8
  const Description = /* @__PURE__ */ styled.div.withConfig({
9
9
  displayName: "Radiostyles__Description",
10
10
  componentId: "sc-137n5jf-1"
11
- })(["color:", ";", " ", ""], (props) => props.theme.palette["grey-600"], (props) => props.disabled ? "opacity: 0.4;" : "", macro.small);
11
+ })(["color:var(--ds-form-description-text-color);", " ", ""], (props) => props.disabled ? `opacity: var(--ds-opacity-disabled);` : "", macro.small);
12
12
  const Label = /* @__PURE__ */ styled(FormFieldLabel).withConfig({
13
13
  displayName: "Radiostyles__Label",
14
14
  componentId: "sc-137n5jf-2"
15
- })(["", ""], (props) => props.disabled ? "opacity: 0.4;" : "");
15
+ })([""]);
16
16
  const AdditionalData = /* @__PURE__ */ styled.div.withConfig({
17
17
  displayName: "Radiostyles__AdditionalData",
18
18
  componentId: "sc-137n5jf-3"
@@ -24,11 +24,11 @@ const RadioInput = /* @__PURE__ */ styled.input.withConfig({
24
24
  const RadioInner = /* @__PURE__ */ styled.span.withConfig({
25
25
  displayName: "Radiostyles__RadioInner",
26
26
  componentId: "sc-137n5jf-5"
27
- })(["position:relative;display:block;width:16px;height:16px;box-sizing:border-box;background-color:", ";border:1px solid ", ";border-radius:50%;&::after{content:'';position:absolute;inset:0;margin:auto;width:8px;height:8px;border-radius:50%;background-color:", ";transform:scale(0);transition:transform 0.2s ease;}", " ", ""], (props) => props.theme.palette.white, (props) => props.theme.palette["grey-300"], (props) => props.theme.palette["blue-600"], (props) => props.$checked && css(["border-color:", ";border-width:2px;&::after{transform:scale(1);}"], props.theme.palette["blue-600"]), (props) => props.$disabled && css(["border-color:", " !important;background-color:", " !important;&::after{background-color:", ";}"], props.theme.palette["grey-200"], props.theme.palette["grey-050"], props.theme.palette["grey-400"]));
27
+ })(["position:relative;display:block;width:16px;height:16px;box-sizing:border-box;background-color:var(--ds-form-control-bg-default);border:1px solid var(--ds-form-control-border-default);border-radius:50%;&::after{content:'';position:absolute;inset:0;margin:auto;width:8px;height:8px;border-radius:50%;background-color:var(--ds-form-control-bg-selected);transform:scale(0);transition:transform 0.2s ease;}", " ", ""], (props) => props.$checked && css(["border-color:var(--ds-form-control-bg-selected);border-width:2px;&::after{transform:scale(1);}"]), (props) => props.$disabled && css(["opacity:var(--ds-opacity-disabled);"]));
28
28
  const RadioText = /* @__PURE__ */ styled.span.withConfig({
29
29
  displayName: "Radiostyles__RadioText",
30
30
  componentId: "sc-137n5jf-6"
31
- })(["flex-grow:1;margin:0 12px;padding:0;font-weight:500;color:", ";", ""], (props) => props.$checked ? props.theme.palette["grey-800"] : props.theme.palette["grey-700"], (props) => props.$disabled && css(["color:", ";opacity:0.4;"], props.theme.palette["grey-600"]));
31
+ })(["flex-grow:1;margin:0 12px;padding:0;font-weight:500;color:var(--ds-form-label-text-color);", ""], (props) => props.$disabled && css(["opacity:var(--ds-opacity-disabled);"]));
32
32
  const RadioBox = /* @__PURE__ */ styled.span.withConfig({
33
33
  displayName: "Radiostyles__RadioBox",
34
34
  componentId: "sc-137n5jf-7"
@@ -36,7 +36,7 @@ const RadioBox = /* @__PURE__ */ styled.span.withConfig({
36
36
  const RadioLabel = /* @__PURE__ */ styled.label.withConfig({
37
37
  displayName: "Radiostyles__RadioLabel",
38
38
  componentId: "sc-137n5jf-8"
39
- })(["display:flex;align-items:flex-start;margin:0 8px 0 0;cursor:pointer;white-space:normal;", ":hover + ", "{border-color:", ";}", ":focus + ", "{border-color:", ";background-color:", ";border-width:2px;}", ""], RadioInput, RadioInner, (props) => props.theme.palette["grey-400"], RadioInput, RadioInner, (props) => props.theme.palette["blue-600"], (props) => props.$checked ? props.theme.palette.white : props.theme.palette["blue-050"], (props) => props.$disabled && css(["cursor:not-allowed;", ",", "{cursor:not-allowed;}"], RadioBox, RadioInput));
39
+ })(["display:flex;align-items:flex-start;margin:0 8px 0 0;cursor:pointer;white-space:normal;", ":hover:not(:disabled) + ", "{border-color:var(--ds-form-control-border-hover);}", ":focus + ", "{border-color:var(--ds-color-focus-base-default);background-color:", ";border-width:2px;}", ""], RadioInput, RadioInner, RadioInput, RadioInner, (props) => props.$checked ? "var(--ds-form-control-bg-default)" : "var(--ds-form-field-bg-focus)", (props) => props.$disabled && css(["cursor:not-allowed;", ",", "{cursor:not-allowed;}"], RadioBox, RadioInput));
40
40
  const RadioButtonInput = /* @__PURE__ */ styled.input.withConfig({
41
41
  displayName: "Radiostyles__RadioButtonInput",
42
42
  componentId: "sc-137n5jf-9"
@@ -49,7 +49,7 @@ const BUTTON_HEIGHT = {
49
49
  const RadioButtonLabel = /* @__PURE__ */ styled.label.withConfig({
50
50
  displayName: "Radiostyles__RadioButtonLabel",
51
51
  componentId: "sc-137n5jf-10"
52
- })(["position:relative;display:inline-flex;align-items:center;justify-content:center;height:", ";margin:0;padding:0 16px;color:", ";background-color:", ";border:1px solid ", ";border-left-width:0;cursor:pointer;&:first-child{border-left:1px solid ", ";border-radius:3px 0 0 3px;}&:last-child{border-radius:0 3px 3px 0;}&:hover{background-color:", ";}&:focus-within{border-color:", ";box-shadow:inset 0 0 0 1px ", ";z-index:2;}", " ", " ", ""], (props) => BUTTON_HEIGHT[props.$size ?? "middle"], (props) => props.theme.palette["grey-700"], (props) => props.theme.palette["grey-050"], (props) => props.theme.palette["grey-300"], (props) => props.theme.palette["grey-300"], (props) => props.theme.palette.white, (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["blue-600"], (props) => props.$checked && css(["&&{color:", ";border-color:", ";box-shadow:-1px 0 0 0 ", ";z-index:1;}"], props.theme.palette["blue-600"], props.theme.palette["blue-600"], props.theme.palette["blue-600"]), (props) => props.$disabled && css(["color:", ";opacity:0.4;cursor:not-allowed;", "{cursor:not-allowed;}"], props.theme.palette["grey-700"], RadioButtonInput), (props) => props.$solid && props.$checked && !props.$disabled && css(["&&{color:", ";background-color:", ";border-color:", ";&:hover{background-color:", ";border-color:", ";box-shadow:-1px 0 0 0 ", ";}}"], props.theme.palette.white, props.theme.palette["blue-600"], props.theme.palette["blue-600"], props.theme.palette["blue-500"], props.theme.palette["blue-500"], props.theme.palette["blue-500"]));
52
+ })(["position:relative;display:inline-flex;align-items:center;justify-content:center;height:", ";margin:0;padding:0 16px;color:var(--ds-buttons-variant-secondary-text-default);background-color:var(--ds-buttons-variant-secondary-bg-default);border:1px solid var(--ds-buttons-variant-secondary-border-default);border-left-width:0;cursor:pointer;&:first-child{border-left:1px solid var(--ds-buttons-variant-secondary-border-default);border-radius:3px 0 0 3px;}&:last-child{border-radius:0 3px 3px 0;}", " &:focus-within{border-color:var(--ds-buttons-variant-secondary-border-focus);box-shadow:inset 0 0 0 1px var(--ds-buttons-variant-secondary-border-focus);z-index:2;}", " ", " ", ""], (props) => BUTTON_HEIGHT[props.$size ?? "middle"], (props) => !props.$disabled && css(["&:hover{color:var(--ds-buttons-variant-secondary-text-hover);background-color:var(--ds-buttons-variant-secondary-bg-hover);border-color:var(--ds-buttons-variant-secondary-border-hover);box-shadow:-1px 0 0 0 var(--ds-buttons-variant-secondary-border-hover);z-index:1;}"]), (props) => props.$checked && css(["&&{color:var(--ds-color-text-brand-default);background-color:var(--ds-color-background-brand-subtle);border-color:var(--ds-color-border-brand-default);box-shadow:-1px 0 0 0 var(--ds-color-border-brand-default);z-index:1;}"]), (props) => props.$disabled && css(["color:var(--ds-buttons-variant-secondary-text-disabled);opacity:var(--ds-opacity-disabled);cursor:not-allowed;", "{cursor:not-allowed;}"], RadioButtonInput), (props) => props.$solid && props.$checked && !props.$disabled && css(["&&{color:var(--ds-buttons-variant-primary-text-default);background-color:var(--ds-buttons-variant-primary-bg-default);border-color:var(--ds-buttons-variant-primary-bg-default);&:hover{color:var(--ds-buttons-variant-primary-text-hover);background-color:var(--ds-buttons-variant-primary-bg-hover);border-color:var(--ds-buttons-variant-primary-bg-hover);box-shadow:-1px 0 0 0 var(--ds-buttons-variant-primary-bg-hover);}}"]));
53
53
  const RadioGroupWrapper = /* @__PURE__ */ styled.div.withConfig({
54
54
  displayName: "Radiostyles__RadioGroupWrapper",
55
55
  componentId: "sc-137n5jf-11"
@@ -1,4 +1,5 @@
1
1
  import { CSSProperties, FocusEventHandler, MouseEventHandler, ReactNode } from 'react';
2
+ import { BaseLabelProps } from '@synerise/ds-form-field';
2
3
  import { DataAttributes, PassthroughAttributes } from '@synerise/ds-utils';
3
4
  export type RadioValueType = string | number | boolean;
4
5
  /** antd-compatible radio change event. */
@@ -29,6 +30,11 @@ export type RadioProps = {
29
30
  onChange?: (event: RadioChangeEvent) => void;
30
31
  /** Label text (rendered via `FormFieldLabel`). Takes precedence over `children`. */
31
32
  label?: ReactNode;
33
+ /** Tooltip on an info icon next to `label`. Use it instead of nesting a `FormFieldLabel` in
34
+ * `children`, whose own `<label>` would stop clicks on the text from selecting the radio. */
35
+ tooltip?: BaseLabelProps['tooltip'];
36
+ /** Tooltip config for `tooltip`, as on `FormFieldLabel`. */
37
+ tooltipConfig?: BaseLabelProps['tooltipConfig'];
32
38
  /** Helper text rendered below the radio. */
33
39
  description?: ReactNode;
34
40
  /** @deprecated use `label` instead */
@@ -1,3 +1,3 @@
1
1
  import { default as React } from 'react';
2
2
  import { RadioProps } from '../Radio.types';
3
- export declare const RadioBase: ({ value, checked, defaultChecked, disabled, name, id, autoFocus, tabIndex, onChange, onClick, label, description, children, className, style, ...rest }: RadioProps) => React.JSX.Element;
3
+ export declare const RadioBase: ({ value, checked, defaultChecked, disabled, name, id, autoFocus, tabIndex, onChange, onClick, label, tooltip, tooltipConfig, description, children, className, style, ...rest }: RadioProps) => React.JSX.Element;
@@ -15,6 +15,8 @@ const RadioBase = ({
15
15
  onChange,
16
16
  onClick,
17
17
  label,
18
+ tooltip,
19
+ tooltipConfig,
18
20
  description,
19
21
  children,
20
22
  className,
@@ -60,7 +62,7 @@ const RadioBase = ({
60
62
  /* @__PURE__ */ jsx(RadioInput, { type: "radio", className: "ant-radio-input ds-radio-input", checked: isChecked, disabled: isDisabled, name: name ?? group?.name, id, autoFocus, tabIndex, value: value === void 0 ? void 0 : String(value), onChange: handleChange, ...rest }),
61
63
  /* @__PURE__ */ jsx(RadioInner, { className: "ant-radio-inner ds-radio-inner", $checked: isChecked, $disabled: isDisabled })
62
64
  ] }),
63
- /* @__PURE__ */ jsx(RadioText, { $checked: isChecked, $disabled: isDisabled, children: label ? /* @__PURE__ */ jsx(Label, { disabled: isDisabled, children: label }) : children })
65
+ /* @__PURE__ */ jsx(RadioText, { $disabled: isDisabled, children: label ? /* @__PURE__ */ jsx(Label, { forwardedAs: "span", tooltip, tooltipConfig, children: label }) : children })
64
66
  ] }),
65
67
  description && /* @__PURE__ */ jsx(AdditionalData, { children: /* @__PURE__ */ jsx(Description, { disabled: isDisabled, children: description }) })
66
68
  ] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-radio",
3
- "version": "2.0.11",
3
+ "version": "2.1.0",
4
4
  "description": "Radio UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -42,9 +42,9 @@
42
42
  ],
43
43
  "types": "dist/index.d.ts",
44
44
  "dependencies": {
45
- "@synerise/ds-form-field": "^2.0.11",
46
- "@synerise/ds-typography": "^2.0.11",
47
- "@synerise/ds-utils": "^2.2.2"
45
+ "@synerise/ds-form-field": "^2.1.0",
46
+ "@synerise/ds-typography": "^2.1.0",
47
+ "@synerise/ds-utils": "^2.3.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "vitest": "4"
@@ -54,5 +54,5 @@
54
54
  "react": ">=16.9.0 <= 18.3.1",
55
55
  "styled-components": "^5.3.3"
56
56
  },
57
- "gitHead": "c356039703d8826bbbdb6dadcb18bb008fea8bc5"
57
+ "gitHead": "5c3d61e30289486d14c7d6becb682e2d4a08ce41"
58
58
  }