@namroodinc/liquid-editorial 0.6.4 → 0.6.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/README.md +81 -1
- package/UPGRADING.md +160 -0
- package/dist/chunks/{Avatar-BTKqaJLP.cjs → Avatar-B_2lI7fS.cjs} +2 -2
- package/dist/chunks/{Avatar-BTKqaJLP.cjs.map → Avatar-B_2lI7fS.cjs.map} +1 -1
- package/dist/chunks/{Avatar-C1q2AUD-.js → Avatar-DdFEOumt.js} +3 -3
- package/dist/chunks/{Avatar-C1q2AUD-.js.map → Avatar-DdFEOumt.js.map} +1 -1
- package/dist/chunks/{Board-z688-51u.js → Board-B8wK079I.js} +2 -2
- package/dist/chunks/{Board-z688-51u.js.map → Board-B8wK079I.js.map} +1 -1
- package/dist/chunks/{Board-CUt4j2-8.cjs → Board-CMf5Azt0.cjs} +2 -2
- package/dist/chunks/{Board-CUt4j2-8.cjs.map → Board-CMf5Azt0.cjs.map} +1 -1
- package/dist/chunks/{ColourField-BwDb7ydB.js → ColourField-DC6cLb9h.js} +7 -3
- package/dist/chunks/ColourField-DC6cLb9h.js.map +1 -0
- package/dist/chunks/ColourField-NnFxLEsh.cjs +2 -0
- package/dist/chunks/ColourField-NnFxLEsh.cjs.map +1 -0
- package/dist/chunks/DatePicker-01sor8iD.cjs +2 -0
- package/dist/chunks/DatePicker-01sor8iD.cjs.map +1 -0
- package/dist/chunks/{DatePicker-C1zcScC3.js → DatePicker-DJAqXUDJ.js} +2 -2
- package/dist/chunks/DatePicker-DJAqXUDJ.js.map +1 -0
- package/dist/chunks/EntryPicker-CR8Phuzl.js +180 -0
- package/dist/chunks/EntryPicker-CR8Phuzl.js.map +1 -0
- package/dist/chunks/EntryPicker-D7JIgx23.cjs +2 -0
- package/dist/chunks/EntryPicker-D7JIgx23.cjs.map +1 -0
- package/dist/chunks/{FormEditor-C4PJu7ZF.js → FormEditor-BSfxVqLn.js} +192 -146
- package/dist/chunks/FormEditor-BSfxVqLn.js.map +1 -0
- package/dist/chunks/FormEditor-DNcSAnRF.cjs +2 -0
- package/dist/chunks/FormEditor-DNcSAnRF.cjs.map +1 -0
- package/dist/chunks/Message-CaX8Y1Xb.js +74 -0
- package/dist/chunks/Message-CaX8Y1Xb.js.map +1 -0
- package/dist/chunks/Message-DU31JAb3.cjs +2 -0
- package/dist/chunks/Message-DU31JAb3.cjs.map +1 -0
- package/dist/chunks/{RichTextEditor-DEJ-u-ZR.js → RichTextEditor-CNkwWist.js} +2 -2
- package/dist/chunks/{RichTextEditor-DEJ-u-ZR.js.map → RichTextEditor-CNkwWist.js.map} +1 -1
- package/dist/chunks/{RichTextEditor-Ddk7qaqg.cjs → RichTextEditor-DAnjElUO.cjs} +2 -2
- package/dist/chunks/{RichTextEditor-Ddk7qaqg.cjs.map → RichTextEditor-DAnjElUO.cjs.map} +1 -1
- package/dist/chunks/context-BONPXF-V.cjs.map +1 -1
- package/dist/chunks/context-CXvOl4Kt.js.map +1 -1
- package/dist/chunks/frame-BBVQTBcX.cjs +2 -0
- package/dist/chunks/frame-BBVQTBcX.cjs.map +1 -0
- package/dist/chunks/frame-De6IuTQz.js +189 -0
- package/dist/chunks/frame-De6IuTQz.js.map +1 -0
- package/dist/chunks/group-Bj9ZKc0R.cjs +2 -0
- package/dist/chunks/group-Bj9ZKc0R.cjs.map +1 -0
- package/dist/chunks/group-Ckz4Xya-.js +34 -0
- package/dist/chunks/group-Ckz4Xya-.js.map +1 -0
- package/dist/chunks/limit-BX6-o1a2.cjs +2 -0
- package/dist/chunks/limit-BX6-o1a2.cjs.map +1 -0
- package/dist/chunks/limit-ChteDN4T.js +18 -0
- package/dist/chunks/limit-ChteDN4T.js.map +1 -0
- package/dist/chunks/mergeRefs-C6_5pADN.js +19 -0
- package/dist/chunks/mergeRefs-C6_5pADN.js.map +1 -0
- package/dist/chunks/mergeRefs-CZ-SArlE.cjs +2 -0
- package/dist/chunks/mergeRefs-CZ-SArlE.cjs.map +1 -0
- package/dist/chunks/useLimit-BOmHKdJE.js +73 -0
- package/dist/chunks/useLimit-BOmHKdJE.js.map +1 -0
- package/dist/chunks/useLimit-DXe_VmYl.cjs +2 -0
- package/dist/chunks/useLimit-DXe_VmYl.cjs.map +1 -0
- package/dist/chunks/{useTooltip-D6cJji8v.js → useTooltip-C5gvEoYk.js} +2 -1
- package/dist/chunks/{useTooltip-D6cJji8v.js.map → useTooltip-C5gvEoYk.js.map} +1 -1
- package/dist/chunks/{useTooltip-CCf79zE9.cjs → useTooltip-bTE_a2Xn.cjs} +2 -2
- package/dist/chunks/{useTooltip-CCf79zE9.cjs.map → useTooltip-bTE_a2Xn.cjs.map} +1 -1
- package/dist/components/AppShell/index.cjs +1 -1
- package/dist/components/AppShell/index.js +1 -1
- package/dist/components/Avatar/index.cjs +1 -1
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/Banner/index.cjs +2 -0
- package/dist/components/Banner/index.cjs.map +1 -0
- package/dist/components/Banner/index.d.cts +6 -0
- package/dist/components/Banner/index.d.cts.map +1 -0
- package/dist/components/Banner/index.d.ts +6 -0
- package/dist/components/Banner/index.d.ts.map +1 -0
- package/dist/components/Banner/index.js +18 -0
- package/dist/components/Banner/index.js.map +1 -0
- package/dist/components/Banner/style.css +6 -0
- package/dist/components/Board/index.cjs +1 -1
- package/dist/components/Board/index.js +1 -1
- package/dist/components/Choice/index.cjs +1 -1
- package/dist/components/Choice/index.js +1 -1
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.cjs.map +1 -1
- package/dist/components/Drawer/index.js +6 -2
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.js +1 -1
- package/dist/components/EntryPicker/index.cjs +1 -2
- package/dist/components/EntryPicker/index.d.cts.map +1 -1
- package/dist/components/EntryPicker/index.d.ts.map +1 -1
- package/dist/components/EntryPicker/index.js +1 -171
- package/dist/components/EntryPicker/limit.d.cts +8 -0
- package/dist/components/EntryPicker/limit.d.cts.map +1 -0
- package/dist/components/EntryPicker/limit.d.ts +8 -0
- package/dist/components/EntryPicker/limit.d.ts.map +1 -0
- package/dist/components/Field/context.d.cts +6 -0
- package/dist/components/Field/context.d.cts.map +1 -1
- package/dist/components/Field/context.d.ts +6 -0
- package/dist/components/Field/context.d.ts.map +1 -1
- package/dist/components/Field/frame.d.cts +1 -1
- package/dist/components/Field/frame.d.cts.map +1 -1
- package/dist/components/Field/frame.d.ts +1 -1
- package/dist/components/Field/frame.d.ts.map +1 -1
- package/dist/components/Field/group.d.cts +1 -1
- package/dist/components/Field/group.d.cts.map +1 -1
- package/dist/components/Field/group.d.ts +1 -1
- package/dist/components/Field/group.d.ts.map +1 -1
- package/dist/components/Field/header.d.cts +12 -0
- package/dist/components/Field/header.d.cts.map +1 -0
- package/dist/components/Field/header.d.ts +12 -0
- package/dist/components/Field/header.d.ts.map +1 -0
- package/dist/components/Field/index.cjs +1 -1
- package/dist/components/Field/index.cjs.map +1 -1
- package/dist/components/Field/index.d.cts +1 -1
- package/dist/components/Field/index.d.cts.map +1 -1
- package/dist/components/Field/index.d.ts +1 -1
- package/dist/components/Field/index.d.ts.map +1 -1
- package/dist/components/Field/index.js +1 -1
- package/dist/components/Field/index.js.map +1 -1
- package/dist/components/Field/limit-reading.d.cts +12 -0
- package/dist/components/Field/limit-reading.d.cts.map +1 -0
- package/dist/components/Field/limit-reading.d.ts +12 -0
- package/dist/components/Field/limit-reading.d.ts.map +1 -0
- package/dist/components/Field/limit.d.cts +8 -0
- package/dist/components/Field/limit.d.cts.map +1 -0
- package/dist/components/Field/limit.d.ts +8 -0
- package/dist/components/Field/limit.d.ts.map +1 -0
- package/dist/components/Field/style.css +77 -0
- package/dist/components/Field/types.d.cts +12 -1
- package/dist/components/Field/types.d.cts.map +1 -1
- package/dist/components/Field/types.d.ts +12 -1
- package/dist/components/Field/types.d.ts.map +1 -1
- package/dist/components/Field/useLimit.d.cts +18 -0
- package/dist/components/Field/useLimit.d.cts.map +1 -0
- package/dist/components/Field/useLimit.d.ts +18 -0
- package/dist/components/Field/useLimit.d.ts.map +1 -0
- package/dist/components/FormEditor/README.md +62 -0
- package/dist/components/FormEditor/control.d.cts.map +1 -1
- package/dist/components/FormEditor/control.d.ts.map +1 -1
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.d.cts.map +1 -1
- package/dist/components/FormEditor/index.d.ts.map +1 -1
- package/dist/components/FormEditor/index.js +1 -1
- package/dist/components/FormEditor/model.d.cts +21 -8
- package/dist/components/FormEditor/model.d.cts.map +1 -1
- package/dist/components/FormEditor/model.d.ts +21 -8
- package/dist/components/FormEditor/model.d.ts.map +1 -1
- package/dist/components/Menu/index.cjs +1 -1
- package/dist/components/Menu/index.cjs.map +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.cjs.map +1 -1
- package/dist/components/Modal/index.js +6 -2
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.js +1 -1
- package/dist/components/Popover/style.css +2 -1
- package/dist/components/Popover/useTooltip.d.cts.map +1 -1
- package/dist/components/Popover/useTooltip.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/SearchField/index.cjs +1 -1
- package/dist/components/SearchField/index.cjs.map +1 -1
- package/dist/components/SearchField/index.d.cts.map +1 -1
- package/dist/components/SearchField/index.d.ts.map +1 -1
- package/dist/components/SearchField/index.js +27 -22
- package/dist/components/SearchField/index.js.map +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.cjs.map +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/SelectionCard/index.cjs +1 -1
- package/dist/components/SelectionCard/index.js +1 -1
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.js +1 -1
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.cjs.map +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/TagsInput/index.cjs +1 -1
- package/dist/components/TagsInput/index.cjs.map +1 -1
- package/dist/components/TagsInput/index.d.cts.map +1 -1
- package/dist/components/TagsInput/index.d.ts.map +1 -1
- package/dist/components/TagsInput/index.js +36 -30
- package/dist/components/TagsInput/index.js.map +1 -1
- package/dist/components/TextField/index.cjs +1 -1
- package/dist/components/TextField/index.cjs.map +1 -1
- package/dist/components/TextField/index.d.cts.map +1 -1
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/components/TextField/index.js +35 -20
- package/dist/components/TextField/index.js.map +1 -1
- package/dist/components/Time/index.cjs +1 -1
- package/dist/components/Time/index.js +2 -2
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.cjs.map +1 -1
- package/dist/components/Toast/index.d.cts.map +1 -1
- package/dist/components/Toast/index.d.ts.map +1 -1
- package/dist/components/Toast/index.js +35 -60
- package/dist/components/Toast/index.js.map +1 -1
- package/dist/components/Toast/style.css +5 -50
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -16
- package/dist/internal/Message.d.cts +23 -0
- package/dist/internal/Message.d.cts.map +1 -0
- package/dist/internal/Message.d.ts +23 -0
- package/dist/internal/Message.d.ts.map +1 -0
- package/dist/internal/mergeRefs.d.cts +5 -1
- package/dist/internal/mergeRefs.d.cts.map +1 -1
- package/dist/internal/mergeRefs.d.ts +5 -1
- package/dist/internal/mergeRefs.d.ts.map +1 -1
- package/dist/message.css +122 -0
- package/dist/styles.css +2 -0
- package/dist/tokens.css +36 -12
- package/package.json +1 -1
- package/dist/chunks/ColourField-Bk5O632x.cjs +0 -2
- package/dist/chunks/ColourField-Bk5O632x.cjs.map +0 -1
- package/dist/chunks/ColourField-BwDb7ydB.js.map +0 -1
- package/dist/chunks/DatePicker-BVsloqVY.cjs +0 -2
- package/dist/chunks/DatePicker-BVsloqVY.cjs.map +0 -1
- package/dist/chunks/DatePicker-C1zcScC3.js.map +0 -1
- package/dist/chunks/FormEditor-C4PJu7ZF.js.map +0 -1
- package/dist/chunks/FormEditor-Dd44EMp_.cjs +0 -2
- package/dist/chunks/FormEditor-Dd44EMp_.cjs.map +0 -1
- package/dist/chunks/frame-Bs_jaQRw.js +0 -70
- package/dist/chunks/frame-Bs_jaQRw.js.map +0 -1
- package/dist/chunks/frame-CNxvbg0D.cjs +0 -2
- package/dist/chunks/frame-CNxvbg0D.cjs.map +0 -1
- package/dist/chunks/group-CzbacuAY.js +0 -29
- package/dist/chunks/group-CzbacuAY.js.map +0 -1
- package/dist/chunks/group-pKDQtq-9.cjs +0 -2
- package/dist/chunks/group-pKDQtq-9.cjs.map +0 -1
- package/dist/chunks/mergeRefs-Bc3qS0Tt.cjs +0 -2
- package/dist/chunks/mergeRefs-Bc3qS0Tt.cjs.map +0 -1
- package/dist/chunks/mergeRefs-DGM402mE.js +0 -10
- package/dist/chunks/mergeRefs-DGM402mE.js.map +0 -1
- package/dist/components/EntryPicker/index.cjs.map +0 -1
- package/dist/components/EntryPicker/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ Field supplies labels and validation relationships. Button supplies action styli
|
|
|
77
77
|
|
|
78
78
|
## Component catalogue
|
|
79
79
|
|
|
80
|
-
All **
|
|
80
|
+
All **44 families** and **94 runtime exports** are listed below, including compound components, hooks, helpers, and compatibility aliases. Each family links to a practical guide and its source stories. Run Storybook locally for interactive examples; this README does not assume a hosted Storybook. Exported TypeScript declarations provide the detailed prop reference.
|
|
81
81
|
|
|
82
82
|
### Actions and feedback catalogue
|
|
83
83
|
|
|
@@ -90,6 +90,7 @@ All **43 families** and **93 runtime exports** are listed below, including compo
|
|
|
90
90
|
| [Drawer](#drawer) | `Drawer` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Drawer/Drawer.stories.tsx) |
|
|
91
91
|
| [Popover](#popover) | `Popover` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Popover/Popover.stories.tsx) |
|
|
92
92
|
| [Toast](#toast) | `Toast`, `ToastProvider`, `useToast` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Toast/Toast.stories.tsx) |
|
|
93
|
+
| [Banner](#banner) | `Banner` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Banner/Banner.stories.tsx) |
|
|
93
94
|
| [Badge](#badge) | `Badge` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Badge/Badge.stories.tsx) |
|
|
94
95
|
| [Icon](#icon) | `Icon`, `icons`, `iconNames` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Icon/Icon.stories.tsx) |
|
|
95
96
|
| [Avatar](#avatar) | `Avatar`, `AvatarGroup` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Avatar/Avatar.stories.tsx) |
|
|
@@ -367,6 +368,56 @@ export function HelpPopover() {
|
|
|
367
368
|
|
|
368
369
|
The caller owns opening, closing, keyboard/focus semantics, and outside-click handling. Pass `tabIndex={-1}` to a dialog panel so a click on its non-interactive content keeps focus inside it, where the caller's Escape handling still runs. A Modal or Drawer containing the anchor treats the open panel as its own, leaving Tab inside it to the panel. Use Menu, Select, Modal, or Drawer when their interactions fit. `matchAnchorWidth` suits listboxes; tall panels scroll without losing their scroll position during repositioning.
|
|
369
370
|
|
|
371
|
+
### Banner
|
|
372
|
+
|
|
373
|
+
A persistent, full-width message about the current view. `title` is required;
|
|
374
|
+
`children` accepts rich content and `actions` accepts shared Button controls.
|
|
375
|
+
Tones are `neutral` (default), `info`, `success`, `warning`, `danger`, and `review`.
|
|
376
|
+
The icon is hidden by default: pass `icon="auto"` for the tone's icon,
|
|
377
|
+
`icon="none"` to hide it explicitly, or an `IconName` such as `"clock"`.
|
|
378
|
+
|
|
379
|
+
```tsx
|
|
380
|
+
import { useState } from "react";
|
|
381
|
+
import { Banner, Button } from "@namroodinc/liquid-editorial";
|
|
382
|
+
|
|
383
|
+
export function ReviewBanner({ onReview }: { onReview: () => void }) {
|
|
384
|
+
const [visible, setVisible] = useState(true);
|
|
385
|
+
return visible ? (
|
|
386
|
+
<Banner
|
|
387
|
+
tone="review"
|
|
388
|
+
title="Waiting for review"
|
|
389
|
+
icon="auto"
|
|
390
|
+
onDismiss={() => setVisible(false)}
|
|
391
|
+
actions={<Button size="sm" onClick={onReview}>Review draft</Button>}
|
|
392
|
+
>
|
|
393
|
+
Sent to the <strong>Politics desk</strong> for legal sign-off.
|
|
394
|
+
</Banner>
|
|
395
|
+
) : null;
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
Banner never times out or hides itself. `onDismiss` shows a dismiss button; the
|
|
400
|
+
parent removes the banner. The button is named "Dismiss" by default; pass
|
|
401
|
+
`dismissLabel` to localize it, or to say which banner it closes when several
|
|
402
|
+
can be dismissed. Empty slots reserve no space: `false`, `null`, `""`, `true`,
|
|
403
|
+
empty arrays and empty fragments render no body or action row, and neither
|
|
404
|
+
does a `0` in `actions` (from `count && <Button />`). A `0` body still renders.
|
|
405
|
+
An icon name outside the curated set renders no icon.
|
|
406
|
+
|
|
407
|
+
Warning and danger default to `role="alert"`; the other tones use
|
|
408
|
+
`role="status"`. The default comes from the tone a banner mounts with and stays
|
|
409
|
+
when the tone changes later, because a live region must exist before its
|
|
410
|
+
content changes. Pass `role` when a banner may escalate. Banners set
|
|
411
|
+
`aria-atomic="false"`, so an update announces the text that changed rather
|
|
412
|
+
than the whole banner with its button labels. Existing content on initial
|
|
413
|
+
render is not reliably announced by live regions, so keep the message visible.
|
|
414
|
+
|
|
415
|
+
Style parts through `.ds-banner__icon`, `__body`, `__title`, `__description`,
|
|
416
|
+
`__actions` and `__dismiss`. The `ds-message__*` classes belong to the internal
|
|
417
|
+
renderer that Banner and Toast share with their tone styles, icons and dismiss
|
|
418
|
+
control, and also match toasts. Use Banner for persistent content and actions;
|
|
419
|
+
Toast remains a brief, text-only notification.
|
|
420
|
+
|
|
370
421
|
### Toast
|
|
371
422
|
|
|
372
423
|
Mount ToastProvider once, then call `useToast()` inside its descendants. The returned `toast` function accepts a title, optional description, tone, and duration in milliseconds. Tones are `neutral`, `info`, `success`, `warning`, and `danger`.
|
|
@@ -593,6 +644,29 @@ Use `isGroup` for a fieldset/legend around related controls and range widgets. K
|
|
|
593
644
|
|
|
594
645
|
`count` displays a Badge beside the label, including zero and totals above 99, without changing the accessible name. Bound EntryPicker, ChoiceGroup, and SelectionCardGroup share this frame and report their count unless Field supplies one. Their standalone label props remain usable; external `aria-labelledby` alone does not remove their frame. Import `FieldBinding`/`FieldRenderProps` when writing adapters. FormEditor uses the same binding path.
|
|
595
646
|
|
|
647
|
+
TextField, TextArea and SearchField report `maxLength` to their bound Field; TagsInput reports its `max` and committed tag count. A finite positive limit adds a reading and progress ring at the right of the label row. EntryPicker does the same for an explicitly capped multiple selection, both standalone and inside Field. Existing count badges remain beside the label. Controls without a Field frame do not gain a label or counter.
|
|
648
|
+
|
|
649
|
+
| Field option | Default | Behavior |
|
|
650
|
+
| --- | --- | --- |
|
|
651
|
+
| `limit?: FieldLimit` | Reported by the bound control | Explicit `{ count, max }` overrides automatic reporting, including during server rendering. |
|
|
652
|
+
| `limitDisplay` | `"used"` | `"used"` prints `48/70`; `"remaining"` prints `22 left`. |
|
|
653
|
+
| `limitVisibility` | `"always"` | `"nearLimit"` shows the counter from 80% usage. |
|
|
654
|
+
| `showLimitRing` | `true` | Hide the decorative ring while keeping the reading. |
|
|
655
|
+
|
|
656
|
+
```tsx
|
|
657
|
+
<Field label="Headline" limitDisplay="remaining">
|
|
658
|
+
{(binding) => <TextField {...binding} maxLength={70} defaultValue="The view from here" />}
|
|
659
|
+
</Field>
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
Configure these options on the owning Field or standalone EntryPicker. Bound pickers use their outer Field's presentation options. `FieldLimit` and `FieldLimitOptions` are exported from the root and Field subpath. Automatic manual-composition reports appear after mount; provide `limit` explicitly for server markup. An explicit `limit` replaces reporting, so bound controls skip it. If several bound controls report, the first to report keeps the reading while others come and go. FormEditor and standalone EntryPicker derive theirs before rendering.
|
|
663
|
+
|
|
664
|
+
TextField reports only for input types where browsers enforce `maxLength`: `text`, `search`, `url`, `tel`, `email` and `password`. Uncontrolled text controls follow typing, native form resets (read after the browser restores values, unless a listener cancels the reset, including when the `form` attribute changes) and programmatic `value` writes such as a form library's `setValue`. `value={null}` counts as uncontrolled, as in React. Unbound controls are not observed.
|
|
665
|
+
|
|
666
|
+
Character counts use JavaScript `.length`, matching native `maxLength` and FormEditor validation; an emoji can occupy two UTF-16 code units. Programmatically loaded values are preserved above the cap: the reading shows the actual count, remaining values can be negative, and the ring stops at full. The text turns warning at 85%, then danger and semibold at the limit. Counter descriptions join the active hint or error and stay out of accessible names. A persistent polite live region announces crossing into 85% and reaching the limit, once each, rather than every keystroke; it announces again only after usage drops back below that threshold. Loaded values are described, not announced. Disabled/read-only counters retain full strength. Motion uses the existing reduced-motion tokens.
|
|
667
|
+
|
|
668
|
+
Limited fields add `.ds-field__header` around the label and counter; limited groups retain a direct legend containing the label and counter, with the badge and required marker centred as in unlimited legends. A consumer's `aria-labelledby` or `aria-label` still names a limited standalone group. Use `.ds-field__label` rather than direct-child label selectors when customizing these fields. Existing unbounded frames keep their markup and styles; only labels beside a counter may break long words. Numeric/date bounds and uncapped or single pickers do not automatically show usage counters. Rich-text limits are deferred.
|
|
669
|
+
|
|
596
670
|
### TextField
|
|
597
671
|
|
|
598
672
|
TextField and TextArea wrap native text controls. Use native `value`/`defaultValue`, `onChange`, `disabled`, `readOnly`, and validation attributes. TextField sizes are `sm`, `md` (default), and `lg`; TextArea uses native rows.
|
|
@@ -1830,6 +1904,12 @@ Set `data-theme` on the document root to `light` (the default), `dark`, `cherry-
|
|
|
1830
1904
|
|
|
1831
1905
|
Theme tokens are included in `styles.css`. Import `@namroodinc/liquid-editorial/tokens.css` when you only need the token system. Keep themes on the document root so body-portaled dialogs and popovers inherit them. Overlays opened from inside a component that knows its place on the page carry that place's `data-theme`, `lang` and `dir` as attributes: a Popover takes them from its anchor, and RichTextEditor's expanded view, link dialog and anything opened from them take them from the editor. Other Modals and Drawers inherit from the document root; pass `dir` to Drawer explicitly where needed. Layouts support RTL and reduced-motion preferences where described in their guides.
|
|
1832
1906
|
|
|
1907
|
+
Colours the tokens derive from a theme re-derive on every `data-theme` element, so a themed subtree or overlay uses its own theme's values. These are the field fill ladder, soft hover and pressed fills, `-text` and `-border` tones, and status aliases. Override them on `:root, [data-theme]` rather than `:root` alone. Frame, rule, rail and control stroke colours remain root-level house-style settings. A custom container with its own fill sets `--field-bg` and carries `ds-field-surface`, so fields and buttons inside it rest, hover, focus and press against that fill:
|
|
1908
|
+
|
|
1909
|
+
```html
|
|
1910
|
+
<section class="ds-field-surface" style="--field-bg: var(--color-surface)">…</section>
|
|
1911
|
+
```
|
|
1912
|
+
|
|
1833
1913
|
## Upgrading
|
|
1834
1914
|
|
|
1835
1915
|
Read [UPGRADING.md](https://github.com/namroodinc/liquid-editorial/blob/main/UPGRADING.md) for adoption, compatibility, and verification steps between your previous and installed versions. The guide and AGENTS.md ship alongside the package manifest in `node_modules/@namroodinc/liquid-editorial/`.
|
package/UPGRADING.md
CHANGED
|
@@ -2,6 +2,166 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.6.6
|
|
6
|
+
|
|
7
|
+
### Shared field limit indicators
|
|
8
|
+
|
|
9
|
+
TextField, TextArea and SearchField now report native `maxLength` usage to their
|
|
10
|
+
bound Field; TextField does so only for `text`, `search`, `url`, `tel`, `email`
|
|
11
|
+
and `password` inputs, where browsers enforce it. TagsInput reports committed tags against `max`; EntryPicker reports
|
|
12
|
+
selected IDs against an explicit `max` in multiple mode. A finite positive limit
|
|
13
|
+
adds a used/max reading and decorative 16px progress ring at the label row's end.
|
|
14
|
+
The existing label count Badge remains in place. The ring mixes theme success,
|
|
15
|
+
warning and danger tones; text turns warning at 85% and danger/semibold at 100%.
|
|
16
|
+
At and above 100%, the ring uses a continuous stroke to prevent a small gap at
|
|
17
|
+
12 o'clock from the dashed-circle rendering. This requires no adoption changes.
|
|
18
|
+
|
|
19
|
+
Adds public `FieldLimit` (`count`, `max`) and `FieldLimitOptions`, exported from
|
|
20
|
+
the root and Field subpath. Field accepts `limit` to override automatic reports.
|
|
21
|
+
`limitDisplay` supports `"used"` (default) or `"remaining"`; `limitVisibility`
|
|
22
|
+
supports `"always"` (default) or `"nearLimit"` (visible from 80%); `showLimitRing`
|
|
23
|
+
defaults to true. Configure presentation on Field or a standalone EntryPicker.
|
|
24
|
+
Bound pickers use the outer Field's presentation. FormEditor's `shortText`,
|
|
25
|
+
`longText`, `tags`, `asset` and `reference` schema fields accept the same
|
|
26
|
+
presentation options at their top level. Picker limits remain in `picker.max`.
|
|
27
|
+
|
|
28
|
+
Adoption: existing positive limits show counters automatically. Use the new
|
|
29
|
+
options to choose remaining counts, near-limit visibility or text only. Manual
|
|
30
|
+
Field reports appear after mount; supply `limit` explicitly for server markup.
|
|
31
|
+
An explicit `limit` replaces control reports. When a Field binds several limited
|
|
32
|
+
controls, the first to report keeps the reading while others mount and unmount.
|
|
33
|
+
FormEditor and standalone EntryPicker supply it before rendering. Custom controls
|
|
34
|
+
can supply Field's explicit limit without implementing internal reporting hooks.
|
|
35
|
+
|
|
36
|
+
Compatibility: no exports or value contracts are removed. Character counts use
|
|
37
|
+
JavaScript `.length`, consistent with existing native limits and validation.
|
|
38
|
+
Over-limit loaded values remain intact; the ring clamps, while counts remain
|
|
39
|
+
accurate and remaining readings can be negative. Error timing, precedence, input
|
|
40
|
+
enforcement, refs and events stay supported. Counters join accessible descriptions
|
|
41
|
+
without changing names. A persistent polite region announces crossing 85% and
|
|
42
|
+
reaching the limit once each, not every keystroke; loaded values are not
|
|
43
|
+
announced. Uncontrolled text controls are counted on typing, native resets
|
|
44
|
+
(read after the browser restores values; cancelled resets keep the count, and
|
|
45
|
+
`form` attribute owners are followed) and programmatic `value` writes, such as
|
|
46
|
+
React Hook Form's `setValue` and `reset`. `value={null}` counts as uncontrolled,
|
|
47
|
+
as in React. Unbound controls are not observed. Forwarded refs keep host-ref
|
|
48
|
+
behavior, including React 19 ref cleanup functions. Disabled/read-only
|
|
49
|
+
counters remain full strength. Invalid new schema option values throw in rendering
|
|
50
|
+
and `validateFormValues`. Numeric/date bounds, uncapped and single pickers, and
|
|
51
|
+
rich text do not automatically gain counters. No dependency or manual version
|
|
52
|
+
change is required.
|
|
53
|
+
|
|
54
|
+
Limited fields add `.ds-field__header` around the label and counter. Limited
|
|
55
|
+
groups keep a direct legend containing the label text and counter, centred like
|
|
56
|
+
an unlimited legend. They are named by the label text unless you pass
|
|
57
|
+
`aria-labelledby` or `aria-label`, which still win. Update direct-child label selectors to use
|
|
58
|
+
`.ds-field__label`; existing unbounded Field markup and label styles are unchanged. Only labels
|
|
59
|
+
beside a counter may shrink and break a long word.
|
|
60
|
+
|
|
61
|
+
Verification: run library validation and consumer lint, types, tests and build.
|
|
62
|
+
Check controlled and uncontrolled edits, native resets (including reset buttons
|
|
63
|
+
and cancelled resets), changed caps, tag commits, picker updates, missing and
|
|
64
|
+
over-limit loaded values. With form libraries that write `value` directly (for
|
|
65
|
+
example React Hook Form `setValue`/`reset`), confirm the counter follows. Number,
|
|
66
|
+
date and other non-text TextField types must not show a counter. Review used/remaining modes,
|
|
67
|
+
80% visibility, 85% warning, full limits, errors and selection badges. With a
|
|
68
|
+
screen reader, confirm one announcement at 85% and at the limit, and none for
|
|
69
|
+
other keystrokes. Check that `aria-labelledby` or `aria-label` on a standalone
|
|
70
|
+
limited EntryPicker or FieldGroup still names it, and that labels in
|
|
71
|
+
min-content containers keep their longest word intact.
|
|
72
|
+
At and above the cap, confirm the ring closes fully; deleting below the cap must
|
|
73
|
+
restore partial progress.
|
|
74
|
+
Check narrow and RTL layouts, all four themes, scoped themes and reduced motion.
|
|
75
|
+
Verify server markup, root/subpath type imports and the packaged FormEditor guide.
|
|
76
|
+
|
|
77
|
+
## 0.6.5
|
|
78
|
+
|
|
79
|
+
### Banners and a shared notification foundation
|
|
80
|
+
|
|
81
|
+
Adds `Banner`, `BannerProps`, and `BannerTone`, available from the package root
|
|
82
|
+
or `@namroodinc/liquid-editorial/components/Banner`. Banner and Toast now share
|
|
83
|
+
an internal Message renderer and tone styles; Message is not a public component.
|
|
84
|
+
|
|
85
|
+
- Banner supports `neutral`, `info`, `success`, `warning`, `danger`, and `review`.
|
|
86
|
+
Supply a required string `title`, rich `children`, optional `actions` made
|
|
87
|
+
from shared Buttons, and `onDismiss` to show the dismiss control.
|
|
88
|
+
`dismissLabel` names that control (default "Dismiss").
|
|
89
|
+
- Icons are hidden by default. `icon="auto"` selects the tone's glyph,
|
|
90
|
+
`icon="none"` hides it, and an `IconName` selects a custom glyph. An unknown
|
|
91
|
+
name renders no icon instead of throwing.
|
|
92
|
+
- Empty slots reserve no space: `false`, `null`, `""`, `true`, empty arrays and
|
|
93
|
+
empty fragments render no body or action row, nor does `0` in `actions`.
|
|
94
|
+
- Banner stays in the page until its parent unmounts it. Warning and danger use
|
|
95
|
+
`role="alert"`; other tones use `role="status"`. The role comes from the tone
|
|
96
|
+
at mount and stays when the tone changes. Banners set `aria-atomic="false"`.
|
|
97
|
+
Native `role` and `aria-atomic` overrides work.
|
|
98
|
+
- Style Banner parts through `.ds-banner__icon`, `__body`, `__title`,
|
|
99
|
+
`__description`, `__actions` and `__dismiss`. `ds-message__*` classes are
|
|
100
|
+
internal and also match toasts.
|
|
101
|
+
- Adds `--color-review-border`, derived from each theme's review colour and fill.
|
|
102
|
+
- Every field-ladder control inside a message (fields, sliders, and simple and
|
|
103
|
+
neutral button hover/pressed fills) now rests, hovers, focuses and presses
|
|
104
|
+
against the message fill. Inside a toast that is the raised surface, a
|
|
105
|
+
barely visible change from the canvas-based hover toasts used before.
|
|
106
|
+
- The aggregate stylesheet now imports packaged `message.css`, which contains
|
|
107
|
+
shared presentation. Keep it when copying or processing the package styles.
|
|
108
|
+
|
|
109
|
+
Adoption: import Banner and the existing package `styles.css`; use `children`
|
|
110
|
+
for body content and shared `<Button size="sm">` controls in `actions`.
|
|
111
|
+
Remove the banner in `onDismiss` when dismissal is offered, and pass a
|
|
112
|
+
localized or specific `dismissLabel` where needed. Pass `role` explicitly for a
|
|
113
|
+
banner whose tone may escalate to warning or danger. No provider is needed.
|
|
114
|
+
|
|
115
|
+
Compatibility: additive, with no new dependencies or version changes. Toast
|
|
116
|
+
keeps its five tones, string description, default polite status, native role
|
|
117
|
+
override, `ds-toast__*` class hooks, `--toast-tone` hook, inherited text colour
|
|
118
|
+
and font, floating appearance, provider and duration behaviour. Its dismiss
|
|
119
|
+
button also gains a `ds-toast__dismiss` class. Toast's default remains five
|
|
120
|
+
seconds. Banner has no timer. Long unbroken titles and descriptions now wrap in
|
|
121
|
+
both presentations; action buttons keep whole labels. No FormEditor adapter is
|
|
122
|
+
needed because Banner is a display component, not a form control.
|
|
123
|
+
|
|
124
|
+
Verification: run library validation and consumer lint, typechecks, tests and
|
|
125
|
+
build. In a packed consumer, check all six banner tones in every theme and
|
|
126
|
+
inside a scoped `data-theme` subtree, automatic/hidden/custom icons, rich
|
|
127
|
+
blocks, wrapped action buttons at narrow widths, keyboard focus and
|
|
128
|
+
parent-controlled dismissal. Confirm the role stays fixed when a banner's tone
|
|
129
|
+
changes, toasts keep their styling, `--toast-tone` overrides and timeouts,
|
|
130
|
+
reduced-motion behaviour, root and Banner subpath imports, and resolution of
|
|
131
|
+
`message.css` from the aggregate stylesheet.
|
|
132
|
+
|
|
133
|
+
### Theme-scoped derived tokens and field surfaces
|
|
134
|
+
|
|
135
|
+
Tokens derived from theme colours are now declared on `:root, [data-theme]`
|
|
136
|
+
instead of `:root` only. These are `--field-bg`, the soft hover/pressed
|
|
137
|
+
ladders, `--color-*-text`, `--color-*-border` and the `--status-*` aliases. A
|
|
138
|
+
subtree or overlay whose `data-theme` differs from the root's now gets its own
|
|
139
|
+
theme's values instead of the root's results. The six field-ladder steps
|
|
140
|
+
(`--field-rest`, `-hover`, `-focus`, `-pressed`, `-invalid`, `-invalid-focus`)
|
|
141
|
+
also re-derive on a new `.ds-field-surface` class. Modal, Drawer, Table,
|
|
142
|
+
DatePicker's calendar, ColourField's panel, Menu, Select's listbox, tooltips,
|
|
143
|
+
Banner and Toast carry it. Their fields and buttons now hover and press against
|
|
144
|
+
their own fill instead of the canvas.
|
|
145
|
+
|
|
146
|
+
Adoption: a custom container that sets `--field-bg` should also carry
|
|
147
|
+
`ds-field-surface`, as should a custom panel using the internal
|
|
148
|
+
`ds-surface-raised` class. Move overrides of the derived tokens above from
|
|
149
|
+
`:root` to `:root, [data-theme]`, or override the base colours and
|
|
150
|
+
`--tint-*`/`--soft-step-*` steps they derive from.
|
|
151
|
+
|
|
152
|
+
Compatibility: no API is removed. The listed containers gain a
|
|
153
|
+
`ds-field-surface` class. Their hover, pressed, focus and invalid fills shift
|
|
154
|
+
slightly towards their own surface. Derived-token overrides set only on `:root`
|
|
155
|
+
no longer reach elements with their own `data-theme`. That includes overlays
|
|
156
|
+
that copy the document's theme. Frame, rule, rail and control stroke colours
|
|
157
|
+
stay root-level settings.
|
|
158
|
+
|
|
159
|
+
Verification: in each theme, hover and press buttons and fields inside a
|
|
160
|
+
Modal, Drawer, Table, Menu and calendar, and check that fills step from that
|
|
161
|
+
surface. Render a Banner and a Popover inside a `data-theme="dark"` subtree on
|
|
162
|
+
a light page and check soft fills, borders and icon colours match the dark
|
|
163
|
+
theme. Confirm any derived-token overrides still apply in overlays.
|
|
164
|
+
|
|
5
165
|
## 0.6.4
|
|
6
166
|
|
|
7
167
|
### Token icon and custom edit status labels
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./colour-BmtxDlWF.cjs"),t=require("../components/Button/index.cjs"),n=require("./mergeRefs-
|
|
2
|
-
//# sourceMappingURL=Avatar-
|
|
1
|
+
const e=require("./colour-BmtxDlWF.cjs"),t=require("../components/Button/index.cjs"),n=require("./mergeRefs-CZ-SArlE.cjs"),r=require("./useTooltip-bTE_a2Xn.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("colord"),s=require("colord/plugins/a11y");s=e.a(s,1),(0,o.extend)([s.default]);function c(t){let n=t?e.i(t):null;if(n&&n.alpha()===1)return{"--avatar-background":n.toHex(),"--avatar-foreground":n.contrast(`#000`)>=n.contrast(`#fff`)?`#000000`:`#ffffff`}}var l={24:`xs`,32:`sm`,40:`md`};function u(e){let t=e.trim().split(/\s+/);return((t[0]?.[0]??``)+(t.length>1?t[t.length-1][0]:``)).toUpperCase()}function d(e){let t={},n={};for(let[r,i]of Object.entries(e))(r.startsWith(`aria-`)?t:n)[r]=i;return{aria:t,other:n}}function f(e,t,n){return e?t?-1:void 0:!t&&n?0:void 0}function p({name:e,src:t}){return(0,a.jsx)(`span`,{className:`ds-avatar__content`,children:t?(0,a.jsx)(`img`,{src:t,alt:``}):u(e)})}function m({href:e,target:n,rel:r,hasCallback:i,size:o,semantics:s,children:c}){return e?(0,a.jsx)(`a`,{className:`ds-avatar__control`,href:e,target:n,rel:r,...s,children:c}):i?(0,a.jsx)(t.Button,{variant:`simple`,size:l[o],isIconOnly:!0,className:`ds-avatar__control`,...s,children:c}):(0,a.jsx)(a.Fragment,{children:c})}var h=(0,i.forwardRef)(function({name:e,src:t,colour:o,style:s,size:l=24,tooltip:u=e,href:h,target:g,rel:_,className:v,onClick:y,onMouseEnter:b,onMouseLeave:x,onFocus:S,onBlur:C,id:w,tabIndex:T,"aria-label":E=e,"aria-describedby":D,"aria-hidden":O,...k},A){let j=O===!0||O===`true`,M=!!h||!!y,{anchorRef:N,description:P,triggerProps:F,panel:I}=r.t(!j&&u,{placement:`top`,className:`ds-avatar-tooltip`}),L=(0,i.useMemo)(()=>n.t(N,A),[N,A]),R=(0,i.useMemo)(()=>c(o),[o]),{aria:z,other:B}=d(k),V={...z,id:w,"aria-label":E,"aria-describedby":[D,P].filter(Boolean).join(` `)||void 0,tabIndex:T??f(M,j,!!u)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`span`,{ref:L,role:M?void 0:`img`,"aria-hidden":O,...M?{}:V,"data-size":l,className:[`ds-avatar`,v].filter(Boolean).join(` `),...B,style:{...s,...R},onClick:y,...F({onMouseEnter:b,onMouseLeave:x,onFocus:S,onBlur:C}),children:(0,a.jsx)(m,{href:h,target:g,rel:_,hasCallback:!!y,size:l,semantics:V,children:(0,a.jsx)(p,{name:e,src:t})})}),I]})});function g({names:e}){let{anchorRef:t,description:n,triggerProps:i,panel:o}=r.t(e.join(`, `),{placement:`top`,className:`ds-avatar-tooltip`}),s=e.length;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`span`,{ref:t,role:`img`,className:`ds-avatar-group__count`,tabIndex:0,"aria-label":`${s} more ${s===1?`person`:`people`}`,"aria-describedby":n,...i(),children:[`+`,s]}),o]})}var _=(0,i.forwardRef)(function({people:e,size:t=24,className:n,...r},i){return(0,a.jsxs)(`span`,{ref:i,role:`group`,"aria-label":e.map(e=>e.name).join(`, `),className:[`ds-avatar-group`,n].filter(Boolean).join(` `),...r,children:[e.slice(0,3).map(({name:e,src:n,colour:r,tooltip:i,href:o,target:s,rel:c,onClick:l},u)=>(0,a.jsx)(h,{name:e,src:n,colour:r,tooltip:i,href:o,target:s,rel:c,onClick:l,size:t},`${e}-${u}`)),e.length>3&&(0,a.jsx)(g,{names:e.slice(3).map(e=>e.name)})]})});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
|
|
2
|
+
//# sourceMappingURL=Avatar-B_2lI7fS.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar-BTKqaJLP.cjs","names":["extend","a11yPlugin","parseColour","Button","_Fragment","forwardRef","useTooltip","useMemo","mergeRefs","require_colour","require_components_Button_index","require_mergeRefs","require_useTooltip","react","react_jsx_runtime","colord","colord_plugins_a11y","avatarColours","background","value","buttonSizes","initialsOf","words","name","splitAria","aria","other","key","props","defaultTabIndex","isActionable","isHidden","hasTooltip","AvatarContent","src","AvatarControl","href","semantics","hasCallback","size","Avatar","label","describedBy","hidden","onClick","tooltip","spanRef","anchorRef","ref","colours","colour","description","tabIndex","className","style","triggerProps","panel","OverflowCount","names","count","AvatarGroup","rest","people","p","index","person"],"sources":["../../src/components/Avatar/colour.ts","../../src/components/Avatar/index.tsx"],"sourcesContent":["import { extend } from \"colord\";\nimport a11yPlugin from \"colord/plugins/a11y\";\nimport { parseColour } from \"../ColourField/colour\";\n\nextend([a11yPlugin]);\n\n/** Opaque colours only: transparency would make contrast depend on the surface below. */\nexport function avatarColours(value?: string) {\n // Share ColourField's parser so both components accept and classify colours identically.\n const background = value ? parseColour(value) : null;\n if (!background || background.alpha() !== 1) {\n return undefined;\n }\n return {\n \"--avatar-background\": background.toHex(),\n \"--avatar-foreground\":\n background.contrast(\"#000\") >= background.contrast(\"#fff\") ? \"#000000\" : \"#ffffff\",\n };\n}\n","import {\n forwardRef,\n useMemo,\n type AnchorHTMLAttributes,\n type AriaAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { Button, type ButtonSize } from \"../Button\";\nimport { useTooltip } from \"../Popover/useTooltip\";\nimport { avatarColours } from \"./colour\";\nimport \"./style.css\";\n\nexport type AvatarSize = 24 | 32 | 40;\n\n/** Each avatar size is one of Button's square sizes, so callback avatars use Button unchanged. */\nconst buttonSizes: Record<AvatarSize, ButtonSize> = { 24: \"xs\", 32: \"sm\", 40: \"md\" };\n\nexport interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {\n /** Required — drives the initials and the accessible name. */\n name: string;\n src?: string;\n size?: AvatarSize;\n /** Solid hex, RGB, HSL or named background; initials automatically use contrasting black/white. */\n colour?: string;\n /** Defaults to name; false disables the hover/focus tooltip. */\n tooltip?: string | false;\n href?: string;\n target?: AnchorHTMLAttributes<HTMLAnchorElement>[\"target\"];\n rel?: string;\n}\n\nfunction initialsOf(name: string) {\n const words = name.trim().split(/\\s+/);\n const first = words[0]?.[0] ?? \"\";\n const last = words.length > 1 ? words[words.length - 1][0] : \"\";\n return (first + last).toUpperCase();\n}\n\n/** Separate ARIA attributes so they can follow the element that carries the role. */\nfunction splitAria<T extends object>(props: T) {\n const aria: Record<string, unknown> = {};\n const other: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(props)) {\n (key.startsWith(\"aria-\") ? aria : other)[key] = value;\n }\n return { aria: aria as AriaAttributes, other: other as Omit<T, keyof AriaAttributes> };\n}\n\n/**\n * Links and Buttons are natively focusable, and hidden ones leave the tab order.\n * A passive avatar is focusable only for a visible tooltip.\n */\nfunction defaultTabIndex(isActionable: boolean, isHidden: boolean, hasTooltip: boolean) {\n if (isActionable) {\n return isHidden ? -1 : undefined;\n }\n return !isHidden && hasTooltip ? 0 : undefined;\n}\n\nfunction AvatarContent({ name, src }: Pick<AvatarProps, \"name\" | \"src\">) {\n return (\n <span className=\"ds-avatar__content\">\n {src ? (\n <img\n src={src}\n alt=\"\"\n />\n ) : (\n initialsOf(name)\n )}\n </span>\n );\n}\n\ninterface AvatarControlProps extends Pick<AvatarProps, \"href\" | \"target\" | \"rel\"> {\n hasCallback: boolean;\n size: AvatarSize;\n /** Naming, description, id, ARIA state and tab order for the control. */\n semantics: HTMLAttributes<HTMLElement>;\n children: ReactNode;\n}\n\n/** The inner link or shared Button of an actionable avatar; passive content otherwise. */\nfunction AvatarControl({\n href,\n target,\n rel,\n hasCallback,\n size,\n semantics,\n children,\n}: AvatarControlProps) {\n if (href) {\n return (\n <a\n className=\"ds-avatar__control\"\n href={href}\n target={target}\n rel={rel}\n {...semantics}\n >\n {children}\n </a>\n );\n }\n if (hasCallback) {\n return (\n <Button\n variant=\"simple\"\n size={buttonSizes[size]}\n isIconOnly\n className=\"ds-avatar__control\"\n {...semantics}\n >\n {children}\n </Button>\n );\n }\n return <>{children}</>;\n}\n\n/**\n * A circular person identifier, optionally linked or actionable. The ref stays on\n * the outer span; `id` and ARIA attributes go to the image span, or to the inner\n * link or Button when the avatar is actionable.\n */\nexport const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(function Avatar(\n {\n name,\n src,\n colour,\n style,\n size = 24,\n tooltip = name,\n href,\n target,\n rel,\n className,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n id,\n tabIndex,\n \"aria-label\": label = name,\n \"aria-describedby\": describedBy,\n \"aria-hidden\": hidden,\n ...props\n },\n ref,\n) {\n const isHidden = hidden === true || hidden === \"true\";\n const isActionable = !!href || !!onClick;\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n isHidden ? false : tooltip,\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n // Stable across renders, so tooltip state changes never detach a caller's callback ref.\n const spanRef = useMemo(() => mergeRefs(anchorRef, ref), [anchorRef, ref]);\n const colours = useMemo(() => avatarColours(colour), [colour]);\n const { aria, other } = splitAria(props);\n const semantics = {\n ...aria,\n id,\n \"aria-label\": label,\n \"aria-describedby\": [describedBy, description].filter(Boolean).join(\" \") || undefined,\n tabIndex: tabIndex ?? defaultTabIndex(isActionable, isHidden, !!tooltip),\n };\n return (\n <>\n <span\n ref={spanRef}\n role={isActionable ? undefined : \"img\"}\n aria-hidden={hidden}\n {...(isActionable ? {} : semantics)}\n data-size={size}\n className={[\"ds-avatar\", className].filter(Boolean).join(\" \")}\n {...other}\n style={{ ...style, ...colours }}\n onClick={onClick}\n {...triggerProps({ onMouseEnter, onMouseLeave, onFocus, onBlur })}\n >\n <AvatarControl\n href={href}\n target={target}\n rel={rel}\n hasCallback={!!onClick}\n size={size}\n semantics={semantics}\n >\n <AvatarContent\n name={name}\n src={src}\n />\n </AvatarControl>\n </span>\n {panel}\n </>\n );\n});\n\ntype AvatarPerson = Pick<\n AvatarProps,\n \"name\" | \"src\" | \"colour\" | \"tooltip\" | \"href\" | \"target\" | \"rel\" | \"onClick\"\n>;\n\nexport interface AvatarGroupProps extends HTMLAttributes<HTMLSpanElement> {\n /** Up to three render; the rest become a +n count with a hidden-name tooltip. */\n people: AvatarPerson[];\n size?: AvatarSize;\n}\n\nfunction OverflowCount({ names }: { names: string[] }) {\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n names.join(\", \"),\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n const count = names.length;\n return (\n <>\n <span\n ref={anchorRef}\n role=\"img\"\n className=\"ds-avatar-group__count\"\n tabIndex={0}\n aria-label={`${count} more ${count === 1 ? \"person\" : \"people\"}`}\n aria-describedby={description}\n {...triggerProps()}\n >\n +{count}\n </span>\n {panel}\n </>\n );\n}\n\n/** Overlapping stack of at most three avatars, then a +n chip. */\nexport const AvatarGroup = forwardRef<HTMLSpanElement, AvatarGroupProps>(function AvatarGroup(\n { people, size = 24, className, ...rest },\n ref,\n) {\n return (\n <span\n ref={ref}\n role=\"group\"\n aria-label={people.map((p) => p.name).join(\", \")}\n className={[\"ds-avatar-group\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {/* Only documented person fields reach Avatar; extra application data stays off the DOM. */}\n {people\n .slice(0, 3)\n .map(({ name, src, colour, tooltip, href, target, rel, onClick }, index) => (\n <Avatar\n key={`${name}-${index}`}\n name={name}\n src={src}\n colour={colour}\n tooltip={tooltip}\n href={href}\n target={target}\n rel={rel}\n onClick={onClick}\n size={size}\n />\n ))}\n {people.length > 3 && <OverflowCount names={people.slice(3).map((person) => person.name)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EAAE,IAAI,CAAC,CAAC,KAAK,IAAI,EAC/C,UAAW,CAAC,kBAAmBV,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAClE,GAAIQ,EALN,SAAA,CAQGC,EACE,MAAM,EAAG,CAAC,CAAC,CACX,KAAK,CAAE,OAAM,MAAK,SAAQ,UAAS,OAAM,SAAQ,MAAK,WAAW,KAChE,EAAAhD,EAAA,IAAA,CAAC0B,EAAD,CAEQ,OACD,MACG,SACC,UACH,OACE,SACH,MACI,UACH,MACP,EAVM,GAAGjB,EAAK,GAAGyC,GAUjB,CACF,EACFF,EAAO,OAAS,IAAK,EAAAhD,EAAA,IAAA,CAAC2C,EAAD,CAAe,MAAOK,EAAO,MAAM,CAAC,CAAC,CAAC,IAAK,GAAWG,EAAO,IAAI,CAAI,CAAA,CACvF,C,EAEV,CAAC,E"}
|
|
1
|
+
{"version":3,"file":"Avatar-B_2lI7fS.cjs","names":["extend","a11yPlugin","parseColour","Button","_Fragment","forwardRef","useTooltip","useMemo","mergeRefs","require_colour","require_components_Button_index","require_mergeRefs","require_useTooltip","react","react_jsx_runtime","colord","colord_plugins_a11y","avatarColours","background","value","buttonSizes","initialsOf","words","name","splitAria","aria","other","key","props","defaultTabIndex","isActionable","isHidden","hasTooltip","AvatarContent","src","AvatarControl","href","semantics","hasCallback","size","Avatar","label","describedBy","hidden","onClick","tooltip","spanRef","anchorRef","ref","colours","colour","description","tabIndex","className","style","triggerProps","panel","OverflowCount","names","count","AvatarGroup","rest","people","p","index","person"],"sources":["../../src/components/Avatar/colour.ts","../../src/components/Avatar/index.tsx"],"sourcesContent":["import { extend } from \"colord\";\nimport a11yPlugin from \"colord/plugins/a11y\";\nimport { parseColour } from \"../ColourField/colour\";\n\nextend([a11yPlugin]);\n\n/** Opaque colours only: transparency would make contrast depend on the surface below. */\nexport function avatarColours(value?: string) {\n // Share ColourField's parser so both components accept and classify colours identically.\n const background = value ? parseColour(value) : null;\n if (!background || background.alpha() !== 1) {\n return undefined;\n }\n return {\n \"--avatar-background\": background.toHex(),\n \"--avatar-foreground\":\n background.contrast(\"#000\") >= background.contrast(\"#fff\") ? \"#000000\" : \"#ffffff\",\n };\n}\n","import {\n forwardRef,\n useMemo,\n type AnchorHTMLAttributes,\n type AriaAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { Button, type ButtonSize } from \"../Button\";\nimport { useTooltip } from \"../Popover/useTooltip\";\nimport { avatarColours } from \"./colour\";\nimport \"./style.css\";\n\nexport type AvatarSize = 24 | 32 | 40;\n\n/** Each avatar size is one of Button's square sizes, so callback avatars use Button unchanged. */\nconst buttonSizes: Record<AvatarSize, ButtonSize> = { 24: \"xs\", 32: \"sm\", 40: \"md\" };\n\nexport interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {\n /** Required — drives the initials and the accessible name. */\n name: string;\n src?: string;\n size?: AvatarSize;\n /** Solid hex, RGB, HSL or named background; initials automatically use contrasting black/white. */\n colour?: string;\n /** Defaults to name; false disables the hover/focus tooltip. */\n tooltip?: string | false;\n href?: string;\n target?: AnchorHTMLAttributes<HTMLAnchorElement>[\"target\"];\n rel?: string;\n}\n\nfunction initialsOf(name: string) {\n const words = name.trim().split(/\\s+/);\n const first = words[0]?.[0] ?? \"\";\n const last = words.length > 1 ? words[words.length - 1][0] : \"\";\n return (first + last).toUpperCase();\n}\n\n/** Separate ARIA attributes so they can follow the element that carries the role. */\nfunction splitAria<T extends object>(props: T) {\n const aria: Record<string, unknown> = {};\n const other: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(props)) {\n (key.startsWith(\"aria-\") ? aria : other)[key] = value;\n }\n return { aria: aria as AriaAttributes, other: other as Omit<T, keyof AriaAttributes> };\n}\n\n/**\n * Links and Buttons are natively focusable, and hidden ones leave the tab order.\n * A passive avatar is focusable only for a visible tooltip.\n */\nfunction defaultTabIndex(isActionable: boolean, isHidden: boolean, hasTooltip: boolean) {\n if (isActionable) {\n return isHidden ? -1 : undefined;\n }\n return !isHidden && hasTooltip ? 0 : undefined;\n}\n\nfunction AvatarContent({ name, src }: Pick<AvatarProps, \"name\" | \"src\">) {\n return (\n <span className=\"ds-avatar__content\">\n {src ? (\n <img\n src={src}\n alt=\"\"\n />\n ) : (\n initialsOf(name)\n )}\n </span>\n );\n}\n\ninterface AvatarControlProps extends Pick<AvatarProps, \"href\" | \"target\" | \"rel\"> {\n hasCallback: boolean;\n size: AvatarSize;\n /** Naming, description, id, ARIA state and tab order for the control. */\n semantics: HTMLAttributes<HTMLElement>;\n children: ReactNode;\n}\n\n/** The inner link or shared Button of an actionable avatar; passive content otherwise. */\nfunction AvatarControl({\n href,\n target,\n rel,\n hasCallback,\n size,\n semantics,\n children,\n}: AvatarControlProps) {\n if (href) {\n return (\n <a\n className=\"ds-avatar__control\"\n href={href}\n target={target}\n rel={rel}\n {...semantics}\n >\n {children}\n </a>\n );\n }\n if (hasCallback) {\n return (\n <Button\n variant=\"simple\"\n size={buttonSizes[size]}\n isIconOnly\n className=\"ds-avatar__control\"\n {...semantics}\n >\n {children}\n </Button>\n );\n }\n return <>{children}</>;\n}\n\n/**\n * A circular person identifier, optionally linked or actionable. The ref stays on\n * the outer span; `id` and ARIA attributes go to the image span, or to the inner\n * link or Button when the avatar is actionable.\n */\nexport const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(function Avatar(\n {\n name,\n src,\n colour,\n style,\n size = 24,\n tooltip = name,\n href,\n target,\n rel,\n className,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n id,\n tabIndex,\n \"aria-label\": label = name,\n \"aria-describedby\": describedBy,\n \"aria-hidden\": hidden,\n ...props\n },\n ref,\n) {\n const isHidden = hidden === true || hidden === \"true\";\n const isActionable = !!href || !!onClick;\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n isHidden ? false : tooltip,\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n // Stable across renders, so tooltip state changes never detach a caller's callback ref.\n const spanRef = useMemo(() => mergeRefs(anchorRef, ref), [anchorRef, ref]);\n const colours = useMemo(() => avatarColours(colour), [colour]);\n const { aria, other } = splitAria(props);\n const semantics = {\n ...aria,\n id,\n \"aria-label\": label,\n \"aria-describedby\": [describedBy, description].filter(Boolean).join(\" \") || undefined,\n tabIndex: tabIndex ?? defaultTabIndex(isActionable, isHidden, !!tooltip),\n };\n return (\n <>\n <span\n ref={spanRef}\n role={isActionable ? undefined : \"img\"}\n aria-hidden={hidden}\n {...(isActionable ? {} : semantics)}\n data-size={size}\n className={[\"ds-avatar\", className].filter(Boolean).join(\" \")}\n {...other}\n style={{ ...style, ...colours }}\n onClick={onClick}\n {...triggerProps({ onMouseEnter, onMouseLeave, onFocus, onBlur })}\n >\n <AvatarControl\n href={href}\n target={target}\n rel={rel}\n hasCallback={!!onClick}\n size={size}\n semantics={semantics}\n >\n <AvatarContent\n name={name}\n src={src}\n />\n </AvatarControl>\n </span>\n {panel}\n </>\n );\n});\n\ntype AvatarPerson = Pick<\n AvatarProps,\n \"name\" | \"src\" | \"colour\" | \"tooltip\" | \"href\" | \"target\" | \"rel\" | \"onClick\"\n>;\n\nexport interface AvatarGroupProps extends HTMLAttributes<HTMLSpanElement> {\n /** Up to three render; the rest become a +n count with a hidden-name tooltip. */\n people: AvatarPerson[];\n size?: AvatarSize;\n}\n\nfunction OverflowCount({ names }: { names: string[] }) {\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n names.join(\", \"),\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n const count = names.length;\n return (\n <>\n <span\n ref={anchorRef}\n role=\"img\"\n className=\"ds-avatar-group__count\"\n tabIndex={0}\n aria-label={`${count} more ${count === 1 ? \"person\" : \"people\"}`}\n aria-describedby={description}\n {...triggerProps()}\n >\n +{count}\n </span>\n {panel}\n </>\n );\n}\n\n/** Overlapping stack of at most three avatars, then a +n chip. */\nexport const AvatarGroup = forwardRef<HTMLSpanElement, AvatarGroupProps>(function AvatarGroup(\n { people, size = 24, className, ...rest },\n ref,\n) {\n return (\n <span\n ref={ref}\n role=\"group\"\n aria-label={people.map((p) => p.name).join(\", \")}\n className={[\"ds-avatar-group\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {/* Only documented person fields reach Avatar; extra application data stays off the DOM. */}\n {people\n .slice(0, 3)\n .map(({ name, src, colour, tooltip, href, target, rel, onClick }, index) => (\n <Avatar\n key={`${name}-${index}`}\n name={name}\n src={src}\n colour={colour}\n tooltip={tooltip}\n href={href}\n target={target}\n rel={rel}\n onClick={onClick}\n size={size}\n />\n ))}\n {people.length > 3 && <OverflowCount names={people.slice(3).map((person) => person.name)} />}\n </span>\n );\n});\n"],"mappings":"A,yRAIAA,EAAAA,EAAAA,OAAAA,CAAO,CAACC,EAAAA,OAAU,CAAC,EAGnB,SAAgBgB,EAAc,EAAgB,CAE5C,IAAMC,EAAaC,EAAQjB,EAAAA,EAAYiB,CAAK,EAAI,KAChD,GAAKD,GAAcA,EAAW,MAAM,IAAM,EAG1C,MAAO,CACL,sBAAuBA,EAAW,MAAM,EACxC,sBACEA,EAAW,SAAS,MAAM,GAAKA,EAAW,SAAS,MAAM,EAAI,UAAY,SAC7E,CACF,CCDA,IAAME,EAA8C,CAAE,GAAI,KAAM,GAAI,KAAM,GAAI,IAAK,EAgBnF,SAASC,EAAW,EAAc,CAChC,IAAMC,EAAQC,EAAK,KAAK,CAAC,CAAC,MAAM,KAAK,EAGrC,QAFcD,EAAM,EAAE,GAAG,IAAM,KAClBA,EAAM,OAAS,EAAIA,EAAMA,EAAM,OAAS,EAAE,CAAC,GAAK,IAAA,CACvC,YAAY,CACpC,CAGA,SAASE,EAA4B,EAAU,CAC7C,IAAMC,EAAgC,CAAC,EACjCC,EAAiC,CAAC,EACxC,IAAK,GAAM,CAACC,EAAKR,KAAU,OAAO,QAAQS,CAAK,EAC7C,CAACD,EAAI,WAAW,OAAO,EAAIF,EAAOC,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,CAAA,SAAA,EACE,EAAAU,EAAA,KAAA,CAAC,OAAD,CACE,IAAKiC,EACL,KAAK,MACL,UAAU,yBACV,SAAU,EACV,aAAY,GAAGY,EAAM,QAAQA,IAAU,EAAI,SAAW,WACtD,mBAAkBR,EAClB,GAAII,EAAa,EAPnB,SAAA,CAQC,IACGI,CACE,CACL,CAAA,EAAAH,CACD,CAAA,CAAA,CAEN,CAGA,IAAaI,GAAA,EAAcvD,EAAAA,WAAAA,CAA8C,SACvE,CAAE,SAAQ,OAAO,GAAI,YAAW,GAAGwD,GACnC,EACA,CACA,OACE,EAAA/C,EAAA,KAAA,CAAC,OAAD,CACO,MACL,KAAK,QACL,aAAYgD,EAAO,IAAK,GAAMC,EAAE,IAAI,CAAC,CAAC,KAAK,IAAI,EAC/C,UAAW,CAAC,kBAAmBV,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAClE,GAAIQ,EALN,SAAA,CAQGC,EACE,MAAM,EAAG,CAAC,CAAC,CACX,KAAK,CAAE,OAAM,MAAK,SAAQ,UAAS,OAAM,SAAQ,MAAK,WAAW,KAChE,EAAAhD,EAAA,IAAA,CAAC0B,EAAD,CAEQ,OACD,MACG,SACC,UACH,OACE,SACH,MACI,UACH,MACP,EAVM,GAAGjB,EAAK,GAAGyC,GAUjB,CACF,EACFF,EAAO,OAAS,IAAK,EAAAhD,EAAA,IAAA,CAAC2C,EAAD,CAAe,MAAOK,EAAO,MAAM,CAAC,CAAC,CAAC,IAAK,GAAWG,EAAO,IAAI,CAAI,CAAA,CACvF,C,EAEV,CAAC,E"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Button as e } from "../components/Button/index.js";
|
|
2
|
-
import { t } from "./mergeRefs-
|
|
2
|
+
import { t } from "./mergeRefs-C6_5pADN.js";
|
|
3
3
|
import { i as n } from "./colour-CYEF4Q_n.js";
|
|
4
|
-
import { t as r } from "./useTooltip-
|
|
4
|
+
import { t as r } from "./useTooltip-C5gvEoYk.js";
|
|
5
5
|
import { forwardRef as i, useMemo as a } from "react";
|
|
6
6
|
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
7
|
import { extend as l } from "colord";
|
|
@@ -146,4 +146,4 @@ var b = i(function({ people: e, size: t = 24, className: n, ...r }, i) {
|
|
|
146
146
|
//#endregion
|
|
147
147
|
export { b as n, v as t };
|
|
148
148
|
|
|
149
|
-
//# sourceMappingURL=Avatar-
|
|
149
|
+
//# sourceMappingURL=Avatar-DdFEOumt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar-C1q2AUD-.js","names":["_Fragment","parseColour","useTooltip","Fragment$1","a11yPlugin","extend","avatarColours","background","value","buttonSizes","initialsOf","words","name","splitAria","aria","other","key","props","defaultTabIndex","isActionable","isHidden","hasTooltip","AvatarContent","src","AvatarControl","href","semantics","hasCallback","Button","size","Avatar","forwardRef","label","describedBy","hidden","onClick","tooltip","spanRef","useMemo","mergeRefs","anchorRef","ref","colours","colour","description","tabIndex","className","style","triggerProps","panel","OverflowCount","names","count","AvatarGroup","rest","people","p","index","person"],"sources":["../../src/components/Avatar/colour.ts","../../src/components/Avatar/index.tsx"],"sourcesContent":["import { extend } from \"colord\";\nimport a11yPlugin from \"colord/plugins/a11y\";\nimport { parseColour } from \"../ColourField/colour\";\n\nextend([a11yPlugin]);\n\n/** Opaque colours only: transparency would make contrast depend on the surface below. */\nexport function avatarColours(value?: string) {\n // Share ColourField's parser so both components accept and classify colours identically.\n const background = value ? parseColour(value) : null;\n if (!background || background.alpha() !== 1) {\n return undefined;\n }\n return {\n \"--avatar-background\": background.toHex(),\n \"--avatar-foreground\":\n background.contrast(\"#000\") >= background.contrast(\"#fff\") ? \"#000000\" : \"#ffffff\",\n };\n}\n","import {\n forwardRef,\n useMemo,\n type AnchorHTMLAttributes,\n type AriaAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { Button, type ButtonSize } from \"../Button\";\nimport { useTooltip } from \"../Popover/useTooltip\";\nimport { avatarColours } from \"./colour\";\nimport \"./style.css\";\n\nexport type AvatarSize = 24 | 32 | 40;\n\n/** Each avatar size is one of Button's square sizes, so callback avatars use Button unchanged. */\nconst buttonSizes: Record<AvatarSize, ButtonSize> = { 24: \"xs\", 32: \"sm\", 40: \"md\" };\n\nexport interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {\n /** Required — drives the initials and the accessible name. */\n name: string;\n src?: string;\n size?: AvatarSize;\n /** Solid hex, RGB, HSL or named background; initials automatically use contrasting black/white. */\n colour?: string;\n /** Defaults to name; false disables the hover/focus tooltip. */\n tooltip?: string | false;\n href?: string;\n target?: AnchorHTMLAttributes<HTMLAnchorElement>[\"target\"];\n rel?: string;\n}\n\nfunction initialsOf(name: string) {\n const words = name.trim().split(/\\s+/);\n const first = words[0]?.[0] ?? \"\";\n const last = words.length > 1 ? words[words.length - 1][0] : \"\";\n return (first + last).toUpperCase();\n}\n\n/** Separate ARIA attributes so they can follow the element that carries the role. */\nfunction splitAria<T extends object>(props: T) {\n const aria: Record<string, unknown> = {};\n const other: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(props)) {\n (key.startsWith(\"aria-\") ? aria : other)[key] = value;\n }\n return { aria: aria as AriaAttributes, other: other as Omit<T, keyof AriaAttributes> };\n}\n\n/**\n * Links and Buttons are natively focusable, and hidden ones leave the tab order.\n * A passive avatar is focusable only for a visible tooltip.\n */\nfunction defaultTabIndex(isActionable: boolean, isHidden: boolean, hasTooltip: boolean) {\n if (isActionable) {\n return isHidden ? -1 : undefined;\n }\n return !isHidden && hasTooltip ? 0 : undefined;\n}\n\nfunction AvatarContent({ name, src }: Pick<AvatarProps, \"name\" | \"src\">) {\n return (\n <span className=\"ds-avatar__content\">\n {src ? (\n <img\n src={src}\n alt=\"\"\n />\n ) : (\n initialsOf(name)\n )}\n </span>\n );\n}\n\ninterface AvatarControlProps extends Pick<AvatarProps, \"href\" | \"target\" | \"rel\"> {\n hasCallback: boolean;\n size: AvatarSize;\n /** Naming, description, id, ARIA state and tab order for the control. */\n semantics: HTMLAttributes<HTMLElement>;\n children: ReactNode;\n}\n\n/** The inner link or shared Button of an actionable avatar; passive content otherwise. */\nfunction AvatarControl({\n href,\n target,\n rel,\n hasCallback,\n size,\n semantics,\n children,\n}: AvatarControlProps) {\n if (href) {\n return (\n <a\n className=\"ds-avatar__control\"\n href={href}\n target={target}\n rel={rel}\n {...semantics}\n >\n {children}\n </a>\n );\n }\n if (hasCallback) {\n return (\n <Button\n variant=\"simple\"\n size={buttonSizes[size]}\n isIconOnly\n className=\"ds-avatar__control\"\n {...semantics}\n >\n {children}\n </Button>\n );\n }\n return <>{children}</>;\n}\n\n/**\n * A circular person identifier, optionally linked or actionable. The ref stays on\n * the outer span; `id` and ARIA attributes go to the image span, or to the inner\n * link or Button when the avatar is actionable.\n */\nexport const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(function Avatar(\n {\n name,\n src,\n colour,\n style,\n size = 24,\n tooltip = name,\n href,\n target,\n rel,\n className,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n id,\n tabIndex,\n \"aria-label\": label = name,\n \"aria-describedby\": describedBy,\n \"aria-hidden\": hidden,\n ...props\n },\n ref,\n) {\n const isHidden = hidden === true || hidden === \"true\";\n const isActionable = !!href || !!onClick;\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n isHidden ? false : tooltip,\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n // Stable across renders, so tooltip state changes never detach a caller's callback ref.\n const spanRef = useMemo(() => mergeRefs(anchorRef, ref), [anchorRef, ref]);\n const colours = useMemo(() => avatarColours(colour), [colour]);\n const { aria, other } = splitAria(props);\n const semantics = {\n ...aria,\n id,\n \"aria-label\": label,\n \"aria-describedby\": [describedBy, description].filter(Boolean).join(\" \") || undefined,\n tabIndex: tabIndex ?? defaultTabIndex(isActionable, isHidden, !!tooltip),\n };\n return (\n <>\n <span\n ref={spanRef}\n role={isActionable ? undefined : \"img\"}\n aria-hidden={hidden}\n {...(isActionable ? {} : semantics)}\n data-size={size}\n className={[\"ds-avatar\", className].filter(Boolean).join(\" \")}\n {...other}\n style={{ ...style, ...colours }}\n onClick={onClick}\n {...triggerProps({ onMouseEnter, onMouseLeave, onFocus, onBlur })}\n >\n <AvatarControl\n href={href}\n target={target}\n rel={rel}\n hasCallback={!!onClick}\n size={size}\n semantics={semantics}\n >\n <AvatarContent\n name={name}\n src={src}\n />\n </AvatarControl>\n </span>\n {panel}\n </>\n );\n});\n\ntype AvatarPerson = Pick<\n AvatarProps,\n \"name\" | \"src\" | \"colour\" | \"tooltip\" | \"href\" | \"target\" | \"rel\" | \"onClick\"\n>;\n\nexport interface AvatarGroupProps extends HTMLAttributes<HTMLSpanElement> {\n /** Up to three render; the rest become a +n count with a hidden-name tooltip. */\n people: AvatarPerson[];\n size?: AvatarSize;\n}\n\nfunction OverflowCount({ names }: { names: string[] }) {\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n names.join(\", \"),\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n const count = names.length;\n return (\n <>\n <span\n ref={anchorRef}\n role=\"img\"\n className=\"ds-avatar-group__count\"\n tabIndex={0}\n aria-label={`${count} more ${count === 1 ? \"person\" : \"people\"}`}\n aria-describedby={description}\n {...triggerProps()}\n >\n +{count}\n </span>\n {panel}\n </>\n );\n}\n\n/** Overlapping stack of at most three avatars, then a +n chip. */\nexport const AvatarGroup = forwardRef<HTMLSpanElement, AvatarGroupProps>(function AvatarGroup(\n { people, size = 24, className, ...rest },\n ref,\n) {\n return (\n <span\n ref={ref}\n role=\"group\"\n aria-label={people.map((p) => p.name).join(\", \")}\n className={[\"ds-avatar-group\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {/* Only documented person fields reach Avatar; extra application data stays off the DOM. */}\n {people\n .slice(0, 3)\n .map(({ name, src, colour, tooltip, href, target, rel, onClick }, index) => (\n <Avatar\n key={`${name}-${index}`}\n name={name}\n src={src}\n colour={colour}\n tooltip={tooltip}\n href={href}\n target={target}\n rel={rel}\n onClick={onClick}\n size={size}\n />\n ))}\n {people.length > 3 && <OverflowCount names={people.slice(3).map((person) => person.name)} />}\n </span>\n );\n});\n"],"mappings":";;;;;;;;;AAIAK,EAAO,CAACD,CAAU,CAAC;AAGnB,SAAgBE,EAAc,GAAgB;CAE5C,IAAMC,IAAaC,IAAQP,EAAYO,CAAK,IAAI;CAChD,IAAKD,KAAcA,EAAW,MAAM,MAAM,GAG1C,OAAO;EACL,uBAAuBA,EAAW,MAAM;EACxC,uBACEA,EAAW,SAAS,MAAM,KAAKA,EAAW,SAAS,MAAM,IAAI,YAAY;CAC7E;AACF;;;ACDA,IAAME,IAA8C;CAAE,IAAI;CAAM,IAAI;CAAM,IAAI;AAAK;AAgBnF,SAASC,EAAW,GAAc;CAChC,IAAMC,IAAQC,EAAK,KAAK,CAAC,CAAC,MAAM,KAAK;CAGrC,SAFcD,EAAM,EAAE,GAAG,MAAM,OAClBA,EAAM,SAAS,IAAIA,EAAMA,EAAM,SAAS,EAAE,CAAC,KAAK,IAAA,CACvC,YAAY;AACpC;AAGA,SAASE,EAA4B,GAAU;CAC7C,IAAMC,IAAgC,CAAC,GACjCC,IAAiC,CAAC;CACxC,KAAK,IAAM,CAACC,GAAKR,MAAU,OAAO,QAAQS,CAAK,GAC7C,CAACD,EAAI,WAAW,OAAO,IAAIF,IAAOC,EAAA,CAAOC,KAAOR;CAElD,OAAO;EAAQ;EAA+B;CAAuC;AACvF;AAMA,SAASU,EAAgB,GAAuB,GAAmB,GAAqB;CAItF,OAHIC,IACKC,IAAW,KAAK,KAAA,IAElB,CAACA,KAAYC,IAAa,IAAI,KAAA;AACvC;AAEA,SAASC,EAAc,EAAE,SAAM,UAA0C;CACvE,OACE,kBAAC,QAAD;EAAM,WAAU;EACb,UAAAC,IACC,kBAAC,OAAD;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,QAAK,WAAQ,YAAS,SAAM,WAAQ,QAAK,cAAW,MAChE,kBAACzB,GAAD;GAEQ;GACD;GACG;GACC;GACH;GACE;GACH;GACI;GACH;EACP,GAVM,GAAGlB,EAAK,GAAG6C,GAUjB,CACF,GACFF,EAAO,SAAS,KAAK,kBAACL,GAAD,EAAe,OAAOK,EAAO,MAAM,CAAC,CAAC,CAAC,KAAK,MAAWG,EAAO,IAAI,EAAI,CAAA,CACvF;;AAEV,CAAC"}
|
|
1
|
+
{"version":3,"file":"Avatar-DdFEOumt.js","names":["_Fragment","parseColour","useTooltip","Fragment$1","a11yPlugin","extend","avatarColours","background","value","buttonSizes","initialsOf","words","name","splitAria","aria","other","key","props","defaultTabIndex","isActionable","isHidden","hasTooltip","AvatarContent","src","AvatarControl","href","semantics","hasCallback","Button","size","Avatar","forwardRef","label","describedBy","hidden","onClick","tooltip","spanRef","useMemo","mergeRefs","anchorRef","ref","colours","colour","description","tabIndex","className","style","triggerProps","panel","OverflowCount","names","count","AvatarGroup","rest","people","p","index","person"],"sources":["../../src/components/Avatar/colour.ts","../../src/components/Avatar/index.tsx"],"sourcesContent":["import { extend } from \"colord\";\nimport a11yPlugin from \"colord/plugins/a11y\";\nimport { parseColour } from \"../ColourField/colour\";\n\nextend([a11yPlugin]);\n\n/** Opaque colours only: transparency would make contrast depend on the surface below. */\nexport function avatarColours(value?: string) {\n // Share ColourField's parser so both components accept and classify colours identically.\n const background = value ? parseColour(value) : null;\n if (!background || background.alpha() !== 1) {\n return undefined;\n }\n return {\n \"--avatar-background\": background.toHex(),\n \"--avatar-foreground\":\n background.contrast(\"#000\") >= background.contrast(\"#fff\") ? \"#000000\" : \"#ffffff\",\n };\n}\n","import {\n forwardRef,\n useMemo,\n type AnchorHTMLAttributes,\n type AriaAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { Button, type ButtonSize } from \"../Button\";\nimport { useTooltip } from \"../Popover/useTooltip\";\nimport { avatarColours } from \"./colour\";\nimport \"./style.css\";\n\nexport type AvatarSize = 24 | 32 | 40;\n\n/** Each avatar size is one of Button's square sizes, so callback avatars use Button unchanged. */\nconst buttonSizes: Record<AvatarSize, ButtonSize> = { 24: \"xs\", 32: \"sm\", 40: \"md\" };\n\nexport interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {\n /** Required — drives the initials and the accessible name. */\n name: string;\n src?: string;\n size?: AvatarSize;\n /** Solid hex, RGB, HSL or named background; initials automatically use contrasting black/white. */\n colour?: string;\n /** Defaults to name; false disables the hover/focus tooltip. */\n tooltip?: string | false;\n href?: string;\n target?: AnchorHTMLAttributes<HTMLAnchorElement>[\"target\"];\n rel?: string;\n}\n\nfunction initialsOf(name: string) {\n const words = name.trim().split(/\\s+/);\n const first = words[0]?.[0] ?? \"\";\n const last = words.length > 1 ? words[words.length - 1][0] : \"\";\n return (first + last).toUpperCase();\n}\n\n/** Separate ARIA attributes so they can follow the element that carries the role. */\nfunction splitAria<T extends object>(props: T) {\n const aria: Record<string, unknown> = {};\n const other: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(props)) {\n (key.startsWith(\"aria-\") ? aria : other)[key] = value;\n }\n return { aria: aria as AriaAttributes, other: other as Omit<T, keyof AriaAttributes> };\n}\n\n/**\n * Links and Buttons are natively focusable, and hidden ones leave the tab order.\n * A passive avatar is focusable only for a visible tooltip.\n */\nfunction defaultTabIndex(isActionable: boolean, isHidden: boolean, hasTooltip: boolean) {\n if (isActionable) {\n return isHidden ? -1 : undefined;\n }\n return !isHidden && hasTooltip ? 0 : undefined;\n}\n\nfunction AvatarContent({ name, src }: Pick<AvatarProps, \"name\" | \"src\">) {\n return (\n <span className=\"ds-avatar__content\">\n {src ? (\n <img\n src={src}\n alt=\"\"\n />\n ) : (\n initialsOf(name)\n )}\n </span>\n );\n}\n\ninterface AvatarControlProps extends Pick<AvatarProps, \"href\" | \"target\" | \"rel\"> {\n hasCallback: boolean;\n size: AvatarSize;\n /** Naming, description, id, ARIA state and tab order for the control. */\n semantics: HTMLAttributes<HTMLElement>;\n children: ReactNode;\n}\n\n/** The inner link or shared Button of an actionable avatar; passive content otherwise. */\nfunction AvatarControl({\n href,\n target,\n rel,\n hasCallback,\n size,\n semantics,\n children,\n}: AvatarControlProps) {\n if (href) {\n return (\n <a\n className=\"ds-avatar__control\"\n href={href}\n target={target}\n rel={rel}\n {...semantics}\n >\n {children}\n </a>\n );\n }\n if (hasCallback) {\n return (\n <Button\n variant=\"simple\"\n size={buttonSizes[size]}\n isIconOnly\n className=\"ds-avatar__control\"\n {...semantics}\n >\n {children}\n </Button>\n );\n }\n return <>{children}</>;\n}\n\n/**\n * A circular person identifier, optionally linked or actionable. The ref stays on\n * the outer span; `id` and ARIA attributes go to the image span, or to the inner\n * link or Button when the avatar is actionable.\n */\nexport const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(function Avatar(\n {\n name,\n src,\n colour,\n style,\n size = 24,\n tooltip = name,\n href,\n target,\n rel,\n className,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n id,\n tabIndex,\n \"aria-label\": label = name,\n \"aria-describedby\": describedBy,\n \"aria-hidden\": hidden,\n ...props\n },\n ref,\n) {\n const isHidden = hidden === true || hidden === \"true\";\n const isActionable = !!href || !!onClick;\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n isHidden ? false : tooltip,\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n // Stable across renders, so tooltip state changes never detach a caller's callback ref.\n const spanRef = useMemo(() => mergeRefs(anchorRef, ref), [anchorRef, ref]);\n const colours = useMemo(() => avatarColours(colour), [colour]);\n const { aria, other } = splitAria(props);\n const semantics = {\n ...aria,\n id,\n \"aria-label\": label,\n \"aria-describedby\": [describedBy, description].filter(Boolean).join(\" \") || undefined,\n tabIndex: tabIndex ?? defaultTabIndex(isActionable, isHidden, !!tooltip),\n };\n return (\n <>\n <span\n ref={spanRef}\n role={isActionable ? undefined : \"img\"}\n aria-hidden={hidden}\n {...(isActionable ? {} : semantics)}\n data-size={size}\n className={[\"ds-avatar\", className].filter(Boolean).join(\" \")}\n {...other}\n style={{ ...style, ...colours }}\n onClick={onClick}\n {...triggerProps({ onMouseEnter, onMouseLeave, onFocus, onBlur })}\n >\n <AvatarControl\n href={href}\n target={target}\n rel={rel}\n hasCallback={!!onClick}\n size={size}\n semantics={semantics}\n >\n <AvatarContent\n name={name}\n src={src}\n />\n </AvatarControl>\n </span>\n {panel}\n </>\n );\n});\n\ntype AvatarPerson = Pick<\n AvatarProps,\n \"name\" | \"src\" | \"colour\" | \"tooltip\" | \"href\" | \"target\" | \"rel\" | \"onClick\"\n>;\n\nexport interface AvatarGroupProps extends HTMLAttributes<HTMLSpanElement> {\n /** Up to three render; the rest become a +n count with a hidden-name tooltip. */\n people: AvatarPerson[];\n size?: AvatarSize;\n}\n\nfunction OverflowCount({ names }: { names: string[] }) {\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n names.join(\", \"),\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n const count = names.length;\n return (\n <>\n <span\n ref={anchorRef}\n role=\"img\"\n className=\"ds-avatar-group__count\"\n tabIndex={0}\n aria-label={`${count} more ${count === 1 ? \"person\" : \"people\"}`}\n aria-describedby={description}\n {...triggerProps()}\n >\n +{count}\n </span>\n {panel}\n </>\n );\n}\n\n/** Overlapping stack of at most three avatars, then a +n chip. */\nexport const AvatarGroup = forwardRef<HTMLSpanElement, AvatarGroupProps>(function AvatarGroup(\n { people, size = 24, className, ...rest },\n ref,\n) {\n return (\n <span\n ref={ref}\n role=\"group\"\n aria-label={people.map((p) => p.name).join(\", \")}\n className={[\"ds-avatar-group\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {/* Only documented person fields reach Avatar; extra application data stays off the DOM. */}\n {people\n .slice(0, 3)\n .map(({ name, src, colour, tooltip, href, target, rel, onClick }, index) => (\n <Avatar\n key={`${name}-${index}`}\n name={name}\n src={src}\n colour={colour}\n tooltip={tooltip}\n href={href}\n target={target}\n rel={rel}\n onClick={onClick}\n size={size}\n />\n ))}\n {people.length > 3 && <OverflowCount names={people.slice(3).map((person) => person.name)} />}\n </span>\n );\n});\n"],"mappings":";;;;;;;;;AAIAK,EAAO,CAACD,CAAU,CAAC;AAGnB,SAAgBE,EAAc,GAAgB;CAE5C,IAAMC,IAAaC,IAAQP,EAAYO,CAAK,IAAI;CAChD,IAAKD,KAAcA,EAAW,MAAM,MAAM,GAG1C,OAAO;EACL,uBAAuBA,EAAW,MAAM;EACxC,uBACEA,EAAW,SAAS,MAAM,KAAKA,EAAW,SAAS,MAAM,IAAI,YAAY;CAC7E;AACF;;;ACDA,IAAME,IAA8C;CAAE,IAAI;CAAM,IAAI;CAAM,IAAI;AAAK;AAgBnF,SAASC,EAAW,GAAc;CAChC,IAAMC,IAAQC,EAAK,KAAK,CAAC,CAAC,MAAM,KAAK;CAGrC,SAFcD,EAAM,EAAE,GAAG,MAAM,OAClBA,EAAM,SAAS,IAAIA,EAAMA,EAAM,SAAS,EAAE,CAAC,KAAK,IAAA,CACvC,YAAY;AACpC;AAGA,SAASE,EAA4B,GAAU;CAC7C,IAAMC,IAAgC,CAAC,GACjCC,IAAiC,CAAC;CACxC,KAAK,IAAM,CAACC,GAAKR,MAAU,OAAO,QAAQS,CAAK,GAC7C,CAACD,EAAI,WAAW,OAAO,IAAIF,IAAOC,EAAA,CAAOC,KAAOR;CAElD,OAAO;EAAQ;EAA+B;CAAuC;AACvF;AAMA,SAASU,EAAgB,GAAuB,GAAmB,GAAqB;CAItF,OAHIC,IACKC,IAAW,KAAK,KAAA,IAElB,CAACA,KAAYC,IAAa,IAAI,KAAA;AACvC;AAEA,SAASC,EAAc,EAAE,SAAM,UAA0C;CACvE,OACE,kBAAC,QAAD;EAAM,WAAU;EACb,UAAAC,IACC,kBAAC,OAAD;GACO;GACL,KAAI;EACL,CAAA,IAEDb,EAAWE,CAAI;CAEb,CAAA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B,GAAD;GAEQ;GACD;GACG;GACC;GACH;GACE;GACH;GACI;GACH;EACP,GAVM,GAAGlB,EAAK,GAAG6C,GAUjB,CACF,GACFF,EAAO,SAAS,KAAK,kBAACL,GAAD,EAAe,OAAOK,EAAO,MAAM,CAAC,CAAC,CAAC,KAAK,MAAWG,EAAO,IAAI,EAAI,CAAA,CACvF;;AAEV,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "./Icon-spaFBU4S.js";
|
|
2
2
|
import { Button as t } from "../components/Button/index.js";
|
|
3
|
-
import { t as n } from "./mergeRefs-
|
|
3
|
+
import { t as n } from "./mergeRefs-C6_5pADN.js";
|
|
4
4
|
import { createContext as r, forwardRef as i, useCallback as a, useContext as o, useId as s, useMemo as c, useState as l } from "react";
|
|
5
5
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
6
|
import { DndContext as f, DragOverlay as p, KeyboardSensor as m, MeasuringStrategy as h, PointerSensor as g, closestCorners as _, pointerWithin as v, useDroppable as y, useSensor as b, useSensors as x } from "@dnd-kit/core";
|
|
@@ -236,4 +236,4 @@ var A = (e, t) => {
|
|
|
236
236
|
//#endregion
|
|
237
237
|
export { F as n, P as r, N as t };
|
|
238
238
|
|
|
239
|
-
//# sourceMappingURL=Board-
|
|
239
|
+
//# sourceMappingURL=Board-B8wK079I.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Board-z688-51u.js","names":["Icon","mergeRefs","columnMove","over","data","columnId","\"type\"","\"columnId\"","toIndex","columnIds","active","cardMove","fromColumnId","onCard","toColumnId","\"sortable\"","\"items\"","boardCoordinateGetter","args","event","containers","context","c","a","b","activeRect","rect","currentCoordinates","sortableKeyboardCoordinates","boardCollisionDetection","isColumn","type","container","scoped","closestCorners","within","pointerWithin","rank","id","BoardContext","createContext","Board","forwardRef","rest","dndId","useId","activeId","setActiveId","useState","activeType","setActiveType","overColumnId","setOverColumnId","sensors","useSensors","useSensor","PointerSensor","KeyboardSensor","handleStart","useCallback","handleOver","overData","reset","handleEnd","move","onColumnMove","onMove","value","useMemo","board","className","DndContext","MeasuringStrategy","SortableContext","horizontalListSortingStrategy","DragOverlay","renderDragOverlay","renderColumnDragOverlay","BoardColumn","useContext","setBodyRef","useDroppable","itemIds","setColumnRef","useSortable","isDraggable","ref","CSS","transform","isDragging","title","Button","attributes","listeners","count","action","verticalListSortingStrategy","BoardCard","setNodeRef","label"],"sources":["../../src/components/Board/moves.ts","../../src/components/Board/keyboard.ts","../../src/components/Board/index.tsx"],"sourcesContent":["import type { DragEndEvent } from \"@dnd-kit/core\";\nimport type { BoardColumnMove, BoardMove } from \".\";\n\nexport function columnMove(\n { active, over }: DragEndEvent,\n columnIds: string[],\n): BoardColumnMove | undefined {\n if (!over) {\n return;\n }\n const data = over.data.current ?? {};\n const columnId = data[\"type\"] === \"column\" ? String(over.id) : String(data[\"columnId\"] ?? \"\");\n const toIndex = columnIds.indexOf(columnId);\n if (toIndex < 0 || columnId === String(active.id)) {\n return;\n }\n return { columnId: String(active.id), toIndex };\n}\n\nexport function cardMove({ active, over }: DragEndEvent): BoardMove | undefined {\n if (!over) {\n return;\n }\n const fromColumnId = String(active.data.current?.[\"columnId\"] ?? \"\");\n const data = over.data.current ?? {};\n const onCard = data[\"type\"] === \"card\";\n const toColumnId = String(data[\"columnId\"] ?? (onCard ? \"\" : over.id));\n // A card occupies a precise slot; empty lane space appends to the lane.\n const toIndex = onCard\n ? ((data[\"sortable\"] as { index: number } | undefined)?.index ?? 0)\n : ((data[\"items\"] as string[] | undefined) ?? []).length;\n if (!toColumnId) {\n return;\n }\n if (fromColumnId === toColumnId && String(active.id) === String(over.id)) {\n return;\n }\n return { cardId: String(active.id), fromColumnId, toColumnId, toIndex };\n}\n","import type { KeyboardCoordinateGetter } from \"@dnd-kit/core\";\nimport { sortableKeyboardCoordinates } from \"@dnd-kit/sortable\";\n\n/**\n * Arrow up/down sorts inside a lane; left/right jumps lanes, which the stock\n * sortable getter does not do.\n */\nexport const boardCoordinateGetter: KeyboardCoordinateGetter = (event, args) => {\n const { currentCoordinates, context } = args;\n if (event.code === \"ArrowLeft\" || event.code === \"ArrowRight\") {\n const containers = context.droppableContainers\n .getEnabled()\n .filter((c) => c.data.current?.[\"type\"] === \"column-body\")\n .sort((a, b) => (a.rect.current?.left ?? 0) - (b.rect.current?.left ?? 0));\n const activeRect = context.active?.rect.current.translated;\n if (!activeRect) {\n return undefined;\n }\n const index = containers.findIndex(\n (c) =>\n (c.rect.current?.left ?? 0) <= activeRect.left + 1 &&\n (c.rect.current?.right ?? 0) >= activeRect.left - 1,\n );\n const next = containers[index + (event.code === \"ArrowRight\" ? 1 : -1)];\n const rect = next?.rect.current;\n if (!rect) {\n return undefined;\n }\n event.preventDefault();\n return { x: rect.left + rect.width / 2 - activeRect.width / 2, y: currentCoordinates.y };\n }\n return sortableKeyboardCoordinates(event, args);\n};\n","import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useId,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport {\n DndContext,\n DragOverlay,\n KeyboardSensor,\n PointerSensor,\n closestCorners,\n pointerWithin,\n MeasuringStrategy,\n useDroppable,\n useSensor,\n useSensors,\n type CollisionDetection,\n type DragEndEvent,\n type DragOverEvent,\n type DragStartEvent,\n} from \"@dnd-kit/core\";\nimport {\n SortableContext,\n horizontalListSortingStrategy,\n useSortable,\n verticalListSortingStrategy,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { cardMove, columnMove } from \"./moves\";\nimport { boardCoordinateGetter } from \"./keyboard\";\nimport \"./style.css\";\n\nexport interface BoardMove {\n cardId: string;\n fromColumnId: string;\n toColumnId: string;\n /** Index the card lands on inside the destination column. */\n toIndex: number;\n}\n\nexport interface BoardColumnMove {\n columnId: string;\n toIndex: number;\n}\n\ninterface BoardContextValue {\n activeId: string | null;\n activeType: \"card\" | \"column\" | null;\n /** The lane the pointer is currently over, whatever it is actually over. */\n overColumnId: string | null;\n}\n\n/**\n * A lane's body sits inside the lane's frame, so a raw corner-distance\n * strategy lets the body steal the hit from the lane itself — most visibly at\n * the board ends, where the last lane then never shifts aside to open the\n * drop gap. Resolve by what is being dragged: a column only ever hits other\n * columns; a card hits the card under the pointer first, then the lane body\n * under it, then whatever is nearest.\n */\nconst boardCollisionDetection: CollisionDetection = (args) => {\n const isColumn = args.active.data.current?.[\"type\"] === \"column\";\n const containers = args.droppableContainers.filter((container) => {\n const type = container.data.current?.[\"type\"];\n return isColumn ? type === \"column\" : type !== \"column\";\n });\n const scoped = { ...args, droppableContainers: containers };\n if (isColumn) {\n return closestCorners(scoped);\n }\n const within = pointerWithin(scoped);\n if (within.length > 0) {\n const rank = (id: (typeof within)[number][\"id\"]) =>\n containers.find((c) => c.id === id)?.data.current?.[\"type\"] === \"card\" ? 0 : 1;\n return [...within].sort((a, b) => rank(a.id) - rank(b.id));\n }\n return closestCorners(scoped);\n};\n\nconst BoardContext = createContext<BoardContextValue>({\n activeId: null,\n activeType: null,\n overColumnId: null,\n});\n\nexport interface BoardProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onDragEnd\"> {\n /** Column ids in render order. Required for columns to be re-orderable. */\n columnIds?: string[];\n /** Fired once a card is dropped somewhere new. Apply it to your own state. */\n onMove?: (move: BoardMove) => void;\n /** Fired once a column is dropped in a new position. */\n onColumnMove?: (move: BoardColumnMove) => void;\n /** Rendered inside the drag overlay while a card is in the air. */\n renderDragOverlay?: (cardId: string) => ReactNode;\n /** Rendered inside the drag overlay while a column is in the air. */\n renderColumnDragOverlay?: (columnId: string) => ReactNode;\n children?: ReactNode;\n}\n\n/**\n * A column board with pointer and keyboard dragging. The board owns the drag\n * mechanics only — the card data stays yours; react to `onMove`.\n */\nexport const Board = forwardRef<HTMLDivElement, BoardProps>(function Board(\n {\n columnIds,\n onMove,\n onColumnMove,\n renderDragOverlay,\n renderColumnDragOverlay,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const dndId = useId();\n const [activeId, setActiveId] = useState<string | null>(null);\n const [activeType, setActiveType] = useState<\"card\" | \"column\" | null>(null);\n const [overColumnId, setOverColumnId] = useState<string | null>(null);\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor, { coordinateGetter: boardCoordinateGetter }),\n );\n\n const handleStart = useCallback((event: DragStartEvent) => {\n setActiveId(String(event.active.id));\n setActiveType(event.active.data.current?.[\"type\"] === \"column\" ? \"column\" : \"card\");\n }, []);\n\n /* Cards land on cards as often as on empty space, so the lane a drag is over\n * is always resolved back to a column id — one highlight, one meaning. */\n const handleOver = useCallback((event: DragOverEvent) => {\n const over = event.over;\n if (!over) {\n setOverColumnId(null);\n return;\n }\n const overData = over.data.current ?? {};\n const columnId =\n overData[\"type\"] === \"column\" ? String(over.id) : String(overData[\"columnId\"] ?? \"\");\n setOverColumnId(columnId || null);\n }, []);\n\n const reset = useCallback(() => {\n setActiveId(null);\n setActiveType(null);\n setOverColumnId(null);\n }, []);\n\n const handleEnd = useCallback(\n (event: DragEndEvent) => {\n const { active, over } = event;\n reset();\n if (!over) {\n return;\n }\n\n /* Columns reorder among themselves; a column never lands inside a lane. */\n if (active.data.current?.[\"type\"] === \"column\") {\n const move = columnMove(event, columnIds ?? []);\n if (move) {\n onColumnMove?.(move);\n }\n } else {\n const move = cardMove(event);\n if (move) {\n onMove?.(move);\n }\n }\n },\n [columnIds, onColumnMove, onMove, reset],\n );\n\n const value = useMemo(\n () => ({ activeId, activeType, overColumnId }),\n [activeId, activeType, overColumnId],\n );\n\n const board = (\n <div\n ref={ref}\n className={[\"ds-board\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {children}\n </div>\n );\n\n return (\n <BoardContext.Provider value={value}>\n <DndContext\n id={`ds-board-${dndId}`}\n sensors={sensors}\n collisionDetection={boardCollisionDetection}\n /* Lanes scroll and change height mid-drag, so positions are re-read\n * continuously — without this the shift animation misfires. */\n measuring={{ droppable: { strategy: MeasuringStrategy.Always } }}\n\n onDragStart={handleStart}\n onDragOver={handleOver}\n onDragEnd={handleEnd}\n onDragCancel={reset}\n >\n {columnIds ? (\n <SortableContext\n items={columnIds}\n strategy={horizontalListSortingStrategy}\n >\n {board}\n </SortableContext>\n ) : (\n board\n )}\n <DragOverlay>\n {activeId && activeType === \"card\" ? (\n <div\n className=\"ds-board-card\"\n data-overlay\n >\n <span\n className=\"ds-board-card__handle\"\n aria-hidden=\"true\"\n >\n <Icon name=\"grip-vertical\" />\n </span>\n <div className=\"ds-board-card__content\">{renderDragOverlay?.(activeId)}</div>\n </div>\n ) : null}\n {activeId && activeType === \"column\" ? (\n <div\n className=\"ds-board-column\"\n data-overlay\n >\n {renderColumnDragOverlay?.(activeId)}\n </div>\n ) : null}\n </DragOverlay>\n </DndContext>\n </BoardContext.Provider>\n );\n});\n\nexport interface BoardColumnProps extends HTMLAttributes<HTMLDivElement> {\n id: string;\n title: string;\n /** Card ids in render order — the sortable contract for this column. */\n itemIds: string[];\n /** Shown beside the title; defaults to the number of cards. */\n count?: number;\n /** A control in the column head, e.g. an add button or a menu. */\n action?: ReactNode;\n /** Set false to pin a lane in place. */\n isDraggable?: boolean;\n children?: ReactNode;\n}\n\n/**\n * One lane of the board. Heavy frame, hairline head rule, scrolling body, and\n * a grip on top of the head that drags the whole lane sideways.\n */\nexport const BoardColumn = forwardRef<HTMLElement, BoardColumnProps>(function BoardColumn(\n { id, title, itemIds, count, action, isDraggable = true, className, children, ...rest },\n ref,\n) {\n const { activeType, overColumnId } = useContext(BoardContext);\n const { setNodeRef: setBodyRef } = useDroppable({\n id: `${id}::body`,\n data: { type: \"column-body\", columnId: id, items: itemIds },\n });\n const {\n attributes,\n listeners,\n setNodeRef: setColumnRef,\n transform,\n transition,\n isDragging,\n } = useSortable({\n id,\n disabled: !isDraggable,\n data: { type: \"column\", columnId: id, items: itemIds },\n });\n\n return (\n <section\n ref={mergeRefs(setColumnRef, ref)}\n style={{ transform: CSS.Translate.toString(transform), transition }}\n className={[\"ds-board-column\", className].filter(Boolean).join(\" \")}\n data-over={(activeType === \"card\" && overColumnId === id) || undefined}\n data-dragging={isDragging || undefined}\n\n aria-label={title}\n {...rest}\n >\n {isDraggable && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n iconStart=\"grip-horizontal\"\n className=\"ds-board-column__grip\"\n aria-label={`Reorder ${title}`}\n {...attributes}\n {...listeners}\n />\n )}\n <header className=\"ds-board-column__head\">\n <span className=\"ds-board-column__title\">{title}</span>\n <span className=\"ds-board-column__count\">{count ?? itemIds.length}</span>\n {action && <span className=\"ds-board-column__action\">{action}</span>}\n </header>\n <div\n ref={setBodyRef}\n className=\"ds-board-column__body\"\n >\n <SortableContext\n items={itemIds}\n strategy={verticalListSortingStrategy}\n >\n {children}\n </SortableContext>\n </div>\n </section>\n );\n});\n\nexport interface BoardCardProps extends HTMLAttributes<HTMLDivElement> {\n id: string;\n columnId: string;\n /** Accessible name announced when the card is picked up. */\n label?: string;\n children?: ReactNode;\n}\n\n/**\n * A draggable card. The grip on the left is the handle, so the card body can\n * hold links and buttons; the grip is a real button for keyboard users:\n * space to pick up, arrows to move, space to drop.\n */\nexport const BoardCard = forwardRef<HTMLDivElement, BoardCardProps>(function BoardCard(\n { id, columnId, label, className, children, ...rest },\n ref,\n) {\n const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({\n id,\n data: { type: \"card\", columnId },\n });\n const { activeId } = useContext(BoardContext);\n\n return (\n <div\n ref={mergeRefs(setNodeRef, ref)}\n style={{ transform: CSS.Translate.toString(transform), transition }}\n className={[\"ds-board-card\", className].filter(Boolean).join(\" \")}\n data-dragging={isDragging || undefined}\n data-idle={activeId && activeId !== id ? \"\" : undefined}\n {...rest}\n >\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"grip-vertical\"\n className=\"ds-board-card__handle\"\n aria-label={label ? `Move ${label}` : \"Move card\"}\n {...attributes}\n {...listeners}\n />\n <div className=\"ds-board-card__content\">{children}</div>\n </div>\n );\n});\n"],"mappings":";;;;;;;;;AAGA,SAAgBE,EACd,EAAE,WAAQ,WACV,GAC6B;CAC7B,IAAI,CAACC,GACH;CAEF,IAAMC,IAAOD,EAAK,KAAK,WAAW,CAAC,GAC7BE,IAAWD,EAAKE,SAAY,WAAW,OAAOH,EAAK,EAAE,IAAI,OAAOC,EAAKG,YAAe,EAAE,GACtFC,IAAUC,EAAU,QAAQJ,CAAQ;CAC1C,IAAI,MAAU,KAAKA,MAAa,OAAOK,EAAO,EAAE,IAGhD,OAAO;EAAE,UAAU,OAAOA,EAAO,EAAE;EAAG;CAAQ;AAChD;AAEA,SAAgBC,EAAS,EAAE,WAAQ,WAA6C;CAC9E,IAAI,CAACR,GACH;CAEF,IAAMS,IAAe,OAAOF,EAAO,KAAK,SAAUH,YAAe,EAAE,GAC7DH,IAAOD,EAAK,KAAK,WAAW,CAAC,GAC7BU,IAAST,EAAKE,SAAY,QAC1BQ,IAAa,OAAOV,EAAKG,aAAgBM,IAAS,KAAKV,EAAK,GAAG,GAE/DK,IAAUK,IACVT,EAAKW,UAA+C,SAAS,KAC7DX,EAAKY,SAAqC,CAAC,EAAA,CAAG;CACpD,IAAKF,MAGDF,MAAiBE,KAAc,OAAOJ,EAAO,EAAE,MAAM,OAAOP,EAAK,EAAE,IAGvE,OAAO;EAAE,QAAQ,OAAOO,EAAO,EAAE;EAAG;EAAc;EAAY;CAAQ;AACxE;;;AC/BA,IAAaO,KAAmD,GAAO,MAAS;CAC9E,IAAM,EAAE,uBAAoB,eAAYC;CACxC,IAAIC,EAAM,SAAS,eAAeA,EAAM,SAAS,cAAc;EAC7D,IAAMC,IAAaC,EAAQ,oBACxB,WAAW,CAAC,CACZ,QAAQ,MAAMC,EAAE,KAAK,SAAUhB,SAAY,aAAa,CAAC,CACzD,MAAM,GAAG,OAA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,kBAAeyC,EAAY;EAC3F;EACA,MAAM;GAAE,MAAM;GAAQ;EAAS;CACjC,CAAC,GACK,EAAE,gBAAaL,EAAWxC,CAAY;CAE5C,OACE,kBAAC,OAAD;EACE,KAAKtC,EAAUiG,GAAYZ,CAAG;EAC9B,OAAO;GAAE,WAAWC,EAAI,UAAU,SAASC,CAAS;GAAG;EAAW;EAClE,WAAW,CAAC,iBAAiBlB,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAChE,iBAAemB,KAAc,KAAA;EAC7B,aAAW3C,KAAYA,MAAaR,IAAK,KAAK,KAAA;EAC9C,GAAIK;EANN,UAAA,CAQE,kBAACgD,GAAD;GACE,SAAQ;GACR,MAAK;GACL,YAAA;GACA,WAAU;GACV,WAAU;GACV,cAAYQ,IAAQ,QAAQA,MAAU;GACtC,GAAIP;GACJ,GAAIC;EACL,CAAA,GACD,kBAAC,OAAD;GAAK,WAAU;GAA0B;EAAc,CAAA,CACpD;;AAET,CAAC"}
|
|
1
|
+
{"version":3,"file":"Board-B8wK079I.js","names":["Icon","mergeRefs","columnMove","over","data","columnId","\"type\"","\"columnId\"","toIndex","columnIds","active","cardMove","fromColumnId","onCard","toColumnId","\"sortable\"","\"items\"","boardCoordinateGetter","args","event","containers","context","c","a","b","activeRect","rect","currentCoordinates","sortableKeyboardCoordinates","boardCollisionDetection","isColumn","type","container","scoped","closestCorners","within","pointerWithin","rank","id","BoardContext","createContext","Board","forwardRef","rest","dndId","useId","activeId","setActiveId","useState","activeType","setActiveType","overColumnId","setOverColumnId","sensors","useSensors","useSensor","PointerSensor","KeyboardSensor","handleStart","useCallback","handleOver","overData","reset","handleEnd","move","onColumnMove","onMove","value","useMemo","board","className","DndContext","MeasuringStrategy","SortableContext","horizontalListSortingStrategy","DragOverlay","renderDragOverlay","renderColumnDragOverlay","BoardColumn","useContext","setBodyRef","useDroppable","itemIds","setColumnRef","useSortable","isDraggable","ref","CSS","transform","isDragging","title","Button","attributes","listeners","count","action","verticalListSortingStrategy","BoardCard","setNodeRef","label"],"sources":["../../src/components/Board/moves.ts","../../src/components/Board/keyboard.ts","../../src/components/Board/index.tsx"],"sourcesContent":["import type { DragEndEvent } from \"@dnd-kit/core\";\nimport type { BoardColumnMove, BoardMove } from \".\";\n\nexport function columnMove(\n { active, over }: DragEndEvent,\n columnIds: string[],\n): BoardColumnMove | undefined {\n if (!over) {\n return;\n }\n const data = over.data.current ?? {};\n const columnId = data[\"type\"] === \"column\" ? String(over.id) : String(data[\"columnId\"] ?? \"\");\n const toIndex = columnIds.indexOf(columnId);\n if (toIndex < 0 || columnId === String(active.id)) {\n return;\n }\n return { columnId: String(active.id), toIndex };\n}\n\nexport function cardMove({ active, over }: DragEndEvent): BoardMove | undefined {\n if (!over) {\n return;\n }\n const fromColumnId = String(active.data.current?.[\"columnId\"] ?? \"\");\n const data = over.data.current ?? {};\n const onCard = data[\"type\"] === \"card\";\n const toColumnId = String(data[\"columnId\"] ?? (onCard ? \"\" : over.id));\n // A card occupies a precise slot; empty lane space appends to the lane.\n const toIndex = onCard\n ? ((data[\"sortable\"] as { index: number } | undefined)?.index ?? 0)\n : ((data[\"items\"] as string[] | undefined) ?? []).length;\n if (!toColumnId) {\n return;\n }\n if (fromColumnId === toColumnId && String(active.id) === String(over.id)) {\n return;\n }\n return { cardId: String(active.id), fromColumnId, toColumnId, toIndex };\n}\n","import type { KeyboardCoordinateGetter } from \"@dnd-kit/core\";\nimport { sortableKeyboardCoordinates } from \"@dnd-kit/sortable\";\n\n/**\n * Arrow up/down sorts inside a lane; left/right jumps lanes, which the stock\n * sortable getter does not do.\n */\nexport const boardCoordinateGetter: KeyboardCoordinateGetter = (event, args) => {\n const { currentCoordinates, context } = args;\n if (event.code === \"ArrowLeft\" || event.code === \"ArrowRight\") {\n const containers = context.droppableContainers\n .getEnabled()\n .filter((c) => c.data.current?.[\"type\"] === \"column-body\")\n .sort((a, b) => (a.rect.current?.left ?? 0) - (b.rect.current?.left ?? 0));\n const activeRect = context.active?.rect.current.translated;\n if (!activeRect) {\n return undefined;\n }\n const index = containers.findIndex(\n (c) =>\n (c.rect.current?.left ?? 0) <= activeRect.left + 1 &&\n (c.rect.current?.right ?? 0) >= activeRect.left - 1,\n );\n const next = containers[index + (event.code === \"ArrowRight\" ? 1 : -1)];\n const rect = next?.rect.current;\n if (!rect) {\n return undefined;\n }\n event.preventDefault();\n return { x: rect.left + rect.width / 2 - activeRect.width / 2, y: currentCoordinates.y };\n }\n return sortableKeyboardCoordinates(event, args);\n};\n","import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useId,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport {\n DndContext,\n DragOverlay,\n KeyboardSensor,\n PointerSensor,\n closestCorners,\n pointerWithin,\n MeasuringStrategy,\n useDroppable,\n useSensor,\n useSensors,\n type CollisionDetection,\n type DragEndEvent,\n type DragOverEvent,\n type DragStartEvent,\n} from \"@dnd-kit/core\";\nimport {\n SortableContext,\n horizontalListSortingStrategy,\n useSortable,\n verticalListSortingStrategy,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { cardMove, columnMove } from \"./moves\";\nimport { boardCoordinateGetter } from \"./keyboard\";\nimport \"./style.css\";\n\nexport interface BoardMove {\n cardId: string;\n fromColumnId: string;\n toColumnId: string;\n /** Index the card lands on inside the destination column. */\n toIndex: number;\n}\n\nexport interface BoardColumnMove {\n columnId: string;\n toIndex: number;\n}\n\ninterface BoardContextValue {\n activeId: string | null;\n activeType: \"card\" | \"column\" | null;\n /** The lane the pointer is currently over, whatever it is actually over. */\n overColumnId: string | null;\n}\n\n/**\n * A lane's body sits inside the lane's frame, so a raw corner-distance\n * strategy lets the body steal the hit from the lane itself — most visibly at\n * the board ends, where the last lane then never shifts aside to open the\n * drop gap. Resolve by what is being dragged: a column only ever hits other\n * columns; a card hits the card under the pointer first, then the lane body\n * under it, then whatever is nearest.\n */\nconst boardCollisionDetection: CollisionDetection = (args) => {\n const isColumn = args.active.data.current?.[\"type\"] === \"column\";\n const containers = args.droppableContainers.filter((container) => {\n const type = container.data.current?.[\"type\"];\n return isColumn ? type === \"column\" : type !== \"column\";\n });\n const scoped = { ...args, droppableContainers: containers };\n if (isColumn) {\n return closestCorners(scoped);\n }\n const within = pointerWithin(scoped);\n if (within.length > 0) {\n const rank = (id: (typeof within)[number][\"id\"]) =>\n containers.find((c) => c.id === id)?.data.current?.[\"type\"] === \"card\" ? 0 : 1;\n return [...within].sort((a, b) => rank(a.id) - rank(b.id));\n }\n return closestCorners(scoped);\n};\n\nconst BoardContext = createContext<BoardContextValue>({\n activeId: null,\n activeType: null,\n overColumnId: null,\n});\n\nexport interface BoardProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onDragEnd\"> {\n /** Column ids in render order. Required for columns to be re-orderable. */\n columnIds?: string[];\n /** Fired once a card is dropped somewhere new. Apply it to your own state. */\n onMove?: (move: BoardMove) => void;\n /** Fired once a column is dropped in a new position. */\n onColumnMove?: (move: BoardColumnMove) => void;\n /** Rendered inside the drag overlay while a card is in the air. */\n renderDragOverlay?: (cardId: string) => ReactNode;\n /** Rendered inside the drag overlay while a column is in the air. */\n renderColumnDragOverlay?: (columnId: string) => ReactNode;\n children?: ReactNode;\n}\n\n/**\n * A column board with pointer and keyboard dragging. The board owns the drag\n * mechanics only — the card data stays yours; react to `onMove`.\n */\nexport const Board = forwardRef<HTMLDivElement, BoardProps>(function Board(\n {\n columnIds,\n onMove,\n onColumnMove,\n renderDragOverlay,\n renderColumnDragOverlay,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const dndId = useId();\n const [activeId, setActiveId] = useState<string | null>(null);\n const [activeType, setActiveType] = useState<\"card\" | \"column\" | null>(null);\n const [overColumnId, setOverColumnId] = useState<string | null>(null);\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor, { coordinateGetter: boardCoordinateGetter }),\n );\n\n const handleStart = useCallback((event: DragStartEvent) => {\n setActiveId(String(event.active.id));\n setActiveType(event.active.data.current?.[\"type\"] === \"column\" ? \"column\" : \"card\");\n }, []);\n\n /* Cards land on cards as often as on empty space, so the lane a drag is over\n * is always resolved back to a column id — one highlight, one meaning. */\n const handleOver = useCallback((event: DragOverEvent) => {\n const over = event.over;\n if (!over) {\n setOverColumnId(null);\n return;\n }\n const overData = over.data.current ?? {};\n const columnId =\n overData[\"type\"] === \"column\" ? String(over.id) : String(overData[\"columnId\"] ?? \"\");\n setOverColumnId(columnId || null);\n }, []);\n\n const reset = useCallback(() => {\n setActiveId(null);\n setActiveType(null);\n setOverColumnId(null);\n }, []);\n\n const handleEnd = useCallback(\n (event: DragEndEvent) => {\n const { active, over } = event;\n reset();\n if (!over) {\n return;\n }\n\n /* Columns reorder among themselves; a column never lands inside a lane. */\n if (active.data.current?.[\"type\"] === \"column\") {\n const move = columnMove(event, columnIds ?? []);\n if (move) {\n onColumnMove?.(move);\n }\n } else {\n const move = cardMove(event);\n if (move) {\n onMove?.(move);\n }\n }\n },\n [columnIds, onColumnMove, onMove, reset],\n );\n\n const value = useMemo(\n () => ({ activeId, activeType, overColumnId }),\n [activeId, activeType, overColumnId],\n );\n\n const board = (\n <div\n ref={ref}\n className={[\"ds-board\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {children}\n </div>\n );\n\n return (\n <BoardContext.Provider value={value}>\n <DndContext\n id={`ds-board-${dndId}`}\n sensors={sensors}\n collisionDetection={boardCollisionDetection}\n /* Lanes scroll and change height mid-drag, so positions are re-read\n * continuously — without this the shift animation misfires. */\n measuring={{ droppable: { strategy: MeasuringStrategy.Always } }}\n\n onDragStart={handleStart}\n onDragOver={handleOver}\n onDragEnd={handleEnd}\n onDragCancel={reset}\n >\n {columnIds ? (\n <SortableContext\n items={columnIds}\n strategy={horizontalListSortingStrategy}\n >\n {board}\n </SortableContext>\n ) : (\n board\n )}\n <DragOverlay>\n {activeId && activeType === \"card\" ? (\n <div\n className=\"ds-board-card\"\n data-overlay\n >\n <span\n className=\"ds-board-card__handle\"\n aria-hidden=\"true\"\n >\n <Icon name=\"grip-vertical\" />\n </span>\n <div className=\"ds-board-card__content\">{renderDragOverlay?.(activeId)}</div>\n </div>\n ) : null}\n {activeId && activeType === \"column\" ? (\n <div\n className=\"ds-board-column\"\n data-overlay\n >\n {renderColumnDragOverlay?.(activeId)}\n </div>\n ) : null}\n </DragOverlay>\n </DndContext>\n </BoardContext.Provider>\n );\n});\n\nexport interface BoardColumnProps extends HTMLAttributes<HTMLDivElement> {\n id: string;\n title: string;\n /** Card ids in render order — the sortable contract for this column. */\n itemIds: string[];\n /** Shown beside the title; defaults to the number of cards. */\n count?: number;\n /** A control in the column head, e.g. an add button or a menu. */\n action?: ReactNode;\n /** Set false to pin a lane in place. */\n isDraggable?: boolean;\n children?: ReactNode;\n}\n\n/**\n * One lane of the board. Heavy frame, hairline head rule, scrolling body, and\n * a grip on top of the head that drags the whole lane sideways.\n */\nexport const BoardColumn = forwardRef<HTMLElement, BoardColumnProps>(function BoardColumn(\n { id, title, itemIds, count, action, isDraggable = true, className, children, ...rest },\n ref,\n) {\n const { activeType, overColumnId } = useContext(BoardContext);\n const { setNodeRef: setBodyRef } = useDroppable({\n id: `${id}::body`,\n data: { type: \"column-body\", columnId: id, items: itemIds },\n });\n const {\n attributes,\n listeners,\n setNodeRef: setColumnRef,\n transform,\n transition,\n isDragging,\n } = useSortable({\n id,\n disabled: !isDraggable,\n data: { type: \"column\", columnId: id, items: itemIds },\n });\n\n return (\n <section\n ref={mergeRefs(setColumnRef, ref)}\n style={{ transform: CSS.Translate.toString(transform), transition }}\n className={[\"ds-board-column\", className].filter(Boolean).join(\" \")}\n data-over={(activeType === \"card\" && overColumnId === id) || undefined}\n data-dragging={isDragging || undefined}\n\n aria-label={title}\n {...rest}\n >\n {isDraggable && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n iconStart=\"grip-horizontal\"\n className=\"ds-board-column__grip\"\n aria-label={`Reorder ${title}`}\n {...attributes}\n {...listeners}\n />\n )}\n <header className=\"ds-board-column__head\">\n <span className=\"ds-board-column__title\">{title}</span>\n <span className=\"ds-board-column__count\">{count ?? itemIds.length}</span>\n {action && <span className=\"ds-board-column__action\">{action}</span>}\n </header>\n <div\n ref={setBodyRef}\n className=\"ds-board-column__body\"\n >\n <SortableContext\n items={itemIds}\n strategy={verticalListSortingStrategy}\n >\n {children}\n </SortableContext>\n </div>\n </section>\n );\n});\n\nexport interface BoardCardProps extends HTMLAttributes<HTMLDivElement> {\n id: string;\n columnId: string;\n /** Accessible name announced when the card is picked up. */\n label?: string;\n children?: ReactNode;\n}\n\n/**\n * A draggable card. The grip on the left is the handle, so the card body can\n * hold links and buttons; the grip is a real button for keyboard users:\n * space to pick up, arrows to move, space to drop.\n */\nexport const BoardCard = forwardRef<HTMLDivElement, BoardCardProps>(function BoardCard(\n { id, columnId, label, className, children, ...rest },\n ref,\n) {\n const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({\n id,\n data: { type: \"card\", columnId },\n });\n const { activeId } = useContext(BoardContext);\n\n return (\n <div\n ref={mergeRefs(setNodeRef, ref)}\n style={{ transform: CSS.Translate.toString(transform), transition }}\n className={[\"ds-board-card\", className].filter(Boolean).join(\" \")}\n data-dragging={isDragging || undefined}\n data-idle={activeId && activeId !== id ? \"\" : undefined}\n {...rest}\n >\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"grip-vertical\"\n className=\"ds-board-card__handle\"\n aria-label={label ? `Move ${label}` : \"Move card\"}\n {...attributes}\n {...listeners}\n />\n <div className=\"ds-board-card__content\">{children}</div>\n </div>\n );\n});\n"],"mappings":";;;;;;;;;AAGA,SAAgBE,EACd,EAAE,WAAQ,WACV,GAC6B;CAC7B,IAAI,CAACC,GACH;CAEF,IAAMC,IAAOD,EAAK,KAAK,W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