@nixxie-cms/core 2.1.0 → 2.2.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 (126) hide show
  1. package/admin-ui/components/dist/nixxie-cms-core-admin-ui-components.cjs.js +7 -7
  2. package/admin-ui/components/dist/nixxie-cms-core-admin-ui-components.esm.js +7 -7
  3. package/admin-ui/context/dist/nixxie-cms-core-admin-ui-context.cjs.js +2 -2
  4. package/admin-ui/context/dist/nixxie-cms-core-admin-ui-context.esm.js +2 -2
  5. package/admin-ui/utils/dist/nixxie-cms-core-admin-ui-utils.cjs.js +5 -5
  6. package/admin-ui/utils/dist/nixxie-cms-core-admin-ui-utils.esm.js +3 -3
  7. package/dist/{CreateItemDialog-7008b050.esm.js → CreateItemDialog-66621fe8.esm.js} +3 -3
  8. package/dist/{CreateItemDialog-a0cab315.cjs.js → CreateItemDialog-96b044ce.cjs.js} +4 -4
  9. package/dist/{Field-47f85161.esm.js → Field-1820c4e6.esm.js} +1 -0
  10. package/dist/{Field-ed8d7627.cjs.js → Field-38d3cdf9.cjs.js} +1 -0
  11. package/dist/GraphQLErrorNotice-7594a9f8.esm.js +64 -0
  12. package/dist/GraphQLErrorNotice-c8890f80.cjs.js +66 -0
  13. package/dist/{PageContainer-5ae731cc.esm.js → PageContainer-355cfbfa.esm.js} +362 -156
  14. package/dist/{PageContainer-abd7159f.cjs.js → PageContainer-4095555a.cjs.js} +361 -155
  15. package/dist/{context-af9957ed.esm.js → context-2924eaaa.esm.js} +53 -58
  16. package/dist/{context-b5204629.cjs.js → context-2ce61d0b.cjs.js} +53 -58
  17. package/dist/declarations/src/admin-ui/components/GraphQLErrorNotice.d.ts.map +1 -1
  18. package/dist/declarations/src/admin-ui/components/Navigation.d.ts.map +1 -1
  19. package/dist/declarations/src/admin-ui/components/PageContainer.d.ts.map +1 -1
  20. package/dist/declarations/src/admin-ui/context.d.ts.map +1 -1
  21. package/dist/declarations/src/admin-ui/utils/useCreateItem.d.ts.map +1 -1
  22. package/dist/declarations/src/fields/types/bigInt/views/index.d.ts +2 -1
  23. package/dist/declarations/src/fields/types/bigInt/views/index.d.ts.map +1 -1
  24. package/dist/declarations/src/fields/types/bytes/views/index.d.ts +2 -1
  25. package/dist/declarations/src/fields/types/bytes/views/index.d.ts.map +1 -1
  26. package/dist/declarations/src/fields/types/calendarDay/views/index.d.ts.map +1 -1
  27. package/dist/declarations/src/fields/types/decimal/views/index.d.ts +2 -1
  28. package/dist/declarations/src/fields/types/decimal/views/index.d.ts.map +1 -1
  29. package/dist/declarations/src/fields/types/float/views/index.d.ts +2 -1
  30. package/dist/declarations/src/fields/types/float/views/index.d.ts.map +1 -1
  31. package/dist/declarations/src/fields/types/integer/views/index.d.ts +2 -1
  32. package/dist/declarations/src/fields/types/integer/views/index.d.ts.map +1 -1
  33. package/dist/declarations/src/fields/types/json/views/index.d.ts.map +1 -1
  34. package/dist/declarations/src/fields/types/multiselect/views/index.d.ts.map +1 -1
  35. package/dist/declarations/src/fields/types/relationship/views/index.d.ts.map +1 -1
  36. package/dist/declarations/src/fields/types/select/views/index.d.ts.map +1 -1
  37. package/dist/declarations/src/fields/types/text/views/index.d.ts +2 -1
  38. package/dist/declarations/src/fields/types/text/views/index.d.ts.map +1 -1
  39. package/dist/declarations/src/fields/types/timestamp/views/index.d.ts.map +1 -1
  40. package/dist/declarations/src/fields/types/virtual/views/index.d.ts.map +1 -1
  41. package/dist/declarations/src/internal-unstable/admin-ui/pages/HomePage/index.d.ts.map +1 -1
  42. package/dist/declarations/src/internal-unstable/admin-ui/pages/ItemPage/index.d.ts.map +1 -1
  43. package/dist/pick-4c785a54.esm.js +34 -0
  44. package/dist/pick-906341bb.cjs.js +37 -0
  45. package/dist/{useCreateItem-1f94d252.esm.js → useCreateItem-36a75f1c.esm.js} +26 -26
  46. package/dist/{useCreateItem-1be4987e.cjs.js → useCreateItem-acf06f77.cjs.js} +37 -37
  47. package/dist/{useFilter-acc9d413.cjs.js → useFilter-c29f17a8.cjs.js} +1 -1
  48. package/dist/{useFilter-9b6db1f9.esm.js → useFilter-f79b2abb.esm.js} +1 -1
  49. package/dist/{Fields-956d9a14.esm.js → usePreventNavigation-093389dd.esm.js} +28 -2
  50. package/dist/{Fields-e2c28056.cjs.js → usePreventNavigation-d4f9f4fa.cjs.js} +27 -0
  51. package/fields/types/bigInt/views/dist/nixxie-cms-core-fields-types-bigInt-views.cjs.js +8 -0
  52. package/fields/types/bigInt/views/dist/nixxie-cms-core-fields-types-bigInt-views.esm.js +8 -1
  53. package/fields/types/bytes/views/dist/nixxie-cms-core-fields-types-bytes-views.cjs.js +14 -3
  54. package/fields/types/bytes/views/dist/nixxie-cms-core-fields-types-bytes-views.esm.js +15 -5
  55. package/fields/types/calendarDay/views/dist/nixxie-cms-core-fields-types-calendarDay-views.cjs.js +2 -1
  56. package/fields/types/calendarDay/views/dist/nixxie-cms-core-fields-types-calendarDay-views.esm.js +2 -1
  57. package/fields/types/decimal/views/dist/nixxie-cms-core-fields-types-decimal-views.cjs.js +10 -1
  58. package/fields/types/decimal/views/dist/nixxie-cms-core-fields-types-decimal-views.esm.js +10 -2
  59. package/fields/types/file/views/dist/nixxie-cms-core-fields-types-file-views.cjs.js +1 -1
  60. package/fields/types/file/views/dist/nixxie-cms-core-fields-types-file-views.esm.js +2 -2
  61. package/fields/types/float/views/dist/nixxie-cms-core-fields-types-float-views.cjs.js +10 -1
  62. package/fields/types/float/views/dist/nixxie-cms-core-fields-types-float-views.esm.js +10 -2
  63. package/fields/types/image/views/dist/nixxie-cms-core-fields-types-image-views.cjs.js +2 -1
  64. package/fields/types/image/views/dist/nixxie-cms-core-fields-types-image-views.esm.js +2 -1
  65. package/fields/types/integer/views/dist/nixxie-cms-core-fields-types-integer-views.cjs.js +8 -0
  66. package/fields/types/integer/views/dist/nixxie-cms-core-fields-types-integer-views.esm.js +8 -1
  67. package/fields/types/json/views/dist/nixxie-cms-core-fields-types-json-views.cjs.js +19 -4
  68. package/fields/types/json/views/dist/nixxie-cms-core-fields-types-json-views.esm.js +19 -4
  69. package/fields/types/multiselect/views/dist/nixxie-cms-core-fields-types-multiselect-views.cjs.js +18 -3
  70. package/fields/types/multiselect/views/dist/nixxie-cms-core-fields-types-multiselect-views.esm.js +18 -3
  71. package/fields/types/password/views/dist/nixxie-cms-core-fields-types-password-views.cjs.js +1 -1
  72. package/fields/types/password/views/dist/nixxie-cms-core-fields-types-password-views.esm.js +1 -1
  73. package/fields/types/relationship/views/dist/nixxie-cms-core-fields-types-relationship-views.cjs.js +9 -7
  74. package/fields/types/relationship/views/dist/nixxie-cms-core-fields-types-relationship-views.esm.js +9 -7
  75. package/fields/types/select/views/dist/nixxie-cms-core-fields-types-select-views.cjs.js +3 -2
  76. package/fields/types/select/views/dist/nixxie-cms-core-fields-types-select-views.esm.js +3 -2
  77. package/fields/types/text/views/dist/nixxie-cms-core-fields-types-text-views.cjs.js +14 -3
  78. package/fields/types/text/views/dist/nixxie-cms-core-fields-types-text-views.esm.js +15 -5
  79. package/fields/types/timestamp/views/dist/nixxie-cms-core-fields-types-timestamp-views.cjs.js +2 -1
  80. package/fields/types/timestamp/views/dist/nixxie-cms-core-fields-types-timestamp-views.esm.js +2 -1
  81. package/fields/types/virtual/views/dist/nixxie-cms-core-fields-types-virtual-views.cjs.js +13 -1
  82. package/fields/types/virtual/views/dist/nixxie-cms-core-fields-types-virtual-views.esm.js +14 -2
  83. package/internal-unstable/admin-ui/pages/App/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-App.cjs.js +3 -3
  84. package/internal-unstable/admin-ui/pages/App/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-App.esm.js +3 -3
  85. package/internal-unstable/admin-ui/pages/CreateItemPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-CreateItemPage.cjs.js +7 -7
  86. package/internal-unstable/admin-ui/pages/CreateItemPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-CreateItemPage.esm.js +6 -6
  87. package/internal-unstable/admin-ui/pages/HomePage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-HomePage.cjs.js +34 -33
  88. package/internal-unstable/admin-ui/pages/HomePage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-HomePage.esm.js +35 -34
  89. package/internal-unstable/admin-ui/pages/ItemPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-ItemPage.cjs.js +53 -13
  90. package/internal-unstable/admin-ui/pages/ItemPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-ItemPage.esm.js +52 -12
  91. package/internal-unstable/admin-ui/pages/ListPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-ListPage.cjs.js +36 -25
  92. package/internal-unstable/admin-ui/pages/ListPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-ListPage.esm.js +36 -25
  93. package/package.json +2 -2
  94. package/src/admin-ui/components/CommandPalette.tsx +134 -27
  95. package/src/admin-ui/components/CreateButtonLink.tsx +20 -46
  96. package/src/admin-ui/components/GraphQLErrorNotice.tsx +39 -33
  97. package/src/admin-ui/components/Logo.tsx +5 -5
  98. package/src/admin-ui/components/Navigation.tsx +41 -27
  99. package/src/admin-ui/components/PageContainer.tsx +171 -15
  100. package/src/admin-ui/components/WelcomeDialog.tsx +14 -14
  101. package/src/admin-ui/context.tsx +5 -2
  102. package/src/admin-ui/utils/useCreateItem.ts +21 -1
  103. package/src/fields/types/bigInt/views/index.tsx +10 -1
  104. package/src/fields/types/bytes/views/index.tsx +14 -1
  105. package/src/fields/types/calendarDay/views/index.tsx +2 -1
  106. package/src/fields/types/decimal/views/index.tsx +7 -1
  107. package/src/fields/types/file/views/Field.tsx +1 -1
  108. package/src/fields/types/float/views/index.tsx +7 -1
  109. package/src/fields/types/image/views/index.tsx +1 -1
  110. package/src/fields/types/integer/views/index.tsx +5 -0
  111. package/src/fields/types/json/views/index.tsx +20 -2
  112. package/src/fields/types/multiselect/views/index.tsx +7 -3
  113. package/src/fields/types/password/views/index.tsx +1 -1
  114. package/src/fields/types/relationship/views/index.tsx +1 -0
  115. package/src/fields/types/select/views/index.tsx +2 -1
  116. package/src/fields/types/text/views/index.tsx +14 -1
  117. package/src/fields/types/timestamp/views/index.tsx +2 -1
  118. package/src/fields/types/virtual/views/index.tsx +17 -2
  119. package/src/internal-unstable/admin-ui/pages/HomePage/index.tsx +40 -31
  120. package/src/internal-unstable/admin-ui/pages/ItemPage/index.tsx +36 -3
  121. package/src/internal-unstable/admin-ui/pages/ListPage/PaginationControls.tsx +20 -33
  122. package/src/internal-unstable/admin-ui/pages/ListPage/index.tsx +24 -16
  123. package/dist/GraphQLErrorNotice-cd74180d.cjs.js +0 -57
  124. package/dist/GraphQLErrorNotice-d9f0931b.esm.js +0 -55
  125. package/dist/pick-5fe45878.cjs.js +0 -71
  126. package/dist/pick-b7ef3115.esm.js +0 -68
