@primer/react 0.0.0-20260527214455 → 0.0.0-20260528014355

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 (65) hide show
  1. package/CHANGELOG.md +3 -59
  2. package/dist/ActionList/index.d.ts +6 -6
  3. package/dist/ActionMenu/ActionMenu.d.ts.map +1 -1
  4. package/dist/ActionMenu/ActionMenu.js +1 -0
  5. package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
  6. package/dist/AnchoredOverlay/AnchoredOverlay.js +4 -7
  7. package/dist/Banner/Banner.d.ts.map +1 -1
  8. package/dist/Banner/Banner.js +20 -17
  9. package/dist/CheckboxGroup/CheckboxGroup.js +1 -0
  10. package/dist/DataTable/index.d.ts.map +1 -1
  11. package/dist/DataTable/index.js +1 -0
  12. package/dist/Dialog/Dialog.d.ts +1 -0
  13. package/dist/Dialog/Dialog.d.ts.map +1 -1
  14. package/dist/Dialog/Dialog.js +1 -0
  15. package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -1
  16. package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
  17. package/dist/FilteredActionList/FilteredActionList.js +0 -4
  18. package/dist/FormControl/FormControl.d.ts +3 -3
  19. package/dist/Heading/Heading.d.ts.map +1 -1
  20. package/dist/Heading/Heading.js +16 -8
  21. package/dist/Link/Link.d.ts.map +1 -1
  22. package/dist/Link/Link.js +16 -8
  23. package/dist/NavList/NavList.d.ts +4 -4
  24. package/dist/NavList/NavList.d.ts.map +1 -1
  25. package/dist/NavList/NavList.js +6 -7
  26. package/dist/PageLayout/PageLayout.d.ts +1 -0
  27. package/dist/PageLayout/PageLayout.d.ts.map +1 -1
  28. package/dist/PageLayout/PageLayout.js +1 -0
  29. package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
  30. package/dist/PageLayout/usePaneWidth.js +1 -3
  31. package/dist/RadioGroup/RadioGroup.d.ts +4 -3
  32. package/dist/RadioGroup/RadioGroup.d.ts.map +1 -1
  33. package/dist/RadioGroup/RadioGroup.js +1 -0
  34. package/dist/SegmentedControl/SegmentedControl.d.ts +3 -2
  35. package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  36. package/dist/SegmentedControl/SegmentedControl.js +1 -0
  37. package/dist/Tooltip/Tooltip.js +1 -1
  38. package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
  39. package/dist/UnderlineNav/UnderlineNav.js +12 -9
  40. package/dist/experimental/UnderlinePanels/UnderlinePanels.d.ts.map +1 -1
  41. package/dist/experimental/UnderlinePanels/UnderlinePanels.js +58 -101
  42. package/dist/hooks/index.d.ts +0 -1
  43. package/dist/hooks/index.d.ts.map +1 -1
  44. package/dist/hooks/useSlots.d.ts.map +1 -1
  45. package/dist/hooks/useSlots.js +0 -24
  46. package/dist/index.d.ts +1 -4
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +0 -3
  49. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.d.ts +3 -3
  50. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.d.ts.map +1 -1
  51. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +4 -3
  52. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupCaption.js +1 -1
  53. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupLabel.js +1 -1
  54. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupValidation.js +1 -1
  55. package/dist/internal/hooks/useFocus.d.ts +1 -9
  56. package/dist/internal/hooks/useFocus.d.ts.map +1 -1
  57. package/package.json +1 -1
  58. package/dist/internal/hooks/useDevOnlyEffect.d.ts +0 -16
  59. package/dist/internal/hooks/useDevOnlyEffect.d.ts.map +0 -1
  60. package/dist/internal/hooks/useDevOnlyEffect.js +0 -25
  61. package/dist/utils/as-slot.d.ts +0 -20
  62. package/dist/utils/as-slot.d.ts.map +0 -1
  63. package/dist/utils/as-slot.js +0 -30
  64. package/dist/utils/testing/profiler.d.ts +0 -35
  65. package/dist/utils/testing/profiler.d.ts.map +0 -1
