tempest-react-sdk 0.66.0 → 0.68.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 (232) hide show
  1. package/README.md +97 -93
  2. package/dist/auth/create-tempest-auth.cjs +1 -1
  3. package/dist/auth/create-tempest-auth.cjs.map +1 -1
  4. package/dist/auth/create-tempest-auth.js +41 -40
  5. package/dist/auth/create-tempest-auth.js.map +1 -1
  6. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  7. package/dist/components/BottomSheet/BottomSheet.cjs.map +1 -1
  8. package/dist/components/BottomSheet/BottomSheet.js +35 -40
  9. package/dist/components/BottomSheet/BottomSheet.js.map +1 -1
  10. package/dist/components/Card/Card.module.cjs.map +1 -1
  11. package/dist/components/Card/Card.module.js.map +1 -1
  12. package/dist/components/Combobox/Combobox.cjs +1 -1
  13. package/dist/components/Combobox/Combobox.cjs.map +1 -1
  14. package/dist/components/Combobox/Combobox.js +96 -74
  15. package/dist/components/Combobox/Combobox.js.map +1 -1
  16. package/dist/components/Combobox/Combobox.module.cjs +1 -1
  17. package/dist/components/Combobox/Combobox.module.cjs.map +1 -1
  18. package/dist/components/Combobox/Combobox.module.js +4 -3
  19. package/dist/components/Combobox/Combobox.module.js.map +1 -1
  20. package/dist/components/Command/Command.cjs +1 -1
  21. package/dist/components/Command/Command.js +4 -4
  22. package/dist/components/ContextMenu/ContextMenu.cjs +1 -1
  23. package/dist/components/ContextMenu/ContextMenu.cjs.map +1 -1
  24. package/dist/components/ContextMenu/ContextMenu.js +80 -83
  25. package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
  26. package/dist/components/DataTable/DataTable.cjs +1 -1
  27. package/dist/components/DataTable/DataTable.cjs.map +1 -1
  28. package/dist/components/DataTable/DataTable.js +138 -127
  29. package/dist/components/DataTable/DataTable.js.map +1 -1
  30. package/dist/components/DataTable/use-dev-warnings.cjs +1 -1
  31. package/dist/components/DataTable/use-dev-warnings.cjs.map +1 -1
  32. package/dist/components/DataTable/use-dev-warnings.js +5 -3
  33. package/dist/components/DataTable/use-dev-warnings.js.map +1 -1
  34. package/dist/components/Drawer/Drawer.cjs +1 -1
  35. package/dist/components/Drawer/Drawer.cjs.map +1 -1
  36. package/dist/components/Drawer/Drawer.js +46 -46
  37. package/dist/components/Drawer/Drawer.js.map +1 -1
  38. package/dist/components/DropdownMenu/DropdownMenu.cjs +1 -1
  39. package/dist/components/DropdownMenu/DropdownMenu.cjs.map +1 -1
  40. package/dist/components/DropdownMenu/DropdownMenu.js +129 -105
  41. package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
  42. package/dist/components/DropdownMenu/DropdownMenu.module.cjs +1 -1
  43. package/dist/components/DropdownMenu/DropdownMenu.module.cjs.map +1 -1
  44. package/dist/components/DropdownMenu/DropdownMenu.module.js +12 -11
  45. package/dist/components/DropdownMenu/DropdownMenu.module.js.map +1 -1
  46. package/dist/components/FilterPanel/FilterPanel.cjs +2 -0
  47. package/dist/components/FilterPanel/FilterPanel.cjs.map +1 -0
  48. package/dist/components/FilterPanel/FilterPanel.js +75 -0
  49. package/dist/components/FilterPanel/FilterPanel.js.map +1 -0
  50. package/dist/components/FilterPanel/FilterPanel.module.cjs +3 -0
  51. package/dist/components/FilterPanel/FilterPanel.module.cjs.map +1 -0
  52. package/dist/components/FilterPanel/FilterPanel.module.js +12 -0
  53. package/dist/components/FilterPanel/FilterPanel.module.js.map +1 -0
  54. package/dist/components/HoverCard/HoverCard.cjs +1 -1
  55. package/dist/components/HoverCard/HoverCard.cjs.map +1 -1
  56. package/dist/components/HoverCard/HoverCard.js +54 -29
  57. package/dist/components/HoverCard/HoverCard.js.map +1 -1
  58. package/dist/components/HoverCard/HoverCard.module.cjs +1 -1
  59. package/dist/components/HoverCard/HoverCard.module.cjs.map +1 -1
  60. package/dist/components/HoverCard/HoverCard.module.js +4 -3
  61. package/dist/components/HoverCard/HoverCard.module.js.map +1 -1
  62. package/dist/components/Lightbox/Lightbox.cjs +1 -1
  63. package/dist/components/Lightbox/Lightbox.cjs.map +1 -1
  64. package/dist/components/Lightbox/Lightbox.js +84 -87
  65. package/dist/components/Lightbox/Lightbox.js.map +1 -1
  66. package/dist/components/Menubar/Menubar.cjs +1 -1
  67. package/dist/components/Menubar/Menubar.cjs.map +1 -1
  68. package/dist/components/Menubar/Menubar.js +86 -65
  69. package/dist/components/Menubar/Menubar.js.map +1 -1
  70. package/dist/components/Menubar/Menubar.module.cjs +1 -1
  71. package/dist/components/Menubar/Menubar.module.cjs.map +1 -1
  72. package/dist/components/Menubar/Menubar.module.js +4 -3
  73. package/dist/components/Menubar/Menubar.module.js.map +1 -1
  74. package/dist/components/Modal/Modal.cjs +1 -1
  75. package/dist/components/Modal/Modal.cjs.map +1 -1
  76. package/dist/components/Modal/Modal.js +47 -51
  77. package/dist/components/Modal/Modal.js.map +1 -1
  78. package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
  79. package/dist/components/MultiSelect/MultiSelect.cjs.map +1 -1
  80. package/dist/components/MultiSelect/MultiSelect.js +113 -96
  81. package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
  82. package/dist/components/MultiSelect/MultiSelect.module.cjs +1 -1
  83. package/dist/components/MultiSelect/MultiSelect.module.cjs.map +1 -1
  84. package/dist/components/MultiSelect/MultiSelect.module.js +4 -3
  85. package/dist/components/MultiSelect/MultiSelect.module.js.map +1 -1
  86. package/dist/components/NavigationMenu/NavigationMenu.cjs +1 -1
  87. package/dist/components/NavigationMenu/NavigationMenu.cjs.map +1 -1
  88. package/dist/components/NavigationMenu/NavigationMenu.js +83 -61
  89. package/dist/components/NavigationMenu/NavigationMenu.js.map +1 -1
  90. package/dist/components/NavigationMenu/NavigationMenu.module.cjs +1 -1
  91. package/dist/components/NavigationMenu/NavigationMenu.module.cjs.map +1 -1
  92. package/dist/components/NavigationMenu/NavigationMenu.module.js +4 -3
  93. package/dist/components/NavigationMenu/NavigationMenu.module.js.map +1 -1
  94. package/dist/components/Pagination/Pagination.cjs +1 -1
  95. package/dist/components/Pagination/Pagination.cjs.map +1 -1
  96. package/dist/components/Pagination/Pagination.js +31 -30
  97. package/dist/components/Pagination/Pagination.js.map +1 -1
  98. package/dist/components/Popover/Popover.cjs +1 -1
  99. package/dist/components/Popover/Popover.cjs.map +1 -1
  100. package/dist/components/Popover/Popover.js +57 -36
  101. package/dist/components/Popover/Popover.js.map +1 -1
  102. package/dist/components/Popover/Popover.module.cjs +1 -1
  103. package/dist/components/Popover/Popover.module.cjs.map +1 -1
  104. package/dist/components/Popover/Popover.module.js +7 -6
  105. package/dist/components/Popover/Popover.module.js.map +1 -1
  106. package/dist/components/Portal/anchor-position.cjs +2 -0
  107. package/dist/components/Portal/anchor-position.cjs.map +1 -0
  108. package/dist/components/Portal/anchor-position.js +99 -0
  109. package/dist/components/Portal/anchor-position.js.map +1 -0
  110. package/dist/components/Portal/escape-layer.cjs +2 -0
  111. package/dist/components/Portal/escape-layer.cjs.map +1 -0
  112. package/dist/components/Portal/escape-layer.js +30 -0
  113. package/dist/components/Portal/escape-layer.js.map +1 -0
  114. package/dist/components/Portal/tab-bridge.cjs +2 -0
  115. package/dist/components/Portal/tab-bridge.cjs.map +1 -0
  116. package/dist/components/Portal/tab-bridge.js +37 -0
  117. package/dist/components/Portal/tab-bridge.js.map +1 -0
  118. package/dist/components/Select/CaretIcon.cjs +2 -0
  119. package/dist/components/Select/CaretIcon.cjs.map +1 -0
  120. package/dist/components/Select/CaretIcon.js +21 -0
  121. package/dist/components/Select/CaretIcon.js.map +1 -0
  122. package/dist/components/Select/Select.cjs +1 -1
  123. package/dist/components/Select/Select.cjs.map +1 -1
  124. package/dist/components/Select/Select.js +33 -47
  125. package/dist/components/Select/Select.js.map +1 -1
  126. package/dist/components/Select/Select.module.cjs +1 -1
  127. package/dist/components/Select/Select.module.cjs.map +1 -1
  128. package/dist/components/Select/Select.module.js +4 -3
  129. package/dist/components/Select/Select.module.js.map +1 -1
  130. package/dist/components/Select/options.cjs +2 -0
  131. package/dist/components/Select/options.cjs.map +1 -0
  132. package/dist/components/Select/options.js +25 -0
  133. package/dist/components/Select/options.js.map +1 -0
  134. package/dist/components/Sidebar/Sidebar.cjs +1 -1
  135. package/dist/components/Sidebar/Sidebar.cjs.map +1 -1
  136. package/dist/components/Sidebar/Sidebar.js +49 -43
  137. package/dist/components/Sidebar/Sidebar.js.map +1 -1
  138. package/dist/components/Sidebar/active-nav-key.cjs +2 -0
  139. package/dist/components/Sidebar/active-nav-key.cjs.map +1 -0
  140. package/dist/components/Sidebar/active-nav-key.js +22 -0
  141. package/dist/components/Sidebar/active-nav-key.js.map +1 -0
  142. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  143. package/dist/components/Tooltip/Tooltip.cjs.map +1 -1
  144. package/dist/components/Tooltip/Tooltip.js +43 -29
  145. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  146. package/dist/components/Tooltip/Tooltip.module.cjs +1 -1
  147. package/dist/components/Tooltip/Tooltip.module.cjs.map +1 -1
  148. package/dist/components/Tooltip/Tooltip.module.js +4 -3
  149. package/dist/components/Tooltip/Tooltip.module.js.map +1 -1
  150. package/dist/hooks/tab-sequence.cjs +2 -0
  151. package/dist/hooks/tab-sequence.cjs.map +1 -0
  152. package/dist/hooks/tab-sequence.js +53 -0
  153. package/dist/hooks/tab-sequence.js.map +1 -0
  154. package/dist/hooks/use-deep-memo.cjs +1 -1
  155. package/dist/hooks/use-deep-memo.cjs.map +1 -1
  156. package/dist/hooks/use-deep-memo.js +1 -1
  157. package/dist/hooks/use-deep-memo.js.map +1 -1
  158. package/dist/hooks/use-draft-filters.cjs +2 -0
  159. package/dist/hooks/use-draft-filters.cjs.map +1 -0
  160. package/dist/hooks/use-draft-filters.js +49 -0
  161. package/dist/hooks/use-draft-filters.js.map +1 -0
  162. package/dist/hooks/use-focus-trap.cjs +1 -1
  163. package/dist/hooks/use-focus-trap.cjs.map +1 -1
  164. package/dist/hooks/use-focus-trap.js +31 -34
  165. package/dist/hooks/use-focus-trap.js.map +1 -1
  166. package/dist/hooks/use-sortable.cjs +1 -1
  167. package/dist/hooks/use-sortable.cjs.map +1 -1
  168. package/dist/hooks/use-sortable.js +3 -3
  169. package/dist/hooks/use-sortable.js.map +1 -1
  170. package/dist/http/api-client.cjs +1 -1
  171. package/dist/http/api-client.cjs.map +1 -1
  172. package/dist/http/api-client.js +92 -80
  173. package/dist/http/api-client.js.map +1 -1
  174. package/dist/http/credential-scope.cjs +1 -1
  175. package/dist/http/credential-scope.cjs.map +1 -1
  176. package/dist/http/credential-scope.js +5 -3
  177. package/dist/http/credential-scope.js.map +1 -1
  178. package/dist/http/csrf.cjs +2 -0
  179. package/dist/http/csrf.cjs.map +1 -0
  180. package/dist/http/csrf.js +46 -0
  181. package/dist/http/csrf.js.map +1 -0
  182. package/dist/http/describe-api-error.cjs +1 -1
  183. package/dist/http/describe-api-error.cjs.map +1 -1
  184. package/dist/http/describe-api-error.js +4 -2
  185. package/dist/http/describe-api-error.js.map +1 -1
  186. package/dist/http/resumable-upload.cjs +1 -1
  187. package/dist/http/resumable-upload.cjs.map +1 -1
  188. package/dist/http/resumable-upload.js +131 -123
  189. package/dist/http/resumable-upload.js.map +1 -1
  190. package/dist/http/upload-with-progress.cjs +1 -1
  191. package/dist/http/upload-with-progress.cjs.map +1 -1
  192. package/dist/http/upload-with-progress.js +41 -33
  193. package/dist/http/upload-with-progress.js.map +1 -1
  194. package/dist/query/use-paginated-query.cjs +1 -1
  195. package/dist/query/use-paginated-query.cjs.map +1 -1
  196. package/dist/query/use-paginated-query.js +47 -30
  197. package/dist/query/use-paginated-query.js.map +1 -1
  198. package/dist/styles/FilterPanel.css +2 -0
  199. package/dist/styles/actions.css +3 -0
  200. package/dist/styles/advanced.css +1 -0
  201. package/dist/styles/component/Card.css +1 -1
  202. package/dist/styles/component/Combobox.css +5 -3
  203. package/dist/styles/component/DropdownMenu.css +1 -0
  204. package/dist/styles/component/FilterPanel.css +5 -0
  205. package/dist/styles/component/HoverCard.css +1 -0
  206. package/dist/styles/component/Menubar.css +1 -0
  207. package/dist/styles/component/MultiSelect.css +1 -0
  208. package/dist/styles/component/NavigationMenu.css +1 -0
  209. package/dist/styles/component/Popover.css +1 -0
  210. package/dist/styles/component/Select.css +13 -6
  211. package/dist/styles/component/Tooltip.css +1 -0
  212. package/dist/styles/core.css +4 -4
  213. package/dist/styles/data.css +4 -0
  214. package/dist/styles/forms.css +19 -9
  215. package/dist/styles/identity.css +1 -1
  216. package/dist/styles/manifest.json +6 -0
  217. package/dist/styles/navigation.css +2 -0
  218. package/dist/styles/tokens.css +4 -4
  219. package/dist/styles.css +1 -1
  220. package/dist/tempest-react-sdk.cjs +1 -1
  221. package/dist/tempest-react-sdk.d.ts +805 -35
  222. package/dist/tempest-react-sdk.js +347 -342
  223. package/dist/vite/tempest-csp.cjs +3 -0
  224. package/dist/vite/tempest-csp.cjs.map +1 -0
  225. package/dist/vite/tempest-csp.js +189 -0
  226. package/dist/vite/tempest-csp.js.map +1 -0
  227. package/dist/vite.cjs +1 -1
  228. package/dist/vite.d.ts +145 -0
  229. package/dist/vite.js +2 -1
  230. package/package.json +2 -2
  231. package/template/vite.config.ts +8 -1
  232. package/template-pwa/vite.config.ts +6 -0
