@primer/react 0.0.0-20260310144829 → 0.0.0-20260310151820
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 +3 -3
- package/dist/Autocomplete/AutocompleteInput.js +3 -3
- package/dist/Autocomplete/AutocompleteOverlay.js +3 -3
- package/dist/Banner/{Banner-f672cdf9.css → Banner-20e0e0eb.css} +2 -2
- package/dist/Banner/{Banner-f672cdf9.css.map → Banner-20e0e0eb.css.map} +1 -1
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +1 -0
- package/dist/Banner/Banner.module.css.js +1 -1
- package/dist/Button/ButtonBase.d.ts.map +1 -1
- package/dist/Button/ButtonBase.js +4 -3
- package/dist/Dialog/Dialog.js +3 -3
- package/dist/Heading/Heading.js +3 -3
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +4 -3
- package/dist/Overlay/Overlay.js +21 -22
- package/dist/PageLayout/PageLayout.js +5 -5
- package/dist/TextInputWithTokens/TextInputWithTokens.js +95 -96
- package/dist/deprecated/DialogV1/Dialog.js +11 -12
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useRefObjectAsForwardedRef.d.ts +0 -12
- package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
- package/dist/hooks/useRefObjectAsForwardedRef.js +0 -12
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/generated/hooks.json +0 -22
- package/package.json +1 -1
- package/dist/hooks/useCombinedRefs.d.ts +0 -51
- package/dist/hooks/useCombinedRefs.d.ts.map +0 -1
- package/dist/hooks/useCombinedRefs.js +0 -97
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260310151820
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
- [#7645](https://github.com/primer/react/pull/7645) [`bdb0e39`](https://github.com/primer/react/commit/bdb0e39d56bfb13ab3e321622402369251cc3207) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Add `useCombinedRefs` hook and deprecate `useRefObjectAsForwardedRef`
|
|
8
|
-
|
|
9
7
|
- [#7524](https://github.com/primer/react/pull/7524) [`f7bdd1c`](https://github.com/primer/react/commit/f7bdd1c04f8cbb17b6a913ba55f7d0855c8eebf1) Thanks [@francinelucca](https://github.com/francinelucca)! - chore: always render ActionMenu in viewport when inside Dialog under feature flag
|
|
10
8
|
|
|
11
9
|
- [#7594](https://github.com/primer/react/pull/7594) [`1e54bdf`](https://github.com/primer/react/commit/1e54bdf72c9466f23c567cfdc73b7b5c243782a4) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Add `align` and `style` props to Dialog component
|
|
@@ -22,6 +20,8 @@
|
|
|
22
20
|
|
|
23
21
|
- [#7624](https://github.com/primer/react/pull/7624) [`f6d4311`](https://github.com/primer/react/commit/f6d431194d217fbb7d456e58bcbbcbb434896fe1) Thanks [@llastflowers](https://github.com/llastflowers)! - Fix FormControl + SelectPanel accessible name to address SR issues
|
|
24
22
|
|
|
23
|
+
- [#7598](https://github.com/primer/react/pull/7598) [`d5cf5b0`](https://github.com/primer/react/commit/d5cf5b06d7a88d8c0a5c34367e72db44f08a868a) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(Banner): replace `:has(.BannerActions)` with `[data-has-actions]` attribute selector
|
|
24
|
+
|
|
25
25
|
- [#7617](https://github.com/primer/react/pull/7617) [`79c855a`](https://github.com/primer/react/commit/79c855abeb6f46d3fefafb236f00ea65dfcd1ed4) Thanks [@llastflowers](https://github.com/llastflowers)! - Push margin-top of TimelineBody +1px
|
|
26
26
|
|
|
27
27
|
- [#7635](https://github.com/primer/react/pull/7635) [`74762e2`](https://github.com/primer/react/commit/74762e265a44b4fa46fcb4db8fd5194cb81b14c4) Thanks [@iansan5653](https://github.com/iansan5653)! - Fix(useRefObjectAsForwardedRef): fix ref failing to update when target changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useContext, useState, useCallback, useEffect } from 'react';
|
|
2
2
|
import { AutocompleteContext, AutocompleteInputContext } from './AutocompleteContext.js';
|
|
3
|
-
import {
|
|
3
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
4
4
|
import useSafeTimeout from '../hooks/useSafeTimeout.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
import TextInput from '../TextInput/TextInput.js';
|
|
@@ -36,7 +36,7 @@ const AutocompleteInput = /*#__PURE__*/React.forwardRef(({
|
|
|
36
36
|
inputValue = '',
|
|
37
37
|
isMenuDirectlyActivated
|
|
38
38
|
} = inputContext;
|
|
39
|
-
|
|
39
|
+
useRefObjectAsForwardedRef(forwardedRef, inputRef);
|
|
40
40
|
const [highlightRemainingText, setHighlightRemainingText] = useState(true);
|
|
41
41
|
const {
|
|
42
42
|
safeSetTimeout
|
|
@@ -130,7 +130,7 @@ const AutocompleteInput = /*#__PURE__*/React.forwardRef(({
|
|
|
130
130
|
onKeyDown: handleInputKeyDown,
|
|
131
131
|
onKeyPress: onInputKeyPress,
|
|
132
132
|
onKeyUp: handleInputKeyUp,
|
|
133
|
-
ref:
|
|
133
|
+
ref: inputRef,
|
|
134
134
|
"aria-controls": `${id}-listbox`,
|
|
135
135
|
"aria-autocomplete": "both",
|
|
136
136
|
role: "combobox",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext, useRef, useEffect, useCallback } from 'react';
|
|
2
2
|
import { AutocompleteContext } from './AutocompleteContext.js';
|
|
3
|
-
import {
|
|
3
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
4
4
|
import VisuallyHidden from '../_VisuallyHidden.js';
|
|
5
5
|
import classes from './AutocompleteOverlay.module.css.js';
|
|
6
6
|
import { clsx } from 'clsx';
|
|
@@ -48,7 +48,7 @@ function AutocompleteOverlay({
|
|
|
48
48
|
align: 'start',
|
|
49
49
|
anchorElementRef: computedAnchorRef
|
|
50
50
|
}, [showMenu, selectedItemLength]);
|
|
51
|
-
|
|
51
|
+
useRefObjectAsForwardedRef(scrollContainerRef, floatingElementRef);
|
|
52
52
|
const closeOptionList = useCallback(() => {
|
|
53
53
|
setShowMenu(false);
|
|
54
54
|
}, [setShowMenu]);
|
|
@@ -60,7 +60,7 @@ function AutocompleteOverlay({
|
|
|
60
60
|
preventFocusOnOpen: true,
|
|
61
61
|
onClickOutside: closeOptionList,
|
|
62
62
|
onEscape: closeOptionList,
|
|
63
|
-
ref:
|
|
63
|
+
ref: floatingElementRef,
|
|
64
64
|
top: position === null || position === void 0 ? void 0 : position.top,
|
|
65
65
|
left: position === null || position === void 0 ? void 0 : position.left,
|
|
66
66
|
className: clsx(classes.Overlay, className),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.prc-Banner-Banner-IPLJ2{align-items:start;background-color:var(--banner-bgColor);border:var(--borderWidth-thin,.0625rem) solid var(--banner-borderColor);border-radius:var(--borderRadius-medium,.375rem);display:grid;grid-template-columns:auto minmax(0,1fr) auto;padding:var(--base-size-8,.5rem)}@supports (container-type:inline-size){.prc-Banner-Banner-IPLJ2[data-actions-layout=default]{container:banner/inline-size}}.prc-Banner-Banner-IPLJ2[data-actions-layout=stacked] .prc-Banner-BannerContainer-T-Siu{flex-direction:column}.prc-Banner-Banner-IPLJ2[data-actions-layout=stacked] .prc-Banner-BannerActions-gvCLf :where([data-primary-action=trailing]){display:none}.prc-Banner-Banner-IPLJ2[data-actions-layout=stacked] .prc-Banner-BannerActions-gvCLf :where([data-primary-action=leading]){display:flex}.prc-Banner-Banner-IPLJ2[data-actions-layout=inline] .prc-Banner-BannerContainer-T-Siu{flex-wrap:nowrap}.prc-Banner-Banner-IPLJ2[data-actions-layout=inline] .prc-Banner-BannerActions-gvCLf{flex:0 0 auto}.prc-Banner-Banner-IPLJ2[data-actions-layout=inline] .prc-Banner-BannerActions-gvCLf :where([data-primary-action=trailing]){display:flex}.prc-Banner-Banner-IPLJ2[data-actions-layout=inline] .prc-Banner-BannerActions-gvCLf :where([data-primary-action=leading]){display:none}.prc-Banner-Banner-IPLJ2[data-layout=compact]{padding:var(--base-size-4,.25rem)}.prc-Banner-Banner-IPLJ2[data-flush]{border-left:none;border-radius:0;border-right:none}.prc-Banner-Banner-IPLJ2[data-variant=critical]{--banner-bgColor:var(--bgColor-danger-muted,var(--color-danger-subtle));--banner-borderColor:var(--borderColor-danger-muted,var(--color-danger-muted));--banner-icon-fgColor:var(--fgColor-danger,var(--color-danger-fg))}.prc-Banner-Banner-IPLJ2[data-variant=info]{--banner-bgColor:var(--bgColor-accent-muted,var(--color-accent-subtle));--banner-borderColor:var(--borderColor-accent-muted,var(--color-accent-muted));--banner-icon-fgColor:var(--fgColor-accent,var(--color-accent-fg))}.prc-Banner-Banner-IPLJ2[data-variant=success]{--banner-bgColor:var(--bgColor-success-muted,var(--color-success-subtle));--banner-borderColor:var(--borderColor-success-muted,var(--color-success-muted));--banner-icon-fgColor:var(--fgColor-success,var(--color-success-fg))}.prc-Banner-Banner-IPLJ2[data-variant=upsell]{--banner-bgColor:var(--bgColor-upsell-muted,#fbefff);--banner-borderColor:var(--borderColor-upsell-muted,#c297ff66);--banner-icon-fgColor:var(--fgColor-upsell,#8250df)}.prc-Banner-Banner-IPLJ2[data-variant=warning]{--banner-bgColor:var(--bgColor-attention-muted,var(--color-attention-subtle));--banner-borderColor:var(--borderColor-attention-muted,var(--color-attention-muted));--banner-icon-fgColor:var(--fgColor-attention,var(--color-attention-fg))}.prc-Banner-BannerContainer-T-Siu{align-items:start;column-gap:var(--base-size-4,.25rem);font-size:var(--text-body-size-medium,.875rem);line-height:var(--text-body-lineHeight-medium,1.5);row-gap:var(--base-size-4,.25rem)}.prc-Banner-Banner-IPLJ2 :where(.prc-Banner-BannerContainer-T-Siu){display:flex;flex-wrap:wrap;justify-content:space-between}.prc-Banner-Banner-IPLJ2[data-dismissible]:not([data-title-hidden],[data-actions-layout=inline]) .prc-Banner-BannerContainer-T-Siu{display:grid;grid-template-columns:auto;grid-template-rows:auto}.prc-Banner-BannerContent-LraS2{display:grid;grid-column-start:1;margin-block:var(--base-size-8,.5rem);row-gap:var(--base-size-4,.25rem)}.prc-Banner-Banner-IPLJ2[data-title-hidden]:not(
|
|
2
|
-
/*# sourceMappingURL=Banner-
|
|
1
|
+
.prc-Banner-Banner-IPLJ2{align-items:start;background-color:var(--banner-bgColor);border:var(--borderWidth-thin,.0625rem) solid var(--banner-borderColor);border-radius:var(--borderRadius-medium,.375rem);display:grid;grid-template-columns:auto minmax(0,1fr) auto;padding:var(--base-size-8,.5rem)}@supports (container-type:inline-size){.prc-Banner-Banner-IPLJ2[data-actions-layout=default]{container:banner/inline-size}}.prc-Banner-Banner-IPLJ2[data-actions-layout=stacked] .prc-Banner-BannerContainer-T-Siu{flex-direction:column}.prc-Banner-Banner-IPLJ2[data-actions-layout=stacked] .prc-Banner-BannerActions-gvCLf :where([data-primary-action=trailing]){display:none}.prc-Banner-Banner-IPLJ2[data-actions-layout=stacked] .prc-Banner-BannerActions-gvCLf :where([data-primary-action=leading]){display:flex}.prc-Banner-Banner-IPLJ2[data-actions-layout=inline] .prc-Banner-BannerContainer-T-Siu{flex-wrap:nowrap}.prc-Banner-Banner-IPLJ2[data-actions-layout=inline] .prc-Banner-BannerActions-gvCLf{flex:0 0 auto}.prc-Banner-Banner-IPLJ2[data-actions-layout=inline] .prc-Banner-BannerActions-gvCLf :where([data-primary-action=trailing]){display:flex}.prc-Banner-Banner-IPLJ2[data-actions-layout=inline] .prc-Banner-BannerActions-gvCLf :where([data-primary-action=leading]){display:none}.prc-Banner-Banner-IPLJ2[data-layout=compact]{padding:var(--base-size-4,.25rem)}.prc-Banner-Banner-IPLJ2[data-flush]{border-left:none;border-radius:0;border-right:none}.prc-Banner-Banner-IPLJ2[data-variant=critical]{--banner-bgColor:var(--bgColor-danger-muted,var(--color-danger-subtle));--banner-borderColor:var(--borderColor-danger-muted,var(--color-danger-muted));--banner-icon-fgColor:var(--fgColor-danger,var(--color-danger-fg))}.prc-Banner-Banner-IPLJ2[data-variant=info]{--banner-bgColor:var(--bgColor-accent-muted,var(--color-accent-subtle));--banner-borderColor:var(--borderColor-accent-muted,var(--color-accent-muted));--banner-icon-fgColor:var(--fgColor-accent,var(--color-accent-fg))}.prc-Banner-Banner-IPLJ2[data-variant=success]{--banner-bgColor:var(--bgColor-success-muted,var(--color-success-subtle));--banner-borderColor:var(--borderColor-success-muted,var(--color-success-muted));--banner-icon-fgColor:var(--fgColor-success,var(--color-success-fg))}.prc-Banner-Banner-IPLJ2[data-variant=upsell]{--banner-bgColor:var(--bgColor-upsell-muted,#fbefff);--banner-borderColor:var(--borderColor-upsell-muted,#c297ff66);--banner-icon-fgColor:var(--fgColor-upsell,#8250df)}.prc-Banner-Banner-IPLJ2[data-variant=warning]{--banner-bgColor:var(--bgColor-attention-muted,var(--color-attention-subtle));--banner-borderColor:var(--borderColor-attention-muted,var(--color-attention-muted));--banner-icon-fgColor:var(--fgColor-attention,var(--color-attention-fg))}.prc-Banner-BannerContainer-T-Siu{align-items:start;column-gap:var(--base-size-4,.25rem);font-size:var(--text-body-size-medium,.875rem);line-height:var(--text-body-lineHeight-medium,1.5);row-gap:var(--base-size-4,.25rem)}.prc-Banner-Banner-IPLJ2 :where(.prc-Banner-BannerContainer-T-Siu){display:flex;flex-wrap:wrap;justify-content:space-between}.prc-Banner-Banner-IPLJ2[data-dismissible]:not([data-title-hidden],[data-actions-layout=inline]) .prc-Banner-BannerContainer-T-Siu{display:grid;grid-template-columns:auto;grid-template-rows:auto}.prc-Banner-BannerContent-LraS2{display:grid;grid-column-start:1;margin-block:var(--base-size-8,.5rem);row-gap:var(--base-size-4,.25rem)}.prc-Banner-Banner-IPLJ2[data-title-hidden]:not([data-has-actions]) .prc-Banner-BannerContent-LraS2{margin-block:var(--base-size-6,.375rem)}@media screen and (min-width:544px){.prc-Banner-BannerContent-LraS2{flex:1 1 0%}}.prc-Banner-BannerTitle-T4z0L{font-size:inherit;font-weight:var(--base-text-weight-semibold,600);margin:0}.prc-Banner-BannerIcon-o4ayx{display:grid;padding:var(--base-size-8,.5rem);place-items:center}.prc-Banner-BannerIcon-o4ayx svg{color:var(--banner-icon-fgColor);height:var(--base-size-20,1.25rem);fill:var(--banner-icon-fgColor)}.prc-Banner-Banner-IPLJ2[data-title-hidden]:not([data-has-actions]) .prc-Banner-BannerIcon-o4ayx svg{height:var(--base-size-16,1rem)}.prc-Banner-BannerDismiss-b12FL{display:grid;margin-inline-start:var(--base-size-4,.25rem);padding:var(--base-size-8,.5rem);place-items:center}:where(.prc-Banner-Banner-IPLJ2)[data-has-actions] .prc-Banner-BannerDismiss-b12FL{margin-block:var(--base-size-2,.125rem)}.prc-Banner-BannerDismiss-b12FL svg{color:var(--banner-icon-fgColor)}.prc-Banner-BannerActionsContainer-PdBu1{align-items:center;column-gap:var(--base-size-12,.75rem);display:flex;margin-block:var(--base-size-2,.125rem)}.prc-Banner-BannerActions-gvCLf :where([data-primary-action=trailing]){display:none}.prc-Banner-Banner-IPLJ2[data-dismissible]:not([data-title-hidden],[data-actions-layout=inline]) .prc-Banner-BannerActions-gvCLf{margin-block-end:var(--base-size-6,.375rem)}.prc-Banner-Banner-IPLJ2[data-dismissible]:not([data-title-hidden],[data-actions-layout=inline]) .prc-Banner-BannerActionsContainer-PdBu1[data-primary-action=trailing]{display:none}.prc-Banner-Banner-IPLJ2[data-dismissible]:not([data-title-hidden],[data-actions-layout=inline]) .prc-Banner-BannerActionsContainer-PdBu1[data-primary-action=leading]{display:flex}@container banner (max-width: 500px){.prc-Banner-BannerContainer-T-Siu{display:grid}:where(.prc-Banner-Banner-IPLJ2)[data-has-actions] .prc-Banner-BannerContainer-T-Siu{grid-template-rows:auto auto}.prc-Banner-BannerActions-gvCLf{margin-block-end:var(--base-size-6,.375rem)}.prc-Banner-BannerActions-gvCLf [data-primary-action=trailing]{display:none}.prc-Banner-BannerActions-gvCLf [data-primary-action=leading]{display:flex}}@container banner (min-width: 500px){.prc-Banner-BannerContainer-T-Siu{display:grid;grid-template-columns:auto auto}:where(.prc-Banner-Banner-IPLJ2):not([data-dismissible]) :where(.prc-Banner-BannerActionsContainer-PdBu1[data-primary-action=trailing]) :where([data-variant=link]:only-child){padding-inline:0 var(--base-size-12,.75rem)}.prc-Banner-BannerActions-gvCLf [data-primary-action=trailing]{display:flex;min-height:var(--base-size-32,2rem)}.prc-Banner-BannerActions-gvCLf [data-primary-action=leading]{display:none}}
|
|
2
|
+
/*# sourceMappingURL=Banner-20e0e0eb.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Banner/Banner.module.css.js"],"names":[],"mappings":"AAAA,yBASE,iBAAkB,CALlB,sCAAuC,CAEvC,uEAA+D,CAC/D,gDAAyC,CANzC,YAAa,CAOb,6CAA+C,CAN/C,gCAsFF,CA5EI,uCADF,sDAEI,4BAEJ,CADE,CAIA,wFACE,qBACF,CAEA,6HACE,YACF,CAEA,4HACE,YACF,CAIA,uFACE,gBACF,CAEA,qFACE,aACF,CAEA,4HACE,YACF,CAEA,2HACE,YACF,CAGF,8CACE,iCACF,CAEA,qCACE,gBAAiB,CAEjB,eAAgB,CADhB,iBAEF,CAEA,gDACE,uEAA6C,CAC7C,8EAAqD,CACrD,kEACF,CAEA,4CACE,uEAA6C,CAC7C,8EAAqD,CACrD,kEACF,CAEA,+CACE,yEAA8C,CAC9C,gFAAsD,CACtD,oEACF,CAEA,8CACE,oDAA6C,CAC7C,8DAAqD,CACrD,mDACF,CAEA,+CACE,6EAAgD,CAChD,oFAAwD,CACxD,wEACF,CAKF,kCAEE,iBAAkB,CAGlB,oCAA8B,CAJ9B,8CAAuC,CAEvC,kDAA+C,CAC/C,iCAEF,CAEA,mEACE,YAAa,CACb,cAAe,CACf,6BACF,CAEA,mIACE,YAAa,CACb,0BAA2B,CAC3B,uBACF,CAIA,gCACE,YAAa,CAEb,mBAAoB,CACpB,qCAAgC,CAFhC,iCAGF,CAEA,
|
|
1
|
+
{"version":3,"sources":["../src/Banner/Banner.module.css.js"],"names":[],"mappings":"AAAA,yBASE,iBAAkB,CALlB,sCAAuC,CAEvC,uEAA+D,CAC/D,gDAAyC,CANzC,YAAa,CAOb,6CAA+C,CAN/C,gCAsFF,CA5EI,uCADF,sDAEI,4BAEJ,CADE,CAIA,wFACE,qBACF,CAEA,6HACE,YACF,CAEA,4HACE,YACF,CAIA,uFACE,gBACF,CAEA,qFACE,aACF,CAEA,4HACE,YACF,CAEA,2HACE,YACF,CAGF,8CACE,iCACF,CAEA,qCACE,gBAAiB,CAEjB,eAAgB,CADhB,iBAEF,CAEA,gDACE,uEAA6C,CAC7C,8EAAqD,CACrD,kEACF,CAEA,4CACE,uEAA6C,CAC7C,8EAAqD,CACrD,kEACF,CAEA,+CACE,yEAA8C,CAC9C,gFAAsD,CACtD,oEACF,CAEA,8CACE,oDAA6C,CAC7C,8DAAqD,CACrD,mDACF,CAEA,+CACE,6EAAgD,CAChD,oFAAwD,CACxD,wEACF,CAKF,kCAEE,iBAAkB,CAGlB,oCAA8B,CAJ9B,8CAAuC,CAEvC,kDAA+C,CAC/C,iCAEF,CAEA,mEACE,YAAa,CACb,cAAe,CACf,6BACF,CAEA,mIACE,YAAa,CACb,0BAA2B,CAC3B,uBACF,CAIA,gCACE,YAAa,CAEb,mBAAoB,CACpB,qCAAgC,CAFhC,iCAGF,CAEA,oGACE,uCACF,CAEA,oCACE,gCACE,WACF,CACF,CAEA,8BAEE,iBAAkB,CAClB,gDAA6C,CAF7C,QAGF,CAIA,6BACE,YAAa,CAEb,gCAA2B,CAD3B,kBAEF,CAEA,iCAIE,gCAAiC,CAFjC,kCAA2B,CAI3B,+BACF,CAGA,qGACE,+BACF,CAIA,gCACE,YAAa,CAGb,6CAAuC,CADvC,gCAA2B,CAD3B,kBAGF,CAEA,mFACE,uCACF,CAEA,oCAEE,gCACF,CAIA,yCAGE,kBAAmB,CADnB,qCAA+B,CAD/B,YAAa,CAGb,uCACF,CAEA,uEACE,YACF,CAEA,iIACE,2CACF,CAGA,wKAEE,YACF,CAGA,uKAEE,YACF,CAIA,qCACE,kCACE,YACF,CAEA,qFACE,4BACF,CAEA,gCACE,2CACF,CAEA,+DACE,YACF,CAEA,8DACE,YACF,CACF,CAEA,qCACE,kCACE,YAAa,CACb,+BACF,CAEA,+KAGE,2CACF,CAEA,+DACE,YAAa,CACb,mCACF,CAEA,8DACE,YACF,CACF","file":"Banner-20e0e0eb.css","sourcesContent":[".Banner {\n display: grid;\n padding: var(--base-size-8);\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--banner-bgColor);\n /* stylelint-disable-next-line primer/colors */\n border: var(--borderWidth-thin) solid var(--banner-borderColor);\n border-radius: var(--borderRadius-medium);\n grid-template-columns: auto minmax(0, 1fr) auto;\n align-items: start;\n\n &[data-actions-layout='default'] {\n @supports (container-type: inline-size) {\n container: banner / inline-size;\n }\n }\n\n &[data-actions-layout='stacked'] {\n & .BannerContainer {\n flex-direction: column;\n }\n\n & .BannerActions :where([data-primary-action='trailing']) {\n display: none;\n }\n\n & .BannerActions :where([data-primary-action='leading']) {\n display: flex;\n }\n }\n\n &[data-actions-layout='inline'] {\n & .BannerContainer {\n flex-wrap: nowrap;\n }\n\n & .BannerActions {\n flex: 0 0 auto;\n }\n\n & .BannerActions :where([data-primary-action='trailing']) {\n display: flex;\n }\n\n & .BannerActions :where([data-primary-action='leading']) {\n display: none;\n }\n }\n\n &[data-layout='compact'] {\n padding: var(--base-size-4);\n }\n\n &[data-flush] {\n border-left: none;\n border-right: none;\n border-radius: 0;\n }\n\n &[data-variant='critical'] {\n --banner-bgColor: var(--bgColor-danger-muted);\n --banner-borderColor: var(--borderColor-danger-muted);\n --banner-icon-fgColor: var(--fgColor-danger);\n }\n\n &[data-variant='info'] {\n --banner-bgColor: var(--bgColor-accent-muted);\n --banner-borderColor: var(--borderColor-accent-muted);\n --banner-icon-fgColor: var(--fgColor-accent);\n }\n\n &[data-variant='success'] {\n --banner-bgColor: var(--bgColor-success-muted);\n --banner-borderColor: var(--borderColor-success-muted);\n --banner-icon-fgColor: var(--fgColor-success);\n }\n\n &[data-variant='upsell'] {\n --banner-bgColor: var(--bgColor-upsell-muted);\n --banner-borderColor: var(--borderColor-upsell-muted);\n --banner-icon-fgColor: var(--fgColor-upsell);\n }\n\n &[data-variant='warning'] {\n --banner-bgColor: var(--bgColor-attention-muted);\n --banner-borderColor: var(--borderColor-attention-muted);\n --banner-icon-fgColor: var(--fgColor-attention);\n }\n}\n\n/* BannerContainer -------------------------------------------------------- */\n\n.BannerContainer {\n font-size: var(--text-body-size-medium);\n align-items: start;\n line-height: var(--text-body-lineHeight-medium);\n row-gap: var(--base-size-4);\n column-gap: var(--base-size-4);\n}\n\n.Banner :where(.BannerContainer) {\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n}\n\n.Banner[data-dismissible]:not([data-title-hidden], [data-actions-layout='inline']) .BannerContainer {\n display: grid;\n grid-template-columns: auto;\n grid-template-rows: auto;\n}\n\n/* BannerContent ---------------------------------------------------------- */\n\n.BannerContent {\n display: grid;\n row-gap: var(--base-size-4);\n grid-column-start: 1;\n margin-block: var(--base-size-8);\n}\n\n.Banner[data-title-hidden]:not([data-has-actions]) .BannerContent {\n margin-block: var(--base-size-6);\n}\n\n@media screen and (min-width: 544px) {\n .BannerContent {\n flex: 1 1 0%;\n }\n}\n\n.BannerTitle {\n margin: 0;\n font-size: inherit;\n font-weight: var(--base-text-weight-semibold);\n}\n\n/* BannerIcon ------------------------------------------------------------- */\n\n.BannerIcon {\n display: grid;\n place-items: center;\n padding: var(--base-size-8);\n}\n\n.BannerIcon svg {\n /* 20px is the line box height of the trailing action buttons */\n height: var(--base-size-20);\n /* stylelint-disable-next-line primer/colors */\n color: var(--banner-icon-fgColor);\n /* stylelint-disable-next-line primer/colors */\n fill: var(--banner-icon-fgColor);\n}\n\n/* stylelint-disable-next-line selector-max-specificity */\n.Banner[data-title-hidden]:not([data-has-actions]) .BannerIcon svg {\n height: var(--base-size-16);\n}\n\n/* BannerDismiss ---------------------------------------------------------- */\n\n.BannerDismiss {\n display: grid;\n place-items: center;\n padding: var(--base-size-8);\n margin-inline-start: var(--base-size-4);\n}\n\n:where(.Banner)[data-has-actions] .BannerDismiss {\n margin-block: var(--base-size-2);\n}\n\n.BannerDismiss svg {\n /* stylelint-disable-next-line primer/colors */\n color: var(--banner-icon-fgColor);\n}\n\n/* BannerActions ---------------------------------------------------------- */\n\n.BannerActionsContainer {\n display: flex;\n column-gap: var(--base-size-12);\n align-items: center;\n margin-block: var(--base-size-2);\n}\n\n.BannerActions :where([data-primary-action='trailing']) {\n display: none;\n}\n\n.Banner[data-dismissible]:not([data-title-hidden], [data-actions-layout='inline']) .BannerActions {\n margin-block-end: var(--base-size-6);\n}\n\n/* stylelint-disable-next-line selector-max-specificity */\n.Banner[data-dismissible]:not([data-title-hidden], [data-actions-layout='inline'])\n .BannerActionsContainer[data-primary-action='trailing'] {\n display: none;\n}\n\n/* stylelint-disable-next-line selector-max-specificity */\n.Banner[data-dismissible]:not([data-title-hidden], [data-actions-layout='inline'])\n .BannerActionsContainer[data-primary-action='leading'] {\n display: flex;\n}\n\n/* Layout ------------------------------------------------------------------- */\n\n@container banner (max-width: 500px) {\n .BannerContainer {\n display: grid;\n }\n\n :where(.Banner)[data-has-actions] .BannerContainer {\n grid-template-rows: auto auto;\n }\n\n .BannerActions {\n margin-block-end: var(--base-size-6);\n }\n\n .BannerActions [data-primary-action='trailing'] {\n display: none;\n }\n\n .BannerActions [data-primary-action='leading'] {\n display: flex;\n }\n}\n\n@container banner (min-width: 500px) {\n .BannerContainer {\n display: grid;\n grid-template-columns: auto auto;\n }\n\n :where(.Banner):not([data-dismissible])\n :where(.BannerActionsContainer[data-primary-action='trailing'])\n :where([data-variant='link']:only-child) {\n padding-inline: 0 var(--base-size-12);\n }\n\n .BannerActions [data-primary-action='trailing'] {\n display: flex;\n min-height: var(--base-size-32, 2rem);\n }\n\n .BannerActions [data-primary-action='leading'] {\n display: none;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../src/Banner/Banner.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAElD,OAAO,EAAqB,KAAK,WAAW,EAAC,MAAM,WAAW,CAAA;AAK9D,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAE/F,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAA;AAQlF,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,wBAAwB,CAAC,SAAS,CAAC,GAAG;IACpE;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE7B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB;;;OAGG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE/B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE/B;;OAEG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAEjC;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAEvB;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,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@@ const Banner = /*#__PURE__*/React.forwardRef(function Banner({
|
|
|
71
71
|
"aria-label": labelledBy ? undefined : label,
|
|
72
72
|
className: clsx(className, classes.Banner),
|
|
73
73
|
"data-dismissible": onDismiss ? '' : undefined,
|
|
74
|
+
"data-has-actions": hasActions ? '' : undefined,
|
|
74
75
|
"data-title-hidden": hideTitle ? '' : undefined,
|
|
75
76
|
"data-variant": variant,
|
|
76
77
|
"data-actions-layout": actionsLayout,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './Banner-
|
|
1
|
+
import './Banner-20e0e0eb.css';
|
|
2
2
|
|
|
3
3
|
var classes = {"Banner":"prc-Banner-Banner-IPLJ2","BannerContainer":"prc-Banner-BannerContainer-T-Siu","BannerActions":"prc-Banner-BannerActions-gvCLf","BannerContent":"prc-Banner-BannerContent-LraS2","BannerTitle":"prc-Banner-BannerTitle-T4z0L","BannerIcon":"prc-Banner-BannerIcon-o4ayx","BannerDismiss":"prc-Banner-BannerDismiss-b12FL","BannerActionsContainer":"prc-Banner-BannerActionsContainer-PdBu1"};
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../src/Button/ButtonBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAC/F,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AA2BxC,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../src/Button/ButtonBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAC/F,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AA2BxC,QAAA,MAAM,UAAU,EA2JV,8BAA8B,CAAC,QAAQ,GAAG,GAAG,EAAE,WAAW,CAAC,CAAA;AAEjE,OAAO,EAAC,UAAU,EAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
3
3
|
import { ConditionalWrapper } from '../internal/components/ConditionalWrapper.js';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import classes from './ButtonBase.module.css.js';
|
|
@@ -46,7 +46,7 @@ const ButtonBase = /*#__PURE__*/forwardRef(({
|
|
|
46
46
|
...rest
|
|
47
47
|
} = props;
|
|
48
48
|
const innerRef = React.useRef(null);
|
|
49
|
-
|
|
49
|
+
useRefObjectAsForwardedRef(forwardedRef, innerRef);
|
|
50
50
|
const uuid = useId(id);
|
|
51
51
|
const loadingAnnouncementID = `${uuid}-loading-announcement`;
|
|
52
52
|
|
|
@@ -74,7 +74,8 @@ const ButtonBase = /*#__PURE__*/forwardRef(({
|
|
|
74
74
|
children: [/*#__PURE__*/jsx(Component, {
|
|
75
75
|
"aria-disabled": loading ? true : undefined,
|
|
76
76
|
...rest,
|
|
77
|
-
|
|
77
|
+
// @ts-ignore temporary disable as we migrate to css modules, until we remove PolymorphicForwardRefComponent
|
|
78
|
+
ref: innerRef,
|
|
78
79
|
className: clsx(classes.ButtonBase, className),
|
|
79
80
|
"data-block": block ? 'block' : null,
|
|
80
81
|
"data-inactive": inactive ? true : undefined,
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -6,7 +6,7 @@ import { XIcon } from '@primer/octicons-react';
|
|
|
6
6
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
7
7
|
import { FocusKeys } from '@primer/behaviors';
|
|
8
8
|
import { Portal } from '../Portal/Portal.js';
|
|
9
|
-
import {
|
|
9
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
10
10
|
import { useId } from '../hooks/useId.js';
|
|
11
11
|
import classes from './Dialog.module.css.js';
|
|
12
12
|
import { clsx } from 'clsx';
|
|
@@ -126,7 +126,7 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
126
126
|
footer: Dialog.Footer
|
|
127
127
|
});
|
|
128
128
|
const dialogRef = useRef(null);
|
|
129
|
-
|
|
129
|
+
useRefObjectAsForwardedRef(forwardedRef, dialogRef);
|
|
130
130
|
const backdropRef = useRef(null);
|
|
131
131
|
useFocusTrap({
|
|
132
132
|
containerRef: dialogRef,
|
|
@@ -189,7 +189,7 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
189
189
|
setLastMouseDownIsBackdrop(e.target === e.currentTarget);
|
|
190
190
|
},
|
|
191
191
|
children: /*#__PURE__*/jsxs("div", {
|
|
192
|
-
ref:
|
|
192
|
+
ref: dialogRef,
|
|
193
193
|
role: role,
|
|
194
194
|
"aria-labelledby": dialogLabelId,
|
|
195
195
|
"aria-describedby": dialogDescriptionId,
|
package/dist/Heading/Heading.js
CHANGED
|
@@ -2,7 +2,7 @@ import { clsx } from 'clsx';
|
|
|
2
2
|
import React, { forwardRef, useEffect } from 'react';
|
|
3
3
|
import classes from './Heading.module.css.js';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
|
-
import {
|
|
5
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
6
6
|
|
|
7
7
|
const Heading = /*#__PURE__*/forwardRef(({
|
|
8
8
|
as: Component = 'h2',
|
|
@@ -11,7 +11,7 @@ const Heading = /*#__PURE__*/forwardRef(({
|
|
|
11
11
|
...props
|
|
12
12
|
}, forwardedRef) => {
|
|
13
13
|
const innerRef = React.useRef(null);
|
|
14
|
-
|
|
14
|
+
useRefObjectAsForwardedRef(forwardedRef, innerRef);
|
|
15
15
|
if (process.env.NODE_ENV !== "production") {
|
|
16
16
|
/**
|
|
17
17
|
* The Linter yells because it thinks this conditionally calls an effect,
|
|
@@ -31,7 +31,7 @@ const Heading = /*#__PURE__*/forwardRef(({
|
|
|
31
31
|
className: clsx(className, classes.Heading),
|
|
32
32
|
"data-variant": variant,
|
|
33
33
|
...props,
|
|
34
|
-
ref:
|
|
34
|
+
ref: innerRef
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
Heading.displayName = 'Heading';
|
package/dist/Link/Link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/Link/Link.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAY,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAA;AAG1E,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAC,KAAK,gBAAgB,EAAkB,MAAM,6BAA6B,CAAA;AAElF,KAAK,eAAe,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,IAAI;IACzD,EAAE,CAAC,EAAE,EAAE,CAAA;IACP,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,EAC9D,OAAO,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE,eAAe,CAAC,EACjD,KAAK,YAAY,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/Link/Link.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAY,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAA;AAG1E,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAC,KAAK,gBAAgB,EAAkB,MAAM,6BAA6B,CAAA;AAElF,KAAK,eAAe,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,IAAI;IACzD,EAAE,CAAC,EAAE,EAAE,CAAA;IACP,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,EAC9D,OAAO,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE,eAAe,CAAC,EACjD,KAAK,YAAY,CAAC,OAAO,CAAC,sBAyC3B,CAAA;AAID,QAAA,MAAM,IAAI,IA/CoB,EAAE,SAAS,KAAK,CAAC,WAAW;;;;CA+CM,CAAA;AAEhE,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,IAAI,CAAC,CAAA;AACnD,eAAe,IAAI,CAAA"}
|
package/dist/Link/Link.js
CHANGED
|
@@ -3,7 +3,7 @@ import React, { useEffect } from 'react';
|
|
|
3
3
|
import classes from './Link.module.css.js';
|
|
4
4
|
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
import {
|
|
6
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
7
7
|
|
|
8
8
|
const UnwrappedLink = (props, ref) => {
|
|
9
9
|
const {
|
|
@@ -14,7 +14,7 @@ const UnwrappedLink = (props, ref) => {
|
|
|
14
14
|
...restProps
|
|
15
15
|
} = props;
|
|
16
16
|
const innerRef = React.useRef(null);
|
|
17
|
-
|
|
17
|
+
useRefObjectAsForwardedRef(ref, innerRef);
|
|
18
18
|
if (process.env.NODE_ENV !== "production") {
|
|
19
19
|
/**
|
|
20
20
|
* The Linter yells because it thinks this conditionally calls an effect,
|
|
@@ -36,7 +36,8 @@ const UnwrappedLink = (props, ref) => {
|
|
|
36
36
|
"data-inline": inline,
|
|
37
37
|
"data-hover-color": hoverColor,
|
|
38
38
|
...restProps,
|
|
39
|
-
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
ref: innerRef
|
|
40
41
|
});
|
|
41
42
|
};
|
|
42
43
|
UnwrappedLink.displayName = "UnwrappedLink";
|
package/dist/Overlay/Overlay.js
CHANGED
|
@@ -2,7 +2,7 @@ import { c } from 'react-compiler-runtime';
|
|
|
2
2
|
import React, { useRef, useEffect } from 'react';
|
|
3
3
|
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
4
4
|
import { Portal } from '../Portal/Portal.js';
|
|
5
|
-
import {
|
|
5
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
6
6
|
import classes from './Overlay.module.css.js';
|
|
7
7
|
import { clsx } from 'clsx';
|
|
8
8
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -115,7 +115,7 @@ const BaseOverlay = /*#__PURE__*/React.forwardRef(({
|
|
|
115
115
|
|
|
116
116
|
*/
|
|
117
117
|
const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
118
|
-
const $ = c(
|
|
118
|
+
const $ = c(45);
|
|
119
119
|
let anchorSide;
|
|
120
120
|
let ignoreClickRefs;
|
|
121
121
|
let initialFocusRef;
|
|
@@ -196,7 +196,7 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
196
196
|
const visibility = t4 === undefined ? "visible" : t4;
|
|
197
197
|
const width = t5 === undefined ? "auto" : t5;
|
|
198
198
|
const overlayRef = useRef(null);
|
|
199
|
-
|
|
199
|
+
useRefObjectAsForwardedRef(forwardedRef, overlayRef);
|
|
200
200
|
let t6;
|
|
201
201
|
if ($[18] !== ignoreClickRefs || $[19] !== initialFocusRef || $[20] !== onClickOutside || $[21] !== onEscape || $[22] !== preventFocusOnOpen || $[23] !== returnFocusRef) {
|
|
202
202
|
t6 = {
|
|
@@ -269,12 +269,12 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
269
269
|
const leftPosition = left === undefined && right === undefined ? 0 : left;
|
|
270
270
|
const t11 = !preventOverflow ? true : undefined;
|
|
271
271
|
let t12;
|
|
272
|
-
if ($[32] !==
|
|
272
|
+
if ($[32] !== height || $[33] !== leftPosition || $[34] !== props || $[35] !== responsiveVariant || $[36] !== right || $[37] !== role || $[38] !== t11 || $[39] !== visibility || $[40] !== width) {
|
|
273
273
|
t12 = /*#__PURE__*/jsx(BaseOverlay, {
|
|
274
274
|
role: role,
|
|
275
275
|
width: width,
|
|
276
276
|
"data-reflow-container": t11,
|
|
277
|
-
ref:
|
|
277
|
+
ref: overlayRef,
|
|
278
278
|
left: leftPosition,
|
|
279
279
|
right: right,
|
|
280
280
|
height: height,
|
|
@@ -282,31 +282,30 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
282
282
|
"data-responsive": responsiveVariant,
|
|
283
283
|
...props
|
|
284
284
|
});
|
|
285
|
-
$[32] =
|
|
286
|
-
$[33] =
|
|
287
|
-
$[34] =
|
|
288
|
-
$[35] =
|
|
289
|
-
$[36] =
|
|
290
|
-
$[37] =
|
|
291
|
-
$[38] =
|
|
292
|
-
$[39] =
|
|
293
|
-
$[40] =
|
|
294
|
-
$[41] =
|
|
295
|
-
$[42] = t12;
|
|
285
|
+
$[32] = height;
|
|
286
|
+
$[33] = leftPosition;
|
|
287
|
+
$[34] = props;
|
|
288
|
+
$[35] = responsiveVariant;
|
|
289
|
+
$[36] = right;
|
|
290
|
+
$[37] = role;
|
|
291
|
+
$[38] = t11;
|
|
292
|
+
$[39] = visibility;
|
|
293
|
+
$[40] = width;
|
|
294
|
+
$[41] = t12;
|
|
296
295
|
} else {
|
|
297
|
-
t12 = $[
|
|
296
|
+
t12 = $[41];
|
|
298
297
|
}
|
|
299
298
|
let t13;
|
|
300
|
-
if ($[
|
|
299
|
+
if ($[42] !== portalContainerName || $[43] !== t12) {
|
|
301
300
|
t13 = /*#__PURE__*/jsx(Portal, {
|
|
302
301
|
containerName: portalContainerName,
|
|
303
302
|
children: t12
|
|
304
303
|
});
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
304
|
+
$[42] = portalContainerName;
|
|
305
|
+
$[43] = t12;
|
|
306
|
+
$[44] = t13;
|
|
308
307
|
} else {
|
|
309
|
-
t13 = $[
|
|
308
|
+
t13 = $[44];
|
|
310
309
|
}
|
|
311
310
|
return t13;
|
|
312
311
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useRef, memo } from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { useId } from '../hooks/useId.js';
|
|
4
|
-
import {
|
|
4
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
5
5
|
import { isResponsiveValue } from '../hooks/useResponsiveValue.js';
|
|
6
6
|
import { useSlots } from '../hooks/useSlots.js';
|
|
7
7
|
import { useOverflow } from '../hooks/useOverflow.js';
|
|
@@ -569,7 +569,7 @@ const Pane = /*#__PURE__*/React.forwardRef(({
|
|
|
569
569
|
onResizeEnd,
|
|
570
570
|
currentWidth: controlledWidth
|
|
571
571
|
});
|
|
572
|
-
|
|
572
|
+
useRefObjectAsForwardedRef(forwardRef, paneRef);
|
|
573
573
|
const hasOverflow = useOverflow(paneRef);
|
|
574
574
|
const paneId = useId(id);
|
|
575
575
|
const labelProp = {};
|
|
@@ -603,7 +603,7 @@ const Pane = /*#__PURE__*/React.forwardRef(({
|
|
|
603
603
|
},
|
|
604
604
|
position: positionProp
|
|
605
605
|
}), /*#__PURE__*/jsx("div", {
|
|
606
|
-
ref:
|
|
606
|
+
ref: paneRef
|
|
607
607
|
// Suppress hydration mismatch for --pane-width when localStorage
|
|
608
608
|
// provides a width that differs from the server-rendered default.
|
|
609
609
|
// Not needed when onResizeEnd is provided (localStorage isn't read).
|
|
@@ -773,7 +773,7 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
|
|
|
773
773
|
contentWrapperRef: sidebarContentWrapperRef,
|
|
774
774
|
constrainToViewport: true
|
|
775
775
|
});
|
|
776
|
-
|
|
776
|
+
useRefObjectAsForwardedRef(forwardRef, sidebarRef);
|
|
777
777
|
const hasOverflow = useOverflow(sidebarRef);
|
|
778
778
|
const sidebarId = useId(id);
|
|
779
779
|
const labelProp = {};
|
|
@@ -812,7 +812,7 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
|
|
|
812
812
|
getDefaultWidth: getDefaultWidth,
|
|
813
813
|
saveWidth: saveWidth
|
|
814
814
|
}), /*#__PURE__*/jsx("div", {
|
|
815
|
-
ref:
|
|
815
|
+
ref: sidebarRef
|
|
816
816
|
// Suppress hydration mismatch for --pane-width when localStorage
|
|
817
817
|
// provides a width that differs from the server-rendered default.
|
|
818
818
|
,
|
|
@@ -3,7 +3,7 @@ import { FocusKeys } from '@primer/behaviors';
|
|
|
3
3
|
import { isFocusable } from '@primer/behaviors/utils';
|
|
4
4
|
import React, { useRef, useState } from 'react';
|
|
5
5
|
import { isValidElementType } from 'react-is';
|
|
6
|
-
import {
|
|
6
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
7
7
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
8
8
|
import { useId } from '../hooks/useId.js';
|
|
9
9
|
import Token from '../Token/Token.js';
|
|
@@ -25,7 +25,7 @@ const overflowCountClassMap = {
|
|
|
25
25
|
|
|
26
26
|
// using forwardRef is important so that other components (ex. Autocomplete) can use the ref
|
|
27
27
|
function TextInputWithTokensInnerComponent(t0, forwardedRef) {
|
|
28
|
-
const $ = c(
|
|
28
|
+
const $ = c(151);
|
|
29
29
|
let IconComponent;
|
|
30
30
|
let LeadingVisual;
|
|
31
31
|
let TrailingVisual;
|
|
@@ -165,7 +165,7 @@ function TextInputWithTokensInnerComponent(t0, forwardedRef) {
|
|
|
165
165
|
}
|
|
166
166
|
const ref = useRef(null);
|
|
167
167
|
const selectedValuesDescriptionId = useId();
|
|
168
|
-
|
|
168
|
+
useRefObjectAsForwardedRef(forwardedRef, ref);
|
|
169
169
|
const [selectedTokenIndex, setSelectedTokenIndex] = useState();
|
|
170
170
|
const [tokensAreTruncated, setTokensAreTruncated] = useState(Boolean(visibleTokenCount));
|
|
171
171
|
let t6;
|
|
@@ -455,9 +455,9 @@ function TextInputWithTokensInnerComponent(t0, forwardedRef) {
|
|
|
455
455
|
const t32 = validationStatus === "error" ? "true" : "false";
|
|
456
456
|
const t33 = ariaDescribedBy || undefined;
|
|
457
457
|
let t34;
|
|
458
|
-
if ($[80] !==
|
|
458
|
+
if ($[80] !== disabled || $[81] !== handleInputBlur || $[82] !== handleInputFocus || $[83] !== handleInputKeyDown || $[84] !== inputPropsRest || $[85] !== role || $[86] !== t32 || $[87] !== t33) {
|
|
459
459
|
t34 = /*#__PURE__*/jsx(UnstyledTextInput, {
|
|
460
|
-
ref:
|
|
460
|
+
ref: ref,
|
|
461
461
|
disabled: disabled,
|
|
462
462
|
onFocus: handleInputFocus,
|
|
463
463
|
onBlur: handleInputBlur,
|
|
@@ -469,48 +469,47 @@ function TextInputWithTokensInnerComponent(t0, forwardedRef) {
|
|
|
469
469
|
"aria-describedby": t33,
|
|
470
470
|
...inputPropsRest
|
|
471
471
|
});
|
|
472
|
-
$[80] =
|
|
473
|
-
$[81] =
|
|
474
|
-
$[82] =
|
|
475
|
-
$[83] =
|
|
476
|
-
$[84] =
|
|
477
|
-
$[85] =
|
|
478
|
-
$[86] =
|
|
479
|
-
$[87] =
|
|
480
|
-
$[88] =
|
|
481
|
-
$[89] = t34;
|
|
472
|
+
$[80] = disabled;
|
|
473
|
+
$[81] = handleInputBlur;
|
|
474
|
+
$[82] = handleInputFocus;
|
|
475
|
+
$[83] = handleInputKeyDown;
|
|
476
|
+
$[84] = inputPropsRest;
|
|
477
|
+
$[85] = role;
|
|
478
|
+
$[86] = t32;
|
|
479
|
+
$[87] = t33;
|
|
480
|
+
$[88] = t34;
|
|
482
481
|
} else {
|
|
483
|
-
t34 = $[
|
|
482
|
+
t34 = $[88];
|
|
484
483
|
}
|
|
485
484
|
let t35;
|
|
486
|
-
if ($[
|
|
485
|
+
if ($[89] !== selectedValuesDescription || $[90] !== selectedValuesDescriptionId || $[91] !== shouldExposeSelectedValuesDescription) {
|
|
487
486
|
t35 = shouldExposeSelectedValuesDescription ? /*#__PURE__*/jsx(VisuallyHidden, {
|
|
488
487
|
id: selectedValuesDescriptionId,
|
|
489
488
|
children: selectedValuesDescription
|
|
490
489
|
}) : null;
|
|
491
|
-
$[
|
|
492
|
-
$[
|
|
493
|
-
$[
|
|
494
|
-
$[
|
|
490
|
+
$[89] = selectedValuesDescription;
|
|
491
|
+
$[90] = selectedValuesDescriptionId;
|
|
492
|
+
$[91] = shouldExposeSelectedValuesDescription;
|
|
493
|
+
$[92] = t35;
|
|
495
494
|
} else {
|
|
496
|
-
t35 = $[
|
|
495
|
+
t35 = $[92];
|
|
497
496
|
}
|
|
498
497
|
let t36;
|
|
499
|
-
if ($[
|
|
498
|
+
if ($[93] !== t34 || $[94] !== t35) {
|
|
500
499
|
t36 = /*#__PURE__*/jsxs("div", {
|
|
501
500
|
className: styles.InputWrapper,
|
|
502
501
|
children: [t34, t35]
|
|
503
502
|
});
|
|
504
|
-
$[
|
|
505
|
-
$[
|
|
506
|
-
$[
|
|
503
|
+
$[93] = t34;
|
|
504
|
+
$[94] = t35;
|
|
505
|
+
$[95] = t36;
|
|
507
506
|
} else {
|
|
508
|
-
t36 = $[
|
|
507
|
+
t36 = $[95];
|
|
509
508
|
}
|
|
510
509
|
let t37;
|
|
511
|
-
if ($[
|
|
510
|
+
if ($[96] !== TokenComponent || $[97] !== disabled || $[98] !== handleTokenBlur || $[99] !== handleTokenFocus || $[100] !== handleTokenRemove || $[101] !== hideTokenRemoveButtons || $[102] !== selectedTokenIndex || $[103] !== size || $[104] !== visibleTokens) {
|
|
512
511
|
let t38;
|
|
513
|
-
if ($[
|
|
512
|
+
if ($[106] !== TokenComponent || $[107] !== disabled || $[108] !== handleTokenBlur || $[109] !== handleTokenFocus || $[110] !== handleTokenRemove || $[111] !== hideTokenRemoveButtons || $[112] !== selectedTokenIndex || $[113] !== size) {
|
|
514
513
|
t38 = (t39, i) => {
|
|
515
514
|
const {
|
|
516
515
|
id,
|
|
@@ -532,89 +531,89 @@ function TextInputWithTokensInnerComponent(t0, forwardedRef) {
|
|
|
532
531
|
...tokenRest
|
|
533
532
|
}, id);
|
|
534
533
|
};
|
|
535
|
-
$[
|
|
536
|
-
$[
|
|
537
|
-
$[
|
|
538
|
-
$[
|
|
539
|
-
$[
|
|
540
|
-
$[
|
|
541
|
-
$[
|
|
542
|
-
$[
|
|
543
|
-
$[
|
|
534
|
+
$[106] = TokenComponent;
|
|
535
|
+
$[107] = disabled;
|
|
536
|
+
$[108] = handleTokenBlur;
|
|
537
|
+
$[109] = handleTokenFocus;
|
|
538
|
+
$[110] = handleTokenRemove;
|
|
539
|
+
$[111] = hideTokenRemoveButtons;
|
|
540
|
+
$[112] = selectedTokenIndex;
|
|
541
|
+
$[113] = size;
|
|
542
|
+
$[114] = t38;
|
|
544
543
|
} else {
|
|
545
|
-
t38 = $[
|
|
544
|
+
t38 = $[114];
|
|
546
545
|
}
|
|
547
546
|
t37 = visibleTokens.map(t38);
|
|
548
|
-
$[
|
|
549
|
-
$[
|
|
550
|
-
$[
|
|
551
|
-
$[
|
|
552
|
-
$[
|
|
553
|
-
$[
|
|
554
|
-
$[
|
|
555
|
-
$[
|
|
556
|
-
$[
|
|
557
|
-
$[
|
|
547
|
+
$[96] = TokenComponent;
|
|
548
|
+
$[97] = disabled;
|
|
549
|
+
$[98] = handleTokenBlur;
|
|
550
|
+
$[99] = handleTokenFocus;
|
|
551
|
+
$[100] = handleTokenRemove;
|
|
552
|
+
$[101] = hideTokenRemoveButtons;
|
|
553
|
+
$[102] = selectedTokenIndex;
|
|
554
|
+
$[103] = size;
|
|
555
|
+
$[104] = visibleTokens;
|
|
556
|
+
$[105] = t37;
|
|
558
557
|
} else {
|
|
559
|
-
t37 = $[
|
|
558
|
+
t37 = $[105];
|
|
560
559
|
}
|
|
561
560
|
let t38;
|
|
562
|
-
if ($[
|
|
561
|
+
if ($[115] !== size || $[116] !== tokens.length || $[117] !== tokensAreTruncated || $[118] !== visibleTokens.length) {
|
|
563
562
|
t38 = tokensAreTruncated && tokens.length - visibleTokens.length ? /*#__PURE__*/jsxs(Text, {
|
|
564
563
|
className: overflowCountClassMap[size],
|
|
565
564
|
children: ["+", tokens.length - visibleTokens.length]
|
|
566
565
|
}) : null;
|
|
567
|
-
$[
|
|
568
|
-
$[
|
|
569
|
-
$[
|
|
570
|
-
$[
|
|
571
|
-
$[
|
|
566
|
+
$[115] = size;
|
|
567
|
+
$[116] = tokens.length;
|
|
568
|
+
$[117] = tokensAreTruncated;
|
|
569
|
+
$[118] = visibleTokens.length;
|
|
570
|
+
$[119] = t38;
|
|
572
571
|
} else {
|
|
573
|
-
t38 = $[
|
|
572
|
+
t38 = $[119];
|
|
574
573
|
}
|
|
575
574
|
let t39;
|
|
576
|
-
if ($[
|
|
575
|
+
if ($[120] !== preventTokenWrapping || $[121] !== t31 || $[122] !== t36 || $[123] !== t37 || $[124] !== t38) {
|
|
577
576
|
t39 = /*#__PURE__*/jsxs("div", {
|
|
578
577
|
ref: t31,
|
|
579
578
|
className: styles.Container,
|
|
580
579
|
"data-prevent-token-wrapping": preventTokenWrapping,
|
|
581
580
|
children: [t36, t37, t38]
|
|
582
581
|
});
|
|
583
|
-
$[
|
|
584
|
-
$[
|
|
585
|
-
$[
|
|
586
|
-
$[
|
|
587
|
-
$[
|
|
588
|
-
$[
|
|
582
|
+
$[120] = preventTokenWrapping;
|
|
583
|
+
$[121] = t31;
|
|
584
|
+
$[122] = t36;
|
|
585
|
+
$[123] = t37;
|
|
586
|
+
$[124] = t38;
|
|
587
|
+
$[125] = t39;
|
|
589
588
|
} else {
|
|
590
|
-
t39 = $[
|
|
589
|
+
t39 = $[125];
|
|
591
590
|
}
|
|
592
591
|
const t40 = typeof loading === "boolean";
|
|
593
592
|
let t41;
|
|
594
|
-
if ($[
|
|
593
|
+
if ($[126] !== TrailingVisual) {
|
|
595
594
|
t41 = typeof TrailingVisual !== "string" && isValidElementType(TrailingVisual) ? /*#__PURE__*/jsx(TrailingVisual, {}) : TrailingVisual;
|
|
596
|
-
$[
|
|
597
|
-
$[
|
|
595
|
+
$[126] = TrailingVisual;
|
|
596
|
+
$[127] = t41;
|
|
598
597
|
} else {
|
|
599
|
-
t41 = $[
|
|
598
|
+
t41 = $[127];
|
|
600
599
|
}
|
|
601
600
|
let t42;
|
|
602
|
-
if ($[
|
|
601
|
+
if ($[128] !== showTrailingLoadingIndicator || $[129] !== t40 || $[130] !== t41) {
|
|
603
602
|
t42 = /*#__PURE__*/jsx(TextInputInnerVisualSlot, {
|
|
604
603
|
hasLoadingIndicator: t40,
|
|
605
604
|
visualPosition: "trailing",
|
|
606
605
|
showLoadingIndicator: showTrailingLoadingIndicator,
|
|
607
606
|
children: t41
|
|
608
607
|
});
|
|
609
|
-
$[
|
|
610
|
-
$[
|
|
611
|
-
$[
|
|
612
|
-
$[
|
|
608
|
+
$[128] = showTrailingLoadingIndicator;
|
|
609
|
+
$[129] = t40;
|
|
610
|
+
$[130] = t41;
|
|
611
|
+
$[131] = t42;
|
|
613
612
|
} else {
|
|
614
|
-
t42 = $[
|
|
613
|
+
t42 = $[131];
|
|
615
614
|
}
|
|
616
615
|
let t43;
|
|
617
|
-
if ($[
|
|
616
|
+
if ($[132] !== block || $[133] !== contrast || $[134] !== disabled || $[135] !== maxWidthProp || $[136] !== minWidthProp || $[137] !== t21 || $[138] !== t22 || $[139] !== t23 || $[140] !== t24 || $[141] !== t25 || $[142] !== t26 || $[143] !== t27 || $[144] !== t30 || $[145] !== t39 || $[146] !== t42 || $[147] !== validationStatus || $[148] !== variantProp || $[149] !== widthProp) {
|
|
618
617
|
t43 = /*#__PURE__*/jsxs(TextInputWrapper, {
|
|
619
618
|
block: block,
|
|
620
619
|
contrast: contrast,
|
|
@@ -633,27 +632,27 @@ function TextInputWithTokensInnerComponent(t0, forwardedRef) {
|
|
|
633
632
|
style: t26,
|
|
634
633
|
children: [t27, t30, t39, t42]
|
|
635
634
|
});
|
|
636
|
-
$[
|
|
637
|
-
$[
|
|
638
|
-
$[
|
|
639
|
-
$[
|
|
640
|
-
$[
|
|
641
|
-
$[
|
|
642
|
-
$[
|
|
643
|
-
$[
|
|
644
|
-
$[
|
|
645
|
-
$[
|
|
646
|
-
$[
|
|
647
|
-
$[
|
|
648
|
-
$[
|
|
649
|
-
$[
|
|
650
|
-
$[
|
|
651
|
-
$[
|
|
652
|
-
$[
|
|
653
|
-
$[
|
|
654
|
-
$[
|
|
635
|
+
$[132] = block;
|
|
636
|
+
$[133] = contrast;
|
|
637
|
+
$[134] = disabled;
|
|
638
|
+
$[135] = maxWidthProp;
|
|
639
|
+
$[136] = minWidthProp;
|
|
640
|
+
$[137] = t21;
|
|
641
|
+
$[138] = t22;
|
|
642
|
+
$[139] = t23;
|
|
643
|
+
$[140] = t24;
|
|
644
|
+
$[141] = t25;
|
|
645
|
+
$[142] = t26;
|
|
646
|
+
$[143] = t27;
|
|
647
|
+
$[144] = t30;
|
|
648
|
+
$[145] = t39;
|
|
649
|
+
$[146] = t42;
|
|
650
|
+
$[147] = validationStatus;
|
|
651
|
+
$[148] = variantProp;
|
|
652
|
+
$[149] = widthProp;
|
|
653
|
+
$[150] = t43;
|
|
655
654
|
} else {
|
|
656
|
-
t43 = $[
|
|
655
|
+
t43 = $[150];
|
|
657
656
|
}
|
|
658
657
|
return t43;
|
|
659
658
|
}
|
|
@@ -2,7 +2,7 @@ import { c } from 'react-compiler-runtime';
|
|
|
2
2
|
import React, { forwardRef, useRef } from 'react';
|
|
3
3
|
import { IconButton } from '../../Button/IconButton.js';
|
|
4
4
|
import useDialog from '../../hooks/useDialog.js';
|
|
5
|
-
import {
|
|
5
|
+
import { useRefObjectAsForwardedRef } from '../../hooks/useRefObjectAsForwardedRef.js';
|
|
6
6
|
import { XIcon } from '@primer/octicons-react';
|
|
7
7
|
import { clsx } from 'clsx';
|
|
8
8
|
import classes from './Dialog.module.css.js';
|
|
@@ -78,7 +78,7 @@ function _temp(ch) {
|
|
|
78
78
|
return typeof ch === "string";
|
|
79
79
|
}
|
|
80
80
|
const Dialog = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
81
|
-
const $ = c(
|
|
81
|
+
const $ = c(25);
|
|
82
82
|
let children;
|
|
83
83
|
let className;
|
|
84
84
|
let initialFocusRef;
|
|
@@ -121,7 +121,7 @@ const Dialog = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
121
121
|
const Component = t2 === undefined ? "div" : t2;
|
|
122
122
|
const overlayRef = useRef(null);
|
|
123
123
|
const modalRef = useRef(null);
|
|
124
|
-
|
|
124
|
+
useRefObjectAsForwardedRef(forwardedRef, modalRef);
|
|
125
125
|
const closeButtonRef = useRef(null);
|
|
126
126
|
let t3;
|
|
127
127
|
if ($[9] !== onDismiss || $[10] !== returnFocusRef) {
|
|
@@ -161,14 +161,14 @@ const Dialog = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
161
161
|
getDialogProps
|
|
162
162
|
} = useDialog(t4);
|
|
163
163
|
let t5;
|
|
164
|
-
if ($[17] !== Component || $[18] !== children || $[19] !== className || $[20] !==
|
|
164
|
+
if ($[17] !== Component || $[18] !== children || $[19] !== className || $[20] !== getDialogProps || $[21] !== isOpen || $[22] !== onCloseClick || $[23] !== props) {
|
|
165
165
|
t5 = isOpen ? /*#__PURE__*/jsxs(Fragment, {
|
|
166
166
|
children: [/*#__PURE__*/jsx("span", {
|
|
167
167
|
className: classes.Overlay,
|
|
168
168
|
ref: overlayRef
|
|
169
169
|
}), /*#__PURE__*/jsxs(Component, {
|
|
170
170
|
tabIndex: -1,
|
|
171
|
-
ref:
|
|
171
|
+
ref: modalRef,
|
|
172
172
|
role: "dialog",
|
|
173
173
|
"aria-modal": "true",
|
|
174
174
|
...props,
|
|
@@ -188,14 +188,13 @@ const Dialog = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
188
188
|
$[17] = Component;
|
|
189
189
|
$[18] = children;
|
|
190
190
|
$[19] = className;
|
|
191
|
-
$[20] =
|
|
192
|
-
$[21] =
|
|
193
|
-
$[22] =
|
|
194
|
-
$[23] =
|
|
195
|
-
$[24] =
|
|
196
|
-
$[25] = t5;
|
|
191
|
+
$[20] = getDialogProps;
|
|
192
|
+
$[21] = isOpen;
|
|
193
|
+
$[22] = onCloseClick;
|
|
194
|
+
$[23] = props;
|
|
195
|
+
$[24] = t5;
|
|
197
196
|
} else {
|
|
198
|
-
t5 = $[
|
|
197
|
+
t5 = $[24];
|
|
199
198
|
}
|
|
200
199
|
return t5;
|
|
201
200
|
});
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ export { useMenuInitialFocus } from './useMenuInitialFocus';
|
|
|
14
14
|
export { useMenuKeyboardNavigation } from './useMenuKeyboardNavigation';
|
|
15
15
|
export { useMnemonics } from './useMnemonics';
|
|
16
16
|
export { useRefObjectAsForwardedRef } from './useRefObjectAsForwardedRef';
|
|
17
|
-
export { useCombinedRefs } from './useCombinedRefs';
|
|
18
17
|
export { useId } from './useId';
|
|
19
18
|
export { useIsMacOS } from './useIsMacOS';
|
|
20
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAA;AACrD,YAAY,EAAC,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,qBAAqB,CAAA;AACrF,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAA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,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,YAAY,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAA;AACpD,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,0BAA0B,EAAC,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA"}
|
|
@@ -5,18 +5,6 @@ import type { ForwardedRef, RefObject } from 'react';
|
|
|
5
5
|
* instance with `.current`.
|
|
6
6
|
*
|
|
7
7
|
* **NOTE**: The `refObject` should be passed to the underlying element, NOT the `forwardedRef`.
|
|
8
|
-
*
|
|
9
|
-
* @deprecated Migrate to `useCombinedRefs`. It's safer, faster, and easier to use:
|
|
10
|
-
*
|
|
11
|
-
* ```diff
|
|
12
|
-
* const ref = useRef(null)
|
|
13
|
-
*
|
|
14
|
-
* - useRefObjectAsForwardedRef(forwardedRef, ref)
|
|
15
|
-
* + const combinedRef = useCombinedRefs(forwardedRef, ref)
|
|
16
|
-
*
|
|
17
|
-
* - return <div ref={ref} />
|
|
18
|
-
* + return <div ref={combinedRef} />
|
|
19
|
-
* ```
|
|
20
8
|
*/
|
|
21
9
|
export declare function useRefObjectAsForwardedRef<T>(forwardedRef: ForwardedRef<T>, refObject: RefObject<T | null>): void;
|
|
22
10
|
//# sourceMappingURL=useRefObjectAsForwardedRef.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRefObjectAsForwardedRef.d.ts","sourceRoot":"","sources":["../../src/hooks/useRefObjectAsForwardedRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAA;AAGlD
|
|
1
|
+
{"version":3,"file":"useRefObjectAsForwardedRef.d.ts","sourceRoot":"","sources":["../../src/hooks/useRefObjectAsForwardedRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAA;AAGlD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAEjH"}
|
|
@@ -7,18 +7,6 @@ import { useImperativeHandle } from 'react';
|
|
|
7
7
|
* instance with `.current`.
|
|
8
8
|
*
|
|
9
9
|
* **NOTE**: The `refObject` should be passed to the underlying element, NOT the `forwardedRef`.
|
|
10
|
-
*
|
|
11
|
-
* @deprecated Migrate to `useCombinedRefs`. It's safer, faster, and easier to use:
|
|
12
|
-
*
|
|
13
|
-
* ```diff
|
|
14
|
-
* const ref = useRef(null)
|
|
15
|
-
*
|
|
16
|
-
* - useRefObjectAsForwardedRef(forwardedRef, ref)
|
|
17
|
-
* + const combinedRef = useCombinedRefs(forwardedRef, ref)
|
|
18
|
-
*
|
|
19
|
-
* - return <div ref={ref} />
|
|
20
|
-
* + return <div ref={combinedRef} />
|
|
21
|
-
* ```
|
|
22
10
|
*/
|
|
23
11
|
function useRefObjectAsForwardedRef(forwardedRef, refObject) {
|
|
24
12
|
const $ = c(2);
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,6 @@ export type { FocusTrapHookSettings } from './hooks/useFocusTrap';
|
|
|
21
21
|
export { useFocusZone } from './hooks/useFocusZone';
|
|
22
22
|
export type { FocusZoneHookSettings } from './hooks/useFocusZone';
|
|
23
23
|
export { useRefObjectAsForwardedRef } from './hooks/useRefObjectAsForwardedRef';
|
|
24
|
-
export { useCombinedRefs } from './hooks/useCombinedRefs';
|
|
25
24
|
export { useResizeObserver } from './hooks/useResizeObserver';
|
|
26
25
|
export { useResponsiveValue, type ResponsiveValue } from './hooks/useResponsiveValue';
|
|
27
26
|
export { default as useIsomorphicLayoutEffect } from './utils/useIsomorphicLayoutEffect';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,IAAI,KAAK,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAC,MAAM,SAAS,CAAA;AACrF,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,cAAc,CAAA;AAClD,YAAY,EAAC,eAAe,EAAC,MAAM,cAAc,CAAA;AACjD,OAAO,EAAC,OAAO,IAAI,aAAa,EAAE,QAAQ,EAAE,iBAAiB,EAAC,MAAM,iBAAiB,CAAA;AACrF,YAAY,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAA;AAGvD,cAAc,UAAU,CAAA;AACxB,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,YAAY,EACV,oBAAoB,EACpB,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAA;AAC3D,YAAY,EAAC,iBAAiB,EAAC,M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,MAAM,YAAY,CAAA;AAE7C,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAA;AACnC,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAC/C,YAAY,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAA;AAEzD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,YAAY,EAAC,iBAAiB,EAAE,qBAAqB,EAAC,MAAM,gBAAgB,CAAA;AAE5E,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AACrC,YAAY,EAAC,cAAc,EAAC,MAAM,aAAa,CAAA;AAE/C,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAA;AAC7B,YAAY,EAAC,UAAU,EAAE,cAAc,EAAC,MAAM,SAAS,CAAA;AAEvD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,YAAY,EACV,eAAe,EACf,UAAU,IAAI,oBAAoB,EAClC,YAAY,IAAI,sBAAsB,EACtC,cAAc,IAAI,wBAAwB,EAC1C,iBAAiB,IAAI,2BAA2B,GACjD,MAAM,cAAc,CAAA;AAErB,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAA;AACtC,YAAY,EAAC,gBAAgB,EAAC,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,6 @@ export { ConfirmationDialog, useConfirm } from './ConfirmationDialog/Confirmatio
|
|
|
12
12
|
export { useFocusTrap } from './hooks/useFocusTrap.js';
|
|
13
13
|
export { useFocusZone } from './hooks/useFocusZone.js';
|
|
14
14
|
export { useRefObjectAsForwardedRef } from './hooks/useRefObjectAsForwardedRef.js';
|
|
15
|
-
export { useCombinedRefs } from './hooks/useCombinedRefs.js';
|
|
16
15
|
export { useResizeObserver } from './hooks/useResizeObserver.js';
|
|
17
16
|
export { useResponsiveValue } from './hooks/useResponsiveValue.js';
|
|
18
17
|
export { default as useIsomorphicLayoutEffect } from './utils/useIsomorphicLayoutEffect.js';
|
package/generated/hooks.json
CHANGED
|
@@ -146,28 +146,6 @@
|
|
|
146
146
|
}
|
|
147
147
|
]
|
|
148
148
|
},
|
|
149
|
-
"useCombinedRefs": {
|
|
150
|
-
"name": "useCombinedRefs",
|
|
151
|
-
"importPath": "@primer/react",
|
|
152
|
-
"stories": [],
|
|
153
|
-
"parameters": [
|
|
154
|
-
{
|
|
155
|
-
"name": "refA",
|
|
156
|
-
"type": "Ref<T>",
|
|
157
|
-
"required": true,
|
|
158
|
-
"description": "First ref to combine."
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
"name": "refB",
|
|
162
|
-
"type": "Ref<T>",
|
|
163
|
-
"required": true,
|
|
164
|
-
"description": "Second ref to combine."
|
|
165
|
-
}
|
|
166
|
-
],
|
|
167
|
-
"returns": {
|
|
168
|
-
"type": "RefCallback<T>"
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
149
|
"useDetails": {
|
|
172
150
|
"name": "useDetails",
|
|
173
151
|
"importPath": "@primer/react",
|
package/package.json
CHANGED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { ForwardedRef, Ref as StandardRef } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Combine two refs of matching type (typically an external or forwarded ref and an internal `useRef` object or
|
|
4
|
-
* callback ref).
|
|
5
|
-
*
|
|
6
|
-
* If you need to combine more than two refs (what are you doing?) just nest the hook:
|
|
7
|
-
* `useCombinedRefs(refA, useCombinedRefs(refB, refC))`
|
|
8
|
-
*
|
|
9
|
-
* @param refA First ref to combine. The order is not important.
|
|
10
|
-
* @param refB Second ref to combine. The order is not important.
|
|
11
|
-
* @returns A new ref which must be passed to the relevant child component. **Important**: do not pass `refA` or
|
|
12
|
-
* `refB` to the component!
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* // React 18
|
|
16
|
-
* const Example = forwardRef<HTMLButtonElement, {}>((props, forwardedRef) => {
|
|
17
|
-
* const ref = useRef<HTMLButtonElement>(null)
|
|
18
|
-
* const combinedRef = useCombinedRefs(forwardedRef, ref)
|
|
19
|
-
*
|
|
20
|
-
* return <button ref={combinedRef} />
|
|
21
|
-
* })
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* // React 19
|
|
25
|
-
* const Example = ({ref: externalRef}: {ref?: Ref<HTMLButtonElement>}) => {
|
|
26
|
-
* const ref = useRef<HTMLButtonElement>(null)
|
|
27
|
-
* const combinedRef = useCombinedRefs(externalRef, ref)
|
|
28
|
-
*
|
|
29
|
-
* return <button ref={combinedRef} />
|
|
30
|
-
* }
|
|
31
|
-
*/
|
|
32
|
-
export declare function useCombinedRefs<T>(refA: Ref<T | null>, refB: Ref<T | null>): (value: T | null) => void;
|
|
33
|
-
type CleanupFunction = () => void;
|
|
34
|
-
/**
|
|
35
|
-
* React 19 supports callback refs that can return a cleanup function. If a cleanup function is returned, the
|
|
36
|
-
* cleanup is called on unmount **instead** of setting the ref to null.
|
|
37
|
-
*/
|
|
38
|
-
type React19RefCallback<T> = {
|
|
39
|
-
bivarianceHack(instance: T): void | CleanupFunction;
|
|
40
|
-
}['bivarianceHack'];
|
|
41
|
-
/**
|
|
42
|
-
* Supporting React 18 and 19 while alleviating the need for any hacks or casts in consumers:
|
|
43
|
-
* - `ForwardedRef` from the React 18 `forwardRef` HOC
|
|
44
|
-
* - `React19RefCallback` for callback refs that can return a cleanup function (this is included in `Ref` in React 19
|
|
45
|
-
* but not in 18)
|
|
46
|
-
* - `Ref` for standard refs from `useRef` or passed in as React 19 prop
|
|
47
|
-
* - `undefined` to allow for easy use of optional `ref` props in React 19
|
|
48
|
-
*/
|
|
49
|
-
type Ref<T> = ForwardedRef<T> | React19RefCallback<T> | StandardRef<T> | undefined;
|
|
50
|
-
export {};
|
|
51
|
-
//# sourceMappingURL=useCombinedRefs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCombinedRefs.d.ts","sourceRoot":"","sources":["../../src/hooks/useCombinedRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,GAAG,IAAI,WAAW,EAAmB,MAAM,OAAO,CAAA;AAG7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,WAc/D,CAAC,GAAG,IAAI,UAQnB;AAED,KAAK,eAAe,GAAG,MAAM,IAAI,CAAA;AAEjC;;;GAGG;AAEH,KAAK,kBAAkB,CAAC,CAAC,IAAI;IAC3B,cAAc,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,GAAG,eAAe,CAAA;CACpD,CAAC,gBAAgB,CAAC,CAAA;AAEnB;;;;;;;GAOG;AACH,KAAK,GAAG,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import { useRef, useEffect } from '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(5);
|
|
36
|
-
const cleanupARef = useRef();
|
|
37
|
-
const cleanupBRef = useRef();
|
|
38
|
-
let t0;
|
|
39
|
-
let t1;
|
|
40
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
41
|
-
t0 = () => () => {
|
|
42
|
-
var _cleanupARef$current, _cleanupBRef$current;
|
|
43
|
-
(_cleanupARef$current = cleanupARef.current) === null || _cleanupARef$current === void 0 ? void 0 : _cleanupARef$current.call(cleanupARef);
|
|
44
|
-
(_cleanupBRef$current = cleanupBRef.current) === null || _cleanupBRef$current === void 0 ? void 0 : _cleanupBRef$current.call(cleanupBRef);
|
|
45
|
-
};
|
|
46
|
-
t1 = [];
|
|
47
|
-
$[0] = t0;
|
|
48
|
-
$[1] = t1;
|
|
49
|
-
} else {
|
|
50
|
-
t0 = $[0];
|
|
51
|
-
t1 = $[1];
|
|
52
|
-
}
|
|
53
|
-
useEffect(t0, t1);
|
|
54
|
-
let t2;
|
|
55
|
-
if ($[2] !== refA || $[3] !== refB) {
|
|
56
|
-
t2 = value => {
|
|
57
|
-
setRef(refA, value, cleanupARef);
|
|
58
|
-
setRef(refB, value, cleanupBRef);
|
|
59
|
-
};
|
|
60
|
-
$[2] = refA;
|
|
61
|
-
$[3] = refB;
|
|
62
|
-
$[4] = t2;
|
|
63
|
-
} else {
|
|
64
|
-
t2 = $[4];
|
|
65
|
-
}
|
|
66
|
-
return t2;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* React 19 supports callback refs that can return a cleanup function. If a cleanup function is returned, the
|
|
71
|
-
* cleanup is called on unmount **instead** of setting the ref to null.
|
|
72
|
-
*/
|
|
73
|
-
// bivarianceHack copied from React types
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Supporting React 18 and 19 while alleviating the need for any hacks or casts in consumers:
|
|
77
|
-
* - `ForwardedRef` from the React 18 `forwardRef` HOC
|
|
78
|
-
* - `React19RefCallback` for callback refs that can return a cleanup function (this is included in `Ref` in React 19
|
|
79
|
-
* but not in 18)
|
|
80
|
-
* - `Ref` for standard refs from `useRef` or passed in as React 19 prop
|
|
81
|
-
* - `undefined` to allow for easy use of optional `ref` props in React 19
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
function setRef(ref, value, cleanupRef) {
|
|
85
|
-
// NOTE: This is technically incorrect; in React 19 even with a callback ref it should be possible to call a ref with
|
|
86
|
-
// `null` if it happens before unmount. But there's no way for a React 18 ref to know whether this update is happening
|
|
87
|
-
// during unmount or not. Once we only need to support React 19, this can be corrected using a cleanup callback in
|
|
88
|
-
// our own combined ref.
|
|
89
|
-
if (value === null && cleanupRef.current) return;
|
|
90
|
-
if (typeof ref === 'function') {
|
|
91
|
-
cleanupRef.current = ref(value) || undefined;
|
|
92
|
-
} else if (ref) {
|
|
93
|
-
ref.current = value;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export { useCombinedRefs };
|