@jobber/components 7.12.0 → 7.12.2
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/Menu/Menu.md +151 -173
- package/dist/styles.css +19 -29
- package/package.json +2 -2
package/dist/docs/Menu/Menu.md
CHANGED
|
@@ -212,12 +212,13 @@ Minimum menu item height:
|
|
|
212
212
|
[Combobox](../Combobox/Combobox.md)
|
|
213
213
|
|
|
214
214
|
|
|
215
|
-
## Composable Version
|
|
215
|
+
## Composable Version
|
|
216
216
|
|
|
217
|
-
The
|
|
218
|
-
|
|
217
|
+
The composable API is the preferred way to build Menus. It supports a
|
|
218
|
+
declarative structure, richer customization, and adapts automatically between a
|
|
219
|
+
desktop dropdown and a small-screen bottom sheet.
|
|
219
220
|
|
|
220
|
-
```
|
|
221
|
+
```tsx
|
|
221
222
|
<Menu>
|
|
222
223
|
<Menu.Trigger>
|
|
223
224
|
<Button>Trigger</Button>
|
|
@@ -228,18 +229,10 @@ style, greater customization and composability with other components.
|
|
|
228
229
|
<Menu.ItemIcon name="email" />
|
|
229
230
|
</Menu.Item>
|
|
230
231
|
|
|
231
|
-
<
|
|
232
|
-
<Menu.
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
</PrivacyMask>
|
|
236
|
-
|
|
237
|
-
<AuthCheck can="viewAdmin">
|
|
238
|
-
<Menu.Item onClick={clickHandler("admin")} textValue="Admin">
|
|
239
|
-
<Menu.ItemLabel>Admin</Menu.ItemLabel>
|
|
240
|
-
<Menu.ItemIcon name="lock" />
|
|
241
|
-
</Menu.Item>
|
|
242
|
-
</AuthCheck>
|
|
232
|
+
<Menu.Item onClick={clickHandler("text")} textValue="Text message">
|
|
233
|
+
<Menu.ItemLabel>Text message</Menu.ItemLabel>
|
|
234
|
+
<Menu.ItemIcon name="sms" />
|
|
235
|
+
</Menu.Item>
|
|
243
236
|
</Menu.Content>
|
|
244
237
|
</Menu>
|
|
245
238
|
```
|
|
@@ -248,210 +241,195 @@ style, greater customization and composability with other components.
|
|
|
248
241
|
|
|
249
242
|
***Menu.Trigger (Required)***
|
|
250
243
|
|
|
251
|
-
An interactive element that
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
for appearance, however there is still a requirement that whatever is given to
|
|
255
|
-
Menu.Trigger must be an element with an interactive role.
|
|
256
|
-
|
|
257
|
-
Clicking the trigger again, or clicking anywhere outside the Menu at all will
|
|
258
|
-
close the Menu.
|
|
259
|
-
|
|
260
|
-
> **NOTICE:** To achieve a full-width Trigger, such as a Button please use UNSAFE\_style or
|
|
261
|
-
> UNSAFE\_className to set the desired display. See example below.
|
|
244
|
+
An interactive element that opens the Menu when clicked, tapped, or activated
|
|
245
|
+
with the keyboard. `Menu.Trigger` handles opening and closing the Menu, so the
|
|
246
|
+
trigger content itself does not need its own `onClick` to open it.
|
|
262
247
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
```
|
|
248
|
+
`Menu.Trigger` can render a default Atlantis trigger from simple content, accept
|
|
249
|
+
custom children such as a `Button` or `Chip`, or use a `render` prop when you
|
|
250
|
+
need full control over the trigger element. Whatever you provide must still be
|
|
251
|
+
interactive and accessible.
|
|
268
252
|
|
|
269
253
|
***Menu.Content (Required)***
|
|
270
254
|
|
|
271
|
-
A structural container
|
|
272
|
-
|
|
255
|
+
A structural container for menu content. It typically contains one or more
|
|
256
|
+
`Menu.Item`s and optional grouping or separation elements such as `Menu.Group`,
|
|
257
|
+
`Menu.GroupLabel`, and `Menu.Separator`.
|
|
258
|
+
|
|
259
|
+
Use `preferredPlacement` to influence desktop dropdown placement when needed.
|
|
273
260
|
|
|
274
261
|
***Menu.Item (Strongly recommended)***
|
|
275
262
|
|
|
276
|
-
The interactive
|
|
263
|
+
The primary interactive row in a Menu.
|
|
277
264
|
|
|
278
|
-
Each item
|
|
279
|
-
|
|
265
|
+
Each item should provide an `onClick` or an `href`. Provide `textValue` when the
|
|
266
|
+
visible content is abbreviated, custom, or otherwise not ideal for type-ahead
|
|
267
|
+
matching.
|
|
280
268
|
|
|
281
|
-
Menu
|
|
269
|
+
`Menu.Item` supports:
|
|
282
270
|
|
|
283
|
-
*
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
`destructive` variation Menu.Item prop.
|
|
287
|
-
* **Menu.ItemIcon**: Renders a leading icon with consistent sizing and spacing.
|
|
288
|
-
Responds to the `destructive` variation Menu.Item prop.
|
|
271
|
+
* `variation="destructive"` for destructive actions
|
|
272
|
+
* `closeOnClick` to control whether the Menu closes after selection
|
|
273
|
+
* `href`, `target`, and `rel` for link-style items
|
|
289
274
|
|
|
290
|
-
|
|
291
|
-
Menu's parent grid (see “Layout and spacing” below). Using them is the easiest
|
|
292
|
-
way to get correct spacing and alignment.
|
|
275
|
+
Default item subcomponents plug into the shared menu row layout:
|
|
293
276
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
277
|
+
* `Menu.ItemLabel`: Renders the primary label text.
|
|
278
|
+
* `Menu.ItemIcon`: Renders a leading icon.
|
|
279
|
+
* `Menu.ItemPrefix`: Renders custom leading content.
|
|
280
|
+
* `Menu.ItemSuffix`: Renders custom trailing content.
|
|
297
281
|
|
|
298
|
-
|
|
299
|
-
|
|
282
|
+
Use the built-in item pieces when possible. They align automatically across the
|
|
283
|
+
menu and respond to shared row styling such as destructive state.
|
|
300
284
|
|
|
301
|
-
|
|
285
|
+
If it is necessary to also adjust the *styles of the container*, style props
|
|
286
|
+
apply to the *container* element. No access is provided to internal markup due
|
|
287
|
+
to accessibility and behavior requirements.
|
|
302
288
|
|
|
303
|
-
|
|
304
|
-
some default spacing that can be overriden with `UNSAFE`.
|
|
289
|
+
***Menu.Group (Optional)***
|
|
305
290
|
|
|
306
|
-
|
|
291
|
+
A structural grouping element for related menu items. Use it to create scannable
|
|
292
|
+
sections or apply an `ariaLabel` to a related set of actions.
|
|
307
293
|
|
|
308
|
-
|
|
294
|
+
***Menu.GroupLabel (Optional)***
|
|
309
295
|
|
|
310
|
-
|
|
311
|
-
|
|
296
|
+
A presentational label for a `Menu.Group`. Use it to describe the category of
|
|
297
|
+
actions in that group. Prefer `Menu.GroupLabel` over custom text styling so
|
|
298
|
+
group headings stay consistent across menus.
|
|
312
299
|
|
|
313
300
|
***Menu.Separator (Optional)***
|
|
314
301
|
|
|
315
|
-
A
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
Comes with a default appearance that can be overriden with `UNSAFE`.
|
|
302
|
+
A visual divider used to separate groups of items or distinct sections of
|
|
303
|
+
content.
|
|
319
304
|
|
|
320
|
-
|
|
305
|
+
***Menu.RadioGroup and Menu.RadioItem (Optional)***
|
|
321
306
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
**any item** includes an icon:
|
|
307
|
+
Use radio items for persistent single-select choices such as a view mode,
|
|
308
|
+
sorting option, or filter state.
|
|
325
309
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
* If no items include `Menu.ItemIcon`, the grid collapses that column and all
|
|
329
|
-
labels move flush left.
|
|
310
|
+
Radio menus remain open by default after selection. Use `closeOnClick` on a
|
|
311
|
+
`Menu.RadioItem` if your experience should close after choosing an option.
|
|
330
312
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
313
|
+
```tsx
|
|
314
|
+
<Menu.RadioGroup defaultValue="list">
|
|
315
|
+
<Menu.RadioItem value="list" textValue="List view">
|
|
316
|
+
<Menu.ItemLabel>List view</Menu.ItemLabel>
|
|
317
|
+
</Menu.RadioItem>
|
|
318
|
+
<Menu.RadioItem value="board" textValue="Board view">
|
|
319
|
+
<Menu.ItemLabel>Board view</Menu.ItemLabel>
|
|
320
|
+
</Menu.RadioItem>
|
|
321
|
+
</Menu.RadioGroup>
|
|
322
|
+
```
|
|
341
323
|
|
|
342
|
-
|
|
324
|
+
***Menu.Submenu, Menu.SubmenuTrigger, and Menu.SubmenuContent (Optional)***
|
|
343
325
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
right).
|
|
348
|
-
* Apply your layout to the item container using `UNSAFE_style` or
|
|
349
|
-
`UNSAFE_className`. A simple, high‑success recipe is flex:
|
|
326
|
+
Use submenus when a related set of actions is better surfaced one level deeper.
|
|
327
|
+
On desktop, submenus open adjacent to the parent menu. On small screens, they
|
|
328
|
+
drill into a nested bottom-sheet view.
|
|
350
329
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
textValue="Email"
|
|
354
|
-
UNSAFE_style={{
|
|
355
|
-
display: 'flex',
|
|
356
|
-
alignItems: 'center',
|
|
357
|
-
justifyContent: 'space-between',
|
|
358
|
-
gap: 'var(--space-small)'
|
|
359
|
-
}}
|
|
360
|
-
>
|
|
361
|
-
<Typography element="span" fontWeight="semiBold">Email</Typography>
|
|
362
|
-
<StatusIndicator status="critical" />
|
|
363
|
-
</Menu.Item>
|
|
364
|
-
```
|
|
330
|
+
Provide a `textValue` on `Menu.SubmenuTrigger` when the submenu label should be
|
|
331
|
+
explicitly defined for typeahead behavior or the small-screen drill-down title.
|
|
365
332
|
|
|
366
|
-
|
|
367
|
-
desired.
|
|
333
|
+
### Deprecated wrappers
|
|
368
334
|
|
|
369
|
-
|
|
335
|
+
Older Menu code may use `Menu.Section`, `Menu.Header`, and `Menu.HeaderLabel`.
|
|
336
|
+
These wrappers still work for backward compatibility, but new code should use
|
|
337
|
+
`Menu.Group` and `Menu.GroupLabel` instead:
|
|
370
338
|
|
|
371
|
-
|
|
372
|
-
|
|
339
|
+
* `Menu.Group` replaces `Menu.Section` as the grouping container.
|
|
340
|
+
* `Menu.GroupLabel` replaces `Menu.Header` as the group heading.
|
|
341
|
+
* Do not use `Menu.HeaderLabel` in new code. Put the heading content directly
|
|
342
|
+
inside `Menu.GroupLabel`.
|
|
373
343
|
|
|
374
|
-
```
|
|
375
|
-
<Menu.
|
|
376
|
-
|
|
377
|
-
|
|
344
|
+
```tsx
|
|
345
|
+
<Menu.Group>
|
|
346
|
+
<Menu.GroupLabel>Sharing</Menu.GroupLabel>
|
|
347
|
+
<Menu.Item onClick={clickHandler("email")} textValue="Email">
|
|
348
|
+
<Menu.ItemLabel>Email</Menu.ItemLabel>
|
|
349
|
+
</Menu.Item>
|
|
350
|
+
</Menu.Group>
|
|
378
351
|
```
|
|
379
352
|
|
|
380
|
-
|
|
353
|
+
## Layout and spacing
|
|
381
354
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
> elements and can lead to unexpected spacing or alignment when combined with
|
|
385
|
-
> custom layouts.
|
|
386
|
-
>
|
|
387
|
-
> Also remember the mobile bottom‑sheet presentation has different dimensions;
|
|
388
|
-
> test custom layouts on small screens.
|
|
355
|
+
Composable menu rows use a shared grid/subgrid model so labels, icons, prefixes,
|
|
356
|
+
suffixes, radio indicators, and submenu chevrons align consistently across rows.
|
|
389
357
|
|
|
390
|
-
|
|
358
|
+
If at least one item uses a built-in leading slot such as `Menu.ItemIcon` or
|
|
359
|
+
`Menu.ItemPrefix`, the layout reserves leading space across the menu. If no
|
|
360
|
+
items use a built-in leading slot, the label column shifts flush left.
|
|
391
361
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
actions: [
|
|
397
|
-
{
|
|
398
|
-
label: "Edit",
|
|
399
|
-
icon: "edit",
|
|
400
|
-
onClick: () => {
|
|
401
|
-
alert("✏️");
|
|
402
|
-
},
|
|
403
|
-
},
|
|
404
|
-
],
|
|
405
|
-
},
|
|
406
|
-
{
|
|
407
|
-
header: "Send as...",
|
|
408
|
-
actions: [
|
|
409
|
-
{
|
|
410
|
-
label: "Text message",
|
|
411
|
-
icon: "sms",
|
|
412
|
-
onClick: () => {
|
|
413
|
-
alert("📱");
|
|
414
|
-
},
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
label: "Email",
|
|
418
|
-
icon: "email",
|
|
419
|
-
onClick: () => {
|
|
420
|
-
alert("📨");
|
|
421
|
-
},
|
|
422
|
-
},
|
|
423
|
-
],
|
|
424
|
-
},
|
|
425
|
-
]}
|
|
426
|
-
/>
|
|
427
|
-
```
|
|
362
|
+
This is why built-in item slots are the easiest way to get correct alignment and
|
|
363
|
+
spacing.
|
|
364
|
+
|
|
365
|
+
## Custom content (advanced)
|
|
428
366
|
|
|
429
|
-
|
|
367
|
+
Prefer the built-in Menu item pieces whenever possible. They provide the most
|
|
368
|
+
consistent alignment and behavior across menus.
|
|
430
369
|
|
|
431
|
-
|
|
370
|
+
Custom item layouts are an escape hatch for exceptional cases, not a preferred
|
|
371
|
+
authoring pattern.
|
|
432
372
|
|
|
433
|
-
|
|
434
|
-
|
|
373
|
+
> **WARNING:** Avoid mixing built-in slots with unrelated custom layout patterns unless you
|
|
374
|
+
> have tested carefully. The shared grid reserves space based on the presence of
|
|
375
|
+
> built-in slot content, which can lead to unexpected spacing or alignment. Also
|
|
376
|
+
> test custom layouts on small screens, where the Menu is presented in a bottom
|
|
377
|
+
> sheet.
|
|
435
378
|
|
|
436
|
-
|
|
437
|
-
considered a **last resort**. Future Menu updates may lead to unintended
|
|
438
|
-
breakages.
|
|
379
|
+
## Component customization
|
|
439
380
|
|
|
440
|
-
|
|
381
|
+
For the composable API, prefer `style` and `className` on the specific Menu
|
|
382
|
+
piece you are customizing.
|
|
441
383
|
|
|
442
|
-
* `
|
|
443
|
-
* `
|
|
444
|
-
* `
|
|
384
|
+
* Use `Menu.Trigger` to style the trigger wrapper.
|
|
385
|
+
* Use `Menu.Content` to control the menu panel.
|
|
386
|
+
* Use `Menu.Group`, `Menu.GroupLabel`, `Menu.Item`, and related subcomponents to
|
|
387
|
+
style individual structural pieces.
|
|
445
388
|
|
|
446
|
-
|
|
389
|
+
Deprecated `UNSAFE_*` props still exist for backward compatibility, but should
|
|
390
|
+
not be used in new code.
|
|
447
391
|
|
|
448
|
-
|
|
449
|
-
for applying styles via CSS Modules.
|
|
392
|
+
## Deprecated: `items` API
|
|
450
393
|
|
|
451
|
-
|
|
394
|
+
The `items` API still exists for backward compatibility, but it is deprecated
|
|
395
|
+
and should not be used for new implementations.
|
|
452
396
|
|
|
453
|
-
|
|
454
|
-
|
|
397
|
+
```tsx
|
|
398
|
+
<Menu
|
|
399
|
+
items={[
|
|
400
|
+
{
|
|
401
|
+
actions: [
|
|
402
|
+
{
|
|
403
|
+
label: "Edit",
|
|
404
|
+
icon: "edit",
|
|
405
|
+
onClick: () => {
|
|
406
|
+
alert("edit");
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
],
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
header: "Send as...",
|
|
413
|
+
actions: [
|
|
414
|
+
{
|
|
415
|
+
label: "Text message",
|
|
416
|
+
icon: "sms",
|
|
417
|
+
onClick: () => {
|
|
418
|
+
alert("text");
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
label: "Email",
|
|
423
|
+
icon: "email",
|
|
424
|
+
onClick: () => {
|
|
425
|
+
alert("email");
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
],
|
|
429
|
+
},
|
|
430
|
+
]}
|
|
431
|
+
/>
|
|
432
|
+
```
|
|
455
433
|
|
|
456
434
|
|
|
457
435
|
## Props
|
package/dist/styles.css
CHANGED
|
@@ -7649,53 +7649,43 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
|
|
|
7649
7649
|
.-hmXAsAfH9U-::picker(select) {
|
|
7650
7650
|
-webkit-appearance: base-select;
|
|
7651
7651
|
appearance: base-select;
|
|
7652
|
-
|
|
7653
|
-
/* Dropdown styling */
|
|
7654
7652
|
}
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
box-shadow: var(--shadow-base);
|
|
7658
|
-
margin-top: 8px;
|
|
7659
|
-
margin-top: var(--space-small);
|
|
7660
|
-
padding: 0;
|
|
7661
|
-
border: 1px solid hsl(200, 13%, 87%);
|
|
7662
|
-
border: var(--border-base) solid var(--color-border);
|
|
7663
|
-
border-radius: 8px;
|
|
7664
|
-
border-radius: var(--radius-base);
|
|
7665
|
-
background: rgba(255, 255, 255, 1);
|
|
7666
|
-
background: var(--color-surface);
|
|
7667
|
-
}
|
|
7668
|
-
|
|
7669
|
-
/* enable transitions in the drop down */
|
|
7653
|
+
|
|
7654
|
+
/* Dropdown styling + transitions */
|
|
7670
7655
|
.-hmXAsAfH9U-::picker(select) {
|
|
7671
|
-
|
|
7672
|
-
|
|
7656
|
+
box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1), 0px 4px 12px 0px rgba(0, 0, 0, 0.05);
|
|
7657
|
+
box-shadow: var(--shadow-base);
|
|
7658
|
+
margin-top: 8px;
|
|
7659
|
+
margin-top: var(--space-small);
|
|
7660
|
+
padding: 0;
|
|
7661
|
+
border: 1px solid hsl(200, 13%, 87%);
|
|
7662
|
+
border: var(--border-base) solid var(--color-border);
|
|
7663
|
+
border-radius: 8px;
|
|
7664
|
+
border-radius: var(--radius-base);
|
|
7665
|
+
background: rgba(255, 255, 255, 1);
|
|
7666
|
+
background: var(--color-surface);
|
|
7667
|
+
transition: opacity 200ms ease,
|
|
7673
7668
|
display 200ms allow-discrete,
|
|
7674
7669
|
overlay 200ms allow-discrete,
|
|
7675
7670
|
-webkit-transform 200ms ease-out;
|
|
7676
|
-
transition:
|
|
7677
|
-
opacity var(--timing-base) ease,
|
|
7671
|
+
transition: opacity var(--timing-base) ease,
|
|
7678
7672
|
display var(--timing-base) allow-discrete,
|
|
7679
7673
|
overlay var(--timing-base) allow-discrete,
|
|
7680
7674
|
-webkit-transform var(--timing-base) ease-out;
|
|
7681
|
-
transition:
|
|
7682
|
-
opacity 200ms ease,
|
|
7675
|
+
transition: opacity 200ms ease,
|
|
7683
7676
|
transform 200ms ease-out,
|
|
7684
7677
|
display 200ms allow-discrete,
|
|
7685
7678
|
overlay 200ms allow-discrete;
|
|
7686
|
-
transition:
|
|
7687
|
-
opacity var(--timing-base) ease,
|
|
7679
|
+
transition: opacity var(--timing-base) ease,
|
|
7688
7680
|
transform var(--timing-base) ease-out,
|
|
7689
7681
|
display var(--timing-base) allow-discrete,
|
|
7690
7682
|
overlay var(--timing-base) allow-discrete;
|
|
7691
|
-
transition:
|
|
7692
|
-
opacity 200ms ease,
|
|
7683
|
+
transition: opacity 200ms ease,
|
|
7693
7684
|
transform 200ms ease-out,
|
|
7694
7685
|
display 200ms allow-discrete,
|
|
7695
7686
|
overlay 200ms allow-discrete,
|
|
7696
7687
|
-webkit-transform 200ms ease-out;
|
|
7697
|
-
transition:
|
|
7698
|
-
opacity var(--timing-base) ease,
|
|
7688
|
+
transition: opacity var(--timing-base) ease,
|
|
7699
7689
|
transform var(--timing-base) ease-out,
|
|
7700
7690
|
display var(--timing-base) allow-discrete,
|
|
7701
7691
|
overlay var(--timing-base) allow-discrete,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "7.12.
|
|
3
|
+
"version": "7.12.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -583,5 +583,5 @@
|
|
|
583
583
|
"> 1%",
|
|
584
584
|
"IE 10"
|
|
585
585
|
],
|
|
586
|
-
"gitHead": "
|
|
586
|
+
"gitHead": "8d5e1d0aa4ed0efea1628f41ae20b29baf2da0c0"
|
|
587
587
|
}
|