vectis-ui 0.15.0 → 0.16.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 (161) hide show
  1. package/dist/components/VAccordion/VAccordion.css +1 -1
  2. package/dist/components/VAccordion/VAccordion.d.ts +0 -6
  3. package/dist/components/VAccordion/VAccordion.js.map +1 -1
  4. package/dist/components/VAccordion/VAccordion.vue_vue_type_script_setup_true_lang.js +3 -8
  5. package/dist/components/VAccordion/VAccordion.vue_vue_type_script_setup_true_lang.js.map +1 -1
  6. package/dist/components/VAccordion/context.js.map +1 -1
  7. package/dist/components/VAvatar/VAvatar.d.ts +0 -3
  8. package/dist/components/VAvatar/VAvatar.js.map +1 -1
  9. package/dist/components/VAvatar/VAvatar.vue_vue_type_script_setup_true_lang.js +21 -27
  10. package/dist/components/VAvatar/VAvatar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  11. package/dist/components/VAvatar/VAvatarGroup.d.ts +0 -6
  12. package/dist/components/VAvatar/VAvatarGroup.js.map +1 -1
  13. package/dist/components/VAvatar/VAvatarGroup.vue_vue_type_script_setup_true_lang.js +5 -19
  14. package/dist/components/VAvatar/VAvatarGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  15. package/dist/components/VAvatar/context.d.ts +0 -1
  16. package/dist/components/VAvatar/context.js.map +1 -1
  17. package/dist/components/VButton/VButton.d.ts +0 -6
  18. package/dist/components/VButton/VButton.js.map +1 -1
  19. package/dist/components/VButton/VButton.vue_vue_type_script_setup_true_lang.js +11 -17
  20. package/dist/components/VButton/VButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  21. package/dist/components/VButton/VButtonGroup.d.ts +0 -6
  22. package/dist/components/VButton/VButtonGroup.js.map +1 -1
  23. package/dist/components/VButton/VButtonGroup.vue_vue_type_script_setup_true_lang.js +0 -7
  24. package/dist/components/VButton/VButtonGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  25. package/dist/components/VButton/context.d.ts +0 -2
  26. package/dist/components/VButton/context.js.map +1 -1
  27. package/dist/components/VChip/VChip.d.ts +0 -3
  28. package/dist/components/VChip/VChip.js.map +1 -1
  29. package/dist/components/VChip/VChip.vue_vue_type_script_setup_true_lang.js +0 -6
  30. package/dist/components/VChip/VChip.vue_vue_type_script_setup_true_lang.js.map +1 -1
  31. package/dist/components/VColorInput/VColorInput.d.ts +0 -3
  32. package/dist/components/VColorInput/VColorInput.js.map +1 -1
  33. package/dist/components/VColorInput/VColorInput.vue_vue_type_script_setup_true_lang.js +60 -66
  34. package/dist/components/VColorInput/VColorInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  35. package/dist/components/VCombobox/VCombobox.d.ts +0 -3
  36. package/dist/components/VCombobox/VCombobox.js.map +1 -1
  37. package/dist/components/VCombobox/VCombobox.vue_vue_type_script_setup_true_lang.js +127 -138
  38. package/dist/components/VCombobox/VCombobox.vue_vue_type_script_setup_true_lang.js.map +1 -1
  39. package/dist/components/VContextMenu/VContextMenu.d.ts +0 -3
  40. package/dist/components/VContextMenu/VContextMenu.js.map +1 -1
  41. package/dist/components/VContextMenu/VContextMenu.vue_vue_type_script_setup_true_lang.js +0 -6
  42. package/dist/components/VContextMenu/VContextMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  43. package/dist/components/VDataTable/VDataTable.css +1 -1
  44. package/dist/components/VDataTable/VDataTable.d.ts +0 -2
  45. package/dist/components/VDataTable/VDataTable.js.map +1 -1
  46. package/dist/components/VDataTable/VDataTable.vue_vue_type_script_setup_true_lang.js +69 -84
  47. package/dist/components/VDataTable/VDataTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
  48. package/dist/components/VDateInput/VDateInput.d.ts +0 -3
  49. package/dist/components/VDateInput/VDateInput.js.map +1 -1
  50. package/dist/components/VDateInput/VDateInput.vue_vue_type_script_setup_true_lang.js +32 -37
  51. package/dist/components/VDateInput/VDateInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  52. package/dist/components/VFileInput/VFileInput.d.ts +0 -5
  53. package/dist/components/VFileInput/VFileInput.js.map +1 -1
  54. package/dist/components/VFileInput/VFileInput.vue_vue_type_script_setup_true_lang.js +75 -86
  55. package/dist/components/VFileInput/VFileInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  56. package/dist/components/VHotkeys/VHotkeys.d.ts +0 -3
  57. package/dist/components/VHotkeys/VHotkeys.js.map +1 -1
  58. package/dist/components/VHotkeys/VHotkeys.vue_vue_type_script_setup_true_lang.js +0 -6
  59. package/dist/components/VHotkeys/VHotkeys.vue_vue_type_script_setup_true_lang.js.map +1 -1
  60. package/dist/components/VIconButton/VIconButton.d.ts +0 -3
  61. package/dist/components/VIconButton/VIconButton.js.map +1 -1
  62. package/dist/components/VIconButton/VIconButton.vue_vue_type_script_setup_true_lang.js +0 -6
  63. package/dist/components/VIconButton/VIconButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  64. package/dist/components/VInput/VInput.css +1 -1
  65. package/dist/components/VInput/VInput.d.ts +0 -3
  66. package/dist/components/VInput/VInput.js.map +1 -1
  67. package/dist/components/VInput/VInput.vue_vue_type_script_setup_true_lang.js +18 -24
  68. package/dist/components/VInput/VInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  69. package/dist/components/VInput/VInputGroup.d.ts +0 -3
  70. package/dist/components/VInput/VInputGroup.js.map +1 -1
  71. package/dist/components/VInput/VInputGroup.vue_vue_type_script_setup_true_lang.js +0 -7
  72. package/dist/components/VInput/VInputGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  73. package/dist/components/VInput/context.d.ts +0 -2
  74. package/dist/components/VInput/context.js.map +1 -1
  75. package/dist/components/VInputOTP/VInputOTP.d.ts +0 -3
  76. package/dist/components/VInputOTP/VInputOTP.js.map +1 -1
  77. package/dist/components/VInputOTP/VInputOTP.vue_vue_type_script_setup_true_lang.js +0 -6
  78. package/dist/components/VInputOTP/VInputOTP.vue_vue_type_script_setup_true_lang.js.map +1 -1
  79. package/dist/components/VListbox/VListboxPanel.d.ts +0 -3
  80. package/dist/components/VListbox/VListboxPanel.js.map +1 -1
  81. package/dist/components/VListbox/VListboxPanel.vue_vue_type_script_setup_true_lang.js +0 -6
  82. package/dist/components/VListbox/VListboxPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  83. package/dist/components/VListbox/VListboxValues.js.map +1 -1
  84. package/dist/components/VListbox/VListboxValues.vue_vue_type_script_setup_true_lang.js +4 -14
  85. package/dist/components/VListbox/VListboxValues.vue_vue_type_script_setup_true_lang.js.map +1 -1
  86. package/dist/components/VMenu/VMenu.d.ts +0 -3
  87. package/dist/components/VMenu/VMenu.js.map +1 -1
  88. package/dist/components/VMenu/VMenu.vue_vue_type_script_setup_true_lang.js +0 -6
  89. package/dist/components/VMenu/VMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  90. package/dist/components/VMenu/VMenuPanel.d.ts +0 -3
  91. package/dist/components/VMenu/VMenuPanel.js.map +1 -1
  92. package/dist/components/VMenu/VMenuPanel.vue_vue_type_script_setup_true_lang.js +0 -6
  93. package/dist/components/VMenu/VMenuPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  94. package/dist/components/VNumberInput/VNumberInput.d.ts +0 -3
  95. package/dist/components/VNumberInput/VNumberInput.js.map +1 -1
  96. package/dist/components/VNumberInput/VNumberInput.vue_vue_type_script_setup_true_lang.js +0 -6
  97. package/dist/components/VNumberInput/VNumberInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  98. package/dist/components/VPagination/VPagination.d.ts +0 -3
  99. package/dist/components/VPagination/VPagination.js.map +1 -1
  100. package/dist/components/VPagination/VPagination.vue_vue_type_script_setup_true_lang.js +0 -6
  101. package/dist/components/VPagination/VPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  102. package/dist/components/VSelect/VSelect.d.ts +0 -3
  103. package/dist/components/VSelect/VSelect.js.map +1 -1
  104. package/dist/components/VSelect/VSelect.vue_vue_type_script_setup_true_lang.js +114 -123
  105. package/dist/components/VSelect/VSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
  106. package/dist/components/VSideNavigation/VSideNavigation.d.ts +0 -6
  107. package/dist/components/VSideNavigation/VSideNavigation.js.map +1 -1
  108. package/dist/components/VSideNavigation/VSideNavigation.vue_vue_type_script_setup_true_lang.js +1 -10
  109. package/dist/components/VSideNavigation/VSideNavigation.vue_vue_type_script_setup_true_lang.js.map +1 -1
  110. package/dist/components/VSideNavigation/context.js.map +1 -1
  111. package/dist/components/VSkeletonLoader/VSkeletonLoader.d.ts +0 -3
  112. package/dist/components/VSkeletonLoader/VSkeletonLoader.js.map +1 -1
  113. package/dist/components/VSkeletonLoader/VSkeletonLoader.vue_vue_type_script_setup_true_lang.js +0 -6
  114. package/dist/components/VSkeletonLoader/VSkeletonLoader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  115. package/dist/components/VSlider/VSlider.js.map +1 -1
  116. package/dist/components/VSlider/VSlider.vue_vue_type_script_setup_true_lang.js +115 -120
  117. package/dist/components/VSlider/VSlider.vue_vue_type_script_setup_true_lang.js.map +1 -1
  118. package/dist/components/VSplitButton/VSplitButton.d.ts +0 -3
  119. package/dist/components/VSplitButton/VSplitButton.js.map +1 -1
  120. package/dist/components/VSplitButton/VSplitButton.vue_vue_type_script_setup_true_lang.js +0 -6
  121. package/dist/components/VSplitButton/VSplitButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  122. package/dist/components/VTabs/VTab.js.map +1 -1
  123. package/dist/components/VTabs/VTab.vue_vue_type_script_setup_true_lang.js +0 -2
  124. package/dist/components/VTabs/VTab.vue_vue_type_script_setup_true_lang.js.map +1 -1
  125. package/dist/components/VTabs/VTabs.css +1 -1
  126. package/dist/components/VTabs/VTabs.d.ts +0 -3
  127. package/dist/components/VTabs/VTabs.js.map +1 -1
  128. package/dist/components/VTabs/VTabs.vue_vue_type_script_setup_true_lang.js +2 -15
  129. package/dist/components/VTabs/VTabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
  130. package/dist/components/VTabs/context.d.ts +0 -2
  131. package/dist/components/VTabs/context.js.map +1 -1
  132. package/dist/components/VTextarea/VTextarea.d.ts +0 -6
  133. package/dist/components/VTextarea/VTextarea.js.map +1 -1
  134. package/dist/components/VTextarea/VTextarea.vue_vue_type_script_setup_true_lang.js +0 -6
  135. package/dist/components/VTextarea/VTextarea.vue_vue_type_script_setup_true_lang.js.map +1 -1
  136. package/dist/components/VTimeInput/VTimeInput.d.ts +0 -3
  137. package/dist/components/VTimeInput/VTimeInput.js.map +1 -1
  138. package/dist/components/VTimeInput/VTimeInput.vue_vue_type_script_setup_true_lang.js +211 -218
  139. package/dist/components/VTimeInput/VTimeInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  140. package/dist/components/VToggle/VToggle.d.ts +0 -3
  141. package/dist/components/VToggle/VToggle.js.map +1 -1
  142. package/dist/components/VToggle/VToggle.vue_vue_type_script_setup_true_lang.js +0 -6
  143. package/dist/components/VToggle/VToggle.vue_vue_type_script_setup_true_lang.js.map +1 -1
  144. package/dist/components/VToggle/VToggleItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  145. package/dist/composables/useControlShape.d.ts +1 -5
  146. package/dist/composables/useControlShape.js +0 -1
  147. package/dist/composables/useControlShape.js.map +1 -1
  148. package/dist/composables/useListbox.d.ts +0 -1
  149. package/dist/composables/useListbox.js +1 -1
  150. package/dist/composables/useListbox.js.map +1 -1
  151. package/dist/styles.css +1 -1
  152. package/dist/tokens/index.d.ts +3 -0
  153. package/dist/tokens/semantic.d.ts +3 -0
  154. package/dist/tokens/semantic.js +6 -5
  155. package/dist/tokens/semantic.js.map +1 -1
  156. package/dist/tokens.json +12 -5
  157. package/dist/types.d.ts +0 -2
  158. package/dist/utils/chip.d.ts +4 -6
  159. package/dist/utils/chip.js +8 -5
  160. package/dist/utils/chip.js.map +1 -1
  161. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
1
  @layer vectis.reset, vectis.tokens, vectis.components, vectis.utilities;
