@kodacms/admin 0.0.0-stage → 0.1.1

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 (503) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENSE +21 -0
  3. package/README.md +93 -2
  4. package/design-tokens/kodacms.tokens.json +1360 -0
  5. package/dist/apple-touch-icon.png +0 -0
  6. package/dist/assets/AuditView-DCgrAjma.js +1 -0
  7. package/dist/assets/CollectionView-CY3zK1CE.js +1 -0
  8. package/dist/assets/CustomComponent-B1mxHHd0.js +1 -0
  9. package/dist/assets/CustomPageView-BTsy9MC8.js +1 -0
  10. package/dist/assets/DashboardView-ujWhLuS2.js +1 -0
  11. package/dist/assets/DeleteDocumentsDialog-D1nx27UG.js +1 -0
  12. package/dist/assets/DocumentHistoryView-Ko633-Dy.js +1 -0
  13. package/dist/assets/DocumentView-CPEjwzzo.js +1 -0
  14. package/dist/assets/GlobalHistoryView-CbwdeYpn.js +1 -0
  15. package/dist/assets/GlobalView-DcTGexxK.js +1 -0
  16. package/dist/assets/KAlert-DoR81cyQ.js +1 -0
  17. package/dist/assets/KCard-DNom764U.js +1 -0
  18. package/dist/assets/KDropdownMenu-BECk5S9K.js +1 -0
  19. package/dist/assets/KField-CvINPmYu.js +1 -0
  20. package/dist/assets/KPagination-DQOzrRaf.js +1 -0
  21. package/dist/assets/KPasswordInput-EPBXvtXG.js +1 -0
  22. package/dist/assets/KSeparator-DEbXnpDV.js +1 -0
  23. package/dist/assets/KTableRow-Dpp2Lk2V.js +1 -0
  24. package/dist/assets/KTabs-b95D7hep.js +1 -0
  25. package/dist/assets/KTextarea-CCveuS_I.js +1 -0
  26. package/dist/assets/Label-m9Ig3v9B.js +1 -0
  27. package/dist/assets/ListFooter-qYmCWY4R.js +1 -0
  28. package/dist/assets/LoadError-BRccywgs.js +1 -0
  29. package/dist/assets/LoginView-DvTtEJxp.js +1 -0
  30. package/dist/assets/NoAccessView-Bg69btHE.js +1 -0
  31. package/dist/assets/NotFoundView-qhJ2ixSH.js +1 -0
  32. package/dist/assets/PageHeader-B3riLtJg.js +1 -0
  33. package/dist/assets/PopoverAnchor-BwL6g4vt.js +1 -0
  34. package/dist/assets/PopoverContentImpl-Dq0cbuHV.js +1 -0
  35. package/dist/assets/PopoverContentModal-BEl8rmbI.js +1 -0
  36. package/dist/assets/PopoverContentNonModal-D5osgtpx.js +1 -0
  37. package/dist/assets/RoleView-D9732bW6.js +1 -0
  38. package/dist/assets/RolesView-Du4NUhQJ.js +1 -0
  39. package/dist/assets/TooltipContentHoverable-C18vbtIU.js +1 -0
  40. package/dist/assets/TooltipContentImpl-CCpG79EA.js +1 -0
  41. package/dist/assets/TooltipContentImpl-DQFjU6ri.js +1 -0
  42. package/dist/assets/UploadQueueItem-BbG5x7WM.js +6 -0
  43. package/dist/assets/UserView-iFK1eFT9.js +1 -0
  44. package/dist/assets/UsersView-B6fCtC-4.js +1 -0
  45. package/dist/assets/columns-DmJOzXV9.js +1 -0
  46. package/dist/assets/ellipsis-BNwYKZMS.js +1 -0
  47. package/dist/assets/error-text-1F8qU3pC.js +1 -0
  48. package/dist/assets/eye-DyBObYiE.js +1 -0
  49. package/dist/assets/eye-off-Bd_6erac.js +1 -0
  50. package/dist/assets/form-layout-Dk2JVUC0.js +1 -0
  51. package/dist/assets/globals-BMIQQR5f.js +1 -0
  52. package/dist/assets/index-CGdQZeTs.css +2 -0
  53. package/dist/assets/index-a4P44W6e.js +14 -0
  54. package/dist/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  55. package/dist/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  56. package/dist/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  57. package/dist/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  58. package/dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  59. package/dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  60. package/dist/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  61. package/dist/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  62. package/dist/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  63. package/dist/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  64. package/dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  65. package/dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  66. package/dist/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  67. package/dist/assets/list-query-DcmvyLSO.js +1 -0
  68. package/dist/assets/rolldown-runtime-P3Pd_6ND.js +1 -0
  69. package/dist/assets/select-options-osOjd-zR.js +1 -0
  70. package/dist/assets/useAuditState-D6n8HXQ2.js +1 -0
  71. package/dist/assets/useDebounced-BVo96C1E.js +1 -0
  72. package/dist/assets/useHistoryLocale-BWBBUuQi.js +1 -0
  73. package/dist/assets/useListState-CTgxjU_g.js +1 -0
  74. package/dist/assets/useLocaleDocument-DkvwSG3X.js +1 -0
  75. package/dist/assets/usePageHeader-wYdFq9cQ.js +1 -0
  76. package/dist/assets/useRoleDelete-DFwroHOv.js +1 -0
  77. package/dist/assets/useSaveShortcut-DFNu_TAL.js +1 -0
  78. package/dist/assets/useUserDelete-83wa7pqC.js +1 -0
  79. package/dist/assets/useUsersAccess-1yVnzExk.js +1 -0
  80. package/dist/assets/users-NiowxtJB.js +1 -0
  81. package/dist/assets/validate-CEcXMakk.js +1 -0
  82. package/dist/favicon.svg +12 -0
  83. package/dist/index.html +16 -0
  84. package/dist/koda-components.json +4 -0
  85. package/index.html +15 -0
  86. package/package.json +68 -4
  87. package/public/apple-touch-icon.png +0 -0
  88. package/public/favicon.svg +12 -0
  89. package/src/App.vue +17 -0
  90. package/src/api/access.ts +110 -0
  91. package/src/api/admin-config.ts +318 -0
  92. package/src/api/admin-fields.ts +557 -0
  93. package/src/api/admin-layout.ts +191 -0
  94. package/src/api/api-error.ts +78 -0
  95. package/src/api/audit.ts +170 -0
  96. package/src/api/client.ts +153 -0
  97. package/src/api/documents.ts +470 -0
  98. package/src/api/drafts.ts +115 -0
  99. package/src/api/error-text.ts +11 -0
  100. package/src/api/globals.ts +133 -0
  101. package/src/api/http.ts +24 -0
  102. package/src/api/locale.ts +48 -0
  103. package/src/api/permissions.ts +194 -0
  104. package/src/api/relations.ts +86 -0
  105. package/src/api/roles.ts +170 -0
  106. package/src/api/scopes.ts +91 -0
  107. package/src/api/search-query.ts +33 -0
  108. package/src/api/search.ts +39 -0
  109. package/src/api/types.ts +39 -0
  110. package/src/api/upload.ts +146 -0
  111. package/src/api/users.ts +88 -0
  112. package/src/api/versions.ts +206 -0
  113. package/src/api/where-query.ts +79 -0
  114. package/src/audit/AuditActionBadge.vue +13 -0
  115. package/src/audit/AuditActor.vue +34 -0
  116. package/src/audit/AuditCard.vue +68 -0
  117. package/src/audit/AuditDrawer.vue +86 -0
  118. package/src/audit/AuditDrawerActions.vue +70 -0
  119. package/src/audit/AuditEntryBody.vue +74 -0
  120. package/src/audit/AuditEntryChanges.vue +88 -0
  121. package/src/audit/AuditEntryFacts.vue +47 -0
  122. package/src/audit/AuditFilterBar.vue +55 -0
  123. package/src/audit/AuditFilterControls.vue +148 -0
  124. package/src/audit/AuditFiltersDrawer.vue +46 -0
  125. package/src/audit/AuditHistory.vue +136 -0
  126. package/src/audit/AuditList.vue +183 -0
  127. package/src/audit/AuditListStates.vue +70 -0
  128. package/src/audit/AuditRestoredVersion.vue +66 -0
  129. package/src/audit/AuditSearch.vue +40 -0
  130. package/src/audit/AuditTable.vue +116 -0
  131. package/src/audit/HistoryTabs.vue +48 -0
  132. package/src/audit/audit-changes.ts +161 -0
  133. package/src/audit/audit-filters.ts +152 -0
  134. package/src/audit/audit-view.ts +372 -0
  135. package/src/audit/useAuditContext.ts +23 -0
  136. package/src/audit/useAuditFilterOptions.ts +67 -0
  137. package/src/audit/useAuditState.ts +82 -0
  138. package/src/brand/KodaMark.vue +42 -0
  139. package/src/composables/useAccessView.ts +120 -0
  140. package/src/composables/useDebounced.ts +15 -0
  141. package/src/composables/usePageHeader.ts +20 -0
  142. package/src/composables/useSessionCacheReset.ts +23 -0
  143. package/src/composables/useTheme.ts +79 -0
  144. package/src/composables/useUsersAccess.ts +13 -0
  145. package/src/custom/CustomComponent.vue +103 -0
  146. package/src/custom/CustomComponentNotice.vue +71 -0
  147. package/src/custom/CustomInserts.vue +36 -0
  148. package/src/custom/component-name.ts +18 -0
  149. package/src/custom/error-info.ts +22 -0
  150. package/src/custom/form-context.ts +44 -0
  151. package/src/custom/list-context.ts +44 -0
  152. package/src/custom/place.ts +126 -0
  153. package/src/custom/registry.ts +101 -0
  154. package/src/custom/useCustomComponent.ts +136 -0
  155. package/src/custom/useFormZones.ts +65 -0
  156. package/src/custom/useListZones.ts +38 -0
  157. package/src/custom/user-components.ts +20 -0
  158. package/src/custom/zone-components.ts +53 -0
  159. package/src/documents/DocumentForm.vue +168 -0
  160. package/src/documents/DocumentList.vue +190 -0
  161. package/src/documents/cells/CheckboxCell.vue +16 -0
  162. package/src/documents/cells/DateCell.vue +26 -0
  163. package/src/documents/cells/FallbackCell.vue +23 -0
  164. package/src/documents/cells/FileSizeCell.vue +14 -0
  165. package/src/documents/cells/IdCell.vue +14 -0
  166. package/src/documents/cells/MimeCell.vue +15 -0
  167. package/src/documents/cells/NumberCell.vue +13 -0
  168. package/src/documents/cells/RelationshipCell.vue +33 -0
  169. package/src/documents/cells/RowsCell.vue +21 -0
  170. package/src/documents/cells/SelectCell.vue +23 -0
  171. package/src/documents/cells/StatusCell.vue +18 -0
  172. package/src/documents/cells/TextCell.vue +16 -0
  173. package/src/documents/cells/ThumbnailCell.vue +31 -0
  174. package/src/documents/cells/UploadCell.vue +53 -0
  175. package/src/documents/cells/UploadCellThumb.vue +27 -0
  176. package/src/documents/cells/cell-props.ts +12 -0
  177. package/src/documents/cells/registry.ts +44 -0
  178. package/src/documents/cells/select-options.ts +18 -0
  179. package/src/documents/drafts/DraftActions.vue +62 -0
  180. package/src/documents/drafts/DraftStatus.vue +100 -0
  181. package/src/documents/drafts/StatusBadge.vue +23 -0
  182. package/src/documents/drafts/UnpublishDialog.vue +25 -0
  183. package/src/documents/drafts/useAutosave.ts +88 -0
  184. package/src/documents/drafts/useDrafts.ts +73 -0
  185. package/src/documents/fields/CheckboxControl.vue +13 -0
  186. package/src/documents/fields/DateControl.vue +22 -0
  187. package/src/documents/fields/FieldControl.vue +55 -0
  188. package/src/documents/fields/FieldDescription.vue +34 -0
  189. package/src/documents/fields/FieldRenderer.vue +92 -0
  190. package/src/documents/fields/GroupChildren.vue +28 -0
  191. package/src/documents/fields/GroupErrors.vue +49 -0
  192. package/src/documents/fields/GroupFields.vue +87 -0
  193. package/src/documents/fields/JsonControl.vue +20 -0
  194. package/src/documents/fields/NumberControl.vue +20 -0
  195. package/src/documents/fields/ReadOnlyControl.vue +18 -0
  196. package/src/documents/fields/SelectControl.vue +46 -0
  197. package/src/documents/fields/TextControl.vue +37 -0
  198. package/src/documents/fields/TextareaControl.vue +18 -0
  199. package/src/documents/fields/ValueField.vue +87 -0
  200. package/src/documents/fields/field-control.ts +10 -0
  201. package/src/documents/fields/registry.ts +56 -0
  202. package/src/documents/fields/relation/JoinControl.vue +41 -0
  203. package/src/documents/fields/relation/RelationshipControl.vue +57 -0
  204. package/src/documents/fields/relation/useRelationPicker.ts +96 -0
  205. package/src/documents/fields/rows/ArrayFields.vue +72 -0
  206. package/src/documents/fields/rows/BlocksFields.vue +90 -0
  207. package/src/documents/fields/rows/RowCard.vue +81 -0
  208. package/src/documents/fields/rows/RowFields.vue +32 -0
  209. package/src/documents/fields/rows/RowsFieldset.vue +51 -0
  210. package/src/documents/fields/rows/row-title.ts +29 -0
  211. package/src/documents/fields/rows/useRows.ts +32 -0
  212. package/src/documents/fields/upload/MediaGrid.vue +61 -0
  213. package/src/documents/fields/upload/MediaLibrary.vue +131 -0
  214. package/src/documents/fields/upload/MediaPickerDialog.vue +54 -0
  215. package/src/documents/fields/upload/MediaTile.vue +69 -0
  216. package/src/documents/fields/upload/MediaUploadArea.vue +60 -0
  217. package/src/documents/fields/upload/UploadControl.vue +157 -0
  218. package/src/documents/fields/upload/UploadValueItem.vue +108 -0
  219. package/src/documents/fields/upload/upload-field.ts +77 -0
  220. package/src/documents/fields/upload/useFieldUploads.ts +60 -0
  221. package/src/documents/fields/upload/useMediaLibrary.ts +77 -0
  222. package/src/documents/fields/useCustomFieldModel.ts +32 -0
  223. package/src/documents/fields/useFieldLocale.ts +38 -0
  224. package/src/documents/form/DocumentFields.vue +28 -0
  225. package/src/documents/form/DocumentHeader.vue +50 -0
  226. package/src/documents/form/DocumentMeta.vue +99 -0
  227. package/src/documents/form/UnsavedChangesDialog.vue +27 -0
  228. package/src/documents/form/created-by.ts +12 -0
  229. package/src/documents/form/field-errors.ts +29 -0
  230. package/src/documents/form/field-value.ts +229 -0
  231. package/src/documents/form/focus-first-error.ts +43 -0
  232. package/src/documents/form/form-conditions.ts +106 -0
  233. package/src/documents/form/form-layout.ts +245 -0
  234. package/src/documents/form/form-values.ts +265 -0
  235. package/src/documents/form/layout/LayoutBlock.vue +32 -0
  236. package/src/documents/form/layout/LayoutItems.vue +43 -0
  237. package/src/documents/form/layout/LayoutLeaf.vue +33 -0
  238. package/src/documents/form/layout/LayoutRow.vue +60 -0
  239. package/src/documents/form/layout/LayoutSection.vue +73 -0
  240. package/src/documents/form/layout/LayoutStack.vue +20 -0
  241. package/src/documents/form/layout/LayoutTabs.vue +74 -0
  242. package/src/documents/form/relation-value.ts +160 -0
  243. package/src/documents/form/rows.ts +24 -0
  244. package/src/documents/form/save-messages.ts +65 -0
  245. package/src/documents/form/useDocumentDelete.ts +38 -0
  246. package/src/documents/form/useDocumentEditor.ts +167 -0
  247. package/src/documents/form/useDocumentForm.ts +37 -0
  248. package/src/documents/form/useDocumentRights.ts +45 -0
  249. package/src/documents/form/useDocumentSubmit.ts +128 -0
  250. package/src/documents/form/useFieldsForm.ts +238 -0
  251. package/src/documents/form/useFormLayout.ts +21 -0
  252. package/src/documents/form/useFormTabs.ts +54 -0
  253. package/src/documents/form/useLeaveGuard.ts +69 -0
  254. package/src/documents/form/useSaveShortcut.ts +13 -0
  255. package/src/documents/form/validate.ts +220 -0
  256. package/src/documents/list/CellConflictMessage.vue +24 -0
  257. package/src/documents/list/CellEditor.vue +155 -0
  258. package/src/documents/list/CellRelationEditor.vue +62 -0
  259. package/src/documents/list/DeleteDocumentsDialog.vue +42 -0
  260. package/src/documents/list/DocumentActions.vue +68 -0
  261. package/src/documents/list/DocumentCard.vue +84 -0
  262. package/src/documents/list/DocumentCards.vue +31 -0
  263. package/src/documents/list/DocumentRow.vue +86 -0
  264. package/src/documents/list/DocumentTable.vue +104 -0
  265. package/src/documents/list/InlineCell.vue +151 -0
  266. package/src/documents/list/InlineCheckboxCell.vue +99 -0
  267. package/src/documents/list/ListCell.vue +39 -0
  268. package/src/documents/list/ListCellValue.vue +59 -0
  269. package/src/documents/list/ListFooter.vue +50 -0
  270. package/src/documents/list/ListSearch.vue +44 -0
  271. package/src/documents/list/ListStates.vue +73 -0
  272. package/src/documents/list/ListToolbar.vue +37 -0
  273. package/src/documents/list/SelectionBar.vue +30 -0
  274. package/src/documents/list/cell-failure.ts +91 -0
  275. package/src/documents/list/cell-save.ts +129 -0
  276. package/src/documents/list/columns.ts +157 -0
  277. package/src/documents/list/inline-cells.ts +61 -0
  278. package/src/documents/list/inline-edit-context.ts +14 -0
  279. package/src/documents/list/inline-edit.ts +302 -0
  280. package/src/documents/list/list-query.ts +46 -0
  281. package/src/documents/list/row-overlay.ts +45 -0
  282. package/src/documents/list/sort.ts +32 -0
  283. package/src/documents/list/useCellEditorKeys.ts +78 -0
  284. package/src/documents/list/useCellEditorModel.ts +33 -0
  285. package/src/documents/list/useCellPopup.ts +94 -0
  286. package/src/documents/list/useDeleteFlow.ts +42 -0
  287. package/src/documents/list/useDocumentListData.ts +97 -0
  288. package/src/documents/list/useInlineEdit.ts +143 -0
  289. package/src/documents/list/useListInlineEdit.ts +68 -0
  290. package/src/documents/list/useListNotices.ts +58 -0
  291. package/src/documents/list/useListState.ts +67 -0
  292. package/src/documents/list/useRowPublish.ts +150 -0
  293. package/src/documents/upload/BulkUpload.vue +58 -0
  294. package/src/documents/upload/DocumentFileCard.vue +106 -0
  295. package/src/documents/upload/FileActions.vue +57 -0
  296. package/src/documents/upload/FileDetails.vue +40 -0
  297. package/src/documents/upload/UploadProgressRow.vue +29 -0
  298. package/src/documents/upload/UploadQueueItem.vue +150 -0
  299. package/src/documents/upload/UploadQueueSummary.vue +70 -0
  300. package/src/documents/upload/file-actions.ts +35 -0
  301. package/src/documents/upload/upload-logic.ts +209 -0
  302. package/src/documents/upload/upload-queue.ts +220 -0
  303. package/src/documents/upload/useDocumentFile.ts +93 -0
  304. package/src/documents/upload/useFileBlob.ts +132 -0
  305. package/src/documents/upload/useShownFile.ts +77 -0
  306. package/src/documents/versions/DiffOmitted.vue +34 -0
  307. package/src/documents/versions/DiffTree.vue +76 -0
  308. package/src/documents/versions/DiffValue.vue +101 -0
  309. package/src/documents/versions/HistoryLink.vue +17 -0
  310. package/src/documents/versions/RestoreVersionDialog.vue +58 -0
  311. package/src/documents/versions/VersionCard.vue +111 -0
  312. package/src/documents/versions/VersionHistory.vue +127 -0
  313. package/src/documents/versions/VersionSnapshot.vue +145 -0
  314. package/src/documents/versions/diff-view.ts +153 -0
  315. package/src/documents/versions/text-diff.ts +66 -0
  316. package/src/documents/versions/useRestoreFlow.ts +55 -0
  317. package/src/env.d.ts +17 -0
  318. package/src/format.ts +58 -0
  319. package/src/globals/GlobalForm.vue +139 -0
  320. package/src/globals/GlobalHeader.vue +39 -0
  321. package/src/globals/GlobalMeta.vue +67 -0
  322. package/src/globals/useGlobalEditor.ts +118 -0
  323. package/src/globals/useGlobalForm.ts +32 -0
  324. package/src/globals/useGlobalSubmit.ts +75 -0
  325. package/src/layout/AppBarMobile.vue +42 -0
  326. package/src/layout/AppLayout.vue +40 -0
  327. package/src/layout/AppTopbar.vue +28 -0
  328. package/src/layout/LoadError.vue +19 -0
  329. package/src/layout/MobileNavDrawer.vue +45 -0
  330. package/src/layout/PageHeader.vue +19 -0
  331. package/src/layout/ThemeToggle.vue +28 -0
  332. package/src/layout/palette/AppCommandPalette.vue +32 -0
  333. package/src/layout/palette/palette-actions.ts +54 -0
  334. package/src/layout/palette/palette-commands.ts +156 -0
  335. package/src/layout/palette/palette-documents.ts +73 -0
  336. package/src/layout/palette/palette-groups.ts +90 -0
  337. package/src/layout/palette/palette-hotkey.ts +39 -0
  338. package/src/layout/palette/recent-documents.ts +123 -0
  339. package/src/layout/palette/useCommandPalette.ts +75 -0
  340. package/src/layout/palette/useDocumentSearch.ts +88 -0
  341. package/src/layout/palette/useRememberDocument.ts +30 -0
  342. package/src/layout/sidebar/SidebarAdmin.vue +50 -0
  343. package/src/layout/sidebar/SidebarBrand.vue +14 -0
  344. package/src/layout/sidebar/SidebarCollections.vue +55 -0
  345. package/src/layout/sidebar/SidebarGlobals.vue +23 -0
  346. package/src/layout/sidebar/SidebarGroup.vue +14 -0
  347. package/src/layout/sidebar/SidebarItem.vue +47 -0
  348. package/src/layout/sidebar/SidebarNav.vue +37 -0
  349. package/src/layout/sidebar/SidebarUser.vue +43 -0
  350. package/src/layout/sidebar/SidebarViews.vue +26 -0
  351. package/src/layout/sidebar/view-icons.ts +112 -0
  352. package/src/localization/FallbackHint.vue +41 -0
  353. package/src/localization/LocaleNotice.vue +42 -0
  354. package/src/localization/LocaleSwitcher.vue +40 -0
  355. package/src/localization/fallback-value.ts +76 -0
  356. package/src/localization/list-locale.ts +37 -0
  357. package/src/localization/locale-form.ts +64 -0
  358. package/src/localization/locale.ts +286 -0
  359. package/src/localization/useContentLocale.ts +47 -0
  360. package/src/localization/useHistoryLocale.ts +30 -0
  361. package/src/localization/useListFallbacks.ts +49 -0
  362. package/src/localization/useLocaleDocument.ts +116 -0
  363. package/src/main.ts +21 -0
  364. package/src/public/__snapshots__/public-api.spec.ts.snap +456 -0
  365. package/src/public/composables/useApi.ts +155 -0
  366. package/src/public/composables/useCell.ts +38 -0
  367. package/src/public/composables/useCurrentUser.ts +16 -0
  368. package/src/public/composables/useDocument.ts +108 -0
  369. package/src/public/composables/useField.ts +136 -0
  370. package/src/public/composables/useList.ts +38 -0
  371. package/src/public/composables/useLocale.ts +29 -0
  372. package/src/public/composables/useToast.ts +19 -0
  373. package/src/public/index.ts +59 -0
  374. package/src/public/types.ts +183 -0
  375. package/src/public/ui.ts +85 -0
  376. package/src/roles/CopyRoleDialog.vue +32 -0
  377. package/src/roles/DeleteRoleDialog.vue +26 -0
  378. package/src/roles/MatrixFlags.vue +77 -0
  379. package/src/roles/MatrixTable.vue +101 -0
  380. package/src/roles/PermissionMatrix.vue +112 -0
  381. package/src/roles/RoleActions.vue +47 -0
  382. package/src/roles/RoleCard.vue +54 -0
  383. package/src/roles/RoleForm.vue +150 -0
  384. package/src/roles/RoleFormFields.vue +43 -0
  385. package/src/roles/RoleList.vue +77 -0
  386. package/src/roles/RoleMeta.vue +74 -0
  387. package/src/roles/RoleTable.vue +74 -0
  388. package/src/roles/role-form.ts +135 -0
  389. package/src/roles/role-matrix.ts +284 -0
  390. package/src/roles/useRoleCopy.ts +61 -0
  391. package/src/roles/useRoleDelete.ts +39 -0
  392. package/src/roles/useRoleForm.ts +122 -0
  393. package/src/router/guards.ts +57 -0
  394. package/src/router/index.ts +160 -0
  395. package/src/router/redirect.ts +9 -0
  396. package/src/runtime/runtime-config.ts +32 -0
  397. package/src/stores/auth.ts +205 -0
  398. package/src/stores/shell.ts +24 -0
  399. package/src/stores/uploads.ts +81 -0
  400. package/src/styles/main.css +40 -0
  401. package/src/styles/motion.css +328 -0
  402. package/src/styles/tokens.css +347 -0
  403. package/src/ui/KAlert.vue +80 -0
  404. package/src/ui/KAvatar.vue +43 -0
  405. package/src/ui/KBadge.vue +56 -0
  406. package/src/ui/KBreadcrumbs.vue +56 -0
  407. package/src/ui/KButton.vue +136 -0
  408. package/src/ui/KCalendar.vue +79 -0
  409. package/src/ui/KCard.vue +106 -0
  410. package/src/ui/KCellMessage.vue +57 -0
  411. package/src/ui/KCellTextarea.vue +92 -0
  412. package/src/ui/KCheckbox.vue +87 -0
  413. package/src/ui/KCollapsible.vue +100 -0
  414. package/src/ui/KCombobox.vue +173 -0
  415. package/src/ui/KComboboxOptions.vue +68 -0
  416. package/src/ui/KCommandItem.vue +53 -0
  417. package/src/ui/KCommandPalette.vue +215 -0
  418. package/src/ui/KDatePicker.vue +165 -0
  419. package/src/ui/KDrawer.vue +108 -0
  420. package/src/ui/KDropdownMenu.vue +60 -0
  421. package/src/ui/KDropzone.vue +163 -0
  422. package/src/ui/KEmptyState.vue +68 -0
  423. package/src/ui/KField.vue +103 -0
  424. package/src/ui/KInput.vue +89 -0
  425. package/src/ui/KKbd.vue +24 -0
  426. package/src/ui/KModal.vue +92 -0
  427. package/src/ui/KMultiSelect.vue +141 -0
  428. package/src/ui/KPagination.vue +65 -0
  429. package/src/ui/KPasswordInput.vue +33 -0
  430. package/src/ui/KPopover.vue +110 -0
  431. package/src/ui/KProgress.vue +61 -0
  432. package/src/ui/KRadioGroup.vue +90 -0
  433. package/src/ui/KSearchTrigger.vue +51 -0
  434. package/src/ui/KSegmented.vue +104 -0
  435. package/src/ui/KSelect.vue +124 -0
  436. package/src/ui/KSeparator.vue +33 -0
  437. package/src/ui/KSkeleton.vue +35 -0
  438. package/src/ui/KSpinner.vue +17 -0
  439. package/src/ui/KSwitch.vue +65 -0
  440. package/src/ui/KTab.vue +65 -0
  441. package/src/ui/KTabList.vue +18 -0
  442. package/src/ui/KTabPanel.vue +18 -0
  443. package/src/ui/KTable.vue +43 -0
  444. package/src/ui/KTableBody.vue +9 -0
  445. package/src/ui/KTableCell.vue +228 -0
  446. package/src/ui/KTableHeader.vue +39 -0
  447. package/src/ui/KTableHeaderCell.vue +94 -0
  448. package/src/ui/KTableRow.vue +49 -0
  449. package/src/ui/KTabs.vue +24 -0
  450. package/src/ui/KTag.vue +29 -0
  451. package/src/ui/KTextarea.vue +50 -0
  452. package/src/ui/KThumbnail.vue +100 -0
  453. package/src/ui/KToaster.vue +70 -0
  454. package/src/ui/KTooltip.vue +55 -0
  455. package/src/ui/command-palette.ts +41 -0
  456. package/src/ui/control-classes.ts +48 -0
  457. package/src/ui/cx.ts +6 -0
  458. package/src/ui/date-value.ts +48 -0
  459. package/src/ui/field-context.ts +61 -0
  460. package/src/ui/index.ts +88 -0
  461. package/src/ui/options.ts +6 -0
  462. package/src/ui/pagination.ts +38 -0
  463. package/src/ui/shortcut.ts +104 -0
  464. package/src/ui/table-grid.ts +277 -0
  465. package/src/ui/toast.ts +59 -0
  466. package/src/ui/useFileDrop.ts +70 -0
  467. package/src/users/DeleteUserDialog.vue +26 -0
  468. package/src/users/UserActions.vue +46 -0
  469. package/src/users/UserCard.vue +44 -0
  470. package/src/users/UserForm.vue +134 -0
  471. package/src/users/UserFormFields.vue +93 -0
  472. package/src/users/UserList.vue +107 -0
  473. package/src/users/UserMeta.vue +70 -0
  474. package/src/users/UserRoleBadge.vue +10 -0
  475. package/src/users/UserTable.vue +84 -0
  476. package/src/users/useRoleOptions.ts +50 -0
  477. package/src/users/useUserDelete.ts +39 -0
  478. package/src/users/useUserForm.ts +74 -0
  479. package/src/users/user-columns.ts +12 -0
  480. package/src/users/user-form.ts +167 -0
  481. package/src/views/AuditView.vue +57 -0
  482. package/src/views/CollectionView.vue +103 -0
  483. package/src/views/CustomPageView.vue +53 -0
  484. package/src/views/DashboardView.vue +91 -0
  485. package/src/views/DocumentHistoryView.vue +158 -0
  486. package/src/views/DocumentView.vue +173 -0
  487. package/src/views/GlobalHistoryView.vue +136 -0
  488. package/src/views/GlobalView.vue +115 -0
  489. package/src/views/LoginView.vue +41 -0
  490. package/src/views/NoAccessView.vue +34 -0
  491. package/src/views/NotFoundView.vue +27 -0
  492. package/src/views/RoleView.vue +93 -0
  493. package/src/views/RolesView.vue +66 -0
  494. package/src/views/UserView.vue +68 -0
  495. package/src/views/UsersView.vue +59 -0
  496. package/src/views/dashboard/CollectionCard.vue +21 -0
  497. package/src/views/dashboard/DashboardCardTitle.vue +18 -0
  498. package/src/views/dashboard/DashboardWidgets.vue +35 -0
  499. package/src/views/dashboard/GlobalCard.vue +24 -0
  500. package/src/views/login/LoginForm.vue +93 -0
  501. package/src/views/login/login-errors.ts +42 -0
  502. package/tsconfig.components.json +26 -0
  503. package/vite/koda-admin.ts +274 -0
