@pagopa/io-app-design-system 7.1.0 → 7.2.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/index.js +0 -11
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/textInput/TextInputBase.js +23 -12
- package/lib/commonjs/components/textInput/TextInputBase.js.map +1 -1
- package/lib/commonjs/components/textInput/TextInputValidation.js +6 -2
- package/lib/commonjs/components/textInput/TextInputValidation.js.map +1 -1
- package/lib/module/components/index.js +0 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/textInput/TextInputBase.js +23 -12
- package/lib/module/components/textInput/TextInputBase.js.map +1 -1
- package/lib/module/components/textInput/TextInputValidation.js +7 -3
- package/lib/module/components/textInput/TextInputValidation.js.map +1 -1
- package/lib/typescript/components/index.d.ts +0 -1
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/components/textInput/TextInputBase.d.ts +9 -2
- package/lib/typescript/components/textInput/TextInputBase.d.ts.map +1 -1
- package/lib/typescript/components/textInput/TextInputValidation.d.ts +7 -1
- package/lib/typescript/components/textInput/TextInputValidation.d.ts.map +1 -1
- package/lib/typescript/utils/types.d.ts +2 -0
- package/lib/typescript/utils/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/index.tsx +0 -1
- package/src/components/textInput/TextInputBase.tsx +35 -13
- package/src/components/textInput/TextInputValidation.tsx +17 -5
- package/src/utils/types.ts +5 -1
- package/lib/commonjs/components/claimsSelector/ClaimsSelector.js +0 -167
- package/lib/commonjs/components/claimsSelector/ClaimsSelector.js.map +0 -1
- package/lib/commonjs/components/claimsSelector/__test__/ClaimsSelector.test.js +0 -64
- package/lib/commonjs/components/claimsSelector/__test__/ClaimsSelector.test.js.map +0 -1
- package/lib/commonjs/components/claimsSelector/__test__/__snapshots__/ClaimsSelector.test.tsx.snap +0 -1918
- package/lib/commonjs/components/claimsSelector/index.js +0 -17
- package/lib/commonjs/components/claimsSelector/index.js.map +0 -1
- package/lib/module/components/claimsSelector/ClaimsSelector.js +0 -160
- package/lib/module/components/claimsSelector/ClaimsSelector.js.map +0 -1
- package/lib/module/components/claimsSelector/__test__/ClaimsSelector.test.js +0 -64
- package/lib/module/components/claimsSelector/__test__/ClaimsSelector.test.js.map +0 -1
- package/lib/module/components/claimsSelector/__test__/__snapshots__/ClaimsSelector.test.tsx.snap +0 -1918
- package/lib/module/components/claimsSelector/index.js +0 -4
- package/lib/module/components/claimsSelector/index.js.map +0 -1
- package/lib/typescript/components/claimsSelector/ClaimsSelector.d.ts +0 -48
- package/lib/typescript/components/claimsSelector/ClaimsSelector.d.ts.map +0 -1
- package/lib/typescript/components/claimsSelector/__test__/ClaimsSelector.test.d.ts +0 -2
- package/lib/typescript/components/claimsSelector/__test__/ClaimsSelector.test.d.ts.map +0 -1
- package/lib/typescript/components/claimsSelector/index.d.ts +0 -2
- package/lib/typescript/components/claimsSelector/index.d.ts.map +0 -1
- package/src/components/claimsSelector/ClaimsSelector.tsx +0 -231
- package/src/components/claimsSelector/__test__/ClaimsSelector.test.tsx +0 -72
- package/src/components/claimsSelector/__test__/__snapshots__/ClaimsSelector.test.tsx.snap +0 -1918
- package/src/components/claimsSelector/index.tsx +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import { TextInput } from "react-native";
|
|
2
3
|
import { IOColors } from "../../core";
|
|
3
4
|
import { RNTextInputProps } from "../../utils/textInput";
|
|
4
5
|
import { InputType, WithTestID } from "../../utils/types";
|
|
@@ -16,6 +17,7 @@ type InputTextProps = WithTestID<{
|
|
|
16
17
|
icon?: IOIcons;
|
|
17
18
|
rightElement?: ReactNode;
|
|
18
19
|
counterLimit?: number;
|
|
20
|
+
showCounterOnlyWhenLimitReached?: boolean;
|
|
19
21
|
accessibilityAnnounceLimitReached?: string;
|
|
20
22
|
bottomMessage?: string;
|
|
21
23
|
bottomMessageColor?: IOColors;
|
|
@@ -23,8 +25,13 @@ type InputTextProps = WithTestID<{
|
|
|
23
25
|
isPassword?: boolean;
|
|
24
26
|
onBlur?: () => void;
|
|
25
27
|
onFocus?: () => void;
|
|
26
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Optional external ref to the underlying React Native `TextInput`. When
|
|
30
|
+
* provided, the consumer can imperatively call `focus()` / `blur()` on the
|
|
31
|
+
* input. Useful to work around autoFocus issues on React Navigation v7.
|
|
32
|
+
*/
|
|
33
|
+
inputRef?: React.RefObject<TextInput | null>;
|
|
27
34
|
}>;
|
|
28
|
-
export declare const TextInputBase: ({ disabled, placeholder, value, onChangeText, accessibilityLabel, accessibilityHint, textInputProps, inputType, status, icon, rightElement, counterLimit, accessibilityAnnounceLimitReached, bottomMessage, bottomMessageColor, onBlur, onFocus, isPassword,
|
|
35
|
+
export declare const TextInputBase: ({ disabled, placeholder, value, onChangeText, accessibilityLabel, accessibilityHint, textInputProps, inputType, status, icon, rightElement, counterLimit, showCounterOnlyWhenLimitReached, accessibilityAnnounceLimitReached, bottomMessage, bottomMessageColor, onBlur, onFocus, isPassword, inputRef: externalInputRef, testID }: InputTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
36
|
export {};
|
|
30
37
|
//# 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,EACL,SAAS,EAMV,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TextInputBase.d.ts","sourceRoot":"","sources":["../../../../src/components/textInput/TextInputBase.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EAMV,MAAM,OAAO,CAAC;AACf,OAAO,EAOL,SAAS,EAGV,MAAM,cAAc,CAAC;AAWtB,OAAO,EAAE,QAAQ,EAA6B,MAAM,YAAY,CAAC;AAOjE,OAAO,EAAE,gBAAgB,EAAuB,MAAM,uBAAuB,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
|
7
7
|
};
|
|
8
|
-
type TextInputValidationProps = Omit<ComponentProps<typeof TextInputBase>, "rightElement" | "status" | "bottomMessageColor" | "isPassword"> & {
|
|
8
|
+
type TextInputValidationProps = Omit<ComponentProps<typeof TextInputBase>, "rightElement" | "status" | "bottomMessageColor" | "isPassword" | "ref"> & {
|
|
9
9
|
ref?: Ref<TextInputValidationRefProps>;
|
|
10
|
+
/**
|
|
11
|
+
* If true, the character counter will only be displayed/announced when the counter limit is reached.
|
|
12
|
+
* If false or undefined, the character counter will be displayed/announced whenever the counter is enabled,
|
|
13
|
+
* including before the user starts typing (for example, `0 / limit`).
|
|
14
|
+
*/
|
|
15
|
+
showCounterOnlyWhenLimitReached?: boolean;
|
|
10
16
|
/**
|
|
11
17
|
* This function can return either a `boolean` or a `ValidationWithOptions` object.
|
|
12
18
|
* If a `boolean` is returned and the field is not valid, the value of the errorMessage prop will be displayed/announced.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInputValidation.d.ts","sourceRoot":"","sources":["../../../../src/components/textInput/TextInputValidation.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,GAAG,
|
|
1
|
+
{"version":3,"file":"TextInputValidation.d.ts","sourceRoot":"","sources":["../../../../src/components/textInput/TextInputValidation.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,GAAG,EAMJ,MAAM,OAAO,CAAC;AAUf,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAEhE,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,cAAc,CAAC,OAAO,aAAa,CAAC,EACpC,cAAc,GAAG,QAAQ,GAAG,oBAAoB,GAAG,YAAY,GAAG,KAAK,CACxE,GAA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CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,MAAM,GACxC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GACzC,CAAC,GAAG,CAAC,CAAC;AAEV,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;AAI3D,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,SAAS,GAAG,UAAU,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;AAExC,MAAM,MAAM,2BAA2B,GAAG;IACxC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB,CAAC"}
|
package/package.json
CHANGED
package/src/components/index.tsx
CHANGED
|
@@ -55,6 +55,7 @@ type InputTextProps = WithTestID<{
|
|
|
55
55
|
icon?: IOIcons;
|
|
56
56
|
rightElement?: ReactNode;
|
|
57
57
|
counterLimit?: number;
|
|
58
|
+
showCounterOnlyWhenLimitReached?: boolean;
|
|
58
59
|
accessibilityAnnounceLimitReached?: string;
|
|
59
60
|
bottomMessage?: string;
|
|
60
61
|
bottomMessageColor?: IOColors;
|
|
@@ -62,7 +63,13 @@ type InputTextProps = WithTestID<{
|
|
|
62
63
|
isPassword?: boolean;
|
|
63
64
|
onBlur?: () => void;
|
|
64
65
|
onFocus?: () => void;
|
|
65
|
-
autoFocus?: boolean;
|
|
66
|
+
// autoFocus?: boolean; --- Ignore since this bug is open https://github.com/react-navigation/react-navigation/issues/11643 ---
|
|
67
|
+
/**
|
|
68
|
+
* Optional external ref to the underlying React Native `TextInput`. When
|
|
69
|
+
* provided, the consumer can imperatively call `focus()` / `blur()` on the
|
|
70
|
+
* input. Useful to work around autoFocus issues on React Navigation v7.
|
|
71
|
+
*/
|
|
72
|
+
inputRef?: React.RefObject<TextInput | null>;
|
|
66
73
|
}>;
|
|
67
74
|
|
|
68
75
|
const inputMarginTop: IOSpacingScale = 16;
|
|
@@ -123,6 +130,7 @@ type InputTextHelperRow = Pick<
|
|
|
123
130
|
InputTextProps,
|
|
124
131
|
| "value"
|
|
125
132
|
| "counterLimit"
|
|
133
|
+
| "showCounterOnlyWhenLimitReached"
|
|
126
134
|
| "bottomMessage"
|
|
127
135
|
| "bottomMessageColor"
|
|
128
136
|
| "inputType"
|
|
@@ -132,6 +140,7 @@ type InputTextHelperRow = Pick<
|
|
|
132
140
|
const HelperRow = ({
|
|
133
141
|
value,
|
|
134
142
|
counterLimit,
|
|
143
|
+
showCounterOnlyWhenLimitReached,
|
|
135
144
|
bottomMessage,
|
|
136
145
|
bottomMessageColor,
|
|
137
146
|
inputType,
|
|
@@ -153,13 +162,17 @@ const HelperRow = ({
|
|
|
153
162
|
const bottomMessageColorValue =
|
|
154
163
|
bottomMessageColor ?? bottomMessageColorDefault;
|
|
155
164
|
|
|
165
|
+
const shouldShowCounter =
|
|
166
|
+
!!counterLimit &&
|
|
167
|
+
(!showCounterOnlyWhenLimitReached || valueCount >= counterLimit);
|
|
168
|
+
|
|
156
169
|
const helperRowStyle: ViewStyle = useMemo(() => {
|
|
157
|
-
if (
|
|
170
|
+
if (shouldShowCounter && bottomMessage) {
|
|
158
171
|
return {
|
|
159
172
|
justifyContent: "space-between"
|
|
160
173
|
};
|
|
161
174
|
}
|
|
162
|
-
if (
|
|
175
|
+
if (shouldShowCounter) {
|
|
163
176
|
return {
|
|
164
177
|
justifyContent: "flex-end"
|
|
165
178
|
};
|
|
@@ -170,7 +183,7 @@ const HelperRow = ({
|
|
|
170
183
|
};
|
|
171
184
|
}
|
|
172
185
|
return {};
|
|
173
|
-
}, [
|
|
186
|
+
}, [shouldShowCounter, bottomMessage]);
|
|
174
187
|
|
|
175
188
|
return (
|
|
176
189
|
<View
|
|
@@ -193,7 +206,7 @@ const HelperRow = ({
|
|
|
193
206
|
{bottomMessage}
|
|
194
207
|
</BodySmall>
|
|
195
208
|
)}
|
|
196
|
-
{
|
|
209
|
+
{shouldShowCounter && (
|
|
197
210
|
<BodySmall
|
|
198
211
|
accessibilityLiveRegion="polite"
|
|
199
212
|
weight="Regular"
|
|
@@ -218,16 +231,20 @@ export const TextInputBase = ({
|
|
|
218
231
|
icon,
|
|
219
232
|
rightElement,
|
|
220
233
|
counterLimit,
|
|
234
|
+
showCounterOnlyWhenLimitReached,
|
|
221
235
|
accessibilityAnnounceLimitReached,
|
|
222
236
|
bottomMessage,
|
|
223
237
|
bottomMessageColor,
|
|
224
238
|
onBlur,
|
|
225
239
|
onFocus,
|
|
226
240
|
isPassword,
|
|
227
|
-
autoFocus,
|
|
241
|
+
// autoFocus,
|
|
242
|
+
inputRef: externalInputRef,
|
|
228
243
|
testID
|
|
229
244
|
}: InputTextProps) => {
|
|
230
|
-
const
|
|
245
|
+
const internalInputRef = useRef<TextInput>(null);
|
|
246
|
+
const inputRef = externalInputRef ?? internalInputRef;
|
|
247
|
+
const isSecretInput = useMemo(() => isPassword, [isPassword]);
|
|
231
248
|
const [inputStatus, setInputStatus] = useState<InputStatus>(
|
|
232
249
|
disabled ? "disabled" : "initial"
|
|
233
250
|
);
|
|
@@ -329,7 +346,8 @@ export const TextInputBase = ({
|
|
|
329
346
|
}
|
|
330
347
|
focusedState.value = 1;
|
|
331
348
|
setInputStatus("focused");
|
|
332
|
-
|
|
349
|
+
// This now works again!
|
|
350
|
+
inputRef.current?.focus();
|
|
333
351
|
};
|
|
334
352
|
|
|
335
353
|
const onChangeTextHandler = useCallback(
|
|
@@ -371,9 +389,12 @@ export const TextInputBase = ({
|
|
|
371
389
|
}, [focusedState, onBlur]);
|
|
372
390
|
|
|
373
391
|
const onFocusHandler = () => {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
392
|
+
// Only update if not already focused to prevent redundant layout passes
|
|
393
|
+
if (focusedState.value !== 1) {
|
|
394
|
+
focusedState.value = 1;
|
|
395
|
+
onFocus?.();
|
|
396
|
+
setInputStatus("focused");
|
|
397
|
+
}
|
|
377
398
|
};
|
|
378
399
|
|
|
379
400
|
const derivedInputProps = useMemo(
|
|
@@ -450,7 +471,7 @@ export const TextInputBase = ({
|
|
|
450
471
|
importantForAccessibility="yes"
|
|
451
472
|
accessibilityElementsHidden={false}
|
|
452
473
|
editable={!disabled}
|
|
453
|
-
secureTextEntry={
|
|
474
|
+
secureTextEntry={isSecretInput}
|
|
454
475
|
disableFullscreenUI={true}
|
|
455
476
|
accessibilityState={{ disabled }}
|
|
456
477
|
accessibilityLabel={accessibilityLabel ?? placeholder}
|
|
@@ -478,7 +499,7 @@ export const TextInputBase = ({
|
|
|
478
499
|
? { color: inputTextColor }
|
|
479
500
|
: { color: inputDisabledTextColor }
|
|
480
501
|
]}
|
|
481
|
-
autoFocus={
|
|
502
|
+
autoFocus={false}
|
|
482
503
|
value={inputValue}
|
|
483
504
|
/>
|
|
484
505
|
{/* We translate the label to the right if icon is present
|
|
@@ -556,6 +577,7 @@ export const TextInputBase = ({
|
|
|
556
577
|
bottomMessage={bottomMessage}
|
|
557
578
|
bottomMessageColor={bottomMessageColor}
|
|
558
579
|
counterLimit={counterLimit}
|
|
580
|
+
showCounterOnlyWhenLimitReached={showCounterOnlyWhenLimitReached}
|
|
559
581
|
inputType={inputType}
|
|
560
582
|
textInputProps={textInputProps}
|
|
561
583
|
/>
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
useCallback,
|
|
5
5
|
useImperativeHandle,
|
|
6
6
|
useMemo,
|
|
7
|
+
useRef,
|
|
7
8
|
useState
|
|
8
9
|
} from "react";
|
|
9
|
-
import { AccessibilityInfo, View } from "react-native";
|
|
10
|
+
import { AccessibilityInfo, TextInput, View } from "react-native";
|
|
10
11
|
import Animated from "react-native-reanimated";
|
|
11
|
-
import { TextInputValidationRefProps } from "../../utils/types";
|
|
12
12
|
import { useIOTheme } from "../../context";
|
|
13
13
|
import { IOColors } from "../../core/IOColors";
|
|
14
14
|
import {
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
exitTransitionInputIcon
|
|
17
17
|
} from "../../core/IOTransitions";
|
|
18
18
|
import { triggerHaptic } from "../../functions";
|
|
19
|
+
import { TextInputValidationRefProps } from "../../utils/types";
|
|
19
20
|
import { IOIconSizeScale, IOIcons, Icon } from "../icons";
|
|
20
21
|
import { TextInputBase } from "./TextInputBase";
|
|
21
22
|
|
|
@@ -23,9 +24,15 @@ export type ValidationWithOptions = { isValid: boolean; errorMessage: string };
|
|
|
23
24
|
|
|
24
25
|
type TextInputValidationProps = Omit<
|
|
25
26
|
ComponentProps<typeof TextInputBase>,
|
|
26
|
-
"rightElement" | "status" | "bottomMessageColor" | "isPassword"
|
|
27
|
+
"rightElement" | "status" | "bottomMessageColor" | "isPassword" | "ref"
|
|
27
28
|
> & {
|
|
28
29
|
ref?: Ref<TextInputValidationRefProps>;
|
|
30
|
+
/**
|
|
31
|
+
* If true, the character counter will only be displayed/announced when the counter limit is reached.
|
|
32
|
+
* If false or undefined, the character counter will be displayed/announced whenever the counter is enabled,
|
|
33
|
+
* including before the user starts typing (for example, `0 / limit`).
|
|
34
|
+
*/
|
|
35
|
+
showCounterOnlyWhenLimitReached?: boolean;
|
|
29
36
|
/**
|
|
30
37
|
* This function can return either a `boolean` or a `ValidationWithOptions` object.
|
|
31
38
|
* If a `boolean` is returned and the field is not valid, the value of the errorMessage prop will be displayed/announced.
|
|
@@ -94,6 +101,8 @@ export const TextInputValidation = ({
|
|
|
94
101
|
[accessibilityErrorLabel]
|
|
95
102
|
);
|
|
96
103
|
|
|
104
|
+
const inputRef = useRef<TextInput>(null);
|
|
105
|
+
|
|
97
106
|
const validateInput = useCallback(() => {
|
|
98
107
|
const validation = onValidate(value);
|
|
99
108
|
|
|
@@ -104,9 +113,11 @@ export const TextInputValidation = ({
|
|
|
104
113
|
}
|
|
105
114
|
}, [value, errorMessage, onValidate, getErrorFeedback]);
|
|
106
115
|
|
|
107
|
-
// Expose the validateInput function to the parent component
|
|
116
|
+
// Expose the validateInput function and focus/blur controls to the parent component
|
|
108
117
|
useImperativeHandle(ref, () => ({
|
|
109
|
-
validateInput
|
|
118
|
+
validateInput,
|
|
119
|
+
focus: () => inputRef.current?.focus(),
|
|
120
|
+
blur: () => inputRef.current?.blur()
|
|
110
121
|
}));
|
|
111
122
|
|
|
112
123
|
const onBlurHandler = useCallback(() => {
|
|
@@ -170,6 +181,7 @@ export const TextInputValidation = ({
|
|
|
170
181
|
return (
|
|
171
182
|
<TextInputBase
|
|
172
183
|
{...props}
|
|
184
|
+
inputRef={inputRef}
|
|
173
185
|
value={value}
|
|
174
186
|
status={isValid === false ? "error" : undefined}
|
|
175
187
|
bottomMessage={labelError}
|
package/src/utils/types.ts
CHANGED
|
@@ -45,4 +45,8 @@ export type Nullable<T> = T | null;
|
|
|
45
45
|
*/
|
|
46
46
|
export type Optional<T> = T | undefined;
|
|
47
47
|
|
|
48
|
-
export type TextInputValidationRefProps = {
|
|
48
|
+
export type TextInputValidationRefProps = {
|
|
49
|
+
validateInput: () => void;
|
|
50
|
+
focus: () => void;
|
|
51
|
+
blur: () => void;
|
|
52
|
+
};
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ClaimsSelector = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _reactNativeGestureHandler = require("react-native-gesture-handler");
|
|
10
|
-
var _reactNativeLinearGradient = _interopRequireDefault(require("react-native-linear-gradient"));
|
|
11
|
-
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
12
|
-
var _context = require("../../context");
|
|
13
|
-
var _core = require("../../core");
|
|
14
|
-
var _useAccordionAnimation = require("../../hooks/useAccordionAnimation");
|
|
15
|
-
var _icons = require("../icons");
|
|
16
|
-
var _layout = require("../layout");
|
|
17
|
-
var _listitems = require("../listitems");
|
|
18
|
-
var _typography = require("../typography");
|
|
19
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
21
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
-
const accordionBodySpacing = 16;
|
|
23
|
-
|
|
24
|
-
// Threshold to determine when the accordion is considered fully collapsed
|
|
25
|
-
const COLLAPSED_RADIUS_THRESHOLD = 0.001;
|
|
26
|
-
|
|
27
|
-
// Border width offset to ensure gradient fits within the border curves
|
|
28
|
-
const COLLAPSIBLE_BORDER = 1;
|
|
29
|
-
const ClaimsSelector = ({
|
|
30
|
-
title,
|
|
31
|
-
items,
|
|
32
|
-
defaultExpanded,
|
|
33
|
-
onItemSelected,
|
|
34
|
-
onToggle,
|
|
35
|
-
accessibilityLabel,
|
|
36
|
-
selectedItemIds,
|
|
37
|
-
selectionEnabled = true,
|
|
38
|
-
headerGradientColors
|
|
39
|
-
}) => {
|
|
40
|
-
const theme = (0, _context.useIOTheme)();
|
|
41
|
-
const {
|
|
42
|
-
expanded,
|
|
43
|
-
toggleAccordion,
|
|
44
|
-
onBodyLayout,
|
|
45
|
-
iconAnimatedStyle,
|
|
46
|
-
bodyAnimatedStyle,
|
|
47
|
-
bodyInnerStyle,
|
|
48
|
-
progress
|
|
49
|
-
} = (0, _useAccordionAnimation.useAccordionAnimation)({
|
|
50
|
-
defaultExpanded
|
|
51
|
-
});
|
|
52
|
-
const accordionBackground = theme["appBackground-primary"];
|
|
53
|
-
const accordionBorder = theme["cardBorder-default"];
|
|
54
|
-
const onItemPress = () => {
|
|
55
|
-
toggleAccordion();
|
|
56
|
-
onToggle?.(!expanded);
|
|
57
|
-
};
|
|
58
|
-
const hasHeaderGradient = headerGradientColors && headerGradientColors.length >= 2;
|
|
59
|
-
const headerForegroundColor = hasHeaderGradient ? "black" : theme["textBody-default"];
|
|
60
|
-
const headerRadiusAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
61
|
-
/**
|
|
62
|
-
* Dynamically adjust bottom corner radius based on the expansion progress.
|
|
63
|
-
* Bottom corners are rounded only when the accordion is fully collapsed to
|
|
64
|
-
* ensure visual consistency with the outer container.
|
|
65
|
-
*/
|
|
66
|
-
const bottomRadius = progress.value < COLLAPSED_RADIUS_THRESHOLD ? _core.IOAccordionRadius : 0;
|
|
67
|
-
return {
|
|
68
|
-
borderTopLeftRadius: _core.IOAccordionRadius - COLLAPSIBLE_BORDER,
|
|
69
|
-
borderTopRightRadius: _core.IOAccordionRadius - COLLAPSIBLE_BORDER,
|
|
70
|
-
borderBottomLeftRadius: bottomRadius - COLLAPSIBLE_BORDER,
|
|
71
|
-
borderBottomRightRadius: bottomRadius - COLLAPSIBLE_BORDER,
|
|
72
|
-
overflow: "hidden"
|
|
73
|
-
};
|
|
74
|
-
});
|
|
75
|
-
const renderClaimItem = (item, index) => {
|
|
76
|
-
const {
|
|
77
|
-
id,
|
|
78
|
-
value,
|
|
79
|
-
description,
|
|
80
|
-
type = "text",
|
|
81
|
-
endElement
|
|
82
|
-
} = item;
|
|
83
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
|
|
84
|
-
children: [index !== 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_layout.Divider, {}),
|
|
85
|
-
// We do not support checkbox selection for images, as it is not needed now
|
|
86
|
-
selectionEnabled && type === "text" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_listitems.ListItemCheckbox, {
|
|
87
|
-
value: value,
|
|
88
|
-
description: description,
|
|
89
|
-
selected: selectedItemIds?.includes(id),
|
|
90
|
-
onValueChange: onItemSelected ? selected => onItemSelected(item, selected) : undefined
|
|
91
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_listitems.ListItemInfo, {
|
|
92
|
-
value: type === "image" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
93
|
-
source: {
|
|
94
|
-
uri: value
|
|
95
|
-
},
|
|
96
|
-
style: styles.imageClaim,
|
|
97
|
-
resizeMode: "contain",
|
|
98
|
-
accessibilityIgnoresInvertColors: true
|
|
99
|
-
}) : value,
|
|
100
|
-
label: description,
|
|
101
|
-
accessibilityRole: type,
|
|
102
|
-
reversed: true,
|
|
103
|
-
endElement: endElement
|
|
104
|
-
})]
|
|
105
|
-
}, id);
|
|
106
|
-
};
|
|
107
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
108
|
-
style: [styles.accordionWrapper, {
|
|
109
|
-
backgroundColor: _core.IOColors[accordionBackground],
|
|
110
|
-
borderColor: _core.IOColors[accordionBorder]
|
|
111
|
-
}],
|
|
112
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeGestureHandler.TouchableWithoutFeedback, {
|
|
113
|
-
accessible: true,
|
|
114
|
-
accessibilityRole: "button",
|
|
115
|
-
accessibilityState: {
|
|
116
|
-
expanded
|
|
117
|
-
},
|
|
118
|
-
accessibilityLabel: accessibilityLabel ?? title,
|
|
119
|
-
onPress: onItemPress,
|
|
120
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeReanimated.default.View, {
|
|
121
|
-
style: [styles.textContainer, headerRadiusAnimatedStyle],
|
|
122
|
-
children: [hasHeaderGradient && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeLinearGradient.default, {
|
|
123
|
-
colors: headerGradientColors,
|
|
124
|
-
style: _reactNative.StyleSheet.absoluteFill
|
|
125
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.H6, {
|
|
126
|
-
color: headerForegroundColor,
|
|
127
|
-
children: title
|
|
128
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
129
|
-
style: iconAnimatedStyle,
|
|
130
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
|
|
131
|
-
name: "chevronBottom",
|
|
132
|
-
color: headerForegroundColor
|
|
133
|
-
})
|
|
134
|
-
})]
|
|
135
|
-
})
|
|
136
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
137
|
-
style: bodyAnimatedStyle,
|
|
138
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
139
|
-
style: [bodyInnerStyle, styles.bodyInnerContainer],
|
|
140
|
-
onLayout: onBodyLayout,
|
|
141
|
-
children: items.map(renderClaimItem)
|
|
142
|
-
})
|
|
143
|
-
})]
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
exports.ClaimsSelector = ClaimsSelector;
|
|
147
|
-
const styles = _reactNative.StyleSheet.create({
|
|
148
|
-
accordionWrapper: {
|
|
149
|
-
borderWidth: 1,
|
|
150
|
-
borderRadius: _core.IOAccordionRadius,
|
|
151
|
-
borderCurve: "continuous"
|
|
152
|
-
},
|
|
153
|
-
textContainer: {
|
|
154
|
-
padding: accordionBodySpacing,
|
|
155
|
-
flexDirection: "row",
|
|
156
|
-
alignItems: "center",
|
|
157
|
-
justifyContent: "space-between"
|
|
158
|
-
},
|
|
159
|
-
bodyInnerContainer: {
|
|
160
|
-
width: "100%"
|
|
161
|
-
},
|
|
162
|
-
imageClaim: {
|
|
163
|
-
width: 160,
|
|
164
|
-
aspectRatio: 3 / 4
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
//# sourceMappingURL=ClaimsSelector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_reactNativeGestureHandler","_reactNativeLinearGradient","_interopRequireDefault","_reactNativeReanimated","_interopRequireWildcard","_context","_core","_useAccordionAnimation","_icons","_layout","_listitems","_typography","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","accordionBodySpacing","COLLAPSED_RADIUS_THRESHOLD","COLLAPSIBLE_BORDER","ClaimsSelector","title","items","defaultExpanded","onItemSelected","onToggle","accessibilityLabel","selectedItemIds","selectionEnabled","headerGradientColors","theme","useIOTheme","expanded","toggleAccordion","onBodyLayout","iconAnimatedStyle","bodyAnimatedStyle","bodyInnerStyle","progress","useAccordionAnimation","accordionBackground","accordionBorder","onItemPress","hasHeaderGradient","length","headerForegroundColor","headerRadiusAnimatedStyle","useAnimatedStyle","bottomRadius","value","IOAccordionRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","overflow","renderClaimItem","item","index","id","description","type","endElement","jsxs","Fragment","children","jsx","Divider","ListItemCheckbox","selected","includes","onValueChange","undefined","ListItemInfo","Image","source","uri","style","styles","imageClaim","resizeMode","accessibilityIgnoresInvertColors","label","accessibilityRole","reversed","View","accordionWrapper","backgroundColor","IOColors","borderColor","TouchableWithoutFeedback","accessible","accessibilityState","onPress","textContainer","colors","StyleSheet","absoluteFill","H6","color","Icon","name","bodyInnerContainer","onLayout","map","exports","create","borderWidth","borderRadius","borderCurve","padding","flexDirection","alignItems","justifyContent","width","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EAAE,CAAC,GAAG;EACnB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _reactNative = require("@testing-library/react-native");
|
|
4
|
-
var _ClaimsSelector = require("../ClaimsSelector");
|
|
5
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
-
describe("ClaimsSelector", () => {
|
|
7
|
-
it("ClaimsSelector Snapshot (controlled)", () => {
|
|
8
|
-
const {
|
|
9
|
-
toJSON
|
|
10
|
-
} = (0, _reactNative.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_ClaimsSelector.ClaimsSelector, {
|
|
11
|
-
title: "Patente di guida",
|
|
12
|
-
selectedItemIds: ["name"],
|
|
13
|
-
items: [{
|
|
14
|
-
id: "name",
|
|
15
|
-
value: "Mario Rossi",
|
|
16
|
-
description: "Nome e cognome"
|
|
17
|
-
}]
|
|
18
|
-
}));
|
|
19
|
-
expect(toJSON()).toMatchSnapshot();
|
|
20
|
-
});
|
|
21
|
-
it("ClaimsSelector Snapshot (uncontrolled)", () => {
|
|
22
|
-
const {
|
|
23
|
-
toJSON
|
|
24
|
-
} = (0, _reactNative.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_ClaimsSelector.ClaimsSelector, {
|
|
25
|
-
title: "Patente di guida",
|
|
26
|
-
items: [{
|
|
27
|
-
id: "name",
|
|
28
|
-
value: "Mario Rossi",
|
|
29
|
-
description: "Nome e cognome"
|
|
30
|
-
}]
|
|
31
|
-
}));
|
|
32
|
-
expect(toJSON()).toMatchSnapshot();
|
|
33
|
-
});
|
|
34
|
-
it("ClaimsSelector Snapshot (unselectable items)", () => {
|
|
35
|
-
const {
|
|
36
|
-
toJSON
|
|
37
|
-
} = (0, _reactNative.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_ClaimsSelector.ClaimsSelector, {
|
|
38
|
-
title: "Patente di guida",
|
|
39
|
-
selectionEnabled: false,
|
|
40
|
-
items: [{
|
|
41
|
-
id: "name",
|
|
42
|
-
value: "Mario Rossi",
|
|
43
|
-
description: "Nome e cognome"
|
|
44
|
-
}]
|
|
45
|
-
}));
|
|
46
|
-
expect(toJSON()).toMatchSnapshot();
|
|
47
|
-
});
|
|
48
|
-
it("ClaimsSelector Snapshot (custom component)", () => {
|
|
49
|
-
const {
|
|
50
|
-
toJSON
|
|
51
|
-
} = (0, _reactNative.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_ClaimsSelector.ClaimsSelector, {
|
|
52
|
-
title: "Patente di guida",
|
|
53
|
-
selectionEnabled: false,
|
|
54
|
-
items: [{
|
|
55
|
-
id: "name",
|
|
56
|
-
value: "data:image/png;base64,iVBORw0KGgoAAAANSUh",
|
|
57
|
-
description: "Nome e cognome",
|
|
58
|
-
type: "image"
|
|
59
|
-
}]
|
|
60
|
-
}));
|
|
61
|
-
expect(toJSON()).toMatchSnapshot();
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
//# sourceMappingURL=ClaimsSelector.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_ClaimsSelector","_jsxRuntime","describe","it","toJSON","render","jsx","ClaimsSelector","title","selectedItemIds","items","id","value","description","expect","toMatchSnapshot","selectionEnabled","type"],"sourceRoot":"../../../../../src","sources":["components/claimsSelector/__test__/ClaimsSelector.test.tsx"],"mappings":";;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAAmD,IAAAE,WAAA,GAAAF,OAAA;AAEnDG,QAAQ,CAAC,gBAAgB,EAAE,MAAM;EAC/BC,EAAE,CAAC,sCAAsC,EAAE,MAAM;IAC/C,MAAM;MAAEC;IAAO,CAAC,GAAG,IAAAC,mBAAM,eACvB,IAAAJ,WAAA,CAAAK,GAAA,EAACN,eAAA,CAAAO,cAAc;MACbC,KAAK,EAAC,kBAAkB;MACxBC,eAAe,EAAE,CAAC,MAAM,CA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