@alulore/kumiko 0.17.3 → 0.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/avatar/avatar-name.d.ts +12 -0
  2. package/dist/avatar/avatar-name.js +42 -0
  3. package/dist/avatar/avatar.css +274 -0
  4. package/dist/avatar/avatar.d.ts +72 -0
  5. package/dist/avatar/avatar.js +45 -0
  6. package/dist/avatar/index.d.ts +3 -0
  7. package/dist/avatar/index.js +3 -0
  8. package/dist/board/board-api.d.ts +1 -0
  9. package/dist/board/board-selection.d.ts +1 -0
  10. package/dist/board/board-slots.d.ts +7 -0
  11. package/dist/board/board-slots.js +2 -1
  12. package/dist/board/refused-home.js +26 -1
  13. package/dist/dialog/dialog.css +7 -1
  14. package/dist/dialog/dialog.d.ts +9 -0
  15. package/dist/dialog/dialog.js +20 -0
  16. package/dist/dialog/index.d.ts +4 -3
  17. package/dist/dialog/index.js +4 -3
  18. package/dist/drawer/drawer.css +514 -0
  19. package/dist/drawer/drawer.d.ts +55 -0
  20. package/dist/drawer/drawer.js +43 -0
  21. package/dist/drawer/index.d.ts +2 -0
  22. package/dist/drawer/index.js +2 -0
  23. package/dist/file-input/file-dropzone.d.ts +67 -0
  24. package/dist/file-input/file-dropzone.js +97 -0
  25. package/dist/file-input/file-input.css +505 -0
  26. package/dist/file-input/file-input.d.ts +29 -0
  27. package/dist/file-input/file-input.js +21 -0
  28. package/dist/file-input/file-preview.d.ts +15 -0
  29. package/dist/file-input/file-preview.js +41 -0
  30. package/dist/file-input/index.d.ts +4 -0
  31. package/dist/file-input/index.js +4 -0
  32. package/dist/hover-card/hover-card.js +2 -0
  33. package/dist/media-viewer/index.d.ts +1 -0
  34. package/dist/media-viewer/index.js +1 -0
  35. package/dist/media-viewer/labels.d.ts +27 -0
  36. package/dist/media-viewer/labels.js +23 -0
  37. package/dist/media-viewer/media-viewer.d.ts +3 -0
  38. package/dist/media-viewer/media-viewer.js +6 -3
  39. package/dist/media-viewer/video-controls.js +4 -2
  40. package/dist/media-viewer/viewer-chrome.js +11 -5
  41. package/dist/menu/menu.js +2 -0
  42. package/dist/motion/settle-close.d.ts +5 -0
  43. package/dist/motion/settle-close.js +78 -0
  44. package/dist/otp-input/index.d.ts +2 -0
  45. package/dist/otp-input/index.js +2 -0
  46. package/dist/otp-input/otp-input.css +336 -0
  47. package/dist/otp-input/otp-input.d.ts +56 -0
  48. package/dist/otp-input/otp-input.js +44 -0
  49. package/dist/popover/index.d.ts +2 -1
  50. package/dist/popover/index.js +2 -1
  51. package/dist/popover/popover.d.ts +3 -0
  52. package/dist/popover/popover.js +8 -0
  53. package/dist/server-render.test.d.ts +1 -0
  54. package/dist/server-render.test.js +57 -0
  55. package/dist/skeleton/index.d.ts +1 -0
  56. package/dist/skeleton/index.js +1 -0
  57. package/dist/skeleton/skeleton.css +143 -0
  58. package/dist/skeleton/skeleton.d.ts +44 -0
  59. package/dist/skeleton/skeleton.js +22 -0
  60. package/dist/smooth-caret/smooth-caret.css +4 -2
  61. package/dist/tabs/index.d.ts +2 -0
  62. package/dist/tabs/index.js +2 -0
  63. package/dist/tabs/tabs.css +616 -0
  64. package/dist/tabs/tabs.d.ts +51 -0
  65. package/dist/tabs/tabs.js +20 -0
  66. package/dist/titlebar/index.d.ts +1 -1
  67. package/dist/titlebar/index.js +1 -1
  68. package/dist/titlebar/titlebar.d.ts +15 -2
  69. package/dist/titlebar/titlebar.js +18 -9
  70. package/dist/toast/index.d.ts +2 -1
  71. package/dist/toast/index.js +2 -1
  72. package/dist/tooltip/tooltip.js +2 -0
  73. package/package.json +59 -5
