@kodacms/admin 0.0.0-stage → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/LICENSE +21 -0
- package/README.md +93 -2
- package/design-tokens/kodacms.tokens.json +1360 -0
- package/dist/apple-touch-icon.png +0 -0
- package/dist/assets/AuditView-DCgrAjma.js +1 -0
- package/dist/assets/CollectionView-CY3zK1CE.js +1 -0
- package/dist/assets/CustomComponent-B1mxHHd0.js +1 -0
- package/dist/assets/CustomPageView-BTsy9MC8.js +1 -0
- package/dist/assets/DashboardView-ujWhLuS2.js +1 -0
- package/dist/assets/DeleteDocumentsDialog-D1nx27UG.js +1 -0
- package/dist/assets/DocumentHistoryView-Ko633-Dy.js +1 -0
- package/dist/assets/DocumentView-CPEjwzzo.js +1 -0
- package/dist/assets/GlobalHistoryView-CbwdeYpn.js +1 -0
- package/dist/assets/GlobalView-DcTGexxK.js +1 -0
- package/dist/assets/KAlert-DoR81cyQ.js +1 -0
- package/dist/assets/KCard-DNom764U.js +1 -0
- package/dist/assets/KDropdownMenu-BECk5S9K.js +1 -0
- package/dist/assets/KField-CvINPmYu.js +1 -0
- package/dist/assets/KPagination-DQOzrRaf.js +1 -0
- package/dist/assets/KPasswordInput-EPBXvtXG.js +1 -0
- package/dist/assets/KSeparator-DEbXnpDV.js +1 -0
- package/dist/assets/KTableRow-Dpp2Lk2V.js +1 -0
- package/dist/assets/KTabs-b95D7hep.js +1 -0
- package/dist/assets/KTextarea-CCveuS_I.js +1 -0
- package/dist/assets/Label-m9Ig3v9B.js +1 -0
- package/dist/assets/ListFooter-qYmCWY4R.js +1 -0
- package/dist/assets/LoadError-BRccywgs.js +1 -0
- package/dist/assets/LoginView-DvTtEJxp.js +1 -0
- package/dist/assets/NoAccessView-Bg69btHE.js +1 -0
- package/dist/assets/NotFoundView-qhJ2ixSH.js +1 -0
- package/dist/assets/PageHeader-B3riLtJg.js +1 -0
- package/dist/assets/PopoverAnchor-BwL6g4vt.js +1 -0
- package/dist/assets/PopoverContentImpl-Dq0cbuHV.js +1 -0
- package/dist/assets/PopoverContentModal-BEl8rmbI.js +1 -0
- package/dist/assets/PopoverContentNonModal-D5osgtpx.js +1 -0
- package/dist/assets/RoleView-D9732bW6.js +1 -0
- package/dist/assets/RolesView-Du4NUhQJ.js +1 -0
- package/dist/assets/TooltipContentHoverable-C18vbtIU.js +1 -0
- package/dist/assets/TooltipContentImpl-CCpG79EA.js +1 -0
- package/dist/assets/TooltipContentImpl-DQFjU6ri.js +1 -0
- package/dist/assets/UploadQueueItem-BbG5x7WM.js +6 -0
- package/dist/assets/UserView-iFK1eFT9.js +1 -0
- package/dist/assets/UsersView-B6fCtC-4.js +1 -0
- package/dist/assets/columns-DmJOzXV9.js +1 -0
- package/dist/assets/ellipsis-BNwYKZMS.js +1 -0
- package/dist/assets/error-text-1F8qU3pC.js +1 -0
- package/dist/assets/eye-DyBObYiE.js +1 -0
- package/dist/assets/eye-off-Bd_6erac.js +1 -0
- package/dist/assets/form-layout-Dk2JVUC0.js +1 -0
- package/dist/assets/globals-BMIQQR5f.js +1 -0
- package/dist/assets/index-CGdQZeTs.css +2 -0
- package/dist/assets/index-a4P44W6e.js +14 -0
- package/dist/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/assets/list-query-DcmvyLSO.js +1 -0
- package/dist/assets/rolldown-runtime-P3Pd_6ND.js +1 -0
- package/dist/assets/select-options-osOjd-zR.js +1 -0
- package/dist/assets/useAuditState-D6n8HXQ2.js +1 -0
- package/dist/assets/useDebounced-BVo96C1E.js +1 -0
- package/dist/assets/useHistoryLocale-BWBBUuQi.js +1 -0
- package/dist/assets/useListState-CTgxjU_g.js +1 -0
- package/dist/assets/useLocaleDocument-DkvwSG3X.js +1 -0
- package/dist/assets/usePageHeader-wYdFq9cQ.js +1 -0
- package/dist/assets/useRoleDelete-DFwroHOv.js +1 -0
- package/dist/assets/useSaveShortcut-DFNu_TAL.js +1 -0
- package/dist/assets/useUserDelete-83wa7pqC.js +1 -0
- package/dist/assets/useUsersAccess-1yVnzExk.js +1 -0
- package/dist/assets/users-NiowxtJB.js +1 -0
- package/dist/assets/validate-CEcXMakk.js +1 -0
- package/dist/favicon.svg +12 -0
- package/dist/index.html +16 -0
- package/dist/koda-components.json +4 -0
- package/index.html +15 -0
- package/package.json +68 -4
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon.svg +12 -0
- package/src/App.vue +17 -0
- package/src/api/access.ts +110 -0
- package/src/api/admin-config.ts +318 -0
- package/src/api/admin-fields.ts +557 -0
- package/src/api/admin-layout.ts +191 -0
- package/src/api/api-error.ts +78 -0
- package/src/api/audit.ts +170 -0
- package/src/api/client.ts +153 -0
- package/src/api/documents.ts +470 -0
- package/src/api/drafts.ts +115 -0
- package/src/api/error-text.ts +11 -0
- package/src/api/globals.ts +133 -0
- package/src/api/http.ts +24 -0
- package/src/api/locale.ts +48 -0
- package/src/api/permissions.ts +194 -0
- package/src/api/relations.ts +86 -0
- package/src/api/roles.ts +170 -0
- package/src/api/scopes.ts +91 -0
- package/src/api/search-query.ts +33 -0
- package/src/api/search.ts +39 -0
- package/src/api/types.ts +39 -0
- package/src/api/upload.ts +146 -0
- package/src/api/users.ts +88 -0
- package/src/api/versions.ts +206 -0
- package/src/api/where-query.ts +79 -0
- package/src/audit/AuditActionBadge.vue +13 -0
- package/src/audit/AuditActor.vue +34 -0
- package/src/audit/AuditCard.vue +68 -0
- package/src/audit/AuditDrawer.vue +86 -0
- package/src/audit/AuditDrawerActions.vue +70 -0
- package/src/audit/AuditEntryBody.vue +74 -0
- package/src/audit/AuditEntryChanges.vue +88 -0
- package/src/audit/AuditEntryFacts.vue +47 -0
- package/src/audit/AuditFilterBar.vue +55 -0
- package/src/audit/AuditFilterControls.vue +148 -0
- package/src/audit/AuditFiltersDrawer.vue +46 -0
- package/src/audit/AuditHistory.vue +136 -0
- package/src/audit/AuditList.vue +183 -0
- package/src/audit/AuditListStates.vue +70 -0
- package/src/audit/AuditRestoredVersion.vue +66 -0
- package/src/audit/AuditSearch.vue +40 -0
- package/src/audit/AuditTable.vue +116 -0
- package/src/audit/HistoryTabs.vue +48 -0
- package/src/audit/audit-changes.ts +161 -0
- package/src/audit/audit-filters.ts +152 -0
- package/src/audit/audit-view.ts +372 -0
- package/src/audit/useAuditContext.ts +23 -0
- package/src/audit/useAuditFilterOptions.ts +67 -0
- package/src/audit/useAuditState.ts +82 -0
- package/src/brand/KodaMark.vue +42 -0
- package/src/composables/useAccessView.ts +120 -0
- package/src/composables/useDebounced.ts +15 -0
- package/src/composables/usePageHeader.ts +20 -0
- package/src/composables/useSessionCacheReset.ts +23 -0
- package/src/composables/useTheme.ts +79 -0
- package/src/composables/useUsersAccess.ts +13 -0
- package/src/custom/CustomComponent.vue +103 -0
- package/src/custom/CustomComponentNotice.vue +71 -0
- package/src/custom/CustomInserts.vue +36 -0
- package/src/custom/component-name.ts +18 -0
- package/src/custom/error-info.ts +22 -0
- package/src/custom/form-context.ts +44 -0
- package/src/custom/list-context.ts +44 -0
- package/src/custom/place.ts +126 -0
- package/src/custom/registry.ts +101 -0
- package/src/custom/useCustomComponent.ts +136 -0
- package/src/custom/useFormZones.ts +65 -0
- package/src/custom/useListZones.ts +38 -0
- package/src/custom/user-components.ts +20 -0
- package/src/custom/zone-components.ts +53 -0
- package/src/documents/DocumentForm.vue +168 -0
- package/src/documents/DocumentList.vue +190 -0
- package/src/documents/cells/CheckboxCell.vue +16 -0
- package/src/documents/cells/DateCell.vue +26 -0
- package/src/documents/cells/FallbackCell.vue +23 -0
- package/src/documents/cells/FileSizeCell.vue +14 -0
- package/src/documents/cells/IdCell.vue +14 -0
- package/src/documents/cells/MimeCell.vue +15 -0
- package/src/documents/cells/NumberCell.vue +13 -0
- package/src/documents/cells/RelationshipCell.vue +33 -0
- package/src/documents/cells/RowsCell.vue +21 -0
- package/src/documents/cells/SelectCell.vue +23 -0
- package/src/documents/cells/StatusCell.vue +18 -0
- package/src/documents/cells/TextCell.vue +16 -0
- package/src/documents/cells/ThumbnailCell.vue +31 -0
- package/src/documents/cells/UploadCell.vue +53 -0
- package/src/documents/cells/UploadCellThumb.vue +27 -0
- package/src/documents/cells/cell-props.ts +12 -0
- package/src/documents/cells/registry.ts +44 -0
- package/src/documents/cells/select-options.ts +18 -0
- package/src/documents/drafts/DraftActions.vue +62 -0
- package/src/documents/drafts/DraftStatus.vue +100 -0
- package/src/documents/drafts/StatusBadge.vue +23 -0
- package/src/documents/drafts/UnpublishDialog.vue +25 -0
- package/src/documents/drafts/useAutosave.ts +88 -0
- package/src/documents/drafts/useDrafts.ts +73 -0
- package/src/documents/fields/CheckboxControl.vue +13 -0
- package/src/documents/fields/DateControl.vue +22 -0
- package/src/documents/fields/FieldControl.vue +55 -0
- package/src/documents/fields/FieldDescription.vue +34 -0
- package/src/documents/fields/FieldRenderer.vue +92 -0
- package/src/documents/fields/GroupChildren.vue +28 -0
- package/src/documents/fields/GroupErrors.vue +49 -0
- package/src/documents/fields/GroupFields.vue +87 -0
- package/src/documents/fields/JsonControl.vue +20 -0
- package/src/documents/fields/NumberControl.vue +20 -0
- package/src/documents/fields/ReadOnlyControl.vue +18 -0
- package/src/documents/fields/SelectControl.vue +46 -0
- package/src/documents/fields/TextControl.vue +37 -0
- package/src/documents/fields/TextareaControl.vue +18 -0
- package/src/documents/fields/ValueField.vue +87 -0
- package/src/documents/fields/field-control.ts +10 -0
- package/src/documents/fields/registry.ts +56 -0
- package/src/documents/fields/relation/JoinControl.vue +41 -0
- package/src/documents/fields/relation/RelationshipControl.vue +57 -0
- package/src/documents/fields/relation/useRelationPicker.ts +96 -0
- package/src/documents/fields/rows/ArrayFields.vue +72 -0
- package/src/documents/fields/rows/BlocksFields.vue +90 -0
- package/src/documents/fields/rows/RowCard.vue +81 -0
- package/src/documents/fields/rows/RowFields.vue +32 -0
- package/src/documents/fields/rows/RowsFieldset.vue +51 -0
- package/src/documents/fields/rows/row-title.ts +29 -0
- package/src/documents/fields/rows/useRows.ts +32 -0
- package/src/documents/fields/upload/MediaGrid.vue +61 -0
- package/src/documents/fields/upload/MediaLibrary.vue +131 -0
- package/src/documents/fields/upload/MediaPickerDialog.vue +54 -0
- package/src/documents/fields/upload/MediaTile.vue +69 -0
- package/src/documents/fields/upload/MediaUploadArea.vue +60 -0
- package/src/documents/fields/upload/UploadControl.vue +157 -0
- package/src/documents/fields/upload/UploadValueItem.vue +108 -0
- package/src/documents/fields/upload/upload-field.ts +77 -0
- package/src/documents/fields/upload/useFieldUploads.ts +60 -0
- package/src/documents/fields/upload/useMediaLibrary.ts +77 -0
- package/src/documents/fields/useCustomFieldModel.ts +32 -0
- package/src/documents/fields/useFieldLocale.ts +38 -0
- package/src/documents/form/DocumentFields.vue +28 -0
- package/src/documents/form/DocumentHeader.vue +50 -0
- package/src/documents/form/DocumentMeta.vue +99 -0
- package/src/documents/form/UnsavedChangesDialog.vue +27 -0
- package/src/documents/form/created-by.ts +12 -0
- package/src/documents/form/field-errors.ts +29 -0
- package/src/documents/form/field-value.ts +229 -0
- package/src/documents/form/focus-first-error.ts +43 -0
- package/src/documents/form/form-conditions.ts +106 -0
- package/src/documents/form/form-layout.ts +245 -0
- package/src/documents/form/form-values.ts +265 -0
- package/src/documents/form/layout/LayoutBlock.vue +32 -0
- package/src/documents/form/layout/LayoutItems.vue +43 -0
- package/src/documents/form/layout/LayoutLeaf.vue +33 -0
- package/src/documents/form/layout/LayoutRow.vue +60 -0
- package/src/documents/form/layout/LayoutSection.vue +73 -0
- package/src/documents/form/layout/LayoutStack.vue +20 -0
- package/src/documents/form/layout/LayoutTabs.vue +74 -0
- package/src/documents/form/relation-value.ts +160 -0
- package/src/documents/form/rows.ts +24 -0
- package/src/documents/form/save-messages.ts +65 -0
- package/src/documents/form/useDocumentDelete.ts +38 -0
- package/src/documents/form/useDocumentEditor.ts +167 -0
- package/src/documents/form/useDocumentForm.ts +37 -0
- package/src/documents/form/useDocumentRights.ts +45 -0
- package/src/documents/form/useDocumentSubmit.ts +128 -0
- package/src/documents/form/useFieldsForm.ts +238 -0
- package/src/documents/form/useFormLayout.ts +21 -0
- package/src/documents/form/useFormTabs.ts +54 -0
- package/src/documents/form/useLeaveGuard.ts +69 -0
- package/src/documents/form/useSaveShortcut.ts +13 -0
- package/src/documents/form/validate.ts +220 -0
- package/src/documents/list/CellConflictMessage.vue +24 -0
- package/src/documents/list/CellEditor.vue +155 -0
- package/src/documents/list/CellRelationEditor.vue +62 -0
- package/src/documents/list/DeleteDocumentsDialog.vue +42 -0
- package/src/documents/list/DocumentActions.vue +68 -0
- package/src/documents/list/DocumentCard.vue +84 -0
- package/src/documents/list/DocumentCards.vue +31 -0
- package/src/documents/list/DocumentRow.vue +86 -0
- package/src/documents/list/DocumentTable.vue +104 -0
- package/src/documents/list/InlineCell.vue +151 -0
- package/src/documents/list/InlineCheckboxCell.vue +99 -0
- package/src/documents/list/ListCell.vue +39 -0
- package/src/documents/list/ListCellValue.vue +59 -0
- package/src/documents/list/ListFooter.vue +50 -0
- package/src/documents/list/ListSearch.vue +44 -0
- package/src/documents/list/ListStates.vue +73 -0
- package/src/documents/list/ListToolbar.vue +37 -0
- package/src/documents/list/SelectionBar.vue +30 -0
- package/src/documents/list/cell-failure.ts +91 -0
- package/src/documents/list/cell-save.ts +129 -0
- package/src/documents/list/columns.ts +157 -0
- package/src/documents/list/inline-cells.ts +61 -0
- package/src/documents/list/inline-edit-context.ts +14 -0
- package/src/documents/list/inline-edit.ts +302 -0
- package/src/documents/list/list-query.ts +46 -0
- package/src/documents/list/row-overlay.ts +45 -0
- package/src/documents/list/sort.ts +32 -0
- package/src/documents/list/useCellEditorKeys.ts +78 -0
- package/src/documents/list/useCellEditorModel.ts +33 -0
- package/src/documents/list/useCellPopup.ts +94 -0
- package/src/documents/list/useDeleteFlow.ts +42 -0
- package/src/documents/list/useDocumentListData.ts +97 -0
- package/src/documents/list/useInlineEdit.ts +143 -0
- package/src/documents/list/useListInlineEdit.ts +68 -0
- package/src/documents/list/useListNotices.ts +58 -0
- package/src/documents/list/useListState.ts +67 -0
- package/src/documents/list/useRowPublish.ts +150 -0
- package/src/documents/upload/BulkUpload.vue +58 -0
- package/src/documents/upload/DocumentFileCard.vue +106 -0
- package/src/documents/upload/FileActions.vue +57 -0
- package/src/documents/upload/FileDetails.vue +40 -0
- package/src/documents/upload/UploadProgressRow.vue +29 -0
- package/src/documents/upload/UploadQueueItem.vue +150 -0
- package/src/documents/upload/UploadQueueSummary.vue +70 -0
- package/src/documents/upload/file-actions.ts +35 -0
- package/src/documents/upload/upload-logic.ts +209 -0
- package/src/documents/upload/upload-queue.ts +220 -0
- package/src/documents/upload/useDocumentFile.ts +93 -0
- package/src/documents/upload/useFileBlob.ts +132 -0
- package/src/documents/upload/useShownFile.ts +77 -0
- package/src/documents/versions/DiffOmitted.vue +34 -0
- package/src/documents/versions/DiffTree.vue +76 -0
- package/src/documents/versions/DiffValue.vue +101 -0
- package/src/documents/versions/HistoryLink.vue +17 -0
- package/src/documents/versions/RestoreVersionDialog.vue +58 -0
- package/src/documents/versions/VersionCard.vue +111 -0
- package/src/documents/versions/VersionHistory.vue +127 -0
- package/src/documents/versions/VersionSnapshot.vue +145 -0
- package/src/documents/versions/diff-view.ts +153 -0
- package/src/documents/versions/text-diff.ts +66 -0
- package/src/documents/versions/useRestoreFlow.ts +55 -0
- package/src/env.d.ts +17 -0
- package/src/format.ts +58 -0
- package/src/globals/GlobalForm.vue +139 -0
- package/src/globals/GlobalHeader.vue +39 -0
- package/src/globals/GlobalMeta.vue +67 -0
- package/src/globals/useGlobalEditor.ts +118 -0
- package/src/globals/useGlobalForm.ts +32 -0
- package/src/globals/useGlobalSubmit.ts +75 -0
- package/src/layout/AppBarMobile.vue +42 -0
- package/src/layout/AppLayout.vue +40 -0
- package/src/layout/AppTopbar.vue +28 -0
- package/src/layout/LoadError.vue +19 -0
- package/src/layout/MobileNavDrawer.vue +45 -0
- package/src/layout/PageHeader.vue +19 -0
- package/src/layout/ThemeToggle.vue +28 -0
- package/src/layout/palette/AppCommandPalette.vue +32 -0
- package/src/layout/palette/palette-actions.ts +54 -0
- package/src/layout/palette/palette-commands.ts +156 -0
- package/src/layout/palette/palette-documents.ts +73 -0
- package/src/layout/palette/palette-groups.ts +90 -0
- package/src/layout/palette/palette-hotkey.ts +39 -0
- package/src/layout/palette/recent-documents.ts +123 -0
- package/src/layout/palette/useCommandPalette.ts +75 -0
- package/src/layout/palette/useDocumentSearch.ts +88 -0
- package/src/layout/palette/useRememberDocument.ts +30 -0
- package/src/layout/sidebar/SidebarAdmin.vue +50 -0
- package/src/layout/sidebar/SidebarBrand.vue +14 -0
- package/src/layout/sidebar/SidebarCollections.vue +55 -0
- package/src/layout/sidebar/SidebarGlobals.vue +23 -0
- package/src/layout/sidebar/SidebarGroup.vue +14 -0
- package/src/layout/sidebar/SidebarItem.vue +47 -0
- package/src/layout/sidebar/SidebarNav.vue +37 -0
- package/src/layout/sidebar/SidebarUser.vue +43 -0
- package/src/layout/sidebar/SidebarViews.vue +26 -0
- package/src/layout/sidebar/view-icons.ts +112 -0
- package/src/localization/FallbackHint.vue +41 -0
- package/src/localization/LocaleNotice.vue +42 -0
- package/src/localization/LocaleSwitcher.vue +40 -0
- package/src/localization/fallback-value.ts +76 -0
- package/src/localization/list-locale.ts +37 -0
- package/src/localization/locale-form.ts +64 -0
- package/src/localization/locale.ts +286 -0
- package/src/localization/useContentLocale.ts +47 -0
- package/src/localization/useHistoryLocale.ts +30 -0
- package/src/localization/useListFallbacks.ts +49 -0
- package/src/localization/useLocaleDocument.ts +116 -0
- package/src/main.ts +21 -0
- package/src/public/__snapshots__/public-api.spec.ts.snap +456 -0
- package/src/public/composables/useApi.ts +155 -0
- package/src/public/composables/useCell.ts +38 -0
- package/src/public/composables/useCurrentUser.ts +16 -0
- package/src/public/composables/useDocument.ts +108 -0
- package/src/public/composables/useField.ts +136 -0
- package/src/public/composables/useList.ts +38 -0
- package/src/public/composables/useLocale.ts +29 -0
- package/src/public/composables/useToast.ts +19 -0
- package/src/public/index.ts +59 -0
- package/src/public/types.ts +183 -0
- package/src/public/ui.ts +85 -0
- package/src/roles/CopyRoleDialog.vue +32 -0
- package/src/roles/DeleteRoleDialog.vue +26 -0
- package/src/roles/MatrixFlags.vue +77 -0
- package/src/roles/MatrixTable.vue +101 -0
- package/src/roles/PermissionMatrix.vue +112 -0
- package/src/roles/RoleActions.vue +47 -0
- package/src/roles/RoleCard.vue +54 -0
- package/src/roles/RoleForm.vue +150 -0
- package/src/roles/RoleFormFields.vue +43 -0
- package/src/roles/RoleList.vue +77 -0
- package/src/roles/RoleMeta.vue +74 -0
- package/src/roles/RoleTable.vue +74 -0
- package/src/roles/role-form.ts +135 -0
- package/src/roles/role-matrix.ts +284 -0
- package/src/roles/useRoleCopy.ts +61 -0
- package/src/roles/useRoleDelete.ts +39 -0
- package/src/roles/useRoleForm.ts +122 -0
- package/src/router/guards.ts +57 -0
- package/src/router/index.ts +160 -0
- package/src/router/redirect.ts +9 -0
- package/src/runtime/runtime-config.ts +32 -0
- package/src/stores/auth.ts +205 -0
- package/src/stores/shell.ts +24 -0
- package/src/stores/uploads.ts +81 -0
- package/src/styles/main.css +40 -0
- package/src/styles/motion.css +328 -0
- package/src/styles/tokens.css +347 -0
- package/src/ui/KAlert.vue +80 -0
- package/src/ui/KAvatar.vue +43 -0
- package/src/ui/KBadge.vue +56 -0
- package/src/ui/KBreadcrumbs.vue +56 -0
- package/src/ui/KButton.vue +136 -0
- package/src/ui/KCalendar.vue +79 -0
- package/src/ui/KCard.vue +106 -0
- package/src/ui/KCellMessage.vue +57 -0
- package/src/ui/KCellTextarea.vue +92 -0
- package/src/ui/KCheckbox.vue +87 -0
- package/src/ui/KCollapsible.vue +100 -0
- package/src/ui/KCombobox.vue +173 -0
- package/src/ui/KComboboxOptions.vue +68 -0
- package/src/ui/KCommandItem.vue +53 -0
- package/src/ui/KCommandPalette.vue +215 -0
- package/src/ui/KDatePicker.vue +165 -0
- package/src/ui/KDrawer.vue +108 -0
- package/src/ui/KDropdownMenu.vue +60 -0
- package/src/ui/KDropzone.vue +163 -0
- package/src/ui/KEmptyState.vue +68 -0
- package/src/ui/KField.vue +103 -0
- package/src/ui/KInput.vue +89 -0
- package/src/ui/KKbd.vue +24 -0
- package/src/ui/KModal.vue +92 -0
- package/src/ui/KMultiSelect.vue +141 -0
- package/src/ui/KPagination.vue +65 -0
- package/src/ui/KPasswordInput.vue +33 -0
- package/src/ui/KPopover.vue +110 -0
- package/src/ui/KProgress.vue +61 -0
- package/src/ui/KRadioGroup.vue +90 -0
- package/src/ui/KSearchTrigger.vue +51 -0
- package/src/ui/KSegmented.vue +104 -0
- package/src/ui/KSelect.vue +124 -0
- package/src/ui/KSeparator.vue +33 -0
- package/src/ui/KSkeleton.vue +35 -0
- package/src/ui/KSpinner.vue +17 -0
- package/src/ui/KSwitch.vue +65 -0
- package/src/ui/KTab.vue +65 -0
- package/src/ui/KTabList.vue +18 -0
- package/src/ui/KTabPanel.vue +18 -0
- package/src/ui/KTable.vue +43 -0
- package/src/ui/KTableBody.vue +9 -0
- package/src/ui/KTableCell.vue +228 -0
- package/src/ui/KTableHeader.vue +39 -0
- package/src/ui/KTableHeaderCell.vue +94 -0
- package/src/ui/KTableRow.vue +49 -0
- package/src/ui/KTabs.vue +24 -0
- package/src/ui/KTag.vue +29 -0
- package/src/ui/KTextarea.vue +50 -0
- package/src/ui/KThumbnail.vue +100 -0
- package/src/ui/KToaster.vue +70 -0
- package/src/ui/KTooltip.vue +55 -0
- package/src/ui/command-palette.ts +41 -0
- package/src/ui/control-classes.ts +48 -0
- package/src/ui/cx.ts +6 -0
- package/src/ui/date-value.ts +48 -0
- package/src/ui/field-context.ts +61 -0
- package/src/ui/index.ts +88 -0
- package/src/ui/options.ts +6 -0
- package/src/ui/pagination.ts +38 -0
- package/src/ui/shortcut.ts +104 -0
- package/src/ui/table-grid.ts +277 -0
- package/src/ui/toast.ts +59 -0
- package/src/ui/useFileDrop.ts +70 -0
- package/src/users/DeleteUserDialog.vue +26 -0
- package/src/users/UserActions.vue +46 -0
- package/src/users/UserCard.vue +44 -0
- package/src/users/UserForm.vue +134 -0
- package/src/users/UserFormFields.vue +93 -0
- package/src/users/UserList.vue +107 -0
- package/src/users/UserMeta.vue +70 -0
- package/src/users/UserRoleBadge.vue +10 -0
- package/src/users/UserTable.vue +84 -0
- package/src/users/useRoleOptions.ts +50 -0
- package/src/users/useUserDelete.ts +39 -0
- package/src/users/useUserForm.ts +74 -0
- package/src/users/user-columns.ts +12 -0
- package/src/users/user-form.ts +167 -0
- package/src/views/AuditView.vue +57 -0
- package/src/views/CollectionView.vue +103 -0
- package/src/views/CustomPageView.vue +53 -0
- package/src/views/DashboardView.vue +91 -0
- package/src/views/DocumentHistoryView.vue +158 -0
- package/src/views/DocumentView.vue +173 -0
- package/src/views/GlobalHistoryView.vue +136 -0
- package/src/views/GlobalView.vue +115 -0
- package/src/views/LoginView.vue +41 -0
- package/src/views/NoAccessView.vue +34 -0
- package/src/views/NotFoundView.vue +27 -0
- package/src/views/RoleView.vue +93 -0
- package/src/views/RolesView.vue +66 -0
- package/src/views/UserView.vue +68 -0
- package/src/views/UsersView.vue +59 -0
- package/src/views/dashboard/CollectionCard.vue +21 -0
- package/src/views/dashboard/DashboardCardTitle.vue +18 -0
- package/src/views/dashboard/DashboardWidgets.vue +35 -0
- package/src/views/dashboard/GlobalCard.vue +24 -0
- package/src/views/login/LoginForm.vue +93 -0
- package/src/views/login/login-errors.ts +42 -0
- package/tsconfig.components.json +26 -0
- package/vite/koda-admin.ts +274 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { CircleCheck, CircleX, Info, TriangleAlert, X } from '@lucide/vue';
|
|
3
|
+
import type { Component } from 'vue';
|
|
4
|
+
import { closeButtonClasses } from './control-classes.js';
|
|
5
|
+
import { cx } from './cx.js';
|
|
6
|
+
|
|
7
|
+
/** Penpot: Alert — Info / Success / Warning / Danger: заголовок, описание, необязательный крестик. */
|
|
8
|
+
export type AlertTone = 'info' | 'success' | 'warning' | 'danger';
|
|
9
|
+
|
|
10
|
+
const props = withDefaults(
|
|
11
|
+
defineProps<{
|
|
12
|
+
tone?: AlertTone;
|
|
13
|
+
title: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
dismissible?: boolean;
|
|
16
|
+
}>(),
|
|
17
|
+
{
|
|
18
|
+
tone: 'info',
|
|
19
|
+
dismissible: false,
|
|
20
|
+
},
|
|
21
|
+
);
|
|
22
|
+
defineEmits<{ dismiss: [] }>();
|
|
23
|
+
|
|
24
|
+
const TONES: Record<
|
|
25
|
+
AlertTone,
|
|
26
|
+
{ box: string; icon: Component; iconClass: string }
|
|
27
|
+
> = {
|
|
28
|
+
info: {
|
|
29
|
+
box: 'border-info-border bg-info-subtle',
|
|
30
|
+
icon: Info,
|
|
31
|
+
iconClass: 'text-info-text',
|
|
32
|
+
},
|
|
33
|
+
success: {
|
|
34
|
+
box: 'border-success-border bg-success-subtle',
|
|
35
|
+
icon: CircleCheck,
|
|
36
|
+
iconClass: 'text-success-text',
|
|
37
|
+
},
|
|
38
|
+
warning: {
|
|
39
|
+
box: 'border-warning-border bg-warning-subtle',
|
|
40
|
+
icon: TriangleAlert,
|
|
41
|
+
iconClass: 'text-warning-text',
|
|
42
|
+
},
|
|
43
|
+
danger: {
|
|
44
|
+
box: 'border-danger-border bg-danger-subtle',
|
|
45
|
+
icon: CircleX,
|
|
46
|
+
iconClass: 'text-danger-text',
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<div
|
|
53
|
+
:role="
|
|
54
|
+
props.tone === 'danger' || props.tone === 'warning' ? 'alert' : 'status'
|
|
55
|
+
"
|
|
56
|
+
:class="cx('flex gap-3 rounded-lg border px-4 py-3', TONES[tone].box)"
|
|
57
|
+
>
|
|
58
|
+
<component
|
|
59
|
+
:is="TONES[tone].icon"
|
|
60
|
+
:size="16"
|
|
61
|
+
:class="['mt-0.5 shrink-0', TONES[tone].iconClass]"
|
|
62
|
+
aria-hidden="true"
|
|
63
|
+
/>
|
|
64
|
+
<div class="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
65
|
+
<p class="typo-body-strong text-fg-default">{{ title }}</p>
|
|
66
|
+
<p v-if="description || $slots.default" class="typo-body text-fg-muted">
|
|
67
|
+
<slot>{{ description }}</slot>
|
|
68
|
+
</p>
|
|
69
|
+
</div>
|
|
70
|
+
<button
|
|
71
|
+
v-if="dismissible"
|
|
72
|
+
type="button"
|
|
73
|
+
:class="closeButtonClasses"
|
|
74
|
+
aria-label="Закрыть"
|
|
75
|
+
@click="$emit('dismiss')"
|
|
76
|
+
>
|
|
77
|
+
<X :size="16" aria-hidden="true" />
|
|
78
|
+
</button>
|
|
79
|
+
</div>
|
|
80
|
+
</template>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { User } from '@lucide/vue';
|
|
3
|
+
import { computed } from 'vue';
|
|
4
|
+
import { cx } from './cx.js';
|
|
5
|
+
|
|
6
|
+
/** Penpot: Avatar — sm 24 / md 32 / lg 40 × Initials / Icon. */
|
|
7
|
+
const props = withDefaults(
|
|
8
|
+
defineProps<{ name?: string; size?: 'sm' | 'md' | 'lg' }>(),
|
|
9
|
+
{ size: 'md' },
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const initials = computed(() =>
|
|
13
|
+
(props.name ?? '')
|
|
14
|
+
.split(/\s+/)
|
|
15
|
+
.filter(Boolean)
|
|
16
|
+
.slice(0, 2)
|
|
17
|
+
.map((part) => part[0]!.toUpperCase())
|
|
18
|
+
.join(''),
|
|
19
|
+
);
|
|
20
|
+
const SIZES = {
|
|
21
|
+
sm: 'size-6 typo-label-sm',
|
|
22
|
+
md: 'size-8 typo-label-sm',
|
|
23
|
+
lg: 'size-10 typo-label',
|
|
24
|
+
};
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<span
|
|
29
|
+
:class="
|
|
30
|
+
cx(
|
|
31
|
+
'inline-flex shrink-0 items-center justify-center rounded-full',
|
|
32
|
+
SIZES[size],
|
|
33
|
+
initials
|
|
34
|
+
? 'bg-accent-subtle text-accent-text'
|
|
35
|
+
: 'bg-bg-muted text-fg-muted',
|
|
36
|
+
)
|
|
37
|
+
"
|
|
38
|
+
aria-hidden="true"
|
|
39
|
+
>
|
|
40
|
+
<template v-if="initials">{{ initials }}</template>
|
|
41
|
+
<User v-else :size="16" />
|
|
42
|
+
</span>
|
|
43
|
+
</template>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import { cx } from './cx.js';
|
|
4
|
+
|
|
5
|
+
/** Penpot: Badge — Tone × Style (Subtle/Solid), точка слева (по умолчанию скрыта, как в Penpot). */
|
|
6
|
+
export type BadgeTone =
|
|
7
|
+
'neutral' | 'accent' | 'success' | 'warning' | 'danger' | 'info';
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(
|
|
10
|
+
defineProps<{
|
|
11
|
+
tone?: BadgeTone;
|
|
12
|
+
variant?: 'subtle' | 'solid';
|
|
13
|
+
dot?: boolean;
|
|
14
|
+
}>(),
|
|
15
|
+
{
|
|
16
|
+
tone: 'neutral',
|
|
17
|
+
variant: 'subtle',
|
|
18
|
+
dot: false,
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const SUBTLE: Record<BadgeTone, string> = {
|
|
23
|
+
neutral: 'border border-border-default bg-bg-subtle text-fg-muted',
|
|
24
|
+
accent: 'border border-accent-border bg-accent-subtle text-accent-text',
|
|
25
|
+
success: 'border border-success-border bg-success-subtle text-success-text',
|
|
26
|
+
warning: 'border border-warning-border bg-warning-subtle text-warning-text',
|
|
27
|
+
danger: 'border border-danger-border bg-danger-subtle text-danger-text',
|
|
28
|
+
info: 'border border-info-border bg-info-subtle text-info-text',
|
|
29
|
+
};
|
|
30
|
+
const SOLID: Record<BadgeTone, string> = {
|
|
31
|
+
neutral: 'bg-bg-inverse text-fg-inverse',
|
|
32
|
+
accent: 'bg-accent-solid text-fg-on-solid',
|
|
33
|
+
success: 'bg-success-solid text-fg-on-solid',
|
|
34
|
+
warning: 'bg-warning-solid text-warning-on-solid',
|
|
35
|
+
danger: 'bg-danger-solid text-fg-on-solid',
|
|
36
|
+
info: 'bg-info-solid text-fg-on-solid',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const classes = computed(() =>
|
|
40
|
+
cx(
|
|
41
|
+
'inline-flex h-5 items-center gap-1.5 rounded-full px-2 typo-label-sm whitespace-nowrap',
|
|
42
|
+
(props.variant === 'solid' ? SOLID : SUBTLE)[props.tone],
|
|
43
|
+
),
|
|
44
|
+
);
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<template>
|
|
48
|
+
<span :class="classes">
|
|
49
|
+
<span
|
|
50
|
+
v-if="dot"
|
|
51
|
+
class="size-1.5 shrink-0 rounded-full bg-current"
|
|
52
|
+
aria-hidden="true"
|
|
53
|
+
/>
|
|
54
|
+
<slot />
|
|
55
|
+
</span>
|
|
56
|
+
</template>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ChevronRight } from '@lucide/vue';
|
|
3
|
+
import { RouterLink, type RouteLocationRaw } from 'vue-router';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Penpot: Breadcrumbs — Crumb State Link/Hover/Focus/Current. Внутренний компонент
|
|
7
|
+
* (верхняя панель админки), в публичный API @kodacms/admin/ui не входит.
|
|
8
|
+
* Link — text.body fg.muted, Hover — fg.default, Focus — shadow.focus radius.sm;
|
|
9
|
+
* Current (последнее звено) — text.body-strong fg.default, не ссылка, aria-current="page".
|
|
10
|
+
* Разделитель — ChevronRight 16 fg.subtle, aria-hidden; gap 8. Длинные звенья обрезаются
|
|
11
|
+
* многоточием (truncate): полный текст остаётся в доступном имени ссылки.
|
|
12
|
+
* a11y: <nav aria-label> + <ol>, звено без `to` — просто текст.
|
|
13
|
+
*/
|
|
14
|
+
export type BreadcrumbItem = { label: string; to?: RouteLocationRaw };
|
|
15
|
+
|
|
16
|
+
defineProps<{ items: BreadcrumbItem[] }>();
|
|
17
|
+
|
|
18
|
+
const CRUMB = 'block max-w-60 truncate';
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<nav aria-label="Навигационная цепочка" class="min-w-0">
|
|
23
|
+
<ol class="flex min-w-0 items-center gap-2">
|
|
24
|
+
<li
|
|
25
|
+
v-for="(item, index) in items"
|
|
26
|
+
:key="index"
|
|
27
|
+
class="flex min-w-0 items-center gap-2"
|
|
28
|
+
>
|
|
29
|
+
<ChevronRight
|
|
30
|
+
v-if="index > 0"
|
|
31
|
+
:size="16"
|
|
32
|
+
class="shrink-0 text-fg-subtle"
|
|
33
|
+
aria-hidden="true"
|
|
34
|
+
/>
|
|
35
|
+
<span
|
|
36
|
+
v-if="index === items.length - 1"
|
|
37
|
+
aria-current="page"
|
|
38
|
+
:class="[CRUMB, 'typo-body-strong text-fg-default']"
|
|
39
|
+
>{{ item.label }}</span
|
|
40
|
+
>
|
|
41
|
+
<RouterLink
|
|
42
|
+
v-else-if="item.to"
|
|
43
|
+
:to="item.to"
|
|
44
|
+
:class="[
|
|
45
|
+
CRUMB,
|
|
46
|
+
'rounded-sm typo-body text-fg-muted outline-none transition duration-(--duration-fast) hover:text-fg-default focus-visible:shadow-focus',
|
|
47
|
+
]"
|
|
48
|
+
>{{ item.label }}</RouterLink
|
|
49
|
+
>
|
|
50
|
+
<span v-else :class="[CRUMB, 'typo-body text-fg-muted']">{{
|
|
51
|
+
item.label
|
|
52
|
+
}}</span>
|
|
53
|
+
</li>
|
|
54
|
+
</ol>
|
|
55
|
+
</nav>
|
|
56
|
+
</template>
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, useAttrs } from 'vue';
|
|
3
|
+
import { cx } from './cx.js';
|
|
4
|
+
import KSpinner from './KSpinner.vue';
|
|
5
|
+
import KTooltip from './KTooltip.vue';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Penpot: Button — Variant Primary/Secondary/Ghost/Danger × Size md/sm × State
|
|
9
|
+
* (Default/Hover/Focus/Disabled/Loading). Иконки — в слоты leading/trailing.
|
|
10
|
+
* iconOnly с aria-label — подпись видна и зрячим: KTooltip по наведению и фокусу.
|
|
11
|
+
* Атрибуты ($attrs) всегда на `<button>`, а не на обёртке подсказки: KButton бывает
|
|
12
|
+
* триггером Reka (`as-child` у DropdownMenuTrigger, DialogTrigger) — aria-*, id,
|
|
13
|
+
* обработчики и ref должны попасть на саму кнопку.
|
|
14
|
+
*/
|
|
15
|
+
defineOptions({ inheritAttrs: false });
|
|
16
|
+
|
|
17
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
|
|
18
|
+
export type ButtonSize = 'md' | 'sm';
|
|
19
|
+
|
|
20
|
+
const props = withDefaults(
|
|
21
|
+
defineProps<{
|
|
22
|
+
variant?: ButtonVariant;
|
|
23
|
+
size?: ButtonSize;
|
|
24
|
+
type?: 'button' | 'submit' | 'reset';
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
/** Кнопка только с иконкой: квадратная, подпись обязательна для скринридера. */
|
|
28
|
+
iconOnly?: boolean;
|
|
29
|
+
}>(),
|
|
30
|
+
{
|
|
31
|
+
variant: 'primary',
|
|
32
|
+
size: 'md',
|
|
33
|
+
type: 'button',
|
|
34
|
+
disabled: false,
|
|
35
|
+
loading: false,
|
|
36
|
+
iconOnly: false,
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const attrs = useAttrs();
|
|
41
|
+
|
|
42
|
+
/** Текст подсказки: только у iconOnly и только из aria-label (новых пропсов нет). */
|
|
43
|
+
const tooltip = computed(() => {
|
|
44
|
+
const label = attrs['aria-label'];
|
|
45
|
+
return props.iconOnly && typeof label === 'string' && label.trim()
|
|
46
|
+
? label
|
|
47
|
+
: undefined;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Атрибуты кнопки с подсказкой: без `title` — иначе поверх KTooltip всплывёт вторая,
|
|
52
|
+
* нативная подсказка (часто с другим текстом). Функция, а не computed: $attrs не реактивны,
|
|
53
|
+
* а шаблон пересчитывает её при каждой отрисовке.
|
|
54
|
+
*/
|
|
55
|
+
function withoutTitle(all: Record<string, unknown>): Record<string, unknown> {
|
|
56
|
+
const { title: _title, ...rest } = all;
|
|
57
|
+
return rest;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
* active: — только у вариантов с токеном нажатия (accent.solid-active, bg.pressed).
|
|
62
|
+
* У danger его нет: в Penpot у Button нет состояния Active, а токена danger.solid-active
|
|
63
|
+
* в наборе нет — новый не придумываем, нажатие danger выглядит как hover.
|
|
64
|
+
*/
|
|
65
|
+
const VARIANTS: Record<ButtonVariant, string> = {
|
|
66
|
+
primary:
|
|
67
|
+
'bg-accent-solid text-fg-on-solid hover:bg-accent-solid-hover active:bg-accent-solid-active focus-visible:shadow-focus',
|
|
68
|
+
secondary:
|
|
69
|
+
'border border-border-strong bg-bg-surface text-fg-default shadow-sm hover:bg-bg-hover active:bg-bg-pressed focus-visible:shadow-focus',
|
|
70
|
+
ghost:
|
|
71
|
+
'text-fg-default hover:bg-bg-hover active:bg-bg-pressed focus-visible:bg-bg-surface focus-visible:shadow-focus',
|
|
72
|
+
danger:
|
|
73
|
+
'bg-danger-solid text-fg-on-solid hover:bg-danger-solid-hover focus-visible:shadow-focus-danger',
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const DISABLED: Record<ButtonVariant, string> = {
|
|
77
|
+
primary: 'bg-bg-muted text-fg-disabled',
|
|
78
|
+
secondary: 'border border-border-disabled bg-bg-subtle text-fg-disabled',
|
|
79
|
+
ghost: 'text-fg-disabled',
|
|
80
|
+
danger: 'bg-bg-muted text-fg-disabled',
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const SIZES: Record<ButtonSize, string> = {
|
|
84
|
+
md: 'h-(--size-control-md) px-4',
|
|
85
|
+
sm: 'h-(--size-control-sm) px-3',
|
|
86
|
+
};
|
|
87
|
+
const ICON_ONLY: Record<ButtonSize, string> = {
|
|
88
|
+
md: 'size-(--size-control-md)',
|
|
89
|
+
sm: 'size-(--size-control-sm)',
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const classes = computed(() =>
|
|
93
|
+
cx(
|
|
94
|
+
'inline-flex shrink-0 items-center justify-center gap-2 rounded-md typo-label whitespace-nowrap outline-none transition duration-(--duration-fast) select-none',
|
|
95
|
+
props.iconOnly ? ICON_ONLY[props.size] : SIZES[props.size],
|
|
96
|
+
props.disabled
|
|
97
|
+
? cx(DISABLED[props.variant], 'cursor-not-allowed')
|
|
98
|
+
: VARIANTS[props.variant],
|
|
99
|
+
props.loading && 'cursor-progress',
|
|
100
|
+
),
|
|
101
|
+
);
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<template>
|
|
105
|
+
<KTooltip v-if="tooltip" :content="tooltip">
|
|
106
|
+
<button
|
|
107
|
+
:type="type"
|
|
108
|
+
:class="classes"
|
|
109
|
+
:disabled="disabled"
|
|
110
|
+
:aria-disabled="loading || undefined"
|
|
111
|
+
:aria-busy="loading || undefined"
|
|
112
|
+
v-bind="withoutTitle($attrs)"
|
|
113
|
+
@click="loading && $event.preventDefault()"
|
|
114
|
+
>
|
|
115
|
+
<KSpinner v-if="loading" />
|
|
116
|
+
<slot v-else name="leading" />
|
|
117
|
+
<slot />
|
|
118
|
+
<slot name="trailing" />
|
|
119
|
+
</button>
|
|
120
|
+
</KTooltip>
|
|
121
|
+
<button
|
|
122
|
+
v-else
|
|
123
|
+
:type="type"
|
|
124
|
+
:class="classes"
|
|
125
|
+
:disabled="disabled"
|
|
126
|
+
:aria-disabled="loading || undefined"
|
|
127
|
+
:aria-busy="loading || undefined"
|
|
128
|
+
v-bind="$attrs"
|
|
129
|
+
@click="loading && $event.preventDefault()"
|
|
130
|
+
>
|
|
131
|
+
<KSpinner v-if="loading" />
|
|
132
|
+
<slot v-else name="leading" />
|
|
133
|
+
<slot />
|
|
134
|
+
<slot name="trailing" />
|
|
135
|
+
</button>
|
|
136
|
+
</template>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { DateValue } from '@internationalized/date';
|
|
3
|
+
import { ChevronLeft, ChevronRight } from '@lucide/vue';
|
|
4
|
+
import {
|
|
5
|
+
CalendarCell,
|
|
6
|
+
CalendarCellTrigger,
|
|
7
|
+
CalendarGrid,
|
|
8
|
+
CalendarGridBody,
|
|
9
|
+
CalendarGridHead,
|
|
10
|
+
CalendarGridRow,
|
|
11
|
+
CalendarHeadCell,
|
|
12
|
+
CalendarHeader,
|
|
13
|
+
CalendarHeading,
|
|
14
|
+
CalendarNext,
|
|
15
|
+
CalendarPrev,
|
|
16
|
+
CalendarRoot,
|
|
17
|
+
} from 'reka-ui';
|
|
18
|
+
import { UI_LOCALE } from '../format.js';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Penpot: Calendar / Panel + Calendar Day (Default / Hover / Today / Selected / Outside / Disabled / Focus).
|
|
22
|
+
* Reka UI Calendar: стрелки, PageUp/PageDown — месяцы, неделя с понедельника.
|
|
23
|
+
*/
|
|
24
|
+
const model = defineModel<DateValue | undefined>();
|
|
25
|
+
const NAV =
|
|
26
|
+
'flex size-8 items-center justify-center rounded-md text-fg-default outline-none transition duration-(--duration-fast) hover:bg-bg-hover focus-visible:shadow-focus';
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<CalendarRoot
|
|
31
|
+
v-slot="{ weekDays, grid }"
|
|
32
|
+
v-model="model"
|
|
33
|
+
:locale="UI_LOCALE"
|
|
34
|
+
:week-starts-on="1"
|
|
35
|
+
weekday-format="short"
|
|
36
|
+
fixed-weeks
|
|
37
|
+
class="flex flex-col gap-2"
|
|
38
|
+
>
|
|
39
|
+
<CalendarHeader class="flex h-9 items-center justify-between">
|
|
40
|
+
<CalendarPrev :class="NAV" aria-label="Предыдущий месяц"
|
|
41
|
+
><ChevronLeft :size="16" aria-hidden="true"
|
|
42
|
+
/></CalendarPrev>
|
|
43
|
+
<CalendarHeading
|
|
44
|
+
class="typo-label text-fg-default first-letter:uppercase"
|
|
45
|
+
/>
|
|
46
|
+
<CalendarNext :class="NAV" aria-label="Следующий месяц"
|
|
47
|
+
><ChevronRight :size="16" aria-hidden="true"
|
|
48
|
+
/></CalendarNext>
|
|
49
|
+
</CalendarHeader>
|
|
50
|
+
<CalendarGrid
|
|
51
|
+
v-for="month in grid"
|
|
52
|
+
:key="month.value.toString()"
|
|
53
|
+
class="w-full border-collapse"
|
|
54
|
+
>
|
|
55
|
+
<CalendarGridHead>
|
|
56
|
+
<CalendarGridRow class="flex">
|
|
57
|
+
<CalendarHeadCell
|
|
58
|
+
v-for="day in weekDays"
|
|
59
|
+
:key="day"
|
|
60
|
+
class="flex h-7 w-9 items-center justify-center typo-caption text-fg-subtle capitalize"
|
|
61
|
+
>
|
|
62
|
+
{{ day }}
|
|
63
|
+
</CalendarHeadCell>
|
|
64
|
+
</CalendarGridRow>
|
|
65
|
+
</CalendarGridHead>
|
|
66
|
+
<CalendarGridBody class="flex flex-col gap-0.5">
|
|
67
|
+
<CalendarGridRow v-for="(week, i) in month.rows" :key="i" class="flex">
|
|
68
|
+
<CalendarCell v-for="day in week" :key="day.toString()" :date="day">
|
|
69
|
+
<CalendarCellTrigger
|
|
70
|
+
:day="day"
|
|
71
|
+
:month="month.value"
|
|
72
|
+
class="flex size-9 items-center justify-center rounded-md typo-body text-fg-default outline-none transition duration-(--duration-fast) hover:bg-bg-hover focus-visible:bg-bg-surface focus-visible:shadow-focus data-outside-view:text-fg-subtle data-disabled:cursor-not-allowed data-disabled:text-fg-disabled data-disabled:hover:bg-transparent data-unavailable:cursor-not-allowed data-unavailable:text-fg-disabled data-unavailable:line-through data-unavailable:hover:bg-transparent data-today:border data-today:border-accent-border data-today:typo-label data-today:text-accent-text data-selected:border-0 data-selected:bg-accent-solid data-selected:typo-label data-selected:text-fg-on-solid"
|
|
73
|
+
/>
|
|
74
|
+
</CalendarCell>
|
|
75
|
+
</CalendarGridRow>
|
|
76
|
+
</CalendarGridBody>
|
|
77
|
+
</CalendarGrid>
|
|
78
|
+
</CalendarRoot>
|
|
79
|
+
</template>
|
package/src/ui/KCard.vue
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ChevronRight } from '@lucide/vue';
|
|
3
|
+
import { computed, useId, useSlots } from 'vue';
|
|
4
|
+
import { RouterLink, type RouteLocationRaw } from 'vue-router';
|
|
5
|
+
import { cx } from './cx.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Penpot: Card — Kind Static / Interactive × State Default / Hover / Focus. bg.surface,
|
|
9
|
+
* border.default, radius.lg, padding 20, gap 12; шапка — заголовок text.heading-3 и
|
|
10
|
+
* описание text.caption fg.muted, справа — действия (Static) или шеврон (Interactive).
|
|
11
|
+
*
|
|
12
|
+
* Interactive — задан `to` (RouterLink) или `href` (<a>): вся карточка — одна ссылка,
|
|
13
|
+
* Hover — border.strong + shadow.sm, Focus — shadow.focus. Слот actions у ссылки не
|
|
14
|
+
* рисуется: интерактивные элементы внутри <a> недопустимы (HTML и скринридеры).
|
|
15
|
+
* Static — <section> с aria-labelledby на заголовок (если он есть), иначе <div>.
|
|
16
|
+
*
|
|
17
|
+
* headingLevel по умолчанию 3: карточки обычно стоят сеткой внутри раздела страницы
|
|
18
|
+
* (h1 страницы → h2 раздела → h3 карточки); на дашборде без разделов — 2.
|
|
19
|
+
*
|
|
20
|
+
* a11y: имя ссылки — весь её текст (заголовок, описание, тело); шеврон aria-hidden;
|
|
21
|
+
* фокус — shadow-focus по focus-visible; переходы рамки/тени — duration-fast
|
|
22
|
+
* (reduced motion глушит их глобально).
|
|
23
|
+
*/
|
|
24
|
+
const props = withDefaults(
|
|
25
|
+
defineProps<{
|
|
26
|
+
title?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
to?: RouteLocationRaw;
|
|
29
|
+
href?: string;
|
|
30
|
+
headingLevel?: 2 | 3 | 4;
|
|
31
|
+
}>(),
|
|
32
|
+
{ headingLevel: 3 },
|
|
33
|
+
);
|
|
34
|
+
defineSlots<{
|
|
35
|
+
default?: () => unknown;
|
|
36
|
+
title?: () => unknown;
|
|
37
|
+
actions?: () => unknown;
|
|
38
|
+
}>();
|
|
39
|
+
const slots = useSlots();
|
|
40
|
+
|
|
41
|
+
const titleId = useId();
|
|
42
|
+
const interactive = computed(
|
|
43
|
+
() => props.to !== undefined || props.href !== undefined,
|
|
44
|
+
);
|
|
45
|
+
const hasTitle = computed(() => Boolean(props.title || slots.title));
|
|
46
|
+
const root = computed(() => {
|
|
47
|
+
if (props.to !== undefined) return RouterLink;
|
|
48
|
+
if (props.href !== undefined) return 'a';
|
|
49
|
+
return hasTitle.value ? 'section' : 'div';
|
|
50
|
+
});
|
|
51
|
+
const rootAttrs = computed(() => {
|
|
52
|
+
if (props.to !== undefined) return { to: props.to };
|
|
53
|
+
if (props.href !== undefined) return { href: props.href };
|
|
54
|
+
return hasTitle.value ? { 'aria-labelledby': titleId } : {};
|
|
55
|
+
});
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<template>
|
|
59
|
+
<component
|
|
60
|
+
:is="root"
|
|
61
|
+
v-bind="rootAttrs"
|
|
62
|
+
:class="
|
|
63
|
+
cx(
|
|
64
|
+
'flex flex-col gap-3 rounded-lg border border-border-default bg-bg-surface p-5',
|
|
65
|
+
interactive &&
|
|
66
|
+
'outline-none transition duration-(--duration-fast) hover:border-border-strong hover:shadow-sm focus-visible:shadow-focus',
|
|
67
|
+
)
|
|
68
|
+
"
|
|
69
|
+
>
|
|
70
|
+
<div
|
|
71
|
+
v-if="hasTitle || description || interactive || $slots.actions"
|
|
72
|
+
class="flex items-start gap-3"
|
|
73
|
+
>
|
|
74
|
+
<div class="flex min-w-0 flex-1 flex-col gap-1">
|
|
75
|
+
<component
|
|
76
|
+
:is="`h${headingLevel}`"
|
|
77
|
+
v-if="hasTitle"
|
|
78
|
+
:id="titleId"
|
|
79
|
+
class="typo-heading-3 text-fg-default"
|
|
80
|
+
>
|
|
81
|
+
<slot name="title">{{ title }}</slot>
|
|
82
|
+
</component>
|
|
83
|
+
<p v-if="description" class="typo-caption text-fg-muted">
|
|
84
|
+
{{ description }}
|
|
85
|
+
</p>
|
|
86
|
+
</div>
|
|
87
|
+
<ChevronRight
|
|
88
|
+
v-if="interactive"
|
|
89
|
+
:size="16"
|
|
90
|
+
class="mt-1 shrink-0 text-fg-subtle"
|
|
91
|
+
aria-hidden="true"
|
|
92
|
+
/>
|
|
93
|
+
<div v-else-if="$slots.actions" class="flex shrink-0 items-center gap-1">
|
|
94
|
+
<slot name="actions" />
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
<div
|
|
98
|
+
v-if="$slots.default"
|
|
99
|
+
:class="
|
|
100
|
+
cx('typo-body', interactive ? 'text-fg-muted' : 'text-fg-default')
|
|
101
|
+
"
|
|
102
|
+
>
|
|
103
|
+
<slot />
|
|
104
|
+
</div>
|
|
105
|
+
</component>
|
|
106
|
+
</template>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { CircleX, TriangleAlert } from '@lucide/vue';
|
|
3
|
+
import { cx } from './cx.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Penpot: Cell Message — сообщение под ячейкой KTable grid: bg.surface, radius.md, shadow.md,
|
|
7
|
+
* padding 8/12, gap 8. Tone danger — ошибка 400/409 по полю: рамка danger.border, CircleX и
|
|
8
|
+
* text.caption danger.text в одну строку. Tone warning — конфликт 412: рамка warning.border,
|
|
9
|
+
* заголовок (title, text.label) с TriangleAlert, текст text.caption fg.muted (ширина 256),
|
|
10
|
+
* кнопки sm в слоте actions («Обновить строку» Secondary / «Перезаписать» Ghost).
|
|
11
|
+
* Положение под ячейкой задаёт KTableCell (слот message).
|
|
12
|
+
*/
|
|
13
|
+
export type CellMessageTone = 'danger' | 'warning';
|
|
14
|
+
|
|
15
|
+
withDefaults(defineProps<{ tone?: CellMessageTone; title?: string }>(), {
|
|
16
|
+
tone: 'danger',
|
|
17
|
+
});
|
|
18
|
+
defineSlots<{ default?: () => unknown; actions?: () => unknown }>();
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<div
|
|
23
|
+
:class="
|
|
24
|
+
cx(
|
|
25
|
+
'flex flex-col gap-2 rounded-md border bg-bg-surface px-3 py-2 shadow-md',
|
|
26
|
+
tone === 'danger' ? 'border-danger-border' : 'border-warning-border',
|
|
27
|
+
)
|
|
28
|
+
"
|
|
29
|
+
>
|
|
30
|
+
<p
|
|
31
|
+
v-if="tone === 'danger'"
|
|
32
|
+
class="flex items-center gap-2 typo-caption text-danger-text"
|
|
33
|
+
>
|
|
34
|
+
<CircleX :size="16" class="shrink-0" aria-hidden="true" />
|
|
35
|
+
<slot />
|
|
36
|
+
</p>
|
|
37
|
+
<template v-else>
|
|
38
|
+
<p
|
|
39
|
+
v-if="title"
|
|
40
|
+
class="flex items-center gap-2 typo-label text-fg-default"
|
|
41
|
+
>
|
|
42
|
+
<TriangleAlert
|
|
43
|
+
:size="16"
|
|
44
|
+
class="shrink-0 text-warning-text"
|
|
45
|
+
aria-hidden="true"
|
|
46
|
+
/>
|
|
47
|
+
{{ title }}
|
|
48
|
+
</p>
|
|
49
|
+
<p v-if="$slots.default" class="w-64 typo-caption text-fg-muted">
|
|
50
|
+
<slot />
|
|
51
|
+
</p>
|
|
52
|
+
<div v-if="$slots.actions" class="flex items-center gap-2">
|
|
53
|
+
<slot name="actions" />
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
56
|
+
</div>
|
|
57
|
+
</template>
|