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,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.DropdownContentWrapper = void 0;
var _react = require("react");
var _context = require("../context");
var _styles = require("./styles");
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedDropdownContentWrapper(props, forwardedRef) {
const {
paddingSize = 'small',
...derivedProps
} = (0, _context.useContextSystem)(props, 'DropdownContentWrapper');
return (0, _react.createElement)(_styles.DropdownContentWrapperDiv, {
...derivedProps,
paddingSize: paddingSize,
ref: forwardedRef
});
}
/**
* A convenience wrapper for the `renderContent` when you want to apply
* different padding. (Default is `paddingSize="small"`).
*
* ```jsx
* import {
* Dropdown,
* __experimentalDropdownContentWrapper as DropdownContentWrapper,
* } from '@wordpress/components';
*
* <Dropdown
* renderContent={ () => (
* <DropdownContentWrapper paddingSize="medium">
* My dropdown content
* </DropdownContentWrapper>
* ) }
* />
* ```
*/
const DropdownContentWrapper = (0, _context.contextConnect)(UnconnectedDropdownContentWrapper, 'DropdownContentWrapper');
exports.DropdownContentWrapper = DropdownContentWrapper;
var _default = DropdownContentWrapper;
exports.default = _default;
//# sourceMappingURL=dropdown-content-wrapper.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_context","require","_styles","UnconnectedDropdownContentWrapper","props","forwardedRef","paddingSize","derivedProps","useContextSystem","_react","createElement","DropdownContentWrapperDiv","ref","DropdownContentWrapper","contextConnect","exports","_default","default"],"sources":["@wordpress/components/src/dropdown/dropdown-content-wrapper.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { contextConnect, useContextSystem } from '../context';\nimport { DropdownContentWrapperDiv } from './styles';\nimport type { DropdownContentWrapperProps } from './types';\n\nfunction UnconnectedDropdownContentWrapper(\n\tprops: WordPressComponentProps< DropdownContentWrapperProps, 'div', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst { paddingSize = 'small', ...derivedProps } = useContextSystem(\n\t\tprops,\n\t\t'DropdownContentWrapper'\n\t);\n\n\treturn (\n\t\t<DropdownContentWrapperDiv\n\t\t\t{ ...derivedProps }\n\t\t\tpaddingSize={ paddingSize }\n\t\t\tref={ forwardedRef }\n\t\t/>\n\t);\n}\n\n/**\n * A convenience wrapper for the `renderContent` when you want to apply\n * different padding. (Default is `paddingSize=\"small\"`).\n *\n * ```jsx\n * import {\n * Dropdown,\n * __experimentalDropdownContentWrapper as DropdownContentWrapper,\n * } from '@wordpress/components';\n *\n * <Dropdown\n * renderContent={ () => (\n * <DropdownContentWrapper paddingSize=\"medium\">\n * My dropdown content\n * </DropdownContentWrapper>\n * ) }\n * />\n * ```\n */\nexport const DropdownContentWrapper = contextConnect(\n\tUnconnectedDropdownContentWrapper,\n\t'DropdownContentWrapper'\n);\n\nexport default DropdownContentWrapper;\n"],"mappings":";;;;;;;AASA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAVA;AACA;AACA;;AAGA;AACA;AACA;;AAMA,SAASE,iCAAiCA,CACzCC,KAA2E,EAC3EC,YAAiC,EAChC;EACD,MAAM;IAAEC,WAAW,GAAG,OAAO;IAAE,GAAGC;EAAa,CAAC,GAAG,IAAAC,yBAAgB,EAClEJ,KAAK,EACL,wBACD,CAAC;EAED,OACC,IAAAK,MAAA,CAAAC,aAAA,EAACR,OAAA,CAAAS,yBAAyB;IAAA,GACpBJ,YAAY;IACjBD,WAAW,EAAGA,WAAa;IAC3BM,GAAG,EAAGP;EAAc,CACpB,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMQ,sBAAsB,GAAG,IAAAC,uBAAc,EACnDX,iCAAiC,EACjC,wBACD,CAAC;AAACY,OAAA,CAAAF,sBAAA,GAAAA,sBAAA;AAAA,IAAAG,QAAA,GAEaH,sBAAsB;AAAAE,OAAA,CAAAE,OAAA,GAAAD,QAAA"}

