@pagopa/io-app-design-system 4.5.5 → 4.6.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/accordion/AccordionItem.js +20 -56
- package/lib/commonjs/components/accordion/AccordionItem.js.map +1 -1
- package/lib/commonjs/components/banner/Banner.js +3 -2
- package/lib/commonjs/components/banner/Banner.js.map +1 -1
- package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +56 -0
- package/lib/commonjs/components/buttons/ButtonLink.js +1 -1
- package/lib/commonjs/components/buttons/ButtonSolid.js +1 -1
- package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/commonjs/components/checkbox/AnimatedCheckbox.js +8 -5
- package/lib/commonjs/components/checkbox/AnimatedCheckbox.js.map +1 -1
- package/lib/commonjs/components/checkbox/AnimatedMessageCheckbox.js +4 -2
- package/lib/commonjs/components/checkbox/AnimatedMessageCheckbox.js.map +1 -1
- package/lib/commonjs/components/claimsSelector/ClaimsSelector.js +119 -0
- package/lib/commonjs/components/claimsSelector/ClaimsSelector.js.map +1 -0
- package/lib/commonjs/components/claimsSelector/__test__/ClaimsSelector.test.js +46 -0
- package/lib/commonjs/components/claimsSelector/__test__/ClaimsSelector.test.js.map +1 -0
- package/lib/commonjs/components/claimsSelector/__test__/__snapshots__/ClaimsSelector.test.tsx.snap +1270 -0
- package/lib/commonjs/components/claimsSelector/index.js +17 -0
- package/lib/commonjs/components/claimsSelector/index.js.map +1 -0
- package/lib/commonjs/components/index.js +11 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemCheckbox.js +1 -1
- package/lib/commonjs/components/listitems/ListItemCheckbox.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemInfo.js +6 -2
- package/lib/commonjs/components/listitems/ListItemInfo.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadio.js +1 -1
- package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemSwitch.js +1 -1
- package/lib/commonjs/components/listitems/ListItemSwitch.js.map +1 -1
- package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +10 -0
- package/lib/commonjs/components/radio/AnimatedRadio.js +8 -5
- package/lib/commonjs/components/radio/AnimatedRadio.js.map +1 -1
- package/lib/commonjs/components/switch/NativeSwitch.js +5 -5
- package/lib/commonjs/components/switch/NativeSwitch.js.map +1 -1
- package/lib/commonjs/components/switch/index.js +0 -22
- package/lib/commonjs/components/switch/index.js.map +1 -1
- package/lib/commonjs/components/textInput/TextInputValidation.js +19 -7
- package/lib/commonjs/components/textInput/TextInputValidation.js.map +1 -1
- package/lib/commonjs/components/typography/markdown/MdH1.js +1 -2
- package/lib/commonjs/components/typography/markdown/MdH1.js.map +1 -1
- package/lib/commonjs/components/typography/markdown/MdH2.js +2 -2
- package/lib/commonjs/components/typography/markdown/MdH2.js.map +1 -1
- package/lib/commonjs/components/typography/markdown/MdH3.js +2 -2
- package/lib/commonjs/components/typography/markdown/MdH3.js.map +1 -1
- package/lib/commonjs/core/IOColors.js +28 -6
- package/lib/commonjs/core/IOColors.js.map +1 -1
- package/lib/commonjs/core/IOStyles.js +2 -16
- package/lib/commonjs/core/IOStyles.js.map +1 -1
- package/lib/commonjs/hooks/useAccordionAnimation.js +83 -0
- package/lib/commonjs/hooks/useAccordionAnimation.js.map +1 -0
- package/lib/module/components/accordion/AccordionItem.js +19 -52
- package/lib/module/components/accordion/AccordionItem.js.map +1 -1
- package/lib/module/components/banner/Banner.js +3 -2
- package/lib/module/components/banner/Banner.js.map +1 -1
- package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +56 -0
- package/lib/module/components/buttons/ButtonLink.js +1 -1
- package/lib/module/components/buttons/ButtonSolid.js +1 -1
- package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/module/components/checkbox/AnimatedCheckbox.js +9 -6
- package/lib/module/components/checkbox/AnimatedCheckbox.js.map +1 -1
- package/lib/module/components/checkbox/AnimatedMessageCheckbox.js +6 -4
- package/lib/module/components/checkbox/AnimatedMessageCheckbox.js.map +1 -1
- package/lib/module/components/claimsSelector/ClaimsSelector.js +109 -0
- package/lib/module/components/claimsSelector/ClaimsSelector.js.map +1 -0
- package/lib/module/components/claimsSelector/__test__/ClaimsSelector.test.js +41 -0
- package/lib/module/components/claimsSelector/__test__/ClaimsSelector.test.js.map +1 -0
- package/lib/module/components/claimsSelector/__test__/__snapshots__/ClaimsSelector.test.tsx.snap +1270 -0
- package/lib/module/components/claimsSelector/index.js +2 -0
- package/lib/module/components/claimsSelector/index.js.map +1 -0
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/listitems/ListItemCheckbox.js +1 -1
- package/lib/module/components/listitems/ListItemCheckbox.js.map +1 -1
- package/lib/module/components/listitems/ListItemInfo.js +6 -2
- package/lib/module/components/listitems/ListItemInfo.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadio.js +1 -1
- package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/module/components/listitems/ListItemSwitch.js +1 -1
- package/lib/module/components/listitems/ListItemSwitch.js.map +1 -1
- package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +10 -0
- package/lib/module/components/radio/AnimatedRadio.js +9 -6
- package/lib/module/components/radio/AnimatedRadio.js.map +1 -1
- package/lib/module/components/switch/NativeSwitch.js +6 -6
- package/lib/module/components/switch/NativeSwitch.js.map +1 -1
- package/lib/module/components/switch/index.js +0 -2
- package/lib/module/components/switch/index.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/module/components/typography/markdown/MdH1.js +1 -2
- package/lib/module/components/typography/markdown/MdH1.js.map +1 -1
- package/lib/module/components/typography/markdown/MdH2.js +2 -2
- package/lib/module/components/typography/markdown/MdH2.js.map +1 -1
- package/lib/module/components/typography/markdown/MdH3.js +2 -2
- package/lib/module/components/typography/markdown/MdH3.js.map +1 -1
- package/lib/module/core/IOColors.js +28 -6
- package/lib/module/core/IOColors.js.map +1 -1
- package/lib/module/core/IOStyles.js +1 -14
- package/lib/module/core/IOStyles.js.map +1 -1
- package/lib/module/hooks/useAccordionAnimation.js +76 -0
- package/lib/module/hooks/useAccordionAnimation.js.map +1 -0
- package/lib/typescript/components/accordion/AccordionItem.d.ts +0 -6
- package/lib/typescript/components/accordion/AccordionItem.d.ts.map +1 -1
- package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
- package/lib/typescript/components/checkbox/AnimatedCheckbox.d.ts.map +1 -1
- package/lib/typescript/components/checkbox/AnimatedMessageCheckbox.d.ts.map +1 -1
- package/lib/typescript/components/claimsSelector/ClaimsSelector.d.ts +42 -0
- package/lib/typescript/components/claimsSelector/ClaimsSelector.d.ts.map +1 -0
- package/lib/typescript/components/claimsSelector/__test__/ClaimsSelector.test.d.ts +2 -0
- package/lib/typescript/components/claimsSelector/__test__/ClaimsSelector.test.d.ts.map +1 -0
- package/lib/typescript/components/claimsSelector/index.d.ts +2 -0
- package/lib/typescript/components/claimsSelector/index.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemInfo.d.ts +2 -1
- package/lib/typescript/components/listitems/ListItemInfo.d.ts.map +1 -1
- package/lib/typescript/components/switch/NativeSwitch.d.ts.map +1 -1
- package/lib/typescript/components/switch/index.d.ts +0 -2
- package/lib/typescript/components/switch/index.d.ts.map +1 -1
- package/lib/typescript/components/textInput/TextInputValidation.d.ts +31 -4
- package/lib/typescript/components/textInput/TextInputValidation.d.ts.map +1 -1
- package/lib/typescript/components/typography/BodyMonospace.d.ts +1 -1
- package/lib/typescript/components/typography/ButtonText.d.ts +1 -1
- package/lib/typescript/components/typography/Caption.d.ts +1 -1
- package/lib/typescript/components/typography/H1.d.ts +1 -1
- package/lib/typescript/components/typography/H2.d.ts +1 -1
- package/lib/typescript/components/typography/H3.d.ts +1 -1
- package/lib/typescript/components/typography/H4.d.ts +1 -1
- package/lib/typescript/components/typography/H5.d.ts +1 -1
- package/lib/typescript/components/typography/H6.d.ts +1 -1
- package/lib/typescript/components/typography/Hero.d.ts +1 -1
- package/lib/typescript/components/typography/markdown/MdH1.d.ts +1 -1
- package/lib/typescript/components/typography/markdown/MdH1.d.ts.map +1 -1
- package/lib/typescript/components/typography/markdown/MdH2.d.ts +1 -1
- package/lib/typescript/components/typography/markdown/MdH3.d.ts +1 -1
- package/lib/typescript/core/IOColors.d.ts +4 -1
- package/lib/typescript/core/IOColors.d.ts.map +1 -1
- package/lib/typescript/core/IOStyles.d.ts +0 -13
- package/lib/typescript/core/IOStyles.d.ts.map +1 -1
- package/lib/typescript/hooks/useAccordionAnimation.d.ts +41 -0
- package/lib/typescript/hooks/useAccordionAnimation.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/accordion/AccordionItem.tsx +21 -82
- package/src/components/banner/Banner.tsx +3 -2
- package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +56 -0
- package/src/components/buttons/ButtonLink.tsx +1 -1
- package/src/components/buttons/ButtonSolid.tsx +1 -1
- package/src/components/checkbox/AnimatedCheckbox.tsx +9 -10
- package/src/components/checkbox/AnimatedMessageCheckbox.tsx +5 -5
- package/src/components/claimsSelector/ClaimsSelector.tsx +185 -0
- package/src/components/claimsSelector/__test__/ClaimsSelector.test.tsx +55 -0
- package/src/components/claimsSelector/__test__/__snapshots__/ClaimsSelector.test.tsx.snap +1270 -0
- package/src/components/claimsSelector/index.tsx +1 -0
- package/src/components/index.tsx +1 -0
- package/src/components/listitems/ListItemCheckbox.tsx +1 -1
- package/src/components/listitems/ListItemInfo.tsx +7 -2
- package/src/components/listitems/ListItemRadio.tsx +1 -1
- package/src/components/listitems/ListItemSwitch.tsx +1 -1
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +10 -0
- package/src/components/radio/AnimatedRadio.tsx +10 -10
- package/src/components/switch/NativeSwitch.tsx +6 -6
- package/src/components/switch/index.tsx +0 -2
- package/src/components/textInput/TextInputValidation.tsx +140 -97
- package/src/components/typography/markdown/MdH1.tsx +1 -2
- package/src/components/typography/markdown/MdH2.tsx +2 -2
- package/src/components/typography/markdown/MdH3.tsx +2 -2
- package/src/core/IOColors.ts +33 -5
- package/src/core/IOStyles.ts +1 -28
- package/src/hooks/useAccordionAnimation.tsx +106 -0
- package/lib/commonjs/components/switch/AnimatedSwitch.js +0 -94
- package/lib/commonjs/components/switch/AnimatedSwitch.js.map +0 -1
- package/lib/commonjs/components/switch/SwitchLabel.js +0 -76
- package/lib/commonjs/components/switch/SwitchLabel.js.map +0 -1
- package/lib/module/components/switch/AnimatedSwitch.js +0 -85
- package/lib/module/components/switch/AnimatedSwitch.js.map +0 -1
- package/lib/module/components/switch/SwitchLabel.js +0 -68
- package/lib/module/components/switch/SwitchLabel.js.map +0 -1
- package/lib/typescript/components/switch/AnimatedSwitch.d.ts +0 -13
- package/lib/typescript/components/switch/AnimatedSwitch.d.ts.map +0 -1
- package/lib/typescript/components/switch/SwitchLabel.d.ts +0 -18
- package/lib/typescript/components/switch/SwitchLabel.d.ts.map +0 -1
- package/src/components/switch/AnimatedSwitch.tsx +0 -126
- package/src/components/switch/SwitchLabel.tsx +0 -80
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { Pressable, View } from "react-native";
|
|
4
|
-
import { useIOTheme } from "../../core";
|
|
5
|
-
import { IOStyles } from "../../core/IOStyles";
|
|
6
|
-
import { triggerHaptic } from "../../functions/haptic-feedback/hapticFeedback";
|
|
7
|
-
import { HSpacer } from "../spacer/Spacer";
|
|
8
|
-
import { H6 } from "../typography/H6";
|
|
9
|
-
import { AnimatedSwitch } from "./AnimatedSwitch";
|
|
10
|
-
|
|
11
|
-
type Props = {
|
|
12
|
-
label: string;
|
|
13
|
-
// dispatch the new value after the checkbox changes state
|
|
14
|
-
onValueChange?: (newValue: boolean) => void;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const DISABLED_OPACITY = 0.5;
|
|
18
|
-
|
|
19
|
-
// disabled: the component is no longer touchable
|
|
20
|
-
// onPress:
|
|
21
|
-
type OwnProps = Props &
|
|
22
|
-
Pick<React.ComponentProps<typeof AnimatedSwitch>, "disabled" | "checked"> &
|
|
23
|
-
Pick<React.ComponentProps<typeof Pressable>, "onPress">;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* A checkbox with the automatic state management that uses a {@link AnimatedCheckBox}
|
|
27
|
-
* The toggleValue change when a `onPress` event is received and dispatch the `onValueChange`.
|
|
28
|
-
*
|
|
29
|
-
* @param props
|
|
30
|
-
* @constructor
|
|
31
|
-
*/
|
|
32
|
-
export const SwitchLabel = ({
|
|
33
|
-
label,
|
|
34
|
-
checked,
|
|
35
|
-
disabled,
|
|
36
|
-
onValueChange
|
|
37
|
-
}: OwnProps) => {
|
|
38
|
-
const theme = useIOTheme();
|
|
39
|
-
const [toggleValue, setToggleValue] = useState(checked ?? false);
|
|
40
|
-
|
|
41
|
-
const toggleCheckbox = () => {
|
|
42
|
-
triggerHaptic("impactLight");
|
|
43
|
-
setToggleValue(!toggleValue);
|
|
44
|
-
if (onValueChange !== undefined) {
|
|
45
|
-
onValueChange(!toggleValue);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<Pressable
|
|
51
|
-
disabled={disabled}
|
|
52
|
-
onPress={toggleCheckbox}
|
|
53
|
-
accessibilityRole="switch"
|
|
54
|
-
accessibilityState={{
|
|
55
|
-
checked: checked ?? toggleValue,
|
|
56
|
-
disabled: !!disabled
|
|
57
|
-
}}
|
|
58
|
-
style={{
|
|
59
|
-
alignSelf: "flex-start",
|
|
60
|
-
opacity: disabled ? DISABLED_OPACITY : 1
|
|
61
|
-
}}
|
|
62
|
-
testID="SwitchLabel"
|
|
63
|
-
>
|
|
64
|
-
<View
|
|
65
|
-
style={[
|
|
66
|
-
IOStyles.row,
|
|
67
|
-
{ alignItems: "flex-start", flexShrink: 1, width: "100%" }
|
|
68
|
-
]}
|
|
69
|
-
>
|
|
70
|
-
<View pointerEvents="none">
|
|
71
|
-
<AnimatedSwitch checked={checked ?? toggleValue} />
|
|
72
|
-
</View>
|
|
73
|
-
<HSpacer size={8} />
|
|
74
|
-
<H6 style={{ flexShrink: 1 }} color={theme["textBody-default"]}>
|
|
75
|
-
{label}
|
|
76
|
-
</H6>
|
|
77
|
-
</View>
|
|
78
|
-
</Pressable>
|
|
79
|
-
);
|
|
80
|
-
};
|