@primer/react 0.0.0-20260813224533 → 0.0.0-20260814130501

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 (57) hide show
  1. package/CHANGELOG.md +3 -28
  2. package/dist/ActionBar/ActionBar.js +8 -10
  3. package/dist/ActionList/Group-efcb39da.css +2 -0
  4. package/dist/ActionList/Group-efcb39da.css.map +1 -0
  5. package/dist/ActionList/Group.module.css.js +2 -2
  6. package/dist/ActionList/Heading.js +1 -2
  7. package/dist/ActionList/Item.js +277 -282
  8. package/dist/ActionList/LinkItem.js +3 -11
  9. package/dist/ActionList/index.d.ts +0 -3
  10. package/dist/ActionList/shared.d.ts +0 -4
  11. package/dist/AvatarStack/{AvatarStack-e6a99916.css → AvatarStack-9bb5649f.css} +2 -2
  12. package/dist/AvatarStack/AvatarStack-9bb5649f.css.map +1 -0
  13. package/dist/AvatarStack/AvatarStack.module.css.js +1 -1
  14. package/dist/CounterLabel/CounterLabel.js +2 -5
  15. package/dist/Details/Details.js +1 -2
  16. package/dist/Dialog/Dialog.js +2 -3
  17. package/dist/FeatureFlags/DefaultFeatureFlags.js +2 -1
  18. package/dist/NavList/NavList.d.ts +2 -4
  19. package/dist/NavList/NavList.js +45 -87
  20. package/dist/PageHeader/PageHeader.js +1 -2
  21. package/dist/Popover/Popover.d.ts +0 -1
  22. package/dist/Popover/Popover.js +47 -84
  23. package/dist/Portal/Portal.js +29 -91
  24. package/dist/Radio/Radio.js +1 -1
  25. package/dist/SelectPanel/SelectPanel.js +25 -26
  26. package/dist/ThemeProvider.d.ts +0 -3
  27. package/dist/ThemeProvider.js +129 -39
  28. package/dist/TooltipV2/Tooltip.js +2 -3
  29. package/dist/TreeView/TreeView.js +1 -0
  30. package/dist/UnderlineNav/UnderlineNav.d.ts +2 -3
  31. package/dist/UnderlineNav/UnderlineNav.js +1 -1
  32. package/dist/deprecated/ActionList/List.js +1 -2
  33. package/dist/experimental/SelectPanel2/SelectPanel.js +4 -7
  34. package/dist/experimental/Tabs/Tabs.js +33 -19
  35. package/dist/experimental/Tabs/types.d.ts +6 -0
  36. package/dist/experimental/Tabs/useTab.js +6 -1
  37. package/dist/experimental/Tabs/useTabList.js +29 -22
  38. package/dist/experimental/UnderlinePanels/UnderlinePanels.d.ts +38 -1
  39. package/dist/experimental/UnderlinePanels/UnderlinePanels.js +69 -18
  40. package/dist/hooks/useFocusZone.js +1 -2
  41. package/dist/hooks/useMenuInitialFocus.js +57 -72
  42. package/dist/legacy-theme/ts/color-schemes.js +3942 -3942
  43. package/dist/next/index.d.ts +1 -4
  44. package/dist/next/index.js +1 -3
  45. package/dist/theme.d.ts +54 -16
  46. package/dist/useTheme.d.ts +14 -2
  47. package/generated/components.json +56 -14
  48. package/generated/hooks.json +7 -2
  49. package/package.json +10 -8
  50. package/dist/ActionList/Group-d89306a8.css +0 -2
  51. package/dist/ActionList/Group-d89306a8.css.map +0 -1
  52. package/dist/AvatarStack/AvatarStack-e6a99916.css.map +0 -1
  53. package/dist/ThemeContext.d.ts +0 -20
  54. package/dist/internal/components/ThemeProviderBase.js +0 -50
  55. package/dist/internal/hooks/useThemeProvider.js +0 -71
  56. package/dist/next/ThemeProvider.d.ts +0 -7
  57. package/dist/next/ThemeProvider.js +0 -35
@@ -1,5 +1,2 @@
1
- import { ThemeProviderProps } from "../ThemeProvider.js";
2
- import { useColorSchemeVar, useTheme } from "../useTheme.js";
3
1
  import { Tooltip, TooltipProps } from "../TooltipV2/Tooltip.js";
4
- import { ThemeProvider } from "./ThemeProvider.js";
5
- export { ThemeProvider, type ThemeProviderProps, Tooltip, type TooltipProps, useColorSchemeVar, useTheme };
2
+ export { Tooltip, type TooltipProps };
@@ -1,5 +1,3 @@
1
1
  "use client";
2
- import { useColorSchemeVar, useTheme } from "../useTheme.js";
3
2
  import { Tooltip } from "../TooltipV2/Tooltip.js";
4
- import { ThemeProvider } from "./ThemeProvider.js";
5
- export { ThemeProvider, Tooltip, useColorSchemeVar, useTheme };
3
+ export { Tooltip };
package/dist/theme.d.ts CHANGED
@@ -1082,7 +1082,6 @@ declare const theme: {
1082
1082
  }>;
1083
1083
  }>;
1084
1084
  };
