@primer/react 0.0.0-20260720205022 → 0.0.0-20260722001252

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 (80) hide show
  1. package/CHANGELOG.md +43 -3
  2. package/dist/ActionBar/ActionBar-3767d551.css +2 -0
  3. package/dist/ActionBar/ActionBar-3767d551.css.map +1 -0
  4. package/dist/ActionBar/ActionBar.js +1 -1
  5. package/dist/ActionBar/ActionBar.module.css.js +1 -1
  6. package/dist/ActionList/Group.js +2 -2
  7. package/dist/ActionList/Item.js +1 -1
  8. package/dist/ActionList/List.js +15 -21
  9. package/dist/ActionMenu/ActionMenu.js +1 -1
  10. package/dist/AnchoredOverlay/AnchoredOverlay.js +5 -7
  11. package/dist/Autocomplete/AutocompleteInput.js +7 -10
  12. package/dist/Autocomplete/AutocompleteMenu.js +3 -2
  13. package/dist/Breadcrumbs/Breadcrumbs.js +4 -1
  14. package/dist/ButtonGroup/ButtonGroup.js +8 -15
  15. package/dist/Checkbox/Checkbox.js +9 -16
  16. package/dist/Dialog/Dialog.js +6 -13
  17. package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -2
  18. package/dist/FeatureFlags/useFeatureFlag.js +2 -1
  19. package/dist/FilteredActionList/FilteredActionList.js +20 -31
  20. package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
  21. package/dist/FilteredActionList/useAnnouncements.js +20 -14
  22. package/dist/LabelGroup/LabelGroup-db41f443.css +2 -0
  23. package/dist/LabelGroup/LabelGroup-db41f443.css.map +1 -0
  24. package/dist/LabelGroup/LabelGroup.module.css.js +1 -1
  25. package/dist/NavList/NavList.d.ts +1 -0
  26. package/dist/NavList/NavList.js +40 -29
  27. package/dist/Overlay/Overlay.js +1 -1
  28. package/dist/PageHeader/PageHeader.js +22 -31
  29. package/dist/PageLayout/DragHandle.d.ts +45 -0
  30. package/dist/PageLayout/DragHandle.js +224 -0
  31. package/dist/PageLayout/PageLayout.js +54 -248
  32. package/dist/PageLayout/index.d.ts +3 -1
  33. package/dist/PageLayout/usePaneWidth.d.ts +63 -1
  34. package/dist/PageLayout/usePaneWidth.js +52 -36
  35. package/dist/SelectPanel/SelectPanel.js +1 -1
  36. package/dist/TextInput/TextInput.js +6 -13
  37. package/dist/TextInputWithTokens/TextInputWithTokens.js +1 -1
  38. package/dist/ThemeProvider.d.ts +1 -4
  39. package/dist/ThemeProvider.js +43 -76
  40. package/dist/Timeline/Timeline-b7e6685b.css +2 -0
  41. package/dist/Timeline/Timeline-b7e6685b.css.map +1 -0
  42. package/dist/Timeline/Timeline.module.css.js +1 -1
  43. package/dist/TooltipV2/Tooltip.js +13 -19
  44. package/dist/TreeView/TreeView.js +6 -3
  45. package/dist/experimental/SelectPanel2/SelectPanel.js +2 -2
  46. package/dist/experimental/Tabs/types.d.ts +2 -2
  47. package/dist/experimental/Tabs/useTabList.js +10 -18
  48. package/dist/experimental/UnderlinePanels/UnderlinePanels.js +1 -1
  49. package/dist/experimental/index.js +4 -4
  50. package/dist/hooks/useAnchoredPosition.js +14 -1
  51. package/dist/hooks/useDialog.js +2 -1
  52. package/dist/hooks/useMergedRefs.d.ts +4 -4
  53. package/dist/hooks/useMergedRefs.js +5 -8
  54. package/dist/hooks/useProvidedRefOrCreate.d.ts +10 -7
  55. package/dist/hooks/useProvidedRefOrCreate.js +10 -7
  56. package/dist/hooks/useScrollFlash.js +2 -1
  57. package/dist/index.d.ts +4 -2
  58. package/dist/index.js +7 -5
  59. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +1 -1
  60. package/dist/internal/components/OverflowObserverProvider.js +5 -5
  61. package/dist/internal/components/UnderlineTabbedInterface-798ef3cb.css +2 -0
  62. package/dist/internal/components/UnderlineTabbedInterface-798ef3cb.css.map +1 -0
  63. package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
  64. package/dist/theme.d.ts +1 -1142
  65. package/dist/theme.js +1 -3
  66. package/dist/useTheme.d.ts +1 -3
  67. package/dist/utils/warning.js +3 -2
  68. package/generated/components.json +13 -13
  69. package/generated/hooks.json +0 -15
  70. package/package.json +7 -10
  71. package/dist/ActionBar/ActionBar-e63def3c.css +0 -2
  72. package/dist/ActionBar/ActionBar-e63def3c.css.map +0 -1
  73. package/dist/LabelGroup/LabelGroup-7d19205a.css +0 -2
  74. package/dist/LabelGroup/LabelGroup-7d19205a.css.map +0 -1
  75. package/dist/Timeline/Timeline-ff81db92.css +0 -2
  76. package/dist/Timeline/Timeline-ff81db92.css.map +0 -1
  77. package/dist/internal/components/UnderlineTabbedInterface-25587345.css +0 -2
  78. package/dist/internal/components/UnderlineTabbedInterface-25587345.css.map +0 -1
  79. package/dist/legacy-theme/ts/color-schemes.js +0 -4252
  80. package/dist/utils/types/KeyPaths.d.ts +0 -4
@@ -47,13 +47,19 @@ function getMaxWidthDiffFromViewport() {
47
47
  if (!canUseDOM) return DEFAULT_MAX_WIDTH_DIFF;
48
48
  return window.innerWidth >= DEFAULT_PANE_MAX_WIDTH_DIFF_BREAKPOINT ? WIDE_MAX_WIDTH_DIFF : DEFAULT_MAX_WIDTH_DIFF;
49
49
  }