@@ -0,0 +1,65 @@
1
+ <script setup lang="ts">
2
+ import { ChevronLeft, ChevronRight } from '@lucide/vue';
3
+ import { computed } from 'vue';
4
+ import { pageItems } from './pagination.js';
5
+ import { cx } from './cx.js';
6
+
7
+ /** Penpot: Pagination Item — Number / Prev / Next / Ellipsis × Default / Hover / Current / Focus / Disabled. */
8
+ const props = defineProps<{ totalPages: number }>();
9
+ const page = defineModel<number>('page', { required: true });
10
+ const items = computed(() => pageItems(page.value, props.totalPages));
11
+
12
+ const ITEM =
13
+ 'flex h-(--size-control-sm) min-w-(--size-control-sm) items-center justify-center rounded-md px-2 typo-label outline-none transition duration-(--duration-fast) focus-visible:bg-bg-surface focus-visible:shadow-focus';
14
+ const IDLE =
15
+ 'text-fg-default hover:bg-bg-hover disabled:cursor-not-allowed disabled:text-fg-disabled disabled:hover:bg-transparent';
16
+ </script>
17
+
18
+ <template>
19
+ <nav aria-label="Страницы" class="flex items-center gap-1">
20
+ <button
21
+ type="button"
22
+ :class="cx(ITEM, IDLE)"
23
+ :disabled="page <= 1"
24
+ aria-label="Предыдущая страница"
25
+ @click="page--"
26
+ >
27
+ <ChevronLeft :size="16" aria-hidden="true" />
28
+ </button>
29
+ <template
30
+ v-for="item in items"
31
+ :key="item.type === 'page' ? item.page : item.key"
32
+ >
33
+ <span
34
+ v-if="item.type === 'ellipsis'"
35
+ :class="cx(ITEM, 'text-fg-muted')"
36
+ aria-hidden="true"
37
+ >…</span
38
+ >
39
+ <button
40
+ v-else
41
+ type="button"
42
+ :class="
43
+ cx(
44
+ ITEM,
45
+ item.page === page ? 'bg-accent-solid text-fg-on-solid' : IDLE,
46
+ )
47
+ "
48
+ :aria-current="item.page === page ? 'page' : undefined"
49
+ :aria-label="`Страница ${item.page}`"
50
+ @click="page = item.page"
51
+ >
52
+ {{ item.page }}
53
+ </button>
54
+ </template>
55
+ <button
56
+ type="button"
57
+ :class="cx(ITEM, IDLE)"
58
+ :disabled="page >= totalPages"
59
+ aria-label="Следующая страница"
60
+ @click="page++"
61
+ >
62
+ <ChevronRight :size="16" aria-hidden="true" />
63
+ </button>
64
+ </nav>
65
+ </template>
@@ -0,0 +1,33 @@
1
+ <script setup lang="ts">
2
+ import { Eye, EyeOff } from '@lucide/vue';
3
+ import { ref } from 'vue';
4
+ import KInput from './KInput.vue';
5
+
6
+ /** KInput для пароля с кнопкой «показать/скрыть». Атрибуты (name, autocomplete) — на <input>. */
7
+ defineOptions({ inheritAttrs: false });
8
+ defineProps<{ size?: 'md' | 'sm' }>();
9
+ const model = defineModel<string>({ default: '' });
10
+ const visible = ref(false);
11
+ </script>
12
+
13
+ <template>
14
+ <KInput
15
+ v-bind="$attrs"
16
+ v-model="model"
17
+ :size="size"
18
+ :type="visible ? 'text' : 'password'"
19
+ >
20
+ <template #trailing>
21
+ <button
22
+ type="button"
23
+ class="-mr-1 flex shrink-0 rounded-sm p-1 text-fg-subtle outline-none transition duration-(--duration-fast) hover:text-fg-default focus-visible:bg-bg-hover focus-visible:text-fg-default"
24
+ :aria-label="visible ? 'Скрыть пароль' : 'Показать пароль'"
25
+ :aria-pressed="visible"
26
+ @click="visible = !visible"
27
+ >
28
+ <EyeOff v-if="visible" :size="16" aria-hidden="true" />
29
+ <Eye v-else :size="16" aria-hidden="true" />
30
+ </button>
31
+ </template>
32
+ </KInput>
33
+ </template>
@@ -0,0 +1,110 @@
1
+ <script setup lang="ts">
2
+ import {
3
+ PopoverContent,
4
+ PopoverPortal,
5
+ PopoverRoot,
6
+ PopoverTrigger,
7
+ } from 'reka-ui';
8
+ import { computed, useId, useSlots } from 'vue';
9
+ import { cx } from './cx.js';
10
+
11
+ /**
12
+ * Penpot: Popover — Kind Text/Form. Панель как у меню (KDropdownMenu): bg.surface,
13
+ * border.default, radius.lg, shadow.md, отступ от якоря 4, padding 12, gap 12;
14
+ * заголовок text.body-strong, футер — кнопки справа (gap 8). Ширина: width="auto" — по содержимому,
15
+ * не больше 288 (Kind Text); width="form" — ровно 288 (Kind Form, поля на всю ширину).
16
+ * Reka Popover: триггер (слот `trigger`, as-child) получает aria-haspopup="dialog",
17
+ * aria-expanded и aria-controls; панель — role="dialog", Esc и клик вне закрывают,
18
+ * фокус переходит в панель и возвращается на триггер. Не модальный: фон доступен.
19
+ * Имя панели: title → aria-labelledby на заголовок; иначе aria-label; иначе — текст триггера (Reka).
20
+ * Анимация — motion-popover (origin — --reka-popover-content-transform-origin), reduced motion — в motion.css.
21
+ */
22
+ export type PopoverSide = 'top' | 'right' | 'bottom' | 'left';
23
+ export type PopoverAlign = 'start' | 'center' | 'end';
24
+ export type PopoverWidth = 'auto' | 'form';
25
+
26
+ const props = withDefaults(
27
+ defineProps<{
28
+ title?: string;
29
+ side?: PopoverSide;
30
+ align?: PopoverAlign;
31
+ /**
32
+ * Подпись панели для скринридера, когда нет видимого заголовка. Объявлен в kebab-case,
33
+ * чтобы vue-tsc проверял `aria-label="…"` в шаблоне (aria-* он не переводит в camelCase).
34
+ */
35
+ 'aria-label'?: string;
36
+ /** auto — по содержимому (max 288), form — фиксированные 288 под форму. */
37
+ width?: PopoverWidth;
38
+ }>(),
39
+ { side: 'bottom', align: 'start', width: 'auto' },
40
+ );
41
+
42
+ /** Vue хранит объявленный 'aria-label' под ключом ariaLabel (camelize), тип знает только исходное имя. */
43
+ const ariaLabel = computed(
44
+ () => (props as unknown as { ariaLabel?: string }).ariaLabel,
45
+ );
46
+
47
+ const WIDTHS: Record<PopoverWidth, string> = {
48
+ auto: 'w-max max-w-72',
49
+ form: 'w-72 max-w-[calc(100vw-2rem)]',
50
+ };
51
+
52
+ const open = defineModel<boolean>('open', { default: false });
53
+
54
+ /** Событие Reka перед переносом фокуса в панель: preventDefault — оставить фокус на месте. */
55
+ const emit = defineEmits<{ openAutoFocus: [event: Event] }>();
56
+
57
+ const titleId = `${useId()}-title`;
58
+ const slots = useSlots();
59
+
60
+ /**
61
+ * Свои aria-* поверх aria-labelledby от Reka (по умолчанию он указывает на триггер):
62
+ * при as-child пропсы ребёнка побеждают пропсы Reka (renderSlotChild), undefined снимает атрибут.
63
+ */
64
+ const labelAttrs = computed(() => {
65
+ if (props.title) return { 'aria-labelledby': titleId };
66
+ if (ariaLabel.value)
67
+ return { 'aria-labelledby': undefined, 'aria-label': ariaLabel.value };
68
+ return {};
69
+ });
70
+ </script>
71
+
72
+ <template>
73
+ <PopoverRoot v-model:open="open">
74
+ <PopoverTrigger as-child>
75
+ <slot name="trigger" />
76
+ </PopoverTrigger>
77
+ <PopoverPortal>
78
+ <!-- as-child: пропсы своего div (aria-labelledby/aria-label) важнее тех, что ставит Reka -->
79
+ <PopoverContent
80
+ as-child
81
+ :side="side"
82
+ :align="align"
83
+ :side-offset="4"
84
+ @open-auto-focus="emit('openAutoFocus', $event)"
85
+ >
86
+ <div
87
+ v-bind="labelAttrs"
88
+ :class="
89
+ cx(
90
+ 'motion-popover z-50 flex flex-col gap-3 rounded-lg border border-border-default bg-bg-surface p-3 text-fg-default shadow-md outline-none',
91
+ WIDTHS[width],
92
+ )
93
+ "
94
+ >
95
+ <p
96
+ v-if="title"
97
+ :id="titleId"
98
+ class="typo-body-strong text-fg-default"
99
+ >
100
+ {{ title }}
101
+ </p>
102
+ <slot />
103
+ <div v-if="slots.footer" class="flex items-center justify-end gap-2">
104
+ <slot name="footer" />
105
+ </div>
106
+ </div>
107
+ </PopoverContent>
108
+ </PopoverPortal>
109
+ </PopoverRoot>
110
+ </template>
@@ -0,0 +1,61 @@
1
+ <script setup lang="ts">
2
+ import { ProgressIndicator, ProgressRoot } from 'reka-ui';
3
+ import { computed } from 'vue';
4
+ import { cx } from './cx.js';
5
+
6
+ /**
7
+ * Полоса прогресса (Reka Progress): 0…100, `null` — неизвестно сколько (бегущая полоса).
8
+ * Тон — по состоянию: accent (идёт), success (готово), danger (ошибка). Подпись — для
9
+ * скринридера (`aria-label`), видимый текст — снаружи.
10
+ */
11
+ export type ProgressTone = 'accent' | 'success' | 'danger';
12
+
13
+ const props = withDefaults(
14
+ defineProps<{
15
+ value: number | null;
16
+ label: string;
17
+ tone?: ProgressTone;
18
+ size?: 'sm' | 'md';
19
+ }>(),
20
+ { tone: 'accent', size: 'sm' },
21
+ );
22
+
23
+ const TONES: Record<ProgressTone, string> = {
24
+ accent: 'bg-accent-solid',
25
+ success: 'bg-success-solid',
26
+ danger: 'bg-danger-solid',
27
+ };
28
+
29
+ const valueLabel = (value: number | null | undefined) =>
30
+ value === null || value === undefined ? props.label : `${Math.round(value)}%`;
31
+
32
+ const percent = computed(() =>
33
+ props.value === null ? null : Math.max(0, Math.min(100, props.value)),
34
+ );
35
+ </script>
36
+
37
+ <template>
38
+ <ProgressRoot
39
+ :model-value="percent"
40
+ :max="100"
41
+ :aria-label="label"
42
+ :get-value-text="valueLabel"
43
+ :class="
44
+ cx(
45
+ 'relative w-full overflow-hidden rounded-full bg-bg-muted',
46
+ size === 'sm' ? 'h-1' : 'h-1.5',
47
+ )
48
+ "
49
+ >
50
+ <ProgressIndicator
51
+ :class="
52
+ cx(
53
+ 'h-full rounded-full transition-[width,background-color] duration-(--duration-base) ease-(--ease-out-soft)',
54
+ TONES[tone],
55
+ percent === null && 'motion-progress-indeterminate w-1/3',
56
+ )
57
+ "
58
+ :style="percent === null ? undefined : { width: `${percent}%` }"
59
+ />
60
+ </ProgressRoot>
61
+ </template>
@@ -0,0 +1,90 @@
1
+ <script setup lang="ts">
2
+ import {
3
+ Label,
4
+ RadioGroupIndicator,
5
+ RadioGroupItem,
6
+ RadioGroupRoot,
7
+ } from 'reka-ui';
8
+ import { computed, useId } from 'vue';
9
+ import { cx } from './cx.js';
10
+ import { useControlState } from './field-context.js';
11
+ import type { ChoiceOption } from './options.js';
12
+
13
+ /** Penpot: Radio — Off/On × Default/Hover/Focus/Disabled/Error; группа — Reka UI RadioGroup (стрелки). */
14
+ const props = withDefaults(
15
+ defineProps<{
16
+ options: ChoiceOption[];
17
+ orientation?: 'vertical' | 'horizontal';
18
+ invalid?: boolean;
19
+ disabled?: boolean;
20
+ }>(),
21
+ { orientation: 'vertical', invalid: undefined, disabled: undefined },
22
+ );
23
+ const model = defineModel<string | undefined>();
24
+ const state = useControlState(() => ({
25
+ invalid: props.invalid,
26
+ disabled: props.disabled,
27
+ }));
28
+ const groupId = useId();
29
+
30
+ const item = computed(() =>
31
+ cx(
32
+ 'flex size-4 shrink-0 items-center justify-center rounded-full border outline-none transition duration-(--duration-fast)',
33
+ state.value.invalid
34
+ ? 'focus-visible:shadow-focus-danger'
35
+ : 'focus-visible:shadow-focus',
36
+ state.value.invalid
37
+ ? 'border-danger-solid bg-bg-surface data-[state=checked]:border-2 text-danger-solid'
38
+ : 'border-border-control bg-bg-surface text-accent-solid hover:border-border-control-hover data-[state=checked]:border-2 data-[state=checked]:border-accent-solid data-[state=checked]:hover:border-accent-solid-hover data-[state=checked]:hover:text-accent-solid-hover',
39
+ 'data-disabled:cursor-not-allowed data-disabled:border data-disabled:border-border-disabled data-disabled:bg-bg-muted data-disabled:text-fg-disabled',
40
+ ),
41
+ );
42
+ </script>
43
+
44
+ <template>
45
+ <RadioGroupRoot
46
+ v-model="model"
47
+ :orientation="orientation"
48
+ :disabled="state.disabled"
49
+ :required="state.required"
50
+ :aria-invalid="state.invalid || undefined"
51
+ :aria-describedby="state.describedBy"
52
+ :aria-labelledby="state.labelledBy"
53
+ :class="
54
+ cx(
55
+ 'flex gap-3',
56
+ orientation === 'vertical' ? 'flex-col' : 'flex-row flex-wrap',
57
+ )
58
+ "
59
+ >
60
+ <div
61
+ v-for="option in options"
62
+ :key="option.value"
63
+ class="flex items-center gap-2"
64
+ >
65
+ <RadioGroupItem
66
+ :id="`${groupId}-${option.value}`"
67
+ :value="option.value"
68
+ :disabled="option.disabled"
69
+ :class="item"
70
+ >
71
+ <RadioGroupIndicator
72
+ class="motion-pop block size-1.5 rounded-full bg-current"
73
+ />
74
+ </RadioGroupItem>
75
+ <Label
76
+ :for="`${groupId}-${option.value}`"
77
+ :class="
78
+ cx(
79
+ 'typo-body',
80
+ state.disabled || option.disabled
81
+ ? 'cursor-not-allowed text-fg-disabled'
82
+ : 'text-fg-default',
83
+ )
84
+ "
85
+ >
86
+ {{ option.label }}
87
+ </Label>
88
+ </div>
89
+ </RadioGroupRoot>
90
+ </template>
@@ -0,0 +1,51 @@
1
+ <script setup lang="ts">
2
+ import { Search } from '@lucide/vue';
3
+ import { computed } from 'vue';
4
+ import { cx } from './cx.js';
5
+ import KKbd from './KKbd.vue';
6
+ import {
7
+ formatAriaShortcut,
8
+ formatShortcut,
9
+ type ShortcutKey,
10
+ } from './shortcut.js';
11
+
12
+ /**
13
+ * Penpot: Search Trigger (M18) — кнопка открытия палитры ⌘K в топбаре: 240×32
14
+ * (size.control.sm), radius.md, bg.surface, border.control; Search 16 + подпись fg.subtle +
15
+ * KKbd с сочетанием. Hover — border.control-hover + bg.control-hover; Focus — accent.solid +
16
+ * shadow.focus. `compact` — квадрат 32 только с иконкой (узкий экран). Это `button` с
17
+ * `aria-keyshortcuts`, не поле ввода: открывает палитру событием click.
18
+ */
19
+ const props = withDefaults(
20
+ defineProps<{
21
+ label?: string;
22
+ shortcut?: ShortcutKey[];
23
+ compact?: boolean;
24
+ }>(),
25
+ { label: 'Поиск', shortcut: () => ['mod', 'k'], compact: false },
26
+ );
27
+
28
+ const ariaShortcut = computed(() => formatAriaShortcut(props.shortcut));
29
+ </script>
30
+
31
+ <template>
32
+ <button
33
+ type="button"
34
+ :aria-label="label"
35
+ :aria-keyshortcuts="ariaShortcut"
36
+ :class="
37
+ cx(
38
+ 'flex h-8 shrink-0 items-center rounded-md border border-border-control bg-bg-surface text-fg-subtle outline-none transition duration-(--duration-fast) hover:border-border-control-hover hover:bg-bg-control-hover focus-visible:border-accent-solid focus-visible:shadow-focus',
39
+ compact ? 'w-8 justify-center' : 'w-60 gap-2 px-3',
40
+ )
41
+ "
42
+ >
43
+ <Search :size="16" class="shrink-0" aria-hidden="true" />
44
+ <template v-if="!compact">
45
+ <span class="min-w-0 flex-1 truncate text-left typo-body">{{
46
+ label
47
+ }}</span>
48
+ <KKbd aria-hidden="true">{{ formatShortcut(shortcut) }}</KKbd>
49
+ </template>
50
+ </button>
51
+ </template>
@@ -0,0 +1,104 @@
1
+ <script setup lang="ts">
2
+ import { ToggleGroupItem, ToggleGroupRoot } from 'reka-ui';
3
+ import type { AcceptableValue } from 'reka-ui';
4
+ import { computed } from 'vue';
5
+ import type { Component } from 'vue';
6
+ import { cx } from './cx.js';
7
+ import KTooltip from './KTooltip.vue';
8
+
9
+ /**
10
+ * Penpot: Segmented — Item Content Text/Icon × State Default/Hover/Selected/Focus/Disabled.
11
+ * Дорожка bg.subtle, radius.md, padding 2, gap 2, высота 32; пункт 28, radius.sm, gap 6:
12
+ * Text — text.label, px 12, иконка 16 слева по желанию; Icon — 28×28, только иконка.
13
+ * Reka ToggleGroup type="single": role="group" с aria-label, пункты — кнопки с aria-pressed,
14
+ * стрелки переносят фокус по кругу (roving focus, Tab — в группу и из неё), Enter/Space выбирают.
15
+ * Выбор обязателен: клик по выбранному пункту не снимает его (пустое значение Reka игнорируем).
16
+ * iconOnly — подпись пункта в aria-label и в KTooltip. Фокус — shadow.focus; переходы — duration-fast.
17
+ */
18
+ export type SegmentedOption = {
19
+ value: string;
20
+ label: string;
21
+ icon?: Component;
22
+ disabled?: boolean;
23
+ };
24
+
25
+ const props = withDefaults(
26
+ defineProps<{
27
+ options: SegmentedOption[];
28
+ /**
29
+ * Подпись группы для скринридера (обязательна: видимой подписи у переключателя нет).
30
+ * Объявлен в kebab-case: vue-tsc не переводит aria-* в camelCase, и `aria-label="…"`
31
+ * в шаблоне не засчитывался бы за обязательный ariaLabel.
32
+ */
33
+ 'aria-label': string;
34
+ iconOnly?: boolean;
35
+ disabled?: boolean;
36
+ }>(),
37
+ { iconOnly: false, disabled: false },
38
+ );
39
+
40
+ const model = defineModel<string>({ required: true });
41
+
42
+ /** Vue хранит объявленный 'aria-label' под ключом ariaLabel (camelize), тип знает только исходное имя. */
43
+ const groupLabel = computed(
44
+ () => (props as unknown as { ariaLabel: string }).ariaLabel,
45
+ );
46
+
47
+ function select(value: AcceptableValue | AcceptableValue[]): void {
48
+ if (typeof value === 'string' && value) model.value = value;
49
+ }
50
+
51
+ /**
52
+ * Классы пункта: disabled решаем в скрипте, чтобы цвета не спорили через порядок вариантов.
53
+ * Выбранный — по aria-pressed, не по data-state: у iconOnly data-state перехватывает триггер KTooltip.
54
+ */
55
+ function itemClass(option: SegmentedOption, groupDisabled: boolean): string {
56
+ const off = groupDisabled || option.disabled;
57
+ return cx(
58
+ 'inline-flex h-7 shrink-0 items-center justify-center gap-1.5 rounded-sm typo-label whitespace-nowrap outline-none transition duration-(--duration-fast) focus-visible:shadow-focus aria-pressed:bg-bg-surface aria-pressed:shadow-sm',
59
+ props.iconOnly ? 'w-7' : 'px-3',
60
+ off
61
+ ? 'cursor-not-allowed text-fg-disabled'
62
+ : 'text-fg-muted hover:text-fg-default aria-pressed:text-fg-default',
63
+ );
64
+ }
65
+ </script>
66
+
67
+ <template>
68
+ <ToggleGroupRoot
69
+ type="single"
70
+ :model-value="model"
71
+ :aria-label="groupLabel"
72
+ :disabled="disabled"
73
+ loop
74
+ class="inline-flex h-8 items-center gap-0.5 rounded-md bg-bg-subtle p-0.5"
75
+ @update:model-value="select"
76
+ >
77
+ <template v-for="option in options" :key="option.value">
78
+ <KTooltip v-if="iconOnly" :content="option.label">
79
+ <ToggleGroupItem
80
+ :value="option.value"
81
+ :disabled="option.disabled"
82
+ :aria-label="option.label"
83
+ :class="itemClass(option, disabled)"
84
+ >
85
+ <component :is="option.icon" :size="16" aria-hidden="true" />
86
+ </ToggleGroupItem>
87
+ </KTooltip>
88
+ <ToggleGroupItem
89
+ v-else
90
+ :value="option.value"
91
+ :disabled="option.disabled"
92
+ :class="itemClass(option, disabled)"
93
+ >
94
+ <component
95
+ :is="option.icon"
96
+ v-if="option.icon"
97
+ :size="16"
98
+ aria-hidden="true"
99
+ />
100
+ {{ option.label }}
101
+ </ToggleGroupItem>
102
+ </template>
103
+ </ToggleGroupRoot>
104
+ </template>
@@ -0,0 +1,124 @@
1
+ <script setup lang="ts">
2
+ import { Check, ChevronDown } from '@lucide/vue';
3
+ import {
4
+ SelectContent,
5
+ SelectItem,
6
+ SelectItemIndicator,
7
+ SelectItemText,
8
+ SelectPortal,
9
+ SelectRoot,
10
+ SelectTrigger,
11
+ SelectValue,
12
+ SelectViewport,
13
+ } from 'reka-ui';
14
+ import { computed } from 'vue';
15
+ import { cellControlClasses, controlClasses } from './control-classes.js';
16
+ import { cx } from './cx.js';
17
+ import { useControlState } from './field-context.js';
18
+ import type { ChoiceOption } from './options.js';
19
+
20
+ /**
21
+ * Penpot: Select (md/sm) + Select Option (Default/Hover/Selected/Disabled). Reka UI Select — клавиатура и ARIA.
22
+ * size="cell" — редактор во всю ячейку KTable grid (Penpot: Cell Editor Select), шеврон открытого — вверх.
23
+ */
24
+ defineOptions({ inheritAttrs: false }); // aria-label и прочее — на кнопку-триггер
25
+ const props = withDefaults(
26
+ defineProps<{
27
+ id?: string;
28
+ options: ChoiceOption[];
29
+ placeholder?: string;
30
+ size?: 'md' | 'sm' | 'cell';
31
+ invalid?: boolean;
32
+ disabled?: boolean;
33
+ }>(),
34
+ {
35
+ placeholder: 'Выберите…',
36
+ size: 'md',
37
+ invalid: undefined,
38
+ disabled: undefined,
39
+ },
40
+ );
41
+ const model = defineModel<string | undefined>();
42
+ /** Открыт ли список (v-model:open): редактор ячейки (M18) открывает его сразу. */
43
+ const open = defineModel<boolean>('open', { default: false });
44
+ const state = useControlState(() => ({
45
+ id: props.id,
46
+ invalid: props.invalid,
47
+ disabled: props.disabled,
48
+ }));
49
+
50
+ const trigger = computed(() =>
51
+ cx(
52
+ 'group flex items-center justify-between gap-2 typo-body',
53
+ // data-placeholder специфичнее text-fg-disabled из controlClasses — в disabled не ставим
54
+ !state.value.disabled && 'data-placeholder:text-fg-subtle',
55
+ props.size === 'cell'
56
+ ? cx(
57
+ cellControlClasses,
58
+ state.value.disabled && 'cursor-not-allowed text-fg-disabled',
59
+ )
60
+ : cx(
61
+ 'w-full px-3',
62
+ props.size === 'md'
63
+ ? 'h-(--size-control-md)'
64
+ : 'h-(--size-control-sm)',
65
+ controlClasses({
66
+ invalid: state.value.invalid,
67
+ disabled: state.value.disabled,
68
+ }),
69
+ ),
70
+ ),
71
+ );
72
+ </script>
73
+
74
+ <template>
75
+ <SelectRoot
76
+ v-model="model"
77
+ v-model:open="open"
78
+ :disabled="state.disabled"
79
+ :required="state.required"
80
+ >
81
+ <SelectTrigger
82
+ v-bind="$attrs"
83
+ :id="state.id"
84
+ :class="trigger"
85
+ :aria-invalid="state.invalid || undefined"
86
+ :aria-describedby="state.describedBy"
87
+ >
88
+ <SelectValue :placeholder="placeholder" class="truncate" />
89
+ <ChevronDown
90
+ :size="16"
91
+ :class="
92
+ cx(
93
+ 'shrink-0 text-fg-subtle',
94
+ size === 'cell' &&
95
+ 'transition-transform duration-(--duration-fast) group-data-[state=open]:rotate-180',
96
+ )
97
+ "
98
+ aria-hidden="true"
99
+ />
100
+ </SelectTrigger>
101
+ <SelectPortal>
102
+ <SelectContent
103
+ position="popper"
104
+ :side-offset="4"
105
+ class="motion-popover z-50 max-h-(--reka-select-content-available-height) w-(--reka-select-trigger-width) overflow-hidden rounded-lg border border-border-default bg-bg-surface p-1 shadow-md"
106
+ >
107
+ <SelectViewport>
108
+ <SelectItem
109
+ v-for="option in options"
110
+ :key="option.value"
111
+ :value="option.value"
112
+ :disabled="option.disabled"
113
+ class="flex h-9 cursor-default items-center justify-between gap-2 rounded-sm px-3 typo-body text-fg-default outline-none select-none data-disabled:text-fg-disabled data-highlighted:bg-bg-hover data-[state=checked]:bg-accent-subtle data-[state=checked]:typo-body-strong data-[state=checked]:text-accent-text"
114
+ >
115
+ <SelectItemText>{{ option.label }}</SelectItemText>
116
+ <SelectItemIndicator>
117
+ <Check :size="16" aria-hidden="true" />
118
+ </SelectItemIndicator>
119
+ </SelectItem>
120
+ </SelectViewport>
121
+ </SelectContent>
122
+ </SelectPortal>
123
+ </SelectRoot>
124
+ </template>
@@ -0,0 +1,33 @@
1
+ <script setup lang="ts">
2
+ import { Separator } from 'reka-ui';
3
+ import { cx } from './cx.js';
4
+
5
+ /**
6
+ * Penpot: Separator — Orientation Horizontal / Vertical. 1px border.default: Horizontal —
7
+ * по ширине контейнера, Vertical — по высоте строки (self-stretch; в flex-строке с
8
+ * items-center задайте высоту классом, например `h-4`). Reka Separator.
9
+ *
10
+ * a11y: по умолчанию декоративный (role="none" — скринридер его пропускает). Разделитель,
11
+ * который делит смысловые группы, — `:decorative="false"`: role="separator", у вертикального
12
+ * ещё aria-orientation="vertical" (у горизонтального это значение по умолчанию).
13
+ */
14
+ export type SeparatorOrientation = 'horizontal' | 'vertical';
15
+
16
+ withDefaults(
17
+ defineProps<{ orientation?: SeparatorOrientation; decorative?: boolean }>(),
18
+ { orientation: 'horizontal', decorative: true },
19
+ );
20
+ </script>
21
+
22
+ <template>
23
+ <Separator
24
+ :orientation="orientation"
25
+ :decorative="decorative"
26
+ :class="
27
+ cx(
28
+ 'shrink-0 bg-border-default',
29
+ orientation === 'horizontal' ? 'h-px w-full' : 'w-px self-stretch',
30
+ )
31
+ "
32
+ />
33
+ </template>