@atlaskit/spotlight 0.6.4 → 0.7.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 +17 -0
- package/README.md +1 -6
- package/constellation/images/color-application.png +0 -0
- package/constellation/images/multi-step-step-1.png +0 -0
- package/constellation/images/multi-step-step-2.png +0 -0
- package/constellation/images/principles-of-use-do.png +0 -0
- package/constellation/images/principles-of-use-dont.png +0 -0
- package/constellation/images/single-step.png +0 -0
- package/constellation/images/spotlight-anatomy.png +0 -0
- package/constellation/images/tour-use-do.png +0 -0
- package/constellation/images/tour-use-dont.png +0 -0
- package/constellation/images/triggered-spotlight.png +0 -0
- package/constellation/index/examples.mdx +13 -15
- package/constellation/index/usage.mdx +169 -84
- package/dist/cjs/controllers/context.js +40 -0
- package/dist/cjs/ui/body/index.js +1 -1
- package/dist/cjs/ui/popover-content/index.js +43 -14
- package/dist/cjs/ui/primary-action/index.js +7 -1
- package/dist/cjs/ui/secondary-action/index.js +8 -2
- package/dist/cjs/ui/show-more-control/index.js +1 -1
- package/dist/es2019/controllers/context.js +28 -0
- package/dist/es2019/ui/body/index.js +1 -1
- package/dist/es2019/ui/popover-content/index.js +39 -9
- package/dist/es2019/ui/popover-provider/index.js +0 -1
- package/dist/es2019/ui/popover-target/index.js +0 -1
- package/dist/es2019/ui/primary-action/index.js +9 -2
- package/dist/es2019/ui/secondary-action/index.js +10 -3
- package/dist/es2019/ui/show-more-control/index.js +1 -1
- package/dist/esm/controllers/context.js +40 -0
- package/dist/esm/ui/body/index.js +1 -1
- package/dist/esm/ui/popover-content/index.js +43 -14
- package/dist/esm/ui/popover-provider/index.js +0 -1
- package/dist/esm/ui/popover-target/index.js +0 -1
- package/dist/esm/ui/primary-action/index.js +8 -2
- package/dist/esm/ui/secondary-action/index.js +9 -3
- package/dist/esm/ui/show-more-control/index.js +1 -1
- package/dist/types/controllers/context.d.ts +9 -1
- package/dist/types/types.d.ts +3 -0
- package/dist/types/ui/body/index.d.ts +3 -3
- package/dist/types/ui/card/index.d.ts +1 -1
- package/dist/types/ui/dismiss-control/index.d.ts +1 -1
- package/dist/types/ui/headline/index.d.ts +1 -1
- package/dist/types/ui/media/index.d.ts +1 -2
- package/dist/types/ui/popover-content/index.d.ts +54 -3
- package/dist/types/ui/popover-provider/index.d.ts +8 -3
- package/dist/types/ui/popover-target/index.d.ts +8 -3
- package/dist/types/ui/primary-action/index.d.ts +1 -1
- package/dist/types/ui/secondary-action/index.d.ts +2 -2
- package/dist/types/ui/show-more-control/index.d.ts +1 -1
- package/dist/types-ts4.5/controllers/context.d.ts +9 -1
- package/dist/types-ts4.5/types.d.ts +3 -0
- package/dist/types-ts4.5/ui/body/index.d.ts +3 -3
- package/dist/types-ts4.5/ui/card/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/dismiss-control/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/headline/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/media/index.d.ts +1 -2
- package/dist/types-ts4.5/ui/popover-content/index.d.ts +54 -3
- package/dist/types-ts4.5/ui/popover-provider/index.d.ts +8 -3
- package/dist/types-ts4.5/ui/popover-target/index.d.ts +8 -3
- package/dist/types-ts4.5/ui/primary-action/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/secondary-action/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/show-more-control/index.d.ts +1 -1
- package/package.json +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/spotlight
|
|
2
2
|
|
|
3
|
+
## 0.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`991d1598db6d6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/991d1598db6d6) -
|
|
8
|
+
Documentation for upcoming beta release.
|
|
9
|
+
|
|
10
|
+
## 0.7.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`6e38d616cae8e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6e38d616cae8e) -
|
|
15
|
+
Allow back, next, done actions to be passed into PopoverContent. These actions will be used if no
|
|
16
|
+
onClick handler is passed to SpotlightSecondaryAction, SpotlightPrimaryAction. If onClick handlers
|
|
17
|
+
are provided to the specific components, then they will take preference over what is passed to
|
|
18
|
+
PopoverContent.
|
|
19
|
+
|
|
3
20
|
## 0.6.4
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
# Spotlight
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
A spotlight introduces users to various points of interest across Atlassian through focused messages
|
|
6
|
-
or multi-step tours.
|
|
3
|
+
A spotlight introduces users to points of interest, from focused messages to multi-step tours.
|
|
7
4
|
|
|
8
5
|
## Usage
|
|
9
6
|
|
|
10
|
-
`import { Spotlight } from '@atlaskit/spotlight';`
|
|
11
|
-
|
|
12
7
|
Detailed docs and example usage can be found
|
|
13
8
|
[here](https://atlaskit.atlassian.com/packages/design-system/spotlight).
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -8,15 +8,13 @@ import MultipleStepsExample from '../../examples/constellation/multiple-steps';
|
|
|
8
8
|
import MediaExample from '../../examples/constellation/media';
|
|
9
9
|
import ControlsExample from '../../examples/constellation/controls';
|
|
10
10
|
|
|
11
|
-
## Single
|
|
11
|
+
## Single step
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
information. Try and combine or eliminate tasks where possible. Dismiss functionality is required.
|
|
15
|
-
Don't force users to participate.
|
|
13
|
+
Always aim for a single step experience.
|
|
16
14
|
|
|
17
|
-
By design `@atlaskit/spotlight` does not have a blanket, scroll-lock, focus-trap
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
By design, `@atlaskit/spotlight` does not have a blanket, scroll-lock, or focus-trap functionality.
|
|
16
|
+
This is to ensure the user is not hijacked into the spotlight experience, and can opt-in if they are
|
|
17
|
+
interested.
|
|
20
18
|
|
|
21
19
|
To show/hide the `SpotlightCard`, simply use a `useState` to control the `isVisible` prop on
|
|
22
20
|
`PopoverContent`. To position the `SpotlightCard`, use `PopoverProvider`, `PopoverTarget` and
|
|
@@ -24,12 +22,12 @@ To show/hide the `SpotlightCard`, simply use a `useState` to control the `isVisi
|
|
|
24
22
|
|
|
25
23
|
<Example Component={SingleStepExample} packageName="@atlaskit/spinner" />
|
|
26
24
|
|
|
27
|
-
##
|
|
25
|
+
## Multi-step tour
|
|
28
26
|
|
|
29
|
-
Multiple steps should be avoided if possible.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
Multiple steps should be avoided if possible. If multiple steps are required, preference managing
|
|
28
|
+
the tour with a `useState`. If `useState` is not feasible, then a React context may be used.
|
|
29
|
+
However, these contexts will often need to be wrapping the entire `App` and therefore will cause the
|
|
30
|
+
entire `App` to re-render every time a new spotlight step is shown, which is not performant.
|
|
33
31
|
|
|
34
32
|
<Example Component={MultipleStepsExample} packageName="@atlaskit/spinner" />
|
|
35
33
|
|
|
@@ -43,10 +41,10 @@ displayed in full.
|
|
|
43
41
|
|
|
44
42
|
## Media
|
|
45
43
|
|
|
46
|
-
Media is optional for a `SpotlightCard
|
|
47
|
-
|
|
44
|
+
Media is optional for a `SpotlightCard`and should only be used for more complex features. To ensure
|
|
45
|
+
correct reflow on smaller viewports, media must be 295px width X 135px height.
|
|
48
46
|
|
|
49
|
-
Media can be an image,
|
|
47
|
+
Media can be an image, gif, or video that helps communicate spotlight intent.
|
|
50
48
|
|
|
51
49
|
<Example Component={MediaExample} packageName="@atlaskit/spinner" />
|
|
52
50
|
|
|
@@ -1,127 +1,212 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
SpotlightTable,
|
|
3
|
+
SpotlightVisualGuidelines,
|
|
4
|
+
SpotlightCollectionBackgroundColors,
|
|
5
|
+
} from '@af/design-system-docs-ui';
|
|
6
|
+
import { Stack } from '@atlaskit/primitives/compiled';
|
|
7
|
+
|
|
8
|
+
import tourUseDo from '../images/tour-use-do.png';
|
|
9
|
+
import tourUseDont from '../images/tour-use-dont.png';
|
|
10
|
+
import principlesDo from '../images/principles-of-use-do.png';
|
|
11
|
+
import principlesDont from '../images/principles-of-use-dont.png';
|
|
2
12
|
|
|
3
13
|
## Usage
|
|
4
14
|
|
|
5
|
-
|
|
6
|
-
users about key features or workflows.
|
|
7
|
-
driving feature discovery, or highlighting important changes. Use them sparingly — if your UI needs
|
|
8
|
-
frequent spotlights, consider simplifying the core experience instead.
|
|
15
|
+
Use a spotlight to bring attention to a specific part of the UI, such as a button or icon, to
|
|
16
|
+
educate users about key features or workflows.
|
|
9
17
|
|
|
10
|
-
|
|
18
|
+
Spotlights are most effective for onboarding new users, driving feature discovery, or highlighting
|
|
19
|
+
important changes. Use them sparingly. If your UI needs frequent spotlights, consider simplifying
|
|
20
|
+
the core experience instead.
|
|
11
21
|
|
|
12
|
-
###
|
|
22
|
+
### Single-step spotlight
|
|
13
23
|
|
|
14
|
-
|
|
15
|
-
|
|
24
|
+
The ideal spotlight experience is lightweight and a single-step. Always try to limit your experience
|
|
25
|
+
to one spotlight to prevent information overload for the user.
|
|
16
26
|
|
|
17
|
-
|
|
27
|
+

