@feugene/granularity 0.11.0 → 0.12.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 (189) hide show
  1. package/dist/GrTree.css +1 -1
  2. package/dist/chunks/config-1uSYl98Y2.js.map +1 -0
  3. package/dist/chunks/config-BIRO0vDJ.js.map +1 -0
  4. package/dist/chunks/config-BWiPnygb.js +5 -0
  5. package/dist/chunks/config-BWiPnygb.js.map +1 -0
  6. package/dist/chunks/config-BXtAmU3s2.js.map +1 -0
  7. package/dist/chunks/config-CGHLoBlH.js.map +1 -0
  8. package/dist/chunks/config-CrG1XiE72.js.map +1 -0
  9. package/dist/chunks/config-DUcu1D682.js.map +1 -0
  10. package/dist/chunks/config-Dlm49Jp5.js +5 -0
  11. package/dist/chunks/config-Dlm49Jp5.js.map +1 -0
  12. package/dist/chunks/config-DnvPqu4g2.js.map +1 -0
  13. package/dist/chunks/config-DpqOnJiz.js.map +1 -0
  14. package/dist/chunks/config-JpHA4Xx02.js.map +1 -0
  15. package/dist/chunks/config-LGrZIdaZ.js.map +1 -0
  16. package/dist/chunks/config-eXB87DOi2.js +9 -0
  17. package/dist/chunks/config-eXB87DOi2.js.map +1 -0
  18. package/dist/chunks/context-DdNIxa1w.js +9 -0
  19. package/dist/chunks/context-DdNIxa1w.js.map +1 -0
  20. package/dist/chunks/{en-BdtiS2d3.js → en-CfkDa4GX.js} +8 -2
  21. package/dist/chunks/{en-BdtiS2d3.js.map → en-CfkDa4GX.js.map} +1 -1
  22. package/dist/chunks/{es-DBhctWg-.js → es-CgaLnFYx.js} +3 -3
  23. package/dist/chunks/{es-DBhctWg-.js.map → es-CgaLnFYx.js.map} +1 -1
  24. package/dist/chunks/{es-BGRMZbe9.js → es-FkgECuCm.js} +8 -2
  25. package/dist/chunks/{es-BGRMZbe9.js.map → es-FkgECuCm.js.map} +1 -1
  26. package/dist/chunks/grModalEscStack-BXk-9mv7.js +43 -0
  27. package/dist/chunks/grModalEscStack-BXk-9mv7.js.map +1 -0
  28. package/dist/chunks/{ru-BFCnOiML.js → ru-Bl8CxpEa.js} +8 -2
  29. package/dist/chunks/{ru-BFCnOiML.js.map → ru-Bl8CxpEa.js.map} +1 -1
  30. package/dist/chunks/{shared-ChvcQgDl.js → shared-B6Ay2081.js} +17 -11
  31. package/dist/chunks/shared-B6Ay2081.js.map +1 -0
  32. package/dist/chunks/{transition-TLFw4KBn.js → useScrollLock-K7kaP2Ud.js} +52 -1
  33. package/dist/chunks/useScrollLock-K7kaP2Ud.js.map +1 -0
  34. package/dist/components/GrConfirmDialog/chunks/{GrConfirmDialog-BWYKCsHd.js → GrConfirmDialog-D8CkOtqv.js} +1 -1
  35. package/dist/components/GrConfirmDialog/chunks/{GrConfirmDialog-BWYKCsHd.js.map → GrConfirmDialog-D8CkOtqv.js.map} +1 -1
  36. package/dist/components/GrConfirmDialog/index.js +2 -2
  37. package/dist/components/GrDataTable/chunks/{GrDataTable-ptbARmJ3.js → GrDataTable-Ds5OeGat.js} +42 -16
  38. package/dist/components/GrDataTable/chunks/GrDataTable-Ds5OeGat.js.map +1 -0
  39. package/dist/components/GrDataTable/index.js +1 -1
  40. package/dist/components/GrDialog/chunks/{GrDialog-5DAS-1Lb.js → GrDialog-Ctucxju9.js} +2 -2
  41. package/dist/components/GrDialog/chunks/{GrDialog-5DAS-1Lb.js.map → GrDialog-Ctucxju9.js.map} +1 -1
  42. package/dist/components/GrDialog/index.js +1 -1
  43. package/dist/components/GrDialogService/chunks/{GrDialogService-DY_fmaMu.js → GrDialogService-CU1Fbonc.js} +2 -2
  44. package/dist/components/GrDialogService/chunks/{GrDialogService-DY_fmaMu.js.map → GrDialogService-CU1Fbonc.js.map} +1 -1
  45. package/dist/components/GrDialogService/index.js +1 -1
  46. package/dist/components/GrDivider/chunks/GrDivider-5bcE-BB4.js +54 -0
  47. package/dist/components/GrDivider/chunks/GrDivider-5bcE-BB4.js.map +1 -0
  48. package/dist/components/GrDivider/index.js +3 -0
  49. package/dist/components/GrDrawer/chunks/{GrDrawer-D1kzsjXN.js → GrDrawer-SLGKCY2A.js} +37 -13
  50. package/dist/components/GrDrawer/chunks/GrDrawer-SLGKCY2A.js.map +1 -0
  51. package/dist/components/GrDrawer/index.js +2 -2
  52. package/dist/components/GrDropdown/chunks/{GrDropdown-BXb5Cxxf.js → GrDropdown-BnDMYP8v.js} +90 -4
  53. package/dist/components/GrDropdown/chunks/GrDropdown-BnDMYP8v.js.map +1 -0
  54. package/dist/components/GrDropdown/index.js +1 -1
  55. package/dist/components/GrDropdownMenu/chunks/{GrDropdownMenu-DFEJLPcV.js → GrDropdownMenu--g9Vofcq.js} +1 -1
  56. package/dist/components/GrDropdownMenu/chunks/{GrDropdownMenu-DFEJLPcV.js.map → GrDropdownMenu--g9Vofcq.js.map} +1 -1
  57. package/dist/components/GrDropdownMenu/index.js +1 -1
  58. package/dist/components/GrFormField/chunks/GrFormField-DnfMHx_U.js +73 -0
  59. package/dist/components/GrFormField/chunks/GrFormField-DnfMHx_U.js.map +1 -0
  60. package/dist/components/GrFormField/index.js +3 -2
  61. package/dist/components/GrImageViewer/chunks/{GrImageViewer-OCUIrNh2.js → GrImageViewer-Dla9IBkd.js} +311 -222
  62. package/dist/components/GrImageViewer/chunks/GrImageViewer-Dla9IBkd.js.map +1 -0
  63. package/dist/components/GrImageViewer/index.js +1 -1
  64. package/dist/components/GrInput/chunks/GrInput-B8dd3JaA.js +334 -0
  65. package/dist/components/GrInput/chunks/GrInput-B8dd3JaA.js.map +1 -0
  66. package/dist/components/GrInput/index.js +1 -1
  67. package/dist/components/GrKbd/chunks/GrKbd-BEoYxWhE.js +22 -0
  68. package/dist/components/GrKbd/chunks/GrKbd-BEoYxWhE.js.map +1 -0
  69. package/dist/components/GrKbd/index.js +3 -0
  70. package/dist/components/GrModal/chunks/{GrModal-BkjW9jZS.js → GrModal-C0GZrHN3.js} +3 -56
  71. package/dist/components/GrModal/chunks/GrModal-C0GZrHN3.js.map +1 -0
  72. package/dist/components/GrModal/index.js +1 -1
  73. package/dist/components/GrNumberInput/chunks/{GrNumberInput-CldPIWQx.js → GrNumberInput-DxCEvL7V.js} +93 -11
  74. package/dist/components/GrNumberInput/chunks/GrNumberInput-DxCEvL7V.js.map +1 -0
  75. package/dist/components/GrNumberInput/index.js +1 -1
  76. package/dist/components/GrPagination/chunks/{GrPagination-Bu9wv6it.js → GrPagination-mlyfLjQY.js} +1 -1
  77. package/dist/components/GrPagination/chunks/{GrPagination-Bu9wv6it.js.map → GrPagination-mlyfLjQY.js.map} +1 -1
  78. package/dist/components/GrPagination/index.js +2 -2
  79. package/dist/components/GrProgressBar/index.js +1 -1
  80. package/dist/components/GrPromptDialog/chunks/{GrPromptDialog-TmWXbpEP.js → GrPromptDialog-C-_BMNuY.js} +3 -3
  81. package/dist/components/GrPromptDialog/chunks/{GrPromptDialog-TmWXbpEP.js.map → GrPromptDialog-C-_BMNuY.js.map} +1 -1
  82. package/dist/components/GrPromptDialog/index.js +1 -1
  83. package/dist/components/GrRadio/chunks/{GrRadio-CPTixXaY.js → GrRadio-Dr-pvs_9.js} +1 -1
  84. package/dist/components/GrRadio/chunks/{GrRadio-CPTixXaY.js.map → GrRadio-Dr-pvs_9.js.map} +1 -1
  85. package/dist/components/GrRadio/index.js +2 -2
  86. package/dist/components/GrRadioGroup/chunks/{GrRadioGroup-vKZCbkCp.js → GrRadioGroup-nOdvfV_g.js} +1 -1
  87. package/dist/components/GrRadioGroup/chunks/{GrRadioGroup-vKZCbkCp.js.map → GrRadioGroup-nOdvfV_g.js.map} +1 -1
  88. package/dist/components/GrRadioGroup/index.js +1 -1
  89. package/dist/components/GrSelect/chunks/{GrSelect-RShK21lK.js → GrSelect-BVCmitqa.js} +147 -27
  90. package/dist/components/GrSelect/chunks/GrSelect-BVCmitqa.js.map +1 -0
  91. package/dist/components/GrSelect/index.js +1 -1
  92. package/dist/components/GrSidebar/index.js +1 -1
  93. package/dist/components/GrTabPanels/chunks/GrTabPanels-DbKybwe-.js +68 -0
  94. package/dist/components/GrTabPanels/chunks/GrTabPanels-DbKybwe-.js.map +1 -0
  95. package/dist/components/GrTabPanels/index.js +3 -0
  96. package/dist/components/GrTabs/chunks/{GrTabs-Z-FDJUr_.js → GrTabs-DsLwWoRz.js} +6 -1
  97. package/dist/components/GrTabs/chunks/GrTabs-DsLwWoRz.js.map +1 -0
  98. package/dist/components/GrTabs/index.js +1 -1
  99. package/dist/components/GrTextarea/chunks/{GrTextarea-D56YxhKq.js → GrTextarea-CKukGlNl.js} +15 -5
  100. package/dist/components/GrTextarea/chunks/GrTextarea-CKukGlNl.js.map +1 -0
  101. package/dist/components/GrTextarea/index.js +2 -2
  102. package/dist/components/GrToaster/chunks/{GrToaster-eI8YvnIo.js → GrToaster-L2cu6cSR.js} +1 -1
  103. package/dist/components/GrToaster/chunks/{GrToaster-eI8YvnIo.js.map → GrToaster-L2cu6cSR.js.map} +1 -1
  104. package/dist/components/GrToaster/index.js +2 -2
  105. package/dist/components/GrTree/chunks/{GrTree-D3ODe2dB.js → GrTree-B2_yW6g1.js} +107 -8
  106. package/dist/components/GrTree/chunks/GrTree-B2_yW6g1.js.map +1 -0
  107. package/dist/components/GrTree/index.js +2 -2
  108. package/dist/components/GrTreeSelect/chunks/{GrTreeSelect-B2xBKs5Q.js → GrTreeSelect-0aM62xyu.js} +3 -3
  109. package/dist/components/GrTreeSelect/chunks/{GrTreeSelect-B2xBKs5Q.js.map → GrTreeSelect-0aM62xyu.js.map} +1 -1
  110. package/dist/components/GrTreeSelect/index.js +2 -2
  111. package/dist/granular-provider-node.js +2 -2
  112. package/dist/granular-provider.js +1 -1
  113. package/dist/i18n/all.js +1 -1
  114. package/dist/i18n/index.js +1 -1
  115. package/dist/index.js +40 -33
  116. package/dist/index.js.map +1 -1
  117. package/dist/styles/base.css +30 -8
  118. package/dist/styles/preflight.css +5 -1
  119. package/dist/types/src/components/GrDataTable/GrDataTable.vue.d.ts +28 -4
  120. package/dist/types/src/components/GrDivider/GrDivider.vue.d.ts +58 -0
  121. package/dist/types/src/components/GrDivider/config.d.ts +1 -0
  122. package/dist/types/src/components/GrDivider/index.d.ts +4 -0
  123. package/dist/types/src/components/GrDrawer/GrDrawer.vue.d.ts +4 -4
  124. package/dist/types/src/components/GrDropdown/GrDropdown.vue.d.ts +7 -0
  125. package/dist/types/src/components/GrDropdownMenu/GrDropdownMenu.vue.d.ts +6 -0
  126. package/dist/types/src/components/GrFormField/GrFormField.vue.d.ts +15 -2
  127. package/dist/types/src/components/GrFormField/context.d.ts +20 -0
  128. package/dist/types/src/components/GrFormField/index.d.ts +1 -0
  129. package/dist/types/src/components/GrImageViewer/GrImageViewer.vue.d.ts +4 -0
  130. package/dist/types/src/components/GrImageViewer/composables/useViewerKeyboard.d.ts +20 -0
  131. package/dist/types/src/components/GrImageViewer/composables/useWheelGesture.d.ts +16 -0
  132. package/dist/types/src/components/GrImageViewer/composables/useZoomPan.d.ts +50 -0
  133. package/dist/types/src/components/GrInput/GrInput.vue.d.ts +41 -2
  134. package/dist/types/src/components/GrKbd/GrKbd.vue.d.ts +46 -0
  135. package/dist/types/src/components/GrKbd/config.d.ts +1 -0
  136. package/dist/types/src/components/GrKbd/index.d.ts +4 -0
  137. package/dist/types/src/components/GrNumberInput/GrNumberInput.vue.d.ts +16 -0
  138. package/dist/types/src/components/GrSelect/GrSelect.vue.d.ts +2 -2
  139. package/dist/types/src/components/GrTabPanels/GrTabPanel.vue.d.ts +46 -0
  140. package/dist/types/src/components/GrTabPanels/GrTabPanels.vue.d.ts +51 -0
  141. package/dist/types/src/components/GrTabPanels/config.d.ts +5 -0
  142. package/dist/types/src/components/GrTabPanels/context.d.ts +9 -0
  143. package/dist/types/src/components/GrTabPanels/index.d.ts +6 -0
  144. package/dist/types/src/components/GrTabs/GrTabs.vue.d.ts +6 -0
  145. package/dist/types/src/components/GrTree/grTreeInteractionContext.d.ts +2 -0
  146. package/dist/types/src/composables/internal/useScrollLock.d.ts +24 -0
  147. package/dist/types/src/granular-provider/shared.d.ts +3 -0
  148. package/dist/types/src/i18n/messages/en.d.ts +10 -0
  149. package/dist/types/src/i18n/messages/es.d.ts +10 -0
  150. package/dist/types/src/i18n/messages/ru.d.ts +10 -0
  151. package/dist/types/src/index.d.ts +3 -0
  152. package/dist/web-types.json +275 -26
  153. package/package.json +13 -1
  154. package/dist/chunks/config-1uSYl98Y.js.map +0 -1
  155. package/dist/chunks/config-BIRO0vDJ2.js.map +0 -1
  156. package/dist/chunks/config-BXtAmU3s.js.map +0 -1
  157. package/dist/chunks/config-CGHLoBlH2.js.map +0 -1
  158. package/dist/chunks/config-CrG1XiE7.js.map +0 -1
  159. package/dist/chunks/config-DUcu1D68.js.map +0 -1
  160. package/dist/chunks/config-DnvPqu4g.js.map +0 -1
  161. package/dist/chunks/config-DpqOnJiz2.js.map +0 -1
  162. package/dist/chunks/config-JpHA4Xx0.js.map +0 -1
  163. package/dist/chunks/config-LGrZIdaZ2.js.map +0 -1
  164. package/dist/chunks/shared-ChvcQgDl.js.map +0 -1
  165. package/dist/chunks/transition-TLFw4KBn.js.map +0 -1
  166. package/dist/components/GrDataTable/chunks/GrDataTable-ptbARmJ3.js.map +0 -1
  167. package/dist/components/GrDrawer/chunks/GrDrawer-D1kzsjXN.js.map +0 -1
  168. package/dist/components/GrDropdown/chunks/GrDropdown-BXb5Cxxf.js.map +0 -1
  169. package/dist/components/GrFormField/chunks/GrFormField-BujNQrw8.js +0 -35
  170. package/dist/components/GrFormField/chunks/GrFormField-BujNQrw8.js.map +0 -1
  171. package/dist/components/GrImageViewer/chunks/GrImageViewer-OCUIrNh2.js.map +0 -1
  172. package/dist/components/GrInput/chunks/GrInput-C8pOJgCi.js +0 -188
  173. package/dist/components/GrInput/chunks/GrInput-C8pOJgCi.js.map +0 -1
  174. package/dist/components/GrModal/chunks/GrModal-BkjW9jZS.js.map +0 -1
  175. package/dist/components/GrNumberInput/chunks/GrNumberInput-CldPIWQx.js.map +0 -1
  176. package/dist/components/GrSelect/chunks/GrSelect-RShK21lK.js.map +0 -1
  177. package/dist/components/GrTabs/chunks/GrTabs-Z-FDJUr_.js.map +0 -1
  178. package/dist/components/GrTextarea/chunks/GrTextarea-D56YxhKq.js.map +0 -1
  179. package/dist/components/GrTree/chunks/GrTree-D3ODe2dB.js.map +0 -1
  180. /package/dist/chunks/{config-1uSYl98Y.js → config-1uSYl98Y2.js} +0 -0
  181. /package/dist/chunks/{config-BIRO0vDJ2.js → config-BIRO0vDJ.js} +0 -0
  182. /package/dist/chunks/{config-BXtAmU3s.js → config-BXtAmU3s2.js} +0 -0
  183. /package/dist/chunks/{config-CGHLoBlH2.js → config-CGHLoBlH.js} +0 -0
  184. /package/dist/chunks/{config-CrG1XiE7.js → config-CrG1XiE72.js} +0 -0
  185. /package/dist/chunks/{config-DUcu1D68.js → config-DUcu1D682.js} +0 -0
  186. /package/dist/chunks/{config-DnvPqu4g.js → config-DnvPqu4g2.js} +0 -0
  187. /package/dist/chunks/{config-DpqOnJiz2.js → config-DpqOnJiz.js} +0 -0
  188. /package/dist/chunks/{config-JpHA4Xx0.js → config-JpHA4Xx02.js} +0 -0
  189. /package/dist/chunks/{config-LGrZIdaZ2.js → config-LGrZIdaZ.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GrImageViewer-Dla9IBkd.js","names":["$slots"],"sources":["../../../../src/components/GrImageViewer/composables/useZoomPan.ts","../../../../src/components/GrImageViewer/composables/useWheelGesture.ts","../../../../src/components/GrImageViewer/composables/useViewerKeyboard.ts","../../../../src/components/GrImageViewer/GrImageViewer.vue","../../../../src/components/GrImageViewer/GrImageViewer.vue"],"sourcesContent":["import { computed, ref, type Ref } from 'vue'\n\nconst TRAILING_ZERO_DECIMAL_RE = /\\.0$/\n\nexport function formatPercent(value: number): string {\n if (Number.isInteger(value))\n return String(value)\n return value.toFixed(1).replace(TRAILING_ZERO_DECIMAL_RE, '')\n}\n\nexport interface UseZoomPanOptions {\n minScale: () => number\n maxScale: () => number\n zoomRate: () => number\n draggable: () => boolean\n /** Ссылка на `<img>` — для измерения layout-размера и подписки ResizeObserver. */\n imageEl: Ref<HTMLImageElement | null>\n /** Колбэк на поворот (эмит `rotate`). */\n onRotate: (deg: number) => void\n}\n\n/**\n * useZoomPan — состояние и логика масштаба/поворота/панорамирования картинки,\n * а также метрики (натуральный/вписанный/фактический размер, реальный масштаб).\n * Вынесено из монолитного `GrImageViewer.vue`.\n */\nexport function useZoomPan(options: UseZoomPanOptions) {\n const scale = ref(1)\n const rotation = ref(0)\n const offsetX = ref(0)\n const offsetY = ref(0)\n\n const isDragging = ref(false)\n let dragStartX = 0\n let dragStartY = 0\n let dragOffsetStartX = 0\n let dragOffsetStartY = 0\n\n // Натуральный размер (из `<img>`) и layout-размер вписанного (`object-contain`) изображения.\n const naturalWidth = ref(0)\n const naturalHeight = ref(0)\n const fittedWidth = ref(0)\n const fittedHeight = ref(0)\n\n let resizeObserver: ResizeObserver | null = null\n\n const imageStyle = computed(() => ({\n transform: `translate3d(${offsetX.value}px, ${offsetY.value}px, 0) scale(${scale.value}) rotate(${rotation.value}deg)`,\n }))\n\n const zoomValueText = computed(() => formatPercent(scale.value * 100))\n\n // Фактический размер изображения на экране вдоль его осей (footprint), c учётом scale.\n const renderedWidth = computed(() => Math.round(fittedWidth.value * scale.value))\n const renderedHeight = computed(() => Math.round(fittedHeight.value * scale.value))\n\n // Реальный масштаб относительно натурального размера (доля). Не зависит от rotation.\n const realScale = computed(() => {\n if (!naturalWidth.value)\n return 0\n return (fittedWidth.value * scale.value) / naturalWidth.value\n })\n const realScalePercent = computed(() => formatPercent(realScale.value * 100))\n\n function setScale(value: number): void {\n const clamped = Math.min(options.maxScale(), Math.max(options.minScale(), value))\n scale.value = Number(clamped.toFixed(4))\n }\n\n function zoomIn(): void {\n setScale(scale.value * options.zoomRate())\n }\n\n function zoomOut(): void {\n setScale(scale.value / options.zoomRate())\n }\n\n function rotateLeft(): void {\n rotation.value -= 90\n options.onRotate(rotation.value)\n }\n\n function rotateRight(): void {\n rotation.value += 90\n options.onRotate(rotation.value)\n }\n\n function resetTransform(): void {\n scale.value = 1\n rotation.value = 0\n offsetX.value = 0\n offsetY.value = 0\n isDragging.value = false\n }\n\n function resetImageMetrics(): void {\n naturalWidth.value = 0\n naturalHeight.value = 0\n fittedWidth.value = 0\n fittedHeight.value = 0\n }\n\n function measureFitted(): void {\n const el = options.imageEl.value\n if (!el)\n return\n // offsetWidth/Height — layout-размер вписанного изображения, без CSS transform.\n fittedWidth.value = el.offsetWidth\n fittedHeight.value = el.offsetHeight\n }\n\n function onImageLoad(event: Event): void {\n const el = event.target as HTMLImageElement\n naturalWidth.value = el.naturalWidth\n naturalHeight.value = el.naturalHeight\n measureFitted()\n }\n\n function startObservingImage(): void {\n const el = options.imageEl.value\n if (!el || typeof ResizeObserver === 'undefined')\n return\n\n if (!resizeObserver)\n resizeObserver = new ResizeObserver(() => measureFitted())\n\n resizeObserver.observe(el)\n\n // Если картинка уже в кэше и `load` не сработал — считаем метрики сразу.\n if (el.complete && el.naturalWidth) {\n naturalWidth.value = el.naturalWidth\n naturalHeight.value = el.naturalHeight\n }\n\n measureFitted()\n }\n\n function stopObservingImage(): void {\n resizeObserver?.disconnect()\n }\n\n function onPointerDown(event: PointerEvent): void {\n // Тянем только основной кнопкой и только если drag включён.\n if (!options.draggable() || event.button !== 0)\n return\n\n event.preventDefault()\n isDragging.value = true\n dragStartX = event.clientX\n dragStartY = event.clientY\n dragOffsetStartX = offsetX.value\n dragOffsetStartY = offsetY.value\n\n // Захватываем указатель, чтобы движение/отпускание ловились за пределами картинки.\n ;(event.currentTarget as Element).setPointerCapture?.(event.pointerId)\n }\n\n function onPointerMove(event: PointerEvent): void {\n if (!isDragging.value)\n return\n offsetX.value = dragOffsetStartX + (event.clientX - dragStartX)\n offsetY.value = dragOffsetStartY + (event.clientY - dragStartY)\n }\n\n function onPointerUp(event: PointerEvent): void {\n if (!isDragging.value)\n return\n isDragging.value = false\n ;(event.currentTarget as Element).releasePointerCapture?.(event.pointerId)\n }\n\n return {\n scale,\n rotation,\n offsetX,\n offsetY,\n isDragging,\n naturalWidth,\n naturalHeight,\n fittedWidth,\n fittedHeight,\n imageStyle,\n zoomValueText,\n renderedWidth,\n renderedHeight,\n realScale,\n realScalePercent,\n setScale,\n zoomIn,\n zoomOut,\n rotateLeft,\n rotateRight,\n resetTransform,\n resetImageMetrics,\n measureFitted,\n onImageLoad,\n startObservingImage,\n stopObservingImage,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n }\n}\n","import { ref } from 'vue'\n\n// Чувствительность масштабирования колесом/трекпадом: чем больше — тем резче реакция.\nconst WHEEL_ZOOM_SENSITIVITY = 0.0015\n// Сколько ms простоя после последнего wheel-события считаем «зум завершён»\n// (после этого возвращаем плавный CSS-переход).\nconst WHEEL_IDLE_MS = 120\n\nexport interface UseWheelGestureOptions {\n /** Разрешён ли зум колесом (проп `wheelZoom` + наличие изображений). */\n enabled: () => boolean\n /** Применить множитель масштаба (накопленный за кадр). */\n applyZoomFactor: (factor: number) => void\n}\n\n/**\n * useWheelGesture — масштабирование колесом мыши / жестом трекпада с батчингом\n * по `requestAnimationFrame` (рендер не чаще кадра — без «дёрганья»/наслоения) и\n * временным отключением CSS-перехода на время жеста (`isWheelZooming`).\n */\nexport function useWheelGesture(options: UseWheelGestureOptions) {\n const isWheelZooming = ref(false)\n\n let pendingWheelDelta = 0\n let wheelFrameId: number | null = null\n let wheelIdleTimer: ReturnType<typeof setTimeout> | null = null\n\n function cancelWheelFrame(): void {\n if (wheelFrameId !== null) {\n cancelAnimationFrame(wheelFrameId)\n wheelFrameId = null\n }\n }\n\n function endWheelZoom(): void {\n if (wheelIdleTimer !== null) {\n clearTimeout(wheelIdleTimer)\n wheelIdleTimer = null\n }\n\n isWheelZooming.value = false\n pendingWheelDelta = 0\n cancelWheelFrame()\n }\n\n // Применяем накопленный за кадр deltaY одним обновлением scale.\n function flushWheelZoom(): void {\n wheelFrameId = null\n\n const delta = pendingWheelDelta\n pendingWheelDelta = 0\n\n if (!delta)\n return\n\n // Экспоненциальный шаг — плавно и одинаково для колеса и трекпада.\n // delta < 0 (scroll up) — приближение, delta > 0 — отдаление.\n const factor = Math.exp(-delta * WHEEL_ZOOM_SENSITIVITY)\n options.applyZoomFactor(factor)\n }\n\n function onWheel(event: WheelEvent): void {\n if (!options.enabled())\n return\n\n // Не даём странице/оверлею проскроллиться — колесо отдаём под зум.\n event.preventDefault()\n\n // Во время непрерывного зума отключаем CSS-переход: плавность даёт само\n // покадровое обновление, а transition на микрошагах вызывает лаг/наслоение.\n isWheelZooming.value = true\n\n pendingWheelDelta += event.deltaY\n\n if (wheelFrameId === null)\n wheelFrameId = requestAnimationFrame(flushWheelZoom)\n\n if (wheelIdleTimer !== null)\n clearTimeout(wheelIdleTimer)\n\n // По завершении жеста возвращаем плавный переход для дискретных зумов.\n wheelIdleTimer = setTimeout(() => {\n wheelIdleTimer = null\n isWheelZooming.value = false\n }, WHEEL_IDLE_MS)\n }\n\n return { isWheelZooming, onWheel, endWheelZoom }\n}\n","export interface ViewerKeyboardActions {\n close: () => void\n prev: () => void\n next: () => void\n zoomIn: () => void\n zoomOut: () => void\n reset: () => void\n}\n\nexport interface UseViewerKeyboardOptions {\n /** Закрывать ли по Escape (проп `closeOnPressEscape`). */\n closeOnEscape: () => boolean\n actions: ViewerKeyboardActions\n}\n\n/**\n * useViewerKeyboard — клавиатурное управление просмотрщиком:\n * Esc — закрыть, стрелки — переключение, `+`/`-`/`0` — зум/сброс.\n */\nexport function useViewerKeyboard(options: UseViewerKeyboardOptions) {\n const { actions } = options\n\n function onKeydown(event: KeyboardEvent): void {\n switch (event.key) {\n case 'Escape':\n if (!options.closeOnEscape())\n return\n event.preventDefault()\n actions.close()\n return\n\n case 'ArrowLeft':\n event.preventDefault()\n actions.prev()\n return\n\n case 'ArrowRight':\n event.preventDefault()\n actions.next()\n return\n\n case '+':\n case '=':\n case 'Add':\n event.preventDefault()\n actions.zoomIn()\n return\n\n case '-':\n case '_':\n case 'Subtract':\n event.preventDefault()\n actions.zoomOut()\n return\n\n case '0':\n event.preventDefault()\n actions.reset()\n break\n\n default:\n }\n }\n\n return { onKeydown }\n}\n","<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'\nimport { Dialog, DialogPanel, TransitionChild, TransitionRoot } from '@headlessui/vue'\n\nimport { useGranularityTranslations } from '../../internal/granularityI18n'\nimport { useScrollLock } from '../../composables/internal/useScrollLock'\nimport { useZoomPan } from './composables/useZoomPan'\nimport { useWheelGesture } from './composables/useWheelGesture'\nimport { useViewerKeyboard } from './composables/useViewerKeyboard'\n\n/**\n * Usage:\n *\n * <GrImageViewer\n * v-model=\"open\"\n * :url-list=\"images\"\n * :initial-index=\"0\"\n * show-progress\n * hide-on-click-modal\n * />\n *\n * Логика вынесена в composables: `useZoomPan` (масштаб/поворот/пан + метрики),\n * `useWheelGesture` (зум колесом/трекпадом с rAF-батчингом), `useViewerKeyboard`\n * (клавиатура). Сам SFC отвечает за оверлей, индекс изображений и композицию.\n */\nconst props = withDefaults(\n defineProps<{\n modelValue: boolean\n urlList: string[]\n initialIndex?: number\n zoomRate?: number\n minScale?: number\n maxScale?: number\n hideOnClickModal?: boolean\n closeOnPressEscape?: boolean\n showProgress?: boolean\n showZoomValue?: boolean\n /** Включает масштабирование колесом мыши / жестом на трекпаде. По умолчанию включено. */\n wheelZoom?: boolean\n /** Включает перетаскивание (pan) картинки мышью. При наведении курсор «рука». По умолчанию выключено. */\n draggable?: boolean\n zIndex?: number\n /** i18n: aria-label кнопки закрытия. */\n closeLabel?: string\n /** i18n: aria-label кнопки «предыдущее изображение». */\n prevLabel?: string\n /** i18n: aria-label кнопки «следующее изображение». */\n nextLabel?: string\n /** i18n: aria-label кнопки «увеличить». */\n zoomInLabel?: string\n /** i18n: aria-label кнопки «уменьшить». */\n zoomOutLabel?: string\n /** i18n: aria-label кнопки «сбросить масштаб». */\n resetZoomLabel?: string\n /** i18n: aria-label кнопки «повернуть влево». */\n rotateLeftLabel?: string\n /** i18n: aria-label кнопки «повернуть вправо». */\n rotateRightLabel?: string\n /** i18n: текст в пустом состоянии (нет изображений). */\n emptyText?: string\n }>(),\n {\n initialIndex: 0,\n zoomRate: 1.2,\n minScale: 0.5,\n maxScale: 5,\n hideOnClickModal: false,\n closeOnPressEscape: true,\n showProgress: false,\n showZoomValue: true,\n wheelZoom: true,\n draggable: false,\n zIndex: undefined,\n closeLabel: undefined,\n prevLabel: undefined,\n nextLabel: undefined,\n zoomInLabel: undefined,\n zoomOutLabel: undefined,\n resetZoomLabel: undefined,\n rotateLeftLabel: undefined,\n rotateRightLabel: undefined,\n emptyText: undefined,\n },\n)\n\nconst { t } = useGranularityTranslations()\nconst resolvedCloseLabel = computed(() => props.closeLabel ?? t('gr.imageViewer.close', 'Close image viewer'))\nconst resolvedPrevLabel = computed(() => props.prevLabel ?? t('gr.imageViewer.prev', 'Previous image'))\nconst resolvedNextLabel = computed(() => props.nextLabel ?? t('gr.imageViewer.next', 'Next image'))\nconst resolvedZoomInLabel = computed(() => props.zoomInLabel ?? t('gr.imageViewer.zoomIn', 'Zoom in'))\nconst resolvedZoomOutLabel = computed(() => props.zoomOutLabel ?? t('gr.imageViewer.zoomOut', 'Zoom out'))\nconst resolvedResetZoomLabel = computed(() => props.resetZoomLabel ?? t('gr.imageViewer.resetZoom', 'Reset zoom'))\nconst resolvedRotateLeftLabel = computed(() => props.rotateLeftLabel ?? t('gr.imageViewer.rotateLeft', 'Rotate left'))\nconst resolvedRotateRightLabel = computed(() => props.rotateRightLabel ?? t('gr.imageViewer.rotateRight', 'Rotate right'))\nconst resolvedEmptyText = computed(() => props.emptyText ?? t('gr.imageViewer.empty', 'No image'))\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: boolean): void\n (e: 'close'): void\n (e: 'switch', newIndex: number): void\n (e: 'rotate', deg: number): void\n}>()\n\ntype GrImageViewerToolbarActions = {\n close: () => void\n prev: () => void\n next: () => void\n zoomIn: () => void\n zoomOut: () => void\n reset: () => void\n rotateLeft: () => void\n rotateRight: () => void\n}\n\ntype GrImageViewerSlotProps = {\n index: number\n displayIndex: number\n total: number\n scale: number\n rotation: number\n /** Натуральный (исходный) размер картинки, px. 0 пока изображение не загружено. */\n naturalWidth: number\n naturalHeight: number\n /** Фактический размер изображения на экране c учётом scale, px (footprint вдоль осей картинки). */\n renderedWidth: number\n renderedHeight: number\n /** Реальный масштаб относительно натурального размера (доля): renderedWidth / naturalWidth. */\n realScale: number\n /** Реальный масштаб в процентах, отформатированный (например `67`). */\n realScalePercent: string\n actions: GrImageViewerToolbarActions\n}\n\nconst DEFAULT_Z_INDEX = 2000\n\nconst open = computed(() => props.modelValue)\n\n// SSR-guard для teleport + общий reference-counted scroll-lock (как в GrModal/GrDrawer).\nconst isClient = typeof window !== 'undefined'\nconst { lock: lockBodyScroll, unlock: unlockBodyScroll } = useScrollLock()\n\nconst total = computed(() => props.urlList.length)\nconst hasImages = computed(() => total.value > 0)\n\nconst currentIndex = ref(0)\nconst imageEl = ref<HTMLImageElement | null>(null)\n\n// Масштаб / поворот / панорамирование + метрики изображения.\nconst {\n scale,\n rotation,\n isDragging,\n naturalWidth,\n naturalHeight,\n renderedWidth,\n renderedHeight,\n realScale,\n realScalePercent,\n imageStyle,\n zoomValueText,\n setScale,\n zoomIn,\n zoomOut,\n rotateLeft,\n rotateRight,\n resetTransform,\n resetImageMetrics,\n onImageLoad,\n startObservingImage,\n stopObservingImage,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n} = useZoomPan({\n minScale: () => props.minScale,\n maxScale: () => props.maxScale,\n zoomRate: () => props.zoomRate,\n draggable: () => props.draggable,\n imageEl,\n onRotate: deg => emit('rotate', deg),\n})\n\n// Зум колесом мыши / жестом трекпада.\nconst { isWheelZooming, onWheel, endWheelZoom } = useWheelGesture({\n enabled: () => props.wheelZoom && hasImages.value,\n applyZoomFactor: factor => setScale(scale.value * factor),\n})\n\nconst currentUrl = computed(() => (hasImages.value ? props.urlList[currentIndex.value] : undefined))\nconst displayIndex = computed(() => (hasImages.value ? currentIndex.value + 1 : 0))\n\nconst viewerStyle = computed(() => ({\n zIndex: String(Number.isFinite(props.zIndex) ? props.zIndex : DEFAULT_Z_INDEX),\n}))\n\n// Плавный CSS-переход только для дискретных зумов; при wheel-зуме/перетаскивании отключаем.\nconst imageTransitionClass = computed(() =>\n isWheelZooming.value || isDragging.value ? '' : 'transition-transform duration-150 ease-out',\n)\n\n// Курсор «рука» (grab/grabbing), только если включён drag.\nconst imageCursorClass = computed(() => {\n if (!props.draggable)\n return ''\n return isDragging.value ? 'cursor-grabbing' : 'cursor-grab'\n})\n\nfunction normalizeIndex(value: number): number {\n if (!hasImages.value)\n return 0\n const normalized = Number.isFinite(value) ? Math.trunc(value) : 0\n return ((normalized % total.value) + total.value) % total.value\n}\n\nfunction setIndex(nextIndex: number, options?: { emitSwitch?: boolean }): void {\n const normalizedIndex = normalizeIndex(nextIndex)\n if (normalizedIndex === currentIndex.value)\n return\n\n currentIndex.value = normalizedIndex\n resetTransform()\n resetImageMetrics()\n endWheelZoom()\n\n if (options?.emitSwitch !== false)\n emit('switch', normalizedIndex)\n}\n\nfunction syncIndexFromInitial(): void {\n if (!hasImages.value) {\n currentIndex.value = 0\n return\n }\n currentIndex.value = normalizeIndex(props.initialIndex)\n resetTransform()\n resetImageMetrics()\n endWheelZoom()\n}\n\nfunction preloadAt(index: number): void {\n const url = props.urlList[index]\n if (!url)\n return\n const image = new Image()\n image.decoding = 'async'\n image.src = url\n}\n\nfunction closeViewer(): void {\n emit('update:modelValue', false)\n emit('close')\n}\n\nfunction prev(): void {\n setIndex(currentIndex.value - 1)\n}\n\nfunction next(): void {\n setIndex(currentIndex.value + 1)\n}\n\nconst toolbarActions: GrImageViewerToolbarActions = {\n close: closeViewer,\n prev,\n next,\n zoomIn,\n zoomOut,\n reset: resetTransform,\n rotateLeft,\n rotateRight,\n}\n\nconst toolbarSlotProps = computed<GrImageViewerSlotProps>(() => ({\n index: currentIndex.value,\n displayIndex: displayIndex.value,\n total: total.value,\n scale: scale.value,\n rotation: rotation.value,\n naturalWidth: naturalWidth.value,\n naturalHeight: naturalHeight.value,\n renderedWidth: renderedWidth.value,\n renderedHeight: renderedHeight.value,\n realScale: realScale.value,\n realScalePercent: realScalePercent.value,\n actions: toolbarActions,\n}))\n\nfunction onBackdropClick(): void {\n if (!props.hideOnClickModal)\n return\n closeViewer()\n}\n\nconst { onKeydown } = useViewerKeyboard({\n closeOnEscape: () => props.closeOnPressEscape,\n actions: { close: closeViewer, prev, next, zoomIn, zoomOut, reset: resetTransform },\n})\n\nwatch(\n () => props.modelValue,\n async (isOpen) => {\n if (!isOpen) {\n unlockBodyScroll()\n stopObservingImage()\n endWheelZoom()\n isDragging.value = false\n return\n }\n\n lockBodyScroll()\n syncIndexFromInitial()\n await nextTick()\n startObservingImage()\n },\n { immediate: true },\n)\n\nwatch(\n () => props.initialIndex,\n () => {\n if (!props.modelValue)\n return\n syncIndexFromInitial()\n },\n)\n\nwatch(\n () => props.urlList,\n () => {\n if (!props.modelValue)\n return\n syncIndexFromInitial()\n },\n { deep: true },\n)\n\nwatch(\n currentIndex,\n (index) => {\n if (!hasImages.value || total.value < 2)\n return\n preloadAt(normalizeIndex(index - 1))\n preloadAt(normalizeIndex(index + 1))\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n unlockBodyScroll()\n stopObservingImage()\n endWheelZoom()\n})\n</script>\n\n<template>\n <teleport to=\"body\" :disabled=\"!isClient\">\n <TransitionRoot :show=\"open\" as=\"template\">\n <Dialog\n as=\"div\"\n class=\"fixed inset-0\"\n :style=\"viewerStyle\"\n role=\"dialog\"\n aria-modal=\"true\"\n :static=\"true\"\n @keydown=\"onKeydown\"\n >\n <div class=\"fixed inset-0 overflow-hidden\">\n <TransitionChild\n as=\"template\"\n enter=\"duration-150 ease-out\"\n enter-from=\"opacity-0\"\n enter-to=\"opacity-100\"\n leave=\"duration-120 ease-in\"\n leave-from=\"opacity-100\"\n leave-to=\"opacity-0\"\n >\n <div\n data-gr-image-viewer-overlay\n class=\"absolute inset-0 bg-black/60 backdrop-blur-sm\"\n aria-hidden=\"true\"\n @click=\"onBackdropClick\"\n />\n </TransitionChild>\n\n <TransitionChild\n as=\"template\"\n enter=\"duration-180 ease-out\"\n enter-from=\"opacity-0 scale-98\"\n enter-to=\"opacity-100 scale-100\"\n leave=\"duration-130 ease-in\"\n leave-from=\"opacity-100 scale-100\"\n leave-to=\"opacity-0 scale-98\"\n >\n <DialogPanel\n data-gr-image-viewer-panel\n class=\"relative z-10 h-full w-full outline-none\"\n tabindex=\"-1\"\n >\n <div class=\"pointer-events-none absolute inset-x-0 top-0 z-30 px-3 py-3 sm:px-6\">\n <div class=\"pointer-events-auto flex items-center justify-between gap-3\">\n <div class=\"flex items-center gap-2\">\n <div\n v-if=\"showProgress\"\n data-gr-image-viewer-progress\n class=\"rounded-full bg-black/35 px-3 py-1 text-xs font-600 text-white/95 sm:text-sm\"\n >\n {{ displayIndex }} / {{ total }}\n </div>\n\n <div\n v-if=\"showZoomValue\"\n data-gr-image-viewer-zoom-value\n class=\"rounded-full bg-black/35 px-3 py-1 text-xs font-700 text-white/95 sm:text-sm\"\n >\n {{ zoomValueText }}%\n </div>\n </div>\n\n <button\n type=\"button\"\n data-gr-image-viewer-close\n :aria-label=\"resolvedCloseLabel\"\n class=\"h-11 w-11 flex items-center justify-center rounded-full border border-white/20 bg-black/35 text-white transition-colors hover:bg-black/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80\"\n @click=\"closeViewer\"\n >\n <span aria-hidden=\"true\" class=\"text-lg leading-none\">✕</span>\n </button>\n </div>\n </div>\n\n <div\n class=\"relative z-10 h-full w-full flex items-center justify-center px-16 py-16 sm:px-24 sm:py-20\"\n @wheel=\"onWheel\"\n >\n <button\n v-if=\"total > 1\"\n type=\"button\"\n data-gr-image-viewer-prev\n :aria-label=\"resolvedPrevLabel\"\n class=\"absolute left-3 top-1/2 z-20 h-12 w-12 -translate-y-1/2 flex items-center justify-center rounded-full border border-white/20 bg-black/35 text-white transition-colors hover:bg-black/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80 sm:left-6\"\n @click=\"prev\"\n >\n <span aria-hidden=\"true\" class=\"text-xl leading-none\">‹</span>\n </button>\n\n <button\n v-if=\"total > 1\"\n type=\"button\"\n data-gr-image-viewer-next\n :aria-label=\"resolvedNextLabel\"\n class=\"absolute right-3 top-1/2 z-20 h-12 w-12 -translate-y-1/2 flex items-center justify-center rounded-full border border-white/20 bg-black/35 text-white transition-colors hover:bg-black/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80 sm:right-6\"\n @click=\"next\"\n >\n <span aria-hidden=\"true\" class=\"text-xl leading-none\">›</span>\n </button>\n\n <div class=\"h-full w-full flex items-center justify-center\">\n <img\n v-if=\"currentUrl\"\n ref=\"imageEl\"\n data-gr-image-viewer-image\n :src=\"currentUrl\"\n alt=\"\"\n draggable=\"false\"\n class=\"max-h-full max-w-full select-none object-contain will-change-transform\"\n :class=\"[imageTransitionClass, imageCursorClass]\"\n :style=\"imageStyle\"\n @load=\"onImageLoad\"\n @pointerdown=\"onPointerDown\"\n @pointermove=\"onPointerMove\"\n @pointerup=\"onPointerUp\"\n @pointercancel=\"onPointerUp\"\n >\n\n <div\n v-else\n class=\"rounded-[var(--gr-radius-xl)] border border-white/20 bg-black/25 px-4 py-3 text-sm text-white/80\"\n >\n {{ resolvedEmptyText }}\n </div>\n </div>\n </div>\n\n <div class=\"pointer-events-none absolute inset-x-0 bottom-0 z-30 px-3 pb-3 sm:px-6 sm:pb-6\">\n <div class=\"pointer-events-auto mx-auto w-full max-w-max\">\n <slot\n name=\"toolbar\"\n v-bind=\"toolbarSlotProps\"\n >\n <div class=\"rounded-full border border-white/20 bg-black/35 p-1 backdrop-blur-sm flex items-center gap-1\">\n <button\n type=\"button\"\n data-gr-image-viewer-zoom-out\n :aria-label=\"resolvedZoomOutLabel\"\n class=\"h-11 min-w-11 px-2 flex items-center justify-center rounded-full text-sm font-600 text-white transition-colors hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80\"\n @click=\"zoomOut\"\n >\n −\n </button>\n\n <button\n type=\"button\"\n data-gr-image-viewer-zoom-reset\n :aria-label=\"resolvedResetZoomLabel\"\n class=\"h-11 min-w-11 px-3 flex items-center justify-center rounded-full text-xs font-700 text-white transition-colors hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80\"\n @click=\"resetTransform\"\n >\n 100%\n </button>\n\n <button\n type=\"button\"\n data-gr-image-viewer-zoom-in\n :aria-label=\"resolvedZoomInLabel\"\n class=\"h-11 min-w-11 px-2 flex items-center justify-center rounded-full text-sm font-600 text-white transition-colors hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80\"\n @click=\"zoomIn\"\n >\n +\n </button>\n\n <template v-if=\"$slots['toolbar-actions']\">\n <div class=\"mx-1 h-6 w-px bg-white/25\" aria-hidden=\"true\" />\n\n <slot\n name=\"toolbar-actions\"\n v-bind=\"toolbarSlotProps\"\n />\n\n <div class=\"mx-1 h-6 w-px bg-white/25\" aria-hidden=\"true\" />\n </template>\n\n <div v-else class=\"mx-1 h-6 w-px bg-white/25\" aria-hidden=\"true\" />\n\n <button\n type=\"button\"\n data-gr-image-viewer-rotate-left\n :aria-label=\"resolvedRotateLeftLabel\"\n class=\"h-11 min-w-11 px-2 flex items-center justify-center rounded-full text-sm font-600 text-white transition-colors hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80\"\n @click=\"rotateLeft\"\n >\n ↺\n </button>\n\n <button\n type=\"button\"\n data-gr-image-viewer-rotate-right\n :aria-label=\"resolvedRotateRightLabel\"\n class=\"h-11 min-w-11 px-2 flex items-center justify-center rounded-full text-sm font-600 text-white transition-colors hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80\"\n @click=\"rotateRight\"\n >\n ↻\n </button>\n </div>\n </slot>\n </div>\n </div>\n </DialogPanel>\n </TransitionChild>\n </div>\n </Dialog>\n </TransitionRoot>\n </teleport>\n</template>","<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'\nimport { Dialog, DialogPanel, TransitionChild, TransitionRoot } from '@headlessui/vue'\n\nimport { useGranularityTranslations } from '../../internal/granularityI18n'\nimport { useScrollLock } from '../../composables/internal/useScrollLock'\nimport { useZoomPan } from './composables/useZoomPan'\nimport { useWheelGesture } from './composables/useWheelGesture'\nimport { useViewerKeyboard } from './composables/useViewerKeyboard'\n\n/**\n * Usage:\n *\n * <GrImageViewer\n * v-model=\"open\"\n * :url-list=\"images\"\n * :initial-index=\"0\"\n * show-progress\n * hide-on-click-modal\n * />\n *\n * Логика вынесена в composables: `useZoomPan` (масштаб/поворот/пан + метрики),\n * `useWheelGesture` (зум колесом/трекпадом с rAF-батчингом), `useViewerKeyboard`\n * (клавиатура). Сам SFC отвечает за оверлей, индекс изображений и композицию.\n */\nconst props = withDefaults(\n defineProps<{\n modelValue: boolean\n urlList: string[]\n initialIndex?: number\n zoomRate?: number\n minScale?: number\n maxScale?: number\n hideOnClickModal?: boolean\n closeOnPressEscape?: boolean\n showProgress?: boolean\n showZoomValue?: boolean\n /** Включает масштабирование колесом мыши / жестом на трекпаде. По умолчанию включено. */\n wheelZoom?: boolean\n /** Включает перетаскивание (pan) картинки мышью. При наведении курсор «рука». По умолчанию выключено. */\n draggable?: boolean\n zIndex?: number\n /** i18n: aria-label кнопки закрытия. */\n closeLabel?: string\n /** i18n: aria-label кнопки «предыдущее изображение». */\n prevLabel?: string\n /** i18n: aria-label кнопки «следующее изображение». */\n nextLabel?: string\n /** i18n: aria-label кнопки «увеличить». */\n zoomInLabel?: string\n /** i18n: aria-label кнопки «уменьшить». */\n zoomOutLabel?: string\n /** i18n: aria-label кнопки «сбросить масштаб». */\n resetZoomLabel?: string\n /** i18n: aria-label кнопки «повернуть влево». */\n rotateLeftLabel?: string\n /** i18n: aria-label кнопки «повернуть вправо». */\n rotateRightLabel?: string\n /** i18n: текст в пустом состоянии (нет изображений). */\n emptyText?: string\n }>(),\n {\n initialIndex: 0,\n zoomRate: 1.2,\n minScale: 0.5,\n maxScale: 5,\n hideOnClickModal: false,\n closeOnPressEscape: true,\n showProgress: false,\n showZoomValue: true,\n wheelZoom: true,\n draggable: false,\n zIndex: undefined,\n closeLabel: undefined,\n prevLabel: undefined,\n nextLabel: undefined,\n zoomInLabel: undefined,\n zoomOutLabel: undefined,\n resetZoomLabel: undefined,\n rotateLeftLabel: undefined,\n rotateRightLabel: undefined,\n emptyText: undefined,\n },\n)\n\nconst { t } = useGranularityTranslations()\nconst resolvedCloseLabel = computed(() => props.closeLabel ?? t('gr.imageViewer.close', 'Close image viewer'))\nconst resolvedPrevLabel = computed(() => props.prevLabel ?? t('gr.imageViewer.prev', 'Previous image'))\nconst resolvedNextLabel = computed(() => props.nextLabel ?? t('gr.imageViewer.next', 'Next image'))\nconst resolvedZoomInLabel = computed(() => props.zoomInLabel ?? t('gr.imageViewer.zoomIn', 'Zoom in'))\nconst resolvedZoomOutLabel = computed(() => props.zoomOutLabel ?? t('gr.imageViewer.zoomOut', 'Zoom out'))\nconst resolvedResetZoomLabel = computed(() => props.resetZoomLabel ?? t('gr.imageViewer.resetZoom', 'Reset zoom'))\nconst resolvedRotateLeftLabel = computed(() => props.rotateLeftLabel ?? t('gr.imageViewer.rotateLeft', 'Rotate left'))\nconst resolvedRotateRightLabel = computed(() => props.rotateRightLabel ?? t('gr.imageViewer.rotateRight', 'Rotate right'))\nconst resolvedEmptyText = computed(() => props.emptyText ?? t('gr.imageViewer.empty', 'No image'))\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: boolean): void\n (e: 'close'): void\n (e: 'switch', newIndex: number): void\n (e: 'rotate', deg: number): void\n}>()\n\ntype GrImageViewerToolbarActions = {\n close: () => void\n prev: () => void\n next: () => void\n zoomIn: () => void\n zoomOut: () => void\n reset: () => void\n rotateLeft: () => void\n rotateRight: () => void\n}\n\ntype GrImageViewerSlotProps = {\n index: number\n displayIndex: number\n total: number\n scale: number\n rotation: number\n /** Натуральный (исходный) размер картинки, px. 0 пока изображение не загружено. */\n naturalWidth: number\n naturalHeight: number\n /** Фактический размер изображения на экране c учётом scale, px (footprint вдоль осей картинки). */\n renderedWidth: number\n renderedHeight: number\n /** Реальный масштаб относительно натурального размера (доля): renderedWidth / naturalWidth. */\n realScale: number\n /** Реальный масштаб в процентах, отформатированный (например `67`). */\n realScalePercent: string\n actions: GrImageViewerToolbarActions\n}\n\nconst DEFAULT_Z_INDEX = 2000\n\nconst open = computed(() => props.modelValue)\n\n// SSR-guard для teleport + общий reference-counted scroll-lock (как в GrModal/GrDrawer).\nconst isClient = typeof window !== 'undefined'\nconst { lock: lockBodyScroll, unlock: unlockBodyScroll } = useScrollLock()\n\nconst total = computed(() => props.urlList.length)\nconst hasImages = computed(() => total.value > 0)\n\nconst currentIndex = ref(0)\nconst imageEl = ref<HTMLImageElement | null>(null)\n\n// Масштаб / поворот / панорамирование + метрики изображения.\nconst {\n scale,\n rotation,\n isDragging,\n naturalWidth,\n naturalHeight,\n renderedWidth,\n renderedHeight,\n realScale,\n realScalePercent,\n imageStyle,\n zoomValueText,\n setScale,\n zoomIn,\n zoomOut,\n rotateLeft,\n rotateRight,\n resetTransform,\n resetImageMetrics,\n onImageLoad,\n startObservingImage,\n stopObservingImage,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n} = useZoomPan({\n minScale: () => props.minScale,\n maxScale: () => props.maxScale,\n zoomRate: () => props.zoomRate,\n draggable: () => props.draggable,\n imageEl,\n onRotate: deg => emit('rotate', deg),\n})\n\n// Зум колесом мыши / жестом трекпада.\nconst { isWheelZooming, onWheel, endWheelZoom } = useWheelGesture({\n enabled: () => props.wheelZoom && hasImages.value,\n applyZoomFactor: factor => setScale(scale.value * factor),\n})\n\nconst currentUrl = computed(() => (hasImages.value ? props.urlList[currentIndex.value] : undefined))\nconst displayIndex = computed(() => (hasImages.value ? currentIndex.value + 1 : 0))\n\nconst viewerStyle = computed(() => ({\n zIndex: String(Number.isFinite(props.zIndex) ? props.zIndex : DEFAULT_Z_INDEX),\n}))\n\n// Плавный CSS-переход только для дискретных зумов; при wheel-зуме/перетаскивании отключаем.\nconst imageTransitionClass = computed(() =>\n isWheelZooming.value || isDragging.value ? '' : 'transition-transform duration-150 ease-out',\n)\n\n// Курсор «рука» (grab/grabbing), только если включён drag.\nconst imageCursorClass = computed(() => {\n if (!props.draggable)\n return ''\n return isDragging.value ? 'cursor-grabbing' : 'cursor-grab'\n})\n\nfunction normalizeIndex(value: number): number {\n if (!hasImages.value)\n return 0\n const normalized = Number.isFinite(value) ? Math.trunc(value) : 0\n return ((normalized % total.value) + total.value) % total.value\n}\n\nfunction setIndex(nextIndex: number, options?: { emitSwitch?: boolean }): void {\n const normalizedIndex = normalizeIndex(nextIndex)\n if (normalizedIndex === currentIndex.value)\n return\n\n currentIndex.value = normalizedIndex\n resetTransform()\n resetImageMetrics()\n endWheelZoom()\n\n if (options?.emitSwitch !== false)\n emit('switch', normalizedIndex)\n}\n\nfunction syncIndexFromInitial(): void {\n if (!hasImages.value) {\n currentIndex.value = 0\n return\n }\n currentIndex.value = normalizeIndex(props.initialIndex)\n resetTransform()\n resetImageMetrics()\n endWheelZoom()\n}\n\nfunction preloadAt(index: number): void {\n const url = props.urlList[index]\n if (!url)\n return\n const image = new Image()\n image.decoding = 'async'\n image.src = url\n}\n\nfunction closeViewer(): void {\n emit('update:modelValue', false)\n emit('close')\n}\n\nfunction prev(): void {\n setIndex(currentIndex.value - 1)\n}\n\nfunction next(): void {\n setIndex(currentIndex.value + 1)\n}\n\nconst toolbarActions: GrImageViewerToolbarActions = {\n close: closeViewer,\n prev,\n next,\n zoomIn,\n zoomOut,\n reset: resetTransform,\n rotateLeft,\n rotateRight,\n}\n\nconst toolbarSlotProps = computed<GrImageViewerSlotProps>(() => ({\n index: currentIndex.value,\n displayIndex: displayIndex.value,\n total: total.value,\n scale: scale.value,\n rotation: rotation.value,\n naturalWidth: naturalWidth.value,\n naturalHeight: naturalHeight.value,\n renderedWidth: renderedWidth.value,\n renderedHeight: renderedHeight.value,\n realScale: realScale.value,\n realScalePercent: realScalePercent.value,\n actions: toolbarActions,\n}))\n\nfunction onBackdropClick(): void {\n if (!props.hideOnClickModal)\n return\n closeViewer()\n}\n\nconst { onKeydown } = useViewerKeyboard({\n closeOnEscape: () => props.closeOnPressEscape,\n actions: { close: closeViewer, prev, next, zoomIn, zoomOut, reset: resetTransform },\n})\n\nwatch(\n () => props.modelValue,\n async (isOpen) => {\n if (!isOpen) {\n unlockBodyScroll()\n stopObservingImage()\n endWheelZoom()\n isDragging.value = false\n return\n }\n\n lockBodyScroll()\n syncIndexFromInitial()\n await nextTick()\n startObservingImage()\n },\n { immediate: true },\n)\n\nwatch(\n () => props.initialIndex,\n () => {\n if (!props.modelValue)\n return\n syncIndexFromInitial()\n },\n)\n\nwatch(\n () => props.urlList,\n () => {\n if (!props.modelValue)\n return\n syncIndexFromInitial()\n },\n { deep: true },\n)\n\nwatch(\n currentIndex,\n (index) => {\n if (!hasImages.value || total.value < 2)\n return\n preloadAt(normalizeIndex(index - 1))\n preloadAt(normalizeIndex(index + 1))\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n unlockBodyScroll()\n stopObservingImage()\n endWheelZoom()\n})\n</script>\n\n<template>\n <teleport to=\"body\" :disabled=\"!isClient\">\n <TransitionRoot :show=\"open\" as=\"template\">\n <Dialog\n as=\"div\"\n class=\"fixed inset-0\"\n :style=\"viewerStyle\"\n role=\"dialog\"\n aria-modal=\"true\"\n :static=\"true\"\n @keydown=\"onKeydown\"\n >\n <div class=\"fixed inset-0 overflow-hidden\">\n <TransitionChild\n as=\"template\"\n enter=\"duration-150 ease-out\"\n enter-from=\"opacity-0\"\n enter-to=\"opacity-100\"\n leave=\"duration-120 ease-in\"\n leave-from=\"opacity-100\"\n leave-to=\"opacity-0\"\n >\n <div\n data-gr-image-viewer-overlay\n class=\"absolute inset-0 bg-black/60 backdrop-blur-sm\"\n aria-hidden=\"true\"\n @click=\"onBackdropClick\"\n />\n </TransitionChild>\n\n <TransitionChild\n as=\"template\"\n enter=\"duration-180 ease-out\"\n enter-from=\"opacity-0 scale-98\"\n enter-to=\"opacity-100 scale-100\"\n leave=\"duration-130 ease-in\"\n leave-from=\"opacity-100 scale-100\"\n leave-to=\"opacity-0 scale-98\"\n >\n <DialogPanel\n data-gr-image-viewer-panel\n class=\"relative z-10 h-full w-full outline-none\"\n tabindex=\"-1\"\n >\n <div class=\"pointer-events-none absolute inset-x-0 top-0 z-30 px-3 py-3 sm:px-6\">\n <div class=\"pointer-events-auto flex items-center justify-between gap-3\">\n <div class=\"flex items-center gap-2\">\n <div\n v-if=\"showProgress\"\n data-gr-image-viewer-progress\n class=\"rounded-full bg-black/35 px-3 py-1 text-xs font-600 text-white/95 sm:text-sm\"\n >\n {{ displayIndex }} / {{ total }}\n </div>\n\n <div\n v-if=\"showZoomValue\"\n data-gr-image-viewer-zoom-value\n class=\"rounded-full bg-black/35 px-3 py-1 text-xs font-700 text-white/95 sm:text-sm\"\n >\n {{ zoomValueText }}%\n </div>\n </div>\n\n <button\n type=\"button\"\n data-gr-image-viewer-close\n :aria-label=\"resolvedCloseLabel\"\n class=\"h-11 w-11 flex items-center justify-center rounded-full border border-white/20 bg-black/35 text-white transition-colors hover:bg-black/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80\"\n @click=\"closeViewer\"\n >\n <span aria-hidden=\"true\" class=\"text-lg leading-none\">✕</span>\n </button>\n </div>\n </div>\n\n <div\n class=\"relative z-10 h-full w-full flex items-center justify-center px-16 py-16 sm:px-24 sm:py-20\"\n @wheel=\"onWheel\"\n >\n <button\n v-if=\"total > 1\"\n type=\"button\"\n data-gr-image-viewer-prev\n :aria-label=\"resolvedPrevLabel\"\n class=\"absolute left-3 top-1/2 z-20 h-12 w-12 -translate-y-1/2 flex items-center justify-center rounded-full border border-white/20 bg-black/35 text-white transition-colors hover:bg-black/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80 sm:left-6\"\n @click=\"prev\"\n >\n <span aria-hidden=\"true\" class=\"text-xl leading-none\">‹</span>\n </button>\n\n <button\n v-if=\"total > 1\"\n type=\"button\"\n data-gr-image-viewer-next\n :aria-label=\"resolvedNextLabel\"\n class=\"absolute right-3 top-1/2 z-20 h-12 w-12 -translate-y-1/2 flex items-center justify-center rounded-full border border-white/20 bg-black/35 text-white transition-colors hover:bg-black/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80 sm:right-6\"\n @click=\"next\"\n >\n <span aria-hidden=\"true\" class=\"text-xl leading-none\">›</span>\n </button>\n\n <div class=\"h-full w-full flex items-center justify-center\">\n <img\n v-if=\"currentUrl\"\n ref=\"imageEl\"\n data-gr-image-viewer-image\n :src=\"currentUrl\"\n alt=\"\"\n draggable=\"false\"\n class=\"max-h-full max-w-full select-none object-contain will-change-transform\"\n :class=\"[imageTransitionClass, imageCursorClass]\"\n :style=\"imageStyle\"\n @load=\"onImageLoad\"\n @pointerdown=\"onPointerDown\"\n @pointermove=\"onPointerMove\"\n @pointerup=\"onPointerUp\"\n @pointercancel=\"onPointerUp\"\n >\n\n <div\n v-else\n class=\"rounded-[var(--gr-radius-xl)] border border-white/20 bg-black/25 px-4 py-3 text-sm text-white/80\"\n >\n {{ resolvedEmptyText }}\n </div>\n </div>\n </div>\n\n <div class=\"pointer-events-none absolute inset-x-0 bottom-0 z-30 px-3 pb-3 sm:px-6 sm:pb-6\">\n <div class=\"pointer-events-auto mx-auto w-full max-w-max\">\n <slot\n name=\"toolbar\"\n v-bind=\"toolbarSlotProps\"\n >\n <div class=\"rounded-full border border-white/20 bg-black/35 p-1 backdrop-blur-sm flex items-center gap-1\">\n <button\n type=\"button\"\n data-gr-image-viewer-zoom-out\n :aria-label=\"resolvedZoomOutLabel\"\n class=\"h-11 min-w-11 px-2 flex items-center justify-center rounded-full text-sm font-600 text-white transition-colors hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80\"\n @click=\"zoomOut\"\n >\n −\n </button>\n\n <button\n type=\"button\"\n data-gr-image-viewer-zoom-reset\n :aria-label=\"resolvedResetZoomLabel\"\n class=\"h-11 min-w-11 px-3 flex items-center justify-center rounded-full text-xs font-700 text-white transition-colors hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80\"\n @click=\"resetTransform\"\n >\n 100%\n </button>\n\n <button\n type=\"button\"\n data-gr-image-viewer-zoom-in\n :aria-label=\"resolvedZoomInLabel\"\n class=\"h-11 min-w-11 px-2 flex items-center justify-center rounded-full text-sm font-600 text-white transition-colors hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80\"\n @click=\"zoomIn\"\n >\n +\n </button>\n\n <template v-if=\"$slots['toolbar-actions']\">\n <div class=\"mx-1 h-6 w-px bg-white/25\" aria-hidden=\"true\" />\n\n <slot\n name=\"toolbar-actions\"\n v-bind=\"toolbarSlotProps\"\n />\n\n <div class=\"mx-1 h-6 w-px bg-white/25\" aria-hidden=\"true\" />\n </template>\n\n <div v-else class=\"mx-1 h-6 w-px bg-white/25\" aria-hidden=\"true\" />\n\n <button\n type=\"button\"\n data-gr-image-viewer-rotate-left\n :aria-label=\"resolvedRotateLeftLabel\"\n class=\"h-11 min-w-11 px-2 flex items-center justify-center rounded-full text-sm font-600 text-white transition-colors hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80\"\n @click=\"rotateLeft\"\n >\n ↺\n </button>\n\n <button\n type=\"button\"\n data-gr-image-viewer-rotate-right\n :aria-label=\"resolvedRotateRightLabel\"\n class=\"h-11 min-w-11 px-2 flex items-center justify-center rounded-full text-sm font-600 text-white transition-colors hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/80\"\n @click=\"rotateRight\"\n >\n ↻\n </button>\n </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D,mBAAmE,OAAnE,WAAmE;SAEnE,mBAQS,UAAA;UAPP,MAAK;UACL,oCAAA;UACC,cAAY,wBAAA;UACb,OAAM;UACL,SAAK,OAAA,OAAA,OAAA,MAAA,GAAA,SAAE,MAAA,UAAA,KAAA,MAAA,UAAA,CAAA,CAAA,GAAA,IAAA;YACT,OAED,GAAA,WAAA;SAEA,mBAQS,UAAA;UAPP,MAAK;UACL,qCAAA;UACC,cAAY,yBAAA;UACb,OAAM;UACL,SAAK,OAAA,QAAA,OAAA,OAAA,GAAA,SAAE,MAAA,WAAA,KAAA,MAAA,WAAA,CAAA,CAAA,GAAA,IAAA;YACT,OAED,GAAA,WAAA"}
@@ -1,3 +1,3 @@
1
- import { t as GrImageViewer_default } from "./chunks/GrImageViewer-OCUIrNh2.js";
1
+ import { t as GrImageViewer_default } from "./chunks/GrImageViewer-Dla9IBkd.js";
2
2
  import { t as grImageViewerConfig } from "../../chunks/config-HZto2PVy.js";
3
3
  export { GrImageViewer_default as GrImageViewer, GrImageViewer_default as default, grImageViewerConfig };
@@ -0,0 +1,334 @@
1
+ import { t as x_default } from "../../../chunks/x-2KXnqxiD.js";
2
+ import { t as useGranularityTranslations } from "../../../chunks/granularityI18n-DoV7Ca2m.js";
3
+ import { n as useGrFormFieldContext } from "../../../chunks/context-DdNIxa1w.js";
4
+ import { n as useAddonMeasurement, t as addLen } from "../../../chunks/useAddonMeasurement-DM0akF4C.js";
5
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, markRaw, mergeProps, normalizeClass, normalizeStyle, openBlock, ref, renderSlot, toDisplayString, unref, useSlots } from "vue";
6
+ //#region ~icons/lucide/eye
7
+ var _hoisted_1$2 = {
8
+ viewBox: "0 0 24 24",
9
+ width: "1.2em",
10
+ height: "1.2em"
11
+ };
12
+ function render$2(_ctx, _cache) {
13
+ return openBlock(), createElementBlock("svg", _hoisted_1$2, [..._cache[0] || (_cache[0] = [createElementVNode("g", {
14
+ fill: "none",
15
+ stroke: "currentColor",
16
+ "stroke-linecap": "round",
17
+ "stroke-linejoin": "round",
18
+ "stroke-width": "2"
19
+ }, [createElementVNode("path", { d: "M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0" }), createElementVNode("circle", {
20
+ cx: "12",
21
+ cy: "12",
22
+ r: "3"
23
+ })], -1)])]);
24
+ }
25
+ var eye_default = markRaw({
26
+ name: "lucide-eye",
27
+ render: render$2
28
+ });
29
+ //#endregion
30
+ //#region ~icons/lucide/eye-off
31
+ var _hoisted_1$1 = {
32
+ viewBox: "0 0 24 24",
33
+ width: "1.2em",
34
+ height: "1.2em"
35
+ };
36
+ function render$1(_ctx, _cache) {
37
+ return openBlock(), createElementBlock("svg", _hoisted_1$1, [..._cache[0] || (_cache[0] = [createElementVNode("g", {
38
+ fill: "none",
39
+ stroke: "currentColor",
40
+ "stroke-linecap": "round",
41
+ "stroke-linejoin": "round",
42
+ "stroke-width": "2"
43
+ }, [createElementVNode("path", { d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575a1 1 0 0 1 0 .696a10.8 10.8 0 0 1-1.444 2.49m-6.41-.679a3 3 0 0 1-4.242-4.242" }), createElementVNode("path", { d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 4.446-5.143M2 2l20 20" })], -1)])]);
44
+ }
45
+ var eye_off_default = markRaw({
46
+ name: "lucide-eye-off",
47
+ render: render$1
48
+ });
49
+ //#endregion
50
+ //#region src/components/GrInput/GrInput.vue?vue&type=script&setup=true&lang.ts
51
+ var _hoisted_1 = {
52
+ "data-gr-input": "",
53
+ class: "w-full"
54
+ };
55
+ var _hoisted_2 = [
56
+ "id",
57
+ "name",
58
+ "type",
59
+ "inputmode",
60
+ "autocomplete",
61
+ "placeholder",
62
+ "disabled",
63
+ "readonly",
64
+ "maxlength",
65
+ "value",
66
+ "aria-invalid",
67
+ "aria-describedby",
68
+ "aria-required"
69
+ ];
70
+ var _hoisted_3 = {
71
+ key: 1,
72
+ "data-gr-input-trailing": "",
73
+ class: "absolute inset-y-0 right-1 flex items-center gap-0.5"
74
+ };
75
+ var _hoisted_4 = ["aria-label"];
76
+ var _hoisted_5 = ["aria-label", "aria-pressed"];
77
+ var _hoisted_6 = {
78
+ key: 0,
79
+ "data-gr-input-count": "",
80
+ class: "mt-1 text-right text-xs text-[var(--muted-fg)] tabular-nums"
81
+ };
82
+ //#endregion
83
+ //#region src/components/GrInput/GrInput.vue
84
+ var GrInput_default = /* @__PURE__ */ defineComponent({
85
+ inheritAttrs: false,
86
+ __name: "GrInput",
87
+ props: {
88
+ modelValue: {},
89
+ type: { default: "text" },
90
+ placeholder: { default: void 0 },
91
+ autocomplete: { default: void 0 },
92
+ inputmode: { default: void 0 },
93
+ disabled: {
94
+ type: Boolean,
95
+ default: false
96
+ },
97
+ readonly: {
98
+ type: Boolean,
99
+ default: false
100
+ },
101
+ invalid: {
102
+ type: Boolean,
103
+ default: false
104
+ },
105
+ state: { default: "default" },
106
+ name: { default: void 0 },
107
+ id: { default: void 0 },
108
+ size: { default: "md" },
109
+ clearable: {
110
+ type: Boolean,
111
+ default: false
112
+ },
113
+ clearLabel: { default: void 0 },
114
+ maxlength: { default: void 0 },
115
+ showCount: {
116
+ type: Boolean,
117
+ default: false
118
+ },
119
+ passwordToggle: {
120
+ type: Boolean,
121
+ default: false
122
+ },
123
+ passwordShowLabel: { default: void 0 },
124
+ passwordHideLabel: { default: void 0 },
125
+ textAlign: { default: "left" },
126
+ prefixMinWidth: { default: void 0 },
127
+ prefixMaxWidth: { default: void 0 },
128
+ suffixMinWidth: { default: void 0 },
129
+ suffixMaxWidth: { default: void 0 },
130
+ prefixFixed: {
131
+ type: Boolean,
132
+ default: false
133
+ },
134
+ suffixFixed: {
135
+ type: Boolean,
136
+ default: false
137
+ }
138
+ },
139
+ emits: ["update:modelValue"],
140
+ setup(__props, { expose: __expose, emit: __emit }) {
141
+ const props = __props;
142
+ const emit = __emit;
143
+ const field = useGrFormFieldContext();
144
+ const resolvedId = computed(() => props.id ?? field?.id.value);
145
+ const isInvalid = computed(() => props.invalid || Boolean(field?.invalid.value));
146
+ const describedBy = computed(() => field?.describedById.value);
147
+ const isRequired = computed(() => Boolean(field?.required.value));
148
+ const inputEl = ref(null);
149
+ function focus() {
150
+ inputEl.value?.focus();
151
+ }
152
+ __expose({ focus });
153
+ const slots = useSlots();
154
+ const hasPrefix = computed(() => Boolean(slots.prefix));
155
+ const hasSuffix = computed(() => Boolean(slots.suffix));
156
+ const defaultAddonMinWidth = computed(() => {
157
+ return {
158
+ xs: "2rem",
159
+ sm: "2.25rem",
160
+ md: "2.5rem",
161
+ lg: "3rem"
162
+ }[props.size];
163
+ });
164
+ const prefixMinWidth = computed(() => props.prefixMinWidth ?? defaultAddonMinWidth.value);
165
+ const suffixMinWidth = computed(() => props.suffixMinWidth ?? defaultAddonMinWidth.value);
166
+ const prefixFixedWidth = computed(() => props.prefixMaxWidth ?? props.prefixMinWidth ?? defaultAddonMinWidth.value);
167
+ const suffixFixedWidth = computed(() => props.suffixMaxWidth ?? props.suffixMinWidth ?? defaultAddonMinWidth.value);
168
+ const { prefixEl, suffixEl, measuredPrefixWidth, measuredSuffixWidth } = useAddonMeasurement(hasPrefix, hasSuffix);
169
+ const basePaddingXLen = computed(() => {
170
+ return {
171
+ xs: "10px",
172
+ sm: "12px",
173
+ md: "12px",
174
+ lg: "16px"
175
+ }[props.size];
176
+ });
177
+ const inputStyle = computed(() => {
178
+ const leftReserved = hasPrefix.value ? props.prefixFixed ? prefixFixedWidth.value : measuredPrefixWidth.value ?? prefixMinWidth.value : "0px";
179
+ const rightReserved = hasSuffix.value ? props.suffixFixed ? suffixFixedWidth.value : measuredSuffixWidth.value ?? suffixMinWidth.value : "0px";
180
+ const left = hasPrefix.value ? addLen(leftReserved, basePaddingXLen.value) : void 0;
181
+ const rightSpace = addLen(rightReserved, trailingReserve.value);
182
+ return {
183
+ paddingLeft: left,
184
+ paddingRight: hasSuffix.value || trailingCount.value > 0 ? addLen(rightSpace, basePaddingXLen.value) : void 0
185
+ };
186
+ });
187
+ const prefixStyle = computed(() => {
188
+ if (props.prefixFixed) return {
189
+ width: prefixFixedWidth.value,
190
+ minWidth: prefixFixedWidth.value,
191
+ maxWidth: prefixFixedWidth.value
192
+ };
193
+ return {
194
+ minWidth: prefixMinWidth.value,
195
+ maxWidth: props.prefixMaxWidth
196
+ };
197
+ });
198
+ const suffixStyle = computed(() => {
199
+ if (props.suffixFixed) return {
200
+ width: suffixFixedWidth.value,
201
+ minWidth: suffixFixedWidth.value,
202
+ maxWidth: suffixFixedWidth.value
203
+ };
204
+ return {
205
+ minWidth: suffixMinWidth.value,
206
+ maxWidth: props.suffixMaxWidth
207
+ };
208
+ });
209
+ const sizeClass = computed(() => {
210
+ return {
211
+ xs: "h-7 px-2.5 text-[12px]",
212
+ sm: "h-8 px-3 text-[13px]",
213
+ md: "h-10 px-3 text-[14px]",
214
+ lg: "h-11 px-4 text-[16px]"
215
+ }[props.size];
216
+ });
217
+ const textAlignClass = computed(() => {
218
+ return {
219
+ left: "text-left",
220
+ center: "text-center",
221
+ right: "text-right"
222
+ }[props.textAlign];
223
+ });
224
+ const shellClass = computed(() => {
225
+ const state = props.state;
226
+ const borderByState = {
227
+ default: "border-[var(--brd)]",
228
+ success: "border-[var(--gr-success)] focus-within:ring-[var(--gr-success)]",
229
+ warning: "border-[var(--gr-warning)] focus-within:ring-[var(--gr-warning)]",
230
+ danger: "border-[var(--gr-danger)] focus-within:ring-[var(--gr-danger)]"
231
+ };
232
+ return [isInvalid.value ? borderByState.danger : borderByState[state], props.disabled ? "opacity-50 cursor-not-allowed" : ""].filter(Boolean).join(" ");
233
+ });
234
+ const className = computed(() => {
235
+ return [sizeClass.value, textAlignClass.value].join(" ");
236
+ });
237
+ function onInput(e) {
238
+ emit("update:modelValue", e.target.value);
239
+ }
240
+ const { t } = useGranularityTranslations();
241
+ const resolvedClearLabel = computed(() => props.clearLabel ?? t("gr.input.clear", "Clear"));
242
+ const resolvedPasswordShowLabel = computed(() => props.passwordShowLabel ?? t("gr.input.showPassword", "Show password"));
243
+ const resolvedPasswordHideLabel = computed(() => props.passwordHideLabel ?? t("gr.input.hidePassword", "Hide password"));
244
+ const passwordVisible = ref(false);
245
+ const resolvedType = computed(() => props.type === "password" && passwordVisible.value ? "text" : props.type);
246
+ const showPasswordToggle = computed(() => props.passwordToggle && props.type === "password" && !props.disabled);
247
+ const showClear = computed(() => props.clearable && props.modelValue.length > 0 && !props.disabled && !props.readonly);
248
+ const trailingCount = computed(() => (showClear.value ? 1 : 0) + (showPasswordToggle.value ? 1 : 0));
249
+ const trailingReserve = computed(() => trailingCount.value > 0 ? `${trailingCount.value * 28}px` : "0px");
250
+ const countText = computed(() => props.maxlength !== void 0 ? `${props.modelValue.length} / ${props.maxlength}` : String(props.modelValue.length));
251
+ function clear() {
252
+ emit("update:modelValue", "");
253
+ inputEl.value?.focus();
254
+ }
255
+ function togglePassword() {
256
+ passwordVisible.value = !passwordVisible.value;
257
+ inputEl.value?.focus();
258
+ }
259
+ return (_ctx, _cache) => {
260
+ return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", { class: normalizeClass(["relative w-full overflow-hidden rounded-md border bg-[var(--bg)] transition-colors duration-150 focus-within:ring-2 focus-within:ring-[var(--ring)]", shellClass.value]) }, [
261
+ _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
262
+ key: 0,
263
+ ref_key: "prefixEl",
264
+ ref: prefixEl,
265
+ "data-testid": "gr-input-prefix",
266
+ class: "absolute inset-y-0 left-0 flex items-center justify-center border-r border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate",
267
+ style: normalizeStyle(prefixStyle.value),
268
+ "aria-hidden": "true"
269
+ }, [renderSlot(_ctx.$slots, "prefix")], 4)) : createCommentVNode("", true),
270
+ createElementVNode("input", mergeProps({
271
+ id: resolvedId.value,
272
+ ref_key: "inputEl",
273
+ ref: inputEl
274
+ }, _ctx.$attrs, {
275
+ name: props.name,
276
+ type: resolvedType.value,
277
+ inputmode: props.inputmode,
278
+ autocomplete: props.autocomplete,
279
+ placeholder: props.placeholder,
280
+ disabled: props.disabled,
281
+ readonly: props.readonly,
282
+ maxlength: props.maxlength,
283
+ value: props.modelValue,
284
+ "aria-invalid": isInvalid.value ? "true" : void 0,
285
+ "aria-describedby": describedBy.value,
286
+ "aria-required": isRequired.value ? "true" : void 0,
287
+ class: ["w-full bg-transparent text-[var(--fg)] placeholder:text-[var(--muted-fg)] focus:placeholder:text-transparent focus:outline-none disabled:cursor-not-allowed", className.value],
288
+ style: inputStyle.value,
289
+ onInput
290
+ }), null, 16, _hoisted_2),
291
+ trailingCount.value > 0 ? (openBlock(), createElementBlock("div", _hoisted_3, [showClear.value ? (openBlock(), createElementBlock("button", {
292
+ key: 0,
293
+ type: "button",
294
+ "data-gr-input-clear": "",
295
+ "aria-label": resolvedClearLabel.value,
296
+ class: "flex h-6 w-6 items-center justify-center rounded text-[var(--muted-fg)] transition-colors hover:bg-[var(--muted)] hover:text-[var(--fg)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",
297
+ tabindex: "-1",
298
+ onClick: clear
299
+ }, [createVNode(unref(x_default), {
300
+ class: "h-4 w-4",
301
+ "aria-hidden": "true"
302
+ })], 8, _hoisted_4)) : createCommentVNode("", true), showPasswordToggle.value ? (openBlock(), createElementBlock("button", {
303
+ key: 1,
304
+ type: "button",
305
+ "data-gr-input-password-toggle": "",
306
+ "aria-label": passwordVisible.value ? resolvedPasswordHideLabel.value : resolvedPasswordShowLabel.value,
307
+ "aria-pressed": passwordVisible.value ? "true" : "false",
308
+ class: "flex h-6 w-6 items-center justify-center rounded text-[var(--muted-fg)] transition-colors hover:bg-[var(--muted)] hover:text-[var(--fg)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",
309
+ tabindex: "-1",
310
+ onClick: togglePassword
311
+ }, [passwordVisible.value ? (openBlock(), createBlock(unref(eye_off_default), {
312
+ key: 0,
313
+ class: "h-4 w-4",
314
+ "aria-hidden": "true"
315
+ })) : (openBlock(), createBlock(unref(eye_default), {
316
+ key: 1,
317
+ class: "h-4 w-4",
318
+ "aria-hidden": "true"
319
+ }))], 8, _hoisted_5)) : createCommentVNode("", true)])) : createCommentVNode("", true),
320
+ _ctx.$slots.suffix ? (openBlock(), createElementBlock("div", {
321
+ key: 2,
322
+ ref_key: "suffixEl",
323
+ ref: suffixEl,
324
+ "data-testid": "gr-input-suffix",
325
+ class: normalizeClass(["absolute inset-y-0 right-0 flex items-center justify-center border-l border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate", __props.suffixFixed ? "[direction:rtl]" : ""]),
326
+ style: normalizeStyle(suffixStyle.value),
327
+ "aria-hidden": "true"
328
+ }, [renderSlot(_ctx.$slots, "suffix")], 6)) : createCommentVNode("", true)
329
+ ], 2), __props.showCount ? (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(countText.value), 1)) : createCommentVNode("", true)]);
330
+ };
331
+ }
332
+ });
333
+ //#endregion
334
+ export { GrInput_default as t };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GrInput-B8dd3JaA.js","names":["$slots","$attrs"],"sources":["../../../../src/components/GrInput/GrInput.vue","../../../../src/components/GrInput/GrInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {computed, ref, useSlots} from 'vue'\n\nimport {addLen, useAddonMeasurement} from '../../composables/internal/useAddonMeasurement'\nimport {useGrFormFieldContext} from '../GrFormField/context'\nimport {useGranularityTranslations} from '../../internal/granularityI18n'\nimport type {InputHTMLAttributes} from 'vue'\n\nimport IconX from '~icons/lucide/x'\nimport IconEye from '~icons/lucide/eye'\nimport IconEyeOff from '~icons/lucide/eye-off'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nexport type GrInputSize = 'xs' | 'sm' | 'md' | 'lg'\nexport type GrInputTextAlign = 'left' | 'center' | 'right'\n\nconst props = withDefaults(\n defineProps<{\n modelValue: string\n type?: 'text' | 'email' | 'password' | 'number' | 'search'\n placeholder?: string\n autocomplete?: string\n inputmode?: InputHTMLAttributes['inputmode']\n disabled?: boolean\n /** Только для чтения: значение видно и выделяемо, но не редактируется. */\n readonly?: boolean\n invalid?: boolean\n state?: 'default' | 'success' | 'warning' | 'danger'\n name?: string\n id?: string\n size?: GrInputSize\n\n /** Показывать кнопку очистки, когда есть значение (и не disabled/readonly). */\n clearable?: boolean\n /** i18n aria-label кнопки очистки. */\n clearLabel?: string\n /** Ограничение длины + основа для счётчика символов. */\n maxlength?: number\n /** Показывать счётчик символов (`len` или `len/maxlength`). */\n showCount?: boolean\n /** Кнопка показать/скрыть пароль (только при `type=\"password\"`). */\n passwordToggle?: boolean\n /** i18n aria-label кнопки показать/скрыть пароль. */\n passwordShowLabel?: string\n passwordHideLabel?: string\n\n textAlign?: GrInputTextAlign\n\n prefixMinWidth?: string\n prefixMaxWidth?: string\n suffixMinWidth?: string\n suffixMaxWidth?: string\n /**\n * Фиксированная ширина у prefix/suffix: аддон получает жёсткую ширину\n * (из `*MaxWidth` → `*MinWidth` → дефолт), а контент обрезается по краю\n * (prefix — справа, suffix — слева). По умолчанию аддоны «растягиваются»\n * под контент (в пределах min/max), а излишек клипается оболочкой.\n */\n prefixFixed?: boolean\n suffixFixed?: boolean\n }>(),\n {\n type: 'text',\n placeholder: undefined,\n autocomplete: undefined,\n inputmode: undefined,\n disabled: false,\n readonly: false,\n invalid: false,\n state: 'default',\n name: undefined,\n id: undefined,\n size: 'md',\n\n clearable: false,\n clearLabel: undefined,\n maxlength: undefined,\n showCount: false,\n passwordToggle: false,\n passwordShowLabel: undefined,\n passwordHideLabel: undefined,\n\n textAlign: 'left',\n\n prefixMinWidth: undefined,\n prefixMaxWidth: undefined,\n suffixMinWidth: undefined,\n suffixMaxWidth: undefined,\n prefixFixed: false,\n suffixFixed: false,\n },\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: string): void\n}>()\n\n// Контекст `GrFormField` (если инпут внутри него): даёт id/aria-describedby/\n// invalid/required как fallback, чтобы не прокидывать `forId` вручную.\nconst field = useGrFormFieldContext()\nconst resolvedId = computed(() => props.id ?? field?.id.value)\nconst isInvalid = computed(() => props.invalid || Boolean(field?.invalid.value))\nconst describedBy = computed(() => field?.describedById.value)\nconst isRequired = computed(() => Boolean(field?.required.value))\n\nconst inputEl = ref<HTMLInputElement | null>(null)\n\nfunction focus(): void {\n inputEl.value?.focus()\n}\n\ndefineExpose({\n focus,\n})\n\nconst slots = useSlots()\n\nconst hasPrefix = computed(() => Boolean(slots.prefix))\nconst hasSuffix = computed(() => Boolean(slots.suffix))\n\nconst defaultAddonMinWidth = computed(() => {\n const map: Record<NonNullable<typeof props.size>, string> = {\n xs: '2rem', // w-8\n sm: '2.25rem', // w-9\n md: '2.5rem', // w-10\n lg: '3rem', // w-12\n }\n\n return map[props.size]\n})\n\nconst prefixMinWidth = computed(() => props.prefixMinWidth ?? defaultAddonMinWidth.value)\nconst suffixMinWidth = computed(() => props.suffixMinWidth ?? defaultAddonMinWidth.value)\n\n// Жёсткая ширина для fixed-режима: max → min → дефолт.\nconst prefixFixedWidth = computed(() => props.prefixMaxWidth ?? props.prefixMinWidth ?? defaultAddonMinWidth.value)\nconst suffixFixedWidth = computed(() => props.suffixMaxWidth ?? props.suffixMinWidth ?? defaultAddonMinWidth.value)\n\nconst { prefixEl, suffixEl, measuredPrefixWidth, measuredSuffixWidth } = useAddonMeasurement(hasPrefix, hasSuffix)\n\nconst basePaddingXLen = computed(() => {\n // Must mirror `sizeClass` horizontal padding (px-*) because inline paddings override class paddings.\n const map: Record<NonNullable<typeof props.size>, string> = {\n xs: '10px', // px-2.5\n sm: '12px', // px-3\n md: '12px', // px-3\n lg: '16px', // px-4\n }\n\n return map[props.size]\n})\n\nconst inputStyle = computed(() => {\n const leftReserved = hasPrefix.value\n ? (props.prefixFixed ? prefixFixedWidth.value : measuredPrefixWidth.value ?? prefixMinWidth.value)\n : '0px'\n const rightReserved = hasSuffix.value\n ? (props.suffixFixed ? suffixFixedWidth.value : measuredSuffixWidth.value ?? suffixMinWidth.value)\n : '0px'\n\n // Keep the same visual text padding as without addons (px-*), but add it on top of reserved space.\n const left = hasPrefix.value ? addLen(leftReserved, basePaddingXLen.value) : undefined\n const rightSpace = addLen(rightReserved, trailingReserve.value)\n const right = (hasSuffix.value || trailingCount.value > 0)\n ? addLen(rightSpace, basePaddingXLen.value)\n : undefined\n\n return {\n paddingLeft: left,\n paddingRight: right,\n } as Record<string, string | undefined>\n})\n\nconst prefixStyle = computed(() => {\n if (props.prefixFixed) {\n return {\n width: prefixFixedWidth.value,\n minWidth: prefixFixedWidth.value,\n maxWidth: prefixFixedWidth.value,\n } as Record<string, string | undefined>\n }\n\n return {\n minWidth: prefixMinWidth.value,\n maxWidth: props.prefixMaxWidth,\n } as Record<string, string | undefined>\n})\n\nconst suffixStyle = computed(() => {\n if (props.suffixFixed) {\n return {\n width: suffixFixedWidth.value,\n minWidth: suffixFixedWidth.value,\n maxWidth: suffixFixedWidth.value,\n } as Record<string, string | undefined>\n }\n\n return {\n minWidth: suffixMinWidth.value,\n maxWidth: props.suffixMaxWidth,\n } as Record<string, string | undefined>\n})\n\nconst sizeClass = computed(() => {\n const map: Record<NonNullable<typeof props.size>, string> = {\n xs: 'h-7 px-2.5 text-[12px]',\n sm: 'h-8 px-3 text-[13px]',\n md: 'h-10 px-3 text-[14px]',\n lg: 'h-11 px-4 text-[16px]',\n }\n\n return map[props.size]\n})\n\nconst textAlignClass = computed(() => {\n const map: Record<NonNullable<typeof props.textAlign>, string> = {\n left: 'text-left',\n center: 'text-center',\n right: 'text-right',\n }\n\n return map[props.textAlign]\n})\n\n// Border/ring/disabled — на оболочке (`focus-within`), размеры/выравнивание — на инпуте.\nconst shellClass = computed(() => {\n const state = props.state\n\n const borderByState: Record<typeof state, string> = {\n default: 'border-[var(--brd)]',\n success: 'border-[var(--gr-success)] focus-within:ring-[var(--gr-success)]',\n warning: 'border-[var(--gr-warning)] focus-within:ring-[var(--gr-warning)]',\n danger: 'border-[var(--gr-danger)] focus-within:ring-[var(--gr-danger)]',\n }\n\n return [\n isInvalid.value ? borderByState.danger : borderByState[state],\n props.disabled ? 'opacity-50 cursor-not-allowed' : '',\n ].filter(Boolean).join(' ')\n})\n\nconst className = computed(() => {\n return [\n sizeClass.value,\n textAlignClass.value,\n ].join(' ')\n})\n\nfunction onInput(e: Event): void {\n emit('update:modelValue', (e.target as HTMLInputElement).value)\n}\n\n// ————— Trailing-контролы: очистка, переключатель пароля, счётчик символов.\nconst { t } = useGranularityTranslations()\nconst resolvedClearLabel = computed(() => props.clearLabel ?? t('gr.input.clear', 'Clear'))\nconst resolvedPasswordShowLabel = computed(() => props.passwordShowLabel ?? t('gr.input.showPassword', 'Show password'))\nconst resolvedPasswordHideLabel = computed(() => props.passwordHideLabel ?? t('gr.input.hidePassword', 'Hide password'))\n\nconst passwordVisible = ref(false)\n// Тип поля с учётом переключателя пароля.\nconst resolvedType = computed(() => (props.type === 'password' && passwordVisible.value ? 'text' : props.type))\n\nconst showPasswordToggle = computed(() => props.passwordToggle && props.type === 'password' && !props.disabled)\nconst showClear = computed(() => props.clearable && props.modelValue.length > 0 && !props.disabled && !props.readonly)\n\nconst trailingCount = computed(() => (showClear.value ? 1 : 0) + (showPasswordToggle.value ? 1 : 0))\nconst trailingReserve = computed(() => (trailingCount.value > 0 ? `${trailingCount.value * 28}px` : '0px'))\n\n// Счётчик символов: `len` или `len / maxlength`.\nconst countText = computed(() =>\n props.maxlength !== undefined ? `${props.modelValue.length} / ${props.maxlength}` : String(props.modelValue.length),\n)\n\nfunction clear(): void {\n emit('update:modelValue', '')\n inputEl.value?.focus()\n}\n\nfunction togglePassword(): void {\n passwordVisible.value = !passwordVisible.value\n inputEl.value?.focus()\n}\n</script>\n\n<template>\n <div data-gr-input class=\"w-full\">\n <div\n class=\"relative w-full overflow-hidden rounded-md border bg-[var(--bg)] transition-colors duration-150 focus-within:ring-2 focus-within:ring-[var(--ring)]\"\n :class=\"shellClass\"\n >\n <div\n v-if=\"$slots.prefix\"\n ref=\"prefixEl\"\n data-testid=\"gr-input-prefix\"\n class=\"absolute inset-y-0 left-0 flex items-center justify-center border-r border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate\"\n :style=\"prefixStyle\"\n aria-hidden=\"true\"\n >\n <slot name=\"prefix\" />\n </div>\n\n <input\n :id=\"resolvedId\"\n ref=\"inputEl\"\n v-bind=\"$attrs\"\n :name=\"props.name\"\n :type=\"resolvedType\"\n :inputmode=\"props.inputmode\"\n :autocomplete=\"props.autocomplete\"\n :placeholder=\"props.placeholder\"\n :disabled=\"props.disabled\"\n :readonly=\"props.readonly\"\n :maxlength=\"props.maxlength\"\n :value=\"props.modelValue\"\n :aria-invalid=\"isInvalid ? 'true' : undefined\"\n :aria-describedby=\"describedBy\"\n :aria-required=\"isRequired ? 'true' : undefined\"\n class=\"w-full bg-transparent text-[var(--fg)] placeholder:text-[var(--muted-fg)] focus:placeholder:text-transparent focus:outline-none disabled:cursor-not-allowed\"\n :class=\"className\"\n :style=\"inputStyle\"\n @input=\"onInput\"\n >\n\n <div\n v-if=\"trailingCount > 0\"\n data-gr-input-trailing\n class=\"absolute inset-y-0 right-1 flex items-center gap-0.5\"\n >\n <button\n v-if=\"showClear\"\n type=\"button\"\n data-gr-input-clear\n :aria-label=\"resolvedClearLabel\"\n class=\"flex h-6 w-6 items-center justify-center rounded text-[var(--muted-fg)] transition-colors hover:bg-[var(--muted)] hover:text-[var(--fg)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]\"\n tabindex=\"-1\"\n @click=\"clear\"\n >\n <IconX class=\"h-4 w-4\" aria-hidden=\"true\" />\n </button>\n\n <button\n v-if=\"showPasswordToggle\"\n type=\"button\"\n data-gr-input-password-toggle\n :aria-label=\"passwordVisible ? resolvedPasswordHideLabel : resolvedPasswordShowLabel\"\n :aria-pressed=\"passwordVisible ? 'true' : 'false'\"\n class=\"flex h-6 w-6 items-center justify-center rounded text-[var(--muted-fg)] transition-colors hover:bg-[var(--muted)] hover:text-[var(--fg)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]\"\n tabindex=\"-1\"\n @click=\"togglePassword\"\n >\n <IconEyeOff v-if=\"passwordVisible\" class=\"h-4 w-4\" aria-hidden=\"true\" />\n <IconEye v-else class=\"h-4 w-4\" aria-hidden=\"true\" />\n </button>\n </div>\n\n <div\n v-if=\"$slots.suffix\"\n ref=\"suffixEl\"\n data-testid=\"gr-input-suffix\"\n class=\"absolute inset-y-0 right-0 flex items-center justify-center border-l border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate\"\n :class=\"suffixFixed ? '[direction:rtl]' : ''\"\n :style=\"suffixStyle\"\n aria-hidden=\"true\"\n >\n <slot name=\"suffix\" />\n </div>\n </div>\n\n <div\n v-if=\"showCount\"\n data-gr-input-count\n class=\"mt-1 text-right text-xs text-[var(--muted-fg)] tabular-nums\"\n >\n {{ countText }}\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport {computed, ref, useSlots} from 'vue'\n\nimport {addLen, useAddonMeasurement} from '../../composables/internal/useAddonMeasurement'\nimport {useGrFormFieldContext} from '../GrFormField/context'\nimport {useGranularityTranslations} from '../../internal/granularityI18n'\nimport type {InputHTMLAttributes} from 'vue'\n\nimport IconX from '~icons/lucide/x'\nimport IconEye from '~icons/lucide/eye'\nimport IconEyeOff from '~icons/lucide/eye-off'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nexport type GrInputSize = 'xs' | 'sm' | 'md' | 'lg'\nexport type GrInputTextAlign = 'left' | 'center' | 'right'\n\nconst props = withDefaults(\n defineProps<{\n modelValue: string\n type?: 'text' | 'email' | 'password' | 'number' | 'search'\n placeholder?: string\n autocomplete?: string\n inputmode?: InputHTMLAttributes['inputmode']\n disabled?: boolean\n /** Только для чтения: значение видно и выделяемо, но не редактируется. */\n readonly?: boolean\n invalid?: boolean\n state?: 'default' | 'success' | 'warning' | 'danger'\n name?: string\n id?: string\n size?: GrInputSize\n\n /** Показывать кнопку очистки, когда есть значение (и не disabled/readonly). */\n clearable?: boolean\n /** i18n aria-label кнопки очистки. */\n clearLabel?: string\n /** Ограничение длины + основа для счётчика символов. */\n maxlength?: number\n /** Показывать счётчик символов (`len` или `len/maxlength`). */\n showCount?: boolean\n /** Кнопка показать/скрыть пароль (только при `type=\"password\"`). */\n passwordToggle?: boolean\n /** i18n aria-label кнопки показать/скрыть пароль. */\n passwordShowLabel?: string\n passwordHideLabel?: string\n\n textAlign?: GrInputTextAlign\n\n prefixMinWidth?: string\n prefixMaxWidth?: string\n suffixMinWidth?: string\n suffixMaxWidth?: string\n /**\n * Фиксированная ширина у prefix/suffix: аддон получает жёсткую ширину\n * (из `*MaxWidth` → `*MinWidth` → дефолт), а контент обрезается по краю\n * (prefix — справа, suffix — слева). По умолчанию аддоны «растягиваются»\n * под контент (в пределах min/max), а излишек клипается оболочкой.\n */\n prefixFixed?: boolean\n suffixFixed?: boolean\n }>(),\n {\n type: 'text',\n placeholder: undefined,\n autocomplete: undefined,\n inputmode: undefined,\n disabled: false,\n readonly: false,\n invalid: false,\n state: 'default',\n name: undefined,\n id: undefined,\n size: 'md',\n\n clearable: false,\n clearLabel: undefined,\n maxlength: undefined,\n showCount: false,\n passwordToggle: false,\n passwordShowLabel: undefined,\n passwordHideLabel: undefined,\n\n textAlign: 'left',\n\n prefixMinWidth: undefined,\n prefixMaxWidth: undefined,\n suffixMinWidth: undefined,\n suffixMaxWidth: undefined,\n prefixFixed: false,\n suffixFixed: false,\n },\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: string): void\n}>()\n\n// Контекст `GrFormField` (если инпут внутри него): даёт id/aria-describedby/\n// invalid/required как fallback, чтобы не прокидывать `forId` вручную.\nconst field = useGrFormFieldContext()\nconst resolvedId = computed(() => props.id ?? field?.id.value)\nconst isInvalid = computed(() => props.invalid || Boolean(field?.invalid.value))\nconst describedBy = computed(() => field?.describedById.value)\nconst isRequired = computed(() => Boolean(field?.required.value))\n\nconst inputEl = ref<HTMLInputElement | null>(null)\n\nfunction focus(): void {\n inputEl.value?.focus()\n}\n\ndefineExpose({\n focus,\n})\n\nconst slots = useSlots()\n\nconst hasPrefix = computed(() => Boolean(slots.prefix))\nconst hasSuffix = computed(() => Boolean(slots.suffix))\n\nconst defaultAddonMinWidth = computed(() => {\n const map: Record<NonNullable<typeof props.size>, string> = {\n xs: '2rem', // w-8\n sm: '2.25rem', // w-9\n md: '2.5rem', // w-10\n lg: '3rem', // w-12\n }\n\n return map[props.size]\n})\n\nconst prefixMinWidth = computed(() => props.prefixMinWidth ?? defaultAddonMinWidth.value)\nconst suffixMinWidth = computed(() => props.suffixMinWidth ?? defaultAddonMinWidth.value)\n\n// Жёсткая ширина для fixed-режима: max → min → дефолт.\nconst prefixFixedWidth = computed(() => props.prefixMaxWidth ?? props.prefixMinWidth ?? defaultAddonMinWidth.value)\nconst suffixFixedWidth = computed(() => props.suffixMaxWidth ?? props.suffixMinWidth ?? defaultAddonMinWidth.value)\n\nconst { prefixEl, suffixEl, measuredPrefixWidth, measuredSuffixWidth } = useAddonMeasurement(hasPrefix, hasSuffix)\n\nconst basePaddingXLen = computed(() => {\n // Must mirror `sizeClass` horizontal padding (px-*) because inline paddings override class paddings.\n const map: Record<NonNullable<typeof props.size>, string> = {\n xs: '10px', // px-2.5\n sm: '12px', // px-3\n md: '12px', // px-3\n lg: '16px', // px-4\n }\n\n return map[props.size]\n})\n\nconst inputStyle = computed(() => {\n const leftReserved = hasPrefix.value\n ? (props.prefixFixed ? prefixFixedWidth.value : measuredPrefixWidth.value ?? prefixMinWidth.value)\n : '0px'\n const rightReserved = hasSuffix.value\n ? (props.suffixFixed ? suffixFixedWidth.value : measuredSuffixWidth.value ?? suffixMinWidth.value)\n : '0px'\n\n // Keep the same visual text padding as without addons (px-*), but add it on top of reserved space.\n const left = hasPrefix.value ? addLen(leftReserved, basePaddingXLen.value) : undefined\n const rightSpace = addLen(rightReserved, trailingReserve.value)\n const right = (hasSuffix.value || trailingCount.value > 0)\n ? addLen(rightSpace, basePaddingXLen.value)\n : undefined\n\n return {\n paddingLeft: left,\n paddingRight: right,\n } as Record<string, string | undefined>\n})\n\nconst prefixStyle = computed(() => {\n if (props.prefixFixed) {\n return {\n width: prefixFixedWidth.value,\n minWidth: prefixFixedWidth.value,\n maxWidth: prefixFixedWidth.value,\n } as Record<string, string | undefined>\n }\n\n return {\n minWidth: prefixMinWidth.value,\n maxWidth: props.prefixMaxWidth,\n } as Record<string, string | undefined>\n})\n\nconst suffixStyle = computed(() => {\n if (props.suffixFixed) {\n return {\n width: suffixFixedWidth.value,\n minWidth: suffixFixedWidth.value,\n maxWidth: suffixFixedWidth.value,\n } as Record<string, string | undefined>\n }\n\n return {\n minWidth: suffixMinWidth.value,\n maxWidth: props.suffixMaxWidth,\n } as Record<string, string | undefined>\n})\n\nconst sizeClass = computed(() => {\n const map: Record<NonNullable<typeof props.size>, string> = {\n xs: 'h-7 px-2.5 text-[12px]',\n sm: 'h-8 px-3 text-[13px]',\n md: 'h-10 px-3 text-[14px]',\n lg: 'h-11 px-4 text-[16px]',\n }\n\n return map[props.size]\n})\n\nconst textAlignClass = computed(() => {\n const map: Record<NonNullable<typeof props.textAlign>, string> = {\n left: 'text-left',\n center: 'text-center',\n right: 'text-right',\n }\n\n return map[props.textAlign]\n})\n\n// Border/ring/disabled — на оболочке (`focus-within`), размеры/выравнивание — на инпуте.\nconst shellClass = computed(() => {\n const state = props.state\n\n const borderByState: Record<typeof state, string> = {\n default: 'border-[var(--brd)]',\n success: 'border-[var(--gr-success)] focus-within:ring-[var(--gr-success)]',\n warning: 'border-[var(--gr-warning)] focus-within:ring-[var(--gr-warning)]',\n danger: 'border-[var(--gr-danger)] focus-within:ring-[var(--gr-danger)]',\n }\n\n return [\n isInvalid.value ? borderByState.danger : borderByState[state],\n props.disabled ? 'opacity-50 cursor-not-allowed' : '',\n ].filter(Boolean).join(' ')\n})\n\nconst className = computed(() => {\n return [\n sizeClass.value,\n textAlignClass.value,\n ].join(' ')\n})\n\nfunction onInput(e: Event): void {\n emit('update:modelValue', (e.target as HTMLInputElement).value)\n}\n\n// ————— Trailing-контролы: очистка, переключатель пароля, счётчик символов.\nconst { t } = useGranularityTranslations()\nconst resolvedClearLabel = computed(() => props.clearLabel ?? t('gr.input.clear', 'Clear'))\nconst resolvedPasswordShowLabel = computed(() => props.passwordShowLabel ?? t('gr.input.showPassword', 'Show password'))\nconst resolvedPasswordHideLabel = computed(() => props.passwordHideLabel ?? t('gr.input.hidePassword', 'Hide password'))\n\nconst passwordVisible = ref(false)\n// Тип поля с учётом переключателя пароля.\nconst resolvedType = computed(() => (props.type === 'password' && passwordVisible.value ? 'text' : props.type))\n\nconst showPasswordToggle = computed(() => props.passwordToggle && props.type === 'password' && !props.disabled)\nconst showClear = computed(() => props.clearable && props.modelValue.length > 0 && !props.disabled && !props.readonly)\n\nconst trailingCount = computed(() => (showClear.value ? 1 : 0) + (showPasswordToggle.value ? 1 : 0))\nconst trailingReserve = computed(() => (trailingCount.value > 0 ? `${trailingCount.value * 28}px` : '0px'))\n\n// Счётчик символов: `len` или `len / maxlength`.\nconst countText = computed(() =>\n props.maxlength !== undefined ? `${props.modelValue.length} / ${props.maxlength}` : String(props.modelValue.length),\n)\n\nfunction clear(): void {\n emit('update:modelValue', '')\n inputEl.value?.focus()\n}\n\nfunction togglePassword(): void {\n passwordVisible.value = !passwordVisible.value\n inputEl.value?.focus()\n}\n</script>\n\n<template>\n <div data-gr-input class=\"w-full\">\n <div\n class=\"relative w-full overflow-hidden rounded-md border bg-[var(--bg)] transition-colors duration-150 focus-within:ring-2 focus-within:ring-[var(--ring)]\"\n :class=\"shellClass\"\n >\n <div\n v-if=\"$slots.prefix\"\n ref=\"prefixEl\"\n data-testid=\"gr-input-prefix\"\n class=\"absolute inset-y-0 left-0 flex items-center justify-center border-r border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate\"\n :style=\"prefixStyle\"\n aria-hidden=\"true\"\n >\n <slot name=\"prefix\" />\n </div>\n\n <input\n :id=\"resolvedId\"\n ref=\"inputEl\"\n v-bind=\"$attrs\"\n :name=\"props.name\"\n :type=\"resolvedType\"\n :inputmode=\"props.inputmode\"\n :autocomplete=\"props.autocomplete\"\n :placeholder=\"props.placeholder\"\n :disabled=\"props.disabled\"\n :readonly=\"props.readonly\"\n :maxlength=\"props.maxlength\"\n :value=\"props.modelValue\"\n :aria-invalid=\"isInvalid ? 'true' : undefined\"\n :aria-describedby=\"describedBy\"\n :aria-required=\"isRequired ? 'true' : undefined\"\n class=\"w-full bg-transparent text-[var(--fg)] placeholder:text-[var(--muted-fg)] focus:placeholder:text-transparent focus:outline-none disabled:cursor-not-allowed\"\n :class=\"className\"\n :style=\"inputStyle\"\n @input=\"onInput\"\n >\n\n <div\n v-if=\"trailingCount > 0\"\n data-gr-input-trailing\n class=\"absolute inset-y-0 right-1 flex items-center gap-0.5\"\n >\n <button\n v-if=\"showClear\"\n type=\"button\"\n data-gr-input-clear\n :aria-label=\"resolvedClearLabel\"\n class=\"flex h-6 w-6 items-center justify-center rounded text-[var(--muted-fg)] transition-colors hover:bg-[var(--muted)] hover:text-[var(--fg)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]\"\n tabindex=\"-1\"\n @click=\"clear\"\n >\n <IconX class=\"h-4 w-4\" aria-hidden=\"true\" />\n </button>\n\n <button\n v-if=\"showPasswordToggle\"\n type=\"button\"\n data-gr-input-password-toggle\n :aria-label=\"passwordVisible ? resolvedPasswordHideLabel : resolvedPasswordShowLabel\"\n :aria-pressed=\"passwordVisible ? 'true' : 'false'\"\n class=\"flex h-6 w-6 items-center justify-center rounded text-[var(--muted-fg)] transition-colors hover:bg-[var(--muted)] hover:text-[var(--fg)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]\"\n tabindex=\"-1\"\n @click=\"togglePassword\"\n >\n <IconEyeOff v-if=\"passwordVisible\" class=\"h-4 w-4\" aria-hidden=\"true\" />\n <IconEye v-else class=\"h-4 w-4\" aria-hidden=\"true\" />\n </button>\n </div>\n\n <div\n v-if=\"$slots.suffix\"\n ref=\"suffixEl\"\n data-testid=\"gr-input-suffix\"\n class=\"absolute inset-y-0 right-0 flex items-center justify-center border-l border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate\"\n :class=\"suffixFixed ? '[direction:rtl]' : ''\"\n :style=\"suffixStyle\"\n aria-hidden=\"true\"\n >\n <slot name=\"suffix\" />\n </div>\n </div>\n\n <div\n v-if=\"showCount\"\n data-gr-input-count\n class=\"mt-1 text-right text-xs text-[var(--muted-fg)] tabular-nums\"\n >\n {{ countText }}\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBA,MAAM,QAAQ;EA6Ed,MAAM,OAAO;EAMb,MAAM,QAAQ,sBAAsB;EACpC,MAAM,aAAa,eAAe,MAAM,MAAM,OAAO,GAAG,KAAK;EAC7D,MAAM,YAAY,eAAe,MAAM,WAAW,QAAQ,OAAO,QAAQ,KAAK,CAAC;EAC/E,MAAM,cAAc,eAAe,OAAO,cAAc,KAAK;EAC7D,MAAM,aAAa,eAAe,QAAQ,OAAO,SAAS,KAAK,CAAC;EAEhE,MAAM,UAAU,IAA6B,IAAI;EAEjD,SAAS,QAAc;GACrB,QAAQ,OAAO,MAAM;EACvB;EAEA,SAAa,EACX,MACF,CAAC;EAED,MAAM,QAAQ,SAAS;EAEvB,MAAM,YAAY,eAAe,QAAQ,MAAM,MAAM,CAAC;EACtD,MAAM,YA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AK,CAAC,+JACE,UAAA,KAAS;KAChB,OAAO,WAAA;KACA;;IAIF,cAAA,QAAa,KAAA,UAAA,GADvB,mBA8BM,OA9BN,YA8BM,CAxBM,UAAA,SAAA,UAAA,GADV,mBAUS,UAAA;;KARL,MAAK;KACL,uBAAA;KACC,cAAY,mBAAA;KACb,OAAM;KACN,UAAS;KACR,SAAO;QAEV,YAA4C,MAAA,SAAA,GAAA;KAArC,OAAM;KAAU,eAAY;yDAI3B,mBAAA,SAAA,UAAA,GADV,mBAYS,UAAA;;KAVL,MAAK;KACL,iCAAA;KACC,cAAY,gBAAA,QAAkB,0BAAA,QAA4B,0BAAA;KAC1D,gBAAc,gBAAA,QAAe,SAAA;KAC9B,OAAM;KACN,UAAS;KACR,SAAO;QAEQ,gBAAA,SAAA,UAAA,GAAlB,YAAwE,MAAA,eAAA,GAAA;;KAArC,OAAM;KAAU,eAAY;wBAC/D,YAAqD,MAAA,WAAA,GAAA;;KAArC,OAAM;KAAU,eAAY;;IAKtCD,KAAAA,OAAO,UAAA,UAAA,GADjB,mBAUM,OAAA;;cARE;KAAJ,KAAI;KACJ,eAAY;KACZ,OAAK,eAAA,CAAC,iKACE,QAAA,cAAW,oBAAA,EAAA,CAAA;KAClB,OAAK,eAAE,YAAA,KAAW;KACnB,eAAY;QAEd,WAAsB,KAAA,QAAA,QAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;UAKhB,QAAA,aAAA,UAAA,GADV,mBAMM,OANN,YAMM,gBADD,UAAA,KAAS,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA"}
@@ -1,3 +1,3 @@
1
- import { t as GrInput_default } from "./chunks/GrInput-C8pOJgCi.js";
1
+ import { t as GrInput_default } from "./chunks/GrInput-B8dd3JaA.js";
2
2
  import { n as grInputSafelist, t as grInputConfig } from "../../chunks/config-D_R56_gT.js";
