@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,20 +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 { ColumnFormatter, FormatterProps } from '@byline/core';
9
- /**
10
- * Type guard: returns true when the formatter is a `{ component }` wrapper
11
- * rather than a plain function.
12
- */
13
- export declare function isComponentFormatter<T>(fmt: ColumnFormatter<T>): fmt is {
14
- component: (props: FormatterProps<T>) => any;
15
- };
16
- /**
17
- * Render a cell value through its column formatter (if any).
18
- * Handles both plain-function and `{ component }` formatters.
19
- */
20
- export declare function renderFormatted(value: any, document: any, formatter: ColumnFormatter): any;
@@ -1,15 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- function isComponentFormatter(fmt) {
3
- return 'object' == typeof fmt && null !== fmt && 'component' in fmt;
4
- }
5
- function renderFormatted(value, document, formatter) {
6
- if (isComponentFormatter(formatter)) {
7
- const Component = formatter.component;
8
- return /*#__PURE__*/ jsx(Component, {
9
- value: value,
10
- record: document
11
- });
12
- }
13
- return formatter(value, document);
14
- }
15
- export { isComponentFormatter, renderFormatted };
@@ -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 { FormatterProps } from '@byline/core';
9
- /**
10
- * SSR-safe date-time column formatter for list views.
11
- *
12
- * Uses the `LocalDateTime` component which renders a placeholder on the server
13
- * and formats to the user's locale/timezone after hydration, avoiding
14
- * server/client mismatches.
15
- */
16
- export declare function DateTimeFormatter({ value }: FormatterProps): import("react").JSX.Element;
@@ -1,8 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { LocalDateTime } from "./local-date-time.js";
3
- function DateTimeFormatter({ value }) {
4
- return /*#__PURE__*/ jsx(LocalDateTime, {
5
- value: value
6
- });
7
- }
8
- export { DateTimeFormatter };
@@ -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 { DateTimeField as FieldType } from '@byline/core';
9
- export declare const DateTimeField: ({ field, value, defaultValue, onChange, id, path, }: {
10
- field: FieldType;
11
- value?: Date | null;
12
- defaultValue?: Date | null;
13
- onChange?: (value: Date | null) => void;
14
- id?: string;
15
- path?: string;
16
- }) => import("react").JSX.Element;
@@ -1,37 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import classnames from "classnames";
3
- import { useFieldError, useFieldValue, useIsDirty } from "../../forms/form-context.js";
4
- import { DatePicker, ErrorText } from "../../uikit.js";
5
- import datetime_field_module from "./datetime-field.module.js";
6
- const DateTimeField = ({ field, value, defaultValue, onChange, id, path })=>{
7
- const fieldPath = path ?? field.name;
8
- const fieldError = useFieldError(fieldPath);
9
- const isDirty = useIsDirty(fieldPath);
10
- const fieldValue = useFieldValue(fieldPath);
11
- const incomingValue = value ?? fieldValue ?? defaultValue ?? null;
12
- return /*#__PURE__*/ jsxs("div", {
13
- className: `byline-field-datetime ${field.name}`,
14
- children: [
15
- /*#__PURE__*/ jsx(DatePicker, {
16
- id: id ?? fieldPath,
17
- name: field.name,
18
- label: field.label,
19
- required: !field.optional,
20
- initialValue: incomingValue,
21
- mode: field.mode || 'datetime',
22
- yearsInFuture: field.yearsInFuture || 1,
23
- yearsInPast: field.yearsInPast || 10,
24
- onDateChange: (date)=>onChange?.(date),
25
- className: classnames(isDirty && [
26
- 'byline-field-datetime-dirty',
27
- datetime_field_module.dirty
28
- ])
29
- }),
30
- fieldError && /*#__PURE__*/ jsx(ErrorText, {
31
- id: `${field.name}-error`,
32
- text: fieldError
33
- })
34
- ]
35
- });
36
- };
37
- export { DateTimeField };
@@ -1,5 +0,0 @@
1
- import "./datetime-field_module.css";
2
- const datetime_field_module = {
3
- dirty: "dirty-cC4ARG"
4
- };
5
- export default datetime_field_module;
@@ -1,4 +0,0 @@
1
- :is(.dirty-cC4ARG, .byline-field-datetime-dirty) {
2
- border-color: var(--blue-300);
3
- }
4
-
@@ -1,6 +0,0 @@
1
- interface DraggableContextMenuProps {
2
- onAddBelow?: () => void;
3
- onRemove?: () => void;
4
- }
5
- export declare function DraggableContextMenu({ onAddBelow, onRemove, }: DraggableContextMenuProps): React.JSX.Element;
6
- export {};
@@ -1,83 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import classnames from "classnames";
4
- import { DeleteIcon, Dropdown, EllipsisIcon, IconButton, PlusIcon } from "../uikit.js";
5
- import draggable_context_menu_module from "./draggable-context-menu.module.js";
6
- function DraggableContextMenu({ onAddBelow, onRemove }) {
7
- const itemClass = classnames('byline-draggable-menu-item', draggable_context_menu_module.item);
8
- const rowClass = classnames('byline-draggable-menu-row', draggable_context_menu_module.row);
9
- const iconSlotClass = classnames('byline-draggable-menu-icon-slot', draggable_context_menu_module["icon-slot"]);
10
- const labelClass = classnames('byline-draggable-menu-label', draggable_context_menu_module.label);
11
- return /*#__PURE__*/ jsxs(Dropdown.Root, {
12
- modal: false,
13
- children: [
14
- /*#__PURE__*/ jsx(Dropdown.Trigger, {
15
- render: /*#__PURE__*/ jsx(IconButton, {
16
- variant: "text",
17
- size: "sm"
18
- }),
19
- children: /*#__PURE__*/ jsx(EllipsisIcon, {
20
- width: "16px",
21
- height: "16px"
22
- })
23
- }),
24
- /*#__PURE__*/ jsx(Dropdown.Portal, {
25
- children: /*#__PURE__*/ jsxs(Dropdown.Content, {
26
- align: "end",
27
- sideOffset: 0,
28
- className: classnames('byline-draggable-menu', draggable_context_menu_module.menu),
29
- children: [
30
- /*#__PURE__*/ jsx(Dropdown.Item, {
31
- className: itemClass,
32
- onClick: onAddBelow,
33
- children: /*#__PURE__*/ jsxs("div", {
34
- className: rowClass,
35
- children: [
36
- /*#__PURE__*/ jsx("span", {
37
- className: iconSlotClass,
38
- children: /*#__PURE__*/ jsx(PlusIcon, {
39
- width: "18px",
40
- height: "18px"
41
- })
42
- }),
43
- /*#__PURE__*/ jsx("span", {
44
- className: labelClass,
45
- children: "Add Below"
46
- })
47
- ]
48
- })
49
- }),
50
- /*#__PURE__*/ jsx(Dropdown.Separator, {
51
- className: classnames('byline-draggable-menu-separator', draggable_context_menu_module.separator)
52
- }),
53
- /*#__PURE__*/ jsx(Dropdown.Item, {
54
- className: itemClass,
55
- onClick: onRemove,
56
- children: /*#__PURE__*/ jsx("div", {
57
- className: rowClass,
58
- children: /*#__PURE__*/ jsxs("div", {
59
- className: rowClass,
60
- children: [
61
- /*#__PURE__*/ jsx("span", {
62
- className: iconSlotClass,
63
- children: /*#__PURE__*/ jsx(DeleteIcon, {
64
- width: "18px",
65
- height: "18px",
66
- svgClassName: classnames('byline-draggable-menu-delete-icon', draggable_context_menu_module["delete-icon"])
67
- })
68
- }),
69
- /*#__PURE__*/ jsx("span", {
70
- className: classnames('byline-draggable-menu-label byline-draggable-menu-label-danger', draggable_context_menu_module.label, draggable_context_menu_module["label-danger"]),
71
- children: "Remove"
72
- })
73
- ]
74
- })
75
- })
76
- })
77
- ]
78
- })
79
- })
80
- ]
81
- });
82
- }
83
- export { DraggableContextMenu };
@@ -1,15 +0,0 @@
1
- import "./draggable-context-menu_module.css";
2
- const draggable_context_menu_module = {
3
- menu: "menu-AK92L8",
4
- item: "item-cZy6je",
5
- row: "row-IT7owe",
6
- "icon-slot": "icon-slot-eFcN9X",
7
- iconSlot: "icon-slot-eFcN9X",
8
- label: "label-FpWNo3",
9
- "label-danger": "label-danger-QfUDsA",
10
- labelDanger: "label-danger-QfUDsA",
11
- "delete-icon": "delete-icon-VR2oJo",
12
- deleteIcon: "delete-icon-VR2oJo",
13
- separator: "separator-wdzZsH"
14
- };
15
- export default draggable_context_menu_module;
@@ -1,91 +0,0 @@
1
- :is(.menu-AK92L8, .byline-draggable-menu) {
2
- z-index: 40;
3
- border: var(--border-width-thin) var(--border-style-solid) var(--gray-200);
4
- border-radius: var(--border-radius-sm);
5
- background-color: #fff;
6
- width: 8.5rem;
7
- padding: .25rem .375rem;
8
- box-shadow: 0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a;
9
- }
10
-
11
- :is(.item-cZy6je, .byline-draggable-menu-item) {
12
- border-radius: var(--border-radius-sm);
13
- width: 100%;
14
- color: var(--gray-600);
15
- cursor: default;
16
- -webkit-user-select: none;
17
- user-select: none;
18
- outline: none;
19
- align-items: center;
20
- gap: .25rem;
21
- padding: 5px 2px;
22
- display: flex;
23
- }
24
-
25
- @media (min-width: 48rem) {
26
- :is(.item-cZy6je, .byline-draggable-menu-item) {
27
- font-size: var(--font-size-sm);
28
- }
29
- }
30
-
31
- :is(.item-cZy6je:hover, .item-cZy6je:focus, .byline-draggable-menu-item:hover, .byline-draggable-menu-item:focus) {
32
- background-color: oklch(from var(--canvas-50) l c h / .3);
33
- }
34
-
35
- :is(.row-IT7owe, .byline-draggable-menu-row) {
36
- align-items: center;
37
- gap: .25rem;
38
- width: 100%;
39
- display: flex;
40
- }
41
-
42
- :is(.icon-slot-eFcN9X, .byline-draggable-menu-icon-slot) {
43
- width: 22px;
44
- display: inline-block;
45
- }
46
-
47
- :is(.label-FpWNo3, .byline-draggable-menu-label) {
48
- text-align: left;
49
- color: #000;
50
- flex: 1;
51
- align-self: flex-start;
52
- width: 100%;
53
- display: inline-block;
54
- }
55
-
56
- :is(.label-danger-QfUDsA, .byline-draggable-menu-label-danger) {
57
- color: var(--red-600);
58
- }
59
-
60
- :is(.delete-icon-VR2oJo, .byline-draggable-menu-delete-icon) {
61
- stroke: var(--red-600);
62
- }
63
-
64
- :is(.separator-wdzZsH, .byline-draggable-menu-separator) {
65
- border: none;
66
- border-top: var(--border-width-thin) var(--border-style-solid) var(--gray-200);
67
- width: 90%;
68
- margin: .25rem auto;
69
- }
70
-
71
- :is(:is([data-theme="dark"], .dark) .menu-AK92L8, :is([data-theme="dark"], .dark) .byline-draggable-menu) {
72
- background-color: var(--canvas-800);
73
- border-color: var(--canvas-700);
74
- }
75
-
76
- :is(:is([data-theme="dark"], .dark) .item-cZy6je, :is([data-theme="dark"], .dark) .byline-draggable-menu-item) {
77
- color: var(--gray-300);
78
- }
79
-
80
- :is(:is([data-theme="dark"], .dark) .item-cZy6je:hover, :is([data-theme="dark"], .dark) .item-cZy6je:focus, :is([data-theme="dark"], .dark) .byline-draggable-menu-item:hover, :is([data-theme="dark"], .dark) .byline-draggable-menu-item:focus) {
81
- background-color: var(--canvas-900);
82
- }
83
-
84
- :is(:is([data-theme="dark"], .dark) .label-FpWNo3, :is([data-theme="dark"], .dark) .byline-draggable-menu-label) {
85
- color: var(--gray-300);
86
- }
87
-
88
- :is(:is([data-theme="dark"], .dark) .separator-wdzZsH, :is([data-theme="dark"], .dark) .byline-draggable-menu-separator) {
89
- border-top-color: var(--gray-900);
90
- }
91
-
@@ -1,26 +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 { Field } from '@byline/core';
9
- export declare const placeholderStoredFileValue: {
10
- fileId: `${string}-${string}-${string}-${string}-${string}`;
11
- filename: string;
12
- originalFilename: string;
13
- mimeType: string;
14
- fileSize: number;
15
- storageProvider: string;
16
- storagePath: string;
17
- storageUrl: null;
18
- fileHash: null;
19
- imageWidth: null;
20
- imageHeight: null;
21
- imageFormat: null;
22
- processingStatus: string;
23
- thumbnailGenerated: boolean;
24
- };
25
- export declare const placeholderForField: (f: Field) => any;
26
- export declare const defaultScalarForField: (f: Field, getFieldValues: () => Record<string, any>) => Promise<any>;
@@ -1,50 +0,0 @@
1
- import { resolveFieldDefaultValue } from "@byline/core";
2
- const placeholderStoredFileValue = {
3
- fileId: crypto.randomUUID(),
4
- filename: 'placeholder',
5
- originalFilename: 'placeholder',
6
- mimeType: 'application/octet-stream',
7
- fileSize: 0,
8
- storageProvider: 'placeholder',
9
- storagePath: 'pending',
10
- storageUrl: null,
11
- fileHash: null,
12
- imageWidth: null,
13
- imageHeight: null,
14
- imageFormat: null,
15
- processingStatus: 'pending',
16
- thumbnailGenerated: false
17
- };
18
- const placeholderForField = (f)=>{
19
- switch(f.type){
20
- case 'text':
21
- case 'textArea':
22
- return '';
23
- case 'checkbox':
24
- return false;
25
- case 'integer':
26
- return 0;
27
- case 'counter':
28
- return;
29
- case 'richText':
30
- case 'datetime':
31
- return;
32
- case 'select':
33
- return '';
34
- case 'file':
35
- case 'image':
36
- return placeholderStoredFileValue;
37
- default:
38
- return null;
39
- }
40
- };
41
- const defaultScalarForField = async (f, getFieldValues)=>{
42
- const schemaDefault = await resolveFieldDefaultValue(f, {
43
- data: getFieldValues(),
44
- now: ()=>new Date(),
45
- uuid: ()=>crypto.randomUUID()
46
- });
47
- if (void 0 !== schemaDefault) return schemaDefault;
48
- return placeholderForField(f);
49
- };
50
- export { defaultScalarForField, placeholderForField, placeholderStoredFileValue };
@@ -1,37 +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 { Field, FieldComponentSlots, RichTextEditorComponent } from '@byline/core';
9
- interface FieldRendererProps {
10
- field: Field;
11
- defaultValue?: any;
12
- basePath?: string;
13
- disableSorting?: boolean;
14
- hideLabel?: boolean;
15
- /** Collection path (e.g. `'media'`) forwarded to upload-capable fields. */
16
- collectionPath?: string;
17
- /**
18
- * The active content locale (e.g. `'en'`, `'fr'`). When provided and
19
- * `field.localized === true`, a small locale badge is shown so the editor
20
- * knows they are working on a localised field in the current language.
21
- */
22
- contentLocale?: string;
23
- /**
24
- * Optional UI component slot overrides from the admin config.
25
- * Forwarded to value-field widgets that support custom slots.
26
- */
27
- components?: FieldComponentSlots;
28
- /**
29
- * Per-field rich-text editor component override from the admin config.
30
- * Takes precedence over the globally registered
31
- * `ClientConfig.fields.richText.editor` for this single field.
32
- * Ignored when `field.type !== 'richText'`.
33
- */
34
- editor?: RichTextEditorComponent;
35
- }
36
- export declare const FieldRenderer: ({ field, defaultValue, basePath, disableSorting, hideLabel, collectionPath, contentLocale, components, editor, }: FieldRendererProps) => import("react").JSX.Element | null;
37
- export {};
@@ -1,206 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { getClientConfig } from "@byline/core";
3
- import classnames from "classnames";
4
- import { ArrayField } from "./array/array-field.js";
5
- import { BlocksField } from "./blocks/blocks-field.js";
6
- import { CheckboxField } from "./checkbox/checkbox-field.js";
7
- import { DateTimeField } from "./datetime/datetime-field.js";
8
- import field_renderer_module from "./field-renderer.module.js";
9
- import { FileField } from "./file/file-field.js";
10
- import { GroupField } from "./group/group-field.js";
11
- import { ImageField } from "./image/image-field.js";
12
- import { LocaleBadge } from "./locale-badge.js";
13
- import { NumericalField } from "./numerical/numerical-field.js";
14
- import { RelationField } from "./relation/relation-field.js";
15
- import { SelectField } from "./select/select-field.js";
16
- import { TextField } from "./text/text-field.js";
17
- import { TextAreaField } from "./text-area/text-area-field.js";
18
- import { useFieldChangeHandler } from "./use-field-change-handler.js";
19
- const FieldRenderer = ({ field, defaultValue, basePath, disableSorting, hideLabel, collectionPath, contentLocale, components, editor })=>{
20
- const path = basePath ? `${basePath}.${field.name}` : field.name;
21
- const htmlId = path.replace(/[[\].]/g, '-');
22
- const handleChange = useFieldChangeHandler(field, path);
23
- const isLocalised = true === field.localized;
24
- const badge = isLocalised && contentLocale && !hideLabel ? /*#__PURE__*/ jsx(LocaleBadge, {
25
- locale: contentLocale
26
- }) : null;
27
- const renderField = ()=>{
28
- switch(field.type){
29
- case 'text':
30
- return /*#__PURE__*/ jsx(TextField, {
31
- field: hideLabel ? {
32
- ...field,
33
- label: void 0
34
- } : field,
35
- defaultValue: defaultValue,
36
- onChange: handleChange,
37
- path: path,
38
- id: htmlId,
39
- locale: isLocalised ? contentLocale : void 0,
40
- components: components
41
- });
42
- case 'textArea':
43
- return /*#__PURE__*/ jsx(TextAreaField, {
44
- field: hideLabel ? {
45
- ...field,
46
- label: void 0
47
- } : field,
48
- defaultValue: defaultValue,
49
- onChange: handleChange,
50
- path: path,
51
- id: htmlId,
52
- locale: isLocalised ? contentLocale : void 0,
53
- components: components
54
- });
55
- case 'checkbox':
56
- return /*#__PURE__*/ jsx(CheckboxField, {
57
- field: hideLabel ? {
58
- ...field,
59
- label: void 0
60
- } : field,
61
- defaultValue: defaultValue,
62
- onChange: handleChange,
63
- path: path,
64
- id: htmlId
65
- });
66
- case 'select':
67
- return /*#__PURE__*/ jsx(SelectField, {
68
- field: hideLabel ? {
69
- ...field,
70
- label: void 0
71
- } : field,
72
- defaultValue: defaultValue,
73
- onChange: handleChange,
74
- path: path,
75
- id: htmlId
76
- });
77
- case 'richText':
78
- {
79
- const RichTextEditor = editor ?? getClientConfig().fields?.richText?.editor;
80
- if (!RichTextEditor) throw new Error("No richText editor registered. Install @byline/richtext-lexical and set `fields.richText.editor` in your admin config.");
81
- return /*#__PURE__*/ jsx(RichTextEditor, {
82
- field: hideLabel ? {
83
- ...field,
84
- label: void 0
85
- } : field,
86
- defaultValue: defaultValue,
87
- onChange: handleChange,
88
- path: path,
89
- instanceKey: htmlId,
90
- locale: isLocalised ? contentLocale : void 0
91
- });
92
- }
93
- case 'datetime':
94
- return /*#__PURE__*/ jsx(DateTimeField, {
95
- field: hideLabel ? {
96
- ...field,
97
- label: void 0
98
- } : field,
99
- defaultValue: defaultValue,
100
- onChange: handleChange,
101
- path: path,
102
- id: htmlId
103
- });
104
- case 'integer':
105
- return /*#__PURE__*/ jsx(NumericalField, {
106
- field: hideLabel ? {
107
- ...field,
108
- label: void 0
109
- } : field,
110
- defaultValue: defaultValue,
111
- onChange: handleChange,
112
- path: path,
113
- id: htmlId,
114
- components: components
115
- });
116
- case 'counter':
117
- return /*#__PURE__*/ jsx(NumericalField, {
118
- field: hideLabel ? {
119
- ...field,
120
- label: void 0,
121
- readOnly: true
122
- } : {
123
- ...field,
124
- readOnly: true
125
- },
126
- defaultValue: defaultValue,
127
- onChange: handleChange,
128
- path: path,
129
- id: htmlId,
130
- components: components
131
- });
132
- case 'file':
133
- return /*#__PURE__*/ jsx(FileField, {
134
- field: hideLabel ? {
135
- ...field,
136
- label: void 0
137
- } : field,
138
- defaultValue: defaultValue,
139
- onChange: handleChange,
140
- path: path,
141
- collectionPath: collectionPath
142
- });
143
- case 'image':
144
- return /*#__PURE__*/ jsx(ImageField, {
145
- field: hideLabel ? {
146
- ...field,
147
- label: void 0
148
- } : field,
149
- defaultValue: defaultValue,
150
- onChange: handleChange,
151
- path: path,
152
- collectionPath: collectionPath
153
- });
154
- case 'relation':
155
- return /*#__PURE__*/ jsx(RelationField, {
156
- field: hideLabel ? {
157
- ...field,
158
- label: void 0
159
- } : field,
160
- defaultValue: defaultValue,
161
- onChange: handleChange,
162
- path: path,
163
- id: htmlId
164
- });
165
- case 'group':
166
- return /*#__PURE__*/ jsx(GroupField, {
167
- field: hideLabel ? {
168
- ...field,
169
- label: void 0
170
- } : field,
171
- defaultValue: defaultValue,
172
- path: path
173
- });
174
- case 'blocks':
175
- if (!field.blocks) return null;
176
- return /*#__PURE__*/ jsx(BlocksField, {
177
- field: field,
178
- defaultValue: defaultValue,
179
- path: path
180
- });
181
- case 'array':
182
- if (!field.fields) return null;
183
- return /*#__PURE__*/ jsx(ArrayField, {
184
- field: field,
185
- defaultValue: defaultValue,
186
- path: path,
187
- disableSorting: disableSorting
188
- });
189
- default:
190
- return null;
191
- }
192
- };
193
- const selfBadge = 'text' === field.type || 'textArea' === field.type || 'richText' === field.type;
194
- if (badge && !selfBadge) return /*#__PURE__*/ jsxs("div", {
195
- className: classnames('byline-field-localized-wrap', field_renderer_module["localized-wrap"]),
196
- children: [
197
- renderField(),
198
- /*#__PURE__*/ jsx("span", {
199
- className: classnames('byline-field-localized-badge', field_renderer_module["localized-badge"]),
200
- children: badge
201
- })
202
- ]
203
- });
204
- return renderField();
205
- };
206
- export { FieldRenderer };
@@ -1,8 +0,0 @@
1
- import "./field-renderer_module.css";
2
- const field_renderer_module = {
3
- "localized-wrap": "localized-wrap-bv51Y7",
4
- localizedWrap: "localized-wrap-bv51Y7",
5
- "localized-badge": "localized-badge-D5MrbH",
6
- localizedBadge: "localized-badge-D5MrbH"
7
- };
8
- export default field_renderer_module;