Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../js/dist
File: components.js
__experimentalFirstVisibleItemClass,
[69500] Fix | Delete
__experimentalLastVisibleItemClass
[69501] Fix | Delete
} = useToolsPanelContext();
[69502] Fix | Delete
[69503] Fix | Delete
// hasValue is a new function on every render, so do not add it as a
[69504] Fix | Delete
// dependency to the useCallback hook! If needed, we should use a ref.
[69505] Fix | Delete
// eslint-disable-next-line react-hooks/exhaustive-deps
[69506] Fix | Delete
const hasValueCallback = (0,external_wp_element_namespaceObject.useCallback)(hasValue, [panelId]);
[69507] Fix | Delete
// resetAllFilter is a new function on every render, so do not add it as a
[69508] Fix | Delete
// dependency to the useCallback hook! If needed, we should use a ref.
[69509] Fix | Delete
// eslint-disable-next-line react-hooks/exhaustive-deps
[69510] Fix | Delete
const resetAllFilterCallback = (0,external_wp_element_namespaceObject.useCallback)(resetAllFilter, [panelId]);
[69511] Fix | Delete
const previousPanelId = (0,external_wp_compose_namespaceObject.usePrevious)(currentPanelId);
[69512] Fix | Delete
const hasMatchingPanel = currentPanelId === panelId || currentPanelId === null;
[69513] Fix | Delete
[69514] Fix | Delete
// Registering the panel item allows the panel to include it in its
[69515] Fix | Delete
// automatically generated menu and determine its initial checked status.
[69516] Fix | Delete
//
[69517] Fix | Delete
// This is performed in a layout effect to ensure that the panel item
[69518] Fix | Delete
// is registered before it is rendered preventing a rendering glitch.
[69519] Fix | Delete
// See: https://github.com/WordPress/gutenberg/issues/56470
[69520] Fix | Delete
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
[69521] Fix | Delete
if (hasMatchingPanel && previousPanelId !== null) {
[69522] Fix | Delete
registerPanelItem({
[69523] Fix | Delete
hasValue: hasValueCallback,
[69524] Fix | Delete
isShownByDefault,
[69525] Fix | Delete
label,
[69526] Fix | Delete
panelId
[69527] Fix | Delete
});
[69528] Fix | Delete
}
[69529] Fix | Delete
return () => {
[69530] Fix | Delete
if (previousPanelId === null && !!currentPanelId || currentPanelId === panelId) {
[69531] Fix | Delete
deregisterPanelItem(label);
[69532] Fix | Delete
}
[69533] Fix | Delete
};
[69534] Fix | Delete
}, [currentPanelId, hasMatchingPanel, isShownByDefault, label, hasValueCallback, panelId, previousPanelId, registerPanelItem, deregisterPanelItem]);
[69535] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[69536] Fix | Delete
if (hasMatchingPanel) {
[69537] Fix | Delete
registerResetAllFilter(resetAllFilterCallback);
[69538] Fix | Delete
}
[69539] Fix | Delete
return () => {
[69540] Fix | Delete
if (hasMatchingPanel) {
[69541] Fix | Delete
deregisterResetAllFilter(resetAllFilterCallback);
[69542] Fix | Delete
}
[69543] Fix | Delete
};
[69544] Fix | Delete
}, [registerResetAllFilter, deregisterResetAllFilter, resetAllFilterCallback, hasMatchingPanel]);
[69545] Fix | Delete
[69546] Fix | Delete
// Note: `label` is used as a key when building menu item state in
[69547] Fix | Delete
// `ToolsPanel`.
[69548] Fix | Delete
const menuGroup = isShownByDefault ? 'default' : 'optional';
[69549] Fix | Delete
const isMenuItemChecked = menuItems?.[menuGroup]?.[label];
[69550] Fix | Delete
const wasMenuItemChecked = (0,external_wp_compose_namespaceObject.usePrevious)(isMenuItemChecked);
[69551] Fix | Delete
const isRegistered = menuItems?.[menuGroup]?.[label] !== undefined;
[69552] Fix | Delete
const isValueSet = hasValue();
[69553] Fix | Delete
// Notify the panel when an item's value has changed except for optional
[69554] Fix | Delete
// items without value because the item should not cause itself to hide.
[69555] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[69556] Fix | Delete
if (!isShownByDefault && !isValueSet) {
[69557] Fix | Delete
return;
[69558] Fix | Delete
}
[69559] Fix | Delete
flagItemCustomization(isValueSet, label, menuGroup);
[69560] Fix | Delete
}, [isValueSet, menuGroup, label, flagItemCustomization, isShownByDefault]);
[69561] Fix | Delete
[69562] Fix | Delete
// Determine if the panel item's corresponding menu is being toggled and
[69563] Fix | Delete
// trigger appropriate callback if it is.
[69564] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[69565] Fix | Delete
// We check whether this item is currently registered as items rendered
[69566] Fix | Delete
// via fills can persist through the parent panel being remounted.
[69567] Fix | Delete
// See: https://github.com/WordPress/gutenberg/pull/45673
[69568] Fix | Delete
if (!isRegistered || isResetting || !hasMatchingPanel) {
[69569] Fix | Delete
return;
[69570] Fix | Delete
}
[69571] Fix | Delete
if (isMenuItemChecked && !isValueSet && !wasMenuItemChecked) {
[69572] Fix | Delete
onSelect?.();
[69573] Fix | Delete
}
[69574] Fix | Delete
if (!isMenuItemChecked && isValueSet && wasMenuItemChecked) {
[69575] Fix | Delete
onDeselect?.();
[69576] Fix | Delete
}
[69577] Fix | Delete
}, [hasMatchingPanel, isMenuItemChecked, isRegistered, isResetting, isValueSet, wasMenuItemChecked, onSelect, onDeselect]);
[69578] Fix | Delete
[69579] Fix | Delete
// The item is shown if it is a default control regardless of whether it
[69580] Fix | Delete
// has a value. Optional items are shown when they are checked or have
[69581] Fix | Delete
// a value.
[69582] Fix | Delete
const isShown = isShownByDefault ? menuItems?.[menuGroup]?.[label] !== undefined : isMenuItemChecked;
[69583] Fix | Delete
const cx = useCx();
[69584] Fix | Delete
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
[69585] Fix | Delete
const shouldApplyPlaceholderStyles = shouldRenderPlaceholder && !isShown;
[69586] Fix | Delete
const firstItemStyle = firstDisplayedItem === label && __experimentalFirstVisibleItemClass;
[69587] Fix | Delete
const lastItemStyle = lastDisplayedItem === label && __experimentalLastVisibleItemClass;
[69588] Fix | Delete
return cx(ToolsPanelItem, shouldApplyPlaceholderStyles && ToolsPanelItemPlaceholder, !shouldApplyPlaceholderStyles && className, firstItemStyle, lastItemStyle);
[69589] Fix | Delete
}, [isShown, shouldRenderPlaceholder, className, cx, firstDisplayedItem, lastDisplayedItem, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass, label]);
[69590] Fix | Delete
return {
[69591] Fix | Delete
...otherProps,
[69592] Fix | Delete
isShown,
[69593] Fix | Delete
shouldRenderPlaceholder,
[69594] Fix | Delete
className: classes
[69595] Fix | Delete
};
[69596] Fix | Delete
}
[69597] Fix | Delete
[69598] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-item/component.js
[69599] Fix | Delete
/**
[69600] Fix | Delete
* External dependencies
[69601] Fix | Delete
*/
[69602] Fix | Delete
[69603] Fix | Delete
/**
[69604] Fix | Delete
* Internal dependencies
[69605] Fix | Delete
*/
[69606] Fix | Delete
[69607] Fix | Delete
[69608] Fix | Delete
[69609] Fix | Delete
[69610] Fix | Delete
// This wraps controls to be conditionally displayed within a tools panel. It
[69611] Fix | Delete
// prevents props being applied to HTML elements that would make them invalid.
[69612] Fix | Delete
const UnconnectedToolsPanelItem = (props, forwardedRef) => {
[69613] Fix | Delete
const {
[69614] Fix | Delete
children,
[69615] Fix | Delete
isShown,
[69616] Fix | Delete
shouldRenderPlaceholder,
[69617] Fix | Delete
...toolsPanelItemProps
[69618] Fix | Delete
} = useToolsPanelItem(props);
[69619] Fix | Delete
if (!isShown) {
[69620] Fix | Delete
return shouldRenderPlaceholder ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, {
[69621] Fix | Delete
...toolsPanelItemProps,
[69622] Fix | Delete
ref: forwardedRef
[69623] Fix | Delete
}) : null;
[69624] Fix | Delete
}
[69625] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, {
[69626] Fix | Delete
...toolsPanelItemProps,
[69627] Fix | Delete
ref: forwardedRef,
[69628] Fix | Delete
children: children
[69629] Fix | Delete
});
[69630] Fix | Delete
};
[69631] Fix | Delete
const component_ToolsPanelItem = contextConnect(UnconnectedToolsPanelItem, 'ToolsPanelItem');
[69632] Fix | Delete
/* harmony default export */ const tools_panel_item_component = (component_ToolsPanelItem);
[69633] Fix | Delete
[69634] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index-context.js
[69635] Fix | Delete
/**
[69636] Fix | Delete
* WordPress dependencies
[69637] Fix | Delete
*/
[69638] Fix | Delete
[69639] Fix | Delete
const RovingTabIndexContext = (0,external_wp_element_namespaceObject.createContext)(undefined);
[69640] Fix | Delete
const useRovingTabIndexContext = () => (0,external_wp_element_namespaceObject.useContext)(RovingTabIndexContext);
[69641] Fix | Delete
const RovingTabIndexProvider = RovingTabIndexContext.Provider;
[69642] Fix | Delete
[69643] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index.js
[69644] Fix | Delete
/**
[69645] Fix | Delete
* WordPress dependencies
[69646] Fix | Delete
*/
[69647] Fix | Delete
[69648] Fix | Delete
[69649] Fix | Delete
/**
[69650] Fix | Delete
* Internal dependencies
[69651] Fix | Delete
*/
[69652] Fix | Delete
[69653] Fix | Delete
[69654] Fix | Delete
/**
[69655] Fix | Delete
* Provider for adding roving tab index behaviors to tree grid structures.
[69656] Fix | Delete
*
[69657] Fix | Delete
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
[69658] Fix | Delete
*/
[69659] Fix | Delete
[69660] Fix | Delete
function RovingTabIndex({
[69661] Fix | Delete
children
[69662] Fix | Delete
}) {
[69663] Fix | Delete
const [lastFocusedElement, setLastFocusedElement] = (0,external_wp_element_namespaceObject.useState)();
[69664] Fix | Delete
[69665] Fix | Delete
// Use `useMemo` to avoid creation of a new object for the providerValue
[69666] Fix | Delete
// on every render. Only create a new object when the `lastFocusedElement`
[69667] Fix | Delete
// value changes.
[69668] Fix | Delete
const providerValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
[69669] Fix | Delete
lastFocusedElement,
[69670] Fix | Delete
setLastFocusedElement
[69671] Fix | Delete
}), [lastFocusedElement]);
[69672] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RovingTabIndexProvider, {
[69673] Fix | Delete
value: providerValue,
[69674] Fix | Delete
children: children
[69675] Fix | Delete
});
[69676] Fix | Delete
}
[69677] Fix | Delete
[69678] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/index.js
[69679] Fix | Delete
/**
[69680] Fix | Delete
* WordPress dependencies
[69681] Fix | Delete
*/
[69682] Fix | Delete
[69683] Fix | Delete
[69684] Fix | Delete
[69685] Fix | Delete
[69686] Fix | Delete
/**
[69687] Fix | Delete
* Internal dependencies
[69688] Fix | Delete
*/
[69689] Fix | Delete
[69690] Fix | Delete
[69691] Fix | Delete
/**
[69692] Fix | Delete
* Return focusables in a row element, excluding those from other branches
[69693] Fix | Delete
* nested within the row.
[69694] Fix | Delete
*
[69695] Fix | Delete
* @param rowElement The DOM element representing the row.
[69696] Fix | Delete
*
[69697] Fix | Delete
* @return The array of focusables in the row.
[69698] Fix | Delete
*/
[69699] Fix | Delete
function getRowFocusables(rowElement) {
[69700] Fix | Delete
const focusablesInRow = external_wp_dom_namespaceObject.focus.focusable.find(rowElement, {
[69701] Fix | Delete
sequential: true
[69702] Fix | Delete
});
[69703] Fix | Delete
return focusablesInRow.filter(focusable => {
[69704] Fix | Delete
return focusable.closest('[role="row"]') === rowElement;
[69705] Fix | Delete
});
[69706] Fix | Delete
}
[69707] Fix | Delete
[69708] Fix | Delete
/**
[69709] Fix | Delete
* Renders both a table and tbody element, used to create a tree hierarchy.
[69710] Fix | Delete
*
[69711] Fix | Delete
*/
[69712] Fix | Delete
function UnforwardedTreeGrid({
[69713] Fix | Delete
children,
[69714] Fix | Delete
onExpandRow = () => {},
[69715] Fix | Delete
onCollapseRow = () => {},
[69716] Fix | Delete
onFocusRow = () => {},
[69717] Fix | Delete
applicationAriaLabel,
[69718] Fix | Delete
...props
[69719] Fix | Delete
}, /** A ref to the underlying DOM table element. */
[69720] Fix | Delete
ref) {
[69721] Fix | Delete
const onKeyDown = (0,external_wp_element_namespaceObject.useCallback)(event => {
[69722] Fix | Delete
const {
[69723] Fix | Delete
keyCode,
[69724] Fix | Delete
metaKey,
[69725] Fix | Delete
ctrlKey,
[69726] Fix | Delete
altKey
[69727] Fix | Delete
} = event;
[69728] Fix | Delete
[69729] Fix | Delete
// The shift key is intentionally absent from the following list,
[69730] Fix | Delete
// to enable shift + up/down to select items from the list.
[69731] Fix | Delete
const hasModifierKeyPressed = metaKey || ctrlKey || altKey;
[69732] Fix | Delete
if (hasModifierKeyPressed || ![external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT, external_wp_keycodes_namespaceObject.HOME, external_wp_keycodes_namespaceObject.END].includes(keyCode)) {
[69733] Fix | Delete
return;
[69734] Fix | Delete
}
[69735] Fix | Delete
[69736] Fix | Delete
// The event will be handled, stop propagation.
[69737] Fix | Delete
event.stopPropagation();
[69738] Fix | Delete
const {
[69739] Fix | Delete
activeElement
[69740] Fix | Delete
} = document;
[69741] Fix | Delete
const {
[69742] Fix | Delete
currentTarget: treeGridElement
[69743] Fix | Delete
} = event;
[69744] Fix | Delete
if (!activeElement || !treeGridElement.contains(activeElement)) {
[69745] Fix | Delete
return;
[69746] Fix | Delete
}
[69747] Fix | Delete
[69748] Fix | Delete
// Calculate the columnIndex of the active element.
[69749] Fix | Delete
const activeRow = activeElement.closest('[role="row"]');
[69750] Fix | Delete
if (!activeRow) {
[69751] Fix | Delete
return;
[69752] Fix | Delete
}
[69753] Fix | Delete
const focusablesInRow = getRowFocusables(activeRow);
[69754] Fix | Delete
const currentColumnIndex = focusablesInRow.indexOf(activeElement);
[69755] Fix | Delete
const canExpandCollapse = 0 === currentColumnIndex;
[69756] Fix | Delete
const cannotFocusNextColumn = canExpandCollapse && (activeRow.getAttribute('data-expanded') === 'false' || activeRow.getAttribute('aria-expanded') === 'false') && keyCode === external_wp_keycodes_namespaceObject.RIGHT;
[69757] Fix | Delete
if ([external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT].includes(keyCode)) {
[69758] Fix | Delete
// Calculate to the next element.
[69759] Fix | Delete
let nextIndex;
[69760] Fix | Delete
if (keyCode === external_wp_keycodes_namespaceObject.LEFT) {
[69761] Fix | Delete
nextIndex = Math.max(0, currentColumnIndex - 1);
[69762] Fix | Delete
} else {
[69763] Fix | Delete
nextIndex = Math.min(currentColumnIndex + 1, focusablesInRow.length - 1);
[69764] Fix | Delete
}
[69765] Fix | Delete
[69766] Fix | Delete
// Focus is at the left most column.
[69767] Fix | Delete
if (canExpandCollapse) {
[69768] Fix | Delete
if (keyCode === external_wp_keycodes_namespaceObject.LEFT) {
[69769] Fix | Delete
var _activeRow$getAttribu;
[69770] Fix | Delete
// Left:
[69771] Fix | Delete
// If a row is focused, and it is expanded, collapses the current row.
[69772] Fix | Delete
if (activeRow.getAttribute('data-expanded') === 'true' || activeRow.getAttribute('aria-expanded') === 'true') {
[69773] Fix | Delete
onCollapseRow(activeRow);
[69774] Fix | Delete
event.preventDefault();
[69775] Fix | Delete
return;
[69776] Fix | Delete
}
[69777] Fix | Delete
// If a row is focused, and it is collapsed, moves to the parent row (if there is one).
[69778] Fix | Delete
const level = Math.max(parseInt((_activeRow$getAttribu = activeRow?.getAttribute('aria-level')) !== null && _activeRow$getAttribu !== void 0 ? _activeRow$getAttribu : '1', 10) - 1, 1);
[69779] Fix | Delete
const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
[69780] Fix | Delete
let parentRow = activeRow;
[69781] Fix | Delete
const currentRowIndex = rows.indexOf(activeRow);
[69782] Fix | Delete
for (let i = currentRowIndex; i >= 0; i--) {
[69783] Fix | Delete
const ariaLevel = rows[i].getAttribute('aria-level');
[69784] Fix | Delete
if (ariaLevel !== null && parseInt(ariaLevel, 10) === level) {
[69785] Fix | Delete
parentRow = rows[i];
[69786] Fix | Delete
break;
[69787] Fix | Delete
}
[69788] Fix | Delete
}
[69789] Fix | Delete
getRowFocusables(parentRow)?.[0]?.focus();
[69790] Fix | Delete
}
[69791] Fix | Delete
if (keyCode === external_wp_keycodes_namespaceObject.RIGHT) {
[69792] Fix | Delete
// Right:
[69793] Fix | Delete
// If a row is focused, and it is collapsed, expands the current row.
[69794] Fix | Delete
if (activeRow.getAttribute('data-expanded') === 'false' || activeRow.getAttribute('aria-expanded') === 'false') {
[69795] Fix | Delete
onExpandRow(activeRow);
[69796] Fix | Delete
event.preventDefault();
[69797] Fix | Delete
return;
[69798] Fix | Delete
}
[69799] Fix | Delete
// If a row is focused, and it is expanded, focuses the next cell in the row.
[69800] Fix | Delete
const focusableItems = getRowFocusables(activeRow);
[69801] Fix | Delete
if (focusableItems.length > 0) {
[69802] Fix | Delete
focusableItems[nextIndex]?.focus();
[69803] Fix | Delete
}
[69804] Fix | Delete
}
[69805] Fix | Delete
// Prevent key use for anything else. For example, Voiceover
[69806] Fix | Delete
// will start reading text on continued use of left/right arrow
[69807] Fix | Delete
// keys.
[69808] Fix | Delete
event.preventDefault();
[69809] Fix | Delete
return;
[69810] Fix | Delete
}
[69811] Fix | Delete
[69812] Fix | Delete
// Focus the next element. If at most left column and row is collapsed, moving right is not allowed as this will expand. However, if row is collapsed, moving left is allowed.
[69813] Fix | Delete
if (cannotFocusNextColumn) {
[69814] Fix | Delete
return;
[69815] Fix | Delete
}
[69816] Fix | Delete
focusablesInRow[nextIndex].focus();
[69817] Fix | Delete
[69818] Fix | Delete
// Prevent key use for anything else. This ensures Voiceover
[69819] Fix | Delete
// doesn't try to handle key navigation.
[69820] Fix | Delete
event.preventDefault();
[69821] Fix | Delete
} else if ([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN].includes(keyCode)) {
[69822] Fix | Delete
// Calculate the rowIndex of the next row.
[69823] Fix | Delete
const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
[69824] Fix | Delete
const currentRowIndex = rows.indexOf(activeRow);
[69825] Fix | Delete
let nextRowIndex;
[69826] Fix | Delete
if (keyCode === external_wp_keycodes_namespaceObject.UP) {
[69827] Fix | Delete
nextRowIndex = Math.max(0, currentRowIndex - 1);
[69828] Fix | Delete
} else {
[69829] Fix | Delete
nextRowIndex = Math.min(currentRowIndex + 1, rows.length - 1);
[69830] Fix | Delete
}
[69831] Fix | Delete
[69832] Fix | Delete
// Focus is either at the top or bottom edge of the grid. Do nothing.
[69833] Fix | Delete
if (nextRowIndex === currentRowIndex) {
[69834] Fix | Delete
// Prevent key use for anything else. For example, Voiceover
[69835] Fix | Delete
// will start navigating horizontally when reaching the vertical
[69836] Fix | Delete
// bounds of a table.
[69837] Fix | Delete
event.preventDefault();
[69838] Fix | Delete
return;
[69839] Fix | Delete
}
[69840] Fix | Delete
[69841] Fix | Delete
// Get the focusables in the next row.
[69842] Fix | Delete
const focusablesInNextRow = getRowFocusables(rows[nextRowIndex]);
[69843] Fix | Delete
[69844] Fix | Delete
// If for some reason there are no focusables in the next row, do nothing.
[69845] Fix | Delete
if (!focusablesInNextRow || !focusablesInNextRow.length) {
[69846] Fix | Delete
// Prevent key use for anything else. For example, Voiceover
[69847] Fix | Delete
// will still focus text when using arrow keys, while this
[69848] Fix | Delete
// component should limit navigation to focusables.
[69849] Fix | Delete
event.preventDefault();
[69850] Fix | Delete
return;
[69851] Fix | Delete
}
[69852] Fix | Delete
[69853] Fix | Delete
// Try to focus the element in the next row that's at a similar column to the activeElement.
[69854] Fix | Delete
const nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1);
[69855] Fix | Delete
focusablesInNextRow[nextIndex].focus();
[69856] Fix | Delete
[69857] Fix | Delete
// Let consumers know the row that was originally focused,
[69858] Fix | Delete
// and the row that is now in focus.
[69859] Fix | Delete
onFocusRow(event, activeRow, rows[nextRowIndex]);
[69860] Fix | Delete
[69861] Fix | Delete
// Prevent key use for anything else. This ensures Voiceover
[69862] Fix | Delete
// doesn't try to handle key navigation.
[69863] Fix | Delete
event.preventDefault();
[69864] Fix | Delete
} else if ([external_wp_keycodes_namespaceObject.HOME, external_wp_keycodes_namespaceObject.END].includes(keyCode)) {
[69865] Fix | Delete
// Calculate the rowIndex of the next row.
[69866] Fix | Delete
const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
[69867] Fix | Delete
const currentRowIndex = rows.indexOf(activeRow);
[69868] Fix | Delete
let nextRowIndex;
[69869] Fix | Delete
if (keyCode === external_wp_keycodes_namespaceObject.HOME) {
[69870] Fix | Delete
nextRowIndex = 0;
[69871] Fix | Delete
} else {
[69872] Fix | Delete
nextRowIndex = rows.length - 1;
[69873] Fix | Delete
}
[69874] Fix | Delete
[69875] Fix | Delete
// Focus is either at the top or bottom edge of the grid. Do nothing.
[69876] Fix | Delete
if (nextRowIndex === currentRowIndex) {
[69877] Fix | Delete
// Prevent key use for anything else. For example, Voiceover
[69878] Fix | Delete
// will start navigating horizontally when reaching the vertical
[69879] Fix | Delete
// bounds of a table.
[69880] Fix | Delete
event.preventDefault();
[69881] Fix | Delete
return;
[69882] Fix | Delete
}
[69883] Fix | Delete
[69884] Fix | Delete
// Get the focusables in the next row.
[69885] Fix | Delete
const focusablesInNextRow = getRowFocusables(rows[nextRowIndex]);
[69886] Fix | Delete
[69887] Fix | Delete
// If for some reason there are no focusables in the next row, do nothing.
[69888] Fix | Delete
if (!focusablesInNextRow || !focusablesInNextRow.length) {
[69889] Fix | Delete
// Prevent key use for anything else. For example, Voiceover
[69890] Fix | Delete
// will still focus text when using arrow keys, while this
[69891] Fix | Delete
// component should limit navigation to focusables.
[69892] Fix | Delete
event.preventDefault();
[69893] Fix | Delete
return;
[69894] Fix | Delete
}
[69895] Fix | Delete
[69896] Fix | Delete
// Try to focus the element in the next row that's at a similar column to the activeElement.
[69897] Fix | Delete
const nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1);
[69898] Fix | Delete
focusablesInNextRow[nextIndex].focus();
[69899] Fix | Delete
[69900] Fix | Delete
// Let consumers know the row that was originally focused,
[69901] Fix | Delete
// and the row that is now in focus.
[69902] Fix | Delete
onFocusRow(event, activeRow, rows[nextRowIndex]);
[69903] Fix | Delete
[69904] Fix | Delete
// Prevent key use for anything else. This ensures Voiceover
[69905] Fix | Delete
// doesn't try to handle key navigation.
[69906] Fix | Delete
event.preventDefault();
[69907] Fix | Delete
}
[69908] Fix | Delete
}, [onExpandRow, onCollapseRow, onFocusRow]);
[69909] Fix | Delete
[69910] Fix | Delete
/* Disable reason: A treegrid is implemented using a table element. */
[69911] Fix | Delete
/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
[69912] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RovingTabIndex, {
[69913] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[69914] Fix | Delete
role: "application",
[69915] Fix | Delete
"aria-label": applicationAriaLabel,
[69916] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("table", {
[69917] Fix | Delete
...props,
[69918] Fix | Delete
role: "treegrid",
[69919] Fix | Delete
onKeyDown: onKeyDown,
[69920] Fix | Delete
ref: ref,
[69921] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("tbody", {
[69922] Fix | Delete
children: children
[69923] Fix | Delete
})
[69924] Fix | Delete
})
[69925] Fix | Delete
})
[69926] Fix | Delete
});
[69927] Fix | Delete
/* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */
[69928] Fix | Delete
}
[69929] Fix | Delete
[69930] Fix | Delete
/**
[69931] Fix | Delete
* `TreeGrid` is used to create a tree hierarchy.
[69932] Fix | Delete
* It is not a visually styled component, but instead helps with adding
[69933] Fix | Delete
* keyboard navigation and roving tab index behaviors to tree grid structures.
[69934] Fix | Delete
*
[69935] Fix | Delete
* A tree grid is a hierarchical 2 dimensional UI component, for example it could be
[69936] Fix | Delete
* used to implement a file system browser.
[69937] Fix | Delete
*
[69938] Fix | Delete
* A tree grid allows the user to navigate using arrow keys.
[69939] Fix | Delete
* Up/down to navigate vertically across rows, and left/right to navigate horizontally
[69940] Fix | Delete
* between focusables in a row.
[69941] Fix | Delete
*
[69942] Fix | Delete
* The `TreeGrid` renders both a `table` and `tbody` element, and is intended to be used
[69943] Fix | Delete
* with `TreeGridRow` (`tr`) and `TreeGridCell` (`td`) to build out a grid.
[69944] Fix | Delete
*
[69945] Fix | Delete
* ```jsx
[69946] Fix | Delete
* function TreeMenu() {
[69947] Fix | Delete
* return (
[69948] Fix | Delete
* <TreeGrid>
[69949] Fix | Delete
* <TreeGridRow level={ 1 } positionInSet={ 1 } setSize={ 2 }>
[69950] Fix | Delete
* <TreeGridCell>
[69951] Fix | Delete
* { ( props ) => (
[69952] Fix | Delete
* <Button onClick={ onSelect } { ...props }>Select</Button>
[69953] Fix | Delete
* ) }
[69954] Fix | Delete
* </TreeGridCell>
[69955] Fix | Delete
* <TreeGridCell>
[69956] Fix | Delete
* { ( props ) => (
[69957] Fix | Delete
* <Button onClick={ onMove } { ...props }>Move</Button>
[69958] Fix | Delete
* ) }
[69959] Fix | Delete
* </TreeGridCell>
[69960] Fix | Delete
* </TreeGridRow>
[69961] Fix | Delete
* <TreeGridRow level={ 1 } positionInSet={ 2 } setSize={ 2 }>
[69962] Fix | Delete
* <TreeGridCell>
[69963] Fix | Delete
* { ( props ) => (
[69964] Fix | Delete
* <Button onClick={ onSelect } { ...props }>Select</Button>
[69965] Fix | Delete
* ) }
[69966] Fix | Delete
* </TreeGridCell>
[69967] Fix | Delete
* <TreeGridCell>
[69968] Fix | Delete
* { ( props ) => (
[69969] Fix | Delete
* <Button onClick={ onMove } { ...props }>Move</Button>
[69970] Fix | Delete
* ) }
[69971] Fix | Delete
* </TreeGridCell>
[69972] Fix | Delete
* </TreeGridRow>
[69973] Fix | Delete
* <TreeGridRow level={ 2 } positionInSet={ 1 } setSize={ 1 }>
[69974] Fix | Delete
* <TreeGridCell>
[69975] Fix | Delete
* { ( props ) => (
[69976] Fix | Delete
* <Button onClick={ onSelect } { ...props }>Select</Button>
[69977] Fix | Delete
* ) }
[69978] Fix | Delete
* </TreeGridCell>
[69979] Fix | Delete
* <TreeGridCell>
[69980] Fix | Delete
* { ( props ) => (
[69981] Fix | Delete
* <Button onClick={ onMove } { ...props }>Move</Button>
[69982] Fix | Delete
* ) }
[69983] Fix | Delete
* </TreeGridCell>
[69984] Fix | Delete
* </TreeGridRow>
[69985] Fix | Delete
* </TreeGrid>
[69986] Fix | Delete
* );
[69987] Fix | Delete
* }
[69988] Fix | Delete
* ```
[69989] Fix | Delete
*
[69990] Fix | Delete
* @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}
[69991] Fix | Delete
*/
[69992] Fix | Delete
const TreeGrid = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTreeGrid);
[69993] Fix | Delete
/* harmony default export */ const tree_grid = (TreeGrid);
[69994] Fix | Delete
[69995] Fix | Delete
[69996] Fix | Delete
[69997] Fix | Delete
[69998] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/row.js
[69999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function