@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.
Files changed (50) hide show
  1. package/dist/account-menu.d.ts +1 -1
  2. package/dist/account-menu.js +1 -1
  3. package/dist/account-settings.d.ts +61 -4
  4. package/dist/account-settings.js +206 -44
  5. package/dist/account-settings.js.map +1 -1
  6. package/dist/app-header.d.ts +3 -3
  7. package/dist/avatar/defaults.d.ts +16 -5
  8. package/dist/avatar/defaults.js +15 -1
  9. package/dist/avatar/defaults.js.map +1 -1
  10. package/dist/{avatar-BL2iG_Js.d.ts → avatar-BdZcfkWR.d.ts} +11 -4
  11. package/dist/avatar.d.ts +16 -5
  12. package/dist/avatar.js +15 -1
  13. package/dist/avatar.js.map +1 -1
  14. package/dist/chat.js +1 -1
  15. package/dist/chunk-EUJ7337V.js +137 -0
  16. package/dist/chunk-EUJ7337V.js.map +1 -0
  17. package/dist/chunk-HK525THY.js +139 -0
  18. package/dist/chunk-HK525THY.js.map +1 -0
  19. package/dist/{chunk-3D2YI63L.js → chunk-SHBYNQFS.js} +7 -2
  20. package/dist/{chunk-3D2YI63L.js.map → chunk-SHBYNQFS.js.map} +1 -1
  21. package/dist/dashboard-layout.js +2 -1
  22. package/dist/dashboard-layout.js.map +1 -1
  23. package/dist/docs-layout.js +1 -1
  24. package/dist/file-upload.d.ts +2 -2
  25. package/dist/filter-bar.d.ts +3 -3
  26. package/dist/language-switch.d.ts +9 -9
  27. package/dist/match-dialog.js +1 -1
  28. package/dist/media-grid.d.ts +8 -3
  29. package/dist/media-grid.js +1 -1
  30. package/dist/native.d.ts +8 -3
  31. package/dist/native.js +51 -0
  32. package/dist/native.js.map +1 -1
  33. package/dist/vertical-video.js +1 -1
  34. package/package.json +9 -9
  35. package/registry/account-settings.json +66 -5
  36. package/registry/avatar.json +5 -4
  37. package/registry/dashboard-layout.json +1 -1
  38. package/registry/elephant.json +1 -1
  39. package/registry/examples/account-settings/avatar-picker-folder.d.ts +4 -0
  40. package/registry/examples/account-settings/avatar-picker-folder.js +27 -0
  41. package/registry/examples/account-settings/avatar-picker-folder.tsx +23 -0
  42. package/registry/index.json +8 -7
  43. package/registry/map.json +1 -1
  44. package/registry/nav-bar.json +1 -1
  45. package/registry/rail-nav.json +1 -1
  46. package/registry/site-footer.json +1 -1
  47. package/dist/chunk-7AZ23BUX.js +0 -88
  48. package/dist/chunk-7AZ23BUX.js.map +0 -1
  49. package/dist/chunk-PW2FVPTV.js +0 -85
  50. package/dist/chunk-PW2FVPTV.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Avatar
4
- } from "./chunk-7AZ23BUX.js";
4
+ } from "./chunk-HK525THY.js";
5
5
  import {
6
6
  IconButton
7
7
  } from "./chunk-M3GEYLMR.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krizaka/ui",
3
- "version": "3.63.1",
3
+ "version": "3.64.0",
4
4
  "description": "The Krizaka front-end platform's components: the primitives (button, card, dialog, toast, menu, field, tabs, chip, switch, slider, command palette, theme, countdown…) on the semantic --kz-* tokens, the animated marks (Krizaka, Orazaka, Yomizaka, Akinaza) and the motion signature — web and /native.",
5
5
  "keywords": [
6
6
  "krizaka",
@@ -881,7 +881,7 @@
881
881
  ],
