@byline/ui 2.5.2 → 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.
Files changed (211) hide show
  1. package/dist/dnd/draggable-sortable/demo/draggable-list-demo.js +1 -1
  2. package/dist/react.d.ts +18 -54
  3. package/dist/react.js +0 -35
  4. package/dist/uikit.d.ts +1 -0
  5. package/dist/uikit.js +1 -0
  6. package/package.json +2 -8
  7. package/src/dnd/draggable-sortable/demo/draggable-list-demo.tsx +1 -1
  8. package/src/react.ts +20 -68
  9. package/src/uikit.ts +1 -0
  10. package/dist/admin/group.d.ts +0 -27
  11. package/dist/admin/group.js +0 -14
  12. package/dist/admin/group.module.js +0 -6
  13. package/dist/admin/group_module.css +0 -19
  14. package/dist/admin/row.d.ts +0 -25
  15. package/dist/admin/row.js +0 -8
  16. package/dist/admin/row.module.js +0 -5
  17. package/dist/admin/row_module.css +0 -18
  18. package/dist/admin/tabs.d.ts +0 -25
  19. package/dist/admin/tabs.js +0 -35
  20. package/dist/admin/tabs.module.js +0 -10
  21. package/dist/admin/tabs_module.css +0 -68
  22. package/dist/fields/array/array-field.d.ts +0 -14
  23. package/dist/fields/array/array-field.js +0 -176
  24. package/dist/fields/array/array-field.module.js +0 -11
  25. package/dist/fields/array/array-field_module.css +0 -32
  26. package/dist/fields/blocks/blocks-field.d.ts +0 -13
  27. package/dist/fields/blocks/blocks-field.js +0 -244
  28. package/dist/fields/blocks/blocks-field.module.js +0 -26
  29. package/dist/fields/blocks/blocks-field_module.css +0 -107
  30. package/dist/fields/checkbox/checkbox-field.d.ts +0 -16
  31. package/dist/fields/checkbox/checkbox-field.js +0 -28
  32. package/dist/fields/checkbox/checkbox-field.module.js +0 -6
  33. package/dist/fields/checkbox/checkbox-field_module.css +0 -4
  34. package/dist/fields/column-formatter.d.ts +0 -20
  35. package/dist/fields/column-formatter.js +0 -15
  36. package/dist/fields/date-time-formatter.d.ts +0 -16
  37. package/dist/fields/date-time-formatter.js +0 -8
  38. package/dist/fields/datetime/datetime-field.d.ts +0 -16
  39. package/dist/fields/datetime/datetime-field.js +0 -37
  40. package/dist/fields/datetime/datetime-field.module.js +0 -5
  41. package/dist/fields/datetime/datetime-field_module.css +0 -4
  42. package/dist/fields/draggable-context-menu.d.ts +0 -6
  43. package/dist/fields/draggable-context-menu.js +0 -83
  44. package/dist/fields/draggable-context-menu.module.js +0 -15
  45. package/dist/fields/draggable-context-menu_module.css +0 -91
  46. package/dist/fields/field-helpers.d.ts +0 -26
  47. package/dist/fields/field-helpers.js +0 -50
  48. package/dist/fields/field-renderer.d.ts +0 -37
  49. package/dist/fields/field-renderer.js +0 -206
  50. package/dist/fields/field-renderer.module.js +0 -8
  51. package/dist/fields/field-renderer_module.css +0 -11
  52. package/dist/fields/file/file-field.d.ts +0 -19
  53. package/dist/fields/file/file-field.js +0 -226
  54. package/dist/fields/file/file-field.module.js +0 -18
  55. package/dist/fields/file/file-field_module.css +0 -131
  56. package/dist/fields/file/file-upload-field.d.ts +0 -21
  57. package/dist/fields/file/file-upload-field.js +0 -128
  58. package/dist/fields/file/file-upload-field.module.js +0 -15
  59. package/dist/fields/file/file-upload-field_module.css +0 -74
  60. package/dist/fields/group/group-field.d.ts +0 -15
  61. package/dist/fields/group/group-field.js +0 -59
  62. package/dist/fields/group/group-field.module.js +0 -9
  63. package/dist/fields/group/group-field_module.css +0 -27
  64. package/dist/fields/image/image-field.d.ts +0 -19
  65. package/dist/fields/image/image-field.js +0 -242
  66. package/dist/fields/image/image-field.module.js +0 -22
  67. package/dist/fields/image/image-field_module.css +0 -121
  68. package/dist/fields/image/image-upload-field.d.ts +0 -21
  69. package/dist/fields/image/image-upload-field.js +0 -187
  70. package/dist/fields/image/image-upload-field.module.js +0 -19
  71. package/dist/fields/image/image-upload-field_module.css +0 -92
  72. package/dist/fields/local-date-time.d.ts +0 -27
  73. package/dist/fields/local-date-time.js +0 -49
  74. package/dist/fields/locale-badge.d.ts +0 -18
  75. package/dist/fields/locale-badge.js +0 -10
  76. package/dist/fields/locale-badge.module.js +0 -5
  77. package/dist/fields/locale-badge_module.css +0 -27
  78. package/dist/fields/numerical/numerical-field.d.ts +0 -18
  79. package/dist/fields/numerical/numerical-field.js +0 -74
  80. package/dist/fields/relation/relation-display.d.ts +0 -40
  81. package/dist/fields/relation/relation-display.js +0 -58
  82. package/dist/fields/relation/relation-display.module.js +0 -9
  83. package/dist/fields/relation/relation-display_module.css +0 -21
  84. package/dist/fields/relation/relation-field.d.ts +0 -18
  85. package/dist/fields/relation/relation-field.js +0 -146
  86. package/dist/fields/relation/relation-field.module.js +0 -13
  87. package/dist/fields/relation/relation-field_module.css +0 -62
  88. package/dist/fields/relation/relation-picker.d.ts +0 -49
  89. package/dist/fields/relation/relation-picker.js +0 -233
  90. package/dist/fields/relation/relation-picker.module.js +0 -26
  91. package/dist/fields/relation/relation-picker_module.css +0 -124
  92. package/dist/fields/relation/relation-summary.d.ts +0 -31
  93. package/dist/fields/relation/relation-summary.js +0 -50
  94. package/dist/fields/relation/relation-summary.module.js +0 -11
  95. package/dist/fields/relation/relation-summary_module.css +0 -37
  96. package/dist/fields/select/select-field.d.ts +0 -16
  97. package/dist/fields/select/select-field.js +0 -50
  98. package/dist/fields/select/select-field.module.js +0 -5
  99. package/dist/fields/select/select-field_module.css +0 -4
  100. package/dist/fields/sortable-item.d.ts +0 -15
  101. package/dist/fields/sortable-item.js +0 -80
  102. package/dist/fields/sortable-item.module.js +0 -22
  103. package/dist/fields/sortable-item_module.css +0 -124
  104. package/dist/fields/text/text-field.d.ts +0 -20
  105. package/dist/fields/text/text-field.js +0 -104
  106. package/dist/fields/text/text-field.module.js +0 -6
  107. package/dist/fields/text/text-field_module.css +0 -5
  108. package/dist/fields/text-area/text-area-field.d.ts +0 -20
  109. package/dist/fields/text-area/text-area-field.js +0 -105
  110. package/dist/fields/text-area/text-area-field.module.js +0 -6
  111. package/dist/fields/text-area/text-area-field_module.css +0 -5
  112. package/dist/fields/use-field-change-handler.d.ts +0 -23
  113. package/dist/fields/use-field-change-handler.js +0 -52
  114. package/dist/forms/document-actions.d.ts +0 -48
  115. package/dist/forms/document-actions.js +0 -469
  116. package/dist/forms/document-actions.module.js +0 -34
  117. package/dist/forms/document-actions_module.css +0 -118
  118. package/dist/forms/form-context.d.ts +0 -89
  119. package/dist/forms/form-context.js +0 -466
  120. package/dist/forms/form-renderer.d.ts +0 -98
  121. package/dist/forms/form-renderer.js +0 -591
  122. package/dist/forms/form-renderer.module.js +0 -46
  123. package/dist/forms/form-renderer_module.css +0 -245
  124. package/dist/forms/navigation-guard.d.ts +0 -54
  125. package/dist/forms/navigation-guard.js +0 -22
  126. package/dist/forms/path-widget.d.ts +0 -36
  127. package/dist/forms/path-widget.js +0 -107
  128. package/dist/forms/path-widget.module.js +0 -8
  129. package/dist/forms/path-widget_module.css +0 -29
  130. package/dist/forms/upload-executor.d.ts +0 -57
  131. package/dist/forms/upload-executor.js +0 -92
  132. package/dist/services/field-services-context.d.ts +0 -16
  133. package/dist/services/field-services-context.js +0 -13
  134. package/dist/services/field-services-types.d.ts +0 -63
  135. package/dist/services/field-services-types.js +0 -1
  136. package/dist/widgets/diff-viewer/diff-modal.d.ts +0 -22
  137. package/dist/widgets/diff-viewer/diff-modal.js +0 -146
  138. package/dist/widgets/diff-viewer/diff-modal.module.js +0 -14
  139. package/dist/widgets/diff-viewer/diff-modal_module.css +0 -56
  140. package/dist/widgets/status-badge/status-badge.d.ts +0 -25
  141. package/dist/widgets/status-badge/status-badge.js +0 -35
  142. package/dist/widgets/status-badge/status-badge.module.js +0 -7
  143. package/dist/widgets/status-badge/status-badge_module.css +0 -20
  144. package/src/admin/group.module.css +0 -41
  145. package/src/admin/group.tsx +0 -40
  146. package/src/admin/row.module.css +0 -32
  147. package/src/admin/row.tsx +0 -33
  148. package/src/admin/tabs.module.css +0 -107
  149. package/src/admin/tabs.tsx +0 -82
  150. package/src/fields/array/array-field.module.css +0 -48
  151. package/src/fields/array/array-field.tsx +0 -266
  152. package/src/fields/blocks/blocks-field.module.css +0 -148
  153. package/src/fields/blocks/blocks-field.tsx +0 -312
  154. package/src/fields/checkbox/checkbox-field.module.css +0 -4
  155. package/src/fields/checkbox/checkbox-field.tsx +0 -54
  156. package/src/fields/column-formatter.tsx +0 -31
  157. package/src/fields/date-time-formatter.tsx +0 -22
  158. package/src/fields/datetime/datetime-field.module.css +0 -13
  159. package/src/fields/datetime/datetime-field.tsx +0 -54
  160. package/src/fields/draggable-context-menu.module.css +0 -127
  161. package/src/fields/draggable-context-menu.tsx +0 -85
  162. package/src/fields/field-helpers.ts +0 -69
  163. package/src/fields/field-renderer.module.css +0 -22
  164. package/src/fields/field-renderer.tsx +0 -288
  165. package/src/fields/file/file-field.module.css +0 -153
  166. package/src/fields/file/file-field.tsx +0 -271
  167. package/src/fields/file/file-upload-field.module.css +0 -101
  168. package/src/fields/file/file-upload-field.tsx +0 -183
  169. package/src/fields/group/group-field.module.css +0 -43
  170. package/src/fields/group/group-field.tsx +0 -84
  171. package/src/fields/image/image-field.module.css +0 -155
  172. package/src/fields/image/image-field.tsx +0 -291
  173. package/src/fields/image/image-upload-field.module.css +0 -123
  174. package/src/fields/image/image-upload-field.tsx +0 -270
  175. package/src/fields/local-date-time.tsx +0 -88
  176. package/src/fields/locale-badge.module.css +0 -37
  177. package/src/fields/locale-badge.tsx +0 -32
  178. package/src/fields/numerical/numerical-field.tsx +0 -114
  179. package/src/fields/relation/relation-display.module.css +0 -36
  180. package/src/fields/relation/relation-display.tsx +0 -130
  181. package/src/fields/relation/relation-field.module.css +0 -83
  182. package/src/fields/relation/relation-field.tsx +0 -206
  183. package/src/fields/relation/relation-picker.module.css +0 -168
  184. package/src/fields/relation/relation-picker.tsx +0 -325
  185. package/src/fields/relation/relation-summary.module.css +0 -55
  186. package/src/fields/relation/relation-summary.tsx +0 -123
  187. package/src/fields/select/select-field.module.css +0 -13
  188. package/src/fields/select/select-field.tsx +0 -61
  189. package/src/fields/sortable-item.module.css +0 -167
  190. package/src/fields/sortable-item.tsx +0 -101
  191. package/src/fields/text/text-field.module.css +0 -13
  192. package/src/fields/text/text-field.tsx +0 -146
  193. package/src/fields/text-area/text-area-field.module.css +0 -13
  194. package/src/fields/text-area/text-area-field.tsx +0 -147
  195. package/src/fields/use-field-change-handler.ts +0 -112
  196. package/src/forms/document-actions.module.css +0 -160
  197. package/src/forms/document-actions.tsx +0 -487
  198. package/src/forms/form-context.tsx +0 -704
  199. package/src/forms/form-renderer.module.css +0 -321
  200. package/src/forms/form-renderer.tsx +0 -888
  201. package/src/forms/navigation-guard.tsx +0 -98
  202. package/src/forms/path-widget.module.css +0 -41
  203. package/src/forms/path-widget.test.tsx +0 -217
  204. package/src/forms/path-widget.tsx +0 -181
  205. package/src/forms/upload-executor.ts +0 -190
  206. package/src/services/field-services-context.tsx +0 -35
  207. package/src/services/field-services-types.ts +0 -68
  208. package/src/widgets/diff-viewer/diff-modal.module.css +0 -79
  209. package/src/widgets/diff-viewer/diff-modal.tsx +0 -184
  210. package/src/widgets/status-badge/status-badge.module.css +0 -31
  211. package/src/widgets/status-badge/status-badge.tsx +0 -69