@@ -0,0 +1,12 @@
1
+ /** How many tones the fallback's colour can take from a name; each is a `--kumiko-avatar-hue-<n>` token. */
2
+ export declare const avatarTones = 8;
3
+ /**
4
+ * The initials for a name: the first letters of its first and last words, like "AS" for "Ana Maria Silva". One word
5
+ * gives one letter; an email address uses the part before the "@". Empty when the name has no letters or digits.
6
+ */
7
+ export declare function getInitials(name: string, most?: number): string;
8
+ /**
9
+ * Which of the `avatarTones` tones a name gets: the same name always gets the same tone, case and spacing aside, so a
10
+ * person keeps their colour everywhere.
11
+ */
12
+ export declare function toneOf(name: string): number;
@@ -0,0 +1,42 @@
1
+ /** How many tones the fallback's colour can take from a name; each is a `--kumiko-avatar-hue-<n>` token. */
2
+ export const avatarTones = 8;
3
+ function words(name) {
4
+ const local = name.includes("@") ? (name.split("@")[0] ?? "") : name;
5
+ return local.split(/[\s._-]+/u).filter((word) => /\p{L}|\p{N}/u.test(word));
6
+ }
7
+ const graphemes = new Intl.Segmenter(undefined, { granularity: "grapheme" });
8
+ /* The first letter or digit as the reader sees it, so a letter and its accent mark stay together. */
9
+ function firstLetter(word) {
10
+ for (const { segment } of graphemes.segment(word)) {
11
+ if (/\p{L}|\p{N}/u.test(segment)) {
12
+ return segment.toLocaleUpperCase();
13
+ }
14
+ }
15
+ return "";
16
+ }
17
+ /**
18
+ * The initials for a name: the first letters of its first and last words, like "AS" for "Ana Maria Silva". One word
19
+ * gives one letter; an email address uses the part before the "@". Empty when the name has no letters or digits.
20
+ */
21
+ export function getInitials(name, most = 2) {
22
+ const parts = words(name.trim());
23
+ if (parts.length === 0 || most < 1) {
24
+ return "";
25
+ }
26
+ const first = parts[0] ?? "";
27
+ const last = parts.at(-1) ?? "";
28
+ const picked = parts.length === 1 || most === 1 ? [first] : [first, last];
29
+ return picked.map((word) => firstLetter(word)).join("");
30
+ }
31
+ /**
32
+ * Which of the `avatarTones` tones a name gets: the same name always gets the same tone, case and spacing aside, so a
33
+ * person keeps their colour everywhere.
34
+ */
35
+ export function toneOf(name) {
36
+ const key = name.trim().toLocaleLowerCase().replaceAll(/\s+/gu, " ");
37
+ let hash = 2_166_136_261;
38
+ for (const char of key) {
39
+ hash = Math.imul(hash ^ (char.codePointAt(0) ?? 0), 16_777_619);
40
+ }
41
+ return (hash >>> 0) % avatarTones;
42
+ }
@@ -0,0 +1,274 @@
1
+ @import "../motion/motion.css";
2
+
3
+ /*
4
+ * Styles ui-sdk's avatar. The root holds the shape and size; the image and the initials fill it and round with it,
5
+ * so the status dot can sit over the edge without being clipped.
6
+ */
7
+ @layer kumiko {
8
+ :where(:root) {
9
+ --kumiko-avatar-size-sm: 2rem;
10
+ --kumiko-avatar-size: 2.5rem;
11
+ --kumiko-avatar-size-lg: 3rem;
12
+ --kumiko-avatar-size-xl: 4rem;
13
+ --kumiko-avatar-square-radius: 28%;
14
+ --kumiko-avatar-font-weight: 600;
15
+ --kumiko-avatar-neutral-bg: color-mix(in oklab, CanvasText 10%, Canvas);
16
+ --kumiko-avatar-neutral-fg: color-mix(in oklab, CanvasText 70%, Canvas);
17
+ --kumiko-avatar-hue-0: 25;
18
+ --kumiko-avatar-hue-1: 60;
19
+ --kumiko-avatar-hue-2: 100;
20
+ --kumiko-avatar-hue-3: 150;
21
+ --kumiko-avatar-hue-4: 195;
22
+ --kumiko-avatar-hue-5: 245;
23
+ --kumiko-avatar-hue-6: 290;
24
+ --kumiko-avatar-hue-7: 335;
25
+ --kumiko-avatar-ring: Canvas;
26
+ --kumiko-avatar-ring-width: 2px;
27
+ --kumiko-avatar-online: light-dark(oklch(0.64 0.17 150), oklch(0.72 0.16 150));
28
+ --kumiko-avatar-away: light-dark(oklch(0.75 0.15 75), oklch(0.8 0.14 75));
29
+ --kumiko-avatar-busy: light-dark(oklch(0.58 0.2 25), oklch(0.68 0.18 25));
30
+ --kumiko-avatar-offline: color-mix(in oklab, CanvasText 40%, Canvas);
31
+ --kumiko-avatar-group-overlap: 0.25;
32
+ --kumiko-avatar-label-gap: 0.625rem;
33
+ --kumiko-avatar-detail-fg: color-mix(in oklab, currentColor 62%, transparent);
34
+ }
35
+
36
+ :where([data-slot="avatar"], [data-slot="avatar-more"]) {
37
+ --_avatar-size: var(--kumiko-avatar-size);
38
+ --_avatar-radius: 50%;
39
+
40
+ position: relative;
41
+ display: inline-grid;
42
+ flex: none;
43
+ box-sizing: border-box;
44
+ inline-size: var(--_avatar-size);
45
+ block-size: var(--_avatar-size);
46
+ border-radius: var(--_avatar-radius);
47
+ font-size: calc(var(--_avatar-size) * 0.4);
48
+ font-weight: var(--kumiko-avatar-font-weight);
49
+ line-height: 1;
50
+ vertical-align: middle;
51
+ user-select: none;
52
+ place-items: center;
53
+ }
54
+
55
+ :where([data-slot="avatar"], [data-slot="avatar-more"], [data-slot="avatar-label"]) {
56
+ &[data-size="sm"] {
57
+ --_avatar-size: var(--kumiko-avatar-size-sm);
58
+ }
59
+
60
+ &[data-size="lg"] {
61
+ --_avatar-size: var(--kumiko-avatar-size-lg);
62
+ }
63
+
64
+ &[data-size="xl"] {
65
+ --_avatar-size: var(--kumiko-avatar-size-xl);
66
+ }
67
+ }
68
+
69
+ :where(
70
+ [data-slot="avatar"]:is(
71
+ [data-shape="square"],
72
+ :not([data-shape]):is([data-kumiko-avatar~="square"] *)
73
+ )
74
+ ) {
75
+ --_avatar-radius: var(--kumiko-avatar-square-radius);
76
+ }
77
+
78
+ :where([data-slot="avatar-image"]) {
79
+ grid-area: 1 / 1;
80
+ inline-size: 100%;
81
+ block-size: 100%;
82
+ border-radius: inherit;
83
+ object-fit: cover;
84
+ }
85
+
86
+ /* A loaded image fades in, on the fade tokens, which reduced motion keeps. */
87
+ :where([data-slot="avatar-image"][data-loading-status="loaded"]) {
88
+ animation: kumiko-avatar-in var(--kumiko-fade-duration) var(--kumiko-fade-ease);
89
+ }
90
+
91
+ @keyframes kumiko-avatar-in {
92
+ from {
93
+ opacity: 0;
94
+ }
95
+ }
96
+
97
+ /* The initials fill the avatar. */
98
+ :where([data-slot="avatar-fallback"]) {
99
+ display: grid;
100
+ grid-area: 1 / 1;
101
+ box-sizing: border-box;
102
+ inline-size: 100%;
103
+ block-size: 100%;
104
+ border-radius: inherit;
105
+ place-items: center;
106
+ }
107
+
108
+ /* The initials, and the "+3" of a group: neutral unless a tone is picked. */
109
+ :where([data-slot="avatar-fallback"], [data-slot="avatar-more"]) {
110
+ background: var(--kumiko-avatar-neutral-bg);
111
+ color: var(--kumiko-avatar-neutral-fg);
112
+ }
113
+
114
+ /*
115
+ * A tone: the hue from the tone's token, light and dark in the page's colour scheme. A neutral word on a container
116
+ * turns off tones picked from names, but not one the app set.
117
+ */
118
+ :where(
119
+ [data-slot="avatar"][data-tone]:not([data-tone="neutral"]):is(
120
+ [data-tone-set],
121
+ :not([data-kumiko-avatar~="neutral"] *)
122
+ )
123
+ )
124
+ > [data-slot="avatar-fallback"] {
125
+ background: light-dark(
126
+ oklch(0.9 0.06 var(--_avatar-hue)),
127
+ oklch(0.38 0.08 var(--_avatar-hue))
128
+ );
129
+ color: light-dark(oklch(0.4 0.12 var(--_avatar-hue)), oklch(0.9 0.06 var(--_avatar-hue)));
130
+ }
131
+
132
+ :where([data-slot="avatar"]) {
133
+ &[data-tone="0"] {
134
+ --_avatar-hue: var(--kumiko-avatar-hue-0);
135
+ }
136
+
137
+ &[data-tone="1"] {
138
+ --_avatar-hue: var(--kumiko-avatar-hue-1);
139
+ }
140
+
141
+ &[data-tone="2"] {
142
+ --_avatar-hue: var(--kumiko-avatar-hue-2);
143
+ }
144
+
145
+ &[data-tone="3"] {
146
+ --_avatar-hue: var(--kumiko-avatar-hue-3);
147
+ }
148
+
149
+ &[data-tone="4"] {
150
+ --_avatar-hue: var(--kumiko-avatar-hue-4);
151
+ }
152
+
153
+ &[data-tone="5"] {
154
+ --_avatar-hue: var(--kumiko-avatar-hue-5);
155
+ }
156
+
157
+ &[data-tone="6"] {
158
+ --_avatar-hue: var(--kumiko-avatar-hue-6);
159
+ }
160
+
161
+ &[data-tone="7"] {
162
+ --_avatar-hue: var(--kumiko-avatar-hue-7);
163
+ }
164
+ }
165
+
166
+ /* The status dot, at the bottom of the end side, ringed in the page's colour so it reads over the picture. */
167
+ :where([data-slot="avatar-status"]) {
168
+ position: absolute;
169
+ inset-block-end: 0;
170
+ inset-inline-end: 0;
171
+ box-sizing: border-box;
172
+ inline-size: max(0.5rem, calc(var(--_avatar-size) * 0.28));
173
+ block-size: max(0.5rem, calc(var(--_avatar-size) * 0.28));
174
+ border-radius: 50%;
175
+ background: var(--kumiko-avatar-offline);
176
+ box-shadow: 0 0 0 var(--kumiko-avatar-ring-width) var(--kumiko-avatar-ring);
177
+ forced-color-adjust: none;
178
+ }
179
+
180
+ /* A square's corner is further out than a circle's edge, so its dot moves out to the corner. */
181
+ :where(
182
+ [data-slot="avatar"]:is(
183
+ [data-shape="square"],
184
+ :not([data-shape]):is([data-kumiko-avatar~="square"] *)
185
+ )
186
+ > [data-slot="avatar-status"]
187
+ ) {
188
+ inset-block-end: calc(var(--_avatar-size) * -0.06);
189
+ inset-inline-end: calc(var(--_avatar-size) * -0.06);
190
+ }
191
+
192
+ :where([data-slot="avatar-status"]) {
193
+ &[data-status="online"] {
194
+ background: var(--kumiko-avatar-online);
195
+ }
196
+
197
+ &[data-status="away"] {
198
+ background: var(--kumiko-avatar-away);
199
+ }
200
+
201
+ &[data-status="busy"] {
202
+ background: var(--kumiko-avatar-busy);
203
+ }
204
+ }
205
+
206
+ /* A group: each avatar overlaps the one before by a share of its size, ringed so the edges stay clear. */
207
+ :where([data-slot="avatar-group"]) {
208
+ display: inline-flex;
209
+ align-items: center;
210
+
211
+ & > :is([data-slot="avatar"], [data-slot="avatar-more"]) {
212
+ box-shadow: 0 0 0 var(--kumiko-avatar-ring-width) var(--kumiko-avatar-ring);
213
+ }
214
+
215
+ & > :is([data-slot="avatar"], [data-slot="avatar-more"]) + * {
216
+ margin-inline-start: calc(
217
+ -1 * var(--_avatar-size) * var(--kumiko-avatar-group-overlap)
218
+ );
219
+ }
220
+ }
221
+
222
+ :where([data-slot="avatar-more"]) {
223
+ font-size: calc(var(--_avatar-size) * 0.34);
224
+ font-variant-numeric: tabular-nums;
225
+ }
226
+
227
+ /* An avatar with a name and a second line. Long text ends in an ellipsis. */
228
+ :where([data-slot="avatar-label"]) {
229
+ --_avatar-size: var(--kumiko-avatar-size);
230
+
231
+ display: flex;
232
+ gap: var(--kumiko-avatar-label-gap);
233
+ align-items: center;
234
+ min-inline-size: 0;
235
+ }
236
+
237
+ :where([data-slot="avatar-label-picture"]) {
238
+ display: inline-flex;
239
+ flex: none;
240
+ }
241
+
242
+ :where([data-slot="avatar-label-text"]) {
243
+ display: grid;
244
+ min-inline-size: 0;
245
+ line-height: 1.3;
246
+ }
247
+
248
+ :where([data-slot="avatar-label-name"], [data-slot="avatar-label-detail"]) {
249
+ overflow: hidden;
250
+ text-overflow: ellipsis;
251
+ white-space: nowrap;
252
+ }
253
+
254
+ :where([data-slot="avatar-label-name"]) {
255
+ font-weight: 600;
256
+ }
257
+
258
+ :where([data-slot="avatar-label-detail"]) {
259
+ color: var(--kumiko-avatar-detail-fg);
260
+ font-size: 0.875em;
261
+ }
262
+
263
+ @media (forced-colors: active) {
264
+ :where([data-slot="avatar-fallback"], [data-slot="avatar-more"]) {
265
+ border: 1px solid CanvasText;
266
+ }
267
+
268
+ :where([data-slot="avatar-status"]) {
269
+ box-shadow:
270
+ 0 0 0 var(--kumiko-avatar-ring-width) Canvas,
271
+ 0 0 0 calc(var(--kumiko-avatar-ring-width) + 1px) CanvasText;
272
+ }
273
+ }
274
+ }
@@ -0,0 +1,72 @@
1
+ import { Avatar as SdkAvatar } from "@ui-sdk/react/avatar";
2
+ export type AvatarSize = "sm" | "md" | "lg" | "xl";
3
+ /** A circle for a person, a rounded square for a team or an organisation. */
4
+ export type AvatarShape = "circle" | "square";
5
+ export type AvatarStatus = "online" | "away" | "busy" | "offline";
6
+ /** What screen readers hear for each status. Pass your own through `statusLabels` to translate them. */
7
+ export type AvatarStatusLabels = Record<AvatarStatus, string>;
8
+ export declare const avatarStatusLabels: AvatarStatusLabels;
9
+ type SdkAvatarProps = Parameters<typeof SdkAvatar>[0];
10
+ export type AvatarProps = Omit<SdkAvatarProps, "children"> & {
11
+ /** The image. Without one, or while it loads or if it fails, the initials of `name` show. */
12
+ src?: string;
13
+ /** Whose avatar it is: names it for screen readers, gives the initials and picks the fallback's tone. */
14
+ name?: string;
15
+ /** @defaultValue "md" */
16
+ size?: AvatarSize;
17
+ /**
18
+ * Without it, `data-kumiko-avatar="square"` on any container picks.
19
+ * @defaultValue "circle"
20
+ */
21
+ shape?: AvatarShape;
22
+ /**
23
+ * The fallback's colour: one of the tones (0 to 7) or `"neutral"`. Left out, `name` picks a tone, and
24
+ * `data-kumiko-avatar="neutral"` on any container makes every fallback neutral.
25
+ */
26
+ tone?: number | "neutral";
27
+ /** A dot at the corner that says whether the person is around. */
28
+ status?: AvatarStatus;
29
+ /** The status words screen readers hear. Any you leave out stay English. */
30
+ statusLabels?: Partial<AvatarStatusLabels>;
31
+ /** Waits this many milliseconds before showing the initials, so a fast image never flashes them first. */
32
+ delay?: number;
33
+ /**
34
+ * Your own parts (`AvatarImage`, `AvatarFallback`) instead of `src` and `name`'s, like an icon for the fallback.
35
+ */
36
+ children?: React.ReactNode;
37
+ };
38
+ /**
39
+ * A person's or a team's picture, with their initials while it loads or if it fails. `src` and `name` are enough;
40
+ * for anything else, put ui-sdk's `AvatarImage` and `AvatarFallback` inside.
41
+ */
42
+ export declare function Avatar({ src, name, size, shape, tone, status, statusLabels, delay, children, ...props }: AvatarProps): React.JSX.Element;
43
+ export interface AvatarGroupProps extends React.ComponentProps<"div"> {
44
+ /** How many avatars show before the rest fold into a count. Left out, all show. */
45
+ max?: number;
46
+ /** The size of the count, matching the avatars'. @defaultValue "md" */
47
+ size?: AvatarSize;
48
+ /** What screen readers hear for the count. @defaultValue (n) => `${n} more` */
49
+ moreLabel?: (hidden: number) => string;
50
+ }
51
+ /** Avatars overlapping in a row, the ones past `max` folded into a "+3". Name the group with `aria-label`. */
52
+ export declare function AvatarGroup({ max, size, moreLabel, children, ...props }: AvatarGroupProps): React.JSX.Element;
53
+ export interface AvatarLabelProps extends React.ComponentProps<"div"> {
54
+ /** The name, shown beside the avatar. */
55
+ name: string;
56
+ /** A second line under the name, like an email address or a role. */
57
+ detail?: React.ReactNode;
58
+ /** The picture, for the avatar made from `name`. */
59
+ src?: string;
60
+ /** @defaultValue "md" */
61
+ size?: AvatarSize;
62
+ shape?: AvatarShape;
63
+ status?: AvatarStatus;
64
+ /** Your own avatar instead of the one made from `name` and `src`. */
65
+ avatar?: React.ReactNode;
66
+ }
67
+ /**
68
+ * An avatar with a name and an optional second line. The name is written out, so the avatar beside it is hidden from
69
+ * screen readers.
70
+ */
71
+ export declare function AvatarLabel({ name, detail, src, size, shape, status, avatar, ...props }: AvatarLabelProps): React.JSX.Element;
72
+ export {};
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Avatar as SdkAvatar, AvatarFallback, AvatarImage } from "@ui-sdk/react/avatar";
3
+ import { Children } from "react";
4
+ import { getInitials, toneOf } from "./avatar-name";
5
+ export const avatarStatusLabels = {
6
+ online: "online",
7
+ away: "away",
8
+ busy: "busy",
9
+ offline: "offline"
10
+ };
11
+ function toneAttribute(tone, name) {
12
+ if (tone === "neutral" || typeof tone === "number") {
13
+ return String(tone);
14
+ }
15
+ return name ? String(toneOf(name)) : undefined;
16
+ }
17
+ function spokenName(name, status, labels) {
18
+ if (!name) {
19
+ return undefined;
20
+ }
21
+ return status ? `${name}, ${labels?.[status] ?? avatarStatusLabels[status]}` : name;
22
+ }
23
+ /**
24
+ * A person's or a team's picture, with their initials while it loads or if it fails. `src` and `name` are enough;
25
+ * for anything else, put ui-sdk's `AvatarImage` and `AvatarFallback` inside.
26
+ */
27
+ export function Avatar({ src, name, size = "md", shape, tone, status, statusLabels, delay, children, ...props }) {
28
+ const label = spokenName(name, status, statusLabels);
29
+ const own = Children.count(children) > 0;
30
+ return (_jsxs(SdkAvatar, { role: label ? "img" : undefined, "aria-label": label, "data-size": size, "data-shape": shape, "data-tone": toneAttribute(tone, name), "data-tone-set": tone === undefined ? undefined : "", ...props, children: [own ? children : null, !own && src ? _jsx(AvatarImage, { src: src, alt: "" }) : null, own ? null : (_jsx(AvatarFallback, { delay: delay, "aria-hidden": true, children: name ? getInitials(name) : null })), status ? _jsx("span", { "data-slot": "avatar-status", "data-status": status, "aria-hidden": true }) : null] }));
31
+ }
32
+ /** Avatars overlapping in a row, the ones past `max` folded into a "+3". Name the group with `aria-label`. */
33
+ export function AvatarGroup({ max, size = "md", moreLabel = (hidden) => `${hidden} more`, children, ...props }) {
34
+ const all = Children.toArray(children);
35
+ const shown = max === undefined ? all : all.slice(0, Math.max(0, max));
36
+ const hidden = all.length - shown.length;
37
+ return (_jsxs("div", { role: "group", "data-slot": "avatar-group", ...props, children: [shown, hidden > 0 ? (_jsx("span", { role: "img", "aria-label": moreLabel(hidden), "data-slot": "avatar-more", "data-size": size, children: _jsxs("span", { "aria-hidden": true, children: ["+", hidden] }) })) : null] }));
38
+ }
39
+ /**
40
+ * An avatar with a name and an optional second line. The name is written out, so the avatar beside it is hidden from
41
+ * screen readers.
42
+ */
43
+ export function AvatarLabel({ name, detail, src, size = "md", shape, status, avatar, ...props }) {
44
+ return (_jsxs("div", { "data-slot": "avatar-label", "data-size": size, ...props, children: [_jsx("span", { "data-slot": "avatar-label-picture", "aria-hidden": true, children: avatar ?? (_jsx(Avatar, { src: src, name: name, size: size, shape: shape, status: status })) }), _jsxs("span", { "data-slot": "avatar-label-text", children: [_jsx("span", { "data-slot": "avatar-label-name", children: name }), detail ? _jsx("span", { "data-slot": "avatar-label-detail", children: detail }) : null] })] }));
45
+ }
@@ -0,0 +1,3 @@
1
+ export { Avatar, AvatarGroup, AvatarLabel, avatarStatusLabels, type AvatarGroupProps, type AvatarLabelProps, type AvatarProps, type AvatarShape, type AvatarSize, type AvatarStatus, type AvatarStatusLabels } from "./avatar";
2
+ export { avatarTones, getInitials, toneOf } from "./avatar-name";
3
+ export { AvatarFallback, AvatarImage, type AvatarFallbackProps, type AvatarLoadingStatus, type AvatarLoadingStatusChangeReason, type AvatarOptions, type AvatarState } from "@ui-sdk/react/avatar";
@@ -0,0 +1,3 @@
1
+ export { Avatar, AvatarGroup, AvatarLabel, avatarStatusLabels } from "./avatar";
2
+ export { avatarTones, getInitials, toneOf } from "./avatar-name";
3
+ export { AvatarFallback, AvatarImage } from "@ui-sdk/react/avatar";
@@ -103,6 +103,7 @@ export declare function createBoardApi(context: BoardContext): {
103
103
  event?: Event;
104
104
  }): void;