@@ -1,8 +1,9 @@
1
1
  import { randomId as e } from "../utils/ids.js";
2
2
  import { isTrustedCredentialTarget as t, reportSuppressedCredential as n } from "./credential-scope.js";
3
- import { TempestApiError as r, buildApiError as i } from "./errors.js";
3
+ import { csrfHeaders as r } from "./csrf.js";
4
+ import { TempestApiError as i, buildApiError as a } from "./errors.js";
4
5
  //#region src/http/upload-with-progress.ts
5
- function a(e) {
6
+ function o(e) {
6
7
  if (!e) return null;
7
8
  try {
8
9
  return JSON.parse(e);
@@ -10,59 +11,66 @@ function a(e) {
10
11
  return e;
11
12
  }
12
13
  }
13
- function o(o) {
14
- let { url: s, body: c, method: l = "POST", headers: u = {}, getToken: d, credentialOrigin: f, trustedOrigins: p, withCredentials: m = !1, onProgress: h, signal: g, parser: _ = JSON.parse, requestId: v } = o;
15
- return new Promise((o, y) => {
16
- if (g?.aborted) {
17
- y(new DOMException("Aborted", "AbortError"));
14
+ function s(s) {
15
+ let { url: c, body: l, method: u = "POST", headers: d = {}, getToken: f, credentialOrigin: p, trustedOrigins: m, withCredentials: h = !1, csrf: g, onProgress: _, signal: v, parser: y = JSON.parse, requestId: b } = s;
16
+ return new Promise((s, x) => {
17
+ if (v?.aborted) {
18
+ x(new DOMException("Aborted", "AbortError"));
18
19
  return;
19
20
  }
20
- let b = new XMLHttpRequest();
21
- b.open(l, s), b.withCredentials = m;
22
- let x = d?.(), S = v ? v() : e(), C = { ...u };
23
- x && !("Authorization" in C) && (f === void 0 || t(s, f, p) ? C.Authorization = `Bearer ${x}` : n(s, f)), S && !("X-Request-ID" in C) && (C["X-Request-ID"] = S);
24
- for (let [e, t] of Object.entries(C)) b.setRequestHeader(e, t);
25
- h && (b.upload.onprogress = (e) => {
26
- h({
21
+ let S = new XMLHttpRequest();
22
+ S.open(u, c), S.withCredentials = h;
23
+ let C = f?.(), w = b ? b() : e(), T = { ...d };
24
+ C && !("Authorization" in T) && (p === void 0 || t(c, p, m) ? T.Authorization = `Bearer ${C}` : n(c, p)), Object.assign(T, r({
25
+ method: u,
26
+ url: c,
27
+ reference: p ?? globalThis.location?.origin ?? c,
28
+ csrf: g,
29
+ trustedOrigins: m,
30
+ headers: d
31
+ })), w && !("X-Request-ID" in T) && (T["X-Request-ID"] = w);
32
+ for (let [e, t] of Object.entries(T)) S.setRequestHeader(e, t);
33
+ _ && (S.upload.onprogress = (e) => {
34
+ _({
27
35
  loaded: e.loaded,
28
36
  total: e.total,
29
37
  fraction: e.lengthComputable ? e.loaded / e.total : null,
30
38
  lengthComputable: e.lengthComputable
31
39
  });
32
40
  });
33
- function w() {
34
- b.abort();
41
+ function E() {
42
+ S.abort();
35
43
  }
36
- g?.addEventListener("abort", w), b.onload = () => {
37
- g?.removeEventListener("abort", w);
38
- let e = b.status >= 200 && b.status < 300, t = b.getResponseHeader("content-type") ?? "";
44
+ v?.addEventListener("abort", E), S.onload = () => {
45
+ v?.removeEventListener("abort", E);
46
+ let e = S.status >= 200 && S.status < 300, t = S.getResponseHeader("content-type") ?? "";
39
47
  if (!e) {
40
- let e = a(b.responseText);
41
- y(new r(i(b.status, e, { get: (e) => b.getResponseHeader(e) }, S)));
48
+ let e = o(S.responseText);
49
+ x(new i(a(S.status, e, { get: (e) => S.getResponseHeader(e) }, w)));
42
50
  return;
43
51
  }
44
- if (b.status === 204 || !b.responseText) {
45
- o(void 0);
52
+ if (S.status === 204 || !S.responseText) {
53
+ s(void 0);
46
54
  return;
47
55
  }
48
56
  if (t.includes("application/json")) try {
49
- o(_(b.responseText));
57
+ s(y(S.responseText));
50
58
  } catch (e) {
51
- y(e);
59
+ x(e);
52
60
  }
53
- else o(b.responseText);
54
- }, b.onerror = () => {
55
- g?.removeEventListener("abort", w), y(new r({
61
+ else s(S.responseText);
62
+ }, S.onerror = () => {
63
+ v?.removeEventListener("abort", E), x(new i({
56
64
  status: 0,
57
65
  detail: "Falha de rede no upload.",
58
- requestId: S || void 0
66
+ requestId: w || void 0
59
67
  }));
60
- }, b.onabort = () => {
61
- g?.removeEventListener("abort", w), y(new DOMException("Aborted", "AbortError"));
62
- }, b.send(c);
68
+ }, S.onabort = () => {
69
+ v?.removeEventListener("abort", E), x(new DOMException("Aborted", "AbortError"));
70
+ }, S.send(l);
63
71
  });
64
72
  }
65
73
  //#endregion
66
- export { o as uploadWithProgress };
74
+ export { s as uploadWithProgress };
67
75
 
68
76
  //# sourceMappingURL=upload-with-progress.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"upload-with-progress.js","names":[],"sources":["../../src/http/upload-with-progress.ts"],"sourcesContent":["/**\n * @tempest-limits function-lines — XMLHttpRequest is used instead of fetch precisely\n * because it reports upload progress, and its API is event-based: the body wires\n * load, error, abort, timeout and progress against one request object, plus the\n * AbortSignal bridge.\n */\nimport { randomId } from \"../utils\";\nimport { isTrustedCredentialTarget, reportSuppressedCredential } from \"./credential-scope\";\nimport { buildApiError, TempestApiError } from \"./errors\";\n\nexport interface UploadProgressEvent {\n /** Bytes already uploaded. */\n loaded: number;\n /** Total payload size in bytes — only meaningful when `lengthComputable` is true. */\n total: number;\n /** Fraction between 0 and 1, or null when total is unknown. */\n fraction: number | null;\n lengthComputable: boolean;\n}\n\nexport interface UploadWithProgressOptions {\n url: string;\n body: FormData | Blob | File;\n method?: \"POST\" | \"PUT\" | \"PATCH\";\n headers?: Record<string, string>;\n /** Returns the current bearer token. */\n getToken?: () => string | null | undefined;\n /**\n * Origin the `getToken` credential belongs to, normally the API's.\n *\n * Unlike `createApiClient`, this helper has no base URL to infer a scope\n * from — the caller names the destination on every call. Set this when the\n * `url` can come from somewhere other than your own code (a signed URL the\n * API handed back, a value from a response body) and the token must not\n * follow it off-origin. Left unset, the header goes wherever `url` points,\n * which is the behaviour every version before 0.66.0 had.\n */\n credentialOrigin?: string;\n /**\n * Extra origins allowed to receive the credential, on top of\n * {@link credentialOrigin}. Ignored when that one is unset.\n */\n trustedOrigins?: readonly string[];\n /** Send cookies. Defaults to false. */\n withCredentials?: boolean;\n /** Called on every `progress` event from the XHR upload channel. */\n onProgress?: (event: UploadProgressEvent) => void;\n /** Abort the request. */\n signal?: AbortSignal;\n /** Override the JSON parser. Defaults to `JSON.parse`. */\n parser?: (raw: string) => unknown;\n /**\n * Per-request correlation id sent as `X-Request-ID` (Tempest convention).\n * Defaults to a generated id. Return an empty string to disable.\n */\n requestId?: () => string;\n}\n\nfunction parseErrorBody(raw: string): unknown {\n if (!raw) return null;\n try {\n return JSON.parse(raw);\n } catch {\n return raw;\n }\n}\n\n/**\n * Upload a file (or any payload) with byte-level progress reporting.\n *\n * `fetch` cannot report upload progress in browsers, so this helper falls\n * back to `XMLHttpRequest`. It mirrors the error contract used by\n * {@link createApiClient}: non-2xx responses reject with a `TempestApiError`.\n *\n * @returns The parsed JSON response, or the raw text when the response is not JSON.\n */\nexport function uploadWithProgress<T = unknown>(options: UploadWithProgressOptions): Promise<T> {\n const {\n url,\n body,\n method = \"POST\",\n headers = {},\n getToken,\n credentialOrigin,\n trustedOrigins,\n withCredentials = false,\n onProgress,\n signal,\n parser = JSON.parse,\n requestId,\n } = options;\n\n return new Promise<T>((resolve, reject) => {\n if (signal?.aborted) {\n reject(new DOMException(\"Aborted\", \"AbortError\"));\n return;\n }\n\n const xhr = new XMLHttpRequest();\n xhr.open(method, url);\n xhr.withCredentials = withCredentials;\n\n const token = getToken?.();\n const sentRequestId = requestId ? requestId() : randomId();\n const finalHeaders: Record<string, string> = { ...headers };\n if (token && !(\"Authorization\" in finalHeaders)) {\n if (\n credentialOrigin === undefined ||\n isTrustedCredentialTarget(url, credentialOrigin, trustedOrigins)\n ) {\n finalHeaders.Authorization = `Bearer ${token}`;\n } else {\n reportSuppressedCredential(url, credentialOrigin);\n }\n }\n if (sentRequestId && !(\"X-Request-ID\" in finalHeaders)) {\n finalHeaders[\"X-Request-ID\"] = sentRequestId;\n }\n for (const [key, value] of Object.entries(finalHeaders)) {\n xhr.setRequestHeader(key, value);\n }\n\n if (onProgress) {\n xhr.upload.onprogress = (event) => {\n onProgress({\n loaded: event.loaded,\n total: event.total,\n fraction: event.lengthComputable ? event.loaded / event.total : null,\n lengthComputable: event.lengthComputable,\n });\n };\n }\n\n function handleAbort(): void {\n xhr.abort();\n }\n signal?.addEventListener(\"abort\", handleAbort);\n\n xhr.onload = () => {\n signal?.removeEventListener(\"abort\", handleAbort);\n const isSuccess = xhr.status >= 200 && xhr.status < 300;\n const contentType = xhr.getResponseHeader(\"content-type\") ?? \"\";\n\n if (!isSuccess) {\n const errorBody = parseErrorBody(xhr.responseText);\n reject(\n new TempestApiError(\n buildApiError(\n xhr.status,\n errorBody,\n { get: (name) => xhr.getResponseHeader(name) },\n sentRequestId,\n ),\n ),\n );\n return;\n }\n\n if (xhr.status === 204 || !xhr.responseText) {\n resolve(undefined as T);\n return;\n }\n\n if (contentType.includes(\"application/json\")) {\n try {\n resolve(parser(xhr.responseText) as T);\n } catch (err) {\n reject(err);\n }\n } else {\n resolve(xhr.responseText as unknown as T);\n }\n };\n\n xhr.onerror = () => {\n signal?.removeEventListener(\"abort\", handleAbort);\n reject(\n new TempestApiError({\n status: 0,\n detail: \"Falha de rede no upload.\",\n requestId: sentRequestId || undefined,\n }),\n );\n };\n\n xhr.onabort = () => {\n signal?.removeEventListener(\"abort\", handleAbort);\n reject(new DOMException(\"Aborted\", \"AbortError\"));\n };\n\n xhr.send(body);\n });\n}\n"],"mappings":";;;;AA0DA,SAAS,EAAe,GAAsB;CAC1C,IAAI,CAAC,GAAK,OAAO;CACjB,IAAI;EACA,OAAO,KAAK,MAAM,CAAG;CACzB,QAAQ;EACJ,OAAO;CACX;AACJ;AAWA,SAAgB,EAAgC,GAAgD;CAC5F,IAAM,EACF,QACA,SACA,YAAS,QACT,aAAU,CAAC,GACX,aACA,qBACA,mBACA,qBAAkB,IAClB,eACA,WACA,YAAS,KAAK,OACd,iBACA;CAEJ,OAAO,IAAI,SAAY,GAAS,MAAW;EACvC,IAAI,GAAQ,SAAS;GACjB,EAAO,IAAI,aAAa,WAAW,YAAY,CAAC;GAChD;EACJ;EAEA,IAAM,IAAM,IAAI,eAAe;EAE/B,AADA,EAAI,KAAK,GAAQ,CAAG,GACpB,EAAI,kBAAkB;EAEtB,IAAM,IAAQ,IAAW,GACnB,IAAgB,IAAY,EAAU,IAAI,EAAS,GACnD,IAAuC,EAAE,GAAG,EAAQ;EAW1D,AAVI,KAAS,EAAE,mBAAmB,OAE1B,MAAqB,KAAA,KACrB,EAA0B,GAAK,GAAkB,CAAc,IAE/D,EAAa,gBAAgB,UAAU,MAEvC,EAA2B,GAAK,CAAgB,IAGpD,KAAiB,EAAE,kBAAkB,OACrC,EAAa,kBAAkB;EAEnC,KAAK,IAAM,CAAC,GAAK,MAAU,OAAO,QAAQ,CAAY,GAClD,EAAI,iBAAiB,GAAK,CAAK;EAGnC,AAAI,MACA,EAAI,OAAO,cAAc,MAAU;GAC/B,EAAW;IACP,QAAQ,EAAM;IACd,OAAO,EAAM;IACb,UAAU,EAAM,mBAAmB,EAAM,SAAS,EAAM,QAAQ;IAChE,kBAAkB,EAAM;GAC5B,CAAC;EACL;EAGJ,SAAS,IAAoB;GACzB,EAAI,MAAM;EACd;EAuDA,AAtDA,GAAQ,iBAAiB,SAAS,CAAW,GAE7C,EAAI,eAAe;GACf,GAAQ,oBAAoB,SAAS,CAAW;GAChD,IAAM,IAAY,EAAI,UAAU,OAAO,EAAI,SAAS,KAC9C,IAAc,EAAI,kBAAkB,cAAc,KAAK;GAE7D,IAAI,CAAC,GAAW;IACZ,IAAM,IAAY,EAAe,EAAI,YAAY;IACjD,EACI,IAAI,EACA,EACI,EAAI,QACJ,GACA,EAAE,MAAM,MAAS,EAAI,kBAAkB,CAAI,EAAE,GAC7C,CACJ,CACJ,CACJ;IACA;GACJ;GAEA,IAAI,EAAI,WAAW,OAAO,CAAC,EAAI,cAAc;IACzC,EAAQ,KAAA,CAAc;IACtB;GACJ;GAEA,IAAI,EAAY,SAAS,kBAAkB,GACvC,IAAI;IACA,EAAQ,EAAO,EAAI,YAAY,CAAM;GACzC,SAAS,GAAK;IACV,EAAO,CAAG;GACd;QAEA,EAAQ,EAAI,YAA4B;EAEhD,GAEA,EAAI,gBAAgB;GAEhB,AADA,GAAQ,oBAAoB,SAAS,CAAW,GAChD,EACI,IAAI,EAAgB;IAChB,QAAQ;IACR,QAAQ;IACR,WAAW,KAAiB,KAAA;GAChC,CAAC,CACL;EACJ,GAEA,EAAI,gBAAgB;GAEhB,AADA,GAAQ,oBAAoB,SAAS,CAAW,GAChD,EAAO,IAAI,aAAa,WAAW,YAAY,CAAC;EACpD,GAEA,EAAI,KAAK,CAAI;CACjB,CAAC;AACL"}
1
+ {"version":3,"file":"upload-with-progress.js","names":[],"sources":["../../src/http/upload-with-progress.ts"],"sourcesContent":["/**\n * @tempest-limits function-lines — XMLHttpRequest is used instead of fetch precisely\n * because it reports upload progress, and its API is event-based: the body wires\n * load, error, abort, timeout and progress against one request object, plus the\n * AbortSignal bridge.\n */\nimport { randomId } from \"../utils\";\nimport { isTrustedCredentialTarget, reportSuppressedCredential } from \"./credential-scope\";\nimport { csrfHeaders } from \"./csrf\";\nimport type { CsrfOptions } from \"./csrf\";\nimport { buildApiError, TempestApiError } from \"./errors\";\n\nexport interface UploadProgressEvent {\n /** Bytes already uploaded. */\n loaded: number;\n /** Total payload size in bytes — only meaningful when `lengthComputable` is true. */\n total: number;\n /** Fraction between 0 and 1, or null when total is unknown. */\n fraction: number | null;\n lengthComputable: boolean;\n}\n\nexport interface UploadWithProgressOptions {\n url: string;\n body: FormData | Blob | File;\n method?: \"POST\" | \"PUT\" | \"PATCH\";\n headers?: Record<string, string>;\n /** Returns the current bearer token. */\n getToken?: () => string | null | undefined;\n /**\n * Origin the `getToken` credential belongs to, normally the API's.\n *\n * Unlike `createApiClient`, this helper has no base URL to infer a scope\n * from — the caller names the destination on every call. Set this when the\n * `url` can come from somewhere other than your own code (a signed URL the\n * API handed back, a value from a response body) and the token must not\n * follow it off-origin. Left unset, the header goes wherever `url` points,\n * which is the behaviour every version before 0.66.0 had.\n */\n credentialOrigin?: string;\n /**\n * Extra origins allowed to receive the credential, on top of\n * {@link credentialOrigin}. Ignored when that one is unset.\n */\n trustedOrigins?: readonly string[];\n /** Send cookies. Defaults to false. */\n withCredentials?: boolean;\n /**\n * Send a CSRF token with the upload, as `createApiClient`'s `csrf` does.\n * Off by default; `true` reads the `csrf_token` cookie into `X-CSRF-Token`.\n *\n * Scoped to {@link credentialOrigin} plus {@link trustedOrigins} — and,\n * unlike the bearer token, scoped even when `credentialOrigin` is unset:\n * then the scope is the page's own origin. The bearer default stays open\n * only for compatibility with every version before 0.66.0; this option is\n * new, so it starts closed. An API on another origin sets\n * `credentialOrigin` to receive the token.\n */\n csrf?: boolean | CsrfOptions;\n /** Called on every `progress` event from the XHR upload channel. */\n onProgress?: (event: UploadProgressEvent) => void;\n /** Abort the request. */\n signal?: AbortSignal;\n /** Override the JSON parser. Defaults to `JSON.parse`. */\n parser?: (raw: string) => unknown;\n /**\n * Per-request correlation id sent as `X-Request-ID` (Tempest convention).\n * Defaults to a generated id. Return an empty string to disable.\n */\n requestId?: () => string;\n}\n\nfunction parseErrorBody(raw: string): unknown {\n if (!raw) return null;\n try {\n return JSON.parse(raw);\n } catch {\n return raw;\n }\n}\n\n/**\n * Upload a file (or any payload) with byte-level progress reporting.\n *\n * `fetch` cannot report upload progress in browsers, so this helper falls\n * back to `XMLHttpRequest`. It mirrors the error contract used by\n * {@link createApiClient}: non-2xx responses reject with a `TempestApiError`.\n *\n * @returns The parsed JSON response, or the raw text when the response is not JSON.\n */\nexport function uploadWithProgress<T = unknown>(options: UploadWithProgressOptions): Promise<T> {\n const {\n url,\n body,\n method = \"POST\",\n headers = {},\n getToken,\n credentialOrigin,\n trustedOrigins,\n withCredentials = false,\n csrf,\n onProgress,\n signal,\n parser = JSON.parse,\n requestId,\n } = options;\n\n return new Promise<T>((resolve, reject) => {\n if (signal?.aborted) {\n reject(new DOMException(\"Aborted\", \"AbortError\"));\n return;\n }\n\n const xhr = new XMLHttpRequest();\n xhr.open(method, url);\n xhr.withCredentials = withCredentials;\n\n const token = getToken?.();\n const sentRequestId = requestId ? requestId() : randomId();\n const finalHeaders: Record<string, string> = { ...headers };\n if (token && !(\"Authorization\" in finalHeaders)) {\n if (\n credentialOrigin === undefined ||\n isTrustedCredentialTarget(url, credentialOrigin, trustedOrigins)\n ) {\n finalHeaders.Authorization = `Bearer ${token}`;\n } else {\n reportSuppressedCredential(url, credentialOrigin);\n }\n }\n Object.assign(\n finalHeaders,\n csrfHeaders({\n method,\n url,\n reference: credentialOrigin ?? globalThis.location?.origin ?? url,\n csrf,\n trustedOrigins,\n headers,\n }),\n );\n if (sentRequestId && !(\"X-Request-ID\" in finalHeaders)) {\n finalHeaders[\"X-Request-ID\"] = sentRequestId;\n }\n for (const [key, value] of Object.entries(finalHeaders)) {\n xhr.setRequestHeader(key, value);\n }\n\n if (onProgress) {\n xhr.upload.onprogress = (event) => {\n onProgress({\n loaded: event.loaded,\n total: event.total,\n fraction: event.lengthComputable ? event.loaded / event.total : null,\n lengthComputable: event.lengthComputable,\n });\n };\n }\n\n function handleAbort(): void {\n xhr.abort();\n }\n signal?.addEventListener(\"abort\", handleAbort);\n\n xhr.onload = () => {\n signal?.removeEventListener(\"abort\", handleAbort);\n const isSuccess = xhr.status >= 200 && xhr.status < 300;\n const contentType = xhr.getResponseHeader(\"content-type\") ?? \"\";\n\n if (!isSuccess) {\n const errorBody = parseErrorBody(xhr.responseText);\n reject(\n new TempestApiError(\n buildApiError(\n xhr.status,\n errorBody,\n { get: (name) => xhr.getResponseHeader(name) },\n sentRequestId,\n ),\n ),\n );\n return;\n }\n\n if (xhr.status === 204 || !xhr.responseText) {\n resolve(undefined as T);\n return;\n }\n\n if (contentType.includes(\"application/json\")) {\n try {\n resolve(parser(xhr.responseText) as T);\n } catch (err) {\n reject(err);\n }\n } else {\n resolve(xhr.responseText as unknown as T);\n }\n };\n\n xhr.onerror = () => {\n signal?.removeEventListener(\"abort\", handleAbort);\n reject(\n new TempestApiError({\n status: 0,\n detail: \"Falha de rede no upload.\",\n requestId: sentRequestId || undefined,\n }),\n );\n };\n\n xhr.onabort = () => {\n signal?.removeEventListener(\"abort\", handleAbort);\n reject(new DOMException(\"Aborted\", \"AbortError\"));\n };\n\n xhr.send(body);\n });\n}\n"],"mappings":";;;;;AAwEA,SAAS,EAAe,GAAsB;CAC1C,IAAI,CAAC,GAAK,OAAO;CACjB,IAAI;EACA,OAAO,KAAK,MAAM,CAAG;CACzB,QAAQ;EACJ,OAAO;CACX;AACJ;AAWA,SAAgB,EAAgC,GAAgD;CAC5F,IAAM,EACF,QACA,SACA,YAAS,QACT,aAAU,CAAC,GACX,aACA,qBACA,mBACA,qBAAkB,IAClB,SACA,eACA,WACA,YAAS,KAAK,OACd,iBACA;CAEJ,OAAO,IAAI,SAAY,GAAS,MAAW;EACvC,IAAI,GAAQ,SAAS;GACjB,EAAO,IAAI,aAAa,WAAW,YAAY,CAAC;GAChD;EACJ;EAEA,IAAM,IAAM,IAAI,eAAe;EAE/B,AADA,EAAI,KAAK,GAAQ,CAAG,GACpB,EAAI,kBAAkB;EAEtB,IAAM,IAAQ,IAAW,GACnB,IAAgB,IAAY,EAAU,IAAI,EAAS,GACnD,IAAuC,EAAE,GAAG,EAAQ;EAsB1D,AArBI,KAAS,EAAE,mBAAmB,OAE1B,MAAqB,KAAA,KACrB,EAA0B,GAAK,GAAkB,CAAc,IAE/D,EAAa,gBAAgB,UAAU,MAEvC,EAA2B,GAAK,CAAgB,IAGxD,OAAO,OACH,GACA,EAAY;GACR;GACA;GACA,WAAW,KAAoB,WAAW,UAAU,UAAU;GAC9D;GACA;GACA;EACJ,CAAC,CACL,GACI,KAAiB,EAAE,kBAAkB,OACrC,EAAa,kBAAkB;EAEnC,KAAK,IAAM,CAAC,GAAK,MAAU,OAAO,QAAQ,CAAY,GAClD,EAAI,iBAAiB,GAAK,CAAK;EAGnC,AAAI,MACA,EAAI,OAAO,cAAc,MAAU;GAC/B,EAAW;IACP,QAAQ,EAAM;IACd,OAAO,EAAM;IACb,UAAU,EAAM,mBAAmB,EAAM,SAAS,EAAM,QAAQ;IAChE,kBAAkB,EAAM;GAC5B,CAAC;EACL;EAGJ,SAAS,IAAoB;GACzB,EAAI,MAAM;EACd;EAuDA,AAtDA,GAAQ,iBAAiB,SAAS,CAAW,GAE7C,EAAI,eAAe;GACf,GAAQ,oBAAoB,SAAS,CAAW;GAChD,IAAM,IAAY,EAAI,UAAU,OAAO,EAAI,SAAS,KAC9C,IAAc,EAAI,kBAAkB,cAAc,KAAK;GAE7D,IAAI,CAAC,GAAW;IACZ,IAAM,IAAY,EAAe,EAAI,YAAY;IACjD,EACI,IAAI,EACA,EACI,EAAI,QACJ,GACA,EAAE,MAAM,MAAS,EAAI,kBAAkB,CAAI,EAAE,GAC7C,CACJ,CACJ,CACJ;IACA;GACJ;GAEA,IAAI,EAAI,WAAW,OAAO,CAAC,EAAI,cAAc;IACzC,EAAQ,KAAA,CAAc;IACtB;GACJ;GAEA,IAAI,EAAY,SAAS,kBAAkB,GACvC,IAAI;IACA,EAAQ,EAAO,EAAI,YAAY,CAAM;GACzC,SAAS,GAAK;IACV,EAAO,CAAG;GACd;QAEA,EAAQ,EAAI,YAA4B;EAEhD,GAEA,EAAI,gBAAgB;GAEhB,AADA,GAAQ,oBAAoB,SAAS,CAAW,GAChD,EACI,IAAI,EAAgB;IAChB,QAAQ;IACR,QAAQ;IACR,WAAW,KAAiB,KAAA;GAChC,CAAC,CACL;EACJ,GAEA,EAAI,gBAAgB;GAEhB,AADA,GAAQ,oBAAoB,SAAS,CAAW,GAChD,EAAO,IAAI,aAAa,WAAW,YAAY,CAAC;EACpD,GAEA,EAAI,KAAK,CAAI;CACjB,CAAC;AACL"}
@@ -1,2 +1,2 @@
1
- let e=require("react"),t=require("@tanstack/react-query");function n(n){let{queryKey:r,queryFn:i,initialPage:a=1,pageSize:o=20,sizeParam:s=`size`,orderBy:c,ascending:l=!1,...u}=n,[d,f]=(0,e.useState)(a),p=(0,t.useQuery)({...u,queryKey:[...r,{page:d,pageSize:o,sizeParam:s,orderBy:c,ascending:l}],queryFn:()=>{let e={page:d,[s]:o};return c&&(e.order_by=c,e.ascending=l),i(e)},placeholderData:t.keepPreviousData}),m=p.data,h=m?.pages??0,g=d<h,_=d>1,v=(0,e.useCallback)(e=>f(Math.max(1,e)),[]),y=(0,e.useCallback)(()=>f(e=>e<h?e+1:e),[h]),b=(0,e.useCallback)(()=>f(e=>e>1?e-1:e),[]);return{page:m,items:m?.items??[],pageNumber:d,pageCount:h,total:m?.total??0,hasNext:g,hasPrev:_,isLoading:p.isLoading,isFetching:p.isFetching,error:p.error,setPage:v,next:y,prev:b,refetch:()=>void p.refetch()}}exports.usePaginatedQuery=n;
1
+ let e=require("react"),t=require("@tanstack/react-query");function n(n){let{queryKey:r,queryFn:i,initialPage:a=1,pageSize:o=20,sizeParam:s=`size`,orderBy:c,ascending:l=!1,...u}=n,d=(0,t.hashKey)(r),[f,p]=(0,e.useState)({keyHash:d,page:a});f.keyHash!==d&&p({keyHash:d,page:1});let m=f.keyHash===d?f.page:1,h=(0,t.useQuery)({...u,queryKey:[...r,{page:m,pageSize:o,sizeParam:s,orderBy:c,ascending:l}],queryFn:()=>{let e={page:m,[s]:o};return c&&(e.order_by=c,e.ascending=l),i(e)},placeholderData:t.keepPreviousData}),g=h.data,_=g?.pages??0,v=m<_,y=m>1,b=(0,e.useCallback)(e=>p(t=>({...t,page:Math.max(1,e)})),[]),x=(0,e.useCallback)(()=>p(e=>e.page<_?{...e,page:e.page+1}:e),[_]),S=(0,e.useCallback)(()=>p(e=>e.page>1?{...e,page:e.page-1}:e),[]);return{page:g,items:g?.items??[],pageNumber:m,pageCount:_,total:g?.total??0,hasNext:v,hasPrev:y,isLoading:h.isLoading,isFetching:h.isFetching,error:h.error,setPage:b,next:x,prev:S,refetch:()=>void h.refetch()}}exports.usePaginatedQuery=n;
2
2
  //# sourceMappingURL=use-paginated-query.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-paginated-query.cjs","names":[],"sources":["../../src/query/use-paginated-query.ts"],"sourcesContent":["import { useCallback, useState } from \"react\";\nimport { keepPreviousData, useQuery } from \"@tanstack/react-query\";\nimport type { QueryKey, UseQueryOptions } from \"@tanstack/react-query\";\n\nimport type { OffsetPage, OffsetParams } from \"./pagination\";\n\nexport interface UsePaginatedQueryOptions<T> extends Omit<\n UseQueryOptions<OffsetPage<T>, Error, OffsetPage<T>, QueryKey>,\n \"queryKey\" | \"queryFn\"\n> {\n /** Base query key — the current page/sort is appended for cache isolation. */\n queryKey: QueryKey;\n /** Fetcher receiving the offset params; return the backend envelope. */\n queryFn: (params: OffsetParams) => Promise<OffsetPage<T>> | OffsetPage<T>;\n /** Initial 1-based page. Default: 1. */\n initialPage?: number;\n /** Page size. Default: 20. */\n pageSize?: number;\n /**\n * Query-param name for the page size. fastapi-pagination uses `\"size\"`\n * (default); SDK `BasePaginationFilterSchema` configs may use `\"page_size\"`.\n */\n sizeParam?: \"size\" | \"page_size\";\n /** Initial `order_by` (only sent when set). */\n orderBy?: string;\n /** Initial `ascending` (only sent when `orderBy` is set). Default: false. */\n ascending?: boolean;\n}\n\nexport interface UsePaginatedQueryResult<T> {\n /** The current page envelope, or undefined while the first load is pending. */\n page: OffsetPage<T> | undefined;\n /** The rows of the current page (empty array while pending). */\n items: T[];\n /** Current 1-based page number (controlled by the hook). */\n pageNumber: number;\n /** Total page count from the last successful response. */\n pageCount: number;\n /** Total row count from the last successful response. */\n total: number;\n hasNext: boolean;\n hasPrev: boolean;\n isLoading: boolean;\n isFetching: boolean;\n error: Error | null;\n /** Jump to a specific 1-based page (clamped to >= 1). */\n setPage: (page: number) => void;\n /** Go to the next page when available. */\n next: () => void;\n /** Go to the previous page when available. */\n prev: () => void;\n /** Refetch the current page. */\n refetch: () => void;\n}\n\n/**\n * Offset-pagination hook over TanStack Query for the fastapi-pagination /\n * Tempest envelope (`{ items, total, page, size, pages }`).\n *\n * It owns the page state, sends `page` + the size param (`size` by default,\n * or `page_size` via `sizeParam`) plus optional `order_by`/`ascending` to your\n * fetcher, keeps the previous page visible while the next loads, and derives\n * `hasNext`/`hasPrev`/`pageCount`.\n *\n * @example\n * const users = usePaginatedQuery<User>({\n * queryKey: [\"users\"],\n * pageSize: 25,\n * queryFn: (params) => usersService.listUsers(params),\n * });\n * // users.items, users.next(), users.hasNext, users.pageCount\n */\nexport function usePaginatedQuery<T>(\n options: UsePaginatedQueryOptions<T>,\n): UsePaginatedQueryResult<T> {\n const {\n queryKey,\n queryFn,\n initialPage = 1,\n pageSize = 20,\n sizeParam = \"size\",\n orderBy,\n ascending = false,\n ...queryOptions\n } = options;\n\n const [pageNumber, setPageNumber] = useState(initialPage);\n\n const query = useQuery<OffsetPage<T>, Error>({\n ...queryOptions,\n queryKey: [...queryKey, { page: pageNumber, pageSize, sizeParam, orderBy, ascending }],\n queryFn: () => {\n const params: OffsetParams = { page: pageNumber, [sizeParam]: pageSize };\n if (orderBy) {\n params.order_by = orderBy;\n params.ascending = ascending;\n }\n return queryFn(params);\n },\n placeholderData: keepPreviousData,\n });\n\n const page = query.data;\n const pageCount = page?.pages ?? 0;\n const hasNext = pageNumber < pageCount;\n const hasPrev = pageNumber > 1;\n\n const setPage = useCallback((next: number) => setPageNumber(Math.max(1, next)), []);\n const next = useCallback(() => setPageNumber((p) => (p < pageCount ? p + 1 : p)), [pageCount]);\n const prev = useCallback(() => setPageNumber((p) => (p > 1 ? p - 1 : p)), []);\n\n return {\n page,\n items: page?.items ?? [],\n pageNumber,\n pageCount,\n total: page?.total ?? 0,\n hasNext,\n hasPrev,\n isLoading: query.isLoading,\n isFetching: query.isFetching,\n error: query.error,\n setPage,\n next,\n prev,\n refetch: () => void query.refetch(),\n };\n}\n"],"mappings":"0DAwEA,SAAgB,EACZ,EAC0B,CAC1B,GAAM,CACF,WACA,UACA,cAAc,EACd,WAAW,GACX,YAAY,OACZ,UACA,YAAY,GACZ,GAAG,GACH,EAEE,CAAC,EAAY,IAAA,EAAiB,EAAA,SAAA,CAAS,CAAW,EAElD,GAAA,EAAQ,EAAA,SAAA,CAA+B,CACzC,GAAG,EACH,SAAU,CAAC,GAAG,EAAU,CAAE,KAAM,EAAY,WAAU,YAAW,UAAS,WAAU,CAAC,EACrF,YAAe,CACX,IAAM,EAAuB,CAAE,KAAM,GAAa,GAAY,CAAS,EAKvE,OAJI,IACA,EAAO,SAAW,EAClB,EAAO,UAAY,GAEhB,EAAQ,CAAM,CACzB,EACA,gBAAiB,EAAA,gBACrB,CAAC,EAEK,EAAO,EAAM,KACb,EAAY,GAAM,OAAS,EAC3B,EAAU,EAAa,EACvB,EAAU,EAAa,EAEvB,GAAA,EAAU,EAAA,YAAA,CAAa,GAAiB,EAAc,KAAK,IAAI,EAAG,CAAI,CAAC,EAAG,CAAC,CAAC,EAC5E,GAAA,EAAO,EAAA,YAAA,KAAkB,EAAe,GAAO,EAAI,EAAY,EAAI,EAAI,CAAE,EAAG,CAAC,CAAS,CAAC,EACvF,GAAA,EAAO,EAAA,YAAA,KAAkB,EAAe,GAAO,EAAI,EAAI,EAAI,EAAI,CAAE,EAAG,CAAC,CAAC,EAE5E,MAAO,CACH,OACA,MAAO,GAAM,OAAS,CAAC,EACvB,aACA,YACA,MAAO,GAAM,OAAS,EACtB,UACA,UACA,UAAW,EAAM,UACjB,WAAY,EAAM,WAClB,MAAO,EAAM,MACb,UACA,OACA,OACA,YAAe,KAAK,EAAM,QAAQ,CACtC,CACJ"}
1
+ {"version":3,"file":"use-paginated-query.cjs","names":[],"sources":["../../src/query/use-paginated-query.ts"],"sourcesContent":["import { useCallback, useState } from \"react\";\nimport { hashKey, keepPreviousData, useQuery } from \"@tanstack/react-query\";\nimport type { QueryKey, UseQueryOptions } from \"@tanstack/react-query\";\n\nimport type { OffsetPage, OffsetParams } from \"./pagination\";\n\nexport interface UsePaginatedQueryOptions<T> extends Omit<\n UseQueryOptions<OffsetPage<T>, Error, OffsetPage<T>, QueryKey>,\n \"queryKey\" | \"queryFn\"\n> {\n /**\n * Base query key — the current page/sort is appended for cache isolation.\n * Put the applied filters here: when the key changes structurally, the page\n * goes back to 1 in the same render.\n */\n queryKey: QueryKey;\n /** Fetcher receiving the offset params; return the backend envelope. */\n queryFn: (params: OffsetParams) => Promise<OffsetPage<T>> | OffsetPage<T>;\n /** Initial 1-based page. Default: 1. */\n initialPage?: number;\n /** Page size. Default: 20. */\n pageSize?: number;\n /**\n * Query-param name for the page size. fastapi-pagination uses `\"size\"`\n * (default); SDK `BasePaginationFilterSchema` configs may use `\"page_size\"`.\n */\n sizeParam?: \"size\" | \"page_size\";\n /** Initial `order_by` (only sent when set). */\n orderBy?: string;\n /** Initial `ascending` (only sent when `orderBy` is set). Default: false. */\n ascending?: boolean;\n}\n\nexport interface UsePaginatedQueryResult<T> {\n /** The current page envelope, or undefined while the first load is pending. */\n page: OffsetPage<T> | undefined;\n /** The rows of the current page (empty array while pending). */\n items: T[];\n /** Current 1-based page number (controlled by the hook; back to 1 on a new `queryKey`). */\n pageNumber: number;\n /** Total page count from the last successful response. */\n pageCount: number;\n /** Total row count from the last successful response. */\n total: number;\n hasNext: boolean;\n hasPrev: boolean;\n isLoading: boolean;\n isFetching: boolean;\n error: Error | null;\n /** Jump to a specific 1-based page (clamped to >= 1). */\n setPage: (page: number) => void;\n /** Go to the next page when available. */\n next: () => void;\n /** Go to the previous page when available. */\n prev: () => void;\n /** Refetch the current page. */\n refetch: () => void;\n}\n\n/**\n * Offset-pagination hook over TanStack Query for the fastapi-pagination /\n * Tempest envelope (`{ items, total, page, size, pages }`).\n *\n * It owns the page state, sends `page` + the size param (`size` by default,\n * or `page_size` via `sizeParam`) plus optional `order_by`/`ascending` to your\n * fetcher, keeps the previous page visible while the next loads, and derives\n * `hasNext`/`hasPrev`/`pageCount`.\n *\n * A structurally different `queryKey` (compared with TanStack's `hashKey`) is a\n * different result set, so the page returns to 1. The reset is applied during\n * render rather than in an effect: an effect would let one render go out with the\n * new key and the old page, and that render is a request — on page 7 of an\n * unfiltered list, applying a filter used to ask for page 7 of a two-page result\n * and show an empty table (#356).\n *\n * @example\n * const users = usePaginatedQuery<User>({\n * queryKey: [\"users\"],\n * pageSize: 25,\n * queryFn: (params) => usersService.listUsers(params),\n * });\n * // users.items, users.next(), users.hasNext, users.pageCount\n */\nexport function usePaginatedQuery<T>(\n options: UsePaginatedQueryOptions<T>,\n): UsePaginatedQueryResult<T> {\n const {\n queryKey,\n queryFn,\n initialPage = 1,\n pageSize = 20,\n sizeParam = \"size\",\n orderBy,\n ascending = false,\n ...queryOptions\n } = options;\n\n const keyHash = hashKey(queryKey);\n const [paging, setPaging] = useState({ keyHash, page: initialPage });\n if (paging.keyHash !== keyHash) setPaging({ keyHash, page: 1 });\n const pageNumber = paging.keyHash === keyHash ? paging.page : 1;\n\n const query = useQuery<OffsetPage<T>, Error>({\n ...queryOptions,\n queryKey: [...queryKey, { page: pageNumber, pageSize, sizeParam, orderBy, ascending }],\n queryFn: () => {\n const params: OffsetParams = { page: pageNumber, [sizeParam]: pageSize };\n if (orderBy) {\n params.order_by = orderBy;\n params.ascending = ascending;\n }\n return queryFn(params);\n },\n placeholderData: keepPreviousData,\n });\n\n const page = query.data;\n const pageCount = page?.pages ?? 0;\n const hasNext = pageNumber < pageCount;\n const hasPrev = pageNumber > 1;\n\n const setPage = useCallback(\n (next: number) => setPaging((s) => ({ ...s, page: Math.max(1, next) })),\n [],\n );\n const next = useCallback(\n () => setPaging((s) => (s.page < pageCount ? { ...s, page: s.page + 1 } : s)),\n [pageCount],\n );\n const prev = useCallback(\n () => setPaging((s) => (s.page > 1 ? { ...s, page: s.page - 1 } : s)),\n [],\n );\n\n return {\n page,\n items: page?.items ?? [],\n pageNumber,\n pageCount,\n total: page?.total ?? 0,\n hasNext,\n hasPrev,\n isLoading: query.isLoading,\n isFetching: query.isFetching,\n error: query.error,\n setPage,\n next,\n prev,\n refetch: () => void query.refetch(),\n };\n}\n"],"mappings":"0DAmFA,SAAgB,EACZ,EAC0B,CAC1B,GAAM,CACF,WACA,UACA,cAAc,EACd,WAAW,GACX,YAAY,OACZ,UACA,YAAY,GACZ,GAAG,GACH,EAEE,GAAA,EAAU,EAAA,QAAA,CAAQ,CAAQ,EAC1B,CAAC,EAAQ,IAAA,EAAa,EAAA,SAAA,CAAS,CAAE,UAAS,KAAM,CAAY,CAAC,EAC/D,EAAO,UAAY,GAAS,EAAU,CAAE,UAAS,KAAM,CAAE,CAAC,EAC9D,IAAM,EAAa,EAAO,UAAY,EAAU,EAAO,KAAO,EAExD,GAAA,EAAQ,EAAA,SAAA,CAA+B,CACzC,GAAG,EACH,SAAU,CAAC,GAAG,EAAU,CAAE,KAAM,EAAY,WAAU,YAAW,UAAS,WAAU,CAAC,EACrF,YAAe,CACX,IAAM,EAAuB,CAAE,KAAM,GAAa,GAAY,CAAS,EAKvE,OAJI,IACA,EAAO,SAAW,EAClB,EAAO,UAAY,GAEhB,EAAQ,CAAM,CACzB,EACA,gBAAiB,EAAA,gBACrB,CAAC,EAEK,EAAO,EAAM,KACb,EAAY,GAAM,OAAS,EAC3B,EAAU,EAAa,EACvB,EAAU,EAAa,EAEvB,GAAA,EAAU,EAAA,YAAA,CACX,GAAiB,EAAW,IAAO,CAAE,GAAG,EAAG,KAAM,KAAK,IAAI,EAAG,CAAI,CAAE,EAAE,EACtE,CAAC,CACL,EACM,GAAA,EAAO,EAAA,YAAA,KACH,EAAW,GAAO,EAAE,KAAO,EAAY,CAAE,GAAG,EAAG,KAAM,EAAE,KAAO,CAAE,EAAI,CAAE,EAC5E,CAAC,CAAS,CACd,EACM,GAAA,EAAO,EAAA,YAAA,KACH,EAAW,GAAO,EAAE,KAAO,EAAI,CAAE,GAAG,EAAG,KAAM,EAAE,KAAO,CAAE,EAAI,CAAE,EACpE,CAAC,CACL,EAEA,MAAO,CACH,OACA,MAAO,GAAM,OAAS,CAAC,EACvB,aACA,YACA,MAAO,GAAM,OAAS,EACtB,UACA,UACA,UAAW,EAAM,UACjB,WAAY,EAAM,WAClB,MAAO,EAAM,MACb,UACA,OACA,OACA,YAAe,KAAK,EAAM,QAAQ,CACtC,CACJ"}
@@ -1,43 +1,60 @@
1
1
  import { useCallback as e, useState as t } from "react";
2
- import { keepPreviousData as n, useQuery as r } from "@tanstack/react-query";
2
+ import { hashKey as n, keepPreviousData as r, useQuery as i } from "@tanstack/react-query";
3
3
  //#region src/query/use-paginated-query.ts
4
- function i(i) {
5
- let { queryKey: a, queryFn: o, initialPage: s = 1, pageSize: c = 20, sizeParam: l = "size", orderBy: u, ascending: d = !1, ...f } = i, [p, m] = t(s), h = r({
6
- ...f,
7
- queryKey: [...a, {
8
- page: p,
9
- pageSize: c,
10
- sizeParam: l,
11
- orderBy: u,
12
- ascending: d
4
+ function a(a) {
5
+ let { queryKey: o, queryFn: s, initialPage: c = 1, pageSize: l = 20, sizeParam: u = "size", orderBy: d, ascending: f = !1, ...p } = a, m = n(o), [h, g] = t({
6
+ keyHash: m,
7
+ page: c
8
+ });
9
+ h.keyHash !== m && g({
10
+ keyHash: m,
11
+ page: 1
12
+ });
13
+ let _ = h.keyHash === m ? h.page : 1, v = i({
14
+ ...p,
15
+ queryKey: [...o, {
16
+ page: _,
17
+ pageSize: l,
18
+ sizeParam: u,
19
+ orderBy: d,
20
+ ascending: f
13
21
  }],
14
22
  queryFn: () => {
15
23
  let e = {
16
- page: p,
17
- [l]: c
24
+ page: _,
25
+ [u]: l
18
26
  };
19
- return u && (e.order_by = u, e.ascending = d), o(e);
27
+ return d && (e.order_by = d, e.ascending = f), s(e);
20
28
  },
21
- placeholderData: n
22
- }), g = h.data, _ = g?.pages ?? 0, v = p < _, y = p > 1, b = e((e) => m(Math.max(1, e)), []), x = e(() => m((e) => e < _ ? e + 1 : e), [_]), S = e(() => m((e) => e > 1 ? e - 1 : e), []);
29
+ placeholderData: r
30
+ }), y = v.data, b = y?.pages ?? 0, x = _ < b, S = _ > 1, C = e((e) => g((t) => ({
31
+ ...t,
32
+ page: Math.max(1, e)
33
+ })), []), w = e(() => g((e) => e.page < b ? {
34
+ ...e,
35
+ page: e.page + 1
36
+ } : e), [b]), T = e(() => g((e) => e.page > 1 ? {
37
+ ...e,
38
+ page: e.page - 1
39
+ } : e), []);
23
40
  return {
24
- page: g,
25
- items: g?.items ?? [],
26
- pageNumber: p,
27
- pageCount: _,
28
- total: g?.total ?? 0,
29
- hasNext: v,
30
- hasPrev: y,
31
- isLoading: h.isLoading,
32
- isFetching: h.isFetching,
33
- error: h.error,
34
- setPage: b,
35
- next: x,
36
- prev: S,
37
- refetch: () => void h.refetch()
41
+ page: y,
42
+ items: y?.items ?? [],
43
+ pageNumber: _,
44
+ pageCount: b,
45
+ total: y?.total ?? 0,
46
+ hasNext: x,
47
+ hasPrev: S,
48
+ isLoading: v.isLoading,
49
+ isFetching: v.isFetching,
50
+ error: v.error,
51
+ setPage: C,
52
+ next: w,
53
+ prev: T,
54
+ refetch: () => void v.refetch()
38
55
  };
39
56
  }
40
57
  //#endregion
41
- export { i as usePaginatedQuery };
58
+ export { a as usePaginatedQuery };
42
59
 
43
60
  //# sourceMappingURL=use-paginated-query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-paginated-query.js","names":[],"sources":["../../src/query/use-paginated-query.ts"],"sourcesContent":["import { useCallback, useState } from \"react\";\nimport { keepPreviousData, useQuery } from \"@tanstack/react-query\";\nimport type { QueryKey, UseQueryOptions } from \"@tanstack/react-query\";\n\nimport type { OffsetPage, OffsetParams } from \"./pagination\";\n\nexport interface UsePaginatedQueryOptions<T> extends Omit<\n UseQueryOptions<OffsetPage<T>, Error, OffsetPage<T>, QueryKey>,\n \"queryKey\" | \"queryFn\"\n> {\n /** Base query key — the current page/sort is appended for cache isolation. */\n queryKey: QueryKey;\n /** Fetcher receiving the offset params; return the backend envelope. */\n queryFn: (params: OffsetParams) => Promise<OffsetPage<T>> | OffsetPage<T>;\n /** Initial 1-based page. Default: 1. */\n initialPage?: number;\n /** Page size. Default: 20. */\n pageSize?: number;\n /**\n * Query-param name for the page size. fastapi-pagination uses `\"size\"`\n * (default); SDK `BasePaginationFilterSchema` configs may use `\"page_size\"`.\n */\n sizeParam?: \"size\" | \"page_size\";\n /** Initial `order_by` (only sent when set). */\n orderBy?: string;\n /** Initial `ascending` (only sent when `orderBy` is set). Default: false. */\n ascending?: boolean;\n}\n\nexport interface UsePaginatedQueryResult<T> {\n /** The current page envelope, or undefined while the first load is pending. */\n page: OffsetPage<T> | undefined;\n /** The rows of the current page (empty array while pending). */\n items: T[];\n /** Current 1-based page number (controlled by the hook). */\n pageNumber: number;\n /** Total page count from the last successful response. */\n pageCount: number;\n /** Total row count from the last successful response. */\n total: number;\n hasNext: boolean;\n hasPrev: boolean;\n isLoading: boolean;\n isFetching: boolean;\n error: Error | null;\n /** Jump to a specific 1-based page (clamped to >= 1). */\n setPage: (page: number) => void;\n /** Go to the next page when available. */\n next: () => void;\n /** Go to the previous page when available. */\n prev: () => void;\n /** Refetch the current page. */\n refetch: () => void;\n}\n\n/**\n * Offset-pagination hook over TanStack Query for the fastapi-pagination /\n * Tempest envelope (`{ items, total, page, size, pages }`).\n *\n * It owns the page state, sends `page` + the size param (`size` by default,\n * or `page_size` via `sizeParam`) plus optional `order_by`/`ascending` to your\n * fetcher, keeps the previous page visible while the next loads, and derives\n * `hasNext`/`hasPrev`/`pageCount`.\n *\n * @example\n * const users = usePaginatedQuery<User>({\n * queryKey: [\"users\"],\n * pageSize: 25,\n * queryFn: (params) => usersService.listUsers(params),\n * });\n * // users.items, users.next(), users.hasNext, users.pageCount\n */\nexport function usePaginatedQuery<T>(\n options: UsePaginatedQueryOptions<T>,\n): UsePaginatedQueryResult<T> {\n const {\n queryKey,\n queryFn,\n initialPage = 1,\n pageSize = 20,\n sizeParam = \"size\",\n orderBy,\n ascending = false,\n ...queryOptions\n } = options;\n\n const [pageNumber, setPageNumber] = useState(initialPage);\n\n const query = useQuery<OffsetPage<T>, Error>({\n ...queryOptions,\n queryKey: [...queryKey, { page: pageNumber, pageSize, sizeParam, orderBy, ascending }],\n queryFn: () => {\n const params: OffsetParams = { page: pageNumber, [sizeParam]: pageSize };\n if (orderBy) {\n params.order_by = orderBy;\n params.ascending = ascending;\n }\n return queryFn(params);\n },\n placeholderData: keepPreviousData,\n });\n\n const page = query.data;\n const pageCount = page?.pages ?? 0;\n const hasNext = pageNumber < pageCount;\n const hasPrev = pageNumber > 1;\n\n const setPage = useCallback((next: number) => setPageNumber(Math.max(1, next)), []);\n const next = useCallback(() => setPageNumber((p) => (p < pageCount ? p + 1 : p)), [pageCount]);\n const prev = useCallback(() => setPageNumber((p) => (p > 1 ? p - 1 : p)), []);\n\n return {\n page,\n items: page?.items ?? [],\n pageNumber,\n pageCount,\n total: page?.total ?? 0,\n hasNext,\n hasPrev,\n isLoading: query.isLoading,\n isFetching: query.isFetching,\n error: query.error,\n setPage,\n next,\n prev,\n refetch: () => void query.refetch(),\n };\n}\n"],"mappings":";;;AAwEA,SAAgB,EACZ,GAC0B;CAC1B,IAAM,EACF,aACA,YACA,iBAAc,GACd,cAAW,IACX,eAAY,QACZ,YACA,eAAY,IACZ,GAAG,MACH,GAEE,CAAC,GAAY,KAAiB,EAAS,CAAW,GAElD,IAAQ,EAA+B;EACzC,GAAG;EACH,UAAU,CAAC,GAAG,GAAU;GAAE,MAAM;GAAY;GAAU;GAAW;GAAS;EAAU,CAAC;EACrF,eAAe;GACX,IAAM,IAAuB;IAAE,MAAM;KAAa,IAAY;GAAS;GAKvE,OAJI,MACA,EAAO,WAAW,GAClB,EAAO,YAAY,IAEhB,EAAQ,CAAM;EACzB;EACA,iBAAiB;CACrB,CAAC,GAEK,IAAO,EAAM,MACb,IAAY,GAAM,SAAS,GAC3B,IAAU,IAAa,GACvB,IAAU,IAAa,GAEvB,IAAU,GAAa,MAAiB,EAAc,KAAK,IAAI,GAAG,CAAI,CAAC,GAAG,CAAC,CAAC,GAC5E,IAAO,QAAkB,GAAe,MAAO,IAAI,IAAY,IAAI,IAAI,CAAE,GAAG,CAAC,CAAS,CAAC,GACvF,IAAO,QAAkB,GAAe,MAAO,IAAI,IAAI,IAAI,IAAI,CAAE,GAAG,CAAC,CAAC;CAE5E,OAAO;EACH;EACA,OAAO,GAAM,SAAS,CAAC;EACvB;EACA;EACA,OAAO,GAAM,SAAS;EACtB;EACA;EACA,WAAW,EAAM;EACjB,YAAY,EAAM;EAClB,OAAO,EAAM;EACb;EACA;EACA;EACA,eAAe,KAAK,EAAM,QAAQ;CACtC;AACJ"}
1
+ {"version":3,"file":"use-paginated-query.js","names":[],"sources":["../../src/query/use-paginated-query.ts"],"sourcesContent":["import { useCallback, useState } from \"react\";\nimport { hashKey, keepPreviousData, useQuery } from \"@tanstack/react-query\";\nimport type { QueryKey, UseQueryOptions } from \"@tanstack/react-query\";\n\nimport type { OffsetPage, OffsetParams } from \"./pagination\";\n\nexport interface UsePaginatedQueryOptions<T> extends Omit<\n UseQueryOptions<OffsetPage<T>, Error, OffsetPage<T>, QueryKey>,\n \"queryKey\" | \"queryFn\"\n> {\n /**\n * Base query key — the current page/sort is appended for cache isolation.\n * Put the applied filters here: when the key changes structurally, the page\n * goes back to 1 in the same render.\n */\n queryKey: QueryKey;\n /** Fetcher receiving the offset params; return the backend envelope. */\n queryFn: (params: OffsetParams) => Promise<OffsetPage<T>> | OffsetPage<T>;\n /** Initial 1-based page. Default: 1. */\n initialPage?: number;\n /** Page size. Default: 20. */\n pageSize?: number;\n /**\n * Query-param name for the page size. fastapi-pagination uses `\"size\"`\n * (default); SDK `BasePaginationFilterSchema` configs may use `\"page_size\"`.\n */\n sizeParam?: \"size\" | \"page_size\";\n /** Initial `order_by` (only sent when set). */\n orderBy?: string;\n /** Initial `ascending` (only sent when `orderBy` is set). Default: false. */\n ascending?: boolean;\n}\n\nexport interface UsePaginatedQueryResult<T> {\n /** The current page envelope, or undefined while the first load is pending. */\n page: OffsetPage<T> | undefined;\n /** The rows of the current page (empty array while pending). */\n items: T[];\n /** Current 1-based page number (controlled by the hook; back to 1 on a new `queryKey`). */\n pageNumber: number;\n /** Total page count from the last successful response. */\n pageCount: number;\n /** Total row count from the last successful response. */\n total: number;\n hasNext: boolean;\n hasPrev: boolean;\n isLoading: boolean;\n isFetching: boolean;\n error: Error | null;\n /** Jump to a specific 1-based page (clamped to >= 1). */\n setPage: (page: number) => void;\n /** Go to the next page when available. */\n next: () => void;\n /** Go to the previous page when available. */\n prev: () => void;\n /** Refetch the current page. */\n refetch: () => void;\n}\n\n/**\n * Offset-pagination hook over TanStack Query for the fastapi-pagination /\n * Tempest envelope (`{ items, total, page, size, pages }`).\n *\n * It owns the page state, sends `page` + the size param (`size` by default,\n * or `page_size` via `sizeParam`) plus optional `order_by`/`ascending` to your\n * fetcher, keeps the previous page visible while the next loads, and derives\n * `hasNext`/`hasPrev`/`pageCount`.\n *\n * A structurally different `queryKey` (compared with TanStack's `hashKey`) is a\n * different result set, so the page returns to 1. The reset is applied during\n * render rather than in an effect: an effect would let one render go out with the\n * new key and the old page, and that render is a request — on page 7 of an\n * unfiltered list, applying a filter used to ask for page 7 of a two-page result\n * and show an empty table (#356).\n *\n * @example\n * const users = usePaginatedQuery<User>({\n * queryKey: [\"users\"],\n * pageSize: 25,\n * queryFn: (params) => usersService.listUsers(params),\n * });\n * // users.items, users.next(), users.hasNext, users.pageCount\n */\nexport function usePaginatedQuery<T>(\n options: UsePaginatedQueryOptions<T>,\n): UsePaginatedQueryResult<T> {\n const {\n queryKey,\n queryFn,\n initialPage = 1,\n pageSize = 20,\n sizeParam = \"size\",\n orderBy,\n ascending = false,\n ...queryOptions\n } = options;\n\n const keyHash = hashKey(queryKey);\n const [paging, setPaging] = useState({ keyHash, page: initialPage });\n if (paging.keyHash !== keyHash) setPaging({ keyHash, page: 1 });\n const pageNumber = paging.keyHash === keyHash ? paging.page : 1;\n\n const query = useQuery<OffsetPage<T>, Error>({\n ...queryOptions,\n queryKey: [...queryKey, { page: pageNumber, pageSize, sizeParam, orderBy, ascending }],\n queryFn: () => {\n const params: OffsetParams = { page: pageNumber, [sizeParam]: pageSize };\n if (orderBy) {\n params.order_by = orderBy;\n params.ascending = ascending;\n }\n return queryFn(params);\n },\n placeholderData: keepPreviousData,\n });\n\n const page = query.data;\n const pageCount = page?.pages ?? 0;\n const hasNext = pageNumber < pageCount;\n const hasPrev = pageNumber > 1;\n\n const setPage = useCallback(\n (next: number) => setPaging((s) => ({ ...s, page: Math.max(1, next) })),\n [],\n );\n const next = useCallback(\n () => setPaging((s) => (s.page < pageCount ? { ...s, page: s.page + 1 } : s)),\n [pageCount],\n );\n const prev = useCallback(\n () => setPaging((s) => (s.page > 1 ? { ...s, page: s.page - 1 } : s)),\n [],\n );\n\n return {\n page,\n items: page?.items ?? [],\n pageNumber,\n pageCount,\n total: page?.total ?? 0,\n hasNext,\n hasPrev,\n isLoading: query.isLoading,\n isFetching: query.isFetching,\n error: query.error,\n setPage,\n next,\n prev,\n refetch: () => void query.refetch(),\n };\n}\n"],"mappings":";;;AAmFA,SAAgB,EACZ,GAC0B;CAC1B,IAAM,EACF,aACA,YACA,iBAAc,GACd,cAAW,IACX,eAAY,QACZ,YACA,eAAY,IACZ,GAAG,MACH,GAEE,IAAU,EAAQ,CAAQ,GAC1B,CAAC,GAAQ,KAAa,EAAS;EAAE;EAAS,MAAM;CAAY,CAAC;CACnE,AAAI,EAAO,YAAY,KAAS,EAAU;EAAE;EAAS,MAAM;CAAE,CAAC;CAC9D,IAAM,IAAa,EAAO,YAAY,IAAU,EAAO,OAAO,GAExD,IAAQ,EAA+B;EACzC,GAAG;EACH,UAAU,CAAC,GAAG,GAAU;GAAE,MAAM;GAAY;GAAU;GAAW;GAAS;EAAU,CAAC;EACrF,eAAe;GACX,IAAM,IAAuB;IAAE,MAAM;KAAa,IAAY;GAAS;GAKvE,OAJI,MACA,EAAO,WAAW,GAClB,EAAO,YAAY,IAEhB,EAAQ,CAAM;EACzB;EACA,iBAAiB;CACrB,CAAC,GAEK,IAAO,EAAM,MACb,IAAY,GAAM,SAAS,GAC3B,IAAU,IAAa,GACvB,IAAU,IAAa,GAEvB,IAAU,GACX,MAAiB,GAAW,OAAO;EAAE,GAAG;EAAG,MAAM,KAAK,IAAI,GAAG,CAAI;CAAE,EAAE,GACtE,CAAC,CACL,GACM,IAAO,QACH,GAAW,MAAO,EAAE,OAAO,IAAY;EAAE,GAAG;EAAG,MAAM,EAAE,OAAO;CAAE,IAAI,CAAE,GAC5E,CAAC,CAAS,CACd,GACM,IAAO,QACH,GAAW,MAAO,EAAE,OAAO,IAAI;EAAE,GAAG;EAAG,MAAM,EAAE,OAAO;CAAE,IAAI,CAAE,GACpE,CAAC,CACL;CAEA,OAAO;EACH;EACA,OAAO,GAAM,SAAS,CAAC;EACvB;EACA;EACA,OAAO,GAAM,SAAS;EACtB;EACA;EACA,WAAW,EAAM;EACjB,YAAY,EAAM;EAClB,OAAO,EAAM;EACb;EACA;EACA;EACA,eAAe,KAAK,EAAM,QAAQ;CACtC;AACJ"}
@@ -0,0 +1,2 @@
1
+ /* Generated by scripts/split-css.mjs — do not edit. */
2
+ @import "./component/FilterPanel.css";
@@ -42,6 +42,7 @@
42
42
  @keyframes tempest_tempest-spin_UOSVC{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
43
43
  .tempest_root_5ZetV{display:inline-flex;position:relative}
44
44
  .tempest_menu_-RiRW{z-index:var(--tempest-z-dropdown);background-color:var(--tempest-bg);border:1px solid var(--tempest-border);border-radius:var(--tempest-radius-lg);min-width:180px;max-width:320px;box-shadow:var(--tempest-shadow-lg);padding:var(--tempest-space-1);font-family:var(--tempest-font-sans);font-size:var(--tempest-text-base);animation:tempest_tempest-menu-in_uCs9q var(--tempest-duration-fast) var(--tempest-ease-out);margin:0;list-style:none;position:absolute}
45
+ .tempest_portalled_b7vCf{z-index:var(--tempest-z-popover)}
45
46
  .tempest_bottomStart_z60h9{top:calc(100% + 4px);left:0}
46
47
  .tempest_bottomEnd_b1tmU{top:calc(100% + 4px);right:0}
47
48
  .tempest_topStart_A0em2{bottom:calc(100% + 4px);left:0}
@@ -92,6 +93,7 @@
92
93
  .tempest_root_vEMon{display:inline-flex;position:relative}
93
94
  .tempest_popover_E9K9X{z-index:var(--tempest-z-popover);background-color:var(--tempest-bg);color:var(--tempest-text);border:1px solid var(--tempest-border);border-radius:var(--tempest-radius-lg);box-shadow:var(--tempest-shadow-lg);padding:var(--tempest-space-3) var(--tempest-space-4);min-width:200px;max-width:320px;font-family:var(--tempest-font-sans);font-size:var(--tempest-text-base);line-height:var(--tempest-leading-snug);animation:tempest_tempest-popover-in_W8miP var(--tempest-duration-fast) var(--tempest-ease-out);position:absolute}
94
95
  .tempest_popover_E9K9X:focus{outline:none}
96
+ .tempest_portalled_pZ553{--tempest-popover-tx:0}
95
97
  .tempest_top_TYlrh{bottom:calc(100% + 8px);left:50%;transform:translate(-50%)}
96
98
  .tempest_bottom_wGs70{top:calc(100% + 8px);left:50%;transform:translate(-50%)}
97
99
  .tempest_left_h7fCr{top:50%;right:calc(100% + 8px);transform:translateY(-50%)}
@@ -104,6 +106,7 @@
104
106
  .tempest_bottom_9Twz4{top:calc(100% + 8px);left:50%;transform:translate(-50%)}
105
107
  .tempest_left_UPdrG{top:50%;right:calc(100% + 8px);transform:translateY(-50%)}
106
108
  .tempest_right_CV--T{top:50%;left:calc(100% + 8px);transform:translateY(-50%)}
109
+ .tempest_portalled_MImIY{bottom:auto;right:auto;transform:none}
107
110
  @keyframes tempest_tempest-tooltip-in_csYeZ{0%{opacity:0;transform:scale(.94) translate(var(--tempest-tx,0), var(--tempest-ty,0))}to{opacity:1}}
108
111
  @media (prefers-reduced-motion:reduce){.tempest_bubble_TPGHB{animation:none}}
109
112
  @media (hover:none){.tempest_bubble_TPGHB{display:none}}
@@ -43,6 +43,7 @@
43
43
  .tempest_bottom_2rLAA{top:calc(100% + 8px);left:50%;transform:translate(-50%)}
44
44
  .tempest_left_tqGPt{top:50%;right:calc(100% + 8px);transform:translateY(-50%)}
45
45
  .tempest_right_9Fe6S{top:50%;left:calc(100% + 8px);transform:translateY(-50%)}
46
+ .tempest_portalled_GMcNw{bottom:auto;right:auto;transform:none}
46
47
  @keyframes tempest_tempest-hover-card-in_jD85J{0%{opacity:0}to{opacity:1}}
47
48
  @media (prefers-reduced-motion:reduce){.tempest_card_CoGx4{animation:none}}
48
49
  .tempest_label_RaRvM{align-items:center;gap:var(--tempest-space-1);color:var(--tempest-text);font-family:var(--tempest-font-sans);font-size:var(--tempest-text-sm);font-weight:var(--tempest-weight-medium);line-height:var(--tempest-leading-snug);display:inline-flex}
@@ -9,7 +9,7 @@
9
9
  .tempest_interactive_B8Tah:focus-visible{outline:var(--tempest-focus-ring-width) solid var(--tempest-focus-ring-color);outline-offset:var(--tempest-focus-ring-offset)}
10
10
  .tempest_padded_oOxwN{padding:var(--tempest-space-5)}
11
11
  .tempest_flush_aiDZi{padding:0}
12
- .tempest_header_PTXf2{justify-content:space-between;align-items:center;gap:var(--tempest-space-3);padding:var(--tempest-space-4) var(--tempest-space-5);border-bottom:1px solid var(--tempest-border);display:flex}
12
+ .tempest_header_PTXf2{justify-content:space-between;align-items:center;gap:var(--tempest-space-3);padding:var(--tempest-space-4) var(--tempest-space-5);border-bottom:1px solid var(--tempest-border);flex-wrap:wrap;display:flex}
13
13
  .tempest_title_mSgoo{font-size:var(--tempest-text-md);font-weight:var(--tempest-weight-semibold);line-height:var(--tempest-leading-snug);color:var(--tempest-text);margin:0}
14
14
  .tempest_body_W441Z{padding:var(--tempest-space-5)}
15
15
  .tempest_footer_Mu-JC{justify-content:flex-end;align-items:center;gap:var(--tempest-space-2);padding:var(--tempest-space-4) var(--tempest-space-5);border-top:1px solid var(--tempest-border);display:flex}
@@ -1,12 +1,13 @@
1
1
  /* Generated by scripts/split-css.mjs — do not edit. */
2
2
  .tempest_wrapper_TNvle{gap:var(--tempest-space-1);width:100%;font-family:var(--tempest-font-sans);flex-direction:column;display:flex;position:relative}
3
3
  .tempest_label_KVkZO{font-size:var(--tempest-text-sm);font-weight:var(--tempest-weight-semibold);color:var(--tempest-text);line-height:var(--tempest-leading-snug)}
4
- .tempest_field_BenH0{align-items:center;display:flex;position:relative}
5
- .tempest_input_-HTv1{width:100%;height:var(--tempest-control-height-md);padding:0 32px 0 var(--tempest-control-padding-md);border:1px solid var(--tempest-border);border-radius:var(--tempest-control-radius);background-color:var(--tempest-bg);color:var(--tempest-text);font-family:inherit;font-size:var(--tempest-control-font-md);box-shadow:var(--tempest-shadow-xs);transition:var(--tempest-transition-color), var(--tempest-transition-shadow)}
4
+ .tempest_field_BenH0{--_tempest-caret-offset:var(--tempest-control-caret-offset,12px);--_tempest-caret-size:var(--tempest-control-caret-size,14px);align-items:center;display:flex;position:relative}
5
+ .tempest_input_-HTv1{width:100%;height:var(--tempest-control-height-md);padding:0 calc(var(--_tempest-caret-offset) + var(--_tempest-caret-size) + 6px) 0 var(--tempest-control-padding-md);border:1px solid var(--tempest-border);border-radius:var(--tempest-control-radius);background-color:var(--tempest-bg);color:var(--tempest-text);font-family:inherit;font-size:var(--tempest-control-font-md);box-shadow:var(--tempest-shadow-xs);transition:var(--tempest-transition-color), var(--tempest-transition-shadow)}
6
6
  .tempest_input_-HTv1::placeholder{color:var(--tempest-text-subtle)}
7
7
  .tempest_input_-HTv1:focus{border-color:var(--tempest-primary);box-shadow:0 0 0 var(--tempest-focus-ring-width) var(--tempest-focus-ring-color);outline:none}
8
8
  .tempest_input_-HTv1:disabled{background-color:var(--tempest-surface);cursor:not-allowed}
9
- .tempest_caret_jRplQ{pointer-events:none;color:var(--tempest-text-muted);position:absolute;right:12px}
9
+ .tempest_caret_jRplQ{right:var(--_tempest-caret-offset);width:var(--_tempest-caret-size);height:var(--_tempest-caret-size);pointer-events:none;color:var(--tempest-text-muted);justify-content:center;align-items:center;display:flex;position:absolute}
10
+ .tempest_field_BenH0>.tempest_caret_jRplQ>svg{flex:none;width:100%;height:100%;margin:0;display:block}
10
11
  .tempest_menu_zPQG3{z-index:var(--tempest-z-dropdown);background-color:var(--tempest-bg);border:1px solid var(--tempest-border);border-radius:var(--tempest-radius-lg);box-shadow:var(--tempest-shadow-lg);max-height:280px;padding:var(--tempest-space-1);margin:0;list-style:none;position:absolute;top:calc(100% + 4px);left:0;right:0;overflow-y:auto}
11
12
  .tempest_option_vhhn5{padding:var(--tempest-space-2) var(--tempest-space-3);border-radius:var(--tempest-radius-sm);cursor:pointer;color:var(--tempest-text);font-size:var(--tempest-text-base);line-height:var(--tempest-leading-snug);align-items:center;display:flex}
12
13
  @media (hover:hover) and (pointer:fine){.tempest_option_vhhn5:hover{background-color:var(--tempest-surface)}}
@@ -16,3 +17,4 @@
16
17
  .tempest_helper_OzB7V{font-size:var(--tempest-text-xs);color:var(--tempest-text-muted)}
17
18
  .tempest_errorText_X18sQ{font-size:var(--tempest-text-xs);color:var(--tempest-danger)}
18
19
  .tempest_wrapper_TNvle.tempest_error_bnVuM .tempest_input_-HTv1{border-color:var(--tempest-danger)}
20
+ .tempest_portalled_C9jFy{font-family:var(--tempest-font-sans);z-index:var(--tempest-z-popover);right:auto}
@@ -1,6 +1,7 @@
1
1
  /* Generated by scripts/split-css.mjs — do not edit. */
2
2
  .tempest_root_5ZetV{display:inline-flex;position:relative}
3
3
  .tempest_menu_-RiRW{z-index:var(--tempest-z-dropdown);background-color:var(--tempest-bg);border:1px solid var(--tempest-border);border-radius:var(--tempest-radius-lg);min-width:180px;max-width:320px;box-shadow:var(--tempest-shadow-lg);padding:var(--tempest-space-1);font-family:var(--tempest-font-sans);font-size:var(--tempest-text-base);animation:tempest_tempest-menu-in_uCs9q var(--tempest-duration-fast) var(--tempest-ease-out);margin:0;list-style:none;position:absolute}
4
+ .tempest_portalled_b7vCf{z-index:var(--tempest-z-popover)}
4
5
  .tempest_bottomStart_z60h9{top:calc(100% + 4px);left:0}
5
6
  .tempest_bottomEnd_b1tmU{top:calc(100% + 4px);right:0}
6
7
  .tempest_topStart_A0em2{bottom:calc(100% + 4px);left:0}
@@ -0,0 +1,5 @@
1
+ /* Generated by scripts/split-css.mjs — do not edit. */
2
+ .tempest_panel_ab2ba{min-width:0}
3
+ .tempest_actions_9a-Sm{justify-content:flex-end;align-items:center;gap:var(--tempest-space-2);flex-wrap:wrap;margin-left:auto;display:flex}
4
+ .tempest_form_bMDhN{margin:0}
5
+ .tempest_fields_M30-g{align-items:start}
@@ -7,5 +7,6 @@
7
7
  .tempest_bottom_2rLAA{top:calc(100% + 8px);left:50%;transform:translate(-50%)}
8
8
  .tempest_left_tqGPt{top:50%;right:calc(100% + 8px);transform:translateY(-50%)}
9
9
  .tempest_right_9Fe6S{top:50%;left:calc(100% + 8px);transform:translateY(-50%)}
10
+ .tempest_portalled_GMcNw{bottom:auto;right:auto;transform:none}
10
11
  @keyframes tempest_tempest-hover-card-in_jD85J{0%{opacity:0}to{opacity:1}}
11
12
  @media (prefers-reduced-motion:reduce){.tempest_card_CoGx4{animation:none}}
@@ -15,3 +15,4 @@
15
15
  .tempest_separator_LfK3t{background-color:var(--tempest-border);height:1px;margin:var(--tempest-space-1) 0}
16
16
  @keyframes tempest_tempest-menubar-in_gOQQD{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
17
17
  @media (prefers-reduced-motion:reduce){.tempest_panel_6ta6u{animation:none}}
18
+ .tempest_portalled_tdHc1{font-family:var(--tempest-font-sans);font-size:var(--tempest-text-sm);z-index:var(--tempest-z-popover)}
@@ -19,3 +19,4 @@
19
19
  .tempest_helper_c7aH3{font-size:var(--tempest-text-xs);color:var(--tempest-text-muted)}
20
20
  .tempest_errorText_qZR9s{font-size:var(--tempest-text-xs);color:var(--tempest-danger)}
21
21
  .tempest_wrapper_6xZZr.tempest_error_DIOTW .tempest_field_GpA0V{border-color:var(--tempest-danger)}
22
+ .tempest_portalled_i1wmW{font-family:var(--tempest-font-sans);z-index:var(--tempest-z-popover);right:auto}
@@ -10,3 +10,4 @@
10
10
  .tempest_subItem_LjtO7 .tempest_link_67ULr{width:100%}
11
11
  @keyframes tempest_tempest-nav-menu-in_8tNCR{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
12
12
  @media (prefers-reduced-motion:reduce){.tempest_panel_N2ujp{animation:none}}
13
+ .tempest_portalled_2V2JB{font-family:var(--tempest-font-sans);font-size:var(--tempest-text-base);z-index:var(--tempest-z-popover)}
@@ -2,6 +2,7 @@
2
2
  .tempest_root_vEMon{display:inline-flex;position:relative}
3
3
  .tempest_popover_E9K9X{z-index:var(--tempest-z-popover);background-color:var(--tempest-bg);color:var(--tempest-text);border:1px solid var(--tempest-border);border-radius:var(--tempest-radius-lg);box-shadow:var(--tempest-shadow-lg);padding:var(--tempest-space-3) var(--tempest-space-4);min-width:200px;max-width:320px;font-family:var(--tempest-font-sans);font-size:var(--tempest-text-base);line-height:var(--tempest-leading-snug);animation:tempest_tempest-popover-in_W8miP var(--tempest-duration-fast) var(--tempest-ease-out);position:absolute}
4
4
  .tempest_popover_E9K9X:focus{outline:none}
5
+ .tempest_portalled_pZ553{--tempest-popover-tx:0}
5
6
  .tempest_top_TYlrh{bottom:calc(100% + 8px);left:50%;transform:translate(-50%)}
6
7
  .tempest_bottom_wGs70{top:calc(100% + 8px);left:50%;transform:translate(-50%)}
7
8
  .tempest_left_h7fCr{top:50%;right:calc(100% + 8px);transform:translateY(-50%)}
@@ -2,17 +2,24 @@
2
2
  .tempest_wrapper_KS2K3{gap:var(--tempest-space-1);flex-direction:column;width:100%;display:flex}
3
3
  .tempest_label_Lmgos{font-size:var(--tempest-text-sm);font-weight:var(--tempest-weight-semibold);color:var(--tempest-text);line-height:var(--tempest-leading-snug)}
4
4
  .tempest_required_PvDVJ{color:var(--tempest-danger);margin-left:2px}
5
- .tempest_field_h-wBy{align-items:center;display:flex;position:relative}
6
- .tempest_select_cjdcr{width:100%;height:var(--tempest-control-height-md);padding:0 36px 0 var(--tempest-control-padding-md);border:1px solid var(--tempest-border);border-radius:var(--tempest-control-radius);background-color:var(--tempest-bg);color:var(--tempest-text);font-family:var(--tempest-font-sans);font-size:var(--tempest-control-font-md);line-height:var(--tempest-leading-snug);appearance:none;cursor:pointer;box-shadow:var(--tempest-shadow-xs);transition:var(--tempest-transition-color), var(--tempest-transition-shadow)}
5
+ .tempest_field_h-wBy{--_tempest-caret-offset:var(--tempest-control-caret-offset,12px);--_tempest-caret-size:var(--tempest-control-caret-size,14px);--_tempest-caret-gap:10px;align-items:center;display:flex;position:relative}
6
+ .tempest_select_cjdcr{width:100%;height:var(--tempest-control-height-md);padding:0 calc(var(--_tempest-caret-offset) + var(--_tempest-caret-size) + var(--_tempest-caret-gap)) 0 var(--tempest-control-padding-md);border:1px solid var(--tempest-border);border-radius:var(--tempest-control-radius);background-color:var(--tempest-bg);color:var(--tempest-text);font-family:var(--tempest-font-sans);font-size:var(--tempest-control-font-md);line-height:var(--tempest-leading-snug);appearance:none;cursor:pointer;box-shadow:var(--tempest-shadow-xs);transition:var(--tempest-transition-color), var(--tempest-transition-shadow)}
7
7
  .tempest_select_cjdcr:hover:not(:disabled):not(:focus){border-color:var(--tempest-border-strong)}
8
8
  .tempest_select_cjdcr:focus{border-color:var(--tempest-primary);box-shadow:0 0 0 var(--tempest-focus-ring-width) var(--tempest-focus-ring-color);outline:none}
9
9
  .tempest_select_cjdcr:disabled{background-color:var(--tempest-surface);cursor:not-allowed;color:var(--tempest-text-muted);box-shadow:none}
10
- .tempest_caret_MdCao{pointer-events:none;color:var(--tempest-text-muted);position:absolute;right:12px}
10
+ .tempest_caret_MdCao{right:var(--_tempest-caret-offset);width:var(--_tempest-caret-size);height:var(--_tempest-caret-size);pointer-events:none;color:var(--tempest-text-muted);justify-content:center;align-items:center;display:flex;position:absolute}
11
+ .tempest_field_h-wBy>.tempest_caret_MdCao>svg{flex:none;width:100%;height:100%;margin:0;display:block}
11
12
  .tempest_error_sw9MU .tempest_select_cjdcr{border-color:var(--tempest-danger)}
12
13
  .tempest_error_sw9MU .tempest_select_cjdcr:focus{box-shadow:0 0 0 var(--tempest-focus-ring-width) color-mix(in srgb, var(--tempest-danger) 25%, transparent)}
13
14
  .tempest_helper_frosK{font-size:var(--tempest-text-xs);color:var(--tempest-text-muted);line-height:var(--tempest-leading-snug)}
14
15
  .tempest_errorText_-zd6i{font-size:var(--tempest-text-xs);color:var(--tempest-danger);line-height:var(--tempest-leading-snug)}
15
16
  .tempest_chipWrapper_5keyI{display:inline-flex}
16
- .tempest_chip_r4NVm{width:auto}
17
- .tempest_chip_r4NVm .tempest_select_cjdcr{width:auto;height:var(--tempest-control-height-sm);padding:0 30px 0 var(--tempest-space-3);border-radius:var(--tempest-radius-full);background-color:var(--tempest-surface);font-size:var(--tempest-text-sm);box-shadow:none}
18
- .tempest_chip_r4NVm .tempest_caret_MdCao{right:10px}
17
+ .tempest_chip_r4NVm{--_tempest-caret-offset:calc(var(--tempest-control-caret-offset,12px) - 2px);--_tempest-caret-gap:6px;width:auto}
18
+ .tempest_chip_r4NVm .tempest_select_cjdcr{width:auto;height:var(--tempest-control-height-sm);padding:0 calc(var(--_tempest-caret-offset) + var(--_tempest-caret-size) + var(--_tempest-caret-gap)) 0 var(--tempest-space-3);border-radius:var(--tempest-radius-full);background-color:var(--tempest-surface);font-size:var(--tempest-text-sm);box-shadow:none}
19
+ .tempest_bare_n9BTx{display:inline-flex}
20
+ .tempest_bare_n9BTx .tempest_select_cjdcr{border-radius:inherit;background-color:inherit;min-width:0;height:auto;color:inherit;font:inherit;letter-spacing:inherit;box-shadow:none;border:0;flex:auto;align-self:stretch;margin:0;padding-block:0;padding-inline-start:0}
21
+ .tempest_bare_n9BTx .tempest_select_cjdcr:focus{box-shadow:none}
22
+ .tempest_bare_n9BTx:focus-within{outline:var(--tempest-focus-ring-width) solid var(--tempest-focus-ring-color);outline-offset:2px}
23
+ .tempest_bare_n9BTx .tempest_select_cjdcr:disabled{background-color:inherit;color:inherit}
24
+ .tempest_bare_n9BTx:has(>.tempest_select_cjdcr:disabled){opacity:.6}
25
+ .tempest_bare_n9BTx .tempest_caret_MdCao{color:inherit}
@@ -5,6 +5,7 @@
5
5
  .tempest_bottom_9Twz4{top:calc(100% + 8px);left:50%;transform:translate(-50%)}
6
6
  .tempest_left_UPdrG{top:50%;right:calc(100% + 8px);transform:translateY(-50%)}
7
7
  .tempest_right_CV--T{top:50%;left:calc(100% + 8px);transform:translateY(-50%)}
8
+ .tempest_portalled_MImIY{bottom:auto;right:auto;transform:none}
8
9
  @keyframes tempest_tempest-tooltip-in_csYeZ{0%{opacity:0;transform:scale(.94) translate(var(--tempest-tx,0), var(--tempest-ty,0))}to{opacity:1}}
9
10
  @media (prefers-reduced-motion:reduce){.tempest_bubble_TPGHB{animation:none}}
10
11
  @media (hover:none){.tempest_bubble_TPGHB{display:none}}
@@ -3,10 +3,10 @@
3
3
  [data-tempest-theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--tempest-primary-50:#0a1730;--tempest-primary-100:#0f2245;--tempest-primary-200:#133066;--tempest-primary-300:#1a4399;--tempest-primary-400:#2563eb;--tempest-primary-500:#3b82f6;--tempest-primary-600:#60a5fa;--tempest-primary-700:#93c5fd;--tempest-primary-800:#bfdbfe;--tempest-primary-900:#dbeafe;--tempest-primary:var(--tempest-primary-500);--tempest-primary-hover:var(--tempest-primary-600);--tempest-primary-active:var(--tempest-primary-700);--tempest-primary-soft:var(--tempest-primary-100);--tempest-primary-soft-hover:var(--tempest-primary-200);--tempest-primary-on-soft:var(--tempest-primary-700);--tempest-bg:#0b0d12;--tempest-surface:#14171f;--tempest-surface-2:#1d2230;--tempest-surface-3:#262d3f;--tempest-border:#2a3142;--tempest-border-strong:#3a4258;--tempest-text:#f1f3f8;--tempest-text-muted:#aab2c0;--tempest-text-subtle:#7b849a;--tempest-primary-foreground:#1f0606;--tempest-text-on-primary:var(--tempest-primary-foreground);--tempest-danger-on-solid:#1f0606;--tempest-info-on-solid:#1f0606;--tempest-success-on-solid:#1f0606;--tempest-warning-on-solid:#1f0606;--tempest-neutral-on-solid:#fff;--tempest-success-fg:#4ade80;--tempest-success-bg:#052e16;--tempest-success-border:#166534;--tempest-success-solid:#22c55e;--tempest-success:#4ade80;--tempest-warning-fg:#fbbf24;--tempest-warning-bg:#2c1c05;--tempest-warning-border:#78350f;--tempest-warning-solid:#f59e0b;--tempest-warning:#fbbf24;--tempest-danger-fg:#f87171;--tempest-danger-bg:#2c0a0a;--tempest-danger-border:#7f1d1d;--tempest-danger-solid:#ef4444;--tempest-danger:#f87171;--tempest-danger-hover:#f87171;--tempest-info-fg:#60a5fa;--tempest-info-bg:#0a1730;--tempest-info-border:#1e3a8a;--tempest-info-solid:#3b82f6;--tempest-info:#60a5fa;--tempest-focus-ring-color:#60a5fa;--tempest-selected-indicator:#60a5fa;--tempest-shadow-xs:0 1px 2px #0000004d;--tempest-shadow-sm:0 1px 3px #0006, 0 1px 2px #0003;--tempest-shadow-md:0 4px 12px #0006, 0 2px 4px #0003;--tempest-shadow-lg:0 12px 32px #00000080, 0 4px 8px #0000004d;--tempest-shadow-xl:0 24px 48px #0009, 0 8px 16px #0000004d;--tempest-chart-1:#60a5fa;--tempest-chart-2:#4ade80;--tempest-chart-3:#fbbf24;--tempest-chart-4:#a78bfa;--tempest-chart-5:#f472b6;--tempest-chart-6:#22d3ee;--tempest-chart-7:#fb923c;--tempest-chart-8:#2dd4bf;--tempest-chart-sequential-1:#172849;--tempest-chart-sequential-2:#1b3c83;--tempest-chart-sequential-3:#2453b9;--tempest-chart-sequential-4:#376fe5;--tempest-chart-sequential-5:#5b90fb;--tempest-chart-sequential-6:#8cb2fa;--tempest-chart-sequential-7:#bad2fe;--tempest-chart-diverging-1:#1543a8;--tempest-chart-diverging-2:#416eca;--tempest-chart-diverging-3:#7599e0;--tempest-chart-diverging-4:#b0c5ec;--tempest-chart-diverging-5:#262d3f;--tempest-chart-diverging-6:#e8b6af;--tempest-chart-diverging-7:#d77e74;--tempest-chart-diverging-8:#ba473f;--tempest-chart-diverging-9:#94020c;--tempest-chart-grid:var(--tempest-gray-300);--tempest-chart-axis:var(--tempest-gray-600);--tempest-code-comment:#838b93;--tempest-code-punctuation:#818b95;--tempest-code-string:#589866;--tempest-code-number:#c57558;--tempest-code-keyword:#8580d8;--tempest-code-literal:#c87172;--tempest-code-function:#2893c6;--tempest-code-tag:#c07197;--tempest-code-attribute:#349897;--tempest-code-property:#349897}
4
4
  :root{--tempest-text-2xs:10px;--tempest-text-xs:12px;--tempest-text-sm:13px;--tempest-text-base:14px;--tempest-text-md:15px;--tempest-text-lg:16px;--tempest-text-xl:18px;--tempest-text-2xl:20px;--tempest-text-3xl:24px;--tempest-text-4xl:30px;--tempest-text-5xl:36px;--tempest-text-6xl:48px;--tempest-leading-none:1;--tempest-leading-tight:1.2;--tempest-leading-snug:1.35;--tempest-leading-normal:1.5;--tempest-leading-relaxed:1.65;--tempest-leading-loose:1.9;--tempest-weight-regular:400;--tempest-weight-medium:500;--tempest-weight-semibold:600;--tempest-weight-bold:700;--tempest-weight-extrabold:800;--tempest-tracking-tight:-.02em;--tempest-tracking-normal:0;--tempest-tracking-wide:.025em;--tempest-tracking-wider:.05em;--tempest-tracking-widest:.1em;--tempest-text-fluid-sm:clamp(13px, 12px + .2vw, 15px);--tempest-text-fluid-base:clamp(14px, 13px + .3vw, 16px);--tempest-text-fluid-lg:clamp(16px, 14px + .5vw, 20px);--tempest-text-fluid-xl:clamp(18px, 15px + .8vw, 24px);--tempest-text-fluid-2xl:clamp(20px, 16px + 1.2vw, 30px);--tempest-text-fluid-3xl:clamp(24px, 18px + 2vw, 40px);--tempest-text-fluid-4xl:clamp(28px, 20px + 3vw, 56px);--tempest-text-fluid-5xl:clamp(32px, 24px + 4vw, 72px);--tempest-text-fluid-6xl:clamp(40px, 28px + 5vw, 96px);--tempest-duration-instant:0s;--tempest-duration-fast:.12s;--tempest-duration-base:.18s;--tempest-duration-slow:.28s;--tempest-duration-slower:.42s;--tempest-ease-linear:linear;--tempest-ease-in:cubic-bezier(.4, 0, 1, 1);--tempest-ease-out:cubic-bezier(0, 0, .2, 1);--tempest-ease-in-out:cubic-bezier(.4, 0, .2, 1);--tempest-ease-emphasized:cubic-bezier(.2, 0, 0, 1);--tempest-ease-bounce:cubic-bezier(.34, 1.56, .64, 1);--tempest-transition-color:color var(--tempest-duration-fast) var(--tempest-ease-out), background-color var(--tempest-duration-fast) var(--tempest-ease-out), border-color var(--tempest-duration-fast) var(--tempest-ease-out);--tempest-transition-shadow:box-shadow var(--tempest-duration-base) var(--tempest-ease-out);--tempest-transition-transform:transform var(--tempest-duration-fast) var(--tempest-ease-out);--tempest-transition-base:color var(--tempest-duration-fast) var(--tempest-ease-out), background-color var(--tempest-duration-fast) var(--tempest-ease-out), border-color var(--tempest-duration-fast) var(--tempest-ease-out), box-shadow var(--tempest-duration-base) var(--tempest-ease-out), transform var(--tempest-duration-fast) var(--tempest-ease-out), opacity var(--tempest-duration-fast) var(--tempest-ease-out)}
5
5
  @media (prefers-reduced-motion:reduce){:root{--tempest-duration-fast:.01ms;--tempest-duration-base:.01ms;--tempest-duration-slow:.01ms;--tempest-duration-slower:.01ms}}
6
- :root,[data-tempest-density=comfortable]{--tempest-control-height-xs:24px;--tempest-control-height-sm:32px;--tempest-control-height-md:40px;--tempest-control-height-lg:48px;--tempest-control-height-xl:56px;--tempest-control-padding-xs:var(--tempest-space-2);--tempest-control-padding-sm:var(--tempest-space-3);--tempest-control-padding-md:var(--tempest-space-4);--tempest-control-padding-lg:var(--tempest-space-5);--tempest-control-padding-xl:var(--tempest-space-6);--tempest-control-font-xs:var(--tempest-text-xs);--tempest-control-font-sm:var(--tempest-text-sm);--tempest-control-font-md:var(--tempest-text-base);--tempest-control-font-lg:var(--tempest-text-lg);--tempest-control-font-xl:var(--tempest-text-xl);--tempest-control-radius:var(--tempest-radius-md);--tempest-control-gap:var(--tempest-space-2)}
7
- [data-tempest-density=compact]{--tempest-control-height-xs:20px;--tempest-control-height-sm:28px;--tempest-control-height-md:34px;--tempest-control-height-lg:40px;--tempest-control-height-xl:48px;--tempest-control-padding-xs:var(--tempest-space-1);--tempest-control-padding-sm:var(--tempest-space-2);--tempest-control-padding-md:var(--tempest-space-3);--tempest-control-padding-lg:var(--tempest-space-4);--tempest-control-padding-xl:var(--tempest-space-5);--tempest-control-font-xs:var(--tempest-text-2xs);--tempest-control-font-sm:var(--tempest-text-xs);--tempest-control-font-md:var(--tempest-text-sm);--tempest-control-font-lg:var(--tempest-text-base);--tempest-control-font-xl:var(--tempest-text-md);--tempest-control-radius:var(--tempest-radius-sm);--tempest-control-gap:var(--tempest-space-1)}
8
- [data-tempest-density=touch]{--tempest-control-height-xs:32px;--tempest-control-height-sm:40px;--tempest-control-height-md:44px;--tempest-control-height-lg:52px;--tempest-control-height-xl:60px;--tempest-control-padding-xs:var(--tempest-space-2);--tempest-control-padding-sm:var(--tempest-space-3);--tempest-control-padding-md:var(--tempest-space-4);--tempest-control-padding-lg:var(--tempest-space-5);--tempest-control-padding-xl:var(--tempest-space-6);--tempest-control-font-xs:var(--tempest-text-xs);--tempest-control-font-sm:var(--tempest-text-sm);--tempest-control-font-md:var(--tempest-text-base);--tempest-control-font-lg:var(--tempest-text-lg);--tempest-control-font-xl:var(--tempest-text-xl);--tempest-control-radius:var(--tempest-radius-md);--tempest-control-gap:var(--tempest-space-2)}
9
- [data-tempest-density=spacious]{--tempest-control-height-xs:28px;--tempest-control-height-sm:36px;--tempest-control-height-md:44px;--tempest-control-height-lg:52px;--tempest-control-height-xl:64px;--tempest-control-padding-xs:var(--tempest-space-3);--tempest-control-padding-sm:var(--tempest-space-4);--tempest-control-padding-md:var(--tempest-space-5);--tempest-control-padding-lg:var(--tempest-space-6);--tempest-control-padding-xl:var(--tempest-space-7);--tempest-control-font-xs:var(--tempest-text-xs);--tempest-control-font-sm:var(--tempest-text-base);--tempest-control-font-md:var(--tempest-text-md);--tempest-control-font-lg:var(--tempest-text-xl);--tempest-control-font-xl:var(--tempest-text-2xl);--tempest-control-radius:var(--tempest-radius-lg);--tempest-control-gap:var(--tempest-space-3)}
6
+ :root,[data-tempest-density=comfortable]{--tempest-control-height-xs:24px;--tempest-control-height-sm:32px;--tempest-control-height-md:40px;--tempest-control-height-lg:48px;--tempest-control-height-xl:56px;--tempest-control-padding-xs:var(--tempest-space-2);--tempest-control-padding-sm:var(--tempest-space-3);--tempest-control-padding-md:var(--tempest-space-4);--tempest-control-padding-lg:var(--tempest-space-5);--tempest-control-padding-xl:var(--tempest-space-6);--tempest-control-font-xs:var(--tempest-text-xs);--tempest-control-font-sm:var(--tempest-text-sm);--tempest-control-font-md:var(--tempest-text-base);--tempest-control-font-lg:var(--tempest-text-lg);--tempest-control-font-xl:var(--tempest-text-xl);--tempest-control-radius:var(--tempest-radius-md);--tempest-control-gap:var(--tempest-space-2);--tempest-control-caret-offset:12px;--tempest-control-caret-size:14px}
7
+ [data-tempest-density=compact]{--tempest-control-height-xs:20px;--tempest-control-height-sm:28px;--tempest-control-height-md:34px;--tempest-control-height-lg:40px;--tempest-control-height-xl:48px;--tempest-control-padding-xs:var(--tempest-space-1);--tempest-control-padding-sm:var(--tempest-space-2);--tempest-control-padding-md:var(--tempest-space-3);--tempest-control-padding-lg:var(--tempest-space-4);--tempest-control-padding-xl:var(--tempest-space-5);--tempest-control-font-xs:var(--tempest-text-2xs);--tempest-control-font-sm:var(--tempest-text-xs);--tempest-control-font-md:var(--tempest-text-sm);--tempest-control-font-lg:var(--tempest-text-base);--tempest-control-font-xl:var(--tempest-text-md);--tempest-control-radius:var(--tempest-radius-sm);--tempest-control-gap:var(--tempest-space-1);--tempest-control-caret-offset:10px;--tempest-control-caret-size:12px}
8
+ [data-tempest-density=touch]{--tempest-control-height-xs:32px;--tempest-control-height-sm:40px;--tempest-control-height-md:44px;--tempest-control-height-lg:52px;--tempest-control-height-xl:60px;--tempest-control-padding-xs:var(--tempest-space-2);--tempest-control-padding-sm:var(--tempest-space-3);--tempest-control-padding-md:var(--tempest-space-4);--tempest-control-padding-lg:var(--tempest-space-5);--tempest-control-padding-xl:var(--tempest-space-6);--tempest-control-font-xs:var(--tempest-text-xs);--tempest-control-font-sm:var(--tempest-text-sm);--tempest-control-font-md:var(--tempest-text-base);--tempest-control-font-lg:var(--tempest-text-lg);--tempest-control-font-xl:var(--tempest-text-xl);--tempest-control-radius:var(--tempest-radius-md);--tempest-control-gap:var(--tempest-space-2);--tempest-control-caret-offset:12px;--tempest-control-caret-size:16px}
9
+ [data-tempest-density=spacious]{--tempest-control-height-xs:28px;--tempest-control-height-sm:36px;--tempest-control-height-md:44px;--tempest-control-height-lg:52px;--tempest-control-height-xl:64px;--tempest-control-padding-xs:var(--tempest-space-3);--tempest-control-padding-sm:var(--tempest-space-4);--tempest-control-padding-md:var(--tempest-space-5);--tempest-control-padding-lg:var(--tempest-space-6);--tempest-control-padding-xl:var(--tempest-space-7);--tempest-control-font-xs:var(--tempest-text-xs);--tempest-control-font-sm:var(--tempest-text-base);--tempest-control-font-md:var(--tempest-text-md);--tempest-control-font-lg:var(--tempest-text-xl);--tempest-control-font-xl:var(--tempest-text-2xl);--tempest-control-radius:var(--tempest-radius-lg);--tempest-control-gap:var(--tempest-space-3);--tempest-control-caret-offset:14px;--tempest-control-caret-size:16px}
10
10
  @media (pointer:coarse){:root:not([data-tempest-density=compact]){--tempest-control-height-xs:32px;--tempest-control-height-sm:40px;--tempest-control-height-md:44px}}
11
11
  *,:before,:after{box-sizing:border-box}
12
12
  html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;tab-size:4}
@@ -55,6 +55,10 @@
55
55
  .tempest_secondary_2wMQS:disabled{color:var(--tempest-text-subtle);cursor:not-allowed}
56
56
  .tempest_ghost_tDjte{color:var(--tempest-text-muted);background:0 0;border:none;text-decoration:underline}
57
57
  .tempest_primary_zW1qN:focus-visible,.tempest_secondary_2wMQS:focus-visible,.tempest_ghost_tDjte:focus-visible,.tempest_remove_FmPaZ:focus-visible{outline:2px solid var(--tempest-primary);outline-offset:1px}
58
+ .tempest_panel_ab2ba{min-width:0}
59
+ .tempest_actions_9a-Sm{justify-content:flex-end;align-items:center;gap:var(--tempest-space-2);flex-wrap:wrap;margin-left:auto;display:flex}
60
+ .tempest_form_bMDhN{margin:0}
61
+ .tempest_fields_M30-g{align-items:start}
58
62
  .tempest_board_4Ucop{align-items:flex-start;gap:var(--tempest-space-4);overscroll-behavior-x:contain;padding-bottom:var(--tempest-space-2);display:flex;overflow-x:auto}
59
63
  .tempest_column_-FohZ{gap:var(--tempest-space-3);flex-direction:column;flex:0 0 var(--tempest-kanban-column-width,260px);min-width:0;padding:var(--tempest-space-3);background-color:var(--tempest-surface);border:1px solid var(--tempest-border);border-radius:var(--tempest-radius-lg);transition:background-color var(--tempest-duration-fast) var(--tempest-ease-out), border-color var(--tempest-duration-fast) var(--tempest-ease-out);display:flex}
60
64
  .tempest_columnActive_TJPM9{border-color:var(--tempest-primary);background-color:var(--tempest-primary-soft)}