@primer/react 0.0.0-20260220174352 → 0.0.0-20260220184804

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 (36) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/Autocomplete/Autocomplete.js +76 -159
  3. package/dist/Autocomplete/AutocompleteMenu.js +128 -333
  4. package/dist/Autocomplete/AutocompleteOverlay.js +49 -130
  5. package/dist/Banner/Banner.js +64 -238
  6. package/dist/Button/Button.js +11 -34
  7. package/dist/Button/IconButton.js +51 -140
  8. package/dist/Button/LinkButton.js +11 -39
  9. package/dist/Checkbox/Checkbox.js +55 -163
  10. package/dist/Dialog/Dialog.js +105 -347
  11. package/dist/FilteredActionList/FilteredActionList.d.ts +16 -1
  12. package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
  13. package/dist/FilteredActionList/FilteredActionList.js +147 -42
  14. package/dist/Overlay/Overlay-15519c09.css +2 -0
  15. package/dist/Overlay/Overlay-15519c09.css.map +1 -0
  16. package/dist/Overlay/Overlay.module.css.js +1 -1
  17. package/dist/PageLayout/PageLayout.js +622 -1560
  18. package/dist/SelectPanel/SelectPanel.d.ts +1 -1
  19. package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
  20. package/dist/SelectPanel/SelectPanel.js +3 -1
  21. package/dist/Text/Text.d.ts +1 -1
  22. package/dist/Text/Text.d.ts.map +1 -1
  23. package/dist/Text/Text.js +10 -13
  24. package/dist/UnderlineNav/UnderlineNavItem.js +56 -149
  25. package/dist/experimental/SelectPanel2/SelectPanel.js +209 -593
  26. package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
  27. package/dist/hooks/useRefObjectAsForwardedRef.js +10 -2
  28. package/dist/hooks/useScrollFlash.d.ts.map +1 -1
  29. package/dist/hooks/useScrollFlash.js +14 -22
  30. package/dist/hooks/useSlots.d.ts +50 -6
  31. package/dist/hooks/useSlots.d.ts.map +1 -1
  32. package/dist/hooks/useSlots.js +114 -36
  33. package/generated/components.json +6 -0
  34. package/package.json +2 -2
  35. package/dist/Overlay/Overlay-43cda449.css +0 -2
  36. package/dist/Overlay/Overlay-43cda449.css.map +0 -1
@@ -64,7 +64,7 @@ type SelectPanelVariantProps = {
64
64
  onCancel: () => void;
65
65
  };
66
66
  export type SelectPanelProps = SelectPanelBaseProps & Omit<FilteredActionListProps, 'selectionVariant' | 'variant' | 'message'> & Pick<AnchoredOverlayProps, 'open' | 'height' | 'width' | 'align'> & AnchoredOverlayWrapperAnchorProps & (SelectPanelSingleSelection | SelectPanelMultiSelection) & SelectPanelVariantProps;
67
- declare function Panel({ open, onOpenChange, renderAnchor, anchorRef: externalAnchorRef, placeholder, placeholderText, inputLabel, selected, title, subtitle, onSelectedChange, filterValue: externalFilterValue, onFilterChange: externalOnFilterChange, items, footer, textInputProps, overlayProps, loading, initialLoadingType, className, height, width, id, message, notice, onCancel, variant, secondaryAction, showSelectedOptionsFirst, disableFullscreenOnNarrow, align, showSelectAll, focusPrependedElements, ...listProps }: SelectPanelProps): JSX.Element;
67
+ declare function Panel({ open, onOpenChange, renderAnchor, anchorRef: externalAnchorRef, placeholder, placeholderText, inputLabel, selected, title, subtitle, onSelectedChange, filterValue: externalFilterValue, onFilterChange: externalOnFilterChange, items, footer, textInputProps, overlayProps, loading, initialLoadingType, className, height, width, id, message, notice, onCancel, variant, secondaryAction, showSelectedOptionsFirst, disableFullscreenOnNarrow, align, showSelectAll, focusPrependedElements, virtualized, ...listProps }: SelectPanelProps): JSX.Element;
68
68
  declare const SecondaryButton: React.FC<ButtonProps>;
