@inventreedb/ui 0.11.1 → 0.11.3

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 (55) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/.vite/manifest.json +86 -0
  3. package/dist/components/Boundary.js +16 -7
  4. package/dist/components/Boundary.js.map +1 -1
  5. package/dist/components/StylishText.d.ts +6 -0
  6. package/dist/components/StylishText.js +36 -0
  7. package/dist/components/StylishText.js.map +1 -0
  8. package/dist/components/nav/DetailDrawer.css.d.ts +1 -0
  9. package/dist/components/nav/DetailDrawer.css.js +6 -0
  10. package/dist/components/nav/DetailDrawer.css.js.map +1 -0
  11. package/dist/components/nav/DetailDrawer.d.ts +21 -0
  12. package/dist/components/nav/DetailDrawer.js +65 -0
  13. package/dist/components/nav/DetailDrawer.js.map +1 -0
  14. package/dist/enums/ApiEndpoints.d.ts +1 -0
  15. package/dist/enums/ApiEndpoints.js +1 -0
  16. package/dist/enums/ApiEndpoints.js.map +1 -1
  17. package/dist/enums/ModelType.d.ts +9 -0
  18. package/dist/enums/ModelType.js.map +1 -1
  19. package/dist/enums/Roles.d.ts +1 -0
  20. package/dist/enums/Roles.js +1 -0
  21. package/dist/enums/Roles.js.map +1 -1
  22. package/dist/index.d.ts +4 -1
  23. package/dist/index.js +5 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/node_modules/@remix-run/router/dist/router.js +448 -0
  26. package/dist/node_modules/@remix-run/router/dist/router.js.map +1 -0
  27. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +8 -0
  28. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js.map +1 -0
  29. package/dist/node_modules/react-router/dist/index.js +704 -0
  30. package/dist/node_modules/react-router/dist/index.js.map +1 -0
  31. package/dist/node_modules/react-router-dom/dist/index.js +526 -0
  32. package/dist/node_modules/react-router-dom/dist/index.js.map +1 -0
  33. package/dist/node_modules/zustand/esm/react/shallow.js +13 -0
  34. package/dist/node_modules/zustand/esm/react/shallow.js.map +1 -0
  35. package/dist/node_modules/zustand/esm/vanilla/shallow.js +57 -0
  36. package/dist/node_modules/zustand/esm/vanilla/shallow.js.map +1 -0
  37. package/dist/states/LocalLibState.d.ts +17 -0
  38. package/dist/states/LocalLibState.js +16 -0
  39. package/dist/states/LocalLibState.js.map +1 -0
  40. package/dist/types/Forms.d.ts +11 -6
  41. package/dist/types/Plugins.js +1 -1
  42. package/dist/types/Tables.d.ts +6 -0
  43. package/dist/ui.css +4 -0
  44. package/lib/components/Boundary.tsx +6 -3
  45. package/lib/components/StylishText.tsx +46 -0
  46. package/lib/components/nav/DetailDrawer.css.ts +6 -0
  47. package/lib/components/nav/DetailDrawer.tsx +108 -0
  48. package/lib/enums/ApiEndpoints.tsx +1 -0
  49. package/lib/enums/ModelType.tsx +13 -0
  50. package/lib/enums/Roles.tsx +1 -0
  51. package/lib/index.ts +15 -0
  52. package/lib/states/LocalLibState.tsx +23 -0
  53. package/lib/types/Forms.tsx +11 -6
  54. package/lib/types/Tables.tsx +8 -0
  55. package/package.json +4 -2
