UNPKG

@wordpress/block-editor

Version:
61 lines (60 loc) 1.84 kB
// packages/block-editor/src/components/publish-date-time-picker/index.js import { DateTimePicker, TimePicker } from "@wordpress/components"; import { __ } from "@wordpress/i18n"; import { forwardRef } from "@wordpress/element"; import { getSettings } from "@wordpress/date"; import InspectorPopoverHeader from "../inspector-popover-header"; import { jsx, jsxs } from "react/jsx-runtime"; function PublishDateTimePicker({ onClose, onChange, showPopoverHeaderActions, isCompact, currentDate, title, ...additionalProps }, ref) { const datePickerProps = { startOfWeek: getSettings().l10n.startOfWeek, onChange, currentDate: isCompact ? void 0 : currentDate, currentTime: isCompact ? currentDate : void 0, ...additionalProps }; const DatePickerComponent = isCompact ? TimePicker : DateTimePicker; return /* @__PURE__ */ jsxs("div", { ref, className: "block-editor-publish-date-time-picker", children: [ /* @__PURE__ */ jsx( InspectorPopoverHeader, { title: title || __("Publish"), actions: showPopoverHeaderActions ? [ { label: __("Now"), onClick: () => onChange?.(null) } ] : void 0, onClose } ), /* @__PURE__ */ jsx(DatePickerComponent, { ...datePickerProps }) ] }); } var PrivatePublishDateTimePicker = forwardRef(PublishDateTimePicker); function PublicPublishDateTimePicker(props, ref) { return /* @__PURE__ */ jsx( PrivatePublishDateTimePicker, { ...props, showPopoverHeaderActions: true, isCompact: false, ref } ); } var publish_date_time_picker_default = forwardRef(PublicPublishDateTimePicker); export { PrivatePublishDateTimePicker, PublishDateTimePicker, publish_date_time_picker_default as default }; //# sourceMappingURL=index.js.map