@nixxie-cms/core 1.0.0 → 1.0.2

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 (187) hide show
  1. package/README.md +2 -2
  2. package/admin-ui/components/dist/nixxie-cms-core-admin-ui-components.cjs.js +4 -4
  3. package/admin-ui/components/dist/nixxie-cms-core-admin-ui-components.esm.js +4 -4
  4. package/admin-ui/context/dist/nixxie-cms-core-admin-ui-context.cjs.js +2 -2
  5. package/admin-ui/context/dist/nixxie-cms-core-admin-ui-context.esm.js +2 -2
  6. package/context/dist/nixxie-cms-core-context.cjs.js +2 -2
  7. package/context/dist/nixxie-cms-core-context.esm.js +2 -2
  8. package/dist/{CreateItemDialog-33335548.esm.js → CreateItemDialog-7008b050.esm.js} +1 -1
  9. package/dist/{CreateItemDialog-56cf59b7.cjs.js → CreateItemDialog-a0cab315.cjs.js} +1 -1
  10. package/dist/{PageContainer-7db73317.esm.js → PageContainer-5ae731cc.esm.js} +25 -18
  11. package/dist/{PageContainer-27c27f10.cjs.js → PageContainer-abd7159f.cjs.js} +25 -18
  12. package/dist/{admin-meta-graphql-6f7f5331.esm.js → admin-meta-graphql-0e6e606e.esm.js} +1 -1
  13. package/dist/{admin-meta-graphql-c8f926e9.cjs.js → admin-meta-graphql-306c224a.cjs.js} +1 -1
  14. package/dist/{context-3132c3ed.esm.js → context-af9957ed.esm.js} +2 -2
  15. package/dist/{context-e7a45152.cjs.js → context-b5204629.cjs.js} +2 -2
  16. package/dist/declarations/src/admin-ui/components/Navigation.d.ts.map +1 -1
  17. package/dist/declarations/src/admin-ui/components/PageContainer.d.ts.map +1 -1
  18. package/dist/declarations/src/helpers.d.ts.map +1 -1
  19. package/dist/declarations/src/index.d.ts +1 -0
  20. package/dist/declarations/src/index.d.ts.map +1 -1
  21. package/dist/declarations/src/internal-unstable/admin-ui/id-field-view.d.ts.map +1 -0
  22. package/dist/declarations/src/internal-unstable/admin-ui/pages/App/index.d.ts.map +1 -0
  23. package/dist/declarations/src/internal-unstable/admin-ui/pages/CreateItemPage/index.d.ts.map +1 -0
  24. package/dist/declarations/src/internal-unstable/admin-ui/pages/HomePage/index.d.ts.map +1 -0
  25. package/dist/declarations/src/internal-unstable/admin-ui/pages/ItemPage/index.d.ts.map +1 -0
  26. package/dist/declarations/src/internal-unstable/admin-ui/pages/ListPage/index.d.ts.map +1 -0
  27. package/dist/declarations/src/internal-unstable/admin-ui/pages/NoAccessPage/index.d.ts.map +1 -0
  28. package/dist/declarations/src/internal-unstable/artifacts.d.ts.map +1 -0
  29. package/dist/declarations/src/lib/core/initialise-lists.d.ts +1 -1
  30. package/dist/declarations/src/schema.d.ts.map +1 -1
  31. package/dist/declarations/src/types/config/index.d.ts +60 -1
  32. package/dist/declarations/src/types/config/index.d.ts.map +1 -1
  33. package/dist/declarations/src/types/config/lists.d.ts +4 -4
  34. package/dist/declarations/src/types/context.d.ts +150 -0
  35. package/dist/declarations/src/types/context.d.ts.map +1 -1
  36. package/dist/declarations/src/types/next-fields.d.ts +1 -1
  37. package/dist/{express-e9ed9a7d.cjs.js → express-455ae20c.cjs.js} +1 -1
  38. package/dist/{express-6743b918.esm.js → express-7559ca2d.esm.js} +1 -1
  39. package/dist/{index-ac01583b.cjs.js → index-89635494.cjs.js} +4 -4
  40. package/dist/{index-24b78415.esm.js → index-baa799e0.esm.js} +4 -4
  41. package/dist/nixxie-cms-core.cjs.js +104 -77
  42. package/dist/nixxie-cms-core.esm.js +104 -77
  43. package/dist/{non-null-graphql-5315718c.esm.js → non-null-graphql-a84ed64d.esm.js} +1 -1
  44. package/dist/{non-null-graphql-17b83ddc.cjs.js → non-null-graphql-add6bb3d.cjs.js} +1 -1
  45. package/dist/{resolve-hooks-66fe8a8e.cjs.js → resolve-hooks-165a9ce2.cjs.js} +1 -1
  46. package/dist/{resolve-hooks-17aafd37.esm.js → resolve-hooks-6813a045.esm.js} +2 -2
  47. package/dist/{system-dfec2f0a.esm.js → system-03e49e4f.esm.js} +8 -4
  48. package/dist/{system-48c5f6df.cjs.js → system-a321642d.cjs.js} +8 -4
  49. package/dist/{useFilter-0b5a1ee6.esm.js → useFilter-9b6db1f9.esm.js} +1 -1
  50. package/dist/{useFilter-1a4e6900.cjs.js → useFilter-acc9d413.cjs.js} +1 -1
  51. package/fields/dist/nixxie-cms-core-fields.cjs.js +16 -16
  52. package/fields/dist/nixxie-cms-core-fields.esm.js +17 -17
  53. package/fields/types/bytes/dist/nixxie-cms-core-fields-types-bytes.cjs.js +3 -3
  54. package/fields/types/bytes/dist/nixxie-cms-core-fields-types-bytes.esm.js +3 -3
  55. package/fields/types/bytes/views/dist/nixxie-cms-core-fields-types-bytes-views.cjs.js +1 -1
  56. package/fields/types/bytes/views/dist/nixxie-cms-core-fields-types-bytes-views.esm.js +1 -1
  57. package/fields/types/password/dist/nixxie-cms-core-fields-types-password.cjs.js +3 -3
  58. package/fields/types/password/dist/nixxie-cms-core-fields-types-password.esm.js +3 -3
  59. package/fields/types/relationship/views/dist/nixxie-cms-core-fields-types-relationship-views.cjs.js +4 -4
  60. package/fields/types/relationship/views/dist/nixxie-cms-core-fields-types-relationship-views.esm.js +4 -4
  61. package/fields/types/select/views/dist/nixxie-cms-core-fields-types-select-views.cjs.js +1 -1
  62. package/fields/types/select/views/dist/nixxie-cms-core-fields-types-select-views.esm.js +1 -1
  63. package/fields/types/text/views/dist/nixxie-cms-core-fields-types-text-views.cjs.js +1 -1
  64. package/fields/types/text/views/dist/nixxie-cms-core-fields-types-text-views.esm.js +1 -1
  65. package/internal-unstable/admin-ui/id-field-view/dist/nixxie-cms-core-internal-unstable-admin-ui-id-field-view.cjs.d.ts +2 -0
  66. package/internal-unstable/admin-ui/id-field-view/dist/nixxie-cms-core-internal-unstable-admin-ui-id-field-view.cjs.js +244 -0
  67. package/internal-unstable/admin-ui/id-field-view/dist/nixxie-cms-core-internal-unstable-admin-ui-id-field-view.esm.js +235 -0
  68. package/internal-unstable/admin-ui/id-field-view/package.json +4 -0
  69. package/internal-unstable/admin-ui/next-config/package.json +4 -0
  70. package/internal-unstable/admin-ui/pages/App/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-App.cjs.d.ts +2 -0
  71. package/internal-unstable/admin-ui/pages/App/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-App.cjs.js +59 -0
  72. package/internal-unstable/admin-ui/pages/App/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-App.esm.js +55 -0
  73. package/internal-unstable/admin-ui/pages/App/package.json +4 -0
  74. package/internal-unstable/admin-ui/pages/CreateItemPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-CreateItemPage.cjs.d.ts +2 -0
  75. package/internal-unstable/admin-ui/pages/CreateItemPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-CreateItemPage.cjs.js +116 -0
  76. package/internal-unstable/admin-ui/pages/CreateItemPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-CreateItemPage.esm.js +112 -0
  77. package/internal-unstable/admin-ui/pages/CreateItemPage/package.json +4 -0
  78. package/internal-unstable/admin-ui/pages/HomePage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-HomePage.cjs.d.ts +2 -0
  79. package/internal-unstable/admin-ui/pages/HomePage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-HomePage.cjs.js +336 -0
  80. package/internal-unstable/admin-ui/pages/HomePage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-HomePage.esm.js +332 -0
  81. package/internal-unstable/admin-ui/pages/HomePage/package.json +4 -0
  82. package/internal-unstable/admin-ui/pages/ItemPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-ItemPage.cjs.d.ts +2 -0
  83. package/internal-unstable/admin-ui/pages/ItemPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-ItemPage.cjs.js +463 -0
  84. package/internal-unstable/admin-ui/pages/ItemPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-ItemPage.esm.js +455 -0
  85. package/internal-unstable/admin-ui/pages/ItemPage/package.json +4 -0
  86. package/internal-unstable/admin-ui/pages/ListPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-ListPage.cjs.d.ts +2 -0
  87. package/internal-unstable/admin-ui/pages/ListPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-ListPage.cjs.js +1195 -0
  88. package/internal-unstable/admin-ui/pages/ListPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-ListPage.esm.js +1187 -0
  89. package/internal-unstable/admin-ui/pages/ListPage/package.json +4 -0
  90. package/internal-unstable/admin-ui/pages/NoAccessPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-NoAccessPage.cjs.d.ts +2 -0
  91. package/internal-unstable/admin-ui/pages/NoAccessPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-NoAccessPage.cjs.js +40 -0
  92. package/internal-unstable/admin-ui/pages/NoAccessPage/dist/nixxie-cms-core-internal-unstable-admin-ui-pages-NoAccessPage.esm.js +35 -0
  93. package/internal-unstable/admin-ui/pages/NoAccessPage/package.json +4 -0
  94. package/internal-unstable/artifacts/dist/nixxie-cms-core-internal-unstable-artifacts.cjs.d.ts +2 -0
  95. package/internal-unstable/artifacts/dist/nixxie-cms-core-internal-unstable-artifacts.cjs.js +51 -0
  96. package/internal-unstable/artifacts/dist/nixxie-cms-core-internal-unstable-artifacts.esm.js +38 -0
  97. package/internal-unstable/artifacts/package.json +4 -0
  98. package/package.json +44 -44
  99. package/scripts/cli/dist/nixxie-cms-core-scripts-cli.cjs.js +44 -15
  100. package/scripts/cli/dist/nixxie-cms-core-scripts-cli.esm.js +44 -15
  101. package/scripts/dist/nixxie-cms-core-scripts.cjs.js +3 -3
  102. package/scripts/dist/nixxie-cms-core-scripts.esm.js +3 -3
  103. package/src/admin-ui/admin-meta-graphql.ts +168 -168
  104. package/src/admin-ui/components/CommandPalette.tsx +433 -431
  105. package/src/admin-ui/components/Navigation.tsx +389 -385
  106. package/src/admin-ui/components/PageContainer.tsx +311 -310
  107. package/src/admin-ui/components/WelcomeDialog.tsx +1 -1
  108. package/src/admin-ui/context.tsx +338 -338
  109. package/src/admin-ui/templates/app.ts +60 -60
  110. package/src/admin-ui/templates/create-item.ts +5 -5
  111. package/src/admin-ui/templates/home.ts +2 -2
  112. package/src/admin-ui/templates/item.tsx +5 -5
  113. package/src/admin-ui/templates/list.tsx +5 -5
  114. package/src/admin-ui/templates/next-config.ts +29 -0
  115. package/src/admin-ui/templates/no-access.ts +7 -7
  116. package/src/fields/types/bigInt/index.ts +181 -181
  117. package/src/fields/types/bytes/index.ts +275 -275
  118. package/src/fields/types/calendarDay/index.ts +194 -194
  119. package/src/fields/types/checkbox/index.ts +76 -76
  120. package/src/fields/types/decimal/index.ts +182 -182
  121. package/src/fields/types/file/index.ts +168 -168
  122. package/src/fields/types/float/index.ts +133 -133
  123. package/src/fields/types/image/index.ts +244 -244
  124. package/src/fields/types/integer/index.ts +156 -156
  125. package/src/fields/types/json/index.ts +77 -77
  126. package/src/fields/types/multiselect/index.ts +212 -212
  127. package/src/fields/types/password/index.ts +241 -241
  128. package/src/fields/types/relationship/index.ts +381 -381
  129. package/src/fields/types/relationship/views/RelationshipTable.tsx +190 -190
  130. package/src/fields/types/select/index.ts +226 -226
  131. package/src/fields/types/text/index.ts +207 -207
  132. package/src/fields/types/timestamp/index.ts +116 -116
  133. package/src/fields/types/virtual/index.ts +108 -108
  134. package/src/helpers.ts +342 -316
  135. package/src/index.ts +4 -0
  136. package/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/id-field-view.tsx +167 -167
  137. package/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/App/index.tsx +22 -22
  138. package/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/CreateItemPage/index.tsx +71 -71
  139. package/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/HomePage/index.tsx +333 -333
  140. package/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/ItemPage/common.tsx +358 -358
  141. package/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/ItemPage/index.tsx +483 -483
  142. package/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/ListPage/FilterAdd.tsx +221 -221
  143. package/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/ListPage/PaginationControls.tsx +170 -170
  144. package/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/ListPage/Tag.tsx +72 -72
  145. package/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/ListPage/index.tsx +1006 -1006
  146. package/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/NoAccessPage/index.tsx +24 -24
  147. package/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/artifacts.ts +5 -5
  148. package/src/lib/context/createContext.ts +165 -161
  149. package/src/lib/core/initialise-lists.ts +1097 -1097
  150. package/src/lib/id-field.ts +214 -214
  151. package/src/lib/telemetry.ts +342 -342
  152. package/src/schema.ts +237 -233
  153. package/src/scripts/telemetry.ts +1 -1
  154. package/src/types/config/index.ts +400 -333
  155. package/src/types/config/lists.ts +4 -4
  156. package/src/types/context.ts +700 -530
  157. package/src/types/next-fields.ts +499 -499
  158. package/src/types/telemetry.ts +51 -51
  159. package/tests/telemetry.test.ts +361 -361
  160. package/CHANGELOG.md +0 -3158
  161. package/___internal-do-not-use-will-break-in-patch/admin-ui/id-field-view/package.json +0 -4
  162. package/___internal-do-not-use-will-break-in-patch/admin-ui/next-config/package.json +0 -4
  163. package/___internal-do-not-use-will-break-in-patch/admin-ui/pages/App/package.json +0 -4
  164. package/___internal-do-not-use-will-break-in-patch/admin-ui/pages/CreateItemPage/package.json +0 -4
  165. package/___internal-do-not-use-will-break-in-patch/admin-ui/pages/HomePage/package.json +0 -4
  166. package/___internal-do-not-use-will-break-in-patch/admin-ui/pages/ItemPage/package.json +0 -4
  167. package/___internal-do-not-use-will-break-in-patch/admin-ui/pages/ListPage/package.json +0 -4
  168. package/___internal-do-not-use-will-break-in-patch/admin-ui/pages/NoAccessPage/package.json +0 -4
  169. package/___internal-do-not-use-will-break-in-patch/artifacts/package.json +0 -4
  170. package/dist/declarations/src/___internal-do-not-use-will-break-in-patch/admin-ui/id-field-view.d.ts.map +0 -1
  171. package/dist/declarations/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/App/index.d.ts.map +0 -1
  172. package/dist/declarations/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/CreateItemPage/index.d.ts.map +0 -1
  173. package/dist/declarations/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/HomePage/index.d.ts.map +0 -1
  174. package/dist/declarations/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/ItemPage/index.d.ts.map +0 -1
  175. package/dist/declarations/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/ListPage/index.d.ts.map +0 -1
  176. package/dist/declarations/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/NoAccessPage/index.d.ts.map +0 -1
  177. package/dist/declarations/src/___internal-do-not-use-will-break-in-patch/artifacts.d.ts.map +0 -1
  178. /package/dist/{common-1a350e11.cjs.js → common-5933f758.cjs.js} +0 -0
  179. /package/dist/{common-29fc82e6.esm.js → common-ea5c441a.esm.js} +0 -0
  180. /package/dist/declarations/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/id-field-view.d.ts +0 -0
  181. /package/dist/declarations/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/App/index.d.ts +0 -0
  182. /package/dist/declarations/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/CreateItemPage/index.d.ts +0 -0
  183. /package/dist/declarations/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/HomePage/index.d.ts +0 -0
  184. /package/dist/declarations/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/ItemPage/index.d.ts +0 -0
  185. /package/dist/declarations/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/ListPage/index.d.ts +0 -0
  186. /package/dist/declarations/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/admin-ui/pages/NoAccessPage/index.d.ts +0 -0
  187. /package/dist/declarations/src/{___internal-do-not-use-will-break-in-patch → internal-unstable}/artifacts.d.ts +0 -0
