@jobber/components-native 0.101.5 → 0.101.6
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/dist/docs/ActionItem/ActionItem.md +65 -0
- package/dist/docs/ActionItemGroup/ActionItemGroup.md +33 -0
- package/dist/docs/ActionLabel/ActionLabel.md +43 -0
- package/dist/docs/ActivityIndicator/ActivityIndicator.md +116 -0
- package/dist/docs/Animation/Animation.md +71 -0
- package/dist/docs/AtlantisThemeContext/AtlantisThemeContext.md +256 -0
- package/dist/docs/AutoLink/AutoLink.md +47 -0
- package/dist/docs/Banner/Banner.md +390 -0
- package/dist/docs/Borders/Borders.md +45 -0
- package/dist/docs/BottomSheet/BottomSheet.md +67 -0
- package/dist/docs/Button/Button.md +918 -0
- package/dist/docs/ButtonGroup/ButtonGroup.md +89 -0
- package/dist/docs/Card/Card.md +270 -0
- package/dist/docs/Checkbox/Checkbox.md +69 -0
- package/dist/docs/Chip/Chip.md +371 -0
- package/dist/docs/Colors/Colors.md +217 -0
- package/dist/docs/Content/Content.md +67 -0
- package/dist/docs/ContentOverlay/ContentOverlay.md +64 -0
- package/dist/docs/Disclosure/Disclosure.md +161 -0
- package/dist/docs/Divider/Divider.md +84 -0
- package/dist/docs/Elevations/Elevations.md +76 -0
- package/dist/docs/EmptyState/EmptyState.md +72 -0
- package/dist/docs/Flex/Flex.md +37 -0
- package/dist/docs/Form/Form.md +126 -0
- package/dist/docs/FormField/FormField.md +57 -0
- package/dist/docs/FormatFile/FormatFile.md +56 -0
- package/dist/docs/Glimmer/Glimmer.md +143 -0
- package/dist/docs/Heading/Heading.md +132 -0
- package/dist/docs/Icon/Icon.md +585 -0
- package/dist/docs/IconButton/IconButton.md +25 -0
- package/dist/docs/InputCurrency/InputCurrency.md +61 -0
- package/dist/docs/InputDate/InputDate.md +133 -0
- package/dist/docs/InputEmail/InputEmail.md +69 -0
- package/dist/docs/InputFieldWrapper/InputFieldWrapper.md +70 -0
- package/dist/docs/InputNumber/InputNumber.md +72 -0
- package/dist/docs/InputPassword/InputPassword.md +61 -0
- package/dist/docs/InputPressable/InputPressable.md +64 -0
- package/dist/docs/InputSearch/InputSearch.md +49 -0
- package/dist/docs/InputText/InputText.md +324 -0
- package/dist/docs/InputTime/InputTime.md +54 -0
- package/dist/docs/Opacity/Opacity.md +12 -0
- package/dist/docs/ProgressBar/ProgressBar.md +39 -0
- package/dist/docs/Radii/Radii.md +23 -0
- package/dist/docs/ResponsiveBreakpoint/ResponsiveBreakpoint.md +74 -0
- package/dist/docs/Select/Select.md +213 -0
- package/dist/docs/Spacing/Spacing.md +103 -0
- package/dist/docs/StatusLabel/StatusLabel.md +119 -0
- package/dist/docs/Switch/Switch.md +54 -0
- package/dist/docs/Text/Text.md +368 -0
- package/dist/docs/TextList/TextList.md +29 -0
- package/dist/docs/ThumbnailList/ThumbnailList.md +16 -0
- package/dist/docs/Toast/Toast.md +71 -0
- package/dist/docs/Typography/Typography.md +170 -0
- package/dist/docs/choosing-components/choosing-components.md +76 -0
- package/dist/docs/customizing-components/customizing-components.md +167 -0
- package/dist/docs/disabled-states/disabled-states.md +86 -0
- package/dist/docs/empty-states/empty-states.md +126 -0
- package/dist/docs/errors/errors.md +114 -0
- package/dist/docs/index.md +64 -0
- package/dist/docs/interaction/interaction.md +109 -0
- package/dist/docs/page-layouts/page-layouts.md +323 -0
- package/dist/docs/scaffolding/scaffolding.md +109 -0
- package/dist/docs/settings/settings.md +58 -0
- package/dist/docs/usage-guidelines/usage-guidelines.md +177 -0
- package/dist/package.json +8 -4
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -4
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
# Banner## SummaryBanners are persistent messages used to communicate important changes, ongoing
|
|
2
|
+
conditions, or system errors. They appear at the top of a screen or near related
|
|
3
|
+
content and remain visible until dismissed or the condition is resolved.At Jobber, Banners help service providers (SPs) stay informed about updates that
|
|
4
|
+
impact their business, without unnecessarily interrupting their flow.## AnatomyA Banner typically includes: Icon: Adds visual context, usually for warning or error types 
|
|
5
|
+
 Message text: 1–2 clear, concise sentences 
