@primer/react 38.4.0-rc.36e3b554d → 38.4.0-rc.6e4fd900e

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.

Potentially problematic release.


This version of @primer/react might be problematic. Click here for more details.

package/CHANGELOG.md CHANGED
@@ -8,13 +8,19 @@
8
8
 
9
9
  - [#7250](https://github.com/primer/react/pull/7250) [`a193d30`](https://github.com/primer/react/commit/a193d30cad6e308e2f0cc29ebdcc926ee057f0fb) Thanks [@siddharthkp](https://github.com/siddharthkp)! - Banner: Add `flush` prop for use within confined spaces, such as dialogs, tables, cards, or boxes where available space is limited.
10
10
 
11
+ - [#7247](https://github.com/primer/react/pull/7247) [`e1021e7`](https://github.com/primer/react/commit/e1021e7a5b65c605d98f025a30ef4fb5cce91024) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Add leadingVisual to InlineMessage component.
12
+
11
13
  - [#7047](https://github.com/primer/react/pull/7047) [`c07dd71`](https://github.com/primer/react/commit/c07dd71e990323a1c73ec99c44752df43d153090) Thanks [@TylerJDev](https://github.com/TylerJDev)! - Remove the feature flag for `primer_react_segmented_control_tooltip` and GA tooltip by default behavior.
12
14
  - Ensure that when `disabled` is applied, the tooltip is still triggered.
13
15
 
14
16
  ### Patch Changes
15
17
 
18
+ - [#7244](https://github.com/primer/react/pull/7244) [`d973c5a`](https://github.com/primer/react/commit/d973c5ad5aa59c66e1f609558b33a6b63880234a) Thanks [@lukasoppermann](https://github.com/lukasoppermann)! - "Update logic for how hex codes are applied"
19
+
16
20
  - [#7230](https://github.com/primer/react/pull/7230) [`534ca11`](https://github.com/primer/react/commit/534ca119a2552bb71684c64d2e7481cf426023b6) Thanks [@mperrotti](https://github.com/mperrotti)! - Replaces 'aria-live' usage and removes internal LiveRegion component
17
21
 
22
+ - [#7267](https://github.com/primer/react/pull/7267) [`1d8759a`](https://github.com/primer/react/commit/1d8759aae8a3bdd1dc2b8bc8785867ca467b72b5) Thanks [@lukasoppermann](https://github.com/lukasoppermann)! - Used correct tokens for disabled radio control
23
+
18
24
  - [#7241](https://github.com/primer/react/pull/7241) [`181f12e`](https://github.com/primer/react/commit/181f12e1244ea1f33559976ff16e32a1777e877d) Thanks [@francinelucca](https://github.com/francinelucca)! - fix(LabelGroup): add role and aria-label to hidden items overlay
19
25
 
20
26
  - [#7251](https://github.com/primer/react/pull/7251) [`12e12f5`](https://github.com/primer/react/commit/12e12f5302a2125b4bedaab3478395105ef93946) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Improve drag performance for PageLayout
@@ -9,7 +9,11 @@ export type InlineMessageProps = React.ComponentPropsWithoutRef<'div'> & {
9
9
  * Specify the type of the InlineMessage
10
10
  */
11
11
  variant: MessageVariant;
12
+ /**
13
+ * A custom leading visual (icon or other element) to display instead of the default variant icon.
14
+ */
15
+ leadingVisual?: React.ElementType | React.ReactNode;
12
16
  };
13
- export declare function InlineMessage({ children, className, size, variant, ...rest }: InlineMessageProps): React.JSX.Element;
17
+ export declare function InlineMessage({ children, className, size, variant, leadingVisual: LeadingVisual, ...rest }: InlineMessageProps): React.JSX.Element;
14
18
  export {};
15
19
  //# sourceMappingURL=InlineMessage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InlineMessage.d.ts","sourceRoot":"","sources":["../../src/InlineMessage/InlineMessage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,KAAK,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAA;AAExE,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,GAAG;IACvE;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAEzB;;OAEG;IACH,OAAO,EAAE,cAAc,CAAA;CACxB,CAAA;AAgBD,wBAAgB,aAAa,CAAC,EAAC,QAAQ,EAAE,SAAS,EAAE,IAAe,EAAE,OAAO,EAAE,GAAG,IAAI,EAAC,EAAE,kBAAkB,qBASzG"}
1
+ {"version":3,"file":"InlineMessage.d.ts","sourceRoot":"","sources":["../../src/InlineMessage/InlineMessage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,KAAK,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAA;AAExE,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,GAAG;IACvE;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAEzB;;OAEG;IACH,OAAO,EAAE,cAAc,CAAA;IAEvB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAA;CACpD,CAAA;AAgBD,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,IAAe,EACf,OAAO,EACP,aAAa,EAAE,aAAa,EAC5B,GAAG,IAAI,EACR,EAAE,kBAAkB,qBAoBpB"}
@@ -1,6 +1,7 @@
1
1
  import { c } from 'react-compiler-runtime';
2
2
  import { AlertFillIcon, CheckCircleFillIcon, AlertIcon, CheckCircleIcon } from '@primer/octicons-react';
3
3
  import { clsx } from 'clsx';
4
+ import { isValidElementType } from 'react-is';
4
5
  import classes from './InlineMessage.module.css.js';
5
6
  import { jsxs, jsx } from 'react/jsx-runtime';
6
7
 
@@ -37,7 +38,8 @@ const smallIcons = {
37
38
  })
38
39
  };
39
40
  function InlineMessage(t0) {
40
- const $ = c(15);
41
+ const $ = c(18);
42
+ let LeadingVisual;
41
43
  let children;
42
44
  let className;
43
45
  let rest;
@@ -49,33 +51,55 @@ function InlineMessage(t0) {
49
51
  className,
50
52
  size: t1,
51
53
  variant,
54
+ leadingVisual: LeadingVisual,
52
55
  ...rest
53
56
  } = t0);
54
57
  $[0] = t0;
55
- $[1] = children;
56
- $[2] = className;
57
- $[3] = rest;
58
- $[4] = t1;
59
- $[5] = variant;
58
+ $[1] = LeadingVisual;
59
+ $[2] = children;
60
+ $[3] = className;
61
+ $[4] = rest;
62
+ $[5] = t1;
63
+ $[6] = variant;
60
64
  } else {
61
- children = $[1];
62
- className = $[2];
63
- rest = $[3];
64
- t1 = $[4];
65
- variant = $[5];
65
+ LeadingVisual = $[1];
66
+ children = $[2];
67
+ className = $[3];
68
+ rest = $[4];
69
+ t1 = $[5];
70
+ variant = $[6];
66
71
  }
67
72
  const size = t1 === undefined ? "medium" : t1;
68
- const icon = size === "small" ? smallIcons[variant] : icons[variant];
73
+ let icon;
74
+ if (LeadingVisual !== undefined) {
75
+ if (typeof LeadingVisual !== "string" && isValidElementType(LeadingVisual)) {
76
+ let t2;
77
+ if ($[7] !== LeadingVisual) {
78
+ t2 = /*#__PURE__*/jsx(LeadingVisual, {
79
+ className: classes.InlineMessageIcon
80
+ });
81
+ $[7] = LeadingVisual;
82
+ $[8] = t2;
83
+ } else {
84
+ t2 = $[8];
85
+ }
86
+ icon = t2;
87
+ } else {
88
+ icon = LeadingVisual;
89
+ }
90
+ } else {
91
+ icon = size === "small" ? smallIcons[variant] : icons[variant];
92
+ }
69
93
  let t2;
70
- if ($[6] !== className) {
94
+ if ($[9] !== className) {
71
95
  t2 = clsx(className, classes.InlineMessage);
72
- $[6] = className;
73
- $[7] = t2;
96
+ $[9] = className;
97
+ $[10] = t2;
74
98
  } else {
75
- t2 = $[7];
99
+ t2 = $[10];
76
100
  }
77
101
  let t3;
78
- if ($[8] !== children || $[9] !== icon || $[10] !== rest || $[11] !== size || $[12] !== t2 || $[13] !== variant) {
102
+ if ($[11] !== children || $[12] !== icon || $[13] !== rest || $[14] !== size || $[15] !== t2 || $[16] !== variant) {
79
103
  t3 = /*#__PURE__*/jsxs("div", {
80
104
  ...rest,
81
105
  className: t2,
@@ -83,15 +107,15 @@ function InlineMessage(t0) {
83
107
  "data-variant": variant,
84
108
  children: [icon, children]
85
109
  });
86
- $[8] = children;
87
- $[9] = icon;
88
- $[10] = rest;
89
- $[11] = size;
90
- $[12] = t2;
91
- $[13] = variant;
92
- $[14] = t3;
110
+ $[11] = children;
111
+ $[12] = icon;
112
+ $[13] = rest;
113
+ $[14] = size;
114
+ $[15] = t2;
115
+ $[16] = variant;
116
+ $[17] = t3;
93
117
  } else {
94
- t3 = $[14];
118
+ t3 = $[17];
95
119
  }
96
120
  return t3;
97
121
  }
@@ -0,0 +1,2 @@
1
+ .prc-Radio-Radio-Ly4MR{border-radius:var(--borderRadius-full,100vh);transition:background-color,border-color 80ms cubic-bezier(.33,1,.68,1)}.prc-Radio-Radio-Ly4MR:where(:checked){background-color:var(--control-checked-fgColor-rest,var(--color-switch-track-checked-fg));border-color:var(--control-checked-bgColor-rest,var(--color-switch-track-checked-bg));border-width:var(--borderWidth-thicker,.25rem)}.prc-Radio-Radio-Ly4MR:where(:checked):disabled{background-color:var(--control-checked-fgColor-disabled,var(--color-switch-track-checked-disabled-fg));border-color:var(--control-checked-bgColor-disabled,var(--color-switch-track-disabled-bg));cursor:not-allowed}.prc-Radio-Radio-Ly4MR:focus-visible{box-shadow:none;outline:2px solid var(--focus-outlineColor,var(--color-accent-fg));outline-offset:2px}@media (forced-colors:active){.prc-Radio-Radio-Ly4MR{background-color:canvastext;border-color:canvastext}}
2
+ /*# sourceMappingURL=Radio-4319e717.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Radio/Radio.module.css","../../postcss-preset-primer/src/mixins/focusOutline.css"],"names":[],"mappings":"AAAA,uBACE,4CAA8C,CAC9C,uEA8BF,CA1BE,uCAEE,yFAAqD,CAIrD,qFAAiD,CACjD,8CASF,CAPE,gDAGE,2DAAsC,CAEtC,uDAAkC,CAJlC,kBAKF,CAGF,qCCrBA,eAAgB,CAFhB,kEAAgC,CAChC,kBDwBA,CAEA,8BA5BF,uBA6BI,2BAA4B,CAC5B,uBAEJ,CADE","file":"Radio-df9a5c02.css","sourcesContent":[".Radio {\n border-radius: var(--borderRadius-full, 100vh);\n transition:\n background-color,\n border-color 80ms cubic-bezier(0.33, 1, 0.68, 1); /* checked -> unchecked - add 120ms delay to fully see animation-out */\n\n &:where(:checked) {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--control-checked-fgColor-rest);\n\n /* using bgColor here to avoid a border change in dark high contrast */\n /* stylelint-disable-next-line primer/colors */\n border-color: var(--control-checked-bgColor-rest);\n border-width: var(--borderWidth-thicker);\n\n &:disabled {\n cursor: not-allowed;\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--fgColor-muted);\n /* stylelint-disable-next-line primer/colors */\n border-color: var(--fgColor-muted);\n }\n }\n\n &:focus-visible {\n @mixin focusOutline 2px;\n }\n\n @media (forced-colors: active) {\n background-color: canvastext;\n border-color: canvastext;\n }\n}\n","@define-mixin focusOutline $outlineOffset: -2px, $outlineColor: var(--focus-outlineColor) {\n outline: 2px solid $outlineColor;\n outline-offset: $outlineOffset;\n box-shadow: none;\n}\n"]}
1
+ {"version":3,"sources":["../src/Radio/Radio.module.css","../../postcss-preset-primer/src/mixins/focusOutline.css"],"names":[],"mappings":"AAAA,uBACE,4CAA8C,CAC9C,uEA8BF,CA1BE,uCAEE,yFAAqD,CAIrD,qFAAiD,CACjD,8CASF,CAPE,gDAGE,sGAAyD,CAEzD,0FAAqD,CAJrD,kBAKF,CAGF,qCCrBA,eAAgB,CAFhB,kEAAgC,CAChC,kBDwBA,CAEA,8BA5BF,uBA6BI,2BAA4B,CAC5B,uBAEJ,CADE","file":"Radio-4319e717.css","sourcesContent":[".Radio {\n border-radius: var(--borderRadius-full, 100vh);\n transition:\n background-color,\n border-color 80ms cubic-bezier(0.33, 1, 0.68, 1); /* checked -> unchecked - add 120ms delay to fully see animation-out */\n\n &:where(:checked) {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--control-checked-fgColor-rest);\n\n /* using bgColor here to avoid a border change in dark high contrast */\n /* stylelint-disable-next-line primer/colors */\n border-color: var(--control-checked-bgColor-rest);\n border-width: var(--borderWidth-thicker);\n\n &:disabled {\n cursor: not-allowed;\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--control-checked-fgColor-disabled);\n /* stylelint-disable-next-line primer/colors */\n border-color: var(--control-checked-bgColor-disabled);\n }\n }\n\n &:focus-visible {\n @mixin focusOutline 2px;\n }\n\n @media (forced-colors: active) {\n background-color: canvastext;\n border-color: canvastext;\n }\n}\n","@define-mixin focusOutline $outlineOffset: -2px, $outlineColor: var(--focus-outlineColor) {\n outline: 2px solid $outlineColor;\n outline-offset: $outlineOffset;\n box-shadow: none;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import './Radio-df9a5c02.css';
1
+ import './Radio-4319e717.css';
2
2
 
3
3
  var classes = {"Radio":"prc-Radio-Radio-Ly4MR"};
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"IssueLabel.d.ts","sourceRoot":"","sources":["../../../src/experimental/IssueLabel/IssueLabel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,KAAK,GAAG,GAAG,IAAI,MAAM,EAAE,CAAA;AAEvB,KAAK,iBAAiB,GAClB,QAAQ,GACR,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM,GACN,MAAM,GACN,OAAO,GACP,QAAQ,GACR,OAAO,GACP,MAAM,GACN,OAAO,GACP,QAAQ,GACR,MAAM,GACN,MAAM,GACN,MAAM,GACN,QAAQ,GACR,KAAK,GACL,MAAM,GACN,QAAQ,CAAA;AAEZ,KAAK,SAAS,GAAG;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,GAAG,CAAA;IACf,OAAO,CAAC,EAAE,iBAAiB,CAAA;CAC5B,CAAA;AAED,KAAK,WAAW,GAAG,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,GACzD,SAAS,GAAG;IACV,EAAE,CAAC,EAAE,KAAK,CAAA;IACV,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,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AC,EAAE,CAAC,EAAE,MAAM,SAAS,CAAC,CAAA;AAE3D,KAAK,eAAe,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,IAAI,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAA;AAEhH,iBAAS,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,CAAC,SAAS,CAAA;AACtD,iBAAS,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,CAAC,SAAS,CAAA;AACtD,iBAAS,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,KAAK,CAAC,SAAS,CAAA;AACxD,iBAAS,UAAU,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,iBAAiB,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,SAAS,CAAA;AAqDhG,OAAO,EAAC,UAAU,EAAC,CAAA;AACnB,YAAY,EAAC,eAAe,EAAE,GAAG,EAAC,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { c } from 'react-compiler-runtime';
2
2
  import { clsx } from 'clsx';
3
- import { getColorsFromHex } from './getColorFromHex.js';
4
3
  import classes from './IssueLabel.module.css.js';
4
+ import { readableColor } from 'color2k';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
7
7
  function IssueLabel(t0) {
@@ -50,7 +50,8 @@ function IssueLabel(t0) {
50
50
  if ($[9] !== fillColor || $[10] !== style) {
51
51
  t4 = fillColor ? {
52
52
  ...style,
53
- ...getColorsFromHex(fillColor)
53
+ backgroundColor: fillColor,
54
+ color: readableColor(fillColor)
54
55
  } : style;
55
56
  $[9] = fillColor;
56
57
  $[10] = style;
@@ -3616,6 +3616,12 @@
3616
3616
  "description": "Specify the type of the inline message",
3617
3617
  "type": "'critical' | 'success' | 'unvailable' | 'warning'",
3618
3618
  "required": true
3619
+ },
3620
+ {
3621
+ "name": "leadingVisual",
3622
+ "description": "A custom leading visual to display instead of the default variant icon.",
3623
+ "type": "React.ElementType | React.ReactNode",
3624
+ "required": false
3619
3625
  }
3620
3626
  ]
3621
3627
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.4.0-rc.36e3b554d",
4
+ "version": "38.4.0-rc.6e4fd900e",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -1,2 +0,0 @@
1
- .prc-Radio-Radio-Ly4MR{border-radius:var(--borderRadius-full,100vh);transition:background-color,border-color 80ms cubic-bezier(.33,1,.68,1)}.prc-Radio-Radio-Ly4MR:where(:checked){background-color:var(--control-checked-fgColor-rest,var(--color-switch-track-checked-fg));border-color:var(--control-checked-bgColor-rest,var(--color-switch-track-checked-bg));border-width:var(--borderWidth-thicker,.25rem)}.prc-Radio-Radio-Ly4MR:where(:checked):disabled{background-color:var(--fgColor-muted,var(--color-fg-muted));border-color:var(--fgColor-muted,var(--color-fg-muted));cursor:not-allowed}.prc-Radio-Radio-Ly4MR:focus-visible{box-shadow:none;outline:2px solid var(--focus-outlineColor,var(--color-accent-fg));outline-offset:2px}@media (forced-colors:active){.prc-Radio-Radio-Ly4MR{background-color:canvastext;border-color:canvastext}}
2
- /*# sourceMappingURL=Radio-df9a5c02.css.map */
@@ -1,8 +0,0 @@
1
- import type { Hex } from './IssueLabel';
2
- /**
3
- * transforms a hex color provided by the user into a color object with background and text colors
4
- * @param colorHex — the hex color provided by the user
5
- * @returns
6
- */
7
- export declare const getColorsFromHex: (colorHex: Hex) => React.CSSProperties | undefined;
8
- //# sourceMappingURL=getColorFromHex.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getColorFromHex.d.ts","sourceRoot":"","sources":["../../../src/experimental/IssueLabel/getColorFromHex.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,cAAc,CAAA;AAErC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAU,GAAG,KAAG,KAAK,CAAC,aAAa,GAAG,SA+EtE,CAAA"}
@@ -1,185 +0,0 @@
1
- import { getContrast } from 'color2k';
2
- import { Hsluv } from 'hsluv';
3
-
4
- /**
5
- * transforms a hex color provided by the user into a color object with background and text colors
6
- * @param colorHex — the hex color provided by the user
7
- * @returns
8
- */
9
- const getColorsFromHex = colorHex => {
10
- // start values for light mode
11
- const lightBgLightness = 96;
12
- const lightLightnessIncrement = -1;
13
- const lightRatio = 4.5;
14
- const darkBgLightness = 16;
15
- const darkLightnessIncrement = 1;
16
- const darkRatio = 5.5;
17
-
18
- // get hue and saturation value from hex color
19
- // eslint-disable-next-line prefer-const
20
- let {
21
- h,
22
- s
23
- } = hexToHsluv(colorHex);
24
-
25
- // avoid intense bright colors
26
- // Hue range: 58 - 198
27
- // 58 marks the transition from yellow to yellow-green
28
- // 198 makes the tranisiton from cyan to blue
29
- // yellow, yellow-green, green, cyan, blue tend to be bright and intense
30
- // Setting the hue range of 58 and 198 helps avoid bright colors
31
- // saturation: represents the intensity of a color, measured as a percentage from 0 to 100. Capping at 70% to avoid intense bright colors
32
- if (h >= 58 && h <= 198 && s > 70) {
33
- s = 70;
34
- }
35
- /**
36
- * creating a background color from the provided hex color
37
- */
38
- const {
39
- colorHex: darkBackgroundColor,
40
- lightness: darkCurrentBgLightness
41
- } = getColorWithContrast(hsluvToHex({
42
- h,
43
- s,
44
- l: darkBgLightness
45
- }), '#0d1117',
46
- // dark mode background color
47
- 1.2, darkLightnessIncrement);
48
-
49
- /**
50
- * creating a background color from the provided hex color
51
- */
52
- const {
53
- colorHex: lightBackgroundColor,
54
- lightness: lightCurrentBgLightness
55
- } = getColorWithContrast(hsluvToHex({
56
- h,
57
- s,
58
- l: lightBgLightness
59
- }), '#ffffff',
60
- // light mode background color
61
- 1.2, lightLightnessIncrement);
62
-
63
- // avoid intense bright colors
64
- if (h >= 58 && h <= 316 && s > 80) {
65
- s = 80;
66
- }
67
- /**
68
- * creating a text color from with a contrast ratio of at least 4.5 to the generated background color
69
- */
70
- const {
71
- colorHex: darkTextColor
72
- } = getColorWithContrast(hsluvToHex({
73
- h,
74
- s,
75
- l: 50
76
- }), darkBackgroundColor, darkRatio, darkLightnessIncrement);
77
- const {
78
- colorHex: lightTextColor
79
- } = getColorWithContrast(hsluvToHex({
80
- h,
81
- s,
82
- l: 50
83
- }), lightBackgroundColor, lightRatio, lightLightnessIncrement);
84
- return {
85
- '--label-bgColor-light-rest': lightBackgroundColor,
86
- '--label-bgColor-light-hover': hsluvToHex({
87
- h,
88
- s,
89
- l: lightCurrentBgLightness + 4 * lightLightnessIncrement
90
- }),
91
- '--label-bgColor-light-active': hsluvToHex({
92
- h,
93
- s,
94
- l: lightCurrentBgLightness + 8 * lightLightnessIncrement
95
- }),
96
- '--label-fgColor-light': lightTextColor,
97
- '--label-fgColor-light-hover': lightTextColor,
98
- '--label-fgColor-light-active': lightTextColor,
99
- '--label-bgColor-dark-rest': darkBackgroundColor,
100
- '--label-bgColor-dark-hover': hsluvToHex({
101
- h,
102
- s,
103
- l: darkCurrentBgLightness + 4 * darkLightnessIncrement
104
- }),
105
- '--label-bgColor-dark-active': hsluvToHex({
106
- h,
107
- s,
108
- l: darkCurrentBgLightness + 8 * darkLightnessIncrement
109
- }),
110
- '--label-fgColor-dark': darkTextColor,
111
- '--label-fgColor-dark-hover': darkTextColor,
112
- '--label-fgColor-dark-active': darkTextColor
113
- };
114
- };
115
- /**
116
- * Changes the lightness of a hex color until the contrast ratio is reached and returns the new hex color
117
- * @param colorHex — initial hex color
118
- * @param bgHex — color to check the contrast against
119
- * @param contrastRatio — the contrast ratio to reach
120
- * @param increment — the direction to change the lightness depending on the color scheme
121
- * @returns the new hex color
122
- */
123
- const getColorWithContrast = (fgColor, bgColor, contrastRatio, increment) => {
124
- const hsluv = hexToHsluv(fgColor);
125
- let color = fgColor;
126
-
127
- // change lightness until contrast is reached
128
- while (getContrast(color, bgColor) < contrastRatio && hsluv.l > 0 && hsluv.l < 100) {
129
- hsluv.l += increment;
130
- color = hsluvToHex(hsluv);
131
- }
132
- return {
133
- colorHex: color,
134
- lightness: hsluv.l
135
- };
136
- };
137
-
138
- /**
139
- * Takes a hex value and returns the hue, saturation and lightness for HSLuv as an object
140
- * @param hex user provided hex string
141
- * @returns an object with the hue, saturation and lightness values
142
- */
143
- const hexToHsluv = hex => {
144
- // convert hex to hsluv
145
- const color = new Hsluv();
146
- color.hex = hex;
147
- color.hexToHsluv();
148
- // extract h, s and l values
149
- const {
150
- hsluv_h: h,
151
- hsluv_s: s,
152
- hsluv_l: l
153
- } = color;
154
- // return h, s, l as an object
155
- return {
156
- h,
157
- s,
158
- l
159
- };
160
- };
161
- /**
162
- * Takes an object with hue, saturation and lightness values and returns a hex string
163
- * @param hex user provided hex string
164
- * @returns an object with the hue, saturation and lightness values
165
- */
166
- const hsluvToHex = ({
167
- h,
168
- s,
169
- l
170
- }) => {
171
- // create a new HSLuv color object and assign values
172
- const color = new Hsluv();
173
- // eslint-disable-next-line camelcase
174
- color.hsluv_h = h;
175
- // eslint-disable-next-line camelcase
176
- color.hsluv_s = s;
177
- // eslint-disable-next-line camelcase
178
- color.hsluv_l = l;
179
- // convert hsluv to hex
180
- color.hsluvToHex();
181
- // return hex string
182
- return color.hex;
183
- };
184
-
185
- export { getColorsFromHex };