fix: prevent asset conflicts between React and Grid.js versions

Add coexistence checks to all enqueue methods to prevent loading
both React and Grid.js assets simultaneously.

Changes:
- ReactAdmin.php: Only enqueue React assets when ?react=1
- Init.php: Skip Grid.js when React active on admin pages
- Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0
- Customer.php, Product.php, License.php: Add coexistence checks

Now the toggle between Classic and React versions works correctly.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

View File

@@ -0,0 +1,50 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = require("react");
var _reactNative = require("react-native");
var _components = require("@wordpress/components");
var _compose = require("@wordpress/compose");
var _element = require("@wordpress/element");
var _actions = _interopRequireDefault(require("./actions.scss"));
var _bottomSeparatorCover = _interopRequireDefault(require("./bottom-separator-cover"));
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PanelActions({
actions,
getStylesFromColorScheme
}) {
const mappedActions = (0, _element.useMemo)(() => {
return actions.map(({
label,
onPress
}) => {
return (0, _react.createElement)(_components.TextControl, {
label: label,
onPress: onPress,
labelStyle: _actions.default.defaultLabelStyle,
key: label
});
});
}, [actions]);
return (0, _react.createElement)(_reactNative.View, {
style: getStylesFromColorScheme(_actions.default.panelActionsContainer, _actions.default.panelActionsContainerDark)
}, mappedActions, (0, _react.createElement)(_bottomSeparatorCover.default, null));
}
var _default = (0, _compose.withPreferredColorScheme)(PanelActions);
exports.default = _default;
//# sourceMappingURL=actions.native.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_reactNative","require","_components","_compose","_element","_actions","_interopRequireDefault","_bottomSeparatorCover","PanelActions","actions","getStylesFromColorScheme","mappedActions","useMemo","map","label","onPress","_react","createElement","TextControl","labelStyle","styles","defaultLabelStyle","key","View","style","panelActionsContainer","panelActionsContainerDark","default","_default","withPreferredColorScheme","exports"],"sources":["@wordpress/components/src/panel/actions.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { TextControl } from '@wordpress/components';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './actions.scss';\nimport BottomSeparatorCover from './bottom-separator-cover';\n\nfunction PanelActions( { actions, getStylesFromColorScheme } ) {\n\tconst mappedActions = useMemo( () => {\n\t\treturn actions.map( ( { label, onPress } ) => {\n\t\t\treturn (\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tonPress={ onPress }\n\t\t\t\t\tlabelStyle={ styles.defaultLabelStyle }\n\t\t\t\t\tkey={ label }\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ actions ] );\n\n\treturn (\n\t\t<View\n\t\t\tstyle={ getStylesFromColorScheme(\n\t\t\t\tstyles.panelActionsContainer,\n\t\t\t\tstyles.panelActionsContainerDark\n\t\t\t) }\n\t\t>\n\t\t\t{ mappedActions }\n\t\t\t<BottomSeparatorCover />\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( PanelActions );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,qBAAA,GAAAD,sBAAA,CAAAL,OAAA;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAIA,SAASO,YAAYA,CAAE;EAAEC,OAAO;EAAEC;AAAyB,CAAC,EAAG;EAC9D,MAAMC,aAAa,GAAG,IAAAC,gBAAO,EAAE,MAAM;IACpC,OAAOH,OAAO,CAACI,GAAG,CAAE,CAAE;MAAEC,KAAK;MAAEC;IAAQ,CAAC,KAAM;MAC7C,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAgB,WAAW;QACXJ,KAAK,EAAGA,KAAO;QACfC,OAAO,EAAGA,OAAS;QACnBI,UAAU,EAAGC,gBAAM,CAACC,iBAAmB;QACvCC,GAAG,EAAGR;MAAO,CACb,CAAC;IAEJ,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEL,OAAO,CAAG,CAAC;EAEhB,OACC,IAAAO,MAAA,CAAAC,aAAA,EAACjB,YAAA,CAAAuB,IAAI;IACJC,KAAK,EAAGd,wBAAwB,CAC/BU,gBAAM,CAACK,qBAAqB,EAC5BL,gBAAM,CAACM,yBACR;EAAG,GAEDf,aAAa,EACf,IAAAK,MAAA,CAAAC,aAAA,EAACV,qBAAA,CAAAoB,OAAoB,MAAE,CAClB,CAAC;AAET;AAAC,IAAAC,QAAA,GAEc,IAAAC,iCAAwB,EAAErB,YAAa,CAAC;AAAAsB,OAAA,CAAAH,OAAA,GAAAC,QAAA"}

