@byline/ui 2.5.1 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dnd/draggable-sortable/demo/draggable-list-demo.js +1 -1
- package/dist/react.d.ts +18 -54
- package/dist/react.js +0 -35
- package/dist/uikit.d.ts +1 -0
- package/dist/uikit.js +1 -0
- package/package.json +2 -8
- package/src/dnd/draggable-sortable/demo/draggable-list-demo.tsx +1 -1
- package/src/react.ts +20 -68
- package/src/uikit.ts +1 -0
- package/dist/admin/group.d.ts +0 -27
- package/dist/admin/group.js +0 -14
- package/dist/admin/group.module.js +0 -6
- package/dist/admin/group_module.css +0 -19
- package/dist/admin/row.d.ts +0 -25
- package/dist/admin/row.js +0 -8
- package/dist/admin/row.module.js +0 -5
- package/dist/admin/row_module.css +0 -18
- package/dist/admin/tabs.d.ts +0 -25
- package/dist/admin/tabs.js +0 -35
- package/dist/admin/tabs.module.js +0 -10
- package/dist/admin/tabs_module.css +0 -68
- package/dist/fields/array/array-field.d.ts +0 -14
- package/dist/fields/array/array-field.js +0 -176
- package/dist/fields/array/array-field.module.js +0 -11
- package/dist/fields/array/array-field_module.css +0 -32
- package/dist/fields/blocks/blocks-field.d.ts +0 -13
- package/dist/fields/blocks/blocks-field.js +0 -244
- package/dist/fields/blocks/blocks-field.module.js +0 -26
- package/dist/fields/blocks/blocks-field_module.css +0 -107
- package/dist/fields/checkbox/checkbox-field.d.ts +0 -16
- package/dist/fields/checkbox/checkbox-field.js +0 -28
- package/dist/fields/checkbox/checkbox-field.module.js +0 -6
- package/dist/fields/checkbox/checkbox-field_module.css +0 -4
- package/dist/fields/column-formatter.d.ts +0 -20
- package/dist/fields/column-formatter.js +0 -15
- package/dist/fields/date-time-formatter.d.ts +0 -16
- package/dist/fields/date-time-formatter.js +0 -8
- package/dist/fields/datetime/datetime-field.d.ts +0 -16
- package/dist/fields/datetime/datetime-field.js +0 -37
- package/dist/fields/datetime/datetime-field.module.js +0 -5
- package/dist/fields/datetime/datetime-field_module.css +0 -4
- package/dist/fields/draggable-context-menu.d.ts +0 -6
- package/dist/fields/draggable-context-menu.js +0 -83
- package/dist/fields/draggable-context-menu.module.js +0 -15
- package/dist/fields/draggable-context-menu_module.css +0 -91
- package/dist/fields/field-helpers.d.ts +0 -26
- package/dist/fields/field-helpers.js +0 -50
- package/dist/fields/field-renderer.d.ts +0 -37
- package/dist/fields/field-renderer.js +0 -206
- package/dist/fields/field-renderer.module.js +0 -8
- package/dist/fields/field-renderer_module.css +0 -11
- package/dist/fields/file/file-field.d.ts +0 -19
- package/dist/fields/file/file-field.js +0 -226
- package/dist/fields/file/file-field.module.js +0 -18
- package/dist/fields/file/file-field_module.css +0 -131
- package/dist/fields/file/file-upload-field.d.ts +0 -21
- package/dist/fields/file/file-upload-field.js +0 -128
- package/dist/fields/file/file-upload-field.module.js +0 -15
- package/dist/fields/file/file-upload-field_module.css +0 -74
- package/dist/fields/group/group-field.d.ts +0 -15
- package/dist/fields/group/group-field.js +0 -59
- package/dist/fields/group/group-field.module.js +0 -9
- package/dist/fields/group/group-field_module.css +0 -27
- package/dist/fields/image/image-field.d.ts +0 -19
- package/dist/fields/image/image-field.js +0 -242
- package/dist/fields/image/image-field.module.js +0 -22
- package/dist/fields/image/image-field_module.css +0 -121
- package/dist/fields/image/image-upload-field.d.ts +0 -21
- package/dist/fields/image/image-upload-field.js +0 -187
- package/dist/fields/image/image-upload-field.module.js +0 -19
- package/dist/fields/image/image-upload-field_module.css +0 -92
- package/dist/fields/local-date-time.d.ts +0 -27
- package/dist/fields/local-date-time.js +0 -49
- package/dist/fields/locale-badge.d.ts +0 -18
- package/dist/fields/locale-badge.js +0 -10
- package/dist/fields/locale-badge.module.js +0 -5
- package/dist/fields/locale-badge_module.css +0 -27
- package/dist/fields/numerical/numerical-field.d.ts +0 -18
- package/dist/fields/numerical/numerical-field.js +0 -74
- package/dist/fields/relation/relation-display.d.ts +0 -40
- package/dist/fields/relation/relation-display.js +0 -58
- package/dist/fields/relation/relation-display.module.js +0 -9
- package/dist/fields/relation/relation-display_module.css +0 -21
- package/dist/fields/relation/relation-field.d.ts +0 -18
- package/dist/fields/relation/relation-field.js +0 -146
- package/dist/fields/relation/relation-field.module.js +0 -13
- package/dist/fields/relation/relation-field_module.css +0 -62
- package/dist/fields/relation/relation-picker.d.ts +0 -49
- package/dist/fields/relation/relation-picker.js +0 -233
- package/dist/fields/relation/relation-picker.module.js +0 -26
- package/dist/fields/relation/relation-picker_module.css +0 -124
- package/dist/fields/relation/relation-summary.d.ts +0 -31
- package/dist/fields/relation/relation-summary.js +0 -50
- package/dist/fields/relation/relation-summary.module.js +0 -11
- package/dist/fields/relation/relation-summary_module.css +0 -37
- package/dist/fields/select/select-field.d.ts +0 -16
- package/dist/fields/select/select-field.js +0 -50
- package/dist/fields/select/select-field.module.js +0 -5
- package/dist/fields/select/select-field_module.css +0 -4
- package/dist/fields/sortable-item.d.ts +0 -15
- package/dist/fields/sortable-item.js +0 -80
- package/dist/fields/sortable-item.module.js +0 -22
- package/dist/fields/sortable-item_module.css +0 -124
- package/dist/fields/text/text-field.d.ts +0 -20
- package/dist/fields/text/text-field.js +0 -104
- package/dist/fields/text/text-field.module.js +0 -6
- package/dist/fields/text/text-field_module.css +0 -5
- package/dist/fields/text-area/text-area-field.d.ts +0 -20
- package/dist/fields/text-area/text-area-field.js +0 -105
- package/dist/fields/text-area/text-area-field.module.js +0 -6
- package/dist/fields/text-area/text-area-field_module.css +0 -5
- package/dist/fields/use-field-change-handler.d.ts +0 -23
- package/dist/fields/use-field-change-handler.js +0 -52
- package/dist/forms/document-actions.d.ts +0 -48
- package/dist/forms/document-actions.js +0 -469
- package/dist/forms/document-actions.module.js +0 -34
- package/dist/forms/document-actions_module.css +0 -118
- package/dist/forms/form-context.d.ts +0 -89
- package/dist/forms/form-context.js +0 -466
- package/dist/forms/form-renderer.d.ts +0 -98
- package/dist/forms/form-renderer.js +0 -591
- package/dist/forms/form-renderer.module.js +0 -46
- package/dist/forms/form-renderer_module.css +0 -245
- package/dist/forms/navigation-guard.d.ts +0 -54
- package/dist/forms/navigation-guard.js +0 -22
- package/dist/forms/path-widget.d.ts +0 -36
- package/dist/forms/path-widget.js +0 -107
- package/dist/forms/path-widget.module.js +0 -8
- package/dist/forms/path-widget_module.css +0 -29
- package/dist/forms/upload-executor.d.ts +0 -57
- package/dist/forms/upload-executor.js +0 -92
- package/dist/services/field-services-context.d.ts +0 -16
- package/dist/services/field-services-context.js +0 -13
- package/dist/services/field-services-types.d.ts +0 -63
- package/dist/services/field-services-types.js +0 -1
- package/dist/widgets/diff-viewer/diff-modal.d.ts +0 -22
- package/dist/widgets/diff-viewer/diff-modal.js +0 -146
- package/dist/widgets/diff-viewer/diff-modal.module.js +0 -14
- package/dist/widgets/diff-viewer/diff-modal_module.css +0 -56
- package/dist/widgets/status-badge/status-badge.d.ts +0 -25
- package/dist/widgets/status-badge/status-badge.js +0 -35
- package/dist/widgets/status-badge/status-badge.module.js +0 -7
- package/dist/widgets/status-badge/status-badge_module.css +0 -20
- package/src/admin/group.module.css +0 -41
- package/src/admin/group.tsx +0 -40
- package/src/admin/row.module.css +0 -32
- package/src/admin/row.tsx +0 -33
- package/src/admin/tabs.module.css +0 -107
- package/src/admin/tabs.tsx +0 -82
- package/src/fields/array/array-field.module.css +0 -48
- package/src/fields/array/array-field.tsx +0 -266
- package/src/fields/blocks/blocks-field.module.css +0 -148
- package/src/fields/blocks/blocks-field.tsx +0 -312
- package/src/fields/checkbox/checkbox-field.module.css +0 -4
- package/src/fields/checkbox/checkbox-field.tsx +0 -54
- package/src/fields/column-formatter.tsx +0 -31
- package/src/fields/date-time-formatter.tsx +0 -22
- package/src/fields/datetime/datetime-field.module.css +0 -13
- package/src/fields/datetime/datetime-field.tsx +0 -54
- package/src/fields/draggable-context-menu.module.css +0 -127
- package/src/fields/draggable-context-menu.tsx +0 -85
- package/src/fields/field-helpers.ts +0 -69
- package/src/fields/field-renderer.module.css +0 -22
- package/src/fields/field-renderer.tsx +0 -288
- package/src/fields/file/file-field.module.css +0 -153
- package/src/fields/file/file-field.tsx +0 -271
- package/src/fields/file/file-upload-field.module.css +0 -101
- package/src/fields/file/file-upload-field.tsx +0 -183
- package/src/fields/group/group-field.module.css +0 -43
- package/src/fields/group/group-field.tsx +0 -84
- package/src/fields/image/image-field.module.css +0 -155
- package/src/fields/image/image-field.tsx +0 -291
- package/src/fields/image/image-upload-field.module.css +0 -123
- package/src/fields/image/image-upload-field.tsx +0 -270
- package/src/fields/local-date-time.tsx +0 -88
- package/src/fields/locale-badge.module.css +0 -37
- package/src/fields/locale-badge.tsx +0 -32
- package/src/fields/numerical/numerical-field.tsx +0 -114
- package/src/fields/relation/relation-display.module.css +0 -36
- package/src/fields/relation/relation-display.tsx +0 -130
- package/src/fields/relation/relation-field.module.css +0 -83
- package/src/fields/relation/relation-field.tsx +0 -206
- package/src/fields/relation/relation-picker.module.css +0 -168
- package/src/fields/relation/relation-picker.tsx +0 -325
- package/src/fields/relation/relation-summary.module.css +0 -55
- package/src/fields/relation/relation-summary.tsx +0 -123
- package/src/fields/select/select-field.module.css +0 -13
- package/src/fields/select/select-field.tsx +0 -61
- package/src/fields/sortable-item.module.css +0 -167
- package/src/fields/sortable-item.tsx +0 -101
- package/src/fields/text/text-field.module.css +0 -13
- package/src/fields/text/text-field.tsx +0 -146
- package/src/fields/text-area/text-area-field.module.css +0 -13
- package/src/fields/text-area/text-area-field.tsx +0 -147
- package/src/fields/use-field-change-handler.ts +0 -112
- package/src/forms/document-actions.module.css +0 -160
- package/src/forms/document-actions.tsx +0 -487
- package/src/forms/form-context.tsx +0 -704
- package/src/forms/form-renderer.module.css +0 -321
- package/src/forms/form-renderer.tsx +0 -888
- package/src/forms/navigation-guard.tsx +0 -98
- package/src/forms/path-widget.module.css +0 -41
- package/src/forms/path-widget.test.tsx +0 -217
- package/src/forms/path-widget.tsx +0 -181
- package/src/forms/upload-executor.ts +0 -190
- package/src/services/field-services-context.tsx +0 -35
- package/src/services/field-services-types.ts +0 -68
- package/src/widgets/diff-viewer/diff-modal.module.css +0 -79
- package/src/widgets/diff-viewer/diff-modal.tsx +0 -184
- package/src/widgets/status-badge/status-badge.module.css +0 -31
- package/src/widgets/status-badge/status-badge.tsx +0 -69
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Infonomic Company Limited
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Framework-neutral function contracts that field/form components in
|
|
10
|
-
* `@byline/ui` need from the host application. The host wires concrete
|
|
11
|
-
* implementations via `BylineFieldServicesProvider` — typically thin
|
|
12
|
-
* adapters around TanStack Start server functions, Next.js server
|
|
13
|
-
* actions, or any other RPC-style transport.
|
|
14
|
-
*/
|
|
15
|
-
import type { StoredFileValue } from '@byline/core';
|
|
16
|
-
export interface CollectionListParams {
|
|
17
|
-
page?: number;
|
|
18
|
-
page_size?: number;
|
|
19
|
-
order?: string;
|
|
20
|
-
desc?: boolean;
|
|
21
|
-
query?: string;
|
|
22
|
-
locale?: string;
|
|
23
|
-
status?: string;
|
|
24
|
-
fields?: string[];
|
|
25
|
-
}
|
|
26
|
-
export interface CollectionListDoc {
|
|
27
|
-
id: string;
|
|
28
|
-
path?: string;
|
|
29
|
-
[field: string]: unknown;
|
|
30
|
-
}
|
|
31
|
-
export interface CollectionListResponse {
|
|
32
|
-
docs: CollectionListDoc[];
|
|
33
|
-
meta: {
|
|
34
|
-
totalPages?: number;
|
|
35
|
-
[k: string]: unknown;
|
|
36
|
-
};
|
|
37
|
-
included: {
|
|
38
|
-
collection: {
|
|
39
|
-
id: string;
|
|
40
|
-
[k: string]: unknown;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
export type GetCollectionDocumentsFn = (input: {
|
|
45
|
-
collection: string;
|
|
46
|
-
params: CollectionListParams;
|
|
47
|
-
}) => Promise<CollectionListResponse>;
|
|
48
|
-
export interface UploadedFileResult {
|
|
49
|
-
documentId?: string;
|
|
50
|
-
documentVersionId?: string;
|
|
51
|
-
/**
|
|
52
|
-
* The persisted file value, including the `variants` array with
|
|
53
|
-
* `storagePath`, `storageUrl`, `width`, `height`, and `format` for each
|
|
54
|
-
* generated derivative. Single source of truth — the legacy top-level
|
|
55
|
-
* `variants: { name, url }[]` is gone.
|
|
56
|
-
*/
|
|
57
|
-
storedFile: StoredFileValue;
|
|
58
|
-
}
|
|
59
|
-
export type UploadFieldFn = (collection: string, formData: FormData, createDocument?: boolean) => Promise<UploadedFileResult>;
|
|
60
|
-
export interface BylineFieldServices {
|
|
61
|
-
getCollectionDocuments: GetCollectionDocumentsFn;
|
|
62
|
-
uploadField: UploadFieldFn;
|
|
63
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export interface DiffModalProps {
|
|
2
|
-
isOpen: boolean;
|
|
3
|
-
onDismiss: () => void;
|
|
4
|
-
collection: string;
|
|
5
|
-
documentId: string;
|
|
6
|
-
/** The `versionId` of the historical version to compare. */
|
|
7
|
-
versionId: string;
|
|
8
|
-
/** A human-readable label for the historical version (e.g. a date string). */
|
|
9
|
-
versionLabel: string;
|
|
10
|
-
/** The already-loaded current (latest) version of the document. */
|
|
11
|
-
currentDocument: Record<string, unknown>;
|
|
12
|
-
/** Content locale to compare — undefined / 'all' shows all locales. */
|
|
13
|
-
locale?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Host-provided loader for a historical document version. The diff
|
|
16
|
-
* modal is framework-neutral; callers wire this to whatever transport
|
|
17
|
-
* they use (e.g. `BylineAdminServices.getCollectionDocumentVersion` in
|
|
18
|
-
* the admin shell).
|
|
19
|
-
*/
|
|
20
|
-
loadHistoricalVersion: (collection: string, documentId: string, versionId: string, locale: string | undefined) => Promise<Record<string, unknown>>;
|
|
21
|
-
}
|
|
22
|
-
export declare function DiffModal({ isOpen, onDismiss, collection, documentId, versionId, versionLabel, currentDocument, locale, loadHistoricalVersion, }: DiffModalProps): import("react").JSX.Element;
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import classnames from "classnames";
|
|
5
|
-
import react_diff_viewer_continued, { DiffMethod } from "react-diff-viewer-continued";
|
|
6
|
-
import { CloseIcon, IconButton, LoaderRing, Modal } from "../../uikit.js";
|
|
7
|
-
import diff_modal_module from "./diff-modal.module.js";
|
|
8
|
-
const STRIP_KEYS = new Set([
|
|
9
|
-
'id',
|
|
10
|
-
'versionId',
|
|
11
|
-
'path',
|
|
12
|
-
'status',
|
|
13
|
-
'createdAt',
|
|
14
|
-
'updatedAt',
|
|
15
|
-
'hasPublishedVersion',
|
|
16
|
-
'_publishedVersion'
|
|
17
|
-
]);
|
|
18
|
-
function stripMeta(doc) {
|
|
19
|
-
if (doc.fields && 'object' == typeof doc.fields) return doc.fields;
|
|
20
|
-
return Object.fromEntries(Object.entries(doc).filter(([k])=>!STRIP_KEYS.has(k)));
|
|
21
|
-
}
|
|
22
|
-
function DiffModal({ isOpen, onDismiss, collection, documentId, versionId, versionLabel, currentDocument, locale, loadHistoricalVersion }) {
|
|
23
|
-
const [historicalDoc, setHistoricalDoc] = useState(null);
|
|
24
|
-
const [loading, setLoading] = useState(false);
|
|
25
|
-
const [error, setError] = useState(null);
|
|
26
|
-
useEffect(()=>{
|
|
27
|
-
if (!isOpen || !versionId) return;
|
|
28
|
-
let cancelled = false;
|
|
29
|
-
setLoading(true);
|
|
30
|
-
setError(null);
|
|
31
|
-
setHistoricalDoc(null);
|
|
32
|
-
loadHistoricalVersion(collection, documentId, versionId, locale).then((doc)=>{
|
|
33
|
-
if (cancelled) return;
|
|
34
|
-
setHistoricalDoc(doc);
|
|
35
|
-
}).catch((err)=>{
|
|
36
|
-
if (cancelled) return;
|
|
37
|
-
setError(err instanceof Error ? err.message : 'Failed to load version');
|
|
38
|
-
}).finally(()=>{
|
|
39
|
-
if (!cancelled) setLoading(false);
|
|
40
|
-
});
|
|
41
|
-
return ()=>{
|
|
42
|
-
cancelled = true;
|
|
43
|
-
};
|
|
44
|
-
}, [
|
|
45
|
-
isOpen,
|
|
46
|
-
collection,
|
|
47
|
-
documentId,
|
|
48
|
-
versionId,
|
|
49
|
-
locale,
|
|
50
|
-
loadHistoricalVersion
|
|
51
|
-
]);
|
|
52
|
-
const currentStr = currentDocument ? JSON.stringify(stripMeta(currentDocument), null, 2) : '';
|
|
53
|
-
const historicalStr = historicalDoc ? JSON.stringify(stripMeta(historicalDoc), null, 2) : '';
|
|
54
|
-
return /*#__PURE__*/ jsx(Modal, {
|
|
55
|
-
isOpen: isOpen,
|
|
56
|
-
closeOnOverlayClick: true,
|
|
57
|
-
onDismiss: onDismiss,
|
|
58
|
-
children: /*#__PURE__*/ jsxs(Modal.Container, {
|
|
59
|
-
style: {
|
|
60
|
-
width: '96vw',
|
|
61
|
-
maxWidth: '96vw',
|
|
62
|
-
height: '90vh',
|
|
63
|
-
maxHeight: '90vh',
|
|
64
|
-
display: 'flex',
|
|
65
|
-
flexDirection: 'column',
|
|
66
|
-
overflow: 'hidden'
|
|
67
|
-
},
|
|
68
|
-
children: [
|
|
69
|
-
/*#__PURE__*/ jsxs(Modal.Header, {
|
|
70
|
-
className: classnames('byline-diff-modal-header', diff_modal_module.header),
|
|
71
|
-
children: [
|
|
72
|
-
/*#__PURE__*/ jsxs("div", {
|
|
73
|
-
className: classnames('byline-diff-modal-title-stack', diff_modal_module["title-stack"]),
|
|
74
|
-
children: [
|
|
75
|
-
/*#__PURE__*/ jsx("h3", {
|
|
76
|
-
className: classnames('byline-diff-modal-title', diff_modal_module.title),
|
|
77
|
-
children: "Version Comparison"
|
|
78
|
-
}),
|
|
79
|
-
/*#__PURE__*/ jsxs("p", {
|
|
80
|
-
className: classnames('byline-diff-modal-subtitle', diff_modal_module.subtitle),
|
|
81
|
-
children: [
|
|
82
|
-
"Comparing",
|
|
83
|
-
' ',
|
|
84
|
-
/*#__PURE__*/ jsx("span", {
|
|
85
|
-
className: classnames('byline-diff-modal-version', diff_modal_module.version),
|
|
86
|
-
children: versionLabel
|
|
87
|
-
}),
|
|
88
|
-
' ',
|
|
89
|
-
"(left) against current version (right)"
|
|
90
|
-
]
|
|
91
|
-
})
|
|
92
|
-
]
|
|
93
|
-
}),
|
|
94
|
-
/*#__PURE__*/ jsx(IconButton, {
|
|
95
|
-
onClick: onDismiss,
|
|
96
|
-
size: "xs",
|
|
97
|
-
"aria-label": "Close comparison",
|
|
98
|
-
children: /*#__PURE__*/ jsx(CloseIcon, {
|
|
99
|
-
width: "15px",
|
|
100
|
-
height: "15px"
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
]
|
|
104
|
-
}),
|
|
105
|
-
/*#__PURE__*/ jsxs(Modal.Content, {
|
|
106
|
-
className: classnames('byline-diff-modal-content', diff_modal_module.content),
|
|
107
|
-
style: {
|
|
108
|
-
minHeight: 0
|
|
109
|
-
},
|
|
110
|
-
children: [
|
|
111
|
-
loading && /*#__PURE__*/ jsxs("div", {
|
|
112
|
-
className: classnames('byline-diff-modal-state', diff_modal_module.state),
|
|
113
|
-
children: [
|
|
114
|
-
/*#__PURE__*/ jsx(LoaderRing, {
|
|
115
|
-
size: 28,
|
|
116
|
-
color: "#666666"
|
|
117
|
-
}),
|
|
118
|
-
/*#__PURE__*/ jsx("span", {
|
|
119
|
-
children: "Loading version…"
|
|
120
|
-
})
|
|
121
|
-
]
|
|
122
|
-
}),
|
|
123
|
-
error && /*#__PURE__*/ jsx("div", {
|
|
124
|
-
className: classnames('byline-diff-modal-state', 'byline-diff-modal-error', diff_modal_module.state, diff_modal_module.error),
|
|
125
|
-
children: error
|
|
126
|
-
}),
|
|
127
|
-
!loading && !error && historicalDoc && /*#__PURE__*/ jsx("div", {
|
|
128
|
-
className: classnames('byline-diff-modal-viewer', diff_modal_module.viewer),
|
|
129
|
-
children: /*#__PURE__*/ jsx(react_diff_viewer_continued, {
|
|
130
|
-
oldValue: historicalStr,
|
|
131
|
-
newValue: currentStr,
|
|
132
|
-
splitView: true,
|
|
133
|
-
compareMethod: DiffMethod.LINES,
|
|
134
|
-
useDarkTheme: true,
|
|
135
|
-
leftTitle: versionLabel,
|
|
136
|
-
rightTitle: "Current version",
|
|
137
|
-
hideLineNumbers: false
|
|
138
|
-
})
|
|
139
|
-
})
|
|
140
|
-
]
|
|
141
|
-
})
|
|
142
|
-
]
|
|
143
|
-
})
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
export { DiffModal };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import "./diff-modal_module.css";
|
|
2
|
-
const diff_modal_module = {
|
|
3
|
-
header: "header-da1tQG",
|
|
4
|
-
"title-stack": "title-stack-mSxmPG",
|
|
5
|
-
titleStack: "title-stack-mSxmPG",
|
|
6
|
-
title: "title-xO708s",
|
|
7
|
-
subtitle: "subtitle-VnkAjp",
|
|
8
|
-
version: "version-sRziHD",
|
|
9
|
-
content: "content-_KyVkg",
|
|
10
|
-
state: "state-Gg9w8j",
|
|
11
|
-
error: "error-BP4kEV",
|
|
12
|
-
viewer: "viewer-hxDZsJ"
|
|
13
|
-
};
|
|
14
|
-
export default diff_modal_module;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
:is(.header-da1tQG, .byline-diff-modal-header) {
|
|
2
|
-
padding-top: var(--spacing-16);
|
|
3
|
-
margin-bottom: var(--spacing-8);
|
|
4
|
-
flex-shrink: 0;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
:is(.title-stack-mSxmPG, .byline-diff-modal-title-stack) {
|
|
8
|
-
flex-direction: column;
|
|
9
|
-
display: flex;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
:is(.title-xO708s, .byline-diff-modal-title) {
|
|
13
|
-
font-size: var(--font-size-xl);
|
|
14
|
-
margin: 0;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
:is(.subtitle-VnkAjp, .byline-diff-modal-subtitle) {
|
|
18
|
-
font-size: var(--font-size-sm);
|
|
19
|
-
color: var(--gray-400);
|
|
20
|
-
margin: 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
:is(.version-sRziHD, .byline-diff-modal-version) {
|
|
24
|
-
font-family: var(--font-family-mono);
|
|
25
|
-
font-size: var(--font-size-xs);
|
|
26
|
-
background-color: var(--canvas-700);
|
|
27
|
-
padding: 0 var(--spacing-4);
|
|
28
|
-
border-radius: var(--border-radius-sm);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
:is(.content-_KyVkg, .byline-diff-modal-content) {
|
|
32
|
-
flex: 1 1 0;
|
|
33
|
-
min-height: 0;
|
|
34
|
-
padding: 0;
|
|
35
|
-
overflow: auto;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
:is(.state-Gg9w8j, .byline-diff-modal-state) {
|
|
39
|
-
justify-content: center;
|
|
40
|
-
align-items: center;
|
|
41
|
-
gap: var(--spacing-12);
|
|
42
|
-
height: 100%;
|
|
43
|
-
color: var(--gray-400);
|
|
44
|
-
display: flex;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
:is(.error-BP4kEV, .byline-diff-modal-error) {
|
|
48
|
-
color: var(--red-400);
|
|
49
|
-
gap: 0;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
:is(.viewer-hxDZsJ, .byline-diff-modal-viewer) {
|
|
53
|
-
font-family: var(--font-family-mono);
|
|
54
|
-
font-size: var(--font-size-sm);
|
|
55
|
-
}
|
|
56
|
-
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Infonomic Company Limited
|
|
7
|
-
*/
|
|
8
|
-
import type { WorkflowStatus } from '@byline/core';
|
|
9
|
-
/**
|
|
10
|
-
* Compact badge for workflow status values. Maps the three built-in
|
|
11
|
-
* statuses (draft, published, archived) to semantic intents and falls
|
|
12
|
-
* back to `noeffect` for any custom workflow statuses.
|
|
13
|
-
*
|
|
14
|
-
* When `hasPublishedVersion` is true and the current status is not
|
|
15
|
-
* `published`, a small green dot is rendered before the badge to
|
|
16
|
-
* indicate that a published version is live.
|
|
17
|
-
*
|
|
18
|
-
* Stable override handles: `.byline-status-badge-wrap`,
|
|
19
|
-
* `.byline-status-badge-dot`, `.byline-status-badge`.
|
|
20
|
-
*/
|
|
21
|
-
export declare const StatusBadge: ({ status, workflowStatuses, hasPublishedVersion, }: {
|
|
22
|
-
status: string;
|
|
23
|
-
workflowStatuses: WorkflowStatus[];
|
|
24
|
-
hasPublishedVersion?: boolean;
|
|
25
|
-
}) => import("react").JSX.Element;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { WORKFLOW_STATUS_ARCHIVED, WORKFLOW_STATUS_DRAFT, WORKFLOW_STATUS_PUBLISHED } from "@byline/core";
|
|
3
|
-
import classnames from "classnames";
|
|
4
|
-
import { Badge } from "../../uikit.js";
|
|
5
|
-
import status_badge_module from "./status-badge.module.js";
|
|
6
|
-
function statusIntent(status) {
|
|
7
|
-
switch(status){
|
|
8
|
-
case WORKFLOW_STATUS_PUBLISHED:
|
|
9
|
-
return 'success';
|
|
10
|
-
case WORKFLOW_STATUS_DRAFT:
|
|
11
|
-
return 'warning';
|
|
12
|
-
case WORKFLOW_STATUS_ARCHIVED:
|
|
13
|
-
return 'info';
|
|
14
|
-
default:
|
|
15
|
-
return 'noeffect';
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
const StatusBadge = ({ status, workflowStatuses, hasPublishedVersion })=>{
|
|
19
|
-
const label = workflowStatuses.find((s)=>s.name === status)?.label ?? String(status ?? '');
|
|
20
|
-
return /*#__PURE__*/ jsxs("span", {
|
|
21
|
-
className: classnames('byline-status-badge-wrap', status_badge_module.wrap),
|
|
22
|
-
children: [
|
|
23
|
-
true === hasPublishedVersion && 'published' !== status && /*#__PURE__*/ jsx("span", {
|
|
24
|
-
title: "A published version is live",
|
|
25
|
-
className: classnames('byline-status-badge-dot', status_badge_module.dot)
|
|
26
|
-
}),
|
|
27
|
-
/*#__PURE__*/ jsx(Badge, {
|
|
28
|
-
intent: statusIntent(status),
|
|
29
|
-
className: classnames('byline-status-badge', status_badge_module.badge),
|
|
30
|
-
children: label
|
|
31
|
-
})
|
|
32
|
-
]
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
export { StatusBadge };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
:is(.wrap-ZbeRnh, .byline-status-badge-wrap) {
|
|
2
|
-
align-items: center;
|
|
3
|
-
gap: var(--spacing-4);
|
|
4
|
-
display: inline-flex;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
:is(.dot-VmpmJH, .byline-status-badge-dot) {
|
|
8
|
-
border-radius: var(--border-radius-full);
|
|
9
|
-
background-color: var(--green-500);
|
|
10
|
-
width: .5rem;
|
|
11
|
-
height: .5rem;
|
|
12
|
-
display: inline-block;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
:is(.badge-zXEFyw, .byline-status-badge) {
|
|
16
|
-
padding: 0 .375rem;
|
|
17
|
-
font-size: .65rem;
|
|
18
|
-
line-height: 1.5;
|
|
19
|
-
}
|
|
20
|
-
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Group — labelled fieldset clustering related fields together.
|
|
3
|
-
*
|
|
4
|
-
* Used by `FormRenderer` when a `CollectionAdminConfig` declares a
|
|
5
|
-
* `groups` primitive. Renders a bordered, padded `<fieldset>` with an
|
|
6
|
-
* optional `<legend>` for the label.
|
|
7
|
-
*
|
|
8
|
-
* Override handles: `.byline-admin-group` (the fieldset) and
|
|
9
|
-
* `.byline-admin-group-legend` (the optional heading) are exposed as
|
|
10
|
-
* stable global classes for host overrides.
|
|
11
|
-
*
|
|
12
|
-
* Note: this is the *admin layout* group primitive, not the schema-level
|
|
13
|
-
* `group` field type. Field widgets use `byline-field-*` handles to keep
|
|
14
|
-
* the namespaces disambiguated.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
.group,
|
|
18
|
-
:global(.byline-admin-group) {
|
|
19
|
-
display: flex;
|
|
20
|
-
flex-direction: column;
|
|
21
|
-
gap: var(--spacing-16);
|
|
22
|
-
padding: var(--spacing-12);
|
|
23
|
-
border: var(--border-width-thin) var(--border-style-solid) var(--gray-200);
|
|
24
|
-
border-radius: var(--border-radius-md);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.legend,
|
|
28
|
-
:global(.byline-admin-group-legend) {
|
|
29
|
-
padding-inline: var(--spacing-4);
|
|
30
|
-
font-size: var(--font-size-sm);
|
|
31
|
-
font-weight: var(--font-weight-medium);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/* ─── Dark theme variants ───────────────────────────────────── */
|
|
35
|
-
|
|
36
|
-
:is([data-theme="dark"], :global(.dark)) {
|
|
37
|
-
.group,
|
|
38
|
-
:global(.byline-admin-group) {
|
|
39
|
-
border-color: var(--gray-700);
|
|
40
|
-
}
|
|
41
|
-
}
|
package/src/admin/group.tsx
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Infonomic Company Limited
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { ReactNode } from 'react'
|
|
10
|
-
|
|
11
|
-
import cx from 'classnames'
|
|
12
|
-
|
|
13
|
-
import styles from './group.module.css'
|
|
14
|
-
|
|
15
|
-
interface AdminGroupProps {
|
|
16
|
-
/** Optional heading rendered as a `<legend>` above the cluster. */
|
|
17
|
-
label?: string
|
|
18
|
-
children: ReactNode
|
|
19
|
-
className?: string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Labelled fieldset clustering related fields together.
|
|
24
|
-
*
|
|
25
|
-
* Used by `FormRenderer` when a `CollectionAdminConfig` declares a `groups`
|
|
26
|
-
* primitive. Renders a bordered, padded `<fieldset>` with an optional
|
|
27
|
-
* `<legend>` for the label.
|
|
28
|
-
*
|
|
29
|
-
* Stable override handles: `.byline-admin-group` on the fieldset and
|
|
30
|
-
* `.byline-admin-group-legend` on the legend (alongside the hashed
|
|
31
|
-
* CSS-modules locals).
|
|
32
|
-
*/
|
|
33
|
-
export const AdminGroup = ({ label, children, className }: AdminGroupProps) => {
|
|
34
|
-
return (
|
|
35
|
-
<fieldset className={cx('byline-admin-group', styles.group, className)}>
|
|
36
|
-
{label && <legend className={cx('byline-admin-group-legend', styles.legend)}>{label}</legend>}
|
|
37
|
-
{children}
|
|
38
|
-
</fieldset>
|
|
39
|
-
)
|
|
40
|
-
}
|
package/src/admin/row.module.css
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Row — horizontal flex layout for admin form fields.
|
|
3
|
-
*
|
|
4
|
-
* Members render side-by-side at `sm` and above, stack vertically below.
|
|
5
|
-
* `flex: 1` + `min-width: 0` on direct children lets two text inputs
|
|
6
|
-
* share the row evenly without overflowing.
|
|
7
|
-
*
|
|
8
|
-
* Override handle: `.byline-admin-row` is exposed as a stable global
|
|
9
|
-
* class so hosts can target this element from their own stylesheet
|
|
10
|
-
* without referring to the hashed local name.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
.row,
|
|
14
|
-
:global(.byline-admin-row) {
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
align-items: flex-start;
|
|
18
|
-
gap: var(--spacing-16);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.row > *,
|
|
22
|
-
:global(.byline-admin-row) > * {
|
|
23
|
-
flex: 1;
|
|
24
|
-
min-width: 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@media (min-width: 40rem) {
|
|
28
|
-
.row,
|
|
29
|
-
:global(.byline-admin-row) {
|
|
30
|
-
flex-direction: row;
|
|
31
|
-
}
|
|
32
|
-
}
|
package/src/admin/row.tsx
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Infonomic Company Limited
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { ReactNode } from 'react'
|
|
10
|
-
|
|
11
|
-
import cx from 'classnames'
|
|
12
|
-
|
|
13
|
-
import styles from './row.module.css'
|
|
14
|
-
|
|
15
|
-
interface AdminRowProps {
|
|
16
|
-
children: ReactNode
|
|
17
|
-
className?: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Horizontal flex-row layout for admin form fields.
|
|
22
|
-
*
|
|
23
|
-
* Used by `FormRenderer` when a `CollectionAdminConfig` declares a `rows`
|
|
24
|
-
* primitive. Members are rendered side-by-side above the `sm` breakpoint
|
|
25
|
-
* and stack vertically below it. `flex-1` + `min-width: 0` lets two text
|
|
26
|
-
* inputs share the row evenly without overflowing.
|
|
27
|
-
*
|
|
28
|
-
* The element carries `.byline-admin-row` as a stable global class for
|
|
29
|
-
* host overrides (alongside the hashed CSS-modules local).
|
|
30
|
-
*/
|
|
31
|
-
export const AdminRow = ({ children, className }: AdminRowProps) => {
|
|
32
|
-
return <div className={cx('byline-admin-row', styles.row, className)}>{children}</div>
|
|
33
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tabs — navigation bar for admin form layouts.
|
|
3
|
-
*
|
|
4
|
-
* Override handles:
|
|
5
|
-
* .byline-admin-tabs — the tablist container
|
|
6
|
-
* .byline-admin-tab — each tab button
|
|
7
|
-
* .byline-admin-tab-active — added when the tab is the active one
|
|
8
|
-
* .byline-admin-tab-label — the inner label span (with optional badge)
|
|
9
|
-
* .byline-admin-tab-badge — the inline error-count badge
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
.tabs,
|
|
13
|
-
:global(.byline-admin-tabs) {
|
|
14
|
-
display: flex;
|
|
15
|
-
gap: var(--spacing-16);
|
|
16
|
-
border-bottom: var(--border-width-thin) var(--border-style-solid) var(--gray-200);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.tab,
|
|
20
|
-
:global(.byline-admin-tab) {
|
|
21
|
-
position: relative;
|
|
22
|
-
margin-bottom: -1px;
|
|
23
|
-
padding: 0.625rem 0;
|
|
24
|
-
border-bottom: 2px solid transparent;
|
|
25
|
-
background: none;
|
|
26
|
-
color: var(--gray-500);
|
|
27
|
-
font-size: 1.1rem;
|
|
28
|
-
font-weight: var(--font-weight-medium);
|
|
29
|
-
cursor: pointer;
|
|
30
|
-
transition:
|
|
31
|
-
color 150ms ease,
|
|
32
|
-
border-color 150ms ease;
|
|
33
|
-
outline: none;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.tab:hover,
|
|
37
|
-
:global(.byline-admin-tab):hover {
|
|
38
|
-
color: var(--gray-800);
|
|
39
|
-
border-bottom-color: var(--gray-300);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.tab:focus-visible,
|
|
43
|
-
:global(.byline-admin-tab):focus-visible {
|
|
44
|
-
box-shadow: 0 0 0 2px var(--blue-500);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.tab-active,
|
|
48
|
-
:global(.byline-admin-tab-active) {
|
|
49
|
-
color: var(--primary-600);
|
|
50
|
-
border-bottom-color: var(--primary-400);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.tab-active:hover,
|
|
54
|
-
:global(.byline-admin-tab-active):hover {
|
|
55
|
-
color: var(--primary-600);
|
|
56
|
-
border-bottom-color: var(--primary-400);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.label,
|
|
60
|
-
:global(.byline-admin-tab-label) {
|
|
61
|
-
display: flex;
|
|
62
|
-
align-items: center;
|
|
63
|
-
gap: 0.375rem;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.badge,
|
|
67
|
-
:global(.byline-admin-tab-badge) {
|
|
68
|
-
display: flex;
|
|
69
|
-
align-items: center;
|
|
70
|
-
justify-content: center;
|
|
71
|
-
min-width: 1.25rem;
|
|
72
|
-
height: 1.25rem;
|
|
73
|
-
padding: 0 0.375rem;
|
|
74
|
-
font-size: 0.7rem;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/* ─── Dark theme variants ───────────────────────────────────── */
|
|
78
|
-
|
|
79
|
-
:is([data-theme="dark"], :global(.dark)) {
|
|
80
|
-
.tabs,
|
|
81
|
-
:global(.byline-admin-tabs) {
|
|
82
|
-
border-bottom-color: var(--gray-700);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.tab,
|
|
86
|
-
:global(.byline-admin-tab) {
|
|
87
|
-
color: var(--gray-400);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.tab:hover,
|
|
91
|
-
:global(.byline-admin-tab):hover {
|
|
92
|
-
color: var(--gray-200);
|
|
93
|
-
border-bottom-color: var(--gray-600);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.tab-active,
|
|
97
|
-
:global(.byline-admin-tab-active) {
|
|
98
|
-
color: var(--primary-200);
|
|
99
|
-
border-bottom-color: var(--primary-400);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.tab-active:hover,
|
|
103
|
-
:global(.byline-admin-tab-active):hover {
|
|
104
|
-
color: var(--primary-200);
|
|
105
|
-
border-bottom-color: var(--primary-400);
|
|
106
|
-
}
|
|
107
|
-
}
|