@primer/react 0.0.0-20260508121249 → 0.0.0-20260508164446

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 (41) hide show
  1. package/CHANGELOG.md +5 -11
  2. package/dist/ActionBar/ActionBar-e2c44be2.css +2 -0
  3. package/dist/ActionBar/ActionBar-e2c44be2.css.map +1 -0
  4. package/dist/ActionBar/ActionBar.d.ts +1 -1
  5. package/dist/ActionBar/ActionBar.d.ts.map +1 -1
  6. package/dist/ActionBar/ActionBar.js +293 -381
  7. package/dist/ActionBar/ActionBar.module.css.js +2 -2
  8. package/dist/ActionBar/index.d.ts +1 -1
  9. package/dist/ActionList/LinkItem.d.ts +1 -1
  10. package/dist/ActionList/index.d.ts +2 -2
  11. package/dist/AnchoredOverlay/AnchoredOverlay-0c26c5f8.css +2 -0
  12. package/dist/AnchoredOverlay/AnchoredOverlay-0c26c5f8.css.map +1 -0
  13. package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
  14. package/dist/AnchoredOverlay/AnchoredOverlay.js +26 -63
  15. package/dist/AnchoredOverlay/AnchoredOverlay.module.css.js +1 -1
  16. package/dist/Autocomplete/Autocomplete.d.ts +1 -1
  17. package/dist/Autocomplete/AutocompleteOverlay.d.ts.map +1 -1
  18. package/dist/Autocomplete/AutocompleteOverlay.js +3 -16
  19. package/dist/DataTable/sorting.d.ts +1 -1
  20. package/dist/Overlay/{Overlay-4e689024.css → Overlay-95cfd3c7.css} +2 -2
  21. package/dist/Overlay/Overlay-95cfd3c7.css.map +1 -0
  22. package/dist/Overlay/Overlay.module.css.js +1 -1
  23. package/dist/TextInput/TextInput.d.ts +1 -1
  24. package/dist/TextInputWithTokens/TextInputWithTokens.d.ts +3 -3
  25. package/dist/experimental/SelectPanel2/mock-story-data.d.ts +3 -3
  26. package/dist/hooks/index.d.ts +0 -2
  27. package/dist/hooks/index.d.ts.map +1 -1
  28. package/dist/hooks/useSyncedState.d.ts +1 -1
  29. package/dist/internal/components/TextInputInnerAction.d.ts +1 -1
  30. package/dist/theme.d.ts +1 -1
  31. package/dist/utils/useIsomorphicLayoutEffect.d.ts +2 -2
  32. package/dist/utils/useIsomorphicLayoutEffect.d.ts.map +1 -1
  33. package/package.json +2 -2
  34. package/dist/ActionBar/ActionBar-a41224b2.css +0 -2
  35. package/dist/ActionBar/ActionBar-a41224b2.css.map +0 -1
  36. package/dist/AnchoredOverlay/AnchoredOverlay-efecedd0.css +0 -2
  37. package/dist/AnchoredOverlay/AnchoredOverlay-efecedd0.css.map +0 -1
  38. package/dist/Overlay/Overlay-4e689024.css.map +0 -1
  39. package/dist/hooks/useCSSAnchorPositioning.d.ts +0 -35
  40. package/dist/hooks/useCSSAnchorPositioning.d.ts.map +0 -1
  41. package/dist/hooks/useCSSAnchorPositioning.js +0 -90
@@ -1,90 +0,0 @@
1
- import { c } from 'react-compiler-runtime';
2
- import { useState, useEffect } from 'react';
3
- import { useId } from './useId.js';
4
- import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
5
-
6
- /**
7
- * Manages CSS anchor positioning by linking an anchor element and a floating
8
- * element via `anchor-name` and `position-anchor` CSS properties.
9
- *
10
- * 1. Checks the `primer_react_css_anchor_positioning` feature flag
11
- * 2. Detects native browser support for CSS anchor positioning
12
- * 3. Sets `anchor-name` on the anchor element
13
- * 4. Sets `position-anchor` on the floating element when open
14
- * 5. Cleans up styles on unmount or when closed
15
- */
16
- function useCSSAnchorPositioning(settings) {
17
- const $ = c(11);
18
- const {
19
- anchorElementRef,
20
- floatingElementRef,
21
- open: t0
22
- } = settings;
23
- const open = t0 === undefined ? true : t0;
24
- const cssAnchorPositioningFlag = useFeatureFlag("primer_react_css_anchor_positioning");
25
- const [supportsNativeCSSAnchorPositioning] = useState(_temp);
26
- const enabled = cssAnchorPositioningFlag && supportsNativeCSSAnchorPositioning;
27
- const rawId = useId();
28
- let t1;
29
- if ($[0] !== rawId) {
30
- t1 = rawId.replaceAll(":", "_");
31
- $[0] = rawId;
32
- $[1] = t1;
33
- } else {
34
- t1 = $[1];
35
- }
36
- const id = t1;
37
- const anchorName = `--css-anchor-${id}`;
38
- let t2;
39
- let t3;
40
- if ($[2] !== anchorElementRef || $[3] !== anchorName || $[4] !== enabled || $[5] !== floatingElementRef || $[6] !== open) {
41
- t2 = () => {
42
- if (!enabled) {
43
- return;
44
- }
45
- const anchorElement = anchorElementRef.current;
46
- const floatingElement = floatingElementRef.current;
47
- if (!anchorElement) {
48
- return;
49
- }
50
- anchorElement.style.setProperty("anchor-name", anchorName);
51
- if (open && floatingElement) {
52
- floatingElement.style.setProperty("position-anchor", anchorName);
53
- }
54
- return () => {
55
- anchorElement.style.removeProperty("anchor-name");
56
- if (floatingElement) {
57
- floatingElement.style.removeProperty("position-anchor");
58
- }
59
- };
60
- };
61
- t3 = [enabled, open, anchorName, anchorElementRef, floatingElementRef];
62
- $[2] = anchorElementRef;
63
- $[3] = anchorName;
64
- $[4] = enabled;
65
- $[5] = floatingElementRef;
66
- $[6] = open;
67
- $[7] = t2;
68
- $[8] = t3;
69
- } else {
70
- t2 = $[7];
71
- t3 = $[8];
72
- }
73
- useEffect(t2, t3);
74
- let t4;
75
- if ($[9] !== enabled) {
76
- t4 = {
77
- enabled
78
- };
79
- $[9] = enabled;
80
- $[10] = t4;
81
- } else {
82
- t4 = $[10];
83
- }
84
- return t4;
85
- }
86
- function _temp() {
87
- return typeof document !== "undefined" && "anchorName" in document.documentElement.style;
88
- }
89
-
90
- export { useCSSAnchorPositioning };