nux.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. /******/ (function() { // webpackBootstrap
  2. /******/ "use strict";
  3. /******/ // The require scope
  4. /******/ var __webpack_require__ = {};
  5. /******/
  6. /************************************************************************/
  7. /******/ /* webpack/runtime/compat get default export */
  8. /******/ !function() {
  9. /******/ // getDefaultExport function for compatibility with non-harmony modules
  10. /******/ __webpack_require__.n = function(module) {
  11. /******/ var getter = module && module.__esModule ?
  12. /******/ function() { return module['default']; } :
  13. /******/ function() { return module; };
  14. /******/ __webpack_require__.d(getter, { a: getter });
  15. /******/ return getter;
  16. /******/ };
  17. /******/ }();
  18. /******/
  19. /******/ /* webpack/runtime/define property getters */
  20. /******/ !function() {
  21. /******/ // define getter functions for harmony exports
  22. /******/ __webpack_require__.d = function(exports, definition) {
  23. /******/ for(var key in definition) {
  24. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  25. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  26. /******/ }
  27. /******/ }
  28. /******/ };
  29. /******/ }();
  30. /******/
  31. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  32. /******/ !function() {
  33. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  34. /******/ }();
  35. /******/
  36. /******/ /* webpack/runtime/make namespace object */
  37. /******/ !function() {
  38. /******/ // define __esModule on exports
  39. /******/ __webpack_require__.r = function(exports) {
  40. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  41. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  42. /******/ }
  43. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  44. /******/ };
  45. /******/ }();
  46. /******/
  47. /************************************************************************/
  48. var __webpack_exports__ = {};
  49. // ESM COMPAT FLAG
  50. __webpack_require__.r(__webpack_exports__);
  51. // EXPORTS
  52. __webpack_require__.d(__webpack_exports__, {
  53. "DotTip": function() { return /* reexport */ dot_tip; },
  54. "store": function() { return /* reexport */ store; }
  55. });
  56. // NAMESPACE OBJECT: ./node_modules/@wordpress/nux/build-module/store/actions.js
  57. var actions_namespaceObject = {};
  58. __webpack_require__.r(actions_namespaceObject);
  59. __webpack_require__.d(actions_namespaceObject, {
  60. "disableTips": function() { return disableTips; },
  61. "dismissTip": function() { return dismissTip; },
  62. "enableTips": function() { return enableTips; },
  63. "triggerGuide": function() { return triggerGuide; }
  64. });
  65. // NAMESPACE OBJECT: ./node_modules/@wordpress/nux/build-module/store/selectors.js
  66. var selectors_namespaceObject = {};
  67. __webpack_require__.r(selectors_namespaceObject);
  68. __webpack_require__.d(selectors_namespaceObject, {
  69. "areTipsEnabled": function() { return selectors_areTipsEnabled; },
  70. "getAssociatedGuide": function() { return getAssociatedGuide; },
  71. "isTipVisible": function() { return isTipVisible; }
  72. });
  73. ;// CONCATENATED MODULE: external ["wp","deprecated"]
  74. var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
  75. var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
  76. ;// CONCATENATED MODULE: external ["wp","data"]
  77. var external_wp_data_namespaceObject = window["wp"]["data"];
  78. ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/reducer.js
  79. /**
  80. * WordPress dependencies
  81. */
  82. /**
  83. * Reducer that tracks which tips are in a guide. Each guide is represented by
  84. * an array which contains the tip identifiers contained within that guide.
  85. *
  86. * @param {Array} state Current state.
  87. * @param {Object} action Dispatched action.
  88. *
  89. * @return {Array} Updated state.
  90. */
  91. function guides() {
  92. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  93. let action = arguments.length > 1 ? arguments[1] : undefined;
  94. switch (action.type) {
  95. case 'TRIGGER_GUIDE':
  96. return [...state, action.tipIds];
  97. }
  98. return state;
  99. }
  100. /**
  101. * Reducer that tracks whether or not tips are globally enabled.
  102. *
  103. * @param {boolean} state Current state.
  104. * @param {Object} action Dispatched action.
  105. *
  106. * @return {boolean} Updated state.
  107. */
  108. function areTipsEnabled() {
  109. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  110. let action = arguments.length > 1 ? arguments[1] : undefined;
  111. switch (action.type) {
  112. case 'DISABLE_TIPS':
  113. return false;
  114. case 'ENABLE_TIPS':
  115. return true;
  116. }
  117. return state;
  118. }
  119. /**
  120. * Reducer that tracks which tips have been dismissed. If the state object
  121. * contains a tip identifier, then that tip is dismissed.
  122. *
  123. * @param {Object} state Current state.
  124. * @param {Object} action Dispatched action.
  125. *
  126. * @return {Object} Updated state.
  127. */
  128. function dismissedTips() {
  129. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  130. let action = arguments.length > 1 ? arguments[1] : undefined;
  131. switch (action.type) {
  132. case 'DISMISS_TIP':
  133. return { ...state,
  134. [action.id]: true
  135. };
  136. case 'ENABLE_TIPS':
  137. return {};
  138. }
  139. return state;
  140. }
  141. const preferences = (0,external_wp_data_namespaceObject.combineReducers)({
  142. areTipsEnabled,
  143. dismissedTips
  144. });
  145. /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
  146. guides,
  147. preferences
  148. }));
  149. ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/actions.js
  150. /**
  151. * Returns an action object that, when dispatched, presents a guide that takes
  152. * the user through a series of tips step by step.
  153. *
  154. * @param {string[]} tipIds Which tips to show in the guide.
  155. *
  156. * @return {Object} Action object.
  157. */
  158. function triggerGuide(tipIds) {
  159. return {
  160. type: 'TRIGGER_GUIDE',
  161. tipIds
  162. };
  163. }
  164. /**
  165. * Returns an action object that, when dispatched, dismisses the given tip. A
  166. * dismissed tip will not show again.
  167. *
  168. * @param {string} id The tip to dismiss.
  169. *
  170. * @return {Object} Action object.
  171. */
  172. function dismissTip(id) {
  173. return {
  174. type: 'DISMISS_TIP',
  175. id
  176. };
  177. }
  178. /**
  179. * Returns an action object that, when dispatched, prevents all tips from
  180. * showing again.
  181. *
  182. * @return {Object} Action object.
  183. */
  184. function disableTips() {
  185. return {
  186. type: 'DISABLE_TIPS'
  187. };
  188. }
  189. /**
  190. * Returns an action object that, when dispatched, makes all tips show again.
  191. *
  192. * @return {Object} Action object.
  193. */
  194. function enableTips() {
  195. return {
  196. type: 'ENABLE_TIPS'
  197. };
  198. }
  199. ;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js
  200. var LEAF_KEY, hasWeakMap;
  201. /**
  202. * Arbitrary value used as key for referencing cache object in WeakMap tree.
  203. *
  204. * @type {Object}
  205. */
  206. LEAF_KEY = {};
  207. /**
  208. * Whether environment supports WeakMap.
  209. *
  210. * @type {boolean}
  211. */
  212. hasWeakMap = typeof WeakMap !== 'undefined';
  213. /**
  214. * Returns the first argument as the sole entry in an array.
  215. *
  216. * @param {*} value Value to return.
  217. *
  218. * @return {Array} Value returned as entry in array.
  219. */
  220. function arrayOf( value ) {
  221. return [ value ];
  222. }
  223. /**
  224. * Returns true if the value passed is object-like, or false otherwise. A value
  225. * is object-like if it can support property assignment, e.g. object or array.
  226. *
  227. * @param {*} value Value to test.
  228. *
  229. * @return {boolean} Whether value is object-like.
  230. */
  231. function isObjectLike( value ) {
  232. return !! value && 'object' === typeof value;
  233. }
  234. /**
  235. * Creates and returns a new cache object.
  236. *
  237. * @return {Object} Cache object.
  238. */
  239. function createCache() {
  240. var cache = {
  241. clear: function() {
  242. cache.head = null;
  243. },
  244. };
  245. return cache;
  246. }
  247. /**
  248. * Returns true if entries within the two arrays are strictly equal by
  249. * reference from a starting index.
  250. *
  251. * @param {Array} a First array.
  252. * @param {Array} b Second array.
  253. * @param {number} fromIndex Index from which to start comparison.
  254. *
  255. * @return {boolean} Whether arrays are shallowly equal.
  256. */
  257. function isShallowEqual( a, b, fromIndex ) {
  258. var i;
  259. if ( a.length !== b.length ) {
  260. return false;
  261. }
  262. for ( i = fromIndex; i < a.length; i++ ) {
  263. if ( a[ i ] !== b[ i ] ) {
  264. return false;
  265. }
  266. }
  267. return true;
  268. }
  269. /**
  270. * Returns a memoized selector function. The getDependants function argument is
  271. * called before the memoized selector and is expected to return an immutable
  272. * reference or array of references on which the selector depends for computing
  273. * its own return value. The memoize cache is preserved only as long as those
  274. * dependant references remain the same. If getDependants returns a different
  275. * reference(s), the cache is cleared and the selector value regenerated.
  276. *
  277. * @param {Function} selector Selector function.
  278. * @param {Function} getDependants Dependant getter returning an immutable
  279. * reference or array of reference used in
  280. * cache bust consideration.
  281. *
  282. * @return {Function} Memoized selector.
  283. */
  284. /* harmony default export */ function rememo(selector, getDependants ) {
  285. var rootCache, getCache;
  286. // Use object source as dependant if getter not provided
  287. if ( ! getDependants ) {
  288. getDependants = arrayOf;
  289. }
  290. /**
  291. * Returns the root cache. If WeakMap is supported, this is assigned to the
  292. * root WeakMap cache set, otherwise it is a shared instance of the default
  293. * cache object.
  294. *
  295. * @return {(WeakMap|Object)} Root cache object.
  296. */
  297. function getRootCache() {
  298. return rootCache;
  299. }
  300. /**
  301. * Returns the cache for a given dependants array. When possible, a WeakMap
  302. * will be used to create a unique cache for each set of dependants. This
  303. * is feasible due to the nature of WeakMap in allowing garbage collection
  304. * to occur on entries where the key object is no longer referenced. Since
  305. * WeakMap requires the key to be an object, this is only possible when the
  306. * dependant is object-like. The root cache is created as a hierarchy where
  307. * each top-level key is the first entry in a dependants set, the value a
  308. * WeakMap where each key is the next dependant, and so on. This continues
  309. * so long as the dependants are object-like. If no dependants are object-
  310. * like, then the cache is shared across all invocations.
  311. *
  312. * @see isObjectLike
  313. *
  314. * @param {Array} dependants Selector dependants.
  315. *
  316. * @return {Object} Cache object.
  317. */
  318. function getWeakMapCache( dependants ) {
  319. var caches = rootCache,
  320. isUniqueByDependants = true,
  321. i, dependant, map, cache;
  322. for ( i = 0; i < dependants.length; i++ ) {
  323. dependant = dependants[ i ];
  324. // Can only compose WeakMap from object-like key.
  325. if ( ! isObjectLike( dependant ) ) {
  326. isUniqueByDependants = false;
  327. break;
  328. }
  329. // Does current segment of cache already have a WeakMap?
  330. if ( caches.has( dependant ) ) {
  331. // Traverse into nested WeakMap.
  332. caches = caches.get( dependant );
  333. } else {
  334. // Create, set, and traverse into a new one.
  335. map = new WeakMap();
  336. caches.set( dependant, map );
  337. caches = map;
  338. }
  339. }
  340. // We use an arbitrary (but consistent) object as key for the last item
  341. // in the WeakMap to serve as our running cache.
  342. if ( ! caches.has( LEAF_KEY ) ) {
  343. cache = createCache();
  344. cache.isUniqueByDependants = isUniqueByDependants;
  345. caches.set( LEAF_KEY, cache );
  346. }
  347. return caches.get( LEAF_KEY );
  348. }
  349. // Assign cache handler by availability of WeakMap
  350. getCache = hasWeakMap ? getWeakMapCache : getRootCache;
  351. /**
  352. * Resets root memoization cache.
  353. */
  354. function clear() {
  355. rootCache = hasWeakMap ? new WeakMap() : createCache();
  356. }
  357. // eslint-disable-next-line jsdoc/check-param-names
  358. /**
  359. * The augmented selector call, considering first whether dependants have
  360. * changed before passing it to underlying memoize function.
  361. *
  362. * @param {Object} source Source object for derivation.
  363. * @param {...*} extraArgs Additional arguments to pass to selector.
  364. *
  365. * @return {*} Selector result.
  366. */
  367. function callSelector( /* source, ...extraArgs */ ) {
  368. var len = arguments.length,
  369. cache, node, i, args, dependants;
  370. // Create copy of arguments (avoid leaking deoptimization).
  371. args = new Array( len );
  372. for ( i = 0; i < len; i++ ) {
  373. args[ i ] = arguments[ i ];
  374. }
  375. dependants = getDependants.apply( null, args );
  376. cache = getCache( dependants );
  377. // If not guaranteed uniqueness by dependants (primitive type or lack
  378. // of WeakMap support), shallow compare against last dependants and, if
  379. // references have changed, destroy cache to recalculate result.
  380. if ( ! cache.isUniqueByDependants ) {
  381. if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
  382. cache.clear();
  383. }
  384. cache.lastDependants = dependants;
  385. }
  386. node = cache.head;
  387. while ( node ) {
  388. // Check whether node arguments match arguments
  389. if ( ! isShallowEqual( node.args, args, 1 ) ) {
  390. node = node.next;
  391. continue;
  392. }
  393. // At this point we can assume we've found a match
  394. // Surface matched node to head if not already
  395. if ( node !== cache.head ) {
  396. // Adjust siblings to point to each other.
  397. node.prev.next = node.next;
  398. if ( node.next ) {
  399. node.next.prev = node.prev;
  400. }
  401. node.next = cache.head;
  402. node.prev = null;
  403. cache.head.prev = node;
  404. cache.head = node;
  405. }
  406. // Return immediately
  407. return node.val;
  408. }
  409. // No cached value found. Continue to insertion phase:
  410. node = {
  411. // Generate the result from original function
  412. val: selector.apply( null, args ),
  413. };
  414. // Avoid including the source object in the cache.
  415. args[ 0 ] = null;
  416. node.args = args;
  417. // Don't need to check whether node is already head, since it would
  418. // have been returned above already if it was
  419. // Shift existing head down list
  420. if ( cache.head ) {
  421. cache.head.prev = node;
  422. node.next = cache.head;
  423. }
  424. cache.head = node;
  425. return node.val;
  426. }
  427. callSelector.getDependants = getDependants;
  428. callSelector.clear = clear;
  429. clear();
  430. return callSelector;
  431. }
  432. ;// CONCATENATED MODULE: external "lodash"
  433. var external_lodash_namespaceObject = window["lodash"];
  434. ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/selectors.js
  435. /**
  436. * External dependencies
  437. */
  438. /**
  439. * An object containing information about a guide.
  440. *
  441. * @typedef {Object} NUXGuideInfo
  442. * @property {string[]} tipIds Which tips the guide contains.
  443. * @property {?string} currentTipId The guide's currently showing tip.
  444. * @property {?string} nextTipId The guide's next tip to show.
  445. */
  446. /**
  447. * Returns an object describing the guide, if any, that the given tip is a part
  448. * of.
  449. *
  450. * @param {Object} state Global application state.
  451. * @param {string} tipId The tip to query.
  452. *
  453. * @return {?NUXGuideInfo} Information about the associated guide.
  454. */
  455. const getAssociatedGuide = rememo((state, tipId) => {
  456. for (const tipIds of state.guides) {
  457. if ((0,external_lodash_namespaceObject.includes)(tipIds, tipId)) {
  458. const nonDismissedTips = (0,external_lodash_namespaceObject.difference)(tipIds, (0,external_lodash_namespaceObject.keys)(state.preferences.dismissedTips));
  459. const [currentTipId = null, nextTipId = null] = nonDismissedTips;
  460. return {
  461. tipIds,
  462. currentTipId,
  463. nextTipId
  464. };
  465. }
  466. }
  467. return null;
  468. }, state => [state.guides, state.preferences.dismissedTips]);
  469. /**
  470. * Determines whether or not the given tip is showing. Tips are hidden if they
  471. * are disabled, have been dismissed, or are not the current tip in any
  472. * guide that they have been added to.
  473. *
  474. * @param {Object} state Global application state.
  475. * @param {string} tipId The tip to query.
  476. *
  477. * @return {boolean} Whether or not the given tip is showing.
  478. */
  479. function isTipVisible(state, tipId) {
  480. if (!state.preferences.areTipsEnabled) {
  481. return false;
  482. }
  483. if ((0,external_lodash_namespaceObject.has)(state.preferences.dismissedTips, [tipId])) {
  484. return false;
  485. }
  486. const associatedGuide = getAssociatedGuide(state, tipId);
  487. if (associatedGuide && associatedGuide.currentTipId !== tipId) {
  488. return false;
  489. }
  490. return true;
  491. }
  492. /**
  493. * Returns whether or not tips are globally enabled.
  494. *
  495. * @param {Object} state Global application state.
  496. *
  497. * @return {boolean} Whether tips are globally enabled.
  498. */
  499. function selectors_areTipsEnabled(state) {
  500. return state.preferences.areTipsEnabled;
  501. }
  502. ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/index.js
  503. /**
  504. * WordPress dependencies
  505. */
  506. /**
  507. * Internal dependencies
  508. */
  509. const STORE_NAME = 'core/nux';
  510. /**
  511. * Store definition for the nux namespace.
  512. *
  513. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
  514. *
  515. * @type {Object}
  516. */
  517. const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
  518. reducer: reducer,
  519. actions: actions_namespaceObject,
  520. selectors: selectors_namespaceObject,
  521. persist: ['preferences']
  522. }); // Once we build a more generic persistence plugin that works across types of stores
  523. // we'd be able to replace this with a register call.
  524. (0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, {
  525. reducer: reducer,
  526. actions: actions_namespaceObject,
  527. selectors: selectors_namespaceObject,
  528. persist: ['preferences']
  529. });
  530. ;// CONCATENATED MODULE: external ["wp","element"]
  531. var external_wp_element_namespaceObject = window["wp"]["element"];
  532. ;// CONCATENATED MODULE: external ["wp","compose"]
  533. var external_wp_compose_namespaceObject = window["wp"]["compose"];
  534. ;// CONCATENATED MODULE: external ["wp","components"]
  535. var external_wp_components_namespaceObject = window["wp"]["components"];
  536. ;// CONCATENATED MODULE: external ["wp","i18n"]
  537. var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
  538. ;// CONCATENATED MODULE: external ["wp","primitives"]
  539. var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
  540. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
  541. /**
  542. * WordPress dependencies
  543. */
  544. const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  545. xmlns: "http://www.w3.org/2000/svg",
  546. viewBox: "0 0 24 24"
  547. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  548. d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"
  549. }));
  550. /* harmony default export */ var library_close = (close_close);
  551. ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/components/dot-tip/index.js
  552. /**
  553. * WordPress dependencies
  554. */
  555. /**
  556. * Internal dependencies
  557. */
  558. function onClick(event) {
  559. // Tips are often nested within buttons. We stop propagation so that clicking
  560. // on a tip doesn't result in the button being clicked.
  561. event.stopPropagation();
  562. }
  563. function DotTip(_ref) {
  564. let {
  565. position = 'middle right',
  566. children,
  567. isVisible,
  568. hasNextTip,
  569. onDismiss,
  570. onDisable
  571. } = _ref;
  572. const anchorParent = (0,external_wp_element_namespaceObject.useRef)(null);
  573. const onFocusOutsideCallback = (0,external_wp_element_namespaceObject.useCallback)(event => {
  574. if (!anchorParent.current) {
  575. return;
  576. }
  577. if (anchorParent.current.contains(event.relatedTarget)) {
  578. return;
  579. }
  580. onDisable();
  581. }, [onDisable, anchorParent]);
  582. if (!isVisible) {
  583. return null;
  584. }
  585. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
  586. className: "nux-dot-tip",
  587. position: position,
  588. noArrow: true,
  589. focusOnMount: "container",
  590. shouldAnchorIncludePadding: true,
  591. role: "dialog",
  592. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Editor tips'),
  593. onClick: onClick,
  594. onFocusOutside: onFocusOutsideCallback
  595. }, (0,external_wp_element_namespaceObject.createElement)("p", null, children), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  596. variant: "link",
  597. onClick: onDismiss
  598. }, hasNextTip ? (0,external_wp_i18n_namespaceObject.__)('See next tip') : (0,external_wp_i18n_namespaceObject.__)('Got it'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  599. className: "nux-dot-tip__disable",
  600. icon: library_close,
  601. label: (0,external_wp_i18n_namespaceObject.__)('Disable tips'),
  602. onClick: onDisable
  603. }));
  604. }
  605. /* harmony default export */ var dot_tip = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => {
  606. let {
  607. tipId
  608. } = _ref2;
  609. const {
  610. isTipVisible,
  611. getAssociatedGuide
  612. } = select(store);
  613. const associatedGuide = getAssociatedGuide(tipId);
  614. return {
  615. isVisible: isTipVisible(tipId),
  616. hasNextTip: !!(associatedGuide && associatedGuide.nextTipId)
  617. };
  618. }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref3) => {
  619. let {
  620. tipId
  621. } = _ref3;
  622. const {
  623. dismissTip,
  624. disableTips
  625. } = dispatch(store);
  626. return {
  627. onDismiss() {
  628. dismissTip(tipId);
  629. },
  630. onDisable() {
  631. disableTips();
  632. }
  633. };
  634. }))(DotTip));
  635. ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/index.js
  636. /**
  637. * WordPress dependencies
  638. */
  639. external_wp_deprecated_default()('wp.nux', {
  640. since: '5.4',
  641. hint: 'wp.components.Guide can be used to show a user guide.',
  642. version: '6.2'
  643. });
  644. (window.wp = window.wp || {}).nux = __webpack_exports__;
  645. /******/ })()
  646. ;