|
|
18
28
|
|
|
19
|
-
|
|
20
|
-
(e.g., a banner that asks for permission to “show me” before triggering a spotlight).
|
|
29
|
+
### Multi-step tour
|
|
21
30
|
|
|
22
|
-
|
|
31
|
+
A tour is a series of spotlights that point to multiple areas of the UI. <br /> Ensure your tour:
|
|
23
32
|
|
|
24
|
-
-
|
|
33
|
+
- has a maximum of three steps
|
|
34
|
+
- is logically sequenced
|
|
35
|
+
- is limited to one screen
|
|
36
|
+
- includes a “Back” call-to-action (CTA) after the initial spotlight
|
|
37
|
+
- displays a step count
|
|
25
38
|
|
|
26
|
-
|
|
39
|
+
**In a tour, the initial spotlight references step count and clear next action**
|
|
27
40
|
|
|
28
|
-
|
|
29
|
-
distract and fatigue users.
|
|
30
|
-
- **One at a time**: Only show one spotlight at a time.
|
|
31
|
-
- **Dismissibility**: Always provide a dismiss option. Never force participation.
|
|
32
|
-
- **Step count**: Prefer single-step spotlights. For tours, keep flows short (2–3 steps max).
|
|
33
|
-
- **Orchestration**: Build spotlights with Post Office to avoid message collisions and enforce
|
|
34
|
-
fatigue rules (Atlassians Only).
|
|
35
|
-
- **Media**: Use media (images or video) only when it enhances understanding. Exclude media if the
|
|
36
|
-
spotlight already focuses attention effectively.
|
|
41
|
+