@@ -0,0 +1,526 @@
1
+ import { UNSAFE_NavigationContext as NavigationContext, useHref, useNavigate, useLocation, useResolvedPath, UNSAFE_DataRouterStateContext as DataRouterStateContext, UNSAFE_useRouteId as useRouteId, UNSAFE_RouteContext as RouteContext, UNSAFE_DataRouterContext as DataRouterContext } from "../../react-router/dist/index.js";
2
+ import { Route, Routes, UNSAFE_LocationContext, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromChildren2, useInRouterContext, useParams, useRouteError, useRoutes } from "../../react-router/dist/index.js";
3
+ import { stripBasename, UNSAFE_warning as warning, createPath, UNSAFE_invariant as invariant, matchPath, joinPaths } from "../../@remix-run/router/dist/router.js";
4
+ import { AbortedDeferredError, Action, isRouteErrorResponse, matchRoutes, parsePath, resolvePath } from "../../@remix-run/router/dist/router.js";
5
+ const React = window["React"];
6
+ const ReactDOM = window["ReactDOM"];
7
+ function _extends() {
8
+ _extends = Object.assign ? Object.assign.bind() : function(target) {
9
+ for (var i = 1; i < arguments.length; i++) {
10
+ var source = arguments[i];
11
+ for (var key in source) {
12
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
13
+ target[key] = source[key];
14
+ }
15
+ }
16
+ }
17
+ return target;
18
+ };
19
+ return _extends.apply(this, arguments);
20
+ }
21
+ function _objectWithoutPropertiesLoose(source, excluded) {
22
+ if (source == null) return {};
23
+ var target = {};
24
+ var sourceKeys = Object.keys(source);
25
+ var key, i;
26
+ for (i = 0; i < sourceKeys.length; i++) {
27
+ key = sourceKeys[i];
28
+ if (excluded.indexOf(key) >= 0) continue;
29
+ target[key] = source[key];
30
+ }
31
+ return target;
32
+ }
33
+ const defaultMethod = "get";
34
+ const defaultEncType = "application/x-www-form-urlencoded";
35
+ function isHtmlElement(object) {
36
+ return object != null && typeof object.tagName === "string";
37
+ }
38
+ function isButtonElement(object) {
39
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
40
+ }
41
+ function isFormElement(object) {
42
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
43
+ }
44
+ function isInputElement(object) {
45
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
46
+ }
47
+ function isModifiedEvent(event) {
48
+ return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
49
+ }
50
+ function shouldProcessLinkClick(event, target) {
51
+ return event.button === 0 && // Ignore everything but left clicks
52
+ (!target || target === "_self") && // Let browser handle "target=_blank" etc.
53
+ !isModifiedEvent(event);
54
+ }
55
+ let _formDataSupportsSubmitter = null;
56
+ function isFormDataSubmitterSupported() {
57
+ if (_formDataSupportsSubmitter === null) {
58
+ try {
59
+ new FormData(
60
+ document.createElement("form"),
61
+ // @ts-expect-error if FormData supports the submitter parameter, this will throw
62
+ 0
63
+ );
64
+ _formDataSupportsSubmitter = false;
65
+ } catch (e) {
66
+ _formDataSupportsSubmitter = true;
67
+ }
68
+ }
69
+ return _formDataSupportsSubmitter;
70
+ }
71
+ const supportedFormEncTypes = /* @__PURE__ */ new Set(["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"]);
72
+ function getFormEncType(encType) {
73
+ if (encType != null && !supportedFormEncTypes.has(encType)) {
74
+ process.env.NODE_ENV !== "production" ? warning(false, '"' + encType + '" is not a valid `encType` for `<Form>`/`<fetcher.Form>` ' + ('and will default to "' + defaultEncType + '"')) : void 0;
75
+ return null;
76
+ }
77
+ return encType;
78
+ }
79
+ function getFormSubmissionInfo(target, basename) {
80
+ let method;
81
+ let action;
82
+ let encType;
83
+ let formData;
84
+ let body;
85
+ if (isFormElement(target)) {
86
+ let attr = target.getAttribute("action");
87
+ action = attr ? stripBasename(attr, basename) : null;
88
+ method = target.getAttribute("method") || defaultMethod;
89
+ encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
90
+ formData = new FormData(target);
91
+ } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
92
+ let form = target.form;
93
+ if (form == null) {
94
+ throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');
95
+ }
96
+ let attr = target.getAttribute("formaction") || form.getAttribute("action");
97
+ action = attr ? stripBasename(attr, basename) : null;
98
+ method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
99
+ encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
100
+ formData = new FormData(form, target);
101
+ if (!isFormDataSubmitterSupported()) {
102
+ let {
103
+ name,
104
+ type,
105
+ value
106
+ } = target;
107
+ if (type === "image") {
108
+ let prefix = name ? name + "." : "";
109
+ formData.append(prefix + "x", "0");
110
+ formData.append(prefix + "y", "0");
111
+ } else if (name) {
112
+ formData.append(name, value);
113
+ }
114
+ }
115
+ } else if (isHtmlElement(target)) {
116
+ throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');
117
+ } else {
118
+ method = defaultMethod;
119
+ action = null;
120
+ encType = defaultEncType;
121
+ body = target;
122
+ }
123
+ if (formData && encType === "text/plain") {
124
+ body = formData;
125
+ formData = void 0;
126
+ }
127
+ return {
128
+ action,
129
+ method: method.toLowerCase(),
130
+ encType,
131
+ formData,
132
+ body
133
+ };
134
+ }
135
+ const _excluded = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset", "viewTransition"], _excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "viewTransition", "children"], _excluded3 = ["fetcherKey", "navigate", "reloadDocument", "replace", "state", "method", "action", "onSubmit", "relative", "preventScrollReset", "viewTransition"];
136
+ const REACT_ROUTER_VERSION = "6";
137
+ try {
138
+ window.__reactRouterVersion = REACT_ROUTER_VERSION;
139
+ } catch (e) {
140
+ }
141
+ const ViewTransitionContext = /* @__PURE__ */ React.createContext({
142
+ isTransitioning: false
143
+ });
144
+ if (process.env.NODE_ENV !== "production") {
145
+ ViewTransitionContext.displayName = "ViewTransition";
146
+ }
147
+ const FetchersContext = /* @__PURE__ */ React.createContext(/* @__PURE__ */ new Map());
148
+ if (process.env.NODE_ENV !== "production") {
149
+ FetchersContext.displayName = "Fetchers";
150
+ }
151
+ const START_TRANSITION = "startTransition";
152
+ React[START_TRANSITION];
153
+ const FLUSH_SYNC = "flushSync";
154
+ ReactDOM[FLUSH_SYNC];
155
+ const USE_ID = "useId";
156
+ React[USE_ID];
157
+ if (process.env.NODE_ENV !== "production") ;
158
+ const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
159
+ const ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
160
+ const Link = /* @__PURE__ */ React.forwardRef(function LinkWithRef(_ref7, ref) {
161
+ let {
162
+ onClick,
163
+ relative,
164
+ reloadDocument,
165
+ replace,
166
+ state,
167
+ target,
168
+ to,
169
+ preventScrollReset,
170
+ viewTransition
171
+ } = _ref7, rest = _objectWithoutPropertiesLoose(_ref7, _excluded);
172
+ let {
173
+ basename
174
+ } = React.useContext(NavigationContext);
175
+ let absoluteHref;
176
+ let isExternal = false;
177
+ if (typeof to === "string" && ABSOLUTE_URL_REGEX.test(to)) {
178
+ absoluteHref = to;
179
+ if (isBrowser) {
180
+ try {
181
+ let currentUrl = new URL(window.location.href);
182
+ let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
183
+ let path = stripBasename(targetUrl.pathname, basename);
184
+ if (targetUrl.origin === currentUrl.origin && path != null) {
185
+ to = path + targetUrl.search + targetUrl.hash;
186
+ } else {
187
+ isExternal = true;
188
+ }
189
+ } catch (e) {
190
+ process.env.NODE_ENV !== "production" ? warning(false, '<Link to="' + to + '"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.') : void 0;
191
+ }
192
+ }
193
+ }
194
+ let href = useHref(to, {
195
+ relative
196
+ });
197
+ let internalOnClick = useLinkClickHandler(to, {
198
+ replace,
199
+ state,
200
+ target,
201
+ preventScrollReset,
202
+ relative,
203
+ viewTransition
204
+ });
205
+ function handleClick(event) {
206
+ if (onClick) onClick(event);
207
+ if (!event.defaultPrevented) {
208
+ internalOnClick(event);
209
+ }
210
+ }
211
+ return (
212
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
213
+ /* @__PURE__ */ React.createElement("a", _extends({}, rest, {
214
+ href: absoluteHref || href,
215
+ onClick: isExternal || reloadDocument ? onClick : handleClick,
216
+ ref,
217
+ target
218
+ }))
219
+ );
220
+ });
221
+ if (process.env.NODE_ENV !== "production") {
222
+ Link.displayName = "Link";
223
+ }
224
+ const NavLink = /* @__PURE__ */ React.forwardRef(function NavLinkWithRef(_ref8, ref) {
225
+ let {
226
+ "aria-current": ariaCurrentProp = "page",
227
+ caseSensitive = false,
228
+ className: classNameProp = "",
229
+ end = false,
230
+ style: styleProp,
231
+ to,
232
+ viewTransition,
233
+ children
234
+ } = _ref8, rest = _objectWithoutPropertiesLoose(_ref8, _excluded2);
235
+ let path = useResolvedPath(to, {
236
+ relative: rest.relative
237
+ });
238
+ let location = useLocation();
239
+ let routerState = React.useContext(DataRouterStateContext);
240
+ let {
241
+ navigator,
242
+ basename
243
+ } = React.useContext(NavigationContext);
244
+ let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
245
+ // eslint-disable-next-line react-hooks/rules-of-hooks
246
+ useViewTransitionState(path) && viewTransition === true;
247
+ let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
248
+ let locationPathname = location.pathname;
249
+ let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
250
+ if (!caseSensitive) {
251
+ locationPathname = locationPathname.toLowerCase();
252
+ nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
253
+ toPathname = toPathname.toLowerCase();
254
+ }
255
+ if (nextLocationPathname && basename) {
256
+ nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
257
+ }
258
+ const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
259
+ let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
260
+ let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
261
+ let renderProps = {
262
+ isActive,
263
+ isPending,
264
+ isTransitioning
265
+ };
266
+ let ariaCurrent = isActive ? ariaCurrentProp : void 0;
267
+ let className;
268
+ if (typeof classNameProp === "function") {
269
+ className = classNameProp(renderProps);
270
+ } else {
271
+ className = [classNameProp, isActive ? "active" : null, isPending ? "pending" : null, isTransitioning ? "transitioning" : null].filter(Boolean).join(" ");
272
+ }
273
+ let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
274
+ return /* @__PURE__ */ React.createElement(Link, _extends({}, rest, {
275
+ "aria-current": ariaCurrent,
276
+ className,
277
+ ref,
278
+ style,
279
+ to,
280
+ viewTransition
281
+ }), typeof children === "function" ? children(renderProps) : children);
282
+ });
283
+ if (process.env.NODE_ENV !== "production") {
284
+ NavLink.displayName = "NavLink";
285
+ }
286
+ const Form = /* @__PURE__ */ React.forwardRef((_ref9, forwardedRef) => {
287
+ let {
288
+ fetcherKey,
289
+ navigate,
290
+ reloadDocument,
291
+ replace,
292
+ state,
293
+ method = defaultMethod,
294
+ action,
295
+ onSubmit,
296
+ relative,
297
+ preventScrollReset,
298
+ viewTransition
299
+ } = _ref9, props = _objectWithoutPropertiesLoose(_ref9, _excluded3);
300
+ let submit = useSubmit();
301
+ let formAction = useFormAction(action, {
302
+ relative
303
+ });
304
+ let formMethod = method.toLowerCase() === "get" ? "get" : "post";
305
+ let submitHandler = (event) => {
306
+ onSubmit && onSubmit(event);
307
+ if (event.defaultPrevented) return;
308
+ event.preventDefault();
309
+ let submitter = event.nativeEvent.submitter;
310
+ let submitMethod = (submitter == null ? void 0 : submitter.getAttribute("formmethod")) || method;
311
+ submit(submitter || event.currentTarget, {
312
+ fetcherKey,
313
+ method: submitMethod,
314
+ navigate,
315
+ replace,
316
+ state,
317
+ relative,
318
+ preventScrollReset,
319
+ viewTransition
320
+ });
321
+ };
322
+ return /* @__PURE__ */ React.createElement("form", _extends({
323
+ ref: forwardedRef,
324
+ method: formMethod,
325
+ action: formAction,
326
+ onSubmit: reloadDocument ? onSubmit : submitHandler
327
+ }, props));
328
+ });
329
+ if (process.env.NODE_ENV !== "production") {
330
+ Form.displayName = "Form";
331
+ }
332
+ if (process.env.NODE_ENV !== "production") ;
333
+ var DataRouterHook;
334
+ (function(DataRouterHook2) {
335
+ DataRouterHook2["UseScrollRestoration"] = "useScrollRestoration";
336
+ DataRouterHook2["UseSubmit"] = "useSubmit";
337
+ DataRouterHook2["UseSubmitFetcher"] = "useSubmitFetcher";
338
+ DataRouterHook2["UseFetcher"] = "useFetcher";
339
+ DataRouterHook2["useViewTransitionState"] = "useViewTransitionState";
340
+ })(DataRouterHook || (DataRouterHook = {}));
341
+ var DataRouterStateHook;
342
+ (function(DataRouterStateHook2) {
343
+ DataRouterStateHook2["UseFetcher"] = "useFetcher";
344
+ DataRouterStateHook2["UseFetchers"] = "useFetchers";
345
+ DataRouterStateHook2["UseScrollRestoration"] = "useScrollRestoration";
346
+ })(DataRouterStateHook || (DataRouterStateHook = {}));
347
+ function getDataRouterConsoleError(hookName) {
348
+ return hookName + " must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.";
349
+ }
350
+ function useDataRouterContext(hookName) {
351
+ let ctx = React.useContext(DataRouterContext);
352
+ !ctx ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
353
+ return ctx;
354
+ }
355
+ function useLinkClickHandler(to, _temp) {
356
+ let {
357
+ target,
358
+ replace: replaceProp,
359
+ state,
360
+ preventScrollReset,
361
+ relative,
362
+ viewTransition
363
+ } = _temp === void 0 ? {} : _temp;
364
+ let navigate = useNavigate();
365
+ let location = useLocation();
366
+ let path = useResolvedPath(to, {
367
+ relative
368
+ });
369
+ return React.useCallback((event) => {
370
+ if (shouldProcessLinkClick(event, target)) {
371
+ event.preventDefault();
372
+ let replace = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
373
+ navigate(to, {
374
+ replace,
375
+ state,
376
+ preventScrollReset,
377
+ relative,
378
+ viewTransition
379
+ });
380
+ }
381
+ }, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative, viewTransition]);
382
+ }
383
+ function validateClientSideSubmission() {
384
+ if (typeof document === "undefined") {
385
+ throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");
386
+ }
387
+ }
388
+ let fetcherId = 0;
389
+ let getUniqueFetcherId = () => "__" + String(++fetcherId) + "__";
390
+ function useSubmit() {
391
+ let {
392
+ router
393
+ } = useDataRouterContext(DataRouterHook.UseSubmit);
394
+ let {
395
+ basename
396
+ } = React.useContext(NavigationContext);
397
+ let currentRouteId = useRouteId();
398
+ return React.useCallback(function(target, options) {
399
+ if (options === void 0) {
400
+ options = {};
401
+ }
402
+ validateClientSideSubmission();
403
+ let {
404
+ action,
405
+ method,
406
+ encType,
407
+ formData,
408
+ body
409
+ } = getFormSubmissionInfo(target, basename);
410
+ if (options.navigate === false) {
411
+ let key = options.fetcherKey || getUniqueFetcherId();
412
+ router.fetch(key, currentRouteId, options.action || action, {
413
+ preventScrollReset: options.preventScrollReset,
414
+ formData,
415
+ body,
416
+ formMethod: options.method || method,
417
+ formEncType: options.encType || encType,
418
+ flushSync: options.flushSync
419
+ });
420
+ } else {
421
+ router.navigate(options.action || action, {
422
+ preventScrollReset: options.preventScrollReset,
423
+ formData,
424
+ body,
425
+ formMethod: options.method || method,
426
+ formEncType: options.encType || encType,
427
+ replace: options.replace,
428
+ state: options.state,
429
+ fromRouteId: currentRouteId,
430
+ flushSync: options.flushSync,
431
+ viewTransition: options.viewTransition
432
+ });
433
+ }
434
+ }, [router, basename, currentRouteId]);
435
+ }
436
+ function useFormAction(action, _temp2) {
437
+ let {
438
+ relative
439
+ } = _temp2 === void 0 ? {} : _temp2;
440
+ let {
441
+ basename
442
+ } = React.useContext(NavigationContext);
443
+ let routeContext = React.useContext(RouteContext);
444
+ !routeContext ? process.env.NODE_ENV !== "production" ? invariant(false, "useFormAction must be used inside a RouteContext") : invariant(false) : void 0;
445
+ let [match] = routeContext.matches.slice(-1);
446
+ let path = _extends({}, useResolvedPath(action ? action : ".", {
447
+ relative
448
+ }));
449
+ let location = useLocation();
450
+ if (action == null) {
451
+ path.search = location.search;
452
+ let params = new URLSearchParams(path.search);
453
+ let indexValues = params.getAll("index");
454
+ let hasNakedIndexParam = indexValues.some((v) => v === "");
455
+ if (hasNakedIndexParam) {
456
+ params.delete("index");
457
+ indexValues.filter((v) => v).forEach((v) => params.append("index", v));
458
+ let qs = params.toString();
459
+ path.search = qs ? "?" + qs : "";
460
+ }
461
+ }
462
+ if ((!action || action === ".") && match.route.index) {
463
+ path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
464
+ }
465
+ if (basename !== "/") {
466
+ path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
467
+ }
468
+ return createPath(path);
469
+ }
470
+ function useViewTransitionState(to, opts) {
471
+ if (opts === void 0) {
472
+ opts = {};
473
+ }
474
+ let vtContext = React.useContext(ViewTransitionContext);
475
+ !(vtContext != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?") : invariant(false) : void 0;
476
+ let {
477
+ basename
478
+ } = useDataRouterContext(DataRouterHook.useViewTransitionState);
479
+ let path = useResolvedPath(to, {
480
+ relative: opts.relative
481
+ });
482
+ if (!vtContext.isTransitioning) {
483
+ return false;
484
+ }
485
+ let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
486
+ let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
487
+ return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
488
+ }
489
+ export {
490
+ AbortedDeferredError,
491
+ Form,
492
+ Link,
493
+ NavLink,
494
+ Action as NavigationType,
495
+ Route,
496
+ Routes,
497
+ DataRouterContext as UNSAFE_DataRouterContext,
498
+ DataRouterStateContext as UNSAFE_DataRouterStateContext,
499
+ FetchersContext as UNSAFE_FetchersContext,
500
+ UNSAFE_LocationContext,
501
+ NavigationContext as UNSAFE_NavigationContext,
502
+ RouteContext as UNSAFE_RouteContext,
503
+ ViewTransitionContext as UNSAFE_ViewTransitionContext,
504
+ useRouteId as UNSAFE_useRouteId,
505
+ createPath,
506
+ createRoutesFromChildren,
507
+ createRoutesFromChildren2 as createRoutesFromElements,
508
+ isRouteErrorResponse,
509
+ matchPath,
510
+ matchRoutes,
511
+ parsePath,
512
+ resolvePath,
513
+ useFormAction,
514
+ useHref,
515
+ useInRouterContext,
516
+ useLinkClickHandler,
517
+ useLocation,
518
+ useNavigate,
519
+ useParams,
520
+ useResolvedPath,
521
+ useRouteError,
522
+ useRoutes,
523
+ useSubmit,
524
+ useViewTransitionState
525
+ };
526
+ //# sourceMappingURL=index.js.map