@@ -1,11 +0,0 @@
1
- :is(.localized-wrap-bv51Y7, .byline-field-localized-wrap) {
2
- position: relative;
3
- }
4
-
5
- :is(.localized-badge-D5MrbH, .byline-field-localized-badge) {
6
- line-height: 1;
7
- position: absolute;
8
- top: 0;
9
- right: 0;
10
- }
11
-
@@ -1,19 +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 FileField as FieldType, type StoredFileValue } from '@byline/core';
9
- interface FileFieldProps {
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 FileField: ({ field, collectionPath, value, defaultValue, onChange: _onChange, path, }: FileFieldProps) => import("react").JSX.Element;
19
- export {};
@@ -1,226 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { isPendingStoredFileValue } from "@byline/core";
3
- import classnames from "classnames";
4
- import { IconButton } from "../../components/button/icon-button.js";
5
- import { useFieldError, useFieldValue, useFormContext, useIsDirty, useIsFieldUploading } from "../../forms/form-context.js";
6
- import { CloseIcon } from "../../icons/close-icon.js";
7
- import { DocumentIcon } from "../../icons/document-icon.js";
8
- import { DownloadIcon } from "../../icons/download-icon.js";
9
- import { VideoIcon } from "../../icons/video-icon.js";
10
- import { ErrorText, HelpText, Label, LoaderRing } from "../../uikit.js";
11
- import { useFieldChangeHandler } from "../use-field-change-handler.js";
12
- import file_field_module from "./file-field.module.js";
13
- import { FileUploadField } from "./file-upload-field.js";
14
- function triggerDownload(url, filename) {
15
- if ("u" < typeof document) return;
16
- const a = document.createElement('a');
17
- a.href = url;
18
- if (filename) a.download = filename;
19
- a.target = '_blank';
20
- a.rel = 'noreferrer';
21
- document.body.appendChild(a);
22
- a.click();
23
- document.body.removeChild(a);
24
- }
25
- const FileField = ({ field, collectionPath, value, defaultValue, onChange: _onChange, path })=>{
26
- const fieldPath = path ?? field.name;
27
- const fieldError = useFieldError(fieldPath);
28
- const isDirty = useIsDirty(fieldPath);
29
- const fieldValue = useFieldValue(fieldPath);
30
- const isUploading = useIsFieldUploading(fieldPath);
31
- const { removePendingUpload } = useFormContext();
32
- const handleChange = useFieldChangeHandler(field, fieldPath);
33
- const incomingValue = isDirty ? fieldValue ?? null : value ?? fieldValue ?? defaultValue ?? null;
34
- const isPending = isPendingStoredFileValue(incomingValue);
35
- const isOldPlaceholder = (v)=>{
36
- if (!v || 'object' != typeof v) return false;
37
- const maybe = v;
38
- return 'placeholder' === maybe.storageProvider && 'pending' === maybe.storagePath;
39
- };
40
- const showUploadWidget = null == incomingValue || isOldPlaceholder(incomingValue);
41
- const handleRemove = ()=>{
42
- if (isPending) removePendingUpload(fieldPath);
43
- handleChange(null);
44
- };
45
- const isVideo = incomingValue?.mimeType?.startsWith('video/') === true;
46
- const FileGlyph = isVideo ? VideoIcon : DocumentIcon;
47
- const htmlId = fieldPath;
48
- return /*#__PURE__*/ jsxs("div", {
49
- className: `byline-field-file ${field.name}`,
50
- children: [
51
- /*#__PURE__*/ jsx("div", {
52
- className: classnames('byline-field-file-header', file_field_module.header),
53
- children: /*#__PURE__*/ jsx(Label, {
54
- id: htmlId,
55
- htmlFor: htmlId,
56
- label: field.label ?? field.name,
57
- required: !field.optional
58
- })
59
- }),
60
- showUploadWidget ? collectionPath ? /*#__PURE__*/ jsx(FileUploadField, {
61
- field: field,
62
- collectionPath: collectionPath,
63
- fieldPath: fieldPath,
64
- onUploaded: (uploaded)=>{
65
- handleChange(uploaded);
66
- }
67
- }) : /*#__PURE__*/ jsx("div", {
68
- className: classnames('byline-field-file-empty', file_field_module.empty),
69
- children: "No file selected"
70
- }) : /*#__PURE__*/ jsxs("div", {
71
- className: classnames('byline-field-file-tile', file_field_module.tile),
72
- children: [
73
- isUploading && /*#__PURE__*/ jsx("div", {
74
- className: classnames('byline-field-file-uploading', file_field_module.uploading),
75
- "aria-live": "polite",
76
- "aria-busy": "true",
77
- children: /*#__PURE__*/ jsx(LoaderRing, {})
78
- }),
79
- collectionPath && /*#__PURE__*/ jsxs("div", {
80
- className: classnames('byline-field-file-actions', file_field_module.actions),
81
- children: [
82
- !isPending && incomingValue?.storageUrl && /*#__PURE__*/ jsx(IconButton, {
83
- type: "button",
84
- intent: "noeffect",
85
- onClick: ()=>triggerDownload(incomingValue.storageUrl, incomingValue.originalFilename ?? incomingValue.filename),
86
- size: "xs",
87
- disabled: isUploading,
88
- "aria-label": "Download file",
89
- children: /*#__PURE__*/ jsx(DownloadIcon, {
90
- width: "15px",
91
- height: "15px"
92
- })
93
- }),
94
- /*#__PURE__*/ jsx(IconButton, {
95
- type: "button",
96
- intent: "noeffect",
97
- onClick: handleRemove,
98
- size: "xs",
99
- disabled: isUploading,
100
- "aria-label": "Remove file",
101
- children: /*#__PURE__*/ jsx(CloseIcon, {
102
- width: "15px",
103
- height: "15px"
104
- })
105
- })
106
- ]
107
- }),
108
- !isPending && incomingValue?.storageUrl ? /*#__PURE__*/ jsx("a", {
109
- href: incomingValue.storageUrl,
110
- target: "_blank",
111
- rel: "noreferrer",
112
- "aria-label": `Open ${incomingValue.originalFilename ?? incomingValue.filename} in a new tab`,
113
- className: classnames('byline-field-file-icon-wrap', file_field_module["icon-wrap"]),
114
- children: /*#__PURE__*/ jsx(FileGlyph, {
115
- width: "48px",
116
- height: "48px",
117
- className: classnames('byline-field-file-icon', file_field_module.icon)
118
- })
119
- }) : /*#__PURE__*/ jsxs("div", {
120
- className: classnames('byline-field-file-icon-wrap', file_field_module["icon-wrap"]),
121
- children: [
122
- /*#__PURE__*/ jsx(FileGlyph, {
123
- width: "48px",
124
- height: "48px",
125
- className: classnames('byline-field-file-icon', file_field_module.icon)
126
- }),
127
- isPending && /*#__PURE__*/ jsx("div", {
128
- className: classnames('byline-field-file-pending', file_field_module.pending),
129
- children: "Pending upload"
130
- })
131
- ]
132
- }),
133
- /*#__PURE__*/ jsxs("div", {
134
- className: classnames('byline-field-file-meta', file_field_module.meta),
135
- children: [
136
- /*#__PURE__*/ jsxs("div", {
137
- children: [
138
- /*#__PURE__*/ jsx("span", {
139
- className: classnames('byline-field-file-meta-key', file_field_module["meta-key"]),
140
- children: "Filename:"
141
- }),
142
- ' ',
143
- incomingValue?.filename
144
- ]
145
- }),
146
- /*#__PURE__*/ jsxs("div", {
147
- children: [
148
- /*#__PURE__*/ jsx("span", {
149
- className: classnames('byline-field-file-meta-key', file_field_module["meta-key"]),
150
- children: "Original:"
151
- }),
152
- ' ',
153
- incomingValue?.originalFilename
154
- ]
155
- }),
156
- /*#__PURE__*/ jsxs("div", {
157
- children: [
158
- /*#__PURE__*/ jsx("span", {
159
- className: classnames('byline-field-file-meta-key', file_field_module["meta-key"]),
160
- children: "Type:"
161
- }),
162
- ' ',
163
- incomingValue?.mimeType
164
- ]
165
- }),
166
- /*#__PURE__*/ jsxs("div", {
167
- children: [
168
- /*#__PURE__*/ jsx("span", {
169
- className: classnames('byline-field-file-meta-key', file_field_module["meta-key"]),
170
- children: "Size:"
171
- }),
172
- ' ',
173
- incomingValue?.fileSize
174
- ]
175
- }),
176
- isPending ? /*#__PURE__*/ jsxs("div", {
177
- children: [
178
- /*#__PURE__*/ jsx("span", {
179
- className: classnames('byline-field-file-meta-key', file_field_module["meta-key"]),
180
- children: "Status:"
181
- }),
182
- ' ',
183
- /*#__PURE__*/ jsx("span", {
184
- className: classnames('byline-field-file-meta-pending', file_field_module["meta-pending"]),
185
- children: "Will upload on save"
186
- })
187
- ]
188
- }) : /*#__PURE__*/ jsxs(Fragment, {
189
- children: [
190
- /*#__PURE__*/ jsxs("div", {
191
- children: [
192
- /*#__PURE__*/ jsx("span", {
193
- className: classnames('byline-field-file-meta-key', file_field_module["meta-key"]),
194
- children: "Storage:"
195
- }),
196
- ' ',
197
- incomingValue?.storageProvider
198
- ]
199
- }),
200
- /*#__PURE__*/ jsxs("div", {
201
- children: [
202
- /*#__PURE__*/ jsx("span", {
203
- className: classnames('byline-field-file-meta-key', file_field_module["meta-key"]),
204
- children: "Path:"
205
- }),
206
- ' ',
207
- incomingValue?.storagePath
208
- ]
209
- })
210
- ]
211
- })
212
- ]
213
- })
214
- ]
215
- }),
216
- field.helpText && /*#__PURE__*/ jsx(HelpText, {
217
- text: field.helpText
218
- }),
219
- fieldError && /*#__PURE__*/ jsx(ErrorText, {
220
- id: `${field.name}-error`,
221
- text: fieldError
222
- })
223
- ]
224
- });
225
- };
226
- export { FileField };
@@ -1,18 +0,0 @@
1
- import "./file-field_module.css";
2
- const file_field_module = {
3
- header: "header-4BiMwv",
4
- actions: "actions-Yd3WIq",
5
- empty: "empty-Afgknj",
6
- tile: "tile-K1K1D_",
7
- uploading: "uploading-KCIPa6",
8
- "icon-wrap": "icon-wrap-TckWPs",
9
- iconWrap: "icon-wrap-TckWPs",
10
- icon: "icon-HnknJj",
11
- pending: "pending-mh5ZKa",
12
- meta: "meta-mm1UmQ",
13
- "meta-key": "meta-key-q6cipk",
14
- metaKey: "meta-key-q6cipk",
15
- "meta-pending": "meta-pending-Q0ICzl",
16
- metaPending: "meta-pending-Q0ICzl"
17
- };
18
- export default file_field_module;
@@ -1,131 +0,0 @@
1
- :is(.header-4BiMwv, .byline-field-file-header) {
2
- align-items: baseline;
3
- gap: var(--spacing-8);
4
- margin-bottom: .25rem;
5
- display: flex;
6
- }
7
-
8
- :is(.actions-Yd3WIq, .byline-field-file-actions) {
9
- top: var(--spacing-6);
10
- right: var(--spacing-6);
11
- z-index: 1;
12
- align-items: center;
13
- gap: var(--spacing-4);
14
- display: flex;
15
- position: absolute;
16
- }
17
-
18
- .byline-field-file-actions .byline-button {
19
- color: var(--gray-900);
20
- }
21
-
22
- :is(.dark .byline-field-file-actions .byline-button, [data-theme="dark"] .byline-field-file-actions .byline-button) {
23
- color: var(--gray-200);
24
- }
25
-
26
- :is(.empty-Afgknj, .byline-field-file-empty) {
27
- color: var(--gray-500);
28
- font-size: var(--font-size-xs);
29
- font-style: italic;
30
- }
31
-
32
- :is(.tile-K1K1D_, .byline-field-file-tile) {
33
- gap: var(--spacing-16);
34
- padding: var(--spacing-8);
35
- border: var(--border-width-thin) var(--border-style-solid) var(--primary-500);
36
- border-radius: var(--border-radius-md);
37
- margin-top: .25rem;
38
- display: flex;
39
- position: relative;
40
- }
41
-
42
- :is(.uploading-KCIPa6, .byline-field-file-uploading) {
43
- z-index: 2;
44
- background-color: oklch(from var(--gray-950) l c h / .5);
45
- border-radius: var(--border-radius-md);
46
- justify-content: center;
47
- align-items: center;
48
- display: flex;
49
- position: absolute;
50
- inset: 0;
51
- }
52
-
53
- :is(.icon-wrap-TckWPs, .byline-field-file-icon-wrap) {
54
- border: var(--border-width-thin) var(--border-style-solid) var(--gray-600);
55
- border-radius: var(--border-radius-sm);
56
- width: 4rem;
57
- height: 4rem;
58
- color: var(--gray-300);
59
- flex-shrink: 0;
60
- justify-content: center;
61
- align-self: flex-start;
62
- align-items: center;
63
- display: flex;
64
- position: relative;
65
- }
66
-
67
- a.icon-wrap-TckWPs {
68
- cursor: pointer;
69
- text-decoration: none;
70
- transition: border-color .12s, color .12s;
71
- }
72
-
73
- a.byline-field-file-icon-wrap {
74
- cursor: pointer;
75
- text-decoration: none;
76
- transition: border-color .12s, color .12s;
77
- }
78
-
79
- a.icon-wrap-TckWPs:hover {
80
- border-color: var(--primary-500);
81
- color: var(--primary-400);
82
- }
83
-
84
- a.byline-field-file-icon-wrap:hover {
85
- border-color: var(--primary-500);
86
- color: var(--primary-400);
87
- }
88
-
89
- a.icon-wrap-TckWPs:focus-visible {
90
- outline: 2px solid var(--primary-500);
91
- outline-offset: 2px;
92
- }
93
-
94
- a.byline-field-file-icon-wrap:focus-visible {
95
- outline: 2px solid var(--primary-500);
96
- outline-offset: 2px;
97
- }
98
-
99
- :is(.icon-HnknJj, .byline-field-file-icon) {
100
- opacity: .85;
101
- }
102
-
103
- :is(.pending-mh5ZKa, .byline-field-file-pending) {
104
- background-color: oklch(from var(--yellow-600) l c h / .9);
105
- color: var(--yellow-100);
106
- font-size: .6rem;
107
- font-weight: var(--font-weight-medium);
108
- border-radius: var(--border-radius-sm);
109
- padding: .125rem .375rem;
110
- position: absolute;
111
- top: .25rem;
112
- left: .25rem;
113
- }
114
-
115
- :is(.meta-mm1UmQ, .byline-field-file-meta) {
116
- padding-right: var(--spacing-32);
117
- color: var(--gray-200);
118
- font-size: var(--font-size-xs);
119
- flex-direction: column;
120
- gap: .125rem;
121
- display: flex;
122
- }
123
-
124
- :is(.meta-key-q6cipk, .byline-field-file-meta-key) {
125
- font-weight: var(--font-weight-semibold);
126
- }
127
-
128
- :is(.meta-pending-Q0ICzl, .byline-field-file-meta-pending) {
129
- color: var(--yellow-400);
130
- }
131
-
@@ -1,21 +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 FileField as FieldType, type PendingStoredFileValue, type StoredFileValue } from '@byline/core';
9
- interface FileUploadFieldProps {
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. `'attachment'` or `'content.0.attachment'`). */
14
- fieldPath: string;
15
- /** Called with the PendingStoredFileValue for immediate UI update. */
16
- onUploaded: (value: StoredFileValue | PendingStoredFileValue) => void;
17
- /** Optional `accept` MIME-type / extension string for the native file input. */
18
- accept?: string;
19
- }
20
- export declare const FileUploadField: ({ field: _field, collectionPath, fieldPath, onUploaded, accept, }: FileUploadFieldProps) => import("react").JSX.Element;
21
- export {};
@@ -1,128 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useCallback, useRef, useState } from "react";
3
- import { createPendingStoredFileValue } from "@byline/core";
4
- import classnames from "classnames";
5
- import { useFormContext } from "../../forms/form-context.js";
6
- import file_upload_field_module from "./file-upload-field.module.js";
7
- const FileUploadField = ({ field: _field, collectionPath, fieldPath, onUploaded, accept })=>{
8
- const inputRef = useRef(null);
9
- const [status, setStatus] = useState('idle');
10
- const [errorMessage, setErrorMessage] = useState(null);
11
- const [isDragOver, setIsDragOver] = useState(false);
12
- const { addPendingUpload } = useFormContext();
13
- const handleFileSelected = useCallback((file)=>{
14
- setStatus('processing');
15
- setErrorMessage(null);
16
- const previewUrl = URL.createObjectURL(file);
17
- const pendingValue = createPendingStoredFileValue(file, previewUrl);
18
- addPendingUpload(fieldPath, {
19
- file,
20
- previewUrl,
21
- collectionPath
22
- });
23
- setStatus('idle');
24
- onUploaded(pendingValue);
25
- }, [
26
- collectionPath,
27
- fieldPath,
28
- addPendingUpload,
29
- onUploaded
30
- ]);
31
- const handleFileChange = useCallback((e)=>{
32
- const file = e.target.files?.[0];
33
- if (file) handleFileSelected(file);
34
- e.target.value = '';
35
- }, [
36
- handleFileSelected
37
- ]);
38
- const handleBrowseClick = useCallback(()=>{
39
- inputRef.current?.click();
40
- }, []);
41
- const handleDragOver = useCallback((e)=>{
42
- e.preventDefault();
43
- setIsDragOver(true);
44
- }, []);
45
- const handleDragLeave = useCallback((e)=>{
46
- e.preventDefault();
47
- setIsDragOver(false);
48
- }, []);
49
- const handleDrop = useCallback((e)=>{
50
- e.preventDefault();
51
- setIsDragOver(false);
52
- const file = e.dataTransfer.files?.[0];
53
- if (file) handleFileSelected(file);
54
- }, [
55
- handleFileSelected
56
- ]);
57
- const isProcessing = 'processing' === status;
58
- return /*#__PURE__*/ jsxs("div", {
59
- className: classnames('byline-field-file-upload', file_upload_field_module.root),
60
- children: [
61
- /*#__PURE__*/ jsx("input", {
62
- ref: inputRef,
63
- type: "file",
64
- accept: accept,
65
- className: classnames('byline-field-file-upload-input', file_upload_field_module.input),
66
- onChange: handleFileChange,
67
- disabled: isProcessing,
68
- "aria-hidden": "true",
69
- tabIndex: -1
70
- }),
71
- /*#__PURE__*/ jsxs("div", {
72
- role: "button",
73
- tabIndex: 0,
74
- "aria-label": "Upload file — drag and drop or click to browse",
75
- onDragOver: handleDragOver,
76
- onDragLeave: handleDragLeave,
77
- onDrop: handleDrop,
78
- onClick: handleBrowseClick,
79
- onKeyDown: (e)=>{
80
- if ('Enter' === e.key || ' ' === e.key) {
81
- e.preventDefault();
82
- handleBrowseClick();
83
- }
84
- },
85
- className: classnames('byline-field-file-upload-zone', file_upload_field_module.zone, isDragOver && !isProcessing && [
86
- 'byline-field-file-upload-zone-active',
87
- file_upload_field_module["zone-active"]
88
- ], isProcessing && [
89
- 'byline-field-file-upload-zone-busy',
90
- file_upload_field_module["zone-busy"]
91
- ]),
92
- children: [
93
- /*#__PURE__*/ jsx("svg", {
94
- xmlns: "http://www.w3.org/2000/svg",
95
- className: classnames('byline-field-file-upload-icon', file_upload_field_module.icon),
96
- fill: "none",
97
- viewBox: "0 0 24 24",
98
- stroke: "currentColor",
99
- strokeWidth: 1.5,
100
- "aria-hidden": "true",
101
- children: /*#__PURE__*/ jsx("path", {
102
- strokeLinecap: "round",
103
- strokeLinejoin: "round",
104
- d: "M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"
105
- })
106
- }),
107
- /*#__PURE__*/ jsxs("span", {
108
- className: classnames('byline-field-file-upload-label', file_upload_field_module.label),
109
- children: [
110
- "Drop file here or",
111
- ' ',
112
- /*#__PURE__*/ jsx("span", {
113
- className: classnames('byline-field-file-upload-action', file_upload_field_module.action),
114
- children: "browse"
115
- })
116
- ]
117
- })
118
- ]
119
- }),
120
- 'error' === status && errorMessage && /*#__PURE__*/ jsx("p", {
121
- className: classnames('byline-field-file-upload-error', file_upload_field_module.error),
122
- role: "alert",
123
- children: errorMessage
124
- })
125
- ]
126
- });
127
- };
128
- export { FileUploadField };
@@ -1,15 +0,0 @@
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;
@@ -1,74 +0,0 @@
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
-
@@ -1,15 +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 { 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 {};