@pagopa/io-app-design-system 1.44.0 → 1.46.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/lib/commonjs/components/badge/Badge.js +4 -0
- package/lib/commonjs/components/badge/Badge.js.map +1 -1
- package/lib/commonjs/components/badge/__test__/__snapshots__/badge.test.tsx.snap +8 -0
- package/lib/commonjs/components/icons/Icon.js +2 -0
- package/lib/commonjs/components/icons/Icon.js.map +1 -1
- package/lib/commonjs/components/icons/svg/IconSwitchCard.js +32 -0
- package/lib/commonjs/components/icons/svg/IconSwitchCard.js.map +1 -0
- package/lib/commonjs/components/icons/svg/originals/IconSwitchCard.svg +3 -0
- package/lib/commonjs/components/listitems/ListItemInfo.js +5 -7
- package/lib/commonjs/components/listitems/ListItemInfo.js.map +1 -1
- package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +0 -4
- package/lib/commonjs/components/textInput/TextInputBase.js +2 -0
- package/lib/commonjs/components/textInput/TextInputBase.js.map +1 -1
- package/lib/commonjs/components/textInput/TextInputValidation.js +20 -8
- package/lib/commonjs/components/textInput/TextInputValidation.js.map +1 -1
- package/lib/module/components/badge/Badge.js +4 -0
- package/lib/module/components/badge/Badge.js.map +1 -1
- package/lib/module/components/badge/__test__/__snapshots__/badge.test.tsx.snap +8 -0
- package/lib/module/components/icons/Icon.js +2 -0
- package/lib/module/components/icons/Icon.js.map +1 -1
- package/lib/module/components/icons/svg/IconSwitchCard.js +25 -0
- package/lib/module/components/icons/svg/IconSwitchCard.js.map +1 -0
- package/lib/module/components/icons/svg/originals/IconSwitchCard.svg +3 -0
- package/lib/module/components/listitems/ListItemInfo.js +6 -8
- package/lib/module/components/listitems/ListItemInfo.js.map +1 -1
- package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +0 -4
- package/lib/module/components/textInput/TextInputBase.js +2 -0
- package/lib/module/components/textInput/TextInputBase.js.map +1 -1
- package/lib/module/components/textInput/TextInputValidation.js +20 -8
- package/lib/module/components/textInput/TextInputValidation.js.map +1 -1
- package/lib/typescript/components/badge/Badge.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonLink.d.ts +1 -1
- package/lib/typescript/components/buttons/ButtonOutline.d.ts +1 -1
- package/lib/typescript/components/buttons/ButtonSolid.d.ts +1 -1
- package/lib/typescript/components/icons/Icon.d.ts +1 -0
- package/lib/typescript/components/icons/Icon.d.ts.map +1 -1
- package/lib/typescript/components/icons/svg/IconSwitchCard.d.ts +5 -0
- package/lib/typescript/components/icons/svg/IconSwitchCard.d.ts.map +1 -0
- package/lib/typescript/components/listitems/ListItemInfo.d.ts.map +1 -1
- package/lib/typescript/components/textInput/TextInputBase.d.ts +2 -1
- package/lib/typescript/components/textInput/TextInputBase.d.ts.map +1 -1
- package/lib/typescript/components/textInput/TextInputValidation.d.ts +13 -1
- package/lib/typescript/components/textInput/TextInputValidation.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/badge/Badge.tsx +4 -0
- package/src/components/badge/__test__/__snapshots__/badge.test.tsx.snap +8 -0
- package/src/components/icons/Icon.tsx +2 -0
- package/src/components/icons/svg/IconSwitchCard.tsx +22 -0
- package/src/components/icons/svg/originals/IconSwitchCard.svg +3 -0
- package/src/components/listitems/ListItemInfo.tsx +8 -16
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +0 -4
- package/src/components/textInput/TextInputBase.tsx +3 -0
- package/src/components/textInput/TextInputValidation.tsx +37 -11
|
@@ -38,7 +38,7 @@ export declare const ButtonSolid: React.ForwardRefExoticComponent<{
|
|
|
38
38
|
* @default false
|
|
39
39
|
*/
|
|
40
40
|
loading?: boolean | undefined;
|
|
41
|
-
icon?: "code" | "option" | "search" | "key" | "spid" | "cie" | "qrCode" | "bell" | "website" | "abacus" | "home" | "homeFill" | "copy" | "selfCert" | "institution" | "merchant" | "hourglass" | "shareiOs" | "shareAndroid" | "filterOniOS" | "filterOffiOS" | "filterAndroid" | "locked" | "unlocked" | "initiatives" | "analytics" | "fornitori" | "eyeShow" | "eyeHide" | "pinOff" | "pinOn" | "emojiSad" | "emojiHappy" | "phone" | "email" | "emailFill" | "pec" | "messageLegal" | "message" | "chat" | "archive" | "archiveFilled" | "inbox" | "inboxFilled" | "security" | "docGiacenza" | "docPaymentTitle" | "docPaymentCode" | "docAttach" | "docAttachPDF" | "folder" | "receiptOn" | "receiptOff" | "notes" | "attachment" | "print" | "add" | "addSmall" | "success" | "ok" | "fiscalCodeIndividual" | "entityCode" | "creditCard" | "creditCardOff" | "creditCardFilled" | "bonus" | "bonusFilled" | "transactionsBoxed" | "transactions" | "amount" | "psp" | "mapPin" | "locationiOS" | "locationiOSFilled" | "locationAndroid" | "coggle" | "warningFilled" | "notice" | "noticeFilled" | "noticePlain" | "info" | "infoFilled" | "canceled" | "errorFilled" | "legalValue" | "refund" | "reload" | "history" | "edit" | "battery" | "trashcan" | "calendar" | "profile" | "familySharing" | "lightbulb" | "magicWand" | "sparkles" | "starEmpty" | "starFilled" | "starOff" | "heartEmpty" | "heartFilled" | "heartOff" | "switchOff" | "fingerprint" | "touch" | "device" | "deviceVibration" | "contactless" | "signal" | "notification" | "keyboard" | "keyboardDown" | "dotMenu" | "barcode" | "save" | "login" | "logout" | "ladybug" | "tag" | "gallery" | "externalLink" | "externalLinkSmall" | "forward" | "cancel" | "compare" | "instruction" | "terms" | "help" | "accessibility" | "car" | "healthCard" | "chevronRight" | "chevronLeft" | "chevronBottom" | "chevronTop" | "chevronRightListItem" | "closeLarge" | "closeMedium" | "closeSmall" | "arrowBottom" | "arrowLeft" | "arrowTop" | "arrowRight" | "change" | "backiOS" | "backAndroid" | "checkTick" | "checkTickBig" | "read" | "light" | "lightFilled" | "navMessages" | "navMessagesFocused" | "navWallet" | "navWalletFocused" | "navScan" | "navServices" | "navServicesFocused" | "navProfile" | "navProfileFocused" | "navPsp" | "legRadioOn" | "legRadioOff" | "legCheckOn" | "legCheckOff" | "biomFingerprint" | "biomFaceID" | "categCulture" | "categWellness" | "categLearning" | "categSport" | "categHome" | "categTelco" | "categFinance" | "categTravel" | "categMobility" | "categJobOffers" | "categShopping" | "categSustainability" | "productIOApp" | "productPagoPA" | "productIOAppBlueBg" | "systemSettingsAndroid" | "systemSettingsiOS" | "systemToggleInstructions" | "systemAppsAndroid" | "systemNotificationsInstructions" | "systemPermissionsAndroid" | "systemLocationiOS" | "systemPhotosiOS" | "systemPrivacyiOS" | "systemBiometricRecognitionOS" | "systemNFC" | "systemPasswordAndroid" | "systemPasswordiOS" | undefined;
|
|
41
|
+
icon?: "code" | "option" | "search" | "key" | "spid" | "cie" | "qrCode" | "bell" | "website" | "abacus" | "home" | "homeFill" | "copy" | "selfCert" | "institution" | "merchant" | "hourglass" | "shareiOs" | "shareAndroid" | "filterOniOS" | "filterOffiOS" | "filterAndroid" | "locked" | "unlocked" | "initiatives" | "analytics" | "fornitori" | "eyeShow" | "eyeHide" | "pinOff" | "pinOn" | "emojiSad" | "emojiHappy" | "phone" | "email" | "emailFill" | "pec" | "messageLegal" | "message" | "chat" | "archive" | "archiveFilled" | "inbox" | "inboxFilled" | "security" | "docGiacenza" | "docPaymentTitle" | "docPaymentCode" | "docAttach" | "docAttachPDF" | "folder" | "receiptOn" | "receiptOff" | "notes" | "attachment" | "print" | "add" | "addSmall" | "success" | "ok" | "fiscalCodeIndividual" | "entityCode" | "creditCard" | "creditCardOff" | "creditCardFilled" | "bonus" | "bonusFilled" | "transactionsBoxed" | "transactions" | "amount" | "psp" | "mapPin" | "locationiOS" | "locationiOSFilled" | "locationAndroid" | "coggle" | "warningFilled" | "notice" | "noticeFilled" | "noticePlain" | "info" | "infoFilled" | "canceled" | "errorFilled" | "legalValue" | "refund" | "reload" | "history" | "edit" | "battery" | "trashcan" | "calendar" | "profile" | "familySharing" | "lightbulb" | "magicWand" | "sparkles" | "starEmpty" | "starFilled" | "starOff" | "heartEmpty" | "heartFilled" | "heartOff" | "switchOff" | "switchCard" | "fingerprint" | "touch" | "device" | "deviceVibration" | "contactless" | "signal" | "notification" | "keyboard" | "keyboardDown" | "dotMenu" | "barcode" | "save" | "login" | "logout" | "ladybug" | "tag" | "gallery" | "externalLink" | "externalLinkSmall" | "forward" | "cancel" | "compare" | "instruction" | "terms" | "help" | "accessibility" | "car" | "healthCard" | "chevronRight" | "chevronLeft" | "chevronBottom" | "chevronTop" | "chevronRightListItem" | "closeLarge" | "closeMedium" | "closeSmall" | "arrowBottom" | "arrowLeft" | "arrowTop" | "arrowRight" | "change" | "backiOS" | "backAndroid" | "checkTick" | "checkTickBig" | "read" | "light" | "lightFilled" | "navMessages" | "navMessagesFocused" | "navWallet" | "navWalletFocused" | "navScan" | "navServices" | "navServicesFocused" | "navProfile" | "navProfileFocused" | "navPsp" | "legRadioOn" | "legRadioOff" | "legCheckOn" | "legCheckOff" | "biomFingerprint" | "biomFaceID" | "categCulture" | "categWellness" | "categLearning" | "categSport" | "categHome" | "categTelco" | "categFinance" | "categTravel" | "categMobility" | "categJobOffers" | "categShopping" | "categSustainability" | "productIOApp" | "productPagoPA" | "productIOAppBlueBg" | "systemSettingsAndroid" | "systemSettingsiOS" | "systemToggleInstructions" | "systemAppsAndroid" | "systemNotificationsInstructions" | "systemPermissionsAndroid" | "systemLocationiOS" | "systemPhotosiOS" | "systemPrivacyiOS" | "systemBiometricRecognitionOS" | "systemNFC" | "systemPasswordAndroid" | "systemPasswordiOS" | undefined;
|
|
42
42
|
/**
|
|
43
43
|
* @default start
|
|
44
44
|
*/
|
|
@@ -104,6 +104,7 @@ export declare const IOIcons: {
|
|
|
104
104
|
readonly heartFilled: ({ size, style, ...props }: import("./types").SVGIconProps) => React.JSX.Element;
|
|
105
105
|
readonly heartOff: ({ size, style, ...props }: import("./types").SVGIconProps) => React.JSX.Element;
|
|
106
106
|
readonly switchOff: ({ size, style, ...props }: import("./types").SVGIconProps) => React.JSX.Element;
|
|
107
|
+
readonly switchCard: ({ size, style, ...props }: import("./types").SVGIconProps) => React.JSX.Element;
|
|
107
108
|
readonly fingerprint: ({ size, style, ...props }: import("./types").SVGIconProps) => React.JSX.Element;
|
|
108
109
|
readonly touch: ({ size, style, ...props }: import("./types").SVGIconProps) => React.JSX.Element;
|
|
109
110
|
readonly device: ({ size, style, ...props }: import("./types").SVGIconProps) => React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../../src/components/icons/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../../src/components/icons/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAwM/C,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsMV,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,OAAO,CAAC;AAK3C,MAAM,MAAM,eAAe,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAEpE,MAAM,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,OAAO,CAAC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"version":3,"file":"IconSwitchCard.d.ts","sourceRoot":"","sources":["../../../../../src/components/icons/svg/IconSwitchCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAMxC,QAAA,MAAM,cAAc,8BAA+B,YAAY,sBAS9D,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemInfo.d.ts","sourceRoot":"","sources":["../../../../src/components/listitems/ListItemInfo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,cAAc,EAAwB,MAAM,OAAO,CAAC;AAQpE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAmB,OAAO,EAAQ,MAAM,UAAU,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,KAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;CACnD,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;CACnD,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,cAAc,EAAE,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC;CAC9C,CAAC;AAEF,KAAK,eAAe,GAChB,qBAAqB,GACrB,qBAAqB,GACrB,UAAU,CAAC;AAEf,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM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AC;AAEf,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,eAAe,CAAC;IAE7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC,GACA,CACI;IACE,eAAe,CAAC,EAAE,iBAAiB,CAAC;IACpC,IAAI,CAAC,EAAE,KAAK,CAAC;CACd,GACD;IACE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,eAAe,CAAC,EAAE,KAAK,CAAC;CACzB,CACJ,CAAC;AAIJ,eAAO,MAAM,YAAY,mGAStB,YAAY,sBAoGd,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -9,6 +9,7 @@ type InputTextProps = WithTestID<{
|
|
|
9
9
|
value: string;
|
|
10
10
|
onChangeText: (value: string) => void;
|
|
11
11
|
accessibilityLabel?: string;
|
|
12
|
+
accessibilityHint?: string;
|
|
12
13
|
textInputProps?: RNTextInputProps;
|
|
13
14
|
inputType?: InputType;
|
|
14
15
|
status?: InputStatus;
|
|
@@ -23,6 +24,6 @@ type InputTextProps = WithTestID<{
|
|
|
23
24
|
onFocus?: () => void;
|
|
24
25
|
autoFocus?: boolean;
|
|
25
26
|
}>;
|
|
26
|
-
export declare const TextInputBase: ({ disabled, placeholder, value, onChangeText, accessibilityLabel, textInputProps, inputType, status, icon, rightElement, counterLimit, bottomMessage, bottomMessageColor, onBlur, onFocus, isPassword, autoFocus, testID }: InputTextProps) => React.JSX.Element;
|
|
27
|
+
export declare const TextInputBase: ({ disabled, placeholder, value, onChangeText, accessibilityLabel, accessibilityHint, textInputProps, inputType, status, icon, rightElement, counterLimit, bottomMessage, bottomMessageColor, onBlur, onFocus, isPassword, autoFocus, testID }: InputTextProps) => React.JSX.Element;
|
|
27
28
|
export {};
|
|
28
29
|
//# sourceMappingURL=TextInputBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInputBase.d.ts","sourceRoot":"","sources":["../../../../src/components/textInput/TextInputBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAoBvE,OAAO,EACL,QAAQ,EAKT,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAuB,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAmB,OAAO,EAAQ,MAAM,UAAU,CAAC;AAI1D,KAAK,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;AAEhE,KAAK,cAAc,GAAG,UAAU,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAClC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,QAAQ,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC,CAAC;AA0IH,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":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7 +1,19 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { TextInputBase } from "./TextInputBase";
|
|
3
|
+
export type ValidationWithOptions = {
|
|
4
|
+
isValid: boolean;
|
|
5
|
+
errorMessage: string;
|
|
6
|
+
};
|
|
3
7
|
type TextInputValidationProps = Omit<React.ComponentProps<typeof TextInputBase>, "rightElement" | "status" | "bottomMessageColor" | "isPassword"> & {
|
|
4
|
-
|
|
8
|
+
/**
|
|
9
|
+
* This function can return either a `boolean` or a `ValidationWithOptions` object.
|
|
10
|
+
* If a `boolean` is returned and the field is not valid, the value of the errorMessage prop will be displayed/announced.
|
|
11
|
+
* If a `ValidationWithOptions` object is returned and the field is not valid, the value displayed/announced will be the one contained within this object.
|
|
12
|
+
*/
|
|
13
|
+
onValidate: (value: string) => boolean | ValidationWithOptions;
|
|
14
|
+
/**
|
|
15
|
+
* In case of a dynamic `errorMessage`, use the `onValidate` function with a `ValidationWithOptions` object as the return value to ensure that screen readers announce the correct value.
|
|
16
|
+
*/
|
|
5
17
|
errorMessage: string;
|
|
6
18
|
};
|
|
7
19
|
export declare const TextInputValidation: ({ onValidate, errorMessage, value, bottomMessage, onBlur, onFocus, ...props }: TextInputValidationProps) => React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInputValidation.d.ts","sourceRoot":"","sources":["../../../../src/components/textInput/TextInputValidation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,KAAK,wBAAwB,GAAG,IAAI,CAClC,KAAK,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,EAC1C,cAAc,GAAG,QAAQ,GAAG,oBAAoB,GAAG,YAAY,CAChE,GAAG;IACF,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TextInputValidation.d.ts","sourceRoot":"","sources":["../../../../src/components/textInput/TextInputValidation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,MAAM,qBAAqB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E,KAAK,wBAAwB,GAAG,IAAI,CAClC,KAAK,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,EAC1C,cAAc,GAAG,QAAQ,GAAG,oBAAoB,GAAG,YAAY,CAChE,GAAG;IACF;;;;OAIG;IACH,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,qBAAqB,CAAC;IAC/D;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAQF,eAAO,MAAM,mBAAmB,kFAQ7B,wBAAwB,sBA4F1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -164,6 +164,7 @@ export const Badge = ({ text, outline = false, variant, testID }: Badge) => {
|
|
|
164
164
|
|
|
165
165
|
return (
|
|
166
166
|
<View
|
|
167
|
+
accessible={true}
|
|
167
168
|
testID={testID}
|
|
168
169
|
style={[
|
|
169
170
|
styles.badge,
|
|
@@ -178,6 +179,9 @@ export const Badge = ({ text, outline = false, variant, testID }: Badge) => {
|
|
|
178
179
|
]}
|
|
179
180
|
>
|
|
180
181
|
<Text
|
|
182
|
+
accessibilityLabel={text}
|
|
183
|
+
importantForAccessibility="yes"
|
|
184
|
+
accessibilityRole="text"
|
|
181
185
|
numberOfLines={1}
|
|
182
186
|
ellipsizeMode="tail"
|
|
183
187
|
allowFontScaling={isExperimental}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Test Badge Components - Experimental Enabled Badge Snapshot 1`] = `
|
|
4
4
|
<View
|
|
5
|
+
accessible={true}
|
|
5
6
|
style={
|
|
6
7
|
[
|
|
7
8
|
{
|
|
@@ -20,8 +21,11 @@ exports[`Test Badge Components - Experimental Enabled Badge Snapshot 1`] = `
|
|
|
20
21
|
}
|
|
21
22
|
>
|
|
22
23
|
<Text
|
|
24
|
+
accessibilityLabel="text"
|
|
25
|
+
accessibilityRole="text"
|
|
23
26
|
allowFontScaling={true}
|
|
24
27
|
ellipsizeMode="tail"
|
|
28
|
+
importantForAccessibility="yes"
|
|
25
29
|
maxFontSizeMultiplier={1.25}
|
|
26
30
|
numberOfLines={1}
|
|
27
31
|
style={
|
|
@@ -51,6 +55,7 @@ exports[`Test Badge Components - Experimental Enabled Badge Snapshot 1`] = `
|
|
|
51
55
|
|
|
52
56
|
exports[`Test Badge Components Badge Snapshot 1`] = `
|
|
53
57
|
<View
|
|
58
|
+
accessible={true}
|
|
54
59
|
style={
|
|
55
60
|
[
|
|
56
61
|
{
|
|
@@ -69,8 +74,11 @@ exports[`Test Badge Components Badge Snapshot 1`] = `
|
|
|
69
74
|
}
|
|
70
75
|
>
|
|
71
76
|
<Text
|
|
77
|
+
accessibilityLabel="text"
|
|
78
|
+
accessibilityRole="text"
|
|
72
79
|
allowFontScaling={false}
|
|
73
80
|
ellipsizeMode="tail"
|
|
81
|
+
importantForAccessibility="yes"
|
|
74
82
|
maxFontSizeMultiplier={1.25}
|
|
75
83
|
numberOfLines={1}
|
|
76
84
|
style={
|
|
@@ -172,6 +172,7 @@ import IconStarEmpty from "./svg/IconStarEmpty";
|
|
|
172
172
|
import IconStarFilled from "./svg/IconStarFilled";
|
|
173
173
|
import IconStarOff from "./svg/IconStarOff";
|
|
174
174
|
import IconSuccess from "./svg/IconSuccess";
|
|
175
|
+
import IconSwitchCard from "./svg/IconSwitchCard";
|
|
175
176
|
import IconSwitchOff from "./svg/IconSwitchOff";
|
|
176
177
|
import IconSystemAppsAndroid from "./svg/IconSystemAppsAndroid";
|
|
177
178
|
import IconSystemBiometricRecognitionOS from "./svg/IconSystemBiometricRecognitionOS";
|
|
@@ -302,6 +303,7 @@ export const IOIcons = {
|
|
|
302
303
|
heartFilled: IconHeartFilled,
|
|
303
304
|
heartOff: IconHeartOff,
|
|
304
305
|
switchOff: IconSwitchOff,
|
|
306
|
+
switchCard: IconSwitchCard,
|
|
305
307
|
fingerprint: IconFingerprint,
|
|
306
308
|
touch: IconTouch,
|
|
307
309
|
device: IconDevice,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3
|
+
// @ts-ignore (ignore Path unused component)
|
|
4
|
+
import { Path, Svg } from "react-native-svg";
|
|
5
|
+
import { SVGIconProps } from "../types";
|
|
6
|
+
|
|
7
|
+
// The `generateNewIcons.js`s script uses this template to generate
|
|
8
|
+
// the new `Icon…` component. Don't edit this file to avoid
|
|
9
|
+
// adding breaking changes to the process.
|
|
10
|
+
|
|
11
|
+
const IconSwitchCard = ({ size, style, ...props }: SVGIconProps) => (
|
|
12
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" style={style} {...props}>
|
|
13
|
+
<Path
|
|
14
|
+
fillRule="evenodd"
|
|
15
|
+
clipRule="evenodd"
|
|
16
|
+
d="M3.47364 6.80676C3.58714 5.35067 4.61099 4 6.1079 4H17.8904C19.3873 4 20.4112 5.35067 20.5247 6.80676H21.1C22.7027 6.80676 24 8.17682 24 9.86438C24 11.5542 22.7006 12.922 21.1 12.922H20.5352V15.924C20.5352 17.4783 19.4793 19 17.8904 19H6.1079C4.51903 19 3.46313 17.4783 3.46313 15.924V15.0689H5.36002V15.924C5.36002 16.6639 5.82216 17 6.1079 17H17.8904C18.1761 17 18.6383 16.6639 18.6383 15.924V12.922H13.3412V10.922H18.6383V7.07602C18.6383 6.33611 18.1761 6 17.8904 6H6.1079C5.82216 6 5.36002 6.33611 5.36002 7.07602V10.922H8.69395L7.53674 9.70924C7.16523 9.3199 7.16342 8.68673 7.53269 8.29503C7.90196 7.90333 8.50248 7.90142 8.87399 8.29076L11.7193 11.2727C12.0893 11.6604 12.0929 12.2903 11.7274 12.6826L8.9161 15.7007C8.54907 16.0947 7.94857 16.1004 7.57485 15.7135C7.20113 15.3265 7.19571 14.6933 7.56275 14.2993L8.84568 12.922H2.89999C1.29943 12.922 0 11.5542 0 9.86438C0 8.17682 1.29728 6.80676 2.89999 6.80676H3.47364ZM3.46313 8.80676H2.89999C2.34574 8.80676 1.89689 9.28051 1.89689 9.86438C1.89689 10.4488 2.34622 10.922 2.89999 10.922H3.46313V8.80676ZM20.5352 10.922H21.1C21.6538 10.922 22.1031 10.4488 22.1031 9.86438C22.1031 9.28051 21.6543 8.80676 21.1 8.80676H20.5352V10.922Z"
|
|
17
|
+
fill="currentColor"
|
|
18
|
+
/>
|
|
19
|
+
</Svg>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default IconSwitchCard;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.47364 6.80676C3.58714 5.35067 4.61099 4 6.1079 4H17.8904C19.3873 4 20.4112 5.35067 20.5247 6.80676H21.1C22.7027 6.80676 24 8.17682 24 9.86438C24 11.5542 22.7006 12.922 21.1 12.922H20.5352V15.924C20.5352 17.4783 19.4793 19 17.8904 19H6.1079C4.51903 19 3.46313 17.4783 3.46313 15.924V15.0689H5.36002V15.924C5.36002 16.6639 5.82216 17 6.1079 17H17.8904C18.1761 17 18.6383 16.6639 18.6383 15.924V12.922H13.3412V10.922H18.6383V7.07602C18.6383 6.33611 18.1761 6 17.8904 6H6.1079C5.82216 6 5.36002 6.33611 5.36002 7.07602V10.922H8.69395L7.53674 9.70924C7.16523 9.3199 7.16342 8.68673 7.53269 8.29503C7.90196 7.90333 8.50248 7.90142 8.87399 8.29076L11.7193 11.2727C12.0893 11.6604 12.0929 12.2903 11.7274 12.6826L8.9161 15.7007C8.54907 16.0947 7.94857 16.1004 7.57485 15.7135C7.20113 15.3265 7.19571 14.6933 7.56275 14.2993L8.84568 12.922H2.89999C1.29943 12.922 0 11.5542 0 9.86438C0 8.17682 1.29728 6.80676 2.89999 6.80676H3.47364ZM3.46313 8.80676H2.89999C2.34574 8.80676 1.89689 9.28051 1.89689 9.86438C1.89689 10.4488 2.34622 10.922 2.89999 10.922H3.46313V8.80676ZM20.5352 10.922H21.1C21.6538 10.922 22.1031 10.4488 22.1031 9.86438C22.1031 9.28051 21.6543 8.80676 21.1 8.80676H20.5352V10.922Z" fill="#BBC2D6"/>
|
|
3
|
+
</svg>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ComponentProps, useCallback, useMemo } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
2
|
+
import { Platform, View } from "react-native";
|
|
3
3
|
import {
|
|
4
4
|
IOListItemStyles,
|
|
5
5
|
IOListItemVisualParams,
|
|
@@ -81,17 +81,7 @@ export const ListItemInfo = ({
|
|
|
81
81
|
|
|
82
82
|
const itemInfoTextComponent = useMemo(
|
|
83
83
|
() => (
|
|
84
|
-
<View
|
|
85
|
-
accessible={endElement === undefined ? true : false}
|
|
86
|
-
importantForAccessibility={
|
|
87
|
-
endElement !== undefined && endElement.type !== "badge"
|
|
88
|
-
? "no-hide-descendants"
|
|
89
|
-
: "yes"
|
|
90
|
-
}
|
|
91
|
-
accessibilityElementsHidden={
|
|
92
|
-
endElement !== undefined && endElement.type !== "badge"
|
|
93
|
-
}
|
|
94
|
-
>
|
|
84
|
+
<View accessible={Platform.OS === "ios"}>
|
|
95
85
|
<LabelSmall weight="Regular" color={theme["textBody-tertiary"]}>
|
|
96
86
|
{label}
|
|
97
87
|
</LabelSmall>
|
|
@@ -104,7 +94,7 @@ export const ListItemInfo = ({
|
|
|
104
94
|
)}
|
|
105
95
|
</View>
|
|
106
96
|
),
|
|
107
|
-
[label, value, numberOfLines, theme
|
|
97
|
+
[label, value, numberOfLines, theme]
|
|
108
98
|
);
|
|
109
99
|
|
|
110
100
|
const listItemInfoAction = useCallback(() => {
|
|
@@ -113,7 +103,9 @@ export const ListItemInfo = ({
|
|
|
113
103
|
|
|
114
104
|
switch (type) {
|
|
115
105
|
case "buttonLink":
|
|
116
|
-
const buttonLinkAccessibilityLabel = `${
|
|
106
|
+
const buttonLinkAccessibilityLabel = `${
|
|
107
|
+
componentProps.accessibilityLabel ?? componentProps.label
|
|
108
|
+
}`;
|
|
117
109
|
|
|
118
110
|
return (
|
|
119
111
|
<ButtonLink
|
|
@@ -122,7 +114,7 @@ export const ListItemInfo = ({
|
|
|
122
114
|
/>
|
|
123
115
|
);
|
|
124
116
|
case "iconButton":
|
|
125
|
-
const iconButtonAccessibilityLabel = `${
|
|
117
|
+
const iconButtonAccessibilityLabel = `${componentProps.accessibilityLabel}`;
|
|
126
118
|
return (
|
|
127
119
|
<IconButton
|
|
128
120
|
{...componentProps}
|
|
@@ -136,7 +128,7 @@ export const ListItemInfo = ({
|
|
|
136
128
|
}
|
|
137
129
|
}
|
|
138
130
|
return <></>;
|
|
139
|
-
}, [endElement
|
|
131
|
+
}, [endElement]);
|
|
140
132
|
|
|
141
133
|
return (
|
|
142
134
|
<View
|
|
@@ -234,9 +234,7 @@ exports[`Test List Item Components - Experimental Enabled ListItemInfo Snapshot
|
|
|
234
234
|
}
|
|
235
235
|
>
|
|
236
236
|
<View
|
|
237
|
-
accessibilityElementsHidden={false}
|
|
238
237
|
accessible={true}
|
|
239
|
-
importantForAccessibility="yes"
|
|
240
238
|
>
|
|
241
239
|
<Text
|
|
242
240
|
allowFontScaling={true}
|
|
@@ -2065,9 +2063,7 @@ exports[`Test List Item Components ListItemInfo Snapshot 1`] = `
|
|
|
2065
2063
|
}
|
|
2066
2064
|
>
|
|
2067
2065
|
<View
|
|
2068
|
-
accessibilityElementsHidden={false}
|
|
2069
2066
|
accessible={true}
|
|
2070
|
-
importantForAccessibility="yes"
|
|
2071
2067
|
>
|
|
2072
2068
|
<Text
|
|
2073
2069
|
allowFontScaling={false}
|
|
@@ -40,6 +40,7 @@ type InputTextProps = WithTestID<{
|
|
|
40
40
|
value: string;
|
|
41
41
|
onChangeText: (value: string) => void;
|
|
42
42
|
accessibilityLabel?: string;
|
|
43
|
+
accessibilityHint?: string;
|
|
43
44
|
textInputProps?: RNTextInputProps;
|
|
44
45
|
inputType?: InputType;
|
|
45
46
|
status?: InputStatus;
|
|
@@ -197,6 +198,7 @@ export const TextInputBase = ({
|
|
|
197
198
|
value = "",
|
|
198
199
|
onChangeText,
|
|
199
200
|
accessibilityLabel,
|
|
201
|
+
accessibilityHint,
|
|
200
202
|
textInputProps,
|
|
201
203
|
inputType = "default",
|
|
202
204
|
status,
|
|
@@ -392,6 +394,7 @@ export const TextInputBase = ({
|
|
|
392
394
|
disableFullscreenUI={true}
|
|
393
395
|
accessibilityState={{ disabled }}
|
|
394
396
|
accessibilityLabel={accessibilityLabel ?? placeholder}
|
|
397
|
+
accessibilityHint={accessibilityHint}
|
|
395
398
|
selectionColor={IOColors[theme["interactiveElem-default"]]} // Caret on iOS
|
|
396
399
|
cursorColor={IOColors[theme["interactiveElem-default"]]} // Caret Android
|
|
397
400
|
maxLength={counterLimit}
|
|
@@ -11,14 +11,28 @@ import { triggerHaptic } from "../../functions";
|
|
|
11
11
|
import { IOIconSizeScale, IOIcons, Icon } from "../icons";
|
|
12
12
|
import { TextInputBase } from "./TextInputBase";
|
|
13
13
|
|
|
14
|
+
export type ValidationWithOptions = { isValid: boolean; errorMessage: string };
|
|
15
|
+
|
|
14
16
|
type TextInputValidationProps = Omit<
|
|
15
17
|
React.ComponentProps<typeof TextInputBase>,
|
|
16
18
|
"rightElement" | "status" | "bottomMessageColor" | "isPassword"
|
|
17
19
|
> & {
|
|
18
|
-
|
|
20
|
+
/**
|
|
21
|
+
* This function can return either a `boolean` or a `ValidationWithOptions` object.
|
|
22
|
+
* If a `boolean` is returned and the field is not valid, the value of the errorMessage prop will be displayed/announced.
|
|
23
|
+
* If a `ValidationWithOptions` object is returned and the field is not valid, the value displayed/announced will be the one contained within this object.
|
|
24
|
+
*/
|
|
25
|
+
onValidate: (value: string) => boolean | ValidationWithOptions;
|
|
26
|
+
/**
|
|
27
|
+
* In case of a dynamic `errorMessage`, use the `onValidate` function with a `ValidationWithOptions` object as the return value to ensure that screen readers announce the correct value.
|
|
28
|
+
*/
|
|
19
29
|
errorMessage: string;
|
|
20
30
|
};
|
|
21
31
|
|
|
32
|
+
function isValidationWithOptions(validation: boolean | ValidationWithOptions): validation is ValidationWithOptions {
|
|
33
|
+
return typeof validation === 'object' && 'isValid' in validation && 'errorMessage' in validation;
|
|
34
|
+
}
|
|
35
|
+
|
|
22
36
|
const feedbackIconSize: IOIconSizeScale = 24;
|
|
23
37
|
|
|
24
38
|
export const TextInputValidation = ({
|
|
@@ -31,20 +45,32 @@ export const TextInputValidation = ({
|
|
|
31
45
|
...props
|
|
32
46
|
}: TextInputValidationProps) => {
|
|
33
47
|
const [isValid, setIsValid] = useState<boolean | undefined>(undefined);
|
|
48
|
+
const [errMessage, setErrMessage] = useState(errorMessage);
|
|
34
49
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
50
|
+
const getErrorFeedback = useCallback((isValid: boolean, message: string) => {
|
|
51
|
+
setIsValid(isValid);
|
|
52
|
+
setErrMessage(message);
|
|
53
|
+
|
|
54
|
+
if (!isValid) {
|
|
39
55
|
triggerHaptic("notificationError");
|
|
40
|
-
AccessibilityInfo.announceForAccessibilityWithOptions(
|
|
56
|
+
AccessibilityInfo.announceForAccessibilityWithOptions(message, {
|
|
41
57
|
queue: true
|
|
42
58
|
});
|
|
43
59
|
} else {
|
|
44
60
|
triggerHaptic("notificationSuccess");
|
|
45
61
|
}
|
|
62
|
+
}, []);
|
|
63
|
+
|
|
64
|
+
const onBlurHandler = useCallback(() => {
|
|
65
|
+
const validation = onValidate(value);
|
|
66
|
+
|
|
67
|
+
if (isValidationWithOptions(validation)) {
|
|
68
|
+
getErrorFeedback(validation.isValid, validation.errorMessage);
|
|
69
|
+
} else {
|
|
70
|
+
getErrorFeedback(validation, errorMessage);
|
|
71
|
+
}
|
|
46
72
|
onBlur?.();
|
|
47
|
-
}, [
|
|
73
|
+
}, [value, errorMessage, onBlur, onValidate, getErrorFeedback]);
|
|
48
74
|
|
|
49
75
|
const onFocusHandler = useCallback(() => {
|
|
50
76
|
setIsValid(undefined);
|
|
@@ -52,13 +78,13 @@ export const TextInputValidation = ({
|
|
|
52
78
|
}, [onFocus]);
|
|
53
79
|
|
|
54
80
|
const labelError = useMemo(
|
|
55
|
-
() => (isValid === false &&
|
|
56
|
-
[isValid,
|
|
81
|
+
() => (isValid === false && errMessage ? errMessage : bottomMessage),
|
|
82
|
+
[isValid, errMessage, bottomMessage]
|
|
57
83
|
);
|
|
58
84
|
|
|
59
85
|
const labelErrorColor: IOColors | undefined = useMemo(
|
|
60
|
-
() => (isValid === false &&
|
|
61
|
-
[isValid,
|
|
86
|
+
() => (isValid === false && errMessage ? "error-600" : undefined),
|
|
87
|
+
[isValid, errMessage]
|
|
62
88
|
);
|
|
63
89
|
|
|
64
90
|
const feedbackIconAttrMap: Record<
|