@primer/styled-react 0.0.0-20260615151755 → 0.0.0-20260722112739

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 (38) hide show
  1. package/dist/components/BaseStyles.d.ts +23 -14
  2. package/dist/components/BaseStyles.d.ts.map +1 -1
  3. package/dist/components/BaseStyles.js +27 -48
  4. package/dist/components/FeatureFlaggedTheming.d.ts +11 -11
  5. package/dist/components/FeatureFlaggedTheming.d.ts.map +1 -1
  6. package/dist/components/FeatureFlaggedTheming.js +20 -43
  7. package/dist/components/ThemeContext.d.ts +19 -0
  8. package/dist/components/ThemeContext.d.ts.map +1 -0
  9. package/dist/components/ThemeContext.js +9 -0
  10. package/dist/components/ThemeProvider.d.ts +21 -31
  11. package/dist/components/ThemeProvider.d.ts.map +1 -1
  12. package/dist/components/ThemeProvider.js +104 -147
  13. package/dist/components/useFeatureFlaggedTheme.d.ts +8 -0
  14. package/dist/components/useFeatureFlaggedTheme.d.ts.map +1 -0
  15. package/dist/components/useFeatureFlaggedTheme.js +19 -0
  16. package/dist/components/useTheme.d.ts +20 -0
  17. package/dist/components/useTheme.d.ts.map +1 -0
  18. package/dist/components/useTheme.js +12 -0
  19. package/dist/index.d.ts +6 -67
  20. package/dist/index.js +6 -6
  21. package/dist/legacy-theme/ts/color-schemes.js +4252 -0
  22. package/dist/polymorphic.d.ts +23 -26
  23. package/dist/polymorphic.d.ts.map +1 -1
  24. package/dist/styled-props.d.ts +7 -3
  25. package/dist/styled-props.d.ts.map +1 -1
  26. package/dist/sx.d.ts +20 -20
  27. package/dist/sx.d.ts.map +1 -1
  28. package/dist/sx.js +6 -8
  29. package/dist/theme-get.d.ts +4 -1
  30. package/dist/theme-get.d.ts.map +1 -1
  31. package/dist/theme-get.js +7 -9
  32. package/dist/theme-types.d.ts +94 -0
  33. package/dist/theme-types.d.ts.map +1 -0
  34. package/dist/theme.d.ts +1090 -0
  35. package/dist/theme.d.ts.map +1 -0
  36. package/dist/theme.js +14 -0
  37. package/package.json +15 -9
  38. package/dist/index.d.ts.map +0 -1
