From d410b6739a9fa0b0de739e7c73ef455040302746 Mon Sep 17 00:00:00 2001 From: ingeniumed Date: Mon, 17 Jun 2024 12:24:26 +1000 Subject: [PATCH] Run the production build for the js/css files --- blocks/dist/custom-status.build.js | 270 +- blocks/dist/custom-status.editor.build.css | 24 +- blocks/dist/custom-status.style.build.css | 24 +- .../calendar/lib/dist/calendar.react.build.js | 7926 +---------------- .../lib/dist/calendar.react.editor.build.css | 158 +- .../lib/dist/calendar.react.style.build.css | 158 +- 6 files changed, 15 insertions(+), 8545 deletions(-) diff --git a/blocks/dist/custom-status.build.js b/blocks/dist/custom-status.build.js index 48759948..1a26bb46 100644 --- a/blocks/dist/custom-status.build.js +++ b/blocks/dist/custom-status.build.js @@ -1,270 +1,2 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./blocks/src/custom-status/editor.scss": -/*!**********************************************!*\ - !*** ./blocks/src/custom-status/editor.scss ***! - \**********************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -__webpack_require__.r(__webpack_exports__); -// extracted by mini-css-extract-plugin - - -/***/ }), - -/***/ "./blocks/src/custom-status/style.scss": -/*!*********************************************!*\ - !*** ./blocks/src/custom-status/style.scss ***! - \*********************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -__webpack_require__.r(__webpack_exports__); -// extracted by mini-css-extract-plugin - - -/***/ }), - -/***/ "react": -/*!************************!*\ - !*** external "React" ***! - \************************/ -/***/ ((module) => { - -module.exports = React; - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. -(() => { -/*!*******************************************!*\ - !*** ./blocks/src/custom-status/block.js ***! - \*******************************************/ -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./editor.scss */ "./blocks/src/custom-status/editor.scss"); -/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style.scss */ "./blocks/src/custom-status/style.scss"); - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - - -var __ = wp.i18n.__; -var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo; -var registerPlugin = wp.plugins.registerPlugin; -var _wp$data = wp.data, - subscribe = _wp$data.subscribe, - dispatch = _wp$data.dispatch, - select = _wp$data.select, - withSelect = _wp$data.withSelect, - withDispatch = _wp$data.withDispatch; -var compose = wp.compose.compose; -var SelectControl = wp.components.SelectControl; - -/** - * Map Custom Statuses as options for SelectControl - */ -var statuses = window.EditFlowCustomStatuses.map(function (s) { - return { - label: s.name, - value: s.slug - }; -}); - -/** - * Subscribe to changes so we can set a default status and update a button's text. - */ -var buttonTextObserver = null; -subscribe(function () { - var postId = select('core/editor').getCurrentPostId(); - if (!postId) { - // Post isn't ready yet so don't do anything. - return; - } - - // For new posts, we need to force the default custom status. - var isCleanNewPost = select('core/editor').isCleanNewPost(); - if (isCleanNewPost) { - dispatch('core/editor').editPost({ - status: ef_default_custom_status - }); - } - - // If the save button exists, let's update the text if needed. - maybeUpdateButtonText(document.querySelector('.editor-post-save-draft')); - - // The post is being saved, so we need to set up an observer to update the button text when it's back. - if (buttonTextObserver === null && window.MutationObserver && select('core/editor').isSavingPost()) { - buttonTextObserver = createButtonObserver(document.querySelector('.edit-post-header__settings')); - } -}); - -/** - * Create a mutation observer that will update the - * save button text right away when it's changed/re-added. - * - * Ideally there will be better ways to go about this in the future. - * @see https://github.com/Automattic/Edit-Flow/issues/583 - */ -function createButtonObserver(parentNode) { - if (!parentNode) { - return null; - } - var observer = new MutationObserver(function (mutationsList) { - var _iterator = _createForOfIteratorHelper(mutationsList), - _step; - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var mutation = _step.value; - var _iterator2 = _createForOfIteratorHelper(mutation.addedNodes), - _step2; - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var node = _step2.value; - maybeUpdateButtonText(node); - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - }); - observer.observe(parentNode, { - childList: true - }); - return observer; -} -function maybeUpdateButtonText(saveButton) { - /* - * saveButton.children < 1 accounts for when a user hovers over the save button - * and a tooltip is rendered - */ - if (saveButton && saveButton.children < 1 && (saveButton.innerText === __('Save Draft') || saveButton.innerText === __('Save as Pending'))) { - saveButton.innerText = __('Save'); - } -} - -/** - * Custom status component - * @param object props - */ -var EditFlowCustomPostStati = function EditFlowCustomPostStati(_ref) { - var onUpdate = _ref.onUpdate, - status = _ref.status; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PluginPostStatusInfo, { - className: "edit-flow-extended-post-status edit-flow-extended-post-status-".concat(status) - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("h4", null, status !== 'publish' ? __('Extended Post Status', 'edit-flow') : __('Extended Post Status Disabled.', 'edit-flow')), status !== 'publish' ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(SelectControl, { - label: "", - value: status, - options: statuses, - onChange: onUpdate - }) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("small", { - className: "edit-flow-extended-post-status-note" - }, status !== 'publish' ? __('Note: this will override all status settings above.', 'edit-flow') : __('To select a custom status, please unpublish the content first.', 'edit-flow'))); -}; -var mapSelectToProps = function mapSelectToProps(select) { - return { - status: select('core/editor').getEditedPostAttribute('status') - }; -}; -var mapDispatchToProps = function mapDispatchToProps(dispatch) { - return { - onUpdate: function onUpdate(status) { - dispatch('core/editor').editPost({ - status: status - }); - } - }; -}; -var plugin = compose(withSelect(mapSelectToProps), withDispatch(mapDispatchToProps))(EditFlowCustomPostStati); - -/** - * Kick it off - */ -registerPlugin('edit-flow-custom-status', { - icon: 'edit-flow', - render: plugin -}); -})(); - -/******/ })() -; +(()=>{"use strict";var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const e=React;var n=t.n(e);function r(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,a=function(){};return{s:a,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,i=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){u=!0,s=t},f:function(){try{i||null==n.return||n.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n * { - flex-basis: 45%; -} -.edit-flow-extended-post-status .edit-flow-extended-post-status-note { - flex-basis: 100%; -} - -.edit-flow-extended-post-status-switch-to-draft { - flex-basis: 100%; -} - -.edit-flow-extended-post-status-publish > * { - flex-basis: 100%; -} -/*!******************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./blocks/src/custom-status/style.scss ***! - \******************************************************************************************************************************/ +.edit-flow-extended-post-status{flex-flow:row wrap}.edit-flow-extended-post-status>*{flex-basis:45%}.edit-flow-extended-post-status .edit-flow-extended-post-status-note{flex-basis:100%}.edit-flow-extended-post-status-switch-to-draft{flex-basis:100%}.edit-flow-extended-post-status-publish>*{flex-basis:100%} /*# sourceMappingURL=custom-status.editor.build.css.map*/ \ No newline at end of file diff --git a/blocks/dist/custom-status.style.build.css b/blocks/dist/custom-status.style.build.css index 16cadaf0..2386bc5b 100644 --- a/blocks/dist/custom-status.style.build.css +++ b/blocks/dist/custom-status.style.build.css @@ -1,26 +1,4 @@ -/*!*******************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./blocks/src/custom-status/editor.scss ***! - \*******************************************************************************************************************************/ -.edit-flow-extended-post-status { - flex-flow: row wrap; -} -.edit-flow-extended-post-status > * { - flex-basis: 45%; -} -.edit-flow-extended-post-status .edit-flow-extended-post-status-note { - flex-basis: 100%; -} - -.edit-flow-extended-post-status-switch-to-draft { - flex-basis: 100%; -} - -.edit-flow-extended-post-status-publish > * { - flex-basis: 100%; -} -/*!******************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./blocks/src/custom-status/style.scss ***! - \******************************************************************************************************************************/ +.edit-flow-extended-post-status{flex-flow:row wrap}.edit-flow-extended-post-status>*{flex-basis:45%}.edit-flow-extended-post-status .edit-flow-extended-post-status-note{flex-basis:100%}.edit-flow-extended-post-status-switch-to-draft{flex-basis:100%}.edit-flow-extended-post-status-publish>*{flex-basis:100%} /*# sourceMappingURL=custom-status.style.build.css.map*/ \ No newline at end of file diff --git a/modules/calendar/lib/dist/calendar.react.build.js b/modules/calendar/lib/dist/calendar.react.build.js index bb019490..df5f929e 100644 --- a/modules/calendar/lib/dist/calendar.react.build.js +++ b/modules/calendar/lib/dist/calendar.react.build.js @@ -1,7925 +1,3 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ "./modules/calendar/lib/react/calendar-date-change-buttons/index.js": -/*!**************************************************************************!*\ - !*** ./modules/calendar/lib/react/calendar-date-change-buttons/index.js ***! - \**************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ CalendarDateChangeButtons: () => (/* binding */ CalendarDateChangeButtons) -/* harmony export */ }); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url"); -/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! moment */ "moment"); -/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _style_react_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./style.react.scss */ "./modules/calendar/lib/react/calendar-date-change-buttons/style.react.scss"); -function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } -function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } -function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } -/* global EF_CALENDAR */ - -/** - * External dependencies - */ - - - - - - - -// Get rid of this eventually -var BUTTON_TYPE_PROPS = parseFloat(EF_CALENDAR.WP_VERSION) >= 5.4 ? { - isSecondary: true -} : { - isDefault: true -}; - -/** - * Internal dependencies - */ - - -/** - * Used to shift the calendar forwards or backwards by some number of weeks - * @param {string} addOrSubtract The valid values for this are 'add'|'subtract' - * @param {string} beginningOfWeek A date string formatted like 'YYYY-MM-DD' - * @param {string} pageUrl The url of the page the query parameters are going to be appended to - * @param {object} filterValues An object of string key and string value pairs representing filter names and values - * @param {number} weeksNumber The number of weeks to shift by - * @returns {string} the url with query params - */ -var moveByWeeks = function moveByWeeks(addOrSubtract, beginningOfWeek, pageUrl, filterValues, weeksNumber) { - var queryArgFilters = _objectSpread({}, filterValues); - if (weeksNumber === 0) { - queryArgFilters.start_date = beginningOfWeek; - } - queryArgFilters.start_date = moment__WEBPACK_IMPORTED_MODULE_3___default()(queryArgFilters.start_date, 'YYYY-MM-DD')[addOrSubtract](weeksNumber, 'weeks').format('YYYY-MM-DD'); - return (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_2__.addQueryArgs)(pageUrl, queryArgFilters); -}; - -/** - * A curried function leveraging `moveByWeek` that returns a URL with query parameters applied - * that will shift the calendar forward by `weeksNumber` - * @param {number} weeksNumber A number representing the weeks to move forward - * @param {string} beginningOfWeek A date string formatted like 'YYYY-MM-DD' - * @param {string} pageUrl The url of the page the query parameters are going to be appended to - * @param {object} filterValues An object of string key and string value pairs representing filter names and values - * @returns {string} the url with query params - */ -var moveFowardByWeeks = function moveFowardByWeeks(weeksNumber, beginningOfWeek, pageUrl, filterValues) { - return moveByWeeks('add', beginningOfWeek, pageUrl, filterValues, weeksNumber); -}; - -/** - * A curried function leveraging `moveByWeek` that returns a URL with query parameters applied - * that will shift the calendar backwards by `weeksNumber` - * @param {number} weeksNumber A number representing the weeks to move forward - * @param {string} beginningOfWeek A date string formatted like 'YYYY-MM-DD' - * @param {string} pageUrl The url of the page the query parameters are going to be appended to - * @param {object} filterValues An object of string key and string value pairs representing filter names and values - * @returns {string} the url with query params - */ -var moveBackByWeeks = function moveBackByWeeks(weeksNumber, beginningOfWeek, pageUrl, filterValues) { - return moveByWeeks('subtract', beginningOfWeek, pageUrl, filterValues, weeksNumber); -}; -var CalendarDateChangeButtons = function CalendarDateChangeButtons(_ref) { - var numberOfWeeks = _ref.numberOfWeeks, - beginningOfWeek = _ref.beginningOfWeek, - pageUrl = _ref.pageUrl, - filterValues = _ref.filterValues; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement("div", { - className: "ef-calendar-date-change-buttons" - }, numberOfWeeks > 1 ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__.Button, _extends({}, BUTTON_TYPE_PROPS, { - className: "ef-calendar-date-change-button", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.sprintf)((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Backwards %d weeks', 'edit-flow'), numberOfWeeks), - href: moveBackByWeeks(numberOfWeeks, beginningOfWeek, pageUrl, filterValues) - }), (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('«', 'edit-flow')) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__.Button, _extends({}, BUTTON_TYPE_PROPS, { - className: "ef-calendar-date-change-button", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Backwards 1 week', 'edit-flow'), - href: moveBackByWeeks(1, beginningOfWeek, pageUrl, filterValues) - }), (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('‹', 'edit-flow')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__.Button, _extends({}, BUTTON_TYPE_PROPS, { - className: "ef-calendar-date-change-button", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Today', 'edit-flow'), - href: moveFowardByWeeks(0, beginningOfWeek, pageUrl, filterValues) - }), (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Today', 'edit-flow')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__.Button, _extends({}, BUTTON_TYPE_PROPS, { - className: "ef-calendar-date-change-button", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Forward 1 week', 'edit-flow'), - href: moveFowardByWeeks(1, beginningOfWeek, pageUrl, filterValues) - }), (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('›', 'edit-flow')), numberOfWeeks > 1 ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__.Button, _extends({}, BUTTON_TYPE_PROPS, { - className: "ef-calendar-date-change-button", - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.sprintf)((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Forward %d weeks', 'edit-flow'), numberOfWeeks), - href: moveFowardByWeeks(numberOfWeeks, beginningOfWeek, pageUrl, filterValues) - }), (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('»', 'edit-flow')) : null); -}; -CalendarDateChangeButtons.propTypes = { - numberOfWeeks: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().number), - beginningOfWeek: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().string), - // Formatted like 'YYYY-MM-DD' - pageUrl: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().string), - filterValues: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().object) // Object should just be k:v pairs -}; - - -/***/ }), - -/***/ "./modules/calendar/lib/react/calendar-filters/index.js": -/*!**************************************************************!*\ - !*** ./modules/calendar/lib/react/calendar-filters/index.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ CalendarFilters: () => (/* binding */ CalendarFilters) -/* harmony export */ }); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url"); -/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _combobox__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../combobox */ "./modules/calendar/lib/react/combobox/index.js"); -/* harmony import */ var _style_react_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./style.react.scss */ "./modules/calendar/lib/react/calendar-filters/style.react.scss"); -function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } -function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } -function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } -/* global EF_CALENDAR */ - -/** - * External Dependencies - */ - - - - - - - -// Get rid of this eventually -var BUTTON_TYPE_PROPS = parseFloat(EF_CALENDAR.WP_VERSION) >= 5.4 ? { - isSecondary: true -} : { - isDefault: true -}; - -/** - * Internal Dependencies - */ - - -function init(_ref) { - var filters = _ref.filters; - return _objectSpread({}, filters.reduce(function (acc, next) { - var filter = _defineProperty({}, next.name, next.initialValue || ''); - if (next.filterType === 'combobox') { - filter["".concat(next.name, "InputValue")] = next.initialValue ? next.initialValue.name : ''; - } - return _objectSpread(_objectSpread({}, acc), filter); - }, [])); -} -var CalendarFilters = /*#__PURE__*/function (_React$Component) { - function CalendarFilters(props) { - var _this; - _classCallCheck(this, CalendarFilters); - _this = _callSuper(this, CalendarFilters, [props]); - _this.state = init(props); - _this.formRef = react__WEBPACK_IMPORTED_MODULE_4___default().createRef(); - return _this; - } - _inherits(CalendarFilters, _React$Component); - return _createClass(CalendarFilters, [{ - key: "updateFilter", - value: function updateFilter(_ref2) { - var name = _ref2.name, - value = _ref2.value; - this.setState(_objectSpread(_objectSpread({}, this.state), {}, _defineProperty({}, name, value))); - } - }, { - key: "render", - value: function render() { - var _this2 = this; - var _this$props = this.props, - filters = _this$props.filters, - pageUrl = _this$props.pageUrl, - isLoading = _this$props.isLoading; - var state = this.state; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement("div", { - className: "ef-calendar-navigation" - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement("div", { - className: "ef-calendar-filters" - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement("form", { - ref: this.formRef, - action: "", - method: "GET", - className: "ef-calendar-filters-form" - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement("input", { - type: "hidden", - name: "page", - value: "calendar" - }), filters.map(function (filter) { - switch (filter.filterType) { - case 'select': - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement("div", { - className: "ef-calendar-filter ef-calendar-filter-".concat(filter.name), - key: "ef-calendar-filter-".concat(filter.name) - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__.SelectControl, { - className: 'label-screen-reader-text' // Replaced by `hideLabelFromVision` prop in later versions - , - key: filter.name, - name: filter.name, - label: filter.label, - value: state[filter.name], - options: filter.options, - onChange: function onChange(newValue) { - return _this2.updateFilter({ - name: filter.name, - value: newValue - }); - } - })); - case 'combobox': - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement("div", { - className: "ef-calendar-filter ef-calendar-filter-".concat(filter.name), - key: "ef-calendar-filter-".concat(filter.name) - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement(_combobox__WEBPACK_IMPORTED_MODULE_5__.ComboBox, { - key: filter.name, - className: "ef-calendar-filter-combobox label-screen-reader-text", - inputLabel: filter.inputLabel, - buttonOpenLabel: filter.buttonOpenLabel, - buttonCloseLabel: filter.buttonCloseLabel, - buttonClearLabel: filter.buttonClearLabel, - placeholder: filter.placeholder, - items: filter.options, - selectedItem: state[filter.name], - inputValue: state["".concat(filter.name, "InputValue")], - itemToString: function itemToString(item) { - return item ? item.name : ''; - }, - onInputBlur: function onInputBlur(items, inputValue) { - /** - * If this is set, if a user has typed out a name - * and it matches an item in the list, select it for them - */ - if (!filter.selectFirstItemOnBlur || items.length < 1 || !inputValue || inputValue.toLowerCase() !== items[0].name.toLowerCase()) { - return; - } - _this2.updateFilter({ - name: filter.name, - value: items[0] - }); - }, - onStateChange: function onStateChange(changes) { - if (changes.hasOwnProperty('selectedItem')) { - _this2.updateFilter({ - name: filter.name, - value: changes.selectedItem - }); - } else if (changes.hasOwnProperty('inputValue')) { - _this2.updateFilter({ - name: "".concat(filter.name, "InputValue"), - value: changes.inputValue - }); - } - } - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement("input", { - key: "".concat(filter.name, "-input"), - type: "hidden", - name: filter.name, - value: state[filter.name] ? state[filter.name].value : '' - })); - } - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement("div", { - className: "ef-calendar-filters-buttons" - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__.Button, { - type: "submit", - isPrimary: true - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Apply', 'edit-flow')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__.Button, _extends({ - type: "button'", - href: (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_2__.addQueryArgs)(pageUrl, filters.reduce(function (acc, filter) { - return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, filter.name, '')); - }, {})), - name: "ef-calendar-reset-filters" - }, BUTTON_TYPE_PROPS), (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Reset', 'edit-flow')), isLoading ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__.Spinner, null) : null)))); - } - }]); -}((react__WEBPACK_IMPORTED_MODULE_4___default().Component)); -CalendarFilters.propTypes = { - filters: prop_types__WEBPACK_IMPORTED_MODULE_7___default().arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_7___default().shape({ - name: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().string), - filterType: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().string), - label: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().string), - options: prop_types__WEBPACK_IMPORTED_MODULE_7___default().arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_7___default().shape({ - name: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().string), - value: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().any) - })), - initialValue: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().any) - })), - pageUrl: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().string), - isLoading: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().bool) -}; - - -/***/ }), - -/***/ "./modules/calendar/lib/react/calendar-header/index.js": -/*!*************************************************************!*\ - !*** ./modules/calendar/lib/react/calendar-header/index.js ***! - \*************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ CalendarHeader: () => (/* binding */ CalendarHeaderWithData) -/* harmony export */ }); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _calendar_date_change_buttons__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../calendar-date-change-buttons */ "./modules/calendar/lib/react/calendar-date-change-buttons/index.js"); -/* harmony import */ var _calendar_filters__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../calendar-filters */ "./modules/calendar/lib/react/calendar-filters/index.js"); -/* harmony import */ var _style_react_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./style.react.scss */ "./modules/calendar/lib/react/calendar-header/style.react.scss"); -function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } -function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } -function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } -function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } -/* global EF_CALENDAR */ - -/** - * External dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - -var DEFAULT_STORE_STATE = { - calendarSnackbarMessage: null, - calendarIsLoading: false -}; -(0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.registerStore)('edit-flow/calendar', { - reducer: function reducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_STORE_STATE; - var action = arguments.length > 1 ? arguments[1] : undefined; - switch (action.type) { - case 'SET_POST_SAVED': - return _objectSpread(_objectSpread({}, state), {}, { - calendarSnackbarMessage: action.message, - calendarIsLoading: false - }); - case 'CLEAR_CALENDAR_SNACKBAR_MESSAGE': - return _objectSpread(_objectSpread({}, state), {}, { - calendarSnackbarMessage: null - }); - case 'SET_CALENDAR_IS_LOADING': - return _objectSpread(_objectSpread({}, state), {}, { - calendarIsLoading: action.isLoading - }); - } - return state; - }, - actions: { - setPostSaved: function setPostSaved(message) { - return { - type: 'SET_POST_SAVED', - message: message - }; - }, - clearCalendarSnackbarMessage: function clearCalendarSnackbarMessage() { - return { - type: 'CLEAR_CALENDAR_SNACKBAR_MESSAGE' - }; - }, - setCalendarIsLoading: function setCalendarIsLoading(isLoading) { - return { - type: 'SET_CALENDAR_IS_LOADING', - isLoading: isLoading - }; - } - }, - selectors: { - getCalendarSnackbarMessage: function getCalendarSnackbarMessage(state) { - return state.calendarSnackbarMessage; - }, - getCalendarIsLoading: function getCalendarIsLoading(state) { - return state.calendarIsLoading; - } - } -}); -var CalendarHeader = function CalendarHeader(_ref) { - var snackbarMessage = _ref.snackbarMessage, - isLoading = _ref.isLoading, - filters = _ref.filters, - filterValues = _ref.filterValues, - numberOfWeeks = _ref.numberOfWeeks, - beginningOfWeek = _ref.beginningOfWeek, - pageUrl = _ref.pageUrl; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", { - className: "ef-calendar-header" - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_calendar_filters__WEBPACK_IMPORTED_MODULE_5__.CalendarFilters, { - isLoading: isLoading, - pageUrl: pageUrl, - filters: filters - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_calendar_date_change_buttons__WEBPACK_IMPORTED_MODULE_4__.CalendarDateChangeButtons, { - beginningOfWeek: beginningOfWeek, - pageUrl: pageUrl, - numberOfWeeks: numberOfWeeks, - filterValues: filterValues - }), snackbarMessage ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__.Animate, { - options: { - origin: 'bottom left' - }, - type: "appear" - }, function (_ref2) { - var className = _ref2.className; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__.Snackbar, { - className: classnames__WEBPACK_IMPORTED_MODULE_2___default()(className, 'ef-calendar-snackbar') - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", null, snackbarMessage)); - }) : null); -}; -CalendarHeader.propTypes = { - filters: prop_types__WEBPACK_IMPORTED_MODULE_7___default().arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_7___default().shape({ - name: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().string), - filterType: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().string), - label: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().string), - options: prop_types__WEBPACK_IMPORTED_MODULE_7___default().arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_7___default().shape({ - label: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().string), - value: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().any) - })), - initialValue: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().any) - })), - filterValues: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().object), - // FilterValues is an object of key value pairs - numberOfWeeks: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().number), - beginningOfWeek: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().string), - // Formatted 'YYYY-MM-DD' - pageUrl: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().string), - snackbarMessage: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().string), - isLoading: (prop_types__WEBPACK_IMPORTED_MODULE_7___default().bool) -}; -var CalendarHeaderWithData = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.withSelect)(function (select) { - var _select = select('edit-flow/calendar'), - getCalendarSnackbarMessage = _select.getCalendarSnackbarMessage, - getCalendarIsLoading = _select.getCalendarIsLoading; - return { - snackbarMessage: getCalendarSnackbarMessage(), - isLoading: getCalendarIsLoading() - }; -})(CalendarHeader); - - -/***/ }), - -/***/ "./modules/calendar/lib/react/combobox/index.js": -/*!******************************************************!*\ - !*** ./modules/calendar/lib/react/combobox/index.js ***! - \******************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ ComboBox: () => (/* binding */ ComboBox) -/* harmony export */ }); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var downshift__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! downshift */ "./node_modules/downshift/dist/downshift.esm.js"); -/* harmony import */ var match_sorter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! match-sorter */ "./node_modules/match-sorter/dist/match-sorter.esm.js"); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _style_react_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./style.react.scss */ "./modules/calendar/lib/react/combobox/style.react.scss"); -var _excluded = ["className", "placeholder", "inputLabel", "buttonOpenLabel", "buttonCloseLabel", "buttonClearLabel", "items", "noMatchText", "onInputBlur"]; -function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } -function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } -function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; } -/* global EF_CALENDAR */ - -/** - * External dependencies - */ - - - - - - - -// Get rid of this eventually -var ACTIVE_ICON_BUTTON = parseFloat(EF_CALENDAR.WP_VERSION) >= 5.3 ? _wordpress_components__WEBPACK_IMPORTED_MODULE_0__.Button : _wordpress_components__WEBPACK_IMPORTED_MODULE_0__.IconButton; - -/** - * Internal dependencies - */ - - -/** - * Filters items based on simple name text match - * - * @param {string} filter a string to filter items by - * @param {Item[]} items a list of items to be filtered - * @return {string[]} array of strings that match - */ -function getItems(filter, items) { - return filter ? (0,match_sorter__WEBPACK_IMPORTED_MODULE_2__.matchSorter)(items, filter, { - keys: ['name'] - }) : items; -} - -/** - * Find an item by Id - * @param {Item[]} items a list of items - * @param {*} id an id to find - * @return {Item} an item with the id - */ -function getItem(items, id) { - return items.find(function (item) { - return item.value === id; - }); -} - -/** - * An item that can be supplied to - * @typedef {Object} Item - * @property {string} name - The name of the item, used for filtering results. - * @property {string|number} id - The unique identifier for the item - * @property {string|number} [parent] - An optional identifier for a parent - * @property {number} [level] - An optional identifier designating nesting level - */ - -// A combobox supporting