@ttoss/components 2.16.1 → 2.17.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/dist/index.d.mts CHANGED
@@ -894,7 +894,13 @@ 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; /** Scope tree to render. */
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; /** Scope tree to render. */
898
904
  scopes: ConsentScope[];
899
905
  /**
900
906
  * Called when the user approves. Receives the minimal granted scope set
@@ -958,6 +964,7 @@ declare const collectGrantedScopes: (scopes: ConsentScope[], selected: Set<strin
958
964
  */
959
965
  declare const OAuthConsent: ({
960
966
  clientName,
967
+ clientLogoUrl,
961
968
  scopes,
962
969
  onAuthorize,
963
970
  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,7 @@ var ConsentCard = ({
3179
3221
  */
3180
3222
  var OAuthConsent = ({
3181
3223
  clientName,
3224
+ clientLogoUrl,
3182
3225
  scopes,
3183
3226
  onAuthorize,
3184
3227
  onAuthorized,
@@ -3228,7 +3271,15 @@ var OAuthConsent = ({
3228
3271
  })]
3229
3272
  });
3230
3273
  return /* @__PURE__ */jsxs(ConsentCard, {
3231
- children: [/* @__PURE__ */jsx(Heading, {
3274
+ children: [clientLogoUrl && /* @__PURE__ */jsx(Box, {
3275
+ sx: {
3276
+ marginBottom: 4
3277
+ },
3278
+ children: /* @__PURE__ */jsx(ClientLogo, {
3279
+ src: clientLogoUrl,
3280
+ clientName
3281
+ })
3282
+ }), /* @__PURE__ */jsx(Heading, {
3232
3283
  as: "h1",
3233
3284
  sx: {
3234
3285
  fontSize: "3xl",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/components",
3
- "version": "2.16.1",
3
+ "version": "2.17.0",
4
4
  "description": "React components for ttoss ecosystem.",
5
5
  "keywords": [
6
6
  "React",
@@ -55,18 +55,18 @@
55
55
  "tsx": "^4.21.0",
56
56
  "@ttoss/config": "^1.37.17",
57
57
  "@ttoss/i18n-cli": "^0.8.17",
58
- "@ttoss/react-i18n": "^2.3.0",
59
- "@ttoss/react-icons": "^0.7.21",
60
58
  "@ttoss/react-hooks": "^2.3.20",
59
+ "@ttoss/react-icons": "^0.7.21",
60
+ "@ttoss/react-i18n": "^2.3.0",
61
61
  "@ttoss/test-utils": "^4.2.18",
62
62
  "@ttoss/ui": "^6.9.28"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "react": ">=16.8.0",
66
66
  "@ttoss/react-hooks": "^2.3.20",
67
- "@ttoss/react-i18n": "^2.3.0",
68
67
  "@ttoss/react-icons": "^0.7.21",
69
- "@ttoss/ui": "^6.9.28"
68
+ "@ttoss/ui": "^6.9.28",
69
+ "@ttoss/react-i18n": "^2.3.0"
70
70
  },
71
71
  "publishConfig": {
72
72
  "access": "public",