@primer/react 0.0.0-20260714202217 → 0.0.0-20260715113945
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 +15 -3
- package/dist/ActionBar/ActionBar-3767d551.css +2 -0
- package/dist/ActionBar/ActionBar-3767d551.css.map +1 -0
- package/dist/ActionBar/ActionBar.js +1 -1
- package/dist/ActionBar/ActionBar.module.css.js +1 -1
- package/dist/ActionList/Group.js +2 -2
- package/dist/ActionList/Item.js +1 -1
- package/dist/ActionList/List.js +11 -17
- package/dist/ActionMenu/ActionMenu.js +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +5 -10
- package/dist/Autocomplete/AutocompleteInput.js +7 -10
- package/dist/Autocomplete/AutocompleteMenu.js +3 -2
- package/dist/Breadcrumbs/Breadcrumbs.js +4 -1
- package/dist/ButtonGroup/ButtonGroup.js +5 -12
- package/dist/Checkbox/Checkbox.js +3 -10
- package/dist/Dialog/Dialog.js +3 -10
- package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -2
- package/dist/FilteredActionList/FilteredActionList.js +4 -15
- package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
- package/dist/FilteredActionList/useAnnouncements.js +20 -14
- package/dist/LabelGroup/LabelGroup-db41f443.css +2 -0
- package/dist/LabelGroup/LabelGroup-db41f443.css.map +1 -0
- package/dist/LabelGroup/LabelGroup.module.css.js +1 -1
- package/dist/NavList/NavList.js +1 -1
- package/dist/Overlay/Overlay.js +1 -1
- package/dist/PageHeader/PageHeader.js +10 -19
- package/dist/PageLayout/PageLayout.js +1 -1
- package/dist/SelectPanel/SelectPanel.js +1 -1
- package/dist/TextInput/TextInput.js +3 -10
- package/dist/TextInputWithTokens/TextInputWithTokens.js +1 -1
- package/dist/TooltipV2/Tooltip.js +4 -10
- package/dist/TreeView/TreeView.js +6 -3
- package/dist/experimental/SelectPanel2/SelectPanel.js +2 -2
- package/dist/experimental/Tabs/types.d.ts +2 -2
- package/dist/experimental/Tabs/useTabList.js +7 -15
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +1 -1
- package/dist/experimental/index.js +4 -4
- package/dist/hooks/useAnchoredPosition.js +14 -1
- package/dist/hooks/useDialog.js +2 -1
- package/dist/hooks/useMergedRefs.js +1 -4
- package/dist/hooks/useProvidedRefOrCreate.d.ts +10 -7
- package/dist/hooks/useProvidedRefOrCreate.js +10 -7
- package/dist/hooks/useScrollFlash.js +2 -1
- package/dist/index.js +4 -4
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +1 -1
- package/dist/internal/components/UnderlineTabbedInterface-70ae932b.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-70ae932b.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/utils/warning.js +3 -2
- package/package.json +2 -2
- package/dist/ActionBar/ActionBar-e63def3c.css +0 -2
- package/dist/ActionBar/ActionBar-e63def3c.css.map +0 -1
- package/dist/LabelGroup/LabelGroup-7d19205a.css +0 -2
- package/dist/LabelGroup/LabelGroup-7d19205a.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260715113945
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#8064](https://github.com/primer/react/pull/8064) [`eb447fe`](https://github.com/primer/react/commit/eb447fef0f1565934dc38d09df21d8063957aa9d) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Update the ActionBar overflow menu anchor label to `More items`
|
|
8
|
+
|
|
9
|
+
- [#8166](https://github.com/primer/react/pull/8166) [`46e4d47`](https://github.com/primer/react/commit/46e4d4749f07526477df1cb96015c3bfbb0323fd) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Add `contain: layout` to high-churn overflow containers (`ActionBar`, `UnderlineNav`, `UnderlinePanels`, and `LabelGroup`) so their frequent reflows no longer invalidate ancestor layout.
|
|
10
|
+
|
|
11
|
+
- Fake entry to force publishing
|
|
12
|
+
|
|
13
|
+
- [#8116](https://github.com/primer/react/pull/8116) [`cade4af`](https://github.com/primer/react/commit/cade4af9a70f3fd2622031af585dc07dccd79e11) Thanks [@mattcosta7](https://github.com/mattcosta7)! - `useAnchoredPosition`: improve performance by caching the scrollable-ancestor walk per anchor, reducing repositioning work for overlays, menus, and tooltips.
|
|
14
|
+
|
|
15
|
+
- [#8164](https://github.com/primer/react/pull/8164) [`f86e5a6`](https://github.com/primer/react/commit/f86e5a6420e857e7476c3954d419f4e228bdcf1a) Thanks [@jonrohan](https://github.com/jonrohan)! - Fix `UnderlineNav` tab list not filling the full width of the underline nav in Safari
|
|
16
|
+
|
|
17
|
+
## 38.32.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
6
20
|
|
|
@@ -19,8 +33,6 @@
|
|
|
19
33
|
|
|
20
34
|
### Patch Changes
|
|
21
35
|
|
|
22
|
-
- Fake entry to force publishing
|
|
23
|
-
|
|
24
36
|
- [#7901](https://github.com/primer/react/pull/7901) [`8288ed9`](https://github.com/primer/react/commit/8288ed9d88668f93cf3b1eb70ee61edac6217367) Thanks [@mattcosta7](https://github.com/mattcosta7)! - PageHeader: improve rendering performance by removing expensive `:has()` selectors. No visual or API changes.
|
|
25
37
|
|
|
26
38
|
- [#8115](https://github.com/primer/react/pull/8115) [`07c530a`](https://github.com/primer/react/commit/07c530a1686ef16b68b2f2fe692b7a3327bdc02b) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Improve rendering performance in Safari by removing expensive `:has()` selectors from ActionList/NavList, Breadcrumbs, SelectPanel, and SegmentedControl. No visual or API changes.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-ActionBar-List-9uz46{align-items:flex-start;animation:prc-ActionBar-detect-overflow-mAuJu linear;display:flex;gap:var(--actionbar-gap,var(--stack-gap-condensed,.5rem));height:var(--actionbar-height,var(--control-small-size,1.75rem));list-style:none;margin-bottom:-1px;min-width:0;overflow:hidden;position:relative;animation-timeline:scroll(self block);contain:layout}.prc-ActionBar-List-9uz46[data-has-overflow=true]{--morebutton-display:flex}.prc-ActionBar-List-9uz46:where([data-size=small]){--actionbar-height:var(--control-small-size,1.75rem)}.prc-ActionBar-List-9uz46:where([data-size=medium]){--actionbar-height:var(--control-medium-size,2rem)}.prc-ActionBar-List-9uz46:where([data-size=large]){--actionbar-height:var(--control-large-size,2.5rem)}.prc-ActionBar-List-9uz46:where([data-gap=none]){--actionbar-gap:0}.prc-ActionBar-List-9uz46:where([data-gap=none]) .prc-ActionBar-Divider-6V8yH{padding:0 var(--base-size-8,.5rem)}.prc-ActionBar-List-9uz46:where([data-gap=condensed]){--actionbar-gap:var(--stack-gap-condensed,0.5rem)}.prc-ActionBar-List-9uz46 [data-overflowing]{visibility:hidden!important}@keyframes prc-ActionBar-detect-overflow-mAuJu{0%,to{--morebutton-display:flex}}.prc-ActionBar-Nav-9spON{align-items:center;display:flex;justify-content:flex-end;padding-inline:var(--base-size-16,1rem)}.prc-ActionBar-Nav-9spON:where([data-flush=true]){padding-inline:0}.prc-ActionBar-Divider-6V8yH:before{background:var(--borderColor-muted,#d1d9e0b3);content:"";display:block;height:var(--base-size-20,1.25rem);margin-top:calc((var(--actionbar-height) - var(--base-size-20,1.25rem))/2);width:var(--borderWidth-thin,.0625rem)}.prc-ActionBar-Group-peNCk,.prc-ActionBar-OverflowContainer-AkYZs{display:flex;gap:inherit}.prc-ActionBar-OverflowContainer-AkYZs{contain:layout;flex-wrap:wrap;justify-content:flex-end;overflow:hidden}.prc-ActionBar-OverflowContainer-AkYZs .prc-ActionBar-OverflowSpacer-tbHkV{height:var(--actionbar-height)}.prc-ActionBar-MoreButton-RHqpx{display:var(--morebutton-display,none)}
|
|
2
|
+
/*# sourceMappingURL=ActionBar-3767d551.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ActionBar/ActionBar.module.css.js"],"names":[],"mappings":"AAAA,0BASE,sBAAuB,CASvB,oDAAiC,CAhBjC,YAAa,CAQb,yDAAqD,CAGrD,gEAA0D,CAL1D,eAAgB,CADhB,kBAAmB,CAJnB,WAAY,CAQZ,eAAgB,CAVhB,iBAAkB,CAkBlB,qCAAsC,CAKtC,cAsCF,CAnCE,kDACE,yBACF,CAEA,mDACE,oDACF,CAEA,oDACE,kDACF,CAEA,mDACE,mDACF,CAGA,iDACE,iBAKF,CAHE,8EACE,kCACF,CAGF,sDACE,iDACF,CAEA,6CAIE,2BACF,CAGF,+CACE,MAEE,yBACF,CACF,CAEA,yBAIE,kBAAmB,CAHnB,YAAa,CAEb,wBAAyB,CADzB,uCAOF,CAHE,kDACE,gBACF,CAIA,oCAME,6CAAoC,CAFpC,UAAW,CAHX,aAAc,CAEd,kCAA2B,CAK3B,0EAAqE,CANrE,sCAOF,CAQF,kEAJE,YAAa,CACb,WAgBF,CAbA,uCAQE,cAAe,CANf,cAAe,CAEf,wBAAyB,CACzB,eAQF,CAHE,2EACE,8BACF,CAGF,gCACE,sCACF","file":"ActionBar-3767d551.css","sourcesContent":[".List {\n position: relative;\n display: flex;\n min-width: 0;\n\n /* wonder why this is here */\n /* stylelint-disable-next-line primer/spacing */\n margin-bottom: -1px;\n list-style: none;\n align-items: flex-start;\n gap: var(--actionbar-gap, var(--stack-gap-condensed));\n overflow: hidden;\n /* Explicit height is required to clip wrapped items */\n height: var(--actionbar-height, var(--control-small-size));\n\n /* Scroll-based animations have no effect unless the container is scrollable (has overflow, even with overflow:hidden)\n so we can use them to detect overflow. It would be cleaner to use scroll-state container queries for this, but\n browser support for scroll-driven animations is slightly better. */\n animation: detect-overflow linear;\n animation-timeline: scroll(self block);\n\n /* Isolate the frequent overflow-driven reflows (JS visibility toggling + item wrapping) so they\n can't invalidate ancestor layout. Safe because the list already clips (overflow: hidden) and the\n More menu is portaled, so it isn't affected by the new containing block/stacking context. */\n contain: layout;\n\n /* After initial render, JS is used to control visibility which provides progressive enhancement for unsupported browsers */\n &[data-has-overflow='true'] {\n --morebutton-display: flex;\n }\n\n &:where([data-size='small']) {\n --actionbar-height: var(--control-small-size);\n }\n\n &:where([data-size='medium']) {\n --actionbar-height: var(--control-medium-size);\n }\n\n &:where([data-size='large']) {\n --actionbar-height: var(--control-large-size);\n }\n\n /* Gap scale (mirrors Stack) */\n &:where([data-gap='none']) {\n --actionbar-gap: 0;\n\n .Divider {\n padding: 0 var(--base-size-8);\n }\n }\n\n &:where([data-gap='condensed']) {\n --actionbar-gap: var(--stack-gap-condensed);\n }\n\n & [data-overflowing] {\n /* Hide overflowing items. Even though they are clipped by `overflow: hidden`, setting `visibility: hidden` ensures\n they can't accidentally be shown and also hides them from screen readers / keyboard nav. `!important` prevents\n consumers from unintentionally overriding this and breaking accessibility. */\n visibility: hidden !important;\n }\n}\n\n@keyframes detect-overflow {\n 0%,\n 100% {\n --morebutton-display: flex;\n }\n}\n\n.Nav {\n display: flex;\n padding-inline: var(--base-size-16);\n justify-content: flex-end;\n align-items: center;\n\n &:where([data-flush='true']) {\n padding-inline: 0;\n }\n}\n\n.Divider {\n &::before {\n display: block;\n width: var(--borderWidth-thin);\n height: var(--base-size-20);\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background: var(--borderColor-muted);\n /* stylelint-disable-next-line primer/spacing */\n margin-top: calc((var(--actionbar-height) - var(--base-size-20)) / 2);\n }\n}\n\n.Group {\n display: flex;\n gap: inherit;\n}\n\n.OverflowContainer {\n display: flex;\n flex-wrap: wrap;\n gap: inherit;\n justify-content: flex-end;\n overflow: hidden;\n\n /* Contain the wrap/measure reflows to this subtree. */\n contain: layout;\n\n .OverflowSpacer {\n height: var(--actionbar-height);\n }\n}\n\n.MoreButton {\n display: var(--morebutton-display, none);\n}\n"]}
|
|
@@ -74,7 +74,7 @@ const ActionBar = ({ size = "medium", children, "aria-label": ariaLabel, "aria-l
|
|
|
74
74
|
})]
|
|
75
75
|
}), /*#__PURE__*/ jsxs(ActionMenu, { children: [/*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
|
|
76
76
|
variant: "invisible",
|
|
77
|
-
"aria-label":
|
|
77
|
+
"aria-label": "More items",
|
|
78
78
|
icon: KebabHorizontalIcon,
|
|
79
79
|
className: ActionBar_module_css_default.MoreButton,
|
|
80
80
|
"data-more-button-inactive": overflowItems !== null && overflowItems !== void 0 && overflowItems.length ? void 0 : true,
|
package/dist/ActionList/Group.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
2
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
3
|
-
import { invariant } from "../utils/invariant.js";
|
|
4
2
|
import { useSlots } from "../hooks/useSlots.js";
|
|
3
|
+
import { invariant } from "../utils/invariant.js";
|
|
5
4
|
import { ListContext } from "./shared.js";
|
|
6
5
|
import ActionList_module_css_default from "./ActionList.module.css.js";
|
|
6
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
7
7
|
import Group_module_css_default from "./Group.module.css.js";
|
|
8
8
|
import { GroupHeadingTrailingAction } from "./GroupHeadingTrailingAction.js";
|
|
9
9
|
import { GroupContext } from "./GroupContext.js";
|
package/dist/ActionList/Item.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
2
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
2
3
|
import { ConditionalWrapper } from "../internal/components/ConditionalWrapper.js";
|
|
3
4
|
import { invariant } from "../utils/invariant.js";
|
|
4
5
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
5
6
|
import VisuallyHidden from "../_VisuallyHidden.js";
|
|
6
7
|
import { TooltipContext } from "../TooltipV2/TooltipContext.js";
|
|
7
8
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
8
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
9
9
|
import { ActionListContainerContext } from "./ActionListContainerContext.js";
|
|
10
10
|
import { ItemContext, ListContext } from "./shared.js";
|
|
11
11
|
import ActionList_module_css_default from "./ActionList.module.css.js";
|
package/dist/ActionList/List.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
1
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
2
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
4
3
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
5
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
6
|
-
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
7
4
|
import { useSlots } from "../hooks/useSlots.js";
|
|
5
|
+
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
8
6
|
import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
|
|
9
7
|
import { ActionListContainerContext } from "./ActionListContainerContext.js";
|
|
10
8
|
import { ListContext } from "./shared.js";
|
|
11
9
|
import { Heading } from "./Heading.js";
|
|
12
10
|
import ActionList_module_css_default from "./ActionList.module.css.js";
|
|
11
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
13
12
|
import { c } from "react-compiler-runtime";
|
|
14
13
|
import { clsx } from "clsx";
|
|
15
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
-
import React
|
|
15
|
+
import React from "react";
|
|
17
16
|
//#region src/ActionList/List.tsx
|
|
18
17
|
const UnwrappedList = (props, forwardedRef) => {
|
|
19
18
|
var _slots$heading$props$;
|
|
@@ -61,12 +60,7 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
61
60
|
const { listRole: listRoleFromContainer, listLabelledBy, selectionVariant: containerSelectionVariant, enableFocusZone: enableFocusZoneFromContainer, container } = React.useContext(ActionListContainerContext);
|
|
62
61
|
const ariaLabelledBy = slots.heading ? (_slots$heading$props$ = slots.heading.props.id) !== null && _slots$heading$props$ !== void 0 ? _slots$heading$props$ : headingId : listLabelledBy;
|
|
63
62
|
const listRole = role || listRoleFromContainer;
|
|
64
|
-
const
|
|
65
|
-
const internalRef = useRef(null);
|
|
66
|
-
const mergedRef = useMergedRefs(forwardedRef, internalRef);
|
|
67
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
|
|
68
|
-
const listRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
|
|
69
|
-
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
63
|
+
const listRef = useProvidedRefOrCreate(forwardedRef);
|
|
70
64
|
const itemGapEnabled = useFeatureFlag("primer_react_action_list_item_gap") && container === "NavList";
|
|
71
65
|
let enableFocusZone = false;
|
|
72
66
|
if (enableFocusZoneFromContainer !== void 0) enableFocusZone = enableFocusZoneFromContainer;
|
|
@@ -117,7 +111,7 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
117
111
|
} else t9 = $[20];
|
|
118
112
|
const listContextValue = t9;
|
|
119
113
|
let t10;
|
|
120
|
-
if ($[21] !== listRef
|
|
114
|
+
if ($[21] !== listRef) {
|
|
121
115
|
t10 = () => {
|
|
122
116
|
const list = listRef.current;
|
|
123
117
|
if (!list) return;
|
|
@@ -126,7 +120,7 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
126
120
|
if (hasMixed && current !== "true") list.setAttribute("data-mixed-descriptions", "true");
|
|
127
121
|
else if (!hasMixed && current !== null) list.removeAttribute("data-mixed-descriptions");
|
|
128
122
|
};
|
|
129
|
-
$[21] = listRef
|
|
123
|
+
$[21] = listRef;
|
|
130
124
|
$[22] = t10;
|
|
131
125
|
} else t10 = $[22];
|
|
132
126
|
useIsomorphicLayoutEffect(t10);
|
|
@@ -139,12 +133,12 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
139
133
|
} else t12 = $[24];
|
|
140
134
|
const t13 = itemGapEnabled ? "" : void 0;
|
|
141
135
|
let t14;
|
|
142
|
-
if ($[25] !== Component || $[26] !==
|
|
136
|
+
if ($[25] !== Component || $[26] !== ariaLabelledBy || $[27] !== childrenWithoutSlots || $[28] !== listRef || $[29] !== listRole || $[30] !== restProps || $[31] !== showDividers || $[32] !== t12 || $[33] !== t13 || $[34] !== variant) {
|
|
143
137
|
t14 = /*#__PURE__*/ jsx(Component, {
|
|
144
138
|
className: t12,
|
|
145
139
|
role: listRole,
|
|
146
140
|
"aria-labelledby": ariaLabelledBy,
|
|
147
|
-
ref:
|
|
141
|
+
ref: listRef,
|
|
148
142
|
"data-component": "ActionList",
|
|
149
143
|
"data-dividers": showDividers,
|
|
150
144
|
"data-variant": variant,
|
|
@@ -153,9 +147,9 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
153
147
|
children: childrenWithoutSlots
|
|
154
148
|
});
|
|
155
149
|
$[25] = Component;
|
|
156
|
-
$[26] =
|
|
157
|
-
$[27] =
|
|
158
|
-
$[28] =
|
|
150
|
+
$[26] = ariaLabelledBy;
|
|
151
|
+
$[27] = childrenWithoutSlots;
|
|
152
|
+
$[28] = listRef;
|
|
159
153
|
$[29] = listRole;
|
|
160
154
|
$[30] = restProps;
|
|
161
155
|
$[31] = showDividers;
|
|
@@ -2,10 +2,10 @@ import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
|
2
2
|
import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
|
|
3
3
|
import { useMenuKeyboardNavigation } from "../hooks/useMenuKeyboardNavigation.js";
|
|
4
4
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
5
|
+
import { isSlot } from "../utils/is-slot.js";
|
|
5
6
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
6
7
|
import { ButtonComponent } from "../Button/Button.js";
|
|
7
8
|
import { useResponsiveValue } from "../hooks/useResponsiveValue.js";
|
|
8
|
-
import { isSlot } from "../utils/is-slot.js";
|
|
9
9
|
import { DialogContext } from "../Dialog/DialogContext.js";
|
|
10
10
|
import { ActionListContainerContext } from "../ActionList/ActionListContainerContext.js";
|
|
11
11
|
import { Divider } from "../ActionList/Divider.js";
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { reactMajorVersion } from "../utils/environment.js";
|
|
2
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
3
2
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
4
3
|
import { useAnchoredPosition } from "../hooks/useAnchoredPosition.js";
|
|
5
4
|
import { useRenderForcingRef } from "../hooks/useRenderForcingRef.js";
|
|
6
5
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
7
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
8
6
|
import { IconButton } from "../Button/IconButton.js";
|
|
9
7
|
import { useFocusTrap } from "../hooks/useFocusTrap.js";
|
|
10
8
|
import { useFocusZone } from "../hooks/useFocusZone.js";
|
|
9
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
11
10
|
import Overlay from "../Overlay/Overlay.js";
|
|
12
11
|
import AnchoredOverlay_module_css_default from "./AnchoredOverlay.module.css.js";
|
|
13
12
|
import { widthMap } from "../Overlay/constants.js";
|
|
@@ -34,8 +33,6 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
34
33
|
const [anchorElement, setAnchorElement] = useState(null);
|
|
35
34
|
if (anchorRef.current !== anchorElement) setAnchorElement(anchorRef.current);
|
|
36
35
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
|
37
|
-
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
38
|
-
const mergedOverlayRef = useMergedRefs(updateOverlayRef, overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.ref);
|
|
39
36
|
const [overlayElement, setOverlayElement] = useState(null);
|
|
40
37
|
const anchorId = useId$1(externalAnchorId);
|
|
41
38
|
const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose("click-outside"), [onClose]);
|
|
@@ -125,7 +122,8 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
125
122
|
else currentOverlay.style.removeProperty("position-try-fallbacks");
|
|
126
123
|
pendingPositionFrame = requestAnimationFrame(() => {
|
|
127
124
|
pendingPositionFrame = null;
|
|
128
|
-
const
|
|
125
|
+
const fallbackWidth = width ? parseInt(widthMap[width]) : parseInt(widthMap.small);
|
|
126
|
+
const result = getDefaultPosition(anchorElement, currentOverlay, fallbackWidth);
|
|
129
127
|
currentOverlay.setAttribute("data-align", result.horizontal);
|
|
130
128
|
if (result.suggestedSide) currentOverlay.setAttribute("data-side", result.suggestedSide);
|
|
131
129
|
const offset = result.horizontal === "left" ? result.leftOffset : result.rightOffset;
|
|
@@ -193,12 +191,9 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
193
191
|
...restOverlayProps,
|
|
194
192
|
...shouldRenderAsPopover ? { id: popoverId } : {},
|
|
195
193
|
ref: (node) => {
|
|
194
|
+
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
|
|
195
|
+
updateOverlayRef(node);
|
|
196
196
|
setOverlayElement(node);
|
|
197
|
-
if (mergedRefEnabled) assignRef(mergedOverlayRef, node);
|
|
198
|
-
else {
|
|
199
|
-
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
|
|
200
|
-
updateOverlayRef(node);
|
|
201
|
-
}
|
|
202
197
|
},
|
|
203
198
|
"data-anchor-position": cssAnchorPositioning,
|
|
204
199
|
"data-side": cssAnchorPositioning ? side : position === null || position === void 0 ? void 0 : position.anchorSide,
|
|
@@ -20,11 +20,9 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
|
|
|
20
20
|
if (openOnFocus) setShowMenu(true);
|
|
21
21
|
};
|
|
22
22
|
const handleInputBlur = useCallback((event) => {
|
|
23
|
-
onBlur
|
|
23
|
+
onBlur && onBlur(event);
|
|
24
24
|
safeSetTimeout(() => {
|
|
25
|
-
|
|
26
|
-
const menuElement = document.getElementById(`${id}-listbox`);
|
|
27
|
-
if (!nextFocusedElement || nextFocusedElement !== menuElement && !(menuElement !== null && menuElement !== void 0 && menuElement.contains(nextFocusedElement))) {
|
|
25
|
+
if (document.activeElement !== inputRef.current) {
|
|
28
26
|
setShowMenu(false);
|
|
29
27
|
if (inputRef.current && autocompleteSuggestion && inputRef.current.value !== inputValue) inputRef.current.value = inputValue;
|
|
30
28
|
}
|
|
@@ -35,17 +33,16 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
|
|
|
35
33
|
inputRef,
|
|
36
34
|
safeSetTimeout,
|
|
37
35
|
autocompleteSuggestion,
|
|
38
|
-
inputValue
|
|
39
|
-
id
|
|
36
|
+
inputValue
|
|
40
37
|
]);
|
|
41
38
|
const handleInputChange = (event) => {
|
|
42
|
-
onChange
|
|
39
|
+
onChange && onChange(event);
|
|
43
40
|
setInputValue(event.currentTarget.value);
|
|
44
41
|
if (!showMenu) setShowMenu(true);
|
|
45
42
|
};
|
|
46
43
|
const handleInputKeyDown = useCallback((event) => {
|
|
47
44
|
var _inputRef$current;
|
|
48
|
-
onKeyDown
|
|
45
|
+
onKeyDown && onKeyDown(event);
|
|
49
46
|
if (event.key === "Backspace") setHighlightRemainingText(false);
|
|
50
47
|
if (event.key === "Escape" && (_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.value) {
|
|
51
48
|
setInputValue("");
|
|
@@ -61,11 +58,11 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
|
|
|
61
58
|
setShowMenu
|
|
62
59
|
]);
|
|
63
60
|
const handleInputKeyUp = useCallback((event) => {
|
|
64
|
-
onKeyUp
|
|
61
|
+
onKeyUp && onKeyUp(event);
|
|
65
62
|
if (event.key === "Backspace") setHighlightRemainingText(true);
|
|
66
63
|
}, [setHighlightRemainingText, onKeyUp]);
|
|
67
64
|
const onInputKeyPress = useCallback((event) => {
|
|
68
|
-
onKeyPress
|
|
65
|
+
onKeyPress && onKeyPress(event);
|
|
69
66
|
if (showMenu && event.key === "Enter" && activeDescendantRef.current) {
|
|
70
67
|
event.preventDefault();
|
|
71
68
|
event.nativeEvent.stopImmediatePropagation();
|
|
@@ -193,10 +193,11 @@ function AutocompleteMenu(props) {
|
|
|
193
193
|
t12 = (current, _previous, directlyActivated) => {
|
|
194
194
|
activeDescendantRef.current = current || null;
|
|
195
195
|
if (current) {
|
|
196
|
-
|
|
196
|
+
const selectedItem = allItemsToRenderRef.current.find((item_1) => {
|
|
197
197
|
var _current$closest;
|
|
198
198
|
return item_1.id === ((_current$closest = current.closest("li")) === null || _current$closest === void 0 ? void 0 : _current$closest.getAttribute("data-id"));
|
|
199
|
-
})
|
|
199
|
+
});
|
|
200
|
+
setHighlightedItem(selectedItem);
|
|
200
201
|
setIsMenuDirectlyActivated(directlyActivated);
|
|
201
202
|
}
|
|
202
203
|
if (current && customScrollContainerRef && customScrollContainerRef.current && directlyActivated) scrollIntoView(current, customScrollContainerRef.current, menuScrollMargins);
|
|
@@ -250,7 +250,10 @@ function Breadcrumbs(t0) {
|
|
|
250
250
|
const measuredContainerWidth = containerElement.offsetWidth;
|
|
251
251
|
setContainerWidth((prev_0) => prev_0 === measuredContainerWidth ? prev_0 : measuredContainerWidth);
|
|
252
252
|
const listElement = containerElement.querySelector("ol");
|
|
253
|
-
if (listElement && listElement.children.length > 0 && listElement.children.length === childArray.length)
|
|
253
|
+
if (listElement && listElement.children.length > 0 && listElement.children.length === childArray.length) {
|
|
254
|
+
const widths = Array.from(listElement.children).map(_temp3);
|
|
255
|
+
setChildArrayWidths(widths);
|
|
256
|
+
}
|
|
254
257
|
};
|
|
255
258
|
$[3] = childArray.length;
|
|
256
259
|
$[4] = overflow;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
1
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
4
2
|
import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
|
|
5
3
|
import ButtonGroup_module_css_default from "./ButtonGroup.module.css.js";
|
|
6
4
|
import { c } from "react-compiler-runtime";
|
|
7
5
|
import { clsx } from "clsx";
|
|
8
6
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
import React
|
|
7
|
+
import React from "react";
|
|
10
8
|
//#region src/ButtonGroup/ButtonGroup.tsx
|
|
11
9
|
const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forwardRef) {
|
|
12
10
|
const $ = c(20);
|
|
@@ -31,12 +29,6 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
31
29
|
t1 = $[5];
|
|
32
30
|
}
|
|
33
31
|
const BaseComponent = t1 === void 0 ? "div" : t1;
|
|
34
|
-
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
35
|
-
const internalRef = useRef(null);
|
|
36
|
-
const mergedRef = useMergedRefs(internalRef, forwardRef);
|
|
37
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(forwardRef);
|
|
38
|
-
const buttonRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
|
|
39
|
-
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
40
32
|
let t2;
|
|
41
33
|
if ($[6] !== children) {
|
|
42
34
|
t2 = React.Children.map(children, _temp);
|
|
@@ -44,6 +36,7 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
44
36
|
$[7] = t2;
|
|
45
37
|
} else t2 = $[7];
|
|
46
38
|
const buttons = t2;
|
|
39
|
+
const buttonRef = useProvidedRefOrCreate(forwardRef);
|
|
47
40
|
const t3 = role !== "toolbar";
|
|
48
41
|
let t4;
|
|
49
42
|
if ($[8] !== buttonRef || $[9] !== t3) {
|
|
@@ -65,9 +58,9 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
65
58
|
$[12] = t5;
|
|
66
59
|
} else t5 = $[12];
|
|
67
60
|
let t6;
|
|
68
|
-
if ($[13] !== BaseComponent || $[14] !==
|
|
61
|
+
if ($[13] !== BaseComponent || $[14] !== buttonRef || $[15] !== buttons || $[16] !== rest || $[17] !== role || $[18] !== t5) {
|
|
69
62
|
t6 = /*#__PURE__*/ jsx(BaseComponent, {
|
|
70
|
-
ref:
|
|
63
|
+
ref: buttonRef,
|
|
71
64
|
className: t5,
|
|
72
65
|
role,
|
|
73
66
|
...rest,
|
|
@@ -75,7 +68,7 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
75
68
|
children: buttons
|
|
76
69
|
});
|
|
77
70
|
$[13] = BaseComponent;
|
|
78
|
-
$[14] =
|
|
71
|
+
$[14] = buttonRef;
|
|
79
72
|
$[15] = buttons;
|
|
80
73
|
$[16] = rest;
|
|
81
74
|
$[17] = role;
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
1
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
2
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
4
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
5
3
|
import shared_module_css_default from "./shared.module.css.js";
|
|
6
4
|
import { CheckboxGroupContext } from "../CheckboxGroup/CheckboxGroupContext.js";
|
|
7
5
|
import Checkbox_module_css_default from "./Checkbox.module.css.js";
|
|
8
6
|
import { clsx } from "clsx";
|
|
9
7
|
import { jsx } from "react/jsx-runtime";
|
|
10
|
-
import React, { useContext, useEffect
|
|
8
|
+
import React, { useContext, useEffect } from "react";
|
|
11
9
|
//#region src/Checkbox/Checkbox.tsx
|
|
12
10
|
/**
|
|
13
11
|
* An accessible, native checkbox component
|
|
14
12
|
*/
|
|
15
13
|
const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultChecked, indeterminate, disabled, onChange, required, validationStatus, value, ["data-component"]: dataComponent, ...rest }, ref) => {
|
|
16
|
-
const
|
|
17
|
-
const internalRef = useRef(null);
|
|
18
|
-
const mergedRef = useMergedRefs(internalRef, ref);
|
|
19
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(ref);
|
|
20
|
-
const checkboxRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
|
|
21
|
-
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
14
|
+
const checkboxRef = useProvidedRefOrCreate(ref);
|
|
22
15
|
const checkboxGroupContext = useContext(CheckboxGroupContext);
|
|
23
16
|
const handleOnChange = (e) => {
|
|
24
17
|
checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
|
|
@@ -31,7 +24,7 @@ const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultCh
|
|
|
31
24
|
const inputProps = {
|
|
32
25
|
type: "checkbox",
|
|
33
26
|
disabled,
|
|
34
|
-
ref:
|
|
27
|
+
ref: checkboxRef,
|
|
35
28
|
checked: indeterminate ? false : checked,
|
|
36
29
|
defaultChecked,
|
|
37
30
|
required,
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -3,10 +3,9 @@ import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
|
3
3
|
import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
|
|
4
4
|
import { useResizeObserver } from "../hooks/useResizeObserver.js";
|
|
5
5
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
7
7
|
import { IconButton } from "../Button/IconButton.js";
|
|
8
8
|
import { ButtonComponent } from "../Button/Button.js";
|
|
9
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
10
9
|
import { useFocusTrap } from "../hooks/useFocusTrap.js";
|
|
11
10
|
import { useFocusZone } from "../hooks/useFocusZone.js";
|
|
12
11
|
import Portal_default from "../Portal/index.js";
|
|
@@ -245,13 +244,7 @@ const Footer = /*#__PURE__*/ React.forwardRef(function Footer({ className, ...re
|
|
|
245
244
|
Footer.displayName = "Dialog.Footer";
|
|
246
245
|
const Buttons = ({ buttons }) => {
|
|
247
246
|
var _buttons$find;
|
|
248
|
-
const
|
|
249
|
-
const providedButtonRef = (_buttons$find = buttons.find((button) => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref;
|
|
250
|
-
const internalRef = useRef(null);
|
|
251
|
-
const mergedRef = useMergedRefs(internalRef, providedButtonRef);
|
|
252
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(providedButtonRef);
|
|
253
|
-
const autoFocusRef = mergedRefEnabled ? internalRef : providedOrCreatedRef;
|
|
254
|
-
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
247
|
+
const autoFocusRef = useProvidedRefOrCreate((_buttons$find = buttons.find((button) => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref);
|
|
255
248
|
let autoFocusCount = 0;
|
|
256
249
|
const [hasRendered, setHasRendered] = useState(0);
|
|
257
250
|
useEffect(() => {
|
|
@@ -266,7 +259,7 @@ const Buttons = ({ buttons }) => {
|
|
|
266
259
|
"data-component": "Dialog.FooterButton",
|
|
267
260
|
...buttonProps,
|
|
268
261
|
variant: buttonType === "normal" ? "default" : buttonType,
|
|
269
|
-
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++,
|
|
262
|
+
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, autoFocusRef) : null,
|
|
270
263
|
children: content
|
|
271
264
|
}, index);
|
|
272
265
|
}) });
|
|
@@ -7,8 +7,7 @@ const DefaultFeatureFlags = FeatureFlagScope.create({
|
|
|
7
7
|
primer_react_styled_react_use_primer_theme_providers: false,
|
|
8
8
|
primer_react_action_list_group_heading_trailing_action: false,
|
|
9
9
|
primer_react_action_list_item_gap: false,
|
|
10
|
-
primer_react_timeline_list_semantics: false
|
|
11
|
-
primer_react_merged_forwarded_refs: false
|
|
10
|
+
primer_react_timeline_list_semantics: false
|
|
12
11
|
});
|
|
13
12
|
//#endregion
|
|
14
13
|
export { DefaultFeatureFlags };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
1
|
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
|
|
3
2
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
4
3
|
import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
|
|
5
4
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
6
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
7
5
|
import { useFocusZone } from "../hooks/useFocusZone.js";
|
|
8
6
|
import { ActionListContainerContext } from "../ActionList/ActionListContainerContext.js";
|
|
9
7
|
import { ActionList } from "../ActionList/index.js";
|
|
@@ -36,17 +34,8 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
36
34
|
}, [onFilterChange, setInternalFilterValue]);
|
|
37
35
|
const inputAndListContainerRef = useRef(null);
|
|
38
36
|
const listRef = useRef(null);
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const combinedScrollContainerRef = useMergedRefs(internalScrollContainerRef, providedScrollContainerRef);
|
|
42
|
-
const providedOrCreatedScrollContainerRef = useProvidedRefOrCreate(providedScrollContainerRef);
|
|
43
|
-
const scrollContainerRef = mergedRefEnabled ? internalScrollContainerRef : providedOrCreatedScrollContainerRef;
|
|
44
|
-
const appliedScrollContainerRef = mergedRefEnabled ? combinedScrollContainerRef : providedOrCreatedScrollContainerRef;
|
|
45
|
-
const internalInputRef = useRef(null);
|
|
46
|
-
const combinedInputRef = useMergedRefs(internalInputRef, providedInputRef);
|
|
47
|
-
const providedOrCreatedInputRef = useProvidedRefOrCreate(providedInputRef);
|
|
48
|
-
const inputRef = mergedRefEnabled ? internalInputRef : providedOrCreatedInputRef;
|
|
49
|
-
const appliedInputRef = mergedRefEnabled ? combinedInputRef : providedOrCreatedInputRef;
|
|
37
|
+
const scrollContainerRef = useProvidedRefOrCreate(providedScrollContainerRef);
|
|
38
|
+
const inputRef = useProvidedRefOrCreate(providedInputRef);
|
|
50
39
|
const usingRovingTabindex = _PrivateFocusManagement === "roving-tabindex";
|
|
51
40
|
const [listContainerElement, setListContainerElement] = useState(null);
|
|
52
41
|
const activeDescendantRef = useRef();
|
|
@@ -301,7 +290,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
301
290
|
"data-component": "FilteredActionList",
|
|
302
291
|
children: [
|
|
303
292
|
/*#__PURE__*/ jsx(FilteredActionListInput, {
|
|
304
|
-
inputRef
|
|
293
|
+
inputRef,
|
|
305
294
|
value: filterValue,
|
|
306
295
|
onInputChange,
|
|
307
296
|
onInputKeyPress,
|
|
@@ -335,7 +324,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
335
324
|
})]
|
|
336
325
|
}),
|
|
337
326
|
/*#__PURE__*/ jsx("div", {
|
|
338
|
-
ref:
|
|
327
|
+
ref: scrollContainerRef,
|
|
339
328
|
className: FilteredActionList_module_css_default.Container,
|
|
340
329
|
children: getBodyContent()
|
|
341
330
|
})
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
|
|
4
4
|
//#region src/FilteredActionList/FilteredActionListInput.d.ts
|
|
5
5
|
interface FilteredActionListInputProps extends Partial<Omit<TextInputProps, 'onChange' | 'onKeyDown'>> {
|
|
6
|
-
inputRef: React.
|
|
6
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
7
7
|
onInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
8
8
|
onInputKeyPress?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
9
9
|
onInputKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
@@ -31,20 +31,23 @@ const useAnnouncements = (items, listContainerRef, inputRef, enabled = true, loa
|
|
|
31
31
|
}, [enabled]);
|
|
32
32
|
useEffect(function announceInitialFocus() {
|
|
33
33
|
const focusHandler = () => {
|
|
34
|
-
if (usingRovingTabindex)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
if (usingRovingTabindex) {
|
|
35
|
+
const announcementText = `${items.length} item${items.length > 1 ? "s" : ""} available, ${selectedItems} selected.`;
|
|
36
|
+
announce$1(announcementText, {
|
|
37
|
+
delayMs,
|
|
38
|
+
from: liveRegion ? liveRegion : void 0
|
|
39
|
+
});
|
|
40
|
+
} else window.requestAnimationFrame(() => {
|
|
39
41
|
const activeItem = getItemWithActiveDescendant(listContainerRef, items);
|
|
40
42
|
if (!activeItem) return;
|
|
41
43
|
const { index, text, selected } = activeItem;
|
|
42
|
-
|
|
44
|
+
const announcementText = [
|
|
43
45
|
`Focus on filter text box and list of items`,
|
|
44
46
|
`Focused item: ${text}`,
|
|
45
47
|
`${selected ? "selected" : "not selected"}`,
|
|
46
48
|
`${index + 1} of ${items.length}`
|
|
47
|
-
].join(", ")
|
|
49
|
+
].join(", ");
|
|
50
|
+
announce$1(announcementText, {
|
|
48
51
|
delayMs,
|
|
49
52
|
from: liveRegion ? liveRegion : void 0
|
|
50
53
|
});
|
|
@@ -70,20 +73,23 @@ const useAnnouncements = (items, listContainerRef, inputRef, enabled = true, loa
|
|
|
70
73
|
announce$1(`${message === null || message === void 0 ? void 0 : message.title}. ${message === null || message === void 0 ? void 0 : message.description}`, { delayMs });
|
|
71
74
|
return;
|
|
72
75
|
}
|
|
73
|
-
if (usingRovingTabindex)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
if (usingRovingTabindex) {
|
|
77
|
+
const announcementText = `${items.length} item${items.length > 1 ? "s" : ""} available, ${selectedItems} selected.`;
|
|
78
|
+
announce$1(announcementText, {
|
|
79
|
+
delayMs,
|
|
80
|
+
from: liveRegion ? liveRegion : void 0
|
|
81
|
+
});
|
|
82
|
+
} else window.requestAnimationFrame(() => {
|
|
78
83
|
const activeItem = getItemWithActiveDescendant(listContainerRef, items);
|
|
79
84
|
if (!activeItem) return;
|
|
80
85
|
const { index, text, selected } = activeItem;
|
|
81
|
-
|
|
86
|
+
const announcementText = [
|
|
82
87
|
`List updated`,
|
|
83
88
|
`Focused item: ${text}`,
|
|
84
89
|
`${selected ? "selected" : "not selected"}`,
|
|
85
90
|
`${index + 1} of ${items.length}`
|
|
86
|
-
].join(", ")
|
|
91
|
+
].join(", ");
|
|
92
|
+
announce$1(announcementText, {
|
|
87
93
|
delayMs,
|
|
88
94
|
from: liveRegion ? liveRegion : void 0
|
|
89
95
|
});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-LabelGroup-Container-E-ePP{contain:layout;display:flex;flex-wrap:nowrap;gap:var(--base-size-4,.25rem);line-height:1;max-width:100%;overflow:hidden}.prc-LabelGroup-Container-E-ePP:where([data-overflow=inline]){flex-wrap:wrap}.prc-LabelGroup-Container-E-ePP:where([data-list]){list-style-type:none;margin-block-end:0;margin-block-start:0;padding-inline-start:0}.prc-LabelGroup-ItemWrapper-GkO4t{align-items:center;display:flex;min-height:28px}.prc-LabelGroup-ItemWrapper--hidden-mdrB0{order:9999;pointer-events:none;visibility:hidden}.prc-LabelGroup-OverlayContainer-duQvd{align-items:flex-start;display:flex}.prc-LabelGroup-OverlayInner-nDXRC{display:flex;flex-wrap:wrap;gap:var(--base-size-4,.25rem)}.prc-LabelGroup-CloseButton-IyLno{flex-shrink:0}
|
|
2
|
+
/*# sourceMappingURL=LabelGroup-db41f443.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/LabelGroup/LabelGroup.module.css.js"],"names":[],"mappings":"AAAA,gCAYE,cAAe,CAXf,YAAa,CACb,gBAAiB,CACjB,6BAAuB,CAEvB,aAAc,CACd,cAAe,CACf,eAiBF,CAVE,8DACE,cACF,CAEA,mDAIE,oBAAqB,CADrB,kBAAmB,CADnB,oBAAqB,CADrB,sBAIF,CAGF,kCAEE,kBAAmB,CADnB,YAAa,CAOb,eACF,CAEA,0CACE,UAAW,CACX,mBAAoB,CACpB,iBACF,CAEA,uCACE,sBAAuB,CACvB,YACF,CAEA,mCACE,YAAa,CACb,cAAe,CACf,6BACF,CAEA,kCACE,aACF","file":"LabelGroup-db41f443.css","sourcesContent":[".Container {\n display: flex;\n flex-wrap: nowrap;\n gap: var(--base-size-4);\n /* stylelint-disable-next-line primer/typography */\n line-height: 1;\n max-width: 100%;\n overflow: hidden;\n\n /* Isolate the IntersectionObserver-driven show/hide of overflowing labels so it can't invalidate\n ancestor layout. Safe because the row already clips (overflow: hidden) and the expanded overlay is\n rendered separately, so it isn't affected by the new containing block/stacking context. */\n contain: layout;\n\n &:where([data-overflow='inline']) {\n flex-wrap: wrap;\n }\n\n &:where([data-list]) {\n padding-inline-start: 0;\n margin-block-start: 0;\n margin-block-end: 0;\n list-style-type: none;\n }\n}\n\n.ItemWrapper {\n display: flex;\n align-items: center;\n /* This min-height matches the height of the expand/collapse button.\n Without it, the labels/tokens will do a slight layout shift when expanded.\n This is because the height of the first row will match the token sizes,\n but the height of the second row will be the height of the collapse button.\n */\n min-height: 28px;\n}\n\n.ItemWrapper--hidden {\n order: 9999;\n pointer-events: none;\n visibility: hidden;\n}\n\n.OverlayContainer {\n align-items: flex-start;\n display: flex;\n}\n\n.OverlayInner {\n display: flex;\n flex-wrap: wrap;\n gap: var(--base-size-4);\n}\n\n.CloseButton {\n flex-shrink: 0;\n}\n"]}
|
package/dist/NavList/NavList.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
2
2
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
3
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
3
4
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
4
5
|
import _VisuallyHidden_module_css_default from "../_VisuallyHidden.module.css.js";
|
|
5
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
6
6
|
import { ActionListContainerContext } from "../ActionList/ActionListContainerContext.js";
|
|
7
7
|
import Heading$1 from "../Heading/Heading.js";
|
|
8
8
|
import ActionList_module_css_default from "../ActionList/ActionList.module.css.js";
|
package/dist/Overlay/Overlay.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
2
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
3
3
|
import { useOverlay } from "../hooks/useOverlay.js";
|
|
4
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
5
4
|
import Portal_default from "../Portal/index.js";
|
|
5
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
6
6
|
import Overlay_module_css_default from "./Overlay.module.css.js";
|
|
7
7
|
import { clsx } from "clsx";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|