@byline/admin 2.5.2 → 2.6.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.
- package/dist/fields/array/array-field.d.ts +14 -0
- package/dist/fields/array/array-field.js +177 -0
- package/dist/fields/array/array-field.module.js +11 -0
- package/dist/fields/array/array-field_module.css +32 -0
- package/dist/fields/blocks/blocks-field.d.ts +13 -0
- package/dist/fields/blocks/blocks-field.js +245 -0
- package/dist/fields/blocks/blocks-field.module.js +26 -0
- package/dist/fields/blocks/blocks-field_module.css +107 -0
- package/dist/fields/checkbox/checkbox-field.d.ts +16 -0
- package/dist/fields/checkbox/checkbox-field.js +28 -0
- package/dist/fields/checkbox/checkbox-field.module.js +6 -0
- package/dist/fields/checkbox/checkbox-field_module.css +4 -0
- package/dist/fields/column-formatter.d.ts +20 -0
- package/dist/fields/column-formatter.js +15 -0
- package/dist/fields/date-time-formatter.d.ts +16 -0
- package/dist/fields/date-time-formatter.js +8 -0
- package/dist/fields/datetime/datetime-field.d.ts +16 -0
- package/dist/fields/datetime/datetime-field.js +37 -0
- package/dist/fields/datetime/datetime-field.module.js +5 -0
- package/dist/fields/datetime/datetime-field_module.css +4 -0
- package/dist/fields/draggable-context-menu.d.ts +6 -0
- package/dist/fields/draggable-context-menu.js +85 -0
- package/dist/fields/draggable-context-menu.module.js +15 -0
- package/dist/fields/draggable-context-menu_module.css +91 -0
- package/dist/fields/field-helpers.d.ts +26 -0
- package/dist/fields/field-helpers.js +50 -0
- package/dist/fields/field-renderer.d.ts +37 -0
- package/dist/fields/field-renderer.js +206 -0
- package/dist/fields/field-renderer.module.js +8 -0
- package/dist/fields/field-renderer_module.css +11 -0
- package/dist/fields/field-services-context.d.ts +16 -0
- package/dist/fields/field-services-context.js +13 -0
- package/dist/fields/field-services-types.d.ts +63 -0
- package/dist/fields/field-services-types.js +1 -0
- package/dist/fields/file/file-field.d.ts +19 -0
- package/dist/fields/file/file-field.js +225 -0
- package/dist/fields/file/file-field.module.js +18 -0
- package/dist/fields/file/file-field_module.css +131 -0
- package/dist/fields/file/file-upload-field.d.ts +21 -0
- package/dist/fields/file/file-upload-field.js +130 -0
- package/dist/fields/file/file-upload-field.module.js +15 -0
- package/dist/fields/file/file-upload-field_module.css +74 -0
- package/dist/fields/group/group-field.d.ts +15 -0
- package/dist/fields/group/group-field.js +59 -0
- package/dist/fields/group/group-field.module.js +9 -0
- package/dist/fields/group/group-field_module.css +27 -0
- package/dist/fields/image/image-field.d.ts +19 -0
- package/dist/fields/image/image-field.js +241 -0
- package/dist/fields/image/image-field.module.js +22 -0
- package/dist/fields/image/image-field_module.css +121 -0
- package/dist/fields/image/image-upload-field.d.ts +21 -0
- package/dist/fields/image/image-upload-field.js +190 -0
- package/dist/fields/image/image-upload-field.module.js +19 -0
- package/dist/fields/image/image-upload-field_module.css +92 -0
- package/dist/fields/local-date-time.d.ts +27 -0
- package/dist/fields/local-date-time.js +49 -0
- package/dist/fields/locale-badge.d.ts +18 -0
- package/dist/fields/locale-badge.js +10 -0
- package/dist/fields/locale-badge.module.js +5 -0
- package/dist/fields/locale-badge_module.css +27 -0
- package/dist/fields/numerical/numerical-field.d.ts +18 -0
- package/dist/fields/numerical/numerical-field.js +74 -0
- package/dist/fields/relation/relation-display.d.ts +40 -0
- package/dist/fields/relation/relation-display.js +61 -0
- package/dist/fields/relation/relation-display.module.js +9 -0
- package/dist/fields/relation/relation-display_module.css +21 -0
- package/dist/fields/relation/relation-field.d.ts +18 -0
- package/dist/fields/relation/relation-field.js +138 -0
- package/dist/fields/relation/relation-field.module.js +13 -0
- package/dist/fields/relation/relation-field_module.css +62 -0
- package/dist/fields/relation/relation-picker.d.ts +59 -0
- package/dist/fields/relation/relation-picker.js +237 -0
- package/dist/fields/relation/relation-picker.module.js +26 -0
- package/dist/fields/relation/relation-picker_module.css +124 -0
- package/dist/fields/relation/relation-summary.d.ts +31 -0
- package/dist/fields/relation/relation-summary.js +50 -0
- package/dist/fields/relation/relation-summary.module.js +11 -0
- package/dist/fields/relation/relation-summary_module.css +37 -0
- package/dist/fields/select/select-field.d.ts +16 -0
- package/dist/fields/select/select-field.js +50 -0
- package/dist/fields/select/select-field.module.js +5 -0
- package/dist/fields/select/select-field_module.css +4 -0
- package/dist/fields/sortable-item.d.ts +15 -0
- package/dist/fields/sortable-item.js +81 -0
- package/dist/fields/sortable-item.module.js +22 -0
- package/dist/fields/sortable-item_module.css +124 -0
- package/dist/fields/text/text-field.d.ts +20 -0
- package/dist/fields/text/text-field.js +104 -0
- package/dist/fields/text/text-field.module.js +6 -0
- package/dist/fields/text/text-field_module.css +5 -0
- package/dist/fields/text-area/text-area-field.d.ts +20 -0
- package/dist/fields/text-area/text-area-field.js +105 -0
- package/dist/fields/text-area/text-area-field.module.js +6 -0
- package/dist/fields/text-area/text-area-field_module.css +5 -0
- package/dist/fields/use-field-change-handler.d.ts +23 -0
- package/dist/fields/use-field-change-handler.js +52 -0
- package/dist/forms/document-actions.d.ts +48 -0
- package/dist/forms/document-actions.js +475 -0
- package/dist/forms/document-actions.module.js +34 -0
- package/dist/forms/document-actions_module.css +118 -0
- package/dist/forms/form-context.d.ts +89 -0
- package/dist/forms/form-context.js +466 -0
- package/dist/forms/form-renderer.d.ts +98 -0
- package/dist/forms/form-renderer.js +597 -0
- package/dist/forms/form-renderer.module.js +46 -0
- package/dist/forms/form-renderer_module.css +245 -0
- package/dist/forms/navigation-guard.d.ts +54 -0
- package/dist/forms/navigation-guard.js +22 -0
- package/dist/forms/path-widget.d.ts +36 -0
- package/dist/forms/path-widget.js +116 -0
- package/dist/forms/path-widget.module.js +8 -0
- package/dist/forms/path-widget_module.css +29 -0
- package/dist/forms/upload-executor.d.ts +57 -0
- package/dist/forms/upload-executor.js +94 -0
- package/dist/lib/translate-validation-error.d.ts +36 -0
- package/dist/lib/translate-validation-error.js +11 -0
- package/dist/modules/admin-account/commands.d.ts +2 -1
- package/dist/modules/admin-account/commands.js +13 -2
- package/dist/modules/admin-account/components/change-password.js +45 -36
- package/dist/modules/admin-account/components/container.js +185 -134
- package/dist/modules/admin-account/components/preferences.d.ts +8 -0
- package/dist/modules/admin-account/components/preferences.js +152 -0
- package/dist/modules/admin-account/components/preferences.module.js +11 -0
- package/dist/modules/admin-account/components/preferences_module.css +41 -0
- package/dist/modules/admin-account/components/update.js +50 -31
- package/dist/modules/admin-account/index.d.ts +3 -3
- package/dist/modules/admin-account/index.js +2 -2
- package/dist/modules/admin-account/schemas.d.ts +4 -0
- package/dist/modules/admin-account/schemas.js +4 -1
- package/dist/modules/admin-account/service.d.ts +1 -0
- package/dist/modules/admin-account/service.js +8 -0
- package/dist/modules/admin-permissions/components/inspector.js +31 -41
- package/dist/modules/admin-roles/components/create.js +43 -26
- package/dist/modules/admin-roles/components/permissions.js +26 -35
- package/dist/modules/admin-roles/components/update.js +26 -16
- package/dist/modules/admin-users/components/create.js +60 -40
- package/dist/modules/admin-users/components/roles.js +9 -15
- package/dist/modules/admin-users/components/set-password.js +30 -31
- package/dist/modules/admin-users/components/update.js +58 -39
- package/dist/modules/admin-users/dto.js +1 -0
- package/dist/modules/admin-users/repository.d.ts +17 -0
- package/dist/modules/admin-users/schemas.d.ts +4 -0
- package/dist/modules/admin-users/schemas.js +6 -2
- package/dist/modules/auth/components/sign-in-form.js +10 -8
- package/dist/presentation/group.d.ts +27 -0
- package/dist/presentation/group.js +14 -0
- package/dist/presentation/group.module.js +6 -0
- package/dist/presentation/group_module.css +19 -0
- package/dist/presentation/row.d.ts +25 -0
- package/dist/presentation/row.js +8 -0
- package/dist/presentation/row.module.js +5 -0
- package/dist/presentation/row_module.css +18 -0
- package/dist/presentation/tabs.d.ts +25 -0
- package/dist/presentation/tabs.js +39 -0
- package/dist/presentation/tabs.module.js +10 -0
- package/dist/presentation/tabs_module.css +68 -0
- package/dist/react.d.ts +66 -0
- package/dist/react.js +36 -0
- package/dist/services/admin-services-types.d.ts +16 -0
- package/dist/widgets/diff-viewer/diff-modal.d.ts +22 -0
- package/dist/widgets/diff-viewer/diff-modal.js +149 -0
- package/dist/widgets/diff-viewer/diff-modal.module.js +14 -0
- package/dist/widgets/diff-viewer/diff-modal_module.css +56 -0
- package/dist/widgets/status-badge/status-badge.d.ts +25 -0
- package/dist/widgets/status-badge/status-badge.js +37 -0
- package/dist/widgets/status-badge/status-badge.module.js +7 -0
- package/dist/widgets/status-badge/status-badge_module.css +20 -0
- package/package.json +14 -4
- package/src/fields/array/array-field.module.css +48 -0
- package/src/fields/array/array-field.tsx +267 -0
- package/src/fields/blocks/blocks-field.module.css +148 -0
- package/src/fields/blocks/blocks-field.tsx +323 -0
- package/src/fields/checkbox/checkbox-field.module.css +4 -0
- package/src/fields/checkbox/checkbox-field.tsx +54 -0
- package/src/fields/column-formatter.tsx +31 -0
- package/src/fields/date-time-formatter.tsx +22 -0
- package/src/fields/datetime/datetime-field.module.css +13 -0
- package/src/fields/datetime/datetime-field.tsx +54 -0
- package/src/fields/draggable-context-menu.module.css +127 -0
- package/src/fields/draggable-context-menu.tsx +87 -0
- package/src/fields/field-helpers.ts +69 -0
- package/src/fields/field-renderer.module.css +22 -0
- package/src/fields/field-renderer.tsx +288 -0
- package/src/fields/field-services-context.tsx +35 -0
- package/src/fields/field-services-types.ts +68 -0
- package/src/fields/file/file-field.module.css +153 -0
- package/src/fields/file/file-field.tsx +286 -0
- package/src/fields/file/file-upload-field.module.css +101 -0
- package/src/fields/file/file-upload-field.tsx +187 -0
- package/src/fields/group/group-field.module.css +43 -0
- package/src/fields/group/group-field.tsx +84 -0
- package/src/fields/image/image-field.module.css +155 -0
- package/src/fields/image/image-field.tsx +306 -0
- package/src/fields/image/image-upload-field.module.css +123 -0
- package/src/fields/image/image-upload-field.tsx +276 -0
- package/src/fields/local-date-time.tsx +88 -0
- package/src/fields/locale-badge.module.css +37 -0
- package/src/fields/locale-badge.tsx +32 -0
- package/src/fields/numerical/numerical-field.tsx +114 -0
- package/src/fields/relation/relation-display.module.css +36 -0
- package/src/fields/relation/relation-display.tsx +138 -0
- package/src/fields/relation/relation-field.module.css +83 -0
- package/src/fields/relation/relation-field.tsx +211 -0
- package/src/fields/relation/relation-picker.module.css +168 -0
- package/src/fields/relation/relation-picker.tsx +343 -0
- package/src/fields/relation/relation-summary.module.css +55 -0
- package/src/fields/relation/relation-summary.tsx +123 -0
- package/src/fields/select/select-field.module.css +13 -0
- package/src/fields/select/select-field.tsx +61 -0
- package/src/fields/sortable-item.module.css +167 -0
- package/src/fields/sortable-item.tsx +106 -0
- package/src/fields/text/text-field.module.css +13 -0
- package/src/fields/text/text-field.tsx +146 -0
- package/src/fields/text-area/text-area-field.module.css +13 -0
- package/src/fields/text-area/text-area-field.tsx +147 -0
- package/src/fields/use-field-change-handler.ts +112 -0
- package/src/forms/document-actions.module.css +160 -0
- package/src/forms/document-actions.tsx +482 -0
- package/src/forms/form-context.tsx +704 -0
- package/src/forms/form-renderer.module.css +321 -0
- package/src/forms/form-renderer.tsx +891 -0
- package/src/forms/navigation-guard.tsx +98 -0
- package/src/forms/path-widget.module.css +41 -0
- package/src/forms/path-widget.test.tsx +217 -0
- package/src/forms/path-widget.tsx +183 -0
- package/src/forms/upload-executor.ts +192 -0
- package/src/lib/translate-validation-error.ts +56 -0
- package/src/modules/admin-account/commands.ts +13 -0
- package/src/modules/admin-account/components/change-password.tsx +46 -31
- package/src/modules/admin-account/components/container.tsx +83 -38
- package/src/modules/admin-account/components/preferences.module.css +60 -0
- package/src/modules/admin-account/components/preferences.tsx +203 -0
- package/src/modules/admin-account/components/update.tsx +53 -27
- package/src/modules/admin-account/index.ts +3 -0
- package/src/modules/admin-account/schemas.ts +13 -0
- package/src/modules/admin-account/service.ts +12 -0
- package/src/modules/admin-permissions/components/inspector.tsx +22 -14
- package/src/modules/admin-roles/components/create.tsx +51 -23
- package/src/modules/admin-roles/components/permissions.tsx +25 -21
- package/src/modules/admin-roles/components/update.tsx +37 -19
- package/src/modules/admin-users/components/create.tsx +63 -34
- package/src/modules/admin-users/components/roles.tsx +9 -8
- package/src/modules/admin-users/components/set-password.tsx +34 -28
- package/src/modules/admin-users/components/update.tsx +58 -36
- package/src/modules/admin-users/dto.ts +1 -0
- package/src/modules/admin-users/repository.ts +17 -0
- package/src/modules/admin-users/schemas.ts +12 -0
- package/src/modules/auth/components/sign-in-form.tsx +14 -8
- package/src/presentation/group.module.css +41 -0
- package/src/presentation/group.tsx +40 -0
- package/src/presentation/row.module.css +32 -0
- package/src/presentation/row.tsx +33 -0
- package/src/presentation/tabs.module.css +107 -0
- package/src/presentation/tabs.tsx +84 -0
- package/src/react.ts +84 -0
- package/src/services/admin-services-types.ts +18 -0
- package/src/widgets/diff-viewer/diff-modal.module.css +79 -0
- package/src/widgets/diff-viewer/diff-modal.tsx +186 -0
- package/src/widgets/status-badge/status-badge.module.css +31 -0
- package/src/widgets/status-badge/status-badge.tsx +71 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./file-upload-field_module.css";
|
|
2
|
+
const file_upload_field_module = {
|
|
3
|
+
root: "root-Eb8eWY",
|
|
4
|
+
input: "input-xBB8ah",
|
|
5
|
+
zone: "zone-HdQNmA",
|
|
6
|
+
"zone-active": "zone-active-iYZTsU",
|
|
7
|
+
zoneActive: "zone-active-iYZTsU",
|
|
8
|
+
"zone-busy": "zone-busy-GmToil",
|
|
9
|
+
zoneBusy: "zone-busy-GmToil",
|
|
10
|
+
icon: "icon-vXw1Do",
|
|
11
|
+
label: "label-XCy7AX",
|
|
12
|
+
action: "action-LUT6jM",
|
|
13
|
+
error: "error-fFWMW2"
|
|
14
|
+
};
|
|
15
|
+
export default file_upload_field_module;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
:is(.root-Eb8eWY, .byline-field-file-upload) {
|
|
2
|
+
margin-top: .25rem;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
:is(.input-xBB8ah, .byline-field-file-upload-input) {
|
|
6
|
+
clip: rect(0, 0, 0, 0);
|
|
7
|
+
white-space: nowrap;
|
|
8
|
+
border: 0;
|
|
9
|
+
width: 1px;
|
|
10
|
+
height: 1px;
|
|
11
|
+
margin: -1px;
|
|
12
|
+
padding: 0;
|
|
13
|
+
position: absolute;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:is(.zone-HdQNmA, .byline-field-file-upload-zone) {
|
|
18
|
+
justify-content: center;
|
|
19
|
+
align-items: center;
|
|
20
|
+
gap: var(--spacing-8);
|
|
21
|
+
border: 2px dashed var(--gray-600);
|
|
22
|
+
border-radius: var(--border-radius-lg);
|
|
23
|
+
color: var(--gray-400);
|
|
24
|
+
text-align: center;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
-webkit-user-select: none;
|
|
27
|
+
user-select: none;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
padding: 1.5rem 1rem;
|
|
30
|
+
transition: color .15s, background-color .15s, border-color .15s;
|
|
31
|
+
display: flex;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:is(.zone-HdQNmA:hover, .byline-field-file-upload-zone:hover) {
|
|
35
|
+
border-color: var(--primary-500);
|
|
36
|
+
background-color: oklch(from var(--primary-900) l c h / .1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:is(.zone-active-iYZTsU, .byline-field-file-upload-zone-active) {
|
|
40
|
+
border-color: var(--primary-400);
|
|
41
|
+
background-color: oklch(from var(--primary-900) l c h / .2);
|
|
42
|
+
color: var(--primary-300);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:is(.zone-busy-GmToil, .byline-field-file-upload-zone-busy) {
|
|
46
|
+
border-color: var(--gray-700);
|
|
47
|
+
background-color: oklch(from var(--canvas-800) l c h / .5);
|
|
48
|
+
color: var(--gray-600);
|
|
49
|
+
cursor: not-allowed;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
:is(.icon-vXw1Do, .byline-field-file-upload-icon) {
|
|
53
|
+
opacity: .6;
|
|
54
|
+
width: 1.75rem;
|
|
55
|
+
height: 1.75rem;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:is(.label-XCy7AX, .byline-field-file-upload-label) {
|
|
59
|
+
font-size: var(--font-size-xs);
|
|
60
|
+
font-weight: var(--font-weight-medium);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:is(.action-LUT6jM, .byline-field-file-upload-action) {
|
|
64
|
+
color: var(--primary-400);
|
|
65
|
+
text-underline-offset: 2px;
|
|
66
|
+
text-decoration: underline;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
:is(.error-fFWMW2, .byline-field-file-upload-error) {
|
|
70
|
+
color: var(--red-400);
|
|
71
|
+
font-size: var(--font-size-xs);
|
|
72
|
+
margin-top: .375rem;
|
|
73
|
+
}
|
|
74
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
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 { GroupField as GroupFieldType } from '@byline/core';
|
|
9
|
+
interface GroupFieldProps {
|
|
10
|
+
field: GroupFieldType;
|
|
11
|
+
defaultValue: any;
|
|
12
|
+
path: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const GroupField: ({ field, defaultValue, path }: GroupFieldProps) => import("react").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { ErrorText } from "@byline/ui/react";
|
|
4
|
+
import classnames from "classnames";
|
|
5
|
+
import { placeholderForField } from "../field-helpers.js";
|
|
6
|
+
import { FieldRenderer } from "../field-renderer.js";
|
|
7
|
+
import { useFieldError } from "../../forms/form-context.js";
|
|
8
|
+
import group_field_module from "./group-field.module.js";
|
|
9
|
+
const GroupField = ({ field, defaultValue, path })=>{
|
|
10
|
+
const fieldError = useFieldError(field.name);
|
|
11
|
+
const groupData = useMemo(()=>{
|
|
12
|
+
if (defaultValue && 'object' == typeof defaultValue && !Array.isArray(defaultValue)) return defaultValue;
|
|
13
|
+
const placeholder = {};
|
|
14
|
+
for (const childField of field.fields)placeholder[childField.name] = placeholderForField(childField);
|
|
15
|
+
return placeholder;
|
|
16
|
+
}, [
|
|
17
|
+
defaultValue,
|
|
18
|
+
field.fields
|
|
19
|
+
]);
|
|
20
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
21
|
+
className: `byline-field-group ${field.name}`,
|
|
22
|
+
children: [
|
|
23
|
+
field.label && /*#__PURE__*/ jsxs("div", {
|
|
24
|
+
className: classnames('byline-field-group-header', group_field_module.header),
|
|
25
|
+
children: [
|
|
26
|
+
/*#__PURE__*/ jsxs("h3", {
|
|
27
|
+
className: classnames('byline-field-group-title', group_field_module.title),
|
|
28
|
+
children: [
|
|
29
|
+
field.label,
|
|
30
|
+
' ',
|
|
31
|
+
!field.optional && /*#__PURE__*/ jsx("span", {
|
|
32
|
+
className: classnames('byline-field-group-required', group_field_module.required),
|
|
33
|
+
children: "*"
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
}),
|
|
37
|
+
field.helpText && /*#__PURE__*/ jsx("p", {
|
|
38
|
+
className: classnames('byline-field-group-help', group_field_module.help),
|
|
39
|
+
children: field.helpText
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
}),
|
|
43
|
+
/*#__PURE__*/ jsx("div", {
|
|
44
|
+
className: classnames('byline-field-group-body', group_field_module.body),
|
|
45
|
+
children: field.fields.map((innerField)=>/*#__PURE__*/ jsx(FieldRenderer, {
|
|
46
|
+
field: innerField,
|
|
47
|
+
defaultValue: groupData[innerField.name],
|
|
48
|
+
basePath: path,
|
|
49
|
+
disableSorting: true
|
|
50
|
+
}, innerField.name))
|
|
51
|
+
}),
|
|
52
|
+
fieldError && /*#__PURE__*/ jsx(ErrorText, {
|
|
53
|
+
id: `${field.name}-error`,
|
|
54
|
+
text: fieldError
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
export { GroupField };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
:is(.header-QiCfGn, .byline-field-group-header) {
|
|
2
|
+
margin-bottom: var(--spacing-8);
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: .125rem;
|
|
5
|
+
display: flex;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
:is(.title-N84bq9, .byline-field-group-title) {
|
|
9
|
+
font-size: 1rem;
|
|
10
|
+
font-weight: var(--font-weight-medium);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:is(.required-aR0X2E, .byline-field-group-required) {
|
|
14
|
+
color: var(--red-500);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:is(.help-xFiofl, .byline-field-group-help) {
|
|
18
|
+
color: var(--gray-500);
|
|
19
|
+
font-size: var(--font-size-xs);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:is(.body-_PqbfY, .byline-field-group-body) {
|
|
23
|
+
gap: var(--spacing-8);
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
display: flex;
|
|
26
|
+
}
|
|
27
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
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 ImageField as FieldType, type StoredFileValue } from '@byline/core';
|
|
9
|
+
interface ImageFieldProps {
|
|
10
|
+
field: FieldType;
|
|
11
|
+
/** Collection path required to call the /upload endpoint. */
|
|
12
|
+
collectionPath?: string;
|
|
13
|
+
value?: StoredFileValue | null;
|
|
14
|
+
defaultValue?: StoredFileValue | null;
|
|
15
|
+
onChange?: (value: StoredFileValue | null) => void;
|
|
16
|
+
path?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const ImageField: ({ field, collectionPath, value, defaultValue, onChange: _onChange, path, }: ImageFieldProps) => import("react").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { isPendingStoredFileValue } from "@byline/core";
|
|
4
|
+
import { useTranslation } from "@byline/i18n/react";
|
|
5
|
+
import { CloseIcon, ErrorText, HelpText, IconButton, ImageLightbox, Label, LoaderRing } from "@byline/ui/react";
|
|
6
|
+
import classnames from "classnames";
|
|
7
|
+
import { useFieldError, useFieldValue, useFormContext, useIsDirty, useIsFieldUploading } from "../../forms/form-context.js";
|
|
8
|
+
import { useFieldChangeHandler } from "../use-field-change-handler.js";
|
|
9
|
+
import image_field_module from "./image-field.module.js";
|
|
10
|
+
import { ImageUploadField } from "./image-upload-field.js";
|
|
11
|
+
const ImageField = ({ field, collectionPath, value, defaultValue, onChange: _onChange, path })=>{
|
|
12
|
+
const fieldPath = path ?? field.name;
|
|
13
|
+
const fieldError = useFieldError(fieldPath);
|
|
14
|
+
const isDirty = useIsDirty(fieldPath);
|
|
15
|
+
const fieldValue = useFieldValue(fieldPath);
|
|
16
|
+
const isUploading = useIsFieldUploading(fieldPath);
|
|
17
|
+
const { removePendingUpload } = useFormContext();
|
|
18
|
+
const { t } = useTranslation('byline-admin');
|
|
19
|
+
const handleChange = useFieldChangeHandler(field, fieldPath);
|
|
20
|
+
const incomingValue = isDirty ? fieldValue ?? null : value ?? fieldValue ?? defaultValue ?? null;
|
|
21
|
+
const isPending = isPendingStoredFileValue(incomingValue);
|
|
22
|
+
const isOldPlaceholder = (v)=>{
|
|
23
|
+
if (!v || 'object' != typeof v) return false;
|
|
24
|
+
const maybe = v;
|
|
25
|
+
return 'placeholder' === maybe.storageProvider && 'pending' === maybe.storagePath;
|
|
26
|
+
};
|
|
27
|
+
const showUploadWidget = null == incomingValue || isOldPlaceholder(incomingValue);
|
|
28
|
+
const thumbVariant = incomingValue && !isPendingStoredFileValue(incomingValue) ? incomingValue.variants?.find((v)=>'thumbnail' === v.name) : void 0;
|
|
29
|
+
const previewUrl = thumbVariant?.storageUrl ?? incomingValue?.storageUrl;
|
|
30
|
+
const handleRemove = ()=>{
|
|
31
|
+
if (isPending) removePendingUpload(fieldPath);
|
|
32
|
+
handleChange(null);
|
|
33
|
+
};
|
|
34
|
+
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
35
|
+
const canOpenLightbox = !isPending && !!incomingValue?.storageUrl;
|
|
36
|
+
const htmlId = fieldPath;
|
|
37
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
38
|
+
className: `byline-field-image ${field.name}`,
|
|
39
|
+
children: [
|
|
40
|
+
/*#__PURE__*/ jsx("div", {
|
|
41
|
+
className: classnames('byline-field-image-header', image_field_module.header),
|
|
42
|
+
children: /*#__PURE__*/ jsx(Label, {
|
|
43
|
+
id: htmlId,
|
|
44
|
+
htmlFor: htmlId,
|
|
45
|
+
label: field.label ?? field.name,
|
|
46
|
+
required: !field.optional
|
|
47
|
+
})
|
|
48
|
+
}),
|
|
49
|
+
showUploadWidget ? collectionPath ? /*#__PURE__*/ jsx(ImageUploadField, {
|
|
50
|
+
field: field,
|
|
51
|
+
collectionPath: collectionPath,
|
|
52
|
+
fieldPath: fieldPath,
|
|
53
|
+
onUploaded: (uploaded)=>{
|
|
54
|
+
handleChange(uploaded);
|
|
55
|
+
}
|
|
56
|
+
}) : /*#__PURE__*/ jsx("div", {
|
|
57
|
+
className: classnames('byline-field-image-empty', image_field_module.empty),
|
|
58
|
+
children: t('fields.image.empty')
|
|
59
|
+
}) : /*#__PURE__*/ jsxs("div", {
|
|
60
|
+
className: classnames('byline-field-image-tile', image_field_module.tile),
|
|
61
|
+
children: [
|
|
62
|
+
isUploading && /*#__PURE__*/ jsx("div", {
|
|
63
|
+
className: classnames('byline-field-image-uploading', image_field_module.uploading),
|
|
64
|
+
"aria-live": "polite",
|
|
65
|
+
"aria-busy": "true",
|
|
66
|
+
children: /*#__PURE__*/ jsx(LoaderRing, {})
|
|
67
|
+
}),
|
|
68
|
+
collectionPath && /*#__PURE__*/ jsx("div", {
|
|
69
|
+
className: classnames('byline-field-image-remove', image_field_module.remove),
|
|
70
|
+
children: /*#__PURE__*/ jsx(IconButton, {
|
|
71
|
+
type: "button",
|
|
72
|
+
intent: "noeffect",
|
|
73
|
+
onClick: handleRemove,
|
|
74
|
+
size: "xs",
|
|
75
|
+
disabled: isUploading,
|
|
76
|
+
"aria-label": t('fields.image.removeAriaLabel'),
|
|
77
|
+
children: /*#__PURE__*/ jsx(CloseIcon, {
|
|
78
|
+
width: "15px",
|
|
79
|
+
height: "15px"
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
}),
|
|
83
|
+
previewUrl && /*#__PURE__*/ jsxs("div", {
|
|
84
|
+
className: classnames('byline-field-image-preview-wrap', image_field_module["preview-wrap"]),
|
|
85
|
+
children: [
|
|
86
|
+
canOpenLightbox ? /*#__PURE__*/ jsx("button", {
|
|
87
|
+
type: "button",
|
|
88
|
+
onClick: ()=>setLightboxOpen(true),
|
|
89
|
+
"aria-label": t('fields.image.openLightboxAriaLabel'),
|
|
90
|
+
className: classnames('byline-field-image-preview-button', image_field_module["preview-button"]),
|
|
91
|
+
children: /*#__PURE__*/ jsx("img", {
|
|
92
|
+
src: previewUrl,
|
|
93
|
+
alt: incomingValue.originalFilename ?? incomingValue.filename,
|
|
94
|
+
className: classnames('byline-field-image-preview', image_field_module.preview, 'image/svg+xml' === incomingValue.mimeType && [
|
|
95
|
+
'byline-field-image-preview-svg',
|
|
96
|
+
image_field_module["preview-svg"]
|
|
97
|
+
])
|
|
98
|
+
})
|
|
99
|
+
}) : /*#__PURE__*/ jsx("img", {
|
|
100
|
+
src: previewUrl,
|
|
101
|
+
alt: incomingValue.originalFilename ?? incomingValue.filename,
|
|
102
|
+
className: classnames('byline-field-image-preview', image_field_module.preview, 'image/svg+xml' === incomingValue.mimeType && [
|
|
103
|
+
'byline-field-image-preview-svg',
|
|
104
|
+
image_field_module["preview-svg"]
|
|
105
|
+
])
|
|
106
|
+
}),
|
|
107
|
+
isPending && /*#__PURE__*/ jsx("div", {
|
|
108
|
+
className: classnames('byline-field-image-pending', image_field_module.pending),
|
|
109
|
+
children: t('fields.fileMeta.pendingUpload')
|
|
110
|
+
})
|
|
111
|
+
]
|
|
112
|
+
}),
|
|
113
|
+
/*#__PURE__*/ jsxs("div", {
|
|
114
|
+
className: classnames('byline-field-image-meta', image_field_module.meta),
|
|
115
|
+
children: [
|
|
116
|
+
/*#__PURE__*/ jsxs("div", {
|
|
117
|
+
children: [
|
|
118
|
+
/*#__PURE__*/ jsx("span", {
|
|
119
|
+
className: classnames('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
120
|
+
children: t('fields.fileMeta.filename')
|
|
121
|
+
}),
|
|
122
|
+
' ',
|
|
123
|
+
incomingValue?.filename
|
|
124
|
+
]
|
|
125
|
+
}),
|
|
126
|
+
/*#__PURE__*/ jsxs("div", {
|
|
127
|
+
children: [
|
|
128
|
+
/*#__PURE__*/ jsx("span", {
|
|
129
|
+
className: classnames('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
130
|
+
children: t('fields.fileMeta.original')
|
|
131
|
+
}),
|
|
132
|
+
' ',
|
|
133
|
+
incomingValue?.originalFilename
|
|
134
|
+
]
|
|
135
|
+
}),
|
|
136
|
+
/*#__PURE__*/ jsxs("div", {
|
|
137
|
+
children: [
|
|
138
|
+
/*#__PURE__*/ jsx("span", {
|
|
139
|
+
className: classnames('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
140
|
+
children: t('fields.fileMeta.type')
|
|
141
|
+
}),
|
|
142
|
+
' ',
|
|
143
|
+
incomingValue?.mimeType
|
|
144
|
+
]
|
|
145
|
+
}),
|
|
146
|
+
/*#__PURE__*/ jsxs("div", {
|
|
147
|
+
children: [
|
|
148
|
+
/*#__PURE__*/ jsx("span", {
|
|
149
|
+
className: classnames('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
150
|
+
children: t('fields.fileMeta.size')
|
|
151
|
+
}),
|
|
152
|
+
' ',
|
|
153
|
+
incomingValue?.fileSize
|
|
154
|
+
]
|
|
155
|
+
}),
|
|
156
|
+
isPending ? /*#__PURE__*/ jsxs("div", {
|
|
157
|
+
children: [
|
|
158
|
+
/*#__PURE__*/ jsx("span", {
|
|
159
|
+
className: classnames('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
160
|
+
children: t('fields.fileMeta.status')
|
|
161
|
+
}),
|
|
162
|
+
' ',
|
|
163
|
+
/*#__PURE__*/ jsx("span", {
|
|
164
|
+
className: classnames('byline-field-image-meta-pending', image_field_module["meta-pending"]),
|
|
165
|
+
children: t('fields.fileMeta.willUploadOnSave')
|
|
166
|
+
})
|
|
167
|
+
]
|
|
168
|
+
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
169
|
+
children: [
|
|
170
|
+
/*#__PURE__*/ jsxs("div", {
|
|
171
|
+
children: [
|
|
172
|
+
/*#__PURE__*/ jsx("span", {
|
|
173
|
+
className: classnames('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
174
|
+
children: t('fields.fileMeta.storage')
|
|
175
|
+
}),
|
|
176
|
+
' ',
|
|
177
|
+
incomingValue?.storageProvider
|
|
178
|
+
]
|
|
179
|
+
}),
|
|
180
|
+
incomingValue?.imageWidth != null && /*#__PURE__*/ jsxs("div", {
|
|
181
|
+
children: [
|
|
182
|
+
/*#__PURE__*/ jsx("span", {
|
|
183
|
+
className: classnames('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
184
|
+
children: t('fields.imageMeta.dimensions')
|
|
185
|
+
}),
|
|
186
|
+
' ',
|
|
187
|
+
incomingValue.imageWidth,
|
|
188
|
+
null != incomingValue.imageHeight ? `×${incomingValue.imageHeight}` : ''
|
|
189
|
+
]
|
|
190
|
+
}),
|
|
191
|
+
incomingValue?.imageFormat != null && /*#__PURE__*/ jsxs("div", {
|
|
192
|
+
children: [
|
|
193
|
+
/*#__PURE__*/ jsx("span", {
|
|
194
|
+
className: classnames('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
195
|
+
children: t('fields.imageMeta.format')
|
|
196
|
+
}),
|
|
197
|
+
' ',
|
|
198
|
+
incomingValue.imageFormat
|
|
199
|
+
]
|
|
200
|
+
}),
|
|
201
|
+
/*#__PURE__*/ jsxs("div", {
|
|
202
|
+
children: [
|
|
203
|
+
/*#__PURE__*/ jsx("span", {
|
|
204
|
+
className: classnames('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
205
|
+
children: t('fields.imageMeta.thumbnail')
|
|
206
|
+
}),
|
|
207
|
+
' ',
|
|
208
|
+
thumbVariant ? t('fields.imageMeta.thumbnailGenerated') : t('fields.imageMeta.thumbnailPending')
|
|
209
|
+
]
|
|
210
|
+
})
|
|
211
|
+
]
|
|
212
|
+
})
|
|
213
|
+
]
|
|
214
|
+
})
|
|
215
|
+
]
|
|
216
|
+
}),
|
|
217
|
+
field.helpText && /*#__PURE__*/ jsx(HelpText, {
|
|
218
|
+
text: field.helpText
|
|
219
|
+
}),
|
|
220
|
+
fieldError && /*#__PURE__*/ jsx(ErrorText, {
|
|
221
|
+
id: `${field.name}-error`,
|
|
222
|
+
text: fieldError
|
|
223
|
+
}),
|
|
224
|
+
canOpenLightbox && incomingValue?.storageUrl && /*#__PURE__*/ jsx(ImageLightbox, {
|
|
225
|
+
isOpen: lightboxOpen,
|
|
226
|
+
onDismiss: ()=>setLightboxOpen(false),
|
|
227
|
+
src: incomingValue.storageUrl,
|
|
228
|
+
alt: incomingValue.originalFilename ?? incomingValue.filename,
|
|
229
|
+
downloadFilename: incomingValue.originalFilename ?? incomingValue.filename,
|
|
230
|
+
title: incomingValue.originalFilename ?? incomingValue.filename,
|
|
231
|
+
meta: {
|
|
232
|
+
width: incomingValue.imageWidth,
|
|
233
|
+
height: incomingValue.imageHeight,
|
|
234
|
+
fileSize: incomingValue.fileSize,
|
|
235
|
+
mimeType: incomingValue.mimeType
|
|
236
|
+
}
|
|
237
|
+
})
|
|
238
|
+
]
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
export { ImageField };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "./image-field_module.css";
|
|
2
|
+
const image_field_module = {
|
|
3
|
+
header: "header-qe_E_5",
|
|
4
|
+
remove: "remove-ib7eKx",
|
|
5
|
+
empty: "empty-b8pdoJ",
|
|
6
|
+
tile: "tile-izbLn0",
|
|
7
|
+
"preview-wrap": "preview-wrap-Cjr0PD",
|
|
8
|
+
previewWrap: "preview-wrap-Cjr0PD",
|
|
9
|
+
"preview-button": "preview-button-LAsENX",
|
|
10
|
+
previewButton: "preview-button-LAsENX",
|
|
11
|
+
preview: "preview-DIASGB",
|
|
12
|
+
"preview-svg": "preview-svg-sCwreb",
|
|
13
|
+
previewSvg: "preview-svg-sCwreb",
|
|
14
|
+
pending: "pending-s6X_52",
|
|
15
|
+
uploading: "uploading-nqh2Gh",
|
|
16
|
+
meta: "meta-uHyKiu",
|
|
17
|
+
"meta-key": "meta-key-eR6iRU",
|
|
18
|
+
metaKey: "meta-key-eR6iRU",
|
|
19
|
+
"meta-pending": "meta-pending-lEdTAj",
|
|
20
|
+
metaPending: "meta-pending-lEdTAj"
|
|
21
|
+
};
|
|
22
|
+
export default image_field_module;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
:is(.header-qe_E_5, .byline-field-image-header) {
|
|
2
|
+
align-items: baseline;
|
|
3
|
+
gap: var(--spacing-8);
|
|
4
|
+
margin-bottom: .25rem;
|
|
5
|
+
display: flex;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
:is(.remove-ib7eKx, .byline-field-image-remove) {
|
|
9
|
+
top: var(--spacing-6);
|
|
10
|
+
right: var(--spacing-6);
|
|
11
|
+
z-index: 1;
|
|
12
|
+
position: absolute;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.byline-field-image-remove .byline-button {
|
|
16
|
+
color: var(--gray-900);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:is(.dark .byline-field-image-remove .byline-button, [data-theme="dark"] .byline-field-image-remove .byline-button) {
|
|
20
|
+
color: var(--gray-200);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:is(.empty-b8pdoJ, .byline-field-image-empty) {
|
|
24
|
+
color: var(--gray-500);
|
|
25
|
+
font-size: var(--font-size-xs);
|
|
26
|
+
font-style: italic;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:is(.tile-izbLn0, .byline-field-image-tile) {
|
|
30
|
+
gap: var(--spacing-16);
|
|
31
|
+
padding: var(--spacing-8);
|
|
32
|
+
border: var(--border-width-thin) var(--border-style-solid) var(--primary-500);
|
|
33
|
+
border-radius: var(--border-radius-md);
|
|
34
|
+
margin-top: .25rem;
|
|
35
|
+
display: flex;
|
|
36
|
+
position: relative;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:is(.preview-wrap-Cjr0PD, .byline-field-image-preview-wrap) {
|
|
40
|
+
position: relative;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:is(.preview-button-LAsENX, .byline-field-image-preview-button) {
|
|
44
|
+
appearance: none;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
border-radius: var(--border-radius-sm);
|
|
47
|
+
background: none;
|
|
48
|
+
border: none;
|
|
49
|
+
margin: 0;
|
|
50
|
+
padding: 0;
|
|
51
|
+
display: block;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:is(.preview-button-LAsENX:focus-visible, .byline-field-image-preview-button:focus-visible) {
|
|
55
|
+
outline: 2px solid var(--primary-500);
|
|
56
|
+
outline-offset: 2px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:is(.preview-button-LAsENX img, .byline-field-image-preview-button img) {
|
|
60
|
+
transition: opacity .12s;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:is(.preview-button-LAsENX:hover img, .byline-field-image-preview-button:hover img) {
|
|
64
|
+
opacity: .85;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:is(.preview-DIASGB, .byline-field-image-preview) {
|
|
68
|
+
border: var(--border-width-thin) var(--border-style-solid) var(--gray-600);
|
|
69
|
+
border-radius: var(--border-radius-sm);
|
|
70
|
+
object-fit: contain;
|
|
71
|
+
min-width: 4rem;
|
|
72
|
+
min-height: 4rem;
|
|
73
|
+
max-height: 10rem;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:is(.preview-svg-sCwreb, .byline-field-image-preview-svg) {
|
|
77
|
+
width: 271px;
|
|
78
|
+
height: 159px;
|
|
79
|
+
max-height: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:is(.pending-s6X_52, .byline-field-image-pending) {
|
|
83
|
+
background-color: oklch(from var(--yellow-600) l c h / .9);
|
|
84
|
+
color: var(--yellow-100);
|
|
85
|
+
font-size: .6rem;
|
|
86
|
+
font-weight: var(--font-weight-medium);
|
|
87
|
+
border-radius: var(--border-radius-sm);
|
|
88
|
+
padding: .125rem .375rem;
|
|
89
|
+
position: absolute;
|
|
90
|
+
top: .25rem;
|
|
91
|
+
left: .25rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:is(.uploading-nqh2Gh, .byline-field-image-uploading) {
|
|
95
|
+
z-index: 2;
|
|
96
|
+
background-color: oklch(from var(--gray-950) l c h / .5);
|
|
97
|
+
border-radius: var(--border-radius-md);
|
|
98
|
+
justify-content: center;
|
|
99
|
+
align-items: center;
|
|
100
|
+
display: flex;
|
|
101
|
+
position: absolute;
|
|
102
|
+
inset: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
:is(.meta-uHyKiu, .byline-field-image-meta) {
|
|
106
|
+
padding-right: var(--spacing-32);
|
|
107
|
+
color: var(--gray-200);
|
|
108
|
+
font-size: var(--font-size-xs);
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
gap: .125rem;
|
|
111
|
+
display: flex;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:is(.meta-key-eR6iRU, .byline-field-image-meta-key) {
|
|
115
|
+
font-weight: var(--font-weight-semibold);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:is(.meta-pending-lEdTAj, .byline-field-image-meta-pending) {
|
|
119
|
+
color: var(--yellow-400);
|
|
120
|
+
}
|
|
121
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
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 ImageField as FieldType, type PendingStoredFileValue, type StoredFileValue } from '@byline/core';
|
|
9
|
+
interface ImageUploadFieldProps {
|
|
10
|
+
field: FieldType;
|
|
11
|
+
/** Collection path used to build the upload URL (e.g. `'media'`). */
|
|
12
|
+
collectionPath: string;
|
|
13
|
+
/** Field path in the form (e.g. `'image'` or `'content.0.image'`). */
|
|
14
|
+
fieldPath: string;
|
|
15
|
+
/** Called with the PendingStoredFileValue for immediate preview. */
|
|
16
|
+
onUploaded: (value: StoredFileValue | PendingStoredFileValue) => void;
|
|
17
|
+
/** Optional accepted-file MIME types string for the native file input. */
|
|
18
|
+
accept?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const ImageUploadField: ({ field: _field, collectionPath, fieldPath, onUploaded, accept, }: ImageUploadFieldProps) => import("react").JSX.Element;
|
|
21
|
+
export {};
|