@primer/react 0.0.0-20260720205022 → 0.0.0-20260722001252
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 +43 -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 +15 -21
- package/dist/ActionMenu/ActionMenu.js +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +5 -7
- 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 +8 -15
- package/dist/Checkbox/Checkbox.js +9 -16
- package/dist/Dialog/Dialog.js +6 -13
- package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -2
- package/dist/FeatureFlags/useFeatureFlag.js +2 -1
- package/dist/FilteredActionList/FilteredActionList.js +20 -31
- 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.d.ts +1 -0
- package/dist/NavList/NavList.js +40 -29
- package/dist/Overlay/Overlay.js +1 -1
- package/dist/PageHeader/PageHeader.js +22 -31
- package/dist/PageLayout/DragHandle.d.ts +45 -0
- package/dist/PageLayout/DragHandle.js +224 -0
- package/dist/PageLayout/PageLayout.js +54 -248
- package/dist/PageLayout/index.d.ts +3 -1
- package/dist/PageLayout/usePaneWidth.d.ts +63 -1
- package/dist/PageLayout/usePaneWidth.js +52 -36
- package/dist/SelectPanel/SelectPanel.js +1 -1
- package/dist/TextInput/TextInput.js +6 -13
- package/dist/TextInputWithTokens/TextInputWithTokens.js +1 -1
- package/dist/ThemeProvider.d.ts +1 -4
- package/dist/ThemeProvider.js +43 -76
- package/dist/Timeline/Timeline-b7e6685b.css +2 -0
- package/dist/Timeline/Timeline-b7e6685b.css.map +1 -0
- package/dist/Timeline/Timeline.module.css.js +1 -1
- package/dist/TooltipV2/Tooltip.js +13 -19
- 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 +10 -18
- 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.d.ts +4 -4
- package/dist/hooks/useMergedRefs.js +5 -8
- 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.d.ts +4 -2
- package/dist/index.js +7 -5
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +1 -1
- package/dist/internal/components/OverflowObserverProvider.js +5 -5
- package/dist/internal/components/UnderlineTabbedInterface-798ef3cb.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-798ef3cb.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/theme.d.ts +1 -1142
- package/dist/theme.js +1 -3
- package/dist/useTheme.d.ts +1 -3
- package/dist/utils/warning.js +3 -2
- package/generated/components.json +13 -13
- package/generated/hooks.json +0 -15
- package/package.json +7 -10
- 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/Timeline/Timeline-ff81db92.css +0 -2
- package/dist/Timeline/Timeline-ff81db92.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css.map +0 -1
- package/dist/legacy-theme/ts/color-schemes.js +0 -4252
- package/dist/utils/types/KeyPaths.d.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260722001252
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#8212](https://github.com/primer/react/pull/8212) [`6a4c131`](https://github.com/primer/react/commit/6a4c1319a70a5f3b5abc7b81b044bd26d042aa75) Thanks [@mattcosta7](https://github.com/mattcosta7)! - ThemeProvider: Remove `colorSchemes` from the default `theme` and stop merging
|
|
8
|
+
color scheme values into the theme context. Color schemes are applied via CSS
|
|
9
|
+
variables instead, and passing an unknown color scheme no longer logs an error.
|
|
10
|
+
`useTheme()` no longer returns `theme` or `resolvedColorScheme`. The
|
|
11
|
+
`ThemeColorPaths` and `ThemeShadowPaths` types are also no longer exported.
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#8086](https://github.com/primer/react/pull/8086) [`81d4174`](https://github.com/primer/react/commit/81d4174150b37da95db23480574ddf8db5b20ca4) Thanks [@TylerJDev](https://github.com/TylerJDev)! - Add a `hideDivider` prop to `NavList.Group` so consumers can opt out of rendering the divider before a group.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Fake entry to force publishing
|
|
20
|
+
|
|
21
|
+
- [#8169](https://github.com/primer/react/pull/8169) [`1d6f559`](https://github.com/primer/react/commit/1d6f5593f5e482d1d03027522bc882560c7b1f06) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Timeline: `Timeline.Actions` now wraps onto a new row below `Timeline.Body`, left-aligned with the body content, when `Timeline.Item` is narrower than 480px.
|
|
22
|
+
|
|
23
|
+
## 38.33.0
|
|
24
|
+
|
|
25
|
+
### Minor Changes
|
|
26
|
+
|
|
27
|
+
- [#8160](https://github.com/primer/react/pull/8160) [`f8e7cf2`](https://github.com/primer/react/commit/f8e7cf2e1bd3eb02d4106b4932b487bb8ff108e6) Thanks [@TylerJDev](https://github.com/TylerJDev)! - PageLayout: Export the resize primitives `usePaneWidth` and `DragHandle` (with `defaultPaneWidth` and related types) so pane-resize behavior can be reused outside of `PageLayout`.
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- [#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`
|
|
32
|
+
|
|
33
|
+
- [#8166](https://github.com/primer/react/pull/8166) [`4045abe`](https://github.com/primer/react/commit/4045abea621d0940edcd1120fc70e6ed5f797205) 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.
|
|
34
|
+
|
|
35
|
+
- [#8176](https://github.com/primer/react/pull/8176) [`f061bc4`](https://github.com/primer/react/commit/f061bc41483211bef1ec8b1dfe07937f20a9ddd6) Thanks [@francinelucca](https://github.com/francinelucca)! - FeatureFlags: Guard against missing context in `useFeatureFlag` so it returns `false` instead of throwing when used outside a provider
|
|
36
|
+
|
|
37
|
+
- [#8188](https://github.com/primer/react/pull/8188) [`2a67c19`](https://github.com/primer/react/commit/2a67c191a0038df64d2225c0bc11c020c2def03c) Thanks [@iansan5653](https://github.com/iansan5653)! - Fix `UnderlineNav` items all being considered overflowing on Safari with text size overrides
|
|
38
|
+
|
|
39
|
+
- [#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.
|
|
40
|
+
|
|
41
|
+
- [#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
|
|
42
|
+
|
|
43
|
+
- [#8165](https://github.com/primer/react/pull/8165) [`d60d05b`](https://github.com/primer/react/commit/d60d05b2684056b653cb605418d6f1cae0ba38e2) Thanks [@jonrohan](https://github.com/jonrohan)! - Pin the underline tabbed interface wrapper's vertical box model in wrap mode so external border and padding overrides can no longer offset its height and incorrectly trigger the overflow "more" menu
|
|
44
|
+
|
|
45
|
+
## 38.32.0
|
|
4
46
|
|
|
5
47
|
### Minor Changes
|
|
6
48
|
|
|
@@ -19,8 +61,6 @@
|
|
|
19
61
|
|
|
20
62
|
### Patch Changes
|
|
21
63
|
|
|
22
|
-
- Fake entry to force publishing
|
|
23
|
-
|
|
24
64
|
- [#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
65
|
|
|
26
66
|
- [#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 listRef = useRef(null);
|
|
66
|
-
const mergedRef = useMergedRefs(listRef, forwardedRef);
|
|
67
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
|
|
68
|
-
const readRef = mergedRefEnabled ? listRef : 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;
|
|
@@ -85,14 +79,14 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
85
79
|
const t5 = !enableFocusZone;
|
|
86
80
|
const t6 = listRole === "menu" || container === "SelectPanel" || container === "FilteredActionList" ? "wrap" : void 0;
|
|
87
81
|
let t7;
|
|
88
|
-
if ($[11] !==
|
|
82
|
+
if ($[11] !== listRef || $[12] !== t5 || $[13] !== t6) {
|
|
89
83
|
t7 = {
|
|
90
84
|
disabled: t5,
|
|
91
|
-
containerRef:
|
|
85
|
+
containerRef: listRef,
|
|
92
86
|
bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd | FocusKeys.PageUpDown,
|
|
93
87
|
focusOutBehavior: t6
|
|
94
88
|
};
|
|
95
|
-
$[11] =
|
|
89
|
+
$[11] = listRef;
|
|
96
90
|
$[12] = t5;
|
|
97
91
|
$[13] = t6;
|
|
98
92
|
$[14] = t7;
|
|
@@ -117,16 +111,16 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
117
111
|
} else t9 = $[20];
|
|
118
112
|
const listContextValue = t9;
|
|
119
113
|
let t10;
|
|
120
|
-
if ($[21] !==
|
|
114
|
+
if ($[21] !== listRef) {
|
|
121
115
|
t10 = () => {
|
|
122
|
-
const list =
|
|
116
|
+
const list = listRef.current;
|
|
123
117
|
if (!list) return;
|
|
124
118
|
const hasMixed = list.querySelector("[data-has-description=\"true\"]") !== null && list.querySelector("[data-has-description=\"false\"]") !== null;
|
|
125
119
|
const current = list.getAttribute("data-mixed-descriptions");
|
|
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] =
|
|
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,9 +33,7 @@ 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
36
|
const [overlayElement, setOverlayElement] = useState(null);
|
|
39
|
-
const mergedOverlayRef = useMergedRefs(updateOverlayRef, useMergedRefs(overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.ref, setOverlayElement));
|
|
40
37
|
const anchorId = useId$1(externalAnchorId);
|
|
41
38
|
const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose("click-outside"), [onClose]);
|
|
42
39
|
const onEscape = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose("escape"), [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;
|
|
@@ -192,10 +190,10 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
192
190
|
...shouldRenderAsPopover ? { popover: "manual" } : {},
|
|
193
191
|
...restOverlayProps,
|
|
194
192
|
...shouldRenderAsPopover ? { id: popoverId } : {},
|
|
195
|
-
ref:
|
|
196
|
-
setOverlayElement(node);
|
|
193
|
+
ref: (node) => {
|
|
197
194
|
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
|
|
198
195
|
updateOverlayRef(node);
|
|
196
|
+
setOverlayElement(node);
|
|
199
197
|
},
|
|
200
198
|
"data-anchor-position": cssAnchorPositioning,
|
|
201
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 buttonRef = useRef(null);
|
|
36
|
-
const mergedRef = useMergedRefs(buttonRef, forwardRef);
|
|
37
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(forwardRef);
|
|
38
|
-
const readRef = mergedRefEnabled ? buttonRef : 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,16 +36,17 @@ 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
|
-
if ($[8] !==
|
|
42
|
+
if ($[8] !== buttonRef || $[9] !== t3) {
|
|
50
43
|
t4 = {
|
|
51
|
-
containerRef:
|
|
44
|
+
containerRef: buttonRef,
|
|
52
45
|
disabled: t3,
|
|
53
46
|
bindKeys: FocusKeys.ArrowHorizontal,
|
|
54
47
|
focusOutBehavior: "wrap"
|
|
55
48
|
};
|
|
56
|
-
$[8] =
|
|
49
|
+
$[8] = buttonRef;
|
|
57
50
|
$[9] = t3;
|
|
58
51
|
$[10] = t4;
|
|
59
52
|
} else t4 = $[10];
|
|
@@ -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,37 +1,30 @@
|
|
|
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 checkboxRef = useRef(null);
|
|
18
|
-
const mergedRef = useMergedRefs(checkboxRef, ref);
|
|
19
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(ref);
|
|
20
|
-
const readRef = mergedRefEnabled ? checkboxRef : 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);
|
|
25
18
|
onChange && onChange(e);
|
|
26
|
-
if (indeterminate &&
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
if (indeterminate && checkboxRef.current) {
|
|
20
|
+
checkboxRef.current.indeterminate = true;
|
|
21
|
+
checkboxRef.current.setAttribute("aria-checked", "mixed");
|
|
29
22
|
}
|
|
30
23
|
};
|
|
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,
|
|
@@ -43,14 +36,14 @@ const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultCh
|
|
|
43
36
|
...rest
|
|
44
37
|
};
|
|
45
38
|
useIsomorphicLayoutEffect(() => {
|
|
46
|
-
if (
|
|
39
|
+
if (checkboxRef.current) checkboxRef.current.indeterminate = indeterminate || false;
|
|
47
40
|
}, [
|
|
48
41
|
indeterminate,
|
|
49
42
|
checked,
|
|
50
|
-
|
|
43
|
+
checkboxRef
|
|
51
44
|
]);
|
|
52
45
|
useEffect(() => {
|
|
53
|
-
const { current: checkbox } =
|
|
46
|
+
const { current: checkbox } = checkboxRef;
|
|
54
47
|
if (!checkbox) return;
|
|
55
48
|
if (indeterminate) checkbox.setAttribute("aria-checked", "mixed");
|
|
56
49
|
else checkbox.setAttribute("aria-checked", checkbox.checked ? "true" : "false");
|
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,28 +244,22 @@ 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 autoFocusRef = useRef(null);
|
|
251
|
-
const mergedRef = useMergedRefs(autoFocusRef, providedButtonRef);
|
|
252
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(providedButtonRef);
|
|
253
|
-
const readRef = mergedRefEnabled ? autoFocusRef : 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(() => {
|
|
258
251
|
if (hasRendered === 1) {
|
|
259
|
-
var
|
|
260
|
-
(
|
|
252
|
+
var _autoFocusRef$current;
|
|
253
|
+
(_autoFocusRef$current = autoFocusRef.current) === null || _autoFocusRef$current === void 0 || _autoFocusRef$current.focus();
|
|
261
254
|
} else setHasRendered(hasRendered + 1);
|
|
262
|
-
}, [
|
|
255
|
+
}, [autoFocusRef, hasRendered]);
|
|
263
256
|
return /*#__PURE__*/ jsx(Fragment, { children: buttons.map((dialogButtonProps, index) => {
|
|
264
257
|
const { content, buttonType = "default", autoFocus = false, ...buttonProps } = dialogButtonProps;
|
|
265
258
|
return /*#__PURE__*/ jsx(ButtonComponent, {
|
|
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 };
|
|
@@ -10,7 +10,8 @@ function useFeatureFlag(flag) {
|
|
|
10
10
|
const context = useContext(FeatureFlagContext);
|
|
11
11
|
let t0;
|
|
12
12
|
if ($[0] !== context || $[1] !== flag) {
|
|
13
|
-
|
|
13
|
+
var _context$enabled;
|
|
14
|
+
t0 = (_context$enabled = context === null || context === void 0 ? void 0 : context.enabled(flag)) !== null && _context$enabled !== void 0 ? _context$enabled : false;
|
|
14
15
|
$[0] = context;
|
|
15
16
|
$[1] = flag;
|
|
16
17
|
$[2] = t0;
|