118
node_modules/@wordpress/components/build/panel/body.js generated vendored Normal file
View File

@@ -0,0 +1,118 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PanelBody = void 0;
exports.UnforwardedPanelBody = UnforwardedPanelBody;
exports.default = void 0;
var _react = require("react");
var _classnames = _interopRequireDefault(require("classnames"));
var _compose = require("@wordpress/compose");
var _element = require("@wordpress/element");
var _icons = require("@wordpress/icons");
var _button = _interopRequireDefault(require("../button"));
var _icon = _interopRequireDefault(require("../icon"));
var _utils = require("../utils");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const noop = () => {};
function UnforwardedPanelBody(props, ref) {
const {
buttonProps = {},
children,
className,
icon,
initialOpen,
onToggle = noop,
opened,
title,
scrollAfterOpen = true
} = props;
const [isOpened, setIsOpened] = (0, _utils.useControlledState)(opened, {
initial: initialOpen === undefined ? true : initialOpen,
fallback: false
});
const nodeRef = (0, _element.useRef)(null);
// Defaults to 'smooth' scrolling
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
const scrollBehavior = (0, _compose.useReducedMotion)() ? 'auto' : 'smooth';
const handleOnToggle = event => {
event.preventDefault();
const next = !isOpened;
setIsOpened(next);
onToggle(next);
};
// Ref is used so that the effect does not re-run upon scrollAfterOpen changing value.
const scrollAfterOpenRef = (0, _element.useRef)();
scrollAfterOpenRef.current = scrollAfterOpen;
// Runs after initial render.
(0, _utils.useUpdateEffect)(() => {
if (isOpened && scrollAfterOpenRef.current && nodeRef.current?.scrollIntoView) {
/*
* Scrolls the content into view when visible.
* This improves the UX when there are multiple stacking <PanelBody />
* components in a scrollable container.
*/
nodeRef.current.scrollIntoView({
inline: 'nearest',
block: 'nearest',
behavior: scrollBehavior
});
}
}, [isOpened, scrollBehavior]);
const classes = (0, _classnames.default)('components-panel__body', className, {
'is-opened': isOpened
});
return (0, _react.createElement)("div", {
className: classes,
ref: (0, _compose.useMergeRefs)([nodeRef, ref])
}, (0, _react.createElement)(PanelBodyTitle, {
icon: icon,
isOpened: Boolean(isOpened),
onClick: handleOnToggle,
title: title,
...buttonProps
}), typeof children === 'function' ? children({
opened: Boolean(isOpened)
}) : isOpened && children);
}
const PanelBodyTitle = (0, _element.forwardRef)(({
isOpened,
icon,
title,
...props
}, ref) => {
if (!title) return null;
return (0, _react.createElement)("h2", {
className: "components-panel__body-title"
}, (0, _react.createElement)(_button.default, {
className: "components-panel__body-toggle",
"aria-expanded": isOpened,
ref: ref,
...props
}, (0, _react.createElement)("span", {
"aria-hidden": "true"
}, (0, _react.createElement)(_icon.default, {
className: "components-panel__arrow",
icon: isOpened ? _icons.chevronUp : _icons.chevronDown
})), title, icon && (0, _react.createElement)(_icon.default, {
icon: icon,
className: "components-panel__icon",
size: 20
})));
});
const PanelBody = (0, _element.forwardRef)(UnforwardedPanelBody);
exports.PanelBody = PanelBody;
var _default = PanelBody;
exports.default = _default;
//# sourceMappingURL=body.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,36 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PanelBody = PanelBody;
exports.default = void 0;
var _react = require("react");
var _reactNative = require("react-native");
var _body = _interopRequireDefault(require("./body.scss"));
var _bottomSeparatorCover = _interopRequireDefault(require("./bottom-separator-cover"));
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function PanelBody({
children,
title,
style,
titleStyle = {}
}) {
return (0, _react.createElement)(_reactNative.View, {
style: [_body.default.panelContainer, style]
}, title && (0, _react.createElement)(_reactNative.Text, {
accessibilityRole: "header",
style: [_body.default.sectionHeaderText, titleStyle]
}, title), children, (0, _react.createElement)(_bottomSeparatorCover.default, null));
}
var _default = PanelBody;
exports.default = _default;
//# sourceMappingURL=body.native.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_reactNative","require","_body","_interopRequireDefault","_bottomSeparatorCover","PanelBody","children","title","style","titleStyle","_react","createElement","View","styles","panelContainer","Text","accessibilityRole","sectionHeaderText","default","_default","exports"],"sources":["@wordpress/components/src/panel/body.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Text, View } from 'react-native';\n\n/**\n * Internal dependencies\n */\nimport styles from './body.scss';\nimport BottomSeparatorCover from './bottom-separator-cover';\n\nexport function PanelBody( { children, title, style, titleStyle = {} } ) {\n\treturn (\n\t\t<View style={ [ styles.panelContainer, style ] }>\n\t\t\t{ title && (\n\t\t\t\t<Text\n\t\t\t\t\taccessibilityRole=\"header\"\n\t\t\t\t\tstyle={ [ styles.sectionHeaderText, titleStyle ] }\n\t\t\t\t>\n\t\t\t\t\t{ title }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t\t{ children }\n\t\t\t<BottomSeparatorCover />\n\t\t</View>\n\t);\n}\n\nexport default PanelBody;\n"],"mappings":";;;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAD,sBAAA,CAAAF,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIO,SAASI,SAASA,CAAE;EAAEC,QAAQ;EAAEC,KAAK;EAAEC,KAAK;EAAEC,UAAU,GAAG,CAAC;AAAE,CAAC,EAAG;EACxE,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACX,YAAA,CAAAY,IAAI;IAACJ,KAAK,EAAG,CAAEK,aAAM,CAACC,cAAc,EAAEN,KAAK;EAAI,GAC7CD,KAAK,IACN,IAAAG,MAAA,CAAAC,aAAA,EAACX,YAAA,CAAAe,IAAI;IACJC,iBAAiB,EAAC,QAAQ;IAC1BR,KAAK,EAAG,CAAEK,aAAM,CAACI,iBAAiB,EAAER,UAAU;EAAI,GAEhDF,KACG,CACN,EACCD,QAAQ,EACV,IAAAI,MAAA,CAAAC,aAAA,EAACP,qBAAA,CAAAc,OAAoB,MAAE,CAClB,CAAC;AAET;AAAC,IAAAC,QAAA,GAEcd,SAAS;AAAAe,OAAA,CAAAF,OAAA,GAAAC,QAAA"}