1085
- /** @deprecated Use `ThemeProvider` from `@primer/react/next` to migrate away from JavaScript theme values. */
1086
1085
  type ThemeColors = {
1087
1086
  fg: {
1088
1087
  default: string;
@@ -1107,21 +1106,60 @@ type ThemeColors = {
1107
1106
  muted: string;
1108
1107
  subtle: string;
1109
1108
  };
1110
- accent: ThemeRole;
1111
- success: ThemeRole;
1112
- attention: ThemeRole;
1113
- severe: ThemeRole;
1114
- danger: ThemeRole;
1115
- open: ThemeRole;
1116
- closed: ThemeRole;
1117
- done: ThemeRole;
1118
- sponsors: ThemeRole;
1119
- };
1120
- type ThemeRole = {
1121
- fg: string;
1122
- emphasis: string;
1123
- muted: string;
1124
- subtle: string;
1109
+ accent: {
1110
+ fg: string;
1111
+ emphasis: string;
1112
+ muted: string;
1113
+ subtle: string;
1114
+ };
1115
+ success: {
1116
+ fg: string;
1117
+ emphasis: string;
1118
+ muted: string;
1119
+ subtle: string;
1120
+ };
1121
+ attention: {
1122
+ fg: string;
1123
+ emphasis: string;
1124
+ muted: string;
1125
+ subtle: string;
1126
+ };
1127
+ severe: {
1128
+ fg: string;
1129
+ emphasis: string;
1130
+ muted: string;
1131
+ subtle: string;
1132
+ };
1133
+ danger: {
1134
+ fg: string;
1135
+ emphasis: string;
1136
+ muted: string;
1137
+ subtle: string;
1138
+ };
1139
+ open: {
1140
+ fg: string;
1141
+ emphasis: string;
1142
+ muted: string;
1143
+ subtle: string;
1144
+ };
1145
+ closed: {
1146
+ fg: string;
1147
+ emphasis: string;
1148
+ muted: string;
1149
+ subtle: string;
1150
+ };
1151
+ done: {
1152
+ fg: string;
1153
+ emphasis: string;
1154
+ muted: string;
1155
+ subtle: string;
1156
+ };
1157
+ sponsors: {
1158
+ fg: string;
1159
+ emphasis: string;
1160
+ muted: string;
1161
+ subtle: string;
1162
+ };
1125
1163
  };
1126
1164
  type ThemeShadows = {
1127
1165
  shadow: {
@@ -1,7 +1,19 @@
1
- import { ThemeContextValue } from "./ThemeContext.js";
1
+ import { ColorMode, ColorModeWithAuto, Theme } from "./ThemeProvider.js";
2
+ import React from "react";
2
3
 
3
4
  //#region src/useTheme.d.ts
4
- declare function useTheme(): ThemeContextValue;
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
+ };
5
17
  declare function useColorSchemeVar(values: Partial<Record<string, string>>, fallback: string): string;
6
18
  //#endregion
7
19
  export { useColorSchemeVar, useTheme };
@@ -5659,11 +5659,6 @@
5659
5659
  "type": "(event: MouseEvent | TouchEvent) => void",
5660
5660
  "description": "Callback fired when a click is detected outside the popover content"
5661
5661
  },
5662
- {
5663
- "name": "onEscape",
5664
- "type": "(event: KeyboardEvent) => void",
5665
- "description": "Callback fired when the Escape key is pressed while the popover is open"
5666
- },
5667
5662
  {
5668
5663
  "name": "ignoreClickRefs",
5669
5664
  "type": "React.RefObject<HTMLElement>[]",
@@ -9042,7 +9037,7 @@
9042
9037
  },
9043
9038
  {
9044
9039
  "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\" 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}"
9040
+ "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}"
9046
9041
  },
9047
9042
  {
9048
9043
  "id": "components-underlinenav-features--overflow-on-narrow-screen",
@@ -9078,12 +9073,6 @@
9078
9073
  "defaultValue": "false",
9079
9074
  "description": "Whether the navigation items are in loading state. Component waits for all the counters to finish loading to prevent multiple layout shifts."
9080
9075
  },
9081
- {
9082
- "name": "hideIconsBreakpoint",
9083
- "type": "'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | null",
9084
- "defaultValue": "'medium'",
9085
- "description": "Controls the container width below which icons are hidden to save space. To keep icons visible in a narrow container, use a smaller breakpoint such as `xsmall`, or set to `null` to always show icons."
9086
- },
9087
9076
  {
9088
9077
  "name": "variant",
9089
9078
  "type": "'inset' | 'flush'",
@@ -9599,6 +9588,22 @@
9599
9588
  {
9600
9589
  "id": "experimental-components-underlinepanels-features--with-icons-hidden-on-narrow-screen",
9601
9590
  "code": "() => (\n <UnderlinePanels aria-label=\"Tabs with icons\">\n <UnderlinePanels.Tab icon={CodeIcon}>Tab 1</UnderlinePanels.Tab>\n <UnderlinePanels.Tab icon={EyeIcon}>Tab 2</UnderlinePanels.Tab>\n <UnderlinePanels.Tab icon={GitPullRequestIcon}>Tab 3</UnderlinePanels.Tab>\n <UnderlinePanels.Tab icon={CommentDiscussionIcon}>\n Tab 4\n </UnderlinePanels.Tab>\n <UnderlinePanels.Tab icon={PlayIcon}>Tab 5</UnderlinePanels.Tab>\n <UnderlinePanels.Tab icon={ProjectIcon}>Tab 6</UnderlinePanels.Tab>\n <UnderlinePanels.Tab icon={GraphIcon}>Tab 7</UnderlinePanels.Tab>\n <UnderlinePanels.Tab icon={GearIcon}>Tab 8</UnderlinePanels.Tab>\n <UnderlinePanels.Tab icon={ShieldLockIcon}>Tab 9</UnderlinePanels.Tab>\n <UnderlinePanels.Panel>Panel 1</UnderlinePanels.Panel>\n <UnderlinePanels.Panel>Panel 2</UnderlinePanels.Panel>\n <UnderlinePanels.Panel>Panel 3</UnderlinePanels.Panel>\n <UnderlinePanels.Panel>Panel 4</UnderlinePanels.Panel>\n <UnderlinePanels.Panel>Panel 5</UnderlinePanels.Panel>\n <UnderlinePanels.Panel>Panel 6</UnderlinePanels.Panel>\n <UnderlinePanels.Panel>Panel 7</UnderlinePanels.Panel>\n <UnderlinePanels.Panel>Panel 8</UnderlinePanels.Panel>\n <UnderlinePanels.Panel>Panel 9</UnderlinePanels.Panel>\n </UnderlinePanels>\n)"
9591
+ },
9592
+ {
9593
+ "id": "experimental-components-underlinepanels-features--controlled",
9594
+ "code": "() => {\n const [refType, setRefType] = useState('branch')\n return (\n <>\n <FlagState />\n <UnderlinePanels\n aria-label=\"Ref type\"\n value={refType}\n onChange={({ value }) => {\n action('onChange')({\n value,\n })\n setRefType(value)\n }}\n >\n <UnderlinePanels.Tab value=\"branch\" icon={GitBranchIcon}>\n Branches\n </UnderlinePanels.Tab>\n <UnderlinePanels.Tab value=\"tag\" icon={TagIcon}>\n Tags\n </UnderlinePanels.Tab>\n <UnderlinePanels.Panel value=\"branch\">\n Find or create a branch…\n </UnderlinePanels.Panel>\n <UnderlinePanels.Panel value=\"tag\">\n Search or create a new tag…\n </UnderlinePanels.Panel>\n </UnderlinePanels>\n <p>\n Selected ref type: <strong>{refType}</strong>\n </p>\n </>\n )\n}"
9595
+ },
9596
+ {
9597
+ "id": "experimental-components-underlinepanels-features--uncontrolled",
9598
+ "code": "() => (\n <>\n <FlagState />\n <UnderlinePanels\n aria-label=\"Ref type\"\n defaultValue=\"tag\"\n onChange={({ value }) => {\n action('onChange')({\n value,\n })\n }}\n >\n <UnderlinePanels.Tab value=\"branch\">Branches</UnderlinePanels.Tab>\n <UnderlinePanels.Tab value=\"tag\">Tags</UnderlinePanels.Tab>\n <UnderlinePanels.Panel value=\"branch\">\n Find or create a branch…\n </UnderlinePanels.Panel>\n <UnderlinePanels.Panel value=\"tag\">\n Search or create a new tag…\n </UnderlinePanels.Panel>\n </UnderlinePanels>\n </>\n)"
9599
+ },
9600
+ {
9601
+ "id": "experimental-components-underlinepanels-features--manual-activation",
9602
+ "code": "() => {\n const [refType, setRefType] = useState('branch')\n return (\n <>\n <FlagState />\n <p>\n With <code>activationMode=&quot;manual&quot;</code>, arrow keys only\n move focus; press Enter or Space (or click) to commit selection. Prefer\n this when switching tabs triggers async work like a fetch.\n </p>\n <UnderlinePanels\n aria-label=\"Ref type\"\n value={refType}\n activationMode=\"manual\"\n onChange={({ value }) => {\n action('onChange')({\n value,\n })\n setRefType(value)\n }}\n >\n <UnderlinePanels.Tab value=\"branch\">Branches</UnderlinePanels.Tab>\n <UnderlinePanels.Tab value=\"tag\">Tags</UnderlinePanels.Tab>\n <UnderlinePanels.Panel value=\"branch\">\n Find or create a branch…\n </UnderlinePanels.Panel>\n <UnderlinePanels.Panel value=\"tag\">\n Search or create a new tag…\n </UnderlinePanels.Panel>\n </UnderlinePanels>\n </>\n )\n}"
9603
+ },
9604
+ {
9605
+ "id": "experimental-components-underlinepanels-features--in-overlay",
9606
+ "code": "() => {\n const [open, setOpen] = useState(false)\n const [refType, setRefType] = useState('branch')\n return (\n <>\n <FlagState />\n <AnchoredOverlay\n open={open}\n onOpen={() => setOpen(true)}\n onClose={() => setOpen(false)}\n renderAnchor={(props) => <Button {...props}>Select ref type</Button>}\n overlayProps={{\n role: 'dialog',\n 'aria-modal': true,\n 'aria-label': 'Select a ref type',\n style: {\n width: '320px',\n },\n }}\n focusZoneSettings={{\n disabled: true,\n }}\n >\n <UnderlinePanels\n aria-label=\"Ref type\"\n value={refType}\n onChange={({ value }) => {\n action('onChange')({\n value,\n })\n setRefType(value)\n }}\n >\n <UnderlinePanels.Tab value=\"branch\">Branches</UnderlinePanels.Tab>\n <UnderlinePanels.Tab value=\"tag\">Tags</UnderlinePanels.Tab>\n <UnderlinePanels.Panel value=\"branch\">\n Find or create a branch…\n </UnderlinePanels.Panel>\n <UnderlinePanels.Panel value=\"tag\">\n Search or create a new tag…\n </UnderlinePanels.Panel>\n </UnderlinePanels>\n </AnchoredOverlay>\n </>\n )\n}"
9602
9607
  }
9603
9608
  ],
9604
9609
  "importPath": "@primer/react/experimental",
@@ -9615,6 +9620,30 @@
9615
9620
  "defaultValue": "",
9616
9621
  "description": "ID of the element containing the name for the tab list"
9617
9622
  },
