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
...otherProps
[63500] Fix | Delete
} = useContextSystem(props, 'NavigatorScreen');
[63501] Fix | Delete
const {
[63502] Fix | Delete
location,
[63503] Fix | Delete
match,
[63504] Fix | Delete
addScreen,
[63505] Fix | Delete
removeScreen
[63506] Fix | Delete
} = (0,external_wp_element_namespaceObject.useContext)(NavigatorContext);
[63507] Fix | Delete
const isMatch = match === screenId;
[63508] Fix | Delete
const wrapperRef = (0,external_wp_element_namespaceObject.useRef)(null);
[63509] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[63510] Fix | Delete
const screen = {
[63511] Fix | Delete
id: screenId,
[63512] Fix | Delete
path: (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(path)
[63513] Fix | Delete
};
[63514] Fix | Delete
addScreen(screen);
[63515] Fix | Delete
return () => removeScreen(screen);
[63516] Fix | Delete
}, [screenId, path, addScreen, removeScreen]);
[63517] Fix | Delete
const isRTL = (0,external_wp_i18n_namespaceObject.isRTL)();
[63518] Fix | Delete
const {
[63519] Fix | Delete
isInitial,
[63520] Fix | Delete
isBack
[63521] Fix | Delete
} = location;
[63522] Fix | Delete
const cx = useCx();
[63523] Fix | Delete
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(navigatorScreen({
[63524] Fix | Delete
isInitial,
[63525] Fix | Delete
isBack,
[63526] Fix | Delete
isRTL
[63527] Fix | Delete
}), className), [className, cx, isInitial, isBack, isRTL]);
[63528] Fix | Delete
const locationRef = (0,external_wp_element_namespaceObject.useRef)(location);
[63529] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[63530] Fix | Delete
locationRef.current = location;
[63531] Fix | Delete
}, [location]);
[63532] Fix | Delete
[63533] Fix | Delete
// Focus restoration
[63534] Fix | Delete
const isInitialLocation = location.isInitial && !location.isBack;
[63535] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[63536] Fix | Delete
// Only attempt to restore focus:
[63537] Fix | Delete
// - if the current location is not the initial one (to avoid moving focus on page load)
[63538] Fix | Delete
// - when the screen becomes visible
[63539] Fix | Delete
// - if the wrapper ref has been assigned
[63540] Fix | Delete
// - if focus hasn't already been restored for the current location
[63541] Fix | Delete
// - if the `skipFocus` option is not set to `true`. This is useful when we trigger the navigation outside of NavigatorScreen.
[63542] Fix | Delete
if (isInitialLocation || !isMatch || !wrapperRef.current || locationRef.current.hasRestoredFocus || location.skipFocus) {
[63543] Fix | Delete
return;
[63544] Fix | Delete
}
[63545] Fix | Delete
const activeElement = wrapperRef.current.ownerDocument.activeElement;
[63546] Fix | Delete
[63547] Fix | Delete
// If an element is already focused within the wrapper do not focus the
[63548] Fix | Delete
// element. This prevents inputs or buttons from losing focus unnecessarily.
[63549] Fix | Delete
if (wrapperRef.current.contains(activeElement)) {
[63550] Fix | Delete
return;
[63551] Fix | Delete
}
[63552] Fix | Delete
let elementToFocus = null;
[63553] Fix | Delete
[63554] Fix | Delete
// When navigating back, if a selector is provided, use it to look for the
[63555] Fix | Delete
// target element (assumed to be a node inside the current NavigatorScreen)
[63556] Fix | Delete
if (location.isBack && location.focusTargetSelector) {
[63557] Fix | Delete
elementToFocus = wrapperRef.current.querySelector(location.focusTargetSelector);
[63558] Fix | Delete
}
[63559] Fix | Delete
[63560] Fix | Delete
// If the previous query didn't run or find any element to focus, fallback
[63561] Fix | Delete
// to the first tabbable element in the screen (or the screen itself).
[63562] Fix | Delete
if (!elementToFocus) {
[63563] Fix | Delete
const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(wrapperRef.current);
[63564] Fix | Delete
elementToFocus = firstTabbable !== null && firstTabbable !== void 0 ? firstTabbable : wrapperRef.current;
[63565] Fix | Delete
}
[63566] Fix | Delete
locationRef.current.hasRestoredFocus = true;
[63567] Fix | Delete
elementToFocus.focus();
[63568] Fix | Delete
}, [isInitialLocation, isMatch, location.isBack, location.focusTargetSelector, location.skipFocus]);
[63569] Fix | Delete
const mergedWrapperRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([forwardedRef, wrapperRef]);
[63570] Fix | Delete
return isMatch ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, {
[63571] Fix | Delete
ref: mergedWrapperRef,
[63572] Fix | Delete
className: classes,
[63573] Fix | Delete
...otherProps,
[63574] Fix | Delete
children: children
[63575] Fix | Delete
}) : null;
[63576] Fix | Delete
}
[63577] Fix | Delete
[63578] Fix | Delete
/**
[63579] Fix | Delete
* The `NavigatorScreen` component represents a single view/screen/panel and
[63580] Fix | Delete
* should be used in combination with the `NavigatorProvider`, the
[63581] Fix | Delete
* `NavigatorButton` and the `NavigatorBackButton` components (or the `useNavigator`
[63582] Fix | Delete
* hook).
[63583] Fix | Delete
*
[63584] Fix | Delete
* @example
[63585] Fix | Delete
* ```jsx
[63586] Fix | Delete
* import {
[63587] Fix | Delete
* __experimentalNavigatorProvider as NavigatorProvider,
[63588] Fix | Delete
* __experimentalNavigatorScreen as NavigatorScreen,
[63589] Fix | Delete
* __experimentalNavigatorButton as NavigatorButton,
[63590] Fix | Delete
* __experimentalNavigatorBackButton as NavigatorBackButton,
[63591] Fix | Delete
* } from '@wordpress/components';
[63592] Fix | Delete
*
[63593] Fix | Delete
* const MyNavigation = () => (
[63594] Fix | Delete
* <NavigatorProvider initialPath="/">
[63595] Fix | Delete
* <NavigatorScreen path="/">
[63596] Fix | Delete
* <p>This is the home screen.</p>
[63597] Fix | Delete
* <NavigatorButton path="/child">
[63598] Fix | Delete
* Navigate to child screen.
[63599] Fix | Delete
* </NavigatorButton>
[63600] Fix | Delete
* </NavigatorScreen>
[63601] Fix | Delete
*
[63602] Fix | Delete
* <NavigatorScreen path="/child">
[63603] Fix | Delete
* <p>This is the child screen.</p>
[63604] Fix | Delete
* <NavigatorBackButton>
[63605] Fix | Delete
* Go back
[63606] Fix | Delete
* </NavigatorBackButton>
[63607] Fix | Delete
* </NavigatorScreen>
[63608] Fix | Delete
* </NavigatorProvider>
[63609] Fix | Delete
* );
[63610] Fix | Delete
* ```
[63611] Fix | Delete
*/
[63612] Fix | Delete
const NavigatorScreen = contextConnect(UnconnectedNavigatorScreen, 'NavigatorScreen');
[63613] Fix | Delete
/* harmony default export */ const navigator_screen_component = (NavigatorScreen);
[63614] Fix | Delete
[63615] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/use-navigator.js
[63616] Fix | Delete
/**
[63617] Fix | Delete
* WordPress dependencies
[63618] Fix | Delete
*/
[63619] Fix | Delete
[63620] Fix | Delete
[63621] Fix | Delete
/**
[63622] Fix | Delete
* Internal dependencies
[63623] Fix | Delete
*/
[63624] Fix | Delete
[63625] Fix | Delete
/**
[63626] Fix | Delete
* Retrieves a `navigator` instance.
[63627] Fix | Delete
*/
[63628] Fix | Delete
function useNavigator() {
[63629] Fix | Delete
const {
[63630] Fix | Delete
location,
[63631] Fix | Delete
params,
[63632] Fix | Delete
goTo,
[63633] Fix | Delete
goBack,
[63634] Fix | Delete
goToParent
[63635] Fix | Delete
} = (0,external_wp_element_namespaceObject.useContext)(NavigatorContext);
[63636] Fix | Delete
return {
[63637] Fix | Delete
location,
[63638] Fix | Delete
goTo,
[63639] Fix | Delete
goBack,
[63640] Fix | Delete
goToParent,
[63641] Fix | Delete
params
[63642] Fix | Delete
};
[63643] Fix | Delete
}
[63644] Fix | Delete
/* harmony default export */ const use_navigator = (useNavigator);
[63645] Fix | Delete
[63646] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-button/hook.js
[63647] Fix | Delete
/**
[63648] Fix | Delete
* WordPress dependencies
[63649] Fix | Delete
*/
[63650] Fix | Delete
[63651] Fix | Delete
[63652] Fix | Delete
[63653] Fix | Delete
/**
[63654] Fix | Delete
* Internal dependencies
[63655] Fix | Delete
*/
[63656] Fix | Delete
[63657] Fix | Delete
[63658] Fix | Delete
[63659] Fix | Delete
[63660] Fix | Delete
const cssSelectorForAttribute = (attrName, attrValue) => `[${attrName}="${attrValue}"]`;
[63661] Fix | Delete
function useNavigatorButton(props) {
[63662] Fix | Delete
const {
[63663] Fix | Delete
path,
[63664] Fix | Delete
onClick,
[63665] Fix | Delete
as = build_module_button,
[63666] Fix | Delete
attributeName = 'id',
[63667] Fix | Delete
...otherProps
[63668] Fix | Delete
} = useContextSystem(props, 'NavigatorButton');
[63669] Fix | Delete
const escapedPath = (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(path);
[63670] Fix | Delete
const {
[63671] Fix | Delete
goTo
[63672] Fix | Delete
} = use_navigator();
[63673] Fix | Delete
const handleClick = (0,external_wp_element_namespaceObject.useCallback)(e => {
[63674] Fix | Delete
e.preventDefault();
[63675] Fix | Delete
goTo(escapedPath, {
[63676] Fix | Delete
focusTargetSelector: cssSelectorForAttribute(attributeName, escapedPath)
[63677] Fix | Delete
});
[63678] Fix | Delete
onClick?.(e);
[63679] Fix | Delete
}, [goTo, onClick, attributeName, escapedPath]);
[63680] Fix | Delete
return {
[63681] Fix | Delete
as,
[63682] Fix | Delete
onClick: handleClick,
[63683] Fix | Delete
...otherProps,
[63684] Fix | Delete
[attributeName]: escapedPath
[63685] Fix | Delete
};
[63686] Fix | Delete
}
[63687] Fix | Delete
[63688] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-button/component.js
[63689] Fix | Delete
/**
[63690] Fix | Delete
* External dependencies
[63691] Fix | Delete
*/
[63692] Fix | Delete
[63693] Fix | Delete
/**
[63694] Fix | Delete
* Internal dependencies
[63695] Fix | Delete
*/
[63696] Fix | Delete
[63697] Fix | Delete
[63698] Fix | Delete
[63699] Fix | Delete
[63700] Fix | Delete
[63701] Fix | Delete
function UnconnectedNavigatorButton(props, forwardedRef) {
[63702] Fix | Delete
const navigatorButtonProps = useNavigatorButton(props);
[63703] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, {
[63704] Fix | Delete
ref: forwardedRef,
[63705] Fix | Delete
...navigatorButtonProps
[63706] Fix | Delete
});
[63707] Fix | Delete
}
[63708] Fix | Delete
[63709] Fix | Delete
/**
[63710] Fix | Delete
* The `NavigatorButton` component can be used to navigate to a screen and should
[63711] Fix | Delete
* be used in combination with the `NavigatorProvider`, the `NavigatorScreen`
[63712] Fix | Delete
* and the `NavigatorBackButton` components (or the `useNavigator` hook).
[63713] Fix | Delete
*
[63714] Fix | Delete
* @example
[63715] Fix | Delete
* ```jsx
[63716] Fix | Delete
* import {
[63717] Fix | Delete
* __experimentalNavigatorProvider as NavigatorProvider,
[63718] Fix | Delete
* __experimentalNavigatorScreen as NavigatorScreen,
[63719] Fix | Delete
* __experimentalNavigatorButton as NavigatorButton,
[63720] Fix | Delete
* __experimentalNavigatorBackButton as NavigatorBackButton,
[63721] Fix | Delete
* } from '@wordpress/components';
[63722] Fix | Delete
*
[63723] Fix | Delete
* const MyNavigation = () => (
[63724] Fix | Delete
* <NavigatorProvider initialPath="/">
[63725] Fix | Delete
* <NavigatorScreen path="/">
[63726] Fix | Delete
* <p>This is the home screen.</p>
[63727] Fix | Delete
* <NavigatorButton path="/child">
[63728] Fix | Delete
* Navigate to child screen.
[63729] Fix | Delete
* </NavigatorButton>
[63730] Fix | Delete
* </NavigatorScreen>
[63731] Fix | Delete
*
[63732] Fix | Delete
* <NavigatorScreen path="/child">
[63733] Fix | Delete
* <p>This is the child screen.</p>
[63734] Fix | Delete
* <NavigatorBackButton>
[63735] Fix | Delete
* Go back
[63736] Fix | Delete
* </NavigatorBackButton>
[63737] Fix | Delete
* </NavigatorScreen>
[63738] Fix | Delete
* </NavigatorProvider>
[63739] Fix | Delete
* );
[63740] Fix | Delete
* ```
[63741] Fix | Delete
*/
[63742] Fix | Delete
const NavigatorButton = contextConnect(UnconnectedNavigatorButton, 'NavigatorButton');
[63743] Fix | Delete
/* harmony default export */ const navigator_button_component = (NavigatorButton);
[63744] Fix | Delete
[63745] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-back-button/hook.js
[63746] Fix | Delete
/**
[63747] Fix | Delete
* WordPress dependencies
[63748] Fix | Delete
*/
[63749] Fix | Delete
[63750] Fix | Delete
[63751] Fix | Delete
/**
[63752] Fix | Delete
* Internal dependencies
[63753] Fix | Delete
*/
[63754] Fix | Delete
[63755] Fix | Delete
[63756] Fix | Delete
[63757] Fix | Delete
[63758] Fix | Delete
function useNavigatorBackButton(props) {
[63759] Fix | Delete
const {
[63760] Fix | Delete
onClick,
[63761] Fix | Delete
as = build_module_button,
[63762] Fix | Delete
goToParent: goToParentProp = false,
[63763] Fix | Delete
...otherProps
[63764] Fix | Delete
} = useContextSystem(props, 'NavigatorBackButton');
[63765] Fix | Delete
const {
[63766] Fix | Delete
goBack,
[63767] Fix | Delete
goToParent
[63768] Fix | Delete
} = use_navigator();
[63769] Fix | Delete
const handleClick = (0,external_wp_element_namespaceObject.useCallback)(e => {
[63770] Fix | Delete
e.preventDefault();
[63771] Fix | Delete
if (goToParentProp) {
[63772] Fix | Delete
goToParent();
[63773] Fix | Delete
} else {
[63774] Fix | Delete
goBack();
[63775] Fix | Delete
}
[63776] Fix | Delete
onClick?.(e);
[63777] Fix | Delete
}, [goToParentProp, goToParent, goBack, onClick]);
[63778] Fix | Delete
return {
[63779] Fix | Delete
as,
[63780] Fix | Delete
onClick: handleClick,
[63781] Fix | Delete
...otherProps
[63782] Fix | Delete
};
[63783] Fix | Delete
}
[63784] Fix | Delete
[63785] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-back-button/component.js
[63786] Fix | Delete
/**
[63787] Fix | Delete
* External dependencies
[63788] Fix | Delete
*/
[63789] Fix | Delete
[63790] Fix | Delete
/**
[63791] Fix | Delete
* Internal dependencies
[63792] Fix | Delete
*/
[63793] Fix | Delete
[63794] Fix | Delete
[63795] Fix | Delete
[63796] Fix | Delete
[63797] Fix | Delete
[63798] Fix | Delete
function UnconnectedNavigatorBackButton(props, forwardedRef) {
[63799] Fix | Delete
const navigatorBackButtonProps = useNavigatorBackButton(props);
[63800] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, {
[63801] Fix | Delete
ref: forwardedRef,
[63802] Fix | Delete
...navigatorBackButtonProps
[63803] Fix | Delete
});
[63804] Fix | Delete
}
[63805] Fix | Delete
[63806] Fix | Delete
/**
[63807] Fix | Delete
* The `NavigatorBackButton` component can be used to navigate to a screen and
[63808] Fix | Delete
* should be used in combination with the `NavigatorProvider`, the
[63809] Fix | Delete
* `NavigatorScreen` and the `NavigatorButton` components (or the `useNavigator`
[63810] Fix | Delete
* hook).
[63811] Fix | Delete
*
[63812] Fix | Delete
* @example
[63813] Fix | Delete
* ```jsx
[63814] Fix | Delete
* import {
[63815] Fix | Delete
* __experimentalNavigatorProvider as NavigatorProvider,
[63816] Fix | Delete
* __experimentalNavigatorScreen as NavigatorScreen,
[63817] Fix | Delete
* __experimentalNavigatorButton as NavigatorButton,
[63818] Fix | Delete
* __experimentalNavigatorBackButton as NavigatorBackButton,
[63819] Fix | Delete
* } from '@wordpress/components';
[63820] Fix | Delete
*
[63821] Fix | Delete
* const MyNavigation = () => (
[63822] Fix | Delete
* <NavigatorProvider initialPath="/">
[63823] Fix | Delete
* <NavigatorScreen path="/">
[63824] Fix | Delete
* <p>This is the home screen.</p>
[63825] Fix | Delete
* <NavigatorButton path="/child">
[63826] Fix | Delete
* Navigate to child screen.
[63827] Fix | Delete
* </NavigatorButton>
[63828] Fix | Delete
* </NavigatorScreen>
[63829] Fix | Delete
*
[63830] Fix | Delete
* <NavigatorScreen path="/child">
[63831] Fix | Delete
* <p>This is the child screen.</p>
[63832] Fix | Delete
* <NavigatorBackButton>
[63833] Fix | Delete
* Go back
[63834] Fix | Delete
* </NavigatorBackButton>
[63835] Fix | Delete
* </NavigatorScreen>
[63836] Fix | Delete
* </NavigatorProvider>
[63837] Fix | Delete
* );
[63838] Fix | Delete
* ```
[63839] Fix | Delete
*/
[63840] Fix | Delete
const NavigatorBackButton = contextConnect(UnconnectedNavigatorBackButton, 'NavigatorBackButton');
[63841] Fix | Delete
/* harmony default export */ const navigator_back_button_component = (NavigatorBackButton);
[63842] Fix | Delete
[63843] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-to-parent-button/component.js
[63844] Fix | Delete
/**
[63845] Fix | Delete
* External dependencies
[63846] Fix | Delete
*/
[63847] Fix | Delete
[63848] Fix | Delete
/**
[63849] Fix | Delete
* Internal dependencies
[63850] Fix | Delete
*/
[63851] Fix | Delete
[63852] Fix | Delete
[63853] Fix | Delete
[63854] Fix | Delete
[63855] Fix | Delete
[63856] Fix | Delete
function UnconnectedNavigatorToParentButton(props, forwardedRef) {
[63857] Fix | Delete
const navigatorToParentButtonProps = useNavigatorBackButton({
[63858] Fix | Delete
...props,
[63859] Fix | Delete
goToParent: true
[63860] Fix | Delete
});
[63861] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, {
[63862] Fix | Delete
ref: forwardedRef,
[63863] Fix | Delete
...navigatorToParentButtonProps
[63864] Fix | Delete
});
[63865] Fix | Delete
}
[63866] Fix | Delete
[63867] Fix | Delete
/*
[63868] Fix | Delete
* The `NavigatorToParentButton` component can be used to navigate to a screen and
[63869] Fix | Delete
* should be used in combination with the `NavigatorProvider`, the
[63870] Fix | Delete
* `NavigatorScreen` and the `NavigatorButton` components (or the `useNavigator`
[63871] Fix | Delete
* hook).
[63872] Fix | Delete
*
[63873] Fix | Delete
* @example
[63874] Fix | Delete
* ```jsx
[63875] Fix | Delete
* import {
[63876] Fix | Delete
* __experimentalNavigatorProvider as NavigatorProvider,
[63877] Fix | Delete
* __experimentalNavigatorScreen as NavigatorScreen,
[63878] Fix | Delete
* __experimentalNavigatorButton as NavigatorButton,
[63879] Fix | Delete
* __experimentalNavigatorToParentButton as NavigatorToParentButton,
[63880] Fix | Delete
* } from '@wordpress/components';
[63881] Fix | Delete
*
[63882] Fix | Delete
* const MyNavigation = () => (
[63883] Fix | Delete
* <NavigatorProvider initialPath="/">
[63884] Fix | Delete
* <NavigatorScreen path="/">
[63885] Fix | Delete
* <p>This is the home screen.</p>
[63886] Fix | Delete
* <NavigatorButton path="/child">
[63887] Fix | Delete
* Navigate to child screen.
[63888] Fix | Delete
* </NavigatorButton>
[63889] Fix | Delete
* </NavigatorScreen>
[63890] Fix | Delete
*
[63891] Fix | Delete
* <NavigatorScreen path="/child">
[63892] Fix | Delete
* <p>This is the child screen.</p>
[63893] Fix | Delete
* <NavigatorToParentButton>
[63894] Fix | Delete
* Go to parent
[63895] Fix | Delete
* </NavigatorToParentButton>
[63896] Fix | Delete
* </NavigatorScreen>
[63897] Fix | Delete
* </NavigatorProvider>
[63898] Fix | Delete
* );
[63899] Fix | Delete
* ```
[63900] Fix | Delete
*/
[63901] Fix | Delete
const NavigatorToParentButton = contextConnect(UnconnectedNavigatorToParentButton, 'NavigatorToParentButton');
[63902] Fix | Delete
/* harmony default export */ const navigator_to_parent_button_component = (NavigatorToParentButton);
[63903] Fix | Delete
[63904] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/notice/index.js
[63905] Fix | Delete
/**
[63906] Fix | Delete
* External dependencies
[63907] Fix | Delete
*/
[63908] Fix | Delete
[63909] Fix | Delete
[63910] Fix | Delete
/**
[63911] Fix | Delete
* WordPress dependencies
[63912] Fix | Delete
*/
[63913] Fix | Delete
[63914] Fix | Delete
[63915] Fix | Delete
[63916] Fix | Delete
[63917] Fix | Delete
[63918] Fix | Delete
/**
[63919] Fix | Delete
* Internal dependencies
[63920] Fix | Delete
*/
[63921] Fix | Delete
[63922] Fix | Delete
[63923] Fix | Delete
[63924] Fix | Delete
[63925] Fix | Delete
const notice_noop = () => {};
[63926] Fix | Delete
[63927] Fix | Delete
/**
[63928] Fix | Delete
* Custom hook which announces the message with the given politeness, if a
[63929] Fix | Delete
* valid message is provided.
[63930] Fix | Delete
*/
[63931] Fix | Delete
function useSpokenMessage(message, politeness) {
[63932] Fix | Delete
const spokenMessage = typeof message === 'string' ? message : (0,external_wp_element_namespaceObject.renderToString)(message);
[63933] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[63934] Fix | Delete
if (spokenMessage) {
[63935] Fix | Delete
(0,external_wp_a11y_namespaceObject.speak)(spokenMessage, politeness);
[63936] Fix | Delete
}
[63937] Fix | Delete
}, [spokenMessage, politeness]);
[63938] Fix | Delete
}
[63939] Fix | Delete
function getDefaultPoliteness(status) {
[63940] Fix | Delete
switch (status) {
[63941] Fix | Delete
case 'success':
[63942] Fix | Delete
case 'warning':
[63943] Fix | Delete
case 'info':
[63944] Fix | Delete
return 'polite';
[63945] Fix | Delete
// The default will also catch the 'error' status.
[63946] Fix | Delete
default:
[63947] Fix | Delete
return 'assertive';
[63948] Fix | Delete
}
[63949] Fix | Delete
}
[63950] Fix | Delete
function getStatusLabel(status) {
[63951] Fix | Delete
switch (status) {
[63952] Fix | Delete
case 'warning':
[63953] Fix | Delete
return (0,external_wp_i18n_namespaceObject.__)('Warning notice');
[63954] Fix | Delete
case 'info':
[63955] Fix | Delete
return (0,external_wp_i18n_namespaceObject.__)('Information notice');
[63956] Fix | Delete
case 'error':
[63957] Fix | Delete
return (0,external_wp_i18n_namespaceObject.__)('Error notice');
[63958] Fix | Delete
// The default will also catch the 'success' status.
[63959] Fix | Delete
default:
[63960] Fix | Delete
return (0,external_wp_i18n_namespaceObject.__)('Notice');
[63961] Fix | Delete
}
[63962] Fix | Delete
}
[63963] Fix | Delete
[63964] Fix | Delete
/**
[63965] Fix | Delete
* `Notice` is a component used to communicate feedback to the user.
[63966] Fix | Delete
*
[63967] Fix | Delete
*```jsx
[63968] Fix | Delete
* import { Notice } from `@wordpress/components`;
[63969] Fix | Delete
*
[63970] Fix | Delete
* const MyNotice = () => (
[63971] Fix | Delete
* <Notice status="error">An unknown error occurred.</Notice>
[63972] Fix | Delete
* );
[63973] Fix | Delete
* ```
[63974] Fix | Delete
*/
[63975] Fix | Delete
function Notice({
[63976] Fix | Delete
className,
[63977] Fix | Delete
status = 'info',
[63978] Fix | Delete
children,
[63979] Fix | Delete
spokenMessage = children,
[63980] Fix | Delete
onRemove = notice_noop,
[63981] Fix | Delete
isDismissible = true,
[63982] Fix | Delete
actions = [],
[63983] Fix | Delete
politeness = getDefaultPoliteness(status),
[63984] Fix | Delete
__unstableHTML,
[63985] Fix | Delete
// onDismiss is a callback executed when the notice is dismissed.
[63986] Fix | Delete
// It is distinct from onRemove, which _looks_ like a callback but is
[63987] Fix | Delete
// actually the function to call to remove the notice from the UI.
[63988] Fix | Delete
onDismiss = notice_noop
[63989] Fix | Delete
}) {
[63990] Fix | Delete
useSpokenMessage(spokenMessage, politeness);
[63991] Fix | Delete
const classes = dist_clsx(className, 'components-notice', 'is-' + status, {
[63992] Fix | Delete
'is-dismissible': isDismissible
[63993] Fix | Delete
});
[63994] Fix | Delete
if (__unstableHTML && typeof children === 'string') {
[63995] Fix | Delete
children = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, {
[63996] Fix | Delete
children: children
[63997] Fix | Delete
});
[63998] Fix | Delete
}
[63999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function