@openedx/paragon 23.6.0 → 23.7.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.
Files changed (39) hide show
  1. package/dist/Alert/index.scss +5 -0
  2. package/dist/Button/_mixins.scss +51 -2
  3. package/dist/Button/button-group.scss +7 -4
  4. package/dist/ProductTour/Checkpoint.js +23 -16
  5. package/dist/ProductTour/Checkpoint.js.map +1 -1
  6. package/dist/ProductTour/Checkpoint.scss +8 -36
  7. package/dist/ProductTour/CheckpointActionRow.js +17 -21
  8. package/dist/ProductTour/CheckpointActionRow.js.map +1 -1
  9. package/dist/ProductTour/CheckpointHeader.js +57 -0
  10. package/dist/ProductTour/CheckpointHeader.js.map +1 -0
  11. package/dist/ProductTour/index.js +120 -20
  12. package/dist/ProductTour/index.js.map +1 -1
  13. package/dist/ProductTour/messages.js +10 -0
  14. package/dist/core.css +56 -31
  15. package/dist/core.css.map +1 -1
  16. package/dist/core.min.css +1 -1
  17. package/dist/withDeprecatedProps.js +11 -3
  18. package/dist/withDeprecatedProps.js.map +1 -1
  19. package/lib/build-scss.js +1 -1
  20. package/package.json +1 -1
  21. package/src/Alert/index.scss +5 -0
  22. package/src/Button/_mixins.scss +51 -2
  23. package/src/Button/button-group.scss +7 -4
  24. package/src/ProductTour/Checkpoint.jsx +22 -16
  25. package/src/ProductTour/Checkpoint.scss +8 -36
  26. package/src/ProductTour/Checkpoint.test.jsx +20 -53
  27. package/src/ProductTour/CheckpointActionRow.jsx +32 -32
  28. package/src/ProductTour/CheckpointHeader.jsx +60 -0
  29. package/src/ProductTour/ProductTour.test.jsx +69 -60
  30. package/src/ProductTour/README.md +11 -3
  31. package/src/ProductTour/index.jsx +125 -17
  32. package/src/ProductTour/messages.js +10 -0
  33. package/src/withDeprecatedProps.tsx +10 -3
  34. package/dist/ProductTour/CheckpointBreadcrumbs.js +0 -37
  35. package/dist/ProductTour/CheckpointBreadcrumbs.js.map +0 -1
  36. package/dist/TransitionReplace/DemoTransitionReplace.js +0 -32
  37. package/dist/TransitionReplace/DemoTransitionReplace.js.map +0 -1
  38. package/src/ProductTour/CheckpointBreadcrumbs.jsx +0 -45
  39. package/src/TransitionReplace/DemoTransitionReplace.jsx +0 -57
@@ -15,10 +15,15 @@
15
15
  border: var(--pgn-size-alert-border-width) solid var(--pgn-alert-border-color, transparent);
16
16
  color: inherit;
17
17
  background-color: var(--pgn-alert-bg, transparent);
18
+ align-items: center;
18
19
 
19
20
  @include border-radius(var(--pgn-size-alert-border-radius));
20
21
  @include pgn-box-shadow(1, "down");
21
22
 
23
+ &:has(.alert-heading:not(:only-child)) {
24
+ align-items: start;
25
+ }
26
+
22
27
  .alert-message-content > :last-child {
23
28
  margin-bottom: 0;
24
29
  }
@@ -1,7 +1,10 @@
1
- // OVERRIDE FROM BOOTSTRAP
2
- // No changes made. We do this to keep all button related mixins together,
3
1
  //
2
+ // Includes common mixins related to button styles.
3
+ //
4
+
4
5
  // Button sizes
6
+ // OVERRIDE FROM BOOTSTRAP
7
+ // No changes made. We do this to keep all button related mixins together,
5
8
  @mixin button-size($padding-y, $padding-x, $font-size, $line-height, $button-border-radius) {
6
9
  padding: $padding-y $padding-x;
7
10
 
@@ -12,3 +15,49 @@
12
15
  // Manually declare to provide an override to the browser default
13
16
  @include border-radius($button-border-radius, 0);
14
17
  }
18
+
19
+ // Mixin for button states that affect border radius
20
+ @mixin button-border-radius-0($side) {
21
+ @if $side == 'right' {
22
+ @include border-right-radius(0);
23
+ }
24
+
25
+ @if $side == 'left' {
26
+ @include border-left-radius(0);
27
+ }
28
+
29
+ // Handle pseudo-classes
30
+ &.btn:not(:disabled, .disabled):focus,
31
+ &.btn:not(:disabled, .disabled):focus::before {
32
+ @if $side == 'left' {
33
+ @include border-left-radius(0);
34
+ }
35
+
36
+ @if $side == 'right' {
37
+ @include border-right-radius(0);
38
+ }
39
+ }
40
+
41
+ &.btn:not(:disabled, .disabled):active,
42
+ &.btn:not(:disabled, .disabled):active::before {
43
+ @if $side == 'left' {
44
+ @include border-left-radius(0);
45
+ }
46
+
47
+ @if $side == 'right' {
48
+ @include border-right-radius(0);
49
+ }
50
+ }
51
+
52
+ // Handle .active class
53
+ &.btn:not(:disabled, .disabled).active,
54
+ &.btn:not(:disabled, .disabled).active::before {
55
+ @if $side == 'right' {
56
+ @include border-right-radius(0);
57
+ }
58
+
59
+ @if $side == 'left' {
60
+ @include border-left-radius(0);
61
+ }
62
+ }
63
+ }
@@ -15,7 +15,7 @@
15
15
  &:focus,
16
16
  &:active,
17
17
  &.active {
18
- z-index: 1;
18
+ z-index: 2;
19
19
  }
20
20
  }
21
21
  }
@@ -36,14 +36,17 @@
36
36
  margin-left: calc(var(--pgn-size-btn-border-width) * -1);
37
37
  }
38
38
 
39
+ // Right border radius for non-last buttons
40
+ > .btn:not(:last-child, .dropdown-toggle, :first-child),
39
41
  > .btn:not(:last-child, .dropdown-toggle),
40
42
  > .btn-group:not(:last-child) > .btn {
41
- @include border-right-radius(0);
43
+ @include button-border-radius-0('right');
42
44
  }
43
45
 
