@wordpress/nux 9.48.0 → 10.0.1
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.
- package/CHANGELOG.md +7 -1
- package/README.md +2 -103
- package/build/components/dot-tip/index.cjs +3 -90
- package/build/components/dot-tip/index.cjs.map +3 -3
- package/build/store/actions.cjs.map +2 -2
- package/build/store/reducer.cjs +8 -38
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +7 -32
- package/build/store/selectors.cjs.map +2 -2
- package/build-module/components/dot-tip/index.mjs +3 -90
- package/build-module/components/dot-tip/index.mjs.map +2 -2
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/reducer.mjs +8 -32
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +7 -32
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-style/style-rtl.css +3 -185
- package/build-style/style.css +3 -189
- package/package.json +10 -12
- package/src/components/dot-tip/README.md +2 -34
- package/src/components/dot-tip/index.js +6 -94
- package/src/components/dot-tip/test/index.js +10 -67
- package/src/store/actions.js +10 -9
- package/src/store/reducer.js +13 -61
- package/src/store/selectors.js +11 -57
- package/src/store/test/reducer.js +20 -60
- package/src/store/test/selectors.js +6 -131
- package/src/style.scss +4 -1
- package/src/components/dot-tip/style.scss +0 -131
- package/src/components/dot-tip/test/__snapshots__/index.js.snap +0 -48
|
@@ -1,37 +1,12 @@
|
|
|
1
1
|
// packages/nux/src/store/selectors.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
(state, tipId) => {
|
|
5
|
-
for (const tipIds of state.guides) {
|
|
6
|
-
if (tipIds.includes(tipId)) {
|
|
7
|
-
const nonDismissedTips = tipIds.filter(
|
|
8
|
-
(tId) => !Object.keys(
|
|
9
|
-
state.preferences.dismissedTips
|
|
10
|
-
).includes(tId)
|
|
11
|
-
);
|
|
12
|
-
const [currentTipId = null, nextTipId = null] = nonDismissedTips;
|
|
13
|
-
return { tipIds, currentTipId, nextTipId };
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return null;
|
|
17
|
-
},
|
|
18
|
-
(state) => [state.guides, state.preferences.dismissedTips]
|
|
19
|
-
);
|
|
20
|
-
function isTipVisible(state, tipId) {
|
|
21
|
-
if (!state.preferences.areTipsEnabled) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
if (state.preferences.dismissedTips?.hasOwnProperty(tipId)) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
const associatedGuide = getAssociatedGuide(state, tipId);
|
|
28
|
-
if (associatedGuide && associatedGuide.currentTipId !== tipId) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
return true;
|
|
2
|
+
function getAssociatedGuide() {
|
|
3
|
+
return null;
|
|
32
4
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
5
|
+
function isTipVisible() {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
function areTipsEnabled() {
|
|
9
|
+
return false;
|
|
35
10
|
}
|
|
36
11
|
export {
|
|
37
12
|
areTipsEnabled,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/selectors.js"],
|
|
4
|
-
"sourcesContent": ["/**\n *
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\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 null because the deprecated NUX package no longer displays guides.\n *\n * @return {null} No associated guide.\n */\nexport function getAssociatedGuide() {\n\treturn null;\n}\n\n/**\n * Returns false because the deprecated NUX package no longer displays tips.\n *\n * @return {boolean} Whether or not the given tip is showing.\n */\nexport function isTipVisible() {\n\treturn false;\n}\n\n/**\n * Returns false because the deprecated NUX package no longer displays tips.\n *\n * @return {boolean} Whether tips are globally enabled.\n */\nexport function areTipsEnabled() {\n\treturn false;\n}\n"],
|
|
5
|
+
"mappings": ";AAcO,SAAS,qBAAqB;AACpC,SAAO;AACR;AAOO,SAAS,eAAe;AAC9B,SAAO;AACR;AAOO,SAAS,iBAAiB;AAChC,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,186 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Typography
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* SCSS Variables.
|
|
9
|
-
*
|
|
10
|
-
* Please use variables from this sheet to ensure consistency across the UI.
|
|
11
|
-
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
|
12
|
-
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Colors
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Fonts & basic variables.
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Typography
|
|
22
|
-
*/
|
|
23
|
-
/**
|
|
24
|
-
* Grid System.
|
|
25
|
-
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* Radius scale.
|
|
29
|
-
*/
|
|
30
|
-
/**
|
|
31
|
-
* Elevation scale.
|
|
32
|
-
*/
|
|
33
|
-
/**
|
|
34
|
-
* Dimensions.
|
|
35
|
-
*/
|
|
36
|
-
/**
|
|
37
|
-
* Mobile specific styles
|
|
38
|
-
*/
|
|
39
|
-
/**
|
|
40
|
-
* Editor styles.
|
|
41
|
-
*/
|
|
42
|
-
/**
|
|
43
|
-
* Block & Editor UI.
|
|
44
|
-
*/
|
|
45
|
-
/**
|
|
46
|
-
* Block paddings.
|
|
47
|
-
*/
|
|
48
|
-
/**
|
|
49
|
-
* React Native specific.
|
|
50
|
-
* These variables do not appear to be used anywhere else.
|
|
51
|
-
*/
|
|
52
|
-
/**
|
|
53
|
-
* Converts a hex value into the rgb equivalent.
|
|
54
|
-
*
|
|
55
|
-
* @param {string} hex - the hexadecimal value to convert
|
|
56
|
-
* @return {string} comma separated rgb values
|
|
57
|
-
*/
|
|
58
|
-
/**
|
|
59
|
-
* Long content fade mixin
|
|
60
|
-
*
|
|
61
|
-
* Creates a fading overlay to signify that the content is longer
|
|
62
|
-
* than the space allows.
|
|
63
|
-
*/
|
|
64
|
-
/**
|
|
65
|
-
* Breakpoint mixins
|
|
66
|
-
*/
|
|
67
|
-
/**
|
|
68
|
-
* Focus styles.
|
|
69
|
-
*/
|
|
70
|
-
/**
|
|
71
|
-
* Applies editor left position to the selector passed as argument
|
|
72
|
-
*/
|
|
73
|
-
/**
|
|
74
|
-
* Styles that are reused verbatim in a few places
|
|
75
|
-
*/
|
|
76
|
-
/**
|
|
77
|
-
* Allows users to opt-out of animations via OS-level preferences.
|
|
78
|
-
*/
|
|
79
|
-
/**
|
|
80
|
-
* Reset default styles for JavaScript UI based pages.
|
|
81
|
-
* This is a WP-admin agnostic reset
|
|
82
|
-
*/
|
|
83
|
-
/**
|
|
84
|
-
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
85
|
-
*/
|
|
86
|
-
/**
|
|
87
|
-
* Creates a checkerboard pattern background to indicate transparency.
|
|
88
|
-
* @param {String} $size - The size of the squares in the checkerboard pattern. Default is 12px.
|
|
89
|
-
*/
|
|
90
|
-
.nux-dot-tip::before, .nux-dot-tip::after {
|
|
91
|
-
border-radius: 100%;
|
|
92
|
-
content: " ";
|
|
93
|
-
pointer-events: none;
|
|
94
|
-
position: absolute;
|
|
95
|
-
}
|
|
96
|
-
.nux-dot-tip::before {
|
|
97
|
-
background: rgba(0, 115, 156, 0.9);
|
|
98
|
-
opacity: 0.9;
|
|
99
|
-
height: 24px;
|
|
100
|
-
right: -12px;
|
|
101
|
-
top: -12px;
|
|
102
|
-
transform: scale(0.3333333333);
|
|
103
|
-
width: 24px;
|
|
104
|
-
}
|
|
105
|
-
@media not (prefers-reduced-motion) {
|
|
106
|
-
.nux-dot-tip::before {
|
|
107
|
-
animation: nux-pulse 1.6s infinite cubic-bezier(0.17, 0.67, 0.92, 0.62);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
.nux-dot-tip::after {
|
|
111
|
-
background: #00739c;
|
|
112
|
-
height: 8px;
|
|
113
|
-
right: -4px;
|
|
114
|
-
top: -4px;
|
|
115
|
-
width: 8px;
|
|
116
|
-
}
|
|
117
|
-
@keyframes nux-pulse {
|
|
118
|
-
100% {
|
|
119
|
-
background: rgba(0, 115, 156, 0);
|
|
120
|
-
transform: scale(1);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
.nux-dot-tip .components-popover__content {
|
|
124
|
-
width: 350px;
|
|
125
|
-
padding: 20px 18px;
|
|
126
|
-
}
|
|
127
|
-
@media (min-width: 600px) {
|
|
128
|
-
.nux-dot-tip .components-popover__content {
|
|
129
|
-
width: 450px;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
.nux-dot-tip .components-popover__content .nux-dot-tip__disable {
|
|
133
|
-
position: absolute;
|
|
134
|
-
left: 0;
|
|
135
|
-
top: 0;
|
|
136
|
-
}
|
|
137
|
-
.nux-dot-tip[data-y-axis=top] {
|
|
138
|
-
margin-top: -4px;
|
|
139
|
-
}
|
|
140
|
-
.nux-dot-tip[data-y-axis=bottom] {
|
|
141
|
-
margin-top: 4px;
|
|
142
|
-
}
|
|
143
|
-
.nux-dot-tip[data-y-axis=middle][data-y-axis=left] {
|
|
144
|
-
margin-right: -4px;
|
|
145
|
-
}
|
|
146
|
-
.nux-dot-tip[data-y-axis=middle][data-y-axis=right] {
|
|
147
|
-
margin-right: 4px;
|
|
148
|
-
}
|
|
149
|
-
.nux-dot-tip[data-y-axis=top] .components-popover__content {
|
|
150
|
-
margin-bottom: 20px;
|
|
151
|
-
}
|
|
152
|
-
.nux-dot-tip[data-y-axis=bottom] .components-popover__content {
|
|
153
|
-
margin-top: 20px;
|
|
154
|
-
}
|
|
155
|
-
.nux-dot-tip[data-y-axis=middle][data-y-axis=left] .components-popover__content {
|
|
156
|
-
margin-left: 20px;
|
|
157
|
-
}
|
|
158
|
-
.nux-dot-tip[data-y-axis=middle][data-y-axis=right] .components-popover__content {
|
|
159
|
-
margin-right: 20px;
|
|
160
|
-
}
|
|
161
|
-
.nux-dot-tip[data-y-axis=left], .nux-dot-tip[data-y-axis=center], .nux-dot-tip[data-y-axis=right] {
|
|
162
|
-
z-index: 1000001;
|
|
163
|
-
}
|
|
164
|
-
@media (max-width: 600px) {
|
|
165
|
-
.nux-dot-tip[data-y-axis=left] .components-popover__content, .nux-dot-tip[data-y-axis=center] .components-popover__content, .nux-dot-tip[data-y-axis=right] .components-popover__content {
|
|
166
|
-
align-self: end;
|
|
167
|
-
right: 5px;
|
|
168
|
-
margin: 20px 0 0 0;
|
|
169
|
-
max-width: none !important;
|
|
170
|
-
position: fixed;
|
|
171
|
-
left: 5px;
|
|
172
|
-
width: auto;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
.nux-dot-tip.components-popover:not([data-y-axis=middle])[data-y-axis=right] .components-popover__content {
|
|
176
|
-
margin-left: 0;
|
|
177
|
-
}
|
|
178
|
-
.nux-dot-tip.components-popover:not([data-y-axis=middle])[data-y-axis=left] .components-popover__content {
|
|
179
|
-
margin-right: 0;
|
|
180
|
-
}
|
|
181
|
-
.nux-dot-tip.components-popover.interface-more-menu-dropdown__content:not([data-y-axis=middle])[data-y-axis=right] .components-popover__content {
|
|
182
|
-
margin-left: -12px;
|
|
183
|
-
}
|
|
184
|
-
.nux-dot-tip.components-popover.interface-more-menu-dropdown__content:not([data-y-axis=middle])[data-y-axis=left] .components-popover__content {
|
|
185
|
-
margin-right: -12px;
|
|
186
|
-
}
|
|
2
|
+
* Intentionally no styles.
|
|
3
|
+
* This entry point is kept so existing @wordpress/nux style imports continue to resolve.
|
|
4
|
+
*/
|
package/build-style/style.css
CHANGED
|
@@ -1,190 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Typography
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* SCSS Variables.
|
|
9
|
-
*
|
|
10
|
-
* Please use variables from this sheet to ensure consistency across the UI.
|
|
11
|
-
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
|
12
|
-
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Colors
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Fonts & basic variables.
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Typography
|
|
22
|
-
*/
|
|
23
|
-
/**
|
|
24
|
-
* Grid System.
|
|
25
|
-
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* Radius scale.
|
|
29
|
-
*/
|
|
30
|
-
/**
|
|
31
|
-
* Elevation scale.
|
|
32
|
-
*/
|
|
33
|
-
/**
|
|
34
|
-
* Dimensions.
|
|
35
|
-
*/
|
|
36
|
-
/**
|
|
37
|
-
* Mobile specific styles
|
|
38
|
-
*/
|
|
39
|
-
/**
|
|
40
|
-
* Editor styles.
|
|
41
|
-
*/
|
|
42
|
-
/**
|
|
43
|
-
* Block & Editor UI.
|
|
44
|
-
*/
|
|
45
|
-
/**
|
|
46
|
-
* Block paddings.
|
|
47
|
-
*/
|
|
48
|
-
/**
|
|
49
|
-
* React Native specific.
|
|
50
|
-
* These variables do not appear to be used anywhere else.
|
|
51
|
-
*/
|
|
52
|
-
/**
|
|
53
|
-
* Converts a hex value into the rgb equivalent.
|
|
54
|
-
*
|
|
55
|
-
* @param {string} hex - the hexadecimal value to convert
|
|
56
|
-
* @return {string} comma separated rgb values
|
|
57
|
-
*/
|
|
58
|
-
/**
|
|
59
|
-
* Long content fade mixin
|
|
60
|
-
*
|
|
61
|
-
* Creates a fading overlay to signify that the content is longer
|
|
62
|
-
* than the space allows.
|
|
63
|
-
*/
|
|
64
|
-
/**
|
|
65
|
-
* Breakpoint mixins
|
|
66
|
-
*/
|
|
67
|
-
/**
|
|
68
|
-
* Focus styles.
|
|
69
|
-
*/
|
|
70
|
-
/**
|
|
71
|
-
* Applies editor left position to the selector passed as argument
|
|
72
|
-
*/
|
|
73
|
-
/**
|
|
74
|
-
* Styles that are reused verbatim in a few places
|
|
75
|
-
*/
|
|
76
|
-
/**
|
|
77
|
-
* Allows users to opt-out of animations via OS-level preferences.
|
|
78
|
-
*/
|
|
79
|
-
/**
|
|
80
|
-
* Reset default styles for JavaScript UI based pages.
|
|
81
|
-
* This is a WP-admin agnostic reset
|
|
82
|
-
*/
|
|
83
|
-
/**
|
|
84
|
-
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
85
|
-
*/
|
|
86
|
-
/**
|
|
87
|
-
* Creates a checkerboard pattern background to indicate transparency.
|
|
88
|
-
* @param {String} $size - The size of the squares in the checkerboard pattern. Default is 12px.
|
|
89
|
-
*/
|
|
90
|
-
.nux-dot-tip::before, .nux-dot-tip::after {
|
|
91
|
-
border-radius: 100%;
|
|
92
|
-
content: " ";
|
|
93
|
-
pointer-events: none;
|
|
94
|
-
position: absolute;
|
|
95
|
-
}
|
|
96
|
-
.nux-dot-tip::before {
|
|
97
|
-
background: rgba(0, 115, 156, 0.9);
|
|
98
|
-
opacity: 0.9;
|
|
99
|
-
height: 24px;
|
|
100
|
-
left: -12px;
|
|
101
|
-
top: -12px;
|
|
102
|
-
transform: scale(0.3333333333);
|
|
103
|
-
width: 24px;
|
|
104
|
-
}
|
|
105
|
-
@media not (prefers-reduced-motion) {
|
|
106
|
-
.nux-dot-tip::before {
|
|
107
|
-
animation: nux-pulse 1.6s infinite cubic-bezier(0.17, 0.67, 0.92, 0.62);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
.nux-dot-tip::after {
|
|
111
|
-
background: #00739c;
|
|
112
|
-
height: 8px;
|
|
113
|
-
left: -4px;
|
|
114
|
-
top: -4px;
|
|
115
|
-
width: 8px;
|
|
116
|
-
}
|
|
117
|
-
@keyframes nux-pulse {
|
|
118
|
-
100% {
|
|
119
|
-
background: rgba(0, 115, 156, 0);
|
|
120
|
-
transform: scale(1);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
.nux-dot-tip .components-popover__content {
|
|
124
|
-
width: 350px;
|
|
125
|
-
padding: 20px 18px;
|
|
126
|
-
}
|
|
127
|
-
@media (min-width: 600px) {
|
|
128
|
-
.nux-dot-tip .components-popover__content {
|
|
129
|
-
width: 450px;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
.nux-dot-tip .components-popover__content .nux-dot-tip__disable {
|
|
133
|
-
position: absolute;
|
|
134
|
-
right: 0;
|
|
135
|
-
top: 0;
|
|
136
|
-
}
|
|
137
|
-
.nux-dot-tip[data-y-axis=top] {
|
|
138
|
-
margin-top: -4px;
|
|
139
|
-
}
|
|
140
|
-
.nux-dot-tip[data-y-axis=bottom] {
|
|
141
|
-
margin-top: 4px;
|
|
142
|
-
}
|
|
143
|
-
.nux-dot-tip[data-y-axis=middle][data-y-axis=left] {
|
|
144
|
-
margin-left: -4px;
|
|
145
|
-
}
|
|
146
|
-
.nux-dot-tip[data-y-axis=middle][data-y-axis=right] {
|
|
147
|
-
margin-left: 4px;
|
|
148
|
-
}
|
|
149
|
-
.nux-dot-tip[data-y-axis=top] .components-popover__content {
|
|
150
|
-
margin-bottom: 20px;
|
|
151
|
-
}
|
|
152
|
-
.nux-dot-tip[data-y-axis=bottom] .components-popover__content {
|
|
153
|
-
margin-top: 20px;
|
|
154
|
-
}
|
|
155
|
-
.nux-dot-tip[data-y-axis=middle][data-y-axis=left] .components-popover__content {
|
|
156
|
-
margin-right: 20px;
|
|
157
|
-
}
|
|
158
|
-
.nux-dot-tip[data-y-axis=middle][data-y-axis=right] .components-popover__content {
|
|
159
|
-
margin-left: 20px;
|
|
160
|
-
}
|
|
161
|
-
.nux-dot-tip[data-y-axis=left], .nux-dot-tip[data-y-axis=center], .nux-dot-tip[data-y-axis=right] {
|
|
162
|
-
z-index: 1000001;
|
|
163
|
-
}
|
|
164
|
-
@media (max-width: 600px) {
|
|
165
|
-
.nux-dot-tip[data-y-axis=left] .components-popover__content, .nux-dot-tip[data-y-axis=center] .components-popover__content, .nux-dot-tip[data-y-axis=right] .components-popover__content {
|
|
166
|
-
align-self: end;
|
|
167
|
-
left: 5px;
|
|
168
|
-
margin: 20px 0 0 0;
|
|
169
|
-
max-width: none !important;
|
|
170
|
-
position: fixed;
|
|
171
|
-
right: 5px;
|
|
172
|
-
width: auto;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
.nux-dot-tip.components-popover:not([data-y-axis=middle])[data-y-axis=right] .components-popover__content {
|
|
176
|
-
/*!rtl:ignore*/
|
|
177
|
-
margin-left: 0;
|
|
178
|
-
}
|
|
179
|
-
.nux-dot-tip.components-popover:not([data-y-axis=middle])[data-y-axis=left] .components-popover__content {
|
|
180
|
-
/*!rtl:ignore*/
|
|
181
|
-
margin-right: 0;
|
|
182
|
-
}
|
|
183
|
-
.nux-dot-tip.components-popover.interface-more-menu-dropdown__content:not([data-y-axis=middle])[data-y-axis=right] .components-popover__content {
|
|
184
|
-
/*!rtl:ignore*/
|
|
185
|
-
margin-left: -12px;
|
|
186
|
-
}
|
|
187
|
-
.nux-dot-tip.components-popover.interface-more-menu-dropdown__content:not([data-y-axis=middle])[data-y-axis=left] .components-popover__content {
|
|
188
|
-
/*!rtl:ignore*/
|
|
189
|
-
margin-right: -12px;
|
|
190
|
-
}
|
|
2
|
+
* Intentionally no styles.
|
|
3
|
+
* This entry point is kept so existing @wordpress/nux style imports continue to resolve.
|
|
4
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/nux",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "NUX (New User eXperience) module for WordPress.",
|
|
3
|
+
"version": "10.0.1",
|
|
4
|
+
"description": "Deprecated no-op NUX (New User eXperience) compatibility module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
7
7
|
"keywords": [
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"./package.json": "./package.json",
|
|
41
41
|
"./build-style/": "./build-style/"
|
|
42
42
|
},
|
|
43
|
-
"react-native": "src/index",
|
|
44
43
|
"wpScript": true,
|
|
45
44
|
"sideEffects": [
|
|
46
45
|
"build-style/**",
|
|
@@ -53,14 +52,13 @@
|
|
|
53
52
|
"build-module/store/index.mjs"
|
|
54
53
|
],
|
|
55
54
|
"dependencies": {
|
|
56
|
-
"@wordpress/
|
|
57
|
-
"@wordpress/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"@wordpress/icons": "^13.3.0"
|
|
55
|
+
"@wordpress/data": "^10.48.1",
|
|
56
|
+
"@wordpress/deprecated": "^4.48.1"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@testing-library/dom": "^10.4.1",
|
|
60
|
+
"@testing-library/react": "^16.3.2",
|
|
61
|
+
"@testing-library/user-event": "^14.6.1"
|
|
64
62
|
},
|
|
65
63
|
"peerDependencies": {
|
|
66
64
|
"react": "^18.0.0",
|
|
@@ -69,5 +67,5 @@
|
|
|
69
67
|
"publishConfig": {
|
|
70
68
|
"access": "public"
|
|
71
69
|
},
|
|
72
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "99df7432c5c7cb83ba41146fd1f57f3c19004305"
|
|
73
71
|
}
|
|
@@ -1,38 +1,6 @@
|
|
|
1
1
|
# DotTip
|
|
2
2
|
|
|
3
|
-
`DotTip` is
|
|
3
|
+
`DotTip` is deprecated and kept only as a no-op compatibility component. It always renders `null`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
New code should use `Guide` from `@wordpress/components` to show user guides.
|
|
6
6
|
|
|
7
|
-
```jsx
|
|
8
|
-
<button onClick={ ... }>
|
|
9
|
-
Add to Cart
|
|
10
|
-
<DotTip tipId="acme/add-to-cart">
|
|
11
|
-
Click here to add the product to your shopping cart.
|
|
12
|
-
</DotTip>
|
|
13
|
-
</button>
|
|
14
|
-
}
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Props
|
|
18
|
-
|
|
19
|
-
The component accepts the following props:
|
|
20
|
-
|
|
21
|
-
### tipId
|
|
22
|
-
|
|
23
|
-
A string that uniquely identifies the tip. Identifiers should be prefixed with the name of the plugin, followed by a `/`. For example, `acme/add-to-cart`.
|
|
24
|
-
|
|
25
|
-
- Type: `string`
|
|
26
|
-
- Required: Yes
|
|
27
|
-
|
|
28
|
-
### position
|
|
29
|
-
|
|
30
|
-
The direction in which the popover should open relative to its parent node. Specify y- and x-axis as a space-separated string. Supports `"top"`, `"middle"`, `"bottom"` y axis, and `"left"`, `"center"`, `"right"` x axis.
|
|
31
|
-
|
|
32
|
-
- Type: `String`
|
|
33
|
-
- Required: No
|
|
34
|
-
- Default: `"middle right"`
|
|
35
|
-
|
|
36
|
-
### children
|
|
37
|
-
|
|
38
|
-
Any React element or elements can be passed as children. They will be rendered within the tip bubble.
|
|
@@ -1,98 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Deprecated no-op DotTip component.
|
|
3
|
+
*
|
|
4
|
+
* @return {null} Nothing.
|
|
3
5
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { withSelect, withDispatch } from '@wordpress/data';
|
|
8
|
-
import { useCallback, useRef } from '@wordpress/element';
|
|
9
|
-
import { close } from '@wordpress/icons';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { store as nuxStore } from '../../store';
|
|
15
|
-
|
|
16
|
-
function onClick( event ) {
|
|
17
|
-
// Tips are often nested within buttons. We stop propagation so that clicking
|
|
18
|
-
// on a tip doesn't result in the button being clicked.
|
|
19
|
-
event.stopPropagation();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function DotTip( {
|
|
23
|
-
position = 'middle right',
|
|
24
|
-
children,
|
|
25
|
-
isVisible,
|
|
26
|
-
hasNextTip,
|
|
27
|
-
onDismiss,
|
|
28
|
-
onDisable,
|
|
29
|
-
} ) {
|
|
30
|
-
const anchorParent = useRef( null );
|
|
31
|
-
const onFocusOutsideCallback = useCallback(
|
|
32
|
-
( event ) => {
|
|
33
|
-
if ( ! anchorParent.current ) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
if ( anchorParent.current.contains( event.relatedTarget ) ) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
onDisable();
|
|
40
|
-
},
|
|
41
|
-
[ onDisable, anchorParent ]
|
|
42
|
-
);
|
|
43
|
-
if ( ! isVisible ) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<Popover
|
|
49
|
-
className="nux-dot-tip"
|
|
50
|
-
position={ position }
|
|
51
|
-
focusOnMount
|
|
52
|
-
role="dialog"
|
|
53
|
-
aria-label={ __( 'Editor tips' ) }
|
|
54
|
-
onClick={ onClick }
|
|
55
|
-
onFocusOutside={ onFocusOutsideCallback }
|
|
56
|
-
>
|
|
57
|
-
<p>{ children }</p>
|
|
58
|
-
<p>
|
|
59
|
-
<Button
|
|
60
|
-
__next40pxDefaultSize
|
|
61
|
-
variant="link"
|
|
62
|
-
onClick={ onDismiss }
|
|
63
|
-
>
|
|
64
|
-
{ hasNextTip ? __( 'See next tip' ) : __( 'Got it' ) }
|
|
65
|
-
</Button>
|
|
66
|
-
</p>
|
|
67
|
-
<Button
|
|
68
|
-
size="small"
|
|
69
|
-
className="nux-dot-tip__disable"
|
|
70
|
-
icon={ close }
|
|
71
|
-
label={ __( 'Disable tips' ) }
|
|
72
|
-
onClick={ onDisable }
|
|
73
|
-
/>
|
|
74
|
-
</Popover>
|
|
75
|
-
);
|
|
6
|
+
export function DotTip() {
|
|
7
|
+
return null;
|
|
76
8
|
}
|
|
77
9
|
|
|
78
|
-
export default
|
|
79
|
-
withSelect( ( select, { tipId } ) => {
|
|
80
|
-
const { isTipVisible, getAssociatedGuide } = select( nuxStore );
|
|
81
|
-
const associatedGuide = getAssociatedGuide( tipId );
|
|
82
|
-
return {
|
|
83
|
-
isVisible: isTipVisible( tipId ),
|
|
84
|
-
hasNextTip: !! ( associatedGuide && associatedGuide.nextTipId ),
|
|
85
|
-
};
|
|
86
|
-
} ),
|
|
87
|
-
withDispatch( ( dispatch, { tipId } ) => {
|
|
88
|
-
const { dismissTip, disableTips } = dispatch( nuxStore );
|
|
89
|
-
return {
|
|
90
|
-
onDismiss() {
|
|
91
|
-
dismissTip( tipId );
|
|
92
|
-
},
|
|
93
|
-
onDisable() {
|
|
94
|
-
disableTips();
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
} )
|
|
98
|
-
)( DotTip );
|
|
10
|
+
export default DotTip;
|