@wordpress/nux 7.0.0 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,15 +33,14 @@ function onClick(event) {
33
33
  event.stopPropagation();
34
34
  }
35
35
 
36
- function DotTip(_ref) {
37
- let {
38
- position = 'middle right',
39
- children,
40
- isVisible,
41
- hasNextTip,
42
- onDismiss,
43
- onDisable
44
- } = _ref;
36
+ function DotTip({
37
+ position = 'middle right',
38
+ children,
39
+ isVisible,
40
+ hasNextTip,
41
+ onDismiss,
42
+ onDisable
43
+ }) {
45
44
  const anchorParent = (0, _element.useRef)(null);
46
45
  const onFocusOutsideCallback = (0, _element.useCallback)(event => {
47
46
  if (!anchorParent.current) {
@@ -78,10 +77,9 @@ function DotTip(_ref) {
78
77
  }));
79
78
  }
80
79
 
81
- var _default = (0, _compose.compose)((0, _data.withSelect)((select, _ref2) => {
82
- let {
83
- tipId
84
- } = _ref2;
80
+ var _default = (0, _compose.compose)((0, _data.withSelect)((select, {
81
+ tipId
82
+ }) => {
85
83
  const {
86
84
  isTipVisible,
87
85
  getAssociatedGuide
@@ -91,10 +89,9 @@ var _default = (0, _compose.compose)((0, _data.withSelect)((select, _ref2) => {
91
89
  isVisible: isTipVisible(tipId),
92
90
  hasNextTip: !!(associatedGuide && associatedGuide.nextTipId)
93
91
  };
94
- }), (0, _data.withDispatch)((dispatch, _ref3) => {
95
- let {
96
- tipId
97
- } = _ref3;
92
+ }), (0, _data.withDispatch)((dispatch, {
93
+ tipId
94
+ }) => {
98
95
  const {
99
96
  dismissTip,
100
97
  disableTips
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/nux/src/components/dot-tip/index.js"],"names":["onClick","event","stopPropagation","DotTip","position","children","isVisible","hasNextTip","onDismiss","onDisable","anchorParent","onFocusOutsideCallback","current","contains","relatedTarget","close","select","tipId","isTipVisible","getAssociatedGuide","nuxStore","associatedGuide","nextTipId","dispatch","dismissTip","disableTips"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ADX;AAEC,IAAA,IAAI,EAAGQ,YAFR;AAGC,IAAA,KAAK,EAAG,cAAI,cAAJ,CAHT;AAIC,IAAA,OAAO,EAAGN;AAJX,IAfD,CADD;AAwBA;;eAEc,sBACd,sBAAY,CAAEO,MAAF,YAAyB;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACpC,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAAuCH,MAAM,CAAEI,YAAF,CAAnD;AACA,QAAMC,eAAe,GAAGF,kBAAkB,CAAEF,KAAF,CAA1C;AACA,SAAO;AACNX,IAAAA,SAAS,EAAEY,YAAY,CAAED,KAAF,CADjB;AAENV,IAAAA,UAAU,EAAE,CAAC,EAAIc,eAAe,IAAIA,eAAe,CAACC,SAAvC;AAFP,GAAP;AAIA,CAPD,CADc,EASd,wBAAc,CAAEC,QAAF,YAA2B;AAAA,MAAf;AAAEN,IAAAA;AAAF,GAAe;AACxC,QAAM;AAAEO,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA8BF,QAAQ,CAAEH,YAAF,CAA5C;AACA,SAAO;AACNZ,IAAAA,SAAS,GAAG;AACXgB,MAAAA,UAAU,CAAEP,KAAF,CAAV;AACA,KAHK;;AAINR,IAAAA,SAAS,GAAG;AACXgB,MAAAA,WAAW;AACX;;AANK,GAAP;AAQA,CAVD,CATc,EAoBZtB,MApBY,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { Popover, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as nuxStore } from '../../store';\n\nfunction onClick( event ) {\n\t// Tips are often nested within buttons. We stop propagation so that clicking\n\t// on a tip doesn't result in the button being clicked.\n\tevent.stopPropagation();\n}\n\nexport function DotTip( {\n\tposition = 'middle right',\n\tchildren,\n\tisVisible,\n\thasNextTip,\n\tonDismiss,\n\tonDisable,\n} ) {\n\tconst anchorParent = useRef( null );\n\tconst onFocusOutsideCallback = useCallback(\n\t\t( event ) => {\n\t\t\tif ( ! anchorParent.current ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( anchorParent.current.contains( event.relatedTarget ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonDisable();\n\t\t},\n\t\t[ onDisable, anchorParent ]\n\t);\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tclassName=\"nux-dot-tip\"\n\t\t\tposition={ position }\n\t\t\tfocusOnMount\n\t\t\trole=\"dialog\"\n\t\t\taria-label={ __( 'Editor tips' ) }\n\t\t\tonClick={ onClick }\n\t\t\tonFocusOutside={ onFocusOutsideCallback }\n\t\t>\n\t\t\t<p>{ children }</p>\n\t\t\t<p>\n\t\t\t\t<Button variant=\"link\" onClick={ onDismiss }>\n\t\t\t\t\t{ hasNextTip ? __( 'See next tip' ) : __( 'Got it' ) }\n\t\t\t\t</Button>\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tclassName=\"nux-dot-tip__disable\"\n\t\t\t\ticon={ close }\n\t\t\t\tlabel={ __( 'Disable tips' ) }\n\t\t\t\tonClick={ onDisable }\n\t\t\t/>\n\t\t</Popover>\n\t);\n}\n\nexport default compose(\n\twithSelect( ( select, { tipId } ) => {\n\t\tconst { isTipVisible, getAssociatedGuide } = select( nuxStore );\n\t\tconst associatedGuide = getAssociatedGuide( tipId );\n\t\treturn {\n\t\t\tisVisible: isTipVisible( tipId ),\n\t\t\thasNextTip: !! ( associatedGuide && associatedGuide.nextTipId ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { tipId } ) => {\n\t\tconst { dismissTip, disableTips } = dispatch( nuxStore );\n\t\treturn {\n\t\t\tonDismiss() {\n\t\t\t\tdismissTip( tipId );\n\t\t\t},\n\t\t\tonDisable() {\n\t\t\t\tdisableTips();\n\t\t\t},\n\t\t};\n\t} )\n)( DotTip );\n"]}
1
+ {"version":3,"sources":["@wordpress/nux/src/components/dot-tip/index.js"],"names":["onClick","event","stopPropagation","DotTip","position","children","isVisible","hasNextTip","onDismiss","onDisable","anchorParent","onFocusOutsideCallback","current","contains","relatedTarget","close","select","tipId","isTipVisible","getAssociatedGuide","nuxStore","associatedGuide","nextTipId","dispatch","dismissTip","disableTips"],"mappings":";;;;;;;;AAOA;;AAJA;;AACA;;AACA;;AACA;;AAEA;;AAKA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;AAGA,SAASA,OAAT,CAAkBC,KAAlB,EAA0B;AACzB;AACA;AACAA,EAAAA,KAAK,CAACC,eAAN;AACA;;AAEM,SAASC,MAAT,CAAiB;AACvBC,EAAAA,QAAQ,GAAG,cADY;AAEvBC,EAAAA,QAFuB;AAGvBC,EAAAA,SAHuB;AAIvBC,EAAAA,UAJuB;AAKvBC,EAAAA,SALuB;AAMvBC,EAAAA;AANuB,CAAjB,EAOH;AACH,QAAMC,YAAY,GAAG,qBAAQ,IAAR,CAArB;AACA,QAAMC,sBAAsB,GAAG,0BAC5BV,KAAF,IAAa;AACZ,QAAK,CAAES,YAAY,CAACE,OAApB,EAA8B;AAC7B;AACA;;AACD,QAAKF,YAAY,CAACE,OAAb,CAAqBC,QAArB,CAA+BZ,KAAK,CAACa,aAArC,CAAL,EAA4D;AAC3D;AACA;;AACDL,IAAAA,SAAS;AACT,GAT6B,EAU9B,CAAEA,SAAF,EAAaC,YAAb,CAV8B,CAA/B;;AAYA,MAAK,CAAEJ,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,mBAAD;AACC,IAAA,SAAS,EAAC,aADX;AAEC,IAAA,QAAQ,EAAGF,QAFZ;AAGC,IAAA,YAAY,MAHb;AAIC,IAAA,IAAI,EAAC,QAJN;AAKC,kBAAa,cAAI,aAAJ,CALd;AAMC,IAAA,OAAO,EAAGJ,OANX;AAOC,IAAA,cAAc,EAAGW;AAPlB,KASC,uCAAKN,QAAL,CATD,EAUC,uCACC,4BAAC,kBAAD;AAAQ,IAAA,OAAO,EAAC,MAAhB;AAAuB,IAAA,OAAO,EAAGG;AAAjC,KACGD,UAAU,GAAG,cAAI,cAAJ,CAAH,GAA0B,cAAI,QAAJ,CADvC,CADD,CAVD,EAeC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,sBADX;AAEC,IAAA,IAAI,EAAGQ,YAFR;AAGC,IAAA,KAAK,EAAG,cAAI,cAAJ,CAHT;AAIC,IAAA,OAAO,EAAGN;AAJX,IAfD,CADD;AAwBA;;eAEc,sBACd,sBAAY,CAAEO,MAAF,EAAU;AAAEC,EAAAA;AAAF,CAAV,KAAyB;AACpC,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAAuCH,MAAM,CAAEI,YAAF,CAAnD;AACA,QAAMC,eAAe,GAAGF,kBAAkB,CAAEF,KAAF,CAA1C;AACA,SAAO;AACNX,IAAAA,SAAS,EAAEY,YAAY,CAAED,KAAF,CADjB;AAENV,IAAAA,UAAU,EAAE,CAAC,EAAIc,eAAe,IAAIA,eAAe,CAACC,SAAvC;AAFP,GAAP;AAIA,CAPD,CADc,EASd,wBAAc,CAAEC,QAAF,EAAY;AAAEN,EAAAA;AAAF,CAAZ,KAA2B;AACxC,QAAM;AAAEO,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA8BF,QAAQ,CAAEH,YAAF,CAA5C;AACA,SAAO;AACNZ,IAAAA,SAAS,GAAG;AACXgB,MAAAA,UAAU,CAAEP,KAAF,CAAV;AACA,KAHK;;AAINR,IAAAA,SAAS,GAAG;AACXgB,MAAAA,WAAW;AACX;;AANK,GAAP;AAQA,CAVD,CATc,EAoBZtB,MApBY,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { Popover, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as nuxStore } from '../../store';\n\nfunction onClick( event ) {\n\t// Tips are often nested within buttons. We stop propagation so that clicking\n\t// on a tip doesn't result in the button being clicked.\n\tevent.stopPropagation();\n}\n\nexport function DotTip( {\n\tposition = 'middle right',\n\tchildren,\n\tisVisible,\n\thasNextTip,\n\tonDismiss,\n\tonDisable,\n} ) {\n\tconst anchorParent = useRef( null );\n\tconst onFocusOutsideCallback = useCallback(\n\t\t( event ) => {\n\t\t\tif ( ! anchorParent.current ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( anchorParent.current.contains( event.relatedTarget ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonDisable();\n\t\t},\n\t\t[ onDisable, anchorParent ]\n\t);\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tclassName=\"nux-dot-tip\"\n\t\t\tposition={ position }\n\t\t\tfocusOnMount\n\t\t\trole=\"dialog\"\n\t\t\taria-label={ __( 'Editor tips' ) }\n\t\t\tonClick={ onClick }\n\t\t\tonFocusOutside={ onFocusOutsideCallback }\n\t\t>\n\t\t\t<p>{ children }</p>\n\t\t\t<p>\n\t\t\t\t<Button variant=\"link\" onClick={ onDismiss }>\n\t\t\t\t\t{ hasNextTip ? __( 'See next tip' ) : __( 'Got it' ) }\n\t\t\t\t</Button>\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tclassName=\"nux-dot-tip__disable\"\n\t\t\t\ticon={ close }\n\t\t\t\tlabel={ __( 'Disable tips' ) }\n\t\t\t\tonClick={ onDisable }\n\t\t\t/>\n\t\t</Popover>\n\t);\n}\n\nexport default compose(\n\twithSelect( ( select, { tipId } ) => {\n\t\tconst { isTipVisible, getAssociatedGuide } = select( nuxStore );\n\t\tconst associatedGuide = getAssociatedGuide( tipId );\n\t\treturn {\n\t\t\tisVisible: isTipVisible( tipId ),\n\t\t\thasNextTip: !! ( associatedGuide && associatedGuide.nextTipId ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { tipId } ) => {\n\t\tconst { dismissTip, disableTips } = dispatch( nuxStore );\n\t\treturn {\n\t\t\tonDismiss() {\n\t\t\t\tdismissTip( tipId );\n\t\t\t},\n\t\t\tonDisable() {\n\t\t\t\tdisableTips();\n\t\t\t},\n\t\t};\n\t} )\n)( DotTip );\n"]}
@@ -23,10 +23,7 @@ var _data = require("@wordpress/data");
23
23
  *
24
24
  * @return {Array} Updated state.
25
25
  */
26
- function guides() {
27
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
28
- let action = arguments.length > 1 ? arguments[1] : undefined;
29
-
26
+ function guides(state = [], action) {
30
27
  switch (action.type) {
31
28
  case 'TRIGGER_GUIDE':
32
29
  return [...state, action.tipIds];
@@ -44,10 +41,7 @@ function guides() {
44
41
  */
45
42
 
46
43
 
47
- function areTipsEnabled() {
48
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
49
- let action = arguments.length > 1 ? arguments[1] : undefined;
50
-
44
+ function areTipsEnabled(state = true, action) {
51
45
  switch (action.type) {
52
46
  case 'DISABLE_TIPS':
53
47
  return false;
@@ -69,10 +63,7 @@ function areTipsEnabled() {
69
63
  */
70
64
 
71
65
 
72
- function dismissedTips() {
73
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
74
- let action = arguments.length > 1 ? arguments[1] : undefined;
75
-
66
+ function dismissedTips(state = {}, action) {
76
67
  switch (action.type) {
77
68
  case 'DISMISS_TIP':
78
69
  return { ...state,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/nux/src/store/reducer.js"],"names":["guides","state","action","type","tipIds","areTipsEnabled","dismissedTips","id","preferences"],"mappings":";;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,MAAT,GAAsC;AAAA,MAArBC,KAAqB,uEAAb,EAAa;AAAA,MAATC,MAAS;;AAC5C,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,eAAL;AACC,aAAO,CAAE,GAAGF,KAAL,EAAYC,MAAM,CAACE,MAAnB,CAAP;AAFF;;AAKA,SAAOH,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,cAAT,GAAgD;AAAA,MAAvBJ,KAAuB,uEAAf,IAAe;AAAA,MAATC,MAAS;;AACtD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,cAAL;AACC,aAAO,KAAP;;AAED,SAAK,aAAL;AACC,aAAO,IAAP;AALF;;AAQA,SAAOF,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASK,aAAT,GAA6C;AAAA,MAArBL,KAAqB,uEAAb,EAAa;AAAA,MAATC,MAAS;;AACnD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,aAAL;AACC,aAAO,EACN,GAAGF,KADG;AAEN,SAAEC,MAAM,CAACK,EAAT,GAAe;AAFT,OAAP;;AAKD,SAAK,aAAL;AACC,aAAO,EAAP;AARF;;AAWA,SAAON,KAAP;AACA;;AAED,MAAMO,WAAW,GAAG,2BAAiB;AAAEH,EAAAA,cAAF;AAAkBC,EAAAA;AAAlB,CAAjB,CAApB;;eAEe,2BAAiB;AAAEN,EAAAA,MAAF;AAAUQ,EAAAA;AAAV,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer that tracks which tips are in a guide. Each guide is represented by\n * an array which contains the tip identifiers contained within that guide.\n *\n * @param {Array} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Array} Updated state.\n */\nexport function guides( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'TRIGGER_GUIDE':\n\t\t\treturn [ ...state, action.tipIds ];\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer that tracks whether or not tips are globally enabled.\n *\n * @param {boolean} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nexport function areTipsEnabled( state = true, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'DISABLE_TIPS':\n\t\t\treturn false;\n\n\t\tcase 'ENABLE_TIPS':\n\t\t\treturn true;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer that tracks which tips have been dismissed. If the state object\n * contains a tip identifier, then that tip is dismissed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function dismissedTips( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'DISMISS_TIP':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.id ]: true,\n\t\t\t};\n\n\t\tcase 'ENABLE_TIPS':\n\t\t\treturn {};\n\t}\n\n\treturn state;\n}\n\nconst preferences = combineReducers( { areTipsEnabled, dismissedTips } );\n\nexport default combineReducers( { guides, preferences } );\n"]}
1
+ {"version":3,"sources":["@wordpress/nux/src/store/reducer.js"],"names":["guides","state","action","type","tipIds","areTipsEnabled","dismissedTips","id","preferences"],"mappings":";;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,MAAT,CAAiBC,KAAK,GAAG,EAAzB,EAA6BC,MAA7B,EAAsC;AAC5C,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,eAAL;AACC,aAAO,CAAE,GAAGF,KAAL,EAAYC,MAAM,CAACE,MAAnB,CAAP;AAFF;;AAKA,SAAOH,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,cAAT,CAAyBJ,KAAK,GAAG,IAAjC,EAAuCC,MAAvC,EAAgD;AACtD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,cAAL;AACC,aAAO,KAAP;;AAED,SAAK,aAAL;AACC,aAAO,IAAP;AALF;;AAQA,SAAOF,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASK,aAAT,CAAwBL,KAAK,GAAG,EAAhC,EAAoCC,MAApC,EAA6C;AACnD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,aAAL;AACC,aAAO,EACN,GAAGF,KADG;AAEN,SAAEC,MAAM,CAACK,EAAT,GAAe;AAFT,OAAP;;AAKD,SAAK,aAAL;AACC,aAAO,EAAP;AARF;;AAWA,SAAON,KAAP;AACA;;AAED,MAAMO,WAAW,GAAG,2BAAiB;AAAEH,EAAAA,cAAF;AAAkBC,EAAAA;AAAlB,CAAjB,CAApB;;eAEe,2BAAiB;AAAEN,EAAAA,MAAF;AAAUQ,EAAAA;AAAV,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer that tracks which tips are in a guide. Each guide is represented by\n * an array which contains the tip identifiers contained within that guide.\n *\n * @param {Array} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Array} Updated state.\n */\nexport function guides( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'TRIGGER_GUIDE':\n\t\t\treturn [ ...state, action.tipIds ];\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer that tracks whether or not tips are globally enabled.\n *\n * @param {boolean} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nexport function areTipsEnabled( state = true, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'DISABLE_TIPS':\n\t\t\treturn false;\n\n\t\tcase 'ENABLE_TIPS':\n\t\t\treturn true;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer that tracks which tips have been dismissed. If the state object\n * contains a tip identifier, then that tip is dismissed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function dismissedTips( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'DISMISS_TIP':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.id ]: true,\n\t\t\t};\n\n\t\tcase 'ENABLE_TIPS':\n\t\t\treturn {};\n\t}\n\n\treturn state;\n}\n\nconst preferences = combineReducers( { areTipsEnabled, dismissedTips } );\n\nexport default combineReducers( { guides, preferences } );\n"]}
@@ -62,13 +62,11 @@ const getAssociatedGuide = (0, _rememo.default)((state, tipId) => {
62
62
  exports.getAssociatedGuide = getAssociatedGuide;
63
63
 
64
64
  function isTipVisible(state, tipId) {
65
- var _state$preferences$di;
66
-
67
65
  if (!state.preferences.areTipsEnabled) {
68
66
  return false;
69
67
  }
70
68
 
71
- if ((_state$preferences$di = state.preferences.dismissedTips) !== null && _state$preferences$di !== void 0 && _state$preferences$di.hasOwnProperty(tipId)) {
69
+ if (state.preferences.dismissedTips?.hasOwnProperty(tipId)) {
72
70
  return false;
73
71
  }
74
72
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/nux/src/store/selectors.js"],"names":["getAssociatedGuide","state","tipId","tipIds","guides","includes","nonDismissedTips","filter","tId","Object","keys","preferences","dismissedTips","currentTipId","nextTipId","isTipVisible","areTipsEnabled","hasOwnProperty","associatedGuide"],"mappings":";;;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAkB,GAAG,qBACjC,CAAEC,KAAF,EAASC,KAAT,KAAoB;AACnB,OAAM,MAAMC,MAAZ,IAAsBF,KAAK,CAACG,MAA5B,EAAqC;AACpC,QAAKD,MAAM,CAACE,QAAP,CAAiBH,KAAjB,CAAL,EAAgC;AAC/B,YAAMI,gBAAgB,GAAGH,MAAM,CAACI,MAAP,CACtBC,GAAF,IACC,CAAEC,MAAM,CAACC,IAAP,CACDT,KAAK,CAACU,WAAN,CAAkBC,aADjB,EAEAP,QAFA,CAEUG,GAFV,CAFqB,CAAzB;AAMA,YAAM,CAAEK,YAAY,GAAG,IAAjB,EAAuBC,SAAS,GAAG,IAAnC,IACLR,gBADD;AAEA,aAAO;AAAEH,QAAAA,MAAF;AAAUU,QAAAA,YAAV;AAAwBC,QAAAA;AAAxB,OAAP;AACA;AACD;;AAED,SAAO,IAAP;AACA,CAjBgC,EAkB/Bb,KAAF,IAAa,CAAEA,KAAK,CAACG,MAAR,EAAgBH,KAAK,CAACU,WAAN,CAAkBC,aAAlC,CAlBoB,CAA3B;AAqBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASG,YAAT,CAAuBd,KAAvB,EAA8BC,KAA9B,EAAsC;AAAA;;AAC5C,MAAK,CAAED,KAAK,CAACU,WAAN,CAAkBK,cAAzB,EAA0C;AACzC,WAAO,KAAP;AACA;;AAED,+BAAKf,KAAK,CAACU,WAAN,CAAkBC,aAAvB,kDAAK,sBAAiCK,cAAjC,CAAiDf,KAAjD,CAAL,EAAgE;AAC/D,WAAO,KAAP;AACA;;AAED,QAAMgB,eAAe,GAAGlB,kBAAkB,CAAEC,KAAF,EAASC,KAAT,CAA1C;;AACA,MAAKgB,eAAe,IAAIA,eAAe,CAACL,YAAhB,KAAiCX,KAAzD,EAAiE;AAChE,WAAO,KAAP;AACA;;AAED,SAAO,IAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASc,cAAT,CAAyBf,KAAzB,EAAiC;AACvC,SAAOA,KAAK,CAACU,WAAN,CAAkBK,cAAzB;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * An object containing information about a guide.\n *\n * @typedef {Object} NUXGuideInfo\n * @property {string[]} tipIds Which tips the guide contains.\n * @property {?string} currentTipId The guide's currently showing tip.\n * @property {?string} nextTipId The guide's next tip to show.\n */\n\n/**\n * Returns an object describing the guide, if any, that the given tip is a part\n * of.\n *\n * @param {Object} state Global application state.\n * @param {string} tipId The tip to query.\n *\n * @return {?NUXGuideInfo} Information about the associated guide.\n */\nexport const getAssociatedGuide = createSelector(\n\t( state, tipId ) => {\n\t\tfor ( const tipIds of state.guides ) {\n\t\t\tif ( tipIds.includes( tipId ) ) {\n\t\t\t\tconst nonDismissedTips = tipIds.filter(\n\t\t\t\t\t( tId ) =>\n\t\t\t\t\t\t! Object.keys(\n\t\t\t\t\t\t\tstate.preferences.dismissedTips\n\t\t\t\t\t\t).includes( tId )\n\t\t\t\t);\n\t\t\t\tconst [ currentTipId = null, nextTipId = null ] =\n\t\t\t\t\tnonDismissedTips;\n\t\t\t\treturn { tipIds, currentTipId, nextTipId };\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t},\n\t( state ) => [ state.guides, state.preferences.dismissedTips ]\n);\n\n/**\n * Determines whether or not the given tip is showing. Tips are hidden if they\n * are disabled, have been dismissed, or are not the current tip in any\n * guide that they have been added to.\n *\n * @param {Object} state Global application state.\n * @param {string} tipId The tip to query.\n *\n * @return {boolean} Whether or not the given tip is showing.\n */\nexport function isTipVisible( state, tipId ) {\n\tif ( ! state.preferences.areTipsEnabled ) {\n\t\treturn false;\n\t}\n\n\tif ( state.preferences.dismissedTips?.hasOwnProperty( tipId ) ) {\n\t\treturn false;\n\t}\n\n\tconst associatedGuide = getAssociatedGuide( state, tipId );\n\tif ( associatedGuide && associatedGuide.currentTipId !== tipId ) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Returns whether or not tips are globally enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether tips are globally enabled.\n */\nexport function areTipsEnabled( state ) {\n\treturn state.preferences.areTipsEnabled;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/nux/src/store/selectors.js"],"names":["getAssociatedGuide","state","tipId","tipIds","guides","includes","nonDismissedTips","filter","tId","Object","keys","preferences","dismissedTips","currentTipId","nextTipId","isTipVisible","areTipsEnabled","hasOwnProperty","associatedGuide"],"mappings":";;;;;;;;;;;AAGA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AP;AACA;;AAED,SAAO,IAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASc,cAAT,CAAyBf,KAAzB,EAAiC;AACvC,SAAOA,KAAK,CAACU,WAAN,CAAkBK,cAAzB;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * An object containing information about a guide.\n *\n * @typedef {Object} NUXGuideInfo\n * @property {string[]} tipIds Which tips the guide contains.\n * @property {?string} currentTipId The guide's currently showing tip.\n * @property {?string} nextTipId The guide's next tip to show.\n */\n\n/**\n * Returns an object describing the guide, if any, that the given tip is a part\n * of.\n *\n * @param {Object} state Global application state.\n * @param {string} tipId The tip to query.\n *\n * @return {?NUXGuideInfo} Information about the associated guide.\n */\nexport const getAssociatedGuide = createSelector(\n\t( state, tipId ) => {\n\t\tfor ( const tipIds of state.guides ) {\n\t\t\tif ( tipIds.includes( tipId ) ) {\n\t\t\t\tconst nonDismissedTips = tipIds.filter(\n\t\t\t\t\t( tId ) =>\n\t\t\t\t\t\t! Object.keys(\n\t\t\t\t\t\t\tstate.preferences.dismissedTips\n\t\t\t\t\t\t).includes( tId )\n\t\t\t\t);\n\t\t\t\tconst [ currentTipId = null, nextTipId = null ] =\n\t\t\t\t\tnonDismissedTips;\n\t\t\t\treturn { tipIds, currentTipId, nextTipId };\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t},\n\t( state ) => [ state.guides, state.preferences.dismissedTips ]\n);\n\n/**\n * Determines whether or not the given tip is showing. Tips are hidden if they\n * are disabled, have been dismissed, or are not the current tip in any\n * guide that they have been added to.\n *\n * @param {Object} state Global application state.\n * @param {string} tipId The tip to query.\n *\n * @return {boolean} Whether or not the given tip is showing.\n */\nexport function isTipVisible( state, tipId ) {\n\tif ( ! state.preferences.areTipsEnabled ) {\n\t\treturn false;\n\t}\n\n\tif ( state.preferences.dismissedTips?.hasOwnProperty( tipId ) ) {\n\t\treturn false;\n\t}\n\n\tconst associatedGuide = getAssociatedGuide( state, tipId );\n\tif ( associatedGuide && associatedGuide.currentTipId !== tipId ) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Returns whether or not tips are globally enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether tips are globally enabled.\n */\nexport function areTipsEnabled( state ) {\n\treturn state.preferences.areTipsEnabled;\n}\n"]}
@@ -21,15 +21,14 @@ function onClick(event) {
21
21
  event.stopPropagation();
22
22
  }
23
23
 
24
- export function DotTip(_ref) {
25
- let {
26
- position = 'middle right',
27
- children,
28
- isVisible,
29
- hasNextTip,
30
- onDismiss,
31
- onDisable
32
- } = _ref;
24
+ export function DotTip({
25
+ position = 'middle right',
26
+ children,
27
+ isVisible,
28
+ hasNextTip,
29
+ onDismiss,
30
+ onDisable
31
+ }) {
33
32
  const anchorParent = useRef(null);
34
33
  const onFocusOutsideCallback = useCallback(event => {
35
34
  if (!anchorParent.current) {
@@ -65,10 +64,9 @@ export function DotTip(_ref) {
65
64
  onClick: onDisable
66
65
  }));
67
66
  }
68
- export default compose(withSelect((select, _ref2) => {
69
- let {
70
- tipId
71
- } = _ref2;
67
+ export default compose(withSelect((select, {
68
+ tipId
69
+ }) => {
72
70
  const {
73
71
  isTipVisible,
74
72
  getAssociatedGuide
@@ -78,10 +76,9 @@ export default compose(withSelect((select, _ref2) => {
78
76
  isVisible: isTipVisible(tipId),
79
77
  hasNextTip: !!(associatedGuide && associatedGuide.nextTipId)
80
78
  };
81
- }), withDispatch((dispatch, _ref3) => {
82
- let {
83
- tipId
84
- } = _ref3;
79
+ }), withDispatch((dispatch, {
80
+ tipId
81
+ }) => {
85
82
  const {
86
83
  dismissTip,
87
84
  disableTips
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/nux/src/components/dot-tip/index.js"],"names":["compose","Popover","Button","__","withSelect","withDispatch","useCallback","useRef","close","store","nuxStore","onClick","event","stopPropagation","DotTip","position","children","isVisible","hasNextTip","onDismiss","onDisable","anchorParent","onFocusOutsideCallback","current","contains","relatedTarget","select","tipId","isTipVisible","getAssociatedGuide","associatedGuide","nextTipId","dispatch","dismissTip","disableTips"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,OAAT,EAAkBC,MAAlB,QAAgC,uBAAhC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,oBAApC;AACA,SAASC,KAAT,QAAsB,kBAAtB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,QAAlB,QAAkC,aAAlC;;AAEA,SAASC,OAAT,CAAkBC,KAAlB,EAA0B;AACzB;AACA;AACAA,EAAAA,KAAK,CAACC,eAAN;AACA;;AAED,OAAO,SAASC,MAAT,OAOH;AAAA,MAPoB;AACvBC,IAAAA,QAAQ,GAAG,cADY;AAEvBC,IAAAA,QAFuB;AAGvBC,IAAAA,SAHuB;AAIvBC,IAAAA,UAJuB;AAKvBC,IAAAA,SALuB;AAMvBC,IAAAA;AANuB,GAOpB;AACH,QAAMC,YAAY,GAAGd,MAAM,CAAE,IAAF,CAA3B;AACA,QAAMe,sBAAsB,GAAGhB,WAAW,CACvCM,KAAF,IAAa;AACZ,QAAK,CAAES,YAAY,CAACE,OAApB,EAA8B;AAC7B;AACA;;AACD,QAAKF,YAAY,CAACE,OAAb,CAAqBC,QAArB,CAA+BZ,KAAK,CAACa,aAArC,CAAL,EAA4D;AAC3D;AACA;;AACDL,IAAAA,SAAS;AACT,GATwC,EAUzC,CAAEA,SAAF,EAAaC,YAAb,CAVyC,CAA1C;;AAYA,MAAK,CAAEJ,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,OAAD;AACC,IAAA,SAAS,EAAC,aADX;AAEC,IAAA,QAAQ,EAAGF,QAFZ;AAGC,IAAA,YAAY,MAHb;AAIC,IAAA,IAAI,EAAC,QAJN;AAKC,k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MApBY,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { Popover, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as nuxStore } from '../../store';\n\nfunction onClick( event ) {\n\t// Tips are often nested within buttons. We stop propagation so that clicking\n\t// on a tip doesn't result in the button being clicked.\n\tevent.stopPropagation();\n}\n\nexport function DotTip( {\n\tposition = 'middle right',\n\tchildren,\n\tisVisible,\n\thasNextTip,\n\tonDismiss,\n\tonDisable,\n} ) {\n\tconst anchorParent = useRef( null );\n\tconst onFocusOutsideCallback = useCallback(\n\t\t( event ) => {\n\t\t\tif ( ! anchorParent.current ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( anchorParent.current.contains( event.relatedTarget ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonDisable();\n\t\t},\n\t\t[ onDisable, anchorParent ]\n\t);\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tclassName=\"nux-dot-tip\"\n\t\t\tposition={ position }\n\t\t\tfocusOnMount\n\t\t\trole=\"dialog\"\n\t\t\taria-label={ __( 'Editor tips' ) }\n\t\t\tonClick={ onClick }\n\t\t\tonFocusOutside={ onFocusOutsideCallback }\n\t\t>\n\t\t\t<p>{ children }</p>\n\t\t\t<p>\n\t\t\t\t<Button variant=\"link\" onClick={ onDismiss }>\n\t\t\t\t\t{ hasNextTip ? __( 'See next tip' ) : __( 'Got it' ) }\n\t\t\t\t</Button>\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tclassName=\"nux-dot-tip__disable\"\n\t\t\t\ticon={ close }\n\t\t\t\tlabel={ __( 'Disable tips' ) }\n\t\t\t\tonClick={ onDisable }\n\t\t\t/>\n\t\t</Popover>\n\t);\n}\n\nexport default compose(\n\twithSelect( ( select, { tipId } ) => {\n\t\tconst { isTipVisible, getAssociatedGuide } = select( nuxStore );\n\t\tconst associatedGuide = getAssociatedGuide( tipId );\n\t\treturn {\n\t\t\tisVisible: isTipVisible( tipId ),\n\t\t\thasNextTip: !! ( associatedGuide && associatedGuide.nextTipId ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { tipId } ) => {\n\t\tconst { dismissTip, disableTips } = dispatch( nuxStore );\n\t\treturn {\n\t\t\tonDismiss() {\n\t\t\t\tdismissTip( tipId );\n\t\t\t},\n\t\t\tonDisable() {\n\t\t\t\tdisableTips();\n\t\t\t},\n\t\t};\n\t} )\n)( DotTip );\n"]}
1
+ {"version":3,"sources":["@wordpress/nux/src/components/dot-tip/index.js"],"names":["compose","Popover","Button","__","withSelect","withDispatch","useCallback","useRef","close","store","nuxStore","onClick","event","stopPropagation","DotTip","position","children","isVisible","hasNextTip","onDismiss","onDisable","anchorParent","onFocusOutsideCallback","current","contains","relatedTarget","select","tipId","isTipVisible","getAssociatedGuide","associatedGuide","nextTipId","dispatch","dismissTip","disableTips"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,OAAT,EAAkBC,MAAlB,QAAgC,uBAAhC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,oBAApC;AACA,SAASC,KAAT,QAAsB,kBAAtB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,QAAlB,QAAkC,aAAlC;;AAEA,SAASC,OAAT,CAAkBC,KAAlB,EAA0B;AACzB;AACA;AACAA,EAAAA,KAAK,CAACC,eAAN;AACA;;AAED,OAAO,SAASC,MAAT,CAAiB;AACvBC,EAAAA,QAAQ,GAAG,cADY;AAEvBC,EAAAA,QAFuB;AAGvBC,EAAAA,SAHuB;AAIvBC,EAAAA,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CH,MAAM,CAAEhB,QAAF,CAAnD;AACA,QAAMoB,eAAe,GAAGD,kBAAkB,CAAEF,KAAF,CAA1C;AACA,SAAO;AACNV,IAAAA,SAAS,EAAEW,YAAY,CAAED,KAAF,CADjB;AAENT,IAAAA,UAAU,EAAE,CAAC,EAAIY,eAAe,IAAIA,eAAe,CAACC,SAAvC;AAFP,GAAP;AAIA,CAPS,CADW,EASrB1B,YAAY,CAAE,CAAE2B,QAAF,EAAY;AAAEL,EAAAA;AAAF,CAAZ,KAA2B;AACxC,QAAM;AAAEM,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA8BF,QAAQ,CAAEtB,QAAF,CAA5C;AACA,SAAO;AACNS,IAAAA,SAAS,GAAG;AACXc,MAAAA,UAAU,CAAEN,KAAF,CAAV;AACA,KAHK;;AAINP,IAAAA,SAAS,GAAG;AACXc,MAAAA,WAAW;AACX;;AANK,GAAP;AAQA,CAVW,CATS,CAAP,CAoBZpB,MApBY,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { Popover, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as nuxStore } from '../../store';\n\nfunction onClick( event ) {\n\t// Tips are often nested within buttons. We stop propagation so that clicking\n\t// on a tip doesn't result in the button being clicked.\n\tevent.stopPropagation();\n}\n\nexport function DotTip( {\n\tposition = 'middle right',\n\tchildren,\n\tisVisible,\n\thasNextTip,\n\tonDismiss,\n\tonDisable,\n} ) {\n\tconst anchorParent = useRef( null );\n\tconst onFocusOutsideCallback = useCallback(\n\t\t( event ) => {\n\t\t\tif ( ! anchorParent.current ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( anchorParent.current.contains( event.relatedTarget ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonDisable();\n\t\t},\n\t\t[ onDisable, anchorParent ]\n\t);\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tclassName=\"nux-dot-tip\"\n\t\t\tposition={ position }\n\t\t\tfocusOnMount\n\t\t\trole=\"dialog\"\n\t\t\taria-label={ __( 'Editor tips' ) }\n\t\t\tonClick={ onClick }\n\t\t\tonFocusOutside={ onFocusOutsideCallback }\n\t\t>\n\t\t\t<p>{ children }</p>\n\t\t\t<p>\n\t\t\t\t<Button variant=\"link\" onClick={ onDismiss }>\n\t\t\t\t\t{ hasNextTip ? __( 'See next tip' ) : __( 'Got it' ) }\n\t\t\t\t</Button>\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tclassName=\"nux-dot-tip__disable\"\n\t\t\t\ticon={ close }\n\t\t\t\tlabel={ __( 'Disable tips' ) }\n\t\t\t\tonClick={ onDisable }\n\t\t\t/>\n\t\t</Popover>\n\t);\n}\n\nexport default compose(\n\twithSelect( ( select, { tipId } ) => {\n\t\tconst { isTipVisible, getAssociatedGuide } = select( nuxStore );\n\t\tconst associatedGuide = getAssociatedGuide( tipId );\n\t\treturn {\n\t\t\tisVisible: isTipVisible( tipId ),\n\t\t\thasNextTip: !! ( associatedGuide && associatedGuide.nextTipId ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { tipId } ) => {\n\t\tconst { dismissTip, disableTips } = dispatch( nuxStore );\n\t\treturn {\n\t\t\tonDismiss() {\n\t\t\t\tdismissTip( tipId );\n\t\t\t},\n\t\t\tonDisable() {\n\t\t\t\tdisableTips();\n\t\t\t},\n\t\t};\n\t} )\n)( DotTip );\n"]}
@@ -12,10 +12,7 @@ import { combineReducers } from '@wordpress/data';
12
12
  * @return {Array} Updated state.
13
13
  */
14
14
 
15
- export function guides() {
16
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
17
- let action = arguments.length > 1 ? arguments[1] : undefined;
18
-
15
+ export function guides(state = [], action) {
19
16
  switch (action.type) {
20
17
  case 'TRIGGER_GUIDE':
21
18
  return [...state, action.tipIds];
@@ -32,10 +29,7 @@ export function guides() {
32
29
  * @return {boolean} Updated state.
33
30
  */
34
31
 
35
- export function areTipsEnabled() {
36
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
37
- let action = arguments.length > 1 ? arguments[1] : undefined;
38
-
32
+ export function areTipsEnabled(state = true, action) {
39
33
  switch (action.type) {
40
34
  case 'DISABLE_TIPS':
41
35
  return false;
@@ -56,10 +50,7 @@ export function areTipsEnabled() {
56
50
  * @return {Object} Updated state.
57
51
  */
58
52
 
59
- export function dismissedTips() {
60
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
61
- let action = arguments.length > 1 ? arguments[1] : undefined;
62
-
53
+ export function dismissedTips(state = {}, action) {
63
54
  switch (action.type) {
64
55
  case 'DISMISS_TIP':
65
56
  return { ...state,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/nux/src/store/reducer.js"],"names":["combineReducers","guides","state","action","type","tipIds","areTipsEnabled","dismissedTips","id","preferences"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,MAAT,GAAsC;AAAA,MAArBC,KAAqB,uEAAb,EAAa;AAAA,MAATC,MAAS;;AAC5C,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,eAAL;AACC,aAAO,CAAE,GAAGF,KAAL,EAAYC,MAAM,CAACE,MAAnB,CAAP;AAFF;;AAKA,SAAOH,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,cAAT,GAAgD;AAAA,MAAvBJ,KAAuB,uEAAf,IAAe;AAAA,MAATC,MAAS;;AACtD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,cAAL;AACC,aAAO,KAAP;;AAED,SAAK,aAAL;AACC,aAAO,IAAP;AALF;;AAQA,SAAOF,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,aAAT,GAA6C;AAAA,MAArBL,KAAqB,uEAAb,EAAa;AAAA,MAATC,MAAS;;AACnD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,aAAL;AACC,aAAO,EACN,GAAGF,KADG;AAEN,SAAEC,MAAM,CAACK,EAAT,GAAe;AAFT,OAAP;;AAKD,SAAK,aAAL;AACC,aAAO,EAAP;AARF;;AAWA,SAAON,KAAP;AACA;AAED,MAAMO,WAAW,GAAGT,eAAe,CAAE;AAAEM,EAAAA,cAAF;AAAkBC,EAAAA;AAAlB,CAAF,CAAnC;AAEA,eAAeP,eAAe,CAAE;AAAEC,EAAAA,MAAF;AAAUQ,EAAAA;AAAV,CAAF,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer that tracks which tips are in a guide. Each guide is represented by\n * an array which contains the tip identifiers contained within that guide.\n *\n * @param {Array} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Array} Updated state.\n */\nexport function guides( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'TRIGGER_GUIDE':\n\t\t\treturn [ ...state, action.tipIds ];\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer that tracks whether or not tips are globally enabled.\n *\n * @param {boolean} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nexport function areTipsEnabled( state = true, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'DISABLE_TIPS':\n\t\t\treturn false;\n\n\t\tcase 'ENABLE_TIPS':\n\t\t\treturn true;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer that tracks which tips have been dismissed. If the state object\n * contains a tip identifier, then that tip is dismissed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function dismissedTips( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'DISMISS_TIP':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.id ]: true,\n\t\t\t};\n\n\t\tcase 'ENABLE_TIPS':\n\t\t\treturn {};\n\t}\n\n\treturn state;\n}\n\nconst preferences = combineReducers( { areTipsEnabled, dismissedTips } );\n\nexport default combineReducers( { guides, preferences } );\n"]}
1
+ {"version":3,"sources":["@wordpress/nux/src/store/reducer.js"],"names":["combineReducers","guides","state","action","type","tipIds","areTipsEnabled","dismissedTips","id","preferences"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,MAAT,CAAiBC,KAAK,GAAG,EAAzB,EAA6BC,MAA7B,EAAsC;AAC5C,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,eAAL;AACC,aAAO,CAAE,GAAGF,KAAL,EAAYC,MAAM,CAACE,MAAnB,CAAP;AAFF;;AAKA,SAAOH,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,cAAT,CAAyBJ,KAAK,GAAG,IAAjC,EAAuCC,MAAvC,EAAgD;AACtD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,cAAL;AACC,aAAO,KAAP;;AAED,SAAK,aAAL;AACC,aAAO,IAAP;AALF;;AAQA,SAAOF,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,aAAT,CAAwBL,KAAK,GAAG,EAAhC,EAAoCC,MAApC,EAA6C;AACnD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,aAAL;AACC,aAAO,EACN,GAAGF,KADG;AAEN,SAAEC,MAAM,CAACK,EAAT,GAAe;AAFT,OAAP;;AAKD,SAAK,aAAL;AACC,aAAO,EAAP;AARF;;AAWA,SAAON,KAAP;AACA;AAED,MAAMO,WAAW,GAAGT,eAAe,CAAE;AAAEM,EAAAA,cAAF;AAAkBC,EAAAA;AAAlB,CAAF,CAAnC;AAEA,eAAeP,eAAe,CAAE;AAAEC,EAAAA,MAAF;AAAUQ,EAAAA;AAAV,CAAF,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer that tracks which tips are in a guide. Each guide is represented by\n * an array which contains the tip identifiers contained within that guide.\n *\n * @param {Array} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Array} Updated state.\n */\nexport function guides( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'TRIGGER_GUIDE':\n\t\t\treturn [ ...state, action.tipIds ];\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer that tracks whether or not tips are globally enabled.\n *\n * @param {boolean} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nexport function areTipsEnabled( state = true, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'DISABLE_TIPS':\n\t\t\treturn false;\n\n\t\tcase 'ENABLE_TIPS':\n\t\t\treturn true;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer that tracks which tips have been dismissed. If the state object\n * contains a tip identifier, then that tip is dismissed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function dismissedTips( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'DISMISS_TIP':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.id ]: true,\n\t\t\t};\n\n\t\tcase 'ENABLE_TIPS':\n\t\t\treturn {};\n\t}\n\n\treturn state;\n}\n\nconst preferences = combineReducers( { areTipsEnabled, dismissedTips } );\n\nexport default combineReducers( { guides, preferences } );\n"]}
@@ -48,13 +48,11 @@ export const getAssociatedGuide = createSelector((state, tipId) => {
48
48
  */
49
49
 
50
50
  export function isTipVisible(state, tipId) {
51
- var _state$preferences$di;
52
-
53
51
  if (!state.preferences.areTipsEnabled) {
54
52
  return false;
55
53
  }
56
54
 
57
- if ((_state$preferences$di = state.preferences.dismissedTips) !== null && _state$preferences$di !== void 0 && _state$preferences$di.hasOwnProperty(tipId)) {
55
+ if (state.preferences.dismissedTips?.hasOwnProperty(tipId)) {
58
56
  return false;
59
57
  }
60
58
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/nux/src/store/selectors.js"],"names":["createSelector","getAssociatedGuide","state","tipId","tipIds","guides","includes","nonDismissedTips","filter","tId","Object","keys","preferences","dismissedTips","currentTipId","nextTipId","isTipVisible","areTipsEnabled","hasOwnProperty","associatedGuide"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,kBAAkB,GAAGD,cAAc,CAC/C,CAAEE,KAAF,EAASC,KAAT,KAAoB;AACnB,OAAM,MAAMC,MAAZ,IAAsBF,KAAK,CAACG,MAA5B,EAAqC;AACpC,QAAKD,MAAM,CAACE,QAAP,CAAiBH,KAAjB,CAAL,EAAgC;AAC/B,YAAMI,gBAAgB,GAAGH,MAAM,CAACI,MAAP,CACtBC,GAAF,IACC,CAAEC,MAAM,CAACC,IAAP,CACDT,KAAK,CAACU,WAAN,CAAkBC,aADjB,EAEAP,QAFA,CAEUG,GAFV,CAFqB,CAAzB;AAMA,YAAM,CAAEK,YAAY,GAAG,IAAjB,EAAuBC,SAAS,GAAG,IAAnC,IACLR,gBADD;AAEA,aAAO;AAAEH,QAAAA,MAAF;AAAUU,QAAAA,YAAV;AAAwBC,QAAAA;AAAxB,OAAP;AACA;AACD;;AAED,SAAO,IAAP;AACA,CAjB8C,EAkB7Cb,KAAF,IAAa,CAAEA,KAAK,CAACG,MAAR,EAAgBH,KAAK,CAACU,WAAN,CAAkBC,aAAlC,CAlBkC,CAAzC;AAqBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,YAAT,CAAuBd,KAAvB,EAA8BC,KAA9B,EAAsC;AAAA;;AAC5C,MAAK,CAAED,KAAK,CAACU,WAAN,CAAkBK,cAAzB,EAA0C;AACzC,WAAO,KAAP;AACA;;AAED,+BAAKf,KAAK,CAACU,WAAN,CAAkBC,aAAvB,kDAAK,sBAAiCK,cAAjC,CAAiDf,KAAjD,CAAL,EAAgE;AAC/D,WAAO,KAAP;AACA;;AAED,QAAMgB,eAAe,GAAGlB,kBAAkB,CAAEC,KAAF,EAASC,KAAT,CAA1C;;AACA,MAAKgB,eAAe,IAAIA,eAAe,CAACL,YAAhB,KAAiCX,KAAzD,EAAiE;AAChE,WAAO,KAAP;AACA;;AAED,SAAO,IAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASc,cAAT,CAAyBf,KAAzB,EAAiC;AACvC,SAAOA,KAAK,CAACU,WAAN,CAAkBK,cAAzB;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * An object containing information about a guide.\n *\n * @typedef {Object} NUXGuideInfo\n * @property {string[]} tipIds Which tips the guide contains.\n * @property {?string} currentTipId The guide's currently showing tip.\n * @property {?string} nextTipId The guide's next tip to show.\n */\n\n/**\n * Returns an object describing the guide, if any, that the given tip is a part\n * of.\n *\n * @param {Object} state Global application state.\n * @param {string} tipId The tip to query.\n *\n * @return {?NUXGuideInfo} Information about the associated guide.\n */\nexport const getAssociatedGuide = createSelector(\n\t( state, tipId ) => {\n\t\tfor ( const tipIds of state.guides ) {\n\t\t\tif ( tipIds.includes( tipId ) ) {\n\t\t\t\tconst nonDismissedTips = tipIds.filter(\n\t\t\t\t\t( tId ) =>\n\t\t\t\t\t\t! Object.keys(\n\t\t\t\t\t\t\tstate.preferences.dismissedTips\n\t\t\t\t\t\t).includes( tId )\n\t\t\t\t);\n\t\t\t\tconst [ currentTipId = null, nextTipId = null ] =\n\t\t\t\t\tnonDismissedTips;\n\t\t\t\treturn { tipIds, currentTipId, nextTipId };\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t},\n\t( state ) => [ state.guides, state.preferences.dismissedTips ]\n);\n\n/**\n * Determines whether or not the given tip is showing. Tips are hidden if they\n * are disabled, have been dismissed, or are not the current tip in any\n * guide that they have been added to.\n *\n * @param {Object} state Global application state.\n * @param {string} tipId The tip to query.\n *\n * @return {boolean} Whether or not the given tip is showing.\n */\nexport function isTipVisible( state, tipId ) {\n\tif ( ! state.preferences.areTipsEnabled ) {\n\t\treturn false;\n\t}\n\n\tif ( state.preferences.dismissedTips?.hasOwnProperty( tipId ) ) {\n\t\treturn false;\n\t}\n\n\tconst associatedGuide = getAssociatedGuide( state, tipId );\n\tif ( associatedGuide && associatedGuide.currentTipId !== tipId ) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Returns whether or not tips are globally enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether tips are globally enabled.\n */\nexport function areTipsEnabled( state ) {\n\treturn state.preferences.areTipsEnabled;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/nux/src/store/selectors.js"],"names":["createSelector","getAssociatedGuide","state","tipId","tipIds","guides","includes","nonDismissedTips","filter","tId","Object","keys","preferences","dismissedTips","currentTipId","nextTipId","isTipVisible","areTipsEnabled","hasOwnProperty","associatedGuide"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,kBAAkB,GAAGD,cAAc,CAC/C,CAAEE,KAAF,EAASC,KAAT,KAAoB;AACnB,OAAM,MAAMC,MAAZ,IAAsBF,KAAK,CAACG,MAA5B,EAAqC;AACpC,QAAKD,MAAM,CAACE,QAAP,CAAiBH,KAAjB,CAAL,EAAgC;AAC/B,YAAMI,gBAAgB,GAAGH,MAAM,CAACI,MAAP,CACtBC,GAAF,IACC,CAAEC,MAAM,CAACC,IAAP,CACDT,KAAK,CAACU,WAAN,CAAkBC,aADjB,EAEAP,QAFA,CAEUG,GAFV,CAFqB,CAAzB;AAMA,YAAM,CAAEK,YAAY,GAAG,IAAjB,EAAuBC,SAAS,GAAG,IAAnC,IACLR,gBADD;AAEA,aAAO;AAAEH,QAAAA,MAAF;AAAUU,QAAAA,YAAV;AAAwBC,QAAAA;AAAxB,OAAP;AACA;AACD;;AAED,SAAO,IAAP;AACA,CAjB8C,EAkB7Cb,KAAF,IAAa,CAAEA,KAAK,CAACG,MAAR,EAAgBH,KAAK,CAACU,WAAN,CAAkBC,aAAlC,CAlBkC,CAAzC;AAqBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,YAAT,CAAuBd,KAAvB,EAA8BC,KAA9B,EAAsC;AAC5C,MAAK,CAAED,KAAK,CAACU,WAAN,CAAkBK,cAAzB,EAA0C;AACzC,WAAO,KAAP;AACA;;AAED,MAAKf,KAAK,CAACU,WAAN,CAAkBC,aAAlB,EAAiCK,cAAjC,CAAiDf,KAAjD,CAAL,EAAgE;AAC/D,WAAO,KAAP;AACA;;AAED,QAAMgB,eAAe,GAAGlB,kBAAkB,CAAEC,KAAF,EAASC,KAAT,CAA1C;;AACA,MAAKgB,eAAe,IAAIA,eAAe,CAACL,YAAhB,KAAiCX,KAAzD,EAAiE;AAChE,WAAO,KAAP;AACA;;AAED,SAAO,IAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASc,cAAT,CAAyBf,KAAzB,EAAiC;AACvC,SAAOA,KAAK,CAACU,WAAN,CAAkBK,cAAzB;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * An object containing information about a guide.\n *\n * @typedef {Object} NUXGuideInfo\n * @property {string[]} tipIds Which tips the guide contains.\n * @property {?string} currentTipId The guide's currently showing tip.\n * @property {?string} nextTipId The guide's next tip to show.\n */\n\n/**\n * Returns an object describing the guide, if any, that the given tip is a part\n * of.\n *\n * @param {Object} state Global application state.\n * @param {string} tipId The tip to query.\n *\n * @return {?NUXGuideInfo} Information about the associated guide.\n */\nexport const getAssociatedGuide = createSelector(\n\t( state, tipId ) => {\n\t\tfor ( const tipIds of state.guides ) {\n\t\t\tif ( tipIds.includes( tipId ) ) {\n\t\t\t\tconst nonDismissedTips = tipIds.filter(\n\t\t\t\t\t( tId ) =>\n\t\t\t\t\t\t! Object.keys(\n\t\t\t\t\t\t\tstate.preferences.dismissedTips\n\t\t\t\t\t\t).includes( tId )\n\t\t\t\t);\n\t\t\t\tconst [ currentTipId = null, nextTipId = null ] =\n\t\t\t\t\tnonDismissedTips;\n\t\t\t\treturn { tipIds, currentTipId, nextTipId };\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t},\n\t( state ) => [ state.guides, state.preferences.dismissedTips ]\n);\n\n/**\n * Determines whether or not the given tip is showing. Tips are hidden if they\n * are disabled, have been dismissed, or are not the current tip in any\n * guide that they have been added to.\n *\n * @param {Object} state Global application state.\n * @param {string} tipId The tip to query.\n *\n * @return {boolean} Whether or not the given tip is showing.\n */\nexport function isTipVisible( state, tipId ) {\n\tif ( ! state.preferences.areTipsEnabled ) {\n\t\treturn false;\n\t}\n\n\tif ( state.preferences.dismissedTips?.hasOwnProperty( tipId ) ) {\n\t\treturn false;\n\t}\n\n\tconst associatedGuide = getAssociatedGuide( state, tipId );\n\tif ( associatedGuide && associatedGuide.currentTipId !== tipId ) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Returns whether or not tips are globally enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether tips are globally enabled.\n */\nexport function areTipsEnabled( state ) {\n\treturn state.preferences.areTipsEnabled;\n}\n"]}
@@ -97,7 +97,7 @@
97
97
  --wp-block-synced-color: #7a00df;
98
98
  --wp-block-synced-color--rgb: 122, 0, 223;
99
99
  }
100
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
100
+ @media (min-resolution: 192dpi) {
101
101
  :root {
102
102
  --wp-admin-border-width-focus: 1.5px;
103
103
  }
@@ -97,7 +97,7 @@
97
97
  --wp-block-synced-color: #7a00df;
98
98
  --wp-block-synced-color--rgb: 122, 0, 223;
99
99
  }
100
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
100
+ @media (min-resolution: 192dpi) {
101
101
  :root {
102
102
  --wp-admin-border-width-focus: 1.5px;
103
103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/nux",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "description": "NUX (New User eXperience) module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,14 +31,14 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/components": "^23.3.7",
35
- "@wordpress/compose": "^6.3.3",
36
- "@wordpress/data": "^8.3.3",
37
- "@wordpress/deprecated": "^3.26.1",
38
- "@wordpress/element": "^5.3.2",
39
- "@wordpress/i18n": "^4.26.1",
40
- "@wordpress/icons": "^9.17.2",
41
- "rememo": "^4.0.0"
34
+ "@wordpress/components": "^25.1.7",
35
+ "@wordpress/compose": "^6.12.1",
36
+ "@wordpress/data": "^9.5.3",
37
+ "@wordpress/deprecated": "^3.35.1",
38
+ "@wordpress/element": "^5.12.1",
39
+ "@wordpress/i18n": "^4.35.1",
40
+ "@wordpress/icons": "^9.26.2",
41
+ "rememo": "^4.0.2"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "react": "^18.0.0",
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "e086b2b595618a5f4c9491119695be3e074d736b"
50
+ "gitHead": "57ab3bd2f1dd0e82d94d6d0a722a650c9b12aaae"
51
51
  }
@@ -5,7 +5,7 @@ exports[`DotTip should render correctly 1`] = `
5
5
  aria-label="Editor tips"
6
6
  class="components-popover nux-dot-tip is-positioned"
7
7
  role="dialog"
8
- style="position: absolute; top: 0px; left: 0px; opacity: 0; transform: translateX(-2em) scale(0) translateZ(0); transform-origin: 0% 50% 0;"
8
+ style="position: absolute; top: 0px; left: 0px; opacity: 0; transform: translateX(0px) translateY(0px) translateX(-2em) scale(0) translateZ(0); transform-origin: 0% 50% 0;"
9
9
  tabindex="-1"
10
10
  >
11
11
  <div