@primer/react 38.32.0-rc.68e0ffa22 → 38.32.0-rc.85de10233
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 +12 -0
- package/dist/ActionBar/ActionBar.js +130 -424
- package/dist/ActionList/{ActionList-65f7daac.css → ActionList-1ff5220c.css} +2 -2
- package/dist/ActionList/ActionList-1ff5220c.css.map +1 -0
- package/dist/ActionList/ActionList.module.css.js +1 -1
- package/dist/Breadcrumbs/{Breadcrumbs-54395fc6.css → Breadcrumbs-16d81430.css} +2 -2
- package/dist/Breadcrumbs/{Breadcrumbs-54395fc6.css.map → Breadcrumbs-16d81430.css.map} +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +1 -0
- package/dist/Breadcrumbs/Breadcrumbs.module.css.js +2 -2
- package/dist/FilteredActionList/FilteredActionList.js +66 -155
- package/dist/FilteredActionList/useAnnouncements.js +66 -138
- package/dist/LabelGroup/LabelGroup.js +76 -110
- package/dist/Overlay/Overlay.js +45 -169
- package/dist/PageHeader/PageHeader-b12247c8.css +2 -0
- package/dist/PageHeader/PageHeader-b12247c8.css.map +1 -0
- package/dist/PageHeader/PageHeader.js +64 -23
- package/dist/PageHeader/PageHeader.module.css.js +1 -1
- package/dist/SegmentedControl/SegmentedControl-a004561f.css +2 -0
- package/dist/SegmentedControl/SegmentedControl-a004561f.css.map +1 -0
- package/dist/SegmentedControl/SegmentedControl.module.css.js +1 -1
- package/dist/TextInput/TextInput.js +7 -7
- package/dist/ToggleSwitch/ToggleSwitch.js +167 -186
- package/dist/TreeView/TreeView.js +309 -814
- package/dist/UnderlineNav/UnderlineNav-a06bbc74.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-a06bbc74.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.d.ts +5 -0
- package/dist/UnderlineNav/UnderlineNav.js +136 -129
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -1
- package/dist/experimental/SelectPanel2/SelectPanel-917fdaef.css +2 -0
- package/dist/experimental/SelectPanel2/{SelectPanel-608e207e.css.map → SelectPanel-917fdaef.css.map} +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.module.css.js +1 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +38 -95
- package/dist/hooks/useControllableState.js +3 -3
- package/dist/hooks/useMedia.js +44 -43
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/internal/components/ValidationAnimationContainer.js +40 -34
- package/package.json +3 -1
- package/dist/ActionList/ActionList-65f7daac.css.map +0 -1
- package/dist/PageHeader/PageHeader-5e969745.css +0 -2
- package/dist/PageHeader/PageHeader-5e969745.css.map +0 -1
- package/dist/SegmentedControl/SegmentedControl-622e61a4.css +0 -2
- package/dist/SegmentedControl/SegmentedControl-622e61a4.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNav-47547980.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-47547980.css.map +0 -1
- package/dist/experimental/SelectPanel2/SelectPanel-608e207e.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
+
- [#8133](https://github.com/primer/react/pull/8133) [`0cb8e17`](https://github.com/primer/react/commit/0cb8e17219f61f853fcf06ce9ee09c755c9ef5ff) Thanks [@iansan5653](https://github.com/iansan5653)! - `UnderlineNav`: Replaced dynamic icon visibility with static breakpoints to avoid flickering. Breakpoints customizable via the `hideIconsBreakpoint` prop.
|
|
8
|
+
|
|
7
9
|
- [#8112](https://github.com/primer/react/pull/8112) [`50face0`](https://github.com/primer/react/commit/50face041d55eb800d643b0d264d23fc12fd4121) Thanks [@llastflowers](https://github.com/llastflowers)! - Add data-component attributes and associated tests for:
|
|
8
10
|
|
|
9
11
|
SplitPageLayout
|
|
@@ -17,8 +19,18 @@
|
|
|
17
19
|
|
|
18
20
|
### Patch Changes
|
|
19
21
|
|
|
22
|
+
- [#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.
|
|
23
|
+
|
|
24
|
+
- [#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.
|
|
25
|
+
|
|
26
|
+
- [#8024](https://github.com/primer/react/pull/8024) [`18e3b7d`](https://github.com/primer/react/commit/18e3b7d7a7b54275b99d2562eb279722f5cdd60e) Thanks [@mattcosta7](https://github.com/mattcosta7)! - ToggleSwitch: Fire `onChange` from the user interaction instead of an effect, so it no longer fires on mount or when a controlled `checked` value changes externally.
|
|
27
|
+
|
|
20
28
|
- [#8035](https://github.com/primer/react/pull/8035) [`723f4d6`](https://github.com/primer/react/commit/723f4d6db12710e2b94f56b945a937158fcbb127) Thanks [@mattcosta7](https://github.com/mattcosta7)! - UnderlineNav, ActionBar: Detect item overflow with a single shared IntersectionObserver per component instead of one observer per item, reducing observer churn during resize. No public API changes.
|
|
21
29
|
|
|
30
|
+
- [#8001](https://github.com/primer/react/pull/8001) [`4edc824`](https://github.com/primer/react/commit/4edc8242da557eedd41d71b242674b33254029ec) Thanks [@mattcosta7](https://github.com/mattcosta7)! - `useMedia` now reads the live `matchMedia` value on the first client render instead of after an effect, removing a redundant render pass. `defaultState` is only used for the SSR/hydration snapshot (no public API changes).
|
|
31
|
+
|
|
32
|
+
- [#8023](https://github.com/primer/react/pull/8023) [`71fa75c`](https://github.com/primer/react/commit/71fa75c861c55bf29dd30ddf4a83549bf81369f8) Thanks [@mattcosta7](https://github.com/mattcosta7)! - FormControl: Avoid an extra re-render when showing a validation message.
|
|
33
|
+
|
|
22
34
|
## 38.31.0
|
|
23
35
|
|
|
24
36
|
### Minor Changes
|
|
@@ -8,7 +8,6 @@ import { useIsClipped } from "../internal/hooks/useOverflowObserver.js";
|
|
|
8
8
|
import { OverflowObserverProvider } from "../internal/components/OverflowObserverProvider.js";
|
|
9
9
|
import { createDescendantRegistry } from "../utils/descendant-registry.js";
|
|
10
10
|
import ActionBar_module_css_default from "./ActionBar.module.css.js";
|
|
11
|
-
import { c } from "react-compiler-runtime";
|
|
12
11
|
import { clsx } from "clsx";
|
|
13
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
13
|
import React, { forwardRef, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
@@ -41,188 +40,81 @@ const renderMenuItem = (item, index) => {
|
|
|
41
40
|
}, label);
|
|
42
41
|
};
|
|
43
42
|
renderMenuItem.displayName = "renderMenuItem";
|
|
44
|
-
const ActionBar = (
|
|
45
|
-
const $ = c(43);
|
|
46
|
-
const { size: t1, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, flush: t2, className, gap: t3 } = t0;
|
|
47
|
-
const size = t1 === void 0 ? "medium" : t1;
|
|
48
|
-
const flush = t2 === void 0 ? false : t2;
|
|
49
|
-
const gap = t3 === void 0 ? "condensed" : t3;
|
|
43
|
+
const ActionBar = ({ size = "medium", children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, flush = false, className, gap = "condensed" }) => {
|
|
50
44
|
const [childRegistry, setChildRegistry] = ActionBarItemsRegistry.useRegistryState();
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
|
|
62
|
-
focusOutBehavior: "wrap",
|
|
63
|
-
focusableElementFilter: _temp2
|
|
64
|
-
};
|
|
65
|
-
$[2] = t5;
|
|
66
|
-
} else t5 = $[2];
|
|
67
|
-
let t6;
|
|
68
|
-
if ($[3] !== overflowItems) {
|
|
69
|
-
t6 = [overflowItems];
|
|
70
|
-
$[3] = overflowItems;
|
|
71
|
-
$[4] = t6;
|
|
72
|
-
} else t6 = $[4];
|
|
73
|
-
const { containerRef } = useFocusZone(t5, t6);
|
|
74
|
-
let t7;
|
|
75
|
-
if ($[5] !== size) {
|
|
76
|
-
t7 = { size };
|
|
77
|
-
$[5] = size;
|
|
78
|
-
$[6] = t7;
|
|
79
|
-
} else t7 = $[6];
|
|
80
|
-
let t8;
|
|
81
|
-
if ($[7] !== className) {
|
|
82
|
-
t8 = clsx(className, ActionBar_module_css_default.Nav);
|
|
83
|
-
$[7] = className;
|
|
84
|
-
$[8] = t8;
|
|
85
|
-
} else t8 = $[8];
|
|
86
|
-
const t9 = containerRef;
|
|
87
|
-
const t10 = overflowItems ? overflowItems.length > 0 : void 0;
|
|
88
|
-
let t11;
|
|
89
|
-
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
90
|
-
t11 = /*#__PURE__*/ jsx("div", { className: ActionBar_module_css_default.OverflowSpacer });
|
|
91
|
-
$[9] = t11;
|
|
92
|
-
} else t11 = $[9];
|
|
93
|
-
let t12;
|
|
94
|
-
if ($[10] !== children || $[11] !== setChildRegistry) {
|
|
95
|
-
t12 = /*#__PURE__*/ jsx(ActionBarItemsRegistry.Provider, {
|
|
96
|
-
setRegistry: setChildRegistry,
|
|
97
|
-
children
|
|
98
|
-
});
|
|
99
|
-
$[10] = children;
|
|
100
|
-
$[11] = setChildRegistry;
|
|
101
|
-
$[12] = t12;
|
|
102
|
-
} else t12 = $[12];
|
|
103
|
-
let t13;
|
|
104
|
-
if ($[13] !== containerRef || $[14] !== t12) {
|
|
105
|
-
t13 = /*#__PURE__*/ jsxs("div", {
|
|
106
|
-
className: ActionBar_module_css_default.OverflowContainer,
|
|
107
|
-
children: [t11, /*#__PURE__*/ jsx(OverflowObserverProvider, {
|
|
108
|
-
rootRef: containerRef,
|
|
109
|
-
children: t12
|
|
110
|
-
})]
|
|
111
|
-
});
|
|
112
|
-
$[13] = containerRef;
|
|
113
|
-
$[14] = t12;
|
|
114
|
-
$[15] = t13;
|
|
115
|
-
} else t13 = $[15];
|
|
116
|
-
const t14 = `More ${ariaLabel} items ${overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.length}`;
|
|
117
|
-
const t15 = overflowItems !== null && overflowItems !== void 0 && overflowItems.length ? void 0 : true;
|
|
118
|
-
let t16;
|
|
119
|
-
if ($[16] !== size || $[17] !== t14 || $[18] !== t15) {
|
|
120
|
-
t16 = /*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
|
|
121
|
-
variant: "invisible",
|
|
122
|
-
"aria-label": t14,
|
|
123
|
-
icon: KebabHorizontalIcon,
|
|
124
|
-
className: ActionBar_module_css_default.MoreButton,
|
|
125
|
-
"data-more-button-inactive": t15,
|
|
126
|
-
size
|
|
127
|
-
}) });
|
|
128
|
-
$[16] = size;
|
|
129
|
-
$[17] = t14;
|
|
130
|
-
$[18] = t15;
|
|
131
|
-
$[19] = t16;
|
|
132
|
-
} else t16 = $[19];
|
|
133
|
-
let t17;
|
|
134
|
-
if ($[20] !== overflowItems) {
|
|
135
|
-
t17 = overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.map(_temp4);
|
|
136
|
-
$[20] = overflowItems;
|
|
137
|
-
$[21] = t17;
|
|
138
|
-
} else t17 = $[21];
|
|
139
|
-
let t18;
|
|
140
|
-
if ($[22] !== t17) {
|
|
141
|
-
t18 = /*#__PURE__*/ jsx(ActionMenu.Overlay, { children: /*#__PURE__*/ jsx(ActionList, { children: t17 }) });
|
|
142
|
-
$[22] = t17;
|
|
143
|
-
$[23] = t18;
|
|
144
|
-
} else t18 = $[23];
|
|
145
|
-
let t19;
|
|
146
|
-
if ($[24] !== t16 || $[25] !== t18) {
|
|
147
|
-
t19 = /*#__PURE__*/ jsxs(ActionMenu, { children: [t16, t18] });
|
|
148
|
-
$[24] = t16;
|
|
149
|
-
$[25] = t18;
|
|
150
|
-
$[26] = t19;
|
|
151
|
-
} else t19 = $[26];
|
|
152
|
-
let t20;
|
|
153
|
-
if ($[27] !== ariaLabel || $[28] !== ariaLabelledBy || $[29] !== gap || $[30] !== size || $[31] !== t10 || $[32] !== t13 || $[33] !== t19 || $[34] !== t9) {
|
|
154
|
-
t20 = /*#__PURE__*/ jsxs("div", {
|
|
155
|
-
ref: t9,
|
|
156
|
-
role: "toolbar",
|
|
157
|
-
className: ActionBar_module_css_default.List,
|
|
158
|
-
"aria-label": ariaLabel,
|
|
159
|
-
"aria-labelledby": ariaLabelledBy,
|
|
160
|
-
"data-gap": gap,
|
|
161
|
-
"data-size": size,
|
|
162
|
-
"data-has-overflow": t10,
|
|
163
|
-
children: [t13, t19]
|
|
164
|
-
});
|
|
165
|
-
$[27] = ariaLabel;
|
|
166
|
-
$[28] = ariaLabelledBy;
|
|
167
|
-
$[29] = gap;
|
|
168
|
-
$[30] = size;
|
|
169
|
-
$[31] = t10;
|
|
170
|
-
$[32] = t13;
|
|
171
|
-
$[33] = t19;
|
|
172
|
-
$[34] = t9;
|
|
173
|
-
$[35] = t20;
|
|
174
|
-
} else t20 = $[35];
|
|
175
|
-
let t21;
|
|
176
|
-
if ($[36] !== flush || $[37] !== t20 || $[38] !== t8) {
|
|
177
|
-
t21 = /*#__PURE__*/ jsx("div", {
|
|
178
|
-
className: t8,
|
|
45
|
+
const overflowItems = useMemo(() => childRegistry && Array.from(childRegistry.entries()).filter((entry) => entry[1] !== null), [childRegistry]);
|
|
46
|
+
const { containerRef } = useFocusZone({
|
|
47
|
+
bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
|
|
48
|
+
focusOutBehavior: "wrap",
|
|
49
|
+
focusableElementFilter: (element) => element.matches(FOCUSABLE_ITEM_SELECTOR)
|
|
50
|
+
}, [overflowItems]);
|
|
51
|
+
return /*#__PURE__*/ jsx(ActionBarContext.Provider, {
|
|
52
|
+
value: { size },
|
|
53
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
54
|
+
className: clsx(className, ActionBar_module_css_default.Nav),
|
|
179
55
|
"data-component": "ActionBar",
|
|
180
56
|
"data-flush": flush,
|
|
181
|
-
children:
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
57
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
58
|
+
ref: containerRef,
|
|
59
|
+
role: "toolbar",
|
|
60
|
+
className: ActionBar_module_css_default.List,
|
|
61
|
+
"aria-label": ariaLabel,
|
|
62
|
+
"aria-labelledby": ariaLabelledBy,
|
|
63
|
+
"data-gap": gap,
|
|
64
|
+
"data-size": size,
|
|
65
|
+
"data-has-overflow": overflowItems ? overflowItems.length > 0 : void 0,
|
|
66
|
+
children: [/*#__PURE__*/ jsxs("div", {
|
|
67
|
+
className: ActionBar_module_css_default.OverflowContainer,
|
|
68
|
+
children: [/*#__PURE__*/ jsx("div", { className: ActionBar_module_css_default.OverflowSpacer }), /*#__PURE__*/ jsx(OverflowObserverProvider, {
|
|
69
|
+
rootRef: containerRef,
|
|
70
|
+
children: /*#__PURE__*/ jsx(ActionBarItemsRegistry.Provider, {
|
|
71
|
+
setRegistry: setChildRegistry,
|
|
72
|
+
children
|
|
73
|
+
})
|
|
74
|
+
})]
|
|
75
|
+
}), /*#__PURE__*/ jsxs(ActionMenu, { children: [/*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
|
|
76
|
+
variant: "invisible",
|
|
77
|
+
"aria-label": `More ${ariaLabel} items ${overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.length}`,
|
|
78
|
+
icon: KebabHorizontalIcon,
|
|
79
|
+
className: ActionBar_module_css_default.MoreButton,
|
|
80
|
+
"data-more-button-inactive": overflowItems !== null && overflowItems !== void 0 && overflowItems.length ? void 0 : true,
|
|
81
|
+
size
|
|
82
|
+
}) }), /*#__PURE__*/ jsx(ActionMenu.Overlay, { children: /*#__PURE__*/ jsx(ActionList, { children: overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.map(([id, menuItem]) => {
|
|
83
|
+
if (menuItem.type === "divider") return /*#__PURE__*/ jsx(ActionList.Divider, {}, id);
|
|
84
|
+
if (menuItem.type === "action") {
|
|
85
|
+
const { onClick, icon: Icon, label, disabled } = menuItem;
|
|
86
|
+
return /*#__PURE__*/ jsxs(ActionList.Item, {
|
|
87
|
+
onSelect: (event) => {
|
|
88
|
+
typeof onClick === "function" && onClick(event);
|
|
89
|
+
},
|
|
90
|
+
disabled,
|
|
91
|
+
children: [Icon ? /*#__PURE__*/ jsx(ActionList.LeadingVisual, { children: /*#__PURE__*/ jsx(Icon, {}) }) : null, label]
|
|
92
|
+
}, id);
|
|
93
|
+
}
|
|
94
|
+
if (menuItem.type === "menu") {
|
|
95
|
+
const menuItems = menuItem.items;
|
|
96
|
+
const { icon: Icon, label, returnFocusRef } = menuItem;
|
|
97
|
+
return /*#__PURE__*/ jsxs(ActionMenu, { children: [/*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsxs(ActionList.Item, { children: [Icon !== "none" ? /*#__PURE__*/ jsx(ActionList.LeadingVisual, { children: /*#__PURE__*/ jsx(Icon, {}) }) : null, label] }) }), /*#__PURE__*/ jsx(ActionMenu.Overlay, {
|
|
98
|
+
...returnFocusRef && { returnFocusRef },
|
|
99
|
+
children: /*#__PURE__*/ jsx(ActionList, { children: menuItems.map((item, index) => renderMenuItem(item, index)) })
|
|
100
|
+
})] }, id);
|
|
101
|
+
}
|
|
102
|
+
}) }) })] })]
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
});
|
|
199
106
|
};
|
|
107
|
+
ActionBar.displayName = "ActionBar";
|
|
200
108
|
function useActionBarItem(ref, registryProps) {
|
|
201
109
|
var _useContext;
|
|
202
|
-
const $ = c(5);
|
|
203
110
|
const isGroupOverflowing = (_useContext = useContext(ActionBarGroupContext)) === null || _useContext === void 0 ? void 0 : _useContext.isOverflowing;
|
|
204
|
-
const
|
|
205
|
-
let t0;
|
|
206
|
-
if ($[0] !== isInGroup) {
|
|
207
|
-
t0 = { disabled: isInGroup };
|
|
208
|
-
$[0] = isInGroup;
|
|
209
|
-
$[1] = t0;
|
|
210
|
-
} else t0 = $[1];
|
|
211
|
-
const isItemOverflowing = useIsClipped(ref, t0);
|
|
111
|
+
const isItemOverflowing = useIsClipped(ref, { disabled: isGroupOverflowing !== void 0 });
|
|
212
112
|
const isOverflowing = isGroupOverflowing || isItemOverflowing;
|
|
213
113
|
ActionBarItemsRegistry.useRegisterDescendant(isOverflowing ? registryProps : null);
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
isOverflowing,
|
|
219
|
-
dataOverflowingAttr: t1
|
|
220
|
-
};
|
|
221
|
-
$[2] = isOverflowing;
|
|
222
|
-
$[3] = t1;
|
|
223
|
-
$[4] = t2;
|
|
224
|
-
} else t2 = $[4];
|
|
225
|
-
return t2;
|
|
114
|
+
return {
|
|
115
|
+
isOverflowing,
|
|
116
|
+
dataOverflowingAttr: isOverflowing ? "" : void 0
|
|
117
|
+
};
|
|
226
118
|
}
|
|
227
119
|
const ActionBarIconButton = /*#__PURE__*/ forwardRef(({ disabled, onClick, ...props }, forwardedRef) => {
|
|
228
120
|
const ref = useRef(null);
|
|
@@ -254,283 +146,97 @@ const ActionBarIconButton = /*#__PURE__*/ forwardRef(({ disabled, onClick, ...pr
|
|
|
254
146
|
"data-overflowing": dataOverflowingAttr
|
|
255
147
|
});
|
|
256
148
|
});
|
|
257
|
-
const ActionBarButton = /*#__PURE__*/ forwardRef((
|
|
258
|
-
const $ = c(19);
|
|
259
|
-
let disabled;
|
|
260
|
-
let onClick;
|
|
261
|
-
let props;
|
|
262
|
-
if ($[0] !== t0) {
|
|
263
|
-
({disabled, onClick, ...props} = t0);
|
|
264
|
-
$[0] = t0;
|
|
265
|
-
$[1] = disabled;
|
|
266
|
-
$[2] = onClick;
|
|
267
|
-
$[3] = props;
|
|
268
|
-
} else {
|
|
269
|
-
disabled = $[1];
|
|
270
|
-
onClick = $[2];
|
|
271
|
-
props = $[3];
|
|
272
|
-
}
|
|
149
|
+
const ActionBarButton = /*#__PURE__*/ forwardRef(({ disabled, onClick, ...props }, forwardedRef) => {
|
|
273
150
|
const ref = useRef(null);
|
|
274
151
|
const mergedRef = useMergedRefs(forwardedRef, ref);
|
|
275
152
|
const { size } = React.useContext(ActionBarContext);
|
|
276
153
|
const { children, leadingVisual } = props;
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
} else t4 = $[8];
|
|
295
|
-
const { dataOverflowingAttr } = useActionBarItem(ref, t4);
|
|
296
|
-
let t5;
|
|
297
|
-
if ($[9] !== disabled || $[10] !== onClick) {
|
|
298
|
-
t5 = (event) => {
|
|
299
|
-
var _onClick;
|
|
154
|
+
const { dataOverflowingAttr } = useActionBarItem(ref, useMemo(() => ({
|
|
155
|
+
type: "action",
|
|
156
|
+
label: children,
|
|
157
|
+
icon: typeof leadingVisual === "function" ? leadingVisual : void 0,
|
|
158
|
+
disabled: !!disabled,
|
|
159
|
+
onClick
|
|
160
|
+
}), [
|
|
161
|
+
children,
|
|
162
|
+
leadingVisual,
|
|
163
|
+
disabled,
|
|
164
|
+
onClick
|
|
165
|
+
]));
|
|
166
|
+
return /*#__PURE__*/ jsx(ButtonComponent, {
|
|
167
|
+
"aria-disabled": disabled,
|
|
168
|
+
ref: mergedRef,
|
|
169
|
+
size,
|
|
170
|
+
onClick: useCallback((event) => {
|
|
300
171
|
if (disabled) return;
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
const clickHandler = t5;
|
|
308
|
-
let t6;
|
|
309
|
-
if ($[12] !== clickHandler || $[13] !== dataOverflowingAttr || $[14] !== disabled || $[15] !== mergedRef || $[16] !== props || $[17] !== size) {
|
|
310
|
-
t6 = /*#__PURE__*/ jsx(ButtonComponent, {
|
|
311
|
-
"aria-disabled": disabled,
|
|
312
|
-
ref: mergedRef,
|
|
313
|
-
size,
|
|
314
|
-
onClick: clickHandler,
|
|
315
|
-
...props,
|
|
316
|
-
variant: "invisible",
|
|
317
|
-
"data-overflowing": dataOverflowingAttr
|
|
318
|
-
});
|
|
319
|
-
$[12] = clickHandler;
|
|
320
|
-
$[13] = dataOverflowingAttr;
|
|
321
|
-
$[14] = disabled;
|
|
322
|
-
$[15] = mergedRef;
|
|
323
|
-
$[16] = props;
|
|
324
|
-
$[17] = size;
|
|
325
|
-
$[18] = t6;
|
|
326
|
-
} else t6 = $[18];
|
|
327
|
-
return t6;
|
|
172
|
+
onClick === null || onClick === void 0 || onClick(event);
|
|
173
|
+
}, [disabled, onClick]),
|
|
174
|
+
...props,
|
|
175
|
+
variant: "invisible",
|
|
176
|
+
"data-overflowing": dataOverflowingAttr
|
|
177
|
+
});
|
|
328
178
|
});
|
|
329
179
|
const ActionBarGroupContext = /*#__PURE__*/ React.createContext(null);
|
|
330
|
-
const ActionBarGroup = /*#__PURE__*/ forwardRef((
|
|
331
|
-
const $ = c(10);
|
|
332
|
-
const { children } = t0;
|
|
180
|
+
const ActionBarGroup = /*#__PURE__*/ forwardRef(({ children }, forwardedRef) => {
|
|
333
181
|
const backupRef = useRef(null);
|
|
334
182
|
const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
} else t1 = $[0];
|
|
340
|
-
const { dataOverflowingAttr, isOverflowing } = useActionBarItem(ref, t1);
|
|
341
|
-
let t2;
|
|
342
|
-
if ($[1] !== isOverflowing) {
|
|
343
|
-
t2 = { isOverflowing };
|
|
344
|
-
$[1] = isOverflowing;
|
|
345
|
-
$[2] = t2;
|
|
346
|
-
} else t2 = $[2];
|
|
347
|
-
let t3;
|
|
348
|
-
if ($[3] !== children || $[4] !== dataOverflowingAttr || $[5] !== ref) {
|
|
349
|
-
t3 = /*#__PURE__*/ jsx("div", {
|
|
183
|
+
const { dataOverflowingAttr, isOverflowing } = useActionBarItem(ref, useMemo(() => ({ type: "group" }), []));
|
|
184
|
+
return /*#__PURE__*/ jsx(ActionBarGroupContext.Provider, {
|
|
185
|
+
value: { isOverflowing },
|
|
186
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
350
187
|
className: ActionBar_module_css_default.Group,
|
|
351
188
|
"data-component": "ActionBar.Group",
|
|
352
189
|
ref,
|
|
353
190
|
"data-overflowing": dataOverflowingAttr,
|
|
354
191
|
children
|
|
355
|
-
})
|
|
356
|
-
|
|
357
|
-
$[4] = dataOverflowingAttr;
|
|
358
|
-
$[5] = ref;
|
|
359
|
-
$[6] = t3;
|
|
360
|
-
} else t3 = $[6];
|
|
361
|
-
let t4;
|
|
362
|
-
if ($[7] !== t2 || $[8] !== t3) {
|
|
363
|
-
t4 = /*#__PURE__*/ jsx(ActionBarGroupContext.Provider, {
|
|
364
|
-
value: t2,
|
|
365
|
-
children: t3
|
|
366
|
-
});
|
|
367
|
-
$[7] = t2;
|
|
368
|
-
$[8] = t3;
|
|
369
|
-
$[9] = t4;
|
|
370
|
-
} else t4 = $[9];
|
|
371
|
-
return t4;
|
|
192
|
+
})
|
|
193
|
+
});
|
|
372
194
|
});
|
|
373
|
-
const ActionBarMenu = /*#__PURE__*/ forwardRef((
|
|
374
|
-
const $ = c(31);
|
|
375
|
-
let ariaLabel;
|
|
376
|
-
let icon;
|
|
377
|
-
let items;
|
|
378
|
-
let overflowIcon;
|
|
379
|
-
let props;
|
|
380
|
-
let returnFocusRef;
|
|
381
|
-
if ($[0] !== t0) {
|
|
382
|
-
({"aria-label": ariaLabel, icon, overflowIcon, items, returnFocusRef, ...props} = t0);
|
|
383
|
-
$[0] = t0;
|
|
384
|
-
$[1] = ariaLabel;
|
|
385
|
-
$[2] = icon;
|
|
386
|
-
$[3] = items;
|
|
387
|
-
$[4] = overflowIcon;
|
|
388
|
-
$[5] = props;
|
|
389
|
-
$[6] = returnFocusRef;
|
|
390
|
-
} else {
|
|
391
|
-
ariaLabel = $[1];
|
|
392
|
-
icon = $[2];
|
|
393
|
-
items = $[3];
|
|
394
|
-
overflowIcon = $[4];
|
|
395
|
-
props = $[5];
|
|
396
|
-
returnFocusRef = $[6];
|
|
397
|
-
}
|
|
195
|
+
const ActionBarMenu = /*#__PURE__*/ forwardRef(({ "aria-label": ariaLabel, icon, overflowIcon, items, returnFocusRef, ...props }, forwardedRef) => {
|
|
398
196
|
const backupRef = useRef(null);
|
|
399
197
|
const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
400
198
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
if ($[12] !== ariaLabel || $[13] !== dataOverflowingAttr || $[14] !== icon || $[15] !== props) {
|
|
420
|
-
t3 = /*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
|
|
199
|
+
const { dataOverflowingAttr } = useActionBarItem(ref, useMemo(() => ({
|
|
200
|
+
type: "menu",
|
|
201
|
+
label: ariaLabel,
|
|
202
|
+
icon: overflowIcon ? overflowIcon : icon,
|
|
203
|
+
returnFocusRef,
|
|
204
|
+
items
|
|
205
|
+
}), [
|
|
206
|
+
ariaLabel,
|
|
207
|
+
overflowIcon,
|
|
208
|
+
icon,
|
|
209
|
+
items,
|
|
210
|
+
returnFocusRef
|
|
211
|
+
]));
|
|
212
|
+
return /*#__PURE__*/ jsxs(ActionMenu, {
|
|
213
|
+
anchorRef: ref,
|
|
214
|
+
open: menuOpen,
|
|
215
|
+
onOpenChange: setMenuOpen,
|
|
216
|
+
children: [/*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsx(IconButton, {
|
|
421
217
|
variant: "invisible",
|
|
422
218
|
"aria-label": ariaLabel,
|
|
423
219
|
icon,
|
|
424
220
|
...props,
|
|
425
221
|
"data-overflowing": dataOverflowingAttr,
|
|
426
222
|
"data-component": "ActionBar.Menu.IconButton"
|
|
427
|
-
}) })
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
$[16] = t3;
|
|
433
|
-
} else t3 = $[16];
|
|
434
|
-
let t4;
|
|
435
|
-
if ($[17] !== returnFocusRef) {
|
|
436
|
-
t4 = returnFocusRef && { returnFocusRef };
|
|
437
|
-
$[17] = returnFocusRef;
|
|
438
|
-
$[18] = t4;
|
|
439
|
-
} else t4 = $[18];
|
|
440
|
-
let t5;
|
|
441
|
-
if ($[19] !== items) {
|
|
442
|
-
t5 = items.map(_temp5);
|
|
443
|
-
$[19] = items;
|
|
444
|
-
$[20] = t5;
|
|
445
|
-
} else t5 = $[20];
|
|
446
|
-
let t6;
|
|
447
|
-
if ($[21] !== t5) {
|
|
448
|
-
t6 = /*#__PURE__*/ jsx(ActionList, { children: t5 });
|
|
449
|
-
$[21] = t5;
|
|
450
|
-
$[22] = t6;
|
|
451
|
-
} else t6 = $[22];
|
|
452
|
-
let t7;
|
|
453
|
-
if ($[23] !== t4 || $[24] !== t6) {
|
|
454
|
-
t7 = /*#__PURE__*/ jsx(ActionMenu.Overlay, {
|
|
455
|
-
...t4,
|
|
456
|
-
children: t6
|
|
457
|
-
});
|
|
458
|
-
$[23] = t4;
|
|
459
|
-
$[24] = t6;
|
|
460
|
-
$[25] = t7;
|
|
461
|
-
} else t7 = $[25];
|
|
462
|
-
let t8;
|
|
463
|
-
if ($[26] !== menuOpen || $[27] !== ref || $[28] !== t3 || $[29] !== t7) {
|
|
464
|
-
t8 = /*#__PURE__*/ jsxs(ActionMenu, {
|
|
465
|
-
anchorRef: ref,
|
|
466
|
-
open: menuOpen,
|
|
467
|
-
onOpenChange: setMenuOpen,
|
|
468
|
-
children: [t3, t7]
|
|
469
|
-
});
|
|
470
|
-
$[26] = menuOpen;
|
|
471
|
-
$[27] = ref;
|
|
472
|
-
$[28] = t3;
|
|
473
|
-
$[29] = t7;
|
|
474
|
-
$[30] = t8;
|
|
475
|
-
} else t8 = $[30];
|
|
476
|
-
return t8;
|
|
223
|
+
}) }), /*#__PURE__*/ jsx(ActionMenu.Overlay, {
|
|
224
|
+
...returnFocusRef && { returnFocusRef },
|
|
225
|
+
children: /*#__PURE__*/ jsx(ActionList, { children: items.map((item, index) => renderMenuItem(item, index)) })
|
|
226
|
+
})]
|
|
227
|
+
});
|
|
477
228
|
});
|
|
478
229
|
const VerticalDivider = () => {
|
|
479
|
-
const $ = c(3);
|
|
480
230
|
const ref = useRef(null);
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
t1 = /*#__PURE__*/ jsx("div", {
|
|
490
|
-
ref,
|
|
491
|
-
"data-component": "ActionBar.VerticalDivider",
|
|
492
|
-
"aria-hidden": "true",
|
|
493
|
-
className: ActionBar_module_css_default.Divider,
|
|
494
|
-
"data-overflowing": dataOverflowingAttr
|
|
495
|
-
});
|
|
496
|
-
$[1] = dataOverflowingAttr;
|
|
497
|
-
$[2] = t1;
|
|
498
|
-
} else t1 = $[2];
|
|
499
|
-
return t1;
|
|
231
|
+
const { dataOverflowingAttr } = useActionBarItem(ref, useMemo(() => ({ type: "divider" }), []));
|
|
232
|
+
return /*#__PURE__*/ jsx("div", {
|
|
233
|
+
ref,
|
|
234
|
+
"data-component": "ActionBar.VerticalDivider",
|
|
235
|
+
"aria-hidden": "true",
|
|
236
|
+
className: ActionBar_module_css_default.Divider,
|
|
237
|
+
"data-overflowing": dataOverflowingAttr
|
|
238
|
+
});
|
|
500
239
|
};
|
|
501
|
-
|
|
502
|
-
return entry[1] !== null;
|
|
503
|
-
}
|
|
504
|
-
function _temp2(element) {
|
|
505
|
-
return element.matches(FOCUSABLE_ITEM_SELECTOR);
|
|
506
|
-
}
|
|
507
|
-
function _temp3(item, index) {
|
|
508
|
-
return renderMenuItem(item, index);
|
|
509
|
-
}
|
|
510
|
-
function _temp4(t0) {
|
|
511
|
-
const [id, menuItem] = t0;
|
|
512
|
-
if (menuItem.type === "divider") return /*#__PURE__*/ jsx(ActionList.Divider, {}, id);
|
|
513
|
-
if (menuItem.type === "action") {
|
|
514
|
-
const { onClick, icon: Icon, label, disabled } = menuItem;
|
|
515
|
-
return /*#__PURE__*/ jsxs(ActionList.Item, {
|
|
516
|
-
onSelect: (event) => {
|
|
517
|
-
typeof onClick === "function" && onClick(event);
|
|
518
|
-
},
|
|
519
|
-
disabled,
|
|
520
|
-
children: [Icon ? /*#__PURE__*/ jsx(ActionList.LeadingVisual, { children: /*#__PURE__*/ jsx(Icon, {}) }) : null, label]
|
|
521
|
-
}, id);
|
|
522
|
-
}
|
|
523
|
-
if (menuItem.type === "menu") {
|
|
524
|
-
const menuItems = menuItem.items;
|
|
525
|
-
const { icon: Icon_0, label: label_0, returnFocusRef } = menuItem;
|
|
526
|
-
return /*#__PURE__*/ jsxs(ActionMenu, { children: [/*#__PURE__*/ jsx(ActionMenu.Anchor, { children: /*#__PURE__*/ jsxs(ActionList.Item, { children: [Icon_0 !== "none" ? /*#__PURE__*/ jsx(ActionList.LeadingVisual, { children: /*#__PURE__*/ jsx(Icon_0, {}) }) : null, label_0] }) }), /*#__PURE__*/ jsx(ActionMenu.Overlay, {
|
|
527
|
-
...returnFocusRef && { returnFocusRef },
|
|
528
|
-
children: /*#__PURE__*/ jsx(ActionList, { children: menuItems.map(_temp3) })
|
|
529
|
-
})] }, id);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
function _temp5(item, index) {
|
|
533
|
-
return renderMenuItem(item, index);
|
|
534
|
-
}
|
|
240
|
+
VerticalDivider.displayName = "VerticalDivider";
|
|
535
241
|
//#endregion
|
|
536
242
|
export { ActionBar, ActionBarButton, ActionBarGroup, ActionBarIconButton, ActionBarMenu, VerticalDivider };
|