105
105
  anchor: () => string | null;
106
+ setAnchor: (key: string | null) => void;
106
107
  };
107
108
  pointerdown: (el: HTMLElement | undefined, count: number) => void;
108
109
  click(event: MouseEvent, key: string): void;
@@ -33,6 +33,7 @@ export declare function createBoardSelection(context: BoardContext, change: Chan
33
33
  event?: Event;
34
34
  }): void;
35
35
  anchor: () => string | null;
36
+ setAnchor: (key: string | null) => void;
36
37
  };
37
38
  pointerdown: (el: HTMLElement | undefined, count: number) => void;
38
39
  click(event: MouseEvent, key: string): void;
@@ -104,6 +104,7 @@ export declare function rootSlot(slot: Slot): import("@ui-sdk/core").SlotDefinit
104
104
  event?: Event;
105
105
  }): void;
106
106
  anchor: () => string | null;
107
+ setAnchor: (key: string | null) => void;
107
108
  };
108
109
  pointerdown: (el: HTMLElement | undefined, count: number) => void;
109
110
  click(event: MouseEvent, key: string): void;
@@ -245,6 +246,7 @@ export declare function sortableSlot(slot: Slot, axis: Axis): import("@ui-sdk/co
245
246
  event?: Event;
246
247
  }): void;
