@unitedstatespowersquadrons/components 1.4.2-1 → 1.4.2-2

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.
Files changed (2) hide show
  1. package/IconButton.tsx +20 -9
  2. package/package.json +1 -1
package/IconButton.tsx CHANGED
@@ -1,24 +1,35 @@
1
1
  import React from "react";
2
2
  import { createUseStyles } from "react-jss";
3
3
  import classNames from "classnames";
4
- import { ButtonColorName } from "./Colors";
4
+ import Colors, { ButtonColorName } from "./Colors";
5
5
  import FontAwesomeIcon, { FontAwesomeProps } from "./FontAwesomeIcon";
6
6
  import BaseActionButton from "./BaseActionButton";
7
7
  import { HrefProps, MethodProps, OnClickProps } from "./types";
8
- import Styles from "./Styles";
8
+
9
+ // FA duotone uses `--fa-primary-color` / `--fa-secondary-color`. Their
10
+ // out-of-the-box defaults are `inherit` (currentColor), but the kit can
11
+ // override that with literal hexes, which freezes the duotone color
12
+ // regardless of `color`. Re-pin both to `currentColor` so each layer
13
+ // follows our `color` while `--fa-secondary-opacity` (default 0.4) keeps
14
+ // the duotone contrast.
15
+ const colorize = (hex: string) => ({
16
+ "--fa-primary-color": "currentColor",
17
+ "--fa-secondary-color": "currentColor",
18
+ color: hex,
19
+ });
9
20
 
10
21
  const useStyles = createUseStyles({
11
- blue: { ...Styles.blue },
12
- darkGray: { ...Styles.darkGray },
13
- gray: { ...Styles.gray },
14
- green: { ...Styles.green },
22
+ blue: colorize(Colors.blue),
23
+ darkGray: colorize(Colors.darkGray),
24
+ gray: colorize(Colors.gray),
25
+ green: colorize(Colors.green),
15
26
  icon: {
16
27
  cursor: "pointer",
17
28
  fontSize: "1.1em",
18
29
  },
19
- orange: { ...Styles.orange },
20
- purple: { ...Styles.purple },
21
- red: { ...Styles.red },
30
+ orange: colorize(Colors.orange),
31
+ purple: colorize(Colors.purple),
32
+ red: colorize(Colors.red),
22
33
  wrapperLink: {
23
34
  display: "inline-block",
24
35
  margin: "0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unitedstatespowersquadrons/components",
3
- "version": "1.4.2-1",
3
+ "version": "1.4.2-2",
4
4
  "description": "USPS shared React components library",
5
5
  "main": "index.tsx",
6
6
  "scripts": {