@primer/react 0.0.0-20260403022804 → 0.0.0-20260403122728
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 +1 -3
- package/dist/ActionList/List.d.ts.map +1 -1
- package/dist/ActionList/List.js +41 -41
- package/dist/AnchoredOverlay/AnchoredOverlay-d50c6e8f.css +2 -0
- package/dist/AnchoredOverlay/AnchoredOverlay-d50c6e8f.css.map +1 -0
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +20 -21
- package/dist/AnchoredOverlay/AnchoredOverlay.module.css.js +1 -1
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +23 -23
- package/dist/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox/Checkbox.js +5 -5
- package/dist/Dialog/{Dialog-f9bb927a.css → Dialog-b577691f.css} +2 -2
- package/dist/Dialog/Dialog-b577691f.css.map +1 -0
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +25 -11
- package/dist/Dialog/Dialog.module.css.js +2 -2
- package/dist/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -0
- package/dist/FeatureFlags/FeatureFlags.d.ts +6 -0
- package/dist/FeatureFlags/FeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/FeatureFlags.js +41 -32
- package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +8 -8
- package/dist/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/PageHeader/PageHeader.js +31 -30
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +6 -5
- package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
- package/dist/TooltipV2/Tooltip.js +4 -4
- package/dist/experimental/Tabs/Tabs.d.ts +1 -1
- package/dist/experimental/Tabs/Tabs.d.ts.map +1 -1
- package/dist/experimental/Tabs/Tabs.js +16 -16
- package/dist/hooks/useMergedRefs.d.ts +1 -1
- package/dist/hooks/useMergedRefs.d.ts.map +1 -1
- package/dist/hooks/useMergedRefs.js +1 -7
- package/dist/hooks/useProvidedRefOrCreate.d.ts +10 -7
- package/dist/hooks/useProvidedRefOrCreate.d.ts.map +1 -1
- package/dist/hooks/useProvidedRefOrCreate.js +10 -10
- package/package.json +1 -2
- package/dist/AnchoredOverlay/AnchoredOverlay-647c7065.css +0 -2
- package/dist/AnchoredOverlay/AnchoredOverlay-647c7065.css.map +0 -1
- package/dist/Dialog/Dialog-f9bb927a.css.map +0 -1
|
@@ -3,6 +3,7 @@ import { FeatureFlagScope } from './FeatureFlagScope.js';
|
|
|
3
3
|
const DefaultFeatureFlags = FeatureFlagScope.create({
|
|
4
4
|
primer_react_breadcrumbs_overflow_menu: false,
|
|
5
5
|
primer_react_css_anchor_positioning: false,
|
|
6
|
+
primer_react_css_has_selector_perf: false,
|
|
6
7
|
primer_react_select_panel_fullscreen_on_narrow: false,
|
|
7
8
|
primer_react_select_panel_order_selected_at_top: false,
|
|
8
9
|
primer_react_select_panel_remove_active_descendant: false,
|
|
@@ -3,5 +3,11 @@ import { type FeatureFlags } from './FeatureFlagScope';
|
|
|
3
3
|
export type FeatureFlagsProps = React.PropsWithChildren<{
|
|
4
4
|
flags: FeatureFlags;
|
|
5
5
|
}>;
|
|
6
|
+
/**
|
|
7
|
+
* Reset the ref count for testing purposes only.
|
|
8
|
+
*
|
|
9
|
+
* @internal - Not part of the public API. Only exported for test isolation.
|
|
10
|
+
*/
|
|
11
|
+
export declare function __resetDialogScrollOptimizedCount(): void;
|
|
6
12
|
export declare function FeatureFlags({ children, flags }: FeatureFlagsProps): React.JSX.Element;
|
|
7
13
|
//# sourceMappingURL=FeatureFlags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureFlags.d.ts","sourceRoot":"","sources":["../../src/FeatureFlags/FeatureFlags.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAmB,KAAK,YAAY,EAAC,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"FeatureFlags.d.ts","sourceRoot":"","sources":["../../src/FeatureFlags/FeatureFlags.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAmB,KAAK,YAAY,EAAC,MAAM,oBAAoB,CAAA;AAGtE,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACtD,KAAK,EAAE,YAAY,CAAA;CACpB,CAAC,CAAA;AAcF;;;;GAIG;AACH,wBAAgB,iCAAiC,IAAI,IAAI,CAGxD;AAED,wBAAgB,YAAY,CAAC,EAAC,QAAQ,EAAE,KAAK,EAAC,EAAE,iBAAiB,qBAyBhE"}
|
|
@@ -1,40 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useContext } from 'react';
|
|
1
|
+
import { useContext, useMemo } from 'react';
|
|
3
2
|
import { FeatureFlagContext } from './FeatureFlagContext.js';
|
|
4
3
|
import { FeatureFlagScope } from './FeatureFlagScope.js';
|
|
4
|
+
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Ref count for data-dialog-scroll-optimized attribute management.
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This is temporary infrastructure while we feature flag the CSS :has()
|
|
11
|
+
* performance optimization (primer_react_css_has_selector_perf). Once the flag
|
|
12
|
+
* is removed and the optimization is the default behavior, this ref counting
|
|
13
|
+
* can be removed - the attribute can simply always be present.
|
|
14
|
+
*
|
|
15
|
+
* @internal - Not part of the public API
|
|
16
|
+
*/
|
|
17
|
+
let dialogScrollOptimizedCount = 0;
|
|
18
|
+
function FeatureFlags({
|
|
19
|
+
children,
|
|
20
|
+
flags
|
|
21
|
+
}) {
|
|
13
22
|
const parentFeatureFlags = useContext(FeatureFlagContext);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
return t2;
|
|
23
|
+
const value = useMemo(() => {
|
|
24
|
+
const scope = FeatureFlagScope.merge(parentFeatureFlags, FeatureFlagScope.create(flags));
|
|
25
|
+
return scope;
|
|
26
|
+
}, [parentFeatureFlags, flags]);
|
|
27
|
+
const isOptimizationEnabled = value.enabled('primer_react_css_has_selector_perf');
|
|
28
|
+
|
|
29
|
+
// Set body attribute for CSS :has() optimization when flag is enabled
|
|
30
|
+
useIsomorphicLayoutEffect(() => {
|
|
31
|
+
if (isOptimizationEnabled) {
|
|
32
|
+
dialogScrollOptimizedCount++;
|
|
33
|
+
document.body.setAttribute('data-dialog-scroll-optimized', '');
|
|
34
|
+
return () => {
|
|
35
|
+
dialogScrollOptimizedCount--;
|
|
36
|
+
if (dialogScrollOptimizedCount === 0) {
|
|
37
|
+
document.body.removeAttribute('data-dialog-scroll-optimized');
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}, [isOptimizationEnabled]);
|
|
42
|
+
return /*#__PURE__*/jsx(FeatureFlagContext.Provider, {
|
|
43
|
+
value: value,
|
|
44
|
+
children: children
|
|
45
|
+
});
|
|
38
46
|
}
|
|
47
|
+
FeatureFlags.displayName = "FeatureFlags";
|
|
39
48
|
|
|
40
49
|
export { FeatureFlags };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilteredActionList.d.ts","sourceRoot":"","sources":["../../src/FilteredActionList/FilteredActionList.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuB,GAAG,EAAC,MAAM,OAAO,CAAA;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAA;AAEhD,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,eAAe,CAAA;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAA0B,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"FilteredActionList.d.ts","sourceRoot":"","sources":["../../src/FilteredActionList/FilteredActionList.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuB,GAAG,EAAC,MAAM,OAAO,CAAA;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAA;AAEhD,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,eAAe,CAAA;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAA0B,MAAM,IAAI,CAAA;AAOhF,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,6BAA6B,CAAA;AAY9E,MAAM,WAAW,uBAAwB,SAAQ,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,MAAM,aAAa,CAAC,CAAC,EAAE,aAAa;IAClH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,6BAA6B,CAAA;IAC3C,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,CA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;IACjE;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC;;;;OAIG;IACH,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B;;;;;;;;;;;;;OAaG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,OAAe,EACf,eAAe,EACf,WAAW,EAAE,mBAAmB,EAChC,WAAwD,EACxD,cAAc,EACd,yBAAyB,EACzB,iBAAiB,EACjB,KAAK,EACL,cAAc,EACd,QAAQ,EAAE,gBAAgB,EAC1B,kBAAkB,EAAE,0BAA0B,EAC9C,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,oBAA2B,EAC3B,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,gBAAyB,EACzB,uBAA6C,EAC7C,yBAAyB,EACzB,oBAA4B,EAC5B,eAAuB,EACvB,sBAAsB,EACtB,cAAc,EACd,WAAmB,EACnB,GAAG,SAAS,EACb,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CA8avC;yBA7ce,kBAAkB"}
|
|
@@ -4,6 +4,7 @@ import { useCallback, useRef, useState, useEffect, useMemo, forwardRef } from 'r
|
|
|
4
4
|
import { ActionList } from '../ActionList/index.js';
|
|
5
5
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
6
6
|
import { useId } from '../hooks/useId.js';
|
|
7
|
+
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
7
8
|
import { useProvidedStateOrCreate } from '../hooks/useProvidedStateOrCreate.js';
|
|
8
9
|
import useScrollFlash from '../hooks/useScrollFlash.js';
|
|
9
10
|
import { FilteredActionListLoadingTypes, FilteredActionListBodyLoader } from './FilteredActionListLoaders.js';
|
|
@@ -14,7 +15,6 @@ import { useAnnouncements } from './useAnnouncements.js';
|
|
|
14
15
|
import { clsx } from 'clsx';
|
|
15
16
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
16
17
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
17
|
-
import { useMergedRefs } from '../hooks/useMergedRefs.js';
|
|
18
18
|
import TextInput from '../TextInput/TextInput.js';
|
|
19
19
|
import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.js';
|
|
20
20
|
import Checkbox from '../Checkbox/Checkbox.js';
|
|
@@ -73,10 +73,8 @@ function FilteredActionList({
|
|
|
73
73
|
}, [onFilterChange, setInternalFilterValue]);
|
|
74
74
|
const inputAndListContainerRef = useRef(null);
|
|
75
75
|
const listRef = useRef(null);
|
|
76
|
-
const scrollContainerRef =
|
|
77
|
-
const
|
|
78
|
-
const inputRef = useRef(null);
|
|
79
|
-
const combinedInputRef = useMergedRefs(inputRef, providedInputRef);
|
|
76
|
+
const scrollContainerRef = useProvidedRefOrCreate(providedScrollContainerRef);
|
|
77
|
+
const inputRef = useProvidedRefOrCreate(providedInputRef);
|
|
80
78
|
const usingRovingTabindex = _PrivateFocusManagement === 'roving-tabindex';
|
|
81
79
|
const [listContainerElement, setListContainerElement] = useState(null);
|
|
82
80
|
const activeDescendantRef = useRef();
|
|
@@ -389,8 +387,10 @@ function FilteredActionList({
|
|
|
389
387
|
"data-testid": "filtered-action-list",
|
|
390
388
|
children: [/*#__PURE__*/jsx("div", {
|
|
391
389
|
className: classes.Header,
|
|
392
|
-
children: /*#__PURE__*/jsx(TextInput
|
|
393
|
-
|
|
390
|
+
children: /*#__PURE__*/jsx(TextInput
|
|
391
|
+
// @ts-expect-error it needs a non nullable ref
|
|
392
|
+
, {
|
|
393
|
+
ref: inputRef,
|
|
394
394
|
block: true,
|
|
395
395
|
width: "auto",
|
|
396
396
|
color: "fg.default",
|
|
@@ -429,7 +429,7 @@ function FilteredActionList({
|
|
|
429
429
|
children: selectAllLabelText
|
|
430
430
|
})]
|
|
431
431
|
}), /*#__PURE__*/jsx("div", {
|
|
432
|
-
ref:
|
|
432
|
+
ref: scrollContainerRef,
|
|
433
433
|
className: classes.Container,
|
|
434
434
|
children: getBodyContent()
|
|
435
435
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../src/PageHeader/PageHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../src/PageHeader/PageHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAIhE,OAAO,KAAK,EAAC,SAAS,IAAI,aAAa,EAAC,MAAM,SAAS,CAAA;AAIvD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAI/F,OAAO,KAAK,EAAC,QAAQ,EAAE,gBAAgB,EAAC,MAAM,gBAAgB,CAAA;AAO9D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;CAC5C,CAAA;AAkBD,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,QAAQ,GAAG,KAAK,CAAA;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AA0FD,KAAK,SAAS,GAAG,IAAI,CACnB,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,GAAG,aAAa,EAC7D,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAC1G,GAAG;IACF,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;CAClD,CAAA;AACD,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAA;AAuDpF,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,eAAe,CAAC,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAA;CAC7F,GAAG,iBAAiB,CAAA;AAsErB,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC7C,GAAG,iBAAiB,CAAA;AAiDrB,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;AAmBrE,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,CAAC,EAAE,KAAK,GAAG,KAAK,CAAA;IAClB,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,iBAAiB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAA;CAC5D,GAAG,iBAAiB,CAAA;AAsFrB,eAAO,MAAM,UAAU;;;;;;;;;;;;+CA3GiC,YAAY;;;CA0HlE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
3
|
import { isResponsiveValue } from '../hooks/useResponsiveValue.js';
|
|
4
4
|
import { ArrowLeftIcon } from '@primer/octicons-react';
|
|
5
5
|
import { getResponsiveAttributes } from '../internal/utils/getResponsiveAttributes.js';
|
|
@@ -9,7 +9,7 @@ import { clsx } from 'clsx';
|
|
|
9
9
|
import classes from './PageHeader.module.css.js';
|
|
10
10
|
import { isSlot } from '../utils/is-slot.js';
|
|
11
11
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
12
|
-
import {
|
|
12
|
+
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
13
13
|
import Heading from '../Heading/Heading.js';
|
|
14
14
|
import Link from '../Link/Link.js';
|
|
15
15
|
|
|
@@ -31,7 +31,7 @@ const hiddenOnNarrow = {
|
|
|
31
31
|
// -----------------------------------------------------------------------------
|
|
32
32
|
|
|
33
33
|
const Root = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
34
|
-
const $ = c(
|
|
34
|
+
const $ = c(14);
|
|
35
35
|
const {
|
|
36
36
|
children,
|
|
37
37
|
className,
|
|
@@ -41,12 +41,11 @@ const Root = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
41
41
|
hasBorder
|
|
42
42
|
} = t0;
|
|
43
43
|
const BaseComponent = t1 === undefined ? "div" : t1;
|
|
44
|
-
const rootRef =
|
|
45
|
-
const mergedRef = useMergedRefs(rootRef, forwardedRef);
|
|
44
|
+
const rootRef = useProvidedRefOrCreate(forwardedRef);
|
|
46
45
|
const isInteractive = _temp;
|
|
47
46
|
let t2;
|
|
48
47
|
let t3;
|
|
49
|
-
if ($[0] !== children) {
|
|
48
|
+
if ($[0] !== children || $[1] !== rootRef) {
|
|
50
49
|
t2 = function validateInteractiveElementsInTitle() {
|
|
51
50
|
if (!(process.env.NODE_ENV !== "production")) {
|
|
52
51
|
return;
|
|
@@ -73,42 +72,43 @@ const Root = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
73
72
|
};
|
|
74
73
|
t3 = [children, rootRef];
|
|
75
74
|
$[0] = children;
|
|
76
|
-
$[1] =
|
|
77
|
-
$[2] =
|
|
75
|
+
$[1] = rootRef;
|
|
76
|
+
$[2] = t2;
|
|
77
|
+
$[3] = t3;
|
|
78
78
|
} else {
|
|
79
|
-
t2 = $[
|
|
80
|
-
t3 = $[
|
|
79
|
+
t2 = $[2];
|
|
80
|
+
t3 = $[3];
|
|
81
81
|
}
|
|
82
82
|
useEffect(t2, t3);
|
|
83
83
|
let t4;
|
|
84
|
-
if ($[
|
|
84
|
+
if ($[4] !== className) {
|
|
85
85
|
t4 = clsx(classes.PageHeader, className);
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
86
|
+
$[4] = className;
|
|
87
|
+
$[5] = t4;
|
|
88
88
|
} else {
|
|
89
|
-
t4 = $[
|
|
89
|
+
t4 = $[5];
|
|
90
90
|
}
|
|
91
91
|
const t5 = hasBorder ? "true" : undefined;
|
|
92
92
|
let t6;
|
|
93
|
-
if ($[
|
|
93
|
+
if ($[6] !== BaseComponent || $[7] !== ariaLabel || $[8] !== children || $[9] !== role || $[10] !== rootRef || $[11] !== t4 || $[12] !== t5) {
|
|
94
94
|
t6 = /*#__PURE__*/jsx(BaseComponent, {
|
|
95
|
-
ref:
|
|
95
|
+
ref: rootRef,
|
|
96
96
|
className: t4,
|
|
97
97
|
"data-has-border": t5,
|
|
98
98
|
"aria-label": ariaLabel,
|
|
99
99
|
role: role,
|
|
100
100
|
children: children
|
|
101
101
|
});
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
$[8] = mergedRef;
|
|
102
|
+
$[6] = BaseComponent;
|
|
103
|
+
$[7] = ariaLabel;
|
|
104
|
+
$[8] = children;
|
|
106
105
|
$[9] = role;
|
|
107
|
-
$[10] =
|
|
108
|
-
$[11] =
|
|
109
|
-
$[12] =
|
|
106
|
+
$[10] = rootRef;
|
|
107
|
+
$[11] = t4;
|
|
108
|
+
$[12] = t5;
|
|
109
|
+
$[13] = t6;
|
|
110
110
|
} else {
|
|
111
|
-
t6 = $[
|
|
111
|
+
t6 = $[13];
|
|
112
112
|
}
|
|
113
113
|
return t6;
|
|
114
114
|
});
|
|
@@ -334,6 +334,7 @@ const TitleArea = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
334
334
|
} = t0;
|
|
335
335
|
const hidden = t1 === undefined ? false : t1;
|
|
336
336
|
const variant = t2 === undefined ? "medium" : t2;
|
|
337
|
+
const titleAreaRef = useProvidedRefOrCreate(forwardedRef);
|
|
337
338
|
let t3;
|
|
338
339
|
if ($[0] !== className) {
|
|
339
340
|
t3 = clsx(classes.TitleArea, className);
|
|
@@ -359,20 +360,20 @@ const TitleArea = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
359
360
|
t5 = $[5];
|
|
360
361
|
}
|
|
361
362
|
let t6;
|
|
362
|
-
if ($[6] !== children || $[7] !==
|
|
363
|
+
if ($[6] !== children || $[7] !== t3 || $[8] !== t4 || $[9] !== t5 || $[10] !== titleAreaRef) {
|
|
363
364
|
t6 = /*#__PURE__*/jsx("div", {
|
|
364
365
|
className: t3,
|
|
365
|
-
ref:
|
|
366
|
+
ref: titleAreaRef,
|
|
366
367
|
"data-component": "TitleArea",
|
|
367
368
|
...t4,
|
|
368
369
|
...t5,
|
|
369
370
|
children: children
|
|
370
371
|
});
|
|
371
372
|
$[6] = children;
|
|
372
|
-
$[7] =
|
|
373
|
-
$[8] =
|
|
374
|
-
$[9] =
|
|
375
|
-
$[10] =
|
|
373
|
+
$[7] = t3;
|
|
374
|
+
$[8] = t4;
|
|
375
|
+
$[9] = t5;
|
|
376
|
+
$[10] = titleAreaRef;
|
|
376
377
|
$[11] = t6;
|
|
377
378
|
} else {
|
|
378
379
|
t6 = $[11];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAwD,MAAM,OAAO,CAAA;AAE5E,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8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;;;;;;;AA+PzG,wBAGE"}
|
|
@@ -10,7 +10,7 @@ import UnstyledTextInput from '../internal/components/UnstyledTextInput.js';
|
|
|
10
10
|
import VisuallyHidden from '../_VisuallyHidden.js';
|
|
11
11
|
import { CharacterCounter } from '../utils/character-counter.js';
|
|
12
12
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
13
|
-
import {
|
|
13
|
+
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
14
14
|
import Text from '../Text/Text.js';
|
|
15
15
|
|
|
16
16
|
// using forwardRef is important so that other components can autofocus the input
|
|
@@ -46,8 +46,7 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
|
46
46
|
...inputProps
|
|
47
47
|
}, ref) => {
|
|
48
48
|
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
49
|
-
const inputRef =
|
|
50
|
-
const mergedRef = useMergedRefs(inputRef, ref);
|
|
49
|
+
const inputRef = useProvidedRefOrCreate(ref);
|
|
51
50
|
const [characterCount, setCharacterCount] = useState('');
|
|
52
51
|
const [isOverLimit, setIsOverLimit] = useState(false);
|
|
53
52
|
const [screenReaderMessage, setScreenReaderMessage] = useState('');
|
|
@@ -171,8 +170,10 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
|
171
170
|
hasLoadingIndicator: typeof loading === 'boolean',
|
|
172
171
|
id: leadingVisualId,
|
|
173
172
|
children: typeof LeadingVisual !== 'string' && isValidElementType(LeadingVisual) ? /*#__PURE__*/jsx(LeadingVisual, {}) : LeadingVisual
|
|
174
|
-
}), /*#__PURE__*/jsx(UnstyledTextInput
|
|
175
|
-
|
|
173
|
+
}), /*#__PURE__*/jsx(UnstyledTextInput
|
|
174
|
+
// @ts-expect-error it needs a non nullable ref
|
|
175
|
+
, {
|
|
176
|
+
ref: inputRef,
|
|
176
177
|
disabled: disabled,
|
|
177
178
|
onFocus: handleInputFocus,
|
|
178
179
|
onBlur: handleInputBlur,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/TooltipV2/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/TooltipV2/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiD,KAAK,yBAAyB,EAAC,MAAM,OAAO,CAAA;AAS3G,OAAO,EAAoD,KAAK,mBAAmB,EAAC,MAAM,mBAAmB,CAAA;AAG7G,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAA;AAE9C,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,CAAA;AAChF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACjD,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,GAAG,aAAa,CAAA;IAC9B,cAAc,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAA;IACjF;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IACnC;;;;;;;;OAQG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;CACjC,CAAC,GACA,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AAiEnC,eAAO,MAAM,cAAc;gBAAoC,MAAM;EAAM,CAAA;AAI3E,eAAO,MAAM,OAAO,EAAE,yBAAyB,CAC7C,KAAK,CAAC,eAAe,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CACvE,GACC,UAiSD,CAAA"}
|
|
@@ -9,7 +9,7 @@ import VisuallyHidden from '../_VisuallyHidden.js';
|
|
|
9
9
|
import useSafeTimeout from '../hooks/useSafeTimeout.js';
|
|
10
10
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
11
|
import { useId } from '../hooks/useId.js';
|
|
12
|
-
import {
|
|
12
|
+
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
13
13
|
import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
|
|
14
14
|
import { useIsMacOS } from '../hooks/useIsMacOS.js';
|
|
15
15
|
import { getAccessibleKeybindingHintString, KeybindingHint } from '../KeybindingHint/KeybindingHint.js';
|
|
@@ -91,8 +91,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
91
91
|
}, forwardedRef) => {
|
|
92
92
|
const tooltipId = useId(id);
|
|
93
93
|
const child = Children.only(children);
|
|
94
|
-
const triggerRef =
|
|
95
|
-
const mergedTriggerRef = useMergedRefs(triggerRef, forwardedRef);
|
|
94
|
+
const triggerRef = useProvidedRefOrCreate(forwardedRef);
|
|
96
95
|
const tooltipElRef = useRef(null);
|
|
97
96
|
const [calculatedDirection, setCalculatedDirection] = useState(direction);
|
|
98
97
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
@@ -208,7 +207,8 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
208
207
|
/*#__PURE__*/
|
|
209
208
|
// eslint-disable-next-line react-hooks/refs
|
|
210
209
|
React.cloneElement(child, {
|
|
211
|
-
ref
|
|
210
|
+
// @ts-expect-error it needs a non nullable ref
|
|
211
|
+
ref: triggerRef,
|
|
212
212
|
// If it is a type description, we use tooltip to describe the trigger
|
|
213
213
|
'aria-describedby': (() => {
|
|
214
214
|
// If tooltip is not a description type, keep the original aria-describedby
|
|
@@ -66,7 +66,7 @@ declare function useTabList<T extends HTMLElement>(props: TabListProps & {
|
|
|
66
66
|
'aria-orientation': AriaAttributes['aria-orientation'];
|
|
67
67
|
'aria-label': AriaAttributes['aria-label'];
|
|
68
68
|
'aria-labelledby': AriaAttributes['aria-labelledby'];
|
|
69
|
-
ref: React.
|
|
69
|
+
ref: React.RefObject<T | null>;
|
|
70
70
|
role: 'tablist';
|
|
71
71
|
};
|
|
72
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/experimental/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/experimental/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKZ,KAAK,cAAc,EAEnB,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAA;AAKd;;GAEG;AACH,KAAK,mBAAmB,GAAG;IACzB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAA;IAEpB;;OAEG;IACH,aAAa,EAAE,CAAC,EAAC,KAAK,EAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,KAAK,IAAI,CAAA;CAClD,CAAA;AAED;;GAEG;AACH,KAAK,qBAAqB,GAAG;IAC3B;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IAEpB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;IAEb;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,EAAC,KAAK,EAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,KAAK,IAAI,CAAA;CACnD,CAAA;AAED,KAAK,SAAS,GAAG,iBAAiB,CAAC,mBAAmB,GAAG,qBAAqB,CAAC,CAAA;AAE/E;;;;;;GAMG;AACH,iBAAS,IAAI,CAAC,KAAK,EAAE,SAAS,qBA2B7B;AAED,KAAK,KAAK,GAAG;IACX,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,KAAK,U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G,IAAI,GAAG,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CAClH,GAAG;QACF,IAAI,EAAE,KAAK,CAAA;KACZ,CAAA;CACF,CAwCA;AAED,QAAA,MAAM,GAAG;IApEP;;OAEG;eACQ,OAAO;IAElB;;;OAGG;WACI,MAAM;2CA4Eb,CAAA;AAEF,KAAK,aAAa,GAAG;IACnB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,kCAAkC;AAClC,iBAAS,WAAW,CAAC,CAAC,SAAS,WAAW,EACxC,KAAK,EAAE,aAAa,GACnB;IACD,qDAAqD;IACrD,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,iBAAiB,GAAG,IAAI,GAAG,QAAQ,CAAC,GAAG;QAC7E;;WAEG;QACH,eAAe,EAAE,MAAM,GAAG,SAAS,CAAA;QACnC,IAAI,EAAE,UAAU,CAAA;KACjB,CAAA;CACF,CAeA;AAED,iBAAS,QAAQ,CAAC,EAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,IAAI,EAAC,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,aAAa,qBAQjG;AA+BD,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAC,CAAA;AACtE,YAAY,EAAC,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAC,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React, { useId,
|
|
2
|
+
import React, { useId, createContext, useContext } from 'react';
|
|
3
3
|
import useIsomorphicLayoutEffect from '../../utils/useIsomorphicLayoutEffect.js';
|
|
4
4
|
import { useControllableState } from '../../hooks/useControllableState.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
import {
|
|
6
|
+
import { useProvidedRefOrCreate } from '../../hooks/useProvidedRefOrCreate.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The Tabs component provides the base structure for a tabbed interface, without providing any formal requirement on DOM structure or styling.
|
|
@@ -87,16 +87,15 @@ function Tabs(props) {
|
|
|
87
87
|
return t5;
|
|
88
88
|
}
|
|
89
89
|
function useTabList(props) {
|
|
90
|
-
const $ = c(
|
|
90
|
+
const $ = c(9);
|
|
91
91
|
const {
|
|
92
92
|
"aria-label": ariaLabel,
|
|
93
93
|
"aria-labelledby": ariaLabelledby,
|
|
94
94
|
"aria-orientation": ariaOrientation
|
|
95
95
|
} = props;
|
|
96
|
-
const ref =
|
|
97
|
-
const mergedRef = useMergedRefs(ref, props.ref);
|
|
96
|
+
const ref = useProvidedRefOrCreate(props.ref);
|
|
98
97
|
let t0;
|
|
99
|
-
if ($[0] !== ariaOrientation) {
|
|
98
|
+
if ($[0] !== ariaOrientation || $[1] !== ref) {
|
|
100
99
|
t0 = event => {
|
|
101
100
|
const {
|
|
102
101
|
current: tablist
|
|
@@ -143,17 +142,18 @@ function useTabList(props) {
|
|
|
143
142
|
}
|
|
144
143
|
};
|
|
145
144
|
$[0] = ariaOrientation;
|
|
146
|
-
$[1] =
|
|
145
|
+
$[1] = ref;
|
|
146
|
+
$[2] = t0;
|
|
147
147
|
} else {
|
|
148
|
-
t0 = $[
|
|
148
|
+
t0 = $[2];
|
|
149
149
|
}
|
|
150
150
|
const onKeyDown = t0;
|
|
151
151
|
const t1 = ariaOrientation !== null && ariaOrientation !== void 0 ? ariaOrientation : "horizontal";
|
|
152
152
|
let t2;
|
|
153
|
-
if ($[
|
|
153
|
+
if ($[3] !== ariaLabel || $[4] !== ariaLabelledby || $[5] !== onKeyDown || $[6] !== ref || $[7] !== t1) {
|
|
154
154
|
t2 = {
|
|
155
155
|
tabListProps: {
|
|
156
|
-
ref
|
|
156
|
+
ref,
|
|
157
157
|
"aria-label": ariaLabel,
|
|
158
158
|
"aria-labelledby": ariaLabelledby,
|
|
159
159
|
"aria-orientation": t1,
|
|
@@ -161,14 +161,14 @@ function useTabList(props) {
|
|
|
161
161
|
onKeyDown
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[4] = mergedRef;
|
|
164
|
+
$[3] = ariaLabel;
|
|
165
|
+
$[4] = ariaLabelledby;
|
|
167
166
|
$[5] = onKeyDown;
|
|
168
|
-
$[6] =
|
|
169
|
-
$[7] =
|
|
167
|
+
$[6] = ref;
|
|
168
|
+
$[7] = t1;
|
|
169
|
+
$[8] = t2;
|
|
170
170
|
} else {
|
|
171
|
-
t2 = $[
|
|
171
|
+
t2 = $[8];
|
|
172
172
|
}
|
|
173
173
|
return t2;
|
|
174
174
|
}
|
|
@@ -29,7 +29,7 @@ import type { ForwardedRef, Ref as StandardRef } from 'react';
|
|
|
29
29
|
* return <button ref={mergedRef} />
|
|
30
30
|
* }
|
|
31
31
|
*/
|
|
32
|
-
export declare function useMergedRefs<T>(refA: Ref<T | null>, refB: Ref<T | null>): (value: T | null) => (
|
|
32
|
+
export declare function useMergedRefs<T>(refA: Ref<T | null>, refB: Ref<T | null>): (value: T | null) => () => void;
|
|
33
33
|
type CleanupFunction = () => void;
|
|
34
34
|
/**
|
|
35
35
|
* React 19 supports callback refs that can return a cleanup function. If a cleanup function is returned, the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMergedRefs.d.ts","sourceRoot":"","sources":["../../src/hooks/useMergedRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,GAAG,IAAI,WAAW,EAAmB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"useMergedRefs.d.ts","sourceRoot":"","sources":["../../src/hooks/useMergedRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,GAAG,IAAI,WAAW,EAAmB,MAAM,OAAO,CAAA;AAG7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,WAE7D,CAAC,GAAG,IAAI,gBAiBnB;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,8 +1,5 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
var _version$split$;
|
|
5
|
-
const majorReactVersion = parseInt((_version$split$ = version.split('.')[0]) !== null && _version$split$ !== void 0 ? _version$split$ : '18', 10);
|
|
2
|
+
import 'react';
|
|
6
3
|
|
|
7
4
|
/**
|
|
8
5
|
* Combine two refs of matching type (typically an external or forwarded ref and an internal `useRef` object or
|
|
@@ -41,9 +38,6 @@ function useMergedRefs(refA, refB) {
|
|
|
41
38
|
t0 = value => {
|
|
42
39
|
const cleanupA = setRef(refA, value);
|
|
43
40
|
const cleanupB = setRef(refB, value);
|
|
44
|
-
if (majorReactVersion <= 18) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
41
|
return () => {
|
|
48
42
|
if (cleanupA) {
|
|
49
43
|
cleanupA();
|
|
@@ -7,14 +7,17 @@ import React from 'react';
|
|
|
7
7
|
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
8
8
|
* @type TRef The type of the RefObject which should be created.
|
|
9
9
|
*
|
|
10
|
-
* @
|
|
11
|
-
*
|
|
12
|
-
* {@linkcode useMergedRefs} instead.
|
|
10
|
+
* @deprecated This hook is incompatible with forwarded callback refs. Prefer `useMergedRefs` with an internally
|
|
11
|
+
* created ref instead.
|
|
13
12
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* ```diff
|
|
14
|
+
* - const ref = useProvidedRefOrCreate(forwardedRef as RefObject<...>)
|
|
15
|
+
* + const ref = useRef(null)
|
|
16
|
+
* + const mergedRef = useMergedRefs(forwardedRef, ref)
|
|
17
|
+
*
|
|
18
|
+
* - return <div ref={ref} />
|
|
19
|
+
* + return <div ref={mergedRef} />
|
|
20
|
+
* ```
|
|
18
21
|
*/
|
|
19
22
|
export declare function useProvidedRefOrCreate<TRef>(providedRef?: React.RefObject<TRef | null>): React.RefObject<TRef | null>;
|
|
20
23
|
//# sourceMappingURL=useProvidedRefOrCreate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProvidedRefOrCreate.d.ts","sourceRoot":"","sources":["../../src/hooks/useProvidedRefOrCreate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"useProvidedRefOrCreate.d.ts","sourceRoot":"","sources":["../../src/hooks/useProvidedRefOrCreate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,CAGrH"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
// used in doc comment
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
-
|
|
6
3
|
/**
|
|
7
4
|
* There are some situations where we only want to create a new ref if one is not provided to a component
|
|
8
5
|
* or hook as a prop. However, due to the `rules-of-hooks`, we cannot conditionally make a call to `React.useRef`
|
|
@@ -11,14 +8,17 @@ import React from 'react';
|
|
|
11
8
|
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
12
9
|
* @type TRef The type of the RefObject which should be created.
|
|
13
10
|
*
|
|
14
|
-
* @
|
|
15
|
-
*
|
|
16
|
-
*
|
|
11
|
+
* @deprecated This hook is incompatible with forwarded callback refs. Prefer `useMergedRefs` with an internally
|
|
12
|
+
* created ref instead.
|
|
13
|
+
*
|
|
14
|
+
* ```diff
|
|
15
|
+
* - const ref = useProvidedRefOrCreate(forwardedRef as RefObject<...>)
|
|
16
|
+
* + const ref = useRef(null)
|
|
17
|
+
* + const mergedRef = useMergedRefs(forwardedRef, ref)
|
|
17
18
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* internal element.
|
|
19
|
+
* - return <div ref={ref} />
|
|
20
|
+
* + return <div ref={mergedRef} />
|
|
21
|
+
* ```
|
|
22
22
|
*/
|
|
23
23
|
function useProvidedRefOrCreate(providedRef) {
|
|
24
24
|
const createdRef = React.useRef(null);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-20260403122728",
|
|
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",
|
|
@@ -78,7 +78,6 @@
|
|
|
78
78
|
"@github/relative-time-element": "^4.5.0",
|
|
79
79
|
"@github/tab-container-element": "^4.8.2",
|
|
80
80
|
"@lit-labs/react": "1.2.1",
|
|
81
|
-
"@oddbird/css-anchor-positioning": "^0.9.0",
|
|
82
81
|
"@oddbird/popover-polyfill": "^0.5.2",
|
|
83
82
|
"@primer/behaviors": "^1.10.2",
|
|
84
83
|
"@primer/live-region-element": "^0.7.1",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
.prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium{position:relative}.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:none;position:absolute;right:var(--base-size-8,.5rem);top:var(--base-size-8,.5rem)}@media screen and (max-width:calc(48rem - 0.02px)){.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:inline-grid}}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z{position-try-fallbacks:flip-block,flip-inline,flip-block flip-inline;position-visibility:anchors-visible;position:fixed!important;z-index:100}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[popover]{border:0;inset:auto;margin:0;max-height:none;max-width:none;padding:0}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-bottom]{left:anchor(left);top:calc(anchor(bottom) + var(--base-size-4,.25rem))}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-top]{bottom:anchor(top);left:anchor(left);margin-bottom:var(--base-size-4,.25rem)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-left]{margin-right:var(--base-size-4,.25rem);right:anchor(left);top:anchor(top)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-right]{left:anchor(right);margin-left:var(--base-size-4,.25rem);top:anchor(top)}
|
|
2
|
-
/*# sourceMappingURL=AnchoredOverlay-647c7065.css.map */
|