@octaviaflow/icons 3.0.18-beta.0 → 3.0.18-beta.7

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.
@@ -4,7 +4,17 @@ export type IconTone = "primary" | "accent" | "muted" | "inverse" | "success" |
4
4
  export interface BaseIconProps extends Omit<SVGAttributes<SVGSVGElement>, "color"> {
5
5
  /** Width + height in px. Token name or number. Default "lg" (24px). */
6
6
  size?: IconSize;
7
- /** Stroke/fill color from the design-system tone enum. Default "primary". */
7
+ /**
8
+ * Stroke/fill color from the design-system tone enum.
9
+ *
10
+ * **Default: undefined — the icon inherits its parent's CSS `color`.**
11
+ * That keeps icons coloured by their context: a primary Button's white
12
+ * text colours its icons white; a Stat tile's accent slot colours its
13
+ * icon accent; a muted Sidebar item tints its icon to match.
14
+ *
15
+ * Pass an explicit tone only when you want to override that inheritance
16
+ * (e.g. `tone="success"` on a status row inside a default-tone surface).
17
+ */
8
18
  tone?: IconTone;
9
19
  /**
10
20
  * Arbitrary CSS color (hex, rgb, hsl, named color, CSS variable). When set,
@@ -26,5 +36,10 @@ export interface BaseIconProps extends Omit<SVGAttributes<SVGSVGElement>, "color
26
36
  /**
27
37
  * BaseIcon — every generated icon wraps this primitive. Pictograms have
28
38
  * BasePictogram with the same shape but a coarser size scale.
39
+ *
40
+ * When neither `tone` nor `color` is passed, the SVG inherits its parent's
41
+ * CSS `color`. This is the default because hard-coding an inline color
42
+ * (the previous behaviour, `tone="primary"`) silently overrode every
43
+ * Button / Stat / Sidebar / Card that had its own `color:` styling.
29
44
  */
30
45
  export declare const BaseIcon: import("react").ForwardRefExoticComponent<BaseIconProps & import("react").RefAttributes<SVGSVGElement>>;
package/dist/index.cjs CHANGED
@@ -22,13 +22,11 @@ var TONE_COLOR = {
22
22
  running: "var(--ods-status-running-fg)"
23
23
  };
24
24
  var BaseIcon = react.forwardRef(
25
- ({ size = "lg", tone = "primary", color, title, viewBox, children, style, ...rest }, ref) => {
25
+ ({ size = "lg", tone, color, title, viewBox, children, style, ...rest }, ref) => {
26
26
  const pixels = typeof size === "number" ? size : SIZE_PX[size];
27
+ const resolvedColor = color ?? (tone ? TONE_COLOR[tone] : void 0);
27
28
  const mergedStyle = {
28
- // `color` wins over `tone` so the consumer can override an inherited
29
- // tone without having to switch the API. Either way the value drives
30
- // the SVG's CSS `color`, which the inner paths resolve via currentColor.
31
- color: color ?? TONE_COLOR[tone],
29
+ ...resolvedColor !== void 0 && { color: resolvedColor },
32
30
  ...style
33
31
  };
34
32
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -44,6 +42,7 @@ var BaseIcon = react.forwardRef(
44
42
  "aria-label": title,
45
43
  style: mergedStyle,
46
44
  focusable: "false",
45
+ fill: "currentColor",
47
46
  fillRule: "evenodd",
48
47
  clipRule: "evenodd",
49
48
  ...rest,