@primer/react 0.0.0-20260714183333 → 0.0.0-20260714202217
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 -15
- package/dist/ActionBar/ActionBar.js +1 -1
- package/dist/ActionList/Group.js +1 -1
- package/dist/ActionList/List.js +16 -10
- package/dist/AnchoredOverlay/AnchoredOverlay.js +9 -3
- package/dist/Autocomplete/AutocompleteInput.js +10 -7
- package/dist/ButtonGroup/ButtonGroup.js +12 -5
- package/dist/Checkbox/Checkbox.js +10 -3
- package/dist/Dialog/Dialog.js +9 -2
- package/dist/FeatureFlags/DefaultFeatureFlags.js +2 -1
- package/dist/FilteredActionList/FilteredActionList.js +15 -4
- package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
- package/dist/Overlay/Overlay.js +1 -1
- package/dist/PageHeader/PageHeader.js +18 -9
- package/dist/PageLayout/PageLayout.js +260 -67
- package/dist/PageLayout/index.d.ts +1 -3
- package/dist/PageLayout/usePaneWidth.d.ts +1 -55
- package/dist/PageLayout/usePaneWidth.js +5 -10
- package/dist/SelectPanel/SelectPanel.js +1 -1
- package/dist/TextInput/TextInput.js +10 -3
- package/dist/TooltipV2/Tooltip.js +9 -2
- package/dist/experimental/Tabs/types.d.ts +2 -2
- package/dist/experimental/Tabs/useTabList.js +15 -7
- package/dist/experimental/index.js +3 -3
- package/dist/hooks/useAnchoredPosition.js +1 -14
- package/dist/hooks/useMergedRefs.js +4 -1
- package/dist/hooks/useProvidedRefOrCreate.d.ts +7 -10
- package/dist/hooks/useProvidedRefOrCreate.js +7 -10
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -3
- package/package.json +1 -1
- package/dist/PageLayout/DragHandle.d.ts +0 -38
- package/dist/PageLayout/DragHandle.js +0 -220
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
import { useMergedRefs } from "../../hooks/useMergedRefs.js";
|
|
1
2
|
import { useProvidedRefOrCreate } from "../../hooks/useProvidedRefOrCreate.js";
|
|
3
|
+
import { useFeatureFlag } from "../../FeatureFlags/useFeatureFlag.js";
|
|
2
4
|
import { c } from "react-compiler-runtime";
|
|
5
|
+
import { useRef } from "react";
|
|
3
6
|
//#region src/experimental/Tabs/useTabList.ts
|
|
4
7
|
function useTabList(props) {
|
|
5
8
|
const $ = c(9);
|
|
6
9
|
const { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-orientation": ariaOrientation } = props;
|
|
7
|
-
const
|
|
10
|
+
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
11
|
+
const internalRef = useRef(null);
|
|
12
|
+
const mergedRef = useMergedRefs(internalRef, props.ref);
|
|
13
|
+
const providedOrCreatedRef = useProvidedRefOrCreate(props.ref);
|
|
14
|
+
const ref = mergedRefEnabled ? internalRef : providedOrCreatedRef;
|
|
15
|
+
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
8
16
|
let t0;
|
|
9
17
|
if ($[0] !== ariaOrientation || $[1] !== ref) {
|
|
10
18
|
t0 = (event) => {
|
|
@@ -39,19 +47,19 @@ function useTabList(props) {
|
|
|
39
47
|
const onKeyDown = t0;
|
|
40
48
|
const t1 = ariaOrientation !== null && ariaOrientation !== void 0 ? ariaOrientation : "horizontal";
|
|
41
49
|
let t2;
|
|
42
|
-
if ($[3] !==
|
|
50
|
+
if ($[3] !== appliedRef || $[4] !== ariaLabel || $[5] !== ariaLabelledby || $[6] !== onKeyDown || $[7] !== t1) {
|
|
43
51
|
t2 = { tabListProps: {
|
|
44
|
-
ref,
|
|
52
|
+
ref: appliedRef,
|
|
45
53
|
"aria-label": ariaLabel,
|
|
46
54
|
"aria-labelledby": ariaLabelledby,
|
|
47
55
|
"aria-orientation": t1,
|
|
48
56
|
role: "tablist",
|
|
49
57
|
onKeyDown
|
|
50
58
|
} };
|
|
51
|
-
$[3] =
|
|
52
|
-
$[4] =
|
|
53
|
-
$[5] =
|
|
54
|
-
$[6] =
|
|
59
|
+
$[3] = appliedRef;
|
|
60
|
+
$[4] = ariaLabel;
|
|
61
|
+
$[5] = ariaLabelledby;
|
|
62
|
+
$[6] = onKeyDown;
|
|
55
63
|
$[7] = t1;
|
|
56
64
|
$[8] = t2;
|
|
57
65
|
} else t2 = $[8];
|
|
@@ -3,6 +3,9 @@ import { Announce } from "../live-region/Announce.js";
|
|
|
3
3
|
import { AriaAlert } from "../live-region/AriaAlert.js";
|
|
4
4
|
import { AriaStatus } from "../live-region/AriaStatus.js";
|
|
5
5
|
import { ButtonBase } from "../Button/ButtonBase.js";
|
|
6
|
+
import { DefaultFeatureFlags } from "../FeatureFlags/DefaultFeatureFlags.js";
|
|
7
|
+
import { FeatureFlags } from "../FeatureFlags/FeatureFlags.js";
|
|
8
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
6
9
|
import { KeybindingHint } from "../KeybindingHint/KeybindingHint.js";
|
|
7
10
|
import { getAccessibleKeybindingHintString } from "../KeybindingHint/utils.js";
|
|
8
11
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
@@ -10,9 +13,6 @@ import { useSlots } from "../hooks/useSlots.js";
|
|
|
10
13
|
import { useOverflow } from "../hooks/useOverflow.js";
|
|
11
14
|
import { ScrollableRegion } from "../ScrollableRegion/ScrollableRegion.js";
|
|
12
15
|
import { Dialog } from "../Dialog/Dialog.js";
|
|
13
|
-
import { DefaultFeatureFlags } from "../FeatureFlags/DefaultFeatureFlags.js";
|
|
14
|
-
import { FeatureFlags } from "../FeatureFlags/FeatureFlags.js";
|
|
15
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
16
16
|
import { Stack } from "../Stack/index.js";
|
|
17
17
|
import { SkeletonBox } from "../Skeleton/SkeletonBox.js";
|
|
18
18
|
import { FilteredActionListLoadingTypes } from "../FilteredActionList/constants.js";
|
|
@@ -106,10 +106,6 @@ function useAnchoredPosition(settings, dependencies = []) {
|
|
|
106
106
|
}, [updatePosition]);
|
|
107
107
|
useResizeObserver(updatePosition, void 0, [], enabled);
|
|
108
108
|
useResizeObserver(updatePosition, floatingElementRef, [], enabled);
|
|
109
|
-
const scrollAncestorsCacheRef = React.useRef({
|
|
110
|
-
anchor: null,
|
|
111
|
-
scrollables: []
|
|
112
|
-
});
|
|
113
109
|
React.useEffect(() => {
|
|
114
110
|
if (!enabled) return;
|
|
115
111
|
const anchorEl = anchorElementRef.current;
|
|
@@ -122,16 +118,7 @@ function useAnchoredPosition(settings, dependencies = []) {
|
|
|
122
118
|
updatePosition();
|
|
123
119
|
});
|
|
124
120
|
};
|
|
125
|
-
const
|
|
126
|
-
let scrollables;
|
|
127
|
-
if (cache.anchor === anchorEl) scrollables = cache.scrollables;
|
|
128
|
-
else {
|
|
129
|
-
scrollables = getScrollableAncestors(anchorEl);
|
|
130
|
-
scrollAncestorsCacheRef.current = {
|
|
131
|
-
anchor: anchorEl,
|
|
132
|
-
scrollables
|
|
133
|
-
};
|
|
134
|
-
}
|
|
121
|
+
const scrollables = getScrollableAncestors(anchorEl);
|
|
135
122
|
for (const scrollable of scrollables) scrollable.addEventListener("scroll", handleScroll);
|
|
136
123
|
return () => {
|
|
137
124
|
for (const scrollable of scrollables) scrollable.removeEventListener("scroll", handleScroll);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { isExperimentalReactVersion, reactMajorVersion } from "../utils/environment.js";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import "react";
|
|
3
|
+
import { version } from "react";
|
|
4
4
|
//#region src/hooks/useMergedRefs.ts
|
|
5
|
+
var _version$split$;
|
|
6
|
+
const majorReactVersion = parseInt((_version$split$ = version.split(".")[0]) !== null && _version$split$ !== void 0 ? _version$split$ : "18", 10);
|
|
5
7
|
/**
|
|
6
8
|
* Cleanup functions for refs were introduced in React 19. For feature detection,
|
|
7
9
|
* we look to see if current version of React is >= 19 or if it is an
|
|
@@ -48,6 +50,7 @@ function useMergedRefs(refA, refB) {
|
|
|
48
50
|
const cleanupA = setRef(refA, value);
|
|
49
51
|
const cleanupB = setRef(refB, value);
|
|
50
52
|
if (!supportsRefCleanup) return;
|
|
53
|
+
if (majorReactVersion <= 18) return;
|
|
51
54
|
return () => {
|
|
52
55
|
if (cleanupA) cleanupA();
|
|
53
56
|
else setRef(refA, null);
|
|
@@ -9,17 +9,14 @@ import React from "react";
|
|
|
9
9
|
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
10
10
|
* @type TRef The type of the RefObject which should be created.
|
|
11
11
|
*
|
|
12
|
-
* @
|
|
13
|
-
*
|
|
12
|
+
* @note This hook is overly restrictive in that it forces the provided ref to be a ref object rather than a callback.
|
|
13
|
+
* In particular, it should **not** be used to merge internal refs with forwarded refs. For this, use
|
|
14
|
+
* {@linkcode useMergedRefs} instead.
|
|
14
15
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* - return <div ref={ref} />
|
|
21
|
-
* + return <div ref={mergedRef} />
|
|
22
|
-
* ```
|
|
16
|
+
* The primary valid use case for this hook is for when the consumer is using the provided ref to point to an external
|
|
17
|
+
* element, like an externally rendered anchor. This is 'backwards' from forwarded refs with respect to data flow; the
|
|
18
|
+
* consumer is passing a reference to an external element, rather than passing a handle to obtain a reference to an
|
|
19
|
+
* internal element.
|
|
23
20
|
*/
|
|
24
21
|
declare function useProvidedRefOrCreate<TRef>(providedRef?: React.RefObject<TRef | null>): React.RefObject<TRef | null>;
|
|
25
22
|
//#endregion
|
|
@@ -8,17 +8,14 @@ import React from "react";
|
|
|
8
8
|
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
9
9
|
* @type TRef The type of the RefObject which should be created.
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
12
|
-
*
|
|
11
|
+
* @note This hook is overly restrictive in that it forces the provided ref to be a ref object rather than a callback.
|
|
12
|
+
* In particular, it should **not** be used to merge internal refs with forwarded refs. For this, use
|
|
13
|
+
* {@linkcode useMergedRefs} instead.
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* - return <div ref={ref} />
|
|
20
|
-
* + return <div ref={mergedRef} />
|
|
21
|
-
* ```
|
|
15
|
+
* The primary valid use case for this hook is for when the consumer is using the provided ref to point to an external
|
|
16
|
+
* element, like an externally rendered anchor. This is 'backwards' from forwarded refs with respect to data flow; the
|
|
17
|
+
* consumer is passing a reference to an external element, rather than passing a handle to obtain a reference to an
|
|
18
|
+
* internal element.
|
|
22
19
|
*/
|
|
23
20
|
function useProvidedRefOrCreate(providedRef) {
|
|
24
21
|
const createdRef = React.useRef(null);
|
package/dist/index.d.ts
CHANGED
|
@@ -16,9 +16,7 @@ import { LinkButton, LinkButtonProps } from "./Button/LinkButton.js";
|
|
|
16
16
|
import { ButtonComponent } from "./Button/Button.js";
|
|
17
17
|
import { ButtonBase } from "./Button/ButtonBase.js";
|
|
18
18
|
import { ResponsiveValue, useResponsiveValue } from "./hooks/useResponsiveValue.js";
|
|
19
|
-
import { CustomWidthOptions, PaneWidth, PaneWidthValue, UsePaneWidthOptions, UsePaneWidthResult, defaultPaneWidth, usePaneWidth } from "./PageLayout/usePaneWidth.js";
|
|
20
19
|
import { PageLayout, PageLayoutContentProps, PageLayoutFooterProps, PageLayoutHeaderProps, PageLayoutPaneProps, PageLayoutProps } from "./PageLayout/PageLayout.js";
|
|
21
|
-
import { DragHandle, DragHandleProps } from "./PageLayout/DragHandle.js";
|
|
22
20
|
import { SplitPageLayout, SplitPageLayoutContentProps, SplitPageLayoutFooterProps, SplitPageLayoutHeaderProps, SplitPageLayoutPaneProps, SplitPageLayoutProps } from "./SplitPageLayout/SplitPageLayout.js";
|
|
23
21
|
import useDetails from "./hooks/useDetails.js";
|
|
24
22
|
import useSafeTimeout from "./hooks/useSafeTimeout.js";
|
|
@@ -119,4 +117,4 @@ import { ActionsProps, ChildrenPropTypes, PageHeader, PageHeaderProps, TitleArea
|
|
|
119
117
|
import { SkeletonBox, SkeletonBoxProps } from "./Skeleton/SkeletonBox.js";
|
|
120
118
|
import { ActionMenu, ActionMenuAnchorProps, ActionMenuButtonProps, ActionMenuProps } from "./ActionMenu/ActionMenu.js";
|
|
121
119
|
import Overlay, { OverlayProps } from "./Overlay/Overlay.js";
|
|
122
|
-
export { ActionBar, type ActionBarProps, ActionList, type ActionListDescriptionProps, type ActionListDividerProps, type ActionListGroupHeadingProps, type ActionListGroupHeadingTrailingActionProps, type ActionListGroupProps, type ActionListItemProps, type ActionListLeadingVisualProps, type ActionListLinkItemProps, type ActionListProps, type ActionListTrailingActionProps, type ActionListTrailingVisualProps, ActionMenu, type ActionMenuAnchorProps, type ActionMenuButtonProps, type ActionMenuProps, AnchoredOverlay, type AnchoredOverlayProps, type AnchoredPositionHookSettings, _default as Autocomplete, type AutocompleteInputProps, type AutocompleteMenuProps, type AutocompleteOverlayProps, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Banner, type BannerProps, BaseStyles, type BaseStylesProps, _default$1 as BranchName, type BranchNameProps, Breadcrumb, type BreadcrumbItemProps, type BreadcrumbProps, _default$2 as Breadcrumbs, type BreadcrumbsItemProps, type BreadcrumbsProps, ButtonComponent as Button, ButtonBase, type ButtonBaseProps, ButtonGroup, type ButtonGroupProps, type ButtonProps, _default$3 as Checkbox, _default$4 as CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, _default$5 as CircleBadge, type CircleBadgeIconProps, type CircleBadgeProps, ConfirmationDialog, type ConfirmationDialogProps, CounterLabel, type CounterLabelProps,
|
|
120
|
+
export { ActionBar, type ActionBarProps, ActionList, type ActionListDescriptionProps, type ActionListDividerProps, type ActionListGroupHeadingProps, type ActionListGroupHeadingTrailingActionProps, type ActionListGroupProps, type ActionListItemProps, type ActionListLeadingVisualProps, type ActionListLinkItemProps, type ActionListProps, type ActionListTrailingActionProps, type ActionListTrailingVisualProps, ActionMenu, type ActionMenuAnchorProps, type ActionMenuButtonProps, type ActionMenuProps, AnchoredOverlay, type AnchoredOverlayProps, type AnchoredPositionHookSettings, _default as Autocomplete, type AutocompleteInputProps, type AutocompleteMenuProps, type AutocompleteOverlayProps, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Banner, type BannerProps, BaseStyles, type BaseStylesProps, _default$1 as BranchName, type BranchNameProps, Breadcrumb, type BreadcrumbItemProps, type BreadcrumbProps, _default$2 as Breadcrumbs, type BreadcrumbsItemProps, type BreadcrumbsProps, ButtonComponent as Button, ButtonBase, type ButtonBaseProps, ButtonGroup, type ButtonGroupProps, type ButtonProps, _default$3 as Checkbox, _default$4 as CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, _default$5 as CircleBadge, type CircleBadgeIconProps, type CircleBadgeProps, ConfirmationDialog, type ConfirmationDialogProps, CounterLabel, type CounterLabelProps, Details, type DetailsProps, Dialog, type DialogButtonProps, type DialogHeaderProps, type DialogHeight, type DialogProps, type DialogWidth, type FCWithSlotMarker, Flash, type FlashProps, FocusKeys, type FocusTrapHookSettings, type FocusZoneHookSettings, _default$6 as FormControl, type FormControlCaptionProps, type Props as FormControlLabelProps, type FormControlProps, type FormControlValidationProps, _default$7 as Header, type HeaderItemProps, type HeaderLinkProps, type HeaderProps, Heading, type HeadingProps, IconButton, type IconButtonProps, IssueLabelToken, type IssueLabelTokenProps, Label, type LabelColorOptions, LabelGroup, type LabelGroupProps, type LabelProps, Link, LinkButton, type LinkButtonProps, type LinkProps, NavList, type NavListDividerProps, type NavListGroupHeadingProps, type NavListGroupProps, type NavListItemProps, type NavListLeadingVisualProps, type NavListProps, type NavListSubNavProps, type NavListTrailingVisualProps, Overlay, type OverlayProps, PageHeader, type ActionsProps as PageHeaderActionsProps, type ChildrenPropTypes as PageHeaderChildrenPropTypes, type PageHeaderProps, type TitleAreaProps as PageHeaderTitleAreaProps, type TitleProps as PageHeaderTitleProps, PageLayout, type PageLayoutContentProps, type PageLayoutFooterProps, type PageLayoutHeaderProps, type PageLayoutPaneProps, type PageLayoutProps, Pagination, type PaginationProps, _default$8 as Popover, type PopoverContentProps, type PopoverProps, Portal, PortalContext, type PortalProps, ProgressBar, type ProgressBarItemProps, type ProgressBarProps, _default$9 as Radio, _default$10 as RadioGroup, type RadioGroupProps, type RadioProps, RelativeTime, type RelativeTimeProps, type ResponsiveValue, SegmentedControl, type SegmentedControlButtonProps, type SegmentedControlIconButtonProps, type SegmentedControlProps, _default$11 as Select, SelectPanel, type GroupedListProps as SelectPanelGroupedListProps, type ItemInput as SelectPanelItemInput, type FilteredActionListItemProps as SelectPanelItemProps, type SelectPanelProps, type SelectProps, _default$12 as SideNav, type SideNavLinkProps, type SideNavProps, SkeletonBox, type SkeletonBoxProps, type SlotMarker, Spinner, type SpinnerProps, SplitPageLayout, type SplitPageLayoutContentProps, type SplitPageLayoutFooterProps, type SplitPageLayoutHeaderProps, type SplitPageLayoutPaneProps, type SplitPageLayoutProps, Stack, type StackItemProps, type StackProps, StateLabel, type StateLabelProps, _default$13 as SubNav, type SubNavLinkProps, type SubNavLinksProps, type SubNavProps, _default$14 as Text, _default$15 as TextInput, type TextInputActionProps, type TextInputProps, _default$16 as TextInputWithTokens, type TextInputWithTokensProps, type TextProps, _default$17 as Textarea, type TextareaProps, type ThemeColorPaths, ThemeProvider, type ThemeProviderProps, type ThemeShadowPaths, _default$18 as Timeline, type TimelineActionsProps, type TimelineAvatarProps, type TimelineBadgeProps, type TimelineBadgeVariant, type TimelineBodyProps, type TimelineBreakProps, type TimelineItemProps, type TimelineItemsProps, type TimelineProps, ToggleSwitch, type ToggleSwitchProps, Token, type TokenProps, Tooltip, type TooltipProps, type TouchOrMouseEvent, TreeView, type TreeViewErrorDialogProps, type TreeViewItemProps, type TreeViewProps, type TreeViewSubTreeProps, type TreeViewVisualProps, Truncate, type TruncateProps, UnderlineNav, type UnderlineNavItemProps, type UnderlineNavProps, VisuallyHidden, type VisuallyHiddenProps, type WithSlotMarker, asSlot, createComponent, isSlot, registerPortalRoot, theme, useAnchoredPosition, useColorSchemeVar, useConfirm, useDetails, useFocusTrap, useFocusZone, useFormControlForwardedProps, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnEscapePress, useOnOutsideClick, useOpenAndCloseFocus, useOverlay, useProvidedRefOrCreate, useRefObjectAsForwardedRef, useResizeObserver, useResponsiveValue, useRovingTabIndex, useSafeTimeout, useSlots, useSyncedState, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -27,8 +27,6 @@ import { ButtonComponent } from "./Button/Button.js";
|
|
|
27
27
|
import { useResponsiveValue } from "./hooks/useResponsiveValue.js";
|
|
28
28
|
import { isSlot } from "./utils/is-slot.js";
|
|
29
29
|
import { useSlots } from "./hooks/useSlots.js";
|
|
30
|
-
import { defaultPaneWidth, usePaneWidth } from "./PageLayout/usePaneWidth.js";
|
|
31
|
-
import { DragHandle } from "./PageLayout/DragHandle.js";
|
|
32
30
|
import { PageLayout } from "./PageLayout/PageLayout.js";
|
|
33
31
|
import { SplitPageLayout } from "./SplitPageLayout/SplitPageLayout.js";
|
|
34
32
|
import useDetails from "./hooks/useDetails.js";
|
|
@@ -94,4 +92,4 @@ import { TreeView } from "./TreeView/TreeView.js";
|
|
|
94
92
|
import { UnderlineNav } from "./UnderlineNav/index.js";
|
|
95
93
|
import { ActionBar } from "./ActionBar/index.js";
|
|
96
94
|
import { PageHeader } from "./PageHeader/PageHeader.js";
|
|
97
|
-
export { ActionBar, ActionList, ActionMenu, AnchoredOverlay, Autocomplete_default as Autocomplete, Avatar, AvatarStack, Banner, BaseStyles, BranchName_default as BranchName, Breadcrumb, Breadcrumbs_default as Breadcrumbs, ButtonComponent as Button, ButtonBase, ButtonGroup, Checkbox, CheckboxGroup_default as CheckboxGroup, CircleBadge_default as CircleBadge, ConfirmationDialog, CounterLabel, Details, Dialog,
|
|
95
|
+
export { ActionBar, ActionList, ActionMenu, AnchoredOverlay, Autocomplete_default as Autocomplete, Avatar, AvatarStack, Banner, BaseStyles, BranchName_default as BranchName, Breadcrumb, Breadcrumbs_default as Breadcrumbs, ButtonComponent as Button, ButtonBase, ButtonGroup, Checkbox, CheckboxGroup_default as CheckboxGroup, CircleBadge_default as CircleBadge, ConfirmationDialog, CounterLabel, Details, Dialog, Flash, FocusKeys, FormControl_default as FormControl, Header_default as Header, Heading, IconButton, IssueLabelToken, Label_default as Label, LabelGroup, Link, LinkButton, NavList, Overlay, PageHeader, PageLayout, Pagination_default as Pagination, Popover_default as Popover, Portal_default as Portal, PortalContext, ProgressBar, Radio, RadioGroup_default as RadioGroup, RelativeTime, SegmentedControl, Select_default as Select, SelectPanel, SideNav_default as SideNav, SkeletonBox, Spinner, SplitPageLayout, Stack, StateLabel, SubNav_default as SubNav, Text_default as Text, TextInput_default as TextInput, TextInputWithTokens, Textarea, ThemeProvider, Timeline_default as Timeline, ToggleSwitch, Token, Tooltip, TreeView, Truncate, UnderlineNav, VisuallyHidden, asSlot, createComponent, isSlot, registerPortalRoot, theme, useAnchoredPosition, useColorSchemeVar, useConfirm, useDetails, useFocusTrap, useFocusZone, useFormControlForwardedProps, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnEscapePress, useOnOutsideClick, useOpenAndCloseFocus, useOverlay, useProvidedRefOrCreate, useRefObjectAsForwardedRef, useResizeObserver, useResponsiveValue, useRovingTabIndex, useSafeTimeout, useSlots, useSyncedState, useTheme };
|
package/package.json
CHANGED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
//#region src/PageLayout/DragHandle.d.ts
|
|
4
|
-
type DragHandleProps = {
|
|
5
|
-
/** Ref for imperative ARIA updates during drag */handleRef: React.RefObject<HTMLDivElement>; /** Called once when drag starts with initial cursor X position */
|
|
6
|
-
onDragStart: (clientX: number) => void; /** Called on each drag tick with cursor position (pointer) or delta (keyboard) */
|
|
7
|
-
onDrag: (value: number, isKeyboard: boolean) => void; /** Called when drag operation completes */
|
|
8
|
-
onDragEnd: () => void; /** Reset width on double-click */
|
|
9
|
-
onDoubleClick?: React.MouseEventHandler<HTMLDivElement>; /** ARIA slider min value */
|
|
10
|
-
'aria-valuemin'?: number; /** ARIA slider max value */
|
|
11
|
-
'aria-valuemax'?: number; /** ARIA slider current value */
|
|
12
|
-
'aria-valuenow'?: number;
|
|
13
|
-
/**
|
|
14
|
-
* Ref to the element that receives drag-time styling/containment optimizations
|
|
15
|
-
* (e.g. the resizable pane). When omitted, those side effects are skipped.
|
|
16
|
-
*/
|
|
17
|
-
dragTargetRef?: React.RefObject<HTMLElement | null>;
|
|
18
|
-
/**
|
|
19
|
-
* Ref to a content wrapper element that receives drag-time containment.
|
|
20
|
-
* Only needed for layouts (like PageLayout) that optimize sibling content during drag.
|
|
21
|
-
*/
|
|
22
|
-
contentWrapperRef?: React.RefObject<HTMLElement | null>;
|
|
23
|
-
/**
|
|
24
|
-
* Formats the `aria-valuetext` announced for the current width.
|
|
25
|
-
* @default valueNow => `Pane width ${valueNow} pixels`
|
|
26
|
-
*/
|
|
27
|
-
formatValueText?: (valueNow: number) => string; /** Value for the `data-component` attribute. */
|
|
28
|
-
'data-component'?: string;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* DragHandle - handles all pointer and keyboard interactions for resizing.
|
|
32
|
-
* ARIA values are set in JSX for SSR accessibility, then updated via DOM
|
|
33
|
-
* manipulation during drag for performance. The consumer owns writing the width
|
|
34
|
-
* (via the `onDrag` callback); this component only reports interactions.
|
|
35
|
-
*/
|
|
36
|
-
declare const DragHandle: React.NamedExoticComponent<DragHandleProps>;
|
|
37
|
-
//#endregion
|
|
38
|
-
export { DragHandle, DragHandleProps };
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import PageLayout_module_css_default from "./PageLayout.module.css.js";
|
|
2
|
-
import { defaultFormatValueText } from "./usePaneWidth.js";
|
|
3
|
-
import { removeDraggingStyles, setDraggingStyles } from "./paneUtils.js";
|
|
4
|
-
import { c } from "react-compiler-runtime";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import React, { memo } from "react";
|
|
7
|
-
//#region src/PageLayout/DragHandle.tsx
|
|
8
|
-
const isArrowKey = (key) => key === "ArrowLeft" || key === "ArrowRight" || key === "ArrowUp" || key === "ArrowDown";
|
|
9
|
-
const isShrinkKey = (key) => key === "ArrowLeft" || key === "ArrowDown";
|
|
10
|
-
/**
|
|
11
|
-
* DragHandle - handles all pointer and keyboard interactions for resizing.
|
|
12
|
-
* ARIA values are set in JSX for SSR accessibility, then updated via DOM
|
|
13
|
-
* manipulation during drag for performance. The consumer owns writing the width
|
|
14
|
-
* (via the `onDrag` callback); this component only reports interactions.
|
|
15
|
-
*/
|
|
16
|
-
const DragHandle = /*#__PURE__*/ memo(function DragHandle(t0) {
|
|
17
|
-
const $ = c(39);
|
|
18
|
-
const { handleRef, onDragStart, onDrag, onDragEnd, onDoubleClick, "aria-valuemin": ariaValueMin, "aria-valuemax": ariaValueMax, "aria-valuenow": ariaValueNow, dragTargetRef, contentWrapperRef, formatValueText: t1, "data-component": t2 } = t0;
|
|
19
|
-
const formatValueText = t1 === void 0 ? defaultFormatValueText : t1;
|
|
20
|
-
const dataComponent = t2 === void 0 ? "PageLayout.DragHandle" : t2;
|
|
21
|
-
const stableOnDragStart = React.useRef(onDragStart);
|
|
22
|
-
const stableOnDrag = React.useRef(onDrag);
|
|
23
|
-
const stableOnDragEnd = React.useRef(onDragEnd);
|
|
24
|
-
let t3;
|
|
25
|
-
if ($[0] !== onDrag || $[1] !== onDragEnd || $[2] !== onDragStart) {
|
|
26
|
-
t3 = () => {
|
|
27
|
-
stableOnDragStart.current = onDragStart;
|
|
28
|
-
stableOnDrag.current = onDrag;
|
|
29
|
-
stableOnDragEnd.current = onDragEnd;
|
|
30
|
-
};
|
|
31
|
-
$[0] = onDrag;
|
|
32
|
-
$[1] = onDragEnd;
|
|
33
|
-
$[2] = onDragStart;
|
|
34
|
-
$[3] = t3;
|
|
35
|
-
} else t3 = $[3];
|
|
36
|
-
React.useEffect(t3);
|
|
37
|
-
const isDraggingRef = React.useRef(false);
|
|
38
|
-
let t4;
|
|
39
|
-
if ($[4] !== contentWrapperRef || $[5] !== dragTargetRef || $[6] !== handleRef) {
|
|
40
|
-
t4 = () => {
|
|
41
|
-
var _dragTargetRef$curren, _contentWrapperRef$cu;
|
|
42
|
-
if (isDraggingRef.current) return;
|
|
43
|
-
setDraggingStyles({
|
|
44
|
-
handle: handleRef.current,
|
|
45
|
-
pane: (_dragTargetRef$curren = dragTargetRef === null || dragTargetRef === void 0 ? void 0 : dragTargetRef.current) !== null && _dragTargetRef$curren !== void 0 ? _dragTargetRef$curren : null,
|
|
46
|
-
contentWrapper: (_contentWrapperRef$cu = contentWrapperRef === null || contentWrapperRef === void 0 ? void 0 : contentWrapperRef.current) !== null && _contentWrapperRef$cu !== void 0 ? _contentWrapperRef$cu : null
|
|
47
|
-
});
|
|
48
|
-
isDraggingRef.current = true;
|
|
49
|
-
};
|
|
50
|
-
$[4] = contentWrapperRef;
|
|
51
|
-
$[5] = dragTargetRef;
|
|
52
|
-
$[6] = handleRef;
|
|
53
|
-
$[7] = t4;
|
|
54
|
-
} else t4 = $[7];
|
|
55
|
-
const startDragging = t4;
|
|
56
|
-
let t5;
|
|
57
|
-
if ($[8] !== contentWrapperRef || $[9] !== dragTargetRef || $[10] !== handleRef) {
|
|
58
|
-
t5 = () => {
|
|
59
|
-
var _dragTargetRef$curren2, _contentWrapperRef$cu2;
|
|
60
|
-
if (!isDraggingRef.current) return;
|
|
61
|
-
removeDraggingStyles({
|
|
62
|
-
handle: handleRef.current,
|
|
63
|
-
pane: (_dragTargetRef$curren2 = dragTargetRef === null || dragTargetRef === void 0 ? void 0 : dragTargetRef.current) !== null && _dragTargetRef$curren2 !== void 0 ? _dragTargetRef$curren2 : null,
|
|
64
|
-
contentWrapper: (_contentWrapperRef$cu2 = contentWrapperRef === null || contentWrapperRef === void 0 ? void 0 : contentWrapperRef.current) !== null && _contentWrapperRef$cu2 !== void 0 ? _contentWrapperRef$cu2 : null
|
|
65
|
-
});
|
|
66
|
-
isDraggingRef.current = false;
|
|
67
|
-
};
|
|
68
|
-
$[8] = contentWrapperRef;
|
|
69
|
-
$[9] = dragTargetRef;
|
|
70
|
-
$[10] = handleRef;
|
|
71
|
-
$[11] = t5;
|
|
72
|
-
} else t5 = $[11];
|
|
73
|
-
const endDragging = t5;
|
|
74
|
-
let t6;
|
|
75
|
-
if ($[12] !== startDragging) {
|
|
76
|
-
t6 = (event) => {
|
|
77
|
-
if (event.button !== 0) return;
|
|
78
|
-
event.preventDefault();
|
|
79
|
-
const target = event.currentTarget;
|
|
80
|
-
try {
|
|
81
|
-
target.setPointerCapture(event.pointerId);
|
|
82
|
-
} catch {}
|
|
83
|
-
stableOnDragStart.current(event.clientX);
|
|
84
|
-
startDragging();
|
|
85
|
-
};
|
|
86
|
-
$[12] = startDragging;
|
|
87
|
-
$[13] = t6;
|
|
88
|
-
} else t6 = $[13];
|
|
89
|
-
const handlePointerDown = t6;
|
|
90
|
-
const rafIdRef = React.useRef(null);
|
|
91
|
-
const pendingClientXRef = React.useRef(null);
|
|
92
|
-
let t7;
|
|
93
|
-
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
94
|
-
t7 = (event_0) => {
|
|
95
|
-
if (!isDraggingRef.current) return;
|
|
96
|
-
event_0.preventDefault();
|
|
97
|
-
pendingClientXRef.current = event_0.clientX;
|
|
98
|
-
if (rafIdRef.current === null) rafIdRef.current = requestAnimationFrame(() => {
|
|
99
|
-
rafIdRef.current = null;
|
|
100
|
-
if (pendingClientXRef.current !== null) {
|
|
101
|
-
stableOnDrag.current(pendingClientXRef.current, false);
|
|
102
|
-
pendingClientXRef.current = null;
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
$[14] = t7;
|
|
107
|
-
} else t7 = $[14];
|
|
108
|
-
const handlePointerMove = t7;
|
|
109
|
-
let t8;
|
|
110
|
-
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
111
|
-
t8 = (event_1) => {
|
|
112
|
-
if (!isDraggingRef.current) return;
|
|
113
|
-
event_1.preventDefault();
|
|
114
|
-
};
|
|
115
|
-
$[15] = t8;
|
|
116
|
-
} else t8 = $[15];
|
|
117
|
-
const handlePointerUp = t8;
|
|
118
|
-
let t9;
|
|
119
|
-
if ($[16] !== endDragging) {
|
|
120
|
-
t9 = () => {
|
|
121
|
-
if (!isDraggingRef.current) return;
|
|
122
|
-
if (rafIdRef.current !== null) {
|
|
123
|
-
cancelAnimationFrame(rafIdRef.current);
|
|
124
|
-
rafIdRef.current = null;
|
|
125
|
-
pendingClientXRef.current = null;
|
|
126
|
-
}
|
|
127
|
-
endDragging();
|
|
128
|
-
stableOnDragEnd.current();
|
|
129
|
-
};
|
|
130
|
-
$[16] = endDragging;
|
|
131
|
-
$[17] = t9;
|
|
132
|
-
} else t9 = $[17];
|
|
133
|
-
const handleLostPointerCapture = t9;
|
|
134
|
-
let t10;
|
|
135
|
-
if ($[18] !== startDragging) {
|
|
136
|
-
t10 = (event_2) => {
|
|
137
|
-
if (!isArrowKey(event_2.key)) return;
|
|
138
|
-
event_2.preventDefault();
|
|
139
|
-
const delta = isShrinkKey(event_2.key) ? -3 : 3;
|
|
140
|
-
if (!isDraggingRef.current) startDragging();
|
|
141
|
-
stableOnDrag.current(delta, true);
|
|
142
|
-
};
|
|
143
|
-
$[18] = startDragging;
|
|
144
|
-
$[19] = t10;
|
|
145
|
-
} else t10 = $[19];
|
|
146
|
-
const handleKeyDown = t10;
|
|
147
|
-
let t11;
|
|
148
|
-
if ($[20] !== endDragging) {
|
|
149
|
-
t11 = (event_3) => {
|
|
150
|
-
if (!isArrowKey(event_3.key)) return;
|
|
151
|
-
event_3.preventDefault();
|
|
152
|
-
endDragging();
|
|
153
|
-
stableOnDragEnd.current();
|
|
154
|
-
};
|
|
155
|
-
$[20] = endDragging;
|
|
156
|
-
$[21] = t11;
|
|
157
|
-
} else t11 = $[21];
|
|
158
|
-
const handleKeyUp = t11;
|
|
159
|
-
let t12;
|
|
160
|
-
let t13;
|
|
161
|
-
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
162
|
-
t12 = () => () => {
|
|
163
|
-
if (rafIdRef.current !== null) {
|
|
164
|
-
cancelAnimationFrame(rafIdRef.current);
|
|
165
|
-
rafIdRef.current = null;
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
t13 = [];
|
|
169
|
-
$[22] = t12;
|
|
170
|
-
$[23] = t13;
|
|
171
|
-
} else {
|
|
172
|
-
t12 = $[22];
|
|
173
|
-
t13 = $[23];
|
|
174
|
-
}
|
|
175
|
-
React.useEffect(t12, t13);
|
|
176
|
-
let t14;
|
|
177
|
-
if ($[24] !== ariaValueNow || $[25] !== formatValueText) {
|
|
178
|
-
t14 = ariaValueNow !== void 0 ? formatValueText(ariaValueNow) : void 0;
|
|
179
|
-
$[24] = ariaValueNow;
|
|
180
|
-
$[25] = formatValueText;
|
|
181
|
-
$[26] = t14;
|
|
182
|
-
} else t14 = $[26];
|
|
183
|
-
let t15;
|
|
184
|
-
if ($[27] !== ariaValueMax || $[28] !== ariaValueMin || $[29] !== ariaValueNow || $[30] !== dataComponent || $[31] !== handleKeyDown || $[32] !== handleKeyUp || $[33] !== handleLostPointerCapture || $[34] !== handlePointerDown || $[35] !== handleRef || $[36] !== onDoubleClick || $[37] !== t14) {
|
|
185
|
-
t15 = /*#__PURE__*/ jsx("div", {
|
|
186
|
-
ref: handleRef,
|
|
187
|
-
className: PageLayout_module_css_default.DraggableHandle,
|
|
188
|
-
"data-component": dataComponent,
|
|
189
|
-
role: "slider",
|
|
190
|
-
"aria-label": "Draggable pane splitter",
|
|
191
|
-
"aria-valuemin": ariaValueMin,
|
|
192
|
-
"aria-valuemax": ariaValueMax,
|
|
193
|
-
"aria-valuenow": ariaValueNow,
|
|
194
|
-
"aria-valuetext": t14,
|
|
195
|
-
tabIndex: 0,
|
|
196
|
-
onPointerDown: handlePointerDown,
|
|
197
|
-
onPointerMove: handlePointerMove,
|
|
198
|
-
onPointerUp: handlePointerUp,
|
|
199
|
-
onLostPointerCapture: handleLostPointerCapture,
|
|
200
|
-
onKeyDown: handleKeyDown,
|
|
201
|
-
onKeyUp: handleKeyUp,
|
|
202
|
-
onDoubleClick
|
|
203
|
-
});
|
|
204
|
-
$[27] = ariaValueMax;
|
|
205
|
-
$[28] = ariaValueMin;
|
|
206
|
-
$[29] = ariaValueNow;
|
|
207
|
-
$[30] = dataComponent;
|
|
208
|
-
$[31] = handleKeyDown;
|
|
209
|
-
$[32] = handleKeyUp;
|
|
210
|
-
$[33] = handleLostPointerCapture;
|
|
211
|
-
$[34] = handlePointerDown;
|
|
212
|
-
$[35] = handleRef;
|
|
213
|
-
$[36] = onDoubleClick;
|
|
214
|
-
$[37] = t14;
|
|
215
|
-
$[38] = t15;
|
|
216
|
-
} else t15 = $[38];
|
|
217
|
-
return t15;
|
|
218
|
-
});
|
|
219
|
-
//#endregion
|
|
220
|
-
export { DragHandle };
|