@ttoss/components 2.17.0 → 2.19.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 +8 -1
- package/dist/index.mjs +78 -17
- package/package.json +12 -12
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -900,7 +900,13 @@ type OAuthConsentProps = {
|
|
|
900
900
|
* the consent heading. Falls back to the first letter of `clientName` if the
|
|
901
901
|
* image fails to load. When omitted, no logo is shown (backward-compatible).
|
|
902
902
|
*/
|
|
903
|
-
clientLogoUrl?: string;
|
|
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. */
|
|
904
910
|
scopes: ConsentScope[];
|
|
905
911
|
/**
|
|
906
912
|
* Called when the user approves. Receives the minimal granted scope set
|
|
@@ -965,6 +971,7 @@ declare const collectGrantedScopes: (scopes: ConsentScope[], selected: Set<strin
|
|
|
965
971
|
declare const OAuthConsent: ({
|
|
966
972
|
clientName,
|
|
967
973
|
clientLogoUrl,
|
|
974
|
+
logoUri,
|
|
968
975
|
scopes,
|
|
969
976
|
onAuthorize,
|
|
970
977
|
onAuthorized,
|
package/dist/index.mjs
CHANGED
|
@@ -1186,9 +1186,28 @@ var FileUploader = ({
|
|
|
1186
1186
|
|
|
1187
1187
|
//#endregion
|
|
1188
1188
|
//#region src/components/InstallPwa/InstallPwa.tsx
|
|
1189
|
+
var messages$3 = defineMessages({
|
|
1190
|
+
prompt: {
|
|
1191
|
+
id: "d/l4Zg",
|
|
1192
|
+
defaultMessage: [{
|
|
1193
|
+
"type": 0,
|
|
1194
|
+
"value": "Deseja instalar o nosso aplicativo?"
|
|
1195
|
+
}]
|
|
1196
|
+
},
|
|
1197
|
+
install: {
|
|
1198
|
+
id: "rmaMPX",
|
|
1199
|
+
defaultMessage: [{
|
|
1200
|
+
"type": 0,
|
|
1201
|
+
"value": "Instalar"
|
|
1202
|
+
}]
|
|
1203
|
+
}
|
|
1204
|
+
});
|
|
1189
1205
|
var InstallPwaUi = ({
|
|
1190
1206
|
onInstall
|
|
1191
1207
|
}) => {
|
|
1208
|
+
const {
|
|
1209
|
+
intl
|
|
1210
|
+
} = useI18n();
|
|
1192
1211
|
return /* @__PURE__ */jsx(Flex, {
|
|
1193
1212
|
sx: {
|
|
1194
1213
|
position: "absolute",
|
|
@@ -1209,10 +1228,10 @@ var InstallPwaUi = ({
|
|
|
1209
1228
|
padding: 4
|
|
1210
1229
|
},
|
|
1211
1230
|
children: [/* @__PURE__ */jsx(Text, {
|
|
1212
|
-
children:
|
|
1231
|
+
children: intl.formatMessage(messages$3.prompt)
|
|
1213
1232
|
}), /* @__PURE__ */jsx(Button, {
|
|
1214
1233
|
onClick: onInstall,
|
|
1215
|
-
children:
|
|
1234
|
+
children: intl.formatMessage(messages$3.install)
|
|
1216
1235
|
})]
|
|
1217
1236
|
})
|
|
1218
1237
|
});
|
|
@@ -1800,7 +1819,7 @@ var Menu = ({
|
|
|
1800
1819
|
|
|
1801
1820
|
//#endregion
|
|
1802
1821
|
//#region src/components/MetricCard/MetricCard.tsx
|
|
1803
|
-
var messages = defineMessages({
|
|
1822
|
+
var messages$2 = defineMessages({
|
|
1804
1823
|
ofMax: {
|
|
1805
1824
|
id: "oYpm71",
|
|
1806
1825
|
defaultMessage: [{
|
|
@@ -1984,7 +2003,7 @@ var PercentageMetricContent = ({
|
|
|
1984
2003
|
});
|
|
1985
2004
|
const showAlert = percentage !== null && metric.showAlertThreshold !== void 0 && percentage >= metric.showAlertThreshold;
|
|
1986
2005
|
const isOverLimit = percentage !== null && percentage >= 100;
|
|
1987
|
-
const maxText = metric.max !== null ? formatValue(metric.max) : intl.formatMessage(messages.infinity);
|
|
2006
|
+
const maxText = metric.max !== null ? formatValue(metric.max) : intl.formatMessage(messages$2.infinity);
|
|
1988
2007
|
return /* @__PURE__ */jsxs(Fragment, {
|
|
1989
2008
|
children: [/* @__PURE__ */jsxs(Flex, {
|
|
1990
2009
|
sx: {
|
|
@@ -2004,7 +2023,7 @@ var PercentageMetricContent = ({
|
|
|
2004
2023
|
fontSize: "sm",
|
|
2005
2024
|
color: "display.text.secondary.default"
|
|
2006
2025
|
},
|
|
2007
|
-
children: intl.formatMessage(messages.ofMax, {
|
|
2026
|
+
children: intl.formatMessage(messages$2.ofMax, {
|
|
2008
2027
|
max: maxText
|
|
2009
2028
|
})
|
|
2010
2029
|
})]
|
|
@@ -2035,9 +2054,9 @@ var PercentageMetricContent = ({
|
|
|
2035
2054
|
sx: {
|
|
2036
2055
|
color: "display.text.secondary.default"
|
|
2037
2056
|
},
|
|
2038
|
-
children: percentage !== null ? intl.formatMessage(messages.percentageUsed, {
|
|
2057
|
+
children: percentage !== null ? intl.formatMessage(messages$2.percentageUsed, {
|
|
2039
2058
|
percentage
|
|
2040
|
-
}) : intl.formatMessage(messages.unlimited)
|
|
2059
|
+
}) : intl.formatMessage(messages$2.unlimited)
|
|
2041
2060
|
}), showAlert && !isOverLimit && /* @__PURE__ */jsxs(Flex, {
|
|
2042
2061
|
sx: {
|
|
2043
2062
|
alignItems: "center",
|
|
@@ -2050,7 +2069,7 @@ var PercentageMetricContent = ({
|
|
|
2050
2069
|
sx: {
|
|
2051
2070
|
fontWeight: "medium"
|
|
2052
2071
|
},
|
|
2053
|
-
children: intl.formatMessage(messages.nearLimit)
|
|
2072
|
+
children: intl.formatMessage(messages$2.nearLimit)
|
|
2054
2073
|
})]
|
|
2055
2074
|
}), showAlert && isOverLimit && /* @__PURE__ */jsxs(Flex, {
|
|
2056
2075
|
sx: {
|
|
@@ -2065,7 +2084,7 @@ var PercentageMetricContent = ({
|
|
|
2065
2084
|
fontWeight: "medium",
|
|
2066
2085
|
color: "feedback.text.negative.default"
|
|
2067
2086
|
},
|
|
2068
|
-
children: intl.formatMessage(messages.reachedLimit)
|
|
2087
|
+
children: intl.formatMessage(messages$2.reachedLimit)
|
|
2069
2088
|
})]
|
|
2070
2089
|
})]
|
|
2071
2090
|
})]
|
|
@@ -2083,7 +2102,7 @@ var NumberMetricContent = ({
|
|
|
2083
2102
|
const formatValue = metric.formatValue || (val => {
|
|
2084
2103
|
return val.toString();
|
|
2085
2104
|
});
|
|
2086
|
-
const maxText = metric.max !== null ? formatValue(metric.max) : intl.formatMessage(messages.infinity);
|
|
2105
|
+
const maxText = metric.max !== null ? formatValue(metric.max) : intl.formatMessage(messages$2.infinity);
|
|
2087
2106
|
return /* @__PURE__ */jsxs(Fragment, {
|
|
2088
2107
|
children: [/* @__PURE__ */jsxs(Flex, {
|
|
2089
2108
|
sx: {
|
|
@@ -2102,7 +2121,7 @@ var NumberMetricContent = ({
|
|
|
2102
2121
|
fontSize: "sm",
|
|
2103
2122
|
color: "display.text.secondary.default"
|
|
2104
2123
|
},
|
|
2105
|
-
children: intl.formatMessage(messages.ofMax, {
|
|
2124
|
+
children: intl.formatMessage(messages$2.ofMax, {
|
|
2106
2125
|
max: maxText
|
|
2107
2126
|
})
|
|
2108
2127
|
})]
|
|
@@ -2775,6 +2794,26 @@ var NotificationCard = props => {
|
|
|
2775
2794
|
|
|
2776
2795
|
//#endregion
|
|
2777
2796
|
//#region src/components/NotificationsMenu/NotificationsMenu.tsx
|
|
2797
|
+
var messages$1 = defineMessages({
|
|
2798
|
+
clearAll: {
|
|
2799
|
+
id: "TqUkps",
|
|
2800
|
+
defaultMessage: [{
|
|
2801
|
+
"type": 0,
|
|
2802
|
+
"value": "Limpar Tudo"
|
|
2803
|
+
}]
|
|
2804
|
+
},
|
|
2805
|
+
empty: {
|
|
2806
|
+
id: "fcbTJg",
|
|
2807
|
+
defaultMessage: [{
|
|
2808
|
+
"type": 0,
|
|
2809
|
+
"value": "Nenhuma notificação"
|
|
2810
|
+
}]
|
|
2811
|
+
}
|
|
2812
|
+
});
|
|
2813
|
+
/** Caps the unread badge at 99+. A formatted number, not translatable copy. */
|
|
2814
|
+
var formatBadgeCount = count => {
|
|
2815
|
+
return count > 99 ? "99+" : String(count);
|
|
2816
|
+
};
|
|
2778
2817
|
var NotificationsMenu = ({
|
|
2779
2818
|
notifications,
|
|
2780
2819
|
defaultOpen = false,
|
|
@@ -2785,6 +2824,9 @@ var NotificationsMenu = ({
|
|
|
2785
2824
|
onClose,
|
|
2786
2825
|
onClearAll
|
|
2787
2826
|
}) => {
|
|
2827
|
+
const {
|
|
2828
|
+
intl
|
|
2829
|
+
} = useI18n();
|
|
2788
2830
|
const [isOpen, setIsOpen] = React.useState(defaultOpen);
|
|
2789
2831
|
const [openToLeft, setOpenToLeft] = React.useState(false);
|
|
2790
2832
|
const buttonRef = React.useRef(null);
|
|
@@ -2883,7 +2925,7 @@ var NotificationsMenu = ({
|
|
|
2883
2925
|
justifyContent: "center",
|
|
2884
2926
|
lineHeight: 1
|
|
2885
2927
|
},
|
|
2886
|
-
children: count
|
|
2928
|
+
children: formatBadgeCount(count)
|
|
2887
2929
|
})]
|
|
2888
2930
|
}), isOpen && /* @__PURE__ */jsx("div", {
|
|
2889
2931
|
ref: containerRef,
|
|
@@ -2948,7 +2990,7 @@ var NotificationsMenu = ({
|
|
|
2948
2990
|
marginTop: -.4,
|
|
2949
2991
|
fontSize: "sm"
|
|
2950
2992
|
},
|
|
2951
|
-
children:
|
|
2993
|
+
children: intl.formatMessage(messages$1.clearAll)
|
|
2952
2994
|
})]
|
|
2953
2995
|
})
|
|
2954
2996
|
}), notifications.length === 0 ? /* @__PURE__ */jsx(Text, {
|
|
@@ -2957,7 +2999,7 @@ var NotificationsMenu = ({
|
|
|
2957
2999
|
textAlign: "center",
|
|
2958
3000
|
p: 4
|
|
2959
3001
|
},
|
|
2960
|
-
children:
|
|
3002
|
+
children: intl.formatMessage(messages$1.empty)
|
|
2961
3003
|
}) : notifications.map(notification => {
|
|
2962
3004
|
return /* @__PURE__ */jsx(NotificationCard, {
|
|
2963
3005
|
...notification,
|
|
@@ -2982,10 +3024,25 @@ var NotificationsMenu = ({
|
|
|
2982
3024
|
|
|
2983
3025
|
//#endregion
|
|
2984
3026
|
//#region src/components/OAuthConsent/ClientLogo.tsx
|
|
3027
|
+
var messages = defineMessages({
|
|
3028
|
+
logoAlt: {
|
|
3029
|
+
id: "dx4ZnR",
|
|
3030
|
+
defaultMessage: [{
|
|
3031
|
+
"type": 1,
|
|
3032
|
+
"value": "name"
|
|
3033
|
+
}, {
|
|
3034
|
+
"type": 0,
|
|
3035
|
+
"value": " logo"
|
|
3036
|
+
}]
|
|
3037
|
+
}
|
|
3038
|
+
});
|
|
2985
3039
|
var ClientLogo = ({
|
|
2986
3040
|
src,
|
|
2987
3041
|
clientName
|
|
2988
3042
|
}) => {
|
|
3043
|
+
const {
|
|
3044
|
+
intl
|
|
3045
|
+
} = useI18n();
|
|
2989
3046
|
const [errored, setErrored] = React.useState(false);
|
|
2990
3047
|
if (errored) return /* @__PURE__ */jsx(Flex, {
|
|
2991
3048
|
"aria-hidden": "true",
|
|
@@ -3008,7 +3065,9 @@ var ClientLogo = ({
|
|
|
3008
3065
|
});
|
|
3009
3066
|
return /* @__PURE__ */jsx("img", {
|
|
3010
3067
|
src,
|
|
3011
|
-
alt:
|
|
3068
|
+
alt: intl.formatMessage(messages.logoAlt, {
|
|
3069
|
+
name: clientName
|
|
3070
|
+
}),
|
|
3012
3071
|
onError: () => {
|
|
3013
3072
|
return setErrored(true);
|
|
3014
3073
|
},
|
|
@@ -3222,6 +3281,7 @@ var ConsentCard = ({
|
|
|
3222
3281
|
var OAuthConsent = ({
|
|
3223
3282
|
clientName,
|
|
3224
3283
|
clientLogoUrl,
|
|
3284
|
+
logoUri,
|
|
3225
3285
|
scopes,
|
|
3226
3286
|
onAuthorize,
|
|
3227
3287
|
onAuthorized,
|
|
@@ -3230,6 +3290,7 @@ var OAuthConsent = ({
|
|
|
3230
3290
|
isValidRequest = true,
|
|
3231
3291
|
labels
|
|
3232
3292
|
}) => {
|
|
3293
|
+
const resolvedLogoUrl = logoUri ?? clientLogoUrl;
|
|
3233
3294
|
const [selected, setSelected] = React.useState(() => {
|
|
3234
3295
|
return initSelected(scopes);
|
|
3235
3296
|
});
|
|
@@ -3271,12 +3332,12 @@ var OAuthConsent = ({
|
|
|
3271
3332
|
})]
|
|
3272
3333
|
});
|
|
3273
3334
|
return /* @__PURE__ */jsxs(ConsentCard, {
|
|
3274
|
-
children: [
|
|
3335
|
+
children: [resolvedLogoUrl && /* @__PURE__ */jsx(Box, {
|
|
3275
3336
|
sx: {
|
|
3276
3337
|
marginBottom: 4
|
|
3277
3338
|
},
|
|
3278
3339
|
children: /* @__PURE__ */jsx(ClientLogo, {
|
|
3279
|
-
src:
|
|
3340
|
+
src: resolvedLogoUrl,
|
|
3280
3341
|
clientName
|
|
3281
3342
|
})
|
|
3282
3343
|
}), /* @__PURE__ */jsx(Heading, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0",
|
|
4
4
|
"description": "React components for ttoss ecosystem.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"React",
|
|
@@ -53,20 +53,20 @@
|
|
|
53
53
|
"react": "^19.2.6",
|
|
54
54
|
"tsdown": "^0.22.2",
|
|
55
55
|
"tsx": "^4.21.0",
|
|
56
|
-
"@ttoss/config": "^1.
|
|
57
|
-
"@ttoss/i18n
|
|
58
|
-
"@ttoss/
|
|
59
|
-
"@ttoss/react-icons": "^0.
|
|
60
|
-
"@ttoss/react-
|
|
61
|
-
"@ttoss/
|
|
62
|
-
"@ttoss/
|
|
56
|
+
"@ttoss/config": "^1.38.0",
|
|
57
|
+
"@ttoss/react-i18n": "^2.3.1",
|
|
58
|
+
"@ttoss/i18n-cli": "^0.9.0",
|
|
59
|
+
"@ttoss/react-icons": "^0.8.0",
|
|
60
|
+
"@ttoss/react-hooks": "^2.3.21",
|
|
61
|
+
"@ttoss/ui": "^6.9.29",
|
|
62
|
+
"@ttoss/test-utils": "^4.2.19"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"react": ">=16.8.0",
|
|
66
|
-
"@ttoss/react-hooks": "^2.3.
|
|
67
|
-
"@ttoss/react-icons": "^0.
|
|
68
|
-
"@ttoss/ui": "^6.9.
|
|
69
|
-
"@ttoss/react-i18n": "^2.3.
|
|
66
|
+
"@ttoss/react-hooks": "^2.3.21",
|
|
67
|
+
"@ttoss/react-icons": "^0.8.0",
|
|
68
|
+
"@ttoss/ui": "^6.9.29",
|
|
69
|
+
"@ttoss/react-i18n": "^2.3.1"
|
|
70
70
|
},
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public",
|