@openedx/paragon 23.6.1 → 23.8.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.
- package/bin/paragon-scripts.js +5 -0
- package/dist/Alert/index.scss +5 -0
- package/dist/ProductTour/Checkpoint.js +23 -16
- package/dist/ProductTour/Checkpoint.js.map +1 -1
- package/dist/ProductTour/Checkpoint.scss +8 -36
- package/dist/ProductTour/CheckpointActionRow.js +17 -21
- package/dist/ProductTour/CheckpointActionRow.js.map +1 -1
- package/dist/ProductTour/CheckpointHeader.js +57 -0
- package/dist/ProductTour/CheckpointHeader.js.map +1 -0
- package/dist/ProductTour/index.js +120 -20
- package/dist/ProductTour/index.js.map +1 -1
- package/dist/ProductTour/messages.js +10 -0
- package/dist/core.css +11 -29
- package/dist/core.css.map +1 -1
- package/dist/core.min.css +1 -1
- package/dist/withDeprecatedProps.js +11 -3
- package/dist/withDeprecatedProps.js.map +1 -1
- package/lib/__tests__/build-tokens.test.js +19 -0
- package/lib/build-scss.js +1 -1
- package/lib/build-tokens.js +16 -12
- package/package.json +1 -1
- package/src/Alert/index.scss +5 -0
- package/src/ProductTour/Checkpoint.jsx +22 -16
- package/src/ProductTour/Checkpoint.scss +8 -36
- package/src/ProductTour/Checkpoint.test.jsx +20 -53
- package/src/ProductTour/CheckpointActionRow.jsx +32 -32
- package/src/ProductTour/CheckpointHeader.jsx +60 -0
- package/src/ProductTour/ProductTour.test.jsx +69 -60
- package/src/ProductTour/README.md +11 -3
- package/src/ProductTour/index.jsx +125 -17
- package/src/ProductTour/messages.js +10 -0
- package/src/withDeprecatedProps.tsx +10 -3
- package/dist/ProductTour/CheckpointBreadcrumbs.js +0 -37
- package/dist/ProductTour/CheckpointBreadcrumbs.js.map +0 -1
- package/dist/TransitionReplace/DemoTransitionReplace.js +0 -32
- package/dist/TransitionReplace/DemoTransitionReplace.js.map +0 -1
- package/src/ProductTour/CheckpointBreadcrumbs.jsx +0 -45
- package/src/TransitionReplace/DemoTransitionReplace.jsx +0 -57
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';
|
|
3
4
|
import Checkpoint from './Checkpoint';
|
|
4
5
|
const ProductTour = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
5
6
|
let {
|
|
@@ -12,10 +13,12 @@ const ProductTour = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
12
13
|
startingIndex,
|
|
13
14
|
onEscape,
|
|
14
15
|
onEnd,
|
|
16
|
+
onBack,
|
|
15
17
|
onDismiss: tourOnDismiss,
|
|
16
18
|
advanceButtonText: tourAdvanceButtonText,
|
|
17
|
-
|
|
18
|
-
endButtonText: tourEndButtonText
|
|
19
|
+
dismissAltText: tourDismissAltText,
|
|
20
|
+
endButtonText: tourEndButtonText,
|
|
21
|
+
backButtonText: tourBackButtonText
|
|
19
22
|
} = tourValue || {};
|
|
20
23
|
const [currentCheckpointData, setCurrentCheckpointData] = useState(null);
|
|
21
24
|
const [index, setIndex] = useState(0);
|
|
@@ -27,11 +30,11 @@ const ProductTour = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
27
30
|
onAdvance,
|
|
28
31
|
onDismiss,
|
|
29
32
|
advanceButtonText,
|
|
30
|
-
|
|
33
|
+
dismissAltText,
|
|
31
34
|
endButtonText,
|
|
35
|
+
backButtonText,
|
|
32
36
|
placement,
|
|
33
|
-
target
|
|
34
|
-
showDismissButton
|
|
37
|
+
target
|
|
35
38
|
} = currentCheckpointData || {};
|
|
36
39
|
|
|
37
40
|
/**
|
|
@@ -77,6 +80,12 @@ const ProductTour = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
77
80
|
onAdvance();
|
|
78
81
|
}
|
|
79
82
|
};
|
|
83
|
+
const handleBack = () => {
|
|
84
|
+
setIndex(index - 1);
|
|
85
|
+
if (onBack) {
|
|
86
|
+
onBack();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
80
89
|
const handleDismiss = () => {
|
|
81
90
|
setIndex(0);
|
|
82
91
|
setIsTourEnabled(false);
|
|
@@ -111,9 +120,11 @@ const ProductTour = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
111
120
|
advanceButtonText: advanceButtonText || tourAdvanceButtonText,
|
|
112
121
|
body: body,
|
|
113
122
|
currentCheckpointData: currentCheckpointData,
|
|
114
|
-
|
|
123
|
+
dismissAltText: dismissAltText || tourDismissAltText,
|
|
115
124
|
endButtonText: endButtonText || tourEndButtonText,
|
|
125
|
+
backButtonText: backButtonText || tourBackButtonText,
|
|
116
126
|
index: index,
|
|
127
|
+
onBack: handleBack,
|
|
117
128
|
onAdvance: handleAdvance,
|
|
118
129
|
onDismiss: handleDismiss,
|
|
119
130
|
onEnd: handleEnd,
|
|
@@ -121,26 +132,28 @@ const ProductTour = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
121
132
|
target: target,
|
|
122
133
|
title: title,
|
|
123
134
|
totalCheckpoints: prunedCheckpoints.length,
|
|
124
|
-
showDismissButton: showDismissButton,
|
|
125
135
|
ref: ref
|
|
126
136
|
});
|
|
127
137
|
});
|
|
128
138
|
ProductTour.defaultProps = {
|
|
129
139
|
tours: {
|
|
130
140
|
advanceButtonText: '',
|
|
141
|
+
backButtonText: '',
|
|
131
142
|
checkpoints: {
|
|
132
143
|
advanceButtonText: '',
|
|
144
|
+
backButtonText: '',
|
|
133
145
|
body: '',
|
|
134
|
-
|
|
146
|
+
dismissAltText: '',
|
|
135
147
|
endButtonText: '',
|
|
136
148
|
onAdvance: () => {},
|
|
137
149
|
onDismiss: () => {},
|
|
150
|
+
onBack: () => {},
|
|
138
151
|
placement: 'top',
|
|
139
|
-
title: ''
|
|
140
|
-
showDismissButton: undefined
|
|
152
|
+
title: ''
|
|
141
153
|
},
|
|
142
|
-
|
|
154
|
+
dismissAltText: '',
|
|
143
155
|
endButtonText: '',
|
|
156
|
+
onBack: () => {},
|
|
144
157
|
onDismiss: () => {},
|
|
145
158
|
onEnd: () => {},
|
|
146
159
|
onEscape: () => {},
|
|
@@ -151,16 +164,20 @@ ProductTour.propTypes = {
|
|
|
151
164
|
tours: PropTypes.arrayOf(PropTypes.shape({
|
|
152
165
|
/** The text displayed on all buttons used to advance the tour. */
|
|
153
166
|
advanceButtonText: PropTypes.node,
|
|
167
|
+
/** The text displayed on all buttons used to go back in the tour */
|
|
168
|
+
backButtonText: PropTypes.string,
|
|
154
169
|
/** An array comprised of checkpoint objects supporting the following values: */
|
|
155
170
|
checkpoints: PropTypes.arrayOf(PropTypes.shape({
|
|
156
171
|
/** The text displayed on the button used to advance the tour for the given Checkpoint
|
|
157
172
|
* (overrides the* `advanceButtonText` defined in the parent tour object). */
|
|
158
173
|
advanceButtonText: PropTypes.node,
|
|
174
|
+
/** The text displayed on the button used to go back in the tour for the given Checkpoint
|
|
175
|
+
* (overrides the* `backButtonText` defined in the parent tour object). */
|
|
176
|
+
backButtonText: PropTypes.string,
|
|
159
177
|
/** The text displayed in the body of the Checkpoint */
|
|
160
178
|
body: PropTypes.node,
|
|
161
|
-
/** The text
|
|
162
|
-
|
|
163
|
-
dismissButtonText: PropTypes.node,
|
|
179
|
+
/** The text used in the alt for the icon used to dismiss the tour for the given Checkpoint */
|
|
180
|
+
dismissAltText: PropTypes.string,
|
|
164
181
|
/** The text displayed on the button used to end the tour for the given Checkpoint
|
|
165
182
|
* (overrides the `endButtonText` defined in the parent tour object). */
|
|
166
183
|
endButtonText: PropTypes.node,
|
|
@@ -178,16 +195,16 @@ ProductTour.propTypes = {
|
|
|
178
195
|
/** The CSS selector for the Checkpoint's desired target. */
|
|
179
196
|
target: PropTypes.string.isRequired,
|
|
180
197
|
/** The text displayed in the title of the Checkpoint */
|
|
181
|
-
title: PropTypes.node
|
|
182
|
-
/** Enforces visibility of the dismiss button under all circumstances */
|
|
183
|
-
showDismissButton: PropTypes.bool
|
|
198
|
+
title: PropTypes.node
|
|
184
199
|
})),
|
|
185
|
-
/** The text
|
|
186
|
-
|
|
200
|
+
/** The text used in the alt for the icon used to dismiss the tour for the given Checkpoint */
|
|
201
|
+
dismissAltText: PropTypes.string,
|
|
187
202
|
/** Whether the tour is enabled. If there are multiple tours defined, only one should be enabled at a time. */
|
|
188
203
|
enabled: PropTypes.bool.isRequired,
|
|
189
204
|
/** The text displayed on the button used to end the tour. */
|
|
190
205
|
endButtonText: PropTypes.node,
|
|
206
|
+
/** A function that runs when triggering the `onBack` event of the back button. */
|
|
207
|
+
onBack: PropTypes.func,
|
|
191
208
|
/** A function that runs when triggering the `onClick` event of the dismiss button. */
|
|
192
209
|
onDismiss: PropTypes.func,
|
|
193
210
|
/** A function that runs when triggering the `onClick` event of the end button. */
|
|
@@ -200,5 +217,88 @@ ProductTour.propTypes = {
|
|
|
200
217
|
tourId: PropTypes.string.isRequired
|
|
201
218
|
}))
|
|
202
219
|
};
|
|
203
|
-
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Checks if the given object has a deprecated/legacy `dismissButtonText` property.
|
|
223
|
+
* @param {Object} obj - The object to check
|
|
224
|
+
* @returns {boolean} - True if the object has a deprecated/legacy `dismissButtonText` property, false otherwise
|
|
225
|
+
*/
|
|
226
|
+
const hasDismissButtonText = obj => {
|
|
227
|
+
if ('dismissButtonText' in obj && !!obj.dismissButtonText) {
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
return false;
|
|
231
|
+
};
|
|
232
|
+
export default withDeprecatedProps(ProductTour, 'ProductTour', {
|
|
233
|
+
tours: {
|
|
234
|
+
deprType: DeprTypes.FORMAT,
|
|
235
|
+
message: "The dismissButtonText options in the 'tours' prop have been moved to 'dismissAltText'.",
|
|
236
|
+
/**
|
|
237
|
+
* Determines whether the given prop value contains the deprecated/legacy `dismissButtonText` property.
|
|
238
|
+
* @param {Object[]} propValue - The tours prop value to check
|
|
239
|
+
* @returns {boolean} True if the prop value contains the deprecated/legacy `dismissButtonText`
|
|
240
|
+
* property, false otherwise
|
|
241
|
+
*/
|
|
242
|
+
expect: propValue => {
|
|
243
|
+
if (!Array.isArray(propValue)) {
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
return !propValue.some(tour => {
|
|
247
|
+
if (hasDismissButtonText(tour)) {
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
return Array.isArray(tour.checkpoints) && tour.checkpoints.some(hasDismissButtonText);
|
|
251
|
+
});
|
|
252
|
+
},
|
|
253
|
+
/**
|
|
254
|
+
* Transforms the given prop value by updating the
|
|
255
|
+
* deprecated/legacy `dismissButtonText` property to
|
|
256
|
+
* `dismissAltText`, if the prop value is a string. Otherwise,
|
|
257
|
+
* the original `dismissButtonText` property is ignored.
|
|
258
|
+
* @param {Object[]} propValue - The tours prop value to transform
|
|
259
|
+
* @returns {Object[]} The transformed prop value
|
|
260
|
+
*/
|
|
261
|
+
transform: propValue => {
|
|
262
|
+
const tours = propValue.map(tour => {
|
|
263
|
+
const updatedTour = {
|
|
264
|
+
...tour
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
// Replace tour level dismissButtonText with dismissAltText
|
|
268
|
+
if (hasDismissButtonText(tour)) {
|
|
269
|
+
if (typeof tour.dismissButtonText === 'string') {
|
|
270
|
+
updatedTour.dismissAltText = tour.dismissButtonText;
|
|
271
|
+
} else {
|
|
272
|
+
const warningMessage = "[Deprecated] ProductTour: The 'dismissButtonText' options within the 'tours' prop now expects a string";
|
|
273
|
+
// eslint-disable-next-line no-console
|
|
274
|
+
console.warn(warningMessage);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Replace checkpoint level dismissButtonText with dismissAltText
|
|
279
|
+
if (Array.isArray(tour.checkpoints)) {
|
|
280
|
+
updatedTour.checkpoints = tour.checkpoints.map(checkpoint => {
|
|
281
|
+
if (hasDismissButtonText(checkpoint)) {
|
|
282
|
+
const {
|
|
283
|
+
dismissButtonText,
|
|
284
|
+
...rest
|
|
285
|
+
} = checkpoint;
|
|
286
|
+
if (typeof dismissButtonText === 'string') {
|
|
287
|
+
return {
|
|
288
|
+
...rest,
|
|
289
|
+
dismissAltText: dismissButtonText
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return checkpoint;
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
return updatedTour;
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
// Return the transformed tours
|
|
300
|
+
return tours;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
});
|
|
204
304
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useEffect","useState","PropTypes","Checkpoint","ProductTour","forwardRef","_ref","ref","tours","tourValue","find","tour","enabled","checkpoints","startingIndex","onEscape","onEnd","onDismiss","tourOnDismiss","advanceButtonText","tourAdvanceButtonText","dismissButtonText","tourDismissButtonText","endButtonText","tourEndButtonText","currentCheckpointData","setCurrentCheckpointData","index","setIndex","isTourEnabled","setIsTourEnabled","prunedCheckpoints","setPrunedCheckpoints","title","body","onAdvance","placement","target","showDismissButton","pruneCheckpoints","checkpointList","checkpointsWithRenderedTargets","filter","checkpoint","document","querySelector","length","handleEsc","event","key","global","addEventListener","removeEventListener","handleAdvance","handleDismiss","handleEnd","checkpointIndex","createElement","totalCheckpoints","defaultProps","undefined","propTypes","arrayOf","shape","node","func","oneOf","string","isRequired","bool","number","tourId"],"sources":["../../src/ProductTour/index.jsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\n\nimport Checkpoint from './Checkpoint';\n\nconst ProductTour = React.forwardRef(({ tours }, ref) => {\n const tourValue = tours.find((tour) => tour.enabled);\n const {\n enabled, checkpoints = [], startingIndex, onEscape, onEnd, onDismiss: tourOnDismiss,\n advanceButtonText: tourAdvanceButtonText, dismissButtonText: tourDismissButtonText,\n endButtonText: tourEndButtonText,\n } = tourValue || {};\n const [currentCheckpointData, setCurrentCheckpointData] = useState(null);\n const [index, setIndex] = useState(0);\n const [isTourEnabled, setIsTourEnabled] = useState(false);\n const [prunedCheckpoints, setPrunedCheckpoints] = useState([]);\n const {\n title, body, onAdvance, onDismiss, advanceButtonText, dismissButtonText,\n endButtonText, placement, target, showDismissButton,\n } = currentCheckpointData || {};\n\n /**\n * Takes a list of checkpoints and verifies that each target string provided is\n * an element in the DOM.\n */\n const pruneCheckpoints = (checkpointList) => {\n const checkpointsWithRenderedTargets = checkpointList.filter(\n (checkpoint) => !!document.querySelector(checkpoint.target),\n );\n setPrunedCheckpoints(checkpointsWithRenderedTargets);\n };\n\n useEffect(() => {\n if (enabled && checkpoints) {\n setIsTourEnabled(enabled);\n pruneCheckpoints(checkpoints);\n setIndex(startingIndex || 0);\n }\n }, [enabled, checkpoints, startingIndex]);\n\n useEffect(() => {\n if (isTourEnabled && prunedCheckpoints.length) {\n setCurrentCheckpointData(prunedCheckpoints[index]);\n }\n }, [index, isTourEnabled, prunedCheckpoints]);\n\n useEffect(() => {\n const handleEsc = (event) => {\n if (event.key === 'Escape') {\n setIsTourEnabled(false);\n if (onEscape) {\n onEscape();\n }\n }\n };\n global.addEventListener('keydown', handleEsc);\n\n return () => {\n global.removeEventListener('keydown', handleEsc);\n };\n }, [onEscape]);\n\n if (!tourValue || !currentCheckpointData || !isTourEnabled) {\n return null;\n }\n\n const handleAdvance = () => {\n setIndex(index + 1);\n if (onAdvance) {\n onAdvance();\n }\n };\n\n const handleDismiss = () => {\n setIndex(0);\n setIsTourEnabled(false);\n if (onDismiss) {\n onDismiss();\n } else {\n tourOnDismiss();\n }\n setCurrentCheckpointData(null);\n };\n /* eslint-disable */\n /**\n * Takes the final checkpoint array index value and looks for an existing onEnd callback.\n * \n * If an onEnd callback exist on checkpointIndex value and it is the final checkpoint \n * in the array, the onEnd callback will be called for the parent, and individual onEnd object. \n * \n * @param {Integer} checkpointIndex \n */\n /* eslint-enable */\n const handleEnd = (checkpointIndex) => {\n setIndex(0);\n setIsTourEnabled(false);\n if (prunedCheckpoints[checkpointIndex].onEnd) {\n prunedCheckpoints[checkpointIndex].onEnd();\n } else if (onEnd) {\n onEnd(prunedCheckpoints[checkpointIndex]);\n }\n setCurrentCheckpointData(null);\n };\n return (\n <Checkpoint\n advanceButtonText={advanceButtonText || tourAdvanceButtonText}\n body={body}\n currentCheckpointData={currentCheckpointData}\n dismissButtonText={dismissButtonText || tourDismissButtonText}\n endButtonText={endButtonText || tourEndButtonText}\n index={index}\n onAdvance={handleAdvance}\n onDismiss={handleDismiss}\n onEnd={handleEnd}\n placement={placement}\n target={target}\n title={title}\n totalCheckpoints={prunedCheckpoints.length}\n showDismissButton={showDismissButton}\n ref={ref}\n />\n );\n});\n\nProductTour.defaultProps = {\n tours: {\n advanceButtonText: '',\n checkpoints: {\n advanceButtonText: '',\n body: '',\n dismissButtonText: '',\n endButtonText: '',\n onAdvance: () => {},\n onDismiss: () => {},\n placement: 'top',\n title: '',\n showDismissButton: undefined,\n },\n dismissButtonText: '',\n endButtonText: '',\n onDismiss: () => {},\n onEnd: () => {},\n onEscape: () => {},\n startingIndex: 0,\n },\n};\n\nProductTour.propTypes = {\n tours: PropTypes.arrayOf(PropTypes.shape({\n /** The text displayed on all buttons used to advance the tour. */\n advanceButtonText: PropTypes.node,\n /** An array comprised of checkpoint objects supporting the following values: */\n checkpoints: PropTypes.arrayOf(PropTypes.shape({\n /** The text displayed on the button used to advance the tour for the given Checkpoint\n * (overrides the* `advanceButtonText` defined in the parent tour object). */\n advanceButtonText: PropTypes.node,\n /** The text displayed in the body of the Checkpoint */\n body: PropTypes.node,\n /** The text displayed on the button used to dismiss the tour for the given Checkpoint\n * (overrides the `dismissButtonText` defined in the parent tour object). */\n dismissButtonText: PropTypes.node,\n /** The text displayed on the button used to end the tour for the given Checkpoint\n * (overrides the `endButtonText` defined in the parent tour object). */\n endButtonText: PropTypes.node,\n /** A function that runs when triggering the `onClick` event of the advance\n * button for the given Checkpoint. */\n onAdvance: PropTypes.func,\n /** A function that runs when triggering the `onClick` event of the dismiss\n * button for the given Checkpoint (overrides the `onDismiss` function defined in the parent tour object). */\n onDismiss: PropTypes.func,\n /** A function that runs when triggering the `onClick` event of the advance\n * button if the given Checkpoint is the only or last Checkpoint in a tour. */\n onEnd: PropTypes.func,\n /** A string that dictates the alignment of the Checkpoint around its target. */\n placement: PropTypes.oneOf([\n 'top', 'top-start', 'top-end', 'right-start', 'right', 'right-end',\n 'left-start', 'left', 'left-end', 'bottom', 'bottom-start', 'bottom-end',\n ]),\n /** The CSS selector for the Checkpoint's desired target. */\n target: PropTypes.string.isRequired,\n /** The text displayed in the title of the Checkpoint */\n title: PropTypes.node,\n /** Enforces visibility of the dismiss button under all circumstances */\n showDismissButton: PropTypes.bool,\n })),\n /** The text displayed on the button used to dismiss the tour. */\n dismissButtonText: PropTypes.node,\n /** Whether the tour is enabled. If there are multiple tours defined, only one should be enabled at a time. */\n enabled: PropTypes.bool.isRequired,\n /** The text displayed on the button used to end the tour. */\n endButtonText: PropTypes.node,\n /** A function that runs when triggering the `onClick` event of the dismiss button. */\n onDismiss: PropTypes.func,\n /** A function that runs when triggering the `onClick` event of the end button. */\n onEnd: PropTypes.func,\n /** A function that runs when pressing the Escape key. */\n onEscape: PropTypes.func,\n /** The index of the desired `Checkpoint` to render when the tour starts. */\n startingIndex: PropTypes.number,\n /** The ID of the tour */\n tourId: PropTypes.string.isRequired,\n })),\n};\n\nexport default ProductTour;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,UAAU,MAAM,cAAc;AAErC,MAAMC,WAAW,gBAAGL,KAAK,CAACM,UAAU,CAAC,CAAAC,IAAA,EAAYC,GAAG,KAAK;EAAA,IAAnB;IAAEC;EAAM,CAAC,GAAAF,IAAA;EAC7C,MAAMG,SAAS,GAAGD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;MACnC;MACAnC,KAAK,EAAE/B,SAAS,CAAC8D,IAAI;MACrB;MACA1B,iBAAiB,EAAEpC,SAAS,CAACmE;IAC/B,CAAC,CAAC,CAAC;IACH;IACAhD,iBAAiB,EAAEnB,SAAS,CAAC8D,IAAI;IACjC;IACApD,OAAO,EAAEV,SAAS,CAACmE,IAAI,CAACD,UAAU;IAClC;IACA7C,aAAa,EAAErB,SAAS,CAAC8D,IAAI;IAC7B;IACA/C,SAAS,EAAEf,SAAS,CAAC+D,IAAI;IACzB;IACAjD,KAAK,EAAEd,SAAS,CAAC+D,IAAI;IACrB;IACAlD,QAAQ,EAAEb,SAAS,CAAC+D,IAAI;IACxB;IACAnD,aAAa,EAAEZ,SAAS,CAACoE,MAAM;IAC/B;IACAC,MAAM,EAAErE,SAAS,CAACiE,MAAM,CAACC;EAC3B,CAAC,CAAC;AACJ,CAAC;AAED,eAAehE,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useEffect","useState","PropTypes","withDeprecatedProps","DeprTypes","Checkpoint","ProductTour","forwardRef","_ref","ref","tours","tourValue","find","tour","enabled","checkpoints","startingIndex","onEscape","onEnd","onBack","onDismiss","tourOnDismiss","advanceButtonText","tourAdvanceButtonText","dismissAltText","tourDismissAltText","endButtonText","tourEndButtonText","backButtonText","tourBackButtonText","currentCheckpointData","setCurrentCheckpointData","index","setIndex","isTourEnabled","setIsTourEnabled","prunedCheckpoints","setPrunedCheckpoints","title","body","onAdvance","placement","target","pruneCheckpoints","checkpointList","checkpointsWithRenderedTargets","filter","checkpoint","document","querySelector","length","handleEsc","event","key","global","addEventListener","removeEventListener","handleAdvance","handleBack","handleDismiss","handleEnd","checkpointIndex","createElement","totalCheckpoints","defaultProps","propTypes","arrayOf","shape","node","string","func","oneOf","isRequired","bool","number","tourId","hasDismissButtonText","obj","dismissButtonText","deprType","FORMAT","message","expect","propValue","Array","isArray","some","transform","map","updatedTour","warningMessage","console","warn","rest"],"sources":["../../src/ProductTour/index.jsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\nimport Checkpoint from './Checkpoint';\n\nconst ProductTour = React.forwardRef(({ tours }, ref) => {\n const tourValue = tours.find((tour) => tour.enabled);\n const {\n enabled,\n checkpoints = [],\n startingIndex,\n onEscape,\n onEnd,\n onBack,\n onDismiss: tourOnDismiss,\n advanceButtonText: tourAdvanceButtonText,\n dismissAltText: tourDismissAltText,\n endButtonText: tourEndButtonText,\n backButtonText: tourBackButtonText,\n } = tourValue || {};\n const [currentCheckpointData, setCurrentCheckpointData] = useState(null);\n const [index, setIndex] = useState(0);\n const [isTourEnabled, setIsTourEnabled] = useState(false);\n const [prunedCheckpoints, setPrunedCheckpoints] = useState([]);\n const {\n title,\n body,\n onAdvance,\n onDismiss,\n advanceButtonText,\n dismissAltText,\n endButtonText,\n backButtonText,\n placement,\n target,\n } = currentCheckpointData || {};\n\n /**\n * Takes a list of checkpoints and verifies that each target string provided is\n * an element in the DOM.\n */\n const pruneCheckpoints = (checkpointList) => {\n const checkpointsWithRenderedTargets = checkpointList.filter(\n (checkpoint) => !!document.querySelector(checkpoint.target),\n );\n setPrunedCheckpoints(checkpointsWithRenderedTargets);\n };\n\n useEffect(() => {\n if (enabled && checkpoints) {\n setIsTourEnabled(enabled);\n pruneCheckpoints(checkpoints);\n setIndex(startingIndex || 0);\n }\n }, [enabled, checkpoints, startingIndex]);\n\n useEffect(() => {\n if (isTourEnabled && prunedCheckpoints.length) {\n setCurrentCheckpointData(prunedCheckpoints[index]);\n }\n }, [index, isTourEnabled, prunedCheckpoints]);\n\n useEffect(() => {\n const handleEsc = (event) => {\n if (event.key === 'Escape') {\n setIsTourEnabled(false);\n if (onEscape) {\n onEscape();\n }\n }\n };\n global.addEventListener('keydown', handleEsc);\n\n return () => {\n global.removeEventListener('keydown', handleEsc);\n };\n }, [onEscape]);\n\n if (!tourValue || !currentCheckpointData || !isTourEnabled) {\n return null;\n }\n\n const handleAdvance = () => {\n setIndex(index + 1);\n if (onAdvance) {\n onAdvance();\n }\n };\n\n const handleBack = () => {\n setIndex(index - 1);\n if (onBack) {\n onBack();\n }\n };\n\n const handleDismiss = () => {\n setIndex(0);\n setIsTourEnabled(false);\n if (onDismiss) {\n onDismiss();\n } else {\n tourOnDismiss();\n }\n setCurrentCheckpointData(null);\n };\n /* eslint-disable */\n /**\n * Takes the final checkpoint array index value and looks for an existing onEnd callback.\n * \n * If an onEnd callback exist on checkpointIndex value and it is the final checkpoint \n * in the array, the onEnd callback will be called for the parent, and individual onEnd object. \n * \n * @param {Integer} checkpointIndex \n */\n /* eslint-enable */\n const handleEnd = (checkpointIndex) => {\n setIndex(0);\n setIsTourEnabled(false);\n if (prunedCheckpoints[checkpointIndex].onEnd) {\n prunedCheckpoints[checkpointIndex].onEnd();\n } else if (onEnd) {\n onEnd(prunedCheckpoints[checkpointIndex]);\n }\n setCurrentCheckpointData(null);\n };\n return (\n <Checkpoint\n advanceButtonText={advanceButtonText || tourAdvanceButtonText}\n body={body}\n currentCheckpointData={currentCheckpointData}\n dismissAltText={dismissAltText || tourDismissAltText}\n endButtonText={endButtonText || tourEndButtonText}\n backButtonText={backButtonText || tourBackButtonText}\n index={index}\n onBack={handleBack}\n onAdvance={handleAdvance}\n onDismiss={handleDismiss}\n onEnd={handleEnd}\n placement={placement}\n target={target}\n title={title}\n totalCheckpoints={prunedCheckpoints.length}\n ref={ref}\n />\n );\n});\n\nProductTour.defaultProps = {\n tours: {\n advanceButtonText: '',\n backButtonText: '',\n checkpoints: {\n advanceButtonText: '',\n backButtonText: '',\n body: '',\n dismissAltText: '',\n endButtonText: '',\n onAdvance: () => {},\n onDismiss: () => {},\n onBack: () => {},\n placement: 'top',\n title: '',\n },\n dismissAltText: '',\n endButtonText: '',\n onBack: () => {},\n onDismiss: () => {},\n onEnd: () => {},\n onEscape: () => {},\n startingIndex: 0,\n },\n};\n\nProductTour.propTypes = {\n tours: PropTypes.arrayOf(PropTypes.shape({\n /** The text displayed on all buttons used to advance the tour. */\n advanceButtonText: PropTypes.node,\n /** The text displayed on all buttons used to go back in the tour */\n backButtonText: PropTypes.string,\n /** An array comprised of checkpoint objects supporting the following values: */\n checkpoints: PropTypes.arrayOf(PropTypes.shape({\n /** The text displayed on the button used to advance the tour for the given Checkpoint\n * (overrides the* `advanceButtonText` defined in the parent tour object). */\n advanceButtonText: PropTypes.node,\n /** The text displayed on the button used to go back in the tour for the given Checkpoint\n * (overrides the* `backButtonText` defined in the parent tour object). */\n backButtonText: PropTypes.string,\n /** The text displayed in the body of the Checkpoint */\n body: PropTypes.node,\n /** The text used in the alt for the icon used to dismiss the tour for the given Checkpoint */\n dismissAltText: PropTypes.string,\n /** The text displayed on the button used to end the tour for the given Checkpoint\n * (overrides the `endButtonText` defined in the parent tour object). */\n endButtonText: PropTypes.node,\n /** A function that runs when triggering the `onClick` event of the advance\n * button for the given Checkpoint. */\n onAdvance: PropTypes.func,\n /** A function that runs when triggering the `onClick` event of the dismiss\n * button for the given Checkpoint (overrides the `onDismiss` function defined in the parent tour object). */\n onDismiss: PropTypes.func,\n /** A function that runs when triggering the `onClick` event of the advance\n * button if the given Checkpoint is the only or last Checkpoint in a tour. */\n onEnd: PropTypes.func,\n /** A string that dictates the alignment of the Checkpoint around its target. */\n placement: PropTypes.oneOf([\n 'top', 'top-start', 'top-end', 'right-start', 'right', 'right-end',\n 'left-start', 'left', 'left-end', 'bottom', 'bottom-start', 'bottom-end',\n ]),\n /** The CSS selector for the Checkpoint's desired target. */\n target: PropTypes.string.isRequired,\n /** The text displayed in the title of the Checkpoint */\n title: PropTypes.node,\n })),\n /** The text used in the alt for the icon used to dismiss the tour for the given Checkpoint */\n dismissAltText: PropTypes.string,\n /** Whether the tour is enabled. If there are multiple tours defined, only one should be enabled at a time. */\n enabled: PropTypes.bool.isRequired,\n /** The text displayed on the button used to end the tour. */\n endButtonText: PropTypes.node,\n /** A function that runs when triggering the `onBack` event of the back button. */\n onBack: PropTypes.func,\n /** A function that runs when triggering the `onClick` event of the dismiss button. */\n onDismiss: PropTypes.func,\n /** A function that runs when triggering the `onClick` event of the end button. */\n onEnd: PropTypes.func,\n /** A function that runs when pressing the Escape key. */\n onEscape: PropTypes.func,\n /** The index of the desired `Checkpoint` to render when the tour starts. */\n startingIndex: PropTypes.number,\n /** The ID of the tour */\n tourId: PropTypes.string.isRequired,\n })),\n};\n\n/**\n * Checks if the given object has a deprecated/legacy `dismissButtonText` property.\n * @param {Object} obj - The object to check\n * @returns {boolean} - True if the object has a deprecated/legacy `dismissButtonText` property, false otherwise\n */\nconst hasDismissButtonText = (obj) => {\n if ('dismissButtonText' in obj && !!obj.dismissButtonText) {\n return true;\n }\n return false;\n};\n\nexport default withDeprecatedProps(ProductTour, 'ProductTour', {\n tours: {\n deprType: DeprTypes.FORMAT,\n message: \"The dismissButtonText options in the 'tours' prop have been moved to 'dismissAltText'.\",\n /**\n * Determines whether the given prop value contains the deprecated/legacy `dismissButtonText` property.\n * @param {Object[]} propValue - The tours prop value to check\n * @returns {boolean} True if the prop value contains the deprecated/legacy `dismissButtonText`\n * property, false otherwise\n */\n expect: (propValue) => {\n if (!Array.isArray(propValue)) {\n return true;\n }\n return !propValue.some((tour) => {\n if (hasDismissButtonText(tour)) {\n return true;\n }\n return Array.isArray(tour.checkpoints)\n && tour.checkpoints.some(hasDismissButtonText);\n });\n },\n /**\n * Transforms the given prop value by updating the\n * deprecated/legacy `dismissButtonText` property to\n * `dismissAltText`, if the prop value is a string. Otherwise,\n * the original `dismissButtonText` property is ignored.\n * @param {Object[]} propValue - The tours prop value to transform\n * @returns {Object[]} The transformed prop value\n */\n transform: (propValue) => {\n const tours = propValue.map((tour) => {\n const updatedTour = { ...tour };\n\n // Replace tour level dismissButtonText with dismissAltText\n if (hasDismissButtonText(tour)) {\n if (typeof tour.dismissButtonText === 'string') {\n updatedTour.dismissAltText = tour.dismissButtonText;\n } else {\n const warningMessage = \"[Deprecated] ProductTour: The 'dismissButtonText' options within the 'tours' prop now expects a string\";\n // eslint-disable-next-line no-console\n console.warn(warningMessage);\n }\n }\n\n // Replace checkpoint level dismissButtonText with dismissAltText\n if (Array.isArray(tour.checkpoints)) {\n updatedTour.checkpoints = tour.checkpoints.map((checkpoint) => {\n if (hasDismissButtonText(checkpoint)) {\n const { dismissButtonText, ...rest } = checkpoint;\n if (typeof dismissButtonText === 'string') {\n return { ...rest, dismissAltText: dismissButtonText };\n }\n }\n return checkpoint;\n });\n }\n return updatedTour;\n });\n\n // Return the transformed tours\n return tours;\n },\n },\n});\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,mBAAmB,IAAIC,SAAS,QAAQ,wBAAwB;AAEvE,OAAOC,UAAU,MAAM,cAAc;AAErC,MAAMC,WAAW,gBAAGP,KAAK,CAACQ,UAAU,CAAC,CAAAC,IAAA,EAAYC,GAAG,KAAK;EAAA,IAAnB;IAAEC;EAAM,CAAC,GAAAF,IAAA;EAC7C,MAAMG,SAAS,GAAGD,KAAK,CAACE,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAACC,OAAO,CAAC;EACpD,MAAM;IACJA,OAAO;IACPC,WAAW,GAAG,EAAE;IAChBC,aAAa;IACbC,QAAQ;IACRC,KAAK;IACLC,MAAM;IACNC,SAAS,EAAEC,aAAa;IACxBC,iBAAiB,EAAEC,qBAAqB;IACxCC,cAAc,EAAEC,kBAAkB;IAClCC,aAAa,EAAEC,iBAAiB;IAChCC,cAAc,EAAEC;EAClB,CAAC,GAAGlB,SAAS,IAAI,CAAC,CAAC;EACnB,MAAM,CAACmB,qBAAqB,EAAEC,wBAAwB,CAAC,GAAG9B,QAAQ,CAAC,IAAI,CAAC;EACxE,MAAM,CAAC+B,KAAK,EAAEC,QAAQ,CAAC,GAAGhC,QAAQ,CAAC,CAAC,CAAC;EACrC,MAAM,CAACi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K;MACxB,MAAMzE,KAAK,GAAGyE,SAAS,CAACK,GAAG,CAAE3E,IAAI,IAAK;QACpC,MAAM4E,WAAW,GAAG;UAAE,GAAG5E;QAAK,CAAC;;QAE/B;QACA,IAAI+D,oBAAoB,CAAC/D,IAAI,CAAC,EAAE;UAC9B,IAAI,OAAOA,IAAI,CAACiE,iBAAiB,KAAK,QAAQ,EAAE;YAC9CW,WAAW,CAACjE,cAAc,GAAGX,IAAI,CAACiE,iBAAiB;UACrD,CAAC,MAAM;YACL,MAAMY,cAAc,GAAG,wGAAwG;YAC/H;YACAC,OAAO,CAACC,IAAI,CAACF,cAAc,CAAC;UAC9B;QACF;;QAEA;QACA,IAAIN,KAAK,CAACC,OAAO,CAACxE,IAAI,CAACE,WAAW,CAAC,EAAE;UACnC0E,WAAW,CAAC1E,WAAW,GAAGF,IAAI,CAACE,WAAW,CAACyE,GAAG,CAAEzC,UAAU,IAAK;YAC7D,IAAI6B,oBAAoB,CAAC7B,UAAU,CAAC,EAAE;cACpC,MAAM;gBAAE+B,iBAAiB;gBAAE,GAAGe;cAAK,CAAC,GAAG9C,UAAU;cACjD,IAAI,OAAO+B,iBAAiB,KAAK,QAAQ,EAAE;gBACzC,OAAO;kBAAE,GAAGe,IAAI;kBAAErE,cAAc,EAAEsD;gBAAkB,CAAC;cACvD;YACF;YACA,OAAO/B,UAAU;UACnB,CAAC,CAAC;QACJ;QACA,OAAO0C,WAAW;MACpB,CAAC,CAAC;;MAEF;MACA,OAAO/E,KAAK;IACd;EACF;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -11,6 +11,16 @@ const messages = defineMessages({
|
|
|
11
11
|
defaultMessage: 'Bottom of step {step}',
|
|
12
12
|
description: 'Screen-reader message to notify user that they are located at the bottom of the product tour step.',
|
|
13
13
|
},
|
|
14
|
+
pageIndexText: {
|
|
15
|
+
id: 'pgn.ProductTour.Checkpoint.page-index-text',
|
|
16
|
+
defaultMessage: '{step} of {totalSteps}',
|
|
17
|
+
description: 'Page index showing your place in the ProductTour',
|
|
18
|
+
},
|
|
19
|
+
closeAltText: {
|
|
20
|
+
id: 'pgn.ProductTour.checkpointHeader.close',
|
|
21
|
+
defaultMessage: 'Close tour',
|
|
22
|
+
description: 'Close alternative text for ProductTour component',
|
|
23
|
+
},
|
|
14
24
|
});
|
|
15
25
|
|
|
16
26
|
export default messages;
|
package/dist/core.css
CHANGED
|
@@ -8999,9 +8999,13 @@ p > a.brand-link[href]:not(.btn):hover, a.brand-link.inline-link:hover {
|
|
|
8999
8999
|
border: var(--pgn-size-alert-border-width) solid var(--pgn-alert-border-color, transparent);
|
|
9000
9000
|
color: inherit;
|
|
9001
9001
|
background-color: var(--pgn-alert-bg, transparent);
|
|
9002
|
+
align-items: center;
|
|
9002
9003
|
border-radius: var(--pgn-size-alert-border-radius);
|
|
9003
9004
|
box-shadow: var(--pgn-elevation-box-shadow-down-1);
|
|
9004
9005
|
}
|
|
9006
|
+
.alert:has(.alert-heading:not(:only-child)) {
|
|
9007
|
+
align-items: start;
|
|
9008
|
+
}
|
|
9005
9009
|
.alert .alert-message-content > :last-child {
|
|
9006
9010
|
margin-bottom: 0;
|
|
9007
9011
|
}
|
|
@@ -16771,7 +16775,7 @@ select.form-control {
|
|
|
16771
16775
|
background: var(--pgn-color-product-tour-checkpoint-bg);
|
|
16772
16776
|
border-top: var(--pgn-size-product-tour-checkpoint-width-border) solid var(--pgn-color-product-tour-checkpoint-border);
|
|
16773
16777
|
border-radius: var(--pgn-size-border-radius-base);
|
|
16774
|
-
padding: var(--pgn-spacing-spacer-
|
|
16778
|
+
padding: var(--pgn-spacing-spacer-3-5);
|
|
16775
16779
|
box-shadow: 0 0.25rem 0.5rem var(--pgn-color-product-tour-checkpoint-box-shadow);
|
|
16776
16780
|
z-index: var(--pgn-elevation-product-tour-checkpoint-zindex);
|
|
16777
16781
|
max-width: var(--pgn-size-product-tour-checkpoint-width-max);
|
|
@@ -16810,32 +16814,6 @@ select.form-control {
|
|
|
16810
16814
|
.pgn__checkpoint .pgn__checkpoint-button_dismiss {
|
|
16811
16815
|
margin-inline-end: var(--pgn-spacing-spacer-2);
|
|
16812
16816
|
}
|
|
16813
|
-
.pgn__checkpoint .pgn__checkpoint-breadcrumb {
|
|
16814
|
-
height: 6px;
|
|
16815
|
-
width: 6px;
|
|
16816
|
-
border-radius: 50%;
|
|
16817
|
-
}
|
|
16818
|
-
.pgn__checkpoint .pgn__checkpoint-breadcrumb.pgn__checkpoint-breadcrumb_active {
|
|
16819
|
-
background: var(--pgn-color-product-tour-checkpoint-breadcrumb);
|
|
16820
|
-
}
|
|
16821
|
-
.pgn__checkpoint .pgn__checkpoint-breadcrumb.pgn__checkpoint-breadcrumb_inactive {
|
|
16822
|
-
border: 1px solid var(--pgn-color-product-tour-checkpoint-breadcrumb);
|
|
16823
|
-
background: transparent;
|
|
16824
|
-
}
|
|
16825
|
-
.pgn__checkpoint .pgn__checkpoint-breadcrumb:not(:first-child) {
|
|
16826
|
-
margin-left: calc(var(--pgn-spacing-spacer-base) * 0.375);
|
|
16827
|
-
}
|
|
16828
|
-
[dir=rtl] .pgn__checkpoint .pgn__checkpoint-breadcrumb {
|
|
16829
|
-
margin-left: calc(var(--pgn-spacing-spacer-base) * 0.375);
|
|
16830
|
-
margin-right: 0;
|
|
16831
|
-
}
|
|
16832
|
-
[dir=rtl] .pgn__checkpoint .pgn__checkpoint-breadcrumb:last-child {
|
|
16833
|
-
margin-left: 0;
|
|
16834
|
-
}
|
|
16835
|
-
.pgn__checkpoint .pgn__checkpoint-breadcrumb-container {
|
|
16836
|
-
display: flex;
|
|
16837
|
-
align-items: center;
|
|
16838
|
-
}
|
|
16839
16817
|
.pgn__checkpoint .pgn__checkpoint-body {
|
|
16840
16818
|
color: var(--pgn-color-product-tour-checkpoint-body);
|
|
16841
16819
|
margin-bottom: calc(var(--pgn-spacing-spacer-base) * 1.25);
|
|
@@ -16844,12 +16822,16 @@ select.form-control {
|
|
|
16844
16822
|
.pgn__checkpoint .pgn__checkpoint-header {
|
|
16845
16823
|
display: flex;
|
|
16846
16824
|
justify-content: space-between;
|
|
16847
|
-
margin-bottom: calc(var(--pgn-spacing-spacer-base) * 0.
|
|
16825
|
+
margin-bottom: calc(var(--pgn-spacing-spacer-base) * 0.5);
|
|
16826
|
+
align-items: center;
|
|
16848
16827
|
}
|
|
16849
16828
|
.pgn__checkpoint #pgn__checkpoint-title {
|
|
16850
16829
|
font-size: var(--pgn-typography-font-size-h3-base);
|
|
16851
16830
|
margin-inline-end: calc(var(--pgn-spacing-spacer-base) * 0.75);
|
|
16852
|
-
margin-bottom: 0;
|
|
16831
|
+
margin-bottom: calc(var(--pgn-spacing-spacer-base) * 0.5);
|
|
16832
|
+
}
|
|
16833
|
+
.pgn__checkpoint .pgn__checkpoint-page-index {
|
|
16834
|
+
font-size: var(--pgn-typography-font-size-sm);
|
|
16853
16835
|
}
|
|
16854
16836
|
.pgn__checkpoint[data-popper-placement^=top] > #pgn__checkpoint-arrow {
|
|
16855
16837
|
left: calc(var(--pgn-size-product-tour-checkpoint-width-arrow) * -1) !important;
|