2
- @layer vectis.components{.v-accordion{--accordion-pad-delta:0px;--accordion-pad-block:calc(var(--vectis-space-4) - var(--accordion-pad-delta));--accordion-pad-inline:calc(var(--vectis-space-5) - var(--accordion-pad-delta));--accordion-content-pad-start:calc(var(--vectis-space-2) - var(--accordion-pad-delta));font-family:var(--vectis-text-family)}.v-accordion[data-variant=flat]{--accordion-corner-radius:var(--vectis-radius-surface)}.v-accordion[data-compact]{--accordion-pad-delta:var(--vectis-space-1)}.v-accordion:is([data-variant=outline],[data-variant=elevated],[data-variant=filled]){--accordion-corner-radius:calc(var(--vectis-radius-surface) - 1px);border-radius:var(--vectis-radius-surface);border:1px solid #0000;overflow:clip}.v-accordion[data-variant=outline]{background:var(--vectis-color-surface);border-color:var(--vectis-color-border)}.v-accordion[data-variant=elevated]{--accordion-corner-radius:var(--vectis-radius-surface);background:var(--vectis-color-surface-raised);box-shadow:var(--vectis-shadow-sm);border:none}.v-accordion[data-variant=filled]{--accordion-hover-bg:color-mix(in oklab, var(--vectis-color-surface-muted), var(--vectis-color-text) 4%);background:var(--vectis-color-surface-muted)}}
2
+ @layer vectis.components{.v-accordion{--accordion-pad-block:calc(var(--vectis-space-4) - var(--vectis-density-delta));--accordion-pad-inline:calc(var(--vectis-space-5) - var(--vectis-density-delta));--accordion-content-pad-start:calc(var(--vectis-space-2) - var(--vectis-density-delta));font-family:var(--vectis-text-family)}.v-accordion[data-variant=flat]{--accordion-corner-radius:var(--vectis-radius-surface)}.v-accordion:is([data-variant=outline],[data-variant=elevated],[data-variant=filled]){--accordion-corner-radius:calc(var(--vectis-radius-surface) - 1px);border-radius:var(--vectis-radius-surface);border:1px solid #0000;overflow:clip}.v-accordion[data-variant=outline]{background:var(--vectis-color-surface);border-color:var(--vectis-color-border)}.v-accordion[data-variant=elevated]{--accordion-corner-radius:var(--vectis-radius-surface);background:var(--vectis-color-surface-raised);box-shadow:var(--vectis-shadow-sm);border:none}.v-accordion[data-variant=filled]{--accordion-hover-bg:color-mix(in oklab, var(--vectis-color-surface-muted), var(--vectis-color-text) 4%);background:var(--vectis-color-surface-muted)}}
@@ -26,11 +26,6 @@ interface AccordionProps {
26
26
  * rotated 180°; provide one and the two icons are swapped instead.
27
27
  */
28
28
  collapseIcon?: IconSource;
29
- /**
30
- * Reduced density: every padding loses 4px, while the text and the icons keep
31
- * their size.
32
- */
33
- compact?: boolean;
34
29
  }
35
30
  type __VLS_Slots = {
36
31
  /** The `<VAccordionItem>`s that make up the group. */
@@ -38,7 +33,6 @@ type __VLS_Slots = {
38
33
  };
39
34
  declare const __VLS_base: import('vue').DefineComponent<AccordionProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<AccordionProps> & Readonly<{}>, {
40
35
  variant: AccordionVariant;
41
- compact: boolean;
42
36
  multiple: boolean;
43
37
  expandIcon: IconSource;
44
38
  collapseIcon: IconSource;
@@ -1 +1 @@
1
- {"version":3,"file":"VAccordion.js","names":["_sfc_main","VAccordion_vue_vue_type_script_setup_true_lang_default","VAccordion_default"],"sources":["../../../src/components/VAccordion/VAccordion.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Native details elements own disclosure and exclusive groups; multiple removes the shared\n * group name.\n */\n\nimport { provide, useId } from 'vue'\n\nimport { expand_more as expandMoreIcon } from '../VIcon/icons/expand_more'\nimport type { IconSource } from '../VIcon/types'\n\nimport { accordionKey } from './context'\n\n/** How the group is set off from the page: nothing, a border, a shadow, or a muted fill. */\nexport type AccordionVariant = 'flat' | 'outline' | 'elevated' | 'filled'\n\ninterface AccordionProps {\n /**\n * Lets the reader keep several sections open at once. Left out, only one may stay\n * open and opening one closes the previous one, which the browser does on its own\n * once every item shares the same `<details>` name.\n */\n multiple?: boolean\n /**\n * How the group is set off from the page. `flat`, the default, draws nothing and lets\n * the accordion sit directly on the surface behind it. The other three frame it with\n * rounded corners, like a card: a border on the page surface (`outline`), a shadow over\n * a raised surface (`elevated`), or a muted fill with no border (`filled`).\n */\n variant?: AccordionVariant\n /**\n * The icon shown on a closed item: an icon name, or an explicit `{ src }` /\n * `{ component }`. It is a chevron by default, which rotates by 180° when the\n * item opens.\n */\n expandIcon?: IconSource\n /**\n * The icon shown on an open item. Leave it out and the `expandIcon` is simply\n * rotated 180°; provide one and the two icons are swapped instead.\n */\n collapseIcon?: IconSource\n /**\n * Reduced density: every padding loses 4px, while the text and the icons keep\n * their size.\n */\n compact?: boolean\n}\n\nconst props = withDefaults(defineProps<AccordionProps>(), {\n multiple: false,\n variant: 'flat',\n expandIcon: () => expandMoreIcon,\n collapseIcon: undefined,\n compact: false,\n})\n\ndefineSlots<{\n /** The `<VAccordionItem>`s that make up the group. */\n default(): unknown\n}>()\n\nconst groupName = useId()\nprovide(accordionKey, {\n get name() {\n return props.multiple ? undefined : groupName\n },\n get expandIcon() {\n return props.expandIcon\n },\n get collapseIcon() {\n return props.collapseIcon\n },\n})\n</script>\n\n<template>\n <div class=\"v-accordion\" :data-variant=\"variant\" :data-compact=\"compact ? '' : undefined\">\n <slot />\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-accordion {\n --accordion-pad-delta: 0px;\n --accordion-pad-block: calc(var(--vectis-space-4) - var(--accordion-pad-delta));\n --accordion-pad-inline: calc(var(--vectis-space-5) - var(--accordion-pad-delta));\n --accordion-content-pad-start: calc(var(--vectis-space-2) - var(--accordion-pad-delta));\n\n font-family: var(--vectis-text-family);\n }\n\n /* Read by the first and last rows to round their hover. Without a frame there is no clip,\n so the rows carry the whole radius. */\n .v-accordion[data-variant='flat'] {\n --accordion-corner-radius: var(--vectis-radius-surface);\n }\n\n .v-accordion[data-compact] {\n --accordion-pad-delta: var(--vectis-space-1);\n }\n\n .v-accordion:is([data-variant='outline'], [data-variant='elevated'], [data-variant='filled']) {\n --accordion-corner-radius: calc(var(--vectis-radius-surface) - 1px);\n\n /* Transparent rather than absent on `filled`: forced colours paint it. `elevated` has\n none, so that the separators and the hover reach the edge its shadow draws. */\n border: 1px solid transparent;\n border-radius: var(--vectis-radius-surface);\n /* The clip is what keeps the first and last rows' hover inside the rounded corners, so\n it belongs to the variants that HAVE corners. `clip` and not `hidden`: `hidden` makes\n the box a scroll container, which captures every `position: sticky` in the content\n and pins it to the accordion instead of the page. */\n overflow: clip;\n }\n\n .v-accordion[data-variant='outline'] {\n background: var(--vectis-color-surface);\n border-color: var(--vectis-color-border);\n }\n\n .v-accordion[data-variant='elevated'] {\n --accordion-corner-radius: var(--vectis-radius-surface);\n\n border: none;\n background: var(--vectis-color-surface-raised);\n box-shadow: var(--vectis-shadow-sm);\n }\n\n /* The usual hover is the muted surface itself, which would vanish on this fill. */\n .v-accordion[data-variant='filled'] {\n --accordion-hover-bg: color-mix(\n in oklab,\n var(--vectis-color-surface-muted),\n var(--vectis-color-text) 4%\n );\n\n background: var(--vectis-color-surface-muted);\n }\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"VAccordion.js","names":["_sfc_main","VAccordion_vue_vue_type_script_setup_true_lang_default","VAccordion_default"],"sources":["../../../src/components/VAccordion/VAccordion.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Native details elements own disclosure and exclusive groups; multiple removes the shared\n * group name.\n */\n\nimport { provide, useId } from 'vue'\n\nimport { expand_more as expandMoreIcon } from '../VIcon/icons/expand_more'\nimport type { IconSource } from '../VIcon/types'\n\nimport { accordionKey } from './context'\n\n/** How the group is set off from the page: nothing, a border, a shadow, or a muted fill. */\nexport type AccordionVariant = 'flat' | 'outline' | 'elevated' | 'filled'\n\ninterface AccordionProps {\n /**\n * Lets the reader keep several sections open at once. Left out, only one may stay\n * open and opening one closes the previous one, which the browser does on its own\n * once every item shares the same `<details>` name.\n */\n multiple?: boolean\n /**\n * How the group is set off from the page. `flat`, the default, draws nothing and lets\n * the accordion sit directly on the surface behind it. The other three frame it with\n * rounded corners, like a card: a border on the page surface (`outline`), a shadow over\n * a raised surface (`elevated`), or a muted fill with no border (`filled`).\n */\n variant?: AccordionVariant\n /**\n * The icon shown on a closed item: an icon name, or an explicit `{ src }` /\n * `{ component }`. It is a chevron by default, which rotates by 180° when the\n * item opens.\n */\n expandIcon?: IconSource\n /**\n * The icon shown on an open item. Leave it out and the `expandIcon` is simply\n * rotated 180°; provide one and the two icons are swapped instead.\n */\n collapseIcon?: IconSource\n}\n\nconst props = withDefaults(defineProps<AccordionProps>(), {\n multiple: false,\n variant: 'flat',\n expandIcon: () => expandMoreIcon,\n collapseIcon: undefined,\n})\n\ndefineSlots<{\n /** The `<VAccordionItem>`s that make up the group. */\n default(): unknown\n}>()\n\nconst groupName = useId()\nprovide(accordionKey, {\n get name() {\n return props.multiple ? undefined : groupName\n },\n get expandIcon() {\n return props.expandIcon\n },\n get collapseIcon() {\n return props.collapseIcon\n },\n})\n</script>\n\n<template>\n <div class=\"v-accordion\" :data-variant=\"variant\">\n <slot />\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-accordion {\n --accordion-pad-block: calc(var(--vectis-space-4) - var(--vectis-density-delta));\n --accordion-pad-inline: calc(var(--vectis-space-5) - var(--vectis-density-delta));\n --accordion-content-pad-start: calc(var(--vectis-space-2) - var(--vectis-density-delta));\n\n font-family: var(--vectis-text-family);\n }\n\n /* Read by the first and last rows to round their hover. Without a frame there is no clip,\n so the rows carry the whole radius. */\n .v-accordion[data-variant='flat'] {\n --accordion-corner-radius: var(--vectis-radius-surface);\n }\n\n .v-accordion:is([data-variant='outline'], [data-variant='elevated'], [data-variant='filled']) {\n --accordion-corner-radius: calc(var(--vectis-radius-surface) - 1px);\n\n /* Transparent rather than absent on `filled`: forced colours paint it. `elevated` has\n none, so that the separators and the hover reach the edge its shadow draws. */\n border: 1px solid transparent;\n border-radius: var(--vectis-radius-surface);\n /* The clip is what keeps the first and last rows' hover inside the rounded corners, so\n it belongs to the variants that HAVE corners. `clip` and not `hidden`: `hidden` makes\n the box a scroll container, which captures every `position: sticky` in the content\n and pins it to the accordion instead of the page. */\n overflow: clip;\n }\n\n .v-accordion[data-variant='outline'] {\n background: var(--vectis-color-surface);\n border-color: var(--vectis-color-border);\n }\n\n .v-accordion[data-variant='elevated'] {\n --accordion-corner-radius: var(--vectis-radius-surface);\n\n border: none;\n background: var(--vectis-color-surface-raised);\n box-shadow: var(--vectis-shadow-sm);\n }\n\n /* The usual hover is the muted surface itself, which would vanish on this fill. */\n .v-accordion[data-variant='filled'] {\n --accordion-hover-bg: color-mix(\n in oklab,\n var(--vectis-color-surface-muted),\n var(--vectis-color-text) 4%\n );\n\n background: var(--vectis-color-surface-muted);\n }\n}\n</style>\n"],"mappings":""}
@@ -2,7 +2,7 @@ import { expand_more as e } from "../VIcon/icons/expand_more.js";
2
2
  import { accordionKey as t } from "./context.js";
3
3
  import { createElementBlock as n, defineComponent as r, openBlock as i, provide as a, renderSlot as o, useId as s } from "vue";
4
4
  //#region src/components/VAccordion/VAccordion.vue?vue&type=script&setup=true&lang.ts
5
- var c = ["data-variant", "data-compact"], l = /*@__PURE__*/ r({
5
+ var c = ["data-variant"], l = /*@__PURE__*/ r({
6
6
  __name: "VAccordion",
7
7
  props: {
8
8
  multiple: {
@@ -11,11 +11,7 @@ var c = ["data-variant", "data-compact"], l = /*@__PURE__*/ r({
11
11
  },
12
12
  variant: { default: "flat" },
13
13
  expandIcon: { default: () => e },
14
- collapseIcon: { default: void 0 },
15
- compact: {
16
- type: Boolean,
17
- default: !1
18
- }
14
+ collapseIcon: { default: void 0 }
19
15
  },
20
16
  setup(e) {
21
17
  let r = e, l = s();
@@ -31,8 +27,7 @@ var c = ["data-variant", "data-compact"], l = /*@__PURE__*/ r({
31
27
  }
32
28
  }), (t, r) => (i(), n("div", {
33
29
  class: "v-accordion",
34
- "data-variant": e.variant,
35
- "data-compact": e.compact ? "" : void 0
30
+ "data-variant": e.variant
36
31
  }, [o(t.$slots, "default")], 8, c));
37
32
  }
38
33
  });
@@ -1 +1 @@
1
- {"version":3,"file":"VAccordion.vue_vue_type_script_setup_true_lang.js","names":["expandMoreIcon","_openBlock","_createElementBlock","_renderSlot","_hoisted_1","VAccordion_vue_vue_type_script_setup_true_lang_default","expand_more","props","__props","groupName","useId","provide","accordionKey","openBlock","createElementBlock","renderSlot","_ctx"],"sources":["../../../src/components/VAccordion/VAccordion.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Native details elements own disclosure and exclusive groups; multiple removes the shared\n * group name.\n */\n\nimport { provide, useId } from 'vue'\n\nimport { expand_more as expandMoreIcon } from '../VIcon/icons/expand_more'\nimport type { IconSource } from '../VIcon/types'\n\nimport { accordionKey } from './context'\n\n/** How the group is set off from the page: nothing, a border, a shadow, or a muted fill. */\nexport type AccordionVariant = 'flat' | 'outline' | 'elevated' | 'filled'\n\ninterface AccordionProps {\n /**\n * Lets the reader keep several sections open at once. Left out, only one may stay\n * open and opening one closes the previous one, which the browser does on its own\n * once every item shares the same `<details>` name.\n */\n multiple?: boolean\n /**\n * How the group is set off from the page. `flat`, the default, draws nothing and lets\n * the accordion sit directly on the surface behind it. The other three frame it with\n * rounded corners, like a card: a border on the page surface (`outline`), a shadow over\n * a raised surface (`elevated`), or a muted fill with no border (`filled`).\n */\n variant?: AccordionVariant\n /**\n * The icon shown on a closed item: an icon name, or an explicit `{ src }` /\n * `{ component }`. It is a chevron by default, which rotates by 180° when the\n * item opens.\n */\n expandIcon?: IconSource\n /**\n * The icon shown on an open item. Leave it out and the `expandIcon` is simply\n * rotated 180°; provide one and the two icons are swapped instead.\n */\n collapseIcon?: IconSource\n /**\n * Reduced density: every padding loses 4px, while the text and the icons keep\n * their size.\n */\n compact?: boolean\n}\n\nconst props = withDefaults(defineProps<AccordionProps>(), {\n multiple: false,\n variant: 'flat',\n expandIcon: () => expandMoreIcon,\n collapseIcon: undefined,\n compact: false,\n})\n\ndefineSlots<{\n /** The `<VAccordionItem>`s that make up the group. */\n default(): unknown\n}>()\n\nconst groupName = useId()\nprovide(accordionKey, {\n get name() {\n return props.multiple ? undefined : groupName\n },\n get expandIcon() {\n return props.expandIcon\n },\n get collapseIcon() {\n return props.collapseIcon\n },\n})\n</script>\n\n<template>\n <div class=\"v-accordion\" :data-variant=\"variant\" :data-compact=\"compact ? '' : undefined\">\n <slot />\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-accordion {\n --accordion-pad-delta: 0px;\n --accordion-pad-block: calc(var(--vectis-space-4) - var(--accordion-pad-delta));\n --accordion-pad-inline: calc(var(--vectis-space-5) - var(--accordion-pad-delta));\n --accordion-content-pad-start: calc(var(--vectis-space-2) - var(--accordion-pad-delta));\n\n font-family: var(--vectis-text-family);\n }\n\n /* Read by the first and last rows to round their hover. Without a frame there is no clip,\n so the rows carry the whole radius. */\n .v-accordion[data-variant='flat'] {\n --accordion-corner-radius: var(--vectis-radius-surface);\n }\n\n .v-accordion[data-compact] {\n --accordion-pad-delta: var(--vectis-space-1);\n }\n\n .v-accordion:is([data-variant='outline'], [data-variant='elevated'], [data-variant='filled']) {\n --accordion-corner-radius: calc(var(--vectis-radius-surface) - 1px);\n\n /* Transparent rather than absent on `filled`: forced colours paint it. `elevated` has\n none, so that the separators and the hover reach the edge its shadow draws. */\n border: 1px solid transparent;\n border-radius: var(--vectis-radius-surface);\n /* The clip is what keeps the first and last rows' hover inside the rounded corners, so\n it belongs to the variants that HAVE corners. `clip` and not `hidden`: `hidden` makes\n the box a scroll container, which captures every `position: sticky` in the content\n and pins it to the accordion instead of the page. */\n overflow: clip;\n }\n\n .v-accordion[data-variant='outline'] {\n background: var(--vectis-color-surface);\n border-color: var(--vectis-color-border);\n }\n\n .v-accordion[data-variant='elevated'] {\n --accordion-corner-radius: var(--vectis-radius-surface);\n\n border: none;\n background: var(--vectis-color-surface-raised);\n box-shadow: var(--vectis-shadow-sm);\n }\n\n /* The usual hover is the muted surface itself, which would vanish on this fill. */\n .v-accordion[data-variant='filled'] {\n --accordion-hover-bg: color-mix(\n in oklab,\n var(--vectis-color-surface-muted),\n var(--vectis-color-text) 4%\n );\n\n background: var(--vectis-color-surface-muted);\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAgDA,IAAMO,IAAQC,GAaRC,IAAYC,EAAM;SACxBC,EAAQC,GAAc;GACpB,IAAI,OAAO;IACT,OAAOL,EAAM,WAAW,KAAA,IAAYE;GACtC;GACA,IAAI,aAAa;IACf,OAAOF,EAAM;GACf;GACA,IAAI,eAAe;IACjB,OAAOA,EAAM;GACf;EACF,CAAC,cAICN,EAAA,GAAAC,EAEM,OAAA;GAFD,OAAM;GAAe,gBAAcM,EAAA;GAAU,gBAAcA,EAAA,UAAO,KAAQ,KAAA;EAC7EL,GAAAA,CAAAA,EAAQa,EAAA,QAAA,SAAA,CAAA,GAAA,GAAAZ,CAAA"}
1
+ {"version":3,"file":"VAccordion.vue_vue_type_script_setup_true_lang.js","names":["expandMoreIcon","_openBlock","_createElementBlock","_renderSlot","_hoisted_1","VAccordion_vue_vue_type_script_setup_true_lang_default","expand_more","props","__props","groupName","useId","provide","accordionKey","openBlock","createElementBlock","renderSlot","_ctx"],"sources":["../../../src/components/VAccordion/VAccordion.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Native details elements own disclosure and exclusive groups; multiple removes the shared\n * group name.\n */\n\nimport { provide, useId } from 'vue'\n\nimport { expand_more as expandMoreIcon } from '../VIcon/icons/expand_more'\nimport type { IconSource } from '../VIcon/types'\n\nimport { accordionKey } from './context'\n\n/** How the group is set off from the page: nothing, a border, a shadow, or a muted fill. */\nexport type AccordionVariant = 'flat' | 'outline' | 'elevated' | 'filled'\n\ninterface AccordionProps {\n /**\n * Lets the reader keep several sections open at once. Left out, only one may stay\n * open and opening one closes the previous one, which the browser does on its own\n * once every item shares the same `<details>` name.\n */\n multiple?: boolean\n /**\n * How the group is set off from the page. `flat`, the default, draws nothing and lets\n * the accordion sit directly on the surface behind it. The other three frame it with\n * rounded corners, like a card: a border on the page surface (`outline`), a shadow over\n * a raised surface (`elevated`), or a muted fill with no border (`filled`).\n */\n variant?: AccordionVariant\n /**\n * The icon shown on a closed item: an icon name, or an explicit `{ src }` /\n * `{ component }`. It is a chevron by default, which rotates by 180° when the\n * item opens.\n */\n expandIcon?: IconSource\n /**\n * The icon shown on an open item. Leave it out and the `expandIcon` is simply\n * rotated 180°; provide one and the two icons are swapped instead.\n */\n collapseIcon?: IconSource\n}\n\nconst props = withDefaults(defineProps<AccordionProps>(), {\n multiple: false,\n variant: 'flat',\n expandIcon: () => expandMoreIcon,\n collapseIcon: undefined,\n})\n\ndefineSlots<{\n /** The `<VAccordionItem>`s that make up the group. */\n default(): unknown\n}>()\n\nconst groupName = useId()\nprovide(accordionKey, {\n get name() {\n return props.multiple ? undefined : groupName\n },\n get expandIcon() {\n return props.expandIcon\n },\n get collapseIcon() {\n return props.collapseIcon\n },\n})\n</script>\n\n<template>\n <div class=\"v-accordion\" :data-variant=\"variant\">\n <slot />\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-accordion {\n --accordion-pad-block: calc(var(--vectis-space-4) - var(--vectis-density-delta));\n --accordion-pad-inline: calc(var(--vectis-space-5) - var(--vectis-density-delta));\n --accordion-content-pad-start: calc(var(--vectis-space-2) - var(--vectis-density-delta));\n\n font-family: var(--vectis-text-family);\n }\n\n /* Read by the first and last rows to round their hover. Without a frame there is no clip,\n so the rows carry the whole radius. */\n .v-accordion[data-variant='flat'] {\n --accordion-corner-radius: var(--vectis-radius-surface);\n }\n\n .v-accordion:is([data-variant='outline'], [data-variant='elevated'], [data-variant='filled']) {\n --accordion-corner-radius: calc(var(--vectis-radius-surface) - 1px);\n\n /* Transparent rather than absent on `filled`: forced colours paint it. `elevated` has\n none, so that the separators and the hover reach the edge its shadow draws. */\n border: 1px solid transparent;\n border-radius: var(--vectis-radius-surface);\n /* The clip is what keeps the first and last rows' hover inside the rounded corners, so\n it belongs to the variants that HAVE corners. `clip` and not `hidden`: `hidden` makes\n the box a scroll container, which captures every `position: sticky` in the content\n and pins it to the accordion instead of the page. */\n overflow: clip;\n }\n\n .v-accordion[data-variant='outline'] {\n background: var(--vectis-color-surface);\n border-color: var(--vectis-color-border);\n }\n\n .v-accordion[data-variant='elevated'] {\n --accordion-corner-radius: var(--vectis-radius-surface);\n\n border: none;\n background: var(--vectis-color-surface-raised);\n box-shadow: var(--vectis-shadow-sm);\n }\n\n /* The usual hover is the muted surface itself, which would vanish on this fill. */\n .v-accordion[data-variant='filled'] {\n --accordion-hover-bg: color-mix(\n in oklab,\n var(--vectis-color-surface-muted),\n var(--vectis-color-text) 4%\n );\n\n background: var(--vectis-color-surface-muted);\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;EA2CA,IAAMO,IAAQC,GAYRC,IAAYC,EAAM;SACxBC,EAAQC,GAAc;GACpB,IAAI,OAAO;IACT,OAAOL,EAAM,WAAW,KAAA,IAAYE;GACtC;GACA,IAAI,aAAa;IACf,OAAOF,EAAM;GACf;GACA,IAAI,eAAe;IACjB,OAAOA,EAAM;GACf;EACF,CAAC,cAICN,EAAA,GAAAC,EAEM,OAAA;GAFD,OAAM;GAAe,gBAAcM,EAAA;EACtCL,GAAAA,CAAAA,EAAQa,EAAA,QAAA,SAAA,CAAA,GAAA,GAAAZ,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","names":["accordionKey"],"sources":["../../../src/components/VAccordion/context.ts"],"sourcesContent":["/** Share group icons through context; compact spacing inherits through CSS variables. */\n\nimport type { InjectionKey } from 'vue'\n\nimport type { IconSource } from '../VIcon/types'\n\nexport interface AccordionContext {\n /** Group name for <details name>; undefined = several items may stay open at once. */\n name: string | undefined\n /** Icon in the closed state: an icon name, or an explicit render. */\n expandIcon: IconSource\n /** Icon in the open state; undefined = a rotation of `expandIcon`. */\n collapseIcon: IconSource | undefined\n}\n\n/**\n * `null` is what an item provides to its own content: an item placed straight inside\n * another one must not join the outer group, since opening it would then close the section\n * that holds it.\n */\nexport const accordionKey: InjectionKey<AccordionContext | null> = Symbol('v-accordion')\n"],"mappings":";AAoBA,IAAaA,IAAsD,OAAO,aAAa"}
1
+ {"version":3,"file":"context.js","names":["accordionKey"],"sources":["../../../src/components/VAccordion/context.ts"],"sourcesContent":["/** Share group icons through context; the density reaches the rows through its token. */\n\nimport type { InjectionKey } from 'vue'\n\nimport type { IconSource } from '../VIcon/types'\n\nexport interface AccordionContext {\n /** Group name for <details name>; undefined = several items may stay open at once. */\n name: string | undefined\n /** Icon in the closed state: an icon name, or an explicit render. */\n expandIcon: IconSource\n /** Icon in the open state; undefined = a rotation of `expandIcon`. */\n collapseIcon: IconSource | undefined\n}\n\n/**\n * `null` is what an item provides to its own content: an item placed straight inside\n * another one must not join the outer group, since opening it would then close the section\n * that holds it.\n */\nexport const accordionKey: InjectionKey<AccordionContext | null> = Symbol('v-accordion')\n"],"mappings":";AAoBA,IAAaA,IAAsD,OAAO,aAAa"}
@@ -31,8 +31,6 @@ interface AvatarProps {
31
31
  * here; on its own it is `md`.
32
32
  */
33
33
  size?: AvatarSize;
34
- /** Takes 4px off the diameter, as it does on every other control. */
35
- compact?: boolean;
36
34
  /**
37
35
  * Turns the avatar into an `<a>` pointing at this address. A disabled link becomes inert:
38
36
  * the address is dropped, so it can be neither focused nor followed.
@@ -59,7 +57,6 @@ declare const __VLS_base: import('vue').DefineComponent<AvatarProps, {}, {}, {},
59
57
  size: AvatarSize;
60
58
  src: string;
61
59
  color: string;
62
- compact: boolean;
63
60
  clickable: boolean;
64
61
  href: string;
65
62
  disabled: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"VAvatar.js","names":["_sfc_main","VAvatar_vue_vue_type_script_setup_true_lang_default","VAvatar_default"],"sources":["../../../src/components/VAvatar/VAvatar.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Resolve image, icon and initials in priority order. JavaScript handles failed images, inert\n * links and merging private colour variables with consumer styles.\n */\n\nimport { computed, inject, onMounted, ref, useAttrs, useSlots, useTemplateRef, watch } from 'vue'\nimport type { StyleValue } from 'vue'\n\nimport VIcon from '../VIcon/VIcon.vue'\nimport { iconProps } from '../VIcon/iconProps'\nimport type { IconSource } from '../VIcon/types'\nimport { AVATAR_DEFAULT_SIZE, avatarGroupKey } from './context'\n\nimport { useAriaLabel } from '../../composables/useAriaLabel'\nimport { useInertLink } from '../../composables/useInertLink'\nimport { customColorStyle } from '../../utils/css'\nimport { isDev } from '../../utils/env'\n\n/** The diameter of the disc, from the control size scale. */\nexport type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n\ninterface AvatarProps {\n /**\n * The picture to show. It is what the avatar prefers above everything else, and an image\n * that fails to load hands over to the icon or the initials rather than leaving a gap.\n */\n src?: string\n /**\n * The icon to show when there is no picture. It comes before the initials, so an avatar\n * given both an icon and a name shows the icon.\n */\n icon?: IconSource\n /** The person's full name. */\n name?: string\n /**\n * The accessible name, when it should not simply be `name`: an avatar standing for a team\n * rather than a person, say. It wins over `name`, and a consumer `aria-label` wins over it.\n */\n alt?: string\n /**\n * A colour of your own, as a hex value, a CSS colour name or an `oklch()`. It REPLACES the\n * hue otherwise derived from `name`, and the text on it is always white, so a light colour\n * is the consumer's own risk.\n */\n color?: string\n /**\n * The diameter of the disc, from the size scale shared by every control. Leaving it out\n * inside a VAvatarGroup takes the group's size, which is the point of not defaulting it\n * here; on its own it is `md`.\n */\n size?: AvatarSize\n /** Takes 4px off the diameter, as it does on every other control. */\n compact?: boolean\n /**\n * Turns the avatar into an `<a>` pointing at this address. A disabled link becomes inert:\n * the address is dropped, so it can be neither focused nor followed.\n */\n href?: string\n /**\n * Turns the avatar into a `<button>`. It is ignored as soon as `href` makes it a link.\n * A VTooltip wrapping the avatar reaches this button through fallthrough.\n */\n clickable?: boolean\n /**\n * Makes an interactive avatar unusable: it stops responding, leaves the tab order and greys\n * out. It says nothing on a plain avatar, which was never interactive to begin with.\n */\n disabled?: boolean\n}\n\nconst props = withDefaults(defineProps<AvatarProps>(), {\n src: undefined,\n icon: undefined,\n name: undefined,\n alt: undefined,\n color: undefined,\n size: undefined,\n compact: false,\n href: undefined,\n clickable: false,\n disabled: false,\n})\n\ndefineSlots<{\n /** Fallback content (replaces the initials), e.g. VAvatarGroup's \"+X\". */\n default?(): unknown\n}>()\n\ndefineOptions({ inheritAttrs: false })\n\nconst attrs = useAttrs()\nconst group = inject(avatarGroupKey, null)\n\n// The size is the avatar's own answer first, then the group's; the density is cumulative,\n// the two terms written out in context.ts.\nconst resolvedSize = computed<AvatarSize>(() => props.size ?? group?.size ?? AVATAR_DEFAULT_SIZE)\nconst resolvedCompact = computed(() => props.compact || Boolean(group?.compact))\n\n// Fallthrough without `style`, which rootStyle merges with the component's own; the click\n// handler is also dropped on an inert link.\nconst {\n isLink,\n isInertLink,\n linkHref,\n attrs: passedAttrs,\n} = useInertLink({\n href: () => props.href,\n inert: () => props.disabled,\n attrs: () => Object.fromEntries(Object.entries(attrs).filter(([key]) => key !== 'style')),\n})\n\nconst isInteractive = computed(() => isLink.value || props.clickable)\nconst tag = computed(() => (isLink.value ? 'a' : props.clickable ? 'button' : 'span'))\n\n// @core\n// The image failed to load: the initials take over, so an avatar is never an empty box.\nconst failed = ref(false)\nwatch(\n () => props.src,\n () => {\n failed.value = false\n },\n)\nconst showImage = computed(() => Boolean(props.src) && !failed.value)\n\n/*\n * On a server-rendered page the browser may give up on the picture before hydration attaches\n * `@error`, and that event is never sent again: the disc would stay an empty circle. A picture\n * already settled with no pixels at mount is one that failed.\n */\nconst imageEl = useTemplateRef<HTMLImageElement>('image')\nonMounted(() => {\n const img = imageEl.value\n if (img?.complete && img.naturalWidth === 0) failed.value = true\n})\n\n// @a11y\n/*\n * The name bound on the root: a consumer `aria-labelledby` removes it, a consumer `aria-label`\n * replaces it, and otherwise it is `alt`, then `name`. A picture on show carries that name as\n * its own `alt`, so the root then names itself only with what the consumer wrote.\n */\nconst ariaLabel = useAriaLabel(() => (showImage.value ? undefined : (props.alt ?? props.name)))\nconst named = computed(() => ariaLabel.value !== undefined || attrs['aria-labelledby'] != null)\n\n// @core\nconst initials = computed(() => {\n if (!props.name) return ''\n /* Whole characters, not UTF-16 halves: `part[0]` of \"😀\" is a lone surrogate, drawn as a\n replacement box. And `toUpperCase` rather than its locale-aware sibling, whose answer\n depends on the runtime's locale, which the server and the browser need not share. */\n return props.name\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((part) => [...part][0]?.toUpperCase() ?? '')\n .join('')\n})\n\n// @core\n/*\n * Only the hue is inline (a unitless scalar); the CSS composes background/text with L/C fixed\n * per theme (light/dark adaptation without depending on contrast-color). A colour computed\n * outside the tokens, a deliberate exception.\n */\nconst hue = computed(() => {\n if (!props.name) return null\n let hash = 0\n for (let i = 0; i < props.name.length; i++) {\n hash = (hash * 31 + props.name.charCodeAt(i)) | 0\n }\n return Math.abs(hash) % 360\n})\nconst isAuto = computed(() => props.color === undefined && hue.value !== null)\n\n// @a11y\n// A static avatar with no picture is an image named by `alt`/ `name`. Anything else keeps the\n// role that arrived in the attributes; `link` on an inert link, a consumer's own otherwise.\nconst role = computed(() =>\n !isInteractive.value && !showImage.value && named.value\n ? 'img'\n : (passedAttrs.value.role as string | undefined),\n)\n\n// @devwarn\n// A button or a link named by nothing: no `name`, no `alt`, no `aria-*` and no slot text. A\n// picture alone does not count, its `alt` coming from the same two props.\nif (isDev) {\n const slots = useSlots()\n onMounted(() => {\n if (isInteractive.value && !named.value && !props.alt && !props.name && !slots.default) {\n console.warn(\n '[VAvatar] a clickable or linked avatar needs an accessible name: set `name`, `alt` or `aria-label`.',\n )\n }\n })\n}\n\nconst rootStyle = computed<StyleValue>(() => [\n customColorStyle(props.color) ??\n (isAuto.value ? { '--avatar-hue': String(hue.value) } : undefined),\n attrs.style as StyleValue,\n])\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :aria-disabled=\"isInertLink ? 'true' : undefined\"\n v-bind=\"passedAttrs\"\n class=\"v-avatar v-control\"\n :style=\"rootStyle\"\n :data-size=\"resolvedSize\"\n :data-compact=\"resolvedCompact ? '' : undefined\"\n :data-custom=\"color !== undefined ? '' : undefined\"\n :data-auto=\"isAuto ? '' : undefined\"\n :href=\"linkHref\"\n :type=\"tag === 'button' ? 'button' : undefined\"\n :disabled=\"tag === 'button' ? disabled : undefined\"\n :role=\"role\"\n :aria-label=\"ariaLabel\"\n >\n <img\n v-if=\"showImage\"\n ref=\"image\"\n class=\"v-avatar-image\"\n :src=\"src\"\n :alt=\"alt ?? name ?? ''\"\n @error=\"failed = true\"\n />\n <VIcon v-else-if=\"icon\" v-bind=\"iconProps(icon)\" class=\"v-avatar-icon\" />\n <slot v-else>\n <span class=\"v-avatar-initials\" aria-hidden=\"true\">{{ initials }}</span>\n </slot>\n </component>\n</template>\n\n<style>\n@layer vectis.components {\n .v-avatar {\n --avatar-bg: var(--vectis-color-surface-muted);\n --avatar-text: var(--vectis-color-text-muted);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n inline-size: var(--control-height);\n block-size: var(--control-height);\n flex: none;\n overflow: hidden;\n padding: 0;\n border: none;\n background: var(--avatar-bg);\n color: var(--avatar-text);\n border-radius: var(--vectis-radius-pill);\n font-family: var(--vectis-text-family);\n font-size: var(--control-font-size);\n font-weight: var(--vectis-font-weight-semibold);\n line-height: var(--vectis-text-control-leading);\n text-decoration: none;\n user-select: none;\n /*\n * The `transparent` fallback is what lets a lone avatar render ringless, and it is also\n * what makes a divergence silent: rename it on one side and the discs in a group simply\n * stop being separated, with no error and nothing missing from the box.\n */\n box-shadow: 0 0 0 var(--vectis-control-size-avatar-ring) var(--avatar-ring-color, transparent);\n transition:\n background-color var(--vectis-duration-fast) var(--vectis-ease-default),\n box-shadow var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n /*\n * The lightness/chroma pairs are set on the THEME scopes and inherited, rather than written\n * in a `[data-theme='dark'] .v-avatar` rule: a descendant selector matches ANY dark ancestor,\n * so a light subtree nested in a dark page kept the dark discs. An inherited value is\n * resolved by the NEAREST scope, which is exactly how the semantic tokens behave.\n */\n :root,\n [data-theme='light'] {\n --avatar-auto-bg-lc: 0.9 0.06;\n --avatar-auto-text-lc: 0.42 0.13;\n }\n\n [data-theme='dark'] {\n --avatar-auto-bg-lc: 0.42 0.09;\n --avatar-auto-text-lc: 0.92 0.05;\n }\n\n .v-avatar[data-auto] {\n --avatar-bg: oklch(var(--avatar-auto-bg-lc) var(--avatar-hue));\n --avatar-text: oklch(var(--avatar-auto-text-lc) var(--avatar-hue));\n }\n\n /* Custom colour (--custom-color inline): wins, with a fixed white text (contrast\n is the consumer's responsibility). */\n .v-avatar[data-custom] {\n --avatar-bg: var(--custom-color);\n --avatar-text: var(--vectis-color-text-on-accent);\n }\n\n .v-avatar-image {\n inline-size: 100%;\n block-size: 100%;\n object-fit: cover;\n }\n\n .v-avatar-icon {\n --vectis-icon-size: calc(var(--control-height) * 0.55);\n }\n\n :is(a, button).v-avatar {\n cursor: pointer;\n }\n\n :is(a, button).v-avatar:hover:not([aria-disabled='true'], :disabled) {\n background: color-mix(in oklab, var(--avatar-bg), var(--vectis-color-text) 10%);\n }\n\n :is(a, button).v-avatar:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: var(--vectis-focus-ring-offset);\n }\n\n .v-avatar:is(:disabled, [aria-disabled='true']) {\n cursor: not-allowed;\n background: var(--vectis-color-surface-muted);\n color: var(--vectis-color-text-subtle);\n }\n\n @media (prefers-reduced-motion: reduce) {\n .v-avatar {\n transition: none;\n }\n }\n\n /* The outline gives each disc its circle back; the focus ring, at (0,2,0), still wins over it. */\n @media (forced-colors: active) {\n .v-avatar {\n outline: var(--vectis-control-border-width) solid CanvasText;\n outline-offset: calc(-1 * var(--vectis-control-border-width));\n }\n }\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"VAvatar.js","names":["_sfc_main","VAvatar_vue_vue_type_script_setup_true_lang_default","VAvatar_default"],"sources":["../../../src/components/VAvatar/VAvatar.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Resolve image, icon and initials in priority order. JavaScript handles failed images, inert\n * links and merging private colour variables with consumer styles.\n */\n\nimport { computed, inject, onMounted, ref, useAttrs, useSlots, useTemplateRef, watch } from 'vue'\nimport type { StyleValue } from 'vue'\n\nimport VIcon from '../VIcon/VIcon.vue'\nimport { iconProps } from '../VIcon/iconProps'\nimport type { IconSource } from '../VIcon/types'\nimport { AVATAR_DEFAULT_SIZE, avatarGroupKey } from './context'\n\nimport { useAriaLabel } from '../../composables/useAriaLabel'\nimport { useInertLink } from '../../composables/useInertLink'\nimport { customColorStyle } from '../../utils/css'\nimport { isDev } from '../../utils/env'\n\n/** The diameter of the disc, from the control size scale. */\nexport type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n\ninterface AvatarProps {\n /**\n * The picture to show. It is what the avatar prefers above everything else, and an image\n * that fails to load hands over to the icon or the initials rather than leaving a gap.\n */\n src?: string\n /**\n * The icon to show when there is no picture. It comes before the initials, so an avatar\n * given both an icon and a name shows the icon.\n */\n icon?: IconSource\n /** The person's full name. */\n name?: string\n /**\n * The accessible name, when it should not simply be `name`: an avatar standing for a team\n * rather than a person, say. It wins over `name`, and a consumer `aria-label` wins over it.\n */\n alt?: string\n /**\n * A colour of your own, as a hex value, a CSS colour name or an `oklch()`. It REPLACES the\n * hue otherwise derived from `name`, and the text on it is always white, so a light colour\n * is the consumer's own risk.\n */\n color?: string\n /**\n * The diameter of the disc, from the size scale shared by every control. Leaving it out\n * inside a VAvatarGroup takes the group's size, which is the point of not defaulting it\n * here; on its own it is `md`.\n */\n size?: AvatarSize\n /**\n * Turns the avatar into an `<a>` pointing at this address. A disabled link becomes inert:\n * the address is dropped, so it can be neither focused nor followed.\n */\n href?: string\n /**\n * Turns the avatar into a `<button>`. It is ignored as soon as `href` makes it a link.\n * A VTooltip wrapping the avatar reaches this button through fallthrough.\n */\n clickable?: boolean\n /**\n * Makes an interactive avatar unusable: it stops responding, leaves the tab order and greys\n * out. It says nothing on a plain avatar, which was never interactive to begin with.\n */\n disabled?: boolean\n}\n\nconst props = withDefaults(defineProps<AvatarProps>(), {\n src: undefined,\n icon: undefined,\n name: undefined,\n alt: undefined,\n color: undefined,\n size: undefined,\n href: undefined,\n clickable: false,\n disabled: false,\n})\n\ndefineSlots<{\n /** Fallback content (replaces the initials), e.g. VAvatarGroup's \"+X\". */\n default?(): unknown\n}>()\n\ndefineOptions({ inheritAttrs: false })\n\nconst attrs = useAttrs()\nconst group = inject(avatarGroupKey, null)\n\n// The size is the avatar's own answer first, then the group's (context.ts).\nconst resolvedSize = computed<AvatarSize>(() => props.size ?? group?.size ?? AVATAR_DEFAULT_SIZE)\n\n// Fallthrough without `style`, which rootStyle merges with the component's own; the click\n// handler is also dropped on an inert link.\nconst {\n isLink,\n isInertLink,\n linkHref,\n attrs: passedAttrs,\n} = useInertLink({\n href: () => props.href,\n inert: () => props.disabled,\n attrs: () => Object.fromEntries(Object.entries(attrs).filter(([key]) => key !== 'style')),\n})\n\nconst isInteractive = computed(() => isLink.value || props.clickable)\nconst tag = computed(() => (isLink.value ? 'a' : props.clickable ? 'button' : 'span'))\n\n// @core\n// The image failed to load: the initials take over, so an avatar is never an empty box.\nconst failed = ref(false)\nwatch(\n () => props.src,\n () => {\n failed.value = false\n },\n)\nconst showImage = computed(() => Boolean(props.src) && !failed.value)\n\n/*\n * On a server-rendered page the browser may give up on the picture before hydration attaches\n * `@error`, and that event is never sent again: the disc would stay an empty circle. A picture\n * already settled with no pixels at mount is one that failed.\n */\nconst imageEl = useTemplateRef<HTMLImageElement>('image')\nonMounted(() => {\n const img = imageEl.value\n if (img?.complete && img.naturalWidth === 0) failed.value = true\n})\n\n// @a11y\n/*\n * The name bound on the root: a consumer `aria-labelledby` removes it, a consumer `aria-label`\n * replaces it, and otherwise it is `alt`, then `name`. A picture on show carries that name as\n * its own `alt`, so the root then names itself only with what the consumer wrote.\n */\nconst ariaLabel = useAriaLabel(() => (showImage.value ? undefined : (props.alt ?? props.name)))\nconst named = computed(() => ariaLabel.value !== undefined || attrs['aria-labelledby'] != null)\n\n// @core\nconst initials = computed(() => {\n if (!props.name) return ''\n /* Whole characters, not UTF-16 halves: `part[0]` of \"😀\" is a lone surrogate, drawn as a\n replacement box. And `toUpperCase` rather than its locale-aware sibling, whose answer\n depends on the runtime's locale, which the server and the browser need not share. */\n return props.name\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((part) => [...part][0]?.toUpperCase() ?? '')\n .join('')\n})\n\n// @core\n/*\n * Only the hue is inline (a unitless scalar); the CSS composes background/text with L/C fixed\n * per theme (light/dark adaptation without depending on contrast-color). A colour computed\n * outside the tokens, a deliberate exception.\n */\nconst hue = computed(() => {\n if (!props.name) return null\n let hash = 0\n for (let i = 0; i < props.name.length; i++) {\n hash = (hash * 31 + props.name.charCodeAt(i)) | 0\n }\n return Math.abs(hash) % 360\n})\nconst isAuto = computed(() => props.color === undefined && hue.value !== null)\n\n// @a11y\n// A static avatar with no picture is an image named by `alt`/ `name`. Anything else keeps the\n// role that arrived in the attributes; `link` on an inert link, a consumer's own otherwise.\nconst role = computed(() =>\n !isInteractive.value && !showImage.value && named.value\n ? 'img'\n : (passedAttrs.value.role as string | undefined),\n)\n\n// @devwarn\n// A button or a link named by nothing: no `name`, no `alt`, no `aria-*` and no slot text. A\n// picture alone does not count, its `alt` coming from the same two props.\nif (isDev) {\n const slots = useSlots()\n onMounted(() => {\n if (isInteractive.value && !named.value && !props.alt && !props.name && !slots.default) {\n console.warn(\n '[VAvatar] a clickable or linked avatar needs an accessible name: set `name`, `alt` or `aria-label`.',\n )\n }\n })\n}\n\nconst rootStyle = computed<StyleValue>(() => [\n customColorStyle(props.color) ??\n (isAuto.value ? { '--avatar-hue': String(hue.value) } : undefined),\n attrs.style as StyleValue,\n])\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :aria-disabled=\"isInertLink ? 'true' : undefined\"\n v-bind=\"passedAttrs\"\n class=\"v-avatar v-control\"\n :style=\"rootStyle\"\n :data-size=\"resolvedSize\"\n :data-custom=\"color !== undefined ? '' : undefined\"\n :data-auto=\"isAuto ? '' : undefined\"\n :href=\"linkHref\"\n :type=\"tag === 'button' ? 'button' : undefined\"\n :disabled=\"tag === 'button' ? disabled : undefined\"\n :role=\"role\"\n :aria-label=\"ariaLabel\"\n >\n <img\n v-if=\"showImage\"\n ref=\"image\"\n class=\"v-avatar-image\"\n :src=\"src\"\n :alt=\"alt ?? name ?? ''\"\n @error=\"failed = true\"\n />\n <VIcon v-else-if=\"icon\" v-bind=\"iconProps(icon)\" class=\"v-avatar-icon\" />\n <slot v-else>\n <span class=\"v-avatar-initials\" aria-hidden=\"true\">{{ initials }}</span>\n </slot>\n </component>\n</template>\n\n<style>\n@layer vectis.components {\n .v-avatar {\n --avatar-bg: var(--vectis-color-surface-muted);\n --avatar-text: var(--vectis-color-text-muted);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n inline-size: var(--control-height);\n block-size: var(--control-height);\n flex: none;\n overflow: hidden;\n padding: 0;\n border: none;\n background: var(--avatar-bg);\n color: var(--avatar-text);\n border-radius: var(--vectis-radius-pill);\n font-family: var(--vectis-text-family);\n font-size: var(--control-font-size);\n font-weight: var(--vectis-font-weight-semibold);\n line-height: var(--vectis-text-control-leading);\n text-decoration: none;\n user-select: none;\n /*\n * The `transparent` fallback is what lets a lone avatar render ringless, and it is also\n * what makes a divergence silent: rename it on one side and the discs in a group simply\n * stop being separated, with no error and nothing missing from the box.\n */\n box-shadow: 0 0 0 var(--vectis-control-size-avatar-ring) var(--avatar-ring-color, transparent);\n transition:\n background-color var(--vectis-duration-fast) var(--vectis-ease-default),\n box-shadow var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n /*\n * The lightness/chroma pairs are set on the THEME scopes and inherited, rather than written\n * in a `[data-theme='dark'] .v-avatar` rule: a descendant selector matches ANY dark ancestor,\n * so a light subtree nested in a dark page kept the dark discs. An inherited value is\n * resolved by the NEAREST scope, which is exactly how the semantic tokens behave.\n */\n :root,\n [data-theme='light'] {\n --avatar-auto-bg-lc: 0.9 0.06;\n --avatar-auto-text-lc: 0.42 0.13;\n }\n\n [data-theme='dark'] {\n --avatar-auto-bg-lc: 0.42 0.09;\n --avatar-auto-text-lc: 0.92 0.05;\n }\n\n .v-avatar[data-auto] {\n --avatar-bg: oklch(var(--avatar-auto-bg-lc) var(--avatar-hue));\n --avatar-text: oklch(var(--avatar-auto-text-lc) var(--avatar-hue));\n }\n\n /* Custom colour (--custom-color inline): wins, with a fixed white text (contrast\n is the consumer's responsibility). */\n .v-avatar[data-custom] {\n --avatar-bg: var(--custom-color);\n --avatar-text: var(--vectis-color-text-on-accent);\n }\n\n .v-avatar-image {\n inline-size: 100%;\n block-size: 100%;\n object-fit: cover;\n }\n\n .v-avatar-icon {\n --vectis-icon-size: calc(var(--control-height) * 0.55);\n }\n\n :is(a, button).v-avatar {\n cursor: pointer;\n }\n\n :is(a, button).v-avatar:hover:not([aria-disabled='true'], :disabled) {\n background: color-mix(in oklab, var(--avatar-bg), var(--vectis-color-text) 10%);\n }\n\n :is(a, button).v-avatar:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: var(--vectis-focus-ring-offset);\n }\n\n .v-avatar:is(:disabled, [aria-disabled='true']) {\n cursor: not-allowed;\n background: var(--vectis-color-surface-muted);\n color: var(--vectis-color-text-subtle);\n }\n\n @media (prefers-reduced-motion: reduce) {\n .v-avatar {\n transition: none;\n }\n }\n\n /* The outline gives each disc its circle back; the focus ring, at (0,2,0), still wins over it. */\n @media (forced-colors: active) {\n .v-avatar {\n outline: var(--vectis-control-border-width) solid CanvasText;\n outline-offset: calc(-1 * var(--vectis-control-border-width));\n }\n }\n}\n</style>\n"],"mappings":""}
@@ -20,10 +20,6 @@ var E = ["src", "alt"], D = {
20
20
  alt: { default: void 0 },
21
21
  color: { default: void 0 },
22
22
  size: { default: void 0 },
23
- compact: {
24
- type: Boolean,
25
- default: !1
26
- },
27
23
  href: { default: void 0 },
28
24
  clickable: {
29
25
  type: Boolean,
@@ -35,59 +31,57 @@ var E = ["src", "alt"], D = {
35
31
  }
36
32
  },
37
33
  setup(d) {
38
- let O = d, k = x(), A = f(o, null), j = s(() => O.size ?? A?.size ?? "md"), M = s(() => O.compact || !!A?.compact), { isLink: N, isInertLink: P, linkHref: F, attrs: I } = i({
34
+ let O = d, k = x(), A = f(o, null), j = s(() => O.size ?? A?.size ?? "md"), { isLink: M, isInertLink: N, linkHref: P, attrs: F } = i({
39
35
  href: () => O.href,
40
36
  inert: () => O.disabled,
41
37
  attrs: () => Object.fromEntries(Object.entries(k).filter(([e]) => e !== "style"))
42
- }), L = s(() => N.value || O.clickable), R = s(() => N.value ? "a" : O.clickable ? "button" : "span"), z = g(!1);
38
+ }), I = s(() => M.value || O.clickable), L = s(() => M.value ? "a" : O.clickable ? "button" : "span"), R = g(!1);
43
39
  w(() => O.src, () => {
44
- z.value = !1;
40
+ R.value = !1;
45
41
  });
46
- let B = s(() => !!O.src && !z.value), V = C("image");
42
+ let z = s(() => !!O.src && !R.value), B = C("image");
47
43
  m(() => {
48
- let e = V.value;
49
- e?.complete && e.naturalWidth === 0 && (z.value = !0);
44
+ let e = B.value;
45
+ e?.complete && e.naturalWidth === 0 && (R.value = !0);
50
46
  });
51
- let H = a(() => B.value ? void 0 : O.alt ?? O.name), U = s(() => H.value !== void 0 || k["aria-labelledby"] != null), W = s(() => O.name ? O.name.split(/\s+/).filter(Boolean).slice(0, 2).map((e) => [...e][0]?.toUpperCase() ?? "").join("") : ""), G = s(() => {
47
+ let V = a(() => z.value ? void 0 : O.alt ?? O.name), H = s(() => V.value !== void 0 || k["aria-labelledby"] != null), U = s(() => O.name ? O.name.split(/\s+/).filter(Boolean).slice(0, 2).map((e) => [...e][0]?.toUpperCase() ?? "").join("") : ""), W = s(() => {
52
48
  if (!O.name) return null;
53
49
  let e = 0;
54
50
  for (let t = 0; t < O.name.length; t++) e = e * 31 + O.name.charCodeAt(t) | 0;
55
51
  return Math.abs(e) % 360;
56
- }), K = s(() => O.color === void 0 && G.value !== null), q = s(() => !L.value && !B.value && U.value ? "img" : I.value.role);
52
+ }), G = s(() => O.color === void 0 && W.value !== null), K = s(() => !I.value && !z.value && H.value ? "img" : F.value.role);
57
53
  if (e) {
58
54
  let e = S();
59
55
  m(() => {
60
- L.value && !U.value && !O.alt && !O.name && !e.default && console.warn("[VAvatar] a clickable or linked avatar needs an accessible name: set `name`, `alt` or `aria-label`.");
56
+ I.value && !H.value && !O.alt && !O.name && !e.default && console.warn("[VAvatar] a clickable or linked avatar needs an accessible name: set `name`, `alt` or `aria-label`.");
61
57
  });
62
58
  }
63
- let J = s(() => [n(O.color) ?? (K.value ? { "--avatar-hue": String(G.value) } : void 0), k.style]);
64
- return (e, n) => (h(), c(v(R.value), p({ "aria-disabled": b(P) ? "true" : void 0 }, b(I), {
59
+ let q = s(() => [n(O.color) ?? (G.value ? { "--avatar-hue": String(W.value) } : void 0), k.style]);
60
+ return (e, n) => (h(), c(v(L.value), p({ "aria-disabled": b(N) ? "true" : void 0 }, b(F), {
65
61
  class: "v-avatar v-control",
66
- style: J.value,
62
+ style: q.value,
67
63
  "data-size": j.value,
68
- "data-compact": M.value ? "" : void 0,
69
64
  "data-custom": d.color === void 0 ? void 0 : "",
70
- "data-auto": K.value ? "" : void 0,
71
- href: b(F),
72
- type: R.value === "button" ? "button" : void 0,
73
- disabled: R.value === "button" ? d.disabled : void 0,
74
- role: q.value,
75
- "aria-label": b(H)
65
+ "data-auto": G.value ? "" : void 0,
66
+ href: b(P),
67
+ type: L.value === "button" ? "button" : void 0,
68
+ disabled: L.value === "button" ? d.disabled : void 0,
69
+ role: K.value,
70
+ "aria-label": b(V)
76
71
  }), {
77
- default: T(() => [B.value ? (h(), l("img", {
72
+ default: T(() => [z.value ? (h(), l("img", {
78
73
  key: 0,
79
74
  ref: "image",
80
75
  class: "v-avatar-image",
81
76
  src: d.src,
82
77
  alt: d.alt ?? d.name ?? "",
83
- onError: n[0] ||= (e) => z.value = !0
84
- }, null, 40, E)) : d.icon ? (h(), c(r, p({ key: 1 }, b(t)(d.icon), { class: "v-avatar-icon" }), null, 16)) : _(e.$slots, "default", {}, () => [u("span", D, y(W.value), 1)], void 0, 2)]),
78
+ onError: n[0] ||= (e) => R.value = !0
79
+ }, null, 40, E)) : d.icon ? (h(), c(r, p({ key: 1 }, b(t)(d.icon), { class: "v-avatar-icon" }), null, 16)) : _(e.$slots, "default", {}, () => [u("span", D, y(U.value), 1)], void 0, 2)]),
85
80
  _: 3
86
81
  }, 16, [
87
82
  "aria-disabled",
88
83
  "style",
89
84
  "data-size",
90
- "data-compact",
91
85
  "data-custom",
92
86
  "data-auto",
93
87
  "href",
@@ -1 +1 @@
1
- {"version":3,"file":"VAvatar.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_withCtx","_createElementBlock","VIcon","_renderSlot","_createElementVNode","_toDisplayString","VIcon_default","_hoisted_1","_hoisted_2","VAvatar_vue_vue_type_script_setup_true_lang_default","props","__props","attrs","useAttrs","group","inject","avatarGroupKey","resolvedSize","computed","resolvedCompact","passedAttrs","useInertLink","key","isInteractive","isLink","tag","failed","ref","showImage","imageEl","useTemplateRef","img","ariaLabel","useAriaLabel","named","initials","part","hue","hash","i","isAuto","role","isDev","slots","useSlots","rootStyle","customColorStyle","openBlock","createBlock","resolveDynamicComponent","mergeProps","unref","isInertLink","linkHref","withCtx","createElementBlock","_cache","iconProps","renderSlot","_ctx","createElementVNode","toDisplayString"],"sources":["../../../src/components/VAvatar/VAvatar.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Resolve image, icon and initials in priority order. JavaScript handles failed images, inert\n * links and merging private colour variables with consumer styles.\n */\n\nimport { computed, inject, onMounted, ref, useAttrs, useSlots, useTemplateRef, watch } from 'vue'\nimport type { StyleValue } from 'vue'\n\nimport VIcon from '../VIcon/VIcon.vue'\nimport { iconProps } from '../VIcon/iconProps'\nimport type { IconSource } from '../VIcon/types'\nimport { AVATAR_DEFAULT_SIZE, avatarGroupKey } from './context'\n\nimport { useAriaLabel } from '../../composables/useAriaLabel'\nimport { useInertLink } from '../../composables/useInertLink'\nimport { customColorStyle } from '../../utils/css'\nimport { isDev } from '../../utils/env'\n\n/** The diameter of the disc, from the control size scale. */\nexport type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n\ninterface AvatarProps {\n /**\n * The picture to show. It is what the avatar prefers above everything else, and an image\n * that fails to load hands over to the icon or the initials rather than leaving a gap.\n */\n src?: string\n /**\n * The icon to show when there is no picture. It comes before the initials, so an avatar\n * given both an icon and a name shows the icon.\n */\n icon?: IconSource\n /** The person's full name. */\n name?: string\n /**\n * The accessible name, when it should not simply be `name`: an avatar standing for a team\n * rather than a person, say. It wins over `name`, and a consumer `aria-label` wins over it.\n */\n alt?: string\n /**\n * A colour of your own, as a hex value, a CSS colour name or an `oklch()`. It REPLACES the\n * hue otherwise derived from `name`, and the text on it is always white, so a light colour\n * is the consumer's own risk.\n */\n color?: string\n /**\n * The diameter of the disc, from the size scale shared by every control. Leaving it out\n * inside a VAvatarGroup takes the group's size, which is the point of not defaulting it\n * here; on its own it is `md`.\n */\n size?: AvatarSize\n /** Takes 4px off the diameter, as it does on every other control. */\n compact?: boolean\n /**\n * Turns the avatar into an `<a>` pointing at this address. A disabled link becomes inert:\n * the address is dropped, so it can be neither focused nor followed.\n */\n href?: string\n /**\n * Turns the avatar into a `<button>`. It is ignored as soon as `href` makes it a link.\n * A VTooltip wrapping the avatar reaches this button through fallthrough.\n */\n clickable?: boolean\n /**\n * Makes an interactive avatar unusable: it stops responding, leaves the tab order and greys\n * out. It says nothing on a plain avatar, which was never interactive to begin with.\n */\n disabled?: boolean\n}\n\nconst props = withDefaults(defineProps<AvatarProps>(), {\n src: undefined,\n icon: undefined,\n name: undefined,\n alt: undefined,\n color: undefined,\n size: undefined,\n compact: false,\n href: undefined,\n clickable: false,\n disabled: false,\n})\n\ndefineSlots<{\n /** Fallback content (replaces the initials), e.g. VAvatarGroup's \"+X\". */\n default?(): unknown\n}>()\n\ndefineOptions({ inheritAttrs: false })\n\nconst attrs = useAttrs()\nconst group = inject(avatarGroupKey, null)\n\n// The size is the avatar's own answer first, then the group's; the density is cumulative,\n// the two terms written out in context.ts.\nconst resolvedSize = computed<AvatarSize>(() => props.size ?? group?.size ?? AVATAR_DEFAULT_SIZE)\nconst resolvedCompact = computed(() => props.compact || Boolean(group?.compact))\n\n// Fallthrough without `style`, which rootStyle merges with the component's own; the click\n// handler is also dropped on an inert link.\nconst {\n isLink,\n isInertLink,\n linkHref,\n attrs: passedAttrs,\n} = useInertLink({\n href: () => props.href,\n inert: () => props.disabled,\n attrs: () => Object.fromEntries(Object.entries(attrs).filter(([key]) => key !== 'style')),\n})\n\nconst isInteractive = computed(() => isLink.value || props.clickable)\nconst tag = computed(() => (isLink.value ? 'a' : props.clickable ? 'button' : 'span'))\n\n// @core\n// The image failed to load: the initials take over, so an avatar is never an empty box.\nconst failed = ref(false)\nwatch(\n () => props.src,\n () => {\n failed.value = false\n },\n)\nconst showImage = computed(() => Boolean(props.src) && !failed.value)\n\n/*\n * On a server-rendered page the browser may give up on the picture before hydration attaches\n * `@error`, and that event is never sent again: the disc would stay an empty circle. A picture\n * already settled with no pixels at mount is one that failed.\n */\nconst imageEl = useTemplateRef<HTMLImageElement>('image')\nonMounted(() => {\n const img = imageEl.value\n if (img?.complete && img.naturalWidth === 0) failed.value = true\n})\n\n// @a11y\n/*\n * The name bound on the root: a consumer `aria-labelledby` removes it, a consumer `aria-label`\n * replaces it, and otherwise it is `alt`, then `name`. A picture on show carries that name as\n * its own `alt`, so the root then names itself only with what the consumer wrote.\n */\nconst ariaLabel = useAriaLabel(() => (showImage.value ? undefined : (props.alt ?? props.name)))\nconst named = computed(() => ariaLabel.value !== undefined || attrs['aria-labelledby'] != null)\n\n// @core\nconst initials = computed(() => {\n if (!props.name) return ''\n /* Whole characters, not UTF-16 halves: `part[0]` of \"😀\" is a lone surrogate, drawn as a\n replacement box. And `toUpperCase` rather than its locale-aware sibling, whose answer\n depends on the runtime's locale, which the server and the browser need not share. */\n return props.name\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((part) => [...part][0]?.toUpperCase() ?? '')\n .join('')\n})\n\n// @core\n/*\n * Only the hue is inline (a unitless scalar); the CSS composes background/text with L/C fixed\n * per theme (light/dark adaptation without depending on contrast-color). A colour computed\n * outside the tokens, a deliberate exception.\n */\nconst hue = computed(() => {\n if (!props.name) return null\n let hash = 0\n for (let i = 0; i < props.name.length; i++) {\n hash = (hash * 31 + props.name.charCodeAt(i)) | 0\n }\n return Math.abs(hash) % 360\n})\nconst isAuto = computed(() => props.color === undefined && hue.value !== null)\n\n// @a11y\n// A static avatar with no picture is an image named by `alt`/ `name`. Anything else keeps the\n// role that arrived in the attributes; `link` on an inert link, a consumer's own otherwise.\nconst role = computed(() =>\n !isInteractive.value && !showImage.value && named.value\n ? 'img'\n : (passedAttrs.value.role as string | undefined),\n)\n\n// @devwarn\n// A button or a link named by nothing: no `name`, no `alt`, no `aria-*` and no slot text. A\n// picture alone does not count, its `alt` coming from the same two props.\nif (isDev) {\n const slots = useSlots()\n onMounted(() => {\n if (isInteractive.value && !named.value && !props.alt && !props.name && !slots.default) {\n console.warn(\n '[VAvatar] a clickable or linked avatar needs an accessible name: set `name`, `alt` or `aria-label`.',\n )\n }\n })\n}\n\nconst rootStyle = computed<StyleValue>(() => [\n customColorStyle(props.color) ??\n (isAuto.value ? { '--avatar-hue': String(hue.value) } : undefined),\n attrs.style as StyleValue,\n])\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :aria-disabled=\"isInertLink ? 'true' : undefined\"\n v-bind=\"passedAttrs\"\n class=\"v-avatar v-control\"\n :style=\"rootStyle\"\n :data-size=\"resolvedSize\"\n :data-compact=\"resolvedCompact ? '' : undefined\"\n :data-custom=\"color !== undefined ? '' : undefined\"\n :data-auto=\"isAuto ? '' : undefined\"\n :href=\"linkHref\"\n :type=\"tag === 'button' ? 'button' : undefined\"\n :disabled=\"tag === 'button' ? disabled : undefined\"\n :role=\"role\"\n :aria-label=\"ariaLabel\"\n >\n <img\n v-if=\"showImage\"\n ref=\"image\"\n class=\"v-avatar-image\"\n :src=\"src\"\n :alt=\"alt ?? name ?? ''\"\n @error=\"failed = true\"\n />\n <VIcon v-else-if=\"icon\" v-bind=\"iconProps(icon)\" class=\"v-avatar-icon\" />\n <slot v-else>\n <span class=\"v-avatar-initials\" aria-hidden=\"true\">{{ initials }}</span>\n </slot>\n </component>\n</template>\n\n<style>\n@layer vectis.components {\n .v-avatar {\n --avatar-bg: var(--vectis-color-surface-muted);\n --avatar-text: var(--vectis-color-text-muted);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n inline-size: var(--control-height);\n block-size: var(--control-height);\n flex: none;\n overflow: hidden;\n padding: 0;\n border: none;\n background: var(--avatar-bg);\n color: var(--avatar-text);\n border-radius: var(--vectis-radius-pill);\n font-family: var(--vectis-text-family);\n font-size: var(--control-font-size);\n font-weight: var(--vectis-font-weight-semibold);\n line-height: var(--vectis-text-control-leading);\n text-decoration: none;\n user-select: none;\n /*\n * The `transparent` fallback is what lets a lone avatar render ringless, and it is also\n * what makes a divergence silent: rename it on one side and the discs in a group simply\n * stop being separated, with no error and nothing missing from the box.\n */\n box-shadow: 0 0 0 var(--vectis-control-size-avatar-ring) var(--avatar-ring-color, transparent);\n transition:\n background-color var(--vectis-duration-fast) var(--vectis-ease-default),\n box-shadow var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n /*\n * The lightness/chroma pairs are set on the THEME scopes and inherited, rather than written\n * in a `[data-theme='dark'] .v-avatar` rule: a descendant selector matches ANY dark ancestor,\n * so a light subtree nested in a dark page kept the dark discs. An inherited value is\n * resolved by the NEAREST scope, which is exactly how the semantic tokens behave.\n */\n :root,\n [data-theme='light'] {\n --avatar-auto-bg-lc: 0.9 0.06;\n --avatar-auto-text-lc: 0.42 0.13;\n }\n\n [data-theme='dark'] {\n --avatar-auto-bg-lc: 0.42 0.09;\n --avatar-auto-text-lc: 0.92 0.05;\n }\n\n .v-avatar[data-auto] {\n --avatar-bg: oklch(var(--avatar-auto-bg-lc) var(--avatar-hue));\n --avatar-text: oklch(var(--avatar-auto-text-lc) var(--avatar-hue));\n }\n\n /* Custom colour (--custom-color inline): wins, with a fixed white text (contrast\n is the consumer's responsibility). */\n .v-avatar[data-custom] {\n --avatar-bg: var(--custom-color);\n --avatar-text: var(--vectis-color-text-on-accent);\n }\n\n .v-avatar-image {\n inline-size: 100%;\n block-size: 100%;\n object-fit: cover;\n }\n\n .v-avatar-icon {\n --vectis-icon-size: calc(var(--control-height) * 0.55);\n }\n\n :is(a, button).v-avatar {\n cursor: pointer;\n }\n\n :is(a, button).v-avatar:hover:not([aria-disabled='true'], :disabled) {\n background: color-mix(in oklab, var(--avatar-bg), var(--vectis-color-text) 10%);\n }\n\n :is(a, button).v-avatar:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: var(--vectis-focus-ring-offset);\n }\n\n .v-avatar:is(:disabled, [aria-disabled='true']) {\n cursor: not-allowed;\n background: var(--vectis-color-surface-muted);\n color: var(--vectis-color-text-subtle);\n }\n\n @media (prefers-reduced-motion: reduce) {\n .v-avatar {\n transition: none;\n }\n }\n\n /* The outline gives each disc its circle back; the focus ring, at (0,2,0), still wins over it. */\n @media (forced-colors: active) {\n .v-avatar {\n outline: var(--vectis-control-border-width) solid CanvasText;\n outline-offset: calc(-1 * var(--vectis-control-border-width));\n }\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuEA,IAAMe,IAAQC,GAoBRC,IAAQC,EAAS,GACjBC,IAAQC,EAAOC,GAAgB,IAAI,GAInCC,IAAeC,QAA2BR,EAAM,QAAQI,GAAO,QAAA,IAA2B,GAC1FK,IAAkBD,QAAeR,EAAM,WAAW,EAAQI,GAAO,OAAQ,GAIzE,EACJ,WACA,gBACA,aACA,OAAOM,MACLC,EAAa;GACf,YAAYX,EAAM;GAClB,aAAaA,EAAM;GACnB,aAAa,OAAO,YAAY,OAAO,QAAQE,CAAK,CAAC,CAAC,QAAQ,CAACU,OAASA,MAAQ,OAAO,CAAC;EAC1F,CAAC,GAEKC,IAAgBL,QAAeM,EAAO,SAASd,EAAM,SAAS,GAC9De,IAAMP,QAAgBM,EAAO,QAAQ,MAAMd,EAAM,YAAY,WAAW,MAAO,GAI/EgB,IAASC,EAAI,EAAK;EACxB,QACQjB,EAAM,WACN;GACJ,EAAO,QAAQ;EACjB,CACF;EACA,IAAMkB,IAAYV,QAAe,EAAQR,EAAM,OAAQ,CAACgB,EAAO,KAAK,GAO9DG,IAAUC,EAAiC,OAAO;EACxD,QAAgB;GACd,IAAMC,IAAMF,EAAQ;GACpB,AAAIE,GAAK,YAAYA,EAAI,iBAAiB,MAAG,EAAO,QAAQ;EAC9D,CAAC;EAQD,IAAMC,IAAYC,QAAoBL,EAAU,QAAQ,KAAA,IAAalB,EAAM,OAAOA,EAAM,IAAM,GACxFwB,IAAQhB,QAAec,EAAU,UAAU,KAAA,KAAapB,EAAM,sBAAsB,IAAI,GAGxFuB,IAAWjB,QACVR,EAAM,OAIJA,EAAM,KACV,MAAM,KAAK,CAAA,CACX,OAAO,OAAO,CAAA,CACd,MAAM,GAAG,CAAC,CAAA,CACV,KAAK,MAAS,CAAC,GAAG0B,CAAI,CAAC,CAAC,EAAE,EAAE,YAAY,KAAK,EAAE,CAAA,CAC/C,KAAK,EAAE,IATc,EAUzB,GAQKC,IAAMnB,QAAe;GACzB,IAAI,CAACR,EAAM,MAAM,OAAO;GACxB,IAAI4B,IAAO;GACX,KAAK,IAAIC,IAAI,GAAGA,IAAI7B,EAAM,KAAK,QAAQ,KACrC,IAAQ4B,IAAO,KAAK5B,EAAM,KAAK,WAAW6B,CAAC,IAAK;GAElD,OAAO,KAAK,IAAID,CAAI,IAAI;EAC1B,CAAC,GACKE,IAAStB,QAAeR,EAAM,UAAU,KAAA,KAAa2B,EAAI,UAAU,IAAI,GAKvEI,IAAOvB,QACX,CAACK,EAAc,SAAS,CAACK,EAAU,SAASM,EAAM,QAC9C,QACCd,EAAY,MAAM,IACzB;EAKA,IAAIsB,GAAO;GACT,IAAMC,IAAQC,EAAS;GACvB,QAAgB;IACd,AAAIrB,EAAc,SAAS,CAACW,EAAM,SAAS,CAACxB,EAAM,OAAO,CAACA,EAAM,QAAQ,CAACiC,EAAM,WAC7E,QAAQ,KACN,qGACF;GAEJ,CAAC;EACH;EAEA,IAAME,IAAY3B,QAA2B,CAC3C4B,EAAiBpC,EAAM,KAAK,MACzB8B,EAAO,QAAQ,EAAE,gBAAgB,OAAOH,EAAI,KAAK,EAAE,IAAI,KAAA,IAC1DzB,EAAM,KACR,CAAC;oBAICjB,EAAA,GAAAC,EA4BYC,EA3BL4B,EAAA,KAAG,GADV3B,EA4BY,EA1BT,iBAAeC,EAAAqD,CAAA,IAAW,SAAY,KAAA,EAC/B,GAAArD,EAAAqB,CAAA,GAAW;GACnB,OAAM;GACL,OAAOyB,EAAA;GACP,aAAW5B,EAAA;GACX,gBAAcE,EAAA,QAAe,KAAQ,KAAA;GACrC,eAAaR,EAAA,UAAU,KAAA,IAAiB,KAAA,IAAR;GAChC,aAAW6B,EAAA,QAAM,KAAQ,KAAA;GACzB,MAAMzC,EAAAsD,CAAA;GACN,MAAM5B,EAAA,UAAG,WAAA,WAA2B,KAAA;GACpC,UAAUA,EAAA,UAAG,WAAgBd,EAAA,WAAW,KAAA;GACxC,MAAM8B,EAAA;GACN,cAAY1C,EAAAiC,CAAA;;GAEb,SAAAhC,QAOE,CANM4B,EAAA,SADRjC,EAAA,GAAAM,EAOE,OAAA;;IALA,KAAI;IACJ,OAAM;IACL,KAAKU,EAAA;IACL,KAAKA,EAAA,OAAOA,EAAA,QAAI;IAChB,SAAK,AAAA6C,EAAA,QAAA,MAAE,EAAA,QAAM;GAEE,GAAA,MAAA,IAAAjD,CAAA,KAAAI,EAAA,QAAlBhB,EAAA,GAAAC,EAAyEM,GAAzEJ,EAAyE,EAAA,KAAA,EAAA,GAAzCC,EAAA0D,CAAA,CAAS,CAAC9C,EAAA,IAAI,GAAA,EAAG,OAAM,gBAAe,CAAA,GAAA,MAAA,EAAA,KACtER,EAEOwD,EAAA,QAAA,WAAA,CAAA,SAAA,CADLvD,EAAwE,QAAxEI,GAAwEH,EAAlB8B,EAAA,KAAQ,GAAA,CAAA,CAAA,GAAA,KAAA,GAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"VAvatar.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_withCtx","_createElementBlock","VIcon","_renderSlot","_createElementVNode","_toDisplayString","VIcon_default","_hoisted_1","_hoisted_2","VAvatar_vue_vue_type_script_setup_true_lang_default","props","__props","attrs","useAttrs","group","inject","avatarGroupKey","resolvedSize","computed","passedAttrs","useInertLink","key","isInteractive","isLink","tag","failed","ref","showImage","imageEl","useTemplateRef","img","ariaLabel","useAriaLabel","named","initials","part","hue","hash","i","isAuto","role","isDev","slots","useSlots","rootStyle","customColorStyle","openBlock","createBlock","resolveDynamicComponent","mergeProps","unref","isInertLink","linkHref","withCtx","createElementBlock","_cache","iconProps","renderSlot","_ctx","createElementVNode","toDisplayString"],"sources":["../../../src/components/VAvatar/VAvatar.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Resolve image, icon and initials in priority order. JavaScript handles failed images, inert\n * links and merging private colour variables with consumer styles.\n */\n\nimport { computed, inject, onMounted, ref, useAttrs, useSlots, useTemplateRef, watch } from 'vue'\nimport type { StyleValue } from 'vue'\n\nimport VIcon from '../VIcon/VIcon.vue'\nimport { iconProps } from '../VIcon/iconProps'\nimport type { IconSource } from '../VIcon/types'\nimport { AVATAR_DEFAULT_SIZE, avatarGroupKey } from './context'\n\nimport { useAriaLabel } from '../../composables/useAriaLabel'\nimport { useInertLink } from '../../composables/useInertLink'\nimport { customColorStyle } from '../../utils/css'\nimport { isDev } from '../../utils/env'\n\n/** The diameter of the disc, from the control size scale. */\nexport type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n\ninterface AvatarProps {\n /**\n * The picture to show. It is what the avatar prefers above everything else, and an image\n * that fails to load hands over to the icon or the initials rather than leaving a gap.\n */\n src?: string\n /**\n * The icon to show when there is no picture. It comes before the initials, so an avatar\n * given both an icon and a name shows the icon.\n */\n icon?: IconSource\n /** The person's full name. */\n name?: string\n /**\n * The accessible name, when it should not simply be `name`: an avatar standing for a team\n * rather than a person, say. It wins over `name`, and a consumer `aria-label` wins over it.\n */\n alt?: string\n /**\n * A colour of your own, as a hex value, a CSS colour name or an `oklch()`. It REPLACES the\n * hue otherwise derived from `name`, and the text on it is always white, so a light colour\n * is the consumer's own risk.\n */\n color?: string\n /**\n * The diameter of the disc, from the size scale shared by every control. Leaving it out\n * inside a VAvatarGroup takes the group's size, which is the point of not defaulting it\n * here; on its own it is `md`.\n */\n size?: AvatarSize\n /**\n * Turns the avatar into an `<a>` pointing at this address. A disabled link becomes inert:\n * the address is dropped, so it can be neither focused nor followed.\n */\n href?: string\n /**\n * Turns the avatar into a `<button>`. It is ignored as soon as `href` makes it a link.\n * A VTooltip wrapping the avatar reaches this button through fallthrough.\n */\n clickable?: boolean\n /**\n * Makes an interactive avatar unusable: it stops responding, leaves the tab order and greys\n * out. It says nothing on a plain avatar, which was never interactive to begin with.\n */\n disabled?: boolean\n}\n\nconst props = withDefaults(defineProps<AvatarProps>(), {\n src: undefined,\n icon: undefined,\n name: undefined,\n alt: undefined,\n color: undefined,\n size: undefined,\n href: undefined,\n clickable: false,\n disabled: false,\n})\n\ndefineSlots<{\n /** Fallback content (replaces the initials), e.g. VAvatarGroup's \"+X\". */\n default?(): unknown\n}>()\n\ndefineOptions({ inheritAttrs: false })\n\nconst attrs = useAttrs()\nconst group = inject(avatarGroupKey, null)\n\n// The size is the avatar's own answer first, then the group's (context.ts).\nconst resolvedSize = computed<AvatarSize>(() => props.size ?? group?.size ?? AVATAR_DEFAULT_SIZE)\n\n// Fallthrough without `style`, which rootStyle merges with the component's own; the click\n// handler is also dropped on an inert link.\nconst {\n isLink,\n isInertLink,\n linkHref,\n attrs: passedAttrs,\n} = useInertLink({\n href: () => props.href,\n inert: () => props.disabled,\n attrs: () => Object.fromEntries(Object.entries(attrs).filter(([key]) => key !== 'style')),\n})\n\nconst isInteractive = computed(() => isLink.value || props.clickable)\nconst tag = computed(() => (isLink.value ? 'a' : props.clickable ? 'button' : 'span'))\n\n// @core\n// The image failed to load: the initials take over, so an avatar is never an empty box.\nconst failed = ref(false)\nwatch(\n () => props.src,\n () => {\n failed.value = false\n },\n)\nconst showImage = computed(() => Boolean(props.src) && !failed.value)\n\n/*\n * On a server-rendered page the browser may give up on the picture before hydration attaches\n * `@error`, and that event is never sent again: the disc would stay an empty circle. A picture\n * already settled with no pixels at mount is one that failed.\n */\nconst imageEl = useTemplateRef<HTMLImageElement>('image')\nonMounted(() => {\n const img = imageEl.value\n if (img?.complete && img.naturalWidth === 0) failed.value = true\n})\n\n// @a11y\n/*\n * The name bound on the root: a consumer `aria-labelledby` removes it, a consumer `aria-label`\n * replaces it, and otherwise it is `alt`, then `name`. A picture on show carries that name as\n * its own `alt`, so the root then names itself only with what the consumer wrote.\n */\nconst ariaLabel = useAriaLabel(() => (showImage.value ? undefined : (props.alt ?? props.name)))\nconst named = computed(() => ariaLabel.value !== undefined || attrs['aria-labelledby'] != null)\n\n// @core\nconst initials = computed(() => {\n if (!props.name) return ''\n /* Whole characters, not UTF-16 halves: `part[0]` of \"😀\" is a lone surrogate, drawn as a\n replacement box. And `toUpperCase` rather than its locale-aware sibling, whose answer\n depends on the runtime's locale, which the server and the browser need not share. */\n return props.name\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((part) => [...part][0]?.toUpperCase() ?? '')\n .join('')\n})\n\n// @core\n/*\n * Only the hue is inline (a unitless scalar); the CSS composes background/text with L/C fixed\n * per theme (light/dark adaptation without depending on contrast-color). A colour computed\n * outside the tokens, a deliberate exception.\n */\nconst hue = computed(() => {\n if (!props.name) return null\n let hash = 0\n for (let i = 0; i < props.name.length; i++) {\n hash = (hash * 31 + props.name.charCodeAt(i)) | 0\n }\n return Math.abs(hash) % 360\n})\nconst isAuto = computed(() => props.color === undefined && hue.value !== null)\n\n// @a11y\n// A static avatar with no picture is an image named by `alt`/ `name`. Anything else keeps the\n// role that arrived in the attributes; `link` on an inert link, a consumer's own otherwise.\nconst role = computed(() =>\n !isInteractive.value && !showImage.value && named.value\n ? 'img'\n : (passedAttrs.value.role as string | undefined),\n)\n\n// @devwarn\n// A button or a link named by nothing: no `name`, no `alt`, no `aria-*` and no slot text. A\n// picture alone does not count, its `alt` coming from the same two props.\nif (isDev) {\n const slots = useSlots()\n onMounted(() => {\n if (isInteractive.value && !named.value && !props.alt && !props.name && !slots.default) {\n console.warn(\n '[VAvatar] a clickable or linked avatar needs an accessible name: set `name`, `alt` or `aria-label`.',\n )\n }\n })\n}\n\nconst rootStyle = computed<StyleValue>(() => [\n customColorStyle(props.color) ??\n (isAuto.value ? { '--avatar-hue': String(hue.value) } : undefined),\n attrs.style as StyleValue,\n])\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :aria-disabled=\"isInertLink ? 'true' : undefined\"\n v-bind=\"passedAttrs\"\n class=\"v-avatar v-control\"\n :style=\"rootStyle\"\n :data-size=\"resolvedSize\"\n :data-custom=\"color !== undefined ? '' : undefined\"\n :data-auto=\"isAuto ? '' : undefined\"\n :href=\"linkHref\"\n :type=\"tag === 'button' ? 'button' : undefined\"\n :disabled=\"tag === 'button' ? disabled : undefined\"\n :role=\"role\"\n :aria-label=\"ariaLabel\"\n >\n <img\n v-if=\"showImage\"\n ref=\"image\"\n class=\"v-avatar-image\"\n :src=\"src\"\n :alt=\"alt ?? name ?? ''\"\n @error=\"failed = true\"\n />\n <VIcon v-else-if=\"icon\" v-bind=\"iconProps(icon)\" class=\"v-avatar-icon\" />\n <slot v-else>\n <span class=\"v-avatar-initials\" aria-hidden=\"true\">{{ initials }}</span>\n </slot>\n </component>\n</template>\n\n<style>\n@layer vectis.components {\n .v-avatar {\n --avatar-bg: var(--vectis-color-surface-muted);\n --avatar-text: var(--vectis-color-text-muted);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n inline-size: var(--control-height);\n block-size: var(--control-height);\n flex: none;\n overflow: hidden;\n padding: 0;\n border: none;\n background: var(--avatar-bg);\n color: var(--avatar-text);\n border-radius: var(--vectis-radius-pill);\n font-family: var(--vectis-text-family);\n font-size: var(--control-font-size);\n font-weight: var(--vectis-font-weight-semibold);\n line-height: var(--vectis-text-control-leading);\n text-decoration: none;\n user-select: none;\n /*\n * The `transparent` fallback is what lets a lone avatar render ringless, and it is also\n * what makes a divergence silent: rename it on one side and the discs in a group simply\n * stop being separated, with no error and nothing missing from the box.\n */\n box-shadow: 0 0 0 var(--vectis-control-size-avatar-ring) var(--avatar-ring-color, transparent);\n transition:\n background-color var(--vectis-duration-fast) var(--vectis-ease-default),\n box-shadow var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n /*\n * The lightness/chroma pairs are set on the THEME scopes and inherited, rather than written\n * in a `[data-theme='dark'] .v-avatar` rule: a descendant selector matches ANY dark ancestor,\n * so a light subtree nested in a dark page kept the dark discs. An inherited value is\n * resolved by the NEAREST scope, which is exactly how the semantic tokens behave.\n */\n :root,\n [data-theme='light'] {\n --avatar-auto-bg-lc: 0.9 0.06;\n --avatar-auto-text-lc: 0.42 0.13;\n }\n\n [data-theme='dark'] {\n --avatar-auto-bg-lc: 0.42 0.09;\n --avatar-auto-text-lc: 0.92 0.05;\n }\n\n .v-avatar[data-auto] {\n --avatar-bg: oklch(var(--avatar-auto-bg-lc) var(--avatar-hue));\n --avatar-text: oklch(var(--avatar-auto-text-lc) var(--avatar-hue));\n }\n\n /* Custom colour (--custom-color inline): wins, with a fixed white text (contrast\n is the consumer's responsibility). */\n .v-avatar[data-custom] {\n --avatar-bg: var(--custom-color);\n --avatar-text: var(--vectis-color-text-on-accent);\n }\n\n .v-avatar-image {\n inline-size: 100%;\n block-size: 100%;\n object-fit: cover;\n }\n\n .v-avatar-icon {\n --vectis-icon-size: calc(var(--control-height) * 0.55);\n }\n\n :is(a, button).v-avatar {\n cursor: pointer;\n }\n\n :is(a, button).v-avatar:hover:not([aria-disabled='true'], :disabled) {\n background: color-mix(in oklab, var(--avatar-bg), var(--vectis-color-text) 10%);\n }\n\n :is(a, button).v-avatar:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: var(--vectis-focus-ring-offset);\n }\n\n .v-avatar:is(:disabled, [aria-disabled='true']) {\n cursor: not-allowed;\n background: var(--vectis-color-surface-muted);\n color: var(--vectis-color-text-subtle);\n }\n\n @media (prefers-reduced-motion: reduce) {\n .v-avatar {\n transition: none;\n }\n }\n\n /* The outline gives each disc its circle back; the focus ring, at (0,2,0), still wins over it. */\n @media (forced-colors: active) {\n .v-avatar {\n outline: var(--vectis-control-border-width) solid CanvasText;\n outline-offset: calc(-1 * var(--vectis-control-border-width));\n }\n }\n}\n</style>\n"],"mappings":"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"}
@@ -15,11 +15,6 @@ interface AvatarGroupProps {
15
15
  * of its own keeps it.
16
16
  */
17
17
  size?: AvatarSize;
18
- /**
19
- * Applies the reduced density to every avatar inside. Unlike `size` it is cumulative: an
20
- * avatar cannot opt back out of a compact group.
21
- */
22
- compact?: boolean;
23
18
  /**
24
19
  * The colour of the ring drawn around each disc. It defaults to the page background, which
25
20
  * makes the ring read as a gap between two avatars.
@@ -43,7 +38,6 @@ type __VLS_Slots = {
43
38
  declare const __VLS_base: import('vue').DefineComponent<AvatarGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<AvatarGroupProps> & Readonly<{}>, {
44
39
  label: string;
45
40
  size: AvatarSize;
46
- compact: boolean;
47
41
  max: number;
48
42
  ringColor: string;
49
43
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -1 +1 @@
1
- {"version":3,"file":"VAvatarGroup.js","names":["_sfc_main","VAvatarGroup_vue_vue_type_script_setup_true_lang_default","VAvatarGroup_default"],"sources":["../../../src/components/VAvatar/VAvatarGroup.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @ssr @core\n/**\n * Count avatars through slot VNodes for SSR-consistent overflow; useSlotNodes keeps that count\n * reactive when the parent replaces its slot.\n */\n\nimport { computed, provide } from 'vue'\nimport type { StyleValue } from 'vue'\n\nimport VAvatar from './VAvatar.vue'\nimport type { AvatarSize } from './VAvatar.vue'\nimport { AVATAR_DEFAULT_SIZE, avatarGroupKey } from './context'\n\nimport { useAriaLabel } from '../../composables/useAriaLabel'\nimport { useSlotNodes } from '../../composables/useSlotNodes'\n\n/** What the `#overflow` slot receives. */\nexport interface AvatarGroupOverflowSlotProps {\n /** How many avatars are hidden beyond `max`. */\n count: number\n}\n\ninterface AvatarGroupProps {\n /**\n * How many avatars to show before the remaining ones are summed up as a single\n * \"+X\" disc. Left out, or set to 0, every avatar is shown.\n */\n max?: number\n /**\n * The size given to the avatars inside the group. An avatar that sets a `size`\n * of its own keeps it.\n */\n size?: AvatarSize\n /**\n * Applies the reduced density to every avatar inside. Unlike `size` it is cumulative: an\n * avatar cannot opt back out of a compact group.\n */\n compact?: boolean\n /**\n * The colour of the ring drawn around each disc. It defaults to the page background, which\n * makes the ring read as a gap between two avatars.\n */\n ringColor?: string\n /**\n * The accessible name of the group, e.g. \"Project members\". A row of faces does not say on\n * its own who these people are. A consumer `aria-label` or `aria-labelledby` wins over it.\n */\n label?: string\n}\n\nconst props = withDefaults(defineProps<AvatarGroupProps>(), {\n max: undefined,\n size: undefined,\n compact: false,\n ringColor: undefined,\n label: undefined,\n})\n\nconst ariaLabel = useAriaLabel(() => props.label)\n\ndefineSlots<{\n /** The VAvatars to stack. */\n default?(): unknown\n /**\n * Replaces the \"+X\" disc that stands for the avatars beyond `max`. It receives\n * `count`, the number of avatars being hidden.\n */\n overflow?(props: AvatarGroupOverflowSlotProps): unknown\n}>()\n\nprovide(avatarGroupKey, {\n get size() {\n return props.size\n },\n get compact() {\n return props.compact\n },\n})\n\nconst items = useSlotNodes()\n// `max: 0` means \"no limit\", as documented, and so does a negative one: `slice(0, -1)` would\n// drop the last avatar and sum it into a \"+1\" disc.\nconst visibleItems = computed(() =>\n props.max !== undefined && props.max > 0 ? items.value.slice(0, props.max) : items.value,\n)\nconst overflowCount = computed(() => items.value.length - visibleItems.value.length)\n\n// A functional component is the only way to render VNodes that have already been\n// captured: <component :is> expects a component definition, not a vnode.\nconst VisibleAvatars = () => visibleItems.value\n\nconst rootStyle = computed<StyleValue>(() =>\n props.ringColor !== undefined ? { '--avatar-ring-color': props.ringColor } : undefined,\n)\n\n// The group carries v-control so that --control-height is defined at ITS level, which keeps the\n// overlap computable even when a child is wrapped; a VTooltip, for instance, inserts a <span>\n// between the group and the VAvatar. An avatar given a size of its own redefines\n// --control-height on itself, so its own overlap follows that size rather than the group's.\nconst resolvedGroupSize = computed<AvatarSize>(() => props.size ?? AVATAR_DEFAULT_SIZE)\n</script>\n\n<template>\n <div\n class=\"v-avatar-group v-control\"\n role=\"group\"\n :aria-label=\"ariaLabel\"\n :style=\"rootStyle\"\n :data-size=\"resolvedGroupSize\"\n :data-compact=\"compact ? '' : undefined\"\n >\n <component :is=\"VisibleAvatars\" />\n <slot v-if=\"overflowCount > 0\" name=\"overflow\" :count=\"overflowCount\">\n <VAvatar>+{{ overflowCount }}</VAvatar>\n </slot>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-avatar-group {\n /* The separation ring, declared here so that every child .v-avatar inherits it. */\n --avatar-ring-color: var(--vectis-color-surface);\n display: inline-flex;\n align-items: center;\n }\n\n /*\n * Take overlap height from the group so wrappers and differently sized avatars share one row\n * contract.\n */\n .v-avatar-group > * + * {\n margin-inline-start: calc(var(--control-height) * -0.3);\n }\n\n /* On hover, or as soon as something inside it takes focus, a disc rises above its\n neighbours so it is seen whole rather than clipped by the next one. */\n .v-avatar-group > *:hover,\n .v-avatar-group > *:focus-within {\n z-index: 1;\n }\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"VAvatarGroup.js","names":["_sfc_main","VAvatarGroup_vue_vue_type_script_setup_true_lang_default","VAvatarGroup_default"],"sources":["../../../src/components/VAvatar/VAvatarGroup.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @ssr @core\n/**\n * Count avatars through slot VNodes for SSR-consistent overflow; useSlotNodes keeps that count\n * reactive when the parent replaces its slot.\n */\n\nimport { computed, provide } from 'vue'\nimport type { StyleValue } from 'vue'\n\nimport VAvatar from './VAvatar.vue'\nimport type { AvatarSize } from './VAvatar.vue'\nimport { AVATAR_DEFAULT_SIZE, avatarGroupKey } from './context'\n\nimport { useAriaLabel } from '../../composables/useAriaLabel'\nimport { useSlotNodes } from '../../composables/useSlotNodes'\n\n/** What the `#overflow` slot receives. */\nexport interface AvatarGroupOverflowSlotProps {\n /** How many avatars are hidden beyond `max`. */\n count: number\n}\n\ninterface AvatarGroupProps {\n /**\n * How many avatars to show before the remaining ones are summed up as a single\n * \"+X\" disc. Left out, or set to 0, every avatar is shown.\n */\n max?: number\n /**\n * The size given to the avatars inside the group. An avatar that sets a `size`\n * of its own keeps it.\n */\n size?: AvatarSize\n /**\n * The colour of the ring drawn around each disc. It defaults to the page background, which\n * makes the ring read as a gap between two avatars.\n */\n ringColor?: string\n /**\n * The accessible name of the group, e.g. \"Project members\". A row of faces does not say on\n * its own who these people are. A consumer `aria-label` or `aria-labelledby` wins over it.\n */\n label?: string\n}\n\nconst props = withDefaults(defineProps<AvatarGroupProps>(), {\n max: undefined,\n size: undefined,\n ringColor: undefined,\n label: undefined,\n})\n\nconst ariaLabel = useAriaLabel(() => props.label)\n\ndefineSlots<{\n /** The VAvatars to stack. */\n default?(): unknown\n /**\n * Replaces the \"+X\" disc that stands for the avatars beyond `max`. It receives\n * `count`, the number of avatars being hidden.\n */\n overflow?(props: AvatarGroupOverflowSlotProps): unknown\n}>()\n\nprovide(avatarGroupKey, {\n get size() {\n return props.size\n },\n})\n\nconst items = useSlotNodes()\n// `max: 0` means \"no limit\", as documented, and so does a negative one: `slice(0, -1)` would\n// drop the last avatar and sum it into a \"+1\" disc.\nconst visibleItems = computed(() =>\n props.max !== undefined && props.max > 0 ? items.value.slice(0, props.max) : items.value,\n)\nconst overflowCount = computed(() => items.value.length - visibleItems.value.length)\n\n// A functional component is the only way to render VNodes that have already been\n// captured: <component :is> expects a component definition, not a vnode.\nconst VisibleAvatars = () => visibleItems.value\n\nconst rootStyle = computed<StyleValue>(() =>\n props.ringColor !== undefined ? { '--avatar-ring-color': props.ringColor } : undefined,\n)\n\n// The group carries v-control so that --control-height is defined at ITS level, which keeps the\n// overlap computable even when a child is wrapped; a VTooltip, for instance, inserts a <span>\n// between the group and the VAvatar. An avatar given a size of its own redefines\n// --control-height on itself, so its own overlap follows that size rather than the group's.\nconst resolvedGroupSize = computed<AvatarSize>(() => props.size ?? AVATAR_DEFAULT_SIZE)\n</script>\n\n<template>\n <div\n class=\"v-avatar-group v-control\"\n role=\"group\"\n :aria-label=\"ariaLabel\"\n :style=\"rootStyle\"\n :data-size=\"resolvedGroupSize\"\n >\n <component :is=\"VisibleAvatars\" />\n <slot v-if=\"overflowCount > 0\" name=\"overflow\" :count=\"overflowCount\">\n <VAvatar>+{{ overflowCount }}</VAvatar>\n </slot>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-avatar-group {\n /* The separation ring, declared here so that every child .v-avatar inherits it. */\n --avatar-ring-color: var(--vectis-color-surface);\n display: inline-flex;\n align-items: center;\n }\n\n /*\n * Take overlap height from the group so wrappers and differently sized avatars share one row\n * contract.\n */\n .v-avatar-group > * + * {\n margin-inline-start: calc(var(--control-height) * -0.3);\n }\n\n /* On hover, or as soon as something inside it takes focus, a disc rises above its\n neighbours so it is seen whole rather than clipped by the next one. */\n .v-avatar-group > *:hover,\n .v-avatar-group > *:focus-within {\n z-index: 1;\n }\n}\n</style>\n"],"mappings":""}
@@ -4,40 +4,26 @@ import { avatarGroupKey as n } from "./context.js";
4
4
  import r from "./VAvatar.js";
5
5
  import { computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createTextVNode as c, createVNode as l, defineComponent as u, normalizeStyle as d, openBlock as f, provide as p, renderSlot as m, resolveDynamicComponent as h, toDisplayString as g, unref as _, withCtx as v } from "vue";
6
6
  //#region src/components/VAvatar/VAvatarGroup.vue?vue&type=script&setup=true&lang.ts
7
- var y = [
8
- "aria-label",
9
- "data-size",
10
- "data-compact"
11
- ], b = /*@__PURE__*/ u({
7
+ var y = ["aria-label", "data-size"], b = /*@__PURE__*/ u({
12
8
  __name: "VAvatarGroup",
13
9
  props: {
14
10
  max: { default: void 0 },
15
11
  size: { default: void 0 },
16
- compact: {
17
- type: Boolean,
18
- default: !1
19
- },
20
12
  ringColor: { default: void 0 },
21
13
  label: { default: void 0 }
22
14
  },
23
15
  setup(u) {
24
16
  let b = u, x = t(() => b.label);
25
- p(n, {
26
- get size() {
27
- return b.size;
28
- },
29
- get compact() {
30
- return b.compact;
31
- }
32
- });
17
+ p(n, { get size() {
18
+ return b.size;
19
+ } });
33
20
  let S = e(), C = i(() => b.max !== void 0 && b.max > 0 ? S.value.slice(0, b.max) : S.value), w = i(() => S.value.length - C.value.length), T = () => C.value, E = i(() => b.ringColor === void 0 ? void 0 : { "--avatar-ring-color": b.ringColor }), D = i(() => b.size ?? "md");
34
21
  return (e, t) => (f(), s("div", {
35
22
  class: "v-avatar-group v-control",
36
23
  role: "group",
37
24
  "aria-label": _(x),
38
25
  style: d(E.value),
39
- "data-size": D.value,
40
- "data-compact": u.compact ? "" : void 0
26
+ "data-size": D.value
41
27
  }, [(f(), a(h(T))), w.value > 0 ? m(e.$slots, "overflow", { count: w.value }, () => [l(r, null, {
42
28
  default: v(() => [c("+" + g(w.value), 1)]),
43
29
  _: 1
@@ -1 +1 @@
1
- {"version":3,"file":"VAvatarGroup.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_unref","_normalizeStyle","_createBlock","_resolveDynamicComponent","_renderSlot","_createVNode","VAvatar","_withCtx","_createTextVNode","_toDisplayString","_createCommentVNode","VAvatar_default","_hoisted_1","VAvatarGroup_vue_vue_type_script_setup_true_lang_default","props","__props","ariaLabel","useAriaLabel","avatarGroupKey","items","useSlotNodes","visibleItems","computed","overflowCount","VisibleAvatars","rootStyle","resolvedGroupSize","openBlock","createElementBlock","unref","normalizeStyle","createBlock","resolveDynamicComponent","renderSlot","_ctx","createVNode","withCtx","createTextVNode","toDisplayString","createCommentVNode"],"sources":["../../../src/components/VAvatar/VAvatarGroup.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @ssr @core\n/**\n * Count avatars through slot VNodes for SSR-consistent overflow; useSlotNodes keeps that count\n * reactive when the parent replaces its slot.\n */\n\nimport { computed, provide } from 'vue'\nimport type { StyleValue } from 'vue'\n\nimport VAvatar from './VAvatar.vue'\nimport type { AvatarSize } from './VAvatar.vue'\nimport { AVATAR_DEFAULT_SIZE, avatarGroupKey } from './context'\n\nimport { useAriaLabel } from '../../composables/useAriaLabel'\nimport { useSlotNodes } from '../../composables/useSlotNodes'\n\n/** What the `#overflow` slot receives. */\nexport interface AvatarGroupOverflowSlotProps {\n /** How many avatars are hidden beyond `max`. */\n count: number\n}\n\ninterface AvatarGroupProps {\n /**\n * How many avatars to show before the remaining ones are summed up as a single\n * \"+X\" disc. Left out, or set to 0, every avatar is shown.\n */\n max?: number\n /**\n * The size given to the avatars inside the group. An avatar that sets a `size`\n * of its own keeps it.\n */\n size?: AvatarSize\n /**\n * Applies the reduced density to every avatar inside. Unlike `size` it is cumulative: an\n * avatar cannot opt back out of a compact group.\n */\n compact?: boolean\n /**\n * The colour of the ring drawn around each disc. It defaults to the page background, which\n * makes the ring read as a gap between two avatars.\n */\n ringColor?: string\n /**\n * The accessible name of the group, e.g. \"Project members\". A row of faces does not say on\n * its own who these people are. A consumer `aria-label` or `aria-labelledby` wins over it.\n */\n label?: string\n}\n\nconst props = withDefaults(defineProps<AvatarGroupProps>(), {\n max: undefined,\n size: undefined,\n compact: false,\n ringColor: undefined,\n label: undefined,\n})\n\nconst ariaLabel = useAriaLabel(() => props.label)\n\ndefineSlots<{\n /** The VAvatars to stack. */\n default?(): unknown\n /**\n * Replaces the \"+X\" disc that stands for the avatars beyond `max`. It receives\n * `count`, the number of avatars being hidden.\n */\n overflow?(props: AvatarGroupOverflowSlotProps): unknown\n}>()\n\nprovide(avatarGroupKey, {\n get size() {\n return props.size\n },\n get compact() {\n return props.compact\n },\n})\n\nconst items = useSlotNodes()\n// `max: 0` means \"no limit\", as documented, and so does a negative one: `slice(0, -1)` would\n// drop the last avatar and sum it into a \"+1\" disc.\nconst visibleItems = computed(() =>\n props.max !== undefined && props.max > 0 ? items.value.slice(0, props.max) : items.value,\n)\nconst overflowCount = computed(() => items.value.length - visibleItems.value.length)\n\n// A functional component is the only way to render VNodes that have already been\n// captured: <component :is> expects a component definition, not a vnode.\nconst VisibleAvatars = () => visibleItems.value\n\nconst rootStyle = computed<StyleValue>(() =>\n props.ringColor !== undefined ? { '--avatar-ring-color': props.ringColor } : undefined,\n)\n\n// The group carries v-control so that --control-height is defined at ITS level, which keeps the\n// overlap computable even when a child is wrapped; a VTooltip, for instance, inserts a <span>\n// between the group and the VAvatar. An avatar given a size of its own redefines\n// --control-height on itself, so its own overlap follows that size rather than the group's.\nconst resolvedGroupSize = computed<AvatarSize>(() => props.size ?? AVATAR_DEFAULT_SIZE)\n</script>\n\n<template>\n <div\n class=\"v-avatar-group v-control\"\n role=\"group\"\n :aria-label=\"ariaLabel\"\n :style=\"rootStyle\"\n :data-size=\"resolvedGroupSize\"\n :data-compact=\"compact ? '' : undefined\"\n >\n <component :is=\"VisibleAvatars\" />\n <slot v-if=\"overflowCount > 0\" name=\"overflow\" :count=\"overflowCount\">\n <VAvatar>+{{ overflowCount }}</VAvatar>\n </slot>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-avatar-group {\n /* The separation ring, declared here so that every child .v-avatar inherits it. */\n --avatar-ring-color: var(--vectis-color-surface);\n display: inline-flex;\n align-items: center;\n }\n\n /*\n * Take overlap height from the group so wrappers and differently sized avatars share one row\n * contract.\n */\n .v-avatar-group > * + * {\n margin-inline-start: calc(var(--control-height) * -0.3);\n }\n\n /* On hover, or as soon as something inside it takes focus, a disc rises above its\n neighbours so it is seen whole rather than clipped by the next one. */\n .v-avatar-group > *:hover,\n .v-avatar-group > *:focus-within {\n z-index: 1;\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAmDA,IAAMgB,IAAQC,GAQRC,IAAYC,QAAmBH,EAAM,KAAK;EAYhD,EAAQI,GAAgB;GACtB,IAAI,OAAO;IACT,OAAOJ,EAAM;GACf;GACA,IAAI,UAAU;IACZ,OAAOA,EAAM;GACf;EACF,CAAC;EAED,IAAMK,IAAQC,EAAa,GAGrBC,IAAeC,QACnBR,EAAM,QAAQ,KAAA,KAAaA,EAAM,MAAM,IAAIK,EAAM,MAAM,MAAM,GAAGL,EAAM,GAAG,IAAIK,EAAM,KACrF,GACMI,IAAgBD,QAAeH,EAAM,MAAM,SAASE,EAAa,MAAM,MAAM,GAI7EG,UAAuBH,EAAa,OAEpCI,IAAYH,QAChBR,EAAM,cAAc,KAAA,IAAyD,KAAA,IAA7C,EAAE,uBAAuBA,EAAM,UAAU,CAC3E,GAMMY,IAAoBJ,QAA2BR,EAAM,QAAA,IAA2B;oBAIpFhB,EAAA,GAAAC,EAYM,OAAA;GAXJ,OAAM;GACN,MAAK;GACJ,cAAYC,EAAAgB,CAAA;GACZ,OAAKf,EAAEwB,EAAA,KAAS;GAChB,aAAWC,EAAA;GACX,gBAAcX,EAAA,UAAO,KAAQ,KAAA;EAE9BjB,GAAAA,EAAAA,EAAA,GAAAI,EAAkCC,EAAlBqB,CAAc,CAAA,IAClBD,EAAA,QAAa,IAAzBnB,EAEO8B,EAAA,QAAA,YAAA,EAFyC,OAAOX,EAAA,MAAa,SAE7D,CADLlB,EAAuCC,GAAA,MAAA;GAA9B,SAAAC,QAAC,CAADC,EAAA,MAACC,EAAGc,EAAA,KAAa,GAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"VAvatarGroup.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_unref","_normalizeStyle","_createBlock","_resolveDynamicComponent","_renderSlot","_createVNode","VAvatar","_withCtx","_createTextVNode","_toDisplayString","_createCommentVNode","VAvatar_default","_hoisted_1","VAvatarGroup_vue_vue_type_script_setup_true_lang_default","props","__props","ariaLabel","useAriaLabel","avatarGroupKey","items","useSlotNodes","visibleItems","computed","overflowCount","VisibleAvatars","rootStyle","resolvedGroupSize","openBlock","createElementBlock","unref","normalizeStyle","createBlock","resolveDynamicComponent","renderSlot","_ctx","createVNode","withCtx","createTextVNode","toDisplayString","createCommentVNode"],"sources":["../../../src/components/VAvatar/VAvatarGroup.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @ssr @core\n/**\n * Count avatars through slot VNodes for SSR-consistent overflow; useSlotNodes keeps that count\n * reactive when the parent replaces its slot.\n */\n\nimport { computed, provide } from 'vue'\nimport type { StyleValue } from 'vue'\n\nimport VAvatar from './VAvatar.vue'\nimport type { AvatarSize } from './VAvatar.vue'\nimport { AVATAR_DEFAULT_SIZE, avatarGroupKey } from './context'\n\nimport { useAriaLabel } from '../../composables/useAriaLabel'\nimport { useSlotNodes } from '../../composables/useSlotNodes'\n\n/** What the `#overflow` slot receives. */\nexport interface AvatarGroupOverflowSlotProps {\n /** How many avatars are hidden beyond `max`. */\n count: number\n}\n\ninterface AvatarGroupProps {\n /**\n * How many avatars to show before the remaining ones are summed up as a single\n * \"+X\" disc. Left out, or set to 0, every avatar is shown.\n */\n max?: number\n /**\n * The size given to the avatars inside the group. An avatar that sets a `size`\n * of its own keeps it.\n */\n size?: AvatarSize\n /**\n * The colour of the ring drawn around each disc. It defaults to the page background, which\n * makes the ring read as a gap between two avatars.\n */\n ringColor?: string\n /**\n * The accessible name of the group, e.g. \"Project members\". A row of faces does not say on\n * its own who these people are. A consumer `aria-label` or `aria-labelledby` wins over it.\n */\n label?: string\n}\n\nconst props = withDefaults(defineProps<AvatarGroupProps>(), {\n max: undefined,\n size: undefined,\n ringColor: undefined,\n label: undefined,\n})\n\nconst ariaLabel = useAriaLabel(() => props.label)\n\ndefineSlots<{\n /** The VAvatars to stack. */\n default?(): unknown\n /**\n * Replaces the \"+X\" disc that stands for the avatars beyond `max`. It receives\n * `count`, the number of avatars being hidden.\n */\n overflow?(props: AvatarGroupOverflowSlotProps): unknown\n}>()\n\nprovide(avatarGroupKey, {\n get size() {\n return props.size\n },\n})\n\nconst items = useSlotNodes()\n// `max: 0` means \"no limit\", as documented, and so does a negative one: `slice(0, -1)` would\n// drop the last avatar and sum it into a \"+1\" disc.\nconst visibleItems = computed(() =>\n props.max !== undefined && props.max > 0 ? items.value.slice(0, props.max) : items.value,\n)\nconst overflowCount = computed(() => items.value.length - visibleItems.value.length)\n\n// A functional component is the only way to render VNodes that have already been\n// captured: <component :is> expects a component definition, not a vnode.\nconst VisibleAvatars = () => visibleItems.value\n\nconst rootStyle = computed<StyleValue>(() =>\n props.ringColor !== undefined ? { '--avatar-ring-color': props.ringColor } : undefined,\n)\n\n// The group carries v-control so that --control-height is defined at ITS level, which keeps the\n// overlap computable even when a child is wrapped; a VTooltip, for instance, inserts a <span>\n// between the group and the VAvatar. An avatar given a size of its own redefines\n// --control-height on itself, so its own overlap follows that size rather than the group's.\nconst resolvedGroupSize = computed<AvatarSize>(() => props.size ?? AVATAR_DEFAULT_SIZE)\n</script>\n\n<template>\n <div\n class=\"v-avatar-group v-control\"\n role=\"group\"\n :aria-label=\"ariaLabel\"\n :style=\"rootStyle\"\n :data-size=\"resolvedGroupSize\"\n >\n <component :is=\"VisibleAvatars\" />\n <slot v-if=\"overflowCount > 0\" name=\"overflow\" :count=\"overflowCount\">\n <VAvatar>+{{ overflowCount }}</VAvatar>\n </slot>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-avatar-group {\n /* The separation ring, declared here so that every child .v-avatar inherits it. */\n --avatar-ring-color: var(--vectis-color-surface);\n display: inline-flex;\n align-items: center;\n }\n\n /*\n * Take overlap height from the group so wrappers and differently sized avatars share one row\n * contract.\n */\n .v-avatar-group > * + * {\n margin-inline-start: calc(var(--control-height) * -0.3);\n }\n\n /* On hover, or as soon as something inside it takes focus, a disc rises above its\n neighbours so it is seen whole rather than clipped by the next one. */\n .v-avatar-group > *:hover,\n .v-avatar-group > *:focus-within {\n z-index: 1;\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;EA8CA,IAAMgB,IAAQC,GAORC,IAAYC,QAAmBH,EAAM,KAAK;EAYhD,EAAQI,GAAgB,EACtB,IAAI,OAAO;GACT,OAAOJ,EAAM;EACf,EACF,CAAC;EAED,IAAMK,IAAQC,EAAa,GAGrBC,IAAeC,QACnBR,EAAM,QAAQ,KAAA,KAAaA,EAAM,MAAM,IAAIK,EAAM,MAAM,MAAM,GAAGL,EAAM,GAAG,IAAIK,EAAM,KACrF,GACMI,IAAgBD,QAAeH,EAAM,MAAM,SAASE,EAAa,MAAM,MAAM,GAI7EG,UAAuBH,EAAa,OAEpCI,IAAYH,QAChBR,EAAM,cAAc,KAAA,IAAyD,KAAA,IAA7C,EAAE,uBAAuBA,EAAM,UAAU,CAC3E,GAMMY,IAAoBJ,QAA2BR,EAAM,QAAA,IAA2B;oBAIpFhB,EAAA,GAAAC,EAWM,OAAA;GAVJ,OAAM;GACN,MAAK;GACJ,cAAYC,EAAAgB,CAAA;GACZ,OAAKf,EAAEwB,EAAA,KAAS;GAChB,aAAWC,EAAA;EAEZ5B,GAAAA,EAAAA,EAAA,GAAAI,EAAkCC,EAAlBqB,CAAc,CAAA,IAClBD,EAAA,QAAa,IAAzBnB,EAEO8B,EAAA,QAAA,YAAA,EAFyC,OAAOX,EAAA,MAAa,SAE7D,CADLlB,EAAuCC,GAAA,MAAA;GAA9B,SAAAC,QAAC,CAADC,EAAA,MAACC,EAAGc,EAAA,KAAa,GAAA,CAAA,CAAA,CAAA"}
@@ -2,7 +2,6 @@ import { InjectionKey } from 'vue';
2
2
  import { AvatarSize } from './VAvatar.js';
3
3
  export interface AvatarGroupContext {
4
4
  size?: AvatarSize;
5
- compact?: boolean;
6
5
  }
7
6
  /** The size of an avatar that neither names one nor sits in a group that does. */
8
7
  export declare const AVATAR_DEFAULT_SIZE: AvatarSize;
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","names":["avatarGroupKey"],"sources":["../../../src/components/VAvatar/context.ts"],"sourcesContent":["/**\n * Explicit avatar size overrides the group fallback. Compact is cumulative, so a compact group\n * cannot have an expanded child.\n */\n\nimport type { InjectionKey } from 'vue'\n\nimport type { AvatarSize } from './VAvatar.vue'\n\nexport interface AvatarGroupContext {\n size?: AvatarSize\n compact?: boolean\n}\n\n/** The size of an avatar that neither names one nor sits in a group that does. */\nexport const AVATAR_DEFAULT_SIZE: AvatarSize = 'md'\n\nexport const avatarGroupKey: InjectionKey<AvatarGroupContext> = Symbol('v-avatar-group')\n"],"mappings":";AAiBA,IAAaA,IAAmD,OAAO,gBAAgB"}
1
+ {"version":3,"file":"context.js","names":["avatarGroupKey"],"sources":["../../../src/components/VAvatar/context.ts"],"sourcesContent":["/** Explicit avatar size overrides the group fallback. */\n\nimport type { InjectionKey } from 'vue'\n\nimport type { AvatarSize } from './VAvatar.vue'\n\nexport interface AvatarGroupContext {\n size?: AvatarSize\n}\n\n/** The size of an avatar that neither names one nor sits in a group that does. */\nexport const AVATAR_DEFAULT_SIZE: AvatarSize = 'md'\n\nexport const avatarGroupKey: InjectionKey<AvatarGroupContext> = Symbol('v-avatar-group')\n"],"mappings":";AAaA,IAAaA,IAAmD,OAAO,gBAAgB"}
@@ -29,11 +29,6 @@ interface ButtonProps {
29
29
  * Inside a VButtonGroup the group's own size wins over this one.
30
30
  */
31
31
  size?: ButtonSize;
32
- /**
33
- * Takes 4px off the height, leaving the padding, the text and the icons as they
34
- * are. Inside a VButtonGroup the group's own value wins over this one.
35
- */
36
- compact?: boolean;
37
32
  /**
38
33
  * Stretches the button to the whole inline size of its parent, instead of leaving it only as
39
34
  * wide as its content.
@@ -85,7 +80,6 @@ declare const __VLS_base: import('vue').DefineComponent<ButtonProps, {}, {}, {},
85
80
  type: "button" | "reset" | "submit";
86
81
  variant: ButtonVariant;
87
82
  tone: ButtonTone;
88
- compact: boolean;
89
83
  href: string;
90
84
  iconStart: IconSource;
91
85
  iconEnd: IconSource;