View File

@@ -0,0 +1,33 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = require("react");
var _reactNative = require("react-native");
var _compose = require("@wordpress/compose");
var _bottomSeparatorCover = _interopRequireDefault(require("./bottom-separator-cover.scss"));
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BottomSeparatorCover({
getStylesFromColorScheme
}) {
return (0, _react.createElement)(_reactNative.View, {
style: getStylesFromColorScheme(_bottomSeparatorCover.default.coverSeparator, _bottomSeparatorCover.default.coverSeparatorDark)
});
}
var _default = (0, _compose.withPreferredColorScheme)(BottomSeparatorCover);
exports.default = _default;
//# sourceMappingURL=bottom-separator-cover.native.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_reactNative","require","_compose","_bottomSeparatorCover","_interopRequireDefault","BottomSeparatorCover","getStylesFromColorScheme","_react","createElement","View","style","styles","coverSeparator","coverSeparatorDark","_default","withPreferredColorScheme","exports","default"],"sources":["@wordpress/components/src/panel/bottom-separator-cover.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { withPreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './bottom-separator-cover.scss';\n\nfunction BottomSeparatorCover( { getStylesFromColorScheme } ) {\n\treturn (\n\t\t<View\n\t\t\tstyle={ getStylesFromColorScheme(\n\t\t\t\tstyles.coverSeparator,\n\t\t\t\tstyles.coverSeparatorDark\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default withPreferredColorScheme( BottomSeparatorCover );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,qBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,SAASI,oBAAoBA,CAAE;EAAEC;AAAyB,CAAC,EAAG;EAC7D,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACR,YAAA,CAAAS,IAAI;IACJC,KAAK,EAAGJ,wBAAwB,CAC/BK,6BAAM,CAACC,cAAc,EACrBD,6BAAM,CAACE,kBACR;EAAG,CACH,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAEc,IAAAC,iCAAwB,EAAEV,oBAAqB,CAAC;AAAAW,OAAA,CAAAC,OAAA,GAAAH,QAAA"}