@@ -0,0 +1,1195 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var isDeepEqual = require('fast-deep-equal');
6
+ var router = require('next/router');
7
+ var react = require('react');
8
+ var actionBar = require('@keystar/ui/action-bar');
9
+ var button = require('@keystar/ui/button');
10
+ var dialog = require('@keystar/ui/dialog');
11
+ var icon = require('@keystar/ui/icon');
12
+ var all = require('@keystar/ui/icon/all');
13
+ var chevronDownIcon = require('@keystar/ui/icon/icons/chevronDownIcon');
14
+ var searchXIcon = require('@keystar/ui/icon/icons/searchXIcon');
15
+ var textSelectIcon = require('@keystar/ui/icon/icons/textSelectIcon');
16
+ var undo2Icon = require('@keystar/ui/icon/icons/undo2Icon');
17
+ var layout = require('@keystar/ui/layout');
18
+ var menu = require('@keystar/ui/menu');
19
+ var progress = require('@keystar/ui/progress');
20
+ var searchField = require('@keystar/ui/search-field');
21
+ var slots = require('@keystar/ui/slots');
22
+ var style = require('@keystar/ui/style');
23
+ var table = require('@keystar/ui/table');
24
+ var toast = require('@keystar/ui/toast');
25
+ var tooltip = require('@keystar/ui/tooltip');
26
+ var typography = require('@keystar/ui/typography');
27
+ var link = require('@keystar/ui/link');
28
+ var notice = require('@keystar/ui/notice');
29
+ var client = require('@apollo/client');
30
+ var react$1 = require('@apollo/client/react');
31
+ var pick = require('../../../../../dist/pick-5fe45878.cjs.js');
32
+ var utils$1 = require('../../../../../dist/utils-230cddb1.cjs.js');
33
+ var GraphQLErrorNotice = require('../../../../../dist/GraphQLErrorNotice-cd74180d.cjs.js');
34
+ var PageContainer = require('../../../../../dist/PageContainer-abd7159f.cjs.js');
35
+ var adminUi_context_dist_nixxieCmsCoreAdminUiContext = require('../../../../../dist/context-b5204629.cjs.js');
36
+ require('@react-aria/utils');
37
+ require('@keystar/ui/icon/icons/chevronRightIcon');
38
+ require('@keystar/ui/icon/icons/textCursorInputIcon');
39
+ var filters = require('../../../../../dist/filters-b3e5eb50.cjs.js');
40
+ var jsxRuntime = require('react/jsx-runtime');
41
+ var actionData = require('../../../../../dist/actionData-7858738d.cjs.js');
42
+ var useFilter = require('../../../../../dist/useFilter-acc9d413.cjs.js');
43
+ var picker = require('@keystar/ui/picker');
44
+ var xIcon = require('@keystar/ui/icon/icons/xIcon');
45
+ var utils = require('@keystar/ui/utils');
46
+ require('graphql');
47
+ require('next/head');
48
+ require('next/link');
49
+ require('apollo-upload-client/UploadHttpLink.mjs');
50
+ require('@keystar/ui/core');
51
+ require('@nixxie-cms/core/admin-ui/router');
52
+ require('@keystar/ui/icon/icons/chevronLeftIcon');
53
+ require('@keystar/ui/tag');
54
+ require('../../../../../dist/admin-meta-graphql-306c224a.cjs.js');
55
+
56
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
57
+
58
+ var isDeepEqual__default = /*#__PURE__*/_interopDefault(isDeepEqual);
59
+
60
+ function FilterAdd({
61
+ listKey,
62
+ onAdd,
63
+ isDisabled
64
+ }) {
65
+ const triggerRef = react.useRef(null);
66
+ const [state, setState] = react.useState({
67
+ kind: 'selecting-field'
68
+ });
69
+ const [forceValidation, setForceValidation] = react.useState(false);
70
+ const formId = react.useId();
71
+ const {
72
+ fieldsWithFilters,
73
+ filtersByFieldThenType,
74
+ list
75
+ } = useFilterFields(listKey);
76
+ const resetState = () => {
77
+ setState({
78
+ kind: 'selecting-field'
79
+ });
80
+ setForceValidation(false);
81
+ // This is a bit of a hack to ensure the trigger button is focused after the
82
+ // dialog closes, since we're forking the render
83
+ setTimeout(() => {
84
+ var _triggerRef$current;
85
+ triggerRef === null || triggerRef === void 0 || (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 || _triggerRef$current.focus();
86
+ }, 200);
87
+ };
88
+ const onSubmit = event => {
89
+ if (event.target !== event.currentTarget) return;
90
+ event.preventDefault();
91
+ setForceValidation(true);
92
+ if (state.kind !== 'filter-value') return;
93
+
94
+ // TODO: Special "empty" types need to be documented somewhere. Filters that
95
+ // have no editable value, basically `null` or `!null`. Which offers:
96
+ // * better DX — we can avoid weird nullable types and UIs that don't make sense
97
+ // * better UX — users don't have to jump through mental hoops, like "is not exactly" + submit empty field
98
+ if (state.filterType !== 'empty' && state.filterType !== 'not_empty' && state.filterValue == null) {
99
+ return;
100
+ }
101
+ onAdd({
102
+ field: state.fieldPath,
103
+ type: state.filterType,
104
+ value: state.filterValue
105
+ });
106
+ resetState();
107
+ };
108
+ if (state.kind === 'filter-value') {
109
+ const {
110
+ Filter
111
+ } = fieldsWithFilters[state.fieldPath].controller.filter;
112
+ const fieldLabel = list.fields[state.fieldPath].label;
113
+ const filterTypes = filtersByFieldThenType[state.fieldPath];
114
+ const typeLabel = filterTypes[state.filterType];
115
+ return /*#__PURE__*/jsxRuntime.jsxs(dialog.DialogTrigger, {
116
+ type: "popover",
117
+ mobileType: "tray",
118
+ defaultOpen: true,
119
+ onOpenChange: isOpen => !isOpen && resetState(),
120
+ children: [/*#__PURE__*/jsxRuntime.jsxs(button.ActionButton, {
121
+ children: [/*#__PURE__*/jsxRuntime.jsx(typography.Text, {
122
+ children: "Filter"
123
+ }), /*#__PURE__*/jsxRuntime.jsx(icon.Icon, {
124
+ src: chevronDownIcon.chevronDownIcon
125
+ })]
126
+ }), /*#__PURE__*/jsxRuntime.jsxs(dialog.Dialog, {
127
+ children: [/*#__PURE__*/jsxRuntime.jsxs(typography.Heading, {
128
+ children: ["Filter by ", fieldLabel.toLocaleLowerCase()]
129
+ }), /*#__PURE__*/jsxRuntime.jsx(slots.Content, {
130
+ children: /*#__PURE__*/jsxRuntime.jsxs("form", {
131
+ onSubmit: onSubmit,
132
+ id: formId,
133
+ children: [/*#__PURE__*/jsxRuntime.jsx("button", {
134
+ type: "submit",
135
+ form: formId,
136
+ style: {
137
+ display: 'none'
138
+ }
139
+ }), /*#__PURE__*/jsxRuntime.jsxs(layout.Grid, {
140
+ gap: "large",
141
+ rows: "auto minmax(0, 1fr)",
142
+ height: "100%",
143
+ children: [/*#__PURE__*/jsxRuntime.jsx(picker.Picker, {
144
+ width: "100%",
145
+ "aria-label": "filter type",
146
+ isRequired: true,
147
+ items: Object.keys(filterTypes).map(filterType => ({
148
+ label: filterTypes[filterType],
149
+ value: filterType
150
+ })),
151
+ selectedKey: state.filterType,
152
+ onSelectionChange: key => {
153
+ if (key) {
154
+ setState({
155
+ kind: 'filter-value',
156
+ fieldPath: state.fieldPath,
157
+ filterValue: fieldsWithFilters[state.fieldPath].controller.filter.types[key].initialValue,
158
+ filterType: key
159
+ });
160
+ }
161
+ },
162
+ children: item => /*#__PURE__*/jsxRuntime.jsx(menu.Item, {
163
+ children: item.label
164
+ }, item.value)
165
+ }), /*#__PURE__*/jsxRuntime.jsx(Filter, {
166
+ autoFocus: true,
167
+ context: "add",
168
+ forceValidation: forceValidation,
169
+ typeLabel: typeLabel,
170
+ type: state.filterType,
171
+ value: state.filterValue,
172
+ onChange: value => {
173
+ setState(state => ({
174
+ ...state,
175
+ filterValue: value
176
+ }));
177
+ }
178
+ })]
179
+ })]
180
+ })
181
+ }), /*#__PURE__*/jsxRuntime.jsxs(button.ButtonGroup, {
182
+ children: [/*#__PURE__*/jsxRuntime.jsx(button.Button, {
183
+ onPress: resetState,
184
+ children: "Cancel"
185
+ }), /*#__PURE__*/jsxRuntime.jsx(button.Button, {
186
+ prominence: "high",
187
+ type: "submit",
188
+ form: formId,
189
+ children: "Add"
190
+ })]
191
+ })]
192
+ })]
193
+ });
194
+ }
195
+ return /*#__PURE__*/jsxRuntime.jsx(react.Fragment, {
196
+ children: /*#__PURE__*/jsxRuntime.jsxs(menu.MenuTrigger, {
197
+ children: [/*#__PURE__*/jsxRuntime.jsxs(button.ActionButton, {
198
+ ref: triggerRef,
199
+ isDisabled: isDisabled,
200
+ children: [/*#__PURE__*/jsxRuntime.jsx(typography.Text, {
201
+ children: "Filter"
202
+ }), /*#__PURE__*/jsxRuntime.jsx(icon.Icon, {
203
+ src: chevronDownIcon.chevronDownIcon
204
+ })]
205
+ }), /*#__PURE__*/jsxRuntime.jsx(menu.Menu, {
206
+ items: Object.keys(filtersByFieldThenType).map(fieldPath => ({
207
+ label: fieldsWithFilters[fieldPath].label,
208
+ value: fieldPath
209
+ })),
210
+ onAction: fieldPath => {
211
+ const filterType = Object.keys(filtersByFieldThenType[fieldPath])[0];
212
+ setState({
213
+ kind: 'filter-value',
214
+ fieldPath: fieldPath,
215
+ filterType,
216
+ filterValue: fieldsWithFilters[fieldPath].controller.filter.types[filterType].initialValue
217
+ });
218
+ },
219
+ children: item => /*#__PURE__*/jsxRuntime.jsx(menu.Item, {
220
+ children: item.label
221
+ }, item.value)
222
+ })]
223
+ })
224
+ });
225
+ }
226
+
227
+ // TODO: broken if user uses the same filter twice
228
+ function useFilterFields(listKey) {
229
+ const list = adminUi_context_dist_nixxieCmsCoreAdminUiContext.useList(listKey);
230
+ const fieldsWithFilters = react.useMemo(() => {
231
+ const fieldsWithFilters = {};
232
+ for (const fieldPath in list.fields) {
233
+ const field = list.fields[fieldPath];
234
+ if (field.isFilterable && field.controller.filter) {
235
+ fieldsWithFilters[fieldPath] = field;
236
+ }
237
+ }
238
+ return fieldsWithFilters;
239
+ }, [list.fields]);
240
+ const filtersByFieldThenType = react.useMemo(() => {
241
+ const filtersByFieldThenType = {};
242
+ for (const fieldPath in fieldsWithFilters) {
243
+ const field = fieldsWithFilters[fieldPath];
244
+ const filters = {};
245
+ for (const filterType in field.controller.filter.types) {
246
+ filters[filterType] = field.controller.filter.types[filterType].label;
247
+ }
248
+ filtersByFieldThenType[fieldPath] = filters;
249
+ }
250
+ return filtersByFieldThenType;
251
+ }, [fieldsWithFilters]);
252
+ return {
253
+ fieldsWithFilters,
254
+ filtersByFieldThenType,
255
+ list
256
+ };
257
+ }
258
+
259
+ // TODO: move to @keystar/ui and implement properly
260
+ function Tag(props) {
261
+ const {
262
+ children,
263
+ onRemove
264
+ } = props;
265
+ const rootId = react.useId();
266
+ const textId = utils.composeId(rootId, 'label');
267
+ const removeId = utils.composeId(rootId, 'remove');
268
+ return /*#__PURE__*/jsxRuntime.jsxs(button.ActionButton, {
269
+ "aria-labelledby": [textId, removeId].join(' '),
270
+ onKeyDown: e => {
271
+ if (!onRemove) {
272
+ return;
273
+ }
274
+ if (e.key === 'Backspace' || e.key === 'Delete') {
275
+ onRemove();
276
+ }
277
+ },
278
+ UNSAFE_className: style.css({
279
+ borderRadius: style.tokenSchema.size.radius.full,
280
+ height: style.tokenSchema.size.element.small,
281
+ paddingInlineStart: style.tokenSchema.size.space.small,
282
+ paddingInlineEnd: 0
283
+ }),
284
+ children: [/*#__PURE__*/jsxRuntime.jsx(slots.SlotProvider, {
285
+ slots: {
286
+ text: {
287
+ id: textId
288
+ }
289
+ },
290
+ children: children
291
+ }), onRemove && /*#__PURE__*/jsxRuntime.jsx("span", {
292
+ role: "button",
293
+ className: style.css({
294
+ alignItems: 'center',
295
+ borderRadius: '50%',
296
+ display: 'flex',
297
+ justifyContent: 'center',
298
+ height: style.tokenSchema.size.element.small,
299
+ width: style.tokenSchema.size.element.small,
300
+ ':hover': {
301
+ backgroundColor: style.tokenSchema.color.alias.backgroundHovered
302
+ },
303
+ ':active': {
304
+ backgroundColor: style.tokenSchema.color.alias.backgroundPressed
305
+ }
306
+ }),
307
+ onClick: e => {
308
+ e.preventDefault();
309
+ e.stopPropagation();
310
+ onRemove();
311
+ },
312
+ children: /*#__PURE__*/jsxRuntime.jsx(icon.Icon, {
313
+ id: removeId,
314
+ src: xIcon.xIcon,
315
+ "aria-label": "backspace to remove"
316
+ })
317
+ })]
318
+ });
319
+ }
320
+
321
+ function FilterTag({
322
+ filter,
323
+ field,
324
+ onChange,
325
+ onRemove
326
+ }) {
327
+ const Label = field.controller.filter.Label;
328
+ const tagElement = /*#__PURE__*/jsxRuntime.jsx(Tag, {
329
+ onRemove: onRemove,
330
+ children: /*#__PURE__*/jsxRuntime.jsxs(typography.Text, {
331
+ children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
332
+ children: [field.label, " "]
333
+ }), /*#__PURE__*/jsxRuntime.jsx(Label, {
334
+ label: field.controller.filter.types[filter.type].label,
335
+ type: filter.type,
336
+ value: filter.value
337
+ })]
338
+ })
339
+ });
340
+
341
+ // TODO: Special "empty" types need to be documented somewhere. Filters that
342
+ // have no editable value, basically `null` or `!null`. Which offers:
343
+ // * better DX — we can avoid weird nullable types and UIs that don't make sense
344
+ // * better UX — users don't have to jump through mental hoops, like "is not exactly" + submit empty field
345
+ if (filter.type === 'empty' || filter.type === 'not_empty') return tagElement;
346
+ return /*#__PURE__*/jsxRuntime.jsxs(dialog.DialogTrigger, {
347
+ type: "popover",
348
+ mobileType: "tray",
349
+ children: [tagElement, onDismiss => /*#__PURE__*/jsxRuntime.jsx(FilterEdit, {
350
+ onChange: onChange,
351
+ onDismiss: onDismiss,
352
+ field: field,
353
+ filter: filter
354
+ })]
355
+ });
356
+ }
357
+ function FilterEdit({
358
+ filter,
359
+ field,
360
+ onChange: onAdd,
361
+ onDismiss
362
+ }) {
363
+ var _field$controller$fil;
364
+ const formId = react.useId();
365
+ const [value, setValue] = react.useState(filter.value);
366
+ const onSubmit = event => {
367
+ if (event.target !== event.currentTarget) return;
368
+ event.preventDefault();
369
+ onAdd({
370
+ ...filter,
371
+ value
372
+ });
373
+ onDismiss();
374
+ };
375
+ const Filter = field.controller.filter.Filter;
376
+ const filterTypeLabel = (_field$controller$fil = field.controller.filter) === null || _field$controller$fil === void 0 ? void 0 : _field$controller$fil.types[filter.type].label;
377
+ return /*#__PURE__*/jsxRuntime.jsxs(dialog.Dialog, {
378
+ children: [/*#__PURE__*/jsxRuntime.jsx(typography.Heading, {
379
+ children: field.label
380
+ }), /*#__PURE__*/jsxRuntime.jsx(slots.Content, {
381
+ children: /*#__PURE__*/jsxRuntime.jsx("form", {
382
+ onSubmit: onSubmit,
383
+ id: formId,
384
+ children: /*#__PURE__*/jsxRuntime.jsx(Filter, {
385
+ autoFocus: true,
386
+ context: "edit",
387
+ typeLabel: filterTypeLabel,
388
+ onChange: setValue,
389
+ type: filter.type,
390
+ value: value
391
+ })
392
+ })
393
+ }), /*#__PURE__*/jsxRuntime.jsxs(button.ButtonGroup, {
394
+ children: [/*#__PURE__*/jsxRuntime.jsx(button.Button, {
395
+ onPress: onDismiss,
396
+ children: "Cancel"
397
+ }), /*#__PURE__*/jsxRuntime.jsx(button.Button, {
398
+ type: "submit",
399
+ prominence: "high",
400
+ form: formId,
401
+ children: "Save"
402
+ })]
403
+ })]
404
+ });
405
+ }
406
+ function getFilters(list, query) {
407
+ const param_ = query.filter;
408
+ const params = Array.isArray(param_) ? param_ : typeof param_ === 'string' ? [param_] : [];
409
+ if (!params.length) {
410
+ if (!list.initialFilter) return [];
411
+ const filters = [];
412
+ for (const [fieldKey, filter] of Object.entries(list.initialFilter)) {
413
+ const {
414
+ controller
415
+ } = list.fields[fieldKey];
416
+ for (const f of (_controller$filter$pa = (_controller$filter = controller.filter) === null || _controller$filter === void 0 ? void 0 : _controller$filter.parseGraphQL(filter)) !== null && _controller$filter$pa !== void 0 ? _controller$filter$pa : []) {
417
+ var _controller$filter$pa, _controller$filter;
418
+ filters.push({
419
+ field: fieldKey,
420
+ ...f
421
+ });
422
+ }
423
+ }
424
+ return filters;
425
+ }
426
+ const filters = [];
427
+ for (const [fieldPath, field] of Object.entries(list.fields)) {
428
+ if (!field.isFilterable) continue;
429
+ if (!field.controller.filter) continue;
430
+ for (const filterType in field.controller.filter.types) {
431
+ const prefix = `${fieldPath}_${filterType}`;
432
+ for (const queryFilter of params) {
433
+ if (!queryFilter.startsWith(prefix)) continue;
434
+ if (queryFilter === prefix) {
435
+ filters.push({
436
+ type: filterType,
437
+ field: fieldPath,
438
+ value: null
439
+ });
440
+ continue;
441
+ }
442
+ const queryValue = queryFilter.slice(prefix.length + 1);
443
+ try {
444
+ const value = JSON.parse(queryValue);
445
+ filters.push({
446
+ type: filterType,
447
+ field: fieldPath,
448
+ value
449
+ });
450
+ } catch (e) {
451
+ console.error('Error parsing filter', queryFilter);
452
+ }
453
+ }
454
+ }
455
+ }
456
+ return filters;
457
+ }
458
+ function getSort(list, query) {
459
+ const param = typeof query.sortBy === 'string' ? query.sortBy : null;
460
+ if (param === '') return null;
461
+ if (!param) {
462
+ if (!list.initialSort) return null;
463
+ return {
464
+ column: list.initialSort.field,
465
+ direction: list.initialSort.direction === 'ASC' ? 'ascending' : 'descending'
466
+ };
467
+ }
468
+ const fieldKey = param.startsWith('-') ? param.slice(1) : param;
469
+ const direction = param.startsWith('-') ? 'descending' : 'ascending';
470
+ const field = list.fields[fieldKey];
471
+ if (!field) return null;
472
+ if (!field.isOrderable) return null;
473
+ return {
474
+ column: fieldKey,
475
+ direction
476
+ };
477
+ }
478
+ function getCurrentPage(_, query) {
479
+ const currentPage = Number(query.page);
480
+ if (Number.isNaN(currentPage) || currentPage < 1) return 1;
481
+ return currentPage;
482
+ }
483
+ function getPageSize(list, query) {
484
+ const pageSize = Number(query.pageSize);
485
+ if (Number.isNaN(pageSize) || pageSize < 1) return list.pageSize;
486
+ return adminUi_context_dist_nixxieCmsCoreAdminUiContext.snapValueToClosest(pageSize);
487
+ }
488
+ function getColumns(list, query) {
489
+ const param_ = query.column;
490
+ const params = Array.isArray(param_) ? param_ : typeof param_ === 'string' ? [param_] : [];
491
+ if (!params.length) return list.initialColumns;
492
+ return params;
493
+ }
494
+ const getListPage = props => () => /*#__PURE__*/jsxRuntime.jsx(ListPage, {
495
+ ...props
496
+ });
497
+ function ListPage({
498
+ listKey
499
+ }) {
500
+ var _list$hideCreate, _data$items$map, _data$items, _data$items4;
501
+ const localStorageListKey = `nixxie.list.${listKey}.list.page.info`;
502
+ const list = adminUi_context_dist_nixxieCmsCoreAdminUiContext.useList(listKey);
503
+ const {
504
+ query,
505
+ replace: routerReplace,
506
+ isReady
507
+ } = router.useRouter();
508
+ const [loaded, setLoaded] = react.useState(false);
509
+ const [sort, setSort] = react.useState(() => getSort(list, {}));
510
+ const [columns, setColumns] = react.useState(list.initialColumns);
511
+ const [filters$1, setFilters] = react.useState(() => getFilters(list, {}));
512
+ const [currentPage, setCurrentPage] = react.useState(1);
513
+ const [pageSize, setPageSize] = react.useState(list.pageSize);
514
+ const [searchString, setSearchString] = react.useState('');
515
+ const [selectedItems, setSelectedItems] = react.useState(() => new Set([]));
516
+ const [activeAction, setActiveAction] = react.useState(null);
517
+ const [actionResult, setActionResult] = react.useState(null);
518
+ const dirty = react.useMemo(() => {
519
+ const defaultFilters = getFilters(list, {});
520
+ const defaultSort = getSort(list, {});
521
+ return !!searchString || !isDeepEqual__default["default"](filters$1, defaultFilters) || !isDeepEqual__default["default"](sort, defaultSort) || !isDeepEqual__default["default"](columns, list.initialColumns);
522
+ }, [searchString, filters$1, sort, columns, list.initialColumns]);
523
+ react.useEffect(() => {
524
+ if (!isReady) return;
525
+ if (loaded) return;
526
+ let localStorageQuery;
527
+ try {
528
+ var _localStorage$getItem;
529
+ localStorageQuery = JSON.parse((_localStorage$getItem = localStorage.getItem(localStorageListKey)) !== null && _localStorage$getItem !== void 0 ? _localStorage$getItem : '{}');
530
+ } catch {}
531
+ setSort(getSort(list, {
532
+ ...localStorageQuery,
533
+ ...query
534
+ }));
535
+ setColumns(getColumns(list, {
536
+ ...localStorageQuery,
537
+ ...query
538
+ }));
539
+ setFilters(getFilters(list, {
540
+ ...localStorageQuery,
541
+ ...query
542
+ }));
543
+ setCurrentPage(getCurrentPage(list, {
544
+ ...localStorageQuery,
545
+ ...query
546
+ }));
547
+ setPageSize(getPageSize(list, {
548
+ ...localStorageQuery,
549
+ ...query
550
+ }));
551
+ setSearchString(typeof query.search === 'string' ? query.search : '');
552
+ setLoaded(true);
553
+ }, [list, isReady]);
554
+ react.useEffect(() => {
555
+ if (!isReady) return;
556
+ if (!loaded) return; // TODO: stop this race condition properly
557
+ const updatedQuery = {
558
+ ...(columns.length ? {
559
+ column: columns
560
+ } : {}),
561
+ ...(sort ? {
562
+ sortBy: sort.direction === 'ascending' ? sort.column : `-${sort.column}`
563
+ } : {}),
564
+ ...(filters$1.length ? {
565
+ filter: function () {
566
+ const result = [];
567
+ for (const filter of filters$1) {
568
+ if (filter.type === 'not_empty' || filter.type === 'empty') {
569
+ result.push(`${filter.field}_${filter.type}`);
570
+ continue;
571
+ }
572
+ result.push(`${filter.field}_${filter.type}_${JSON.stringify(filter.value)}`);
573
+ }
574
+ return result;
575
+ }()
576
+ } : {}),
577
+ ...(currentPage > 1 ? {
578
+ page: currentPage
579
+ } : {}),
580
+ ...(pageSize !== list.pageSize ? {
581
+ pageSize
582
+ } : {}),
583
+ ...(searchString ? {
584
+ search: searchString
585
+ } : {})
586
+ };
587
+ localStorage.setItem(localStorageListKey, JSON.stringify(updatedQuery));
588
+ routerReplace({
589
+ query: updatedQuery
590
+ });
591
+ }, [columns, sort, filters$1, currentPage, pageSize, searchString, list, loaded]);
592
+ const allowCreate = !((_list$hideCreate = list.hideCreate) !== null && _list$hideCreate !== void 0 ? _list$hideCreate : true);
593
+ const isConstrained = Boolean(filters$1.length || query.search);
594
+ const readableFields = Object.values(list.fields).map(f => ({
595
+ id: f.key,
596
+ value: f.key,
597
+ label: f.label,
598
+ isDisabled: f.listView.fieldMode === 'read'
599
+ }));
600
+ const where = react.useMemo(() => filters$1.map(filter => {
601
+ return list.fields[filter.field].controller.filter.graphql({
602
+ type: filter.type,
603
+ value: filter.value
604
+ });
605
+ }), [list, filters$1]);
606
+ const actionsAvailable = react.useMemo(() => list.actions.filter(x => filters.isActionAvailable(x, x.listView)), [list.actions]);
607
+ const actionConditionalFilterFieldKeys = react.useMemo(() => {
608
+ const fieldKeys = new Set();
609
+ for (const action of actionsAvailable) {
610
+ for (const fieldKey of filters.getConditionalFilterFieldKeys(action.listView.actionMode)) {
611
+ fieldKeys.add(fieldKey);
612
+ }
613
+ }
614
+ return fieldKeys;
615
+ }, [actionsAvailable]);
616
+ const search = useFilter.useSearchFilter(searchString, list, list.initialSearchFields);
617
+ const {
618
+ data,
619
+ error,
620
+ refetch,
621
+ loading
622
+ } = react$1.useQuery(react.useMemo(() => {
623
+ const fieldKeys = new Set(columns); // only the shown columns
624
+
625
+ // and any fields needed by the action filters
626
+ for (const fieldKey of actionConditionalFilterFieldKeys) {
627
+ fieldKeys.add(fieldKey);
628
+ }
629
+ for (const action of actionsAvailable) {
630
+ for (const arg of action.graphql.arguments) {
631
+ if (!arg.source) continue;
632
+ fieldKeys.add(arg.source.itemField);
633
+ }
634
+ }
635
+ const fieldsToQuery = [...fieldKeys].filter(fieldKey => fieldKey !== 'id') // id is always included
636
+ .map(fieldKey => {
637
+ var _list$fields$fieldKey;
638
+ return (_list$fields$fieldKey = list.fields[fieldKey]) === null || _list$fields$fieldKey === void 0 ? void 0 : _list$fields$fieldKey.controller.graphqlSelection;
639
+ }).filter(Boolean).join('\n');
640
+
641
+ // TODO: less interpolation
642
+ return client.gql`
643
+ query (
644
+ $where: ${list.graphql.names.whereInputName},
645
+ $take: Int!,
646
+ $skip: Int!,
647
+ $orderBy: [${list.graphql.names.listOrderName}!]
648
+ ) {
649
+ items: ${list.graphql.names.listQueryName}(
650
+ where: $where,
651
+ take: $take,
652
+ skip: $skip,
653
+ orderBy: $orderBy
654
+ ) {
655
+ id
656
+ ${fieldsToQuery}
657
+ }
658
+ count: ${list.graphql.names.listQueryCountName}(where: $where)
659
+ }
660
+ `;
661
+ }, [list, list.fields, columns, actionsAvailable, actionConditionalFilterFieldKeys]), {
662
+ fetchPolicy: 'cache-and-network',
663
+ errorPolicy: 'all',
664
+ variables: {
665
+ where: {
666
+ ...(where.length ? {
667
+ AND: where
668
+ } : {}),
669
+ ...(search.length ? {
670
+ OR: search
671
+ } : {})
672
+ },
673
+ take: pageSize,
674
+ skip: (currentPage - 1) * pageSize,
675
+ orderBy: sort ? [{
676
+ [sort.column]: sort.direction === 'ascending' ? 'asc' : 'desc'
677
+ }] : undefined
678
+ }
679
+ });
680
+ react.useEffect(() => {
681
+ if (typeof (data === null || data === void 0 ? void 0 : data.count) !== 'number') return;
682
+ const lastPage = Math.max(Math.ceil(data.count / pageSize), 1);
683
+ if (currentPage > lastPage) {
684
+ setCurrentPage(lastPage);
685
+ }
686
+ }, [data]);
687
+ const selectedItemIds = (selectedItems === 'all' ? (_data$items$map = data === null || data === void 0 || (_data$items = data.items) === null || _data$items === void 0 ? void 0 : _data$items.map(item => item.id)) !== null && _data$items$map !== void 0 ? _data$items$map : [] : Array.from(selectedItems)).map(String);
688
+ const isEmpty = Boolean((data === null || data === void 0 ? void 0 : data.count) === 0 && !isConstrained);
689
+ const headers = columns.map(column => {
690
+ var _data$items2;
691
+ const field = list.fields[column];
692
+ if (!field) return;
693
+ return {
694
+ id: field.key,
695
+ label: field.label,
696
+ allowsSorting: !isConstrained && !(data !== null && data !== void 0 && (_data$items2 = data.items) !== null && _data$items2 !== void 0 && _data$items2.length) ? false : field.isOrderable
697
+ };
698
+ }).filter(x => Boolean(x));
699
+ function onAddFilter(newFilter) {
700
+ setFilters(prevFilters => [...prevFilters, newFilter]);
701
+ }
702
+ function resetToDefaults() {
703
+ const defaultFilters = getFilters(list, {});
704
+ const defaultSort = getSort(list, {});
705
+ setSearchString('');
706
+ setColumns(list.initialColumns);
707
+ setFilters(defaultFilters);
708
+ setSort(defaultSort);
709
+ }
710
+ const actionsList = [...actionsAvailable, ...(list.hideDelete ? [] : [{
711
+ key: 'delete',
712
+ label: 'Delete',
713
+ icon: 'trash2Icon',
714
+ graphql: {
715
+ arguments: [],
716
+ names: {
717
+ one: list.graphql.names.deleteMutationName,
718
+ many: list.graphql.names.deleteManyMutationName
719
+ }
720
+ },
721
+ messages: {
722
+ promptTitle: 'Delete {singular}?',
723
+ promptTitleMany: 'Delete {count} {singular|plural}?',
724
+ prompt: 'Are you sure you want to delete {singular}? This action cannot be undone.',
725
+ promptMany: 'Are you sure you want to delete {count} {singular|plural}? This action cannot be undone.',
726
+ promptConfirmLabel: 'Yes, delete',
727
+ promptConfirmLabelMany: 'Yes, delete',
728
+ success: 'Deleted {singular}.',
729
+ successMany: 'Deleted {countSuccess} {singular|plural}.',
730
+ fail: 'Unable to delete {singular}.',
731
+ failMany: 'Unable to delete {countFail} {singular|plural}.'
732
+ },
733
+ itemView: null,
734
+ // unusud
735
+ listView: {
736
+ actionMode: list.hideDelete ? 'hidden' : 'enabled'
737
+ }
738
+ }])];
739
+ const selectionMode = actionsList.length > 0 ? 'multiple' : 'none';
740
+ const selectedRows = react.useMemo(() => {
741
+ var _data$items$filter, _data$items3;
742
+ return (_data$items$filter = data === null || data === void 0 || (_data$items3 = data.items) === null || _data$items3 === void 0 ? void 0 : _data$items3.filter(item => selectedItemIds.includes(String(item.id)))) !== null && _data$items$filter !== void 0 ? _data$items$filter : [];
743
+ }, [data === null || data === void 0 ? void 0 : data.items, selectedItemIds]);
744
+ const actionConditionalFilterFields = react.useMemo(() => pick.pick(list.fields, actionConditionalFilterFieldKeys), [actionConditionalFilterFieldKeys, list.fields]);
745
+ const serializedSelectedRows = react.useMemo(() => selectedRows.map(row => {
746
+ const value = utils$1.deserializeItemToValue(actionConditionalFilterFields, row);
747
+ return filters.serializeItemForConditionalFilters(actionConditionalFilterFields, value);
748
+ }), [actionConditionalFilterFields, selectedRows]);
749
+ const {
750
+ actions,
751
+ disabledKeys: disabledActionKeys
752
+ } = react.useMemo(() => {
753
+ const disabledKeys = [];
754
+ const actions = [];
755
+ for (const action of actionsList) {
756
+ let actionMode;
757
+ for (const serializedValue of serializedSelectedRows) {
758
+ const mode = filters.resolveActionMode(action.listView.actionMode, serializedValue);
759
+ if (mode === 'hidden') {
760
+ actionMode = 'hidden';
761
+ break;
762
+ }
763
+ if (mode === 'disabled') actionMode = 'disabled';
764
+ }
765
+ if (actionMode === 'hidden') continue;
766
+ if (actionMode === 'disabled') disabledKeys.push(action.key);
767
+ actions.push(action);
768
+ }
769
+ return {
770
+ actions,
771
+ disabledKeys
772
+ };
773
+ }, [actionsList, serializedSelectedRows]);
774
+ return /*#__PURE__*/jsxRuntime.jsx(PageContainer.PageContainer, {
775
+ header: /*#__PURE__*/jsxRuntime.jsx(ListPageHeader, {
776
+ listKey: listKey,
777
+ showCreate: allowCreate
778
+ }),
779
+ title: list.label,
780
+ children: /*#__PURE__*/jsxRuntime.jsxs(layout.VStack, {
781
+ flex: true,
782
+ gap: "large",
783
+ paddingX: "xlarge",
784
+ paddingY: "xlarge",
785
+ minHeight: 0,
786
+ minWidth: 0,
787
+ children: [/*#__PURE__*/jsxRuntime.jsxs(layout.HStack, {
788
+ gap: "regular",
789
+ alignItems: "center",
790
+ children: [/*#__PURE__*/jsxRuntime.jsx(searchField.SearchField, {
791
+ "aria-label": "Search",
792
+ isDisabled: isEmpty,
793
+ onClear: () => setSearchString(''),
794
+ onChange: v => setSearchString(v),
795
+ placeholder: "Search\u2026",
796
+ value: searchString,
797
+ width: "alias.singleLineWidth",
798
+ flexGrow: {
799
+ mobile: 1,
800
+ tablet: 0
801
+ }
802
+ }), /*#__PURE__*/jsxRuntime.jsx(FilterAdd, {
803
+ listKey: listKey,
804
+ onAdd: onAddFilter,
805
+ isDisabled: isEmpty
806
+ }), /*#__PURE__*/jsxRuntime.jsxs(menu.MenuTrigger, {
807
+ children: [/*#__PURE__*/jsxRuntime.jsxs(button.ActionButton, {
808
+ isDisabled: isEmpty,
809
+ children: [/*#__PURE__*/jsxRuntime.jsx(typography.Text, {
810
+ children: "Columns"
811
+ }), /*#__PURE__*/jsxRuntime.jsx(icon.Icon, {
812
+ src: chevronDownIcon.chevronDownIcon
813
+ })]
814
+ }), /*#__PURE__*/jsxRuntime.jsx(menu.Menu, {
815
+ items: readableFields,
816
+ disallowEmptySelection: true,
817
+ onSelectionChange: selection => {
818
+ if (selection === 'all') {
819
+ setColumns(readableFields.map(field => field.id));
820
+ } else {
821
+ setColumns(readableFields.filter(f => selection.has(f.id)).map(f => f.id));
822
+ }
823
+ },
824
+ selectionMode: "multiple",
825
+ selectedKeys: columns,
826
+ children: item => /*#__PURE__*/jsxRuntime.jsx(actionBar.Item, {
827
+ children: item.label
828
+ }, item.value)
829
+ })]
830
+ }), dirty ? /*#__PURE__*/jsxRuntime.jsxs(tooltip.TooltipTrigger, {
831
+ children: [/*#__PURE__*/jsxRuntime.jsx(button.ActionButton, {
832
+ "aria-label": "reset",
833
+ onPress: resetToDefaults,
834
+ prominence: "low",
835
+ children: /*#__PURE__*/jsxRuntime.jsx(icon.Icon, {
836
+ src: undo2Icon.undo2Icon
837
+ })
838
+ }), /*#__PURE__*/jsxRuntime.jsx(tooltip.Tooltip, {
839
+ children: "Reset to defaults"
840
+ })]
841
+ }) : null, isReady && loading && /*#__PURE__*/jsxRuntime.jsx(progress.ProgressCircle, {
842
+ "aria-label": "Loading\u2026",
843
+ size: "small",
844
+ isIndeterminate: true
845
+ })]
846
+ }), filters$1.length ? /*#__PURE__*/jsxRuntime.jsx(layout.Flex, {
847
+ gap: "small",
848
+ wrap: true,
849
+ children: filters$1.map((filter, i) => {
850
+ const field = list.fields[filter.field];
851
+ function onRemove() {
852
+ setFilters(prevFilters => prevFilters.filter(f => f !== filter));
853
+ }
854
+ function onChange(updatedFilter) {
855
+ setFilters(prevFilters => [...prevFilters.filter(f => f !== filter), updatedFilter]);
856
+ }
857
+ return /*#__PURE__*/jsxRuntime.jsx(FilterTag, {
858
+ field: field,
859
+ filter: filter,
860
+ onChange: onChange,
861
+ onRemove: onRemove
862
+ }, i);
863
+ })
864
+ }) : null, /*#__PURE__*/jsxRuntime.jsx(GraphQLErrorNotice.GraphQLErrorNotice, {
865
+ errors: [error]
866
+ }), /*#__PURE__*/jsxRuntime.jsxs(actionBar.ActionBarContainer, {
867
+ flex: true,
868
+ minHeight: "scale.3000",
869
+ children: [/*#__PURE__*/jsxRuntime.jsxs(table.TableView, {
870
+ "aria-labelledby": LIST_PAGE_TITLE_ID,
871
+ selectionMode: selectionMode,
872
+ onSortChange: setSort,
873
+ sortDescriptor: sort !== null && sort !== void 0 ? sort : undefined,
874
+ density: "spacious",
875
+ overflowMode: "truncate",
876
+ onSelectionChange: setSelectedItems,
877
+ selectedKeys: selectedItems,
878
+ renderEmptyState: () => loading ? /*#__PURE__*/jsxRuntime.jsx(progress.ProgressCircle, {
879
+ "aria-label": "Preparing items",
880
+ isIndeterminate: true
881
+ }) : isConstrained ? /*#__PURE__*/jsxRuntime.jsx(utils$1.EmptyState, {
882
+ icon: searchXIcon.searchXIcon,
883
+ title: "No results",
884
+ message: "No items found. Try adjusting your search or filters."
885
+ }) : /*#__PURE__*/jsxRuntime.jsx(utils$1.EmptyState, {
886
+ icon: textSelectIcon.textSelectIcon,
887
+ title: "Empty list",
888
+ message: "Add the first item to see it here."
889
+ }),
890
+ flex: true,
891
+ UNSAFE_style: {
892
+ opacity: loading && !!data ? 0.5 : undefined
893
+ },
894
+ children: [/*#__PURE__*/jsxRuntime.jsx(table.TableHeader, {
895
+ columns: headers,
896
+ children: ({
897
+ label,
898
+ id,
899
+ ...options
900
+ }) => /*#__PURE__*/jsxRuntime.jsx(table.Column, {
901
+ isRowHeader: true,
902
+ ...options,
903
+ children: label
904
+ }, id)
905
+ }), /*#__PURE__*/jsxRuntime.jsx(table.TableBody, {
906
+ items: (_data$items4 = data === null || data === void 0 ? void 0 : data.items) !== null && _data$items4 !== void 0 ? _data$items4 : [],
907
+ children: row => {
908
+ return /*#__PURE__*/jsxRuntime.jsx(table.Row, {
909
+ href: `/${list.path}/${row === null || row === void 0 ? void 0 : row.id}`,
910
+ children: key => {
911
+ const field = list.fields[key];
912
+ const value = row[key];
913
+ const CellContent = field.views.Cell;
914
+ return /*#__PURE__*/jsxRuntime.jsx(table.Cell, {
915
+ children: CellContent ? /*#__PURE__*/jsxRuntime.jsx(CellContent, {
916
+ value: value,
917
+ field: field.controller,
918
+ item: row
919
+ }) : /*#__PURE__*/jsxRuntime.jsx(typography.Text, {
920
+ children: value === null || value === void 0 ? void 0 : value.toString()
921
+ })
922
+ });
923
+ }
924
+ });
925
+ }
926
+ })]
927
+ }), /*#__PURE__*/jsxRuntime.jsx(actionBar.ActionBar, {
928
+ selectedItemCount: selectedItemIds.length,
929
+ onClearSelection: () => setSelectedItems(new Set()),
930
+ UNSAFE_className: style.css({
931
+ // TODO: update in @keystar/ui package
932
+ // make `tokenSchema.size.shadow.regular` token "0 1px 4px"
933
+ 'div:has([data-focus-scope-start])': {
934
+ backgroundColor: style.tokenSchema.color.background.canvas,
935
+ border: `${style.tokenSchema.size.border.regular} solid ${style.tokenSchema.color.border.emphasis}`,
936
+ borderRadius: style.tokenSchema.size.radius.regular,
937
+ boxShadow: `0 1px 4px ${style.tokenSchema.color.shadow.regular}`
938
+ }
939
+ }),
940
+ disabledKeys: disabledActionKeys,
941
+ onAction: setActiveAction,
942
+ children: [...function* () {
943
+ for (const action of actions) {
944
+ const iconComponent = action.icon ? all.allIcons[action.icon] : null;
945
+ yield /*#__PURE__*/jsxRuntime.jsxs(actionBar.Item, {
946
+ textValue: action.label,
947
+ children: [iconComponent ? /*#__PURE__*/jsxRuntime.jsx(icon.Icon, {
948
+ src: iconComponent
949
+ }) : null, /*#__PURE__*/jsxRuntime.jsx(typography.Text, {
950
+ children: action.label
951
+ })]
952
+ }, action.key);
953
+ }
954
+ }()]
955
+ })]
956
+ }), !!(data !== null && data !== void 0 && data.count) && /*#__PURE__*/jsxRuntime.jsx(adminUi_context_dist_nixxieCmsCoreAdminUiContext.PaginationControls, {
957
+ singular: list.singular,
958
+ plural: list.plural,
959
+ currentPage: currentPage,
960
+ pageSize: pageSize,
961
+ total: data.count,
962
+ onChangePage: page => setCurrentPage(page),
963
+ onChangePageSize: pageSize => setPageSize(pageSize),
964
+ defaultPageSize: list.pageSize
965
+ }), /*#__PURE__*/jsxRuntime.jsx(dialog.DialogContainer, {
966
+ onDismiss: () => {
967
+ setActiveAction(null);
968
+ },
969
+ children: actions.filter(action => action.key === activeAction).map(action => {
970
+ var _data$items5;
971
+ return /*#__PURE__*/jsxRuntime.jsx(ActionItemsDialog, {
972
+ itemIds: selectedItemIds,
973
+ items: (_data$items5 = data === null || data === void 0 ? void 0 : data.items) !== null && _data$items5 !== void 0 ? _data$items5 : [],
974
+ action: action,
975
+ list: list,
976
+ onSuccess: remaining => {
977
+ refetch();
978
+ setSelectedItems(remaining);
979
+ },
980
+ onErrors: setActionResult
981
+ });
982
+ }).pop()
983
+ }), /*#__PURE__*/jsxRuntime.jsx(dialog.DialogContainer, {
984
+ onDismiss: () => setActionResult(null),
985
+ isDismissable: true,
986
+ children: actionResult ? /*#__PURE__*/jsxRuntime.jsxs(dialog.Dialog, {
987
+ children: [/*#__PURE__*/jsxRuntime.jsxs(typography.Heading, {
988
+ children: ["Error details for ", actionResult.action.label, " action"]
989
+ }), /*#__PURE__*/jsxRuntime.jsx(slots.Content, {
990
+ children: /*#__PURE__*/jsxRuntime.jsx(layout.VStack, {
991
+ gap: "large",
992
+ children: [...function* () {
993
+ const {
994
+ action,
995
+ errors: actionErrors
996
+ } = actionResult;
997
+ for (const [itemId, itemActionErrors] of Object.entries(actionErrors)) {
998
+ var _data$items$find, _data$items6, _ref;
999
+ const item = (_data$items$find = data === null || data === void 0 || (_data$items6 = data.items) === null || _data$items6 === void 0 ? void 0 : _data$items6.find(i => i.id === itemId)) !== null && _data$items$find !== void 0 ? _data$items$find : null;
1000
+ const itemLabel = (_ref = item === null || item === void 0 ? void 0 : item[list.labelField]) !== null && _ref !== void 0 ? _ref : itemId;
1001
+ const href = `/${list.path}/${itemId}`;
1002
+ for (const error of itemActionErrors) {
1003
+ yield /*#__PURE__*/jsxRuntime.jsx(layout.VStack, {
1004
+ gap: "regular",
1005
+ children: /*#__PURE__*/jsxRuntime.jsxs(notice.Notice, {
1006
+ tone: "critical",
1007
+ children: [/*#__PURE__*/jsxRuntime.jsxs(slots.Content, {
1008
+ children: [/*#__PURE__*/jsxRuntime.jsxs(typography.Text, {
1009
+ children: ["You might try running the action again from", ' ', /*#__PURE__*/jsxRuntime.jsxs(link.TextLink, {
1010
+ href: href,
1011
+ children: ["the ", list.singular.toLowerCase(), "."]
1012
+ })]
1013
+ }), /*#__PURE__*/jsxRuntime.jsx(layout.Box, {
1014
+ elementType: "pre",
1015
+ backgroundColor: "critical",
1016
+ borderRadius: "regular",
1017
+ maxHeight: "100%",
1018
+ overflow: "auto",
1019
+ children: /*#__PURE__*/jsxRuntime.jsx(typography.Text, {
1020
+ color: "critical",
1021
+ UNSAFE_className: style.css({
1022
+ fontFamily: style.tokenSchema.typography.fontFamily.code
1023
+ }),
1024
+ children: error.message
1025
+ })
1026
+ })]
1027
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
1028
+ children: /*#__PURE__*/jsxRuntime.jsx(typography.Heading, {
1029
+ children: replace(action.messages.fail, list, {
1030
+ ...action,
1031
+ itemLabel
1032
+ }, false)
1033
+ })
1034
+ })]
1035
+ })
1036
+ }, itemId);
1037
+ }
1038
+ }
1039
+ }()]
1040
+ })
1041
+ })]
1042
+ }) : null
1043
+ })]
1044
+ })
1045
+ });
1046
+ }
1047
+ const LIST_PAGE_TITLE_ID = 'nixxie-list-page-title';
1048
+ function ListPageHeader({
1049
+ listKey,
1050
+ showCreate
1051
+ }) {
1052
+ const list = adminUi_context_dist_nixxieCmsCoreAdminUiContext.useList(listKey);
1053
+ return /*#__PURE__*/jsxRuntime.jsxs(react.Fragment, {
1054
+ children: [/*#__PURE__*/jsxRuntime.jsx(typography.Heading, {
1055
+ id: LIST_PAGE_TITLE_ID,
1056
+ elementType: "h1",
1057
+ size: "small",
1058
+ children: list.label
1059
+ }), showCreate && /*#__PURE__*/jsxRuntime.jsx(pick.CreateButtonLink, {
1060
+ list: list,
1061
+ children: `New ${list.singular.toLocaleLowerCase()}`
1062
+ })]
1063
+ });
1064
+ }
1065
+ function replace(s, list, args, many) {
1066
+ var _args$itemLabel;
1067
+ s = s.replaceAll('{Label}', args.label);
1068
+ s = s.replaceAll('{label}', args.label.toLowerCase());
1069
+ if (s.includes('{singular|plural}')) s = s.replaceAll('{singular|plural}', many ? '{plural}' : '{singular}');
1070
+ if (s.includes('{Singular}')) s = s.replaceAll('{Singular}', list.singular);
1071
+ if (s.includes('{Plural}')) s = s.replaceAll('{Plural}', list.plural);
1072
+ if (s.includes('{singular}')) s = s.replaceAll('{singular}', list.singular.toLowerCase());
1073
+ if (s.includes('{plural}')) s = s.replaceAll('{plural}', list.plural.toLowerCase());
1074
+ if ('count' in args) s = s.replaceAll('{count}', String(args.count));
1075
+ if ('countFail' in args) s = s.replaceAll('{countFail}', String(args.countFail));
1076
+ if ('countSuccess' in args) s = s.replaceAll('{countSuccess}', String(args.countSuccess));
1077
+ if ('itemLabel' in args) s = s.replaceAll('{itemLabel}', (_args$itemLabel = args.itemLabel) !== null && _args$itemLabel !== void 0 ? _args$itemLabel : '');
1078
+ return s;
1079
+ }
1080
+ function ActionItemsDialog({
1081
+ list,
1082
+ itemIds,
1083
+ items,
1084
+ onSuccess,
1085
+ onErrors,
1086
+ action
1087
+ }) {
1088
+ const actionMutation = action.key === 'delete' ? client.gql`mutation($where: [${list.graphql.names.whereUniqueInputName}!]!) {
1089
+ results: ${action.graphql.names.many}(where: $where) {
1090
+ id
1091
+ }
1092
+ }` : client.gql`mutation($data: [${action.graphql.names.one[0].toUpperCase()}${action.graphql.names.one.slice(1)}Args!]!) {
1093
+ results: ${action.graphql.names.many}(data: $data) {
1094
+ id
1095
+ }
1096
+ }`;
1097
+ const [actionOnItems] = react$1.useMutation(actionMutation, {
1098
+ variables: action.key === 'delete' ? {
1099
+ where: itemIds.map(id => ({
1100
+ id
1101
+ }))
1102
+ } : {
1103
+ data: itemIds.flatMap(id => {
1104
+ const row = items.find(item => String(item.id) === id);
1105
+ if (!row) {
1106
+ return [];
1107
+ }
1108
+ const deserialized = utils$1.deserializeItemToValue(list.fields, row);
1109
+ const args = actionData.getActionArguments(list, action, deserialized);
1110
+ return {
1111
+ where: {
1112
+ id
1113
+ },
1114
+ ...args
1115
+ };
1116
+ })
1117
+ },
1118
+ errorPolicy: 'all'
1119
+ });
1120
+ const {
1121
+ messages: m
1122
+ } = action;
1123
+ async function onTryAction() {
1124
+ try {
1125
+ const {
1126
+ error
1127
+ } = await actionOnItems();
1128
+ const failed = new Set();
1129
+ const actionErrors = {};
1130
+ let countFail = 0;
1131
+ if (client.CombinedGraphQLErrors.is(error)) {
1132
+ countFail = error.errors.length;
1133
+ for (const err of (_error$errors = error.errors) !== null && _error$errors !== void 0 ? _error$errors : []) {
1134
+ var _error$errors, _err$path, _actionErrors$itemId;
1135
+ const i = (_err$path = err.path) === null || _err$path === void 0 ? void 0 : _err$path[1];
1136
+ if (typeof i !== 'number') continue;
1137
+ const itemId = itemIds[i];
1138
+ failed.add(itemId);
1139
+ (_actionErrors$itemId = actionErrors[itemId]) !== null && _actionErrors$itemId !== void 0 ? _actionErrors$itemId : actionErrors[itemId] = [];
1140
+ actionErrors[itemId].push(err);
1141
+ }
1142
+ }
1143
+ const countSuccess = itemIds.length - countFail;
1144
+ if (countSuccess) {
1145
+ toast.toastQueue.neutral(replace(m.successMany, list, {
1146
+ ...action,
1147
+ count: itemIds.length,
1148
+ countFail,
1149
+ countSuccess
1150
+ }, countSuccess > 1), {
1151
+ timeout: 5000
1152
+ });
1153
+ }
1154
+ if (countFail) {
1155
+ toast.toastQueue.critical(replace(m.failMany, list, {
1156
+ ...action,
1157
+ count: itemIds.length,
1158
+ countFail,
1159
+ countSuccess
1160
+ }, countFail > 1), {
1161
+ actionLabel: 'Details',
1162
+ onAction: () => onErrors({
1163
+ action,
1164
+ errors: actionErrors
1165
+ }),
1166
+ shouldCloseOnAction: true
1167
+ });
1168
+ }
1169
+ return onSuccess(failed);
1170
+ } catch (error) {
1171
+ console.error(error);
1172
+ }
1173
+ }
1174
+ return /*#__PURE__*/jsxRuntime.jsx(dialog.AlertDialog, {
1175
+ tone: action.key === 'delete' ? 'critical' : 'neutral',
1176
+ title: replace(m.promptTitleMany, list, {
1177
+ ...action,
1178
+ count: itemIds.length
1179
+ }, itemIds.length > 1),
1180
+ cancelLabel: "Cancel",
1181
+ primaryActionLabel: replace(m.promptConfirmLabelMany, list, {
1182
+ ...action,
1183
+ count: itemIds.length
1184
+ }, itemIds.length > 1),
1185
+ onPrimaryAction: onTryAction,
1186
+ children: /*#__PURE__*/jsxRuntime.jsx(typography.Text, {
1187
+ children: replace(m.promptMany, list, {
1188
+ ...action,
1189
+ count: itemIds.length
1190
+ }, itemIds.length > 1)
1191
+ })
1192
+ });
1193
+ }
1194
+
1195
+ exports.getListPage = getListPage;