44
- > .btn:not(:first-child),
46
+ // Left border radius for non-first buttons
47
+ > .btn:not(:first-child, .dropdown-toggle),
45
48
  > .btn-group:not(:first-child) > .btn {
46
- @include border-left-radius(0);
49
+ @include button-border-radius-0('left');
47
50
  }
48
51
  }
49
52
 
@@ -6,13 +6,15 @@ import { FormattedMessage } from 'react-intl';
6
6
  import breakpoints from '../utils/breakpoints';
7
7
  import CheckpointActionRow from './CheckpointActionRow';
8
8
  import CheckpointBody from './CheckpointBody';
9
- import CheckpointBreadcrumbs from './CheckpointBreadcrumbs';
10
- import CheckpointTitle from './CheckpointTitle';
9
+ import CheckpointHeader from './CheckpointHeader';
11
10
  import messages from './messages';
12
11
  const Checkpoint = /*#__PURE__*/React.forwardRef((_ref, ref) => {
13
12
  let {
14
13
  body,
14
+ dismissAltText,
15
15
  index,
16
+ onBack,
17
+ onDismiss,
16
18
  placement,
17
19
  target,
18
20
  title,
@@ -79,7 +81,6 @@ const Checkpoint = /*#__PURE__*/React.forwardRef((_ref, ref) => {
79
81
  }
80
82
  }, [target, checkpointVisible, placement]);
81
83
  const isLastCheckpoint = index + 1 === totalCheckpoints;
82
- const isOnlyCheckpoint = totalCheckpoints === 1;
83
84
  return /*#__PURE__*/React.createElement("div", {
84
85
  id: "pgn__checkpoint",
85
86
  className: "pgn__checkpoint",
@@ -97,12 +98,15 @@ const Checkpoint = /*#__PURE__*/React.forwardRef((_ref, ref) => {
97
98
  values: {
98
99
  step: index + 1
99
100
  }
100
- })), (title || !isOnlyCheckpoint) && /*#__PURE__*/React.createElement("div", {
101
- className: "pgn__checkpoint-header"
102
- }, /*#__PURE__*/React.createElement(CheckpointTitle, null, title), /*#__PURE__*/React.createElement(CheckpointBreadcrumbs, {
103
- currentIndex: index,
101
+ })), /*#__PURE__*/React.createElement(CheckpointHeader, {
102
+ dismissAltText: dismissAltText,
103
+ index: index,
104
+ onDismiss: onDismiss,
105
+ title: title,
104
106
  totalCheckpoints: totalCheckpoints
105
- })), /*#__PURE__*/React.createElement(CheckpointBody, null, body), /*#__PURE__*/React.createElement(CheckpointActionRow, {
107
+ }), /*#__PURE__*/React.createElement(CheckpointBody, null, body), /*#__PURE__*/React.createElement(CheckpointActionRow, {
108
+ onBack: onBack,
109
+ onDismiss: onDismiss,
106
110
  isLastCheckpoint: isLastCheckpoint,
107
111
  index: index,
108
112
  ...props
@@ -120,20 +124,22 @@ const Checkpoint = /*#__PURE__*/React.forwardRef((_ref, ref) => {
120
124
  });
121
125
  Checkpoint.defaultProps = {
122
126
  advanceButtonText: null,
127
+ backButtonText: null,
123
128
  body: null,
124
- dismissButtonText: null,
129
+ dismissAltText: null,
125
130
  endButtonText: null,
126
131
  placement: 'top',
127
- title: null,
128
- showDismissButton: undefined
132
+ title: null
129
133
  };
130
134
  Checkpoint.propTypes = {
131
135
  /** The text displayed on the button used to advance the tour for the given Checkpoint. */
132
136
  advanceButtonText: PropTypes.node,
137
+ /** The text displayed on the button used go back in the tour for the given Checkpoint. */
138
+ backButtonText: PropTypes.string,
133
139
  /** The text displayed in the body of the Checkpoint */
134
140
  body: PropTypes.node,
135
- /** The text displayed on the button used to dismiss the tour for the given Checkpoint. */
136
- dismissButtonText: PropTypes.node,
141
+ /** The text used in the alt for the icon used to dismiss the tour for the given Checkpoint */
142
+ dismissAltText: PropTypes.string,
137
143
  /** The text displayed on the button used to end the tour for the given Checkpoint. */
138
144
  endButtonText: PropTypes.node,
139
145
  /** The current index of the given Checkpoint */
@@ -141,6 +147,9 @@ Checkpoint.propTypes = {
141
147
  /** A function that runs when triggering the `onClick` event of the advance
142
148
  * button for the given Checkpoint. */
143
149
  onAdvance: PropTypes.func.isRequired,
150
+ /** A function that runs when triggering the `onBack` event of the back
151
+ * button for the given Checkpoint. */
152
+ onBack: PropTypes.func.isRequired,
144
153
  /** A function that runs when triggering the `onClick` event of the dismiss
145
154
  * button for the given Checkpoint. */
146
155
  onDismiss: PropTypes.func.isRequired,
@@ -154,9 +163,7 @@ Checkpoint.propTypes = {
154
163
  /** The text displayed in the title of the Checkpoint */
155
164
  title: PropTypes.node,
156
165
  /** The total number of Checkpoints in a tour */
157
- totalCheckpoints: PropTypes.number.isRequired,
158
- /** Enforces visibility of the dismiss button under all circumstances */
159
- showDismissButton: PropTypes.bool
166
+ totalCheckpoints: PropTypes.number.isRequired
160
167
  };
161
168
  export default Checkpoint;
162
169
  //# sourceMappingURL=Checkpoint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkpoint.js","names":["React","useEffect","useState","useMediaQuery","PropTypes","createPopper","FormattedMessage","breakpoints","CheckpointActionRow","CheckpointBody","CheckpointBreadcrumbs","CheckpointTitle","messages","Checkpoint","forwardRef","_ref","ref","body","index","placement","target","title","totalCheckpoints","props","checkpointVisible","setCheckpointVisible","isMobile","maxWidth","small","targetElement","document","querySelector","checkpoint","checkpointPopper","strategy","modifiers","name","options","padding","offset","tetherOffset","forceUpdate","targetOffset","getBoundingClientRect","top","bottom","global","innerHeight","includes","scrollTo","behavior","button","focus","isLastCheckpoint","isOnlyCheckpoint","createElement","id","className","role","style","visibility","pointerEvents","topPositionText","values","step","currentIndex","bottomPositionText","defaultProps","advanceButtonText","dismissButtonText","endButtonText","showDismissButton","undefined","propTypes","node","number","isRequired","onAdvance","func","onDismiss","onEnd","oneOf","string","bool"],"sources":["../../src/ProductTour/Checkpoint.jsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { useMediaQuery } from 'react-responsive';\nimport PropTypes from 'prop-types';\nimport { createPopper } from '@popperjs/core';\nimport { FormattedMessage } from 'react-intl';\n\nimport breakpoints from '../utils/breakpoints';\n\nimport CheckpointActionRow from './CheckpointActionRow';\nimport CheckpointBody from './CheckpointBody';\nimport CheckpointBreadcrumbs from './CheckpointBreadcrumbs';\nimport CheckpointTitle from './CheckpointTitle';\nimport messages from './messages';\n\nconst Checkpoint = React.forwardRef(({\n body,\n index,\n placement,\n target,\n title,\n totalCheckpoints,\n ...props\n}, ref) => {\n const [checkpointVisible, setCheckpointVisible] = useState(false);\n const isMobile = useMediaQuery({ maxWidth: breakpoints.small.maxWidth });\n\n useEffect(() => {\n const targetElement = document.querySelector(target);\n const checkpoint = document.querySelector('#pgn__checkpoint');\n if (targetElement && checkpoint) {\n // Use the Popper library to translate the Checkpoint to its target's coordinates\n const checkpointPopper = createPopper(targetElement, checkpoint, {\n placement: isMobile ? 'top' : placement,\n strategy: 'fixed',\n modifiers: [\n {\n name: 'arrow',\n options: {\n padding: 25,\n },\n },\n {\n name: 'offset',\n options: {\n offset: [0, 20],\n },\n },\n {\n name: 'preventOverflow',\n options: {\n padding: 20,\n tetherOffset: 35,\n },\n },\n ],\n });\n setCheckpointVisible(true);\n if (checkpointPopper) {\n checkpointPopper.forceUpdate();\n }\n }\n }, [target, isMobile, placement]);\n\n useEffect(() => {\n if (checkpointVisible) {\n // Scroll the Checkpoint into view once its rendered\n const targetElement = document.querySelector(target);\n let targetOffset = targetElement.getBoundingClientRect().top;\n if ((targetOffset < 0) || (targetElement.getBoundingClientRect().bottom > global.innerHeight)) {\n if (placement.includes('top')) {\n if (targetOffset < 0) {\n targetOffset *= -1;\n }\n targetOffset -= 280;\n } else {\n targetOffset -= 80;\n }\n\n global.scrollTo({\n top: targetOffset, behavior: 'smooth',\n });\n }\n\n const button = document.querySelector('.pgn__checkpoint-button_advance');\n button.focus();\n }\n }, [target, checkpointVisible, placement]);\n\n const isLastCheckpoint = index + 1 === totalCheckpoints;\n const isOnlyCheckpoint = totalCheckpoints === 1;\n\n return (\n <div\n id=\"pgn__checkpoint\"\n className=\"pgn__checkpoint\"\n aria-labelledby=\"pgn__checkpoint-title\"\n ref={ref}\n role=\"dialog\"\n style={{ visibility: checkpointVisible ? 'visible' : 'hidden', pointerEvents: checkpointVisible ? 'auto' : 'none' }}\n >\n <span className=\"sr-only\">\n <FormattedMessage\n {...messages.topPositionText}\n values={{ step: index + 1 }}\n />\n </span>\n {(title || !isOnlyCheckpoint) && (\n <div className=\"pgn__checkpoint-header\">\n <CheckpointTitle>{title}</CheckpointTitle>\n <CheckpointBreadcrumbs currentIndex={index} totalCheckpoints={totalCheckpoints} />\n </div>\n )}\n <CheckpointBody>{body}</CheckpointBody>\n <CheckpointActionRow\n isLastCheckpoint={isLastCheckpoint}\n index={index}\n {...props}\n />\n <div id=\"pgn__checkpoint-arrow\" data-popper-arrow />\n <span className=\"sr-only\">\n <FormattedMessage\n {...messages.bottomPositionText}\n values={{ step: index + 1 }}\n />\n </span>\n </div>\n );\n});\n\nCheckpoint.defaultProps = {\n advanceButtonText: null,\n body: null,\n dismissButtonText: null,\n endButtonText: null,\n placement: 'top',\n title: null,\n showDismissButton: undefined,\n};\n\nCheckpoint.propTypes = {\n /** The text displayed on the button used to advance the tour for the given Checkpoint. */\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 dismissButtonText: PropTypes.node,\n /** The text displayed on the button used to end the tour for the given Checkpoint. */\n endButtonText: PropTypes.node,\n /** The current index of the given Checkpoint */\n index: PropTypes.number.isRequired,\n /** A function that runs when triggering the `onClick` event of the advance\n * button for the given Checkpoint. */\n onAdvance: PropTypes.func.isRequired,\n /** A function that runs when triggering the `onClick` event of the dismiss\n * button for the given Checkpoint. */\n onDismiss: PropTypes.func.isRequired,\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.isRequired,\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 /** The total number of Checkpoints in a tour */\n totalCheckpoints: PropTypes.number.isRequired,\n /** Enforces visibility of the dismiss button under all circumstances */\n showDismissButton: PropTypes.bool,\n};\n\nexport default Checkpoint;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,YAAY;AAE7C,OAAOC,WAAW,MAAM,sBAAsB;AAE9C,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,qBAAqB,MAAM,yBAAyB;AAC3D,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,QAAQ,MAAM,YAAY;AAEjC,MAAMC,UAAU,gBAAGb,KAAK,CAACc,UAAU,CAAC,CAAAC,IAAA,EAQjCC,GAAG,KAAK;EAAA,IAR0B;IACnCC,IAAI;IACJC,KAAK;IACLC,SAA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jC;EACAzD,IAAI,EAAEb,SAAS,CAACsE,IAAI;EACpB;EACAL,iBAAiB,EAAEjE,SAAS,CAACsE,IAAI;EACjC;EACAJ,aAAa,EAAElE,SAAS,CAACsE,IAAI;EAC7B;EACAxD,KAAK,EAAEd,SAAS,CAACuE,MAAM,CAACC,UAAU;EAClC;AACF;EACEC,SAAS,EAAEzE,SAAS,CAAC0E,IAAI,CAACF,UAAU;EACpC;AACF;EACEG,SAAS,EAAE3E,SAAS,CAAC0E,IAAI,CAACF,UAAU;EACpC;AACF;EACEI,KAAK,EAAE5E,SAAS,CAAC0E,IAAI,CAACF,UAAU;EAChC;EACAzD,SAAS,EAAEf,SAAS,CAAC6E,KAAK,CAAC,CACzB,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAClE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,CACzE,CAAC;EACF;EACA7D,MAAM,EAAEhB,SAAS,CAAC8E,MAAM,CAACN,UAAU;EACnC;EACAvD,KAAK,EAAEjB,SAAS,CAACsE,IAAI;EACrB;EACApD,gBAAgB,EAAElB,SAAS,CAACuE,MAAM,CAACC,UAAU;EAC7C;EACAL,iBAAiB,EAAEnE,SAAS,CAAC+E;AAC/B,CAAC;AAED,eAAetE,UAAU","ignoreList":[]}
1
+ {"version":3,"file":"Checkpoint.js","names":["React","useEffect","useState","useMediaQuery","PropTypes","createPopper","FormattedMessage","breakpoints","CheckpointActionRow","CheckpointBody","CheckpointHeader","messages","Checkpoint","forwardRef","_ref","ref","body","dismissAltText","index","onBack","onDismiss","placement","target","title","totalCheckpoints","props","checkpointVisible","setCheckpointVisible","isMobile","maxWidth","small","targetElement","document","querySelector","checkpoint","checkpointPopper","strategy","modifiers","name","options","padding","offset","tetherOffset","forceUpdate","targetOffset","getBoundingClientRect","top","bottom","global","innerHeight","includes","scrollTo","behavior","button","focus","isLastCheckpoint","createElement","id","className","role","style","visibility","pointerEvents","topPositionText","values","step","bottomPositionText","defaultProps","advanceButtonText","backButtonText","endButtonText","propTypes","node","string","number","isRequired","onAdvance","func","onEnd","oneOf"],"sources":["../../src/ProductTour/Checkpoint.jsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { useMediaQuery } from 'react-responsive';\nimport PropTypes from 'prop-types';\nimport { createPopper } from '@popperjs/core';\nimport { FormattedMessage } from 'react-intl';\n\nimport breakpoints from '../utils/breakpoints';\nimport CheckpointActionRow from './CheckpointActionRow';\nimport CheckpointBody from './CheckpointBody';\nimport CheckpointHeader from './CheckpointHeader';\nimport messages from './messages';\n\nconst Checkpoint = React.forwardRef(({\n body,\n dismissAltText,\n index,\n onBack,\n onDismiss,\n placement,\n target,\n title,\n totalCheckpoints,\n ...props\n}, ref) => {\n const [checkpointVisible, setCheckpointVisible] = useState(false);\n const isMobile = useMediaQuery({ maxWidth: breakpoints.small.maxWidth });\n\n useEffect(() => {\n const targetElement = document.querySelector(target);\n const checkpoint = document.querySelector('#pgn__checkpoint');\n if (targetElement && checkpoint) {\n // Use the Popper library to translate the Checkpoint to its target's coordinates\n const checkpointPopper = createPopper(targetElement, checkpoint, {\n placement: isMobile ? 'top' : placement,\n strategy: 'fixed',\n modifiers: [\n {\n name: 'arrow',\n options: {\n padding: 25,\n },\n },\n {\n name: 'offset',\n options: {\n offset: [0, 20],\n },\n },\n {\n name: 'preventOverflow',\n options: {\n padding: 20,\n tetherOffset: 35,\n },\n },\n ],\n });\n setCheckpointVisible(true);\n if (checkpointPopper) {\n checkpointPopper.forceUpdate();\n }\n }\n }, [target, isMobile, placement]);\n\n useEffect(() => {\n if (checkpointVisible) {\n // Scroll the Checkpoint into view once its rendered\n const targetElement = document.querySelector(target);\n let targetOffset = targetElement.getBoundingClientRect().top;\n if ((targetOffset < 0) || (targetElement.getBoundingClientRect().bottom > global.innerHeight)) {\n if (placement.includes('top')) {\n if (targetOffset < 0) {\n targetOffset *= -1;\n }\n targetOffset -= 280;\n } else {\n targetOffset -= 80;\n }\n\n global.scrollTo({\n top: targetOffset, behavior: 'smooth',\n });\n }\n\n const button = document.querySelector('.pgn__checkpoint-button_advance');\n button.focus();\n }\n }, [target, checkpointVisible, placement]);\n\n const isLastCheckpoint = index + 1 === totalCheckpoints;\n\n return (\n <div\n id=\"pgn__checkpoint\"\n className=\"pgn__checkpoint\"\n aria-labelledby=\"pgn__checkpoint-title\"\n ref={ref}\n role=\"dialog\"\n style={{ visibility: checkpointVisible ? 'visible' : 'hidden', pointerEvents: checkpointVisible ? 'auto' : 'none' }}\n >\n <span className=\"sr-only\">\n <FormattedMessage\n {...messages.topPositionText}\n values={{ step: index + 1 }}\n />\n </span>\n <CheckpointHeader\n dismissAltText={dismissAltText}\n index={index}\n onDismiss={onDismiss}\n title={title}\n totalCheckpoints={totalCheckpoints}\n />\n <CheckpointBody>{body}</CheckpointBody>\n <CheckpointActionRow\n onBack={onBack}\n onDismiss={onDismiss}\n isLastCheckpoint={isLastCheckpoint}\n index={index}\n {...props}\n />\n <div id=\"pgn__checkpoint-arrow\" data-popper-arrow />\n <span className=\"sr-only\">\n <FormattedMessage\n {...messages.bottomPositionText}\n values={{ step: index + 1 }}\n />\n </span>\n </div>\n );\n});\n\nCheckpoint.defaultProps = {\n advanceButtonText: null,\n backButtonText: null,\n body: null,\n dismissAltText: null,\n endButtonText: null,\n placement: 'top',\n title: null,\n};\n\nCheckpoint.propTypes = {\n /** The text displayed on the button used to advance the tour for the given Checkpoint. */\n advanceButtonText: PropTypes.node,\n /** The text displayed on the button used go back in the tour for the given Checkpoint. */\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 endButtonText: PropTypes.node,\n /** The current index of the given Checkpoint */\n index: PropTypes.number.isRequired,\n /** A function that runs when triggering the `onClick` event of the advance\n * button for the given Checkpoint. */\n onAdvance: PropTypes.func.isRequired,\n /** A function that runs when triggering the `onBack` event of the back\n * button for the given Checkpoint. */\n onBack: PropTypes.func.isRequired,\n /** A function that runs when triggering the `onClick` event of the dismiss\n * button for the given Checkpoint. */\n onDismiss: PropTypes.func.isRequired,\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.isRequired,\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 /** The total number of Checkpoints in a tour */\n totalCheckpoints: PropTypes.number.isRequired,\n};\n\nexport default Checkpoint;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,YAAY;AAE7C,OAAOC,WAAW,MAAM,sBAAsB;AAC9C,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,QAAQ,MAAM,YAAY;AAEjC,MAAMC,UAAU,gBAAGZ,KAAK,CAACa,UAAU,CAAC,CAAAC,IAAA,EAWjCC,GAAG,KAAK;EAAA,IAX0B;IACnCC,IAAI;IACJC,cAAc;IACdC,KAAK;IACLC,MAAM;IACNC,SAAS;IACTC,SAAS;IACTC,MAAM;IACNC,KAAK;IACLC,gBAAgB;IAChB,GAAGC;EACL,CAAC,GAAAX,IAAA;EACC,MAAM,CAACY,iBAAiB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AEd,SAAS,CAACsE,MAAM,CAACC,UAAU;EAClC;AACF;EACEC,SAAS,EAAExE,SAAS,CAACyE,IAAI,CAACF,UAAU;EACpC;AACF;EACExD,MAAM,EAAEf,SAAS,CAACyE,IAAI,CAACF,UAAU;EACjC;AACF;EACEvD,SAAS,EAAEhB,SAAS,CAACyE,IAAI,CAACF,UAAU;EACpC;AACF;EACEG,KAAK,EAAE1E,SAAS,CAACyE,IAAI,CAACF,UAAU;EAChC;EACAtD,SAAS,EAAEjB,SAAS,CAAC2E,KAAK,CAAC,CACzB,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAClE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,CACzE,CAAC;EACF;EACAzD,MAAM,EAAElB,SAAS,CAACqE,MAAM,CAACE,UAAU;EACnC;EACApD,KAAK,EAAEnB,SAAS,CAACoE,IAAI;EACrB;EACAhD,gBAAgB,EAAEpB,SAAS,CAACsE,MAAM,CAACC;AACrC,CAAC;AAED,eAAe/D,UAAU","ignoreList":[]}
@@ -7,7 +7,7 @@
7
7
  var(--pgn-size-product-tour-checkpoint-width-border)
8
8
  solid var(--pgn-color-product-tour-checkpoint-border);
9
9
  border-radius: var(--pgn-size-border-radius-base);
10
- padding: var(--pgn-spacing-spacer-4);
10
+ padding: var(--pgn-spacing-spacer-3-5);
11
11
  box-shadow: 0 .25rem .5rem var(--pgn-color-product-tour-checkpoint-box-shadow);
12
12
  z-index: var(--pgn-elevation-product-tour-checkpoint-zindex);
13
13
  max-width: var(--pgn-size-product-tour-checkpoint-width-max);
@@ -44,39 +44,6 @@
44
44
  margin-inline-end: var(--pgn-spacing-spacer-2);
45
45
  }
46
46
 
47
- .pgn__checkpoint-breadcrumb {
48
- height: 6px;
49
- width: 6px;
50
- border-radius: 50%;
51
-
52
- &.pgn__checkpoint-breadcrumb_active {
53
- background: var(--pgn-color-product-tour-checkpoint-breadcrumb);
54
- }
55
-
56
- &.pgn__checkpoint-breadcrumb_inactive {
57
- border: 1px solid var(--pgn-color-product-tour-checkpoint-breadcrumb);
58
- background: transparent;
59
- }
60
-
61
- &:not(:first-child) {
62
- margin-left: map.get($spacers, 1\.5);
63
- }
64
-
65
- [dir="rtl"] & {
66
- margin-left: map.get($spacers, 1\.5);
67
- margin-right: 0;
68
-
69
- &:last-child {
70
- margin-left: 0;
71
- }
72
- }
73
- }
74
-
75
- .pgn__checkpoint-breadcrumb-container {
76
- display: flex;
77
- align-items: center;
78
- }
79
-
80
47
  .pgn__checkpoint-body {
81
48
  color: var(--pgn-color-product-tour-checkpoint-body);
82
49
  margin-bottom: map.get($spacers, 3\.5);
@@ -86,13 +53,18 @@
86
53
  .pgn__checkpoint-header {
87
54
  display: flex;
88
55
  justify-content: space-between;
89
- margin-bottom: map.get($spacers, 2\.5);
56
+ margin-bottom: map.get($spacers, 2);
57
+ align-items: center;
90
58
  }
91
59
 
92
60
  #pgn__checkpoint-title {
93
61
  font-size: var(--pgn-typography-font-size-h3-base);
94
62
  margin-inline-end: map.get($spacers, 2\.5);
95
- margin-bottom: 0;
63
+ margin-bottom: map.get($spacers, 2);;
64
+ }
65
+
66
+ .pgn__checkpoint-page-index {
67
+ font-size: $small-font-size;
96
68
  }
97
69
  }
98
70
 
@@ -1,60 +1,56 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import ActionRow from '../ActionRow';
3
4
  import Button from '../Button';
4
- const CheckpointActionRow = /*#__PURE__*/React.forwardRef((_ref, ref) => {
5
+ const CheckpointActionRow = /*#__PURE__*/React.forwardRef(_ref => {
5
6
  let {
6
7
  advanceButtonText,
7
- dismissButtonText,
8
+ backButtonText,
8
9
  endButtonText,
9
10
  isLastCheckpoint,
10
11
  onAdvance,
11
- onDismiss,
12
+ onBack,
12
13
  onEnd,
13
- showDismissButton,
14
14
  index
15
15
  } = _ref;
16
- return /*#__PURE__*/React.createElement("div", {
17
- className: "pgn__checkpoint-action-row",
18
- ref: ref
19
- }, (showDismissButton === undefined ? !isLastCheckpoint : showDismissButton) && /*#__PURE__*/React.createElement(Button, {
16
+ const isFirstCheckpoint = index === 0;
17
+ return /*#__PURE__*/React.createElement(ActionRow, {
18
+ className: "pgn__checkpoint-action-row"
19
+ }, !isFirstCheckpoint && /*#__PURE__*/React.createElement(Button, {
20
+ className: "pgn__checkpoint-button-back",
20
21
  variant: "tertiary",
21
- className: "pgn__checkpoint-button_dismiss",
22
- onClick: onDismiss
23
- }, dismissButtonText), /*#__PURE__*/React.createElement(Button, {
22
+ onClick: onBack
23
+ }, backButtonText), /*#__PURE__*/React.createElement(Button, {
24
24
  autoFocus: true,
25
25
  className: "pgn__checkpoint-button_advance",
26
- variant: "primary",
27
26
  onClick: isLastCheckpoint ? () => onEnd(index) : () => onAdvance(index)
28
27
  }, isLastCheckpoint ? endButtonText : advanceButtonText));
29
28
  });
30
29
  CheckpointActionRow.defaultProps = {
31
30
  advanceButtonText: '',
32
- dismissButtonText: '',
31
+ backButtonText: '',
33
32
  endButtonText: '',
34
33
  isLastCheckpoint: false,
35
34
  onAdvance: () => {},
36
- onDismiss: () => {},
35
+ onBack: () => {},
37
36
  onEnd: () => {},
38
- showDismissButton: undefined,
39
37
  index: 0
40
38
  };
41
39
  CheckpointActionRow.propTypes = {
42
40
  /** The text displayed on the button used to advance the tour. */
43
41
  advanceButtonText: PropTypes.node,
44
- /** The text displayed on the button used to dismiss the tour. */
45
- dismissButtonText: PropTypes.node,
42
+ /** The text displayed on the button used to go back on the tour */
43
+ backButtonText: PropTypes.string,
46
44
  /** The text displayed on the button used to end the tour. */
47
45
  endButtonText: PropTypes.node,
48
46
  /** Whether the parent Checkpoint is the last in the tour. */
49
47
  isLastCheckpoint: PropTypes.bool,
50
48
  /** A function that runs when triggering the `onClick` event of the advance button. */
51
49
  onAdvance: PropTypes.func,
52
- /** A function that runs when triggering the `onClick` event of the dismiss button. */
53
- onDismiss: PropTypes.func,
50
+ /** A function that runs when triggering the `onClick` event of the back button. */
51
+ onBack: PropTypes.func,
54
52
  /** A function that runs when triggering the `onClick` event of the advance button if isLastCheckpoint is true. */
55
53
  onEnd: PropTypes.func,
56
- /** Enforces visibility of the dismiss button under all circumstances */
57
- showDismissButton: PropTypes.bool,
58
54
  /** Allows visibility of last index value for onEnd checkpoint compatibility */
59
55
  index: PropTypes.number
60
56
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CheckpointActionRow.js","names":["React","PropTypes","Button","CheckpointActionRow","forwardRef","_ref","ref","advanceButtonText","dismissButtonText","endButtonText","isLastCheckpoint","onAdvance","onDismiss","onEnd","showDismissButton","index","createElement","className","undefined","variant","onClick","autoFocus","defaultProps","propTypes","node","bool","func","number"],"sources":["../../src/ProductTour/CheckpointActionRow.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Button from '../Button';\n\nconst CheckpointActionRow = React.forwardRef(({\n advanceButtonText,\n dismissButtonText,\n endButtonText,\n isLastCheckpoint,\n onAdvance,\n onDismiss,\n onEnd,\n showDismissButton,\n index,\n}, ref) => (\n <div className=\"pgn__checkpoint-action-row\" ref={ref}>\n {(showDismissButton === undefined ? !isLastCheckpoint : showDismissButton) && (\n <Button\n variant=\"tertiary\"\n className=\"pgn__checkpoint-button_dismiss\"\n onClick={onDismiss}\n >\n {dismissButtonText}\n </Button>\n )}\n <Button\n autoFocus\n className=\"pgn__checkpoint-button_advance\"\n variant=\"primary\"\n onClick={isLastCheckpoint ? () => onEnd(index) : () => onAdvance(index)}\n >\n {isLastCheckpoint ? endButtonText : advanceButtonText}\n </Button>\n </div>\n));\n\nCheckpointActionRow.defaultProps = {\n advanceButtonText: '',\n dismissButtonText: '',\n endButtonText: '',\n isLastCheckpoint: false,\n onAdvance: () => {},\n onDismiss: () => {},\n onEnd: () => {},\n showDismissButton: undefined,\n index: 0,\n};\n\nCheckpointActionRow.propTypes = {\n /** The text displayed on the button used to advance the tour. */\n advanceButtonText: PropTypes.node,\n /** The text displayed on the button used to dismiss the tour. */\n dismissButtonText: PropTypes.node,\n /** The text displayed on the button used to end the tour. */\n endButtonText: PropTypes.node,\n /** Whether the parent Checkpoint is the last in the tour. */\n isLastCheckpoint: PropTypes.bool,\n /** A function that runs when triggering the `onClick` event of the advance button. */\n onAdvance: 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 advance button if isLastCheckpoint is true. */\n onEnd: PropTypes.func,\n /** Enforces visibility of the dismiss button under all circumstances */\n showDismissButton: PropTypes.bool,\n /** Allows visibility of last index value for onEnd checkpoint compatibility */\n index: PropTypes.number,\n};\n\nexport default CheckpointActionRow;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,MAAM,MAAM,WAAW;AAE9B,MAAMC,mBAAmB,gBAAGH,KAAK,CAACI,UAAU,CAAC,CAAAC,IAAA,EAU1CC,GAAG;EAAA,IAVwC;IAC5CC,iBAAiB;IACjBC,iBAAiB;IACjBC,aAAa;IACbC,gBAAgB;IAChBC,SAAS;IACTC,SAAS;IACTC,KAAK;IACLC,iBAAiB;IACjBC;EACF,CAAC,GAAAV,IAAA;EAAA,oBACCL,KAAA,CAAAgB,aAAA;IAAKC,SAAS,EAAC,4BAA4B;IAACX,GAAG,EAAEA;EAAI,GAClD,CAACQ,iBAAiB,KAAKI,SAAS,GAAG,CAACR,gBAAgB,GAAGI,iBAAiB,kBACvEd,KAAA,CAAAgB,aAAA,CAACd,MAAM;IACLiB,OAAO,EAAC,UAAU;IAClBF,SAAS,EAAC,gCAAgC;IAC1CG,OAAO,EAAER;EAAU,GAElBJ,iBACK,CACT,eACDR,KAAA,CAAAgB,aAAA,CAACd,MAAM;IACLmB,SAAS;IACTJ,SAAS,EAAC,gCAAgC;IAC1CE,OAAO,EAAC,SAAS;IACjBC,OAAO,EAAEV,gBAAgB,GAAG,MAAMG,KAAK,CAACE,KAAK,CAAC,GAAG,MAAMJ,SAAS,CAACI,KAAK;EAAE,GAEvEL,gBAAgB,GAAGD,aAAa,GAAGF,iBAC9B,CACL,CAAC;AAAA,CACP,CAAC;AAEFJ,mBAAmB,CAACmB,YAAY,GAAG;EACjCf,iBAAiB,EAAE,EAAE;EACrBC,iBAAiB,EAAE,EAAE;EACrBC,aAAa,EAAE,EAAE;EACjBC,gBAAgB,EAAE,KAAK;EACvBC,SAAS,EAAEA,CAAA,KAAM,CAAC,CAAC;EACnBC,SAAS,EAAEA,CAAA,KAAM,CAAC,CAAC;EACnBC,KAAK,EAAEA,CAAA,KAAM,CAAC,CAAC;EACfC,iBAAiB,EAAEI,SAAS;EAC5BH,KAAK,EAAE;AACT,CAAC;AAEDZ,mBAAmB,CAACoB,SAAS,GAAG;EAC9B;EACAhB,iBAAiB,EAAEN,SAAS,CAACuB,IAAI;EACjC;EACAhB,iBAAiB,EAAEP,SAAS,CAACuB,IAAI;EACjC;EACAf,aAAa,EAAER,SAAS,CAACuB,IAAI;EAC7B;EACAd,gBAAgB,EAAET,SAAS,CAACwB,IAAI;EAChC;EACAd,SAAS,EAAEV,SAAS,CAACyB,IAAI;EACzB;EACAd,SAAS,EAAEX,SAAS,CAACyB,IAAI;EACzB;EACAb,KAAK,EAAEZ,SAAS,CAACyB,IAAI;EACrB;EACAZ,iBAAiB,EAAEb,SAAS,CAACwB,IAAI;EACjC;EACAV,KAAK,EAAEd,SAAS,CAAC0B;AACnB,CAAC;AAED,eAAexB,mBAAmB","ignoreList":[]}
1
+ {"version":3,"file":"CheckpointActionRow.js","names":["React","PropTypes","ActionRow","Button","CheckpointActionRow","forwardRef","_ref","advanceButtonText","backButtonText","endButtonText","isLastCheckpoint","onAdvance","onBack","onEnd","index","isFirstCheckpoint","createElement","className","variant","onClick","autoFocus","defaultProps","propTypes","node","string","bool","func","number"],"sources":["../../src/ProductTour/CheckpointActionRow.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport ActionRow from '../ActionRow';\nimport Button from '../Button';\n\nconst CheckpointActionRow = React.forwardRef(({\n advanceButtonText,\n backButtonText,\n endButtonText,\n isLastCheckpoint,\n onAdvance,\n onBack,\n onEnd,\n index,\n}) => {\n const isFirstCheckpoint = index === 0;\n return (\n <ActionRow className=\"pgn__checkpoint-action-row\">\n {!isFirstCheckpoint && (\n <Button\n className=\"pgn__checkpoint-button-back\"\n variant=\"tertiary\"\n onClick={onBack}\n >\n {backButtonText}\n </Button>\n )}\n <Button\n autoFocus\n className=\"pgn__checkpoint-button_advance\"\n onClick={isLastCheckpoint ? () => onEnd(index) : () => onAdvance(index)}\n >\n {isLastCheckpoint ? endButtonText : advanceButtonText}\n </Button>\n </ActionRow>\n );\n});\n\nCheckpointActionRow.defaultProps = {\n advanceButtonText: '',\n backButtonText: '',\n endButtonText: '',\n isLastCheckpoint: false,\n onAdvance: () => { },\n onBack: () => { },\n onEnd: () => { },\n index: 0,\n};\n\nCheckpointActionRow.propTypes = {\n /** The text displayed on the button used to advance the tour. */\n advanceButtonText: PropTypes.node,\n /** The text displayed on the button used to go back on the tour */\n backButtonText: PropTypes.string,\n /** The text displayed on the button used to end the tour. */\n endButtonText: PropTypes.node,\n /** Whether the parent Checkpoint is the last in the tour. */\n isLastCheckpoint: PropTypes.bool,\n /** A function that runs when triggering the `onClick` event of the advance button. */\n onAdvance: PropTypes.func,\n /** A function that runs when triggering the `onClick` event of the back button. */\n onBack: PropTypes.func,\n /** A function that runs when triggering the `onClick` event of the advance button if isLastCheckpoint is true. */\n onEnd: PropTypes.func,\n /** Allows visibility of last index value for onEnd checkpoint compatibility */\n index: PropTypes.number,\n};\n\nexport default CheckpointActionRow;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,SAAS,MAAM,cAAc;AACpC,OAAOC,MAAM,MAAM,WAAW;AAE9B,MAAMC,mBAAmB,gBAAGJ,KAAK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Ad,SAAS,EAAEV,SAAS,CAACyB,IAAI;EACzB;EACAd,MAAM,EAAEX,SAAS,CAACyB,IAAI;EACtB;EACAb,KAAK,EAAEZ,SAAS,CAACyB,IAAI;EACrB;EACAZ,KAAK,EAAEb,SAAS,CAAC0B;AACnB,CAAC;AAED,eAAevB,mBAAmB","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { FormattedMessage, useIntl } from 'react-intl';
4
+ import Icon from '../Icon';
5
+ import IconButton from '../IconButton';
6
+ import { Close } from '../../icons';
7
+ import CheckpointTitle from './CheckpointTitle';
8
+ import messages from './messages';
9
+ const CheckpointHeader = /*#__PURE__*/React.forwardRef(_ref => {
10
+ let {
11
+ dismissAltText,
12
+ index,
13
+ onDismiss,
14
+ title,
15
+ totalCheckpoints
16
+ } = _ref;
17
+ const intl = useIntl();
18
+ const oneBasedIndex = index + 1;
19
+ const altText = dismissAltText && typeof dismissAltText === 'string' ? dismissAltText : intl.formatMessage(messages.closeAltText);
20
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("header", {
21
+ className: "pgn__checkpoint-header"
22
+ }, /*#__PURE__*/React.createElement("span", {
23
+ className: "pgn__checkpoint-page-index"
24
+ }, /*#__PURE__*/React.createElement(FormattedMessage, {
25
+ ...messages.pageIndexText,
26
+ values: {
27
+ step: oneBasedIndex,
28
+ totalSteps: totalCheckpoints
29
+ }
30
+ })), /*#__PURE__*/React.createElement(IconButton, {
31
+ size: "sm",
32
+ iconAs: Icon,
33
+ src: Close,
34
+ alt: altText,
35
+ onClick: onDismiss,
36
+ "data-testid": "dismiss-tour"
37
+ })), title && /*#__PURE__*/React.createElement(CheckpointTitle, null, title));
38
+ });
39
+ CheckpointHeader.defaultProps = {
40
+ dismissAltText: null,
41
+ title: ''
42
+ };
43
+ CheckpointHeader.propTypes = {
44
+ /** The text used in the alt for the icon used to dismiss the tour for the given Checkpoint */
45
+ dismissAltText: PropTypes.string,
46
+ /** The current index of the given Checkpoint */
47
+ index: PropTypes.number.isRequired,
48
+ /** A function that runs when triggering the `onClick` event of the dismiss
49
+ * button for the given Checkpoint. */
50
+ onDismiss: PropTypes.func.isRequired,
51
+ /** The text displayed in the title of the Checkpoint */
52
+ title: PropTypes.node,
53
+ /** The total number of Checkpoints in a tour */
54
+ totalCheckpoints: PropTypes.number.isRequired
55
+ };
56
+ export default CheckpointHeader;
57
+ //# sourceMappingURL=CheckpointHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckpointHeader.js","names":["React","PropTypes","FormattedMessage","useIntl","Icon","IconButton","Close","CheckpointTitle","messages","CheckpointHeader","forwardRef","_ref","dismissAltText","index","onDismiss","title","totalCheckpoints","intl","oneBasedIndex","altText","formatMessage","closeAltText","createElement","Fragment","className","pageIndexText","values","step","totalSteps","size","iconAs","src","alt","onClick","defaultProps","propTypes","string","number","isRequired","func","node"],"sources":["../../src/ProductTour/CheckpointHeader.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { FormattedMessage, useIntl } from 'react-intl';\n\nimport Icon from '../Icon';\nimport IconButton from '../IconButton';\nimport { Close } from '../../icons';\nimport CheckpointTitle from './CheckpointTitle';\nimport messages from './messages';\n\nconst CheckpointHeader = React.forwardRef(({\n dismissAltText, index, onDismiss, title, totalCheckpoints,\n}) => {\n const intl = useIntl();\n const oneBasedIndex = index + 1;\n const altText = (dismissAltText && typeof dismissAltText === 'string') ? dismissAltText : intl.formatMessage(messages.closeAltText);\n\n return (\n <>\n <header className=\"pgn__checkpoint-header\">\n <span className=\"pgn__checkpoint-page-index\">\n <FormattedMessage\n {...messages.pageIndexText}\n values={{ step: oneBasedIndex, totalSteps: totalCheckpoints }}\n />\n </span>\n <IconButton\n size=\"sm\"\n iconAs={Icon}\n src={Close}\n alt={altText}\n onClick={onDismiss}\n data-testid=\"dismiss-tour\"\n />\n </header>\n {title && (<CheckpointTitle>{title}</CheckpointTitle>)}\n </>\n );\n});\n\nCheckpointHeader.defaultProps = {\n dismissAltText: null,\n title: '',\n};\n\nCheckpointHeader.propTypes = {\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 current index of the given Checkpoint */\n index: PropTypes.number.isRequired,\n /** A function that runs when triggering the `onClick` event of the dismiss\n * button for the given Checkpoint. */\n onDismiss: PropTypes.func.isRequired,\n /** The text displayed in the title of the Checkpoint */\n title: PropTypes.node,\n /** The total number of Checkpoints in a tour */\n totalCheckpoints: PropTypes.number.isRequired,\n};\n\nexport default CheckpointHeader;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,gBAAgB,EAAEC,OAAO,QAAQ,YAAY;AAEtD,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,UAAU,MAAM,eAAe;AACtC,SAASC,KAAK,QAAQ,aAAa;AACnC,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,QAAQ,MAAM,YAAY;AAEjC,MAAMC,gBAAgB,gBAAGT,KAAK,CAACU,UAAU,CAACC,IAAA,IAEpC;EAAA,IAFqC;IACzCC,cAAc;IAAEC,KAAK;IAAEC,SAAS;IAAEC,KAAK;IAAEC;EAC3C,CAAC,GAAAL,IAAA;EACC,MAAMM,IAAI,GAAGd,OAAO,CAAC,CAAC;EACtB,MAAMe,aAAa,GAAGL,KAAK,GAAG,CAAC;EAC/B,MAAMM,OAAO,GAAIP,cAAc,IAAI,OAAOA,cAAc,KAAK,QAAQ,GAAIA,cAAc,GAAGK,IAAI,CAACG,aAAa,CAACZ,QAAQ,CAACa,YAAY,CAAC;EAEnI,oBACErB,KAAA,CAAAsB,aAAA,CAAAtB,KAAA,CAAAuB,QAAA,qBACEvB,KAAA,CAAAsB,aAAA;IAAQE,SAAS,EAAC;EAAwB,gBACxCxB,KAAA,CAAAsB,aAAA;IAAME,SAAS,EAAC;EAA4B,g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