View File

@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = require("react");
/**
* Internal dependencies
*/
/**
* `PanelHeader` renders the header for the `Panel`.
* This is used by the `Panel` component under the hood,
* so it does not typically need to be used.
*/
function PanelHeader({
label,
children
}) {
return (0, _react.createElement)("div", {
className: "components-panel__header"
}, label && (0, _react.createElement)("h2", null, label), children);
}
var _default = PanelHeader;
exports.default = _default;
//# sourceMappingURL=header.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["PanelHeader","label","children","_react","createElement","className","_default","exports","default"],"sources":["@wordpress/components/src/panel/header.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { PanelHeaderProps } from './types';\n\n/**\n * `PanelHeader` renders the header for the `Panel`.\n * This is used by the `Panel` component under the hood,\n * so it does not typically need to be used.\n */\nfunction PanelHeader( { label, children }: PanelHeaderProps ) {\n\treturn (\n\t\t<div className=\"components-panel__header\">\n\t\t\t{ label && <h2>{ label }</h2> }\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default PanelHeader;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA,SAASA,WAAWA,CAAE;EAAEC,KAAK;EAAEC;AAA2B,CAAC,EAAG;EAC7D,OACC,IAAAC,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAA0B,GACtCJ,KAAK,IAAI,IAAAE,MAAA,CAAAC,aAAA,cAAMH,KAAW,CAAC,EAC3BC,QACE,CAAC;AAER;AAAC,IAAAI,QAAA,GAEcN,WAAW;AAAAO,OAAA,CAAAC,OAAA,GAAAF,QAAA"}

View File