9623
+ {
9624
+ "name": "value",
9625
+ "type": "string",
9626
+ "defaultValue": "",
9627
+ "description": "The value of the selected tab, keyed to each `UnderlinePanels.Tab`/`UnderlinePanels.Panel` `value`. Provide this (with `onChange`) for a controlled component where the selected tab is the single source of truth. Requires the `primer_react_underline_panels_controlled` feature flag."
9628
+ },
9629
+ {
9630
+ "name": "defaultValue",
9631
+ "type": "string",
9632
+ "defaultValue": "",
9633
+ "description": "The value of the tab selected by default, for an uncontrolled component. Cannot be combined with `value`."
9634
+ },
9635
+ {
9636
+ "name": "onChange",
9637
+ "type": "({value}: {value: string}) => void",
9638
+ "defaultValue": "",
9639
+ "description": "Callback fired whenever the selected tab changes, for every selection method — pointer, Enter/Space, and Arrow/Home/End keys. Unlike `UnderlinePanels.Tab`'s `onSelect` (which only fires on click and Enter/Space), this makes the selected value usable as a single source of truth for data-driven tabs."
9640
+ },
9641
+ {
9642
+ "name": "activationMode",
9643
+ "type": "'automatic' | 'manual'",
9644
+ "defaultValue": "'automatic'",
9645
+ "description": "Controls how tabs are activated with the keyboard. `'automatic'` selects on focus (Arrow/Home/End select immediately); `'manual'` moves focus only and commits selection on Enter, Space, or click. Prefer `'manual'` when displaying a panel is not instant (e.g. it triggers a network request). Requires the `primer_react_underline_panels_controlled` feature flag."
9646
+ },
9618
9647
  {
9619
9648
  "name": "children",
9620
9649
  "type": "Array<UnderlinePanels.Tab | UnderlinePanels.Panel>",
@@ -9645,6 +9674,12 @@
9645
9674
  {
9646
9675
  "name": "UnderlinePanels.Tab",
9647
9676
  "props": [
9677
+ {
9678
+ "name": "value",
9679
+ "type": "string",
9680
+ "defaultValue": "",
9681
+ "description": "A value that uniquely identifies this tab, paired with the `UnderlinePanels.Panel` of the same `value`. Provide this to use domain values (e.g. `'branch'`) with the container's controlled `value`/`onChange` API. When omitted, tabs and panels are paired by DOM order."
9682
+ },
9648
9683
  {
9649
9684
  "name": "aria-selected",
9650
9685
  "type": "| boolean | 'true' | 'false'",
@@ -9655,7 +9690,7 @@
9655
9690
  "name": "onSelect",
9656
9691
  "type": "(event) => void",
9657
9692
  "defaultValue": "",
9658
- "description": "The handler that gets called when the tab is selected"
9693
+ "description": "The handler that gets called when the tab is selected. Note: this fires only on click and Enter/Space — not on arrow-key navigation. For a callback that fires for every selection method, use the container's `onChange` prop instead."
9659
9694
  },
9660
9695
  {
9661
9696
  "name": "counter",
@@ -9673,7 +9708,14 @@
9673
9708
  },
9674
9709
  {
9675
9710
  "name": "UnderlinePanels.Panel",
9676
- "props": [],
9711
+ "props": [
9712
+ {
9713
+ "name": "value",
9714
+ "type": "string",
9715
+ "defaultValue": "",
9716
+ "description": "A value that uniquely identifies this panel, paired with the `UnderlinePanels.Tab` of the same `value`. When omitted, tabs and panels are paired by DOM order."
9717
+ }
9718
+ ],
9677
9719
  "passthrough": {
9678
9720
  "element": "div",
9679
9721
  "url": "https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#Attributes"
@@ -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'",
@@ -988,7 +993,7 @@
988
993
  {
989
994
  "name": "theme",
990
995
  "type": "Theme",
991
- "description": "Deprecated: Use `ThemeProvider` from `@primer/react/next` to migrate away from JavaScript theme values."
996
+ "description": "The theme object that is applied."
992
997
  },
993
998
  {
994
999
  "name": "colorScheme",
@@ -1003,7 +1008,7 @@
1003
1008
  {
1004
1009
  "name": "resolvedColorScheme",
1005
1010
  "type": "string",
1006
- "description": "Deprecated: Use `colorScheme` with `ThemeProvider` from `@primer/react/next`."
1011
+ "description": "The name of the current color scheme."
1007
1012
  },
1008
1013
  {
1009
1014
  "name": "resolvedColorMode",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260813224533",
4
+ "version": "0.0.0-20260814130501",
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
  ],
@@ -108,12 +110,12 @@
108
110
  "@primer/doc-gen": "^0.0.1",
109
111
  "@primer/react-compiler-check": "^0.0.0",
110
112
  "@rolldown/plugin-babel": "^0.2.3",
111
- "@storybook/addon-a11y": "10.5.5",
112
- "@storybook/addon-docs": "10.5.5",
113
- "@storybook/addon-links": "10.5.5",
114
- "@storybook/addon-mcp": "^0.7.0",
113
+ "@storybook/addon-a11y": "10.5.0",
114
+ "@storybook/addon-docs": "10.5.0",
115
+ "@storybook/addon-links": "10.5.0",
116
+ "@storybook/addon-mcp": "^0.6.0",
115
117
  "@storybook/icons": "^2.1.0",
116
- "@storybook/react-vite": "10.5.5",
118
+ "@storybook/react-vite": "10.5.0",
117
119
  "@testing-library/dom": "^10.4.0",
118
120
  "@testing-library/jest-dom": "^6.4.5",
119
121
  "@testing-library/react": "^16.3.0",
@@ -166,11 +168,11 @@
166
168
  "react-is": "18.3.1",
167
169
  "recast": "0.23.7",
168
170
  "rimraf": "5.0.5",
169
- "rolldown": "^1.2.2",
171
+ "rolldown": "^1.1.4",
170
172
  "rolldown-plugin-dts": "^0.26.0",
171
173
  "rolldown-plugin-import-css": "^0.0.0",
172
174
  "rolldown-plugin-preserve-directives": "^0.0.0",
173
- "storybook": "10.5.5",
175
+ "storybook": "10.5.0",
174
176
  "terser": "5.36.0",
175
177
  "ts-toolbelt": "9.6.0",
176
178
  "tsx": "4.20.3",
@@ -1,2 +0,0 @@
1
- .prc-ActionList-Group-lMIPQ{list-style:none}.prc-ActionList-Group-lMIPQ:not(:first-child){margin-block-start:var(--base-size-8,.5rem)}.prc-ActionList-GroupList-V5B3-{padding-inline-start:0}.prc-ActionList-GroupHeadingWrap-laXcX{color:var(--fgColor-muted,#59636e);display:flex;flex-direction:column;font-size:var(--text-body-size-small,.75rem);font-weight:var(--base-text-weight-semibold,600);line-height:18px;padding-block:var(--base-size-6,.375rem);padding-inline:var(--base-size-16,1rem)}.prc-ActionList-GroupHeadingWrap-laXcX:where([data-variant=filled]){background:var(--bgColor-muted,#f6f8fa);border-bottom:var(--borderWidth-thin,.0625rem) solid var(--borderColor-muted,#d1d9e0b3);border-top:var(--borderWidth-thin,.0625rem) solid var(--borderColor-muted,#d1d9e0b3);margin-block-end:var(--base-size-8,.5rem);margin-block-start:calc(var(--base-size-8,.5rem) - var(--borderWidth-thin,.0625rem));padding-inline:var(--base-size-16,1rem)}.prc-ActionList-GroupHeadingWrap-laXcX:where([data-variant=filled]):first-child{margin-block-start:0}.prc-ActionList-GroupHeading-STzxi{align-self:flex-start;color:var(--fgColor-muted,#59636e);font-size:var(--text-body-size-small,.75rem);font-weight:var(--base-text-weight-semibold,600);margin:0}.prc-ActionList-GroupHeadingWrap-laXcX[data-has-trailing-action]{align-items:center;flex-direction:row;gap:var(--base-size-8,.5rem);justify-content:space-between}.prc-ActionList-GroupHeadingWrap-laXcX[data-has-trailing-action]>.prc-ActionList-GroupHeading-STzxi{align-self:center}.prc-ActionList-GroupHeadingTrailingAction-jnb64{align-items:center;display:inline-flex;margin-inline-start:auto}
2
- /*# sourceMappingURL=Group-d89306a8.css.map */
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/ActionList/Group.module.css.js"],"names":[],"mappings":"AAAA,4BACE,eAKF,CAHE,8CACE,2CACF,CAGF,gCACE,sBACF,CAEA,uCAQE,kCAA2B,CAP3B,YAAa,CAQb,qBAAsB,CAPtB,4CAAsC,CACtC,gDAA6C,CAI7C,gBAAiB,CAIjB,wCAAiC,CADjC,uCAoBF,CAjBE,oEAIE,uCAAgC,CAEhC,uFAAqE,CADrE,oFAAkE,CAFlE,yCAAoC,CADpC,oFAAsE,CAKtE,uCAKF,CAHE,gFACE,oBACF,CAQJ,mCAKE,qBAAsB,CADtB,kCAA2B,CAF3B,4CAAsC,CACtC,gDAA6C,CAF7C,QAKF,CAEA,iEAEE,kBAAmB,CADnB,kBAAmB,CAGnB,4BAAuB,CADvB,6BAMF,CAHE,oGACE,iBACF,CAGF,iDAEE,kBAAmB,CADnB,mBAAoB,CAEpB,wBACF","file":"Group-d89306a8.css","sourcesContent":[".Group {\n list-style: none;\n\n &:not(:first-child) {\n margin-block-start: var(--base-size-8);\n }\n}\n\n.GroupList {\n padding-inline-start: 0;\n}\n\n.GroupHeadingWrap {\n display: flex;\n font-size: var(--text-body-size-small);\n font-weight: var(--base-text-weight-semibold);\n\n /* line-height: var(--text-body-lineHeight-small); use when FF rolls out */\n /* stylelint-disable-next-line primer/typography */\n line-height: 18px;\n color: var(--fgColor-muted);\n flex-direction: column;\n padding-inline: var(--base-size-16);\n padding-block: var(--base-size-6);\n\n &:where([data-variant='filled']) {\n /* stylelint-disable-next-line primer/spacing */\n margin-block-start: calc(var(--base-size-8) - var(--borderWidth-thin));\n margin-block-end: var(--base-size-8);\n background: var(--bgColor-muted);\n border-top: solid var(--borderWidth-thin) var(--borderColor-muted);\n border-bottom: solid var(--borderWidth-thin) var(--borderColor-muted);\n padding-inline: var(--base-size-16);\n\n &:first-child {\n margin-block-start: 0;\n }\n }\n\n /* & + ul:has(.GroupHeadingWrap) {\n outline: solid 1px red;\n } */\n}\n\n.GroupHeading {\n margin: 0;\n font-size: var(--text-body-size-small);\n font-weight: var(--base-text-weight-semibold);\n color: var(--fgColor-muted);\n align-self: flex-start;\n}\n\n.GroupHeadingWrap[data-has-trailing-action] {\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: var(--base-size-8);\n\n & > .GroupHeading {\n align-self: center;\n }\n}\n\n.GroupHeadingTrailingAction {\n display: inline-flex;\n align-items: center;\n margin-inline-start: auto;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/AvatarStack/AvatarStack.module.css.js"],"names":[],"mappings":"AACA,mCACE,yBAA0B,CAC1B,qDAA0D,CAC1D,eAAgB,CAChB,kBAAmB,CAGnB,YAAa,CAEb,+BAAgC,CAChC,iBAAkB,CAFlB,kCAAmC,CAFnC,iBA2GF,CArGE,iEACE,kDAAqD,CACrD,oEACF,CAEA,+DACE,kDAAqD,CACrD,oEACF,CAGE,mDADF,4DAEI,2CAUJ,CATE,CAEA,oCALF,4DAMI,4CAMJ,CALE,CAEA,sCATF,4DAUI,yCAEJ,CADE,CAIA,sJAEE,+EACF,CAGF,uHAEE,qBACF,CAEA,yIAEE,sBACF,CAEA,kEAME,yFACF,CAEA,wFAOE,4JAIF,CAEA,sFAME,+GACF,CAEA,yFAOE,gKAIF,CAEA,uFAME,+GAAkH,CAElH,oDACF,CAEA,6DACE,cAAe,CAEf,aACF,CAGF,uCAEE,YAAa,CADb,iBAMF,CAHE,oEACE,iBACF,CAGF,kCACE,6CAA8C,CAG9C,YAAa,CAIb,aAAc,CAFd,+BAAgC,CAChC,eAAgB,CAJhB,iBAAkB,CAMlB,iHAI4B,CAR5B,8BAqHF,CA1GE,mGAEE,uDACF,CAGA,wFACE,iBACF,CAGA,mGAEE,qBACF,CAGA,qHAEE,sBACF,CAEA,8CACE,qBACF,CAEA,iDAEE,gDAAmD,CAKnD,sBAAuB,CAQvB,8HAEK,CAdL,+BAAiC,CACjC,gDAEM,CAeN,YACF,CAGA,+GACE,yFACF,CAGA,+GAEE,yFACF,CAGA,kHACE,oDAAqD,CAGrD,0CACF,CAGA,kHAEE,0CACF,CAGA,kHAEE,0CACF,CAEA,4GACE,SACF,CAEA,6GACE,SACF,CAEA,6GACE,SACF,CAEA,6GACE,SACF,CAEA,6GACE,SACF,CAEA,iDAGE,SAAU,CAFV,iBAAkB,CAClB,iBAEF,CAGF,uJAEE,UAuBF,CArBE,iHACE,gBAAiB,CAGjB,6CAAuC,CASvC,yEAEK,CATL,SAAU,CAHV,iBAAkB,CAElB,kBAeF,CApBA,0GACE,gBAAiB,CAGjB,6CAAuC,CASvC,yEAEK,CATL,SAAU,CAHV,iBAAkB,CAElB,kBAeF,CAHE,sHACE,qBACF,CAFA,6HACE,qBACF","file":"AvatarStack-e6a99916.css","sourcesContent":["/* stylelint-disable selector-max-specificity */\n.AvatarStack {\n --avatar-border-width: 1px;\n --mask-size: calc(100% + (var(--avatar-border-width) * 2));\n --mask-start: -1;\n --opacity-step: 15%;\n\n position: relative;\n display: flex;\n min-width: var(--avatar-stack-size);\n height: var(--avatar-stack-size);\n isolation: isolate;\n\n &:where([data-variant='cascade']) {\n --overlap-size: calc(var(--avatar-stack-size) * 0.55);\n --overlap-size-avatar-three-plus: calc(var(--avatar-stack-size) * 0.85);\n }\n\n &:where([data-variant='stack']) {\n --overlap-size: calc(var(--avatar-stack-size) * 0.55);\n --overlap-size-avatar-three-plus: calc(var(--avatar-stack-size) * 0.55);\n }\n\n &:where([data-responsive]) {\n @media screen and (--viewportRange-narrow) {\n --avatar-stack-size: var(--stackSize-narrow);\n }\n\n @media screen and (--viewportRange-regular) {\n --avatar-stack-size: var(--stackSize-regular);\n }\n\n @media screen and (--viewportRange-wide) {\n --avatar-stack-size: var(--stackSize-wide);\n }\n }\n\n &:where([data-avatar-count='1'][data-shape='circle']) {\n .AvatarItem:where([data-component='Avatar']) {\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: 0 0 0 var(--avatar-border-width) var(--avatar-borderColor);\n }\n }\n\n &:where([data-avatar-count='1'][data-shape='square']) .AvatarItem {\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: 1px 0 rgb(0, 0, 0, 1);\n }\n\n &:where([data-avatar-count='1'][data-shape='square'][data-align-right]) .AvatarItem {\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: -1px 0 rgb(0, 0, 0, 1);\n }\n\n &:where([data-avatar-count='2']) {\n /*\n MIN-WIDTH CALC FORMULA EXPLAINED:\n avatar size ➡️ var(--avatar-stack-size)\n plus the visible part of the 2nd avatar ➡️ var(--avatar-stack-size) - var(--overlap-size)\n */\n min-width: calc(var(--avatar-stack-size) + (var(--avatar-stack-size) - var(--overlap-size)));\n }\n\n &:where([data-avatar-count='3'][data-variant='cascade']) {\n /*\n MIN-WIDTH CALC FORMULA EXPLAINED:\n avatar size ➡️ var(--avatar-stack-size)\n plus the visible part of the 2nd avatar ➡️ var(--avatar-stack-size) - var(--overlap-size)\n plus the visible part of the 3rd avatar ➡️ var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus)\n */\n min-width: calc(\n var(--avatar-stack-size) + (var(--avatar-stack-size) - var(--overlap-size)) +\n (var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus))\n );\n }\n\n &:where([data-avatar-count='3'][data-variant='stack']) {\n /*\n MIN-WIDTH CALC FORMULA EXPLAINED:\n avatar size ➡️ var(--avatar-stack-size)\n plus the visible part of the 2nd avatar & 3rd avatar ➡️ var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus) * 2\n */\n min-width: calc(var(--avatar-stack-size) + (var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus)) * 2);\n }\n\n &:where([data-avatar-count='3+'][data-variant='cascade']) {\n /*\n MIN-WIDTH CALC FORMULA EXPLAINED:\n avatar size ➡️ var(--avatar-stack-size)\n plus the visible part of the 2nd avatar ➡️ var(--avatar-stack-size) - var(--overlap-size)\n plus the visible part of the 3rd AND 4th avatar ➡️ (var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus)) * 2\n */\n min-width: calc(\n var(--avatar-stack-size) + (var(--avatar-stack-size) - var(--overlap-size)) +\n (var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus)) * 2\n );\n }\n\n &:where([data-avatar-count='3+'][data-variant='stack']) {\n /*\n MIN-WIDTH CALC FORMULA EXPLAINED:\n avatar size ➡️ var(--avatar-stack-size)\n plus the visible part of the 2nd to 4th avatars ➡️ var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus) * 3\n */\n min-width: calc(var(--avatar-stack-size) + (var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus)) * 3);\n\n --overlap-size: var(--overlap-size-avatar-three-plus);\n }\n\n &:where([data-align-right]) {\n --mask-start: 1;\n\n direction: rtl;\n }\n}\n\n.AvatarStackBody {\n position: absolute;\n display: flex;\n\n &:where([data-disable-expand]) {\n position: relative;\n }\n}\n\n.AvatarItem {\n --avatarSize-regular: var(--avatar-stack-size);\n\n position: relative;\n display: flex;\n width: var(--avatar-stack-size);\n height: var(--avatar-stack-size);\n overflow: hidden;\n flex-shrink: 0;\n transition:\n margin 0.2s ease-in-out,\n opacity 0.2s ease-in-out,\n mask-position 0.2s ease-in-out,\n mask-size 0.2s ease-in-out;\n\n /* stylelint-disable-next-line selector-no-qualifying-type */\n .AvatarStack:where([data-shape='circle']) &:is(img) {\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: 0 0 0 var(--avatar-border-width) transparent;\n }\n\n /* stylelint-disable-next-line selector-pseudo-class-disallowed-list -- scoped to CSS Module, audited (github/github-ui#17224) */\n &:not([data-component='Avatar']):not(:has([data-square])) {\n border-radius: 50%;\n }\n\n /* stylelint-disable-next-line selector-no-qualifying-type */\n .AvatarStack:where([data-shape='square']) &:is(img) {\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: 1px 0 rgb(255, 255, 255, 1);\n }\n\n /* stylelint-disable-next-line selector-no-qualifying-type */\n .AvatarStack:where([data-shape='square'][data-align-right]) &:is(img) {\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: -1px 0 rgb(255, 255, 255, 1);\n }\n\n &:first-child {\n margin-inline-start: 0;\n }\n\n &:nth-child(n + 2) {\n /* stylelint-disable-next-line primer/spacing */\n margin-inline-start: calc(var(--overlap-size) * -1);\n mask-repeat: no-repeat, no-repeat;\n mask-size:\n var(--mask-size) var(--mask-size),\n auto;\n mask-composite: exclude;\n\n /*\n HORIZONTAL POSITION CALC FORMULA EXPLAINED:\n width of the visible part of the avatar ➡️ var(--avatar-stack-size) - var(--overlap-size)\n multiply by -1 for left-aligned, 1 for right-aligned ➡️ var(--mask-start)\n subtract the avatar border width ➡️ var(--avatar-border-width)\n */\n mask-position:\n calc((var(--avatar-stack-size) - var(--overlap-size)) * var(--mask-start) - var(--avatar-border-width)) center,\n 0 0;\n\n /* HACK: This padding fixes a weird rendering bug where a tiiiiny outline is visible at the edges of the element */\n /* stylelint-disable-next-line primer/spacing */\n padding: 0.1px;\n }\n\n /* Circular mask */\n .AvatarStack:where([data-shape='circle']) &:nth-child(n + 2) {\n mask-image: radial-gradient(at 50% 50%, rgb(0, 0, 0) 70%, rgb(0, 0, 0, 0) 71%), linear-gradient(rgb(0, 0, 0) 0 0);\n }\n\n /* Square mask */\n .AvatarStack:where([data-shape='square']) &:nth-child(n + 2) {\n /* stylelint-disable-next-line declaration-property-value-no-unknown */\n mask-image: linear-gradient(at 50% 50%, rgb(0, 0, 0) 70%, rgb(0, 0, 0, 0) 71%), linear-gradient(rgb(0, 0, 0) 0 0);\n }\n\n /* Cascade variant override for nth-child(n + 3) */\n .AvatarStack:where([data-variant='cascade']) &:nth-child(n + 3) {\n --overlap-size: var(--overlap-size-avatar-three-plus);\n\n /* stylelint-disable-next-line alpha-value-notation */\n opacity: calc(100% - 2 * var(--opacity-step));\n }\n\n /* Cascade variant override for nth-child(n + 4) */\n .AvatarStack:where([data-variant='cascade']) &:nth-child(n + 4) {\n /* stylelint-disable-next-line alpha-value-notation */\n opacity: calc(100% - 3 * var(--opacity-step));\n }\n\n /* Cascade variant override for nth-child(n + 5) */\n .AvatarStack:where([data-variant='cascade']) &:nth-child(n + 5) {\n /* stylelint-disable-next-line alpha-value-notation */\n opacity: calc(100% - 4 * var(--opacity-step));\n }\n\n .AvatarStack:where([data-shape='square']) &:nth-child(1) {\n z-index: 5;\n }\n\n .AvatarStack:where([data-shape='square']) &:nth-child(2) {\n z-index: 4;\n }\n\n .AvatarStack:where([data-shape='square']) &:nth-child(3) {\n z-index: 3;\n }\n\n .AvatarStack:where([data-shape='square']) &:nth-child(4) {\n z-index: 2;\n }\n\n .AvatarStack:where([data-shape='square']) &:nth-child(5) {\n z-index: 1;\n }\n\n &:nth-child(n + 6) {\n position: absolute;\n visibility: hidden;\n opacity: 0;\n }\n}\n\n.AvatarStackBody:not([data-disable-expand]):hover,\n.AvatarStackBody:not([data-disable-expand]):focus-within {\n width: auto;\n\n .AvatarItem {\n --mask-size: 100%; /* reset size of the mask to prevent unintentionally clipping due to the additional size created by the border width */\n\n position: relative;\n margin-inline-start: var(--base-size-4);\n visibility: visible;\n opacity: 1;\n\n /*\n HORIZONTAL POSITION CALC FORMULA EXPLAINED:\n width of the full avatar ➡️ var(--avatar-stack-size)\n multiply by -1 for left-aligned, 1 for right-aligned ➡️ var(--mask-start)\n */\n mask-position:\n calc(var(--avatar-stack-size) * var(--mask-start)) center,\n 0 0;\n\n &:first-child {\n margin-inline-start: 0;\n }\n }\n}\n"]}
@@ -1,20 +0,0 @@
1
- import { ColorMode, ColorModeWithAuto, Theme } from "./ThemeProvider.js";
2
- import React from "react";
3
-
4
- //#region src/ThemeContext.d.ts
5
- interface ThemeContextValue {
6
- /** @deprecated Use `ThemeProvider` and `useTheme` from `@primer/react/next` to migrate away from JavaScript theme values. */
7
- theme?: Theme;
8
- colorScheme?: string;
9
- colorMode?: ColorModeWithAuto;
10
- resolvedColorMode?: ColorMode;
11
- /** @deprecated Use `ThemeProvider` and `useTheme` from `@primer/react/next` to migrate away from JavaScript theme values. */
12
- resolvedColorScheme?: string;
13
- dayScheme?: string;
14
- nightScheme?: string;
15
- setColorMode: React.Dispatch<React.SetStateAction<ColorModeWithAuto>>;
16
- setDayScheme: React.Dispatch<React.SetStateAction<string>>;
17
- setNightScheme: React.Dispatch<React.SetStateAction<string>>;
18
- }
19
- //#endregion
20
- export { ThemeContextValue };
@@ -1,50 +0,0 @@
1
- import { ThemeContext } from "../../ThemeContext.js";
2
- import { c } from "react-compiler-runtime";
3
- import { jsx } from "react/jsx-runtime";
4
- //#region src/internal/components/ThemeProviderBase.tsx
5
- const ThemeProviderBase = (t0) => {
6
- const $ = c(11);
7
- const { children, contextOnly, value } = t0;
8
- if (contextOnly) {
9
- let t1;
10
- if ($[0] !== children || $[1] !== value) {
11
- t1 = /*#__PURE__*/ jsx(ThemeContext.Provider, {
12
- value,
13
- children
14
- });
15
- $[0] = children;
16
- $[1] = value;
17
- $[2] = t1;
18
- } else t1 = $[2];
19
- return t1;
20
- }
21
- const t1 = value.colorMode === "auto" ? "auto" : value.colorScheme.includes("dark") ? "dark" : "light";
22
- let t2;
23
- if ($[3] !== children || $[4] !== t1 || $[5] !== value.dayScheme || $[6] !== value.nightScheme) {
24
- t2 = /*#__PURE__*/ jsx("div", {
25
- "data-component": "ThemeProvider",
26
- "data-color-mode": t1,
27
- "data-light-theme": value.dayScheme,
28
- "data-dark-theme": value.nightScheme,
29
- children
30
- });
31
- $[3] = children;
32
- $[4] = t1;
33
- $[5] = value.dayScheme;
34
- $[6] = value.nightScheme;
35
- $[7] = t2;
36
- } else t2 = $[7];
37
- let t3;
38
- if ($[8] !== t2 || $[9] !== value) {
39
- t3 = /*#__PURE__*/ jsx(ThemeContext.Provider, {
40
- value,
41
- children: t2
42
- });
43
- $[8] = t2;
44
- $[9] = value;
45
- $[10] = t3;
46
- } else t3 = $[10];
47
- return t3;
48
- };
49
- //#endregion
50
- export { ThemeProviderBase };
@@ -1,71 +0,0 @@
1
- import { useSyncedState } from "../../hooks/useSyncedState.js";
2
- import { useTheme } from "../../useTheme.js";
3
- import { c } from "react-compiler-runtime";
4
- import React from "react";
5
- //#region src/internal/hooks/useThemeProvider.ts
6
- const defaultColorMode = "day";
7
- const defaultDayScheme = "light";
8
- const defaultNightScheme = "dark";
9
- function useThemeProvider(props) {
10
- var _ref, _props$colorMode, _ref2, _props$dayScheme, _ref3, _props$nightScheme;
11
- const $ = c(12);
12
- const parentValue = useTheme();
13
- const [colorMode, setColorMode] = useSyncedState((_ref = (_props$colorMode = props.colorMode) !== null && _props$colorMode !== void 0 ? _props$colorMode : parentValue.colorMode) !== null && _ref !== void 0 ? _ref : defaultColorMode);
14
- const [dayScheme, setDayScheme] = useSyncedState((_ref2 = (_props$dayScheme = props.dayScheme) !== null && _props$dayScheme !== void 0 ? _props$dayScheme : parentValue.dayScheme) !== null && _ref2 !== void 0 ? _ref2 : defaultDayScheme);
15
- const [nightScheme, setNightScheme] = useSyncedState((_ref3 = (_props$nightScheme = props.nightScheme) !== null && _props$nightScheme !== void 0 ? _props$nightScheme : parentValue.nightScheme) !== null && _ref3 !== void 0 ? _ref3 : defaultNightScheme);
16
- const systemColorMode = useSystemColorMode();
17
- const resolvedColorMode = colorMode === "auto" ? systemColorMode : colorMode;
18
- const colorScheme = resolvedColorMode === "day" || resolvedColorMode === "light" ? dayScheme : nightScheme;
19
- let t0;
20
- if ($[0] !== colorMode || $[1] !== colorScheme || $[2] !== dayScheme || $[3] !== nightScheme || $[4] !== resolvedColorMode || $[5] !== setColorMode || $[6] !== setDayScheme || $[7] !== setNightScheme) {
21
- t0 = {
22
- colorScheme,
23
- colorMode,
24
- resolvedColorMode,
25
- dayScheme,
26
- nightScheme,
27
- setColorMode,
28
- setDayScheme,
29
- setNightScheme
30
- };
31
- $[0] = colorMode;
32
- $[1] = colorScheme;
33
- $[2] = dayScheme;
34
- $[3] = nightScheme;
35
- $[4] = resolvedColorMode;
36
- $[5] = setColorMode;
37
- $[6] = setDayScheme;
38
- $[7] = setNightScheme;
39
- $[8] = t0;
40
- } else t0 = $[8];
41
- const value = t0;
42
- let t1;
43
- if ($[9] !== parentValue || $[10] !== value) {
44
- t1 = {
45
- parentValue,
46
- value
47
- };
48
- $[9] = parentValue;
49
- $[10] = value;
50
- $[11] = t1;
51
- } else t1 = $[11];
52
- return t1;
53
- }
54
- function subscribeToSystemColorMode(callback) {
55
- var _window, _window$matchMedia;
56
- const media = (_window = window) === null || _window === void 0 ? void 0 : (_window$matchMedia = _window.matchMedia) === null || _window$matchMedia === void 0 ? void 0 : _window$matchMedia.call(_window, "(prefers-color-scheme: dark)");
57
- media === null || media === void 0 || media.addEventListener("change", callback);
58
- return () => media === null || media === void 0 ? void 0 : media.removeEventListener("change", callback);
59
- }
60
- function useSystemColorMode() {
61
- return React.useSyncExternalStore(subscribeToSystemColorMode, getSystemColorMode, _temp);
62
- }
63
- function _temp() {
64
- return "day";
65
- }
66
- function getSystemColorMode() {
67
- var _window2, _window2$matchMedia, _window2$matchMedia$c;
68
- return (_window2 = window) !== null && _window2 !== void 0 && (_window2$matchMedia = _window2.matchMedia) !== null && _window2$matchMedia !== void 0 && (_window2$matchMedia$c = _window2$matchMedia.call(_window2, "(prefers-color-scheme: dark)")) !== null && _window2$matchMedia$c !== void 0 && _window2$matchMedia$c.matches ? "night" : "day";
69
- }
70
- //#endregion
71
- export { useThemeProvider };
@@ -1,7 +0,0 @@
1
- import { ThemeProviderProps } from "../ThemeProvider.js";
2
- import React from "react";
3
-
4
- //#region src/next/ThemeProvider.d.ts
5
- declare const ThemeProvider: React.FC<React.PropsWithChildren<ThemeProviderProps>>;
6
- //#endregion
7
- export { ThemeProvider, ThemeProvider as default };
@@ -1,35 +0,0 @@
1
- import { ThemeProviderBase } from "../internal/components/ThemeProviderBase.js";
2
- import { useThemeProvider } from "../internal/hooks/useThemeProvider.js";
3
- import { c } from "react-compiler-runtime";
4
- import { jsx } from "react/jsx-runtime";
5
- //#region src/next/ThemeProvider.tsx
6
- const ThemeProvider = (t0) => {
7
- const $ = c(7);
8
- let children;
9
- let props;
10
- if ($[0] !== t0) {
11
- ({children, ...props} = t0);
12
- $[0] = t0;
13
- $[1] = children;
14
- $[2] = props;
15
- } else {
16
- children = $[1];
17
- props = $[2];
18
- }
19
- const { value } = useThemeProvider(props);
20
- let t1;
21
- if ($[3] !== children || $[4] !== props.contextOnly || $[5] !== value) {
22
- t1 = /*#__PURE__*/ jsx(ThemeProviderBase, {
23
- contextOnly: props.contextOnly,
24
- value,
25
- children
26
- });
27
- $[3] = children;
28
- $[4] = props.contextOnly;
29
- $[5] = value;
30
- $[6] = t1;
31
- } else t1 = $[6];
32
- return t1;
33
- };
34
- //#endregion
35
- export { ThemeProvider, ThemeProvider as default };