@krizaka/ui 3.63.1 → 3.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account-menu.d.ts +1 -1
- package/dist/account-menu.js +1 -1
- package/dist/account-settings.d.ts +61 -4
- package/dist/account-settings.js +206 -44
- package/dist/account-settings.js.map +1 -1
- package/dist/app-header.d.ts +3 -3
- package/dist/avatar/defaults.d.ts +16 -5
- package/dist/avatar/defaults.js +15 -1
- package/dist/avatar/defaults.js.map +1 -1
- package/dist/{avatar-BL2iG_Js.d.ts → avatar-BdZcfkWR.d.ts} +11 -4
- package/dist/avatar.d.ts +16 -5
- package/dist/avatar.js +15 -1
- package/dist/avatar.js.map +1 -1
- package/dist/chat.js +1 -1
- package/dist/chunk-EUJ7337V.js +137 -0
- package/dist/chunk-EUJ7337V.js.map +1 -0
- package/dist/chunk-HK525THY.js +139 -0
- package/dist/chunk-HK525THY.js.map +1 -0
- package/dist/{chunk-3D2YI63L.js → chunk-SHBYNQFS.js} +7 -2
- package/dist/{chunk-3D2YI63L.js.map → chunk-SHBYNQFS.js.map} +1 -1
- package/dist/dashboard-layout.js +2 -1
- package/dist/dashboard-layout.js.map +1 -1
- package/dist/docs-layout.js +1 -1
- package/dist/file-upload.d.ts +2 -2
- package/dist/filter-bar.d.ts +3 -3
- package/dist/language-switch.d.ts +9 -9
- package/dist/match-dialog.js +1 -1
- package/dist/media-grid.d.ts +8 -3
- package/dist/media-grid.js +1 -1
- package/dist/native.d.ts +8 -3
- package/dist/native.js +51 -0
- package/dist/native.js.map +1 -1
- package/dist/vertical-video.js +1 -1
- package/package.json +9 -9
- package/registry/account-settings.json +66 -5
- package/registry/avatar.json +5 -4
- package/registry/dashboard-layout.json +1 -1
- package/registry/elephant.json +1 -1
- package/registry/examples/account-settings/avatar-picker-folder.d.ts +4 -0
- package/registry/examples/account-settings/avatar-picker-folder.js +27 -0
- package/registry/examples/account-settings/avatar-picker-folder.tsx +23 -0
- package/registry/index.json +8 -7
- package/registry/map.json +1 -1
- package/registry/nav-bar.json +1 -1
- package/registry/rail-nav.json +1 -1
- package/registry/site-footer.json +1 -1
- package/dist/chunk-7AZ23BUX.js +0 -88
- package/dist/chunk-7AZ23BUX.js.map +0 -1
- package/dist/chunk-PW2FVPTV.js +0 -85
- package/dist/chunk-PW2FVPTV.js.map +0 -1
package/dist/account-menu.d.ts
CHANGED
package/dist/account-menu.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { A as AvatarProps, D as DefaultAvatar } from './avatar-
|
|
2
|
+
import { A as AvatarProps, D as DefaultAvatar, a as DefaultAvatarEntityKind, b as DefaultAvatarBrand } from './avatar-BdZcfkWR.js';
|
|
3
3
|
import { RadioGroup as RadioGroup$1 } from 'radix-ui';
|
|
4
4
|
import 'tailwind-variants';
|
|
5
5
|
|
|
@@ -189,6 +189,44 @@ type AppearanceSettingsProps = {
|
|
|
189
189
|
/** The appearance rows of a settings page: theme cards, accent, density, language, sound. */
|
|
190
190
|
declare function AppearanceSettings({ themes, theme, onThemeChange, accents, accent, onAccentChange, densities, density, onDensityChange, languages, language, onLanguageChange, sound, onSoundChange, labels: given, className, }: AppearanceSettingsProps): React.JSX.Element;
|
|
191
191
|
|
|
192
|
+
/** Why a file was refused. */
|
|
193
|
+
type FileRejection = {
|
|
194
|
+
file: File;
|
|
195
|
+
reason: "type" | "size" | "count";
|
|
196
|
+
};
|
|
197
|
+
type DropzoneProps = {
|
|
198
|
+
/** The title in the zone ("Drop your video here"), passed translated. */
|
|
199
|
+
title: string;
|
|
200
|
+
/** The button that opens the file picker ("Choose a file"), passed translated. */
|
|
201
|
+
browseLabel: string;
|
|
202
|
+
/** What is accepted, in words ("MP4 or MOV, up to 4 GB"). */
|
|
203
|
+
hint?: string;
|
|
204
|
+
/** The types accepted, as the `accept` attribute (`"video/*"`, `"image/png,.pdf"`). */
|
|
205
|
+
accept?: string;
|
|
206
|
+
/** The largest file, in bytes. */
|
|
207
|
+
maxSize?: number;
|
|
208
|
+
/** The most files at once (1 unless `multiple`). */
|
|
209
|
+
maxFiles?: number;
|
|
210
|
+
/** Several files at once. */
|
|
211
|
+
multiple?: boolean;
|
|
212
|
+
/** Not available (an upload is running). */
|
|
213
|
+
disabled?: boolean;
|
|
214
|
+
/** On a phone, opens the camera directly (`"environment"` the back one, `"user"` the front one). */
|
|
215
|
+
capture?: "user" | "environment";
|
|
216
|
+
/** Called with the files accepted (never empty). */
|
|
217
|
+
onFiles: (files: File[]) => void;
|
|
218
|
+
/** Called with the files refused and why (show `refusalLabel`'s words, or your own). */
|
|
219
|
+
onReject?: (rejections: FileRejection[]) => void;
|
|
220
|
+
/** The words of a refusal, shown in the zone: `(r) => r.file.name + " is too large"`. Without it, nothing is shown. */
|
|
221
|
+
refusalLabel?: (rejection: FileRejection) => string;
|
|
222
|
+
/** An icon instead of the upload glyph. */
|
|
223
|
+
icon?: React.ReactNode;
|
|
224
|
+
/** Classes merged on the zone. */
|
|
225
|
+
className?: string;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
/** The value of the « no picture » tile (`noneLabel`). */
|
|
229
|
+
declare const AVATAR_NONE = "none";
|
|
192
230
|
interface AvatarOption {
|
|
193
231
|
/** The value of the choice. */
|
|
194
232
|
id: string;
|
|
@@ -198,7 +236,15 @@ interface AvatarOption {
|
|
|
198
236
|
src?: string;
|
|
199
237
|
/** One of Krizaka's default pictures (`{ brand, tone }`). */
|
|
200
238
|
defaultAvatar?: DefaultAvatar;
|
|
239
|
+
/** What this picture is of; a picker of another `kind` never lists it. Read from `defaultAvatar.kind` when not given (`plain` is a person's). */
|
|
240
|
+
kind?: DefaultAvatarEntityKind;
|
|
201
241
|
}
|
|
242
|
+
/** What an option is of, when it says: its own `kind`, else its default picture's. */
|
|
243
|
+
declare function avatarOptionKind(option: AvatarOption): DefaultAvatarEntityKind | undefined;
|
|
244
|
+
/** The pictures that fit `kind`: an option of another kind is dropped, so a folder is never offered a person. Options that do not say what they are stay. */
|
|
245
|
+
declare function optionsOfKind(options: readonly AvatarOption[], kind: DefaultAvatarEntityKind): AvatarOption[];
|
|
246
|
+
/** The pictures drawn here for a kind: the brand's six tones, no request. Used when the app passes no `options`. */
|
|
247
|
+
declare function builtInAvatarOptions(kind: DefaultAvatarEntityKind, brand: DefaultAvatarBrand, label: (tone: number) => string): AvatarOption[];
|
|
202
248
|
type AvatarPickerProps = Omit<React.ComponentProps<typeof RadioGroup$1.Root>, "children" | "onChange" | "dir"> & {
|
|
203
249
|
/** The group's accessible name (“Profile picture”) — passed translated. */
|
|
204
250
|
label: string;
|
|
@@ -211,8 +257,19 @@ type AvatarPickerProps = Omit<React.ComponentProps<typeof RadioGroup$1.Root>, "c
|
|
|
211
257
|
showLabel?: boolean;
|
|
212
258
|
/** One line under the visible label: what it changes. */
|
|
213
259
|
description?: React.ReactNode;
|
|
214
|
-
/**
|
|
260
|
+
/**
|
|
261
|
+
* What the pictures are of: `person` (default), `folder`, `organisation` or `shop`. Only the options of this kind are listed.
|
|
262
|
+
* @default "person"
|
|
263
|
+
*/
|
|
264
|
+
kind?: DefaultAvatarEntityKind;
|
|
265
|
+
/** The pictures — the central set of the kind (`listDefaults(kind)` of `@krizaka/org`) turned into options, with `src`. */
|
|
215
266
|
options: readonly AvatarOption[];
|
|
267
|
+
/** Adds a « no picture » tile first, chosen with the value `AVATAR_NONE`; the words of the tile, passed translated. */
|
|
268
|
+
noneLabel?: string;
|
|
269
|
+
/** The library's upload control under the grid: a `Dropzone` (a real file input), for a picture of one's own. */
|
|
270
|
+
uploadFile?: Pick<DropzoneProps, "title" | "browseLabel" | "hint" | "accept" | "maxSize" | "disabled" | "refusalLabel" | "onReject"> & {
|
|
271
|
+
onFile: (file: File) => void;
|
|
272
|
+
};
|
|
216
273
|
/** The chosen id (controlled). */
|
|
217
274
|
value?: string;
|
|
218
275
|
/** The viewer chooses another picture. */
|
|
@@ -221,7 +278,7 @@ type AvatarPickerProps = Omit<React.ComponentProps<typeof RadioGroup$1.Root>, "c
|
|
|
221
278
|
upload?: React.ReactNode;
|
|
222
279
|
};
|
|
223
280
|
/** A grid of pictures to choose from, with an upload beside them: a radio group, never a row of loose radios. */
|
|
224
|
-
declare function AvatarPicker({ label, showLabel, description, dense, options, upload, className, ...props }: AvatarPickerProps): React.JSX.Element;
|
|
281
|
+
declare function AvatarPicker({ label, showLabel, description, dense, kind, options, noneLabel, uploadFile, upload, className, ...props }: AvatarPickerProps): React.JSX.Element;
|
|
225
282
|
|
|
226
283
|
interface ChoiceCardOption {
|
|
227
284
|
/** The value of the choice. */
|
|
@@ -251,5 +308,5 @@ type ChoiceCardsProps = Omit<React.ComponentProps<typeof RadioGroup.Root>, "chil
|
|
|
251
308
|
/** Cards to choose one from: a radio group where each card has an icon, a title and a description. */
|
|
252
309
|
declare function ChoiceCards({ label, showLabel, description, options, className, ...props }: ChoiceCardsProps): React.JSX.Element;
|
|
253
310
|
|
|
254
|
-
export { AccountProfileCard, AppearanceSettings, AvatarPicker, ChoiceCards, LanguagePicker, appearanceLabels };
|
|
311
|
+
export { AVATAR_NONE, AccountProfileCard, AppearanceSettings, AvatarPicker, ChoiceCards, LanguagePicker, appearanceLabels, avatarOptionKind, builtInAvatarOptions, optionsOfKind };
|
|
255
312
|
export type { AccentOption, AccountProfileCardProps, AppearanceLabels, AppearanceSettingsProps, AvatarOption, AvatarPickerProps, ChoiceCardOption, ChoiceCardsProps, LanguageOption, LanguagePickerProps, ThemeCardOption, ThemePreview };
|
package/dist/account-settings.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CheckGlyph
|
|
3
|
-
|
|
2
|
+
CheckGlyph,
|
|
3
|
+
UploadGlyph
|
|
4
|
+
} from "./chunk-SHBYNQFS.js";
|
|
4
5
|
import {
|
|
5
6
|
SettingsRow,
|
|
6
7
|
defineRecipe
|
|
7
8
|
} from "./chunk-MTVX4RRF.js";
|
|
8
9
|
import {
|
|
9
10
|
Avatar,
|
|
11
|
+
DEFAULT_AVATAR_TONES,
|
|
10
12
|
defaultAvatarUrl
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-EUJ7337V.js";
|
|
12
14
|
import {
|
|
13
15
|
cn,
|
|
14
16
|
twMergeConfig
|
|
@@ -365,73 +367,233 @@ function AppearanceSettings({
|
|
|
365
367
|
|
|
366
368
|
// src/account-settings/avatar-picker.tsx
|
|
367
369
|
import { RadioGroup as RadioGroupPrimitive2 } from "radix-ui";
|
|
370
|
+
import * as React5 from "react";
|
|
371
|
+
|
|
372
|
+
// src/file-upload/file-upload.tsx
|
|
373
|
+
import { getNumberFormat } from "@krizaka/intl";
|
|
374
|
+
import { useQueue, useQueueSnapshot } from "@krizaka/pacer/react";
|
|
368
375
|
import * as React4 from "react";
|
|
376
|
+
import { tv as tv5 } from "tailwind-variants";
|
|
369
377
|
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
370
|
-
var
|
|
371
|
-
|
|
378
|
+
var fileUpload = tv5({
|
|
379
|
+
slots: {
|
|
380
|
+
zone: "relative flex w-full flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed border-border-default bg-surface-1 px-6 py-10 text-center transition-colors data-[dragging]:border-accent data-[dragging]:bg-accent-soft data-[disabled]:opacity-50 has-[:focus-visible]:border-accent",
|
|
381
|
+
zoneIcon: "flex h-12 w-12 items-center justify-center rounded-full bg-surface-3 text-fg-secondary",
|
|
382
|
+
zoneTitle: "text-sm font-semibold text-fg",
|
|
383
|
+
zoneHint: "text-xs text-fg-secondary",
|
|
384
|
+
browse: "inline-flex h-9 items-center justify-center rounded-lg bg-accent px-4 text-sm font-semibold text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface-0 disabled:pointer-events-none",
|
|
385
|
+
refusals: "w-full text-left text-xs font-medium text-fg-danger",
|
|
386
|
+
list: "flex w-full flex-col gap-2",
|
|
387
|
+
item: "flex items-center gap-3 rounded-xl border border-border-default bg-surface-1 p-3 data-[status=error]:border-danger/60",
|
|
388
|
+
preview: "flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-3 text-fg-secondary",
|
|
389
|
+
body: "flex min-w-0 flex-1 flex-col gap-1.5",
|
|
390
|
+
name: "truncate text-sm font-semibold text-fg",
|
|
391
|
+
meta: "flex flex-wrap gap-x-2 text-xs tabular-nums text-fg-secondary",
|
|
392
|
+
error: "text-xs font-medium text-fg-danger",
|
|
393
|
+
actions: "flex shrink-0 items-center gap-1",
|
|
394
|
+
action: "inline-flex h-8 w-8 items-center justify-center rounded-md text-fg-secondary transition-colors hover:bg-surface-3 hover:text-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring"
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
function acceptsFile(file, accept) {
|
|
398
|
+
if (!accept) return true;
|
|
399
|
+
const name = file.name.toLowerCase();
|
|
400
|
+
const type = file.type.toLowerCase();
|
|
401
|
+
return accept.split(",").map((rule) => rule.trim().toLowerCase()).filter(Boolean).some((rule) => rule.startsWith(".") ? name.endsWith(rule) : rule.endsWith("/*") ? type.startsWith(rule.slice(0, -1)) : type === rule);
|
|
402
|
+
}
|
|
403
|
+
function Dropzone({
|
|
404
|
+
title,
|
|
405
|
+
browseLabel,
|
|
406
|
+
hint,
|
|
407
|
+
accept,
|
|
408
|
+
maxSize,
|
|
409
|
+
maxFiles,
|
|
410
|
+
multiple,
|
|
411
|
+
disabled,
|
|
412
|
+
capture,
|
|
413
|
+
onFiles,
|
|
414
|
+
onReject,
|
|
415
|
+
refusalLabel,
|
|
416
|
+
icon,
|
|
417
|
+
className
|
|
418
|
+
}) {
|
|
419
|
+
const s3 = fileUpload();
|
|
420
|
+
const input = React4.useRef(null);
|
|
421
|
+
const [dragging, setDragging] = React4.useState(false);
|
|
422
|
+
const [refused, setRefused] = React4.useState([]);
|
|
423
|
+
const depth = React4.useRef(0);
|
|
372
424
|
const id = React4.useId();
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
425
|
+
const limit = maxFiles ?? (multiple ? Infinity : 1);
|
|
426
|
+
const take = (list) => {
|
|
427
|
+
const files = [...list];
|
|
428
|
+
const accepted = [];
|
|
429
|
+
const rejections = [];
|
|
430
|
+
for (const file of files) {
|
|
431
|
+
if (!acceptsFile(file, accept)) rejections.push({ file, reason: "type" });
|
|
432
|
+
else if (maxSize !== void 0 && file.size > maxSize) rejections.push({ file, reason: "size" });
|
|
433
|
+
else if (accepted.length >= limit) rejections.push({ file, reason: "count" });
|
|
434
|
+
else accepted.push(file);
|
|
435
|
+
}
|
|
436
|
+
setRefused(rejections);
|
|
437
|
+
if (accepted.length) onFiles(accepted);
|
|
438
|
+
if (rejections.length) onReject?.(rejections);
|
|
439
|
+
};
|
|
440
|
+
return /* @__PURE__ */ jsxs8(
|
|
441
|
+
"div",
|
|
442
|
+
{
|
|
443
|
+
className: s3.zone({ className }),
|
|
444
|
+
"data-dragging": dragging ? "" : void 0,
|
|
445
|
+
"data-disabled": disabled ? "" : void 0,
|
|
446
|
+
onDragEnter: (event) => {
|
|
447
|
+
if (disabled) return;
|
|
448
|
+
event.preventDefault();
|
|
449
|
+
depth.current += 1;
|
|
450
|
+
setDragging(true);
|
|
451
|
+
},
|
|
452
|
+
onDragOver: (event) => {
|
|
453
|
+
if (disabled) return;
|
|
454
|
+
event.preventDefault();
|
|
455
|
+
event.dataTransfer.dropEffect = "copy";
|
|
456
|
+
},
|
|
457
|
+
onDragLeave: () => {
|
|
458
|
+
depth.current = Math.max(0, depth.current - 1);
|
|
459
|
+
if (depth.current === 0) setDragging(false);
|
|
460
|
+
},
|
|
461
|
+
onDrop: (event) => {
|
|
462
|
+
if (disabled) return;
|
|
463
|
+
event.preventDefault();
|
|
464
|
+
depth.current = 0;
|
|
465
|
+
setDragging(false);
|
|
466
|
+
take(event.dataTransfer.files);
|
|
467
|
+
},
|
|
468
|
+
children: [
|
|
469
|
+
/* @__PURE__ */ jsx9("span", { className: s3.zoneIcon(), "aria-hidden": true, children: icon ?? /* @__PURE__ */ jsx9(UploadGlyph, { className: "h-6 w-6" }) }),
|
|
470
|
+
/* @__PURE__ */ jsx9("p", { id: `${id}-title`, className: s3.zoneTitle(), children: title }),
|
|
471
|
+
hint ? /* @__PURE__ */ jsx9("p", { id: `${id}-hint`, className: s3.zoneHint(), children: hint }) : null,
|
|
472
|
+
/* @__PURE__ */ jsx9(
|
|
473
|
+
"button",
|
|
474
|
+
{
|
|
475
|
+
type: "button",
|
|
476
|
+
className: s3.browse(),
|
|
477
|
+
disabled,
|
|
478
|
+
"aria-describedby": [`${id}-title`, hint ? `${id}-hint` : null].filter(Boolean).join(" "),
|
|
479
|
+
onClick: () => input.current?.click(),
|
|
480
|
+
children: browseLabel
|
|
481
|
+
}
|
|
384
482
|
),
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
483
|
+
/* @__PURE__ */ jsx9(
|
|
484
|
+
"input",
|
|
485
|
+
{
|
|
486
|
+
ref: input,
|
|
487
|
+
type: "file",
|
|
488
|
+
tabIndex: -1,
|
|
489
|
+
"aria-hidden": true,
|
|
490
|
+
className: "sr-only",
|
|
491
|
+
accept,
|
|
492
|
+
multiple,
|
|
493
|
+
capture,
|
|
494
|
+
disabled,
|
|
495
|
+
onChange: (event) => {
|
|
496
|
+
if (event.target.files?.length) take(event.target.files);
|
|
497
|
+
event.target.value = "";
|
|
393
498
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
499
|
+
}
|
|
500
|
+
),
|
|
501
|
+
refusalLabel && refused.length > 0 ? /* @__PURE__ */ jsx9("ul", { role: "alert", className: s3.refusals(), children: refused.map((r) => /* @__PURE__ */ jsx9("li", { children: refusalLabel(r) }, `${r.file.name}-${r.reason}`)) }) : null
|
|
502
|
+
]
|
|
503
|
+
}
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// src/account-settings/avatar-picker.tsx
|
|
508
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
509
|
+
var AVATAR_NONE = "none";
|
|
510
|
+
function avatarOptionKind(option) {
|
|
511
|
+
const kind = option.kind ?? option.defaultAvatar?.kind;
|
|
512
|
+
return kind === "plain" ? "person" : kind;
|
|
513
|
+
}
|
|
514
|
+
function optionsOfKind(options, kind) {
|
|
515
|
+
return options.filter((option) => {
|
|
516
|
+
const own = avatarOptionKind(option);
|
|
517
|
+
return own === void 0 || own === kind;
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
function builtInAvatarOptions(kind, brand, label) {
|
|
521
|
+
return Array.from({ length: DEFAULT_AVATAR_TONES }, (_, i) => ({ id: `${kind}-${i + 1}`, label: label(i + 1), kind, defaultAvatar: { brand, kind, tone: i + 1 } }));
|
|
522
|
+
}
|
|
523
|
+
var pictureOf = (option) => option.src ?? (option.defaultAvatar ? defaultAvatarUrl(option.defaultAvatar, { size: 256 }) : void 0);
|
|
524
|
+
function AvatarPicker({ label, showLabel, description, dense, kind = "person", options, noneLabel, uploadFile, upload, className, ...props }) {
|
|
525
|
+
const id = React5.useId();
|
|
526
|
+
const listed = optionsOfKind(options, kind);
|
|
527
|
+
const tile = cn(
|
|
528
|
+
"group/avatar relative shrink-0 rounded-full",
|
|
529
|
+
dense ? "h-12 w-12" : "aspect-square w-full",
|
|
530
|
+
"outline-none transition-shadow duration-200 motion-reduce:transition-none",
|
|
531
|
+
"ring-1 ring-border-default hover:ring-border-strong focus-visible:focus-ring data-[state=checked]:ring-2 data-[state=checked]:ring-accent"
|
|
532
|
+
);
|
|
533
|
+
const check = /* @__PURE__ */ jsx10(
|
|
534
|
+
"span",
|
|
535
|
+
{
|
|
536
|
+
"aria-hidden": true,
|
|
537
|
+
className: "absolute -bottom-0.5 -right-0.5 hidden h-5 w-5 items-center justify-center rounded-full border-2 border-surface-1 bg-accent text-on-accent group-data-[state=checked]/avatar:inline-flex",
|
|
538
|
+
children: /* @__PURE__ */ jsx10(CheckGlyph, { className: "h-3 w-3" })
|
|
539
|
+
}
|
|
540
|
+
);
|
|
541
|
+
const group = /* @__PURE__ */ jsxs9(RadioGroupPrimitive2.Root, { "aria-label": label, "aria-labelledby": showLabel ? id : void 0, className: cn(dense ? "flex flex-wrap gap-2.5" : "grid grid-cols-[repeat(auto-fill,minmax(4.25rem,1fr))] gap-3", !showLabel && !uploadFile && className), ...props, children: [
|
|
542
|
+
noneLabel ? /* @__PURE__ */ jsxs9(RadioGroupPrimitive2.Item, { value: AVATAR_NONE, "aria-label": noneLabel, className: tile, children: [
|
|
543
|
+
/* @__PURE__ */ jsx10("span", { "aria-hidden": true, className: "flex h-full w-full items-center justify-center rounded-full bg-surface-3 text-fg-secondary", children: /* @__PURE__ */ jsxs9("svg", { viewBox: "0 0 24 24", className: "h-1/2 w-1/2", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", children: [
|
|
544
|
+
/* @__PURE__ */ jsx10("circle", { cx: "12", cy: "12", r: "8" }),
|
|
545
|
+
/* @__PURE__ */ jsx10("path", { d: "M6.5 17.5l11-11" })
|
|
546
|
+
] }) }),
|
|
547
|
+
check
|
|
548
|
+
] }) : null,
|
|
549
|
+
listed.map((option) => /* @__PURE__ */ jsxs9(RadioGroupPrimitive2.Item, { value: option.id, "aria-label": option.label, className: tile, children: [
|
|
550
|
+
/* @__PURE__ */ jsx10("img", { src: pictureOf(option), alt: "", draggable: false, className: "h-full w-full rounded-full bg-surface-3 object-cover" }),
|
|
551
|
+
check
|
|
552
|
+
] }, option.id)),
|
|
553
|
+
upload ? /* @__PURE__ */ jsx10("div", { className: "flex aspect-square w-full items-center justify-center", children: upload }) : null
|
|
400
554
|
] });
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
|
|
555
|
+
const withUpload = uploadFile ? /* @__PURE__ */ jsxs9("div", { className: cn("flex flex-col gap-3", !showLabel && className), children: [
|
|
556
|
+
group,
|
|
557
|
+
/* @__PURE__ */ jsx10(Dropzone, { ...uploadFile, onFiles: (files) => files[0] && uploadFile.onFile(files[0]) })
|
|
558
|
+
] }) : group;
|
|
559
|
+
if (!showLabel) return withUpload;
|
|
560
|
+
return /* @__PURE__ */ jsxs9("div", { className: cn("flex flex-col gap-3", className), children: [
|
|
561
|
+
/* @__PURE__ */ jsx10(GroupHead, { id, label, description }),
|
|
562
|
+
withUpload
|
|
405
563
|
] });
|
|
406
564
|
}
|
|
407
565
|
|
|
408
566
|
// src/account-settings/choice-cards.tsx
|
|
409
|
-
import * as
|
|
410
|
-
import { jsx as
|
|
567
|
+
import * as React6 from "react";
|
|
568
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
411
569
|
function ChoiceCards({ label, showLabel, description, options, className, ...props }) {
|
|
412
|
-
const base =
|
|
413
|
-
const group = /* @__PURE__ */
|
|
570
|
+
const base = React6.useId();
|
|
571
|
+
const group = /* @__PURE__ */ jsx11(RadioGroup.Root, { variant: "cards", label, "aria-labelledby": showLabel ? `${base}-label` : void 0, className: ["grid grid-cols-1 gap-3 sm:grid-cols-2", !showLabel && className].filter(Boolean).join(" "), ...props, children: options.map((option) => {
|
|
414
572
|
const describedBy = option.description ? `${base}-${option.id}` : void 0;
|
|
415
|
-
return /* @__PURE__ */
|
|
416
|
-
/* @__PURE__ */
|
|
573
|
+
return /* @__PURE__ */ jsxs10(RadioGroup.Card, { value: option.id, disabled: option.disabled, "aria-describedby": describedBy, children: [
|
|
574
|
+
/* @__PURE__ */ jsxs10("span", { className: "flex items-center gap-2.5 font-semibold text-fg [&>svg]:h-5 [&>svg]:w-5 [&>svg]:text-accent", children: [
|
|
417
575
|
option.icon,
|
|
418
576
|
option.title
|
|
419
577
|
] }),
|
|
420
|
-
option.description ? /* @__PURE__ */
|
|
578
|
+
option.description ? /* @__PURE__ */ jsx11("span", { id: describedBy, className: "text-sm font-normal text-fg-secondary", children: option.description }) : null
|
|
421
579
|
] }, option.id);
|
|
422
580
|
}) });
|
|
423
581
|
if (!showLabel) return group;
|
|
424
|
-
return /* @__PURE__ */
|
|
425
|
-
/* @__PURE__ */
|
|
582
|
+
return /* @__PURE__ */ jsxs10("div", { className: ["flex flex-col gap-3", className].filter(Boolean).join(" "), children: [
|
|
583
|
+
/* @__PURE__ */ jsx11(GroupHead, { id: `${base}-label`, label, description }),
|
|
426
584
|
group
|
|
427
585
|
] });
|
|
428
586
|
}
|
|
429
587
|
export {
|
|
588
|
+
AVATAR_NONE,
|
|
430
589
|
AccountProfileCard,
|
|
431
590
|
AppearanceSettings,
|
|
432
591
|
AvatarPicker,
|
|
433
592
|
ChoiceCards,
|
|
434
593
|
LanguagePicker,
|
|
435
|
-
appearanceLabels
|
|
594
|
+
appearanceLabels,
|
|
595
|
+
avatarOptionKind,
|
|
596
|
+
builtInAvatarOptions,
|
|
597
|
+
optionsOfKind
|
|
436
598
|
};
|
|
437
599
|
//# sourceMappingURL=account-settings.js.map
|