@primer/react 38.7.0 → 38.7.1-rc.df7efa73c

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
@@ -1,5 +1,11 @@
1
1
  # @primer/react
2
2
 
3
+ ## 38.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#7364](https://github.com/primer/react/pull/7364) [`d239382`](https://github.com/primer/react/commit/d239382a6c6df8e97cabdb6f1be4009c2ea15d2c) Thanks [@francinelucca](https://github.com/francinelucca)! - fix(Autocomplete.Overlay): prevent user-defined className from overriding default styles
8
+
3
9
  ## 38.7.0
4
10
 
5
11
  ### Minor Changes
@@ -12,7 +12,7 @@ type AutocompleteOverlayInternalProps = {
12
12
  overlayProps?: Partial<OverlayProps>;
13
13
  children?: React.ReactNode;
14
14
  } & Partial<OverlayProps> & Pick<React.AriaAttributes, 'aria-labelledby'>;
15
- declare function AutocompleteOverlay({ menuAnchorRef, overlayProps: oldOverlayProps, children, ...newOverlayProps }: AutocompleteOverlayInternalProps): React.JSX.Element | null;
15
+ declare function AutocompleteOverlay({ menuAnchorRef, overlayProps: oldOverlayProps, children, className, ...newOverlayProps }: AutocompleteOverlayInternalProps): React.JSX.Element | null;
16
16
  declare namespace AutocompleteOverlay {
17
17
  var displayName: string;
18
18
  var __SLOT__: symbol;
@@ -1 +1 @@
1
- {"version":3,"file":"AutocompleteOverlay.d.ts","sourceRoot":"","sources":["../../src/Autocomplete/AutocompleteOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAOlD,KAAK,gCAAgC,GAAG;IACtC;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;IAC5C;;OAEG;I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OAAO,mBAAmB,CAAC,CAAA;AACjF,eAAe,mBAAmB,CAAA"}
@@ -4,6 +4,7 @@ import { AutocompleteContext } from './AutocompleteContext.js';
4
4
  import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
5
5
  import VisuallyHidden from '../_VisuallyHidden.js';
6
6
  import classes from './AutocompleteOverlay.module.css.js';
7
+ import { clsx } from 'clsx';
7
8
  import { jsx } from 'react/jsx-runtime';
8
9
  import { useAnchoredPosition } from '../hooks/useAnchoredPosition.js';
9
10
  import Overlay from '../Overlay/Overlay.js';
@@ -11,8 +12,9 @@ import Overlay from '../Overlay/Overlay.js';
11
12
  // TODO: consider making 'aria-labelledby' required
12
13
 
13
14
  function AutocompleteOverlay(t0) {
14
- const $ = c(24);
15
+ const $ = c(26);
15
16
  let children;
17
+ let className;
16
18
  let menuAnchorRef;
17
19
  let newOverlayProps;
18
20
  let oldOverlayProps;
@@ -21,34 +23,37 @@ function AutocompleteOverlay(t0) {
21
23
  menuAnchorRef,
22
24
  overlayProps: oldOverlayProps,
23
25
  children,
26
+ className,
24
27
  ...newOverlayProps
25
28
  } = t0);
26
29
  $[0] = t0;
27
30
  $[1] = children;
28
- $[2] = menuAnchorRef;
29
- $[3] = newOverlayProps;
30
- $[4] = oldOverlayProps;
31
+ $[2] = className;
32
+ $[3] = menuAnchorRef;
33
+ $[4] = newOverlayProps;
34
+ $[5] = oldOverlayProps;
31
35
  } else {
32
36
  children = $[1];
33
- menuAnchorRef = $[2];
34
- newOverlayProps = $[3];
35
- oldOverlayProps = $[4];
37
+ className = $[2];
38
+ menuAnchorRef = $[3];
39
+ newOverlayProps = $[4];
40
+ oldOverlayProps = $[5];
36
41
  }
37
42
  const autocompleteContext = useContext(AutocompleteContext);
38
43
  if (autocompleteContext === null) {
39
44
  throw new Error("AutocompleteContext returned null values");
40
45
  }
41
46
  let t1;
42
- if ($[5] !== newOverlayProps || $[6] !== oldOverlayProps) {
47
+ if ($[6] !== newOverlayProps || $[7] !== oldOverlayProps) {
43
48
  t1 = {
44
49
  ...oldOverlayProps,
45
50
  ...newOverlayProps
46
51
  };
47
- $[5] = newOverlayProps;
48
- $[6] = oldOverlayProps;
49
- $[7] = t1;
52
+ $[6] = newOverlayProps;
53
+ $[7] = oldOverlayProps;
54
+ $[8] = t1;
50
55
  } else {
51
- t1 = $[7];
56
+ t1 = $[8];
52
57
  }
53
58
  const overlayProps = t1;
54
59
  const {
@@ -61,25 +66,25 @@ function AutocompleteOverlay(t0) {
61
66
  const showMenu = t2 === undefined ? false : t2;
62
67
  const t3 = menuAnchorRef ? menuAnchorRef : inputRef;
63
68
  let t4;
64
- if ($[8] !== t3) {
69
+ if ($[9] !== t3) {
65
70
  t4 = {
66
71
  side: "outside-bottom",
67
72
  align: "start",
68
73
  anchorElementRef: t3
69
74
  };
70
- $[8] = t3;
71
- $[9] = t4;
75
+ $[9] = t3;
76
+ $[10] = t4;
72
77
  } else {
73
- t4 = $[9];
78
+ t4 = $[10];
74
79
  }
75
80
  let t5;
76
- if ($[10] !== selectedItemLength || $[11] !== showMenu) {
81
+ if ($[11] !== selectedItemLength || $[12] !== showMenu) {
77
82
  t5 = [showMenu, selectedItemLength];
78
- $[10] = selectedItemLength;
79
- $[11] = showMenu;
80
- $[12] = t5;
83
+ $[11] = selectedItemLength;
84
+ $[12] = showMenu;
85
+ $[13] = t5;
81
86
  } else {
82
- t5 = $[12];
87
+ t5 = $[13];
83
88
  }
84
89
  const {
85
90
  floatingElementRef,
@@ -87,21 +92,21 @@ function AutocompleteOverlay(t0) {
87
92
  } = useAnchoredPosition(t4, t5);
88
93
  useRefObjectAsForwardedRef(scrollContainerRef, floatingElementRef);
89
94
  let t6;
90
- if ($[13] !== setShowMenu) {
95
+ if ($[14] !== setShowMenu) {
91
96
  t6 = () => {
92
97
  setShowMenu(false);
93
98
  };
94
- $[13] = setShowMenu;
95
- $[14] = t6;
99
+ $[14] = setShowMenu;
100
+ $[15] = t6;
96
101
  } else {
97
- t6 = $[14];
102
+ t6 = $[15];
98
103
  }
99
104
  const closeOptionList = t6;
100
105
  if (typeof window === "undefined") {
101
106
  return null;
102
107
  }
103
108
  let t7;
104
- if ($[15] !== children || $[16] !== closeOptionList || $[17] !== floatingElementRef || $[18] !== inputRef || $[19] !== overlayProps || $[20] !== (position === null || position === void 0 ? void 0 : position.left) || $[21] !== (position === null || position === void 0 ? void 0 : position.top) || $[22] !== showMenu) {
109
+ if ($[16] !== children || $[17] !== className || $[18] !== closeOptionList || $[19] !== floatingElementRef || $[20] !== inputRef || $[21] !== overlayProps || $[22] !== (position === null || position === void 0 ? void 0 : position.left) || $[23] !== (position === null || position === void 0 ? void 0 : position.top) || $[24] !== showMenu) {
105
110
  t7 = showMenu ? /*#__PURE__*/jsx(Overlay, {
106
111
  returnFocusRef: inputRef,
107
112
  preventFocusOnOpen: true,
@@ -110,24 +115,25 @@ function AutocompleteOverlay(t0) {
110
115
  ref: floatingElementRef,
111
116
  top: position === null || position === void 0 ? void 0 : position.top,
112
117
  left: position === null || position === void 0 ? void 0 : position.left,
113
- className: classes.Overlay,
118
+ className: clsx(classes.Overlay, className),
114
119
  ...overlayProps,
115
120
  children: children
116
121
  }) : /*#__PURE__*/jsx(VisuallyHidden, {
117
122
  "aria-hidden": "true",
118
123
  children: children
119
124
  });
120
- $[15] = children;
121
- $[16] = closeOptionList;
122
- $[17] = floatingElementRef;
123
- $[18] = inputRef;
124
- $[19] = overlayProps;
125
- $[20] = position === null || position === void 0 ? void 0 : position.left;
126
- $[21] = position === null || position === void 0 ? void 0 : position.top;
127
- $[22] = showMenu;
128
- $[23] = t7;
125
+ $[16] = children;
126
+ $[17] = className;
127
+ $[18] = closeOptionList;
128
+ $[19] = floatingElementRef;
129
+ $[20] = inputRef;
130
+ $[21] = overlayProps;
131
+ $[22] = position === null || position === void 0 ? void 0 : position.left;
132
+ $[23] = position === null || position === void 0 ? void 0 : position.top;
133
+ $[24] = showMenu;
134
+ $[25] = t7;
129
135
  } else {
130
- t7 = $[23];
136
+ t7 = $[25];
131
137
  }
132
138
  return t7;
133
139
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.7.0",
4
+ "version": "38.7.1-rc.df7efa73c",
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",
@@ -114,11 +114,11 @@
114
114
  "@rollup/plugin-node-resolve": "16.0.3",
115
115
  "@rollup/plugin-typescript": "12.3.0",
116
116
  "@rollup/plugin-virtual": "3.0.2",
117
- "@storybook/addon-a11y": "^10.1.10",
118
- "@storybook/addon-docs": "^10.1.10",
119
- "@storybook/addon-links": "^10.1.10",
117
+ "@storybook/addon-a11y": "^10.1.11",
118
+ "@storybook/addon-docs": "^10.1.11",
119
+ "@storybook/addon-links": "^10.1.11",
120
120
  "@storybook/icons": "^2.0.1",
121
- "@storybook/react-vite": "^10.1.10",
121
+ "@storybook/react-vite": "^10.1.11",
122
122
  "@testing-library/dom": "^10.4.0",
123
123
  "@testing-library/jest-dom": "^6.4.5",
124
124
  "@testing-library/react": "^16.3.0",
@@ -172,7 +172,7 @@
172
172
  "rimraf": "5.0.5",
173
173
  "rollup": "4.54.0",
174
174
  "rollup-plugin-import-css": "^0.0.0",
175
- "storybook": "^10.1.10",
175
+ "storybook": "^10.1.11",
176
176
  "terser": "5.36.0",
177
177
  "ts-toolbelt": "9.6.0",
178
178
  "tsx": "4.20.3",