|
|
6
|
+
 CTA or link (optional): For related action 
|
|
7
|
+
 Dismiss button (optional): For SP-controlled removal ## Behaviour- Alignment: Banner should align with the left and right of the content it
|
|
8
|
+
relates to. In a modal or page layout, this means aligning with text, inputs,
|
|
9
|
+
or other components beneath it. Use the [Content](../Content/Content.md) to
|
|
10
|
+
ensure consistent vertical spacing between the Banner and adjacent elements.
|
|
11
|
+
|
|
12
|
+
- Dismissal: Banners remain visible until they are dismissed or the condition
|
|
13
|
+
resolves. Include a dismiss button only when no further user action is
|
|
14
|
+
required.#### Global Banner (Web and Mobile)Use Global banner for system-wide messages that need to persist beyond a
|
|
15
|
+
specific view or layout.It should be positioned above the top navigation bar
|
|
16
|
+
It should be full-width, flush with the screen edgesNote that Global Banner is a separate component (there's a version of it in
|
|
17
|
+
Jobber and Jobber Online repos).## VariantsBanners come in four types; `success`, `notice`, `warning` and `error`. Each
|
|
18
|
+
type has guidelines for usage:### Success```tsx
|
|
19
|
+
import type { ComponentProps } from "react";
|
|
20
|
+
import React from "react";
|
|
21
|
+
import { Banner } from "@jobber/components/Banner";
|
|
22
|
+
|
|
23
|
+
export function BannerSuccessVariantExample(
|
|
24
|
+
props: Partial<ComponentProps<typeof Banner>>,
|
|
25
|
+
) {
|
|
26
|
+
return (
|
|
27
|
+
<Banner type="success" {...props}>
|
|
28
|
+
You've connected your bank account and can start receiving payouts.
|
|
29
|
+
</Banner>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
```Success banners are appropriate when:A meaningful user action is complete and feedback is delayed or needs to
|
|
33
|
+
persistIt’s important for SPs to understand that a key change has been appliedOtherwise, use [Toast](../Toast/Toast.md) as the default for success messages.
|
|
34
|
+
Do not use the term "Success" when writing a success banner.### Notice (Info)```tsx
|
|
35
|
+
import type { ComponentProps } from "react";
|
|
36
|
+
import React from "react";
|
|
37
|
+
import { Banner } from "@jobber/components/Banner";
|
|
38
|
+
|
|
39
|
+
export function BannerNoticeExample(
|
|
40
|
+
props: Partial<ComponentProps<typeof Banner>>,
|
|
41
|
+
) {
|
|
42
|
+
return (
|
|
43
|
+
<Banner type="notice" {...props}>
|
|
44
|
+
Your visits are being scheduled
|
|
45
|
+
</Banner>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
```Use notice (info) banners to provide information about:Informing SPs of background operations such as visits being scheduled
|
|
49
|
+
Communicating new features or non-blocking advice
|
|
50
|
+
Maintenance windows or known system statesNotices should get to the point and inform the user about why the functionality
|
|
51
|
+
or change is important, especially if the impact isn't obvious.### Warning```tsx
|
|
52
|
+
import type { ComponentProps } from "react";
|
|
53
|
+
import React from "react";
|
|
54
|
+
import { Banner } from "@jobber/components/Banner";
|
|
55
|
+
|
|
56
|
+
export function BannerWarningExample(
|
|
57
|
+
props: Partial<ComponentProps<typeof Banner>>,
|
|
58
|
+
) {
|
|
59
|
+
return (
|
|
60
|
+
<Banner type="warning" {...props}>
|
|
61
|
+
Your subscription will be automatically upgraded in 8 days
|
|
62
|
+
</Banner>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
```Use warning banners when:An SPs action may cause unintended effects or a system state change
|
|
66
|
+
Additional action has to be taken by the SPWarning messages should be one to two short sentences that describe the possibly
|
|
67
|
+
unknown impact changes or actions will have.They should not use "alarmist" language such as start with "Warning" and should
|
|
68
|
+
avoid exclamation points. Additionally, they should not be used as a way of
|
|
69
|
+
blocking or redirecting a workflow.#### Warning banner vs. Confirmation modalOn web, you should use [ConfirmationModal](/components/ConfirmationModal) when
|
|
70
|
+
you need to get explicit confirmation from the SP before they complete an action
|
|
71
|
+
that is difficult to reverse.| Use a **Warning Banner** when... | Use a **Confirmation Modal** when... |
|
|
72
|
+
| --------------------------------------------------- | --------------------------------------------------- |
|
|
73
|
+
| You’re communicating a persistent or upcoming state | You need to confirm intent before proceeding |
|
|
74
|
+
| The SP needs to act, but isn’t initiating the risk | The SP is triggering a high-impact change |
|
|
75
|
+
| The risk persists until resolved (e.g. paused plan) | The action could disrupt billing, payments, or data |
|
|
76
|
+
| You want the message visible across sessions | You want to keep context to current action |
|
|
77
|
+
| The SP may need time to decide or follow up | The SP must make a choice before continuing |### Error message```tsx
|
|
78
|
+
import type { ComponentProps } from "react";
|
|
79
|
+
import React from "react";
|
|
80
|
+
import { Banner } from "@jobber/components/Banner";
|
|
81
|
+
|
|
82
|
+
export function BannerErrorExample(
|
|
83
|
+
props: Partial<ComponentProps<typeof Banner>>,
|
|
84
|
+
) {
|
|
85
|
+
return (
|
|
86
|
+
<Banner type="error" icon="alert" {...props}>
|
|
87
|
+
Your changes couldn't be saved. Check your connection and try again.
|
|
88
|
+
</Banner>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
```Use error banners when:an issue requires immediate attention
|
|
92
|
+
an issue is blocking the SP
|
|
93
|
+
inline validation can not be usedErrors should explain what happened, and how to address the issue in a concise
|
|
94
|
+
manner.System errors should avoid technical or intimidating language, and provide ways
|
|
95
|
+
to resolve or troubleshoot the issue if possible. Don't use error codes.Using an `icon` prop is optional, but can be used to provide additional visual
|
|
96
|
+
context to the user.#### Errors in forms (Web)If an error is directly related to an input, don't use a banner. Use the
|
|
97
|
+
[InputText validation message](/?path=/story/components-forms-and-inputs-inputvalidation--basic)
|
|
98
|
+
component or, if unavailable, [InputValidation](/components/InputValidation).
|
|
99
|
+
Scroll to the first affected field on submission.#### Errors in forms (Mobile)In forms, use the error Banner when the response from submitting the form has
|
|
100
|
+
returned errors. See
|
|
101
|
+
[Error Details](/storybook/mobile/?path=/story/components-status-and-feedback-banner--error-details)
|
|
102
|
+
as an example.In conjunction, each impacted input should display its own inline error
|
|
103
|
+
messaging to aid in "recognition over recall" as the user scrolls down through
|
|
104
|
+
the form to rectify the issues.If an input can be validated client-side (immediately, before the form is
|
|
105
|
+
submitted to the server), you don't need to provide a Banner that duplicates the
|
|
106
|
+
error messages. Use inline validation on the inputs to prevent the user from
|
|
107
|
+
submitting invalid data. If the user ignores client-side error messages and
|
|
108
|
+
submits anyways, show them the error Banner along with the errors on the
|
|
109
|
+
individual input(s).## Content guidelinesBanner messages should be concise, clear, and actionable. They inform users of
|
|
110
|
+
system states, requirements, or follow-ups—especially ones that persist until
|
|
111
|
+
resolved.This guidance helps ensure Banners are useful for all users, and particularly
|
|
112
|
+
for SPs who may be multitasking, working on mobile, or managing their business
|
|
113
|
+
on the go.#### General guidanceUse plain, direct language.
|
|
114
|
+
Limit to 1–2 short sentences (ideally under 200 characters).
|
|
115
|
+
Start with what’s happening, then what’s needed (if anything).
|
|
116
|
+
Be specific—avoid vague phrases like “something went wrong.”You can reuse key terms from the message in the CTA, especially to reinforce
|
|
117
|
+
the action.Use full sentences for clarity. Avoid fragments or trailing thoughts.#### SP specific tipsPrioritize clarity over cleverness. SPs need fast, scannable guidance.Avoid backend or system terms (e.g. “system error,” “processing failed”).Frame language around outcomes: payouts, scheduling, client experience.Keep urgency proportional to actual impact.#### Language RulesAvoid exclamation points. They add unnecessary emotion and visual noise.Don’t use “Heads up,” “FYI,” or “Just so you know.” These take space but say
|
|
118
|
+
nothing.Get to the point as quickly as possible. Start with the action required if
|
|
119
|
+
there is one.Avoid apologizing in system messages. Focus on clarity and resolution rather
|
|
120
|
+
than sentiment.#### Language examples| Type | ✅ Better phrasing | ❌ Less clear phrasing |
|
|
121
|
+
| ------- | ------------------------------------------------------------------------------------------ | ----------------------------------------------- |
|
|
122
|
+
| Success | “You've connected your bank account and can start recieving payouts.” | “Bank connection successful!” |
|
|
123
|
+
| | “Your logo has been added to your invoices.” | “Update saved successfully.” |
|
|
124
|
+
| Notice | “Client reminders now include a booking link.” | “We’ve made updates to reminders.” |
|
|
125
|
+
| | “You can now double-book visits on your calendar.” | “New scheduling feature added.” |
|
|
126
|
+
| Warning | “To receive payouts, you need to add your bank account details.” CTA: “Add bank account” | “Missing payout details!” |
|
|
127
|
+
| | “Your trial ends in 2 days. Select a plan to keep your account active.” CTA: “Select plan” | “Trial ending—don’t forget to upgrade!” |
|
|
128
|
+
| Error | “We couldn’t sync your calendar. Try reconnecting your account.” | “Calendar sync failed: error 503.” |
|
|
129
|
+
| | “We couldn’t save your changes. Check your connection and try again.” | “Something went wrong. Please try again later.” |Use these examples as starting points. Focus on clarity, relevance, and next
|
|
130
|
+
steps. For actions that must be taken, make the language outcome-focused, rather
|
|
131
|
+
than technical or emotional.## Dos and Don'tsIn summary, here are some general rules to follow when working with the banner
|
|
132
|
+
component:#### Do: ✅ Use for persistent and important messages 
|
|
133
|
+
 ✅ Try to keep the content to under 200 characters 
|
|
134
|
+
 ✅ Align messaging with SP context and workflows 
|
|
135
|
+
 ✅ Provide a CTA if user action is needed 
|
|
136
|
+
 ✅ Use inline validation for field-level form errors #### Don't: ❌ Use Banners for short-lived success feedback (use the Toast component instead) ❌ Stack multiple Banners without clear visual hierarchy 
|
|
137
|
+
 ❌ Add filler intros like “Heads up” or “FYI" 
|
|
138
|
+
 ❌ Over-explain or apologize; stay focused and practical ## Accessibility notes Banners should be announced to screen readers when renderedEnsure high contrast between background and text—especially for error and
|
|
139
|
+
warning statesAvoid positioning mobile Banners over navigation or actionable UI## Related components- To provide low-priority, temporary feedback on the outcome of a user action,
|
|
140
|
+
use [Toast](../Toast/Toast.md) instead.
|
|
141
|
+
- Use [ConfirmationModal](/components/ConfirmationModal) when you need to get
|
|
142
|
+
explicit confirmation from the user before they complete an action.
|
|
143
|
+
- As stated in the Behaviour section, Global Banner is a a separate component
|
|
144
|
+
(shared component, a version exists in both the Jobber and Jobber Online
|
|
145
|
+
repos).
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
## Configuration
|
|
149
|
+
|
|
150
|
+
### Actions (web)
|
|
151
|
+
|
|
152
|
+
It is discouraged to use a Button component when requiring an action within a
|
|
153
|
+
Banner. If you require an action, use the `primaryActions` prop. The
|
|
154
|
+
`primaryAction` accepts the same props as the Button component.
|
|
155
|
+
|
|
156
|
+
See
|
|
157
|
+
[Actions in Banners](/storybook/web/?path=/story/components-status-and-feedback-banner--actions-in-banners)
|
|
158
|
+
for some examples.
|
|
159
|
+
|
|
160
|
+
### Actions (mobile)
|
|
161
|
+
|
|
162
|
+
Use the `action` prop to specify an `onPress` callback and a `label`. Banner
|
|
163
|
+
will render the action using an [ActionLabel](../ActionLabel/ActionLabel.md).
|
|
164
|
+
|
|
165
|
+
See
|
|
166
|
+
[Actions in Banners](/storybook/mobile/?path=/story/components-status-and-feedback-banner--actions-in-banners)
|
|
167
|
+
for an example.
|
|
168
|
+
|
|
169
|
+
## Component customization
|
|
170
|
+
|
|
171
|
+
### Composable usage
|
|
172
|
+
|
|
173
|
+
Banner exposes its internal building blocks as subcomponents: `Banner.Provider`,
|
|
174
|
+
`Banner.Content`, `Banner.DismissButton`, `Banner.Icon`, and `Banner.Action`.
|
|
175
|
+
This gives you more control over the Banner's appearance and behaviour.
|
|
176
|
+
|
|
177
|
+
Here's a basic example of how our current non-composable Banner is used:
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
<Banner type="success">Your account was upgraded successfully</Banner>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Using Banner's built-in subcomponents, this UI can alternatively be expressed
|
|
184
|
+
as:
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
<Banner.Provider type="success">
|
|
188
|
+
<Banner.Content>Your account was upgraded successfully</Banner.Content>
|
|
189
|
+
</Banner.Provider>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
If you want to completely disable the icon or dismiss button, you can set them
|
|
193
|
+
to false:
|
|
194
|
+
|
|
195
|
+
```tsx
|
|
196
|
+
<Banner.Provider type="success" icon={false} dismissButton={false}>
|
|
197
|
+
<Banner.Content>No icon or dismiss button</Banner.Content>
|
|
198
|
+
</Banner.Provider>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
If you need a custom icon, you can either configure `Banner.Icon` or pass in
|
|
202
|
+
your own element:
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
<Banner.Provider
|
|
206
|
+
type="notice"
|
|
207
|
+
icon={
|
|
208
|
+
<Banner.Icon
|
|
209
|
+
name="sparkles"
|
|
210
|
+
customColor="var(--color-base-purple--700)"
|
|
211
|
+
backgroundColor="base-purple--300"
|
|
212
|
+
/>
|
|
213
|
+
}
|
|
214
|
+
>
|
|
215
|
+
<Banner.Content>Custom purple sparkles icon</Banner.Content>
|
|
216
|
+
</Banner.Provider>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
If you need to customize the dismiss button, you can either configure
|
|
220
|
+
`Banner.DismissButton` or pass in your own element:
|
|
221
|
+
|
|
222
|
+
```tsx
|
|
223
|
+
<Banner.Provider
|
|
224
|
+
type="success"
|
|
225
|
+
dismissButton={<Banner.DismissButton onClick={() => alert("Dismissed")} />}
|
|
226
|
+
>
|
|
227
|
+
<Banner.Content>Your account was upgraded successfully</Banner.Content>
|
|
228
|
+
</Banner.Provider>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
For action buttons, you should use `Banner.Action`:
|
|
232
|
+
|
|
233
|
+
```tsx
|
|
234
|
+
<Banner.Provider type="warning">
|
|
235
|
+
<Banner.Content>
|
|
236
|
+
Changes to this visit will not be applied to future visits
|
|
237
|
+
</Banner.Content>
|
|
238
|
+
<Banner.Action label="More info" onClick={() => alert("More info...")} />
|
|
239
|
+
</Banner.Provider>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### UNSAFE\_ props (advanced usage)
|
|
243
|
+
|
|
244
|
+
General information for using `UNSAFE_` props can be found
|
|
245
|
+
[here](../customizing-components/customizing-components.md).
|
|
246
|
+
|
|
247
|
+
Banner has a few elements that can be targeted with classes or styles:
|
|
248
|
+
`Banner.Provider`, `Banner.Content`, `Banner.Icon`, `Banner.Action`, and
|
|
249
|
+
`Banner.DismissButton`.
|
|
250
|
+
|
|
251
|
+
**Note**: Use of `UNSAFE_` props is **at your own risk** and should be
|
|
252
|
+
considered a **last resort**. Future Popover updates may lead to unintended
|
|
253
|
+
breakages.
|
|
254
|
+
|
|
255
|
+
#### UNSAFE\_className
|
|
256
|
+
|
|
257
|
+
Use `UNSAFE_className` to apply custom classes to the Banner. This can be useful
|
|
258
|
+
for applying styles via CSS Modules.
|
|
259
|
+
|
|
260
|
+
```tsx
|
|
261
|
+
// YourComponent.module.css
|
|
262
|
+
.customContainer {
|
|
263
|
+
background-color: var(--color-surface--background);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.customIconContainer {
|
|
267
|
+
background-color: var(--color-base-red--600);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.customDismissButton {
|
|
271
|
+
background-color: var(--color-base-blue--200);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.customContent {
|
|
275
|
+
background-color: var(--color-base-pink--200);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.customActionButton {
|
|
279
|
+
background-color: var(--color-base-green--600);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// YourComponent.tsx
|
|
283
|
+
<Banner.Provider
|
|
284
|
+
type="error"
|
|
285
|
+
UNSAFE_className={{
|
|
286
|
+
container: styles.customContainer,
|
|
287
|
+
}}
|
|
288
|
+
icon={
|
|
289
|
+
<Banner.Icon
|
|
290
|
+
name="offline"
|
|
291
|
+
backgroundColor="base-purple--300"
|
|
292
|
+
UNSAFE_className={{
|
|
293
|
+
container: styles.customIconContainer,
|
|
294
|
+
icon: {
|
|
295
|
+
/* See Icon's UNSAFE_className for more information */
|
|
296
|
+
},
|
|
297
|
+
}}
|
|
298
|
+
/>
|
|
299
|
+
}
|
|
300
|
+
dismissButton={
|
|
301
|
+
<Banner.DismissButton
|
|
302
|
+
UNSAFE_className={{
|
|
303
|
+
container: styles.customDismissButton,
|
|
304
|
+
}}
|
|
305
|
+
/>
|
|
306
|
+
}
|
|
307
|
+
>
|
|
308
|
+
<Banner.Content
|
|
309
|
+
UNSAFE_className={{
|
|
310
|
+
container: styles.customContent,
|
|
311
|
+
}}
|
|
312
|
+
>
|
|
313
|
+
Banner content goes here
|
|
314
|
+
</Banner.Content>
|
|
315
|
+
<Banner.Action
|
|
316
|
+
label="More info"
|
|
317
|
+
onClick={() => alert("More info...")}
|
|
318
|
+
UNSAFE_className={{
|
|
319
|
+
container: styles.customActionButton,
|
|
320
|
+
button: {
|
|
321
|
+
/* See Button's UNSAFE_className for more information */
|
|
322
|
+
},
|
|
323
|
+
}}
|
|
324
|
+
/>
|
|
325
|
+
</Banner.Provider>
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
#### UNSAFE\_style
|
|
329
|
+
|
|
330
|
+
Use `UNSAFE_style` to apply inline custom styles to the Banner.
|
|
331
|
+
|
|
332
|
+
```tsx
|
|
333
|
+
<Banner.Provider
|
|
334
|
+
type="error"
|
|
335
|
+
UNSAFE_style={{
|
|
336
|
+
container: { backgroundColor: "var(--color-surface--background)" },
|
|
337
|
+
}}
|
|
338
|
+
icon={
|
|
339
|
+
<Banner.Icon
|
|
340
|
+
name="offline"
|
|
341
|
+
backgroundColor="base-purple--300"
|
|
342
|
+
UNSAFE_style={{
|
|
343
|
+
container: { backgroundColor: "var(--color-base-red--600)" },
|
|
344
|
+
icon: {
|
|
345
|
+
/* See Icon's UNSAFE_style for more information */
|
|
346
|
+
},
|
|
347
|
+
}}
|
|
348
|
+
/>
|
|
349
|
+
}
|
|
350
|
+
dismissButton={
|
|
351
|
+
<Banner.DismissButton
|
|
352
|
+
UNSAFE_style={{
|
|
353
|
+
container: { backgroundColor: "var(--color-base-blue--200)" },
|
|
354
|
+
}}
|
|
355
|
+
/>
|
|
356
|
+
}
|
|
357
|
+
>
|
|
358
|
+
<Banner.Content
|
|
359
|
+
UNSAFE_style={{
|
|
360
|
+
container: { backgroundColor: "var(--color-base-pink--200)" },
|
|
361
|
+
}}
|
|
362
|
+
>
|
|
363
|
+
Banner content goes here
|
|
364
|
+
</Banner.Content>
|
|
365
|
+
<Banner.Action
|
|
366
|
+
label="More info"
|
|
367
|
+
onClick={() => alert("More info...")}
|
|
368
|
+
UNSAFE_style={{
|
|
369
|
+
container: { backgroundColor: "var(--color-base-green--600)" },
|
|
370
|
+
button: {
|
|
371
|
+
/* See Button's UNSAFE_style for more information */
|
|
372
|
+
},
|
|
373
|
+
}}
|
|
374
|
+
/>
|
|
375
|
+
</Banner.Provider>
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
## Props
|
|
380
|
+
|
|
381
|
+
### Mobile
|
|
382
|
+
|
|
383
|
+
| Prop | Type | Required | Default | Description |
|
|
384
|
+
|------|------|----------|---------|-------------|
|
|
385
|
+
| `type` | `BannerTypes` | Yes | — | The primary theme of the banner, controls the things like the background color |
|
|
386
|
+
| `action` | `ActionProps` | No | — | The function that should be performed when the Banner is pressed |
|
|
387
|
+
| `children` | `string | ReactElement<unknown, string | JSXElementConstructor<any>> | ReactElement<unknown, string | JSXElementConstructor<any>>[]` | No | — | Custom content to be displayed in the banner |
|
|
388
|
+
| `details` | `string[]` | No | — | **Deprecated**: Use `children` with a `<TextList level="text" />` instead @deprecated |
|
|
389
|
+
| `icon` | `IconNames` | No | — | Adds an icon to the left of the banner content |
|
|
390
|
+
| `text` | `string` | No | — | **Deprecated**: Use `children` with a `<Text level="text" />` @deprecated |
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Borders and Dividers
|
|
2
|
+
|
|
3
|
+
You may find that a visual indicator is helpful to segment elements in an
|
|
4
|
+
interface. We have elements to help you do so in a consistent way across
|
|
5
|
+
platforms: borders and dividers.
|
|
6
|
+
|
|
7
|
+
## Borders
|
|
8
|
+
|
|
9
|
+
### Border Widths
|
|
10
|
+
|
|
11
|
+
To add a border to an element, use the border-width variables in the component's
|
|
12
|
+
styling to ensure consistent border thickness throughout Jobber.
|
|
13
|
+
|
|
14
|
+
Border style should be `solid` unless a specific use case calls for some other
|
|
15
|
+
format, such as indicating a dropzone on the
|
|
16
|
+
[`InputFile` component](/components/InputFile).
|
|
17
|
+
|
|
18
|
+
| Width | Visual | Value |
|
|
19
|
+
| :------------------ | :----- | :---- |
|
|
20
|
+
| `--border-base` | | |
|
|
21
|
+
| `--border-thick` | | |
|
|
22
|
+
| `--border-thicker` | | |
|
|
23
|
+
| `--border-thickest` | | |
|
|
24
|
+
|
|
25
|
+
The `base` border width should be used for most use cases (see
|
|
26
|
+
[`Card`](../Card/Card.md) and [`List` items](/components/List) for in-context
|
|
27
|
+
examples). You may want to consider thicker borders when the border conveys a
|
|
28
|
+
closing of already-divided sections, such as a
|
|
29
|
+
[`Table` footer](/components/Table).
|
|
30
|
+
|
|
31
|
+
### Border Colors
|
|
32
|
+
|
|
33
|
+
Borders should use `--color-border)` for most use cases.
|
|
34
|
+
[`List` sections](/components/List), [`Table` headers](/components/Table) and
|
|
35
|
+
other scenarios where other bordered content is being further subsectioned
|
|
36
|
+
should use `--color-border--section)`.
|
|
37
|
+
|
|
38
|
+
For accessibility reasons, ensure that color usage is not the only way to
|
|
39
|
+
[convey meaning](https://webaim.org/articles/contrast/#sc141) in an interface.
|
|
40
|
+
|
|
41
|
+
## Dividers
|
|
42
|
+
|
|
43
|
+
The [`Divider` component](../Divider/Divider.md) will help you segment sections of
|
|
44
|
+
content without writing additional styling. This component will render a
|
|
45
|
+
horizontal rule that takes up the full available width.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# BottomSheet
|
|
2
|
+
|
|
3
|
+
BottomSheet uses an overlay to focus attention to the user on the options
|
|
4
|
+
available after triggering a button. This helps isolate the decision-making that
|
|
5
|
+
a user has to make at each step of their interaction. BottomSheet is used to
|
|
6
|
+
bring up a modal from the bottom that will contain whatever children are passed
|
|
7
|
+
to it. Its height will be defined by the component that is passed to it.
|
|
8
|
+
|
|
9
|
+
## Design & usage guidelines
|
|
10
|
+
|
|
11
|
+
For the most part, a BottomSheet will be used in cases where the user is
|
|
12
|
+
choosing from a menu offering additional functionality related to onscreen
|
|
13
|
+
items.
|
|
14
|
+
|
|
15
|
+
In certain scenarios, you may need to add a title or an explicit option to
|
|
16
|
+
cancel the BottomSheet.
|
|
17
|
+
|
|
18
|
+
### Cancel
|
|
19
|
+
|
|
20
|
+
A **cancel action** should only be used in cases where:
|
|
21
|
+
|
|
22
|
+
* an action will *actually* be cancelled; if the only thing tapping "cancel"
|
|
23
|
+
will do is close the BottomSheet, don't use cancel
|
|
24
|
+
* it is not inherently obvious that tapping out of the BottomSheet will *not*
|
|
25
|
+
complete the desired preceding action initiated
|
|
26
|
+
|
|
27
|
+
### Heading
|
|
28
|
+
|
|
29
|
+
Add a **heading** to the BottomSheet in cases where the user has initiated a
|
|
30
|
+
preceding action which could result in a state change. In this case, the title
|
|
31
|
+
should repeat the preceding action label.
|
|
32
|
+
|
|
33
|
+
## Content guidelines
|
|
34
|
+
|
|
35
|
+
BottomSheetOption follows the same content guidelines as the web
|
|
36
|
+
[Menu.](/components/Menu)
|
|
37
|
+
|
|
38
|
+
## Mockup
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## Configuration
|
|
42
|
+
|
|
43
|
+
BottomSheet uses an internal BottomSheetOption to provide a preset pairing of an
|
|
44
|
+
Icon and an ActionLabel.
|
|
45
|
+
|
|
46
|
+
By default, the `<BottomSheet />` is not visible on the screen. To open the
|
|
47
|
+
`<BottomSheet />`, you need to add a `ref` attribute on it and call
|
|
48
|
+
`ref.current.open()`.
|
|
49
|
+
|
|
50
|
+
### onClose
|
|
51
|
+
|
|
52
|
+
Do not use `ref.current?.close()` inside the onClose callback. This could create
|
|
53
|
+
an infinite loop.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## Props
|
|
57
|
+
|
|
58
|
+
### Mobile
|
|
59
|
+
|
|
60
|
+
| Prop | Type | Required | Default | Description |
|
|
61
|
+
|------|------|----------|---------|-------------|
|
|
62
|
+
| `heading` | `string` | No | — | An optional heading to display in the bottom sheet header. |
|
|
63
|
+
| `loading` | `boolean` | No | `false` | Hide or show the cancel button when loading state is provided. |
|
|
64
|
+
| `onClose` | `() => void` | No | — | Callback that is called when the overlay is closed. |
|
|
65
|
+
| `onOpen` | `() => void` | No | — | Callback that is called when the overlay is opened. |
|
|
66
|
+
| `ref` | `Ref<BottomSheetRef>` | No | — | |
|
|
67
|
+
| `showCancel` | `boolean` | No | — | Display a cancel button in the bottom sheet footer. |
|