@@ -0,0 +1,58 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.Panel = void 0;
var _react = require("react");
var _classnames = _interopRequireDefault(require("classnames"));
var _element = require("@wordpress/element");
var _header = _interopRequireDefault(require("./header"));
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedPanel({
header,
className,
children
}, ref) {
const classNames = (0, _classnames.default)(className, 'components-panel');
return (0, _react.createElement)("div", {
className: classNames,
ref: ref
}, header && (0, _react.createElement)(_header.default, {
label: header
}), children);
}
/**
* `Panel` expands and collapses multiple sections of content.
*
* ```jsx
* import { Panel, PanelBody, PanelRow } from '@wordpress/components';
* import { more } from '@wordpress/icons';
*
* const MyPanel = () => (
* <Panel header="My Panel">
* <PanelBody title="My Block Settings" icon={ more } initialOpen={ true }>
* <PanelRow>My Panel Inputs and Labels</PanelRow>
* </PanelBody>
* </Panel>
* );
* ```
*/
const Panel = (0, _element.forwardRef)(UnforwardedPanel);
exports.Panel = Panel;
var _default = Panel;
exports.default = _default;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_header","UnforwardedPanel","header","className","children","ref","classNames","classnames","_react","createElement","default","label","Panel","forwardRef","exports","_default"],"sources":["@wordpress/components/src/panel/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PanelHeader from './header';\nimport type { PanelProps } from './types';\n\nfunction UnforwardedPanel(\n\t{ header, className, children }: PanelProps,\n\tref: React.ForwardedRef< HTMLDivElement >\n) {\n\tconst classNames = classnames( className, 'components-panel' );\n\treturn (\n\t\t<div className={ classNames } ref={ ref }>\n\t\t\t{ header && <PanelHeader label={ header } /> }\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\n/**\n * `Panel` expands and collapses multiple sections of content.\n *\n * ```jsx\n * import { Panel, PanelBody, PanelRow } from '@wordpress/components';\n * import { more } from '@wordpress/icons';\n *\n * const MyPanel = () => (\n * \t<Panel header=\"My Panel\">\n * \t\t<PanelBody title=\"My Block Settings\" icon={ more } initialOpen={ true }>\n * \t\t\t<PanelRow>My Panel Inputs and Labels</PanelRow>\n * \t\t</PanelBody>\n * \t</Panel>\n * );\n * ```\n */\nexport const Panel = forwardRef( UnforwardedPanel );\n\nexport default Panel;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAIA,SAASG,gBAAgBA,CACxB;EAAEC,MAAM;EAAEC,SAAS;EAAEC;AAAqB,CAAC,EAC3CC,GAAyC,EACxC;EACD,MAAMC,UAAU,GAAG,IAAAC,mBAAU,EAAEJ,SAAS,EAAE,kBAAmB,CAAC;EAC9D,OACC,IAAAK,MAAA,CAAAC,aAAA;IAAKN,SAAS,EAAGG,UAAY;IAACD,GAAG,EAAGA;EAAK,GACtCH,MAAM,IAAI,IAAAM,MAAA,CAAAC,aAAA,EAACT,OAAA,CAAAU,OAAW;IAACC,KAAK,EAAGT;EAAQ,CAAE,CAAC,EAC1CE,QACE,CAAC;AAER;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMQ,KAAK,GAAG,IAAAC,mBAAU,EAAEZ,gBAAiB,CAAC;AAACa,OAAA,CAAAF,KAAA,GAAAA,KAAA;AAAA,IAAAG,QAAA,GAErCH,KAAK;AAAAE,OAAA,CAAAJ,OAAA,GAAAK,QAAA"}

37
node_modules/@wordpress/components/build/panel/row.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.PanelRow = void 0;
var _react = require("react");
var _classnames = _interopRequireDefault(require("classnames"));
var _element = require("@wordpress/element");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function UnforwardedPanelRow({
className,
children
}, ref) {
return (0, _react.createElement)("div", {
className: (0, _classnames.default)('components-panel__row', className),
ref: ref
}, children);
}
/**
* `PanelRow` is a generic container for rows within a `PanelBody`.
* It is a flex container with a top margin for spacing.
*/
const PanelRow = (0, _element.forwardRef)(UnforwardedPanelRow);
exports.PanelRow = PanelRow;
var _default = PanelRow;
exports.default = _default;
//# sourceMappingURL=row.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_classnames","_interopRequireDefault","require","_element","UnforwardedPanelRow","className","children","ref","_react","createElement","classnames","PanelRow","forwardRef","exports","_default","default"],"sources":["@wordpress/components/src/panel/row.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { PanelRowProps } from './types';\n\nfunction UnforwardedPanelRow(\n\t{ className, children }: PanelRowProps,\n\tref: ForwardedRef< HTMLDivElement >\n) {\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'components-panel__row', className ) }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\n/**\n * `PanelRow` is a generic container for rows within a `PanelBody`.\n * It is a flex container with a top margin for spacing.\n */\nexport const PanelRow = forwardRef( UnforwardedPanelRow );\n\nexport default PanelRow;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AASA,SAASE,mBAAmBA,CAC3B;EAAEC,SAAS;EAAEC;AAAwB,CAAC,EACtCC,GAAmC,EAClC;EACD,OACC,IAAAC,MAAA,CAAAC,aAAA;IACCJ,SAAS,EAAG,IAAAK,mBAAU,EAAE,uBAAuB,EAAEL,SAAU,CAAG;IAC9DE,GAAG,EAAGA;EAAK,GAETD,QACE,CAAC;AAER;;AAEA;AACA;AACA;AACA;AACO,MAAMK,QAAQ,GAAG,IAAAC,mBAAU,EAAER,mBAAoB,CAAC;AAACS,OAAA,CAAAF,QAAA,GAAAA,QAAA;AAAA,IAAAG,QAAA,GAE3CH,QAAQ;AAAAE,OAAA,CAAAE,OAAA,GAAAD,QAAA"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":[],"sources":["@wordpress/components/src/panel/types.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { ButtonAsButtonProps } from '../button/types';\nimport type { WordPressComponentProps } from '../context';\n\nexport type PanelProps = {\n\t/**\n\t * The text that will be rendered as the title of the panel.\n\t * Text will be rendered inside an `<h2>` tag.\n\t */\n\theader?: PanelHeaderProps[ 'label' ];\n\t/**\n\t * The CSS class to apply to the wrapper element.\n\t */\n\tclassName?: string;\n\t/**\n\t * The content to display within the panel.\n\t */\n\tchildren: React.ReactNode;\n};\n\nexport type PanelHeaderProps = {\n\t/**\n\t * The text that will be rendered as the title of the panel.\n\t * Will be rendered in an `<h2>` tag.\n\t */\n\tlabel?: string;\n\t/**\n\t * The content to display within the panel header.\n\t */\n\tchildren?: React.ReactNode;\n};\n\nexport type PanelRowProps = {\n\t/**\n\t * The CSS class to apply to the wrapper element.\n\t */\n\tclassName?: string;\n\t/**\n\t * The content to display within the panel row.\n\t */\n\tchildren: React.ReactNode;\n};\n\nexport type PanelBodyProps = {\n\t/**\n\t * Props that are passed to the `Button` component in title within the\n\t * `PanelBody`.\n\t *\n\t * @default {}\n\t */\n\tbuttonProps?: WordPressComponentProps<\n\t\tOmit< ButtonAsButtonProps, 'icon' >,\n\t\t'button',\n\t\tfalse\n\t>;\n\t/**\n\t * The content to display in the `PanelBody`.If a function is provided for\n\t * this prop, it will receive an object with the `opened` prop as an argument.\n\t */\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ( ( props: { opened: boolean } ) => React.ReactNode );\n\n\t/**\n\t * The CSS class to apply to the wrapper element.\n\t */\n\tclassName?: string;\n\t/**\n\t * An icon to be shown next to the title.\n\t */\n\ticon?: JSX.Element;\n\t/**\n\t * Whether or not the panel will start open.\n\t */\n\tinitialOpen?: boolean;\n\t/**\n\t * A function that is called any time the component is toggled from its closed\n\t * state to its opened state, or vice versa.\n\t *\n\t * @default noop\n\t */\n\tonToggle?: ( next: boolean ) => void;\n\t/**\n\t * When set to `true`, the component will remain open regardless of the\n\t * `initialOpen` prop and the panel will be prevented from being closed.\n\t */\n\topened?: boolean;\n\t/**\n\t * Title text. It shows even when it is closed.\n\t */\n\ttitle?: string;\n\t/**\n\t * Scrolls the content into view when visible. This improves the UX when\n\t * multiple `PanelBody` components are stacked in a scrollable container.\n\t *\n\t * @default true\n\t */\n\tscrollAfterOpen?: boolean;\n};\n\nexport type PanelBodyTitleProps = Omit< ButtonAsButtonProps, 'icon' > & {\n\t/**\n\t * An icon to be shown next to the title.\n\t */\n\ticon?: JSX.Element;\n\t/**\n\t * Whether or not the `PanelBody` is currently opened or not.\n\t */\n\tisOpened?: boolean;\n\t/**\n\t * The title text.\n\t */\n\ttitle?: string;\n};\n"],"mappings":""}