@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,245 +0,0 @@
1
- :is(.form-MVxxVb, .byline-form) {
2
- flex-direction: column;
3
- width: 100%;
4
- display: flex;
5
- }
6
-
7
- :is(.heading-row-qw_UYh, .byline-form-heading-row) {
8
- align-items: start;
9
- gap: .25rem var(--spacing-16);
10
- margin-bottom: var(--spacing-8);
11
- grid-template-columns: 1fr;
12
- display: grid;
13
- }
14
-
15
- @media (min-width: 40rem) {
16
- :is(.heading-row-qw_UYh, .byline-form-heading-row) {
17
- grid-template-columns: 1fr auto;
18
- }
19
- }
20
-
21
- :is(.heading-wnLlb_, .byline-form-heading) {
22
- margin-bottom: 0;
23
- font-size: 1.75rem;
24
- }
25
-
26
- :is(.status-bar-kQCXLT, .byline-form-status-bar) {
27
- z-index: 20;
28
- align-items: start;
29
- gap: .25rem var(--spacing-16);
30
- padding: var(--spacing-8);
31
- border: var(--border-width-thin) var(--border-style-solid) var(--gray-100);
32
- border-radius: var(--border-radius-sm);
33
- background-color: var(--canvas-25);
34
- grid-template-columns: 1fr;
35
- margin-bottom: .25rem;
36
- display: grid;
37
- position: sticky;
38
- top: 45px;
39
- }
40
-
41
- @media (min-width: 40rem) {
42
- :is(.status-bar-kQCXLT, .byline-form-status-bar) {
43
- grid-template-columns: 1fr auto;
44
- }
45
- }
46
-
47
- @media (min-width: 66rem) {
48
- :is(.status-bar-kQCXLT, .byline-form-status-bar) {
49
- margin-bottom: 0;
50
- }
51
- }
52
-
53
- :is(.status-XbhkJR, .byline-form-status) {
54
- flex-direction: column;
55
- justify-content: center;
56
- height: 100%;
57
- display: flex;
58
- }
59
-
60
- :is(.status-meta-gppNXX, .byline-form-status-meta) {
61
- flex-direction: column;
62
- font-size: .8rem;
63
- line-height: 1.25;
64
- display: flex;
65
- }
66
-
67
- @media (min-width: 48rem) {
68
- :is(.status-meta-gppNXX, .byline-form-status-meta) {
69
- margin-bottom: .25rem;
70
- line-height: .75rem;
71
- }
72
- }
73
-
74
- @media (min-width: 66rem) {
75
- :is(.status-meta-gppNXX, .byline-form-status-meta) {
76
- flex-direction: row;
77
- align-items: center;
78
- }
79
- }
80
-
81
- @media (min-width: 40rem) {
82
- :is(.status-meta-gppNXX, .byline-form-status-meta) {
83
- gap: var(--spacing-8);
84
- }
85
- }
86
-
87
- :is(.status-cell-Tr3QHl, .byline-form-status-cell) {
88
- align-items: center;
89
- gap: .25rem;
90
- min-width: 0;
91
- display: flex;
92
- }
93
-
94
- :is(.status-muted-vHn34O, .byline-form-status-muted) {
95
- color: var(--gray-500);
96
- flex-shrink: 0;
97
- }
98
-
99
- :is(.status-trunc-jGiHWf, .byline-form-status-trunc) {
100
- text-overflow: ellipsis;
101
- white-space: nowrap;
102
- overflow: hidden;
103
- }
104
-
105
- :is(.status-published-hqosWb, .byline-form-status-published) {
106
- font-size: .8rem;
107
- line-height: 1rem;
108
- display: inline;
109
- }
110
-
111
- @media (min-width: 48rem) {
112
- :is(.status-published-hqosWb, .byline-form-status-published) {
113
- line-height: .875rem;
114
- }
115
- }
116
-
117
- :is(.status-unpublish-DiCNI0, .byline-form-status-unpublish) {
118
- color: inherit;
119
- cursor: pointer;
120
- background: none;
121
- border: none;
122
- padding: 0;
123
- font-size: .8rem;
124
- text-decoration: underline;
125
- }
126
-
127
- :is(.actions-AZBIdR, .byline-form-actions) {
128
- align-items: center;
129
- gap: var(--spacing-8);
130
- display: flex;
131
- }
132
-
133
- :is(.actions-button-VIwbST, .byline-form-actions-button) {
134
- min-width: 70px;
135
- min-height: 28px;
136
- }
137
-
138
- :is(.actions-status-wrap-hSvlps, .byline-form-actions-status-wrap) {
139
- z-index: 10;
140
- position: relative;
141
- }
142
-
143
- :is(.actions-combo-button-XvqHCC, .byline-form-actions-combo-button) {
144
- min-width: 100px;
145
- min-height: 28px;
146
- }
147
-
148
- :is(.actions-combo-trigger-bmXUzc, .byline-form-actions-combo-trigger) {
149
- min-height: 28px;
150
- }
151
-
152
- :is(.layout-WTbLYr, .byline-form-layout) {
153
- gap: var(--spacing-12);
154
- padding-top: var(--spacing-32);
155
- flex-direction: column;
156
- display: flex;
157
- }
158
-
159
- @media (min-width: 60rem) {
160
- :is(.layout-WTbLYr, .byline-form-layout) {
161
- gap: var(--spacing-32);
162
- grid-column-gap: 36px;
163
- grid-template-columns: minmax(0, 1fr) .4fr;
164
- align-items: start;
165
- display: grid;
166
- }
167
- }
168
-
169
- :is(.content-_P5cdJ, .byline-form-content) {
170
- gap: var(--spacing-20);
171
- flex-direction: column;
172
- max-width: 100%;
173
- margin-bottom: 2.75rem;
174
- display: flex;
175
- }
176
-
177
- @media (min-width: 60rem) {
178
- :is(.content-_P5cdJ, .byline-form-content) {
179
- margin-bottom: 3.75rem;
180
- }
181
- }
182
-
183
- :is(.sidebar-WsxX88, .byline-form-sidebar) {
184
- gap: var(--spacing-20);
185
- background-color: oklch(from var(--canvas-50) l c h / .2);
186
- flex-direction: column;
187
- max-width: 100%;
188
- margin-top: 0;
189
- margin-bottom: 4rem;
190
- display: flex;
191
- }
192
-
193
- @media (min-width: 60rem) {
194
- :is(.sidebar-WsxX88, .byline-form-sidebar) {
195
- padding-top: .25rem;
196
- padding-right: 12px;
197
- padding-left: var(--spacing-16);
198
- border-left: var(--border-width-thin) var(--border-style-solid) var(--gray-100);
199
- margin-bottom: 0;
200
- position: sticky;
201
- top: 95px;
202
- }
203
- }
204
-
205
- :is(.tabset-xfaMkP, .byline-form-tabset) {
206
- gap: var(--spacing-20);
207
- flex-direction: column;
208
- display: flex;
209
- }
210
-
211
- :is(.tabset-tabs-jZpqd_, .byline-form-tabset-tabs) {
212
- margin-top: -1rem;
213
- margin-bottom: 0;
214
- }
215
-
216
- :is(.tabset-fields-JJefdw, .byline-form-tabset-fields) {
217
- gap: var(--spacing-20);
218
- flex-direction: column;
219
- display: flex;
220
- }
221
-
222
- :is(.guard-modal-head-r2TApi, .byline-form-guard-modal-head) {
223
- margin-bottom: var(--spacing-8);
224
- padding-top: 1rem;
225
- }
226
-
227
- :is(.guard-modal-title-p9dFJ9, .byline-form-guard-modal-title) {
228
- margin: 0 0 var(--spacing-8) 0;
229
- font-size: var(--font-size-2xl);
230
- }
231
-
232
- :is(.guard-modal-text-uW56HS, .byline-form-guard-modal-text) {
233
- font-size: var(--font-size-sm);
234
- }
235
-
236
- :is(:is([data-theme="dark"], .dark) .status-bar-kQCXLT, :is([data-theme="dark"], .dark) .byline-form-status-bar) {
237
- background-color: var(--canvas-800);
238
- border: var(--border-width-thin) var(--border-style-solid) var(--gray-700);
239
- }
240
-
241
- :is(:is([data-theme="dark"], .dark) .sidebar-WsxX88, :is([data-theme="dark"], .dark) .byline-form-sidebar) {
242
- border-left-color: var(--gray-800);
243
- background-color: var(--canvas-900);
244
- }
245
-
@@ -1,54 +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
- /** The result returned by a `UseNavigationGuard` hook. */
9
- export interface NavigationGuardResult {
10
- /** Whether a navigation attempt is currently being blocked (show confirmation UI). */
11
- isBlocked: boolean;
12
- /** Cancel the pending navigation — stay on the current page. */
13
- stay: () => void;
14
- /** Confirm the pending navigation — leave the page. */
15
- proceed: () => void;
16
- }
17
- /**
18
- * A hook that blocks in-app navigation and (optionally) browser unload when
19
- * `shouldBlock` is `true`.
20
- *
21
- * Each framework adapter implements this signature.
22
- */
23
- export type UseNavigationGuard = (shouldBlock: boolean) => NavigationGuardResult;
24
- /**
25
- * Fallback navigation guard that only handles the browser's native
26
- * `beforeunload` event. In-app (client-side) route changes are **not**
27
- * intercepted — `isBlocked` will never become `true`.
28
- *
29
- * This is used when no framework-specific adapter has been provided.
30
- */
31
- export declare const useBeforeUnloadGuard: UseNavigationGuard;
32
- /**
33
- * Provide a framework-specific `UseNavigationGuard` hook to all descendant
34
- * `FormRenderer` instances.
35
- *
36
- * ```tsx
37
- * import { NavigationGuardProvider } from './navigation-guard'
38
- * import { useTanStackNavigationGuard } from './tanstack-navigation-guard'
39
- *
40
- * function App() {
41
- * return (
42
- * <NavigationGuardProvider value={useTanStackNavigationGuard}>
43
- * <Outlet />
44
- * </NavigationGuardProvider>
45
- * )
46
- * }
47
- * ```
48
- */
49
- export declare const NavigationGuardProvider: import("react").Provider<UseNavigationGuard>;
50
- /**
51
- * Consume the current `UseNavigationGuard` hook from context.
52
- * Falls back to `useBeforeUnloadGuard` when no provider is present.
53
- */
54
- export declare const useNavigationGuardAdapter: () => UseNavigationGuard;
@@ -1,22 +0,0 @@
1
- import { createContext, useContext, useEffect } from "react";
2
- const useBeforeUnloadGuard = (shouldBlock)=>{
3
- useEffect(()=>{
4
- if (!shouldBlock) return;
5
- const handler = (e)=>{
6
- e.preventDefault();
7
- };
8
- window.addEventListener('beforeunload', handler);
9
- return ()=>window.removeEventListener('beforeunload', handler);
10
- }, [
11
- shouldBlock
12
- ]);
13
- return {
14
- isBlocked: false,
15
- stay: ()=>{},
16
- proceed: ()=>{}
17
- };
18
- };
19
- const NavigationGuardContext = /*#__PURE__*/ createContext(useBeforeUnloadGuard);
20
- const NavigationGuardProvider = NavigationGuardContext.Provider;
21
- const useNavigationGuardAdapter = ()=>useContext(NavigationGuardContext);
22
- export { NavigationGuardProvider, useBeforeUnloadGuard, useNavigationGuardAdapter };
@@ -1,36 +0,0 @@
1
- export interface PathWidgetProps {
2
- /** The collection's `useAsPath` source field name, when configured. */
3
- useAsPath: string | undefined;
4
- /** Collection path, forwarded to the slugifier as context. */
5
- collectionPath: string;
6
- /** Default content locale, forwarded to the slugifier as context. */
7
- defaultLocale: string;
8
- /**
9
- * The locale currently being edited in the form. When this differs
10
- * from `defaultLocale` (i.e. the editor is editing a translation),
11
- * the widget renders read-only — phase 1 paths are default-locale
12
- * territory, and the lifecycle drops translation-locale path changes
13
- * with a warn. Locking the input prevents the warn path being hit
14
- * through the admin form and gives editors a clear cue.
15
- */
16
- activeLocale: string;
17
- /** `'create'` shows the live derived preview as placeholder text. */
18
- mode: 'create' | 'edit';
19
- }
20
- /**
21
- * System-managed `path` widget.
22
- *
23
- * Edits the path stored in `byline_document_paths` for the current
24
- * (document, locale) row. Displays the current persisted/overridden
25
- * value as an editable input.
26
- * In create mode, when the user hasn't supplied an override, the input
27
- * shows the live-derived preview (slugified `useAsPath` source field) as
28
- * a placeholder so the user sees what will be saved. The "Regenerate"
29
- * action explicitly writes the current live preview into the override
30
- * slot so the user can re-anchor a path against the source field after
31
- * editing the title.
32
- *
33
- * Stable override handles: `.byline-form-path`, `.byline-form-path-header`,
34
- * `.byline-form-path-regenerate`.
35
- */
36
- export declare const PathWidget: ({ useAsPath, collectionPath, defaultLocale, activeLocale, mode, }: PathWidgetProps) => import("react").JSX.Element;
@@ -1,107 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useCallback, useMemo } from "react";
4
- import { slugify } from "@byline/core";
5
- import classnames from "classnames";
6
- import { Input, Label } from "../uikit.js";
7
- import { useFieldValue, useFormContext, useSystemPath } from "./form-context.js";
8
- import path_widget_module from "./path-widget.module.js";
9
- function coerceToString(value) {
10
- if (null == value) return '';
11
- if (value instanceof Date) return value.toISOString();
12
- return String(value);
13
- }
14
- const PathWidget = ({ useAsPath, collectionPath, defaultLocale, activeLocale, mode })=>{
15
- const { setSystemPath } = useFormContext();
16
- const systemPath = useSystemPath();
17
- const sourceValue = useFieldValue(useAsPath ?? '');
18
- const isReadOnly = activeLocale !== defaultLocale;
19
- const livePreview = useMemo(()=>{
20
- if (!useAsPath) return '';
21
- const asString = coerceToString(sourceValue);
22
- if (0 === asString.length) return '';
23
- return slugify(asString, {
24
- locale: defaultLocale,
25
- collectionPath
26
- });
27
- }, [
28
- useAsPath,
29
- sourceValue,
30
- defaultLocale,
31
- collectionPath
32
- ]);
33
- const inputValue = systemPath ?? '';
34
- const handleChange = useCallback((next)=>{
35
- setSystemPath(0 === next.length ? null : next);
36
- }, [
37
- setSystemPath
38
- ]);
39
- const handleRegenerate = useCallback(()=>{
40
- if (livePreview.length > 0) setSystemPath(livePreview);
41
- }, [
42
- livePreview,
43
- setSystemPath
44
- ]);
45
- const formatted = useMemo(()=>{
46
- if (0 === inputValue.length) return '';
47
- return slugify(inputValue, {
48
- locale: defaultLocale,
49
- collectionPath
50
- });
51
- }, [
52
- inputValue,
53
- defaultLocale,
54
- collectionPath
55
- ]);
56
- const validationHint = inputValue.length > 0 && formatted !== inputValue ? `Suggested: "${formatted}"` : void 0;
57
- const readOnlyHint = isReadOnly ? `Path is set in the default locale ("${defaultLocale}") and applies across translations.` : void 0;
58
- const hint = readOnlyHint ?? validationHint;
59
- const placeholder = !isReadOnly && 'create' === mode && livePreview.length > 0 ? `Will be saved as "${livePreview}"` : void 0;
60
- const srDescription = [
61
- 'System-managed URL path for this document.',
62
- placeholder,
63
- hint
64
- ].filter(Boolean).join(' ');
65
- const showRegenerate = !isReadOnly && useAsPath && livePreview.length > 0 && livePreview !== systemPath;
66
- return /*#__PURE__*/ jsxs("div", {
67
- className: "byline-form-path",
68
- children: [
69
- /*#__PURE__*/ jsxs("div", {
70
- className: classnames('byline-form-path-header', path_widget_module.header),
71
- children: [
72
- /*#__PURE__*/ jsx(Label, {
73
- id: "system-path-label",
74
- htmlFor: "system-path",
75
- label: "Path"
76
- }),
77
- showRegenerate && /*#__PURE__*/ jsxs("button", {
78
- type: "button",
79
- onClick: handleRegenerate,
80
- className: classnames('byline-form-path-regenerate', path_widget_module.regenerate),
81
- "aria-label": `Regenerate path from ${useAsPath} field`,
82
- children: [
83
- "Regenerate from ",
84
- useAsPath
85
- ]
86
- })
87
- ]
88
- }),
89
- /*#__PURE__*/ jsx(Input, {
90
- id: "system-path",
91
- name: "__systemPath__",
92
- value: inputValue,
93
- placeholder: placeholder,
94
- onChange: (e)=>handleChange(e.target.value),
95
- helpText: hint,
96
- readOnly: isReadOnly,
97
- "aria-describedby": "system-path-description"
98
- }),
99
- /*#__PURE__*/ jsx("span", {
100
- id: "system-path-description",
101
- className: classnames('byline-form-path-sr-only', path_widget_module["sr-only"]),
102
- children: srDescription
103
- })
104
- ]
105
- });
106
- };
107
- export { PathWidget };
@@ -1,8 +0,0 @@
1
- import "./path-widget_module.css";
2
- const path_widget_module = {
3
- header: "header-mJ5Fde",
4
- regenerate: "regenerate-P5Mdye",
5
- "sr-only": "sr-only-feJgAM",
6
- srOnly: "sr-only-feJgAM"
7
- };
8
- export default path_widget_module;
@@ -1,29 +0,0 @@
1
- :is(.header-mJ5Fde, .byline-form-path-header) {
2
- justify-content: space-between;
3
- align-items: center;
4
- gap: var(--spacing-8);
5
- display: flex;
6
- }
7
-
8
- :is(.regenerate-P5Mdye, .byline-form-path-regenerate) {
9
- color: inherit;
10
- cursor: pointer;
11
- background: none;
12
- border: none;
13
- padding: 0;
14
- font-size: .8rem;
15
- text-decoration: underline;
16
- }
17
-
18
- :is(.sr-only-feJgAM, .byline-form-path-sr-only) {
19
- clip: rect(0, 0, 0, 0);
20
- white-space: nowrap;
21
- border: 0;
22
- width: 1px;
23
- height: 1px;
24
- margin: -1px;
25
- padding: 0;
26
- position: absolute;
27
- overflow: hidden;
28
- }
29
-
@@ -1,57 +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
- * Upload Executor
10
- *
11
- * Handles batch execution of pending file uploads at form submission time.
12
- * This enables "deferred uploads" — files are selected/previewed immediately
13
- * but only uploaded when the user clicks Save.
14
- */
15
- import type { StoredFileValue } from '@byline/core';
16
- import type { UploadFieldFn } from '../services/field-services-types';
17
- import type { PendingUpload } from './form-context';
18
- export interface UploadResult {
19
- fieldPath: string;
20
- success: boolean;
21
- storedFile?: StoredFileValue;
22
- error?: string;
23
- }
24
- export interface ExecuteUploadsResult {
25
- /** All upload results (both successful and failed) */
26
- results: UploadResult[];
27
- /** Map of field path to StoredFileValue for successful uploads */
28
- successful: Map<string, StoredFileValue>;
29
- /** Map of field path to error message for failed uploads */
30
- errors: Map<string, string>;
31
- /** Whether all uploads succeeded */
32
- allSucceeded: boolean;
33
- }
34
- /**
35
- * Execute all pending uploads sequentially.
36
- * Returns a result object with successful uploads and any errors.
37
- *
38
- * @param pendingUploads - Map of field path to PendingUpload
39
- * @param uploadField - Host-provided upload transport (resolved via
40
- * `useBylineFieldServices()` in the calling React tree)
41
- * @returns Promise resolving to ExecuteUploadsResult
42
- */
43
- export declare function executeUploads(pendingUploads: Map<string, PendingUpload>, uploadField: UploadFieldFn): Promise<ExecuteUploadsResult>;
44
- /**
45
- * Progress callback type for upload execution with progress tracking.
46
- */
47
- export type UploadProgressCallback = (info: {
48
- current: number;
49
- total: number;
50
- fieldPath: string;
51
- status: 'uploading' | 'done' | 'error';
52
- }) => void;
53
- /**
54
- * Execute uploads with progress callbacks.
55
- * Useful for showing upload progress in the UI.
56
- */
57
- export declare function executeUploadsWithProgress(pendingUploads: Map<string, PendingUpload>, uploadField: UploadFieldFn, onProgress?: UploadProgressCallback): Promise<ExecuteUploadsResult>;
@@ -1,92 +0,0 @@
1
- async function executeUploads(pendingUploads, uploadField) {
2
- const results = [];
3
- const successful = new Map();
4
- const errors = new Map();
5
- for (const [fieldPath, upload] of pendingUploads.entries()){
6
- const formData = new FormData();
7
- formData.append('file', upload.file);
8
- formData.append('field', uploadFieldName(fieldPath));
9
- try {
10
- const result = await uploadField(upload.collectionPath, formData, false);
11
- results.push({
12
- fieldPath,
13
- success: true,
14
- storedFile: result.storedFile
15
- });
16
- successful.set(fieldPath, result.storedFile);
17
- } catch (err) {
18
- const message = err instanceof Error ? err.message : 'Upload failed';
19
- results.push({
20
- fieldPath,
21
- success: false,
22
- error: message
23
- });
24
- errors.set(fieldPath, message);
25
- }
26
- }
27
- return {
28
- results,
29
- successful,
30
- errors,
31
- allSucceeded: 0 === errors.size
32
- };
33
- }
34
- function uploadFieldName(fieldPath) {
35
- const dot = fieldPath.lastIndexOf('.');
36
- return -1 === dot ? fieldPath : fieldPath.slice(dot + 1);
37
- }
38
- async function executeUploadsWithProgress(pendingUploads, uploadField, onProgress) {
39
- const results = [];
40
- const successful = new Map();
41
- const errors = new Map();
42
- const entries = Array.from(pendingUploads.entries());
43
- const total = entries.length;
44
- for(let i = 0; i < entries.length; i++){
45
- const [fieldPath, upload] = entries[i];
46
- onProgress?.({
47
- current: i + 1,
48
- total,
49
- fieldPath,
50
- status: 'uploading'
51
- });
52
- const formData = new FormData();
53
- formData.append('file', upload.file);
54
- formData.append('field', uploadFieldName(fieldPath));
55
- try {
56
- const result = await uploadField(upload.collectionPath, formData, false);
57
- results.push({
58
- fieldPath,
59
- success: true,
60
- storedFile: result.storedFile
61
- });
62
- successful.set(fieldPath, result.storedFile);
63
- onProgress?.({
64
- current: i + 1,
65
- total,
66
- fieldPath,
67
- status: 'done'
68
- });
69
- } catch (err) {
70
- const message = err instanceof Error ? err.message : 'Upload failed';
71
- results.push({
72
- fieldPath,
73
- success: false,
74
- error: message
75
- });
76
- errors.set(fieldPath, message);
77
- onProgress?.({
78
- current: i + 1,
79
- total,
80
- fieldPath,
81
- status: 'error'
82
- });
83
- }
84
- }
85
- return {
86
- results,
87
- successful,
88
- errors,
89
- allSucceeded: 0 === errors.size
90
- };
91
- }
92
- export { executeUploads, executeUploadsWithProgress };
@@ -1,16 +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 ReactNode } from 'react';
9
- import type { BylineFieldServices } from './field-services-types';
10
- interface BylineFieldServicesProviderProps {
11
- services: BylineFieldServices;
12
- children: ReactNode;
13
- }
14
- export declare const BylineFieldServicesProvider: ({ services, children, }: BylineFieldServicesProviderProps) => import("react").JSX.Element;
15
- export declare const useBylineFieldServices: () => BylineFieldServices;
16
- export {};
@@ -1,13 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { createContext, useContext } from "react";
3
- const FieldServicesContext = /*#__PURE__*/ createContext(null);
4
- const BylineFieldServicesProvider = ({ services, children })=>/*#__PURE__*/ jsx(FieldServicesContext.Provider, {
5
- value: services,
6
- children: children
7
- });
8
- const useBylineFieldServices = ()=>{
9
- const ctx = useContext(FieldServicesContext);
10
- if (!ctx) throw new Error('@byline/ui: BylineFieldServicesProvider missing. Wrap your admin tree with <BylineFieldServicesProvider services={…} />.');
11
- return ctx;
12
- };
13
- export { BylineFieldServicesProvider, useBylineFieldServices };