@primer/react 0.0.0-20260731202127 → 0.0.0-20260803221355

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/theme.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { fontStack } from "./utils/theme.js";
2
+ import { colorSchemes } from "./legacy-theme/ts/color-schemes.js";
2
3
  //#region src/theme.ts
3
4
  const theme = {
4
5
  animation: { easeOutCubic: "cubic-bezier(0.33, 1, 0.68, 1)" },
@@ -78,7 +79,8 @@ const theme = {
78
79
  "96px",
79
80
  "112px",
80
81
  "128px"
81
- ]
82
+ ],
83
+ colorSchemes
82
84
  };
83
85
  //#endregion
84
86
  export { theme as default };
@@ -1,11 +1,13 @@
1
- import { ColorMode, ColorModeWithAuto } from "./ThemeProvider.js";
1
+ import { ColorMode, ColorModeWithAuto, Theme } from "./ThemeProvider.js";
2
2
  import React from "react";
3
3
 
4
4
  //#region src/useTheme.d.ts
5
5
  declare function useTheme(): {
6
+ theme?: Theme;
6
7
  colorScheme?: string;
7
8
  colorMode?: ColorModeWithAuto;
8
9
  resolvedColorMode?: ColorMode;
10
+ resolvedColorScheme?: string;
9
11
  dayScheme?: string;
10
12
  nightScheme?: string;
11
13
  setColorMode: React.Dispatch<React.SetStateAction<ColorModeWithAuto>>;
@@ -0,0 +1,4 @@
1
+ //#region src/utils/types/KeyPaths.d.ts
2
+ type KeyPaths<O> = { [K in keyof O]: K extends string ? (O[K] extends Record<string, unknown> ? `${K}.${KeyPaths<O[K]>}` : `${K}`) : never }[keyof O];
3
+ //#endregion
4
+ export { KeyPaths };
@@ -9042,7 +9042,7 @@
9042
9042
  },
9043
9043
  {
9044
9044
  "id": "components-underlinenav-features--overflow-template",
9045
- "code": "({ initialSelectedIndex = 1 }: { initialSelectedIndex?: number }) => {\n const [selectedIndex, setSelectedIndex] = React.useState<number | null>(\n initialSelectedIndex,\n )\n return (\n <UnderlineNav aria-label=\"Repository\">\n {items.map((item, index) => (\n <UnderlineNav.Item\n key={item.navigation}\n leadingVisual={item.icon}\n aria-current={index === selectedIndex ? 'page' : undefined}\n // Set so that navigation in interaction tests does not cause the\n // page to load the storybook iframe URL and instead keeps the test in\n // the local preview\n target=\"_self\"\n onSelect={(event) => {\n event.preventDefault()\n setSelectedIndex(index)\n }}\n counter={item.counter}\n href={item.href}\n >\n {item.navigation}\n </UnderlineNav.Item>\n ))}\n </UnderlineNav>\n )\n}"
9045
+ "code": "({ initialSelectedIndex = 1 }: { initialSelectedIndex?: number }) => {\n const [selectedIndex, setSelectedIndex] = React.useState<number | null>(\n initialSelectedIndex,\n )\n return (\n <UnderlineNav aria-label=\"Repository\" hideIconsBreakpoint=\"medium\">\n {items.map((item, index) => (\n <UnderlineNav.Item\n key={item.navigation}\n leadingVisual={item.icon}\n aria-current={index === selectedIndex ? 'page' : undefined}\n // Set so that navigation in interaction tests does not cause the\n // page to load the storybook iframe URL and instead keeps the test in\n // the local preview\n target=\"_self\"\n onSelect={(event) => {\n event.preventDefault()\n setSelectedIndex(index)\n }}\n counter={item.counter}\n href={item.href}\n >\n {item.navigation}\n </UnderlineNav.Item>\n ))}\n </UnderlineNav>\n )\n}"
9046
9046
  },
9047
9047
  {
9048
9048
  "id": "components-underlinenav-features--overflow-on-narrow-screen",
@@ -960,6 +960,11 @@
960
960
  {
961
961
  "name": "ThemeProviderProps",
962
962
  "properties": [
963
+ {
964
+ "name": "theme",
965
+ "type": "{[key: string]: any}",
966
+ "description": "The theme object to be applied."
967
+ },
963
968
  {
964
969
  "name": "colorMode",
965
970
  "type": "'auto' | 'day' | 'night' | 'light' | 'dark'",
@@ -985,6 +990,11 @@
985
990
  {
986
991
  "name": "ThemeData",
987
992
  "properties": [
993
+ {
994
+ "name": "theme",
995
+ "type": "Theme",
996
+ "description": "The theme object that is applied."
997
+ },
988
998
  {
989
999
  "name": "colorScheme",
990
1000
  "type": "string",
@@ -995,6 +1005,11 @@
995
1005
  "type": "'auto' | 'day' | 'night' | 'light' | 'dark'",
996
1006
  "description": "The color mode (for example: \"day\", \"night\") that is applied. If the color mode is \"auto\", the color mode is determined by the user's system preference."
997
1007
  },
1008
+ {
1009
+ "name": "resolvedColorScheme",
1010
+ "type": "string",
1011
+ "description": "The name of the current color scheme."
1012
+ },
998
1013
  {
999
1014
  "name": "resolvedColorMode",
1000
1015
  "type": "'day' | 'night' | 'light' | 'dark'",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260731202127",
4
+ "version": "0.0.0-20260803221355",
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",
@@ -45,6 +45,7 @@
45
45
  "build:docs:preview": "NODE_OPTIONS=--openssl-legacy-provider script/build-docs preview",
46
46
  "build:components.json": "tsx script/components-json/build.ts",
47
47
  "build:hooks.json": "tsx script/hooks-json/build.ts",
48
+ "build:precompile-color-schemes": "tsx script/precompile-color-schemes.ts",
48
49
  "lint:npm": "publint --types",
49
50
  "lint:react-compiler": "node script/lint-react-compiler.ts",
50
51
  "storybook": "storybook",
@@ -63,6 +64,7 @@
63
64
  ],
64
65
  "files": [
65
66
  "dist",
67
+ "!dist/legacy-theme/ts/colors",
66
68
  "generated",
67
69
  "CHANGELOG.md"
68
70
  ],
@@ -84,6 +86,7 @@
84
86
  "@tanstack/react-virtual": "^3.13.18",
85
87
  "clsx": "^2.1.1",
86
88
  "color2k": "^2.0.3",
89
+ "deepmerge": "^4.3.1",
87
90
  "focus-visible": "^5.2.1",
88
91
  "history": "^5.0.0",
89
92
  "hsluv": "1.0.1",