247
248
  anchor: () => string | null;
249
+ setAnchor: (key: string | null) => void;
248
250
  };
249
251
  pointerdown: (el: HTMLElement | undefined, count: number) => void;
250
252
  click(event: MouseEvent, key: string): void;
@@ -388,6 +390,7 @@ export declare function handleSlot(slot: Slot, axis: Axis): import("@ui-sdk/core
388
390
  event?: Event;
389
391
  }): void;
390
392
  anchor: () => string | null;
393
+ setAnchor: (key: string | null) => void;
391
394
  };
392
395
  pointerdown: (el: HTMLElement | undefined, count: number) => void;
393
396
  click(event: MouseEvent, key: string): void;
@@ -531,6 +534,7 @@ export declare function insertSlot(slot: Slot): import("@ui-sdk/core").SlotDefin
531
534
  event?: Event;
532
535
  }): void;
533
536
  anchor: () => string | null;
537
+ setAnchor: (key: string | null) => void;
534
538
  };
535
539
  pointerdown: (el: HTMLElement | undefined, count: number) => void;
536
540
  click(event: MouseEvent, key: string): void;
@@ -672,6 +676,7 @@ export declare function foldSlot(slot: Slot): import("@ui-sdk/core").SlotDefinit
672
676
  event?: Event;
