@primer/react 38.40.1-rc.0bcc68991 → 38.40.1-rc.1028b70d8

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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,8 @@
6
6
 
7
7
  - [#8413](https://github.com/primer/react/pull/8413) [`d4e30ed`](https://github.com/primer/react/commit/d4e30ed186af6ae781b3adcf83278e0c2001a834) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - SelectPanel: Announce the filter input label when focus moves into the panel
8
8
 
9
+ - [#8443](https://github.com/primer/react/pull/8443) [`e2d6cb9`](https://github.com/primer/react/commit/e2d6cb931bbde9446701056f204b055789b16dd9) Thanks [@siddharthkp](https://github.com/siddharthkp)! - UnderlineNav: Avoid adding a default `href` when items render as custom link components
10
+
9
11
  - [#8442](https://github.com/primer/react/pull/8442) [`68019e8`](https://github.com/primer/react/commit/68019e8945a754bb0f97c9e963b90e2a9ccaaf85) Thanks [@joshfarrant](https://github.com/joshfarrant)! - SegmentedControl: Allow controls to grow vertically and preserve visible labels when they wrap
10
12
 
11
13
  ## 38.40.0
@@ -9,72 +9,80 @@ import { jsx } from "react/jsx-runtime";
9
9
  //#region src/UnderlineNav/UnderlineNavItem.tsx
10
10
  const UnderlineNavItem = /*#__PURE__*/ forwardRef((allProps, forwardedRef) => {
11
11
  var _leadingVisual;
12
- const $ = c(30);
12
+ const $ = c(33);
13
13
  let Icon;
14
14
  let ariaCurrent;
15
15
  let children;
16
16
  let counter;
17
+ let href;
17
18
  let leadingVisual;
18
19
  let onSelect;
19
20
  let props;
20
21
  let t0;
21
- let t1;
22
22
  if ($[0] !== allProps) {
23
- ({as: t0, href: t1, children, counter, onSelect, "aria-current": ariaCurrent, icon: Icon, leadingVisual, ...props} = allProps);
23
+ ({as: t0, href, children, counter, onSelect, "aria-current": ariaCurrent, icon: Icon, leadingVisual, ...props} = allProps);
24
24
  $[0] = allProps;
25
25
  $[1] = Icon;
26
26
  $[2] = ariaCurrent;
27
27
  $[3] = children;
28
28
  $[4] = counter;
29
- $[5] = leadingVisual;
30
- $[6] = onSelect;
31
- $[7] = props;
32
- $[8] = t0;
33
- $[9] = t1;
29
+ $[5] = href;
30
+ $[6] = leadingVisual;
31
+ $[7] = onSelect;
32
+ $[8] = props;
33
+ $[9] = t0;
34
34
  } else {
35
35
  Icon = $[1];
36
36
  ariaCurrent = $[2];
37
37
  children = $[3];
38
38
  counter = $[4];
39
- leadingVisual = $[5];
40
- onSelect = $[6];
41
- props = $[7];
42
- t0 = $[8];
43
- t1 = $[9];
39
+ href = $[5];
40
+ leadingVisual = $[6];
41
+ onSelect = $[7];
42
+ props = $[8];
43
+ t0 = $[9];
44
44
  }
45
45
  const Component = t0 === void 0 ? "a" : t0;
46
- const href = t1 === void 0 ? "#" : t1;
46
+ let t1;
47
+ if ($[10] !== Component || $[11] !== href) {
48
+ var _href;
49
+ t1 = Component === "a" ? { href: (_href = href) !== null && _href !== void 0 ? _href : "#" } : href === void 0 ? {} : { href };
50
+ $[10] = Component;
51
+ $[11] = href;
52
+ $[12] = t1;
53
+ } else t1 = $[12];
54
+ const hrefProps = t1;
47
55
  const ref = useRef(null);
48
56
  const { loadingCounters } = useContext(UnderlineNavContext);
49
57
  const isOverflowing = useIsClipped(ref);
50
58
  UnderlineNavItemsRegistry.useRegisterDescendant(isOverflowing ? allProps : null);
51
59
  let t2;
52
- if ($[10] !== onSelect) {
60
+ if ($[13] !== onSelect) {
53
61
  t2 = (event) => {
54
62
  if ((event.key === " " || event.key === "Enter") && !event.defaultPrevented && typeof onSelect === "function") onSelect(event);
55
63
  };
56
- $[10] = onSelect;
57
- $[11] = t2;
58
- } else t2 = $[11];
64
+ $[13] = onSelect;
65
+ $[14] = t2;
66
+ } else t2 = $[14];
59
67
  const keyDownHandler = t2;
60
68
  let t3;
61
- if ($[12] !== onSelect) {
69
+ if ($[15] !== onSelect) {
62
70
  t3 = (event_0) => {
63
71
  if (!event_0.defaultPrevented && typeof onSelect === "function") onSelect(event_0);
64
72
  };
65
- $[12] = onSelect;
66
- $[13] = t3;
67
- } else t3 = $[13];
73
+ $[15] = onSelect;
74
+ $[16] = t3;
75
+ } else t3 = $[16];
68
76
  const clickHandler = t3;
69
77
  const t4 = isOverflowing ? true : allProps["aria-hidden"];
70
78
  const t5 = (_leadingVisual = leadingVisual) !== null && _leadingVisual !== void 0 ? _leadingVisual : Icon;
71
79
  const t6 = isOverflowing ? -1 : allProps.tabIndex;
72
80
  let t7;
73
- if ($[14] !== Component || $[15] !== ariaCurrent || $[16] !== children || $[17] !== clickHandler || $[18] !== counter || $[19] !== forwardedRef || $[20] !== href || $[21] !== keyDownHandler || $[22] !== loadingCounters || $[23] !== props || $[24] !== t5 || $[25] !== t6) {
81
+ if ($[17] !== Component || $[18] !== ariaCurrent || $[19] !== children || $[20] !== clickHandler || $[21] !== counter || $[22] !== forwardedRef || $[23] !== hrefProps || $[24] !== keyDownHandler || $[25] !== loadingCounters || $[26] !== props || $[27] !== t5 || $[28] !== t6) {
74
82
  t7 = /*#__PURE__*/ jsx(UnderlineItem, {
75
83
  ref: forwardedRef,
76
84
  as: Component,
77
- href,
85
+ ...hrefProps,
78
86
  "aria-current": ariaCurrent,
79
87
  onKeyDown: keyDownHandler,
80
88
  onClick: clickHandler,
@@ -85,32 +93,32 @@ const UnderlineNavItem = /*#__PURE__*/ forwardRef((allProps, forwardedRef) => {
85
93
  tabIndex: t6,
86
94
  children
87
95
  });
88
- $[14] = Component;
89
- $[15] = ariaCurrent;
90
- $[16] = children;
91
- $[17] = clickHandler;
92
- $[18] = counter;
93
- $[19] = forwardedRef;
94
- $[20] = href;
95
- $[21] = keyDownHandler;
96
- $[22] = loadingCounters;
97
- $[23] = props;
98
- $[24] = t5;
99
- $[25] = t6;
100
- $[26] = t7;
101
- } else t7 = $[26];
96
+ $[17] = Component;
97
+ $[18] = ariaCurrent;
98
+ $[19] = children;
99
+ $[20] = clickHandler;
100
+ $[21] = counter;
101
+ $[22] = forwardedRef;
102
+ $[23] = hrefProps;
103
+ $[24] = keyDownHandler;
104
+ $[25] = loadingCounters;
105
+ $[26] = props;
106
+ $[27] = t5;
107
+ $[28] = t6;
108
+ $[29] = t7;
109
+ } else t7 = $[29];
102
110
  let t8;
103
- if ($[27] !== t4 || $[28] !== t7) {
111
+ if ($[30] !== t4 || $[31] !== t7) {
104
112
  t8 = /*#__PURE__*/ jsx("li", {
105
113
  className: UnderlineNavItem_module_css_default.UnderlineNavItem,
106
114
  ref,
107
115
  "aria-hidden": t4,
108
116
  children: t7
109
117
  });
110
- $[27] = t4;
111
- $[28] = t7;
112
- $[29] = t8;
113
- } else t8 = $[29];
118
+ $[30] = t4;
119
+ $[31] = t7;
120
+ $[32] = t8;
121
+ } else t8 = $[32];
114
122
  return t8;
115
123
  });
116
124
  UnderlineNavItem.displayName = "UnderlineNavItem";
@@ -9235,7 +9235,7 @@
9235
9235
  "name": "href",
9236
9236
  "type": "string",
9237
9237
  "defaultValue": "",
9238
- "description": "The URL that the item navigates to. `href` is passed to the underlying `<a>` element. If 'as' is specified, the component may need different props and 'href' is ignored. (Required prop for the react router is 'to' for example)"
9238
+ "description": "The URL that the item navigates to. Native anchor items default to `href=\"#\"`. When a custom component is supplied with `as`, no default `href` is added; provide the navigation props required by that component, such as `to` for React Router."
9239
9239
  },
9240
9240
  {
9241
9241
  "name": "icon",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.40.1-rc.0bcc68991",
4
+ "version": "38.40.1-rc.1028b70d8",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",