@ttoss/components 2.16.1 → 2.18.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.
- package/README.md +1 -0
- package/dist/index.d.mts +15 -1
- package/dist/index.mjs +54 -1
- package/package.json +3 -3
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -894,7 +894,19 @@ type OAuthConsentLabels = {
|
|
|
894
894
|
* Props for the OAuthConsent component.
|
|
895
895
|
*/
|
|
896
896
|
type OAuthConsentProps = {
|
|
897
|
-
/** Display name or identifier of the requesting OAuth client. */clientName: string;
|
|
897
|
+
/** Display name or identifier of the requesting OAuth client. */clientName: string;
|
|
898
|
+
/**
|
|
899
|
+
* URL of the client's logo or icon. When provided, renders the image above
|
|
900
|
+
* the consent heading. Falls back to the first letter of `clientName` if the
|
|
901
|
+
* image fails to load. When omitted, no logo is shown (backward-compatible).
|
|
902
|
+
*/
|
|
903
|
+
clientLogoUrl?: string;
|
|
904
|
+
/**
|
|
905
|
+
* Logo URL sourced directly from the OAuth `logo_uri` parameter appended by
|
|
906
|
+
* the consent-redirect flow. Takes precedence over `clientLogoUrl` when both
|
|
907
|
+
* are provided; otherwise the two are interchangeable.
|
|
908
|
+
*/
|
|
909
|
+
logoUri?: string; /** Scope tree to render. */
|
|
898
910
|
scopes: ConsentScope[];
|
|
899
911
|
/**
|
|
900
912
|
* Called when the user approves. Receives the minimal granted scope set
|
|
@@ -958,6 +970,8 @@ declare const collectGrantedScopes: (scopes: ConsentScope[], selected: Set<strin
|
|
|
958
970
|
*/
|
|
959
971
|
declare const OAuthConsent: ({
|
|
960
972
|
clientName,
|
|
973
|
+
clientLogoUrl,
|
|
974
|
+
logoUri,
|
|
961
975
|
scopes,
|
|
962
976
|
onAuthorize,
|
|
963
977
|
onAuthorized,
|
package/dist/index.mjs
CHANGED
|
@@ -2980,6 +2980,48 @@ var NotificationsMenu = ({
|
|
|
2980
2980
|
});
|
|
2981
2981
|
};
|
|
2982
2982
|
|
|
2983
|
+
//#endregion
|
|
2984
|
+
//#region src/components/OAuthConsent/ClientLogo.tsx
|
|
2985
|
+
var ClientLogo = ({
|
|
2986
|
+
src,
|
|
2987
|
+
clientName
|
|
2988
|
+
}) => {
|
|
2989
|
+
const [errored, setErrored] = React.useState(false);
|
|
2990
|
+
if (errored) return /* @__PURE__ */jsx(Flex, {
|
|
2991
|
+
"aria-hidden": "true",
|
|
2992
|
+
sx: {
|
|
2993
|
+
width: 48,
|
|
2994
|
+
height: 48,
|
|
2995
|
+
borderRadius: "lg",
|
|
2996
|
+
backgroundColor: "display.background.muted.default",
|
|
2997
|
+
alignItems: "center",
|
|
2998
|
+
justifyContent: "center"
|
|
2999
|
+
},
|
|
3000
|
+
children: /* @__PURE__ */jsx(Text, {
|
|
3001
|
+
sx: {
|
|
3002
|
+
fontSize: "xl",
|
|
3003
|
+
fontWeight: "bold",
|
|
3004
|
+
color: "display.text.muted.default"
|
|
3005
|
+
},
|
|
3006
|
+
children: clientName.charAt(0).toUpperCase()
|
|
3007
|
+
})
|
|
3008
|
+
});
|
|
3009
|
+
return /* @__PURE__ */jsx("img", {
|
|
3010
|
+
src,
|
|
3011
|
+
alt: `${clientName} logo`,
|
|
3012
|
+
onError: () => {
|
|
3013
|
+
return setErrored(true);
|
|
3014
|
+
},
|
|
3015
|
+
style: {
|
|
3016
|
+
width: 48,
|
|
3017
|
+
height: 48,
|
|
3018
|
+
borderRadius: 8,
|
|
3019
|
+
objectFit: "contain",
|
|
3020
|
+
display: "block"
|
|
3021
|
+
}
|
|
3022
|
+
});
|
|
3023
|
+
};
|
|
3024
|
+
|
|
2983
3025
|
//#endregion
|
|
2984
3026
|
//#region src/components/OAuthConsent/OAuthConsent.tsx
|
|
2985
3027
|
/**
|
|
@@ -3179,6 +3221,8 @@ var ConsentCard = ({
|
|
|
3179
3221
|
*/
|
|
3180
3222
|
var OAuthConsent = ({
|
|
3181
3223
|
clientName,
|
|
3224
|
+
clientLogoUrl,
|
|
3225
|
+
logoUri,
|
|
3182
3226
|
scopes,
|
|
3183
3227
|
onAuthorize,
|
|
3184
3228
|
onAuthorized,
|
|
@@ -3187,6 +3231,7 @@ var OAuthConsent = ({
|
|
|
3187
3231
|
isValidRequest = true,
|
|
3188
3232
|
labels
|
|
3189
3233
|
}) => {
|
|
3234
|
+
const resolvedLogoUrl = logoUri ?? clientLogoUrl;
|
|
3190
3235
|
const [selected, setSelected] = React.useState(() => {
|
|
3191
3236
|
return initSelected(scopes);
|
|
3192
3237
|
});
|
|
@@ -3228,7 +3273,15 @@ var OAuthConsent = ({
|
|
|
3228
3273
|
})]
|
|
3229
3274
|
});
|
|
3230
3275
|
return /* @__PURE__ */jsxs(ConsentCard, {
|
|
3231
|
-
children: [/* @__PURE__ */jsx(
|
|
3276
|
+
children: [resolvedLogoUrl && /* @__PURE__ */jsx(Box, {
|
|
3277
|
+
sx: {
|
|
3278
|
+
marginBottom: 4
|
|
3279
|
+
},
|
|
3280
|
+
children: /* @__PURE__ */jsx(ClientLogo, {
|
|
3281
|
+
src: resolvedLogoUrl,
|
|
3282
|
+
clientName
|
|
3283
|
+
})
|
|
3284
|
+
}), /* @__PURE__ */jsx(Heading, {
|
|
3232
3285
|
as: "h1",
|
|
3233
3286
|
sx: {
|
|
3234
3287
|
fontSize: "3xl",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"description": "React components for ttoss ecosystem.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"React",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"react": "^19.2.6",
|
|
54
54
|
"tsdown": "^0.22.2",
|
|
55
55
|
"tsx": "^4.21.0",
|
|
56
|
-
"@ttoss/
|
|
56
|
+
"@ttoss/react-hooks": "^2.3.20",
|
|
57
57
|
"@ttoss/i18n-cli": "^0.8.17",
|
|
58
|
+
"@ttoss/config": "^1.37.17",
|
|
58
59
|
"@ttoss/react-i18n": "^2.3.0",
|
|
59
60
|
"@ttoss/react-icons": "^0.7.21",
|
|
60
|
-
"@ttoss/react-hooks": "^2.3.20",
|
|
61
61
|
"@ttoss/test-utils": "^4.2.18",
|
|
62
62
|
"@ttoss/ui": "^6.9.28"
|
|
63
63
|
},
|