673
677
  }): void;
674
678
  anchor: () => string | null;
679
+ setAnchor: (key: string | null) => void;
675
680
  };
676
681
  pointerdown: (el: HTMLElement | undefined, count: number) => void;
677
682
  click(event: MouseEvent, key: string): void;
@@ -815,6 +820,7 @@ export declare function cellSlot(slot: Slot): import("@ui-sdk/core").SlotDefinit
815
820
  event?: Event;
816
821
  }): void;
817
822
  anchor: () => string | null;
823
+ setAnchor: (key: string | null) => void;
818
824
  };
819
825
  pointerdown: (el: HTMLElement | undefined, count: number) => void;
820
826
  click(event: MouseEvent, key: string): void;
@@ -958,6 +964,7 @@ export declare function cardSlot(slot: Slot): import("@ui-sdk/core").SlotDefinit
958
964
  event?: Event;
959
965
  }): void;
960
966
  anchor: () => string | null;
967
+ setAnchor: (key: string | null) => void;
961
968
  };
962
969
  pointerdown: (el: HTMLElement | undefined, count: number) => void;
963
970
  click(event: MouseEvent, key: string): void;
@@ -41,7 +41,8 @@ function gripOf(target) {
41
41
  /**
42
42
  * The element a pull from this press follows, or null when the press isn't
43
43
  * one: empty space follows the lane or row itself. A grip follows the grip, so
44
- * the pointer capture stays on it and a click without movement still reaches it.
44
+ * any pointer capture stays on it. Since ui-sdk 0.1.0-beta.13 a press that
45
+ * doesn't move captures nothing, so its click reaches the grip either way.
45
46
  */
46
47
  function pullFrom(event, axis, el) {
47
48
  const target = event.target instanceof HTMLElement ? event.target : null;
@@ -29,13 +29,36 @@ function cellUnder(root, event) {
29
29
  * home, so the drop shows, and does, what will happen: nothing moves.
30
30
  */
31
31
  export function bindRefusedHome(root, store, api) {
32
+ /*
33
+ * Chrome repeats the last pointermove after every scroll.
34
+ * So an auto-scrolling drag sends one per frame from a pointer that hasn't moved.
35
+ * The cell under it only changes with the pointer, the scroll position or the cards.
36
+ * The last answer is reused until one of them changes.
37
+ */
38
+ let scrolls = 0;
39
+ let looked = null;
40
+ const scrolled = () => {
41
+ scrolls += 1;
42
+ };
43
+ const find = (event, cells) => {
44
+ if (looked?.x === event.clientX &&
45
+ looked.y === event.clientY &&
46
+ looked.scrolls === scrolls &&
47
+ looked.cells === cells) {
48
+ return looked.cell;
49
+ }
50
+ const cell = cellUnder(root, event);
51
+ looked = { x: event.clientX, y: event.clientY, scrolls, cells, cell };
52
+ return cell;
53
+ };
32
54
  const moved = (event) => {
33
55
  const state = store.get();
34
56
  const moving = state.moving;
35
57
  if (!moving?.pointer) {
58
+ looked = null;
36
59
  return;
37
60
  }
38
- const under = cellUnder(root, event);
61
+ const under = find(event, state.cells);
39
62
  const home = homeOf(state, moving.key);
40
63
  if (under === null || home === null || api.allows(moving.key, under)) {
41
64
  return;
@@ -44,7 +67,9 @@ export function bindRefusedHome(root, store, api) {
44
67
  };
45
68
  const view = root.ownerDocument.defaultView ?? window;
46
69
  view.addEventListener("pointermove", moved, { passive: true });
70
+ view.document.addEventListener("scroll", scrolled, { capture: true, passive: true });
47
71
  return () => {
48
72
  view.removeEventListener("pointermove", moved);
73
+ view.document.removeEventListener("scroll", scrolled, { capture: true });
49
74
  };
50
75
  }
@@ -176,7 +176,13 @@
176
176
  backdrop-filter: none;
177
177
  }
178
178
 
179
- :where([data-slot$="dialog-backdrop"]:is([data-starting-style], [data-ending-style])) {
179
+ /*
180
+ * A closed backdrop stays clear: ui-sdk drops the ending style two frames after the fade, and a
181
+ * React unmount on a busy page can come later, which would dim the whole app again for a frame.
182
+ */
183
+ :where(
184
+ [data-slot$="dialog-backdrop"]:is([data-starting-style], [data-ending-style], [data-closed])
185
+ ) {
180
186
  opacity: 0;
181
187
  }
182
188
 
@@ -0,0 +1,9 @@
1
+ import { type AlertDialogProps } from "@ui-sdk/react/alert-dialog";
2
+ import { type DialogProps } from "@ui-sdk/react/dialog";
3
+ import { type OverlayHostProps } from "@ui-sdk/react/overlays";
4
+ /** The ui-sdk dialog, whose close isn't stretched by infinite animations inside it. */
5
+ export declare function Dialog(props: DialogProps): React.JSX.Element;
6
+ /** The ui-sdk alert dialog, whose close isn't stretched by infinite animations inside it. */
7
+ export declare function AlertDialog(props: AlertDialogProps): React.JSX.Element;
8
+ /** The ui-sdk host for `confirm()` and `toast()`, whose closes aren't stretched by infinite animations. */
9
+ export declare function OverlayHost(props: OverlayHostProps): React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { AlertDialog as SdkAlertDialog } from "@ui-sdk/react/alert-dialog";
3
+ import { Dialog as SdkDialog } from "@ui-sdk/react/dialog";
4
+ import { OverlayHost as SdkOverlayHost } from "@ui-sdk/react/overlays";
5
+ import { useSettledClose } from "../motion/settle-close";
6
+ /** The ui-sdk dialog, whose close isn't stretched by infinite animations inside it. */
7
+ export function Dialog(props) {
8
+ useSettledClose();
9
+ return _jsx(SdkDialog, { ...props });
10
+ }
11
+ /** The ui-sdk alert dialog, whose close isn't stretched by infinite animations inside it. */
12
+ export function AlertDialog(props) {
13
+ useSettledClose();
14
+ return _jsx(SdkAlertDialog, { ...props });
15
+ }
16
+ /** The ui-sdk host for `confirm()` and `toast()`, whose closes aren't stretched by infinite animations. */
17
+ export function OverlayHost(props) {
18
+ useSettledClose();
19
+ return _jsx(SdkOverlayHost, { ...props });
20
+ }
@@ -1,3 +1,4 @@
1
- export { createDialogController, Dialog, DialogBackdrop, DialogClose, DialogContent, DialogDescription, DialogShortcut, DialogTitle, DialogTrigger, type DialogApi, type DialogBackdropState, type DialogCloseActionDetails, type DialogCloseProps, type DialogCloseState, type DialogContentProps, type DialogContentState, type DialogController, type DialogDismissAttemptDetails, type DialogDismissReason, type DialogFinalFocus, type DialogInitialFocus, type DialogOpenChangeDetails, type DialogOpenChangeReason, type DialogOptions, type DialogPayloadChangeReason, type DialogProps, type DialogShortcutProps, type DialogTriggerProps, type DialogTriggerState } from "@ui-sdk/react/dialog";
2
- export { AlertDialog, AlertDialogBackdrop, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogShortcut, AlertDialogTitle, AlertDialogTrigger, confirm, createAlertDialogController, createConfirm, type AlertDialogCloseProps, type AlertDialogContentProps, type AlertDialogContentState, type AlertDialogController, type AlertDialogOpenChangeReason, type AlertDialogOptions, type AlertDialogProps, type AlertDialogTriggerProps, type ConfirmEntry, type ConfirmOptions } from "@ui-sdk/react/alert-dialog";
3
- export { OverlayHost, type OverlayHostProps } from "@ui-sdk/react/overlays";
1
+ export { createDialogController, DialogBackdrop, DialogClose, DialogContent, DialogDescription, DialogShortcut, DialogTitle, DialogTrigger, type DialogApi, type DialogBackdropState, type DialogCloseActionDetails, type DialogCloseProps, type DialogCloseState, type DialogContentProps, type DialogContentState, type DialogController, type DialogDismissAttemptDetails, type DialogDismissReason, type DialogFinalFocus, type DialogInitialFocus, type DialogOpenChangeDetails, type DialogOpenChangeReason, type DialogOptions, type DialogPayloadChangeReason, type DialogProps, type DialogShortcutProps, type DialogTriggerProps, type DialogTriggerState } from "@ui-sdk/react/dialog";
2
+ export { AlertDialogBackdrop, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogShortcut, AlertDialogTitle, AlertDialogTrigger, confirm, createAlertDialogController, createConfirm, type AlertDialogCloseProps, type AlertDialogContentProps, type AlertDialogContentState, type AlertDialogController, type AlertDialogOpenChangeReason, type AlertDialogOptions, type AlertDialogProps, type AlertDialogTriggerProps, type ConfirmEntry, type ConfirmOptions } from "@ui-sdk/react/alert-dialog";
3
+ export { AlertDialog, Dialog, OverlayHost } from "./dialog";
4
+ export { type OverlayHostProps } from "@ui-sdk/react/overlays";
@@ -1,3 +1,4 @@
1
- export { createDialogController, Dialog, DialogBackdrop, DialogClose, DialogContent, DialogDescription, DialogShortcut, DialogTitle, DialogTrigger } from "@ui-sdk/react/dialog";
2
- export { AlertDialog, AlertDialogBackdrop, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogShortcut, AlertDialogTitle, AlertDialogTrigger, confirm, createAlertDialogController, createConfirm } from "@ui-sdk/react/alert-dialog";
3
- export { OverlayHost } from "@ui-sdk/react/overlays";
1
+ export { createDialogController, DialogBackdrop, DialogClose, DialogContent, DialogDescription, DialogShortcut, DialogTitle, DialogTrigger } from "@ui-sdk/react/dialog";
2
+ export { AlertDialogBackdrop, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogShortcut, AlertDialogTitle, AlertDialogTrigger, confirm, createAlertDialogController, createConfirm } from "@ui-sdk/react/alert-dialog";
3
+ export { AlertDialog, Dialog, OverlayHost } from "./dialog";
4
+ export {} from "@ui-sdk/react/overlays";