@primer/react 0.0.0-20260312192106 → 0.0.0-20260312192556

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 +12 -4
  2. package/dist/ActionBar/ActionBar-f2b70d1d.css +2 -0
  3. package/dist/ActionBar/ActionBar-f2b70d1d.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 +389 -390
  7. package/dist/ActionBar/ActionBar.module.css.js +2 -2
  8. package/dist/ActionBar/index.d.ts +1 -1
  9. package/dist/Autocomplete/AutocompleteInput.js +3 -3
  10. package/dist/Autocomplete/AutocompleteOverlay.js +3 -3
  11. package/dist/Banner/Banner-b3871000.css +2 -0
  12. package/dist/Banner/Banner-b3871000.css.map +1 -0
  13. package/dist/Banner/Banner.module.css.js +1 -1
  14. package/dist/Button/ButtonBase.d.ts.map +1 -1
  15. package/dist/Button/ButtonBase.js +4 -3
  16. package/dist/Dialog/Dialog.js +3 -3
  17. package/dist/Heading/Heading.js +3 -3
  18. package/dist/Link/Link.d.ts.map +1 -1
  19. package/dist/Link/Link.js +4 -3
  20. package/dist/Overlay/Overlay.js +21 -22
  21. package/dist/PageLayout/PageLayout.js +5 -5
  22. package/dist/TextInputWithTokens/TextInputWithTokens.js +95 -96
  23. package/dist/deprecated/DialogV1/Dialog.js +11 -12
  24. package/dist/hooks/index.d.ts +0 -1
  25. package/dist/hooks/index.d.ts.map +1 -1
  26. package/dist/hooks/useRefObjectAsForwardedRef.d.ts +0 -12
  27. package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
  28. package/dist/hooks/useRefObjectAsForwardedRef.js +0 -12
  29. package/dist/index.d.ts +0 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +0 -1
  32. package/generated/components.json +1 -1
  33. package/generated/hooks.json +0 -22
  34. package/package.json +1 -1
  35. package/dist/ActionBar/ActionBar-a41224b2.css +0 -2
  36. package/dist/ActionBar/ActionBar-a41224b2.css.map +0 -1
  37. package/dist/Banner/Banner-f672cdf9.css +0 -2
  38. package/dist/Banner/Banner-f672cdf9.css.map +0 -1
  39. package/dist/hooks/useCombinedRefs.d.ts +0 -51
  40. package/dist/hooks/useCombinedRefs.d.ts.map +0 -1
  41. package/dist/hooks/useCombinedRefs.js +0 -86
@@ -1,86 +0,0 @@
1
- import { c } from 'react-compiler-runtime';
2
- import 'react';
3
-
4
- /**
5
- * Combine two refs of matching type (typically an external or forwarded ref and an internal `useRef` object or
6
- * callback ref).
7
- *
8
- * If you need to combine more than two refs (what are you doing?) just nest the hook:
9
- * `useCombinedRefs(refA, useCombinedRefs(refB, refC))`
10
- *
11
- * @param refA First ref to combine. The order is not important.
12
- * @param refB Second ref to combine. The order is not important.
13
- * @returns A new ref which must be passed to the relevant child component. **Important**: do not pass `refA` or
14
- * `refB` to the component!
15
- *
16
- * @example
17
- * // React 18
18
- * const Example = forwardRef<HTMLButtonElement, {}>((props, forwardedRef) => {
19
- * const ref = useRef<HTMLButtonElement>(null)
20
- * const combinedRef = useCombinedRefs(forwardedRef, ref)
21
- *
22
- * return <button ref={combinedRef} />
23
- * })
24
- *
25
- * @example
26
- * // React 19
27
- * const Example = ({ref: externalRef}: {ref?: Ref<HTMLButtonElement>}) => {
28
- * const ref = useRef<HTMLButtonElement>(null)
29
- * const combinedRef = useCombinedRefs(externalRef, ref)
30
- *
31
- * return <button ref={combinedRef} />
32
- * }
33
- */
34
- function useCombinedRefs(refA, refB) {
35
- const $ = c(3);
36
- let t0;
37
- if ($[0] !== refA || $[1] !== refB) {
38
- t0 = value => {
39
- const cleanupA = setRef(refA, value);
40
- const cleanupB = setRef(refB, value);
41
- return () => {
42
- if (cleanupA) {
43
- cleanupA();
44
- } else {
45
- setRef(refA, null);
46
- }
47
- if (cleanupB) {
48
- cleanupB();
49
- } else {
50
- setRef(refB, null);
51
- }
52
- };
53
- };
54
- $[0] = refA;
55
- $[1] = refB;
56
- $[2] = t0;
57
- } else {
58
- t0 = $[2];
59
- }
60
- return t0;
61
- }
62
-
63
- /**
64
- * React 19 supports callback refs that can return a cleanup function. If a cleanup function is returned, the
65
- * cleanup is called on unmount **instead** of setting the ref to null.
66
- */
67
- // bivarianceHack copied from React types
68
-
69
- /**
70
- * Supporting React 18 and 19 while alleviating the need for any hacks or casts in consumers:
71
- * - `ForwardedRef` from the React 18 `forwardRef` HOC
72
- * - `React19RefCallback` for callback refs that can return a cleanup function (this is included in `Ref` in React 19
73
- * but not in 18)
74
- * - `Ref` for standard refs from `useRef` or passed in as React 19 prop
75
- * - `undefined` to allow for easy use of optional `ref` props in React 19
76
- */
77
-
78
- function setRef(ref, value) {
79
- if (typeof ref === 'function') {
80
- return ref(value);
81
- } else if (ref) {
82
- ref.current = value;
83
- }
84
- }
85
-
86
- export { useCombinedRefs };