@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,4 @@
1
1
  import { useOnOutsideClick } from "../hooks/useOnOutsideClick.js";
2
- import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
3
2
  import Popover_module_css_default from "./Popover.module.css.js";
4
3
  import { c } from "react-compiler-runtime";
5
4
  import { clsx } from "clsx";
@@ -7,10 +6,8 @@ import { jsx } from "react/jsx-runtime";
7
6
  import React, { useRef } from "react";
8
7
  //#region src/Popover/Popover.tsx
9
8
  const EMPTY_IGNORE_CLICK_REFS = [];
10
- const PopoverContext = /*#__PURE__*/ React.createContext(false);
11
9
  const Popover = /*#__PURE__*/ React.forwardRef(function Popover(t0, forwardRef) {
12
- var _open;
13
- const $ = c(18);
10
+ const $ = c(15);
14
11
  let className;
15
12
  let open;
16
13
  let props;
@@ -32,136 +29,102 @@ const Popover = /*#__PURE__*/ React.forwardRef(function Popover(t0, forwardRef)
32
29
  t1 = $[5];
33
30
  }
34
31
  const caret = t1 === void 0 ? "top" : t1;
35
- const t2 = (_open = open) !== null && _open !== void 0 ? _open : false;
36
- const t3 = open ? "" : void 0;
37
- const t4 = relative ? "" : void 0;
38
- let t5;
32
+ const t2 = open ? "" : void 0;
33
+ const t3 = relative ? "" : void 0;
34
+ let t4;
39
35
  if ($[6] !== className) {
40
- t5 = clsx(className, Popover_module_css_default.Popover);
36
+ t4 = clsx(className, Popover_module_css_default.Popover);
41
37
  $[6] = className;
42
- $[7] = t5;
43
- } else t5 = $[7];
44
- let t6;
45
- if ($[8] !== caret || $[9] !== forwardRef || $[10] !== props || $[11] !== t3 || $[12] !== t4 || $[13] !== t5) {
46
- t6 = /*#__PURE__*/ jsx("div", {
38
+ $[7] = t4;
39
+ } else t4 = $[7];
40
+ let t5;
41
+ if ($[8] !== caret || $[9] !== forwardRef || $[10] !== props || $[11] !== t2 || $[12] !== t3 || $[13] !== t4) {
42
+ t5 = /*#__PURE__*/ jsx("div", {
47
43
  ...props,
48
44
  ref: forwardRef,
49
45
  "data-component": "Popover",
50
- "data-open": t3,
51
- "data-relative": t4,
46
+ "data-open": t2,
47
+ "data-relative": t3,
52
48
  "data-caret": caret,
53
- className: t5
49
+ className: t4
54
50
  });
55
51
  $[8] = caret;
56
52
  $[9] = forwardRef;
57
53
  $[10] = props;
58
- $[11] = t3;
59
- $[12] = t4;
60
- $[13] = t5;
61
- $[14] = t6;
62
- } else t6 = $[14];
63
- let t7;
64
- if ($[15] !== t2 || $[16] !== t6) {
65
- t7 = /*#__PURE__*/ jsx(PopoverContext.Provider, {
66
- value: t2,
67
- children: t6
68
- });
69
- $[15] = t2;
70
- $[16] = t6;
71
- $[17] = t7;
72
- } else t7 = $[17];
73
- return t7;
54
+ $[11] = t2;
55
+ $[12] = t3;
56
+ $[13] = t4;
57
+ $[14] = t5;
58
+ } else t5 = $[14];
59
+ return t5;
74
60
  });
75
61
  Popover.displayName = "Popover";
76
62
  const PopoverContent = (t0) => {
77
63
  var _onClickOutside, _ignoreClickRefs;
78
- const $ = c(22);
64
+ const $ = c(17);
79
65
  let className;
80
66
  let ignoreClickRefs;
81
67
  let onClickOutside;
82
- let onEscape;
83
68
  let props;
84
69
  let t1;
85
70
  let t2;
86
71
  if ($[0] !== t0) {
87
- ({className, width: t1, height: t2, onClickOutside, onEscape, ignoreClickRefs, ...props} = t0);
72
+ ({className, width: t1, height: t2, onClickOutside, ignoreClickRefs, ...props} = t0);
88
73
  $[0] = t0;
89
74
  $[1] = className;
90
75
  $[2] = ignoreClickRefs;
91
76
  $[3] = onClickOutside;
92
- $[4] = onEscape;
93
- $[5] = props;
94
- $[6] = t1;
95
- $[7] = t2;
77
+ $[4] = props;
78
+ $[5] = t1;
79
+ $[6] = t2;
96
80
  } else {
97
81
  className = $[1];
98
82
  ignoreClickRefs = $[2];
99
83
  onClickOutside = $[3];
100
- onEscape = $[4];
101
- props = $[5];
102
- t1 = $[6];
103
- t2 = $[7];
84
+ props = $[4];
85
+ t1 = $[5];
86
+ t2 = $[6];
104
87
  }
105
88
  const width = t1 === void 0 ? "small" : t1;
106
89
  const height = t2 === void 0 ? "fit-content" : t2;
107
90
  const divRef = useRef(null);
108
- const open = React.useContext(PopoverContext);
109
91
  const outsideClickHandler = (_onClickOutside = onClickOutside) !== null && _onClickOutside !== void 0 ? _onClickOutside : _temp;
110
92
  const t3 = (_ignoreClickRefs = ignoreClickRefs) !== null && _ignoreClickRefs !== void 0 ? _ignoreClickRefs : EMPTY_IGNORE_CLICK_REFS;
111
93
  let t4;
112
- if ($[8] !== outsideClickHandler || $[9] !== t3) {
94
+ if ($[7] !== outsideClickHandler || $[8] !== t3) {
113
95
  t4 = {
114
96
  onClickOutside: outsideClickHandler,
115
97
  containerRef: divRef,
116
98
  ignoreClickRefs: t3
117
99
  };
118
- $[8] = outsideClickHandler;
119
- $[9] = t3;
120
- $[10] = t4;
121
- } else t4 = $[10];
100
+ $[7] = outsideClickHandler;
101
+ $[8] = t3;
102
+ $[9] = t4;
103
+ } else t4 = $[9];
122
104
  useOnOutsideClick(t4);
123
105
  let t5;
106
+ if ($[10] !== className) {
107
+ t5 = clsx(className, Popover_module_css_default.PopoverContent);
108
+ $[10] = className;
109
+ $[11] = t5;
110
+ } else t5 = $[11];
124
111
  let t6;
125
- if ($[11] !== onEscape || $[12] !== open) {
126
- t5 = (event) => {
127
- if (open && onEscape) {
128
- onEscape(event);
129
- event.preventDefault();
130
- }
131
- };
132
- t6 = [open, onEscape];
133
- $[11] = onEscape;
134
- $[12] = open;
135
- $[13] = t5;
136
- $[14] = t6;
137
- } else {
138
- t5 = $[13];
139
- t6 = $[14];
140
- }
141
- useOnEscapePress(t5, t6);
142
- let t7;
143
- if ($[15] !== className) {
144
- t7 = clsx(className, Popover_module_css_default.PopoverContent);
145
- $[15] = className;
146
- $[16] = t7;
147
- } else t7 = $[16];
148
- let t8;
149
- if ($[17] !== height || $[18] !== props || $[19] !== t7 || $[20] !== width) {
150
- t8 = /*#__PURE__*/ jsx("div", {
112
+ if ($[12] !== height || $[13] !== props || $[14] !== t5 || $[15] !== width) {
113
+ t6 = /*#__PURE__*/ jsx("div", {
151
114
  ref: divRef,
152
115
  "data-component": "Popover.Content",
153
116
  "data-width": width,
154
117
  "data-height": height,
155
- className: t7,
118
+ className: t5,
156
119
  ...props
157
120
  });
158
- $[17] = height;
159
- $[18] = props;
160
- $[19] = t7;
161
- $[20] = width;
162
- $[21] = t8;
163
- } else t8 = $[21];
164
- return t8;
121
+ $[12] = height;
122
+ $[13] = props;
123
+ $[14] = t5;
124
+ $[15] = width;
125
+ $[16] = t6;
126
+ } else t6 = $[16];
127
+ return t6;
165
128
  };
166
129
  PopoverContent.displayName = "Popover.Content";
167
130
  var Popover_default = Object.assign(Popover, { Content: PopoverContent });
@@ -1,105 +1,43 @@
1
1
  import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
2
2
  import { PortalContext } from "./PortalContext.js";
3
3
  import { DEFAULT_PORTAL_CONTAINER_NAME, ensureDefaultPortal, getPortalRoot } from "./portalRoot.js";
4
- import { c } from "react-compiler-runtime";
5
- import React, { useContext, useSyncExternalStore } from "react";
4
+ import React, { useContext } from "react";
6
5
  import { createPortal } from "react-dom";
7
6
  //#region src/Portal/Portal.tsx
8
- const subscribe = () => () => {};
9
- const getSnapshot = () => true;
10
- const getServerSnapshot = () => false;
11
- /**
12
- * Returns `true` only when React is rendering on the client, and not as part of
13
- * hydrating server-rendered markup.
14
- *
15
- * `Portal` needs this because React's server renderer throws when it encounters a
16
- * portal, and portaled content is never part of the server-rendered markup.
17
- *
18
- * `useSyncExternalStore` is used rather than a `useEffect`/`useState` "is mounted"
19
- * flag because it only defers the portal for the renders that need it: it returns
20
- * `false` while server rendering and for the hydration pass (keeping hydration
21
- * consistent with the server markup), but `true` from the very first render of a
22
- * client-only render. That way client-rendered portals — the overwhelmingly common
23
- * case for overlays, dialogs and menus — still mount their children in the same
24
- * commit as the `Portal` itself, so refs into portaled content are populated by the
25
- * time the parent's layout effects run.
26
- */
27
- function useIsClientRender() {
28
- return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
29
- }
30
7
  /**
31
8
  * Creates a React Portal, placing all children in a separate physical DOM root node.
32
9
  * @see https://reactjs.org/docs/portals.html
33
10
  */
34
- const Portal = (t0) => {
35
- const $ = c(12);
36
- const { children, onMount, containerName: _containerName } = t0;
11
+ const Portal = ({ children, onMount, containerName: _containerName }) => {
37
12
  const { portalContainerName } = useContext(PortalContext);
38
- const isClientRender = useIsClientRender();
39
- const onMountRef = React.useRef(onMount);
40
- let t1;
41
- if ($[0] !== onMount) {
42
- t1 = () => {
43
- onMountRef.current = onMount;
44
- };
45
- $[0] = onMount;
46
- $[1] = t1;
47
- } else t1 = $[1];
48
- useIsomorphicLayoutEffect(t1);
49
- const [element] = React.useState(_temp);
50
- let t2;
51
- let t3;
52
- if ($[2] !== _containerName || $[3] !== element || $[4] !== isClientRender || $[5] !== portalContainerName) {
53
- t2 = () => {
54
- var _onMountRef$current;
55
- if (!element || !isClientRender) return;
56
- let containerName = _containerName !== null && _containerName !== void 0 ? _containerName : portalContainerName;
57
- if (containerName === void 0) {
58
- containerName = DEFAULT_PORTAL_CONTAINER_NAME;
59
- ensureDefaultPortal();
60
- }
61
- const parentElement = getPortalRoot(containerName);
62
- if (!parentElement) throw new Error(`Portal container '${containerName}' is not yet registered. Container must be registered with registerPortalRoot before use.`);
63
- parentElement.appendChild(element);
64
- (_onMountRef$current = onMountRef.current) === null || _onMountRef$current === void 0 || _onMountRef$current.call(onMountRef);
65
- return () => {
66
- parentElement.removeChild(element);
67
- };
68
- };
69
- t3 = [
70
- element,
71
- isClientRender,
72
- _containerName,
73
- portalContainerName
74
- ];
75
- $[2] = _containerName;
76
- $[3] = element;
77
- $[4] = isClientRender;
78
- $[5] = portalContainerName;
79
- $[6] = t2;
80
- $[7] = t3;
81
- } else {
82
- t2 = $[6];
83
- t3 = $[7];
13
+ const elementRef = React.useRef(null);
14
+ if (!elementRef.current) {
15
+ const div = document.createElement("div");
16
+ div.setAttribute("data-component", "Portal");
17
+ div.style.position = "relative";
18
+ div.style.zIndex = "1";
19
+ elementRef.current = div;
84
20
  }
85
- useIsomorphicLayoutEffect(t2, t3);
86
- let t4;
87
- if ($[8] !== children || $[9] !== element || $[10] !== isClientRender) {
88
- t4 = element && isClientRender ? /*#__PURE__*/ createPortal(children, element) : null;
89
- $[8] = children;
90
- $[9] = element;
91
- $[10] = isClientRender;
92
- $[11] = t4;
93
- } else t4 = $[11];
94
- return t4;
21
+ const element = elementRef.current;
22
+ useIsomorphicLayoutEffect(() => {
23
+ let containerName = _containerName !== null && _containerName !== void 0 ? _containerName : portalContainerName;
24
+ if (containerName === void 0) {
25
+ containerName = DEFAULT_PORTAL_CONTAINER_NAME;
26
+ ensureDefaultPortal();
27
+ }
28
+ const parentElement = getPortalRoot(containerName);
29
+ if (!parentElement) throw new Error(`Portal container '${containerName}' is not yet registered. Container must be registered with registerPortalRoot before use.`);
30
+ parentElement.appendChild(element);
31
+ onMount === null || onMount === void 0 || onMount();
32
+ return () => {
33
+ parentElement.removeChild(element);
34
+ };
35
+ }, [
36
+ element,
37
+ _containerName,
38
+ portalContainerName
39
+ ]);
40
+ return /*#__PURE__*/ createPortal(children, element);
95
41
  };
96
- function _temp() {
97
- if (typeof document === "undefined") return null;
98
- const div = document.createElement("div");
99
- div.setAttribute("data-component", "Portal");
100
- div.style.position = "relative";
101
- div.style.zIndex = "1";
102
- return div;
103
- }
104
42
  //#endregion
105
43
  export { Portal };
@@ -48,7 +48,7 @@ const Radio = /*#__PURE__*/ React.forwardRef((t0, ref) => {
48
48
  let t2;
49
49
  if ($[10] !== onChange || $[11] !== radioGroupContext) {
50
50
  t2 = (e) => {
51
- radioGroupContext !== null && radioGroupContext !== void 0 && radioGroupContext.onChange && radioGroupContext.onChange(e);
51
+ !(radioGroupContext === null || radioGroupContext === void 0) && radioGroupContext.onChange && radioGroupContext.onChange(e);
52
52
  onChange && onChange(e);
53
53
  };
54
54
  $[10] = onChange;
@@ -435,31 +435,6 @@ function Panel({ open, onOpenChange, renderAnchor = defaultRenderAnchor, anchorR
435
435
  if (event.key !== "/" && !isAlphabetKey(event.nativeEvent)) return;
436
436
  event.stopPropagation();
437
437
  }, [overlayProps]);
438
- const mergedOverlayProps = useMemo(() => ({
439
- role: "dialog",
440
- "aria-labelledby": titleId,
441
- "aria-describedby": subtitle ? subtitleId : void 0,
442
- ...overlayProps,
443
- ...variant === "modal" ? {
444
- top: "50vh",
445
- left: "50vw",
446
- anchorSide: void 0
447
- } : {},
448
- style: {
449
- transform: variant === "modal" ? "translate(-50%, -50%)" : void 0,
450
- ...isKeyboardVisible ? { maxHeight: availablePanelHeight !== void 0 ? `${availablePanelHeight}px` : "auto" } : {}
451
- },
452
- onKeyDown: preventBubbling
453
- }), [
454
- titleId,
455
- subtitle,
456
- subtitleId,
457
- overlayProps,
458
- variant,
459
- isKeyboardVisible,
460
- availablePanelHeight,
461
- preventBubbling
462
- ]);
463
438
  return /*#__PURE__*/ jsxs(Fragment, { children: [/*#__PURE__*/ jsx(AnchoredOverlay, {
464
439
  renderAnchor: renderMenuAnchor,
465
440
  anchorRef,
@@ -467,7 +442,31 @@ function Panel({ open, onOpenChange, renderAnchor = defaultRenderAnchor, anchorR
467
442
  open,
468
443
  onOpen,
469
444
  onClose,
470
- overlayProps: mergedOverlayProps,
445
+ overlayProps: useMemo(() => ({
446
+ role: "dialog",
447
+ "aria-labelledby": titleId,
448
+ "aria-describedby": subtitle ? subtitleId : void 0,
449
+ ...overlayProps,
450
+ ...variant === "modal" ? {
451
+ top: "50vh",
452
+ left: "50vw",
453
+ anchorSide: void 0
454
+ } : {},
455
+ style: {
456
+ transform: variant === "modal" ? "translate(-50%, -50%)" : void 0,
457
+ ...isKeyboardVisible ? { maxHeight: availablePanelHeight !== void 0 ? `${availablePanelHeight}px` : "auto" } : {}
458
+ },
459
+ onKeyDown: preventBubbling
460
+ }), [
461
+ titleId,
462
+ subtitle,
463
+ subtitleId,
464
+ overlayProps,
465
+ variant,
466
+ isKeyboardVisible,
467
+ availablePanelHeight,
468
+ preventBubbling
469
+ ]),
471
470
  focusTrapSettings,
472
471
  focusZoneSettings,
473
472
  height,
@@ -21,9 +21,6 @@ type ThemeProviderProps = {
21
21
  */
22
22
  contextOnly?: boolean;
23
23
  };
24
- /**
25
- * @deprecated Use `ThemeProvider` from `@primer/react/next` to migrate away from JavaScript theme values.
26
- */
27
24
  declare const ThemeProvider: React.FC<React.PropsWithChildren<ThemeProviderProps>>;
28
25
  //#endregion
29
26
  export { ColorMode, ColorModeWithAuto, Theme, ThemeProvider, ThemeProvider as default, ThemeProviderProps };
@@ -1,17 +1,16 @@
1
1
  import theme from "./theme.js";
2
- import { ThemeProviderBase } from "./internal/components/ThemeProviderBase.js";
3
- import { useThemeProvider } from "./internal/hooks/useThemeProvider.js";
2
+ import { useSyncedState } from "./hooks/useSyncedState.js";
3
+ import { ThemeContext } from "./ThemeContext.js";
4
+ import { useTheme } from "./useTheme.js";
4
5
  import { c } from "react-compiler-runtime";
5
6
  import { jsx } from "react/jsx-runtime";
6
- import "react";
7
+ import React from "react";
7
8
  import deepmerge from "deepmerge";
8
- //#region src/ThemeProvider.tsx
9
- /**
10
- * @deprecated Use `ThemeProvider` from `@primer/react/next` to migrate away from JavaScript theme values.
11
- */
9
+ const defaultDayScheme = "light";
10
+ const defaultNightScheme = "dark";
12
11
  const ThemeProvider = (t0) => {
13
- var _parentValue$theme;
14
- const $ = c(14);
12
+ var _ref, _props$colorMode, _ref2, _props$dayScheme, _ref3, _props$nightScheme;
13
+ const $ = c(34);
15
14
  let children;
16
15
  let props;
17
16
  if ($[0] !== t0) {
@@ -23,43 +22,134 @@ const ThemeProvider = (t0) => {
23
22
  children = $[1];
24
23
  props = $[2];
25
24
  }
26
- const { parentValue, value } = useThemeProvider(props);
27
- const theme$1 = (_parentValue$theme = parentValue.theme) !== null && _parentValue$theme !== void 0 ? _parentValue$theme : theme;
25
+ const { theme: fallbackTheme, colorMode: fallbackColorMode, dayScheme: fallbackDayScheme, nightScheme: fallbackNightScheme } = useTheme();
26
+ const theme$1 = fallbackTheme !== null && fallbackTheme !== void 0 ? fallbackTheme : theme;
27
+ const [colorMode, setColorMode] = useSyncedState((_ref = (_props$colorMode = props.colorMode) !== null && _props$colorMode !== void 0 ? _props$colorMode : fallbackColorMode) !== null && _ref !== void 0 ? _ref : "day");
28
+ const [dayScheme, setDayScheme] = useSyncedState((_ref2 = (_props$dayScheme = props.dayScheme) !== null && _props$dayScheme !== void 0 ? _props$dayScheme : fallbackDayScheme) !== null && _ref2 !== void 0 ? _ref2 : defaultDayScheme);
29
+ const [nightScheme, setNightScheme] = useSyncedState((_ref3 = (_props$nightScheme = props.nightScheme) !== null && _props$nightScheme !== void 0 ? _props$nightScheme : fallbackNightScheme) !== null && _ref3 !== void 0 ? _ref3 : defaultNightScheme);
30
+ const systemColorMode = useSystemColorMode();
31
+ let resolvedColorMode;
28
32
  let t1;
29
- if ($[3] !== theme$1 || $[4] !== value.colorScheme) {
30
- t1 = applyColorScheme(theme$1, value.colorScheme);
31
- $[3] = theme$1;
32
- $[4] = value.colorScheme;
33
- $[5] = t1;
34
- } else t1 = $[5];
35
- const { resolvedTheme, resolvedColorScheme } = t1;
33
+ if ($[3] !== colorMode || $[4] !== dayScheme || $[5] !== nightScheme || $[6] !== systemColorMode) {
34
+ resolvedColorMode = resolveColorMode(colorMode, systemColorMode);
35
+ t1 = chooseColorScheme(resolvedColorMode, dayScheme, nightScheme);
36
+ $[3] = colorMode;
37
+ $[4] = dayScheme;
38
+ $[5] = nightScheme;
39
+ $[6] = systemColorMode;
40
+ $[7] = resolvedColorMode;
41
+ $[8] = t1;
42
+ } else {
43
+ resolvedColorMode = $[7];
44
+ t1 = $[8];
45
+ }
46
+ const colorScheme = t1;
36
47
  let t2;
37
- if ($[6] !== resolvedColorScheme || $[7] !== resolvedTheme || $[8] !== value) {
38
- t2 = {
39
- ...value,
48
+ if ($[9] !== colorScheme || $[10] !== theme$1) {
49
+ t2 = applyColorScheme(theme$1, colorScheme);
50
+ $[9] = colorScheme;
51
+ $[10] = theme$1;
52
+ $[11] = t2;
53
+ } else t2 = $[11];
54
+ const { resolvedTheme, resolvedColorScheme } = t2;
55
+ let t3;
56
+ if ($[12] !== colorMode || $[13] !== colorScheme || $[14] !== dayScheme || $[15] !== nightScheme || $[16] !== resolvedColorMode || $[17] !== resolvedColorScheme || $[18] !== resolvedTheme || $[19] !== setColorMode || $[20] !== setDayScheme || $[21] !== setNightScheme) {
57
+ t3 = {
40
58
  theme: resolvedTheme,
41
- resolvedColorScheme
59
+ colorScheme,
60
+ colorMode,
61
+ resolvedColorMode,
62
+ resolvedColorScheme,
63
+ dayScheme,
64
+ nightScheme,
65
+ setColorMode,
66
+ setDayScheme,
67
+ setNightScheme
42
68
  };
43
- $[6] = resolvedColorScheme;
44
- $[7] = resolvedTheme;
45
- $[8] = value;
46
- $[9] = t2;
47
- } else t2 = $[9];
48
- const contextValue = t2;
49
- let t3;
50
- if ($[10] !== children || $[11] !== contextValue || $[12] !== props.contextOnly) {
51
- t3 = /*#__PURE__*/ jsx(ThemeProviderBase, {
52
- contextOnly: props.contextOnly,
53
- value: contextValue,
69
+ $[12] = colorMode;
70
+ $[13] = colorScheme;
71
+ $[14] = dayScheme;
72
+ $[15] = nightScheme;
73
+ $[16] = resolvedColorMode;
74
+ $[17] = resolvedColorScheme;
75
+ $[18] = resolvedTheme;
76
+ $[19] = setColorMode;
77
+ $[20] = setDayScheme;
78
+ $[21] = setNightScheme;
79
+ $[22] = t3;
80
+ } else t3 = $[22];
81
+ const contextValue = t3;
82
+ if (props.contextOnly) {
83
+ let t4;
84
+ if ($[23] !== children || $[24] !== contextValue) {
85
+ t4 = /*#__PURE__*/ jsx(ThemeContext.Provider, {
86
+ value: contextValue,
87
+ children
88
+ });
89
+ $[23] = children;
90
+ $[24] = contextValue;
91
+ $[25] = t4;
92
+ } else t4 = $[25];
93
+ return t4;
94
+ }
95
+ const t4 = colorMode === "auto" ? "auto" : colorScheme.includes("dark") ? "dark" : "light";
96
+ let t5;
97
+ if ($[26] !== children || $[27] !== dayScheme || $[28] !== nightScheme || $[29] !== t4) {
98
+ t5 = /*#__PURE__*/ jsx("div", {
99
+ "data-component": "ThemeProvider",
100
+ "data-color-mode": t4,
101
+ "data-light-theme": dayScheme,
102
+ "data-dark-theme": nightScheme,
54
103
  children
55
104
  });
56
- $[10] = children;
57
- $[11] = contextValue;
58
- $[12] = props.contextOnly;
59
- $[13] = t3;
60
- } else t3 = $[13];
61
- return t3;
105
+ $[26] = children;
106
+ $[27] = dayScheme;
107
+ $[28] = nightScheme;
108
+ $[29] = t4;
109
+ $[30] = t5;
110
+ } else t5 = $[30];
111
+ let t6;
112
+ if ($[31] !== contextValue || $[32] !== t5) {
113
+ t6 = /*#__PURE__*/ jsx(ThemeContext.Provider, {
114
+ value: contextValue,
115
+ children: t5
116
+ });
117
+ $[31] = contextValue;
118
+ $[32] = t5;
119
+ $[33] = t6;
120
+ } else t6 = $[33];
121
+ return t6;
62
122
  };
123
+ function subscribeToSystemColorMode(callback) {
124
+ var _window, _window$matchMedia;
125
+ 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)");
126
+ media === null || media === void 0 || media.addEventListener("change", callback);
127
+ return () => media === null || media === void 0 ? void 0 : media.removeEventListener("change", callback);
128
+ }
129
+ function useSystemColorMode() {
130
+ return React.useSyncExternalStore(subscribeToSystemColorMode, getSystemColorMode, _temp);
131
+ }
132
+ function _temp() {
133
+ return "day";
134
+ }
135
+ function getSystemColorMode() {
136
+ var _window2, _window2$matchMedia, _window2$matchMedia$c;
137
+ 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";
138
+ }
139
+ function resolveColorMode(colorMode, systemColorMode) {
140
+ switch (colorMode) {
141
+ case "auto": return systemColorMode;
142
+ default: return colorMode;
143
+ }
144
+ }
145
+ function chooseColorScheme(colorMode, dayScheme, nightScheme) {
146
+ switch (colorMode) {
147
+ case "day":
148
+ case "light": return dayScheme;
149
+ case "dark":
150
+ case "night": return nightScheme;
151
+ }
152
+ }
63
153
  function applyColorScheme(theme, colorScheme) {
64
154
  if (!theme.colorSchemes) return {
65
155
  resolvedTheme: theme,
@@ -100,11 +100,10 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
100
100
  const trigger = readTriggerRef.current;
101
101
  tooltip.showPopover();
102
102
  setIsPopoverOpen(true);
103
- const settings = {
103
+ const { top, left, anchorAlign, anchorSide } = getAnchoredPosition(tooltip, trigger, {
104
104
  side: directionToPosition[direction].side,
105
105
  align: directionToPosition[direction].align
106
- };
107
- const { top, left, anchorAlign, anchorSide } = getAnchoredPosition(tooltip, trigger, settings);
106
+ });
108
107
  const calculatedDirection = positionToDirection[`${anchorSide}-${anchorAlign}`];
109
108
  setCalculatedDirection(calculatedDirection);
110
109
  tooltip.style.top = `${top}px`;
@@ -193,6 +193,7 @@ const ItemImpl = fixedForwardRef(({ id: itemId, containIntrinsicSize, current: i
193
193
  case "u":
194
194
  if (!(event.shiftKey && (event.metaKey || event.ctrlKey))) return;
195
195
  activateActionsDialog();
196
+ break;
196
197
  }
197
198
  }, [
198
199
  onSelect,
@@ -17,9 +17,8 @@ type UnderlineNavProps = {
17
17
  */
18
18
  variant?: 'inset' | 'flush';
19
19
  /**
20
- * Controls the container width below which icons are hidden to save space. Defaults to `medium`.
21
- * To keep icons visible in a narrow container, use a smaller breakpoint such as `xsmall`, or set to `null` to
22
- * always show icons.
20
+ * Customize when the icons are hidden to save space. Set to `null` to always show icons.
21
+ * Defaults to `xxlarge`; if you know there won't be very many tabs you might set this to a smaller value.
23
22
  */
24
23
  hideIconsBreakpoint?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | null;
25
24
  };
@@ -22,7 +22,7 @@ const UnderlineNav = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
22
22
  const as = t1 === void 0 ? "nav" : t1;
23
23
  const loadingCounters = t2 === void 0 ? false : t2;
24
24
  const variant = t3 === void 0 ? "inset" : t3;
25
- const hideIconsBreakpoint = t4 === void 0 ? "medium" : t4;
25
+ const hideIconsBreakpoint = t4 === void 0 ? "xxlarge" : t4;
26
26
  const backupRef = useRef(null);
27
27
  const navRef = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
28
28
  const listRef = useRef(null);
@@ -59,8 +59,7 @@ const List = /*#__PURE__*/ React.forwardRef((props, forwardedRef) => {
59
59
  const { firstGroupStyle, lastGroupStyle, headerStyle, itemStyle } = useListVariant(restProps.variant);
60
60
  const renderGroup = (groupProps) => {
61
61
  var _ref;
62
- const GroupComponent = ((_ref = "renderGroup" in groupProps && groupProps.renderGroup) !== null && _ref !== void 0 ? _ref : restProps.renderGroup) || Group;
63
- return /*#__PURE__*/ createElement(GroupComponent, {
62
+ return /*#__PURE__*/ createElement(((_ref = "renderGroup" in groupProps && groupProps.renderGroup) !== null && _ref !== void 0 ? _ref : restProps.renderGroup) || Group, {
64
63
  ...groupProps,
65
64
  key: groupProps.groupId
66
65
  });