@@ -1,25 +0,0 @@
1
- import { useEffect } from 'react';
2
-
3
- /**
4
- * Runs an effect only in development. Wrapping `useEffect` in a regular hook
5
- * with an outer `__DEV__` guard keeps the production cost to zero (the entire
6
- * call is dropped by the consumer's `process.env.NODE_ENV` replacement) while
7
- * centralising the `eslint-disable react-hooks/rules-of-hooks` to one place
8
- * instead of every call site.
9
- *
10
- * `exhaustive-deps` is wired up to also check call sites of this hook via
11
- * `additionalEffectHooks` in `eslint.config.mjs`, so callers get the same
12
- * deps lint they would for a plain `useEffect`.
13
- *
14
- * @param effect The effect callback to run in development.
15
- * @param deps Dependency list, same semantics as `useEffect`.
16
- */
17
- const useDevOnlyEffect = (effect, deps) => {
18
- if (process.env.NODE_ENV !== "production") {
19
- // Forwarding wrapper; deps lint applies at call sites.
20
- // eslint-disable-next-line react-hooks/rules-of-hooks
21
- useEffect(effect, deps);
22
- }
23
- };
24
-
25
- export { useDevOnlyEffect };
@@ -1,20 +0,0 @@
1
- import type { WithSlotMarker } from './types';
2
- /**
3
- * Copies the `__SLOT__` marker from a slot-aware source component onto another
4
- * component, returning the same component reference typed as a slot.
5
- *
6
- * Useful when building reusable wrappers around Primer slot components that
7
- * still need to be recognised by the parent's slot scanner.
8
- *
9
- * @example
10
- * ```tsx
11
- * const ColoredLeadingVisual = asSlot(
12
- * function ColoredLeadingVisual({color, children}) {
13
- * return <ActionList.LeadingVisual><span style={{color}}>{children}</span></ActionList.LeadingVisual>
14
- * },
15
- * ActionList.LeadingVisual,
16
- * )
17
- * ```
18
- */
19
- export declare function asSlot<T>(component: T, slotSource: WithSlotMarker<unknown>): WithSlotMarker<T>;
20
- //# sourceMappingURL=as-slot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"as-slot.d.ts","sourceRoot":"","sources":["../../src/utils/as-slot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,cAAc,EAAC,MAAM,SAAS,CAAA;AAEvD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAW9F"}
@@ -1,30 +0,0 @@
1
- import { warning } from './warning.js';
2
-
3
- /**
4
- * Copies the `__SLOT__` marker from a slot-aware source component onto another
5
- * component, returning the same component reference typed as a slot.
6
- *
7
- * Useful when building reusable wrappers around Primer slot components that
8
- * still need to be recognised by the parent's slot scanner.
9
- *
10
- * @example
11
- * ```tsx
12
- * const ColoredLeadingVisual = asSlot(
13
- * function ColoredLeadingVisual({color, children}) {
14
- * return <ActionList.LeadingVisual><span style={{color}}>{children}</span></ActionList.LeadingVisual>
15
- * },
16
- * ActionList.LeadingVisual,
17
- * )
18
- * ```
19
- */
20
- function asSlot(component, slotSource) {
21
- if (process.env.NODE_ENV !== "production") {
22
- process.env.NODE_ENV !== "production" ? warning(!slotSource.__SLOT__, 'asSlot: the provided slotSource does not have a `__SLOT__` marker. The wrapper will not be recognised by the parent slot scanner.') : void 0;
23
- }
24
- if (slotSource.__SLOT__) {
25
- component.__SLOT__ = slotSource.__SLOT__;
26
- }
27
- return component;
28
- }
29
-
30
- export { asSlot };
@@ -1,35 +0,0 @@
1
- import { type ReactElement } from 'react';
2
- export type RenderCounter = {
3
- /** Total number of times the wrapped subtree has rendered (mount + updates). */
4
- readonly count: number;
5
- /** Number of mount renders. */
6
- readonly mountCount: number;
7
- /** Number of update renders (any cause). */
8
- readonly updateCount: number;
9
- /**
10
- * Number of updates triggered inside the same commit cycle that produced the
11
- * original render — i.e., a `setState` call from inside a `useLayoutEffect`
12
- * that forced a synchronous re-render before paint. This is the canonical
13
- * "nested update" / cascade signal; assert `nestedUpdateCount === 0` to pin
14
- * that a component never forces a double-commit.
15
- */
16
- readonly nestedUpdateCount: number;
17
- /** Reset the counter. */
18
- reset(): void;
19
- };
20
- /**
21
- * Returns a `[Wrap, counter]` pair. Wrap the component under test with `Wrap`
22
- * to count how many times its subtree renders. Useful for asserting that a
23
- * single user interaction (or a stable prop) does not cause cascading renders.
24
- *
25
- * @example
26
- * const [Wrap, counter] = createRenderCounter()
27
- * render(<Wrap><MyComponent /></Wrap>)
28
- * // ... interaction ...
29
- * expect(counter.updateCount).toBe(1)
30
- * expect(counter.nestedUpdateCount).toBe(0)
31
- */
32
- export declare function createRenderCounter(id?: string): [(props: {
33
- children: ReactElement | ReactElement[];
34
- }) => ReactElement, RenderCounter];
35
- //# sourceMappingURL=profiler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"profiler.d.ts","sourceRoot":"","sources":["../../../src/utils/testing/profiler.tsx"],"names":[],"mappings":"AAAA,OAAc,EAA0C,KAAK,YAAY,EAAC,MAAM,OAAO,CAAA;AAEvF,MAAM,MAAM,aAAa,GAAG;IAC1B,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,4CAA4C;IAC5C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;IAClC,yBAAyB;IACzB,KAAK,IAAI,IAAI,CAAA;CACd,CAAA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,SAAkB,GACnB,CAAC,CAAC,KAAK,EAAE;IAAC,QAAQ,EAAE,YAAY,GAAG,YAAY,EAAE,CAAA;CAAC,KAAK,YAAY,EAAE,aAAa,CAAC,CAsCrF"}