@primer/react 0.0.0-20260309154957 → 0.0.0-20260309160559
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/dist/ActionList/List.d.ts.map +1 -1
- package/dist/ActionList/List.js +41 -41
- package/dist/ActionMenu/ActionMenu.d.ts.map +1 -1
- package/dist/ActionMenu/ActionMenu.js +7 -10
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts +2 -2
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +17 -7
- package/dist/Autocomplete/AutocompleteInput.js +3 -3
- package/dist/Autocomplete/AutocompleteOverlay.js +3 -3
- package/dist/Button/ButtonBase.d.ts.map +1 -1
- package/dist/Button/ButtonBase.js +4 -3
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +23 -23
- package/dist/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox/Checkbox.js +5 -5
- package/dist/Dialog/Dialog.js +9 -7
- package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +8 -8
- package/dist/Heading/Heading.js +3 -3
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +4 -3
- package/dist/Overlay/Overlay.js +21 -22
- package/dist/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/PageHeader/PageHeader.js +31 -30
- package/dist/PageLayout/PageLayout.js +5 -5
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +3 -4
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +6 -5
- package/dist/TextInputWithTokens/TextInputWithTokens.js +95 -96
- package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
- package/dist/TooltipV2/Tooltip.js +4 -4
- package/dist/deprecated/ActionMenu.d.ts.map +1 -1
- package/dist/deprecated/ActionMenu.js +7 -8
- package/dist/deprecated/DialogV1/Dialog.js +11 -12
- package/dist/experimental/SelectPanel2/SelectPanel.d.ts.map +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.js +4 -5
- package/dist/experimental/Tabs/Tabs.d.ts +1 -1
- package/dist/experimental/Tabs/Tabs.d.ts.map +1 -1
- package/dist/experimental/Tabs/Tabs.js +16 -16
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useAnchoredPosition.js +1 -1
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +1 -1
- package/dist/hooks/useProvidedRefOrCreate.d.ts +0 -12
- package/dist/hooks/useProvidedRefOrCreate.d.ts.map +1 -1
- package/dist/hooks/useProvidedRefOrCreate.js +0 -12
- package/dist/hooks/useRefObjectAsForwardedRef.d.ts +0 -12
- package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
- package/dist/hooks/useRefObjectAsForwardedRef.js +0 -12
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/generated/hooks.json +0 -22
- package/package.json +1 -1
- package/dist/hooks/useCombinedRefs.d.ts +0 -51
- package/dist/hooks/useCombinedRefs.d.ts.map +0 -1
- package/dist/hooks/useCombinedRefs.js +0 -97
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/ActionList/List.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/ActionList/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;AAoFrC,QAAA,MAAM,IAAI,GAxEa,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;oDAwER,CAAA;AAI3C,OAAO,EAAC,IAAI,EAAC,CAAA"}
|
package/dist/ActionList/List.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
4
4
|
import { ActionListContainerContext } from './ActionListContainerContext.js';
|
|
5
5
|
import { useSlots } from '../hooks/useSlots.js';
|
|
@@ -10,12 +10,12 @@ import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
|
10
10
|
import { clsx } from 'clsx';
|
|
11
11
|
import classes from './ActionList.module.css.js';
|
|
12
12
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
|
-
import {
|
|
13
|
+
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
14
14
|
import { FocusKeys } from '@primer/behaviors';
|
|
15
15
|
|
|
16
16
|
const UnwrappedList = (props, forwardedRef) => {
|
|
17
17
|
var _slots$heading$props$;
|
|
18
|
-
const $ = c(
|
|
18
|
+
const $ = c(37);
|
|
19
19
|
let className;
|
|
20
20
|
let restProps;
|
|
21
21
|
let role;
|
|
@@ -78,8 +78,7 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
78
78
|
} = React.useContext(ActionListContainerContext);
|
|
79
79
|
const ariaLabelledBy = slots.heading ? (_slots$heading$props$ = slots.heading.props.id) !== null && _slots$heading$props$ !== void 0 ? _slots$heading$props$ : headingId : listLabelledBy;
|
|
80
80
|
const listRole = role || listRoleFromContainer;
|
|
81
|
-
const listRef =
|
|
82
|
-
const combinedRef = useCombinedRefs(forwardedRef, listRef);
|
|
81
|
+
const listRef = useProvidedRefOrCreate(forwardedRef);
|
|
83
82
|
let enableFocusZone = false;
|
|
84
83
|
if (enableFocusZoneFromContainer !== undefined) {
|
|
85
84
|
enableFocusZone = enableFocusZoneFromContainer;
|
|
@@ -98,23 +97,24 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
98
97
|
const t5 = !enableFocusZone;
|
|
99
98
|
const t6 = listRole === "menu" || container === "SelectPanel" || container === "FilteredActionList" ? "wrap" : undefined;
|
|
100
99
|
let t7;
|
|
101
|
-
if ($[11] !==
|
|
100
|
+
if ($[11] !== listRef || $[12] !== t5 || $[13] !== t6) {
|
|
102
101
|
t7 = {
|
|
103
102
|
disabled: t5,
|
|
104
103
|
containerRef: listRef,
|
|
105
104
|
bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd | FocusKeys.PageUpDown,
|
|
106
105
|
focusOutBehavior: t6
|
|
107
106
|
};
|
|
108
|
-
$[11] =
|
|
109
|
-
$[12] =
|
|
110
|
-
$[13] =
|
|
107
|
+
$[11] = listRef;
|
|
108
|
+
$[12] = t5;
|
|
109
|
+
$[13] = t6;
|
|
110
|
+
$[14] = t7;
|
|
111
111
|
} else {
|
|
112
|
-
t7 = $[
|
|
112
|
+
t7 = $[14];
|
|
113
113
|
}
|
|
114
114
|
useFocusZone(t7);
|
|
115
115
|
const t8 = selectionVariant || containerSelectionVariant;
|
|
116
116
|
let t9;
|
|
117
|
-
if ($[
|
|
117
|
+
if ($[15] !== headingId || $[16] !== listRole || $[17] !== showDividers || $[18] !== t8 || $[19] !== variant) {
|
|
118
118
|
t9 = {
|
|
119
119
|
variant,
|
|
120
120
|
selectionVariant: t8,
|
|
@@ -122,61 +122,61 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
122
122
|
role: listRole,
|
|
123
123
|
headingId
|
|
124
124
|
};
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
125
|
+
$[15] = headingId;
|
|
126
|
+
$[16] = listRole;
|
|
127
|
+
$[17] = showDividers;
|
|
128
|
+
$[18] = t8;
|
|
129
|
+
$[19] = variant;
|
|
130
|
+
$[20] = t9;
|
|
131
131
|
} else {
|
|
132
|
-
t9 = $[
|
|
132
|
+
t9 = $[20];
|
|
133
133
|
}
|
|
134
134
|
const t10 = slots.heading;
|
|
135
135
|
let t11;
|
|
136
|
-
if ($[
|
|
136
|
+
if ($[21] !== className) {
|
|
137
137
|
t11 = clsx(classes.ActionList, className);
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
138
|
+
$[21] = className;
|
|
139
|
+
$[22] = t11;
|
|
140
140
|
} else {
|
|
141
|
-
t11 = $[
|
|
141
|
+
t11 = $[22];
|
|
142
142
|
}
|
|
143
143
|
let t12;
|
|
144
|
-
if ($[
|
|
144
|
+
if ($[23] !== Component || $[24] !== ariaLabelledBy || $[25] !== childrenWithoutSlots || $[26] !== listRef || $[27] !== listRole || $[28] !== restProps || $[29] !== showDividers || $[30] !== t11 || $[31] !== variant) {
|
|
145
145
|
t12 = /*#__PURE__*/jsx(Component, {
|
|
146
146
|
className: t11,
|
|
147
147
|
role: listRole,
|
|
148
148
|
"aria-labelledby": ariaLabelledBy,
|
|
149
|
-
ref:
|
|
149
|
+
ref: listRef,
|
|
150
150
|
"data-dividers": showDividers,
|
|
151
151
|
"data-variant": variant,
|
|
152
152
|
...restProps,
|
|
153
153
|
children: childrenWithoutSlots
|
|
154
154
|
});
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
155
|
+
$[23] = Component;
|
|
156
|
+
$[24] = ariaLabelledBy;
|
|
157
|
+
$[25] = childrenWithoutSlots;
|
|
158
|
+
$[26] = listRef;
|
|
159
|
+
$[27] = listRole;
|
|
160
|
+
$[28] = restProps;
|
|
161
|
+
$[29] = showDividers;
|
|
162
|
+
$[30] = t11;
|
|
163
|
+
$[31] = variant;
|
|
164
|
+
$[32] = t12;
|
|
165
165
|
} else {
|
|
166
|
-
t12 = $[
|
|
166
|
+
t12 = $[32];
|
|
167
167
|
}
|
|
168
168
|
let t13;
|
|
169
|
-
if ($[
|
|
169
|
+
if ($[33] !== slots.heading || $[34] !== t12 || $[35] !== t9) {
|
|
170
170
|
t13 = /*#__PURE__*/jsxs(ListContext.Provider, {
|
|
171
171
|
value: t9,
|
|
172
172
|
children: [t10, t12]
|
|
173
173
|
});
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
174
|
+
$[33] = slots.heading;
|
|
175
|
+
$[34] = t12;
|
|
176
|
+
$[35] = t9;
|
|
177
|
+
$[36] = t13;
|
|
178
178
|
} else {
|
|
179
|
-
t13 = $[
|
|
179
|
+
t13 = $[36];
|
|
180
180
|
}
|
|
181
181
|
return t13;
|
|
182
182
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../src/ActionMenu/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../src/ActionMenu/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAA;AAElF,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAA;AAE5D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAI5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,WAAW,CAAA;AAC1C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAIrD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAK/F,OAAO,KAAK,EAAC,gBAAgB,EAAE,cAAc,EAAC,MAAM,sBAAsB,CAAA;AAI1E,MAAM,MAAM,gBAAgB,GAAG,CAC7B,OAAO,EAAE,cAAc,GAAG,eAAe,GAAG,QAAQ,GAAG,KAAK,GAAG,aAAa,GAAG,YAAY,GAAG,OAAO,KAClG,I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CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext,
|
|
1
|
+
import React, { useContext, useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import { ChevronRightIcon, TriangleDownIcon } from '@primer/octicons-react';
|
|
3
3
|
import { Divider } from '../ActionList/Divider.js';
|
|
4
4
|
import { ActionListContainerContext } from '../ActionList/ActionListContainerContext.js';
|
|
@@ -10,7 +10,7 @@ import { isSlot } from '../utils/is-slot.js';
|
|
|
10
10
|
import { DialogContext } from '../Dialog/Dialog.js';
|
|
11
11
|
import { jsx } from 'react/jsx-runtime';
|
|
12
12
|
import { useProvidedStateOrCreate } from '../hooks/useProvidedStateOrCreate.js';
|
|
13
|
-
import {
|
|
13
|
+
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
14
14
|
import { useMenuKeyboardNavigation } from '../hooks/useMenuKeyboardNavigation.js';
|
|
15
15
|
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
16
16
|
import { AnchoredOverlay } from '../AnchoredOverlay/AnchoredOverlay.js';
|
|
@@ -72,8 +72,7 @@ const Menu = ({
|
|
|
72
72
|
}, [setCombinedOpenState, parentMenuContext, open, isNarrow]);
|
|
73
73
|
const menuButtonChild = React.Children.toArray(children).find(child => /*#__PURE__*/React.isValidElement(child) && (child.type === MenuButton || child.type === Anchor || isSlot(child, Anchor) || isSlot(child, MenuButton)));
|
|
74
74
|
const menuButtonChildId = /*#__PURE__*/React.isValidElement(menuButtonChild) ? menuButtonChild.props.id : undefined;
|
|
75
|
-
const anchorRef =
|
|
76
|
-
const combinedRef = useCombinedRefs(anchorRef, externalAnchorRef);
|
|
75
|
+
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
|
77
76
|
const anchorId = useId(menuButtonChildId);
|
|
78
77
|
let renderAnchor = null;
|
|
79
78
|
// 🚨 Hack for good API!
|
|
@@ -94,7 +93,7 @@ const Menu = ({
|
|
|
94
93
|
}, anchorChildren.props));
|
|
95
94
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
96
95
|
children: triggerButton,
|
|
97
|
-
ref:
|
|
96
|
+
ref: anchorRef
|
|
98
97
|
});
|
|
99
98
|
};
|
|
100
99
|
}
|
|
@@ -116,7 +115,7 @@ const Menu = ({
|
|
|
116
115
|
});
|
|
117
116
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
118
117
|
children: tooltip,
|
|
119
|
-
ref:
|
|
118
|
+
ref: anchorRef
|
|
120
119
|
});
|
|
121
120
|
};
|
|
122
121
|
}
|
|
@@ -219,7 +218,7 @@ const Overlay = ({
|
|
|
219
218
|
// we typecast anchorRef as required instead of optional
|
|
220
219
|
// because we know that we're setting it in context in Menu
|
|
221
220
|
const {
|
|
222
|
-
anchorRef
|
|
221
|
+
anchorRef,
|
|
223
222
|
renderAnchor,
|
|
224
223
|
anchorId,
|
|
225
224
|
open,
|
|
@@ -227,8 +226,6 @@ const Overlay = ({
|
|
|
227
226
|
onClose,
|
|
228
227
|
isSubmenu = false
|
|
229
228
|
} = React.useContext(MenuContext);
|
|
230
|
-
const anchorRef = useRef(null);
|
|
231
|
-
const combinedAnchorRef = useCombinedRefs(anchorRef, contextAnchorRef);
|
|
232
229
|
const containerRef = React.useRef(null);
|
|
233
230
|
const isNarrow = useResponsiveValue({
|
|
234
231
|
narrow: true
|
|
@@ -262,7 +259,7 @@ const Overlay = ({
|
|
|
262
259
|
const featureFlagDisplayInViewportInsideDialog = useFeatureFlag('primer_react_action_menu_display_in_viewport_inside_dialog');
|
|
263
260
|
const isInsideDialog = useContext(DialogContext) !== undefined;
|
|
264
261
|
return /*#__PURE__*/jsx(AnchoredOverlay, {
|
|
265
|
-
anchorRef:
|
|
262
|
+
anchorRef: anchorRef,
|
|
266
263
|
renderAnchor: renderAnchor,
|
|
267
264
|
anchorId: anchorId,
|
|
268
265
|
open: open,
|
|
@@ -15,7 +15,7 @@ interface AnchoredOverlayPropsWithAnchor {
|
|
|
15
15
|
/**
|
|
16
16
|
* An override to the internal ref that will be spread on to the renderAnchor
|
|
17
17
|
*/
|
|
18
|
-
anchorRef?: React.
|
|
18
|
+
anchorRef?: React.RefObject<HTMLElement | null>;
|
|
19
19
|
/**
|
|
20
20
|
* An override to the internal id that will be spread on to the renderAnchor
|
|
21
21
|
*/
|
|
@@ -31,7 +31,7 @@ interface AnchoredOverlayPropsWithoutAnchor {
|
|
|
31
31
|
* An override to the internal renderAnchor ref that will be used to position the overlay.
|
|
32
32
|
* When renderAnchor is null this can be used to make an anchor that is detached from ActionMenu.
|
|
33
33
|
*/
|
|
34
|
-
anchorRef: React.
|
|
34
|
+
anchorRef: React.RefObject<HTMLElement | null>;
|
|
35
35
|
/**
|
|
36
36
|
* An override to the internal id that will be spread on to the renderAnchor
|
|
37
37
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,
|
|
1
|
+
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAyB,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AACtD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAEhE,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAIhE,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,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B,CAAC,CAAA;IAElD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,YAAY,CAAC,CAAA;IAChE;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,EAAC,QAAQ,EAAC,EAAE;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAC,KAAK,IAAI,CAAA;IACnE;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAC5C;AAED,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GACzD,CAAC,8BAA8B,GAAG,iCAAiC,CAAC,GACpE,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,iBAAiB,GAAG,mBAAmB,CAAC,CAAC,CAAA;AAS9G;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CA6JnF,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCallback, useEffect } from 'react';
|
|
2
2
|
import { useFocusTrap } from '../hooks/useFocusTrap.js';
|
|
3
3
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
4
4
|
import { useId } from '../hooks/useId.js';
|
|
@@ -7,7 +7,7 @@ import { XIcon } from '@primer/octicons-react';
|
|
|
7
7
|
import classes from './AnchoredOverlay.module.css.js';
|
|
8
8
|
import { clsx } from 'clsx';
|
|
9
9
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
10
|
-
import {
|
|
10
|
+
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
11
11
|
import { useRenderForcingRef } from '../hooks/useRenderForcingRef.js';
|
|
12
12
|
import { useAnchoredPosition } from '../hooks/useAnchoredPosition.js';
|
|
13
13
|
import Overlay from '../Overlay/Overlay.js';
|
|
@@ -48,10 +48,8 @@ const AnchoredOverlay = ({
|
|
|
48
48
|
displayCloseButton = true,
|
|
49
49
|
closeButtonProps = defaultCloseButtonProps
|
|
50
50
|
}) => {
|
|
51
|
-
const anchorRef =
|
|
52
|
-
const combinedRef = useCombinedRefs(anchorRef, externalAnchorRef);
|
|
51
|
+
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
|
53
52
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
|
54
|
-
const combinedOverlayRef = useCombinedRefs(updateOverlayRef, overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.ref);
|
|
55
53
|
const anchorId = useId(externalAnchorId);
|
|
56
54
|
const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose('click-outside'), [onClose]);
|
|
57
55
|
const onEscape = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose('escape'), [onClose]);
|
|
@@ -114,7 +112,7 @@ const AnchoredOverlay = ({
|
|
|
114
112
|
const XButtonAriaLabel = closeButtonProps['aria-label'];
|
|
115
113
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
116
114
|
children: [renderAnchor && renderAnchor({
|
|
117
|
-
ref:
|
|
115
|
+
ref: anchorRef,
|
|
118
116
|
id: anchorId,
|
|
119
117
|
'aria-haspopup': 'true',
|
|
120
118
|
'aria-expanded': open,
|
|
@@ -138,7 +136,12 @@ const AnchoredOverlay = ({
|
|
|
138
136
|
preventOverflow: preventOverflow,
|
|
139
137
|
"data-component": "AnchoredOverlay",
|
|
140
138
|
...overlayProps,
|
|
141
|
-
ref:
|
|
139
|
+
ref: node => {
|
|
140
|
+
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) {
|
|
141
|
+
assignRef(overlayProps.ref, node);
|
|
142
|
+
}
|
|
143
|
+
updateOverlayRef(node);
|
|
144
|
+
},
|
|
142
145
|
children: [showXIcon ? /*#__PURE__*/jsx("div", {
|
|
143
146
|
className: classes.ResponsiveCloseButtonContainer,
|
|
144
147
|
children: /*#__PURE__*/jsx(IconButton, {
|
|
@@ -162,6 +165,13 @@ const AnchoredOverlay = ({
|
|
|
162
165
|
}) : null]
|
|
163
166
|
});
|
|
164
167
|
};
|
|
168
|
+
function assignRef(ref, value) {
|
|
169
|
+
if (typeof ref === 'function') {
|
|
170
|
+
ref(value);
|
|
171
|
+
} else if (ref) {
|
|
172
|
+
ref.current = value;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
165
175
|
AnchoredOverlay.displayName = 'AnchoredOverlay';
|
|
166
176
|
|
|
167
177
|
export { AnchoredOverlay };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useContext, useState, useCallback, useEffect } from 'react';
|
|
2
2
|
import { AutocompleteContext, AutocompleteInputContext } from './AutocompleteContext.js';
|
|
3
|
-
import {
|
|
3
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
4
4
|
import useSafeTimeout from '../hooks/useSafeTimeout.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
import TextInput from '../TextInput/TextInput.js';
|
|
@@ -36,7 +36,7 @@ const AutocompleteInput = /*#__PURE__*/React.forwardRef(({
|
|
|
36
36
|
inputValue = '',
|
|
37
37
|
isMenuDirectlyActivated
|
|
38
38
|
} = inputContext;
|
|
39
|
-
|
|
39
|
+
useRefObjectAsForwardedRef(forwardedRef, inputRef);
|
|
40
40
|
const [highlightRemainingText, setHighlightRemainingText] = useState(true);
|
|
41
41
|
const {
|
|
42
42
|
safeSetTimeout
|
|
@@ -130,7 +130,7 @@ const AutocompleteInput = /*#__PURE__*/React.forwardRef(({
|
|
|
130
130
|
onKeyDown: handleInputKeyDown,
|
|
131
131
|
onKeyPress: onInputKeyPress,
|
|
132
132
|
onKeyUp: handleInputKeyUp,
|
|
133
|
-
ref:
|
|
133
|
+
ref: inputRef,
|
|
134
134
|
"aria-controls": `${id}-listbox`,
|
|
135
135
|
"aria-autocomplete": "both",
|
|
136
136
|
role: "combobox",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext, useRef, useEffect, useCallback } from 'react';
|
|
2
2
|
import { AutocompleteContext } from './AutocompleteContext.js';
|
|
3
|
-
import {
|
|
3
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
4
4
|
import VisuallyHidden from '../_VisuallyHidden.js';
|
|
5
5
|
import classes from './AutocompleteOverlay.module.css.js';
|
|
6
6
|
import { clsx } from 'clsx';
|
|
@@ -48,7 +48,7 @@ function AutocompleteOverlay({
|
|
|
48
48
|
align: 'start',
|
|
49
49
|
anchorElementRef: computedAnchorRef
|
|
50
50
|
}, [showMenu, selectedItemLength]);
|
|
51
|
-
|
|
51
|
+
useRefObjectAsForwardedRef(scrollContainerRef, floatingElementRef);
|
|
52
52
|
const closeOptionList = useCallback(() => {
|
|
53
53
|
setShowMenu(false);
|
|
54
54
|
}, [setShowMenu]);
|
|
@@ -60,7 +60,7 @@ function AutocompleteOverlay({
|
|
|
60
60
|
preventFocusOnOpen: true,
|
|
61
61
|
onClickOutside: closeOptionList,
|
|
62
62
|
onEscape: closeOptionList,
|
|
63
|
-
ref:
|
|
63
|
+
ref: floatingElementRef,
|
|
64
64
|
top: position === null || position === void 0 ? void 0 : position.top,
|
|
65
65
|
left: position === null || position === void 0 ? void 0 : position.left,
|
|
66
66
|
className: clsx(classes.Overlay, className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../src/Button/ButtonBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAC/F,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AA2BxC,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../src/Button/ButtonBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAC/F,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AA2BxC,QAAA,MAAM,UAAU,EA2JV,8BAA8B,CAAC,QAAQ,GAAG,GAAG,EAAE,WAAW,CAAC,CAAA;AAEjE,OAAO,EAAC,UAAU,EAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
3
3
|
import { ConditionalWrapper } from '../internal/components/ConditionalWrapper.js';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import classes from './ButtonBase.module.css.js';
|
|
@@ -46,7 +46,7 @@ const ButtonBase = /*#__PURE__*/forwardRef(({
|
|
|
46
46
|
...rest
|
|
47
47
|
} = props;
|
|
48
48
|
const innerRef = React.useRef(null);
|
|
49
|
-
|
|
49
|
+
useRefObjectAsForwardedRef(forwardedRef, innerRef);
|
|
50
50
|
const uuid = useId(id);
|
|
51
51
|
const loadingAnnouncementID = `${uuid}-loading-announcement`;
|
|
52
52
|
|
|
@@ -74,7 +74,8 @@ const ButtonBase = /*#__PURE__*/forwardRef(({
|
|
|
74
74
|
children: [/*#__PURE__*/jsx(Component, {
|
|
75
75
|
"aria-disabled": loading ? true : undefined,
|
|
76
76
|
...rest,
|
|
77
|
-
|
|
77
|
+
// @ts-ignore temporary disable as we migrate to css modules, until we remove PolymorphicForwardRefComponent
|
|
78
|
+
ref: innerRef,
|
|
78
79
|
className: clsx(classes.ButtonBase, className),
|
|
79
80
|
"data-block": block ? 'block' : null,
|
|
80
81
|
"data-inactive": inactive ? true : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../../src/ButtonGroup/ButtonGroup.tsx"],"names":[],"mappings":"AAAA,OAAc,
|
|
1
|
+
{"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../../src/ButtonGroup/ButtonGroup.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAC,KAAK,iBAAiB,EAAC,MAAM,OAAO,CAAA;AAKnD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAE/F,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;IAC/C,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;AAEF,QAAA,MAAM,WAAW,EAoBX,8BAA8B,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAA;AAI7D,eAAe,WAAW,CAAA"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import classes from './ButtonGroup.module.css.js';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
|
-
import {
|
|
7
|
+
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
8
8
|
import { FocusKeys } from '@primer/behaviors';
|
|
9
9
|
|
|
10
10
|
const ButtonGroup = /*#__PURE__*/React.forwardRef(function ButtonGroup(t0, forwardRef) {
|
|
11
|
-
const $ = c(
|
|
11
|
+
const $ = c(20);
|
|
12
12
|
let children;
|
|
13
13
|
let className;
|
|
14
14
|
let rest;
|
|
@@ -45,49 +45,49 @@ const ButtonGroup = /*#__PURE__*/React.forwardRef(function ButtonGroup(t0, forwa
|
|
|
45
45
|
t2 = $[7];
|
|
46
46
|
}
|
|
47
47
|
const buttons = t2;
|
|
48
|
-
const buttonRef =
|
|
49
|
-
const combinedRef = useCombinedRefs(buttonRef, forwardRef);
|
|
48
|
+
const buttonRef = useProvidedRefOrCreate(forwardRef);
|
|
50
49
|
const t3 = role !== "toolbar";
|
|
51
50
|
let t4;
|
|
52
|
-
if ($[8] !== t3) {
|
|
51
|
+
if ($[8] !== buttonRef || $[9] !== t3) {
|
|
53
52
|
t4 = {
|
|
54
53
|
containerRef: buttonRef,
|
|
55
54
|
disabled: t3,
|
|
56
55
|
bindKeys: FocusKeys.ArrowHorizontal,
|
|
57
56
|
focusOutBehavior: "wrap"
|
|
58
57
|
};
|
|
59
|
-
$[8] =
|
|
60
|
-
$[9] =
|
|
58
|
+
$[8] = buttonRef;
|
|
59
|
+
$[9] = t3;
|
|
60
|
+
$[10] = t4;
|
|
61
61
|
} else {
|
|
62
|
-
t4 = $[
|
|
62
|
+
t4 = $[10];
|
|
63
63
|
}
|
|
64
64
|
useFocusZone(t4);
|
|
65
65
|
let t5;
|
|
66
|
-
if ($[
|
|
66
|
+
if ($[11] !== className) {
|
|
67
67
|
t5 = clsx(className, classes.ButtonGroup);
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
68
|
+
$[11] = className;
|
|
69
|
+
$[12] = t5;
|
|
70
70
|
} else {
|
|
71
|
-
t5 = $[
|
|
71
|
+
t5 = $[12];
|
|
72
72
|
}
|
|
73
73
|
let t6;
|
|
74
|
-
if ($[
|
|
74
|
+
if ($[13] !== BaseComponent || $[14] !== buttonRef || $[15] !== buttons || $[16] !== rest || $[17] !== role || $[18] !== t5) {
|
|
75
75
|
t6 = /*#__PURE__*/jsx(BaseComponent, {
|
|
76
|
-
ref:
|
|
76
|
+
ref: buttonRef,
|
|
77
77
|
className: t5,
|
|
78
78
|
role: role,
|
|
79
79
|
...rest,
|
|
80
80
|
children: buttons
|
|
81
81
|
});
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
82
|
+
$[13] = BaseComponent;
|
|
83
|
+
$[14] = buttonRef;
|
|
84
|
+
$[15] = buttons;
|
|
85
|
+
$[16] = rest;
|
|
86
|
+
$[17] = role;
|
|
87
|
+
$[18] = t5;
|
|
88
|
+
$[19] = t6;
|
|
89
89
|
} else {
|
|
90
|
-
t6 = $[
|
|
90
|
+
t6 = $[19];
|
|
91
91
|
}
|
|
92
92
|
return t6;
|
|
93
93
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAiD,KAAK,mBAAmB,EAAoB,MAAM,OAAO,CAAA;AAExH,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAA;AAI7E,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAElD,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAA;IACvC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,oBAAoB,CAAA;IACvC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,OAAO,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,CAAA;AAE3D;;GAEG;AACH,QAAA,MAAM,QAAQ,qGAgDb,CAAA;wBAK0B,cAAc,CAAC,OAAO,QAAQ,CAAC;AAA1D,wBAA0D"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useContext, useEffect } from 'react';
|
|
3
3
|
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
4
4
|
import { CheckboxGroupContext } from '../CheckboxGroup/CheckboxGroupContext.js';
|
|
5
5
|
import classes from './Checkbox.module.css.js';
|
|
6
6
|
import sharedClasses from './shared.module.css.js';
|
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
|
8
|
-
import {
|
|
8
|
+
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* An accessible, native checkbox component
|
|
@@ -24,8 +24,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
24
24
|
}, ref
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
26
|
) => {
|
|
27
|
-
const checkboxRef =
|
|
28
|
-
const combinedRef = useCombinedRefs(checkboxRef, ref);
|
|
27
|
+
const checkboxRef = useProvidedRefOrCreate(ref);
|
|
29
28
|
const checkboxGroupContext = useContext(CheckboxGroupContext);
|
|
30
29
|
const handleOnChange = e => {
|
|
31
30
|
checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
|
|
@@ -34,7 +33,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
34
33
|
const inputProps = {
|
|
35
34
|
type: 'checkbox',
|
|
36
35
|
disabled,
|
|
37
|
-
ref:
|
|
36
|
+
ref: checkboxRef,
|
|
38
37
|
checked: indeterminate ? false : checked,
|
|
39
38
|
defaultChecked,
|
|
40
39
|
required,
|
|
@@ -63,6 +62,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
63
62
|
checkbox.setAttribute('aria-checked', checkbox.checked ? 'true' : 'false');
|
|
64
63
|
}
|
|
65
64
|
});
|
|
65
|
+
// @ts-expect-error inputProp needs a non nullable ref
|
|
66
66
|
return /*#__PURE__*/jsx("input", {
|
|
67
67
|
...inputProps,
|
|
68
68
|
className: clsx(className, sharedClasses.Input, classes.Checkbox)
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -6,7 +6,7 @@ import { XIcon } from '@primer/octicons-react';
|
|
|
6
6
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
7
7
|
import { FocusKeys } from '@primer/behaviors';
|
|
8
8
|
import { Portal } from '../Portal/Portal.js';
|
|
9
|
-
import {
|
|
9
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
10
10
|
import { useId } from '../hooks/useId.js';
|
|
11
11
|
import classes from './Dialog.module.css.js';
|
|
12
12
|
import { clsx } from 'clsx';
|
|
@@ -14,6 +14,7 @@ import { useSlots } from '../hooks/useSlots.js';
|
|
|
14
14
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
15
15
|
import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
|
|
16
16
|
import { ScrollableRegion } from '../ScrollableRegion/ScrollableRegion.js';
|
|
17
|
+
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
17
18
|
|
|
18
19
|
const DefaultHeader = ({
|
|
19
20
|
dialogLabelId,
|
|
@@ -125,7 +126,7 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
125
126
|
footer: Dialog.Footer
|
|
126
127
|
});
|
|
127
128
|
const dialogRef = useRef(null);
|
|
128
|
-
|
|
129
|
+
useRefObjectAsForwardedRef(forwardedRef, dialogRef);
|
|
129
130
|
const backdropRef = useRef(null);
|
|
130
131
|
useFocusTrap({
|
|
131
132
|
containerRef: dialogRef,
|
|
@@ -188,7 +189,7 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
188
189
|
setLastMouseDownIsBackdrop(e.target === e.currentTarget);
|
|
189
190
|
},
|
|
190
191
|
children: /*#__PURE__*/jsxs("div", {
|
|
191
|
-
ref:
|
|
192
|
+
ref: dialogRef,
|
|
192
193
|
role: role,
|
|
193
194
|
"aria-labelledby": dialogLabelId,
|
|
194
195
|
"aria-describedby": dialogDescriptionId,
|
|
@@ -271,8 +272,7 @@ const Buttons = ({
|
|
|
271
272
|
buttons
|
|
272
273
|
}) => {
|
|
273
274
|
var _buttons$find;
|
|
274
|
-
const autoFocusRef =
|
|
275
|
-
const combinedRef = useCombinedRefs(autoFocusRef, (_buttons$find = buttons.find(button => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref);
|
|
275
|
+
const autoFocusRef = useProvidedRefOrCreate((_buttons$find = buttons.find(button => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref);
|
|
276
276
|
let autoFocusCount = 0;
|
|
277
277
|
const [hasRendered, setHasRendered] = useState(0);
|
|
278
278
|
useEffect(() => {
|
|
@@ -295,8 +295,10 @@ const Buttons = ({
|
|
|
295
295
|
return /*#__PURE__*/jsx(ButtonComponent, {
|
|
296
296
|
...buttonProps,
|
|
297
297
|
// 'normal' value is equivalent to 'default', this is used for backwards compatibility
|
|
298
|
-
variant: buttonType === 'normal' ? 'default' : buttonType
|
|
299
|
-
|
|
298
|
+
variant: buttonType === 'normal' ? 'default' : buttonType
|
|
299
|
+
// @ts-expect-error it needs a non nullable ref
|
|
300
|
+
,
|
|
301
|
+
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, autoFocusRef) : null,
|
|
300
302
|
children: content
|
|
301
303
|
}, index);
|
|
302
304
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilteredActionList.d.ts","sourceRoot":"","sources":["../../src/FilteredActionList/FilteredActionList.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuB,GAAG,EAAC,MAAM,OAAO,CAAA;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAA;AAEhD,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,eAAe,CAAA;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAA0B,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"FilteredActionList.d.ts","sourceRoot":"","sources":["../../src/FilteredActionList/FilteredActionList.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuB,GAAG,EAAC,MAAM,OAAO,CAAA;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAA;AAEhD,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,eAAe,CAAA;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAA0B,MAAM,IAAI,CAAA;AAOhF,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,6BAA6B,CAAA;AAY9E,MAAM,WAAW,uBAAwB,SAAQ,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,MAAM,aAAa,CAAC,CAAC,EAAE,aAAa;IAClH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,6BAA6B,CAAA;IAC3C,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,GAAG,IAAI,KAAK,IAAI,CAAA;IACtF,yBAAyB,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;IAC7D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