View File

@@ -0,0 +1,153 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.Dropdown = void 0;
var _react = require("react");
var _classnames = _interopRequireDefault(require("classnames"));
var _element = require("@wordpress/element");
var _compose = require("@wordpress/compose");
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
var _context = require("../context");
var _hooks = require("../utils/hooks");
var _popover = _interopRequireDefault(require("../popover"));
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const UnconnectedDropdown = (props, forwardedRef) => {
const {
renderContent,
renderToggle,
className,
contentClassName,
expandOnMobile,
headerTitle,
focusOnMount,
popoverProps,
onClose,
onToggle,
style,
open,
defaultOpen,
// Deprecated props
position,
// From context system
variant
} = (0, _context.useContextSystem)(props, 'Dropdown');
if (position !== undefined) {
(0, _deprecated.default)('`position` prop in wp.components.Dropdown', {
since: '6.2',
alternative: '`popoverProps.placement` prop',
hint: 'Note that the `position` prop will override any values passed through the `popoverProps.placement` prop.'
});
}
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [fallbackPopoverAnchor, setFallbackPopoverAnchor] = (0, _element.useState)(null);
const containerRef = (0, _element.useRef)();
const [isOpen, setIsOpen] = (0, _hooks.useControlledValue)({
defaultValue: defaultOpen,
value: open,
onChange: onToggle
});
/**
* Closes the popover when focus leaves it unless the toggle was pressed or
* focus has moved to a separate dialog. The former is to let the toggle
* handle closing the popover and the latter is to preserve presence in
* case a dialog has opened, allowing focus to return when it's dismissed.
*/
function closeIfFocusOutside() {
if (!containerRef.current) {
return;
}
const {
ownerDocument
} = containerRef.current;
const dialog = ownerDocument?.activeElement?.closest('[role="dialog"]');
if (!containerRef.current.contains(ownerDocument.activeElement) && (!dialog || dialog.contains(containerRef.current))) {
close();
}
}
function close() {
onClose?.();
setIsOpen(false);
}
const args = {
isOpen: !!isOpen,
onToggle: () => setIsOpen(!isOpen),
onClose: close
};
const popoverPropsHaveAnchor = !!popoverProps?.anchor ||
// Note: `anchorRef`, `getAnchorRect` and `anchorRect` are deprecated and
// be removed from `Popover` from WordPress 6.3
!!popoverProps?.anchorRef || !!popoverProps?.getAnchorRect || !!popoverProps?.anchorRect;
return (0, _react.createElement)("div", {
className: className,
ref: (0, _compose.useMergeRefs)([containerRef, forwardedRef, setFallbackPopoverAnchor])
// Some UAs focus the closest focusable parent when the toggle is
// clicked. Making this div focusable ensures such UAs will focus
// it and `closeIfFocusOutside` can tell if the toggle was clicked.
,
tabIndex: -1,
style: style
}, renderToggle(args), isOpen && (0, _react.createElement)(_popover.default, {
position: position,
onClose: close,
onFocusOutside: closeIfFocusOutside,
expandOnMobile: expandOnMobile,
headerTitle: headerTitle,
focusOnMount: focusOnMount
// This value is used to ensure that the dropdowns
// align with the editor header by default.
,
offset: 13,
anchor: !popoverPropsHaveAnchor ? fallbackPopoverAnchor : undefined,
variant: variant,
...popoverProps,
className: (0, _classnames.default)('components-dropdown__content', popoverProps?.className, contentClassName)
}, renderContent(args)));
};
/**
* Renders a button that opens a floating content modal when clicked.
*
* ```jsx
* import { Button, Dropdown } from '@wordpress/components';
*
* const MyDropdown = () => (
* <Dropdown
* className="my-container-class-name"
* contentClassName="my-dropdown-content-classname"
* popoverProps={ { placement: 'bottom-start' } }
* renderToggle={ ( { isOpen, onToggle } ) => (
* <Button
* variant="primary"
* onClick={ onToggle }
* aria-expanded={ isOpen }
* >
* Toggle Dropdown!
* </Button>
* ) }
* renderContent={ () => <div>This is the content of the dropdown.</div> }
* />
* );
* ```
*/
const Dropdown = (0, _context.contextConnect)(UnconnectedDropdown, 'Dropdown');
exports.Dropdown = Dropdown;
var _default = Dropdown;
exports.default = _default;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,72 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = require("react");
var _element = require("@wordpress/element");
/**
* WordPress dependencies
*/
class Dropdown extends _element.Component {
constructor() {
super(...arguments);
this.toggle = this.toggle.bind(this);
this.close = this.close.bind(this);
this.state = {
isOpen: false
};
}
componentWillUnmount() {
const {
isOpen
} = this.state;
const {
onToggle
} = this.props;
if (isOpen && onToggle) {
onToggle(false);
}
}
componentDidUpdate(prevProps, prevState) {
const {
isOpen
} = this.state;
const {
onToggle
} = this.props;
if (prevState.isOpen !== isOpen && onToggle) {
onToggle(isOpen);
}
}
toggle() {
this.setState(state => ({
isOpen: !state.isOpen
}));
}
close() {
this.setState({
isOpen: false
});
}
render() {
const {
isOpen
} = this.state;
const {
renderContent,
renderToggle
} = this.props;
const args = {
isOpen,
onToggle: this.toggle,
onClose: this.close
};
return (0, _react.createElement)(_react.Fragment, null, renderToggle(args), isOpen && renderContent(args));
}
}
var _default = Dropdown;
exports.default = _default;
//# sourceMappingURL=index.native.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_element","require","Dropdown","Component","constructor","arguments","toggle","bind","close","state","isOpen","componentWillUnmount","onToggle","props","componentDidUpdate","prevProps","prevState","setState","render","renderContent","renderToggle","args","onClose","_react","createElement","Fragment","_default","exports","default"],"sources":["@wordpress/components/src/dropdown/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\n\nclass Dropdown extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.toggle = this.toggle.bind( this );\n\t\tthis.close = this.close.bind( this );\n\n\t\tthis.state = {\n\t\t\tisOpen: false,\n\t\t};\n\t}\n\n\tcomponentWillUnmount() {\n\t\tconst { isOpen } = this.state;\n\t\tconst { onToggle } = this.props;\n\t\tif ( isOpen && onToggle ) {\n\t\t\tonToggle( false );\n\t\t}\n\t}\n\n\tcomponentDidUpdate( prevProps, prevState ) {\n\t\tconst { isOpen } = this.state;\n\t\tconst { onToggle } = this.props;\n\t\tif ( prevState.isOpen !== isOpen && onToggle ) {\n\t\t\tonToggle( isOpen );\n\t\t}\n\t}\n\n\ttoggle() {\n\t\tthis.setState( ( state ) => ( {\n\t\t\tisOpen: ! state.isOpen,\n\t\t} ) );\n\t}\n\n\tclose() {\n\t\tthis.setState( { isOpen: false } );\n\t}\n\n\trender() {\n\t\tconst { isOpen } = this.state;\n\t\tconst { renderContent, renderToggle } = this.props;\n\n\t\tconst args = { isOpen, onToggle: this.toggle, onClose: this.close };\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ renderToggle( args ) }\n\t\t\t\t{ isOpen && renderContent( args ) }\n\t\t\t</>\n\t\t);\n\t}\n}\n\nexport default Dropdown;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,QAAQ,SAASC,kBAAS,CAAC;EAChCC,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IAErB,IAAI,CAACC,MAAM,GAAG,IAAI,CAACA,MAAM,CAACC,IAAI,CAAE,IAAK,CAAC;IACtC,IAAI,CAACC,KAAK,GAAG,IAAI,CAACA,KAAK,CAACD,IAAI,CAAE,IAAK,CAAC;IAEpC,IAAI,CAACE,KAAK,GAAG;MACZC,MAAM,EAAE;IACT,CAAC;EACF;EAEAC,oBAAoBA,CAAA,EAAG;IACtB,MAAM;MAAED;IAAO,CAAC,G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require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DropdownContentWrapperDiv = void 0;
var _base = _interopRequireDefault(require("@emotion/styled/base"));
var _react = require("@emotion/react");
var _space = require("../utils/space");
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const padding = ({
paddingSize = 'small'
}) => {
if (paddingSize === 'none') return;
const paddingValues = {
small: (0, _space.space)(2),
medium: (0, _space.space)(4)
};
return /*#__PURE__*/(0, _react.css)("padding:", paddingValues[paddingSize] || paddingValues.small, ";" + (process.env.NODE_ENV === "production" ? "" : ";label:padding;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZHJvcGRvd24vc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW9CVyIsImZpbGUiOiJAd29yZHByZXNzL2NvbXBvbmVudHMvc3JjL2Ryb3Bkb3duL3N0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuLyoqXG4gKiBJbnRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgc3BhY2UgfSBmcm9tICcuLi91dGlscy9zcGFjZSc7XG5pbXBvcnQgdHlwZSB7IERyb3Bkb3duQ29udGVudFdyYXBwZXJQcm9wcyB9IGZyb20gJy4vdHlwZXMnO1xuXG5jb25zdCBwYWRkaW5nID0gKCB7IHBhZGRpbmdTaXplID0gJ3NtYWxsJyB9OiBEcm9wZG93bkNvbnRlbnRXcmFwcGVyUHJvcHMgKSA9PiB7XG5cdGlmICggcGFkZGluZ1NpemUgPT09ICdub25lJyApIHJldHVybjtcblxuXHRjb25zdCBwYWRkaW5nVmFsdWVzID0ge1xuXHRcdHNtYWxsOiBzcGFjZSggMiApLFxuXHRcdG1lZGl1bTogc3BhY2UoIDQgKSxcblx0fTtcblxuXHRyZXR1cm4gY3NzYFxuXHRcdHBhZGRpbmc6ICR7IHBhZGRpbmdWYWx1ZXNbIHBhZGRpbmdTaXplIF0gfHwgcGFkZGluZ1ZhbHVlcy5zbWFsbCB9O1xuXHRgO1xufTtcblxuZXhwb3J0IGNvbnN0IERyb3Bkb3duQ29udGVudFdyYXBwZXJEaXYgPSBzdHlsZWQuZGl2PCBEcm9wZG93bkNvbnRlbnRXcmFwcGVyUHJvcHMgPmBcblx0Ly8gTmVnYXRpdmUgbWFyZ2luIHRvIHJlc2V0IChvZmZzZXQpIHRoZSBkZWZhdWx0IHBhZGRpbmcgb24gLmNvbXBvbmVudHMtcG9wb3Zlcl9fY29udGVudFxuXHRtYXJnaW4tbGVmdDogJHsgc3BhY2UoIC0yICkgfTtcblx0bWFyZ2luLXJpZ2h0OiAkeyBzcGFjZSggLTIgKSB9O1xuXHQmOmZpcnN0LW9mLXR5cGUge1xuXHRcdG1hcmdpbi10b3A6ICR7IHNwYWNlKCAtMiApIH07XG5cdH1cblx0JjpsYXN0LW9mLXR5cGUge1xuXHRcdG1hcmdpbi1ib3R0b206ICR7IHNwYWNlKCAtMiApIH07XG5cdH1cblxuXHQkeyBwYWRkaW5nIH07XG5gO1xuIl19 */");
};
const DropdownContentWrapperDiv = (0, _base.default)("div", process.env.NODE_ENV === "production" ? {
target: "eovvns30"
} : {
target: "eovvns30",
label: "DropdownContentWrapperDiv"
})("margin-left:", (0, _space.space)(-2), ";margin-right:", (0, _space.space)(-2), ";&:first-of-type{margin-top:", (0, _space.space)(-2), ";}&:last-of-type{margin-bottom:", (0, _space.space)(-2), ";}", padding, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset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vd25Db250ZW50V3JhcHBlclByb3BzID5gXG5cdC8vIE5lZ2F0aXZlIG1hcmdpbiB0byByZXNldCAob2Zmc2V0KSB0aGUgZGVmYXVsdCBwYWRkaW5nIG9uIC5jb21wb25lbnRzLXBvcG92ZXJfX2NvbnRlbnRcblx0bWFyZ2luLWxlZnQ6ICR7IHNwYWNlKCAtMiApIH07XG5cdG1hcmdpbi1yaWdodDogJHsgc3BhY2UoIC0yICkgfTtcblx0JjpmaXJzdC1vZi10eXBlIHtcblx0XHRtYXJnaW4tdG9wOiAkeyBzcGFjZSggLTIgKSB9O1xuXHR9XG5cdCY6bGFzdC1vZi10eXBlIHtcblx0XHRtYXJnaW4tYm90dG9tOiAkeyBzcGFjZSggLTIgKSB9O1xuXHR9XG5cblx0JHsgcGFkZGluZyB9O1xuYDtcbiJdfQ== */"));
exports.DropdownContentWrapperDiv = DropdownContentWrapperDiv;
//# sourceMappingURL=styles.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_react","require","_space","padding","paddingSize","paddingValues","small","space","medium","css","process","env","NODE_ENV","DropdownContentWrapperDiv","_base","default","target","label","exports"],"sources":["@wordpress/components/src/dropdown/styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\nimport styled from '@emotion/styled';\n\n/**\n * Internal dependencies\n */\nimport { space } from '../utils/space';\nimport type { DropdownContentWrapperProps } from './types';\n\nconst padding = ( { paddingSize = 'small' }: DropdownContentWrapperProps ) => {\n\tif ( paddingSize === 'none' ) return;\n\n\tconst paddingValues = {\n\t\tsmall: space( 2 ),\n\t\tmedium: space( 4 ),\n\t};\n\n\treturn css`\n\t\tpadding: ${ paddingValues[ paddingSize ] || paddingValues.small };\n\t`;\n};\n\nexport const DropdownContentWrapperDiv = styled.div< DropdownContentWrapperProps >`\n\t// Negative margin to reset (offset) the default padding on .components-popover__content\n\tmargin-left: ${ space( -2 ) };\n\tmargin-right: ${ space( -2 ) };\n\t&:first-of-type {\n\t\tmargin-top: ${ space( -2 ) };\n\t}\n\t&:last-of-type {\n\t\tmargin-bottom: ${ space( -2 ) };\n\t}\n\n\t${ padding };\n`;\n"],"mappings":";;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,MAAA,GAAAD,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAIA,MAAME,OAAO,GAAGA,CAAE;EAAEC,WAAW,GAAG;AAAqC,CAAC,KAAM;EAC7E,IAAKA,WAAW,KAAK,MAAM,EAAG;EAE9B,MAAMC,aAAa,GAAG;IACrBC,KAAK,EAAE,IAAAC,YAAK,EAAE,CAAE,CAAC;IACjBC,MAAM,EAAE,IAAAD,YAAK,EAAE,CAAE;EAClB,CAAC;EAED,wBAAOE,UAAG,cACGJ,aAAa,CAAED,WAAW,CAAE,IAAIC,aAAa,CAACC,KAAK,SAAAI,OAAA,CAAAC,GAAA,CAAAC,QAAA,6CAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA;AAEjE,CAAC;AAEM,MAAMC,yBAAyB,OAAAC,KAAA,CAAAC,OAAA,SAAAL,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAI,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,mBAErB,IAAAV,YAAK,EAAE,CAAC,CAAE,CAAC,oBACV,IAAAA,YAAK,EAAE,CAAC,CAAE,CAAC,kCAEZ,IAAAA,YAAK,EAAE,CAAC,CAAE,CAAC,qCAGR,IAAAA,YAAK,EAAE,CAAC,CAAE,CAAC,QAG3BJ,OAAO,SAAAO,OAAA,CAAAC,GAAA,CAAAC,QAAA,4kDACV;AAACM,OAAA,CAAAL,yBAAA,GAAAA,yBAAA"}

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/dropdown/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ComponentPropsWithoutRef, CSSProperties, ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type Popover from '../popover';\nimport type { PopoverProps } from '../popover/types';\n\ntype CallbackProps = {\n\tisOpen: boolean;\n\tonToggle: () => void;\n\tonClose: () => void;\n};\n\nexport type DropdownContentWrapperProps = {\n\t/**\n\t * Amount of padding to apply on the dropdown content.\n\t *\n\t * @default 'small'\n\t */\n\tpaddingSize?: 'none' | 'small' | 'medium';\n};\n\nexport type DropdownProps = {\n\t/**\n\t * The className of the global container.\n\t */\n\tclassName?: string;\n\t/**\n\t * If you want to target the dropdown menu for styling purposes,\n\t * you need to provide a contentClassName because it's not being rendered\n\t * as a child of the container node.\n\t */\n\tcontentClassName?: string;\n\t/**\n\t * Opt-in prop to show popovers fullscreen on mobile.\n\t *\n\t * @default false\n\t */\n\texpandOnMobile?: boolean;\n\t/**\n\t * By default, the first tabbable element in the popover will receive focus\n\t * when it mounts. This is the same as setting this prop to \"firstElement\".\n\t * Specifying a true value will focus the container instead.\n\t * Specifying a false value disables the focus handling entirely\n\t * (this should only be done when an appropriately accessible\n\t * substitute behavior exists).\n\t *\n\t * @default 'firstElement'\n\t */\n\tfocusOnMount?: 'firstElement' | boolean;\n\t/**\n\t * Set this to customize the text that is shown in the dropdown's header\n\t * when it is fullscreen on mobile.\n\t */\n\theaderTitle?: string;\n\t/**\n\t * A callback invoked when the popover should be closed.\n\t */\n\tonClose?: () => void;\n\t/**\n\t * A callback invoked when the state of the dropdown changes\n\t * from open to closed and vice versa.\n\t */\n\tonToggle?: ( willOpen: boolean ) => void;\n\t/**\n\t * Properties of popoverProps object will be passed as props\n\t * to the Popover component.\n\t * Use this object to access properties/features\n\t * of the Popover component that are not already exposed\n\t * in the Dropdown component,\n\t * e.g.: the ability to have the popover without an arrow.\n\t */\n\tpopoverProps?: Omit<\n\t\tComponentPropsWithoutRef< typeof Popover >,\n\t\t'children'\n\t>;\n\t/**\n\t * A callback invoked to render the content of the dropdown menu.\n\t * Its first argument is the same as the renderToggle prop.\n\t */\n\trenderContent: ( props: CallbackProps ) => ReactNode;\n\t/**\n\t * A callback invoked to render the Dropdown Toggle Button.\n\t *\n\t * The first argument of the callback is an object\n\t * containing the following properties:\n\t *\n\t * - isOpen: whether the dropdown menu is opened or not\n\t * - onToggle: A function switching the dropdown menu's state\n\t * from open to closed and vice versa\n\t * - onClose: A function that closes the menu if invoked\n\t */\n\trenderToggle: ( props: CallbackProps ) => ReactNode;\n\t/**\n\t * The style of the global container.\n\t */\n\tstyle?: CSSProperties;\n\t/**\n\t * Legacy way to specify the popover's position with respect to its anchor.\n\t * For details about the possible values, see the `Popover` component's docs.\n\t * _Note: this prop is deprecated. Use the `popoverProps.placement` prop\n\t * instead._\n\t *\n\t * @deprecated\n\t */\n\tposition?: PopoverProps[ 'position' ];\n\t/**\n\t * The controlled open state of the dropdown.\n\t * Must be used in conjunction with `onToggle`.\n\t */\n\topen?: boolean;\n\t/**\n\t * The open state of the dropdown when initially rendered.\n\t * Use when you do not need to control its open state. It will be overridden\n\t * by the `open` prop if it is specified on the component's first render.\n\t */\n\tdefaultOpen?: boolean;\n};\n\nexport type DropdownInternalContext = {\n\t/**\n\t * This variant can be used to change the appearance of the component in\n\t * specific contexts, ie. when rendered inside the `Toolbar` component.\n\t */\n\tvariant?: 'toolbar';\n};\n"],"mappings":""}