3
3
  export { GrInput_default as GrInput, GrInput_default as default, grInputConfig, grInputSafelist };
@@ -0,0 +1,22 @@
1
+ import { createElementBlock, defineComponent, normalizeClass, openBlock, renderSlot } from "vue";
2
+ //#endregion
3
+ //#region src/components/GrKbd/GrKbd.vue
4
+ var GrKbd_default = /* @__PURE__ */ defineComponent({
5
+ __name: "GrKbd",
6
+ props: { size: { default: "md" } },
7
+ setup(__props) {
8
+ /**
9
+ * GrKbd — GR-примитив для отображения клавиш/сочетаний (`<kbd>`).
10
+ *
11
+ * Пример: `<GrKbd>⌘</GrKbd> <GrKbd>K</GrKbd>`.
12
+ */
13
+ return (_ctx, _cache) => {
14
+ return openBlock(), createElementBlock("kbd", {
15
+ "data-gr-kbd": "",
16
+ class: normalizeClass(["inline-flex items-center justify-center rounded-md border border-[var(--brd)] bg-[var(--muted)] font-medium leading-none text-[var(--muted-fg)] shadow-[var(--gr-shadow-1)] tabular-nums", __props.size === "sm" ? "min-w-[1.25rem] h-5 px-1 text-[11px]" : "min-w-[1.5rem] h-6 px-1.5 text-xs"])
17
+ }, [renderSlot(_ctx.$slots, "default")], 2);
18
+ };
19
+ }
20
+ });
21
+ //#endregion
22
+ export { GrKbd_default as t };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GrKbd-BEoYxWhE.js","names":[],"sources":["../../../../src/components/GrKbd/GrKbd.vue","../../../../src/components/GrKbd/GrKbd.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * GrKbd — GR-примитив для отображения клавиш/сочетаний (`<kbd>`).\n *\n * Пример: `<GrKbd>⌘</GrKbd> <GrKbd>K</GrKbd>`.\n */\nexport type GrKbdSize = 'sm' | 'md'\n\nwithDefaults(defineProps<{ size?: GrKbdSize }>(), {\n size: 'md',\n})\n</script>\n\n<template>\n <kbd\n data-gr-kbd\n class=\"inline-flex items-center justify-center rounded-md border border-[var(--brd)] bg-[var(--muted)] font-medium leading-none text-[var(--muted-fg)] shadow-[var(--gr-shadow-1)] tabular-nums\"\n :class=\"size === 'sm'\n ? 'min-w-[1.25rem] h-5 px-1 text-[11px]'\n : 'min-w-[1.5rem] h-6 px-1.5 text-xs'\"\n ><slot /></kbd>\n</template>\n","<script setup lang=\"ts\">\n/**\n * GrKbd — GR-примитив для отображения клавиш/сочетаний (`<kbd>`).\n *\n * Пример: `<GrKbd>⌘</GrKbd> <GrKbd>K</GrKbd>`.\n */\nexport type GrKbdSize = 'sm' | 'md'\n\nwithDefaults(defineProps<{ size?: GrKbdSize }>(), {\n size: 'md',\n})\n</script>\n\n<template>\n <kbd\n data-gr-kbd\n class=\"inline-flex items-center justify-center rounded-md border border-[var(--brd)] bg-[var(--muted)] font-medium leading-none text-[var(--muted-fg)] shadow-[var(--gr-shadow-1)] tabular-nums\"\n :class=\"size === 'sm'\n ? 'min-w-[1.25rem] h-5 px-1 text-[11px]'\n : 'min-w-[1.5rem] h-6 px-1.5 text-xs'\"\n ><slot /></kbd>\n</template>\n"],"mappings":";;;;;;;;;;;;;uBAcE,mBAMe,OAAA;IALb,eAAA;IACA,OAAK,eAAA,CAAC,4LACE,QAAA,SAAI,OAAA,yCAAA,mCAAA,CAAA;OAGb,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { t as GrKbd_default } from "./chunks/GrKbd-BEoYxWhE.js";
2
+ import { t as grKbdConfig } from "../../chunks/config-Dlm49Jp5.js";
3
+ export { GrKbd_default as GrKbd, GrKbd_default as default, grKbdConfig };