@pagopa/io-app-design-system 4.2.1 → 4.3.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/alert/Alert.js +10 -31
- package/lib/commonjs/components/alert/Alert.js.map +1 -1
- package/lib/commonjs/components/alert/AlertEdgeToEdge.js +9 -29
- package/lib/commonjs/components/alert/AlertEdgeToEdge.js.map +1 -1
- package/lib/commonjs/components/banner/Banner.js +10 -34
- package/lib/commonjs/components/banner/Banner.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonLink.js +20 -53
- package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonOutline.js +24 -44
- package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonSolid.js +14 -39
- package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButton.js +13 -32
- package/lib/commonjs/components/buttons/IconButton.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButtonContained.js +19 -42
- package/lib/commonjs/components/buttons/IconButtonContained.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButtonSolid.js +15 -31
- package/lib/commonjs/components/buttons/IconButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +34 -10
- package/lib/commonjs/components/layout/index.js +0 -11
- package/lib/commonjs/components/layout/index.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemAction.js +14 -40
- package/lib/commonjs/components/listitems/ListItemAction.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemCheckbox.js +13 -41
- package/lib/commonjs/components/listitems/ListItemCheckbox.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemHeader.js +2 -2
- package/lib/commonjs/components/listitems/ListItemHeader.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js +15 -43
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemNav.js +17 -48
- package/lib/commonjs/components/listitems/ListItemNav.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemNavAlert.js +19 -50
- package/lib/commonjs/components/listitems/ListItemNavAlert.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadio.js +20 -50
- package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js +2 -2
- package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemTransaction.js +2 -2
- package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/commonjs/components/listitems/{PressableListItemsBase.js → PressableListItemBase.js} +7 -7
- package/lib/commonjs/components/listitems/PressableListItemBase.js.map +1 -0
- package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +13 -7
- package/lib/commonjs/components/listitems/__test__/listitem.test.js +3 -3
- package/lib/commonjs/components/listitems/__test__/listitem.test.js.map +1 -1
- package/lib/commonjs/components/listitems/index.js +11 -11
- package/lib/commonjs/components/listitems/index.js.map +1 -1
- package/lib/commonjs/components/modules/PressableModuleBase.js +17 -11
- package/lib/commonjs/components/modules/PressableModuleBase.js.map +1 -1
- package/lib/commonjs/components/modules/index.js +8 -8
- package/lib/commonjs/components/modules/index.js.map +1 -1
- package/lib/commonjs/components/numberpad/NumberButton.js +12 -28
- package/lib/commonjs/components/numberpad/NumberButton.js.map +1 -1
- package/lib/commonjs/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +20 -0
- package/lib/commonjs/components/tabs/TabItem.js +15 -21
- package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
- package/lib/commonjs/core/IOAnimations.js +6 -12
- package/lib/commonjs/core/IOAnimations.js.map +1 -1
- package/lib/commonjs/hooks/index.js +28 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/useListItemAnimation.js +40 -0
- package/lib/commonjs/hooks/useListItemAnimation.js.map +1 -0
- package/lib/commonjs/hooks/useScaleAnimation.js +36 -0
- package/lib/commonjs/hooks/useScaleAnimation.js.map +1 -0
- package/lib/commonjs/index.js +11 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/hooks/index.js +28 -0
- package/lib/commonjs/utils/hooks/index.js.map +1 -0
- package/lib/commonjs/utils/hooks/useSpringPressProgressValue.js +5 -7
- package/lib/commonjs/utils/hooks/useSpringPressProgressValue.js.map +1 -1
- package/lib/module/components/alert/Alert.js +10 -32
- package/lib/module/components/alert/Alert.js.map +1 -1
- package/lib/module/components/alert/AlertEdgeToEdge.js +10 -31
- package/lib/module/components/alert/AlertEdgeToEdge.js.map +1 -1
- package/lib/module/components/banner/Banner.js +10 -33
- package/lib/module/components/banner/Banner.js.map +1 -1
- package/lib/module/components/buttons/ButtonLink.js +23 -56
- package/lib/module/components/buttons/ButtonLink.js.map +1 -1
- package/lib/module/components/buttons/ButtonOutline.js +27 -47
- package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/module/components/buttons/ButtonSolid.js +17 -42
- package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/IconButton.js +16 -35
- package/lib/module/components/buttons/IconButton.js.map +1 -1
- package/lib/module/components/buttons/IconButtonContained.js +21 -45
- package/lib/module/components/buttons/IconButtonContained.js.map +1 -1
- package/lib/module/components/buttons/IconButtonSolid.js +17 -34
- package/lib/module/components/buttons/IconButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +34 -10
- package/lib/module/components/layout/index.js +0 -1
- package/lib/module/components/layout/index.js.map +1 -1
- package/lib/module/components/listitems/ListItemAction.js +15 -42
- package/lib/module/components/listitems/ListItemAction.js.map +1 -1
- package/lib/module/components/listitems/ListItemCheckbox.js +15 -43
- package/lib/module/components/listitems/ListItemCheckbox.js.map +1 -1
- package/lib/module/components/listitems/ListItemHeader.js +2 -2
- package/lib/module/components/listitems/ListItemHeader.js.map +1 -1
- package/lib/module/components/listitems/ListItemInfoCopy.js +16 -45
- package/lib/module/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/module/components/listitems/ListItemNav.js +17 -47
- package/lib/module/components/listitems/ListItemNav.js.map +1 -1
- package/lib/module/components/listitems/ListItemNavAlert.js +19 -49
- package/lib/module/components/listitems/ListItemNavAlert.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadio.js +22 -52
- package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadioWithAmount.js +1 -1
- package/lib/module/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/module/components/listitems/ListItemTransaction.js +1 -1
- package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/module/components/listitems/{PressableListItemsBase.js → PressableListItemBase.js} +7 -7
- package/lib/module/components/listitems/PressableListItemBase.js.map +1 -0
- package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +13 -7
- package/lib/module/components/listitems/__test__/listitem.test.js +1 -1
- package/lib/module/components/listitems/__test__/listitem.test.js.map +1 -1
- package/lib/module/components/listitems/index.js +1 -1
- package/lib/module/components/listitems/index.js.map +1 -1
- package/lib/module/components/modules/PressableModuleBase.js +17 -10
- package/lib/module/components/modules/PressableModuleBase.js.map +1 -1
- package/lib/module/components/modules/index.js +1 -1
- package/lib/module/components/modules/index.js.map +1 -1
- package/lib/module/components/numberpad/NumberButton.js +14 -30
- package/lib/module/components/numberpad/NumberButton.js.map +1 -1
- package/lib/module/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +20 -0
- package/lib/module/components/tabs/TabItem.js +18 -24
- package/lib/module/components/tabs/TabItem.js.map +1 -1
- package/lib/module/core/IOAnimations.js +4 -10
- package/lib/module/core/IOAnimations.js.map +1 -1
- package/lib/module/hooks/index.js +3 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useListItemAnimation.js +33 -0
- package/lib/module/hooks/useListItemAnimation.js.map +1 -0
- package/lib/module/hooks/useScaleAnimation.js +29 -0
- package/lib/module/hooks/useScaleAnimation.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/hooks/index.js +3 -0
- package/lib/module/utils/hooks/index.js.map +1 -0
- package/lib/module/utils/hooks/useSpringPressProgressValue.js +5 -5
- package/lib/module/utils/hooks/useSpringPressProgressValue.js.map +1 -1
- package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
- package/lib/typescript/components/alert/AlertEdgeToEdge.d.ts.map +1 -1
- package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButton.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButtonContained.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButtonSolid.d.ts.map +1 -1
- package/lib/typescript/components/layout/index.d.ts +0 -1
- package/lib/typescript/components/layout/index.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemAction.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemCheckbox.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemInfoCopy.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemNav.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemNavAlert.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemRadio.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemRadioWithAmount.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemTransaction.d.ts +1 -1
- package/lib/typescript/components/listitems/ListItemTransaction.d.ts.map +1 -1
- package/lib/typescript/components/listitems/{PressableListItemsBase.d.ts → PressableListItemBase.d.ts} +3 -2
- package/lib/typescript/components/listitems/PressableListItemBase.d.ts.map +1 -0
- package/lib/typescript/components/listitems/index.d.ts +1 -1
- package/lib/typescript/components/listitems/index.d.ts.map +1 -1
- package/lib/typescript/components/modules/PressableModuleBase.d.ts.map +1 -1
- package/lib/typescript/components/modules/index.d.ts +1 -1
- package/lib/typescript/components/modules/index.d.ts.map +1 -1
- package/lib/typescript/components/numberpad/NumberButton.d.ts.map +1 -1
- package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
- package/lib/typescript/core/IOAnimations.d.ts +6 -10
- package/lib/typescript/core/IOAnimations.d.ts.map +1 -1
- package/lib/typescript/hooks/index.d.ts +3 -0
- package/lib/typescript/hooks/index.d.ts.map +1 -0
- package/lib/typescript/hooks/useListItemAnimation.d.ts +10 -0
- package/lib/typescript/hooks/useListItemAnimation.d.ts.map +1 -0
- package/lib/typescript/hooks/useScaleAnimation.d.ts +10 -0
- package/lib/typescript/hooks/useScaleAnimation.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/hooks/index.d.ts +3 -0
- package/lib/typescript/utils/hooks/index.d.ts.map +1 -0
- package/lib/typescript/utils/hooks/useSpringPressProgressValue.d.ts +7 -8
- package/lib/typescript/utils/hooks/useSpringPressProgressValue.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/alert/Alert.tsx +7 -46
- package/src/components/alert/AlertEdgeToEdge.tsx +6 -46
- package/src/components/banner/Banner.tsx +6 -52
- package/src/components/buttons/ButtonLink.tsx +32 -89
- package/src/components/buttons/ButtonOutline.tsx +26 -60
- package/src/components/buttons/ButtonSolid.tsx +11 -58
- package/src/components/buttons/IconButton.tsx +10 -47
- package/src/components/buttons/IconButtonContained.tsx +21 -57
- package/src/components/buttons/IconButtonSolid.tsx +15 -46
- package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +34 -10
- package/src/components/layout/index.tsx +0 -1
- package/src/components/listitems/ListItemAction.tsx +10 -66
- package/src/components/listitems/ListItemCheckbox.tsx +10 -68
- package/src/components/listitems/ListItemHeader.tsx +2 -2
- package/src/components/listitems/ListItemInfoCopy.tsx +11 -71
- package/src/components/listitems/ListItemNav.tsx +13 -74
- package/src/components/listitems/ListItemNavAlert.tsx +18 -92
- package/src/components/listitems/ListItemRadio.tsx +14 -75
- package/src/components/listitems/ListItemRadioWithAmount.tsx +2 -1
- package/src/components/listitems/ListItemTransaction.tsx +1 -1
- package/src/components/listitems/{PressableListItemsBase.tsx → PressableListItemBase.tsx} +7 -6
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +13 -7
- package/src/components/listitems/__test__/listitem.test.tsx +1 -1
- package/src/components/listitems/index.tsx +1 -1
- package/src/components/modules/PressableModuleBase.tsx +15 -8
- package/src/components/modules/index.tsx +1 -1
- package/src/components/numberpad/NumberButton.tsx +12 -43
- package/src/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +20 -0
- package/src/components/tabs/TabItem.tsx +15 -29
- package/src/core/IOAnimations.ts +8 -10
- package/src/hooks/index.tsx +2 -0
- package/src/hooks/useListItemAnimation.tsx +59 -0
- package/src/hooks/useScaleAnimation.tsx +41 -0
- package/src/index.tsx +1 -0
- package/src/utils/hooks/index.tsx +2 -0
- package/src/utils/hooks/useSpringPressProgressValue.ts +14 -8
- package/lib/commonjs/components/layout/FooterWithButtons.js +0 -84
- package/lib/commonjs/components/layout/FooterWithButtons.js.map +0 -1
- package/lib/commonjs/components/listitems/PressableListItemsBase.js.map +0 -1
- package/lib/commonjs/components/listitems/hooks/useListItemSpringAnimation.js +0 -56
- package/lib/commonjs/components/listitems/hooks/useListItemSpringAnimation.js.map +0 -1
- package/lib/commonjs/components/modules/hooks/useModuleSpringAnimation.js +0 -41
- package/lib/commonjs/components/modules/hooks/useModuleSpringAnimation.js.map +0 -1
- package/lib/module/components/layout/FooterWithButtons.js +0 -75
- package/lib/module/components/layout/FooterWithButtons.js.map +0 -1
- package/lib/module/components/listitems/PressableListItemsBase.js.map +0 -1
- package/lib/module/components/listitems/hooks/useListItemSpringAnimation.js +0 -47
- package/lib/module/components/listitems/hooks/useListItemSpringAnimation.js.map +0 -1
- package/lib/module/components/modules/hooks/useModuleSpringAnimation.js +0 -34
- package/lib/module/components/modules/hooks/useModuleSpringAnimation.js.map +0 -1
- package/lib/typescript/components/layout/FooterWithButtons.d.ts +0 -16
- package/lib/typescript/components/layout/FooterWithButtons.d.ts.map +0 -1
- package/lib/typescript/components/listitems/PressableListItemsBase.d.ts.map +0 -1
- package/lib/typescript/components/listitems/hooks/useListItemSpringAnimation.d.ts +0 -13
- package/lib/typescript/components/listitems/hooks/useListItemSpringAnimation.d.ts.map +0 -1
- package/lib/typescript/components/modules/hooks/useModuleSpringAnimation.d.ts +0 -10
- package/lib/typescript/components/modules/hooks/useModuleSpringAnimation.d.ts.map +0 -1
- package/src/components/layout/FooterWithButtons.tsx +0 -90
- package/src/components/listitems/hooks/useListItemSpringAnimation.ts +0 -72
- package/src/components/modules/hooks/useModuleSpringAnimation.ts +0 -49
|
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = exports.ListItemInfoCopy = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var _reactNativeReanimated =
|
|
9
|
+
var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated"));
|
|
10
10
|
var _core = require("../../core");
|
|
11
|
+
var _hooks = require("../../hooks");
|
|
11
12
|
var _icons = require("../icons");
|
|
12
13
|
var _typography = require("../typography");
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
17
|
const ListItemInfoCopy = ({
|
|
@@ -22,15 +24,16 @@ const ListItemInfoCopy = ({
|
|
|
22
24
|
accessibilityHint,
|
|
23
25
|
testID
|
|
24
26
|
}) => {
|
|
25
|
-
var _IOScaleValues$basicB;
|
|
26
|
-
const isPressed = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
27
|
-
const {
|
|
28
|
-
isExperimental
|
|
29
|
-
} = (0, _core.useIOExperimentalDesign)();
|
|
30
27
|
const theme = (0, _core.useIOTheme)();
|
|
28
|
+
const {
|
|
29
|
+
onPressIn,
|
|
30
|
+
onPressOut,
|
|
31
|
+
scaleAnimatedStyle,
|
|
32
|
+
backgroundAnimatedStyle
|
|
33
|
+
} = (0, _hooks.useListItemAnimation)();
|
|
31
34
|
const componentValueToAccessibility = (0, _react.useMemo)(() => typeof value === "string" ? value : "", [value]);
|
|
32
35
|
const listItemAccessibilityLabel = (0, _react.useMemo)(() => accessibilityLabel ? accessibilityLabel : `${label}; ${componentValueToAccessibility}`, [label, componentValueToAccessibility, accessibilityLabel]);
|
|
33
|
-
const foregroundColor =
|
|
36
|
+
const foregroundColor = theme["interactiveElem-default"];
|
|
34
37
|
const listItemInfoCopyContent = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_typography.BodySmall, {
|
|
35
38
|
weight: "Regular",
|
|
36
39
|
color: theme["textBody-tertiary"]
|
|
@@ -40,42 +43,11 @@ const ListItemInfoCopy = ({
|
|
|
40
43
|
}, value) : {
|
|
41
44
|
value
|
|
42
45
|
});
|
|
43
|
-
const mapBackgroundStates = {
|
|
44
|
-
default: (0, _core.hexToRgba)(_core.IOColors[theme["listItem-pressed"]], 0),
|
|
45
|
-
pressed: _core.IOColors[theme["listItem-pressed"]]
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// Scaling transformation applied when the button is pressed
|
|
49
|
-
const animationScaleValue = _core.IOScaleValues === null || _core.IOScaleValues === void 0 || (_IOScaleValues$basicB = _core.IOScaleValues.basicButton) === null || _IOScaleValues$basicB === void 0 ? void 0 : _IOScaleValues$basicB.pressedState;
|
|
50
|
-
const progressPressed = (0, _reactNativeReanimated.useDerivedValue)(() => (0, _reactNativeReanimated.withSpring)(isPressed.value, _core.IOSpringValues.button));
|
|
51
|
-
|
|
52
|
-
// Interpolate animation values from `isPressed` values
|
|
53
|
-
const animatedScaleStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
54
|
-
const scale = (0, _reactNativeReanimated.interpolate)(progressPressed.value, [0, 1], [1, animationScaleValue], _reactNativeReanimated.Extrapolate.CLAMP);
|
|
55
|
-
return {
|
|
56
|
-
transform: [{
|
|
57
|
-
scale
|
|
58
|
-
}]
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
const animatedBackgroundStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
62
|
-
const backgroundColor = (0, _reactNativeReanimated.interpolateColor)(progressPressed.value, [0, 1], [mapBackgroundStates.default, mapBackgroundStates.pressed]);
|
|
63
|
-
return {
|
|
64
|
-
backgroundColor
|
|
65
|
-
};
|
|
66
|
-
});
|
|
67
|
-
const handlePressIn = (0, _react.useCallback)(() => {
|
|
68
|
-
// eslint-disable-next-line functional/immutable-data
|
|
69
|
-
isPressed.value = 1;
|
|
70
|
-
}, [isPressed]);
|
|
71
|
-
const handlePressOut = (0, _react.useCallback)(() => {
|
|
72
|
-
// eslint-disable-next-line functional/immutable-data
|
|
73
|
-
isPressed.value = 0;
|
|
74
|
-
}, [isPressed]);
|
|
75
46
|
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
|
|
76
47
|
onPress: onPress,
|
|
77
|
-
onPressIn:
|
|
78
|
-
onPressOut:
|
|
48
|
+
onPressIn: onPressIn,
|
|
49
|
+
onPressOut: onPressOut,
|
|
50
|
+
onTouchEnd: onPressOut,
|
|
79
51
|
accessible: true,
|
|
80
52
|
accessibilityLabel: listItemAccessibilityLabel,
|
|
81
53
|
accessibilityHint: accessibilityHint,
|
|
@@ -84,9 +56,9 @@ const ListItemInfoCopy = ({
|
|
|
84
56
|
}, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
|
|
85
57
|
importantForAccessibility: "no-hide-descendants",
|
|
86
58
|
accessibilityElementsHidden: true,
|
|
87
|
-
style: [_core.IOListItemStyles.listItem,
|
|
59
|
+
style: [_core.IOListItemStyles.listItem, backgroundAnimatedStyle]
|
|
88
60
|
}, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
|
|
89
|
-
style: [_core.IOListItemStyles.listItemInner,
|
|
61
|
+
style: [_core.IOListItemStyles.listItemInner, scaleAnimatedStyle]
|
|
90
62
|
}, icon && /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
91
63
|
style: {
|
|
92
64
|
marginRight: _core.IOListItemVisualParams.iconMargin
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_core","_icons","_typography","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_interopRequireDefault","_core","_hooks","_icons","_typography","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ListItemInfoCopy","label","value","numberOfLines","onPress","icon","accessibilityLabel","accessibilityHint","testID","theme","useIOTheme","onPressIn","onPressOut","scaleAnimatedStyle","backgroundAnimatedStyle","useListItemAnimation","componentValueToAccessibility","useMemo","listItemAccessibilityLabel","foregroundColor","listItemInfoCopyContent","createElement","Fragment","BodySmall","weight","color","H6","Pressable","onTouchEnd","accessible","accessibilityRole","View","importantForAccessibility","accessibilityElementsHidden","style","IOListItemStyles","listItem","listItemInner","marginRight","IOListItemVisualParams","iconMargin","Icon","name","size","iconSize","IOStyles","flex","marginLeft","chevronSize","exports","_default"],"sourceRoot":"../../../../src","sources":["components/listitems/ListItemInfoCopy.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAMA,IAAAK,MAAA,GAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAA8C,SAAAG,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAb,wBAAAS,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAA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
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var _reactNativeReanimated =
|
|
9
|
+
var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated"));
|
|
10
10
|
var _core = require("../../core");
|
|
11
|
+
var _hooks = require("../../hooks");
|
|
11
12
|
var _avatar = require("../avatar");
|
|
12
13
|
var _badge = require("../badge");
|
|
13
14
|
var _icons = require("../icons");
|
|
14
15
|
var _loadingSpinner = require("../loadingSpinner");
|
|
15
16
|
var _spacer = require("../spacer");
|
|
16
17
|
var _typography = require("../typography");
|
|
17
|
-
function
|
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
20
20
|
const styles = _reactNative.StyleSheet.create({
|
|
21
21
|
paymentLogoSize: {
|
|
@@ -39,11 +39,12 @@ const ListItemNav = ({
|
|
|
39
39
|
loading,
|
|
40
40
|
numberOfLines
|
|
41
41
|
}) => {
|
|
42
|
-
var _IOScaleValues$basicB;
|
|
43
|
-
const isPressed = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
44
42
|
const {
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
onPressIn,
|
|
44
|
+
onPressOut,
|
|
45
|
+
scaleAnimatedStyle,
|
|
46
|
+
backgroundAnimatedStyle
|
|
47
|
+
} = (0, _hooks.useListItemAnimation)();
|
|
47
48
|
const theme = (0, _core.useIOTheme)();
|
|
48
49
|
const withMargin = GraphicalAsset => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
49
50
|
style: {
|
|
@@ -78,49 +79,17 @@ const ListItemNav = ({
|
|
|
78
79
|
weight: "Regular",
|
|
79
80
|
color: theme["textBody-tertiary"]
|
|
80
81
|
}, description) : description));
|
|
81
|
-
const
|
|
82
|
-
default: (0, _core.hexToRgba)(_core.IOColors[theme["listItem-pressed"]], 0),
|
|
83
|
-
pressed: _core.IOColors[theme["listItem-pressed"]]
|
|
84
|
-
};
|
|
85
|
-
const navIconColor = isExperimental ? theme["interactiveElem-default"] : "blue";
|
|
86
|
-
|
|
87
|
-
// Scaling transformation applied when the button is pressed
|
|
88
|
-
const animationScaleValue = _core.IOScaleValues === null || _core.IOScaleValues === void 0 || (_IOScaleValues$basicB = _core.IOScaleValues.basicButton) === null || _IOScaleValues$basicB === void 0 ? void 0 : _IOScaleValues$basicB.pressedState;
|
|
89
|
-
const progressPressed = (0, _reactNativeReanimated.useDerivedValue)(() => (0, _reactNativeReanimated.withSpring)(isPressed.value, _core.IOSpringValues.button));
|
|
90
|
-
|
|
91
|
-
// Interpolate animation values from `isPressed` values
|
|
92
|
-
const animatedScaleStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
93
|
-
const scale = (0, _reactNativeReanimated.interpolate)(progressPressed.value, [0, 1], [1, animationScaleValue], _reactNativeReanimated.Extrapolate.CLAMP);
|
|
94
|
-
return {
|
|
95
|
-
transform: [{
|
|
96
|
-
scale
|
|
97
|
-
}]
|
|
98
|
-
};
|
|
99
|
-
});
|
|
100
|
-
const animatedBackgroundStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
101
|
-
const backgroundColor = (0, _reactNativeReanimated.interpolateColor)(progressPressed.value, [0, 1], [mapBackgroundStates.default, mapBackgroundStates.pressed]);
|
|
102
|
-
return {
|
|
103
|
-
backgroundColor
|
|
104
|
-
};
|
|
105
|
-
});
|
|
106
|
-
const handlePressIn = (0, _react.useCallback)(() => {
|
|
107
|
-
// eslint-disable-next-line functional/immutable-data
|
|
108
|
-
isPressed.value = 1;
|
|
109
|
-
}, [isPressed]);
|
|
110
|
-
const handlePressOut = (0, _react.useCallback)(() => {
|
|
111
|
-
// eslint-disable-next-line functional/immutable-data
|
|
112
|
-
isPressed.value = 0;
|
|
113
|
-
}, [isPressed]);
|
|
82
|
+
const interactiveColor = theme["interactiveElem-default"];
|
|
114
83
|
const handleOnPress = event => {
|
|
115
84
|
if (!loading) {
|
|
116
85
|
onPress(event);
|
|
117
86
|
}
|
|
118
87
|
};
|
|
119
|
-
const primaryColor = isExperimental ? "blueIO-500" : "blue";
|
|
120
88
|
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
|
|
121
89
|
onPress: handleOnPress,
|
|
122
|
-
onPressIn:
|
|
123
|
-
onPressOut:
|
|
90
|
+
onPressIn: onPressIn,
|
|
91
|
+
onPressOut: onPressOut,
|
|
92
|
+
onTouchEnd: onPressOut,
|
|
124
93
|
accessible: true,
|
|
125
94
|
accessibilityState: {
|
|
126
95
|
busy: loading
|
|
@@ -130,9 +99,9 @@ const ListItemNav = ({
|
|
|
130
99
|
accessibilityRole: "button",
|
|
131
100
|
testID: testID
|
|
132
101
|
}, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
|
|
133
|
-
style: [_core.IOListItemStyles.listItem,
|
|
102
|
+
style: [_core.IOListItemStyles.listItem, backgroundAnimatedStyle]
|
|
134
103
|
}, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
|
|
135
|
-
style: [_core.IOListItemStyles.listItemInner,
|
|
104
|
+
style: [_core.IOListItemStyles.listItemInner, scaleAnimatedStyle]
|
|
136
105
|
}, icon && withMargin( /*#__PURE__*/_react.default.createElement(_icons.Icon, {
|
|
137
106
|
name: icon,
|
|
138
107
|
color: iconColor,
|
|
@@ -148,10 +117,10 @@ const ListItemNav = ({
|
|
|
148
117
|
}, avatar))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
149
118
|
style: _core.IOStyles.flex
|
|
150
119
|
}, listItemNavContent), loading && /*#__PURE__*/_react.default.createElement(_loadingSpinner.LoadingSpinner, {
|
|
151
|
-
color:
|
|
120
|
+
color: interactiveColor
|
|
152
121
|
}), !loading && !hideChevron && /*#__PURE__*/_react.default.createElement(_icons.Icon, {
|
|
153
122
|
name: "chevronRightListItem",
|
|
154
|
-
color:
|
|
123
|
+
color: interactiveColor,
|
|
155
124
|
size: _core.IOListItemVisualParams.chevronSize
|
|
156
125
|
}))));
|
|
157
126
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_reactNativeReanimated","_core","_hooks","_avatar","_badge","_icons","_loadingSpinner","_spacer","_typography","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","styles","StyleSheet","create","paymentLogoSize","width","IOSelectionListItemVisualParams","iconSize","height","ListItemNav","value","description","onPress","icon","iconColor","avatarProps","avatar","paymentLogoUri","accessibilityLabel","accessibilityHint","testID","hideChevron","topElement","loading","numberOfLines","onPressIn","onPressOut","scaleAnimatedStyle","backgroundAnimatedStyle","useListItemAnimation","theme","useIOTheme","withMargin","GraphicalAsset","createElement","View","style","marginRight","IOListItemVisualParams","iconMargin","listItemNavContent","Fragment","badgeProps","alignSelf","Badge","VSpacer","size","dateValue","flexDirection","Icon","name","color","HSpacer","Caption","H6","BodySmall","weight","interactiveColor","handleOnPress","event","Pressable","onTouchEnd","accessible","accessibilityState","busy","accessibilityRole","IOListItemStyles","listItem","listItemInner","Image","accessibilityIgnoresInvertColors","uri","Avatar","IOStyles","flex","LoadingSpinner","chevronSize","exports","_default"],"sourceRoot":"../../../../src","sources":["components/listitems/ListItemNav.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,sBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAQA,IAAAI,MAAA,GAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,eAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AAAuD,SAAAD,uBAAAY,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,KAAAL,MAAA,CAAAK,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAL,MAAA,YAAAJ,QAAA,CAAAa,KAAA,OAAAP,SAAA;AA0DvD,MAAMQ,MAAM,GAAGC,uBAAU,CAACC,MAAM,CAAC;EAC/BC,eAAe,EAAE;IACfC,KAAK,EAAE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AU;IACjBgC,IAAI,EAAER,4BAAsB,CAAC/B;EAAS,CACvC,CACH,CAAC,EACFU,cAAc,IACbe,UAAU,eACR7D,MAAA,CAAAe,OAAA,CAAAgD,aAAA,CAAC5D,YAAA,CAAA+F,KAAK;IACJC,gCAAgC;IAChC3E,MAAM,EAAE;MAAE4E,GAAG,EAAEtD;IAAe,CAAE;IAChCmB,KAAK,EAAEnC,MAAM,CAACG;EAAgB,CAC/B,CACH,CAAC,EACFY,MAAM,IAAIgB,UAAU,eAAC7D,MAAA,CAAAe,OAAA,CAAAgD,aAAA,CAACxD,OAAA,CAAA8F,MAAM,EAAArF,QAAA;IAAC2D,IAAI,EAAC;EAAO,GAAK9B,MAAM,CAAG,CAAC,CAAC,eAE1D7C,MAAA,CAAAe,OAAA,CAAAgD,aAAA,CAAC5D,YAAA,CAAA6D,IAAI;IAACC,KAAK,EAAEqC,cAAQ,CAACC;EAAK,GAAElC,kBAAyB,CAAC,EACtDjB,OAAO,iBAAIpD,MAAA,CAAAe,OAAA,CAAAgD,aAAA,CAACrD,eAAA,CAAA8F,cAAc;IAACxB,KAAK,EAAEM;EAAiB,CAAE,CAAC,EACtD,CAAClC,OAAO,IAAI,CAACF,WAAW,iBACvBlD,MAAA,CAAAe,OAAA,CAAAgD,aAAA,CAACtD,MAAA,CAAAqE,IAAI;IACHC,IAAI,EAAC,sBAAsB;IAC3BC,KAAK,EAAEM,gBAAiB;IACxBX,IAAI,EAAER,4BAAsB,CAACsC;EAAY,CAC1C,CAEU,CACF,CACN,CAAC;AAEhB,CAAC;AAACC,OAAA,CAAApE,WAAA,GAAAA,WAAA;AAAA,IAAAqE,QAAA,GAEarE,WAAW;AAAAoE,OAAA,CAAA3F,OAAA,GAAA4F,QAAA"}
|
|
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.ListItemNavAlert = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var _reactNativeReanimated =
|
|
9
|
+
var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated"));
|
|
10
10
|
var _core = require("../../core");
|
|
11
|
+
var _hooks = require("../../hooks");
|
|
11
12
|
var _icons = require("../icons");
|
|
12
13
|
var _typography = require("../typography");
|
|
13
|
-
function
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
const ListItemNavAlert = ({
|
|
16
16
|
value,
|
|
17
17
|
description,
|
|
@@ -21,15 +21,16 @@ const ListItemNavAlert = ({
|
|
|
21
21
|
accessibilityHint,
|
|
22
22
|
testID
|
|
23
23
|
}) => {
|
|
24
|
-
var _IOScaleValues$basicB;
|
|
25
|
-
const isPressed = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
26
|
-
const {
|
|
27
|
-
isExperimental
|
|
28
|
-
} = (0, _core.useIOExperimentalDesign)();
|
|
29
|
-
const componentValueToAccessibility = (0, _react.useMemo)(() => typeof value === "string" ? value : "", [value]);
|
|
30
|
-
const componentDescriptionToAccessibility = (0, _react.useMemo)(() => typeof description === "string" ? description : "", [description]);
|
|
31
|
-
const listItemAccessibilityLabel = (0, _react.useMemo)(() => accessibilityLabel ? accessibilityLabel : `${componentValueToAccessibility}; ${componentDescriptionToAccessibility}`, [componentDescriptionToAccessibility, componentValueToAccessibility, accessibilityLabel]);
|
|
32
24
|
const theme = (0, _core.useIOTheme)();
|
|
25
|
+
const {
|
|
26
|
+
onPressIn,
|
|
27
|
+
onPressOut,
|
|
28
|
+
scaleAnimatedStyle,
|
|
29
|
+
backgroundAnimatedStyle
|
|
30
|
+
} = (0, _hooks.useListItemAnimation)();
|
|
31
|
+
const componentValueToAccessibility = typeof value === "string" ? value : "";
|
|
32
|
+
const componentDescriptionToAccessibility = typeof description === "string" ? description : "";
|
|
33
|
+
const listItemAccessibilityLabel = accessibilityLabel ?? `${componentValueToAccessibility}; ${componentDescriptionToAccessibility}`;
|
|
33
34
|
|
|
34
35
|
// TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
|
|
35
36
|
const listItemNavAlertContent = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, typeof value === "string" ? /*#__PURE__*/_react.default.createElement(_typography.H6, {
|
|
@@ -38,54 +39,22 @@ const ListItemNavAlert = ({
|
|
|
38
39
|
weight: "Semibold",
|
|
39
40
|
color: theme.errorText
|
|
40
41
|
}, description) : description));
|
|
41
|
-
const iconColor = isExperimental ? theme["interactiveElem-default"] : "blue";
|
|
42
|
-
const mapBackgroundStates = {
|
|
43
|
-
default: (0, _core.hexToRgba)(_core.IOColors[theme["listItem-pressed"]], 0),
|
|
44
|
-
pressed: _core.IOColors[theme["listItem-pressed"]]
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// Scaling transformation applied when the button is pressed
|
|
48
|
-
const animationScaleValue = _core.IOScaleValues === null || _core.IOScaleValues === void 0 || (_IOScaleValues$basicB = _core.IOScaleValues.basicButton) === null || _IOScaleValues$basicB === void 0 ? void 0 : _IOScaleValues$basicB.pressedState;
|
|
49
|
-
const progressPressed = (0, _reactNativeReanimated.useDerivedValue)(() => (0, _reactNativeReanimated.withSpring)(isPressed.value, _core.IOSpringValues.button));
|
|
50
|
-
|
|
51
|
-
// Interpolate animation values from `isPressed` values
|
|
52
|
-
const animatedScaleStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
53
|
-
const scale = (0, _reactNativeReanimated.interpolate)(progressPressed.value, [0, 1], [1, animationScaleValue], _reactNativeReanimated.Extrapolate.CLAMP);
|
|
54
|
-
return {
|
|
55
|
-
transform: [{
|
|
56
|
-
scale
|
|
57
|
-
}]
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
const animatedBackgroundStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
61
|
-
const backgroundColor = (0, _reactNativeReanimated.interpolateColor)(progressPressed.value, [0, 1], [mapBackgroundStates.default, mapBackgroundStates.pressed]);
|
|
62
|
-
return {
|
|
63
|
-
backgroundColor
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
const handlePressIn = (0, _react.useCallback)(() => {
|
|
67
|
-
// eslint-disable-next-line functional/immutable-data
|
|
68
|
-
isPressed.value = 1;
|
|
69
|
-
}, [isPressed]);
|
|
70
|
-
const handlePressOut = (0, _react.useCallback)(() => {
|
|
71
|
-
// eslint-disable-next-line functional/immutable-data
|
|
72
|
-
isPressed.value = 0;
|
|
73
|
-
}, [isPressed]);
|
|
74
42
|
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
|
|
75
43
|
onPress: onPress,
|
|
76
|
-
onPressIn:
|
|
77
|
-
onPressOut:
|
|
44
|
+
onPressIn: onPressIn,
|
|
45
|
+
onPressOut: onPressOut,
|
|
46
|
+
onTouchEnd: onPressOut,
|
|
78
47
|
accessible: true,
|
|
79
48
|
accessibilityLabel: listItemAccessibilityLabel,
|
|
80
49
|
accessibilityHint: accessibilityHint,
|
|
81
50
|
accessibilityRole: "button",
|
|
82
51
|
testID: testID
|
|
83
52
|
}, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
|
|
84
|
-
style: [_core.IOListItemStyles.listItem,
|
|
53
|
+
style: [_core.IOListItemStyles.listItem, backgroundAnimatedStyle],
|
|
85
54
|
importantForAccessibility: "no-hide-descendants",
|
|
86
55
|
accessibilityElementsHidden: true
|
|
87
56
|
}, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
|
|
88
|
-
style: [_core.IOListItemStyles.listItemInner,
|
|
57
|
+
style: [_core.IOListItemStyles.listItemInner, scaleAnimatedStyle]
|
|
89
58
|
}, !withoutIcon && /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
90
59
|
style: {
|
|
91
60
|
marginRight: _core.IOListItemVisualParams.iconMargin
|
|
@@ -102,7 +71,7 @@ const ListItemNavAlert = ({
|
|
|
102
71
|
}
|
|
103
72
|
}, /*#__PURE__*/_react.default.createElement(_icons.Icon, {
|
|
104
73
|
name: "chevronRightListItem",
|
|
105
|
-
color:
|
|
74
|
+
color: theme["interactiveElem-default"],
|
|
106
75
|
size: _core.IOListItemVisualParams.chevronSize
|
|
107
76
|
})))));
|
|
108
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_reactNativeReanimated","_core","_hooks","_icons","_typography","obj","__esModule","default","ListItemNavAlert","value","description","withoutIcon","onPress","accessibilityLabel","accessibilityHint","testID","theme","useIOTheme","onPressIn","onPressOut","scaleAnimatedStyle","backgroundAnimatedStyle","useListItemAnimation","componentValueToAccessibility","componentDescriptionToAccessibility","listItemAccessibilityLabel","listItemNavAlertContent","createElement","Fragment","H6","color","BodySmall","weight","errorText","Pressable","onTouchEnd","accessible","accessibilityRole","View","style","IOListItemStyles","listItem","importantForAccessibility","accessibilityElementsHidden","listItemInner","marginRight","IOListItemVisualParams","iconMargin","Icon","name","errorIcon","size","iconSize","IOStyles","flex","marginLeft","chevronSize","exports","_default"],"sourceRoot":"../../../../src","sources":["components/listitems/ListItemNavAlert.ts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,IAAI;IACHC,IAAI,EAAC,aAAa;IAClBnB,KAAK,EAAEd,KAAK,CAACkC,SAAU;IACvBC,IAAI,EAAEL,4BAAsB,CAACM;EAAS,CACvC,CACG,CACP,eACDxD,MAAA,CAAAW,OAAA,CAAAoB,aAAA,CAAC5B,YAAA,CAAAuC,IAAI;IAACC,KAAK,EAAEc,cAAQ,CAACC;EAAK,GAAE5B,uBAA8B,CAAC,eAC5D9B,MAAA,CAAAW,OAAA,CAAAoB,aAAA,CAAC5B,YAAA,CAAAuC,IAAI;IAACC,KAAK,EAAE;MAAEgB,UAAU,EAAET,4BAAsB,CAACC;IAAW;EAAE,gBAC7DnD,MAAA,CAAAW,OAAA,CAAAoB,aAAA,CAACxB,MAAA,CAAA6C,IAAI;IACHC,IAAI,EAAC,sBAAsB;IAC3BnB,KAAK,EAAEd,KAAK,CAAC,yBAAyB,CAAE;IACxCmC,IAAI,EAAEL,4BAAsB,CAACU;EAAY,CAC1C,CACG,CACO,CACF,CACN,CAAC;AAEhB,CAAC;AAACC,OAAA,CAAAjD,gBAAA,GAAAA,gBAAA;AAAA,IAAAkD,QAAA,GAEalD,gBAAgB;AAAAiD,OAAA,CAAAlD,OAAA,GAAAmD,QAAA"}
|
|
@@ -7,14 +7,16 @@ exports.ListItemRadio = void 0;
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _reactNativeHapticFeedback = _interopRequireDefault(require("react-native-haptic-feedback"));
|
|
10
|
-
var _reactNativeReanimated =
|
|
10
|
+
var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated"));
|
|
11
11
|
var _rnPlaceholder = _interopRequireDefault(require("rn-placeholder"));
|
|
12
12
|
var _core = require("../../core");
|
|
13
|
+
var _hooks = require("../../hooks");
|
|
13
14
|
var _icons = require("../icons");
|
|
14
15
|
var _logos = require("../logos");
|
|
15
16
|
var _AnimatedRadio = require("../radio/AnimatedRadio");
|
|
16
17
|
var _spacer = require("../spacer");
|
|
17
18
|
var _typography = require("../typography");
|
|
19
|
+
var _stack = require("../stack");
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -46,44 +48,14 @@ const ListItemRadio = ({
|
|
|
46
48
|
loadingProps,
|
|
47
49
|
testID
|
|
48
50
|
}) => {
|
|
49
|
-
var _IOScaleValues$basicB;
|
|
50
51
|
const [toggleValue, setToggleValue] = (0, React.useState)(selected ?? false);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// Theme
|
|
52
|
+
const {
|
|
53
|
+
onPressIn,
|
|
54
|
+
onPressOut,
|
|
55
|
+
scaleAnimatedStyle,
|
|
56
|
+
backgroundAnimatedStyle
|
|
57
|
+
} = (0, _hooks.useListItemAnimation)();
|
|
58
58
|
const theme = (0, _core.useIOTheme)();
|
|
59
|
-
const mapBackgroundStates = {
|
|
60
|
-
default: (0, _core.hexToRgba)(_core.IOColors[theme["listItem-pressed"]], 0),
|
|
61
|
-
pressed: _core.IOColors[theme["listItem-pressed"]]
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
// Interpolate animation values from `isPressed` values
|
|
65
|
-
const animatedScaleStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
66
|
-
const scale = (0, _reactNativeReanimated.interpolate)(progressPressed.value, [0, 1], [1, animationScaleValue], _reactNativeReanimated.Extrapolate.CLAMP);
|
|
67
|
-
return {
|
|
68
|
-
transform: [{
|
|
69
|
-
scale
|
|
70
|
-
}]
|
|
71
|
-
};
|
|
72
|
-
});
|
|
73
|
-
const handlePressIn = (0, React.useCallback)(() => {
|
|
74
|
-
// eslint-disable-next-line functional/immutable-data
|
|
75
|
-
isPressed.value = 1;
|
|
76
|
-
}, [isPressed]);
|
|
77
|
-
const handlePressOut = (0, React.useCallback)(() => {
|
|
78
|
-
// eslint-disable-next-line functional/immutable-data
|
|
79
|
-
isPressed.value = 0;
|
|
80
|
-
}, [isPressed]);
|
|
81
|
-
const animatedBackgroundStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
82
|
-
const backgroundColor = (0, _reactNativeReanimated.interpolateColor)(progressPressed.value, [0, 1], [mapBackgroundStates.default, mapBackgroundStates.pressed]);
|
|
83
|
-
return {
|
|
84
|
-
backgroundColor
|
|
85
|
-
};
|
|
86
|
-
});
|
|
87
59
|
const toggleRadioItem = () => {
|
|
88
60
|
_reactNativeHapticFeedback.default.trigger("impactLight");
|
|
89
61
|
setToggleValue(!toggleValue);
|
|
@@ -94,22 +66,18 @@ const ListItemRadio = ({
|
|
|
94
66
|
const disabledStyle = {
|
|
95
67
|
opacity: disabled ? DISABLED_OPACITY : 1
|
|
96
68
|
};
|
|
97
|
-
const SkeletonDescriptionLines = () => /*#__PURE__*/React.createElement(
|
|
98
|
-
|
|
99
|
-
}
|
|
69
|
+
const SkeletonDescriptionLines = () => /*#__PURE__*/React.createElement(_stack.VStack, {
|
|
70
|
+
space: 8
|
|
71
|
+
}, /*#__PURE__*/React.createElement(_rnPlaceholder.default.Box, {
|
|
100
72
|
animate: "fade",
|
|
101
73
|
radius: 8,
|
|
102
74
|
width: "100%",
|
|
103
75
|
height: 8
|
|
104
|
-
}), /*#__PURE__*/React.createElement(_spacer.VSpacer, {
|
|
105
|
-
size: 8
|
|
106
76
|
}), /*#__PURE__*/React.createElement(_rnPlaceholder.default.Box, {
|
|
107
77
|
animate: "fade",
|
|
108
78
|
radius: 8,
|
|
109
79
|
width: "100%",
|
|
110
80
|
height: 8
|
|
111
|
-
}), /*#__PURE__*/React.createElement(_spacer.VSpacer, {
|
|
112
|
-
size: 8
|
|
113
81
|
}), /*#__PURE__*/React.createElement(_rnPlaceholder.default.Box, {
|
|
114
82
|
animate: "fade",
|
|
115
83
|
radius: 8,
|
|
@@ -127,7 +95,9 @@ const ListItemRadio = ({
|
|
|
127
95
|
height: _core.IOSelectionListItemVisualParams.iconSize
|
|
128
96
|
}));
|
|
129
97
|
const SkeletonComponent = () => /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
130
|
-
style: _core.IOSelectionListItemStyles.listItem
|
|
98
|
+
style: [_core.IOSelectionListItemStyles.listItem, {
|
|
99
|
+
rowGap: 8
|
|
100
|
+
}]
|
|
131
101
|
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
132
102
|
style: _core.IOSelectionListItemStyles.listItemInner
|
|
133
103
|
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
@@ -156,19 +126,19 @@ const ListItemRadio = ({
|
|
|
156
126
|
accessibilityLabel: accessibilityLabel,
|
|
157
127
|
accessibilityHint: accessibilityHint,
|
|
158
128
|
onPress: toggleRadioItem,
|
|
159
|
-
onPressIn:
|
|
160
|
-
onPressOut:
|
|
161
|
-
onTouchEnd:
|
|
129
|
+
onPressIn: onPressIn,
|
|
130
|
+
onPressOut: onPressOut,
|
|
131
|
+
onTouchEnd: onPressOut,
|
|
162
132
|
testID: testID,
|
|
163
133
|
disabled: disabled
|
|
164
134
|
}, /*#__PURE__*/React.createElement(_reactNativeReanimated.default.View, {
|
|
165
|
-
style: [_core.IOSelectionListItemStyles.listItem,
|
|
135
|
+
style: [_core.IOSelectionListItemStyles.listItem, backgroundAnimatedStyle, disabledStyle]
|
|
166
136
|
// This is required to avoid opacity
|
|
167
137
|
// inheritance on Android
|
|
168
138
|
,
|
|
169
139
|
needsOffscreenAlphaCompositing: true
|
|
170
140
|
}, /*#__PURE__*/React.createElement(_reactNativeReanimated.default.View, {
|
|
171
|
-
style:
|
|
141
|
+
style: scaleAnimatedStyle
|
|
172
142
|
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
173
143
|
style: _core.IOSelectionListItemStyles.listItemInner
|
|
174
144
|
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|