|
|
37
42
|
|
|
38
|
-
|
|
43
|
+
**Advancing to the next step introduces a Back button**
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+

|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
<br />
|
|
47
|
+
### Tour use
|
|
44
48
|
|
|
45
|
-
|
|
49
|
+
Tours should be used sparingly. Before designing a tour, assess if you can combine or eliminate
|
|
50
|
+
steps to keep the experience as lightweight as possible, as seen below.
|
|
46
51
|
|
|
47
|
-
<
|
|
48
|
-
|
|
52
|
+
<DoDont
|
|
53
|
+
type="do"
|
|
54
|
+
image={{
|
|
55
|
+
url: tourUseDo,
|
|
56
|
+
alt: 'Example of a single-step spotlight with content that combines the example content of the multi-step tour next to it.',
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
Keep things lightweight. Aim for one step with active and concise messaging.
|
|
60
|
+
</DoDont>
|
|
49
61
|
|
|
50
|
-
|
|
62
|
+
<DoDont
|
|
63
|
+
type="dont"
|
|
64
|
+
image={{
|
|
65
|
+
url: tourUseDont,
|
|
66
|
+
alt: 'Example of a multi-step spotlight with content that that can be combined into a single step.',
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
Avoid tours unless the steps are crucial. Consolidate information first.
|
|
70
|
+
</DoDont>
|
|
51
71
|
|
|
52
|
-
|
|
53
|
-
simple features, a single illustration for moderate complexity, and a narrative/motion for complex
|
|
54
|
-
flows.
|
|
72
|
+
### Triggered spotlights
|
|
55
73
|
|
|
56
|
-
|
|
57
|
-
|
|
74
|
+
Spotlights can activate UI if triggered by another component. Although they are a second step in an
|
|
75
|
+
experience, they should not use a step count or “Back” CTA.
|
|
58
76
|
|
|
59
|
-
|
|
60
|
-
it clarifies the feature.
|
|
77
|
+
**In this example, a banner triggers a spotlight that opens a dropdown**
|
|
61
78
|
|
|
62
|
-
|
|
79
|
+

|
|
63
80
|
|
|
64
|
-
|
|
65
|
-
For cross-product or promotional spotlights, use a less obtrusive entrypoint (like a banner)
|
|
66
|
-
first.
|
|
81
|
+
## Spotlight use cases
|
|
67
82
|
|
|
68
|
-
|
|
83
|
+
### Onboarding
|
|
69
84
|
|
|
70
|
-
|
|
85
|
+
Guide first-time users to essential features and workflows.
|
|
71
86
|
|
|
72
|
-
|
|
73
|
-
- Sequence multi-step spotlights logically; aim for 2–3 steps max.
|
|
74
|
-
- Always allow users to dismiss or skip.
|
|
75
|
-
- Avoid competing with other in-product messages.
|
|
76
|
-
- Prefer embedded, contextual education over overlays.
|
|
87
|
+
### Feature discovery
|
|
77
88
|
|
|
78
|
-
|
|
89
|
+
Help existing users learn about new or updated capabilities.
|
|
90
|
+
|
|
91
|
+
### Cross-flow, cross-join, and co-use
|
|
92
|
+
|
|
93
|
+
Trigger a spotlight from another component to elaborate on the message. For example, a flag with a
|
|
94
|
+
“Show me” CTA triggers a spotlight to demonstrate the feature in context. Triggered spotlights can
|
|
95
|
+
also activate UI.
|
|
96
|
+
|
|
97
|
+
## Principles of use
|
|
98
|
+
|
|
99
|
+
<DoDont
|
|
100
|
+
type="do"
|
|
101
|
+
image={{
|
|
102
|
+
url: principlesDo,
|
|
103
|
+
alt: 'Example of spotlight with content that explains what Rovo is.',
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
Use spotlights to educate users or introduce them to something new.
|
|
107
|
+
</DoDont>
|
|
79
108
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
109
|
+
<DoDont
|
|
110
|
+
type="dont"
|
|
111
|
+
image={{
|
|
112
|
+
url: principlesDont,
|
|
113
|
+
alt: 'Example of a spotlight with content that promotes purchasing collections to get Rovo.',
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
Use spotlights for upsells or other transactional messaging.
|
|
117
|
+
</DoDont>
|
|
83
118
|
|
|
84
|
-
|
|
119
|
+
## Anatomy and specifications
|
|
85
120
|
|
|
86
|
-
|
|
121
|
+

|
|
87
122
|
|
|
88
|
-
|
|
89
|
-
order. By default the tabbable elements in spotlight will be ordered directly after the target
|
|
90
|
-
element to give screen-reader/keyboard users context about what the spotlight is related to.
|
|
123
|
+
<SpotlightTable />
|
|
91
124
|
|
|
92
|
-
|
|
93
|
-
the card. This will happen automatically even when a show-more button is visually ahead of it. So
|
|
94
|
-
product engineers shouldn't need to do any additional work.
|
|
125
|
+
## Visual guidelines
|
|
95
126
|
|
|
96
|
-
|
|
127
|
+
### Media
|
|
97
128
|
|
|
98
|
-
|
|
99
|
-
|
|
129
|
+
Media should only be used to make messaging clearer for more complex features. For simple
|
|
130
|
+
experiences, stick to text to avoid distracting the user.
|
|
100
131
|
|
|
101
|
-
The
|
|
102
|
-
users have no other method of knowing where the new spotlight steps are shown.
|
|
132
|
+
The cognitive load necessary for comprehension should determine the level of complexity.
|
|
103
133
|
|
|
104
|
-
|
|
105
|
-
|
|
134
|
+
<br />
|
|
135
|
+
<SpotlightVisualGuidelines />
|
|
136
|
+
<br />
|
|
137
|
+
|
|
138
|
+
### Color application
|
|
139
|
+
|
|
140
|
+

|
|
106
141
|
|
|
107
|
-
|
|
142
|
+
- Use solid color for the background color to drive focus to the main UI elements
|
|
143
|
+
- Incorporate the collection color into background color to further strengthen the color association
|
|
144
|
+
to the collection (see colors below)
|
|
145
|
+
- Start with the color designated for each collection, then evenly distribute other brand colors to
|
|
146
|
+
the UI elements
|
|
147
|
+
- Limit the use to no more than three different colors in a single composition
|
|
148
|
+
- Different shades can be used to create contrast and spatial depth in the UI illustrations, but
|
|
149
|
+
avoid using too many shades within one composition
|
|
108
150
|
|
|
109
|
-
|
|
151
|
+
### Collection background colors
|
|
152
|
+
|
|
153
|
+
<br />
|
|
154
|
+
<SpotlightCollectionBackgroundColors />
|
|
155
|
+
<br />
|
|
110
156
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
157
|
+
## Content guidelines
|
|
158
|
+
|
|
159
|
+
A successful spotlight can be understood in just a few seconds. Spotlight content should be as
|
|
160
|
+
concise as possible, easy to scan, and only communicate essential information.
|
|
161
|
+
|
|
162
|
+
### Messaging guidelines
|
|
163
|
+
|
|
164
|
+
- Prioritize the most relevant information and if more context is needed, find a way to provide a
|
|
165
|
+
path to further learning
|
|
166
|
+
- Don’t talk about things the user cannot see at that time
|
|
167
|
+
|
|
168
|
+
#### Headline
|
|
169
|
+
|
|
170
|
+
- 27 characters max
|
|
171
|
+
- Start with an active verb
|
|
172
|
+
- Clearly communicate intent
|
|
173
|
+
- Focus on benefits rather than announcements
|
|
174
|
+
- Personalize with words such as, “your” where it is relevant
|
|
175
|
+
|
|
176
|
+
#### Body copy
|
|
177
|
+
|
|
178
|
+
- 75 characters max
|
|
179
|
+
- Brief and direct
|
|
180
|
+
- Elaborate value
|
|
181
|
+
|
|
182
|
+
#### Primary CTA
|
|
183
|
+
|
|
184
|
+
- 24 characters max for single-step
|
|
185
|
+
- 15 characters max for tour
|
|
186
|
+
- Provide an obvious next action
|
|
187
|
+
- If used for dismissal, use “Done”
|
|
188
|
+
- Let them know where they’re going next when navigating to another screen “Go to Jira”
|
|
189
|
+
- Be explicit when activating UI components “Chat with Rovo” opens the Rovo panel
|
|
190
|
+
- Use “Learn more” when navigating to more detailed information
|
|
191
|
+
- For tours: start with “Next” and conclude the flow with “Done”
|
|
192
|
+
|
|
193
|
+
#### Secondary CTA
|
|
194
|
+
|
|
195
|
+
- Reserved for “Back” navigation in tours
|
|
196
|
+
|
|
197
|
+
## Accessibility
|
|
114
198
|
|
|
115
|
-
|
|
199
|
+
- The headline is used as the accessible name for the spotlight dialog
|
|
200
|
+
- Keep content concise and avoid motion that could be disruptive
|
|
201
|
+
- Ensure the arrow and spotlight are not truncated by the browser bounds
|
|
116
202
|
|
|
117
|
-
|
|
118
|
-
- Avoid repeating the headline verb.
|
|
119
|
-
- Two lines max. Focus on benefits and relevance.
|
|
120
|
-
- Reference only visible elements.
|
|
203
|
+
### Focus management
|
|
121
204
|
|
|
122
|
-
|
|
205
|
+
For a **single-step spotlight** or the **first in a multi-step tour**, tabbing begins after the
|
|
206
|
+
targeted element so the user is aware of what the spotlight is referring to. It follows a normal
|
|
207
|
+
tabbing order, automatically starting with the "X" dismissal on the top right, even if a "…" show
|
|
208
|
+
more is included ahead of it.
|
|
123
209
|
|
|
124
|
-
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
- For features: 1–3 words; “Done” is acceptable if no clear next action.
|
|
210
|
+
Unless the first spotlight is dismissed with the "X," in a **multi-step tour** the second and third
|
|
211
|
+
spotlights grab focus to continue the messaging narrative then return to the targeted element once
|
|
212
|
+
complete so the user can perform the intended action.
|
|
@@ -61,6 +61,26 @@ var SpotlightContext = exports.SpotlightContext = /*#__PURE__*/(0, _react.create
|
|
|
61
61
|
setDismiss: function setDismiss() {
|
|
62
62
|
return undefined;
|
|
63
63
|
}
|
|
64
|
+
},
|
|
65
|
+
primaryAction: {
|
|
66
|
+
action: {
|
|
67
|
+
current: function current() {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
setAction: function setAction() {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
secondaryAction: {
|
|
76
|
+
action: {
|
|
77
|
+
current: function current() {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
setAction: function setAction() {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
64
84
|
}
|
|
65
85
|
});
|
|
66
86
|
|
|
@@ -106,6 +126,18 @@ var SpotlightContextProvider = exports.SpotlightContextProvider = function Spotl
|
|
|
106
126
|
var setDismiss = function setDismiss(dismissFn) {
|
|
107
127
|
dismissRef.current = dismissFn;
|
|
108
128
|
};
|
|
129
|
+
var secondaryActionRef = (0, _react.useRef)(function () {
|
|
130
|
+
return undefined;
|
|
131
|
+
});
|
|
132
|
+
var setSecondaryAction = function setSecondaryAction(actionFn) {
|
|
133
|
+
secondaryActionRef.current = actionFn;
|
|
134
|
+
};
|
|
135
|
+
var primaryActionRef = (0, _react.useRef)(function () {
|
|
136
|
+
return undefined;
|
|
137
|
+
});
|
|
138
|
+
var setPrimaryAction = function setPrimaryAction(actionFn) {
|
|
139
|
+
primaryActionRef.current = actionFn;
|
|
140
|
+
};
|
|
109
141
|
return /*#__PURE__*/React.createElement(SpotlightContext.Provider, {
|
|
110
142
|
value: {
|
|
111
143
|
card: {
|
|
@@ -125,6 +157,14 @@ var SpotlightContextProvider = exports.SpotlightContextProvider = function Spotl
|
|
|
125
157
|
setUpdate: setUpdate,
|
|
126
158
|
dismiss: dismissRef,
|
|
127
159
|
setDismiss: setDismiss
|
|
160
|
+
},
|
|
161
|
+
primaryAction: {
|
|
162
|
+
action: primaryActionRef,
|
|
163
|
+
setAction: setPrimaryAction
|
|
164
|
+
},
|
|
165
|
+
secondaryAction: {
|
|
166
|
+
action: secondaryActionRef,
|
|
167
|
+
setAction: setSecondaryAction
|
|
128
168
|
}
|
|
129
169
|
}
|
|
130
170
|
}, children);
|
|
@@ -18,7 +18,7 @@ var styles = {
|
|
|
18
18
|
/**
|
|
19
19
|
* __SpotlightBody__
|
|
20
20
|
*
|
|
21
|
-
* `SpotlightBody` is required in a
|
|
21
|
+
* `SpotlightBody` is required in a spotlight. The content should be brief and direct to elaborate on the intent.
|
|
22
22
|
*
|
|
23
23
|
*/
|
|
24
24
|
var SpotlightBody = exports.SpotlightBody = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
@@ -55,15 +55,24 @@ var popperPlacementMap = {
|
|
|
55
55
|
*
|
|
56
56
|
* A `PopoverContent` is the element that is shown as a popover.
|
|
57
57
|
*/
|
|
58
|
-
var PopoverContent = exports.PopoverContent = function PopoverContent(
|
|
59
|
-
var children =
|
|
60
|
-
placement =
|
|
61
|
-
|
|
62
|
-
isVisible =
|
|
63
|
-
|
|
64
|
-
shouldDismissOnClickOutside =
|
|
65
|
-
dismiss =
|
|
66
|
-
|
|
58
|
+
var PopoverContent = exports.PopoverContent = function PopoverContent(props) {
|
|
59
|
+
var children = props.children,
|
|
60
|
+
placement = props.placement,
|
|
61
|
+
_props$isVisible = props.isVisible,
|
|
62
|
+
isVisible = _props$isVisible === void 0 ? true : _props$isVisible,
|
|
63
|
+
_props$shouldDismissO = props.shouldDismissOnClickOutside,
|
|
64
|
+
shouldDismissOnClickOutside = _props$shouldDismissO === void 0 ? true : _props$shouldDismissO,
|
|
65
|
+
dismiss = props.dismiss,
|
|
66
|
+
back = props.back,
|
|
67
|
+
testId = props.testId;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A user should only be able to pass a `done` or a `next`. Not both.
|
|
71
|
+
* The type is set up as a discriminant union. So, we need a typeguard
|
|
72
|
+
* here to destructure it properly.
|
|
73
|
+
*/
|
|
74
|
+
var done = 'done' in props ? props.done : undefined;
|
|
75
|
+
var next = 'next' in props ? props.next : undefined;
|
|
67
76
|
var updateRef = (0, _react.useRef)(function () {
|
|
68
77
|
return new Promise(function () {
|
|
69
78
|
return undefined;
|
|
@@ -73,14 +82,34 @@ var PopoverContent = exports.PopoverContent = function PopoverContent(_ref) {
|
|
|
73
82
|
var _useContext = (0, _react.useContext)(_context.SpotlightContext),
|
|
74
83
|
heading = _useContext.heading,
|
|
75
84
|
popoverContent = _useContext.popoverContent,
|
|
76
|
-
card = _useContext.card
|
|
85
|
+
card = _useContext.card,
|
|
86
|
+
primaryAction = _useContext.primaryAction,
|
|
87
|
+
secondaryAction = _useContext.secondaryAction;
|
|
77
88
|
var focusWithin = (0, _useFocusWithin.useFocusWithin)(popoverContent.ref);
|
|
78
89
|
(0, _react.useEffect)(function () {
|
|
79
90
|
popoverContent.setRef(ref);
|
|
80
91
|
}, [ref, popoverContent]);
|
|
92
|
+
(0, _react.useEffect)(function () {
|
|
93
|
+
if (!done && !next) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (done) {
|
|
97
|
+
primaryAction.setAction(done);
|
|
98
|
+
return;
|
|
99
|
+
} else if (next) {
|
|
100
|
+
primaryAction.setAction(next);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
}, [done, next, primaryAction]);
|
|
81
104
|
(0, _react.useEffect)(function () {
|
|
82
105
|
popoverContent.setDismiss(dismiss);
|
|
83
106
|
}, [dismiss, popoverContent]);
|
|
107
|
+
(0, _react.useEffect)(function () {
|
|
108
|
+
if (!back) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
secondaryAction.setAction(back);
|
|
112
|
+
}, [back, secondaryAction]);
|
|
84
113
|
(0, _react.useEffect)(function () {
|
|
85
114
|
card.setPlacement(placement);
|
|
86
115
|
}, [placement, card]);
|
|
@@ -106,10 +135,10 @@ var PopoverContent = exports.PopoverContent = function PopoverContent(_ref) {
|
|
|
106
135
|
return /*#__PURE__*/React.createElement(_popper.Popper, {
|
|
107
136
|
offset: offset,
|
|
108
137
|
placement: popperPlacementMap[placement]
|
|
109
|
-
}, function (
|
|
110
|
-
var localRef =
|
|
111
|
-
style =
|
|
112
|
-
update =
|
|
138
|
+
}, function (_ref) {
|
|
139
|
+
var localRef = _ref.ref,
|
|
140
|
+
style = _ref.style,
|
|
141
|
+
update = _ref.update;
|
|
113
142
|
if (!isVisible) {
|
|
114
143
|
return;
|
|
115
144
|
}
|
|
@@ -11,6 +11,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var React = _react;
|
|
12
12
|
var _runtime = require("@compiled/react/runtime");
|
|
13
13
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
14
|
+
var _context = require("../../controllers/context");
|
|
14
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
16
|
var styles = {
|
|
16
17
|
root: "_2rko12b0 _1dqonqa1 _189ee4h9 _1h6dz9xs _syaz15cr _bfhkcdhy _irr31bsc _1di61b6k"
|
|
@@ -27,12 +28,17 @@ var SpotlightPrimaryAction = exports.SpotlightPrimaryAction = /*#__PURE__*/(0, _
|
|
|
27
28
|
onClick = _ref.onClick,
|
|
28
29
|
children = _ref.children,
|
|
29
30
|
testId = _ref.testId;
|
|
31
|
+
var _useContext = (0, _react.useContext)(_context.SpotlightContext),
|
|
32
|
+
primaryAction = _useContext.primaryAction;
|
|
33
|
+
var done = function done(event) {
|
|
34
|
+
primaryAction.action.current(event);
|
|
35
|
+
};
|
|
30
36
|
return /*#__PURE__*/React.createElement(_compiled.Pressable, {
|
|
31
37
|
"aria-label": ariaLabel,
|
|
32
38
|
ref: ref,
|
|
33
39
|
testId: testId,
|
|
34
40
|
xcss: styles.root,
|
|
35
|
-
onClick: onClick
|
|
41
|
+
onClick: onClick || done
|
|
36
42
|
}, /*#__PURE__*/React.createElement(_compiled.Text, {
|
|
37
43
|
as: "span"
|
|
38
44
|
}, children));
|
|
@@ -11,6 +11,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var React = _react;
|
|
12
12
|
var _runtime = require("@compiled/react/runtime");
|
|
13
13
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
14
|
+
var _context = require("../../controllers/context");
|
|
14
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
16
|
var styles = {
|
|
16
17
|
root: "_2rko12b0 _syaz15cr _bfhkcdhy _irr31bsc _1di61b6k"
|
|
@@ -18,7 +19,7 @@ var styles = {
|
|
|
18
19
|
/**
|
|
19
20
|
* __Spotlight secondary action__
|
|
20
21
|
*
|
|
21
|
-
* `SpotlightSecondaryAction` is not required for all
|
|
22
|
+
* `SpotlightSecondaryAction` is not required for all spotlight components. It should supplement the `SpotlightPrimaryAction`.
|
|
22
23
|
* It is intended to be used to go back to the previous step in multi step spotlight tours, or other similar actions.
|
|
23
24
|
*
|
|
24
25
|
*/
|
|
@@ -27,12 +28,17 @@ var SpotlightSecondaryAction = exports.SpotlightSecondaryAction = /*#__PURE__*/(
|
|
|
27
28
|
onClick = _ref.onClick,
|
|
28
29
|
children = _ref.children,
|
|
29
30
|
testId = _ref.testId;
|
|
31
|
+
var _useContext = (0, _react.useContext)(_context.SpotlightContext),
|
|
32
|
+
secondaryAction = _useContext.secondaryAction;
|
|
33
|
+
var back = function back(event) {
|
|
34
|
+
secondaryAction.action.current(event);
|
|
35
|
+
};
|
|
30
36
|
return /*#__PURE__*/React.createElement(_compiled.Pressable, {
|
|
31
37
|
"aria-label": ariaLabel,
|
|
32
38
|
ref: ref,
|
|
33
39
|
testId: testId,
|
|
34
40
|
xcss: styles.root,
|
|
35
|
-
onClick: onClick
|
|
41
|
+
onClick: onClick || back
|
|
36
42
|
}, /*#__PURE__*/React.createElement(_compiled.Text, {
|
|
37
43
|
as: "span"
|
|
38
44
|
}, children));
|
|
@@ -20,7 +20,7 @@ var styles = {
|
|
|
20
20
|
/**
|
|
21
21
|
* __SpotlightShowMoreControl__
|
|
22
22
|
*
|
|
23
|
-
* SpotlightShowMoreControl
|
|
23
|
+
* `SpotlightShowMoreControl` provides follow-up actions and customizations for the spotlight.
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
26
|
var SpotlightShowMoreControl = exports.SpotlightShowMoreControl = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|