69
69
  declare const SecondaryLink: React.FC<LinkButtonProps & ButtonProps>;
70
70
  export declare const SelectPanel: typeof Panel & {
@@ -1 +1 @@
1
- {"version":3,"file":"SelectPanel.d.ts","sourceRoot":"","sources":["../../src/SelectPanel/SelectPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAC1F,OAAO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BAAoB,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,GACjE,iCAAiC,GACjC,CAAC,0BAA0B,GAAG,yBAAyB,CAAC,GACxD,uBAAuB,CAAA;AAgCzB,iBAAS,KAAK,CAAC,EACb,IAAI,EACJ,YAAY,EACZ,YAAkC,EAClC,SAAS,EAAE,iBAAiB,EAC5B,WAAW,EACX,eAAgC,EAChC,UAA4B,EAC5B,QAAQ,EACR,KAA0E,EAC1E,QAAQ,EACR,gBAAgB,EAChB,WAAW,EAAE,mBAAmB,EAChC,cAAc,EAAE,sBAAsB,EACtC,KAAK,EACL,MAAM,EACN,cAAc,EACd,YAAY,EACZ,OAAO,EACP,kBAA8B,EAC9B,SAAS,EACT,MAAM,EACN,KAAK,EACL,EAAE,EACF,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAoB,EACpB,eAAe,EACf,wBAA+B,EAC/B,yBAAyB,EACzB,KAAK,EACL,aAAqB,EACrB,sBAAsB,EACtB,WAAW,EACX,GAAG,SAAS,EACb,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAsvBhC;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAM1C,CAAA;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,GAAG,WAAW,CAM1D,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;CAItB,CAAA"}
@@ -108,6 +108,7 @@ function Panel({
108
108
  align,
109
109
  showSelectAll = false,
110
110
  focusPrependedElements,
111
+ virtualized,
111
112
  ...listProps
112
113
  }) {
113
114
  var _listProps$groupMetad;
@@ -681,7 +682,8 @@ function Panel({
681
682
  },
682
683
  fullScreenOnNarrow: usingFullScreenOnNarrow,
683
684
  className: clsx(className, classes.FilteredActionList),
684
- focusPrependedElements: focusPrependedElements
685
+ focusPrependedElements: focusPrependedElements,
686
+ virtualized: virtualized
685
687
  }), footer ? /*#__PURE__*/jsx("div", {
686
688
  className: classes.Footer,
687
689
  children: footer
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
  import { type PolymorphicProps } from '../utils/modern-polymorphic';
3
3
  export type TextProps<As extends React.ElementType = 'span'> = PolymorphicProps<As, 'span', {
4
4
  size?: 'large' | 'medium' | 'small';
@@ -1 +1 @@
1
- {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/Text/Text.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAA;AAG9C,OAAO,EAAkB,KAAK,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAElF,MAAM,MAAM,SAAS,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,MAAM,IAAI,gBAAgB,CAC7E,EAAE,EACF,MAAM,EACN;IACE,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAA;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CACF,CAAA;yBAGa,EAAE,SAAS,KAAK,CAAC,WAAW;WAP/B,OAAO,GAAG,QAAQ,GAAG,OAAO;aAC1B,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU;gBACvC,MAAM;;WAFX,OAAO,GAAG,QAAQ,GAAG,OAAO;aAC1B,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU;gBACvC,MAAM;;;;AAuBtB,wBAAoC"}
1
+ {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/Text/Text.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAkB,KAAK,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAElF,MAAM,MAAM,SAAS,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,MAAM,IAAI,gBAAgB,CAC7E,EAAE,EACF,MAAM,EACN;IACE,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAA;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CACF,CAAA;yBAGa,EAAE,SAAS,KAAK,CAAC,WAAW;WAP/B,OAAO,GAAG,QAAQ,GAAG,OAAO;aAC1B,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU;gBACvC,MAAM;;WAFX,OAAO,GAAG,QAAQ,GAAG,OAAO;aAC1B,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU;gBACvC,MAAM;;;;AAetB,wBAAoC"}
package/dist/Text/Text.js CHANGED
@@ -1,14 +1,12 @@
1
1
  import { c } from 'react-compiler-runtime';
2
2
  import { clsx } from 'clsx';
3
- import React from 'react';
4
3
  import classes from './Text.module.css.js';
5
4
  import { fixedForwardRef } from '../utils/modern-polymorphic.js';
6
5
  import { jsx } from 'react/jsx-runtime';
7
- import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
8
6
 
9
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
8
  function Text(props, ref) {
11
- const $ = c(14);
9
+ const $ = c(15);
12
10
  let className;
13
11
  let rest;
14
12
  let size;
@@ -36,8 +34,6 @@ function Text(props, ref) {
36
34
  weight = $[5];
37
35
  }
38
36
  const Component = t0 === undefined ? "span" : t0;
39
- const innerRef = React.useRef(null);
40
- useRefObjectAsForwardedRef(ref, innerRef);
41
37
  let t1;
42
38
  if ($[6] !== className) {
43
39
  t1 = clsx(className, classes.Text);
@@ -47,22 +43,23 @@ function Text(props, ref) {
47
43
  t1 = $[7];
48
44
  }
49
45
  let t2;
50
- if ($[8] !== Component || $[9] !== rest || $[10] !== size || $[11] !== t1 || $[12] !== weight) {
46
+ if ($[8] !== Component || $[9] !== ref || $[10] !== rest || $[11] !== size || $[12] !== t1 || $[13] !== weight) {
51
47
  t2 = /*#__PURE__*/jsx(Component, {
52
48
  className: t1,
53
49
  "data-size": size,
54
50
  "data-weight": weight,
55
51
  ...rest,
56
- ref: innerRef
52
+ ref: ref
57
53
  });
58
54
  $[8] = Component;
59
- $[9] = rest;
60
- $[10] = size;
61
- $[11] = t1;
62
- $[12] = weight;
63
- $[13] = t2;
55
+ $[9] = ref;
56
+ $[10] = rest;
57
+ $[11] = size;
58
+ $[12] = t1;
59
+ $[13] = weight;
60
+ $[14] = t2;
64
61
  } else {
65
- t2 = $[13];
62
+ t2 = $[14];
66
63
  }
67
64
  return t2;
68
65
  }
@@ -1,58 +1,21 @@
1
- import { c } from 'react-compiler-runtime';
2
- import { forwardRef, useRef, useContext } from 'react';
1
+ import React, { forwardRef, useRef, useContext } from 'react';
3
2
  import { UnderlineNavContext } from './UnderlineNavContext.js';
4
3
  import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
5
4
  import { UnderlineItem } from '../internal/components/UnderlineTabbedInterface.js';
6
5
  import classes from './UnderlineNavItem.module.css.js';
7
6
  import { jsx } from 'react/jsx-runtime';
8
7
 
9
- const UnderlineNavItem = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
10
- var _leadingVisual;
11
- const $ = c(32);
12
- let Icon;
13
- let ariaCurrent;
14
- let children;
15
- let counter;
16
- let leadingVisual;
17
- let onSelect;
18
- let props;
19
- let t1;
20
- let t2;
21
- if ($[0] !== t0) {
22
- ({
23
- as: t1,
24
- href: t2,
25
- children,
26
- counter,
27
- onSelect,
28
- "aria-current": ariaCurrent,
29
- icon: Icon,
30
- leadingVisual,
31
- ...props
32
- } = t0);
33
- $[0] = t0;
34
- $[1] = Icon;
35
- $[2] = ariaCurrent;
36
- $[3] = children;
37
- $[4] = counter;
38
- $[5] = leadingVisual;
39
- $[6] = onSelect;
40
- $[7] = props;
41
- $[8] = t1;
42
- $[9] = t2;
43
- } else {
44
- Icon = $[1];
45
- ariaCurrent = $[2];
46
- children = $[3];
47
- counter = $[4];
48
- leadingVisual = $[5];
49
- onSelect = $[6];
50
- props = $[7];
51
- t1 = $[8];
52
- t2 = $[9];
53
- }
54
- const Component = t1 === undefined ? "a" : t1;
55
- const href = t2 === undefined ? "#" : t2;
8
+ const UnderlineNavItem = /*#__PURE__*/forwardRef(({
9
+ as: Component = 'a',
10
+ href = '#',
11
+ children,
12
+ counter,
13
+ onSelect,
14
+ 'aria-current': ariaCurrent,
15
+ icon: Icon,
16
+ leadingVisual,
17
+ ...props
18
+ }, forwardedRef) => {
56
19
  const backupRef = useRef(null);
57
20
  const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
58
21
  const {
@@ -61,107 +24,51 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
61
24
  loadingCounters,
62
25
  iconsVisible
63
26
  } = useContext(UnderlineNavContext);
64
- let t3;
65
- let t4;
66
- if ($[10] !== ref || $[11] !== setChildrenWidth || $[12] !== setNoIconChildrenWidth) {
67
- t3 = () => {
68
- if (ref.current) {
69
- const domRect = ref.current.getBoundingClientRect();
70
- const icon = Array.from(ref.current.children).find(_temp);
71
- const content = Array.from(ref.current.children).find(_temp2);
72
- const text = content.textContent;
73
- const iconWidthWithMargin = icon ? icon.getBoundingClientRect().width + Number(getComputedStyle(icon).marginRight.slice(0, -2)) + Number(getComputedStyle(icon).marginLeft.slice(0, -2)) : 0;
74
- setChildrenWidth({
75
- text,
76
- width: domRect.width
77
- });
78
- setNoIconChildrenWidth({
79
- text,
80
- width: domRect.width - iconWidthWithMargin
81
- });
82
- }
83
- };
84
- t4 = [ref, setChildrenWidth, setNoIconChildrenWidth];
85
- $[10] = ref;
86
- $[11] = setChildrenWidth;
87
- $[12] = setNoIconChildrenWidth;
88
- $[13] = t3;
89
- $[14] = t4;
90
- } else {
91
- t3 = $[13];
92
- t4 = $[14];
93
- }
94
- useIsomorphicLayoutEffect(t3, t4);
95
- let t5;
96
- if ($[15] !== onSelect) {
97
- t5 = event => {
98
- if ((event.key === " " || event.key === "Enter") && !event.defaultPrevented && typeof onSelect === "function") {
99
- onSelect(event);
100
- }
101
- };
102
- $[15] = onSelect;
103
- $[16] = t5;
104
- } else {
105
- t5 = $[16];
106
- }
107
- const keyDownHandler = t5;
108
- let t6;
109
- if ($[17] !== onSelect) {
110
- t6 = event_0 => {
111
- if (!event_0.defaultPrevented && typeof onSelect === "function") {
112
- onSelect(event_0);
113
- }
114
- };
115
- $[17] = onSelect;
116
- $[18] = t6;
117
- } else {
118
- t6 = $[18];
119
- }
120
- const clickHandler = t6;
121
- const t7 = (_leadingVisual = leadingVisual) !== null && _leadingVisual !== void 0 ? _leadingVisual : Icon;
122
- let t8;
123
- if ($[19] !== Component || $[20] !== ariaCurrent || $[21] !== children || $[22] !== clickHandler || $[23] !== counter || $[24] !== href || $[25] !== iconsVisible || $[26] !== keyDownHandler || $[27] !== loadingCounters || $[28] !== props || $[29] !== ref || $[30] !== t7) {
124
- t8 = /*#__PURE__*/jsx("li", {
125
- className: classes.UnderlineNavItem,
126
- children: /*#__PURE__*/jsx(UnderlineItem, {
127
- ref: ref,
128
- as: Component,
129
- href: href,
130
- "aria-current": ariaCurrent,
131
- onKeyDown: keyDownHandler,
132
- onClick: clickHandler,
133
- counter: counter,
134
- icon: t7,
135
- loadingCounters: loadingCounters,
136
- iconsVisible: iconsVisible,
137
- ...props,
138
- children: children
139
- })
140
- });
141
- $[19] = Component;
142
- $[20] = ariaCurrent;
143
- $[21] = children;
144
- $[22] = clickHandler;
145
- $[23] = counter;
146
- $[24] = href;
147
- $[25] = iconsVisible;
148
- $[26] = keyDownHandler;
149
- $[27] = loadingCounters;
150
- $[28] = props;
151
- $[29] = ref;
152
- $[30] = t7;
153
- $[31] = t8;
154
- } else {
155
- t8 = $[31];
156
- }
157
- return t8;
27
+ useIsomorphicLayoutEffect(() => {
28
+ if (ref.current) {
29
+ const domRect = ref.current.getBoundingClientRect();
30
+ const icon = Array.from(ref.current.children).find(child => child.getAttribute('data-component') === 'icon');
31
+ const content = Array.from(ref.current.children).find(child => child.getAttribute('data-component') === 'text');
32
+ const text = content.textContent;
33
+ const iconWidthWithMargin = icon ? icon.getBoundingClientRect().width + Number(getComputedStyle(icon).marginRight.slice(0, -2)) + Number(getComputedStyle(icon).marginLeft.slice(0, -2)) : 0;
34
+ setChildrenWidth({
35
+ text,
36
+ width: domRect.width
37
+ });
38
+ setNoIconChildrenWidth({
39
+ text,
40
+ width: domRect.width - iconWidthWithMargin
41
+ });
42
+ }
43
+ }, [ref, setChildrenWidth, setNoIconChildrenWidth]);
44
+ const keyDownHandler = React.useCallback(event => {
45
+ if ((event.key === ' ' || event.key === 'Enter') && !event.defaultPrevented && typeof onSelect === 'function') {
46
+ onSelect(event);
47
+ }
48
+ }, [onSelect]);
49
+ const clickHandler = React.useCallback(event => {
50
+ if (!event.defaultPrevented && typeof onSelect === 'function') {
51
+ onSelect(event);
52
+ }
53
+ }, [onSelect]);
54
+ return /*#__PURE__*/jsx("li", {
55
+ className: classes.UnderlineNavItem,
56
+ children: /*#__PURE__*/jsx(UnderlineItem, {
57
+ ref: ref,
58
+ as: Component,
59
+ href: href,
60
+ "aria-current": ariaCurrent,
61
+ onKeyDown: keyDownHandler,
62
+ onClick: clickHandler,
63
+ counter: counter,
64
+ icon: leadingVisual !== null && leadingVisual !== void 0 ? leadingVisual : Icon,
65
+ loadingCounters: loadingCounters,
66
+ iconsVisible: iconsVisible,
67
+ ...props,
68
+ children: children
69
+ })
70
+ });
158
71
  });
159
72
  UnderlineNavItem.displayName = 'UnderlineNavItem';
160
- function _temp(child) {
161
- return child.getAttribute("data-component") === "icon";
162
- }
163
- function _temp2(child_0) {
164
- return child_0.getAttribute("data-component") === "text";
165
- }
166
73
 
167
74
  export { UnderlineNavItem };