882
882
  "peerDependencies": {
883
883
  "@krizaka/query": ">=0.2.2",
884
- "@krizaka/tailwind": ">=3.63.1",
884
+ "@krizaka/tailwind": ">=3.64.0",
885
885
  "@maplibre/maplibre-react-native": ">=11",
886
886
  "@shopify/flash-list": ">=2",
887
887
  "expo-camera": ">=16",
@@ -1004,7 +1004,7 @@
1004
1004
  {
1005
1005
  "name": "./native (bundled into the app by Metro, never downloaded: a regression guard, not a budget)",
1006
1006
  "path": "dist/native.js",
1007
- "limit": "67 kB",
1007
+ "limit": "67.5 kB",
1008
1008
  "gzip": true
1009
1009
  },
1010
1010
  {
@@ -1818,7 +1818,7 @@
1818
1818
  {
1819
1819
  "name": "./vertical-video",
1820
1820
  "path": "dist/vertical-video.js",
1821
- "limit": "6 kB",
1821
+ "limit": "7 kB",
1822
1822
  "gzip": true,
1823
1823
  "ignore": [
1824
1824
  "tailwind-variants",
@@ -2480,7 +2480,7 @@
2480
2480
  {
2481
2481
  "name": "./account-menu",
2482
2482
  "path": "dist/account-menu.js",
2483
- "limit": "3 kB",
2483
+ "limit": "4 kB",
2484
2484
  "gzip": true,
2485
2485
  "ignore": [
2486
2486
  "tailwind-variants",
@@ -2854,7 +2854,7 @@
2854
2854
  {
2855
2855
  "name": "./media-grid",
2856
2856
  "path": "dist/media-grid.js",
2857
- "limit": "8 kB",
2857
+ "limit": "9 kB",
2858
2858
  "gzip": true,
2859
2859
  "ignore": [
2860
2860
  "tailwind-variants",
@@ -2929,7 +2929,7 @@
2929
2929
  {
2930
2930
  "name": "./chat",
2931
2931
  "path": "dist/chat.js",
2932
- "limit": "7 kB",
2932
+ "limit": "7.6 kB",
2933
2933
  "gzip": true,
2934
2934
  "ignore": [
2935
2935
  "tailwind-variants",
@@ -2995,8 +2995,8 @@
2995
2995
  "tailwind-variants": "^3.3.1",
2996
2996
  "zod": "^4.6.7",
2997
2997
  "@krizaka/intl": "^0.4.1",
2998
- "@krizaka/tokens": "^3.63.1",
2999
- "@krizaka/pacer": "^0.1.0"
2998
+ "@krizaka/pacer": "^0.1.0",
2999
+ "@krizaka/tokens": "^3.64.0"
3000
3000
  },
3001
3001
  "scripts": {
3002
3002
  "build": "node -e \"const fs=require('node:fs');fs.rmSync('dist',{recursive:true,force:true});for(const f of fs.readdirSync('registry/examples',{recursive:true}))if(/\\.(js|d\\.ts)$/.test(f))fs.rmSync('registry/examples/'+f)\" && tsup && node -e \"require('node:fs').copyFileSync('src/motion.css','dist/motion.css');require('node:fs').copyFileSync('src/blocks.css','dist/blocks.css');require('node:fs').copyFileSync('src/story.css','dist/story.css')\" && node scripts/build-registry.mjs",
@@ -267,6 +267,11 @@
267
267
  }
268
268
  ]
269
269
  },
270
+ {
271
+ "component": "AVATAR_NONE",
272
+ "description": "The value of the « no picture » tile (`noneLabel`).",
273
+ "props": []
274
+ },
270
275
  {
271
276
  "component": "AvatarPicker",
272
277
  "description": "A grid of pictures to choose from, with an upload beside them: a radio group, never a row of loose radios.",
@@ -282,7 +287,7 @@
282
287
  "name": "options",
283
288
  "type": "readonly AvatarOption[]",
284
289
  "default": null,
285
- "description": "The pictures.",
290
+ "description": "The pictures — the central set of the kind (`listDefaults(kind)` of `@krizaka/org`) turned into options, with `src`.",
286
291
  "required": true
287
292
  },
288
293
  {
@@ -299,6 +304,20 @@
299
304
  "description": "One line under the visible label: what it changes.",
300
305
  "required": false
301
306
  },
307
+ {
308
+ "name": "kind",
309
+ "type": "DefaultAvatarEntityKind",
310
+ "default": "person",
311
+ "description": "What the pictures are of: `person` (default), `folder`, `organisation` or `shop`. Only the options of this kind are listed.",
312
+ "required": false
313
+ },
314
+ {
315
+ "name": "noneLabel",
316
+ "type": "string",
317
+ "default": null,
318
+ "description": "Adds a « no picture » tile first, chosen with the value `AVATAR_NONE`; the words of the tile, passed translated.",
319
+ "required": false
320
+ },
302
321
  {
303
322
  "name": "onValueChange",
304
323
  "type": "((value: string) => void) | ((id: string) => void)",
@@ -320,6 +339,13 @@
320
339
  "description": "After the pictures, in the grid: the upload action (a `Button`, a file input's label). Not a radio.",
321
340
  "required": false
322
341
  },
342
+ {
343
+ "name": "uploadFile",
344
+ "type": "(Pick<DropzoneProps, \"title\" | \"hint\" | \"disabled\" | \"browseLabel\" | \"accept\" | \"maxSize\" | \"refusalLabel\" | \"onReject\"> & { onFile: (file: File) => void; })",
345
+ "default": null,
346
+ "description": "The library's upload control under the grid: a `Dropzone` (a real file input), for a picture of one's own.",
347
+ "required": false
348
+ },
323
349
  {
324
350
  "name": "value",
325
351
  "type": "string | null",
@@ -488,6 +514,14 @@
488
514
  "module": "@krizaka/ui/registry/examples/account-settings/avatar-picker",
489
515
  "code": "import { AvatarPicker } from \"@krizaka/ui/account-settings\";\nimport { Button } from \"@krizaka/ui/button\";\nimport * as React from \"react\";\n\nconst OPTIONS = [1, 2, 3, 4, 5, 6].map((tone) => ({ id: `tone-${tone}`, label: `Teinte ${tone}`, defaultAvatar: { brand: \"yomizaka\", tone } as const }));\n\n// The family's default pictures as one radio group, and the upload beside them: no loose radios.\nexport default function AvatarPickerExample() {\n const [value, setValue] = React.useState(\"tone-2\");\n return (\n <div className=\"w-full max-w-md\">\n <AvatarPicker label=\"Photo de profil\" showLabel options={OPTIONS} value={value} onValueChange={setValue} upload={<Button variant=\"secondary\" size=\"sm\">Téléverser</Button>} />\n </div>\n );\n}\n"
490
516
  },
517
+ {
518
+ "name": "avatar-picker-folder",
519
+ "title": "Avatar picker of a folder",
520
+ "description": "`kind=\"folder\"`: the folder set, never a person; a « no picture » tile; the library's `Dropzone` to upload.",
521
+ "path": "examples/account-settings/avatar-picker-folder.tsx",
522
+ "module": "@krizaka/ui/registry/examples/account-settings/avatar-picker-folder",
523
+ "code": "import { AVATAR_NONE, AvatarPicker, builtInAvatarOptions } from \"@krizaka/ui/account-settings\";\nimport * as React from \"react\";\n\nconst OPTIONS = builtInAvatarOptions(\"folder\", \"yomizaka\", (tone) => `Teinte ${tone}`);\n\n// A folder's picture: the set of the folder kind (never a person), the « no picture » tile and the library's upload control.\nexport default function AvatarPickerFolderExample() {\n const [value, setValue] = React.useState(\"folder-2\");\n return (\n <div className=\"w-full max-w-md\">\n <AvatarPicker\n label=\"Photo du dossier\"\n showLabel\n kind=\"folder\"\n noneLabel=\"Aucune photo\"\n options={OPTIONS}\n value={value}\n onValueChange={(id) => setValue(id === AVATAR_NONE ? AVATAR_NONE : id)}\n uploadFile={{ title: \"Déposez une image\", browseLabel: \"Choisir une image\", hint: \"PNG ou JPEG, 2 Mo au plus\", accept: \"image/png,image/jpeg\", maxSize: 2_000_000, onFile: () => {} }}\n />\n </div>\n );\n}\n"
524
+ },
491
525
  {
492
526
  "name": "choice-cards",
493
527
  "title": "Choice cards",
@@ -534,7 +568,7 @@
534
568
  },
535
569
  {
536
570
  "path": "account-settings/avatar-picker.tsx",
537
- "content": "// Client (a radio group). The pictures of a person to choose from — the family's default avatars, a few photos — as a grid of\n// round tiles: one named radiogroup, one tab stop, the arrows choose, a ring and a check on the chosen one.\nimport { RadioGroup as RadioGroupPrimitive } from \"radix-ui\";\nimport * as React from \"react\";\n\nimport { type DefaultAvatar, defaultAvatarUrl } from \"../avatar/default-avatar\";\nimport { cn } from \"../cn\";\nimport { CheckGlyph } from \"../glyphs\";\nimport { GroupHead } from \"./group-head\";\n\nexport interface AvatarOption {\n /** The value of the choice. */\n id: string;\n /** Its name for assistive technology (“Teinte 3”) — passed translated. */\n label: string;\n /** A picture's address; otherwise `defaultAvatar` draws one of the family's pictures. */\n src?: string;\n /** One of Krizaka's default pictures (`{ brand, tone }`). */\n defaultAvatar?: DefaultAvatar;\n}\n\nexport type AvatarPickerProps = Omit<React.ComponentProps<typeof RadioGroupPrimitive.Root>, \"children\" | \"onChange\" | \"dir\"> & {\n /** The group's accessible name (“Profile picture”) — passed translated. */\n label: string;\n /**\n * Smaller tiles, for a settings row.\n * @default false\n */\n dense?: boolean;\n /** Shows the label above the grid, with `description` under it. */\n showLabel?: boolean;\n /** One line under the visible label: what it changes. */\n description?: React.ReactNode;\n /** The pictures. */\n options: readonly AvatarOption[];\n /** The chosen id (controlled). */\n value?: string;\n /** The viewer chooses another picture. */\n onValueChange?: (id: string) => void;\n /** After the pictures, in the grid: the upload action (a `Button`, a file input's label). Not a radio. */\n upload?: React.ReactNode;\n};\n\nconst pictureOf = (option: AvatarOption) => option.src ?? (option.defaultAvatar ? defaultAvatarUrl(option.defaultAvatar, { size: 256 }) : undefined);\n\n/** A grid of pictures to choose from, with an upload beside them: a radio group, never a row of loose radios. */\nexport function AvatarPicker({ label, showLabel, description, dense, options, upload, className, ...props }: AvatarPickerProps) {\n const id = React.useId();\n const group = (\n <RadioGroupPrimitive.Root aria-label={label} aria-labelledby={showLabel ? id : undefined} className={cn(dense ? \"flex flex-wrap gap-2.5\" : \"grid grid-cols-[repeat(auto-fill,minmax(4.25rem,1fr))] gap-3\", !showLabel && className)} {...props}>\n {options.map((option) => (\n <RadioGroupPrimitive.Item\n key={option.id}\n value={option.id}\n aria-label={option.label}\n className={cn(\n \"group/avatar relative shrink-0 rounded-full\", dense ? \"h-12 w-12\" : \"aspect-square w-full\",\n \" outline-none transition-shadow duration-200 motion-reduce:transition-none\",\n \"ring-1 ring-border-default hover:ring-border-strong focus-visible:focus-ring data-[state=checked]:ring-2 data-[state=checked]:ring-accent\",\n )}\n >\n <img src={pictureOf(option)} alt=\"\" draggable={false} className=\"h-full w-full rounded-full bg-surface-3 object-cover\" />\n <span\n aria-hidden\n 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\"\n >\n <CheckGlyph className=\"h-3 w-3\" />\n </span>\n </RadioGroupPrimitive.Item>\n ))}\n {upload ? <div className=\"flex aspect-square w-full items-center justify-center\">{upload}</div> : null}\n </RadioGroupPrimitive.Root>\n );\n if (!showLabel) return group;\n return (\n <div className={cn(\"flex flex-col gap-3\", className)}>\n <GroupHead id={id} label={label} description={description} />\n {group}\n </div>\n );\n}\n"
571
+ "content": "// Client (a radio group). The pictures of a person to choose from — the family's default avatars, a few photos — as a grid of\n// round tiles: one named radiogroup, one tab stop, the arrows choose, a ring and a check on the chosen one.\nimport { RadioGroup as RadioGroupPrimitive } from \"radix-ui\";\nimport * as React from \"react\";\n\nimport { DEFAULT_AVATAR_TONES,type DefaultAvatar, type DefaultAvatarBrand, type DefaultAvatarEntityKind, defaultAvatarUrl } from \"../avatar/default-avatar\";\nimport { cn } from \"../cn\";\nimport { Dropzone, type DropzoneProps } from \"../file-upload\";\nimport { CheckGlyph } from \"../glyphs\";\nimport { GroupHead } from \"./group-head\";\n\n/** The value of the « no picture » tile (`noneLabel`). */\nexport const AVATAR_NONE = \"none\";\n\nexport interface AvatarOption {\n /** The value of the choice. */\n id: string;\n /** Its name for assistive technology (“Teinte 3”) — passed translated. */\n label: string;\n /** A picture's address; otherwise `defaultAvatar` draws one of the family's pictures. */\n src?: string;\n /** One of Krizaka's default pictures (`{ brand, tone }`). */\n defaultAvatar?: DefaultAvatar;\n /** 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). */\n kind?: DefaultAvatarEntityKind;\n}\n\n/** What an option is of, when it says: its own `kind`, else its default picture's. */\nexport function avatarOptionKind(option: AvatarOption): DefaultAvatarEntityKind | undefined {\n const kind = option.kind ?? option.defaultAvatar?.kind;\n return kind === \"plain\" ? \"person\" : kind;\n}\n\n/** 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. */\nexport function optionsOfKind(options: readonly AvatarOption[], kind: DefaultAvatarEntityKind): AvatarOption[] {\n return options.filter((option) => {\n const own = avatarOptionKind(option);\n return own === undefined || own === kind;\n });\n}\n\n/** The pictures drawn here for a kind: the brand's six tones, no request. Used when the app passes no `options`. */\nexport function builtInAvatarOptions(kind: DefaultAvatarEntityKind, brand: DefaultAvatarBrand, label: (tone: number) => string): AvatarOption[] {\n return Array.from({ length: DEFAULT_AVATAR_TONES }, (_, i) => ({ id: `${kind}-${i + 1}`, label: label(i + 1), kind, defaultAvatar: { brand, kind, tone: i + 1 } }));\n}\n\nexport type AvatarPickerProps = Omit<React.ComponentProps<typeof RadioGroupPrimitive.Root>, \"children\" | \"onChange\" | \"dir\"> & {\n /** The group's accessible name (“Profile picture”) — passed translated. */\n label: string;\n /**\n * Smaller tiles, for a settings row.\n * @default false\n */\n dense?: boolean;\n /** Shows the label above the grid, with `description` under it. */\n showLabel?: boolean;\n /** One line under the visible label: what it changes. */\n description?: React.ReactNode;\n /**\n * What the pictures are of: `person` (default), `folder`, `organisation` or `shop`. Only the options of this kind are listed.\n * @default \"person\"\n */\n kind?: DefaultAvatarEntityKind;\n /** The pictures — the central set of the kind (`listDefaults(kind)` of `@krizaka/org`) turned into options, with `src`. */\n options: readonly AvatarOption[];\n /** Adds a « no picture » tile first, chosen with the value `AVATAR_NONE`; the words of the tile, passed translated. */\n noneLabel?: string;\n /** The library's upload control under the grid: a `Dropzone` (a real file input), for a picture of one's own. */\n uploadFile?: Pick<DropzoneProps, \"title\" | \"browseLabel\" | \"hint\" | \"accept\" | \"maxSize\" | \"disabled\" | \"refusalLabel\" | \"onReject\"> & { onFile: (file: File) => void };\n /** The chosen id (controlled). */\n value?: string;\n /** The viewer chooses another picture. */\n onValueChange?: (id: string) => void;\n /** After the pictures, in the grid: the upload action (a `Button`, a file input's label). Not a radio. */\n upload?: React.ReactNode;\n};\n\nconst pictureOf = (option: AvatarOption) => option.src ?? (option.defaultAvatar ? defaultAvatarUrl(option.defaultAvatar, { size: 256 }) : undefined);\n\n/** A grid of pictures to choose from, with an upload beside them: a radio group, never a row of loose radios. */\nexport function AvatarPicker({ label, showLabel, description, dense, kind = \"person\", options, noneLabel, uploadFile, upload, className, ...props }: AvatarPickerProps) {\n const id = React.useId();\n const listed = optionsOfKind(options, kind);\n const tile = cn(\n \"group/avatar relative shrink-0 rounded-full\",\n dense ? \"h-12 w-12\" : \"aspect-square w-full\",\n \"outline-none transition-shadow duration-200 motion-reduce:transition-none\",\n \"ring-1 ring-border-default hover:ring-border-strong focus-visible:focus-ring data-[state=checked]:ring-2 data-[state=checked]:ring-accent\",\n );\n const check = (\n <span\n aria-hidden\n 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\"\n >\n <CheckGlyph className=\"h-3 w-3\" />\n </span>\n );\n const group = (\n <RadioGroupPrimitive.Root aria-label={label} aria-labelledby={showLabel ? id : undefined} 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}>\n {noneLabel ? (\n <RadioGroupPrimitive.Item value={AVATAR_NONE} aria-label={noneLabel} className={tile}>\n <span aria-hidden className=\"flex h-full w-full items-center justify-center rounded-full bg-surface-3 text-fg-secondary\">\n <svg viewBox=\"0 0 24 24\" className=\"h-1/2 w-1/2\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.75\" strokeLinecap=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"8\" />\n <path d=\"M6.5 17.5l11-11\" />\n </svg>\n </span>\n {check}\n </RadioGroupPrimitive.Item>\n ) : null}\n {listed.map((option) => (\n <RadioGroupPrimitive.Item key={option.id} value={option.id} aria-label={option.label} className={tile}>\n <img src={pictureOf(option)} alt=\"\" draggable={false} className=\"h-full w-full rounded-full bg-surface-3 object-cover\" />\n {check}\n </RadioGroupPrimitive.Item>\n ))}\n {upload ? <div className=\"flex aspect-square w-full items-center justify-center\">{upload}</div> : null}\n </RadioGroupPrimitive.Root>\n );\n const withUpload = uploadFile ? (\n <div className={cn(\"flex flex-col gap-3\", !showLabel && className)}>\n {group}\n <Dropzone {...uploadFile} onFiles={(files) => files[0] && uploadFile.onFile(files[0])} />\n </div>\n ) : (\n group\n );\n if (!showLabel) return withUpload;\n return (\n <div className={cn(\"flex flex-col gap-3\", className)}>\n <GroupHead id={id} label={label} description={description} />\n {withUpload}\n </div>\n );\n}\n"
538
572
  },
539
573
  {
540
574
  "path": "account-settings/choice-cards.tsx",
@@ -546,7 +580,7 @@
546
580
  },
547
581
  {
548
582
  "path": "account-settings/index.ts",
549
- "content": "/** @krizaka/ui/account-settings — the blocks of an account page: `AccountProfileCard`, `AvatarPicker`, `ChoiceCards`, `LanguagePicker`. Client. The inline save of a section is `SettingsSection`'s `save` with `useSaveStatus` (`@krizaka/ui/settings-layout`). */\nexport { AccountProfileCard, type AccountProfileCardProps } from \"./account-profile-card\";\nexport {\n type AccentOption,\n type AppearanceLabels,\n appearanceLabels,\n AppearanceSettings,\n type AppearanceSettingsProps,\n type ThemeCardOption,\n type ThemePreview,\n} from \"./appearance-settings\";\nexport { type AvatarOption, AvatarPicker, type AvatarPickerProps } from \"./avatar-picker\";\nexport { type ChoiceCardOption, ChoiceCards, type ChoiceCardsProps } from \"./choice-cards\";\nexport { type LanguageOption, LanguagePicker, type LanguagePickerProps } from \"./language-picker\";\n"
583
+ "content": "/** @krizaka/ui/account-settings — the blocks of an account page: `AccountProfileCard`, `AvatarPicker`, `ChoiceCards`, `LanguagePicker`. Client. The inline save of a section is `SettingsSection`'s `save` with `useSaveStatus` (`@krizaka/ui/settings-layout`). */\nexport { AccountProfileCard, type AccountProfileCardProps } from \"./account-profile-card\";\nexport {\n type AccentOption,\n type AppearanceLabels,\n appearanceLabels,\n AppearanceSettings,\n type AppearanceSettingsProps,\n type ThemeCardOption,\n type ThemePreview,\n} from \"./appearance-settings\";\nexport { AVATAR_NONE, type AvatarOption, avatarOptionKind, AvatarPicker, type AvatarPickerProps, builtInAvatarOptions, optionsOfKind } from \"./avatar-picker\";\nexport { type ChoiceCardOption, ChoiceCards, type ChoiceCardsProps } from \"./choice-cards\";\nexport { type LanguageOption, LanguagePicker, type LanguagePickerProps } from \"./language-picker\";\n"
550
584
  },
551
585
  {
552
586
  "path": "account-settings/language-picker.tsx",
@@ -554,7 +588,7 @@
554
588
  },
555
589
  {
556
590
  "path": "account-settings/meta.ts",
557
- "content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Account settings\",\n summary:\n \"The blocks of an account page, so every app has the same polished one: the identity card (picture, name, verified e-mail, member since), a picture grid to choose from, a labelled language control, selectable cards for a single choice — beside `SettingsSection`'s one inline save.\",\n status: \"beta\",\n category: \"forms\",\n platforms: \"web\",\n parity: {\n native: { status: \"gap\", issue: \"krizaka/krizaka-ui#503\", reason: \"The Expo apps get the same blocks on @krizaka/ui/native.\" },\n desktop: \"web\",\n },\n whenToUse: [\n \"The profile page of any Krizaka app (a product's `/settings/profile`, the future `@krizaka/auth`).\",\n \"`ChoiceCards` for any single choice that deserves a sentence each: a side, a plan, a way to be answered.\",\n ],\n whenNotToUse: [\n { when: \"A choice between a few short words (a view, a size).\", use: \"radio-group\" },\n { when: \"A set of tiles that lead somewhere or show a line-up.\", use: \"choice-grid\" },\n { when: \"The language of a public page: it is a link to the same page in the other language.\", use: \"language-switch\" },\n ],\n bestPractices: [\n \"One save per section (`SettingsSection` `save`): enabled while the section is dirty, « Saved » and Undo after it, the failure as an alert. Never a save above the fields.\",\n \"`AvatarPicker` is one radiogroup — never a row of circles with loose radios; keep the upload inside its grid, after the pictures.\",\n \"Name every language in its own language and label the control: « Langue », never an unlabelled switch.\",\n \"Pass every word translated; the member-since date is formatted by the app in the viewer's language.\",\n \"Appearance: pass the themes the product offers (system, light, dark, then Blueprint and Carbone if wanted — never a paper theme inside a signed-in product) from `appearance` of @krizaka/tokens, and only the accents that read on all of them (`appearance.passes`). The change applies at once (`useAppearance()` of `@krizaka/ui/theme`, restored before paint by `ThemeScript`); save it in the account too so it follows the person. Sound is opt-in, off by default, never under reduced motion; density is `html[data-density]`.\",\n \"Section patterns (security, subscription, storage, my data) are flat sections of `SettingsRow`s: the billing portal is one link, the export one button, the delete a `ConfirmButton`.\",\n ],\n accessibility: {\n keyboard: [\n { keys: \"← → ↑ ↓\", action: \"Moves to the next picture, card or language and chooses it (one tab stop per group).\" },\n { keys: \"Space\", action: \"Chooses the focused one.\" },\n { keys: \"Enter (in a field)\", action: \"Submits the section's form: saves when it is dirty.\" },\n ],\n notes: [\n \"Each group is a named `radiogroup`; the chosen item says `aria-checked`, shows a ring and a check (not colour alone).\",\n \"A card's description is its `aria-describedby`; a picture is named by its `label`, not its image.\",\n \"The save result is a polite live region that stays mounted; a failure is `role=\\\"alert\\\"`.\",\n ],\n },\n related: [\"settings-layout\", \"radio-group\", \"avatar\", \"choice-grid\", \"confirm-button\", \"meter\"],\n web: {\n imports: [\"AccountProfileCard\", \"AvatarPicker\", \"ChoiceCards\", \"LanguagePicker\", \"AppearanceSettings\"],\n examples: [\n { name: \"profile\", title: \"Profile page\", description: \"A whole profile section: identity, name, pictures, language, side — one save, dirty then saved with Undo.\", template: true, purpose: \"operate\", why: \"A person changes who they are in the app in one place, and sees at once that it was kept.\" },\n { name: \"avatar-picker\", title: \"Avatar picker\", description: \"The family's default pictures as one radio group, the upload beside them.\" },\n { name: \"choice-cards\", title: \"Choice cards\", description: \"A single choice as two cards with an icon, a title and a line.\" },\n { name: \"language-picker\", title: \"Language picker\", description: \"Labelled, native names.\" },\n { name: \"appearance\", title: \"Appearance\", description: \"Theme cards (live miniatures, one check), accent, density and language as settings rows; applied at once with `useAppearance()`.\" },\n { name: \"patterns\", title: \"Section patterns\", description: \"Security, subscription, storage and my data as flat sections of rows.\" },\n ],\n },\n} satisfies ComponentMeta;\n"
591
+ "content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Account settings\",\n summary:\n \"The blocks of an account page, so every app has the same polished one: the identity card (picture, name, verified e-mail, member since), a picture grid to choose from, a labelled language control, selectable cards for a single choice — beside `SettingsSection`'s one inline save.\",\n status: \"beta\",\n category: \"forms\",\n platforms: \"web\",\n parity: {\n native: { status: \"gap\", issue: \"krizaka/krizaka-ui#503\", reason: \"The Expo apps get the same blocks on @krizaka/ui/native.\" },\n desktop: \"web\",\n },\n whenToUse: [\n \"The profile page of any Krizaka app (a product's `/settings/profile`, the future `@krizaka/auth`).\",\n \"`ChoiceCards` for any single choice that deserves a sentence each: a side, a plan, a way to be answered.\",\n ],\n whenNotToUse: [\n { when: \"A choice between a few short words (a view, a size).\", use: \"radio-group\" },\n { when: \"A set of tiles that lead somewhere or show a line-up.\", use: \"choice-grid\" },\n { when: \"The language of a public page: it is a link to the same page in the other language.\", use: \"language-switch\" },\n ],\n bestPractices: [\n \"One save per section (`SettingsSection` `save`): enabled while the section is dirty, « Saved » and Undo after it, the failure as an alert. Never a save above the fields.\",\n \"`AvatarPicker` is one radiogroup — never a row of circles with loose radios; keep the upload inside its grid, after the pictures.\",\n \"Name every language in its own language and label the control: « Langue », never an unlabelled switch.\",\n \"Pass every word translated; the member-since date is formatted by the app in the viewer's language.\",\n \"Appearance: pass the themes the product offers (system, light, dark, then Blueprint and Carbone if wanted — never a paper theme inside a signed-in product) from `appearance` of @krizaka/tokens, and only the accents that read on all of them (`appearance.passes`). The change applies at once (`useAppearance()` of `@krizaka/ui/theme`, restored before paint by `ThemeScript`); save it in the account too so it follows the person. Sound is opt-in, off by default, never under reduced motion; density is `html[data-density]`.\",\n \"Section patterns (security, subscription, storage, my data) are flat sections of `SettingsRow`s: the billing portal is one link, the export one button, the delete a `ConfirmButton`.\",\n ],\n accessibility: {\n keyboard: [\n { keys: \"← → ↑ ↓\", action: \"Moves to the next picture, card or language and chooses it (one tab stop per group).\" },\n { keys: \"Space\", action: \"Chooses the focused one.\" },\n { keys: \"Enter (in a field)\", action: \"Submits the section's form: saves when it is dirty.\" },\n ],\n notes: [\n \"Each group is a named `radiogroup`; the chosen item says `aria-checked`, shows a ring and a check (not colour alone).\",\n \"A card's description is its `aria-describedby`; a picture is named by its `label`, not its image.\",\n \"The save result is a polite live region that stays mounted; a failure is `role=\\\"alert\\\"`.\",\n ],\n },\n related: [\"settings-layout\", \"radio-group\", \"avatar\", \"choice-grid\", \"confirm-button\", \"meter\"],\n web: {\n imports: [\"AccountProfileCard\", \"AvatarPicker\", \"ChoiceCards\", \"LanguagePicker\", \"AppearanceSettings\"],\n examples: [\n { name: \"profile\", title: \"Profile page\", description: \"A whole profile section: identity, name, pictures, language, side — one save, dirty then saved with Undo.\", template: true, purpose: \"operate\", why: \"A person changes who they are in the app in one place, and sees at once that it was kept.\" },\n { name: \"avatar-picker\", title: \"Avatar picker\", description: \"The family's default pictures as one radio group, the upload beside them.\" },\n { name: \"avatar-picker-folder\", title: \"Avatar picker of a folder\", description: \"`kind=\\\"folder\\\"`: the folder set, never a person; a « no picture » tile; the library's `Dropzone` to upload.\" },\n { name: \"choice-cards\", title: \"Choice cards\", description: \"A single choice as two cards with an icon, a title and a line.\" },\n { name: \"language-picker\", title: \"Language picker\", description: \"Labelled, native names.\" },\n { name: \"appearance\", title: \"Appearance\", description: \"Theme cards (live miniatures, one check), accent, density and language as settings rows; applied at once with `useAppearance()`.\" },\n { name: \"patterns\", title: \"Section patterns\", description: \"Security, subscription, storage and my data as flat sections of rows.\" },\n ],\n },\n} satisfies ComponentMeta;\n"
558
592
  },
559
593
  {
560
594
  "path": "glyphs.tsx",
@@ -573,6 +607,7 @@
573
607
  "badge",
574
608
  "cn",
575
609
  "field",
610
+ "file-upload",
576
611
  "radio-group",
577
612
  "settings-layout",
578
613
  "switch"
@@ -769,6 +804,11 @@
769
804
  }
770
805
  ]
771
806
  },
807
+ {
808
+ "component": "AVATAR_NONE",
809
+ "description": "The value of the « no picture » tile (`noneLabel`).",
810
+ "props": []
811
+ },
772
812
  {
773
813
  "component": "AvatarPicker",
774
814
  "description": "A grid of pictures to choose from, with an upload beside them: a radio group, never a row of loose radios.",
@@ -784,7 +824,7 @@
784
824
  "name": "options",
785
825
  "type": "readonly AvatarOption[]",
786
826
  "default": null,
787
- "description": "The pictures.",
827
+ "description": "The pictures — the central set of the kind (`listDefaults(kind)` of `@krizaka/org`) turned into options, with `src`.",
788
828
  "required": true
789
829
  },
790
830
  {
@@ -801,6 +841,20 @@
801
841
  "description": "One line under the visible label: what it changes.",
802
842
  "required": false
803
843
  },
844
+ {
845
+ "name": "kind",
846
+ "type": "DefaultAvatarEntityKind",
847
+ "default": "person",
848
+ "description": "What the pictures are of: `person` (default), `folder`, `organisation` or `shop`. Only the options of this kind are listed.",
849
+ "required": false
850
+ },
851
+ {
852
+ "name": "noneLabel",
853
+ "type": "string",
854
+ "default": null,
855
+ "description": "Adds a « no picture » tile first, chosen with the value `AVATAR_NONE`; the words of the tile, passed translated.",
856
+ "required": false
857
+ },
804
858
  {
805
859
  "name": "onValueChange",
806
860
  "type": "((value: string) => void) | ((id: string) => void)",
@@ -822,6 +876,13 @@
822
876
  "description": "After the pictures, in the grid: the upload action (a `Button`, a file input's label). Not a radio.",
823
877
  "required": false
824
878
  },
879
+ {
880
+ "name": "uploadFile",
881
+ "type": "(Pick<DropzoneProps, \"title\" | \"hint\" | \"disabled\" | \"browseLabel\" | \"accept\" | \"maxSize\" | \"refusalLabel\" | \"onReject\"> & { onFile: (file: File) => void; })",
882
+ "default": null,
883
+ "description": "The library's upload control under the grid: a `Dropzone` (a real file input), for a picture of one's own.",
884
+ "required": false
885
+ },
825
886
  {
826
887
  "name": "value",
827
888
  "type": "string | null",
@@ -35,6 +35,7 @@
35
35
  "bestPractices": [
36
36
  "Always pass a `fallback` (initials) on the web: images fail, and the layout should not jump.",
37
37
  "A profile can lack a photo: pass `defaultAvatar={{ brand, seed: user.id }}` and the person gets the product's own default picture (a silhouette on the brand's gradient, one of six tones, always the same for the same id) instead of an empty circle. It also replaces a photo that fails to load. `fallbackSrc` is the same for your own image; `kind: \"plain\"` is the gradient alone, for initials.",
38
+ "`defaultAvatar.kind` is what the picture is of: `person` (default, a silhouette), `folder`, `organisation` or `shop` (a glyph on the gradient, drawn in the page, never a person). A folder, a company or a shop never gets a silhouette. The central sets of those kinds, and the founder's illustrated people and banners, are in the Krizaka org JSON (`defaults` of `@krizaka/org`): an app lists and picks them from there, it never bundles or hard-codes a default media URL.",
38
39
  "The default pictures are generated from the code (`defaultAvatarSvg`) and served by the Krizaka CDN (`defaultAvatarUrl`, 256 and 512 px WebP, SVG): a product never draws its own.",
39
40
  "Use one size per list: `sm` in dense lists, `md` by default, `lg`/`xl` on a profile.",
40
41
  "In a group, set `max` so a long list ends with `+n` instead of overflowing."
@@ -457,19 +458,19 @@
457
458
  },
458
459
  {
459
460
  "path": "avatar/default-avatar.ts",
460
- "content": "// The default profile pictures of the Krizaka family: what a product shows when a person has no photo.\n// They are generated from this file (tools/export-brand.mjs renders them to SVG and WebP and uploads them to Bunny,\n// `people/defaults/v1/<brand>/…`), so the pictures and the URLs that name them cannot drift apart.\n\n/** A brand of the default avatars. `orochia`, `yasakia`, `yororis` and `kachizaka` are deprecated: paused products (2026-10-25), removed in the next major; their pictures stay served until then. */\nexport type DefaultAvatarBrand = \"krizaka\" | \"orazaka\" | \"orochia\" | \"yasakia\" | \"yororis\" | \"yomizaka\" | \"kachizaka\" | \"akinaza\";\n/** `person`: a neutral silhouette. `plain`: the brand's gradient alone, ready for initials. */\nexport type DefaultAvatarKind = \"person\" | \"plain\";\nexport type DefaultAvatarSize = 256 | 512;\n\nexport const DEFAULT_AVATAR_BRANDS: readonly DefaultAvatarBrand[] = [\"krizaka\", \"orazaka\", \"orochia\", \"yasakia\", \"yororis\", \"yomizaka\", \"kachizaka\", \"akinaza\"];\nexport const DEFAULT_AVATAR_KINDS: readonly DefaultAvatarKind[] = [\"person\", \"plain\"];\nexport const DEFAULT_AVATAR_SIZES: readonly DefaultAvatarSize[] = [256, 512];\n/** How many tones each brand has: a person always gets the same one from their seed, so a list is not one colour. */\nexport const DEFAULT_AVATAR_TONES = 6;\n\n/** Where the set lives. `v1` is the set's version: a changed picture is a new version folder, never an overwrite. */\nexport const DEFAULT_AVATAR_BASE = \"https://krizaka-assets.b-cdn.net/people/defaults/v1\";\n\nexport interface DefaultAvatar {\n /** The brand of the product showing the avatar: its gradient, its hues. */\n brand: DefaultAvatarBrand;\n /** Any stable text or number of the person (their id): the same seed gives the same tone everywhere. */\n seed?: string | number;\n /** Force a tone, 1 to 6, instead of deriving it from `seed`. */\n tone?: number;\n /**\n * `person` (default): a silhouette. `plain`: the gradient alone.\n * @default \"person\"\n */\n kind?: DefaultAvatarKind;\n}\n\n/** The mark gradient of each brand (BRAND.md, `$extensions[\"com.krizaka\"].mark`) as [hue, saturation %, lightness %] and the hue spread of its tones. */\nconst BRANDS: Record<DefaultAvatarBrand, { from: [number, number, number]; to: [number, number, number]; spread: number }> = {\n krizaka: { from: [217, 92, 53], to: [217, 92, 68], spread: 14 },\n orazaka: { from: [26, 90.5, 37.1], to: [26, 92, 45], spread: 7 },\n orochia: { from: [262.1, 83.3, 57.8], to: [328.6, 85.5, 70.2], spread: 12 },\n yasakia: { from: [156, 92, 32], to: [178, 90, 32], spread: 12 },\n yororis: { from: [34, 46, 44], to: [104, 28, 42], spread: 10 },\n yomizaka: { from: [232, 50, 55], to: [248, 50, 58], spread: 10 },\n kachizaka: { from: [226, 80, 56], to: [44, 92, 33], spread: 10 },\n akinaza: { from: [140, 48, 34], to: [22, 60, 46], spread: 10 },\n};\n\n/** White on top of a stop must stay visible: a stop is darkened until the contrast reaches this (WCAG 1.4.11, non-text). */\nconst MIN_CONTRAST = 3.2;\nconst OFFSETS = [0, -1, 1, -2, 2, 3] as const;\n\nfunction hslToHex([h, s, l]: [number, number, number]): string {\n const sat = s / 100;\n const light = l / 100;\n const k = (n: number) => (n + (((h % 360) + 360) % 360) / 30) % 12;\n const a = sat * Math.min(light, 1 - light);\n const channel = (n: number) => Math.round(255 * (light - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)))));\n return `#${[0, 8, 4].map((n) => channel(n).toString(16).padStart(2, \"0\")).join(\"\")}`;\n}\n\nconst channelLuminance = (v: number) => (v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4);\nconst whiteContrast = (hex: string) => {\n const [r, g, b] = [1, 3, 5].map((i) => channelLuminance(Number.parseInt(hex.slice(i, i + 2), 16) / 255));\n return 1.05 / (0.2126 * r! + 0.7152 * g! + 0.0722 * b! + 0.05);\n};\n/** The stop, darkened one point of lightness at a time until white reads on it. */\nfunction readable([h, s, l]: [number, number, number]): string {\n let hex = hslToHex([h, s, l]);\n for (let light = l; whiteContrast(hex) < MIN_CONTRAST && light > 10; light -= 1) hex = hslToHex([h, s, light]);\n return hex;\n}\n\n/** The two stops (hex) of tone `tone` (1 to 6) of a brand. */\nexport function defaultAvatarTone(brand: DefaultAvatarBrand, tone: number): readonly [string, string] {\n const b = BRANDS[brand];\n const o = OFFSETS[(clampTone(tone) - 1) % OFFSETS.length] * b.spread;\n return [readable([b.from[0] + o, b.from[1], b.from[2]]), readable([b.to[0] + o, b.to[1], b.to[2]])];\n}\n\nconst clampTone = (tone: number) => Math.min(DEFAULT_AVATAR_TONES, Math.max(1, Math.round(tone)));\n\n/** 1 to 6 from a seed (FNV-1a): stable across renders, devices and products. */\nexport function defaultAvatarToneOf(seed: string | number | undefined): number {\n if (seed === undefined) return 1;\n let h = 0x811c9dc5;\n for (const ch of String(seed)) {\n h ^= ch.codePointAt(0) ?? 0;\n h = Math.imul(h, 0x01000193) >>> 0;\n }\n return (h % DEFAULT_AVATAR_TONES) + 1;\n}\n\nconst resolveTone = (a: DefaultAvatar) => (a.tone === undefined ? defaultAvatarToneOf(a.seed) : clampTone(a.tone));\n\n/** The file name of a picture in the set: `person-3` + 256 → `person-3-256.webp`; `svg` has no size. */\nexport function defaultAvatarFile(kind: DefaultAvatarKind, tone: number, size: DefaultAvatarSize | \"svg\"): string {\n return size === \"svg\" ? `${kind}-${tone}.svg` : `${kind}-${tone}-${size}.webp`;\n}\n\n/** Linear on purpose: a `/\\/+$/` regex backtracks quadratically on a long run of slashes. */\nfunction trimTrailingSlashes(value: string): string {\n let end = value.length;\n while (end > 0 && value.charCodeAt(end - 1) === 47) end--;\n return value.slice(0, end);\n}\n\n/**\n * The URL of a default avatar: `defaultAvatarUrl({ brand: \"orazaka\", seed: user.id })`.\n * @param size 256 for lists, 512 for a profile; `\"svg\"` for the vector.\n * @param base Another host or version of the set (a self-hosted copy); the default is the Krizaka CDN.\n */\nexport function defaultAvatarUrl(avatar: DefaultAvatar, { size = 256, base = DEFAULT_AVATAR_BASE }: { size?: DefaultAvatarSize | \"svg\"; base?: string } = {}): string {\n return `${trimTrailingSlashes(base)}/${avatar.brand}/${defaultAvatarFile(avatar.kind ?? \"person\", resolveTone(avatar), size)}`;\n}\n\n/** The SVG source of a default avatar, 512 × 512 and square (the Avatar clips it round). */\nexport function defaultAvatarSvg(avatar: DefaultAvatar): string {\n const [from, to] = defaultAvatarTone(avatar.brand, resolveTone(avatar));\n const person =\n (avatar.kind ?? \"person\") === \"person\"\n ? `<circle cx=\"256\" cy=\"200\" r=\"86\" fill=\"#fff\" fill-opacity=\".92\"/><path d=\"M84 512c0-108 78-182 172-182s172 74 172 182z\" fill=\"#fff\" fill-opacity=\".92\"/>`\n : \"\";\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" width=\"512\" height=\"512\"><defs><linearGradient id=\"g\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\"><stop offset=\"0\" stop-color=\"${from}\"/><stop offset=\"1\" stop-color=\"${to}\"/></linearGradient><radialGradient id=\"l\" cx=\".28\" cy=\".18\" r=\".85\"><stop offset=\"0\" stop-color=\"#fff\" stop-opacity=\".24\"/><stop offset=\"1\" stop-color=\"#fff\" stop-opacity=\"0\"/></radialGradient></defs><rect width=\"512\" height=\"512\" fill=\"url(#g)\"/><rect width=\"512\" height=\"512\" fill=\"url(#l)\"/>${person}</svg>`;\n}\n"
461
+ "content": "// The default profile pictures of the Krizaka family: what a product shows when a person has no photo.\n// They are generated from this file (tools/export-brand.mjs renders them to SVG and WebP and uploads them to Bunny,\n// `people/defaults/v1/<brand>/…`), so the pictures and the URLs that name them cannot drift apart.\n\n/** A brand of the default avatars. `orochia`, `yasakia`, `yororis` and `kachizaka` are deprecated: paused products (2026-10-25), removed in the next major; their pictures stay served until then. */\nexport type DefaultAvatarBrand = \"krizaka\" | \"orazaka\" | \"orochia\" | \"yasakia\" | \"yororis\" | \"yomizaka\" | \"kachizaka\" | \"akinaza\";\n/**\n * What the picture is of. `person`: a neutral silhouette. `plain`: the brand's gradient alone, ready for initials.\n * `folder`, `organisation` and `shop` are the pictures of a thing that is not a person (a folder or collection, a company, a shop):\n * a glyph on the gradient, never a silhouette. The central sets of these kinds are in the Krizaka org JSON (`defaults`, `@krizaka/org`).\n */\nexport type DefaultAvatarKind = \"person\" | \"plain\" | \"folder\" | \"organisation\" | \"shop\";\n/** The kinds of entity that have a set of default pictures of their own (`plain` is a style of `person`). */\nexport type DefaultAvatarEntityKind = \"person\" | \"folder\" | \"organisation\" | \"shop\";\nexport type DefaultAvatarSize = 256 | 512;\n\nexport const DEFAULT_AVATAR_BRANDS: readonly DefaultAvatarBrand[] = [\"krizaka\", \"orazaka\", \"orochia\", \"yasakia\", \"yororis\", \"yomizaka\", \"kachizaka\", \"akinaza\"];\n/** The two styles of the legacy brand sets (`people/defaults/v1/<brand>`); the kinds of the central sets are `DEFAULT_AVATAR_ENTITY_KINDS`. */\nexport const DEFAULT_AVATAR_KINDS: readonly DefaultAvatarKind[] = [\"person\", \"plain\"];\nexport const DEFAULT_AVATAR_ENTITY_KINDS: readonly DefaultAvatarEntityKind[] = [\"person\", \"folder\", \"organisation\", \"shop\"];\nexport const DEFAULT_AVATAR_SIZES: readonly DefaultAvatarSize[] = [256, 512];\n/** How many tones each brand has: a person always gets the same one from their seed, so a list is not one colour. */\nexport const DEFAULT_AVATAR_TONES = 6;\n\n/** Where the set lives. `v1` is the set's version: a changed picture is a new version folder, never an overwrite. */\nexport const DEFAULT_AVATAR_BASE = \"https://krizaka-assets.b-cdn.net/people/defaults/v1\";\n\nexport interface DefaultAvatar {\n /** The brand of the product showing the avatar: its gradient, its hues. */\n brand: DefaultAvatarBrand;\n /** Any stable text or number of the person (their id): the same seed gives the same tone everywhere. */\n seed?: string | number;\n /** Force a tone, 1 to 6, instead of deriving it from `seed`. */\n tone?: number;\n /**\n * `person` (default): a silhouette. `plain`: the gradient alone. `folder`, `organisation`, `shop`: that thing's glyph, drawn here\n * (a data URL, no request) — a folder is never given a person.\n * @default \"person\"\n */\n kind?: DefaultAvatarKind;\n}\n\n/** The mark gradient of each brand (BRAND.md, `$extensions[\"com.krizaka\"].mark`) as [hue, saturation %, lightness %] and the hue spread of its tones. */\nconst BRANDS: Record<DefaultAvatarBrand, { from: [number, number, number]; to: [number, number, number]; spread: number }> = {\n krizaka: { from: [217, 92, 53], to: [217, 92, 68], spread: 14 },\n orazaka: { from: [26, 90.5, 37.1], to: [26, 92, 45], spread: 7 },\n orochia: { from: [262.1, 83.3, 57.8], to: [328.6, 85.5, 70.2], spread: 12 },\n yasakia: { from: [156, 92, 32], to: [178, 90, 32], spread: 12 },\n yororis: { from: [34, 46, 44], to: [104, 28, 42], spread: 10 },\n yomizaka: { from: [232, 50, 55], to: [248, 50, 58], spread: 10 },\n kachizaka: { from: [226, 80, 56], to: [44, 92, 33], spread: 10 },\n akinaza: { from: [140, 48, 34], to: [22, 60, 46], spread: 10 },\n};\n\n/** White on top of a stop must stay visible: a stop is darkened until the contrast reaches this (WCAG 1.4.11, non-text). */\nconst MIN_CONTRAST = 3.2;\nconst OFFSETS = [0, -1, 1, -2, 2, 3] as const;\n\nfunction hslToHex([h, s, l]: [number, number, number]): string {\n const sat = s / 100;\n const light = l / 100;\n const k = (n: number) => (n + (((h % 360) + 360) % 360) / 30) % 12;\n const a = sat * Math.min(light, 1 - light);\n const channel = (n: number) => Math.round(255 * (light - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)))));\n return `#${[0, 8, 4].map((n) => channel(n).toString(16).padStart(2, \"0\")).join(\"\")}`;\n}\n\nconst channelLuminance = (v: number) => (v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4);\nconst whiteContrast = (hex: string) => {\n const [r, g, b] = [1, 3, 5].map((i) => channelLuminance(Number.parseInt(hex.slice(i, i + 2), 16) / 255));\n return 1.05 / (0.2126 * r! + 0.7152 * g! + 0.0722 * b! + 0.05);\n};\n/** The stop, darkened one point of lightness at a time until white reads on it. */\nfunction readable([h, s, l]: [number, number, number]): string {\n let hex = hslToHex([h, s, l]);\n for (let light = l; whiteContrast(hex) < MIN_CONTRAST && light > 10; light -= 1) hex = hslToHex([h, s, light]);\n return hex;\n}\n\n/** The two stops (hex) of tone `tone` (1 to 6) of a brand. */\nexport function defaultAvatarTone(brand: DefaultAvatarBrand, tone: number): readonly [string, string] {\n const b = BRANDS[brand];\n const o = OFFSETS[(clampTone(tone) - 1) % OFFSETS.length] * b.spread;\n return [readable([b.from[0] + o, b.from[1], b.from[2]]), readable([b.to[0] + o, b.to[1], b.to[2]])];\n}\n\nconst clampTone = (tone: number) => Math.min(DEFAULT_AVATAR_TONES, Math.max(1, Math.round(tone)));\n\n/** 1 to 6 from a seed (FNV-1a): stable across renders, devices and products. */\nexport function defaultAvatarToneOf(seed: string | number | undefined): number {\n if (seed === undefined) return 1;\n let h = 0x811c9dc5;\n for (const ch of String(seed)) {\n h ^= ch.codePointAt(0) ?? 0;\n h = Math.imul(h, 0x01000193) >>> 0;\n }\n return (h % DEFAULT_AVATAR_TONES) + 1;\n}\n\nconst resolveTone = (a: DefaultAvatar) => (a.tone === undefined ? defaultAvatarToneOf(a.seed) : clampTone(a.tone));\n\n/** The file name of a picture in the set: `person-3` + 256 → `person-3-256.webp`; `svg` has no size. */\nexport function defaultAvatarFile(kind: DefaultAvatarKind, tone: number, size: DefaultAvatarSize | \"svg\"): string {\n return size === \"svg\" ? `${kind}-${tone}.svg` : `${kind}-${tone}-${size}.webp`;\n}\n\n/** Linear on purpose: a `/\\/+$/` regex backtracks quadratically on a long run of slashes. */\nfunction trimTrailingSlashes(value: string): string {\n let end = value.length;\n while (end > 0 && value.charCodeAt(end - 1) === 47) end--;\n return value.slice(0, end);\n}\n\n/**\n * The URL of a default avatar: `defaultAvatarUrl({ brand: \"orazaka\", seed: user.id })`.\n * @param size 256 for lists, 512 for a profile; `\"svg\"` for the vector.\n * @param base Another host or version of the set (a self-hosted copy); the default is the Krizaka CDN.\n */\nexport function defaultAvatarUrl(avatar: DefaultAvatar, { size = 256, base = DEFAULT_AVATAR_BASE }: { size?: DefaultAvatarSize | \"svg\"; base?: string } = {}): string {\n if (isGlyphKind(avatar.kind)) return defaultAvatarDataUrl(avatar);\n return `${trimTrailingSlashes(base)}/${avatar.brand}/${defaultAvatarFile(avatar.kind ?? \"person\", resolveTone(avatar), size)}`;\n}\n\nconst GLYPHS: Record<\"folder\" | \"organisation\" | \"shop\", (from: string) => string> = {\n folder: () => `<path d=\"M96 176a28 28 0 0 1 28-28h92l40 44h132a28 28 0 0 1 28 28v152a28 28 0 0 1-28 28H124a28 28 0 0 1-28-28z\" fill=\"#fff\" fill-opacity=\".92\"/>`,\n organisation: (from) =>\n `<rect x=\"136\" y=\"104\" width=\"240\" height=\"304\" rx=\"16\" fill=\"#fff\" fill-opacity=\".92\"/>${[160, 226, 292]\n .flatMap((y) => [168, 236, 304].map((x) => `<rect x=\"${x}\" y=\"${y}\" width=\"40\" height=\"40\" rx=\"6\" fill=\"${from}\"/>`))\n .join(\"\")}<rect x=\"232\" y=\"352\" width=\"48\" height=\"56\" rx=\"6\" fill=\"${from}\"/>`,\n shop: (from) =>\n `<path d=\"M112 132h288l24 84a56 56 0 0 1-112 0 56 56 0 0 1-112 0 56 56 0 0 1-112 0z\" fill=\"#fff\" fill-opacity=\".92\"/><rect x=\"136\" y=\"292\" width=\"240\" height=\"116\" rx=\"12\" fill=\"#fff\" fill-opacity=\".92\"/><rect x=\"226\" y=\"326\" width=\"60\" height=\"82\" rx=\"8\" fill=\"${from}\"/><rect x=\"156\" y=\"318\" width=\"48\" height=\"44\" rx=\"6\" fill=\"${from}\"/><rect x=\"308\" y=\"318\" width=\"48\" height=\"44\" rx=\"6\" fill=\"${from}\"/>`,\n};\n\ntype GlyphKind = keyof typeof GLYPHS;\nconst isGlyphKind = (kind: DefaultAvatarKind | undefined): kind is GlyphKind => kind === \"folder\" || kind === \"organisation\" || kind === \"shop\";\n\n/** The picture as a `data:` URL: nothing to fetch, so a folder, an organisation or a shop always has its picture (offline, in a test, before the CDN answers). */\nexport function defaultAvatarDataUrl(avatar: DefaultAvatar): string {\n return `data:image/svg+xml,${encodeURIComponent(defaultAvatarSvg(avatar))}`;\n}\n\n/** The SVG source of a default avatar, 512 × 512 and square (the Avatar clips it round). */\nexport function defaultAvatarSvg(avatar: DefaultAvatar): string {\n const [from, to] = defaultAvatarTone(avatar.brand, resolveTone(avatar));\n const kind = avatar.kind ?? \"person\";\n const person = isGlyphKind(kind)\n ? GLYPHS[kind](from)\n : kind === \"person\"\n ? `<circle cx=\"256\" cy=\"200\" r=\"86\" fill=\"#fff\" fill-opacity=\".92\"/><path d=\"M84 512c0-108 78-182 172-182s172 74 172 182z\" fill=\"#fff\" fill-opacity=\".92\"/>`\n : \"\";\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" width=\"512\" height=\"512\"><defs><linearGradient id=\"g\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\"><stop offset=\"0\" stop-color=\"${from}\"/><stop offset=\"1\" stop-color=\"${to}\"/></linearGradient><radialGradient id=\"l\" cx=\".28\" cy=\".18\" r=\".85\"><stop offset=\"0\" stop-color=\"#fff\" stop-opacity=\".24\"/><stop offset=\"1\" stop-color=\"#fff\" stop-opacity=\"0\"/></radialGradient></defs><rect width=\"512\" height=\"512\" fill=\"url(#g)\"/><rect width=\"512\" height=\"512\" fill=\"url(#l)\"/>${person}</svg>`;\n}\n"
461
462
  },
462
463
  {
463
464
  "path": "avatar/defaults.ts",
464
- "content": "// @krizaka/ui/avatar/defaults — the default pictures' pure helpers, SERVER-SAFE: no \"use client\", no React.\n// `defaultAvatarUrl(…)` can be called in a Server Component; `@krizaka/ui/avatar` (a client entry) re-exports the same\n// functions for client code, but calling them from the server through it fails (\"Attempted to call … from the server\").\nexport {\n DEFAULT_AVATAR_BASE,\n DEFAULT_AVATAR_BRANDS,\n DEFAULT_AVATAR_KINDS,\n DEFAULT_AVATAR_SIZES,\n DEFAULT_AVATAR_TONES,\n type DefaultAvatar,\n type DefaultAvatarBrand,\n defaultAvatarFile,\n type DefaultAvatarKind,\n type DefaultAvatarSize,\n defaultAvatarSvg,\n defaultAvatarTone,\n defaultAvatarToneOf,\n defaultAvatarUrl,\n} from \"./default-avatar\";\n"
465
+ "content": "// @krizaka/ui/avatar/defaults — the default pictures' pure helpers, SERVER-SAFE: no \"use client\", no React.\n// `defaultAvatarUrl(…)` can be called in a Server Component; `@krizaka/ui/avatar` (a client entry) re-exports the same\n// functions for client code, but calling them from the server through it fails (\"Attempted to call … from the server\").\nexport {\n DEFAULT_AVATAR_BASE,\n DEFAULT_AVATAR_BRANDS,\n DEFAULT_AVATAR_ENTITY_KINDS,\n DEFAULT_AVATAR_KINDS,\n DEFAULT_AVATAR_SIZES,\n DEFAULT_AVATAR_TONES,\n type DefaultAvatar,\n type DefaultAvatarBrand,\n defaultAvatarDataUrl,\n type DefaultAvatarEntityKind,\n defaultAvatarFile,\n type DefaultAvatarKind,\n type DefaultAvatarSize,\n defaultAvatarSvg,\n defaultAvatarTone,\n defaultAvatarToneOf,\n defaultAvatarUrl,\n} from \"./default-avatar\";\n"
465
466
  },
466
467
  {
467
468
  "path": "avatar/index.ts",
468
- "content": "/** @krizaka/ui/avatar — `Avatar`, `Avatar.Group`, and the default pictures (`defaultAvatarUrl`…) for CLIENT code. In a Server Component import the helpers from `@krizaka/ui/avatar/defaults`. Client (\"use client\"). */\nexport { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, AvatarRoot, type AvatarSize } from \"./avatar\";\nexport {\n DEFAULT_AVATAR_BASE,\n DEFAULT_AVATAR_BRANDS,\n DEFAULT_AVATAR_KINDS,\n DEFAULT_AVATAR_SIZES,\n DEFAULT_AVATAR_TONES,\n type DefaultAvatar,\n type DefaultAvatarBrand,\n defaultAvatarFile,\n type DefaultAvatarKind,\n type DefaultAvatarSize,\n defaultAvatarSvg,\n defaultAvatarTone,\n defaultAvatarToneOf,\n defaultAvatarUrl,\n} from \"./default-avatar\";\n"
469
+ "content": "/** @krizaka/ui/avatar — `Avatar`, `Avatar.Group`, and the default pictures (`defaultAvatarUrl`…) for CLIENT code. In a Server Component import the helpers from `@krizaka/ui/avatar/defaults`. Client (\"use client\"). */\nexport { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, AvatarRoot, type AvatarSize } from \"./avatar\";\nexport {\n DEFAULT_AVATAR_BASE,\n DEFAULT_AVATAR_BRANDS,\n DEFAULT_AVATAR_ENTITY_KINDS,\n DEFAULT_AVATAR_KINDS,\n DEFAULT_AVATAR_SIZES,\n DEFAULT_AVATAR_TONES,\n type DefaultAvatar,\n type DefaultAvatarBrand,\n defaultAvatarDataUrl,\n type DefaultAvatarEntityKind,\n defaultAvatarFile,\n type DefaultAvatarKind,\n type DefaultAvatarSize,\n defaultAvatarSvg,\n defaultAvatarTone,\n defaultAvatarToneOf,\n defaultAvatarUrl,\n} from \"./default-avatar\";\n"
469
470
  },
470
471
  {
471
472
  "path": "avatar/meta.ts",
472
- "content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Avatar\",\n summary: \"A person or an account: their picture, or initials while it loads, when it fails or when there is none.\",\n status: \"stable\",\n category: \"data-display\",\n platforms: \"both\",\n parity: { desktop: \"web\" },\n whenToUse: [\n \"Next to a name: comments, creators, members, the signed-in account in a header.\",\n \"`Avatar.Group` to show who takes part (followers, collaborators) in little space.\",\n ],\n whenNotToUse: [\n { when: \"For a product, a video or a place: use an image in a card.\", use: \"card\" },\n { when: \"As the only way to say who someone is: show their name too, or give the avatar an `alt`.\" },\n ],\n bestPractices: [\n \"Always pass a `fallback` (initials) on the web: images fail, and the layout should not jump.\",\n \"A profile can lack a photo: pass `defaultAvatar={{ brand, seed: user.id }}` and the person gets the product's own default picture (a silhouette on the brand's gradient, one of six tones, always the same for the same id) instead of an empty circle. It also replaces a photo that fails to load. `fallbackSrc` is the same for your own image; `kind: \\\"plain\\\"` is the gradient alone, for initials.\",\n \"The default pictures are generated from the code (`defaultAvatarSvg`) and served by the Krizaka CDN (`defaultAvatarUrl`, 256 and 512 px WebP, SVG): a product never draws its own.\",\n \"Use one size per list: `sm` in dense lists, `md` by default, `lg`/`xl` on a profile.\",\n \"In a group, set `max` so a long list ends with `+n` instead of overflowing.\",\n ],\n accessibility: {\n keyboard: [],\n notes: [\n \"With `alt`, the picture is an image named by it; without `alt`, it is decorative — put the name in the text next to it.\",\n \"The fallback initials are shown, not announced, when an `alt` names the person.\",\n ],\n },\n related: [\"card\", \"badge\", \"skeleton\"],\n web: {\n imports: [\"Avatar\"],\n examples: [\n { name: \"with-image\", title: \"With an image\", description: \"A picture named by `alt`, with initials as `fallback`.\" },\n { name: \"default\", title: \"Default pictures\", description: \"No photo: `defaultAvatar={{ brand, seed }}` — the brand's gradient and a silhouette, one of six tones per person.\" },\n { name: \"fallback\", title: \"Fallback\", description: \"No image: the initials.\" },\n { name: \"sizes\", title: \"Sizes\", description: \"`xs`, `sm`, `md` (default), `lg`, `xl`.\" },\n { name: \"group\", title: \"Group\", description: \"`Avatar.Group` with `max`: the others become `+n`.\" },\n ],\n },\n native: {\n imports: [\"Avatar\"],\n differences: [\n \"The fallback is the initial of `alt` when `fallback` is not given.\",\n \"`size` also takes a number of points.\",\n \"`defaultAvatar` and `fallbackSrc` work as on the web (the default pictures are WebP, drawn by `Image`); `defaultAvatarUrl` is exported from `@krizaka/ui/native`.\",\n \"`src` is a URI string (an `Image` source), not a URL object.\",\n \"An SVG `src` (`….svg`, `data:image/svg+xml,…`, or any URI with `svg`) is drawn by react-native-svg — `Image` cannot.\",\n \"`presence` adds a dot (online, away, busy, offline) and `ring` a story ring (new, seen, live): mobile only for now.\",\n ],\n examples: [\n { name: \"sizes\", title: \"Sizes\", description: \"Without an image: the initial of `alt`, from `xs` to `xl`.\" },\n { name: \"group\", title: \"Group\", description: \"`Avatar.Group max={3}`: the rest becomes `+n`.\" },\n { name: \"presence\", title: \"Presence and story rings\", description: \"A presence dot, a story ring (new or seen), said with the name.\" },\n ],\n },\n} satisfies ComponentMeta;\n"
473
+ "content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Avatar\",\n summary: \"A person or an account: their picture, or initials while it loads, when it fails or when there is none.\",\n status: \"stable\",\n category: \"data-display\",\n platforms: \"both\",\n parity: { desktop: \"web\" },\n whenToUse: [\n \"Next to a name: comments, creators, members, the signed-in account in a header.\",\n \"`Avatar.Group` to show who takes part (followers, collaborators) in little space.\",\n ],\n whenNotToUse: [\n { when: \"For a product, a video or a place: use an image in a card.\", use: \"card\" },\n { when: \"As the only way to say who someone is: show their name too, or give the avatar an `alt`.\" },\n ],\n bestPractices: [\n \"Always pass a `fallback` (initials) on the web: images fail, and the layout should not jump.\",\n \"A profile can lack a photo: pass `defaultAvatar={{ brand, seed: user.id }}` and the person gets the product's own default picture (a silhouette on the brand's gradient, one of six tones, always the same for the same id) instead of an empty circle. It also replaces a photo that fails to load. `fallbackSrc` is the same for your own image; `kind: \\\"plain\\\"` is the gradient alone, for initials.\",\n \"`defaultAvatar.kind` is what the picture is of: `person` (default, a silhouette), `folder`, `organisation` or `shop` (a glyph on the gradient, drawn in the page, never a person). A folder, a company or a shop never gets a silhouette. The central sets of those kinds, and the founder's illustrated people and banners, are in the Krizaka org JSON (`defaults` of `@krizaka/org`): an app lists and picks them from there, it never bundles or hard-codes a default media URL.\",\n \"The default pictures are generated from the code (`defaultAvatarSvg`) and served by the Krizaka CDN (`defaultAvatarUrl`, 256 and 512 px WebP, SVG): a product never draws its own.\",\n \"Use one size per list: `sm` in dense lists, `md` by default, `lg`/`xl` on a profile.\",\n \"In a group, set `max` so a long list ends with `+n` instead of overflowing.\",\n ],\n accessibility: {\n keyboard: [],\n notes: [\n \"With `alt`, the picture is an image named by it; without `alt`, it is decorative — put the name in the text next to it.\",\n \"The fallback initials are shown, not announced, when an `alt` names the person.\",\n ],\n },\n related: [\"card\", \"badge\", \"skeleton\"],\n web: {\n imports: [\"Avatar\"],\n examples: [\n { name: \"with-image\", title: \"With an image\", description: \"A picture named by `alt`, with initials as `fallback`.\" },\n { name: \"default\", title: \"Default pictures\", description: \"No photo: `defaultAvatar={{ brand, seed }}` — the brand's gradient and a silhouette, one of six tones per person.\" },\n { name: \"fallback\", title: \"Fallback\", description: \"No image: the initials.\" },\n { name: \"sizes\", title: \"Sizes\", description: \"`xs`, `sm`, `md` (default), `lg`, `xl`.\" },\n { name: \"group\", title: \"Group\", description: \"`Avatar.Group` with `max`: the others become `+n`.\" },\n ],\n },\n native: {\n imports: [\"Avatar\"],\n differences: [\n \"The fallback is the initial of `alt` when `fallback` is not given.\",\n \"`size` also takes a number of points.\",\n \"`defaultAvatar` and `fallbackSrc` work as on the web (the default pictures are WebP, drawn by `Image`); `defaultAvatarUrl` is exported from `@krizaka/ui/native`.\",\n \"`src` is a URI string (an `Image` source), not a URL object.\",\n \"An SVG `src` (`….svg`, `data:image/svg+xml,…`, or any URI with `svg`) is drawn by react-native-svg — `Image` cannot.\",\n \"`presence` adds a dot (online, away, busy, offline) and `ring` a story ring (new, seen, live): mobile only for now.\",\n ],\n examples: [\n { name: \"sizes\", title: \"Sizes\", description: \"Without an image: the initial of `alt`, from `xs` to `xl`.\" },\n { name: \"group\", title: \"Group\", description: \"`Avatar.Group max={3}`: the rest becomes `+n`.\" },\n { name: \"presence\", title: \"Presence and story rings\", description: \"A presence dot, a story ring (new or seen), said with the name.\" },\n ],\n },\n} satisfies ComponentMeta;\n"
473
474
  },
474
475
  {
475
476
  "path": "meta.ts",
@@ -223,7 +223,7 @@
223
223
  },
224
224
  {
225
225
  "path": "dashboard-layout/dashboard-layout.tsx",
226
- "content": "// Server-safe. A dashboard, read from the products' home screens (a creator studio, Orazaka's console for\n// Eric): the screen's heading with its actions and filters, then a responsive grid of widgets — one column on a phone,\n// two from `sm`, four from `xl`; a widget spans 1, 2, 3 columns or the full row, and keeps its order everywhere.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { BlockLink, type LinkComponent } from \"../block-link\";\n\nexport const dashboardLayout = tv({\n slots: {\n root: \"flex w-full flex-col gap-6\",\n head: \"flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between\",\n text: \"flex min-w-0 flex-col gap-1\",\n eyebrow: \"font-mono text-[11px] font-semibold text-fg-accent\",\n title: \"font-display text-2xl font-extrabold tracking-tight text-fg sm:text-[1.75rem]\",\n description: \"max-w-2xl text-sm text-fg-secondary\",\n side: \"flex min-w-0 flex-col gap-4\",\n right: \"flex shrink-0 flex-col gap-2 sm:items-end\",\n date: \"m-0 text-sm font-medium tabular-nums text-fg-secondary sm:text-right\",\n quick: \"m-0 grid list-none grid-cols-2 gap-2 p-0 lg:grid-cols-4\",\n tile:\n \"flex h-full min-h-14 min-w-0 items-center gap-3 rounded-xl border border-border-default bg-surface-1 p-3 text-fg no-underline transition-colors \" +\n \"hover:border-accent/60 hover:bg-accent-soft focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\",\n tileIcon: \"grid size-9 shrink-0 place-items-center rounded-lg bg-accent-soft text-fg-accent [&>svg]:size-5\",\n tileText: \"flex min-w-0 flex-col leading-tight\",\n tileLabel: \"text-sm font-semibold\",\n tileHint: \"text-xs text-fg-secondary\",\n actions: \"flex shrink-0 flex-wrap items-center gap-2\",\n toolbar: \"flex flex-wrap items-center gap-2\",\n grid: \"grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4\",\n widget: \"flex min-w-0 flex-col gap-3 rounded-xl border border-border-default bg-surface-1 p-4 sm:p-5\",\n widgetHead: \"flex items-start justify-between gap-3\",\n widgetTitle: \"text-sm font-semibold text-fg\",\n widgetDescription: \"mt-0.5 text-xs text-fg-secondary\",\n widgetBody: \"min-w-0 flex-1\",\n },\n variants: {\n span: {\n 1: { widget: \"\" },\n 2: { widget: \"sm:col-span-2\" },\n 3: { widget: \"sm:col-span-2 xl:col-span-3\" },\n full: { widget: \"sm:col-span-2 xl:col-span-4\" },\n },\n },\n defaultVariants: { span: 1 },\n});\nconst s = dashboardLayout();\n\nexport type DashboardLayoutProps = Omit<React.ComponentProps<\"div\">, \"title\"> & {\n /** The screen's title: `Good morning, Eric`. */\n title: React.ReactNode;\n /** A mono line above it (the workspace, the date). */\n eyebrow?: React.ReactNode;\n /** One sentence under it. */\n description?: React.ReactNode;\n /** The screen's actions (a primary Button, a DropdownMenu). */\n actions?: React.ReactNode;\n /** Under the heading: the period, the filters (Segmented tabs, a DateRangePicker, a FilterBar). */\n toolbar?: React.ReactNode;\n /**\n * The heading's level: `h1` when the dashboard is the screen, `h2` inside an AppShell whose header holds the h1.\n * @default \"h1\"\n */\n headingAs?: \"h1\" | \"h2\";\n /** Today's date, in words, formatted by the app with `@krizaka/intl`: on the right of the heading; under the title on a phone. */\n date?: React.ReactNode;\n /** Two to four tiles under the heading: where the person goes most (new invoice, new client…). */\n quickActions?: readonly QuickAction[];\n /** Names the quick actions' navigation (`Quick access`). Required with `quickActions`. */\n quickActionsLabel?: string;\n /** The app's link component for the quick actions. */\n linkAs?: LinkComponent;\n /** A side column (the period panel, `NextActions`, a notes list) beside the widgets from `lg`; under them on a phone. */\n side?: React.ReactNode;\n /** The widgets (`Widget`), in reading order. */\n children: React.ReactNode;\n};\n\n/** A tile of the quick-access row: an icon, a name, one line, a way in. */\nexport type QuickAction = {\n id: string;\n label: string;\n /** One line under the name. */\n hint?: string;\n icon?: React.ReactNode;\n href: string;\n};\n\n/** A dashboard screen: heading, actions, filters, then the grid of widgets. */\nexport function DashboardLayout({\n title,\n eyebrow,\n description,\n actions,\n toolbar,\n date,\n quickActions,\n quickActionsLabel,\n linkAs,\n side,\n headingAs: H = \"h1\",\n className,\n children,\n ...props\n}: DashboardLayoutProps) {\n const grid = <div className={s.grid()}>{children}</div>;\n return (\n <div className={s.root({ className })} {...props}>\n <div className={s.head()}>\n <div className={s.text()}>\n {eyebrow && <p className={s.eyebrow()}>{eyebrow}</p>}\n <H className={s.title()}>{title}</H>\n {description && <p className={s.description()}>{description}</p>}\n </div>\n {(date || actions) && (\n <div className={s.right()}>\n {date && <p className={s.date()}>{date}</p>}\n {actions && <div className={s.actions()}>{actions}</div>}\n </div>\n )}\n </div>\n {toolbar && <div className={s.toolbar()}>{toolbar}</div>}\n {quickActions && quickActions.length > 0 && (\n <nav aria-label={quickActionsLabel}>\n <ul className={s.quick()}>\n {quickActions.slice(0, 4).map((q) => (\n <li key={q.id}>\n <BlockLink href={q.href} linkAs={linkAs} className={s.tile()}>\n {q.icon && (\n <span className={s.tileIcon()} aria-hidden=\"true\">\n {q.icon}\n </span>\n )}\n <span className={s.tileText()}>\n <span className={s.tileLabel()}>{q.label}</span>\n {q.hint && <span className={s.tileHint()}>{q.hint}</span>}\n </span>\n </BlockLink>\n </li>\n ))}\n </ul>\n </nav>\n )}\n {side ? (\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_20rem]\">\n {grid}\n <aside className={s.side()}>{side}</aside>\n </div>\n ) : (\n grid\n )}\n </div>\n );\n}\n\nexport type WidgetProps = Omit<React.ComponentProps<\"section\">, \"title\"> & {\n /** The widget's title: it names the region. */\n title: React.ReactNode;\n /** One line under the title (the period, the source). */\n description?: React.ReactNode;\n /** An action on the right of the title (`See all`). */\n action?: React.ReactNode;\n /**\n * The columns it takes: 1, 2, 3 or the full row (from `sm`; one column on a phone).\n * @default 1\n */\n span?: 1 | 2 | 3 | \"full\";\n /**\n * The title's level: one under the dashboard's heading — `2` under an `h1`, `3` inside an AppShell (`headingAs=\"h2\"`).\n * @default 2\n */\n level?: 2 | 3;\n /** The content: a Stat, a chart of @krizaka/charts, a DataTable, a list. */\n children: React.ReactNode;\n};\n\n/** A widget of the dashboard: a titled region on a card. */\nexport function Widget({ title, description, action, span = 1, level = 2, className, children, id, ...props }: WidgetProps) {\n const H = level === 2 ? \"h2\" : \"h3\";\n const sv = dashboardLayout({ span });\n const auto = React.useId();\n const titleId = `${id ?? auto}-title`;\n return (\n <section className={sv.widget({ className })} aria-labelledby={titleId} id={id} {...props}>\n <div className={s.widgetHead()}>\n <div className=\"min-w-0\">\n <H id={titleId} className={s.widgetTitle()}>\n {title}\n </H>\n {description && <p className={s.widgetDescription()}>{description}</p>}\n </div>\n {action}\n </div>\n <div className={s.widgetBody()}>{children}</div>\n </section>\n );\n}\n"
226
+ "content": "// Server-safe. A dashboard, read from the products' home screens (a creator studio, Orazaka's console for\n// Eric): the screen's heading with its actions and filters, then a responsive grid of widgets — one column on a phone,\n// two from `sm`, four from `xl`; a widget spans 1, 2, 3 columns or the full row, and keeps its order everywhere.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { BlockLink, type LinkComponent } from \"../block-link\";\n\nexport const dashboardLayout = tv({\n slots: {\n root: \"flex w-full flex-col gap-6\",\n head: \"flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between\",\n text: \"flex min-w-0 flex-col gap-1\",\n eyebrow: \"font-mono text-[11px] font-semibold text-fg-accent\",\n title: \"font-display text-2xl font-extrabold tracking-tight text-fg sm:text-[1.75rem]\",\n description: \"max-w-2xl text-sm text-fg-secondary\",\n side: \"flex min-w-0 flex-col gap-4\",\n right: \"flex shrink-0 flex-col gap-2 sm:items-end\",\n date: \"m-0 text-sm font-medium tabular-nums text-fg-secondary sm:text-right\",\n quick: \"m-0 grid list-none grid-cols-2 gap-2 p-0 lg:grid-cols-4\",\n tile:\n \"flex h-full min-h-14 min-w-0 items-center gap-3 rounded-xl border border-border-default bg-surface-1 p-3 text-fg no-underline transition-colors \" +\n \"hover:border-accent/60 hover:bg-accent-soft focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\",\n tileIcon: \"grid size-9 shrink-0 place-items-center rounded-lg bg-accent-soft text-fg-accent [&>svg]:size-5\",\n tileText: \"flex min-w-0 flex-col leading-tight\",\n tileLabel: \"text-sm font-semibold\",\n tileHint: \"text-xs text-fg-secondary\",\n actions: \"flex shrink-0 flex-wrap items-center gap-2\",\n toolbar: \"flex flex-wrap items-center gap-2\",\n // content-start: next to a taller side column the rows keep the height of their content (an auto row would stretch, and a card inside a widget with it: yomizaka#435).\n grid: \"grid grid-cols-1 content-start gap-4 sm:grid-cols-2 xl:grid-cols-4\",\n widget: \"flex min-w-0 flex-col gap-3 rounded-xl border border-border-default bg-surface-1 p-4 sm:p-5\",\n widgetHead: \"flex items-start justify-between gap-3\",\n widgetTitle: \"text-sm font-semibold text-fg\",\n widgetDescription: \"mt-0.5 text-xs text-fg-secondary\",\n widgetBody: \"min-w-0 flex-1\",\n },\n variants: {\n span: {\n 1: { widget: \"\" },\n 2: { widget: \"sm:col-span-2\" },\n 3: { widget: \"sm:col-span-2 xl:col-span-3\" },\n full: { widget: \"sm:col-span-2 xl:col-span-4\" },\n },\n },\n defaultVariants: { span: 1 },\n});\nconst s = dashboardLayout();\n\nexport type DashboardLayoutProps = Omit<React.ComponentProps<\"div\">, \"title\"> & {\n /** The screen's title: `Good morning, Eric`. */\n title: React.ReactNode;\n /** A mono line above it (the workspace, the date). */\n eyebrow?: React.ReactNode;\n /** One sentence under it. */\n description?: React.ReactNode;\n /** The screen's actions (a primary Button, a DropdownMenu). */\n actions?: React.ReactNode;\n /** Under the heading: the period, the filters (Segmented tabs, a DateRangePicker, a FilterBar). */\n toolbar?: React.ReactNode;\n /**\n * The heading's level: `h1` when the dashboard is the screen, `h2` inside an AppShell whose header holds the h1.\n * @default \"h1\"\n */\n headingAs?: \"h1\" | \"h2\";\n /** Today's date, in words, formatted by the app with `@krizaka/intl`: on the right of the heading; under the title on a phone. */\n date?: React.ReactNode;\n /** Two to four tiles under the heading: where the person goes most (new invoice, new client…). */\n quickActions?: readonly QuickAction[];\n /** Names the quick actions' navigation (`Quick access`). Required with `quickActions`. */\n quickActionsLabel?: string;\n /** The app's link component for the quick actions. */\n linkAs?: LinkComponent;\n /** A side column (the period panel, `NextActions`, a notes list) beside the widgets from `lg`; under them on a phone. */\n side?: React.ReactNode;\n /** The widgets (`Widget`), in reading order. */\n children: React.ReactNode;\n};\n\n/** A tile of the quick-access row: an icon, a name, one line, a way in. */\nexport type QuickAction = {\n id: string;\n label: string;\n /** One line under the name. */\n hint?: string;\n icon?: React.ReactNode;\n href: string;\n};\n\n/** A dashboard screen: heading, actions, filters, then the grid of widgets. */\nexport function DashboardLayout({\n title,\n eyebrow,\n description,\n actions,\n toolbar,\n date,\n quickActions,\n quickActionsLabel,\n linkAs,\n side,\n headingAs: H = \"h1\",\n className,\n children,\n ...props\n}: DashboardLayoutProps) {\n const grid = <div className={s.grid()}>{children}</div>;\n return (\n <div className={s.root({ className })} {...props}>\n <div className={s.head()}>\n <div className={s.text()}>\n {eyebrow && <p className={s.eyebrow()}>{eyebrow}</p>}\n <H className={s.title()}>{title}</H>\n {description && <p className={s.description()}>{description}</p>}\n </div>\n {(date || actions) && (\n <div className={s.right()}>\n {date && <p className={s.date()}>{date}</p>}\n {actions && <div className={s.actions()}>{actions}</div>}\n </div>\n )}\n </div>\n {toolbar && <div className={s.toolbar()}>{toolbar}</div>}\n {quickActions && quickActions.length > 0 && (\n <nav aria-label={quickActionsLabel}>\n <ul className={s.quick()}>\n {quickActions.slice(0, 4).map((q) => (\n <li key={q.id}>\n <BlockLink href={q.href} linkAs={linkAs} className={s.tile()}>\n {q.icon && (\n <span className={s.tileIcon()} aria-hidden=\"true\">\n {q.icon}\n </span>\n )}\n <span className={s.tileText()}>\n <span className={s.tileLabel()}>{q.label}</span>\n {q.hint && <span className={s.tileHint()}>{q.hint}</span>}\n </span>\n </BlockLink>\n </li>\n ))}\n </ul>\n </nav>\n )}\n {side ? (\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_20rem]\">\n {grid}\n <aside className={s.side()}>{side}</aside>\n </div>\n ) : (\n grid\n )}\n </div>\n );\n}\n\nexport type WidgetProps = Omit<React.ComponentProps<\"section\">, \"title\"> & {\n /** The widget's title: it names the region. */\n title: React.ReactNode;\n /** One line under the title (the period, the source). */\n description?: React.ReactNode;\n /** An action on the right of the title (`See all`). */\n action?: React.ReactNode;\n /**\n * The columns it takes: 1, 2, 3 or the full row (from `sm`; one column on a phone).\n * @default 1\n */\n span?: 1 | 2 | 3 | \"full\";\n /**\n * The title's level: one under the dashboard's heading — `2` under an `h1`, `3` inside an AppShell (`headingAs=\"h2\"`).\n * @default 2\n */\n level?: 2 | 3;\n /** The content: a Stat, a chart of @krizaka/charts, a DataTable, a list. */\n children: React.ReactNode;\n};\n\n/** A widget of the dashboard: a titled region on a card. */\nexport function Widget({ title, description, action, span = 1, level = 2, className, children, id, ...props }: WidgetProps) {\n const H = level === 2 ? \"h2\" : \"h3\";\n const sv = dashboardLayout({ span });\n const auto = React.useId();\n const titleId = `${id ?? auto}-title`;\n return (\n <section className={sv.widget({ className })} aria-labelledby={titleId} id={id} {...props}>\n <div className={s.widgetHead()}>\n <div className=\"min-w-0\">\n <H id={titleId} className={s.widgetTitle()}>\n {title}\n </H>\n {description && <p className={s.widgetDescription()}>{description}</p>}\n </div>\n {action}\n </div>\n <div className={s.widgetBody()}>{children}</div>\n </section>\n );\n}\n"
227
227
  },
228
228
  {
229
229
  "path": "dashboard-layout/index.ts",
@@ -149,7 +149,7 @@
149
149
  }
150
150
  ],
151
151
  "dependencies": [
152
- "@krizaka/tokens@^3.63.1"
152
+ "@krizaka/tokens@^3.64.0"
153
153
  ],
154
154
  "registryDependencies": [],
155
155
  "demo": {
@@ -0,0 +1,4 @@
1
+ import type { ComponentType } from "react";
2
+ /** A named example of the @krizaka/ui registry; `defaultOpen` opens what it opens (a dialog, a menu, toasts) at load. */
3
+ declare const Example: ComponentType<{ defaultOpen?: boolean }>;
4
+ export default Example;
@@ -0,0 +1,27 @@
1
+ "use client";
2
+
3
+ // registry/examples/account-settings/avatar-picker-folder.tsx
4
+ import { AVATAR_NONE, AvatarPicker, builtInAvatarOptions } from "@krizaka/ui/account-settings";
5
+ import * as React from "react";
6
+ import { jsx } from "react/jsx-runtime";
7
+ var OPTIONS = builtInAvatarOptions("folder", "yomizaka", (tone) => `Teinte ${tone}`);
8
+ function AvatarPickerFolderExample() {
9
+ const [value, setValue] = React.useState("folder-2");
10
+ return /* @__PURE__ */ jsx("div", { className: "w-full max-w-md", children: /* @__PURE__ */ jsx(
11
+ AvatarPicker,
12
+ {
13
+ label: "Photo du dossier",
14
+ showLabel: true,
15
+ kind: "folder",
16
+ noneLabel: "Aucune photo",
17
+ options: OPTIONS,
18
+ value,
19
+ onValueChange: (id) => setValue(id === AVATAR_NONE ? AVATAR_NONE : id),
20
+ uploadFile: { title: "D\xE9posez une image", browseLabel: "Choisir une image", hint: "PNG ou JPEG, 2 Mo au plus", accept: "image/png,image/jpeg", maxSize: 2e6, onFile: () => {
21
+ } }
22
+ }
23
+ ) });
24
+ }
25
+ export {
26
+ AvatarPickerFolderExample as default
27
+ };
@@ -0,0 +1,23 @@
1
+ import { AVATAR_NONE, AvatarPicker, builtInAvatarOptions } from "@krizaka/ui/account-settings";
2
+ import * as React from "react";
3
+
4
+ const OPTIONS = builtInAvatarOptions("folder", "yomizaka", (tone) => `Teinte ${tone}`);
5
+
6
+ // A folder's picture: the set of the folder kind (never a person), the « no picture » tile and the library's upload control.
7
+ export default function AvatarPickerFolderExample() {
8
+ const [value, setValue] = React.useState("folder-2");
9
+ return (
10
+ <div className="w-full max-w-md">
11
+ <AvatarPicker
12
+ label="Photo du dossier"
13
+ showLabel
14
+ kind="folder"
15
+ noneLabel="Aucune photo"
16
+ options={OPTIONS}
17
+ value={value}
18
+ onValueChange={(id) => setValue(id === AVATAR_NONE ? AVATAR_NONE : id)}
19
+ uploadFile={{ title: "Déposez une image", browseLabel: "Choisir une image", hint: "PNG ou JPEG, 2 Mo au plus", accept: "image/png,image/jpeg", maxSize: 2_000_000, onFile: () => {} }}
20
+ />
21
+ </div>
22
+ );
23
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krizaka/ui",
3
- "version": "3.63.1",
3
+ "version": "3.64.0",
4
4
  "templatePurposes": {
5
5
  "convince": {
6
6
  "title": "Convince",
@@ -612,7 +612,7 @@
612
612
  }
613
613
  },
614
614
  "examples": {
615
- "web": 6,
615
+ "web": 7,
616
616
  "native": 0
617
617
  },
618
618
  "dependencies": [
@@ -623,6 +623,7 @@
623
623
  "badge",
624
624
  "cn",
625
625
  "field",
626
+ "file-upload",
626
627
  "radio-group",
627
628
  "settings-layout",
628
629
  "switch"
@@ -2468,7 +2469,7 @@
2468
2469
  "native": 0
2469
2470
  },
2470
2471
  "dependencies": [
2471
- "@krizaka/tokens@^3.63.1"
2472
+ "@krizaka/tokens@^3.64.0"
2472
2473
  ],
2473
2474
  "registryDependencies": []
2474
2475
  },
@@ -3716,7 +3717,7 @@
3716
3717
  "native": 2
3717
3718
  },
3718
3719
  "dependencies": [
3719
- "@krizaka/tokens@^3.63.1",
3720
+ "@krizaka/tokens@^3.64.0",
3720
3721
  "@protomaps/basemaps@5.7.2",
3721
3722
  "tailwind-variants@^3.3.1"
3722
3723
  ],
@@ -4187,7 +4188,7 @@
4187
4188
  "native": 0
4188
4189
  },
4189
4190
  "dependencies": [
4190
- "@krizaka/tokens@^3.63.1",
4191
+ "@krizaka/tokens@^3.64.0",
4191
4192
  "radix-ui@^1.8.1",
4192
4193
  "tailwind-variants@^3.3.1"
4193
4194
  ],
@@ -4950,7 +4951,7 @@
4950
4951
  "native": 0
4951
4952
  },
4952
4953
  "dependencies": [
4953
- "@krizaka/tokens@^3.63.1",
4954
+ "@krizaka/tokens@^3.64.0",
4954
4955
  "radix-ui@^1.8.1",
4955
4956
  "tailwind-variants@^3.3.1"
4956
4957
  ],
@@ -5459,7 +5460,7 @@
5459
5460
  "native": 0
5460
5461
  },
5461
5462
  "dependencies": [
5462
- "@krizaka/tokens@^3.63.1",
5463
+ "@krizaka/tokens@^3.64.0",
5463
5464
  "radix-ui@^1.8.1",
5464
5465
  "tailwind-variants@^3.3.1"
5465
5466
  ],
package/registry/map.json CHANGED
@@ -1075,7 +1075,7 @@
1075
1075
  }
1076
1076
  ],
1077
1077
  "dependencies": [
1078
- "@krizaka/tokens@^3.63.1",
1078
+ "@krizaka/tokens@^3.64.0",
1079
1079
  "@protomaps/basemaps@5.7.2",
1080
1080
  "tailwind-variants@^3.3.1"
1081
1081
  ],
@@ -722,7 +722,7 @@
722
722
  }
723
723
  ],
724
724
  "dependencies": [
725
- "@krizaka/tokens@^3.63.1",
725
+ "@krizaka/tokens@^3.64.0",
726
726
  "radix-ui@^1.8.1",
727
727
  "tailwind-variants@^3.3.1"
728
728
  ],
@@ -366,7 +366,7 @@
366
366
  }
367
367
  ],
368
368
  "dependencies": [
369
- "@krizaka/tokens@^3.63.1",
369
+ "@krizaka/tokens@^3.64.0",
370
370
  "radix-ui@^1.8.1",
371
371
  "tailwind-variants@^3.3.1"
372
372
  ],