50
- const updateAriaValues = (handle, values) => {
50
+ /**
51
+ * Default formatter for the drag handle's `aria-valuetext`.
52
+ * Kept in sync between the rendered attribute and drag-time DOM writes.
53
+ */
54
+ const defaultFormatValueText = (valueNow) => `Pane width ${valueNow} pixels`;
55
+ const updateAriaValues = (handle, values, formatValueText) => {
51
56
  if (!handle) return;
57
+ const format = formatValueText !== null && formatValueText !== void 0 ? formatValueText : defaultFormatValueText;
52
58
  if (values.min !== void 0) handle.setAttribute("aria-valuemin", String(values.min));
53
59
  if (values.max !== void 0) handle.setAttribute("aria-valuemax", String(values.max));
54
60
  if (values.current !== void 0) {
55
61
  handle.setAttribute("aria-valuenow", String(values.current));
56
- handle.setAttribute("aria-valuetext", `Pane width ${values.current} pixels`);
62
+ handle.setAttribute("aria-valuetext", format(values.current));
57
63
  }
58
64
  };
59
65
  const localStoragePersister = {
@@ -84,8 +90,8 @@ const localStoragePersister = {
84
90
  * - When `resizable` is `false` or `undefined`: Not resizable, no persistence
85
91
  */
86
92
  function usePaneWidth(t0) {
87
- const $ = c(42);
88
- const { width, minWidth, resizable, widthStorageKey, paneRef, handleRef, contentWrapperRef, constrainToViewport: t1, onResizeEnd, currentWidth: controlledWidth } = t0;
93
+ const $ = c(44);
94
+ const { width, minWidth, resizable, widthStorageKey, paneRef, handleRef, contentWrapperRef, constrainToViewport: t1, onResizeEnd, currentWidth: controlledWidth, formatValueText } = t0;
89
95
  const constrainToViewport = t1 === void 0 ? false : t1;
90
96
  const isCustomWidth = isCustomWidthOptions(width);
91
97
  const minPaneWidth = isCustomWidth ? parseInt(width.min, 10) : minWidth;
@@ -218,10 +224,20 @@ function usePaneWidth(t0) {
218
224
  $[25] = t11;
219
225
  } else t11 = $[25];
220
226
  useIsomorphicLayoutEffect(t11);
227
+ const formatValueTextRef = React.useRef(formatValueText);
221
228
  let t12;
222
- let t13;
223
- if ($[26] !== constrainToViewport || $[27] !== contentWrapperRef || $[28] !== customMaxWidth || $[29] !== handleRef || $[30] !== minPaneWidth || $[31] !== paneRef || $[32] !== resizable) {
229
+ if ($[26] !== formatValueText) {
224
230
  t12 = () => {
231
+ formatValueTextRef.current = formatValueText;
232
+ };
233
+ $[26] = formatValueText;
234
+ $[27] = t12;
235
+ } else t12 = $[27];
236
+ useIsomorphicLayoutEffect(t12);
237
+ let t13;
238
+ let t14;
239
+ if ($[28] !== constrainToViewport || $[29] !== contentWrapperRef || $[30] !== customMaxWidth || $[31] !== handleRef || $[32] !== minPaneWidth || $[33] !== paneRef || $[34] !== resizable) {
240
+ t13 = () => {
225
241
  var _paneRef$current3;
226
242
  if (!resizable) return;
227
243
  let lastViewportWidth = window.innerWidth;
@@ -242,7 +258,7 @@ function usePaneWidth(t0) {
242
258
  updateAriaValues(handleRef.current, {
243
259
  max: actualMax,
244
260
  current: currentWidthRef.current
245
- });
261
+ }, formatValueTextRef.current);
246
262
  if (actualMax !== maxPaneWidthRef.current || wasClamped) {
247
263
  maxPaneWidthRef.current = actualMax;
248
264
  startTransition(() => {
@@ -259,7 +275,7 @@ function usePaneWidth(t0) {
259
275
  min: minPaneWidth,
260
276
  max: initialMax,
261
277
  current: currentWidthRef.current
262
- });
278
+ }, formatValueTextRef.current);
263
279
  startTransition(() => {
264
280
  setMaxPaneWidth(initialMax);
265
281
  });
@@ -274,14 +290,14 @@ function usePaneWidth(t0) {
274
290
  if (isResizing) return;
275
291
  isResizing = true;
276
292
  (_paneRef$current4 = paneRef.current) === null || _paneRef$current4 === void 0 || _paneRef$current4.setAttribute("data-dragging", "true");
277
- (_contentWrapperRef$cu = contentWrapperRef.current) === null || _contentWrapperRef$cu === void 0 || _contentWrapperRef$cu.setAttribute("data-dragging", "true");
293
+ contentWrapperRef === null || contentWrapperRef === void 0 || (_contentWrapperRef$cu = contentWrapperRef.current) == null || _contentWrapperRef$cu.setAttribute("data-dragging", "true");
278
294
  };
279
295
  const endResizeOptimizations = () => {
280
296
  var _paneRef$current5, _contentWrapperRef$cu2;
281
297
  if (!isResizing) return;
282
298
  isResizing = false;
283
299
  (_paneRef$current5 = paneRef.current) === null || _paneRef$current5 === void 0 || _paneRef$current5.removeAttribute("data-dragging");
284
- (_contentWrapperRef$cu2 = contentWrapperRef.current) === null || _contentWrapperRef$cu2 === void 0 || _contentWrapperRef$cu2.removeAttribute("data-dragging");
300
+ contentWrapperRef === null || contentWrapperRef === void 0 || (_contentWrapperRef$cu2 = contentWrapperRef.current) == null || _contentWrapperRef$cu2.removeAttribute("data-dragging");
285
301
  };
286
302
  const handleResize = () => {
287
303
  startResizeOptimizations();
@@ -312,7 +328,7 @@ function usePaneWidth(t0) {
312
328
  window.removeEventListener("resize", handleResize);
313
329
  };
314
330
  };
315
- t13 = [
331
+ t14 = [
316
332
  resizable,
317
333
  customMaxWidth,
318
334
  constrainToViewport,
@@ -321,23 +337,23 @@ function usePaneWidth(t0) {
321
337
  handleRef,
322
338
  contentWrapperRef
323
339
  ];
324
- $[26] = constrainToViewport;
325
- $[27] = contentWrapperRef;
326
- $[28] = customMaxWidth;
327
- $[29] = handleRef;
328
- $[30] = minPaneWidth;
329
- $[31] = paneRef;
330
- $[32] = resizable;
331
- $[33] = t12;
332
- $[34] = t13;
340
+ $[28] = constrainToViewport;
341
+ $[29] = contentWrapperRef;
342
+ $[30] = customMaxWidth;
343
+ $[31] = handleRef;
344
+ $[32] = minPaneWidth;
345
+ $[33] = paneRef;
346
+ $[34] = resizable;
347
+ $[35] = t13;
348
+ $[36] = t14;
333
349
  } else {
334
- t12 = $[33];
335
- t13 = $[34];
350
+ t13 = $[35];
351
+ t14 = $[36];
336
352
  }
337
- useIsomorphicLayoutEffect(t12, t13);
338
- let t14;
339
- if ($[35] !== currentWidth || $[36] !== getDefaultWidth || $[37] !== getMaxPaneWidth || $[38] !== maxPaneWidth || $[39] !== minPaneWidth || $[40] !== saveWidth) {
340
- t14 = {
353
+ useIsomorphicLayoutEffect(t13, t14);
354
+ let t15;
355
+ if ($[37] !== currentWidth || $[38] !== getDefaultWidth || $[39] !== getMaxPaneWidth || $[40] !== maxPaneWidth || $[41] !== minPaneWidth || $[42] !== saveWidth) {
356
+ t15 = {
341
357
  currentWidth,
342
358
  currentWidthRef,
343
359
  minPaneWidth,
@@ -346,15 +362,15 @@ function usePaneWidth(t0) {
346
362
  saveWidth,
347
363
  getDefaultWidth
348
364
  };
349
- $[35] = currentWidth;
350
- $[36] = getDefaultWidth;
351
- $[37] = getMaxPaneWidth;
352
- $[38] = maxPaneWidth;
353
- $[39] = minPaneWidth;
354
- $[40] = saveWidth;
355
- $[41] = t14;
356
- } else t14 = $[41];
357
- return t14;
365
+ $[37] = currentWidth;
366
+ $[38] = getDefaultWidth;
367
+ $[39] = getMaxPaneWidth;
368
+ $[40] = maxPaneWidth;
369
+ $[41] = minPaneWidth;
370
+ $[42] = saveWidth;
371
+ $[43] = t15;
372
+ } else t15 = $[43];
373
+ return t15;
358
374
  }
359
375
  //#endregion
360
- export { DEFAULT_MAX_WIDTH_DIFF, DEFAULT_SIDEBAR_MAX_WIDTH_DIFF, defaultPaneWidth, getDefaultPaneWidth, getMaxWidthDiffFromViewport, isCustomWidthOptions, isPaneWidth, updateAriaValues, usePaneWidth };
376
+ export { DEFAULT_MAX_WIDTH_DIFF, DEFAULT_SIDEBAR_MAX_WIDTH_DIFF, defaultFormatValueText, defaultPaneWidth, getDefaultPaneWidth, getMaxWidthDiffFromViewport, isCustomWidthOptions, isPaneWidth, updateAriaValues, usePaneWidth };
@@ -2,13 +2,13 @@ import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
2
2
  import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
3
3
  import { isAlphabetKey } from "../hooks/useMnemonics.js";
4
4
  import { useId as useId$1 } from "../hooks/useId.js";
5
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
6
5
  import useSafeTimeout from "../hooks/useSafeTimeout.js";
7
6
  import { IconButton } from "../Button/IconButton.js";
8
7
  import { LinkButton } from "../Button/LinkButton.js";
9
8
  import { ButtonComponent } from "../Button/Button.js";
10
9
  import { useResponsiveValue } from "../hooks/useResponsiveValue.js";
11
10
  import Heading from "../Heading/Heading.js";
11
+ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
12
12
  import { AnchoredOverlay } from "../AnchoredOverlay/AnchoredOverlay.js";
13
13
  import { Banner } from "../Banner/index.js";
14
14
  import { useFormControlContext } from "../FormControl/_FormControlContext.js";
@@ -1,7 +1,5 @@
1
- import { useMergedRefs } from "../hooks/useMergedRefs.js";
2
1
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
3
2
  import { AriaStatus } from "../live-region/AriaStatus.js";
4
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
5
3
  import Text_default from "../Text/Text.js";
6
4
  import _VisuallyHidden_module_css_default from "../_VisuallyHidden.module.css.js";
7
5
  import VisuallyHidden from "../_VisuallyHidden.js";
@@ -13,19 +11,14 @@ import UnstyledTextInput from "../internal/components/UnstyledTextInput.js";
13
11
  import { getCharacterCountState } from "../utils/character-counter.js";
14
12
  import { clsx } from "clsx";
15
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
- import React, { useCallback, useId, useRef, useState } from "react";
14
+ import React, { useCallback, useId, useState } from "react";
17
15
  import { isValidElementType } from "react-is";
18
16
  import { AlertFillIcon } from "@primer/octicons-react";
19
17
  //#region src/TextInput/TextInput.tsx
20
18
  const TextInput = /*#__PURE__*/ React.forwardRef(({ icon: IconComponent, leadingVisual: LeadingVisual, trailingVisual: TrailingVisual, trailingAction, block, className, contrast, disabled, loading, loaderPosition = "auto", loaderText = "Loading", monospace, validationStatus, size: sizeProp, onFocus, onBlur, variant: variantProp, width: widthProp, minWidth: minWidthProp, maxWidth: maxWidthProp, type = "text", required, characterLimit, onChange, value, defaultValue, "data-component": dataComponent, ...inputProps }, ref) => {
21
19
  var _counter$isOverLimit;
22
20
  const [isInputFocused, setIsInputFocused] = useState(false);
23
- const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
24
- const inputRef = useRef(null);
25
- const mergedRef = useMergedRefs(inputRef, ref);
26
- const providedOrCreatedRef = useProvidedRefOrCreate(ref);
27
- const readRef = mergedRefEnabled ? inputRef : providedOrCreatedRef;
28
- const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
21
+ const inputRef = useProvidedRefOrCreate(ref);
29
22
  const isControlled = value !== void 0;
30
23
  const [uncontrolledLength, setUncontrolledLength] = useState(() => defaultValue !== void 0 ? String(defaultValue).length : 0);
31
24
  const currentLength = isControlled ? String(value).length : uncontrolledLength;
@@ -36,9 +29,9 @@ const TextInput = /*#__PURE__*/ React.forwardRef(({ icon: IconComponent, leading
36
29
  const showTrailingLoadingIndicator = loading && (loaderPosition === "trailing" || Boolean(loaderPosition === "auto" && !LeadingVisual));
37
30
  const isSegmentedInputType = type === "date" || type === "time" || type === "datetime-local";
38
31
  const focusInput = (e) => {
39
- if (e.target !== readRef.current || !isSegmentedInputType) {
40
- var _readRef$current;
41
- (_readRef$current = readRef.current) === null || _readRef$current === void 0 || _readRef$current.focus();
32
+ if (e.target !== inputRef.current || !isSegmentedInputType) {
33
+ var _inputRef$current;
34
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
42
35
  }
43
36
  };
44
37
  const leadingVisualId = useId();
@@ -95,7 +88,7 @@ const TextInput = /*#__PURE__*/ React.forwardRef(({ icon: IconComponent, leading
95
88
  children: typeof LeadingVisual !== "string" && isValidElementType(LeadingVisual) ? /*#__PURE__*/ jsx(LeadingVisual, {}) : LeadingVisual
96
89
  }),
97
90
  /*#__PURE__*/ jsx(UnstyledTextInput, {
98
- ref: appliedRef,
91
+ ref: inputRef,
99
92
  disabled,
100
93
  onFocus: handleInputFocus,
101
94
  onBlur: handleInputBlur,
@@ -12,8 +12,8 @@ import { c } from "react-compiler-runtime";
12
12
  import { clsx } from "clsx";
13
13
  import { jsx, jsxs } from "react/jsx-runtime";
14
14
  import React, { useRef, useState } from "react";
15
- import { FocusKeys } from "@primer/behaviors";
16
15
  import { isFocusable } from "@primer/behaviors/utils";
16
+ import { FocusKeys } from "@primer/behaviors";
17
17
  import { isValidElementType } from "react-is";
18
18
  //#region src/TextInputWithTokens/TextInputWithTokens.tsx
19
19
  /**
@@ -1,9 +1,6 @@
1
1
  import React from "react";
2
2
 
3
3
  //#region src/ThemeProvider.d.ts
4
- type Theme = {
5
- [key: string]: any;
6
- };
7
4
  type ColorMode = 'day' | 'night' | 'light' | 'dark';
8
5
  type ColorModeWithAuto = ColorMode | 'auto';
9
6
  type ThemeProviderProps = {
@@ -23,4 +20,4 @@ type ThemeProviderProps = {
23
20
  };
24
21
  declare const ThemeProvider: React.FC<React.PropsWithChildren<ThemeProviderProps>>;
25
22
  //#endregion
26
- export { ColorMode, ColorModeWithAuto, Theme, ThemeProvider, ThemeProvider as default, ThemeProviderProps };
23
+ export { ColorMode, ColorModeWithAuto, ThemeProvider, ThemeProvider as default, ThemeProviderProps };
@@ -1,16 +1,14 @@
1
- import theme from "./theme.js";
2
1
  import { useSyncedState } from "./hooks/useSyncedState.js";
3
2
  import { ThemeContext } from "./ThemeContext.js";
4
3
  import { useTheme } from "./useTheme.js";
5
4
  import { c } from "react-compiler-runtime";
6
5
  import { jsx } from "react/jsx-runtime";
7
6
  import React from "react";
8
- import deepmerge from "deepmerge";
9
7
  const defaultDayScheme = "light";
10
8
  const defaultNightScheme = "dark";
11
9
  const ThemeProvider = (t0) => {
12
10
  var _ref, _props$colorMode, _ref2, _props$dayScheme, _ref3, _props$nightScheme;
13
- const $ = c(34);
11
+ const $ = c(29);
14
12
  let children;
15
13
  let props;
16
14
  if ($[0] !== t0) {
@@ -22,8 +20,7 @@ const ThemeProvider = (t0) => {
22
20
  children = $[1];
23
21
  props = $[2];
24
22
  }
25
- const { theme: fallbackTheme, colorMode: fallbackColorMode, dayScheme: fallbackDayScheme, nightScheme: fallbackNightScheme } = useTheme();
26
- const theme$1 = fallbackTheme !== null && fallbackTheme !== void 0 ? fallbackTheme : theme;
23
+ const { colorMode: fallbackColorMode, dayScheme: fallbackDayScheme, nightScheme: fallbackNightScheme } = useTheme();
27
24
  const [colorMode, setColorMode] = useSyncedState((_ref = (_props$colorMode = props.colorMode) !== null && _props$colorMode !== void 0 ? _props$colorMode : fallbackColorMode) !== null && _ref !== void 0 ? _ref : "day");
28
25
  const [dayScheme, setDayScheme] = useSyncedState((_ref2 = (_props$dayScheme = props.dayScheme) !== null && _props$dayScheme !== void 0 ? _props$dayScheme : fallbackDayScheme) !== null && _ref2 !== void 0 ? _ref2 : defaultDayScheme);
29
26
  const [nightScheme, setNightScheme] = useSyncedState((_ref3 = (_props$nightScheme = props.nightScheme) !== null && _props$nightScheme !== void 0 ? _props$nightScheme : fallbackNightScheme) !== null && _ref3 !== void 0 ? _ref3 : defaultNightScheme);
@@ -45,80 +42,68 @@ const ThemeProvider = (t0) => {
45
42
  }
46
43
  const colorScheme = t1;
47
44
  let t2;
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 = {
58
- theme: resolvedTheme,
45
+ if ($[9] !== colorMode || $[10] !== colorScheme || $[11] !== dayScheme || $[12] !== nightScheme || $[13] !== resolvedColorMode || $[14] !== setColorMode || $[15] !== setDayScheme || $[16] !== setNightScheme) {
46
+ t2 = {
59
47
  colorScheme,
60
48
  colorMode,
61
49
  resolvedColorMode,
62
- resolvedColorScheme,
63
50
  dayScheme,
64
51
  nightScheme,
65
52
  setColorMode,
66
53
  setDayScheme,
67
54
  setNightScheme
68
55
  };
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;
56
+ $[9] = colorMode;
57
+ $[10] = colorScheme;
58
+ $[11] = dayScheme;
59
+ $[12] = nightScheme;
60
+ $[13] = resolvedColorMode;
61
+ $[14] = setColorMode;
62
+ $[15] = setDayScheme;
63
+ $[16] = setNightScheme;
64
+ $[17] = t2;
65
+ } else t2 = $[17];
66
+ const contextValue = t2;
82
67
  if (props.contextOnly) {
83
- let t4;
84
- if ($[23] !== children || $[24] !== contextValue) {
85
- t4 = /*#__PURE__*/ jsx(ThemeContext.Provider, {
68
+ let t3;
69
+ if ($[18] !== children || $[19] !== contextValue) {
70
+ t3 = /*#__PURE__*/ jsx(ThemeContext.Provider, {
86
71
  value: contextValue,
87
72
  children
88
73
  });
89
- $[23] = children;
90
- $[24] = contextValue;
91
- $[25] = t4;
92
- } else t4 = $[25];
93
- return t4;
74
+ $[18] = children;
75
+ $[19] = contextValue;
76
+ $[20] = t3;
77
+ } else t3 = $[20];
78
+ return t3;
94
79
  }
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", {
80
+ const t3 = colorMode === "auto" ? "auto" : colorScheme.includes("dark") ? "dark" : "light";
81
+ let t4;
82
+ if ($[21] !== children || $[22] !== dayScheme || $[23] !== nightScheme || $[24] !== t3) {
83
+ t4 = /*#__PURE__*/ jsx("div", {
99
84
  "data-component": "ThemeProvider",
100
- "data-color-mode": t4,
85
+ "data-color-mode": t3,
101
86
  "data-light-theme": dayScheme,
102
87
  "data-dark-theme": nightScheme,
103
88
  children
104
89
  });
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, {
90
+ $[21] = children;
91
+ $[22] = dayScheme;
92
+ $[23] = nightScheme;
93
+ $[24] = t3;
94
+ $[25] = t4;
95
+ } else t4 = $[25];
96
+ let t5;
97
+ if ($[26] !== contextValue || $[27] !== t4) {
98
+ t5 = /*#__PURE__*/ jsx(ThemeContext.Provider, {
114
99
  value: contextValue,
115
- children: t5
100
+ children: t4
116
101
  });
117
- $[31] = contextValue;
118
- $[32] = t5;
119
- $[33] = t6;
120
- } else t6 = $[33];
121
- return t6;
102
+ $[26] = contextValue;
103
+ $[27] = t4;
104
+ $[28] = t5;
105
+ } else t5 = $[28];
106
+ return t5;
122
107
  };
123
108
  function subscribeToSystemColorMode(callback) {
124
109
  var _window, _window$matchMedia;
@@ -150,23 +135,5 @@ function chooseColorScheme(colorMode, dayScheme, nightScheme) {
150
135
  case "night": return nightScheme;
151
136
  }
152
137
  }
153
- function applyColorScheme(theme, colorScheme) {
154
- if (!theme.colorSchemes) return {
155
- resolvedTheme: theme,
156
- resolvedColorScheme: void 0
157
- };
158
- if (!theme.colorSchemes[colorScheme]) {
159
- console.error(`\`${colorScheme}\` scheme not defined in \`theme.colorSchemes\``);
160
- const defaultColorScheme = Object.keys(theme.colorSchemes)[0];
161
- return {
162
- resolvedTheme: deepmerge(theme, theme.colorSchemes[defaultColorScheme]),
163
- resolvedColorScheme: defaultColorScheme
164
- };
165
- }
166
- return {
167
- resolvedTheme: deepmerge(theme, theme.colorSchemes[colorScheme]),
168
- resolvedColorScheme: colorScheme
169
- };
170
- }
171
138
  //#endregion
172
139
  export { ThemeProvider, ThemeProvider as default };
@@ -0,0 +1,2 @@
1
+ .prc-Timeline-Timeline-awSoC{container-type:inline-size;display:flex;flex-direction:column;list-style:none;margin:0;padding:0}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=start]) .prc-Timeline-TimelineItem-QwDVH:first-child{padding-top:0}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=both]) .prc-Timeline-TimelineItem-QwDVH:first-child{padding-top:0}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=start]) .prc-Timeline-TimelineItem-QwDVH:first-child .prc-Timeline-TimelineItemAvatar-4zO8f{top:var(--base-size-16,1rem)}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=both]) .prc-Timeline-TimelineItem-QwDVH:first-child .prc-Timeline-TimelineItemAvatar-4zO8f{top:var(--base-size-16,1rem)}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=start]) .prc-Timeline-TimelineItem-QwDVH:first-child:where([data-condensed]):before{top:var(--base-size-12,.75rem)}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=both]) .prc-Timeline-TimelineItem-QwDVH:first-child:where([data-condensed]):before{top:var(--base-size-12,.75rem)}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=start]) .prc-Timeline-TimelineItem-QwDVH:first-child:where([data-condensed]) .prc-Timeline-TimelineItemAvatar-4zO8f{top:calc(var(--base-size-8,.5rem) + var(--base-size-8,.5rem))}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=both]) .prc-Timeline-TimelineItem-QwDVH:first-child:where([data-condensed]) .prc-Timeline-TimelineItemAvatar-4zO8f{top:calc(var(--base-size-8,.5rem) + var(--base-size-8,.5rem))}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=end]) .prc-Timeline-TimelineItem-QwDVH:last-child{padding-bottom:0}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=both]) .prc-Timeline-TimelineItem-QwDVH:last-child{padding-bottom:0}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=end]) .prc-Timeline-TimelineItem-QwDVH:last-child:where([data-condensed]):before{height:var(--base-size-12,.75rem)}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=both]) .prc-Timeline-TimelineItem-QwDVH:last-child:where([data-condensed]):before{height:var(--base-size-12,.75rem)}.prc-Timeline-TimelineItem-QwDVH{display:flex;margin-left:var(--base-size-16,1rem);padding:var(--base-size-16,1rem) 0;position:relative}.prc-Timeline-TimelineItem-QwDVH:before{background-color:var(--borderColor-muted,#d1d9e0b3);bottom:0;content:"";display:block;left:0;position:absolute;top:0;width:2px}.prc-Timeline-TimelineItem-QwDVH:where([data-condensed]){padding-bottom:0;padding-top:var(--base-size-4,.25rem)}.prc-Timeline-TimelineItem-QwDVH:where([data-condensed]):last-child{padding-bottom:var(--base-size-16,1rem)}.prc-Timeline-TimelineItem-QwDVH:where([data-condensed]) .prc-Timeline-TimelineBadge-u0qSm{background-color:var(--bgColor-default,#fff);border:0;color:var(--fgColor-muted,#59636e);height:16px;margin-bottom:var(--base-size-8,.5rem);margin-top:var(--base-size-8,.5rem)}.prc-Timeline-TimelineItem-QwDVH:where([data-condensed]) .prc-Timeline-TimelineItemAvatar-4zO8f{top:calc(var(--base-size-4,.25rem) + var(--base-size-8,.5rem) + var(--base-size-8,.5rem))}.prc-Timeline-TimelineItemAvatar-4zO8f{left:calc((var(--base-size-40,2.5rem) + var(--base-size-32,2rem))*-1);position:absolute;top:calc(var(--base-size-16,1rem) + var(--base-size-16,1rem));transform:translateY(-50%);z-index:1}.prc-Timeline-TimelineBadgeWrapper-SZw4k{position:relative;z-index:1}.prc-Timeline-TimelineBadge-u0qSm{align-items:center;background-color:var(--timelineBadge-bgColor,#f6f8fa);border-color:var(--bgColor-default,#fff);border-radius:50%;border-style:solid;border-width:var(--borderWidth-thick,.125rem);color:var(--fgColor-muted,#59636e);display:flex;flex-shrink:0;height:32px;justify-content:center;margin-left:-15px;margin-right:var(--base-size-8,.5rem);overflow:hidden;width:32px}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant]){color:var(--fgColor-onEmphasis,#fff)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=accent]){background-color:var(--bgColor-accent-emphasis,#0969da)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=success]){background-color:var(--bgColor-success-emphasis,#1f883d)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=attention]){background-color:var(--bgColor-attention-emphasis,#9a6700)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=severe]){background-color:var(--bgColor-severe-emphasis,#bc4c00)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=danger]){background-color:var(--bgColor-danger-emphasis,#cf222e)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=done]){background-color:var(--bgColor-done-emphasis,#8250df)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=open]){background-color:var(--bgColor-open-emphasis,#1f883d)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=closed]){background-color:var(--bgColor-closed-emphasis,#cf222e)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=sponsors]){background-color:var(--bgColor-sponsors-emphasis,#bf3989)}.prc-Timeline-TimelineBody-tjOtb{color:var(--fgColor-muted,#59636e);flex:auto;font-size:var(--text-body-size-medium,.875rem);margin-top:calc(var(--base-size-4,.25rem) + 1px);max-width:100%;min-width:0}.prc-Timeline-TimelineBreak-X8eti{background-color:var(--bgColor-default,#fff);border:0;border-top:var(--borderWidth-thicker,.25rem) solid var(--borderColor-default,#d1d9e0);height:var(--base-size-24,1.5rem);margin:0;margin-bottom:calc(var(--base-size-16,1rem)*-1);margin-left:0;position:relative;z-index:1}.prc-Timeline-TimelineBreak-X8eti:has(+[data-condensed]){margin-bottom:calc(var(--base-size-12,.75rem)*-1)}.prc-Timeline-TimelineItemActions-56Y7h{align-items:center;align-self:flex-start;display:flex;flex-shrink:0;gap:var(--base-size-8,.5rem);margin-left:auto;min-height:var(--base-size-32,2rem)}@container (width < 480px){.prc-Timeline-TimelineItem-QwDVH{display:grid;grid-template-areas:"badge body" ". actions";grid-template-columns:auto 1fr}.prc-Timeline-TimelineBadgeWrapper-SZw4k{grid-area:badge}.prc-Timeline-TimelineBody-tjOtb{grid-area:body}.prc-Timeline-TimelineItemActions-56Y7h{grid-area:actions;justify-content:flex-start;margin-left:0;margin-top:var(--base-size-8,.5rem);min-height:0}}
2
+ /*# sourceMappingURL=Timeline-b7e6685b.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Timeline/Timeline.module.css.js"],"names":[],"mappings":"AAAA,6BASE,0BAA2B,CAR3B,YAAa,CACb,qBAAsB,CACtB,eAAgB,CAEhB,QAAS,CADT,SAsCF,CA7BI,2GACE,aAeF,CAhBA,0GACE,aAeF,CAbE,kJAEE,4BACF,CAHA,iJAEE,4BACF,CAEA,0IACE,8BACF,CAFA,yIACE,8BACF,CAEA,0KAEE,6DACF,CAHA,yKAEE,6DACF,CAMF,wGACE,gBAKF,CANA,yGACE,gBAKF,CAHE,uIACE,iCACF,CAFA,wIACE,iCACF,CAKN,iCAEE,YAAa,CAEb,oCAAgC,CADhC,kCAA8B,CAF9B,iBAuCF,CAlCE,wCASE,mDAA0C,CAN1C,QAAS,CAIT,UAAW,CAFX,aAAc,CADd,MAAO,CAHP,iBAAkB,CAClB,KAAM,CAIN,SAIF,CAEA,yDAEE,gBAAiB,CADjB,qCAoBF,CAjBE,oEACE,uCACF,CAEA,2FAKE,4CAAwC,CACxC,QAAS,CAFT,kCAA2B,CAH3B,WAAY,CAEZ,sCAAiC,CADjC,mCAKF,CAEA,gGAEE,yFACF,CAIJ,uCAGE,qEAA4D,CAF5D,iBAAkB,CAIlB,6DAAoD,CAEpD,0BAA2B,CAD3B,SAEF,CAEA,yCACE,iBAAkB,CAClB,SACF,CAEA,kCAkBE,kBAAmB,CANnB,qDAA8C,CAE9C,wCAAoC,CAGpC,iBAAkB,CAFlB,kBAAmB,CACnB,6CAAsC,CAPtC,kCAA2B,CAR3B,YAAa,CAMb,aAAc,CAJd,WAAY,CAgBZ,sBAAuB,CAbvB,iBAAkB,CAFlB,qCAAgC,CAIhC,eAAgB,CANhB,UA0DF,CAvCE,wDACE,oCACF,CAEA,+DACE,uDACF,CAEA,gEACE,wDACF,CAEA,kEACE,0DACF,CAEA,+DACE,uDACF,CAEA,+DACE,uDACF,CAEA,6DACE,qDACF,CAEA,6DACE,qDACF,CAEA,+DACE,uDACF,CAEA,iEACE,yDACF,CAGF,iCAME,kCAA2B,CAC3B,SAAU,CAFV,8CAAuC,CADvC,gDAA0C,CAF1C,cAAe,CADf,WAOF,CAEA,kCAOE,4CAAwC,CACxC,QAAS,CACT,qFAAuE,CANvE,iCAA2B,CAC3B,QAAS,CACT,+CAA6C,CAC7C,aAAc,CALd,iBAAkB,CAClB,SAaF,CAHE,yDACE,iDACF,CAGF,wCAEE,kBAAmB,CACnB,qBAAsB,CAFtB,YAAa,CAOb,aAAc,CADd,4BAAuB,CADvB,gBAAiB,CADjB,mCAIF,CAKA,2BACE,iCACE,YAAa,CAEb,gDAEiB,CAHjB,8BAIF,CAEA,yCACE,eACF,CAEA,iCACE,cACF,CAEA,wCACE,iBAAkB,CAIlB,0BAA2B,CAD3B,aAAc,CADd,mCAA8B,CAG9B,YACF,CACF","file":"Timeline-b7e6685b.css","sourcesContent":[".Timeline {\n display: flex;\n flex-direction: column;\n list-style: none;\n padding: 0;\n margin: 0;\n /* Container for the narrow-viewport rules at the end of this file. Uses\n an inline-size container so behavior tracks the timeline's own width,\n not the viewport (works inside narrow side panels and split views). */\n container-type: inline-size;\n\n &:where([data-clip-sidebar='start']),\n &:where([data-clip-sidebar='both']) {\n .TimelineItem:first-child {\n padding-top: 0;\n\n .TimelineItemAvatar {\n /* No padding-top on first item: badge center is at 0 + 16px (half-badge) */\n top: var(--base-size-16);\n }\n\n &:where([data-condensed])::before {\n top: var(--base-size-12);\n }\n\n &:where([data-condensed]) .TimelineItemAvatar {\n /* No padding-top + condensed: badge center is at 0 + 8px margin + 8px half-badge */\n top: calc(var(--base-size-8) + var(--base-size-8));\n }\n }\n }\n\n &:where([data-clip-sidebar='end']),\n &:where([data-clip-sidebar='both']) {\n .TimelineItem:last-child {\n padding-bottom: 0;\n\n &:where([data-condensed])::before {\n height: var(--base-size-12);\n }\n }\n }\n}\n\n.TimelineItem {\n position: relative;\n display: flex;\n padding: var(--base-size-16) 0;\n margin-left: var(--base-size-16);\n\n &::before {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n display: block;\n width: 2px;\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--borderColor-muted);\n }\n\n &:where([data-condensed]) {\n padding-top: var(--base-size-4);\n padding-bottom: 0;\n\n &:last-child {\n padding-bottom: var(--base-size-16);\n }\n\n .TimelineBadge {\n height: 16px;\n margin-top: var(--base-size-8);\n margin-bottom: var(--base-size-8);\n color: var(--fgColor-muted);\n background-color: var(--bgColor-default);\n border: 0;\n }\n\n .TimelineItemAvatar {\n /* Vertically center against the condensed badge (4px padding-top + 8px badge top margin + 8px half-badge) */\n top: calc(var(--base-size-4) + var(--base-size-8) + var(--base-size-8));\n }\n }\n}\n\n.TimelineItemAvatar {\n position: absolute;\n /* Place avatar in the left gutter, aligned with surrounding actor avatars (~72px from item content) */\n left: calc(-1 * (var(--base-size-40) + var(--base-size-32)));\n /* Vertically center against the default badge (16px padding-top + 16px half-badge) */\n top: calc(var(--base-size-16) + var(--base-size-16));\n z-index: 1;\n transform: translateY(-50%);\n}\n\n.TimelineBadgeWrapper {\n position: relative;\n z-index: 1;\n}\n\n.TimelineBadge {\n display: flex;\n width: 32px;\n height: 32px;\n margin-right: var(--base-size-8);\n /* stylelint-disable-next-line primer/spacing */\n margin-left: -15px;\n flex-shrink: 0;\n overflow: hidden;\n color: var(--fgColor-muted);\n\n /* TODOl not quite sure if this is the correct migration for this line */\n background-color: var(--timelineBadge-bgColor);\n /* stylelint-disable-next-line primer/colors */\n border-color: var(--bgColor-default);\n border-style: solid;\n border-width: var(--borderWidth-thick);\n border-radius: 50%;\n align-items: center;\n justify-content: center;\n\n &:where([data-variant]) {\n color: var(--fgColor-onEmphasis);\n }\n\n &:where([data-variant='accent']) {\n background-color: var(--bgColor-accent-emphasis);\n }\n\n &:where([data-variant='success']) {\n background-color: var(--bgColor-success-emphasis);\n }\n\n &:where([data-variant='attention']) {\n background-color: var(--bgColor-attention-emphasis);\n }\n\n &:where([data-variant='severe']) {\n background-color: var(--bgColor-severe-emphasis);\n }\n\n &:where([data-variant='danger']) {\n background-color: var(--bgColor-danger-emphasis);\n }\n\n &:where([data-variant='done']) {\n background-color: var(--bgColor-done-emphasis);\n }\n\n &:where([data-variant='open']) {\n background-color: var(--bgColor-open-emphasis);\n }\n\n &:where([data-variant='closed']) {\n background-color: var(--bgColor-closed-emphasis);\n }\n\n &:where([data-variant='sponsors']) {\n background-color: var(--bgColor-sponsors-emphasis);\n }\n}\n\n.TimelineBody {\n min-width: 0;\n max-width: 100%;\n /* stylelint-disable-next-line primer/spacing */\n margin-top: calc(var(--base-size-4) + 1px);\n font-size: var(--text-body-size-medium);\n color: var(--fgColor-muted);\n flex: auto;\n}\n\n.TimelineBreak {\n position: relative;\n z-index: 1;\n height: var(--base-size-24);\n margin: 0;\n margin-bottom: calc(-1 * var(--base-size-16));\n margin-left: 0;\n background-color: var(--bgColor-default);\n border: 0;\n border-top: var(--borderWidth-thicker) solid var(--borderColor-default);\n\n /* stylelint-disable-next-line selector-pseudo-class-disallowed-list -- scoped to CSS Module, audited (github/github-ui#17224) */\n &:has(+ [data-condensed]) {\n margin-bottom: calc(-1 * var(--base-size-12));\n }\n}\n\n.TimelineItemActions {\n display: flex;\n align-items: center;\n align-self: flex-start;\n /* Match the badge wrapper height (32px in both default and condensed) so contents vertically center against the badge */\n min-height: var(--base-size-32);\n margin-left: auto;\n gap: var(--base-size-8);\n flex-shrink: 0;\n}\n\n/* Below 480px inline size, wrap Timeline.Actions onto its own row under\n Timeline.Body via a 2-column grid. The badge keeps the left column so\n the vertical rule stays consistent. */\n@container (width < 480px) {\n .TimelineItem {\n display: grid;\n grid-template-columns: auto 1fr;\n grid-template-areas:\n 'badge body'\n '. actions';\n }\n\n .TimelineBadgeWrapper {\n grid-area: badge;\n }\n\n .TimelineBody {\n grid-area: body;\n }\n\n .TimelineItemActions {\n grid-area: actions;\n /* Reset flex-row auto-push; the wrapped row sits under Body. */\n margin-top: var(--base-size-8);\n margin-left: 0;\n justify-content: flex-start;\n min-height: 0;\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import "./Timeline-ff81db92.css";
1
+ import "./Timeline-b7e6685b.css";
2
2
  //#region src/Timeline/Timeline.module.css.js
3
3
  var Timeline_module_css_default = {
4
4
  "Timeline": "prc-Timeline-Timeline-awSoC",
@@ -1,9 +1,7 @@
1
- import { useMergedRefs } from "../hooks/useMergedRefs.js";
2
1
  import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
3
2
  import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
4
3
  import { useId as useId$1 } from "../hooks/useId.js";
5
4
  import { warning } from "../utils/warning.js";
6
- import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
7
5
  import { invariant } from "../utils/invariant.js";
8
6
  import Tooltip_module_css_default from "./Tooltip.module.css.js";
9
7
  import VisuallyHidden from "../_VisuallyHidden.js";
@@ -82,12 +80,7 @@ const emptyKeybindingHints = [];
82
80
  const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type = "description", children, id, className, keybindingHint = emptyKeybindingHints, delay = "short", _privateDisableTooltip = false, ...rest }, forwardedRef) => {
83
81
  const tooltipId = useId$1(id);
84
82
  const child = Children.only(children);
85
- const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
86
- const triggerRef = useRef(null);
87
- const mergedTriggerRef = useMergedRefs(triggerRef, forwardedRef);
88
- const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
89
- const readTriggerRef = mergedRefEnabled ? triggerRef : providedOrCreatedRef;
90
- const appliedTriggerRef = mergedRefEnabled ? mergedTriggerRef : providedOrCreatedRef;
83
+ const triggerRef = useProvidedRefOrCreate(forwardedRef);
91
84
  const tooltipElRef = useRef(null);
92
85
  const [calculatedDirection, setCalculatedDirection] = useState(direction);
93
86
  const [isPopoverOpen, setIsPopoverOpen] = useState(false);
@@ -95,9 +88,9 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
95
88
  const { safeSetTimeout, safeClearTimeout } = useSafeTimeout();
96
89
  const openTooltip = () => {
97
90
  try {
98
- if (tooltipElRef.current && readTriggerRef.current && tooltipElRef.current.hasAttribute("popover") && !tooltipElRef.current.matches(":popover-open") && !_privateDisableTooltip) {
91
+ if (tooltipElRef.current && triggerRef.current && tooltipElRef.current.hasAttribute("popover") && !tooltipElRef.current.matches(":popover-open") && !_privateDisableTooltip) {
99
92
  const tooltip = tooltipElRef.current;
100
- const trigger = readTriggerRef.current;
93
+ const trigger = triggerRef.current;
101
94
  tooltip.showPopover();
102
95
  setIsPopoverOpen(true);
103
96
  const { top, left, anchorAlign, anchorSide } = getAnchoredPosition(tooltip, trigger, {
@@ -119,7 +112,7 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
119
112
  openTimeoutRef.current = null;
120
113
  }
121
114
  try {
122
- if (tooltipElRef.current && readTriggerRef.current && tooltipElRef.current.hasAttribute("popover") && tooltipElRef.current.matches(":popover-open")) {
115
+ if (tooltipElRef.current && triggerRef.current && tooltipElRef.current.hasAttribute("popover") && tooltipElRef.current.matches(":popover-open")) {
123
116
  tooltipElRef.current.hidePopover();
124
117
  setIsPopoverOpen(false);
125
118
  } else setIsPopoverOpen(false);
@@ -129,16 +122,16 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
129
122
  };
130
123
  const value = useMemo(() => ({ tooltipId }), [tooltipId]);
131
124
  useEffect(() => {
132
- if (!tooltipElRef.current || !readTriggerRef.current) return;
133
- const isTriggerInteractive = isInteractive(readTriggerRef.current);
134
- const triggerChildren = readTriggerRef.current.childNodes;
125
+ if (!tooltipElRef.current || !triggerRef.current) return;
126
+ const isTriggerInteractive = isInteractive(triggerRef.current);
127
+ const triggerChildren = triggerRef.current.childNodes;
135
128
  const hasInteractiveDescendant = Array.from(triggerChildren).some((child) => {
136
129
  return child instanceof HTMLElement && isInteractive(child) || Array.from(child.childNodes).some((grandChild) => grandChild instanceof HTMLElement && isInteractive(grandChild));
137
130
  });
138
131
  !(isTriggerInteractive || hasInteractiveDescendant) && invariant(false, "The `Tooltip` component expects a single React element that contains interactive content. Consider using a `<button>` or equivalent interactive element instead.");
139
132
  if (type === "label") {
140
- const hasAriaLabel = readTriggerRef.current.hasAttribute("aria-label");
141
- const hasAriaLabelInChildren = Array.from(readTriggerRef.current.childNodes).some((child) => child instanceof HTMLElement && child.hasAttribute("aria-label"));
133
+ const hasAriaLabel = triggerRef.current.hasAttribute("aria-label");
134
+ const hasAriaLabelInChildren = Array.from(triggerRef.current.childNodes).some((child) => child instanceof HTMLElement && child.hasAttribute("aria-label"));
142
135
  warning(hasAriaLabel || hasAriaLabelInChildren, "The label type `Tooltip` is going to be used here to label the trigger element. Please remove the aria-label from the trigger element.");
143
136
  }
144
137
  if (typeof window !== "undefined") {
@@ -147,7 +140,7 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
147
140
  tooltipElRef.current.setAttribute("popover", "auto");
148
141
  }, [
149
142
  tooltipElRef,
150
- readTriggerRef,
143
+ triggerRef,
151
144
  direction,
152
145
  type
153
146
  ]);
@@ -164,7 +157,7 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
164
157
  return /*#__PURE__*/ jsx(TooltipContext.Provider, {
165
158
  value,
166
159
  children: /*#__PURE__*/ jsxs(Fragment, { children: [/*#__PURE__*/ React.isValidElement(child) && /*#__PURE__*/ React.cloneElement(child, {
167
- ref: appliedTriggerRef,
160
+ ref: triggerRef,
168
161
  "aria-describedby": (() => {
169
162
  if (type !== "description") return child.props["aria-describedby"];
170
163
  const existingDescribedBy = child.props["aria-describedby"];
@@ -191,12 +184,13 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
191
184
  (_child$props$onFocus = (_child$props3 = child.props).onFocus) === null || _child$props$onFocus === void 0 || _child$props$onFocus.call(_child$props3, event);
192
185
  },
193
186
  onMouseOverCapture: (event) => {
187
+ const delayTime = delayTimeMap[delay] || 50;
194
188
  openTimeoutRef.current = safeSetTimeout(() => {
195
189
  var _child$props$onMouseE, _child$props4;
196
190
  if (!openTimeoutRef.current) return;
197
191
  openTooltip();
198
192
  (_child$props$onMouseE = (_child$props4 = child.props).onMouseEnter) === null || _child$props$onMouseE === void 0 || _child$props$onMouseE.call(_child$props4, event);
199
- }, delayTimeMap[delay] || 50);
193
+ }, delayTime);
200
194
  },
201
195
  onMouseLeave: (event) => {
202
196
  var _child$props$onMouseL, _child$props5;
@@ -1,4 +1,6 @@
1
1
  import { useId as useId$1 } from "../hooks/useId.js";
2
+ import { isSlot } from "../utils/is-slot.js";
3
+ import { useSlots } from "../hooks/useSlots.js";
2
4
  import Spinner from "../Spinner/Spinner.js";
3
5
  import { AriaStatus } from "../live-region/AriaStatus.js";
4
6
  import { fixedForwardRef } from "../utils/modern-polymorphic.js";
@@ -10,8 +12,6 @@ import useSafeTimeout from "../hooks/useSafeTimeout.js";
10
12
  import { Tooltip } from "../TooltipV2/Tooltip.js";
11
13
  import { IconButton } from "../Button/IconButton.js";
12
14
  import { ButtonComponent } from "../Button/Button.js";
13
- import { isSlot } from "../utils/is-slot.js";
14
- import { useSlots } from "../hooks/useSlots.js";
15
15
  import { Dialog } from "../Dialog/Dialog.js";
16
16
  import { ConfirmationDialog } from "../ConfirmationDialog/ConfirmationDialog.js";
17
17
  import { ActionList } from "../ActionList/index.js";
@@ -349,7 +349,10 @@ const SubTree = ({ count, state, children, "aria-label": ariaLabel }) => {
349
349
  });
350
350
  setLoadingFocused(false);
351
351
  }
352
- } else if (state === "loading") announceUpdate(`${getAccessibleName(parentElement)} content loading`);
352
+ } else if (state === "loading") {
353
+ const parentName = getAccessibleName(parentElement);
354
+ announceUpdate(`${parentName} content loading`);
355
+ }
353
356
  }, [
354
357
  loadingFocused,
355
358
  previousState,
@@ -1,14 +1,14 @@
1
1
  import { useProvidedRefOrCreate } from "../../hooks/useProvidedRefOrCreate.js";
2
2
  import { useAnchoredPosition } from "../../hooks/useAnchoredPosition.js";
3
3
  import { useId as useId$1 } from "../../hooks/useId.js";
4
+ import { isSlot } from "../../utils/is-slot.js";
5
+ import { useSlots } from "../../hooks/useSlots.js";
4
6
  import Spinner from "../../Spinner/Spinner.js";
5
7
  import { AriaStatus } from "../../live-region/AriaStatus.js";
6
8
  import { invariant } from "../../utils/invariant.js";
7
9
  import { IconButton } from "../../Button/IconButton.js";
8
10
  import { ButtonComponent } from "../../Button/Button.js";
9
11
  import { useResponsiveValue } from "../../hooks/useResponsiveValue.js";
10
- import { isSlot } from "../../utils/is-slot.js";
11
- import { useSlots } from "../../hooks/useSlots.js";
12
12
  import { ActionListContainerContext } from "../../ActionList/ActionListContainerContext.js";
13
13
  import Heading from "../../Heading/Heading.js";
14
14
  import Link from "../../Link/Link.js";
@@ -73,7 +73,7 @@ type TabPanelProps = {
73
73
  value: string;
74
74
  };
75
75
  type TabListHookProps<T extends HTMLElement> = TabListProps & {
76
- /** Optional ref to use for the tablist. If none is provided, one will be generated automatically */ref?: React.Ref<T | null>;
76
+ /** Optional ref to use for the tablist. If none is provided, one will be generated automatically */ref?: React.RefObject<T>;
77
77
  };
78
78
  type TabListHookResult<T extends HTMLElement> = {
79
79
  /** Props to be spread onto the tablist element */tabListProps: {
@@ -81,7 +81,7 @@ type TabListHookResult<T extends HTMLElement> = {
81
81
  'aria-orientation': AriaAttributes['aria-orientation'];
82
82
  'aria-label': AriaAttributes['aria-label'];
83
83
  'aria-labelledby': AriaAttributes['aria-labelledby'];
84
- ref: React.Ref<T | null>;
84
+ ref: React.RefObject<T | null>;
85
85
  role: 'tablist';
86
86
  };
87
87
  };