@mediaradar/design-components 0.18.7 → 0.18.8

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/dist/index.d.cts CHANGED
@@ -2118,10 +2118,12 @@ interface ToggleProps {
2118
2118
  * Rendered as a `<button role="switch">` so the on/off state is announced as a
2119
2119
  * switch rather than a checkbox, and so the track and knob can carry the brand
2120
2120
  * fill without fighting a native input's styling hooks.
2121
- * @tokens bg-brand-primaryAction, bg-border-interactive, bg-surface, shadow-raised, outline-border-focus
2121
+ * @tokens bg-brand-primaryAction, bg-surface, shadow-raised, outline-border-focus
2122
2122
  * @behavior The knob is positioned by `translate-x`, not by flex alignment, so
2123
- * the slide animates. Off uses `bg-border-interactive` rather than a grey
2124
- * literal, which keeps the track visible against `bg-surface` in dark mode.
2123
+ * the slide animates. Off is `border-interactive` mixed 70/30 with
2124
+ * `text-secondary` (an inline style), so the track and the knob on it are at
2125
+ * least 3:1 against the surface in both themes (WCAG 1.4.11). The two tokens
2126
+ * are the same colour in light mode, so light is unchanged.
2125
2127
  * Pair it with a label and any InfoTip in the surrounding row: this component
2126
2128
  * draws only the switch, so rows stay free to lay the label out however they
2127
2129
  * need (usually label left, switch pushed right).
package/dist/index.d.ts CHANGED
@@ -2118,10 +2118,12 @@ interface ToggleProps {
2118
2118
  * Rendered as a `<button role="switch">` so the on/off state is announced as a
2119
2119
  * switch rather than a checkbox, and so the track and knob can carry the brand
2120
2120
  * fill without fighting a native input's styling hooks.
2121
- * @tokens bg-brand-primaryAction, bg-border-interactive, bg-surface, shadow-raised, outline-border-focus
2121
+ * @tokens bg-brand-primaryAction, bg-surface, shadow-raised, outline-border-focus
2122
2122
  * @behavior The knob is positioned by `translate-x`, not by flex alignment, so
2123
- * the slide animates. Off uses `bg-border-interactive` rather than a grey
2124
- * literal, which keeps the track visible against `bg-surface` in dark mode.
2123
+ * the slide animates. Off is `border-interactive` mixed 70/30 with
2124
+ * `text-secondary` (an inline style), so the track and the knob on it are at
2125
+ * least 3:1 against the surface in both themes (WCAG 1.4.11). The two tokens
2126
+ * are the same colour in light mode, so light is unchanged.
2125
2127
  * Pair it with a label and any InfoTip in the surrounding row: this component
2126
2128
  * draws only the switch, so rows stay free to lay the label out however they
2127
2129
  * need (usually label left, switch pushed right).
package/dist/index.js CHANGED
@@ -3833,6 +3833,7 @@ var SIZES2 = {
3833
3833
  sm: { track: "h-5 w-9", knob: "h-4 w-4", on: "translate-x-[18px]" },
3834
3834
  md: { track: "h-6 w-11", knob: "h-5 w-5", on: "translate-x-[22px]" }
3835
3835
  };
3836
+ var OFF_TRACK = "color-mix(in srgb, var(--mr-color-border-interactive) 70%, var(--mr-color-text-secondary))";
3836
3837
  function Toggle({ checked, onChange, label, size = "md", disabled, className, testIdPrefix }) {
3837
3838
  const s = SIZES2[size];
3838
3839
  return /* @__PURE__ */ jsx38(
@@ -3845,10 +3846,11 @@ function Toggle({ checked, onChange, label, size = "md", disabled, className, te
3845
3846
  disabled,
3846
3847
  "data-testid": testIdPrefix && `${testIdPrefix}-toggle`,
3847
3848
  onClick: () => onChange(!checked),
3849
+ style: checked ? void 0 : { backgroundColor: OFF_TRACK },
3848
3850
  className: cn(
3849
3851
  "relative inline-flex shrink-0 items-center rounded-full transition-colors focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
3850
3852
  s.track,
3851
- checked ? "bg-brand-primaryAction" : "bg-border-interactive",
3853
+ checked && "bg-brand-primaryAction",
3852
3854
  disabled && "cursor-not-allowed opacity-50",
3853
3855
  className
3854
3856
  ),