@apicurio/common-ui-components 2.0.13 → 2.0.16
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.
- package/dist/auth/useAuth.d.ts +1 -0
- package/dist/main.js +114 -105
- package/package.json +5 -1
package/dist/auth/useAuth.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface AuthService {
|
|
|
13
13
|
getToken: () => Promise<string | undefined>;
|
|
14
14
|
getUsernameAndPassword: () => UsernameAndPassword | undefined;
|
|
15
15
|
login: (username: string, password: string) => Promise<void>;
|
|
16
|
+
refresh: () => Promise<void>;
|
|
16
17
|
logout: () => Promise<void>;
|
|
17
18
|
}
|
|
18
19
|
/**
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import j, { createContext as gt, useContext as ut, useState as T, useEffect as pe, memo as Pe, forwardRef as ne, useCallback as Ne, useMemo as
|
|
1
|
+
import j, { createContext as gt, useContext as ut, useState as T, useEffect as pe, memo as Pe, forwardRef as ne, useCallback as Ne, useMemo as De } from "react";
|
|
2
2
|
import { jsx as a, jsxs as v, Fragment as Re } from "react/jsx-runtime";
|
|
3
|
-
import { useInterval as _t, Tooltip as pt, EmptyState as oe, EmptyStateVariant as ft, EmptyStateHeader as ae, EmptyStateBody as ve, Spinner as te, Alert as wt, Dropdown as mt, MenuToggle as Je, DropdownList as vt, Divider as Ke, DropdownItem as St, Select as yt, SelectOption as bt, TextInput as ce, Button as le, TextArea as kt, AboutModal as Tt, TextContent as It, Text as
|
|
4
|
-
import { EllipsisVIcon as Nt, ChevronDownIcon as
|
|
3
|
+
import { useInterval as _t, Tooltip as pt, EmptyState as oe, EmptyStateVariant as ft, EmptyStateHeader as ae, EmptyStateBody as ve, Spinner as te, Alert as wt, Dropdown as mt, MenuToggle as Je, DropdownList as vt, Divider as Ke, DropdownItem as St, Select as yt, SelectOption as bt, TextInput as ce, Button as le, TextArea as kt, AboutModal as Tt, TextContent as It, Text as qe, TextVariants as Le, TextList as $e, TextListItem as b, Modal as Ue, Form as Be, FormGroup as He, Progress as Et, EmptyStateIcon as ze, ChipGroup as Ct, Chip as Pt, InputGroup as Rt, ButtonVariant as Ut, Pagination as xt, PaginationVariant as At, Skeleton as Ot } from "@patternfly/react-core";
|
|
4
|
+
import { EllipsisVIcon as Nt, ChevronDownIcon as Dt, ChevronRightIcon as qt, ErrorCircleOIcon as Lt, SearchIcon as $t } from "@patternfly/react-icons";
|
|
5
5
|
import { DateTime as ie } from "luxon";
|
|
6
6
|
import { Tr as de, Td as xe, Th as Ht, Table as jt, Thead as Ft, Tbody as Mt, ActionsColumn as Wt } from "@patternfly/react-table";
|
|
7
7
|
import Jt from "use-resize-observer";
|
|
@@ -82,22 +82,22 @@ var Gt = {
|
|
|
82
82
|
}
|
|
83
83
|
e.setLogger = i;
|
|
84
84
|
})(he || (he = {}));
|
|
85
|
-
var p = class
|
|
85
|
+
var p = class q {
|
|
86
86
|
constructor(t) {
|
|
87
87
|
this._name = t;
|
|
88
88
|
}
|
|
89
89
|
/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
|
|
90
90
|
debug(...t) {
|
|
91
|
-
$ >= 4 && H.debug(
|
|
91
|
+
$ >= 4 && H.debug(q._format(this._name, this._method), ...t);
|
|
92
92
|
}
|
|
93
93
|
info(...t) {
|
|
94
|
-
$ >= 3 && H.info(
|
|
94
|
+
$ >= 3 && H.info(q._format(this._name, this._method), ...t);
|
|
95
95
|
}
|
|
96
96
|
warn(...t) {
|
|
97
|
-
$ >= 2 && H.warn(
|
|
97
|
+
$ >= 2 && H.warn(q._format(this._name, this._method), ...t);
|
|
98
98
|
}
|
|
99
99
|
error(...t) {
|
|
100
|
-
$ >= 1 && H.error(
|
|
100
|
+
$ >= 1 && H.error(q._format(this._name, this._method), ...t);
|
|
101
101
|
}
|
|
102
102
|
/* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */
|
|
103
103
|
throw(t) {
|
|
@@ -108,7 +108,7 @@ var p = class D {
|
|
|
108
108
|
return s._method = t, s.debug("begin"), s;
|
|
109
109
|
}
|
|
110
110
|
static createStatic(t, s) {
|
|
111
|
-
const i = new
|
|
111
|
+
const i = new q(`${t}.${s}`);
|
|
112
112
|
return i.debug("begin"), i;
|
|
113
113
|
}
|
|
114
114
|
static _format(t, s) {
|
|
@@ -118,16 +118,16 @@ var p = class D {
|
|
|
118
118
|
/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
|
|
119
119
|
// helpers for static class methods
|
|
120
120
|
static debug(t, ...s) {
|
|
121
|
-
$ >= 4 && H.debug(
|
|
121
|
+
$ >= 4 && H.debug(q._format(t), ...s);
|
|
122
122
|
}
|
|
123
123
|
static info(t, ...s) {
|
|
124
|
-
$ >= 3 && H.info(
|
|
124
|
+
$ >= 3 && H.info(q._format(t), ...s);
|
|
125
125
|
}
|
|
126
126
|
static warn(t, ...s) {
|
|
127
|
-
$ >= 2 && H.warn(
|
|
127
|
+
$ >= 2 && H.warn(q._format(t), ...s);
|
|
128
128
|
}
|
|
129
129
|
static error(t, ...s) {
|
|
130
|
-
$ >= 1 && H.error(
|
|
130
|
+
$ >= 1 && H.error(q._format(t), ...s);
|
|
131
131
|
}
|
|
132
132
|
/* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */
|
|
133
133
|
};
|
|
@@ -357,7 +357,7 @@ var C = Ve, W = class {
|
|
|
357
357
|
const i = new URL(e, "http://127.0.0.1")[t === "fragment" ? "hash" : "search"];
|
|
358
358
|
return new URLSearchParams(i.slice(1));
|
|
359
359
|
}
|
|
360
|
-
}, G = ";",
|
|
360
|
+
}, G = ";", z = class extends Error {
|
|
361
361
|
constructor(e, t) {
|
|
362
362
|
var s, i, r;
|
|
363
363
|
if (super(e.error_description || e.error || ""), this.form = t, this.name = "ErrorResponse", !e.error)
|
|
@@ -512,7 +512,7 @@ var C = Ve, W = class {
|
|
|
512
512
|
throw r.error("Error parsing JSON response", d), o.ok ? d : new Error(`${o.statusText} (${o.status})`);
|
|
513
513
|
}
|
|
514
514
|
if (!o.ok)
|
|
515
|
-
throw r.error("Error from server:", l), l.error ? new
|
|
515
|
+
throw r.error("Error from server:", l), l.error ? new z(l) : new Error(`${o.statusText} (${o.status}): ${JSON.stringify(l)}`);
|
|
516
516
|
return l;
|
|
517
517
|
}
|
|
518
518
|
async postForm(e, {
|
|
@@ -551,7 +551,7 @@ var C = Ve, W = class {
|
|
|
551
551
|
const _ = l.headers.get("dpop-nonce");
|
|
552
552
|
throw new be(_, `${JSON.stringify(g)}`);
|
|
553
553
|
}
|
|
554
|
-
throw g.error ? new
|
|
554
|
+
throw g.error ? new z(g, t) : new Error(`${l.statusText} (${l.status}): ${JSON.stringify(g)}`);
|
|
555
555
|
}
|
|
556
556
|
return g;
|
|
557
557
|
}
|
|
@@ -702,24 +702,24 @@ var C = Ve, W = class {
|
|
|
702
702
|
disablePKCE: U = !1,
|
|
703
703
|
// other behavior
|
|
704
704
|
stateStore: y,
|
|
705
|
-
revokeTokenAdditionalContentTypes:
|
|
705
|
+
revokeTokenAdditionalContentTypes: V,
|
|
706
706
|
fetchRequestCredentials: f,
|
|
707
707
|
refreshTokenAllowedScope: m,
|
|
708
708
|
// extra
|
|
709
|
-
extraQueryParams:
|
|
709
|
+
extraQueryParams: D = {},
|
|
710
710
|
extraTokenParams: J = {},
|
|
711
711
|
extraHeaders: K = {},
|
|
712
712
|
dpop: X,
|
|
713
713
|
omitScopeWhenRequesting: fe = !1
|
|
714
714
|
}) {
|
|
715
715
|
var Y;
|
|
716
|
-
if (this.authority = e, t ? this.metadataUrl = t : (this.metadataUrl = e, e && (this.metadataUrl.endsWith("/") || (this.metadataUrl += "/"), this.metadataUrl += ".well-known/openid-configuration")), this.metadata = s, this.metadataSeed = r, this.signingKeys = i, this.client_id = n, this.client_secret = o, this.response_type = c, this.scope = l, this.redirect_uri = d, this.post_logout_redirect_uri = h, this.client_authentication = g, this.prompt = _, this.display = S, this.max_age = x, this.ui_locales = k, this.acr_values = A, this.resource = I, this.response_mode = N, this.filterProtocolClaims = P ?? !0, this.loadUserInfo = !!F, this.staleStateAgeInSeconds = w, this.mergeClaimsStrategy = E, this.omitScopeWhenRequesting = fe, this.disablePKCE = !!U, this.revokeTokenAdditionalContentTypes =
|
|
716
|
+
if (this.authority = e, t ? this.metadataUrl = t : (this.metadataUrl = e, e && (this.metadataUrl.endsWith("/") || (this.metadataUrl += "/"), this.metadataUrl += ".well-known/openid-configuration")), this.metadata = s, this.metadataSeed = r, this.signingKeys = i, this.client_id = n, this.client_secret = o, this.response_type = c, this.scope = l, this.redirect_uri = d, this.post_logout_redirect_uri = h, this.client_authentication = g, this.prompt = _, this.display = S, this.max_age = x, this.ui_locales = k, this.acr_values = A, this.resource = I, this.response_mode = N, this.filterProtocolClaims = P ?? !0, this.loadUserInfo = !!F, this.staleStateAgeInSeconds = w, this.mergeClaimsStrategy = E, this.omitScopeWhenRequesting = fe, this.disablePKCE = !!U, this.revokeTokenAdditionalContentTypes = V, this.fetchRequestCredentials = f || "same-origin", this.requestTimeoutInSeconds = R, y)
|
|
717
717
|
this.stateStore = y;
|
|
718
718
|
else {
|
|
719
719
|
const se = typeof window < "u" ? window.localStorage : new Ge();
|
|
720
720
|
this.stateStore = new Qe({ store: se });
|
|
721
721
|
}
|
|
722
|
-
if (this.refreshTokenAllowedScope = m, this.extraQueryParams =
|
|
722
|
+
if (this.refreshTokenAllowedScope = m, this.extraQueryParams = D, this.extraTokenParams = J, this.extraHeaders = K, this.dpop = X, this.dpop && !((Y = this.dpop) != null && Y.store))
|
|
723
723
|
throw new Error("A DPoPStore is required when dpop is enabled");
|
|
724
724
|
}
|
|
725
725
|
}, rs = class {
|
|
@@ -904,13 +904,13 @@ var C = Ve, W = class {
|
|
|
904
904
|
validateSignoutResponse(e, t) {
|
|
905
905
|
const s = this._logger.create("validateSignoutResponse");
|
|
906
906
|
if (t.id !== e.state && s.throw(new Error("State does not match")), s.debug("state validated"), e.userState = t.data, e.error)
|
|
907
|
-
throw s.warn("Response was error", e.error), new
|
|
907
|
+
throw s.warn("Response was error", e.error), new z(e);
|
|
908
908
|
}
|
|
909
909
|
_processSigninState(e, t) {
|
|
910
910
|
var s;
|
|
911
911
|
const i = this._logger.create("_processSigninState");
|
|
912
912
|
if (t.id !== e.state && i.throw(new Error("State does not match")), t.client_id || i.throw(new Error("No client_id on state")), t.authority || i.throw(new Error("No authority on state")), this._settings.authority !== t.authority && i.throw(new Error("authority mismatch on settings vs. signin state")), this._settings.client_id && this._settings.client_id !== t.client_id && i.throw(new Error("client_id mismatch on settings vs. signin state")), i.debug("state validated"), e.userState = t.data, e.url_state = t.url_state, (s = e.scope) != null || (e.scope = t.scope), e.error)
|
|
913
|
-
throw i.warn("Response was error", e.error), new
|
|
913
|
+
throw i.warn("Response was error", e.error), new z(e);
|
|
914
914
|
t.code_verifier && !e.code && i.throw(new Error("Expected code in response"));
|
|
915
915
|
}
|
|
916
916
|
async _processClaims(e, t = !1, s = !0) {
|
|
@@ -1245,8 +1245,8 @@ var os = Ze, as = "openid", we = class {
|
|
|
1245
1245
|
omitScopeWhenRequesting: w
|
|
1246
1246
|
});
|
|
1247
1247
|
await this.clearStaleState();
|
|
1248
|
-
const
|
|
1249
|
-
return await this.settings.stateStore.set(
|
|
1248
|
+
const V = y.state;
|
|
1249
|
+
return await this.settings.stateStore.set(V.id, V.toStorageString()), y;
|
|
1250
1250
|
}
|
|
1251
1251
|
async readSigninResponseState(e, t = !1) {
|
|
1252
1252
|
const s = this._logger.create("readSigninResponseState"), i = new we(ye.readParams(e, this.settings.response_mode));
|
|
@@ -1379,7 +1379,7 @@ var os = Ze, as = "openid", we = class {
|
|
|
1379
1379
|
const s = this._logger.create("readSignoutResponseState"), i = new ls(ye.readParams(e, this.settings.response_mode));
|
|
1380
1380
|
if (!i.state) {
|
|
1381
1381
|
if (s.debug("No state in response"), i.error)
|
|
1382
|
-
throw s.warn("Response was error:", i.error), new
|
|
1382
|
+
throw s.warn("Response was error:", i.error), new z(i);
|
|
1383
1383
|
return { state: void 0, response: i };
|
|
1384
1384
|
}
|
|
1385
1385
|
const r = await this.settings.stateStore[t ? "remove" : "get"](i.state);
|
|
@@ -2131,7 +2131,7 @@ var os = Ze, as = "openid", we = class {
|
|
|
2131
2131
|
sub: d.profile.sub
|
|
2132
2132
|
}) : (t.info("success, user not authenticated"), null);
|
|
2133
2133
|
} catch (l) {
|
|
2134
|
-
if (this.settings.monitorAnonymousSession && l instanceof
|
|
2134
|
+
if (this.settings.monitorAnonymousSession && l instanceof z)
|
|
2135
2135
|
switch (l.error) {
|
|
2136
2136
|
case "login_required":
|
|
2137
2137
|
case "consent_required":
|
|
@@ -2170,7 +2170,7 @@ var os = Ze, as = "openid", we = class {
|
|
|
2170
2170
|
const s = this._logger.create("_buildUser"), i = new me(e);
|
|
2171
2171
|
if (t) {
|
|
2172
2172
|
if (t !== i.profile.sub)
|
|
2173
|
-
throw s.debug("current user does not match user returned from signin. sub from signin:", i.profile.sub), new
|
|
2173
|
+
throw s.debug("current user does not match user returned from signin. sub from signin:", i.profile.sub), new z({ ...e, error: "login_required" });
|
|
2174
2174
|
s.debug("current user matches user returned from signin");
|
|
2175
2175
|
}
|
|
2176
2176
|
return await this.storeUser(i), s.debug("user stored"), await this._events.load(i), i;
|
|
@@ -2380,24 +2380,24 @@ var os = Ze, as = "openid", we = class {
|
|
|
2380
2380
|
return await C.generateDPoPJkt(t.keys);
|
|
2381
2381
|
}
|
|
2382
2382
|
};
|
|
2383
|
-
const Cs = ["url", "clientId", "redirectUri", "scope", "logoutUrl"], Ps = "openid profile email";
|
|
2383
|
+
const Cs = ["url", "clientId", "redirectUri", "scope", "logoutUrl", "loadUserInfo"], Ps = "openid profile email";
|
|
2384
2384
|
function Rs(e, t) {
|
|
2385
2385
|
const s = {};
|
|
2386
2386
|
return e.forEach((i) => {
|
|
2387
2387
|
t[i] !== void 0 && (s[i] = t[i]);
|
|
2388
2388
|
}), s;
|
|
2389
2389
|
}
|
|
2390
|
-
let u,
|
|
2391
|
-
const Us = (e) => (
|
|
2392
|
-
authority:
|
|
2393
|
-
client_id:
|
|
2394
|
-
redirect_uri:
|
|
2390
|
+
let u, B;
|
|
2391
|
+
const Us = (e) => (B = Rs(Cs, e), new Es({
|
|
2392
|
+
authority: B.url,
|
|
2393
|
+
client_id: B.clientId,
|
|
2394
|
+
redirect_uri: B.redirectUri,
|
|
2395
2395
|
response_type: "code",
|
|
2396
|
-
scope:
|
|
2396
|
+
scope: B.scope || Ps,
|
|
2397
2397
|
filterProtocolClaims: !0,
|
|
2398
2398
|
includeIdTokenInSilentRenew: !0,
|
|
2399
2399
|
includeIdTokenInSilentSignout: !0,
|
|
2400
|
-
loadUserInfo: !0
|
|
2400
|
+
loadUserInfo: B.loadUserInfo ?? !0
|
|
2401
2401
|
})), xs = async () => {
|
|
2402
2402
|
try {
|
|
2403
2403
|
console.debug("[Auth] Logging in using OIDC");
|
|
@@ -2411,31 +2411,37 @@ const Us = (e) => (V = Rs(Cs, e), new Es({
|
|
|
2411
2411
|
console.error("[Auth] Error logging in using OIDC: ", e);
|
|
2412
2412
|
}
|
|
2413
2413
|
}, As = async () => {
|
|
2414
|
+
try {
|
|
2415
|
+
console.debug("[Auth] Refreshing token using OIDC"), await (u == null ? void 0 : u.signinSilent());
|
|
2416
|
+
} catch (e) {
|
|
2417
|
+
console.error("[Auth] Error refreshing token using OIDC: ", e);
|
|
2418
|
+
}
|
|
2419
|
+
}, Os = async () => {
|
|
2414
2420
|
const e = await (u == null ? void 0 : u.getUser()), t = e == null ? void 0 : e.id_token;
|
|
2415
2421
|
return u == null ? void 0 : u.removeUser().then(() => u == null ? void 0 : u.signoutRedirect({
|
|
2416
2422
|
id_token_hint: t,
|
|
2417
|
-
post_logout_redirect_uri:
|
|
2423
|
+
post_logout_redirect_uri: B.logoutUrl || window.location.href
|
|
2418
2424
|
}));
|
|
2419
|
-
},
|
|
2425
|
+
}, Ns = async () => await (u == null ? void 0 : u.getUser()) != null, Ds = async () => {
|
|
2420
2426
|
const e = await (u == null ? void 0 : u.getUser());
|
|
2421
2427
|
return Promise.resolve(e == null ? void 0 : e.access_token);
|
|
2422
2428
|
}, qs = async () => {
|
|
2423
2429
|
const e = await (u == null ? void 0 : u.getUser());
|
|
2424
2430
|
return Promise.resolve(e == null ? void 0 : e.id_token);
|
|
2425
|
-
},
|
|
2431
|
+
}, Ls = async () => {
|
|
2426
2432
|
const e = await (u == null ? void 0 : u.getUser());
|
|
2427
2433
|
return Promise.resolve(e == null ? void 0 : e.profile.preferred_username);
|
|
2428
2434
|
};
|
|
2429
2435
|
let Q, ee;
|
|
2430
|
-
const
|
|
2436
|
+
const $s = async (e, t) => {
|
|
2431
2437
|
try {
|
|
2432
2438
|
console.debug("[Auth] Setting Username and Password for BasicAuth"), Q = e, ee = t;
|
|
2433
2439
|
} catch (s) {
|
|
2434
2440
|
console.error("[Auth] Error logging in using BasicAuth: ", s);
|
|
2435
2441
|
}
|
|
2436
|
-
},
|
|
2442
|
+
}, Hs = async () => {
|
|
2437
2443
|
console.debug("[Auth] Logout for BasicAuth"), Q = void 0, ee = void 0, window.location.reload();
|
|
2438
|
-
},
|
|
2444
|
+
}, js = async () => Q !== void 0 && ee !== void 0, Fs = async () => Promise.resolve(Q), Ms = () => {
|
|
2439
2445
|
if (Q !== void 0 && ee != null)
|
|
2440
2446
|
return {
|
|
2441
2447
|
username: Q,
|
|
@@ -2446,29 +2452,31 @@ const Ls = async (e, t) => {
|
|
|
2446
2452
|
return e.type === "oidc" ? (u === void 0 && (console.debug("[Auth] Creating OIDC UserManager with options: ", e.options), u = Us(e.options)), {
|
|
2447
2453
|
isOidcAuthEnabled: () => !0,
|
|
2448
2454
|
isBasicAuthEnabled: () => !1,
|
|
2449
|
-
isAuthenticated:
|
|
2455
|
+
isAuthenticated: Ns,
|
|
2450
2456
|
getToken: async () => {
|
|
2451
2457
|
if (e.options.logTokens) {
|
|
2452
2458
|
const t = await (u == null ? void 0 : u.getUser());
|
|
2453
2459
|
console.debug("[Auth] ID Token:"), console.debug(t == null ? void 0 : t.id_token), console.debug("[Auth] Access Token:"), console.debug(t == null ? void 0 : t.access_token);
|
|
2454
2460
|
}
|
|
2455
|
-
return e.options.tokenType === "id" ? qs() :
|
|
2461
|
+
return e.options.tokenType === "id" ? qs() : Ds();
|
|
2456
2462
|
},
|
|
2457
2463
|
getUsernameAndPassword: () => {
|
|
2458
2464
|
},
|
|
2459
|
-
getUsername:
|
|
2465
|
+
getUsername: Ls,
|
|
2460
2466
|
login: xs,
|
|
2461
|
-
|
|
2467
|
+
refresh: As,
|
|
2468
|
+
logout: Os
|
|
2462
2469
|
}) : e.type === "basic" ? {
|
|
2463
2470
|
isOidcAuthEnabled: () => !1,
|
|
2464
2471
|
isBasicAuthEnabled: () => !0,
|
|
2465
|
-
isAuthenticated:
|
|
2472
|
+
isAuthenticated: js,
|
|
2466
2473
|
getToken: async () => {
|
|
2467
2474
|
},
|
|
2468
|
-
getUsernameAndPassword:
|
|
2469
|
-
getUsername:
|
|
2470
|
-
login:
|
|
2471
|
-
|
|
2475
|
+
getUsernameAndPassword: Ms,
|
|
2476
|
+
getUsername: Fs,
|
|
2477
|
+
login: $s,
|
|
2478
|
+
refresh: () => Promise.resolve(),
|
|
2479
|
+
logout: Hs
|
|
2472
2480
|
} : {
|
|
2473
2481
|
isOidcAuthEnabled: () => !1,
|
|
2474
2482
|
isBasicAuthEnabled: () => !1,
|
|
@@ -2478,6 +2486,7 @@ const Ls = async (e, t) => {
|
|
|
2478
2486
|
getUsernameAndPassword: () => {
|
|
2479
2487
|
},
|
|
2480
2488
|
login: () => Promise.resolve(),
|
|
2489
|
+
refresh: () => Promise.resolve(),
|
|
2481
2490
|
logout: () => Promise.resolve()
|
|
2482
2491
|
};
|
|
2483
2492
|
}, Ee = (e) => {
|
|
@@ -2497,7 +2506,7 @@ const Ls = async (e, t) => {
|
|
|
2497
2506
|
return pe(() => {
|
|
2498
2507
|
o();
|
|
2499
2508
|
}, [e.date]), n === "fromNow" ? /* @__PURE__ */ a(pt, { content: /* @__PURE__ */ a("span", { children: i }), children: /* @__PURE__ */ a("span", { children: t }) }) : /* @__PURE__ */ a("span", { children: t });
|
|
2500
|
-
},
|
|
2509
|
+
}, ei = (e) => /* @__PURE__ */ a(Ee, { date: e.date, format: "fromNow" }), O = ({ condition: e, children: t }) => (typeof e == "boolean" ? e : e()) ? /* @__PURE__ */ a(j.Fragment, { children: t }) : /* @__PURE__ */ a(j.Fragment, {}), ti = ({ collection: e, emptyState: t, emptyStateTitle: s, emptyStateMessage: i, children: r }) => {
|
|
2501
2510
|
const n = () => !e || e.length === 0, o = t || /* @__PURE__ */ v(oe, { variant: ft.xs, children: [
|
|
2502
2511
|
/* @__PURE__ */ a(ae, { titleText: s || "None found", headingLevel: "h4" }),
|
|
2503
2512
|
/* @__PURE__ */ a(ve, { children: i || "No items found." })
|
|
@@ -2506,7 +2515,7 @@ const Ls = async (e, t) => {
|
|
|
2506
2515
|
}, _e = ({ isLoading: e, loadingComponent: t, children: s }) => {
|
|
2507
2516
|
const i = () => typeof e == "boolean" ? e : e(), r = t || /* @__PURE__ */ a(te, {});
|
|
2508
2517
|
return i() ? /* @__PURE__ */ a(j.Fragment, { children: r }) : /* @__PURE__ */ a(j.Fragment, { children: s });
|
|
2509
|
-
},
|
|
2518
|
+
}, si = ({ toolbar: e, alwaysShowToolbar: t, emptyState: s, filteredEmptyState: i, isLoading: r, isError: n, loadingComponent: o, errorComponent: c, isEmpty: l, isFiltered: d, children: h }) => {
|
|
2510
2519
|
const g = t || !l || d || n;
|
|
2511
2520
|
return c || (c = /* @__PURE__ */ a("div", { style: { padding: "15px", backgroundColor: "white" }, children: /* @__PURE__ */ a(wt, { isInline: !0, variant: "danger", title: "Error: Something went wrong!", children: /* @__PURE__ */ a("p", { children: "Something went wrong with the action you attempted, but we're not sure what it was. Try reloading the page and hopef for a better result, or contact your admin to report the error." }) }) })), /* @__PURE__ */ v(j.Fragment, { children: [
|
|
2512
2521
|
/* @__PURE__ */ a(O, { condition: g, children: e }),
|
|
@@ -2517,7 +2526,7 @@ const Ls = async (e, t) => {
|
|
|
2517
2526
|
/* @__PURE__ */ a(O, { condition: n, children: c })
|
|
2518
2527
|
] })
|
|
2519
2528
|
] });
|
|
2520
|
-
},
|
|
2529
|
+
}, ii = (e) => {
|
|
2521
2530
|
const [t, s] = T(!1), i = (l, d) => {
|
|
2522
2531
|
s(!1);
|
|
2523
2532
|
const h = d;
|
|
@@ -2563,7 +2572,7 @@ const Ls = async (e, t) => {
|
|
|
2563
2572
|
)) })
|
|
2564
2573
|
}
|
|
2565
2574
|
);
|
|
2566
|
-
},
|
|
2575
|
+
}, Ws = (e) => {
|
|
2567
2576
|
var l;
|
|
2568
2577
|
const [t, s] = T(!1), i = (d, h) => {
|
|
2569
2578
|
s(!1), e.onSelect(e.items[h]);
|
|
@@ -2606,18 +2615,18 @@ const Ls = async (e, t) => {
|
|
|
2606
2615
|
))
|
|
2607
2616
|
}
|
|
2608
2617
|
);
|
|
2609
|
-
},
|
|
2618
|
+
}, ri = ({ expanded: e, onClick: t }) => e ? /* @__PURE__ */ a(Dt, { onClick: t, style: { cursor: "pointer" } }) : /* @__PURE__ */ a(qt, { onClick: t, style: { cursor: "pointer" } }), lt = {
|
|
2610
2619
|
padding: "5px",
|
|
2611
2620
|
minHeight: "128px",
|
|
2612
2621
|
borderRight: 0,
|
|
2613
2622
|
borderLeft: 0,
|
|
2614
2623
|
borderBottom: "1px solid #666",
|
|
2615
2624
|
backgroundColor: "rgb(240, 240, 240)"
|
|
2616
|
-
},
|
|
2625
|
+
}, Js = {
|
|
2617
2626
|
...lt,
|
|
2618
2627
|
color: "red",
|
|
2619
2628
|
overflow: "auto"
|
|
2620
|
-
},
|
|
2629
|
+
}, ni = (e) => {
|
|
2621
2630
|
const [t, s] = T(""), [i, r] = T(""), [n, o] = T(!1), [c, l] = T(), d = (k, A) => {
|
|
2622
2631
|
s(A);
|
|
2623
2632
|
}, h = () => t != null && t.trim().length > 0, g = () => c != null && c.trim().length > 0, _ = () => {
|
|
@@ -2650,7 +2659,7 @@ const Ls = async (e, t) => {
|
|
|
2650
2659
|
/* @__PURE__ */ a("div", { className: "url-clear-button", children: /* @__PURE__ */ a(le, { "data-testid": `${e.testId}-clear`, variant: "control", isDisabled: !h(), onClick: S, children: "Clear" }) })
|
|
2651
2660
|
] }),
|
|
2652
2661
|
/* @__PURE__ */ a("div", { className: "url-upload-preview", children: /* @__PURE__ */ v(_e, { isLoading: n, loadingComponent: x, children: [
|
|
2653
|
-
/* @__PURE__ */ a(O, { condition: g, children: /* @__PURE__ */ v("div", { className: "url-upload-error", style:
|
|
2662
|
+
/* @__PURE__ */ a(O, { condition: g, children: /* @__PURE__ */ v("div", { className: "url-upload-error", style: Js, children: [
|
|
2654
2663
|
/* @__PURE__ */ a("div", { children: "Error getting content from URL." }),
|
|
2655
2664
|
/* @__PURE__ */ a("div", { children: c })
|
|
2656
2665
|
] }) }),
|
|
@@ -2666,7 +2675,7 @@ const Ls = async (e, t) => {
|
|
|
2666
2675
|
) })
|
|
2667
2676
|
] }) })
|
|
2668
2677
|
] });
|
|
2669
|
-
},
|
|
2678
|
+
}, oi = (e) => {
|
|
2670
2679
|
const [t, s] = T(), [i, r] = T();
|
|
2671
2680
|
return pe(() => {
|
|
2672
2681
|
e.isOpen && (typeof e.frontendInfo == "function" ? e.frontendInfo().then(s) : s(e.frontendInfo), typeof e.backendInfo == "function" ? e.backendInfo().then(r) : r(e.backendInfo));
|
|
@@ -2681,7 +2690,7 @@ const Ls = async (e, t) => {
|
|
|
2681
2690
|
brandImageAlt: e.brandImageAlt,
|
|
2682
2691
|
"aria-label": e.brandImageAlt,
|
|
2683
2692
|
children: /* @__PURE__ */ v(It, { className: "app-about-modal-content", style: { marginTop: "-25px" }, children: [
|
|
2684
|
-
/* @__PURE__ */ a(
|
|
2693
|
+
/* @__PURE__ */ a(qe, { component: Le.h2, children: "Web console info" }),
|
|
2685
2694
|
/* @__PURE__ */ a(_e, { isLoading: t === void 0, children: /* @__PURE__ */ v($e, { component: "dl", children: [
|
|
2686
2695
|
/* @__PURE__ */ a(b, { component: "dt", children: "Project" }),
|
|
2687
2696
|
/* @__PURE__ */ a(b, { component: "dd", children: /* @__PURE__ */ a("a", { href: t == null ? void 0 : t.url, target: "_blank", children: t == null ? void 0 : t.name }) }),
|
|
@@ -2692,7 +2701,7 @@ const Ls = async (e, t) => {
|
|
|
2692
2701
|
/* @__PURE__ */ a(b, { component: "dt", children: "Digest" }),
|
|
2693
2702
|
/* @__PURE__ */ a(b, { component: "dd", children: t == null ? void 0 : t.digest })
|
|
2694
2703
|
] }) }),
|
|
2695
|
-
/* @__PURE__ */ a(
|
|
2704
|
+
/* @__PURE__ */ a(qe, { style: { marginTop: "40px" }, component: Le.h2, children: e.backendLabel }),
|
|
2696
2705
|
/* @__PURE__ */ a(_e, { isLoading: i === void 0, children: /* @__PURE__ */ v($e, { component: "dl", children: [
|
|
2697
2706
|
/* @__PURE__ */ a(b, { component: "dt", children: "Name" }),
|
|
2698
2707
|
/* @__PURE__ */ a(b, { component: "dd", children: (i == null ? void 0 : i.name) || "" }),
|
|
@@ -2706,7 +2715,7 @@ const Ls = async (e, t) => {
|
|
|
2706
2715
|
] })
|
|
2707
2716
|
}
|
|
2708
2717
|
);
|
|
2709
|
-
},
|
|
2718
|
+
}, Ks = (e) => {
|
|
2710
2719
|
const [t, s] = T({
|
|
2711
2720
|
username: "",
|
|
2712
2721
|
password: ""
|
|
@@ -2781,7 +2790,7 @@ const Ls = async (e, t) => {
|
|
|
2781
2790
|
] })
|
|
2782
2791
|
}
|
|
2783
2792
|
);
|
|
2784
|
-
},
|
|
2793
|
+
}, ai = (e) => /* @__PURE__ */ v(
|
|
2785
2794
|
Ue,
|
|
2786
2795
|
{
|
|
2787
2796
|
title: "Please Wait",
|
|
@@ -2797,7 +2806,7 @@ const Ls = async (e, t) => {
|
|
|
2797
2806
|
/* @__PURE__ */ a("span", { className: "message", style: { fontSize: "15px", color: "#333", marginLeft: "10px" }, children: e.message })
|
|
2798
2807
|
]
|
|
2799
2808
|
}
|
|
2800
|
-
),
|
|
2809
|
+
), ci = (e) => /* @__PURE__ */ a(
|
|
2801
2810
|
Ue,
|
|
2802
2811
|
{
|
|
2803
2812
|
title: e.title,
|
|
@@ -2809,7 +2818,7 @@ const Ls = async (e, t) => {
|
|
|
2809
2818
|
"aria-label": "progress-modal",
|
|
2810
2819
|
children: /* @__PURE__ */ a(Et, { title: e.message, value: e.progress })
|
|
2811
2820
|
}
|
|
2812
|
-
),
|
|
2821
|
+
), li = (e) => {
|
|
2813
2822
|
const [t, s] = T(
|
|
2814
2823
|
0
|
|
2815
2824
|
/* AUTHENTICATING */
|
|
@@ -2839,24 +2848,24 @@ const Ls = async (e, t) => {
|
|
|
2839
2848
|
/* @__PURE__ */ a(ae, { titleText: "Loading", headingLevel: "h4" }),
|
|
2840
2849
|
/* @__PURE__ */ a(ve, { children: /* @__PURE__ */ a(te, { size: "xl", "aria-label": "Loading spinner" }) })
|
|
2841
2850
|
] }) }),
|
|
2842
|
-
/* @__PURE__ */ a(O, { condition: t === 0 && i.isBasicAuthEnabled(), children: /* @__PURE__ */ a(
|
|
2851
|
+
/* @__PURE__ */ a(O, { condition: t === 0 && i.isBasicAuthEnabled(), children: /* @__PURE__ */ a(Ks, { onLogin: r }) }),
|
|
2843
2852
|
/* @__PURE__ */ a(O, { condition: t === 2, children: /* @__PURE__ */ v(oe, { children: [
|
|
2844
2853
|
/* @__PURE__ */ a(ae, { titleText: "Empty state", headingLevel: "h4", icon: /* @__PURE__ */ a(ze, { icon: Lt }) }),
|
|
2845
2854
|
/* @__PURE__ */ a(ve, { children: "Authentication failed." })
|
|
2846
2855
|
] }) }),
|
|
2847
2856
|
/* @__PURE__ */ a(O, { condition: t === 1, children: e.children })
|
|
2848
2857
|
] });
|
|
2849
|
-
},
|
|
2858
|
+
}, di = (e) => {
|
|
2850
2859
|
const t = ct();
|
|
2851
2860
|
return (() => {
|
|
2852
2861
|
let i = !0;
|
|
2853
2862
|
return e.enabled !== void 0 && (i = i && (t.isOidcAuthEnabled() === e.enabled || t.isBasicAuthEnabled() === e.enabled)), i;
|
|
2854
2863
|
})() ? /* @__PURE__ */ a(j.Fragment, { children: e.children }) : /* @__PURE__ */ a(j.Fragment, {});
|
|
2855
|
-
},
|
|
2864
|
+
}, hi = (e) => /* @__PURE__ */ a(Ct, { categoryName: e.categoryName || "Filters", isClosable: !0, onClick: e.onClearAllCriteria, children: e.criteria.map((t, s) => /* @__PURE__ */ v(Pt, { onClick: () => e.onRemoveCriteria(t), children: [
|
|
2856
2865
|
/* @__PURE__ */ a("b", { children: t.filterBy.label }),
|
|
2857
2866
|
/* @__PURE__ */ a("span", { children: ": " }),
|
|
2858
2867
|
/* @__PURE__ */ a("span", { children: t.filterValue })
|
|
2859
|
-
] }, s)) }),
|
|
2868
|
+
] }, s)) }), gi = (e) => {
|
|
2860
2869
|
const [t, s] = T(e.filterTypes[0]), [i, r] = T(""), n = (o) => {
|
|
2861
2870
|
o && o.preventDefault(), e.onAddCriteria({
|
|
2862
2871
|
filterBy: t,
|
|
@@ -2867,7 +2876,7 @@ const Ls = async (e, t) => {
|
|
|
2867
2876
|
s(e.filterTypes[0]);
|
|
2868
2877
|
}, [e.filterTypes]), /* @__PURE__ */ a(Be, { onSubmit: n, children: /* @__PURE__ */ v(Rt, { children: [
|
|
2869
2878
|
/* @__PURE__ */ a(
|
|
2870
|
-
|
|
2879
|
+
Ws,
|
|
2871
2880
|
{
|
|
2872
2881
|
value: t,
|
|
2873
2882
|
items: e.filterTypes,
|
|
@@ -2902,7 +2911,7 @@ const Ls = async (e, t) => {
|
|
|
2902
2911
|
)
|
|
2903
2912
|
] }) });
|
|
2904
2913
|
};
|
|
2905
|
-
function
|
|
2914
|
+
function ui() {
|
|
2906
2915
|
return /* @__PURE__ */ a(oe, { children: /* @__PURE__ */ a(
|
|
2907
2916
|
ae,
|
|
2908
2917
|
{
|
|
@@ -2912,7 +2921,7 @@ function gi() {
|
|
|
2912
2921
|
}
|
|
2913
2922
|
) });
|
|
2914
2923
|
}
|
|
2915
|
-
function
|
|
2924
|
+
function _i({
|
|
2916
2925
|
itemCount: e,
|
|
2917
2926
|
page: t,
|
|
2918
2927
|
perPage: s,
|
|
@@ -2933,7 +2942,7 @@ function ui({
|
|
|
2933
2942
|
}
|
|
2934
2943
|
);
|
|
2935
2944
|
}
|
|
2936
|
-
function
|
|
2945
|
+
function Bs({ columns: e, rows: t, getTd: s = () => xe }) {
|
|
2937
2946
|
const i = new Array(e).fill(0).map((n, o) => {
|
|
2938
2947
|
const c = s(o);
|
|
2939
2948
|
return /* @__PURE__ */ a(c, { children: /* @__PURE__ */ a(
|
|
@@ -2945,7 +2954,7 @@ function Ks({ columns: e, rows: t, getTd: s = () => xe }) {
|
|
|
2945
2954
|
}), r = new Array(t).fill(0).map((n, o) => /* @__PURE__ */ a(de, { children: i }, `row_${o}`));
|
|
2946
2955
|
return /* @__PURE__ */ a(Re, { children: r });
|
|
2947
2956
|
}
|
|
2948
|
-
const
|
|
2957
|
+
const pi = ({
|
|
2949
2958
|
ariaLabel: e,
|
|
2950
2959
|
minimumColumnWidth: t = 250,
|
|
2951
2960
|
columns: s,
|
|
@@ -2973,8 +2982,8 @@ const _i = ({
|
|
|
2973
2982
|
}, { ref: R } = Jt({ onResize: F }), w = I >= 576, E = Ne(
|
|
2974
2983
|
(f) => w && f !== 0 && f !== s.length - 1,
|
|
2975
2984
|
[s, w]
|
|
2976
|
-
), U =
|
|
2977
|
-
const
|
|
2985
|
+
), U = De(() => s.map((f, m) => {
|
|
2986
|
+
const D = ne(
|
|
2978
2987
|
({ children: J, ...K }, X) => /* @__PURE__ */ a(
|
|
2979
2988
|
dt,
|
|
2980
2989
|
{
|
|
@@ -2989,8 +2998,8 @@ const _i = ({
|
|
|
2989
2998
|
}
|
|
2990
2999
|
)
|
|
2991
3000
|
);
|
|
2992
|
-
return
|
|
2993
|
-
Th:
|
|
3001
|
+
return D.displayName = "ResponsiveThCurried", r({
|
|
3002
|
+
Th: D,
|
|
2994
3003
|
key: `header_${f}`,
|
|
2995
3004
|
column: f,
|
|
2996
3005
|
colIndex: m
|
|
@@ -3005,7 +3014,7 @@ const _i = ({
|
|
|
3005
3014
|
]), y = Ne(
|
|
3006
3015
|
(f) => {
|
|
3007
3016
|
const m = ne(
|
|
3008
|
-
({ children:
|
|
3017
|
+
({ children: D, ...J }, K) => /* @__PURE__ */ a(
|
|
3009
3018
|
Ce,
|
|
3010
3019
|
{
|
|
3011
3020
|
position: f,
|
|
@@ -3014,14 +3023,14 @@ const _i = ({
|
|
|
3014
3023
|
canHide: E(f),
|
|
3015
3024
|
...J,
|
|
3016
3025
|
ref: K,
|
|
3017
|
-
children:
|
|
3026
|
+
children: D
|
|
3018
3027
|
}
|
|
3019
3028
|
)
|
|
3020
3029
|
);
|
|
3021
3030
|
return m.displayName = "ResponsiveTdCurried", m;
|
|
3022
3031
|
},
|
|
3023
3032
|
[E, t, I]
|
|
3024
|
-
),
|
|
3033
|
+
), V = De(
|
|
3025
3034
|
() => s.map((f, m) => y(m)),
|
|
3026
3035
|
[s, y]
|
|
3027
3036
|
);
|
|
@@ -3038,7 +3047,7 @@ const _i = ({
|
|
|
3038
3047
|
/* @__PURE__ */ a(Ft, { children: /* @__PURE__ */ a(de, { children: U }) }),
|
|
3039
3048
|
/* @__PURE__ */ v(Mt, { children: [
|
|
3040
3049
|
i === void 0 && /* @__PURE__ */ a(
|
|
3041
|
-
|
|
3050
|
+
Bs,
|
|
3042
3051
|
{
|
|
3043
3052
|
columns: s.length,
|
|
3044
3053
|
rows: h,
|
|
@@ -3046,14 +3055,14 @@ const _i = ({
|
|
|
3046
3055
|
}
|
|
3047
3056
|
),
|
|
3048
3057
|
i == null ? void 0 : i.map((f, m) => {
|
|
3049
|
-
const
|
|
3050
|
-
Td:
|
|
3058
|
+
const D = l !== void 0 && l({ row: f, rowIndex: m }), J = d !== void 0 && d({ row: f, rowIndex: m }), K = !D && g ? () => g({ row: f, rowIndex: m }) : void 0, X = s.map((Y, se) => n({
|
|
3059
|
+
Td: V[se],
|
|
3051
3060
|
key: `row_${m}_cell_${Y}`,
|
|
3052
3061
|
column: Y,
|
|
3053
3062
|
colIndex: se,
|
|
3054
3063
|
rowIndex: m,
|
|
3055
3064
|
row: f
|
|
3056
|
-
})), fe = !
|
|
3065
|
+
})), fe = !D && o && /* @__PURE__ */ a(
|
|
3057
3066
|
Ce,
|
|
3058
3067
|
{
|
|
3059
3068
|
position: s.length,
|
|
@@ -3068,7 +3077,7 @@ const _i = ({
|
|
|
3068
3077
|
return /* @__PURE__ */ v(
|
|
3069
3078
|
ht,
|
|
3070
3079
|
{
|
|
3071
|
-
isDeleted:
|
|
3080
|
+
isDeleted: D,
|
|
3072
3081
|
isSelected: J,
|
|
3073
3082
|
onClick: K,
|
|
3074
3083
|
rowOuiaId: S == null ? void 0 : S({ row: f, rowIndex: m }),
|
|
@@ -3149,31 +3158,31 @@ const ht = Pe(
|
|
|
3149
3158
|
);
|
|
3150
3159
|
ht.displayName = "DeletableRow";
|
|
3151
3160
|
export {
|
|
3152
|
-
|
|
3153
|
-
|
|
3161
|
+
oi as AppAboutModal,
|
|
3162
|
+
li as ApplicationAuth,
|
|
3154
3163
|
Kt as AuthConfigContext,
|
|
3155
|
-
|
|
3156
|
-
|
|
3164
|
+
Ks as BasicAuthModal,
|
|
3165
|
+
gi as ChipFilterInput,
|
|
3157
3166
|
Ee as DateTime,
|
|
3158
3167
|
ht as DeletableRow,
|
|
3159
|
-
|
|
3160
|
-
|
|
3168
|
+
hi as FilterChips,
|
|
3169
|
+
ei as FromNow,
|
|
3161
3170
|
O as If,
|
|
3162
|
-
|
|
3163
|
-
|
|
3171
|
+
di as IfAuth,
|
|
3172
|
+
ti as IfNotEmpty,
|
|
3164
3173
|
_e as IfNotLoading,
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3174
|
+
si as ListWithToolbar,
|
|
3175
|
+
ui as Loading,
|
|
3176
|
+
ii as ObjectDropdown,
|
|
3177
|
+
Ws as ObjectSelect,
|
|
3178
|
+
_i as Pagination,
|
|
3179
|
+
ai as PleaseWaitModal,
|
|
3180
|
+
ci as ProgressModal,
|
|
3181
|
+
pi as ResponsiveTable,
|
|
3173
3182
|
Ce as ResponsiveTd,
|
|
3174
3183
|
dt as ResponsiveTh,
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3184
|
+
Bs as TableSkeleton,
|
|
3185
|
+
ri as ToggleIcon,
|
|
3186
|
+
ni as UrlUpload,
|
|
3178
3187
|
ct as useAuth
|
|
3179
3188
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apicurio/common-ui-components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.16",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"types": "dist/main.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/Apicurio/apicurio-common-ui-components"
|
|
14
|
+
},
|
|
11
15
|
"scripts": {
|
|
12
16
|
"clean": "rimraf dist",
|
|
13
17
|
"dev": "vite",
|