@primer/react 0.0.0-20260304102724 → 0.0.0-20260304110422
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 +10 -2
- package/dist/ActionBar/ActionBar.d.ts.map +1 -1
- package/dist/ActionBar/ActionBar.js +281 -431
- package/dist/ActionMenu/ActionMenu.d.ts.map +1 -1
- package/dist/ActionMenu/ActionMenu.js +22 -21
- package/dist/Autocomplete/AutocompleteMenu.d.ts.map +1 -1
- package/dist/Autocomplete/AutocompleteMenu.js +38 -80
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +106 -152
- package/dist/Timeline/{Timeline-116393ee.css → Timeline-19bef8c5.css} +2 -2
- package/dist/Timeline/{Timeline-116393ee.css.map → Timeline-19bef8c5.css.map} +1 -1
- package/dist/Timeline/Timeline.module.css.js +1 -1
- package/dist/utils/descendant-registry.d.ts +32 -0
- package/dist/utils/descendant-registry.d.ts.map +1 -0
- package/dist/utils/descendant-registry.js +222 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
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,CA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AM,qBAAqB,GAAG;IAAC,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AA0DxH,6CAA6C;AAC7C,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAA;AAe/C,KAAK,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,GAC3C,IAAI,CAAC,oBAAoB,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,mBAAmB,CAAC,GAAG;IAC/E;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,gBAAgB,CAAC,EAAE,CAAC,EAAC,QAAQ,EAAC,EAAE;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAC,KAAK,IAAI,CAAA;CACpE,CAAA;AAoHH,eAAO,MAAM,UAAU;;;kBAhMP,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;aAC5B,MAAM;;;;CA+L4E,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext, useState, useEffect, useCallback
|
|
1
|
+
import React, { useContext, useMemo, useState, useEffect, useCallback } 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';
|
|
@@ -130,17 +130,18 @@ const Menu = ({
|
|
|
130
130
|
return child;
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
|
+
const isSubmenu = parentMenuContext.isSubmenu !== undefined;
|
|
134
|
+
const menuContextValue = useMemo(() => ({
|
|
135
|
+
anchorRef,
|
|
136
|
+
renderAnchor,
|
|
137
|
+
anchorId,
|
|
138
|
+
open: combinedOpenState,
|
|
139
|
+
onOpen,
|
|
140
|
+
onClose,
|
|
141
|
+
isSubmenu
|
|
142
|
+
}), [anchorRef, renderAnchor, anchorId, combinedOpenState, onOpen, onClose, isSubmenu]);
|
|
133
143
|
return /*#__PURE__*/jsx(MenuContext.Provider, {
|
|
134
|
-
value:
|
|
135
|
-
anchorRef,
|
|
136
|
-
renderAnchor,
|
|
137
|
-
anchorId,
|
|
138
|
-
open: combinedOpenState,
|
|
139
|
-
onOpen,
|
|
140
|
-
onClose,
|
|
141
|
-
// will be undefined for the outermost level, then false for the top menu, then true inside that
|
|
142
|
-
isSubmenu: parentMenuContext.isSubmenu !== undefined
|
|
143
|
-
},
|
|
144
|
+
value: menuContextValue,
|
|
144
145
|
children: contents
|
|
145
146
|
});
|
|
146
147
|
};
|
|
@@ -256,6 +257,15 @@ const Overlay = ({
|
|
|
256
257
|
}
|
|
257
258
|
}
|
|
258
259
|
}, [anchorRef]);
|
|
260
|
+
const afterSelect = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose('item-select'), [onClose]);
|
|
261
|
+
const overlayContextValue = useMemo(() => ({
|
|
262
|
+
container: 'ActionMenu',
|
|
263
|
+
listRole: 'menu',
|
|
264
|
+
listLabelledBy: ariaLabelledby || anchorAriaLabelledby || anchorId,
|
|
265
|
+
selectionAttribute: 'aria-checked',
|
|
266
|
+
afterSelect,
|
|
267
|
+
enableFocusZone: isNarrowFullscreen
|
|
268
|
+
}), [ariaLabelledby, anchorAriaLabelledby, anchorId, afterSelect, isNarrowFullscreen]);
|
|
259
269
|
const featureFlagDisplayInViewportInsideDialog = useFeatureFlag('primer_react_action_menu_display_in_viewport_inside_dialog');
|
|
260
270
|
const isInsideDialog = useContext(DialogContext) !== undefined;
|
|
261
271
|
return /*#__PURE__*/jsx(AnchoredOverlay, {
|
|
@@ -287,16 +297,7 @@ const Overlay = ({
|
|
|
287
297
|
[`data-max-height-${overlayProps.maxHeight}`]: ''
|
|
288
298
|
} : {}),
|
|
289
299
|
children: /*#__PURE__*/jsx(ActionListContainerContext.Provider, {
|
|
290
|
-
value:
|
|
291
|
-
container: 'ActionMenu',
|
|
292
|
-
listRole: 'menu',
|
|
293
|
-
// If there is a custom aria-labelledby, use that. Otherwise, if exists, use the id that labels the anchor such as tooltip. If none of them exist, use anchor id.
|
|
294
|
-
listLabelledBy: ariaLabelledby || anchorAriaLabelledby || anchorId,
|
|
295
|
-
selectionAttribute: 'aria-checked',
|
|
296
|
-
// Should this be here?
|
|
297
|
-
afterSelect: () => onClose === null || onClose === void 0 ? void 0 : onClose('item-select'),
|
|
298
|
-
enableFocusZone: isNarrowFullscreen // AnchoredOverlay takes care of focus zone. We only want to enable this if menu is narrow fullscreen.
|
|
299
|
-
},
|
|
300
|
+
value: overlayContextValue,
|
|
300
301
|
children: children
|
|
301
302
|
})
|
|
302
303
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteMenu.d.ts","sourceRoot":"","sources":["../../src/Autocomplete/AutocompleteMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAA;AAK7E,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,eAAe,CAAA;AAGtD,OAAO,KAAK,EAAC,cAAc,EAAE,YAAY,EAAW,MAAM,gBAAgB,CAAA;AAI1E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAOrD,KAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,IAAI,CAAA;AAClD,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,mBAAmB,EAAE,IAAI,CAAC,GAAG;IAE3E,aAAa,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IACrG,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,cAAc,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAA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E,UAAU,GAAG,eAAe,CAAC,KAAK,IAAI,CAAA;KACrE,CAAA;IAED;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,GAAG,IAAI,CAAA;IAE/C;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAA;IAE1C;;;OAGG;IACH,KAAK,EAAE,CAAC,EAAE,CAAA;IAEV;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;OAEG;IAEH,eAAe,EAAE,MAAM,EAAE,CAAA;IAEzB;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;IAE5D;;OAEG;IACH,gBAAgB,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAExC;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAEtC;;OAEG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAA;IAEtC;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAErE,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC5B,CAAA;AAUD,iBAAS,gBAAgB,CAAC,CAAC,SAAS,qBAAqB,EAAE,KAAK,EAAE,6BAA6B,CAAC,CAAC,CAAC,qBAqRjG;kBArRQ,gBAAgB;;;;AAyRzB,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAC3E,eAAe,gBAAgB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext, useRef,
|
|
1
|
+
import React, { useContext, useRef, useState, useMemo, useEffect } from 'react';
|
|
2
2
|
import { debounce } from '@github/mini-throttle';
|
|
3
3
|
import { announce } from '@primer/live-region-element';
|
|
4
4
|
import { scrollIntoView } from '@primer/behaviors';
|
|
@@ -33,41 +33,6 @@ function getdefaultCheckedSelectionChange(setInputValueFn) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
const isItemSelected = (itemId, selectedItemIds) => selectedItemIds.includes(itemId);
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Memoized wrapper around ActionList.Item that skips re-rendering when props
|
|
39
|
-
* haven't changed. Combined with the `highlightedItem` ref (instead of state),
|
|
40
|
-
* arrow-key navigation no longer triggers re-renders of the item list.
|
|
41
|
-
*/
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
-
const MemoizedAutocompleteItem = /*#__PURE__*/React.memo(function MemoizedAutocompleteItem({
|
|
44
|
-
item
|
|
45
|
-
}) {
|
|
46
|
-
const {
|
|
47
|
-
id,
|
|
48
|
-
onAction,
|
|
49
|
-
children,
|
|
50
|
-
text,
|
|
51
|
-
leadingVisual: LeadingVisual,
|
|
52
|
-
trailingVisual: TrailingVisual,
|
|
53
|
-
role,
|
|
54
|
-
...itemProps
|
|
55
|
-
} = item;
|
|
56
|
-
// Remove key from itemProps so it doesn't spread onto the DOM
|
|
57
|
-
delete itemProps.key;
|
|
58
|
-
return /*#__PURE__*/jsxs(ActionList.Item, {
|
|
59
|
-
onSelect: () => onAction(item),
|
|
60
|
-
...itemProps,
|
|
61
|
-
id: id,
|
|
62
|
-
"data-id": id,
|
|
63
|
-
role: role,
|
|
64
|
-
children: [LeadingVisual && /*#__PURE__*/jsx(ActionList.LeadingVisual, {
|
|
65
|
-
children: isElement(LeadingVisual) ? LeadingVisual : /*#__PURE__*/jsx(LeadingVisual, {})
|
|
66
|
-
}), children !== null && children !== void 0 ? children : text, TrailingVisual && /*#__PURE__*/jsx(ActionList.TrailingVisual, {
|
|
67
|
-
children: isElement(TrailingVisual) ? TrailingVisual : /*#__PURE__*/jsx(TrailingVisual, {})
|
|
68
|
-
})]
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
36
|
function getItemById(itemId, items) {
|
|
72
37
|
return items.find(item => item.id === itemId);
|
|
73
38
|
}
|
|
@@ -120,19 +85,7 @@ function AutocompleteMenu(props) {
|
|
|
120
85
|
} = props;
|
|
121
86
|
const listContainerRef = useRef(null);
|
|
122
87
|
const allItemsToRenderRef = useRef([]);
|
|
123
|
-
|
|
124
|
-
// on every arrow-key press. The active styling was already handled via DOM by
|
|
125
|
-
// useFocusZone (data-is-active-descendant) before this change, but the
|
|
126
|
-
// previous useState caused React to re-render the entire item list anyway.
|
|
127
|
-
const highlightedItemRef = useRef();
|
|
128
|
-
const deferredInputValueRef = useRef(deferredInputValue);
|
|
129
|
-
const selectedItemIdsRef = useRef(selectedItemIds);
|
|
130
|
-
useEffect(() => {
|
|
131
|
-
deferredInputValueRef.current = deferredInputValue;
|
|
132
|
-
}, [deferredInputValue]);
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
selectedItemIdsRef.current = selectedItemIds;
|
|
135
|
-
}, [selectedItemIds]);
|
|
88
|
+
const [highlightedItem, setHighlightedItem] = useState();
|
|
136
89
|
const [sortedItemIds, setSortedItemIds] = useState(items.map(({
|
|
137
90
|
id: itemId
|
|
138
91
|
}) => itemId));
|
|
@@ -142,6 +95,7 @@ function AutocompleteMenu(props) {
|
|
|
142
95
|
...selectableItem,
|
|
143
96
|
role: 'option',
|
|
144
97
|
id: selectableItem.id,
|
|
98
|
+
active: (highlightedItem === null || highlightedItem === void 0 ? void 0 : highlightedItem.id) === selectableItem.id,
|
|
145
99
|
selected: selectionVariant === 'multiple' ? selectedItemIds.includes(selectableItem.id) : undefined,
|
|
146
100
|
onAction: item => {
|
|
147
101
|
const otherSelectedItemIds = selectedItemIds.filter(selectedItemId => selectedItemId !== item.id);
|
|
@@ -158,7 +112,7 @@ function AutocompleteMenu(props) {
|
|
|
158
112
|
}
|
|
159
113
|
}
|
|
160
114
|
};
|
|
161
|
-
}), [items, selectedItemIds, inputRef, onSelectedChange, selectionVariant, setAutocompleteSuggestion, setInputValue, setShowMenu]);
|
|
115
|
+
}), [highlightedItem, items, selectedItemIds, inputRef, onSelectedChange, selectionVariant, setAutocompleteSuggestion, setInputValue, setShowMenu]);
|
|
162
116
|
const itemSortOrderData = useMemo(() => sortedItemIds.reduce((acc, curr, i) => {
|
|
163
117
|
acc[curr] = i;
|
|
164
118
|
return acc;
|
|
@@ -172,6 +126,7 @@ function AutocompleteMenu(props) {
|
|
|
172
126
|
...addNewItem,
|
|
173
127
|
role: 'option',
|
|
174
128
|
key: addNewItem.id,
|
|
129
|
+
active: (highlightedItem === null || highlightedItem === void 0 ? void 0 : highlightedItem.id) === addNewItem.id,
|
|
175
130
|
selected: selectionVariant === 'multiple' ? selectedItemIds.includes(addNewItem.id) : undefined,
|
|
176
131
|
leadingVisual: () => /*#__PURE__*/jsx(PlusIcon, {}),
|
|
177
132
|
onAction: item => {
|
|
@@ -186,7 +141,7 @@ function AutocompleteMenu(props) {
|
|
|
186
141
|
setAutocompleteSuggestion('');
|
|
187
142
|
}
|
|
188
143
|
}
|
|
189
|
-
}] : [])], [sortedAndFilteredItemsToRender, addNewItem, setAutocompleteSuggestion, selectionVariant, setInputValue, generatedUniqueId, selectedItemIds]);
|
|
144
|
+
}] : [])], [sortedAndFilteredItemsToRender, addNewItem, setAutocompleteSuggestion, selectionVariant, setInputValue, generatedUniqueId, highlightedItem, selectedItemIds]);
|
|
190
145
|
React.useEffect(() => {
|
|
191
146
|
allItemsToRenderRef.current = allItemsToRender;
|
|
192
147
|
});
|
|
@@ -204,28 +159,13 @@ function AutocompleteMenu(props) {
|
|
|
204
159
|
activeDescendantFocus: inputRef,
|
|
205
160
|
onActiveDescendantChanged: (current, _previous, directlyActivated) => {
|
|
206
161
|
activeDescendantRef.current = current || null;
|
|
207
|
-
|
|
208
|
-
// Active styling was already handled via DOM before this change:
|
|
209
|
-
// useFocusZone sets `data-is-active-descendant` on the active element,
|
|
210
|
-
// and ActionList styles that attribute in CSS. The key change is that
|
|
211
|
-
// we no longer call setHighlightedItem (state), avoiding re-renders.
|
|
212
|
-
|
|
213
162
|
if (current) {
|
|
214
|
-
var _selectedItem$text;
|
|
215
|
-
const currentLi = current.closest('li');
|
|
216
163
|
const selectedItem = allItemsToRenderRef.current.find(item => {
|
|
217
|
-
|
|
164
|
+
var _current$closest;
|
|
165
|
+
return item.id === ((_current$closest = current.closest('li')) === null || _current$closest === void 0 ? void 0 : _current$closest.getAttribute('data-id'));
|
|
218
166
|
});
|
|
219
|
-
|
|
167
|
+
setHighlightedItem(selectedItem);
|
|
220
168
|
setIsMenuDirectlyActivated(directlyActivated);
|
|
221
|
-
|
|
222
|
-
// Update autocomplete suggestion inline (moved from the useEffect
|
|
223
|
-
// that previously depended on highlightedItem state)
|
|
224
|
-
if (selectedItem !== null && selectedItem !== void 0 && (_selectedItem$text = selectedItem.text) !== null && _selectedItem$text !== void 0 && _selectedItem$text.startsWith(deferredInputValueRef.current) && !selectedItemIdsRef.current.includes(selectedItem.id)) {
|
|
225
|
-
setAutocompleteSuggestion(selectedItem.text);
|
|
226
|
-
} else {
|
|
227
|
-
setAutocompleteSuggestion('');
|
|
228
|
-
}
|
|
229
169
|
}
|
|
230
170
|
if (current && customScrollContainerRef && customScrollContainerRef.current && directlyActivated) {
|
|
231
171
|
scrollIntoView(current, customScrollContainerRef.current, menuScrollMargins);
|
|
@@ -235,16 +175,15 @@ function AutocompleteMenu(props) {
|
|
|
235
175
|
}
|
|
236
176
|
}, [loading]);
|
|
237
177
|
useEffect(() => {
|
|
238
|
-
var
|
|
239
|
-
//
|
|
240
|
-
//
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
setAutocompleteSuggestion(highlighted.text);
|
|
178
|
+
var _highlightedItem$text;
|
|
179
|
+
// Use deferredInputValue to avoid running this effect on every keystroke
|
|
180
|
+
// The Input component guards against stale suggestions
|
|
181
|
+
if (highlightedItem !== null && highlightedItem !== void 0 && (_highlightedItem$text = highlightedItem.text) !== null && _highlightedItem$text !== void 0 && _highlightedItem$text.startsWith(deferredInputValue) && !selectedItemIds.includes(highlightedItem.id)) {
|
|
182
|
+
setAutocompleteSuggestion(highlightedItem.text);
|
|
244
183
|
} else {
|
|
245
184
|
setAutocompleteSuggestion('');
|
|
246
185
|
}
|
|
247
|
-
}, [deferredInputValue, selectedItemIds, setAutocompleteSuggestion]);
|
|
186
|
+
}, [highlightedItem, deferredInputValue, selectedItemIds, setAutocompleteSuggestion]);
|
|
248
187
|
useEffect(() => {
|
|
249
188
|
const itemIdSortResult = [...sortedItemIds].sort(sortOnCloseFn ? sortOnCloseFn : getDefaultSortFn(itemId => isItemSelected(itemId, selectedItemIds)));
|
|
250
189
|
const sortResultMatchesState = itemIdSortResult.length === sortedItemIds.length && itemIdSortResult.every((element, index) => element === sortedItemIds[index]);
|
|
@@ -276,10 +215,29 @@ function AutocompleteMenu(props) {
|
|
|
276
215
|
id: `${id}-listbox`,
|
|
277
216
|
"aria-labelledby": ariaLabelledBy,
|
|
278
217
|
children: allItemsToRender.map(item => {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
218
|
+
const {
|
|
219
|
+
id,
|
|
220
|
+
onAction,
|
|
221
|
+
children,
|
|
222
|
+
text,
|
|
223
|
+
leadingVisual: LeadingVisual,
|
|
224
|
+
trailingVisual: TrailingVisual,
|
|
225
|
+
key,
|
|
226
|
+
role,
|
|
227
|
+
...itemProps
|
|
228
|
+
} = item;
|
|
229
|
+
return /*#__PURE__*/jsxs(ActionList.Item, {
|
|
230
|
+
onSelect: () => onAction(item),
|
|
231
|
+
...itemProps,
|
|
232
|
+
id: id,
|
|
233
|
+
"data-id": id,
|
|
234
|
+
role: role,
|
|
235
|
+
children: [LeadingVisual && /*#__PURE__*/jsx(ActionList.LeadingVisual, {
|
|
236
|
+
children: isElement(LeadingVisual) ? LeadingVisual : /*#__PURE__*/jsx(LeadingVisual, {})
|
|
237
|
+
}), children !== null && children !== void 0 ? children : text, TrailingVisual && /*#__PURE__*/jsx(ActionList.TrailingVisual, {
|
|
238
|
+
children: isElement(TrailingVisual) ? TrailingVisual : /*#__PURE__*/jsx(TrailingVisual, {})
|
|
239
|
+
})]
|
|
240
|
+
}, key !== null && key !== void 0 ? key : id);
|
|
283
241
|
})
|
|
284
242
|
}) : emptyStateText !== false && emptyStateText !== null ? /*#__PURE__*/jsx("div", {
|
|
285
243
|
className: classes.EmptyStateWrapper,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../src/Spinner/Spinner.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../src/Spinner/Spinner.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAA;AAQlE,QAAA,MAAM,OAAO;;;;CAIZ,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,OAAO,OAAO,CAAA;IAC3B,0KAA0K;IAC1K,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,4MAA4M;IAC5M,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;CAC5C,GAAG,kBAAkB,CAAA;AAEtB,iBAAS,OAAO,CAAC,EACf,IAAI,EAAE,OAAkB,EACxB,MAAkB,EAClB,YAAY,EAAE,SAAS,EACvB,SAAS,EACT,KAAK,EACL,KAAa,EACb,GAAG,KAAK,EACT,EAAE,YAAY,4BAiEd;kBAzEQ,OAAO;;;AA0FhB,eAAe,OAAO,CAAA"}
|
package/dist/Spinner/Spinner.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import { useState, useEffect
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
4
|
import classes from './Spinner.module.css.js';
|
|
5
5
|
import { useMedia } from '../hooks/useMedia.js';
|
|
6
6
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
@@ -8,6 +8,7 @@ import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
|
8
8
|
import { useId } from '../hooks/useId.js';
|
|
9
9
|
import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.js';
|
|
10
10
|
|
|
11
|
+
const ANIMATION_DURATION_MS = 1000;
|
|
11
12
|
const sizeMap = {
|
|
12
13
|
small: '16px',
|
|
13
14
|
medium: '32px',
|
|
@@ -15,7 +16,7 @@ const sizeMap = {
|
|
|
15
16
|
};
|
|
16
17
|
function Spinner(t0) {
|
|
17
18
|
var _ariaLabel;
|
|
18
|
-
const $ = c(
|
|
19
|
+
const $ = c(35);
|
|
19
20
|
let ariaLabel;
|
|
20
21
|
let className;
|
|
21
22
|
let props;
|
|
@@ -54,50 +55,82 @@ function Spinner(t0) {
|
|
|
54
55
|
const srText = t2 === undefined ? "Loading" : t2;
|
|
55
56
|
const delay = t3 === undefined ? false : t3;
|
|
56
57
|
const syncAnimationsEnabled = useFeatureFlag("primer_react_spinner_synchronize_animations");
|
|
57
|
-
const
|
|
58
|
+
const noMotionPreference = useMedia("(prefers-reduced-motion: no-preference)", false);
|
|
58
59
|
const size = sizeMap[sizeKey];
|
|
59
60
|
const hasHiddenLabel = srText !== null && ariaLabel === undefined;
|
|
60
61
|
const labelId = useId();
|
|
61
|
-
const [isVisible, setIsVisible] = useState(!delay);
|
|
62
62
|
let t4;
|
|
63
|
-
let t5;
|
|
64
63
|
if ($[8] !== delay) {
|
|
65
|
-
t4 = () => {
|
|
64
|
+
t4 = () => ({
|
|
65
|
+
isVisible: !delay,
|
|
66
|
+
syncDelay: !delay ? computeSyncDelay() : 0
|
|
67
|
+
});
|
|
68
|
+
$[8] = delay;
|
|
69
|
+
$[9] = t4;
|
|
70
|
+
} else {
|
|
71
|
+
t4 = $[9];
|
|
72
|
+
}
|
|
73
|
+
const [t5, setVisibleState] = useState(t4);
|
|
74
|
+
const {
|
|
75
|
+
isVisible,
|
|
76
|
+
syncDelay
|
|
77
|
+
} = t5;
|
|
78
|
+
let t6;
|
|
79
|
+
let t7;
|
|
80
|
+
if ($[10] !== delay) {
|
|
81
|
+
t6 = () => {
|
|
66
82
|
if (delay) {
|
|
67
83
|
const delayDuration = typeof delay === "number" ? delay : delay === "short" ? 300 : 1000;
|
|
68
84
|
const timeoutId = setTimeout(() => {
|
|
69
|
-
|
|
85
|
+
setVisibleState({
|
|
86
|
+
isVisible: true,
|
|
87
|
+
syncDelay: computeSyncDelay()
|
|
88
|
+
});
|
|
70
89
|
}, delayDuration);
|
|
71
90
|
return () => clearTimeout(timeoutId);
|
|
72
91
|
}
|
|
73
92
|
};
|
|
74
|
-
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
77
|
-
$[
|
|
93
|
+
t7 = [delay];
|
|
94
|
+
$[10] = delay;
|
|
95
|
+
$[11] = t6;
|
|
96
|
+
$[12] = t7;
|
|
78
97
|
} else {
|
|
79
|
-
|
|
80
|
-
|
|
98
|
+
t6 = $[11];
|
|
99
|
+
t7 = $[12];
|
|
81
100
|
}
|
|
82
|
-
useEffect(
|
|
101
|
+
useEffect(t6, t7);
|
|
83
102
|
if (!isVisible) {
|
|
84
103
|
return null;
|
|
85
104
|
}
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
$[
|
|
105
|
+
const shouldSync = syncAnimationsEnabled && noMotionPreference;
|
|
106
|
+
let t8;
|
|
107
|
+
if ($[13] !== shouldSync || $[14] !== style || $[15] !== syncDelay) {
|
|
108
|
+
t8 = shouldSync ? {
|
|
109
|
+
...style,
|
|
110
|
+
animationDelay: `${syncDelay}ms`
|
|
111
|
+
} : style;
|
|
112
|
+
$[13] = shouldSync;
|
|
113
|
+
$[14] = style;
|
|
114
|
+
$[15] = syncDelay;
|
|
115
|
+
$[16] = t8;
|
|
94
116
|
} else {
|
|
95
|
-
|
|
117
|
+
t8 = $[16];
|
|
96
118
|
}
|
|
97
|
-
|
|
119
|
+
const mergedStyle = t8;
|
|
120
|
+
const t9 = (_ariaLabel = ariaLabel) !== null && _ariaLabel !== void 0 ? _ariaLabel : undefined;
|
|
121
|
+
const t10 = hasHiddenLabel ? labelId : undefined;
|
|
98
122
|
let t11;
|
|
99
|
-
if ($[
|
|
100
|
-
|
|
123
|
+
if ($[17] !== className) {
|
|
124
|
+
t11 = clsx(className, classes.SpinnerAnimation);
|
|
125
|
+
$[17] = className;
|
|
126
|
+
$[18] = t11;
|
|
127
|
+
} else {
|
|
128
|
+
t11 = $[18];
|
|
129
|
+
}
|
|
130
|
+
let t12;
|
|
131
|
+
let t13;
|
|
132
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
133
|
+
t12 = /*#__PURE__*/jsx("circle", {
|
|
101
134
|
cx: "8",
|
|
102
135
|
cy: "8",
|
|
103
136
|
r: "7",
|
|
@@ -106,163 +139,84 @@ function Spinner(t0) {
|
|
|
106
139
|
strokeWidth: "2",
|
|
107
140
|
vectorEffect: "non-scaling-stroke"
|
|
108
141
|
});
|
|
109
|
-
|
|
142
|
+
t13 = /*#__PURE__*/jsx("path", {
|
|
110
143
|
d: "M15 8a7.002 7.002 0 00-7-7",
|
|
111
144
|
stroke: "currentColor",
|
|
112
145
|
strokeWidth: "2",
|
|
113
146
|
strokeLinecap: "round",
|
|
114
147
|
vectorEffect: "non-scaling-stroke"
|
|
115
148
|
});
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
149
|
+
$[19] = t12;
|
|
150
|
+
$[20] = t13;
|
|
118
151
|
} else {
|
|
119
|
-
|
|
120
|
-
|
|
152
|
+
t12 = $[19];
|
|
153
|
+
t13 = $[20];
|
|
121
154
|
}
|
|
122
|
-
let
|
|
123
|
-
if ($[
|
|
124
|
-
|
|
125
|
-
ref: t6,
|
|
155
|
+
let t14;
|
|
156
|
+
if ($[21] !== mergedStyle || $[22] !== props || $[23] !== size || $[24] !== t10 || $[25] !== t11 || $[26] !== t9) {
|
|
157
|
+
t14 = /*#__PURE__*/jsxs("svg", {
|
|
126
158
|
height: size,
|
|
127
159
|
width: size,
|
|
128
160
|
viewBox: "0 0 16 16",
|
|
129
161
|
fill: "none",
|
|
130
162
|
"aria-hidden": true,
|
|
131
|
-
"aria-label":
|
|
132
|
-
"aria-labelledby":
|
|
133
|
-
className:
|
|
134
|
-
style:
|
|
163
|
+
"aria-label": t9,
|
|
164
|
+
"aria-labelledby": t10,
|
|
165
|
+
className: t11,
|
|
166
|
+
style: mergedStyle,
|
|
135
167
|
...props,
|
|
136
|
-
children: [
|
|
168
|
+
children: [t12, t13]
|
|
137
169
|
});
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[22] = t12;
|
|
170
|
+
$[21] = mergedStyle;
|
|
171
|
+
$[22] = props;
|
|
172
|
+
$[23] = size;
|
|
173
|
+
$[24] = t10;
|
|
174
|
+
$[25] = t11;
|
|
175
|
+
$[26] = t9;
|
|
176
|
+
$[27] = t14;
|
|
146
177
|
} else {
|
|
147
|
-
|
|
178
|
+
t14 = $[27];
|
|
148
179
|
}
|
|
149
|
-
let
|
|
150
|
-
if ($[
|
|
151
|
-
|
|
180
|
+
let t15;
|
|
181
|
+
if ($[28] !== hasHiddenLabel || $[29] !== labelId || $[30] !== srText) {
|
|
182
|
+
t15 = hasHiddenLabel ? /*#__PURE__*/jsx(VisuallyHidden, {
|
|
152
183
|
id: labelId,
|
|
153
184
|
children: srText
|
|
154
185
|
}) : null;
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
186
|
+
$[28] = hasHiddenLabel;
|
|
187
|
+
$[29] = labelId;
|
|
188
|
+
$[30] = srText;
|
|
189
|
+
$[31] = t15;
|
|
159
190
|
} else {
|
|
160
|
-
|
|
191
|
+
t15 = $[31];
|
|
161
192
|
}
|
|
162
|
-
let
|
|
163
|
-
if ($[
|
|
164
|
-
|
|
193
|
+
let t16;
|
|
194
|
+
if ($[32] !== t14 || $[33] !== t15) {
|
|
195
|
+
t16 = /*#__PURE__*/jsxs("span", {
|
|
165
196
|
className: classes.Box,
|
|
166
|
-
children: [
|
|
197
|
+
children: [t14, t15]
|
|
167
198
|
});
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
199
|
+
$[32] = t14;
|
|
200
|
+
$[33] = t15;
|
|
201
|
+
$[34] = t16;
|
|
171
202
|
} else {
|
|
172
|
-
|
|
203
|
+
t16 = $[34];
|
|
173
204
|
}
|
|
174
|
-
return
|
|
205
|
+
return t16;
|
|
175
206
|
}
|
|
176
207
|
Spinner.displayName = 'Spinner';
|
|
177
|
-
const animationTimingStore = {
|
|
178
|
-
subscribers: new Set(),
|
|
179
|
-
value: {
|
|
180
|
-
startTime: null
|
|
181
|
-
},
|
|
182
|
-
update(startTime) {
|
|
183
|
-
const value = {
|
|
184
|
-
startTime
|
|
185
|
-
};
|
|
186
|
-
animationTimingStore.value = value;
|
|
187
|
-
for (const subscriber of animationTimingStore.subscribers) {
|
|
188
|
-
subscriber();
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
subscribe(subscriber) {
|
|
192
|
-
animationTimingStore.subscribers.add(subscriber);
|
|
193
|
-
return () => {
|
|
194
|
-
animationTimingStore.subscribers.delete(subscriber);
|
|
195
|
-
};
|
|
196
|
-
},
|
|
197
|
-
getSnapshot() {
|
|
198
|
-
return animationTimingStore.value;
|
|
199
|
-
},
|
|
200
|
-
getServerSnapshot() {
|
|
201
|
-
return animationTimingStore.value;
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* A utility hook for reading a common `startTime` value so that all animations
|
|
207
|
-
* are in sync. This is a global value and is coordinated through `useSyncExternalStore`.
|
|
208
|
-
*/
|
|
209
|
-
function useAnimationTiming() {
|
|
210
|
-
return useSyncExternalStore(animationTimingStore.subscribe, animationTimingStore.getSnapshot, animationTimingStore.getServerSnapshot);
|
|
211
|
-
}
|
|
212
208
|
|
|
213
209
|
/**
|
|
214
|
-
*
|
|
215
|
-
*
|
|
210
|
+
* Computes a negative animation-delay so all spinners land at the same
|
|
211
|
+
* rotation angle regardless of when they mount. Because every instance
|
|
212
|
+
* references the same clock (performance.now()), the CSS animation engine
|
|
213
|
+
* keeps them visually in sync without any Web Animations API calls
|
|
214
|
+
* (getAnimations, element.animate, startTime), which are significantly
|
|
215
|
+
* slower in Safari/WebKit.
|
|
216
216
|
*/
|
|
217
|
-
function
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
const noMotionPreference = useMedia("(prefers-reduced-motion: no-preference)", false);
|
|
221
|
-
const animationTiming = useAnimationTiming();
|
|
222
|
-
let t0;
|
|
223
|
-
if ($[0] !== animationTiming || $[1] !== noMotionPreference) {
|
|
224
|
-
t0 = element => {
|
|
225
|
-
if (!element) {
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
if (ref.current !== null) {
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
if (noMotionPreference) {
|
|
232
|
-
const cssAnimation = element.getAnimations().find(_temp);
|
|
233
|
-
cssAnimation === null || cssAnimation === void 0 ? void 0 : cssAnimation.pause();
|
|
234
|
-
ref.current = element.animate([{
|
|
235
|
-
transform: "rotate(0deg)"
|
|
236
|
-
}, {
|
|
237
|
-
transform: "rotate(360deg)"
|
|
238
|
-
}], {
|
|
239
|
-
duration: 1000,
|
|
240
|
-
easing: "cubic-bezier(0,0,1,1)",
|
|
241
|
-
iterations: Infinity
|
|
242
|
-
});
|
|
243
|
-
if (animationTiming.startTime === null) {
|
|
244
|
-
var _cssAnimation$startTi;
|
|
245
|
-
const startTime = (_cssAnimation$startTi = cssAnimation === null || cssAnimation === void 0 ? void 0 : cssAnimation.startTime) !== null && _cssAnimation$startTi !== void 0 ? _cssAnimation$startTi : 0;
|
|
246
|
-
animationTimingStore.update(startTime);
|
|
247
|
-
ref.current.startTime = startTime;
|
|
248
|
-
} else {
|
|
249
|
-
ref.current.startTime = animationTiming.startTime;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
$[0] = animationTiming;
|
|
254
|
-
$[1] = noMotionPreference;
|
|
255
|
-
$[2] = t0;
|
|
256
|
-
} else {
|
|
257
|
-
t0 = $[2];
|
|
258
|
-
}
|
|
259
|
-
return t0;
|
|
260
|
-
}
|
|
261
|
-
function _temp(animation) {
|
|
262
|
-
if (animation instanceof CSSAnimation) {
|
|
263
|
-
return animation.animationName.startsWith("Spinner") && animation.animationName.endsWith("rotate-keyframes");
|
|
264
|
-
}
|
|
265
|
-
return false;
|
|
217
|
+
function computeSyncDelay() {
|
|
218
|
+
const now = typeof performance !== 'undefined' ? performance.now() : 0;
|
|
219
|
+
return -(now % ANIMATION_DURATION_MS);
|
|
266
220
|
}
|
|
267
221
|
|
|
268
222
|
export { Spinner as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.prc-Timeline-Timeline-awSoC{display:flex;flex-direction:column}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar]) .prc-Timeline-TimelineItem-QwDVH:first-child{padding-top:0}:is(.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar]) .prc-Timeline-TimelineItem-QwDVH:first-child):where([data-condensed]):before{top:var(--base-size-12,.75rem)}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar]) .prc-Timeline-TimelineItem-QwDVH:last-child{padding-bottom:0}:is(.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar]) .prc-Timeline-TimelineItem-QwDVH:last-child):where([data-condensed]):before{height:var(--base-size-12,.75rem)}.prc-Timeline-TimelineItem-QwDVH{display:flex;margin-left:var(--base-size-16,1rem);padding:var(--base-size-16,1rem) 0;position:relative}.prc-Timeline-TimelineItem-QwDVH:before{background-color:var(--borderColor-muted,var(--color-border-muted));bottom:0;content:"";display:block;left:0;position:absolute;top:0;width:2px}.prc-Timeline-TimelineItem-QwDVH:where([data-condensed]){padding-bottom:0;padding-top:var(--base-size-4,.25rem)}.prc-Timeline-TimelineItem-QwDVH:where([data-condensed]):last-child{padding-bottom:var(--base-size-16,1rem)}.prc-Timeline-TimelineItem-QwDVH:where([data-condensed]) .prc-Timeline-TimelineBadge-u0qSm{background-color:var(--bgColor-default,var(--color-canvas-default));border:0;color:var(--fgColor-muted,var(--color-fg-muted));height:16px;margin-bottom:var(--base-size-8,.5rem);margin-top:var(--base-size-8,.5rem)}.prc-Timeline-TimelineBadgeWrapper-SZw4k{position:relative;z-index:1}.prc-Timeline-TimelineBadge-u0qSm{align-items:center;background-color:var(--timelineBadge-bgColor,var(--color-timeline-badge-bg));border-color:var(--bgColor-default,var(--color-canvas-default));border-radius:50%;border-style:solid;border-width:var(--borderWidth-thick,.125rem);display:flex;flex-shrink:0;height:32px;justify-content:center;margin-left:-15px;margin-right:var(--base-size-8,.5rem);overflow:hidden;width:32px}.prc-Timeline-TimelineBadge-u0qSm,.prc-Timeline-TimelineBody-tjOtb{color:var(--fgColor-muted,var(--color-fg-muted))}.prc-Timeline-TimelineBody-tjOtb{flex:auto;font-size:var(--text-body-size-medium,.875rem);margin-top:var(--base-size-4,.25rem);max-width:100%;min-width:0}.prc-Timeline-TimelineBreak-X8eti{background-color:var(--bgColor-default,var(--color-canvas-default));border:0;border-top:var(--borderWidth-thicker,.25rem) solid var(--borderColor-default,var(--color-border-default));height:var(--base-size-24,1.5rem);margin:0;margin-bottom:calc(var(--base-size-16,1rem)*-1);margin-left:0;position:relative;z-index:1}.prc-Timeline-TimelineBreak-X8eti:has(+[data-condensed]){margin-bottom:calc(var(--base-size-12,.75rem)*-1)}
|
|
2
|
-
/*# sourceMappingURL=Timeline-
|
|
1
|
+
.prc-Timeline-Timeline-awSoC{display:flex;flex-direction:column}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar]) .prc-Timeline-TimelineItem-QwDVH:first-child{padding-top:0}:is(.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar]) .prc-Timeline-TimelineItem-QwDVH:first-child):where([data-condensed]):before{top:var(--base-size-12,.75rem)}.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar]) .prc-Timeline-TimelineItem-QwDVH:last-child{padding-bottom:0}:is(.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar]) .prc-Timeline-TimelineItem-QwDVH:last-child):where([data-condensed]):before{height:var(--base-size-12,.75rem)}.prc-Timeline-TimelineItem-QwDVH{display:flex;margin-left:var(--base-size-16,1rem);padding:var(--base-size-16,1rem) 0;position:relative}.prc-Timeline-TimelineItem-QwDVH:before{background-color:var(--borderColor-muted,var(--color-border-muted));bottom:0;content:"";display:block;left:0;position:absolute;top:0;width:2px}.prc-Timeline-TimelineItem-QwDVH:where([data-condensed]){padding-bottom:0;padding-top:var(--base-size-4,.25rem)}.prc-Timeline-TimelineItem-QwDVH:where([data-condensed]):last-child{padding-bottom:var(--base-size-16,1rem)}.prc-Timeline-TimelineItem-QwDVH:where([data-condensed]) .prc-Timeline-TimelineBadge-u0qSm{background-color:var(--bgColor-default,var(--color-canvas-default));border:0;color:var(--fgColor-muted,var(--color-fg-muted));height:16px;margin-bottom:var(--base-size-8,.5rem);margin-top:var(--base-size-8,.5rem)}.prc-Timeline-TimelineBadgeWrapper-SZw4k{position:relative;z-index:1}.prc-Timeline-TimelineBadge-u0qSm{align-items:center;background-color:var(--timelineBadge-bgColor,var(--color-timeline-badge-bg));border-color:var(--bgColor-default,var(--color-canvas-default));border-radius:50%;border-style:solid;border-width:var(--borderWidth-thick,.125rem);display:flex;flex-shrink:0;height:32px;justify-content:center;margin-left:-15px;margin-right:var(--base-size-8,.5rem);overflow:hidden;width:32px}.prc-Timeline-TimelineBadge-u0qSm,.prc-Timeline-TimelineBody-tjOtb{color:var(--fgColor-muted,var(--color-fg-muted))}.prc-Timeline-TimelineBody-tjOtb{flex:auto;font-size:var(--text-body-size-medium,.875rem);margin-top:calc(var(--base-size-4,.25rem) + 1px);max-width:100%;min-width:0}.prc-Timeline-TimelineBreak-X8eti{background-color:var(--bgColor-default,var(--color-canvas-default));border:0;border-top:var(--borderWidth-thicker,.25rem) solid var(--borderColor-default,var(--color-border-default));height:var(--base-size-24,1.5rem);margin:0;margin-bottom:calc(var(--base-size-16,1rem)*-1);margin-left:0;position:relative;z-index:1}.prc-Timeline-TimelineBreak-X8eti:has(+[data-condensed]){margin-bottom:calc(var(--base-size-12,.75rem)*-1)}
|
|
2
|
+
/*# sourceMappingURL=Timeline-19bef8c5.css.map */
|