@byline/ui 2.2.9 → 2.3.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 (41) hide show
  1. package/dist/fields/field-renderer.js +2 -1
  2. package/dist/fields/file/file-field.d.ts +4 -2
  3. package/dist/fields/file/file-field.js +182 -81
  4. package/dist/fields/file/file-field.module.js +10 -5
  5. package/dist/fields/file/file-field_module.css +99 -32
  6. package/dist/fields/file/file-upload-field.d.ts +21 -0
  7. package/dist/fields/file/file-upload-field.js +128 -0
  8. package/dist/fields/file/file-upload-field.module.js +15 -0
  9. package/dist/fields/file/file-upload-field_module.css +74 -0
  10. package/dist/fields/image/image-field.js +33 -17
  11. package/dist/fields/image/image-field.module.js +1 -0
  12. package/dist/fields/image/image-field_module.css +23 -10
  13. package/dist/fields/relation/relation-field.js +37 -24
  14. package/dist/fields/relation/relation-field.module.js +1 -1
  15. package/dist/fields/relation/relation-field_module.css +16 -16
  16. package/dist/forms/form-context.d.ts +11 -0
  17. package/dist/forms/form-context.js +47 -3
  18. package/dist/forms/form-renderer.js +5 -3
  19. package/dist/forms/form-renderer_module.css +1 -2
  20. package/dist/icons/index.d.ts +1 -0
  21. package/dist/icons/index.js +1 -0
  22. package/dist/icons/video-icon.d.ts +6 -0
  23. package/dist/icons/video-icon.js +36 -0
  24. package/dist/react.d.ts +1 -0
  25. package/dist/react.js +1 -0
  26. package/package.json +5 -4
  27. package/src/fields/field-renderer.tsx +1 -0
  28. package/src/fields/file/file-field.module.css +114 -49
  29. package/src/fields/file/file-field.tsx +220 -56
  30. package/src/fields/file/file-upload-field.module.css +101 -0
  31. package/src/fields/file/file-upload-field.tsx +183 -0
  32. package/src/fields/image/image-field.module.css +27 -13
  33. package/src/fields/image/image-field.tsx +35 -12
  34. package/src/fields/relation/relation-field.module.css +21 -21
  35. package/src/fields/relation/relation-field.tsx +24 -20
  36. package/src/forms/form-context.tsx +73 -0
  37. package/src/forms/form-renderer.module.css +1 -2
  38. package/src/forms/form-renderer.tsx +9 -2
  39. package/src/icons/index.ts +1 -0
  40. package/src/icons/video-icon.tsx +32 -0
  41. package/src/react.ts +1 -0
@@ -32,7 +32,7 @@ import { FormProvider, useFieldValue, useFormContext } from './form-context'
32
32
  import styles from './form-renderer.module.css'
33
33
  import { useNavigationGuardAdapter } from './navigation-guard'
34
34
  import { PathWidget } from './path-widget'
35
- import { executeUploads } from './upload-executor'
35
+ import { executeUploadsWithProgress } from './upload-executor'
36
36
  import type { UseNavigationGuard } from './navigation-guard'
37
37
 
38
38
  /** Metadata about a previously published version that is still live. */
@@ -321,6 +321,7 @@ const FormContent = ({
321
321
  setFieldError,
322
322
  getPendingUploads,
323
323
  clearPendingUploads,
324
+ setFieldUploading,
324
325
  } = useFormContext()
325
326
 
326
327
  const [errors, setErrors] = useState(initialErrors)
@@ -511,7 +512,13 @@ const FormContent = ({
511
512
  if (pendingUploads.size > 0) {
512
513
  setIsUploading(true)
513
514
  try {
514
- const uploadResult = await executeUploads(pendingUploads, uploadField)
515
+ const uploadResult = await executeUploadsWithProgress(
516
+ pendingUploads,
517
+ uploadField,
518
+ ({ fieldPath, status }) => {
519
+ setFieldUploading(fieldPath, status === 'uploading')
520
+ }
521
+ )
515
522
 
516
523
  // Check for upload errors
517
524
  if (!uploadResult.allSucceeded) {
@@ -49,6 +49,7 @@ export * from './stopwatch-icon.js'
49
49
  export * from './success-icon.js'
50
50
  export * from './user-icon.js'
51
51
  export * from './users-icon.js'
52
+ export * from './video-icon.js'
52
53
  export * from './wallet-icon.js'
53
54
  export * from './warning-icon.js'
54
55
  export * from './x-icon.js'
@@ -0,0 +1,32 @@
1
+ import type React from 'react'
2
+
3
+ import cx from 'classnames'
4
+
5
+ import { IconElement } from './icon-element.js'
6
+ import styles from './icons.module.css'
7
+ import type { IconProps } from './types/icon.js'
8
+
9
+ export const VideoIcon = ({ className, svgClassName, ...rest }: IconProps): React.JSX.Element => {
10
+ const applied = cx(styles['fill-none'], styles['stroke-current'], svgClassName)
11
+
12
+ return (
13
+ <IconElement className={cx('video-icon', className)} {...rest}>
14
+ <svg
15
+ className={applied}
16
+ xmlns="http://www.w3.org/2000/svg"
17
+ focusable="false"
18
+ aria-hidden="true"
19
+ viewBox="0 0 24 24"
20
+ strokeWidth="1.5"
21
+ strokeLinecap="round"
22
+ strokeLinejoin="round"
23
+ >
24
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
25
+ <path d="M15 10l4.553 -2.276a1 1 0 0 1 1.447 .894v6.764a1 1 0 0 1 -1.447 .894l-4.553 -2.276v-4z" />
26
+ <path d="M3 6m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z" />
27
+ </svg>
28
+ </IconElement>
29
+ )
30
+ }
31
+
32
+ VideoIcon.displayName = 'VideoIcon'
package/src/react.ts CHANGED
@@ -49,6 +49,7 @@ export * from './fields/draggable-context-menu.js'
49
49
  export * from './fields/field-helpers.js'
50
50
  export * from './fields/field-renderer.js'
51
51
  export * from './fields/file/file-field.js'
52
+ export * from './fields/file/file-upload-field.js'
52
53
  export * from './fields/group/group-field.js'
53
54
  export * from './fields/image/image-field.js'
54
55
  export * from './fields/image/image-upload-field.js'