@@ -0,0 +1,19 @@
1
+ import { useColorSchemeVar as useColorSchemeVar$2, useTheme as useTheme$2 } from "./useTheme.js";
2
+ import { useColorSchemeVar, useTheme } from "@primer/react";
3
+ import { useFeatureFlag } from "@primer/react/experimental";
4
+ //#region src/components/useFeatureFlaggedTheme.ts
5
+ function useTheme$1() {
6
+ const enabled = useFeatureFlag("primer_react_styled_react_use_primer_theme_providers");
7
+ const styledTheme = useTheme$2();
8
+ const primerTheme = useTheme();
9
+ if (enabled) return primerTheme;
10
+ return styledTheme;
11
+ }
12
+ function useColorSchemeVar$1(values, fallback) {
13
+ const enabled = useFeatureFlag("primer_react_styled_react_use_primer_theme_providers");
14
+ const styledValue = useColorSchemeVar$2(values, fallback);
15
+ const primerValue = useColorSchemeVar(values, fallback);
16
+ return enabled ? primerValue : styledValue;
17
+ }
18
+ //#endregion
19
+ export { useColorSchemeVar$1 as useColorSchemeVar, useTheme$1 as useTheme };
@@ -0,0 +1,20 @@
1
+ import { ColorMode, ColorModeWithAuto, Theme } from "./ThemeProvider.js";
2
+ import React from "react";
3
+
4
+ //#region src/components/useTheme.d.ts
5
+ declare function useTheme(): {
6
+ theme?: Theme;
7
+ colorScheme?: string;
8
+ colorMode?: ColorModeWithAuto;
9
+ resolvedColorMode?: ColorMode;
10
+ resolvedColorScheme?: string;
11
+ dayScheme?: string;
12
+ nightScheme?: string;
13
+ setColorMode: React.Dispatch<React.SetStateAction<ColorModeWithAuto>>;
14
+ setDayScheme: React.Dispatch<React.SetStateAction<string>>;
15
+ setNightScheme: React.Dispatch<React.SetStateAction<string>>;
16
+ };
17
+ declare function useColorSchemeVar(values: Partial<Record<string, string>>, fallback: string): string;
18
+ //#endregion
19
+ export { useColorSchemeVar, useTheme };
20
+ //# sourceMappingURL=useTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTheme.d.ts","names":[],"sources":["../../src/components/useTheme.ts"],"mappings":";;;;iBAGgB,QAAA;UAAQ,KAAA;;;;;;;;;;;iBAIR,iBAAA,CAAkB,MAAA,EAAQ,OAAO,CAAC,MAAA,mBAAyB,QAAA"}
@@ -0,0 +1,12 @@
1
+ import { ThemeContext } from "./ThemeContext.js";
2
+ import React from "react";
3
+ //#region src/components/useTheme.ts
4
+ function useTheme() {
5
+ return React.useContext(ThemeContext);
6
+ }
7
+ function useColorSchemeVar(values, fallback) {
8
+ const { colorScheme = "" } = useTheme();
9
+ return values[colorScheme] ?? fallback;
10
+ }
11
+ //#endregion
12
+ export { useColorSchemeVar, useTheme };
package/dist/index.d.ts CHANGED
@@ -1,67 +1,6 @@
1
- export {
2
- /**
3
- * @deprecated Theming in JavaScript is no longer supported. Prefer using
4
- * `@primer/primitives` and CSS Modules instead.
5
- */
6
- ThemeProvider,
7
- /**
8
- * @deprecated Theming in JavaScript is no longer supported. Prefer using
9
- * `@primer/primitives` and CSS Modules instead.
10
- */
11
- useTheme,
12
- /**
13
- * @deprecated Theming in JavaScript is no longer supported. Prefer using
14
- * `@primer/primitives` and CSS Modules instead.
15
- */
16
- useColorSchemeVar,
17
- /**
18
- * @deprecated Theming in JavaScript is no longer supported. Prefer using
19
- * `@primer/primitives` and CSS Modules instead.
20
- */
21
- type ThemeProviderProps, } from './components/FeatureFlaggedTheming';
22
- export {
23
- /**
24
- * @deprecated Usage of the `sx` prop with this component is no longer
25
- * supported. Use the component from `@primer/react` with CSS Modules instead.
26
- */
27
- BaseStyles,
28
- /**
29
- * @deprecated Usage of the `sx` prop with this component is no longer
30
- * supported. Use the component from `@primer/react` with CSS Modules instead.
31
- */
32
- type BaseStylesProps, } from './components/FeatureFlaggedTheming';
33
- export {
34
- /**
35
- * @deprecated Theming in JavaScript is no longer supported. Prefer using
36
- * `@primer/primitives` and CSS Modules instead.
37
- */
38
- theme, } from '@primer/react';
39
- export {
40
- /**
41
- * @deprecated Theming in JavaScript is no longer supported. Prefer using
42
- * `@primer/primitives` and CSS Modules instead.
43
- */
44
- get as themeGet, } from './theme-get';
45
- export {
46
- /**
47
- * @deprecated Theming in JavaScript is no longer supported. Prefer using
48
- * `@primer/primitives` and CSS Modules instead.
49
- */
50
- merge,
51
- /**
52
- * @deprecated Styling with the `sx` prop is no longer supported. Use CSS
53
- * Modules instead
54
- */
55
- sx,
56
- /**
57
- * @deprecated Styling with the `sx` prop is no longer supported. Use CSS
58
- * Modules instead
59
- */
60
- type SxProp, } from './sx';
61
- export {
62
- /**
63
- * @deprecated Styling with the `sx` prop is no longer supported. Use CSS
64
- * Modules instead
65
- */
66
- type BetterSystemStyleObject, } from './sx';
67
- //# sourceMappingURL=index.d.ts.map
1
+ import { BaseStyles, BaseStylesProps, ThemeProvider, ThemeProviderProps } from "./components/FeatureFlaggedTheming.js";
2
+ import { useColorSchemeVar, useTheme } from "./components/useFeatureFlaggedTheme.js";
3
+ import { theme } from "./theme.js";
4
+ import { get } from "./theme-get.js";
5
+ import sx, { BetterSystemStyleObject, SxProp, merge } from "./sx.js";
6
+ export { BaseStyles, type BaseStylesProps, type BetterSystemStyleObject, type SxProp, ThemeProvider, type ThemeProviderProps, merge, sx, theme, get as themeGet, useColorSchemeVar, useTheme };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- export { BaseStyles, ThemeProvider, useTheme } from './components/FeatureFlaggedTheming.js';
3
- export { theme } from '@primer/react';
4
- export { get as themeGet } from './theme-get.js';
5
- export { sx } from './sx.js';
6
- export { default as merge } from 'deepmerge';
7
- export { useColorSchemeVar } from './components/ThemeProvider.js';
2
+ import { theme } from "./theme.js";
3
+ import { BaseStyles, ThemeProvider } from "./components/FeatureFlaggedTheming.js";
4
+ import { useColorSchemeVar, useTheme } from "./components/useFeatureFlaggedTheme.js";
5
+ import { get } from "./theme-get.js";
6
+ import sx, { merge } from "./sx.js";
7
+ export { BaseStyles, ThemeProvider, merge, sx, theme, get as themeGet, useColorSchemeVar, useTheme };