@@ -1,5 +1,5 @@
1
1
  import { useRouter } from 'next/router';
2
- import { useEffect, useMemo, useState, useRef } from 'react';
2
+ import { useMemo, useState, useRef, useEffect } from 'react';
3
3
  import { toastQueue } from '@keystar/ui/toast';
4
4
  import '@react-aria/utils';
5
5
  import '@keystar/ui/button';
@@ -15,32 +15,28 @@ import 'react/jsx-runtime';
15
15
  import { m as makeDefaultValueState, u as useInvalidFields, a as useHasChanges, s as serializeValueToOperationItem } from './utils-5e1d4d28.esm.js';
16
16
  import { gql } from '@apollo/client';
17
17
  import { useMutation } from '@apollo/client/react';
18
+ import { u as usePreventNavigation } from './usePreventNavigation-093389dd.esm.js';
18
19
 
19
- function usePreventNavigation(shouldPreventNavigationRef) {
20
- const router = useRouter();
21
- useEffect(() => {
22
- const clientSideRouteChangeHandler = () => {
23
- if (shouldPreventNavigationRef.current && !window.confirm('There are unsaved changes, are you sure you want to exit?')) {
24
- // throwing from here seems to be the only way to prevent the navigation
25
- // we're throwing just a string here rather than an error because throwing an error
26
- // causes Next to show an error overlay in dev but it doesn't show the overlay when we throw a string
27
- throw 'Navigation cancelled by user';
28
- }
29
- };
30
- router.events.on('routeChangeStart', clientSideRouteChangeHandler);
31
- const beforeUnloadHandler = event => {
32
- if (shouldPreventNavigationRef.current) {
33
- event.preventDefault();
34
- }
35
- };
36
- window.addEventListener('beforeunload', beforeUnloadHandler);
37
- return () => {
38
- router.events.off('routeChangeStart', clientSideRouteChangeHandler);
39
- window.removeEventListener('beforeunload', beforeUnloadHandler);
40
- };
41
- }, [shouldPreventNavigationRef, router.events]);
20
+ // after forcing validation, move focus to the first invalid field so the user
21
+ // can see and fix it. runs on the next frame so the DOM reflects the new
22
+ // aria-invalid state, and is fully defensive so it can never throw.
23
+ function focusFirstInvalidField() {
24
+ requestAnimationFrame(() => {
25
+ try {
26
+ const el = document.querySelector('[aria-invalid="true"]');
27
+ if (!el) return;
28
+ el.focus({
29
+ preventScroll: false
30
+ });
31
+ el.scrollIntoView({
32
+ block: 'center',
33
+ behavior: 'smooth'
34
+ });
35
+ } catch {
36
+ // ignore — focusing is a best-effort enhancement
37
+ }
38
+ });
42
39
  }
43
-
44
40
  function useCreateItem(list) {
45
41
  const router = useRouter();
46
42
  const [tryCreateItem, {
@@ -82,7 +78,11 @@ function useCreateItem(list) {
82
78
  async create() {
83
79
  const newForceValidation = invalidFields.size !== 0;
84
80
  setForceValidation(newForceValidation);
85
- if (newForceValidation) return;
81
+ if (newForceValidation) {
82
+ toastQueue.critical('Please fix the highlighted field(s) before saving.');
83
+ focusFirstInvalidField();
84
+ return;
85
+ }
86
86
  let outputData;
87
87
  try {
88
88
  outputData = await tryCreateItem({
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var router = require('next/router');
4
- var react = require('react');
4
+ var react$1 = require('react');
5
5
  var toast = require('@keystar/ui/toast');
6
6
  require('@react-aria/utils');
7
7
  require('@keystar/ui/button');
@@ -16,56 +16,52 @@ require('@keystar/ui/utils');
16
16
  require('react/jsx-runtime');
17
17
  var utils = require('./utils-230cddb1.cjs.js');
18
18
  var client = require('@apollo/client');
19
- var react$1 = require('@apollo/client/react');
19
+ var react = require('@apollo/client/react');
20
+ var usePreventNavigation = require('./usePreventNavigation-d4f9f4fa.cjs.js');
20
21
 
21
- function usePreventNavigation(shouldPreventNavigationRef) {
22
- const router$1 = router.useRouter();
23
- react.useEffect(() => {
24
- const clientSideRouteChangeHandler = () => {
25
- if (shouldPreventNavigationRef.current && !window.confirm('There are unsaved changes, are you sure you want to exit?')) {
26
- // throwing from here seems to be the only way to prevent the navigation
27
- // we're throwing just a string here rather than an error because throwing an error
28
- // causes Next to show an error overlay in dev but it doesn't show the overlay when we throw a string
29
- throw 'Navigation cancelled by user';
30
- }
31
- };
32
- router$1.events.on('routeChangeStart', clientSideRouteChangeHandler);
33
- const beforeUnloadHandler = event => {
34
- if (shouldPreventNavigationRef.current) {
35
- event.preventDefault();
36
- }
37
- };
38
- window.addEventListener('beforeunload', beforeUnloadHandler);
39
- return () => {
40
- router$1.events.off('routeChangeStart', clientSideRouteChangeHandler);
41
- window.removeEventListener('beforeunload', beforeUnloadHandler);
42
- };
43
- }, [shouldPreventNavigationRef, router$1.events]);
22
+ // after forcing validation, move focus to the first invalid field so the user
23
+ // can see and fix it. runs on the next frame so the DOM reflects the new
24
+ // aria-invalid state, and is fully defensive so it can never throw.
25
+ function focusFirstInvalidField() {
26
+ requestAnimationFrame(() => {
27
+ try {
28
+ const el = document.querySelector('[aria-invalid="true"]');
29
+ if (!el) return;
30
+ el.focus({
31
+ preventScroll: false
32
+ });
33
+ el.scrollIntoView({
34
+ block: 'center',
35
+ behavior: 'smooth'
36
+ });
37
+ } catch {
38
+ // ignore — focusing is a best-effort enhancement
39
+ }
40
+ });
44
41
  }
45
-
46
42
  function useCreateItem(list) {
47
43
  const router$1 = router.useRouter();
48
44
  const [tryCreateItem, {
49
45
  loading,
50
46
  error,
51
47
  data: returnedData
52
- }] = react$1.useMutation(client.gql`mutation($data: ${list.graphql.names.createInputName}!) {
48
+ }] = react.useMutation(client.gql`mutation($data: ${list.graphql.names.createInputName}!) {
53
49
  item: ${list.graphql.names.createMutationName}(data: $data) {
54
50
  id
55
51
  label: ${list.labelField}
56
52
  }
57
53
  }`);
58
- const isRequireds = react.useMemo(() => Object.fromEntries(Object.entries(list.fields).map(([key, field]) => [key, field.createView.isRequired])), [list.fields]);
59
- const [forceValidation, setForceValidation] = react.useState(false);
60
- const [value, setValue] = react.useState(() => utils.makeDefaultValueState(list.fields));
54
+ const isRequireds = react$1.useMemo(() => Object.fromEntries(Object.entries(list.fields).map(([key, field]) => [key, field.createView.isRequired])), [list.fields]);
55
+ const [forceValidation, setForceValidation] = react$1.useState(false);
56
+ const [value, setValue] = react$1.useState(() => utils.makeDefaultValueState(list.fields));
61
57
  const invalidFields = utils.useInvalidFields(list.fields, value, isRequireds);
62
58
  const hasChangedFields = utils.useHasChanges('create', list.fields, value, utils.makeDefaultValueState(list.fields));
63
59
  const shouldPreventNavigation = !(returnedData !== null && returnedData !== void 0 && returnedData.item) && hasChangedFields;
64
- const shouldPreventNavigationRef = react.useRef(shouldPreventNavigation);
65
- react.useEffect(() => {
60
+ const shouldPreventNavigationRef = react$1.useRef(shouldPreventNavigation);
61
+ react$1.useEffect(() => {
66
62
  shouldPreventNavigationRef.current = shouldPreventNavigation;
67
63
  }, [shouldPreventNavigation]);
68
- usePreventNavigation(shouldPreventNavigationRef);
64
+ usePreventNavigation.usePreventNavigation(shouldPreventNavigationRef);
69
65
  return {
70
66
  state: loading ? 'loading' : !(returnedData !== null && returnedData !== void 0 && returnedData.item) ? 'created' : 'editing',
71
67
  shouldPreventNavigation,
@@ -84,7 +80,11 @@ function useCreateItem(list) {
84
80
  async create() {
85
81
  const newForceValidation = invalidFields.size !== 0;
86
82
  setForceValidation(newForceValidation);
87
- if (newForceValidation) return;
83
+ if (newForceValidation) {
84
+ toast.toastQueue.critical('Please fix the highlighted field(s) before saving.');
85
+ focusFirstInvalidField();
86
+ return;
87
+ }
88
88
  let outputData;
89
89
  try {
90
90
  outputData = await tryCreateItem({
@@ -129,10 +129,10 @@ function useCreateItem(list) {
129
129
  };
130
130
  }
131
131
  function useBuildItem(list, fieldKeys = []) {
132
- const [forceValidation, setForceValidation] = react.useState(false);
133
- const [value, setValue] = react.useState(() => utils.makeDefaultValueState(list.fields));
132
+ const [forceValidation, setForceValidation] = react$1.useState(false);
133
+ const [value, setValue] = react$1.useState(() => utils.makeDefaultValueState(list.fields));
134
134
  const fields = fieldKeys.length ? Object.fromEntries(Object.entries(list.fields).filter(([key]) => fieldKeys.includes(key))) : list.fields;
135
- const isRequireds = react.useMemo(() => Object.fromEntries(Object.entries(list.fields).map(([key, field]) => [key, field.createView.isRequired])), [list.fields]);
135
+ const isRequireds = react$1.useMemo(() => Object.fromEntries(Object.entries(list.fields).map(([key, field]) => [key, field.createView.isRequired])), [list.fields]);
136
136
  const invalidFields = utils.useInvalidFields(list.fields, value, isRequireds);
137
137
  return {
138
138
  state: 'editing',
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var react = require('react');
4
- var adminUi_context_dist_nixxieCmsCoreAdminUiContext = require('./context-b5204629.cjs.js');
4
+ var adminUi_context_dist_nixxieCmsCoreAdminUiContext = require('./context-2ce61d0b.cjs.js');
5
5
 
6
6
  function isInt(x) {
7
7
  return Number.isInteger(Number(x));
@@ -1,5 +1,5 @@
1
1
  import { useMemo } from 'react';
2
- import { u as useNixxie } from './context-af9957ed.esm.js';
2
+ import { u as useNixxie } from './context-2924eaaa.esm.js';
3
3
 
4
4
  function isInt(x) {
5
5
  return Number.isInteger(Number(x));
@@ -1,5 +1,5 @@
1
1
  import { useSlotId } from '@react-aria/utils';
2
- import { useId } from 'react';
2
+ import { useId, useEffect } from 'react';
3
3
  import { FieldButton } from '@keystar/ui/button';
4
4
  import { Icon } from '@keystar/ui/icon';
5
5
  import { chevronRightIcon } from '@keystar/ui/icon/icons/chevronRightIcon';
@@ -10,6 +10,7 @@ import { textCursorInputIcon } from '@keystar/ui/icon/icons/textCursorInputIcon'
10
10
  import { E as EmptyState } from './utils-5e1d4d28.esm.js';
11
11
  import { s as serializeItemForConditionalFilters, a as resolveFieldMode, t as testFilter } from './filters-8c8616f9.esm.js';
12
12
  import { jsx, jsxs } from 'react/jsx-runtime';
13
+ import { useRouter } from 'next/router';
13
14
 
14
15
  function Fields({
15
16
  view,
@@ -200,4 +201,29 @@ function GroupIndicatorLine() {
200
201
  });
201
202
  }
202
203
 
203
- export { Fields as F, GroupIndicatorLine as G };
204
+ function usePreventNavigation(shouldPreventNavigationRef) {
205
+ const router = useRouter();
206
+ useEffect(() => {
207
+ const clientSideRouteChangeHandler = () => {
208
+ if (shouldPreventNavigationRef.current && !window.confirm('There are unsaved changes, are you sure you want to exit?')) {
209
+ // throwing from here seems to be the only way to prevent the navigation
210
+ // we're throwing just a string here rather than an error because throwing an error
211
+ // causes Next to show an error overlay in dev but it doesn't show the overlay when we throw a string
212
+ throw 'Navigation cancelled by user';
213
+ }
214
+ };
215
+ router.events.on('routeChangeStart', clientSideRouteChangeHandler);
216
+ const beforeUnloadHandler = event => {
217
+ if (shouldPreventNavigationRef.current) {
218
+ event.preventDefault();
219
+ }
220
+ };
221
+ window.addEventListener('beforeunload', beforeUnloadHandler);
222
+ return () => {
223
+ router.events.off('routeChangeStart', clientSideRouteChangeHandler);
224
+ window.removeEventListener('beforeunload', beforeUnloadHandler);
225
+ };
226
+ }, [shouldPreventNavigationRef, router.events]);
227
+ }
228
+
229
+ export { Fields as F, GroupIndicatorLine as G, usePreventNavigation as u };
@@ -12,6 +12,7 @@ var textCursorInputIcon = require('@keystar/ui/icon/icons/textCursorInputIcon');
12
12
  var utils = require('./utils-230cddb1.cjs.js');
13
13
  var filters = require('./filters-b3e5eb50.cjs.js');
14
14
  var jsxRuntime = require('react/jsx-runtime');
15
+ var router = require('next/router');
15
16
 
16
17
  function Fields({
17
18
  view,
@@ -202,5 +203,31 @@ function GroupIndicatorLine() {
202
203
  });
203
204
  }
204
205
 
206
+ function usePreventNavigation(shouldPreventNavigationRef) {
207
+ const router$1 = router.useRouter();
208
+ react.useEffect(() => {
209
+ const clientSideRouteChangeHandler = () => {
210
+ if (shouldPreventNavigationRef.current && !window.confirm('There are unsaved changes, are you sure you want to exit?')) {
211
+ // throwing from here seems to be the only way to prevent the navigation
212
+ // we're throwing just a string here rather than an error because throwing an error
213
+ // causes Next to show an error overlay in dev but it doesn't show the overlay when we throw a string
214
+ throw 'Navigation cancelled by user';
215
+ }
216
+ };
217
+ router$1.events.on('routeChangeStart', clientSideRouteChangeHandler);
218
+ const beforeUnloadHandler = event => {
219
+ if (shouldPreventNavigationRef.current) {
220
+ event.preventDefault();
221
+ }
222
+ };
223
+ window.addEventListener('beforeunload', beforeUnloadHandler);
224
+ return () => {
225
+ router$1.events.off('routeChangeStart', clientSideRouteChangeHandler);
226
+ window.removeEventListener('beforeunload', beforeUnloadHandler);
227
+ };
228
+ }, [shouldPreventNavigationRef, router$1.events]);
229
+ }
230
+
205
231
  exports.Fields = Fields;
206
232
  exports.GroupIndicatorLine = GroupIndicatorLine;
233
+ exports.usePreventNavigation = usePreventNavigation;
@@ -253,6 +253,14 @@ function Field({
253
253
  value: (_value$value = value.value) !== null && _value$value !== void 0 ? _value$value : ''
254
254
  });
255
255
  }
256
+ const Cell = ({
257
+ value
258
+ }) => {
259
+ return value != null && value !== '' ? /*#__PURE__*/jsxRuntime.jsx(typography.Text, {
260
+ children: value
261
+ }) : null;
262
+ };
256
263
 
264
+ exports.Cell = Cell;
257
265
  exports.Field = Field;
258
266
  exports.controller = controller;
@@ -249,5 +249,12 @@ function Field({
249
249
  value: (_value$value = value.value) !== null && _value$value !== void 0 ? _value$value : ''
250
250
  });
251
251
  }
252
+ const Cell = ({
253
+ value
254
+ }) => {
255
+ return value != null && value !== '' ? /*#__PURE__*/jsx(Text, {
256
+ children: value
257
+ }) : null;
258
+ };
252
259
 
253
- export { Field, controller };
260
+ export { Cell, Field, controller };
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var textField = require('@keystar/ui/text-field');
6
+ var typography = require('@keystar/ui/typography');
6
7
  var react = require('react');
7
8
  require('@keystar/ui/table');
8
9
  var jsxRuntime = require('react/jsx-runtime');
@@ -16,7 +17,6 @@ require('@keystar/ui/icon/icons/alertTriangleIcon');
16
17
  require('@keystar/ui/layout');
17
18
  require('@keystar/ui/notice');
18
19
  require('@keystar/ui/slots');
19
- require('@keystar/ui/typography');
20
20
  require('next/link');
21
21
  require('apollo-upload-client/UploadHttpLink.mjs');
22
22
  require('next/head');
@@ -26,8 +26,8 @@ require('@nixxie-cms/core/admin-ui/router');
26
26
  require('@keystar/ui/icon/icons/chevronLeftIcon');
27
27
  require('@keystar/ui/icon/icons/chevronRightIcon');
28
28
  require('@keystar/ui/icon/icons/undo2Icon');
29
+ require('@keystar/ui/number-field');
29
30
  require('@keystar/ui/picker');
30
- require('@keystar/ui/tag');
31
31
  require('@keystar/ui/tooltip');
32
32
  require('../../../../../dist/admin-meta-graphql-306c224a.cjs.js');
33
33
  require('@apollo/client');
@@ -79,7 +79,9 @@ function Field(props) {
79
79
  autoFocus: autoFocus,
80
80
  description: field.description,
81
81
  label: field.label,
82
- errorMessage: !!validationMessages.length && (shouldShowErrors || forceValidation) ? validationMessages.join('. ') : undefined,
82
+ errorMessage: !!validationMessages.length && (shouldShowErrors || forceValidation) ? validationMessages.length === 1 ? validationMessages[0] : validationMessages.map((message, i) => /*#__PURE__*/jsxRuntime.jsxs(typography.Text, {
83
+ children: [i > 0 && /*#__PURE__*/jsxRuntime.jsx("br", {}), message]
84
+ }, i)) : undefined,
83
85
  isDisabled: isNull,
84
86
  isReadOnly: isReadOnly,
85
87
  isRequired: isRequired,
@@ -103,6 +105,14 @@ function Field(props) {
103
105
  })
104
106
  });
105
107
  }
108
+ const Cell = ({
109
+ value
110
+ }) => {
111
+ return value ? /*#__PURE__*/jsxRuntime.jsx(typography.Text, {
112
+ truncate: true,
113
+ children: value
114
+ }) : null;
115
+ };
106
116
  function validate(value, isRequired, fieldLabel) {
107
117
  // if the value is the same as the initial for an update, we don't want to block saving
108
118
  // since we're not gonna send it anyway if it's the same
@@ -235,5 +245,6 @@ function controller(config) {
235
245
  };
236
246
  }
237
247
 
248
+ exports.Cell = Cell;
238
249
  exports.Field = Field;
239
250
  exports.controller = controller;
@@ -1,7 +1,8 @@
1
1
  import { TextField } from '@keystar/ui/text-field';
2
+ import { Text } from '@keystar/ui/typography';
2
3
  import { useState } from 'react';
3
4
  import '@keystar/ui/table';
4
- import { jsx } from 'react/jsx-runtime';
5
+ import { jsx, jsxs } from 'react/jsx-runtime';
5
6
  import '@keystar/ui/style';
6
7
  import { N as NullableFieldWrapper } from '../../../../../dist/NullableFieldWrapper-6ea48af3.esm.js';
7
8
  import '@babel/runtime/helpers/defineProperty';
@@ -12,7 +13,6 @@ import '@keystar/ui/icon/icons/alertTriangleIcon';
12
13
  import '@keystar/ui/layout';
13
14
  import '@keystar/ui/notice';
14
15
  import '@keystar/ui/slots';
15
- import '@keystar/ui/typography';
16
16
  import 'next/link';
17
17
  import 'apollo-upload-client/UploadHttpLink.mjs';
18
18
  import 'next/head';
@@ -22,8 +22,8 @@ import '@nixxie-cms/core/admin-ui/router';
22
22
  import '@keystar/ui/icon/icons/chevronLeftIcon';
23
23
  import '@keystar/ui/icon/icons/chevronRightIcon';
24
24
  import '@keystar/ui/icon/icons/undo2Icon';
25
+ import '@keystar/ui/number-field';
25
26
  import '@keystar/ui/picker';
26
- import '@keystar/ui/tag';
27
27
  import '@keystar/ui/tooltip';
28
28
  import '../../../../../dist/admin-meta-graphql-0e6e606e.esm.js';
29
29
  import '@apollo/client';
@@ -75,7 +75,9 @@ function Field(props) {
75
75
  autoFocus: autoFocus,
76
76
  description: field.description,
77
77
  label: field.label,
78
- errorMessage: !!validationMessages.length && (shouldShowErrors || forceValidation) ? validationMessages.join('. ') : undefined,
78
+ errorMessage: !!validationMessages.length && (shouldShowErrors || forceValidation) ? validationMessages.length === 1 ? validationMessages[0] : validationMessages.map((message, i) => /*#__PURE__*/jsxs(Text, {
79
+ children: [i > 0 && /*#__PURE__*/jsx("br", {}), message]
80
+ }, i)) : undefined,
79
81
  isDisabled: isNull,
80
82
  isReadOnly: isReadOnly,
81
83
  isRequired: isRequired,
@@ -99,6 +101,14 @@ function Field(props) {
99
101
  })
100
102
  });
101
103
  }
104
+ const Cell = ({
105
+ value
106
+ }) => {
107
+ return value ? /*#__PURE__*/jsx(Text, {
108
+ truncate: true,
109
+ children: value
110
+ }) : null;
111
+ };
102
112
  function validate(value, isRequired, fieldLabel) {
103
113
  // if the value is the same as the initial for an update, we don't want to block saving
104
114
  // since we're not gonna send it anyway if it's the same
@@ -231,4 +241,4 @@ function controller(config) {
231
241
  };
232
242
  }
233
243
 
234
- export { Field, controller };
244
+ export { Cell, Field, controller };
@@ -47,7 +47,8 @@ function Field(props) {
47
47
  description: field.description,
48
48
  isDisabled: !parsedValue,
49
49
  isReadOnly: true,
50
- value: parsedValue ? isReadonlyUTC ? parsedValue.toString() : dateFormatter.format(parsedValue.toDate(date.getLocalTimeZone())) : 'yyyy-mm-dd'
50
+ placeholder: "yyyy-mm-dd",
51
+ value: parsedValue ? isReadonlyUTC ? parsedValue.toString() : dateFormatter.format(parsedValue.toDate(date.getLocalTimeZone())) : ''
51
52
  }), !!parsedValue && /*#__PURE__*/jsxRuntime.jsxs(tooltip.TooltipTrigger, {
52
53
  children: [/*#__PURE__*/jsxRuntime.jsx(button.ToggleButton, {
53
54
  "aria-label": "utc time",
@@ -43,7 +43,8 @@ function Field(props) {
43
43
  description: field.description,
44
44
  isDisabled: !parsedValue,
45
45
  isReadOnly: true,
46
- value: parsedValue ? isReadonlyUTC ? parsedValue.toString() : dateFormatter.format(parsedValue.toDate(getLocalTimeZone())) : 'yyyy-mm-dd'
46
+ placeholder: "yyyy-mm-dd",
47
+ value: parsedValue ? isReadonlyUTC ? parsedValue.toString() : dateFormatter.format(parsedValue.toDate(getLocalTimeZone())) : ''
47
48
  }), !!parsedValue && /*#__PURE__*/jsxs(TooltipTrigger, {
48
49
  children: [/*#__PURE__*/jsx(ToggleButton, {
49
50
  "aria-label": "utc time",
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var react = require('react');
6
6
  var textField = require('@keystar/ui/text-field');
7
+ var typography = require('@keystar/ui/typography');
7
8
  require('pluralize');
8
9
  require('../../../../../dist/next-fields-49c025ef.cjs.js');
9
10
  var utils = require('../../../../../dist/utils-b031e11c.cjs.js');
@@ -233,7 +234,7 @@ function Field({
233
234
  errorMessage: (forceValidation || isDirty) && validate(value),
234
235
  isReadOnly: isReadOnly,
235
236
  isRequired: isRequired,
236
- inputMode: "numeric",
237
+ inputMode: "decimal",
237
238
  width: "alias.singleLineWidth",
238
239
  onBlur: () => setDirty(true),
239
240
  onChange: x => onChange === null || onChange === void 0 ? void 0 : onChange({
@@ -243,6 +244,14 @@ function Field({
243
244
  value: (_value$value = value.value) !== null && _value$value !== void 0 ? _value$value : ''
244
245
  });
245
246
  }
247
+ const Cell = ({
248
+ value
249
+ }) => {
250
+ return value != null && value !== '' ? /*#__PURE__*/jsxRuntime.jsx(typography.Text, {
251
+ children: value
252
+ }) : null;
253
+ };
246
254
 
255
+ exports.Cell = Cell;
247
256
  exports.Field = Field;
248
257
  exports.controller = controller;
@@ -1,5 +1,6 @@
1
1
  import { useState } from 'react';
2
2
  import { TextField } from '@keystar/ui/text-field';
3
+ import { Text } from '@keystar/ui/typography';
3
4
  import 'pluralize';
4
5
  import '../../../../../dist/next-fields-9bf04ed8.esm.js';
5
6
  import { e as entriesTyped } from '../../../../../dist/utils-f9556354.esm.js';
@@ -225,7 +226,7 @@ function Field({
225
226
  errorMessage: (forceValidation || isDirty) && validate(value),
226
227
  isReadOnly: isReadOnly,
227
228
  isRequired: isRequired,
228
- inputMode: "numeric",
229
+ inputMode: "decimal",
229
230
  width: "alias.singleLineWidth",
230
231
  onBlur: () => setDirty(true),
231
232
  onChange: x => onChange === null || onChange === void 0 ? void 0 : onChange({
@@ -235,5 +236,12 @@ function Field({
235
236
  value: (_value$value = value.value) !== null && _value$value !== void 0 ? _value$value : ''
236
237
  });
237
238
  }
239
+ const Cell = ({
240
+ value
241
+ }) => {
242
+ return value != null && value !== '' ? /*#__PURE__*/jsx(Text, {
243
+ children: value
244
+ }) : null;
245
+ };
238
246
 
239
- export { Field, controller };
247
+ export { Cell, Field, controller };
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var Field = require('../../../../../dist/Field-ed8d7627.cjs.js');
5
+ var Field = require('../../../../../dist/Field-38d3cdf9.cjs.js');
6
6
  require('@react-aria/i18n');
7
7
  require('bytes');
8
8
  require('path');
@@ -1,5 +1,5 @@
1
- import { v as validateFile } from '../../../../../dist/Field-47f85161.esm.js';
2
- export { F as Field } from '../../../../../dist/Field-47f85161.esm.js';
1
+ import { v as validateFile } from '../../../../../dist/Field-1820c4e6.esm.js';
2
+ export { F as Field } from '../../../../../dist/Field-1820c4e6.esm.js';
3
3
  import '@react-aria/i18n';
4
4
  import 'bytes';
5
5
  import 'path';
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var react = require('react');
6
6
  var textField = require('@keystar/ui/text-field');
7
+ var typography = require('@keystar/ui/typography');
7
8
  var utils = require('../../../../../dist/utils-b031e11c.cjs.js');
8
9
  var jsxRuntime = require('react/jsx-runtime');
9
10
 
@@ -222,7 +223,7 @@ function Field({
222
223
  errorMessage: (forceValidation || isDirty) && validate(value),
223
224
  isReadOnly: isReadOnly,
224
225
  isRequired: isRequired,
225
- inputMode: "numeric",
226
+ inputMode: "decimal",
226
227
  width: "alias.singleLineWidth",
227
228
  onBlur: () => setDirty(true),
228
229
  onChange: x => onChange === null || onChange === void 0 ? void 0 : onChange({
@@ -232,6 +233,14 @@ function Field({
232
233
  value: (_value$value = value.value) !== null && _value$value !== void 0 ? _value$value : ''
233
234
  });
234
235
  }
236
+ const Cell = ({
237
+ value
238
+ }) => {
239
+ return value != null && value !== '' ? /*#__PURE__*/jsxRuntime.jsx(typography.Text, {
240
+ children: value
241
+ }) : null;
242
+ };
235
243
 
244
+ exports.Cell = Cell;
236
245
  exports.Field = Field;
237
246
  exports.controller = controller;
@@ -1,5 +1,6 @@
1
1
  import { useState } from 'react';
2
2
  import { TextField } from '@keystar/ui/text-field';
3
+ import { Text } from '@keystar/ui/typography';
3
4
  import { e as entriesTyped } from '../../../../../dist/utils-f9556354.esm.js';
4
5
  import { jsx } from 'react/jsx-runtime';
5
6
 
@@ -218,7 +219,7 @@ function Field({
218
219
  errorMessage: (forceValidation || isDirty) && validate(value),
219
220
  isReadOnly: isReadOnly,
220
221
  isRequired: isRequired,
221
- inputMode: "numeric",
222
+ inputMode: "decimal",
222
223
  width: "alias.singleLineWidth",
223
224
  onBlur: () => setDirty(true),
224
225
  onChange: x => onChange === null || onChange === void 0 ? void 0 : onChange({
@@ -228,5 +229,12 @@ function Field({
228
229
  value: (_value$value = value.value) !== null && _value$value !== void 0 ? _value$value : ''
229
230
  });
230
231
  }
232
+ const Cell = ({
233
+ value
234
+ }) => {
235
+ return value != null && value !== '' ? /*#__PURE__*/jsx(Text, {
236
+ children: value
237
+ }) : null;
238
+ };
231
239
 
232
- export { Field, controller };
240
+ export { Cell, Field, controller };
@@ -10,7 +10,7 @@ var field = require('@keystar/ui/field');
10
10
  var layout = require('@keystar/ui/layout');
11
11
  var style = require('@keystar/ui/style');
12
12
  var typography = require('@keystar/ui/typography');
13
- var Field$1 = require('../../../../../dist/Field-ed8d7627.cjs.js');
13
+ var Field$1 = require('../../../../../dist/Field-38d3cdf9.cjs.js');
14
14
  require('@react-aria/i18n');
15
15
  require('bytes');
16
16
  require('path');
@@ -290,6 +290,7 @@ const Cell = ({
290
290
  width: 24
291
291
  },
292
292
  children: /*#__PURE__*/jsxRuntime.jsx("img", {
293
+ alt: "",
293
294
  style: {
294
295
  maxHeight: '100%',
295
296
  maxWidth: '100%'
@@ -6,7 +6,7 @@ import { Field as Field$1 } from '@keystar/ui/field';
6
6
  import { VStack, HStack } from '@keystar/ui/layout';
7
7
  import { transition, css, tokenSchema } from '@keystar/ui/style';
8
8
  import { Text } from '@keystar/ui/typography';
9
- import { u as useTrimStartStyles, f as formatBytes } from '../../../../../dist/Field-47f85161.esm.js';
9
+ import { u as useTrimStartStyles, f as formatBytes } from '../../../../../dist/Field-1820c4e6.esm.js';
10
10
  import '@react-aria/i18n';
11
11
  import 'bytes';
12
12
  import 'path';
@@ -286,6 +286,7 @@ const Cell = ({
286
286
  width: 24
287
287
  },
288
288
  children: /*#__PURE__*/jsx("img", {
289
+ alt: "",
289
290
  style: {
290
291
  maxHeight: '100%',
291
292
  maxWidth: '100%'