@ledgerhq/native-ui 0.28.0-nightly.0 → 0.29.0-next.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/components/Cards/BannerCard/index.js +2 -2
- package/lib/components/Cards/InformativeCard/index.js +4 -4
- package/lib/components/Cards/NotificationCard/index.js +1 -1
- package/lib/components/Cards/SideImageCard/index.js +3 -3
- package/lib/components/Carousel/index.js +4 -4
- package/lib/components/Form/Input/AnimatedInput/AnimatedNotchedLabel.js +2 -2
- package/lib/components/Form/Input/AnimatedInput/index.js +4 -16
- package/lib/components/Form/Input/AnimatedInputSelect/index.js +3 -15
- package/lib/components/Form/Input/BaseInput/index.js +8 -19
- package/lib/components/Form/Input/LegendInput/index.js +3 -15
- package/lib/components/Form/Input/NumberInput/index.js +3 -15
- package/lib/components/Form/Input/QrCodeInput/index.js +3 -15
- package/lib/components/Form/Input/SearchInput/index.js +5 -17
- package/lib/components/Form/SelectableList.js +3 -3
- package/lib/components/Form/TabSelector/index.d.ts +5 -4
- package/lib/components/Form/TabSelector/index.d.ts.map +1 -1
- package/lib/components/Form/TabSelector/index.js +10 -4
- package/lib/components/Icon/BoxedIcon.js +2 -14
- package/lib/components/Icon/IconBadge.js +2 -14
- package/lib/components/Icon/IconBox/index.js +1 -1
- package/lib/components/Layout/Divider/index.js +2 -2
- package/lib/components/Layout/List/IconBoxList/index.js +6 -15
- package/lib/components/Layout/List/List/index.js +5 -18
- package/lib/components/Layout/List/NumberedList/index.js +6 -18
- package/lib/components/Layout/List/TipList/index.js +6 -15
- package/lib/components/Layout/List/VerticalStepper/StepperItem.js +8 -12
- package/lib/components/Layout/List/VerticalStepper/index.js +4 -16
- package/lib/components/Layout/List/VerticalTimeline/TimelineIndicator.js +2 -14
- package/lib/components/Layout/List/VerticalTimeline/TimelineItem.js +9 -13
- package/lib/components/Layout/List/VerticalTimeline/index.js +4 -16
- package/lib/components/Layout/Modals/BaseModal/index.js +2 -14
- package/lib/components/Layout/Modals/BottomDrawer/index.js +2 -14
- package/lib/components/Layout/Modals/Popin/index.js +2 -14
- package/lib/components/Layout/Modals/Tooltip/index.js +3 -15
- package/lib/components/Layout/ScrollContainer/index.js +1 -15
- package/lib/components/Layout/ScrollContainerHeader/index.js +3 -15
- package/lib/components/Layout/ScrollListContainer/index.js +2 -14
- package/lib/components/Layout/Table/Row.js +2 -14
- package/lib/components/Loader/InfiniteLoader/index.js +5 -15
- package/lib/components/Loader/ProgressLoader/index.js +1 -1
- package/lib/components/Navigation/FlowStepper/index.js +3 -3
- package/lib/components/Navigation/Stepper/index.js +4 -16
- package/lib/components/ProgressBar/index.js +3 -15
- package/lib/components/Tabs/Chip/index.js +3 -3
- package/lib/components/Tabs/Graph/index.js +1 -1
- package/lib/components/Tabs/TemplateTabs/index.js +2 -14
- package/lib/components/Text/getTextStyle.js +4 -2
- package/lib/components/Text/index.js +9 -25
- package/lib/components/cta/Button/getButtonStyle.js +10 -2
- package/lib/components/cta/Button/index.js +15 -20
- package/lib/components/cta/Link/index.js +2 -2
- package/lib/components/cta/QuickAction/QuickActionButton/index.d.ts.map +1 -1
- package/lib/components/cta/QuickAction/QuickActionButton/index.js +6 -14
- package/lib/components/cta/QuickAction/QuickActionList/index.js +3 -15
- package/lib/components/message/Alert/index.js +1 -1
- package/lib/components/message/Log/index.js +1 -1
- package/lib/components/message/Notification/index.js +15 -19
- package/lib/components/tags/Badge/index.js +3 -1
- package/lib/components/tags/Tag/index.js +2 -14
- package/lib/icons/BracketLeft.js +1 -1
- package/lib/icons/BracketRight.js +1 -1
- package/lib/styles/InvertTheme.js +5 -1
- package/lib/styles/StyleProvider.js +9 -1
- package/lib/styles/theme.js +4 -1
- package/package.json +3 -4
|
@@ -38,7 +38,7 @@ export const CloseButton = ({ onPressDismiss }) => {
|
|
|
38
38
|
};
|
|
39
39
|
const CardContainer = (props) => {
|
|
40
40
|
const { onPressDismiss, LeftElement, LeftElementNotCirlcled, title, typeOfRightIcon } = props;
|
|
41
|
-
return (React.createElement(Container,
|
|
41
|
+
return (React.createElement(Container, { ...props },
|
|
42
42
|
LeftElementNotCirlcled ? (LeftElement) : (React.createElement(Flex, { borderRadius: 50, height: 40, width: 40, alignItems: "center", justifyContent: "center", bg: "opacityDefault.c05" }, LeftElement)),
|
|
43
43
|
React.createElement(Flex, { flexShrink: 1 },
|
|
44
44
|
React.createElement(Text, { mx: 4, variant: "large", fontWeight: "medium", numberOfLines: 2, color: "neutral.c100" }, title)),
|
|
@@ -46,6 +46,6 @@ const CardContainer = (props) => {
|
|
|
46
46
|
React.createElement(ChevronRightMedium, { size: 24 })))));
|
|
47
47
|
};
|
|
48
48
|
const BannerCard = (props) => {
|
|
49
|
-
return React.createElement(CardContainer,
|
|
49
|
+
return React.createElement(CardContainer, { ...props, activeOpacity: 0.5 });
|
|
50
50
|
};
|
|
51
51
|
export default BannerCard;
|
|
@@ -20,12 +20,12 @@ const CardContainer = (props) => {
|
|
|
20
20
|
React.createElement(Flex, { justifyContent: "space-between", alignItems: "flex-start", py: 2, pr: imageUrl ? 4 : 2, flex: 1 },
|
|
21
21
|
React.createElement(Text, { variant: "body", fontWeight: "medium", color: "neutral.c100", numberOfLines: 2 }, title),
|
|
22
22
|
React.createElement(Text, { variant: "paragraph", fontWeight: "medium", color: "neutral.c70", numberOfLines: 1, mt: 4 }, tag)),
|
|
23
|
-
imageUrl && (React.createElement(ImageContent,
|
|
23
|
+
imageUrl && (React.createElement(ImageContent, { source: {
|
|
24
24
|
uri: imageUrl,
|
|
25
|
-
}, style: styles.image
|
|
25
|
+
}, style: styles.image, ...imageProps }))));
|
|
26
26
|
};
|
|
27
27
|
const InformativeCard = (props) => {
|
|
28
|
-
return (React.createElement(Base,
|
|
29
|
-
React.createElement(CardContainer,
|
|
28
|
+
return (React.createElement(Base, { ...props, activeOpacity: 0.5, onPress: props.onClickCard },
|
|
29
|
+
React.createElement(CardContainer, { ...props })));
|
|
30
30
|
};
|
|
31
31
|
export default memo(InformativeCard);
|
|
@@ -14,7 +14,7 @@ const Timer = ({ time, viewed }) => (React.createElement(Flex, { flexDirection:
|
|
|
14
14
|
const NotificationCard = (props) => {
|
|
15
15
|
const { tag = "", time = "", title, description, cta, viewed, onClickCard, showLinkCta, link = "", } = props;
|
|
16
16
|
const ctaIcon = useMemo(() => {
|
|
17
|
-
const isDeepLink = link
|
|
17
|
+
const isDeepLink = link?.startsWith("ledgerlive:");
|
|
18
18
|
return link && isDeepLink ? undefined : () => React.createElement(ExternalLinkMedium, { color: "neutral.c100" });
|
|
19
19
|
}, [link]);
|
|
20
20
|
return (React.createElement(Base, { onPress: onClickCard, activeOpacity: link ? 0.5 : 1 },
|
|
@@ -54,11 +54,11 @@ const TextComponent = (props) => (React.createElement(Flex, { justifyContent: "s
|
|
|
54
54
|
const CardContainer = (props) => {
|
|
55
55
|
const { imageUrl, onPressDismiss } = props;
|
|
56
56
|
return (React.createElement(Container, { height: 125 },
|
|
57
|
-
React.createElement(TextComponent,
|
|
57
|
+
React.createElement(TextComponent, { ...props }),
|
|
58
58
|
React.createElement(ImageComponent, { imageUrl: imageUrl, onPressDismiss: onPressDismiss })));
|
|
59
59
|
};
|
|
60
60
|
const SideImageCard = (props) => {
|
|
61
|
-
return (React.createElement(Base,
|
|
62
|
-
React.createElement(CardContainer,
|
|
61
|
+
return (React.createElement(Base, { ...props, activeOpacity: 0.5 },
|
|
62
|
+
React.createElement(CardContainer, { ...props })));
|
|
63
63
|
};
|
|
64
64
|
export default SideImageCard;
|
|
@@ -108,16 +108,16 @@ function Carousel({ activeIndex = 0, autoDelay, restartAfterEnd = true, scrollOn
|
|
|
108
108
|
onTap(event);
|
|
109
109
|
}
|
|
110
110
|
}, [maxDurationOfTap, onTap, tapTime]);
|
|
111
|
-
return (React.createElement(Flex,
|
|
112
|
-
React.createElement(HorizontalScrollView,
|
|
111
|
+
return (React.createElement(Flex, { flex: 1, width: "100%", alignItems: "center", justifyContent: "center", ...containerProps },
|
|
112
|
+
React.createElement(HorizontalScrollView, { ref: scrollRef, onScroll: onScroll, onContentSizeChange: onContentSizeChange, onScrollBeginDrag: () => {
|
|
113
113
|
disableTimer.current = true;
|
|
114
114
|
}, onScrollEndDrag: () => {
|
|
115
115
|
disableTimer.current = false;
|
|
116
116
|
}, pagingEnabled: Platform.OS !== "web", showsHorizontalScrollIndicator: false, scrollEventThrottle: 200, contentContainerStyle: {
|
|
117
117
|
width: `${fullWidth}%`,
|
|
118
118
|
flexDirection: I18nManager.isRTL && Platform.OS !== "ios" ? "row-reverse" : "row",
|
|
119
|
-
}, decelerationRate: "fast", onTouchStart: scrollOnSidePress ? onStartTap : undefined, onTouchEnd: scrollOnSidePress ? onEndTap : undefined
|
|
120
|
-
React.createElement(Flex,
|
|
119
|
+
}, decelerationRate: "fast", onTouchStart: scrollOnSidePress ? onStartTap : undefined, onTouchEnd: scrollOnSidePress ? onEndTap : undefined, ...scrollViewProps }, React.Children.map(children, (child, index) => (React.createElement(Flex, { key: index, flex: 1 }, child)))),
|
|
120
|
+
React.createElement(Flex, { my: 8, ...slideIndicatorContainerProps }, React.isValidElement(IndicatorComponent) ? (IndicatorComponent) : (
|
|
121
121
|
/* @ts-expect-error TS 5 can't seem to be able to prove this is a react comopnent here */
|
|
122
122
|
React.createElement(IndicatorComponent, { activeIndex: activeIndexState || 0, onChange: (index) => {
|
|
123
123
|
scrollToIndex(index);
|
|
@@ -70,7 +70,7 @@ export const AnimatedNotchedLabel = ({ placeholder, inputStatus, value, }) => {
|
|
|
70
70
|
easing: Easing.inOut(Easing.quad),
|
|
71
71
|
}));
|
|
72
72
|
}, [notched]);
|
|
73
|
-
return (React.createElement(LabelContainer, { onLayout: (event) => setLabelWidth(event.nativeEvent.layout.width), style:
|
|
73
|
+
return (React.createElement(LabelContainer, { onLayout: (event) => setLabelWidth(event.nativeEvent.layout.width), style: { ...labelStyle, elevation: notched ? 3 : 0 }, notched: notched },
|
|
74
74
|
notched && React.createElement(LineCutout, { status: inputStatus, labelWidth: labelWidth }),
|
|
75
|
-
React.createElement(LabelText, { style:
|
|
75
|
+
React.createElement(LabelText, { style: { ...labelFontSize }, status: inputStatus }, placeholder)));
|
|
76
76
|
};
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React from "react";
|
|
13
2
|
import { BaseInput } from "..";
|
|
14
3
|
import styled, { useTheme } from "styled-components/native";
|
|
@@ -20,9 +9,8 @@ const InputContainer = styled(View) `
|
|
|
20
9
|
position: relative;
|
|
21
10
|
box-sizing: border-box;
|
|
22
11
|
`;
|
|
23
|
-
const AnimatedInput = (
|
|
24
|
-
|
|
25
|
-
const { placeholder, onFocus: onFocusCallback, onBlur: onBlurCallback, error, value } = textInputProps, rest = __rest(textInputProps, ["placeholder", "onFocus", "onBlur", "error", "value"]);
|
|
12
|
+
const AnimatedInput = ({ style = { width: "100%" }, ...textInputProps }, ref) => {
|
|
13
|
+
const { placeholder, onFocus: onFocusCallback, onBlur: onBlurCallback, error, value, ...rest } = textInputProps;
|
|
26
14
|
const theme = useTheme();
|
|
27
15
|
const { onFocus, onBlur, focused } = useAnimatedInputFocus({
|
|
28
16
|
onFocusCallback,
|
|
@@ -32,7 +20,7 @@ const AnimatedInput = (_a, ref) => {
|
|
|
32
20
|
const displayClearCross = inputStatus === "error" || inputStatus === "focused";
|
|
33
21
|
return (React.createElement(InputContainer, { status: inputStatus, style: style },
|
|
34
22
|
placeholder && (React.createElement(AnimatedNotchedLabel, { placeholder: placeholder, inputStatus: inputStatus, value: value })),
|
|
35
|
-
React.createElement(BaseInput,
|
|
23
|
+
React.createElement(BaseInput, { ref: ref, onFocus: onFocus, onBlur: onBlur, error: error, value: value, color: theme ? inputTextColor[inputStatus]({ theme }) : "neutral.c100", inputContainerStyle: {
|
|
36
24
|
backgroundColor: "none",
|
|
37
25
|
borderColor: theme ? inputStatusColors[inputStatus]({ theme }) : "neutral.c100",
|
|
38
26
|
borderRadius: 8,
|
|
@@ -41,6 +29,6 @@ const AnimatedInput = (_a, ref) => {
|
|
|
41
29
|
paddingRight: displayClearCross ? 8 : 14,
|
|
42
30
|
}, inputErrorContainerStyles: {
|
|
43
31
|
marginTop: 8,
|
|
44
|
-
}, inputErrorColor: theme ? inputStatusColors[inputStatus]({ theme }) : "neutral.c100", showErrorIcon: true
|
|
32
|
+
}, inputErrorColor: theme ? inputStatusColors[inputStatus]({ theme }) : "neutral.c100", showErrorIcon: true, ...rest })));
|
|
45
33
|
};
|
|
46
34
|
export default React.forwardRef(AnimatedInput);
|
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React from "react";
|
|
13
2
|
import { AnimatedInput } from "..";
|
|
14
3
|
import { useTheme } from "styled-components/native";
|
|
15
4
|
import { useAnimatedInputFocus } from "../AnimatedInput/useAnimatedInputFocus";
|
|
16
5
|
import { getInputStatus, inputStatusColors } from "../AnimatedInput/inputTextColor";
|
|
17
6
|
import { SelectComponent } from "./Select";
|
|
18
|
-
const AnimatedInputSelect = (
|
|
19
|
-
|
|
20
|
-
const { placeholder, onFocus: onFocusCallback, onBlur: onBlurCallback, error, value, onChange } = textInputProps, rest = __rest(textInputProps, ["placeholder", "onFocus", "onBlur", "error", "value", "onChange"]);
|
|
7
|
+
const AnimatedInputSelect = ({ selectProps, ...textInputProps }, ref) => {
|
|
8
|
+
const { placeholder, onFocus: onFocusCallback, onBlur: onBlurCallback, error, value, onChange, ...rest } = textInputProps;
|
|
21
9
|
const { onPressSelect, text } = selectProps;
|
|
22
10
|
const theme = useTheme();
|
|
23
11
|
const { onFocus, onBlur, focused } = useAnimatedInputFocus({
|
|
@@ -25,6 +13,6 @@ const AnimatedInputSelect = (_a, ref) => {
|
|
|
25
13
|
onBlurCallback,
|
|
26
14
|
});
|
|
27
15
|
const inputStatus = getInputStatus({ focused, hasError: !!error, hasValue: !!value });
|
|
28
|
-
return (React.createElement(AnimatedInput,
|
|
16
|
+
return (React.createElement(AnimatedInput, { value: value, ref: ref, onFocus: onFocus, onBlur: onBlur, renderRight: () => (React.createElement(SelectComponent, { text: text, color: inputStatusColors[inputStatus]({ theme }), onPressSelect: onPressSelect })), placeholder: placeholder, onChange: onChange, ...rest }));
|
|
29
17
|
};
|
|
30
18
|
export default React.forwardRef(AnimatedInputSelect);
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React, { useMemo, useCallback, useEffect, useImperativeHandle, useRef } from "react";
|
|
13
2
|
import styled, { css } from "styled-components/native";
|
|
14
3
|
import Text from "../../../Text";
|
|
@@ -88,29 +77,29 @@ export const InputRenderRightContainer = styled(FlexBox).attrs(() => ({
|
|
|
88
77
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89
78
|
const IDENTITY = (_) => _;
|
|
90
79
|
function Input(props, ref) {
|
|
91
|
-
const { value, onChange, onChangeText, onChangeEvent, disabled, error, renderLeft, renderRight, serialize = IDENTITY, deserialize = IDENTITY, containerStyle, hasBorder = true, inputContainerStyle, baseInputContainerStyle, inputErrorContainerStyles, autoFocus, onFocus, onBlur, color, inputErrorColor = "error.c50", showErrorIcon = false
|
|
80
|
+
const { value, onChange, onChangeText, onChangeEvent, disabled, error, renderLeft, renderRight, serialize = IDENTITY, deserialize = IDENTITY, containerStyle, hasBorder = true, inputContainerStyle, baseInputContainerStyle, inputErrorContainerStyles, autoFocus, onFocus, onBlur, color, inputErrorColor = "error.c50", showErrorIcon = false, ...textInputProps } = props;
|
|
92
81
|
const inputRef = useRef();
|
|
93
82
|
useImperativeHandle(ref, () => inputRef.current, [inputRef]);
|
|
94
83
|
const inputValue = useMemo(() => serialize(value), [serialize, value]);
|
|
95
84
|
const handleChange = useCallback((value) => {
|
|
96
|
-
onChange
|
|
97
|
-
onChangeText
|
|
85
|
+
onChange?.(deserialize(value));
|
|
86
|
+
onChangeText?.(value);
|
|
98
87
|
}, [onChange, onChangeText, deserialize]);
|
|
99
88
|
useEffect(() => {
|
|
100
89
|
if (autoFocus && inputRef && inputRef.current && inputRef.current.focus)
|
|
101
90
|
inputRef.current.focus();
|
|
102
91
|
}, [inputRef, autoFocus]);
|
|
103
92
|
const [focus, setFocus] = React.useState(false);
|
|
104
|
-
return (React.createElement(FlexBox, { width: "100%", style: containerStyle
|
|
93
|
+
return (React.createElement(FlexBox, { width: "100%", style: containerStyle ?? undefined },
|
|
105
94
|
React.createElement(InputContainer, { disabled: disabled, focus: focus, hasBorder: hasBorder, error: error, style: inputContainerStyle },
|
|
106
95
|
typeof renderLeft === "function" ? renderLeft(props, inputRef) : renderLeft,
|
|
107
|
-
React.createElement(BaseInput,
|
|
96
|
+
React.createElement(BaseInput, { ref: inputRef, ...textInputProps, value: inputValue, onChange: onChangeEvent, onChangeText: handleChange, editable: !disabled, disabled: disabled, error: error, onFocus: (e) => {
|
|
108
97
|
setFocus(true);
|
|
109
|
-
onFocus
|
|
98
|
+
onFocus?.(e);
|
|
110
99
|
}, onBlur: (e) => {
|
|
111
100
|
setFocus(false);
|
|
112
|
-
onBlur
|
|
113
|
-
}, style:
|
|
101
|
+
onBlur?.(e);
|
|
102
|
+
}, style: { ...(color ? { color: color } : {}), ...baseInputContainerStyle } }),
|
|
114
103
|
typeof renderRight === "function" ? renderRight(props, inputRef) : renderRight),
|
|
115
104
|
!!error && !disabled && (React.createElement(FlexBox, { flexDirection: "row", alignItems: "center", style: inputErrorContainerStyles },
|
|
116
105
|
showErrorIcon && React.createElement(DeleteCircleFill, { color: inputErrorColor, size: "S" }),
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React from "react";
|
|
13
2
|
import Input, { InputRenderRightContainer } from "../BaseInput";
|
|
14
3
|
import Text from "../../../Text";
|
|
15
|
-
function LegendInput(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
React.createElement(Text, { color: "neutral.c70", variant: "body" }, legend)) })));
|
|
4
|
+
function LegendInput({ legend, ...inputProps }, ref) {
|
|
5
|
+
return (React.createElement(Input, { ref: ref, ...inputProps, renderRight: React.createElement(InputRenderRightContainer, null,
|
|
6
|
+
React.createElement(Text, { color: "neutral.c70", variant: "body" }, legend)) }));
|
|
19
7
|
}
|
|
20
8
|
export default React.forwardRef(LegendInput);
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React from "react";
|
|
13
2
|
import { TouchableOpacity } from "react-native";
|
|
14
3
|
import styled from "styled-components/native";
|
|
@@ -38,14 +27,13 @@ function deserialize(value) {
|
|
|
38
27
|
return undefined;
|
|
39
28
|
}
|
|
40
29
|
}
|
|
41
|
-
function NumberInput(
|
|
42
|
-
|
|
43
|
-
return (React.createElement(Input, Object.assign({ ref: ref, serialize: serialize, deserialize: deserialize }, inputProps, { value: value, disabled: disabled, keyboardType: "numeric", renderRight: React.createElement(FlexBox, { alignItems: "center", justifyContent: "center", py: "3px", mr: "8px", flexDirection: "row" }, [0.25, 0.5, 0.75, 1].map((percent) => {
|
|
30
|
+
function NumberInput({ onPercentClick, max, value, disabled, ...inputProps }, ref) {
|
|
31
|
+
return (React.createElement(Input, { ref: ref, serialize: serialize, deserialize: deserialize, ...inputProps, value: value, disabled: disabled, keyboardType: "numeric", renderRight: React.createElement(FlexBox, { alignItems: "center", justifyContent: "center", py: "3px", mr: "8px", flexDirection: "row" }, [0.25, 0.5, 0.75, 1].map((percent) => {
|
|
44
32
|
const active = !!value && !!max && Number(value) === percent * Number(max);
|
|
45
33
|
return (React.createElement(PercentButton, { key: percent, onPress: () => onPercentClick(percent), active: active, disabled: disabled },
|
|
46
34
|
React.createElement(Text, { variant: "small", color: active ? "neutral.c00" : "neutral.c70" },
|
|
47
35
|
percent * 100,
|
|
48
36
|
"%")));
|
|
49
|
-
})) }))
|
|
37
|
+
})) }));
|
|
50
38
|
}
|
|
51
39
|
export default React.forwardRef(NumberInput);
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React from "react";
|
|
13
2
|
import { TouchableOpacity } from "react-native";
|
|
14
3
|
import styled from "styled-components/native";
|
|
@@ -28,10 +17,9 @@ const QrCodeButton = styled(TouchableOpacity) `
|
|
|
28
17
|
const Icon = styled(QrCodeMedium).attrs((p) => ({
|
|
29
18
|
color: p.theme.colors.neutral.c00,
|
|
30
19
|
})) ``;
|
|
31
|
-
function QrCodeInput(
|
|
32
|
-
|
|
33
|
-
return (React.createElement(Input, Object.assign({ ref: ref }, inputProps, { renderRight: React.createElement(FlexBox, { alignItems: "center", justifyContent: "center", pr: "8px" },
|
|
20
|
+
function QrCodeInput({ onQrCodeClick, ...inputProps }, ref) {
|
|
21
|
+
return (React.createElement(Input, { ref: ref, ...inputProps, renderRight: React.createElement(FlexBox, { alignItems: "center", justifyContent: "center", pr: "8px" },
|
|
34
22
|
React.createElement(QrCodeButton, { onPress: onQrCodeClick },
|
|
35
|
-
React.createElement(Icon, { size: "20px" }))) }))
|
|
23
|
+
React.createElement(Icon, { size: "20px" }))) }));
|
|
36
24
|
}
|
|
37
25
|
export default React.forwardRef(QrCodeInput);
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React, { useCallback } from "react";
|
|
13
2
|
import styled, { useTheme } from "styled-components/native";
|
|
14
3
|
import Input, { InputRenderLeftContainer } from "../BaseInput";
|
|
@@ -21,18 +10,17 @@ const Icon = styled(Search).attrs((p) => ({
|
|
|
21
10
|
const Delete = styled(DeleteCircleFill).attrs((p) => ({
|
|
22
11
|
color: p.theme.colors.opacityDefault.c50,
|
|
23
12
|
})) ``;
|
|
24
|
-
function SearchInput(
|
|
25
|
-
var { onChange, value } = _a, props = __rest(_a, ["onChange", "value"]);
|
|
13
|
+
function SearchInput({ onChange, value, ...props }, ref) {
|
|
26
14
|
const theme = useTheme();
|
|
27
15
|
const onClear = useCallback(() => {
|
|
28
|
-
onChange
|
|
16
|
+
onChange?.("");
|
|
29
17
|
}, [onChange]);
|
|
30
|
-
return (React.createElement(Input,
|
|
18
|
+
return (React.createElement(Input, { ref: ref, onChange: onChange, value: value, hasBorder: false, inputContainerStyle: {
|
|
31
19
|
backgroundColor: theme.colors.opacityDefault.c05,
|
|
32
20
|
height: 40,
|
|
33
21
|
paddingHorizontal: 12,
|
|
34
22
|
paddingVertical: 0,
|
|
35
|
-
}, baseInputContainerStyle: { height: 40 }
|
|
36
|
-
React.createElement(Icon, { size: "S" })), renderRight: value ? (React.createElement(Button, { Icon: React.createElement(Delete, { size: "S" }), isNewIcon: true, onPress: onClear, style: { width: "auto", marginLeft: 8 } })) : null }))
|
|
23
|
+
}, baseInputContainerStyle: { height: 40 }, ...props, renderLeft: React.createElement(InputRenderLeftContainer, null,
|
|
24
|
+
React.createElement(Icon, { size: "S" })), renderRight: value ? (React.createElement(Button, { Icon: React.createElement(Delete, { size: "S" }), isNewIcon: true, onPress: onClear, style: { width: "auto", marginLeft: 8 } })) : null }));
|
|
37
25
|
}
|
|
38
26
|
export default React.forwardRef(SearchInput);
|
|
@@ -16,7 +16,7 @@ function Element(props) {
|
|
|
16
16
|
React.createElement(Text, { variant: "large", flex: 1, color: disabled ? "neutral.c50" : selected ? "primary.c90" : "neutral.c100" }, children || value),
|
|
17
17
|
RenderRight && (React.createElement(Flex, { pl: 6, flexShrink: 0 }, React.isValidElement(RenderRight) ? (RenderRight) : (
|
|
18
18
|
/* @ts-expect-error TS 5 can't seem to be able to prove this is a react comopnent here */
|
|
19
|
-
React.createElement(RenderRight,
|
|
19
|
+
React.createElement(RenderRight, { ...props })))))));
|
|
20
20
|
}
|
|
21
21
|
function SelectableList({ currentValue, onChange, children }) {
|
|
22
22
|
return (React.createElement(Flex, { accessible: true, accessibilityRole: "radiogroup" }, React.Children.map(children, (child, index) => {
|
|
@@ -26,8 +26,8 @@ function SelectableList({ currentValue, onChange, children }) {
|
|
|
26
26
|
const casted = child;
|
|
27
27
|
return React.cloneElement(casted, {
|
|
28
28
|
first: index === 0,
|
|
29
|
-
onPress: () => onChange(casted
|
|
30
|
-
selected:
|
|
29
|
+
onPress: () => onChange(casted?.props.value),
|
|
30
|
+
selected: casted?.props.value === currentValue,
|
|
31
31
|
});
|
|
32
32
|
})));
|
|
33
33
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
type TabSelectorProps = {
|
|
2
|
+
type TabSelectorProps<T extends string> = {
|
|
3
3
|
labels: {
|
|
4
|
-
id:
|
|
4
|
+
id: T;
|
|
5
5
|
value: string;
|
|
6
6
|
}[];
|
|
7
|
-
|
|
7
|
+
initialTab?: T extends infer K ? K : never;
|
|
8
|
+
onToggle: (value: T) => void;
|
|
8
9
|
};
|
|
9
|
-
export default function TabSelector({ labels, onToggle }: TabSelectorProps): JSX.Element;
|
|
10
|
+
export default function TabSelector<T extends string>({ labels, initialTab, onToggle, }: TabSelectorProps<T>): JSX.Element;
|
|
10
11
|
export {};
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/TabSelector/index.tsx"],"names":[],"mappings":";AA8BA,KAAK,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/TabSelector/index.tsx"],"names":[],"mappings":";AA8BA,KAAK,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI;IACxC,MAAM,EAAE;QAAE,EAAE,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC3C,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;CAC9B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,EACpD,MAAM,EACN,UAAU,EACV,QAAQ,GACT,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CA4DnC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
2
|
import { Pressable } from "react-native";
|
|
3
3
|
import Animated, { useSharedValue, useAnimatedStyle, withTiming } from "react-native-reanimated";
|
|
4
4
|
import styled from "styled-components/native";
|
|
@@ -24,10 +24,16 @@ const Tab = styled(Flex) `
|
|
|
24
24
|
align-items: center;
|
|
25
25
|
justify-content: center;
|
|
26
26
|
`;
|
|
27
|
-
export default function TabSelector({ labels, onToggle }) {
|
|
28
|
-
const translateX = useSharedValue(0);
|
|
27
|
+
export default function TabSelector({ labels, initialTab, onToggle, }) {
|
|
29
28
|
const [containerWidth, setContainerWidth] = useState(0);
|
|
30
|
-
const
|
|
29
|
+
const initialIndex = initialTab ? labels.findIndex((l) => l.id === initialTab) : 0;
|
|
30
|
+
const translateX = useSharedValue(0);
|
|
31
|
+
const [selectedIndex, setSelectedIndex] = useState(initialIndex);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (containerWidth > 0) {
|
|
34
|
+
translateX.value = (containerWidth / labels.length) * initialIndex;
|
|
35
|
+
}
|
|
36
|
+
}, [containerWidth, labels.length, initialIndex]);
|
|
31
37
|
const handlePress = (id, index) => {
|
|
32
38
|
setSelectedIndex(index);
|
|
33
39
|
translateX.value = (containerWidth / labels.length) * index;
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React from "react";
|
|
13
2
|
import styled, { useTheme } from "styled-components/native";
|
|
14
3
|
import { PixelRatio } from "react-native";
|
|
@@ -78,9 +67,8 @@ export const IconBox = ({ Badge, size = DEFAULT_BOX_SIZE, children, borderColor
|
|
|
78
67
|
hasBadge && (React.createElement(BadgeContainer, { badgeSize: badgeSize },
|
|
79
68
|
React.createElement(Badge, { size: badgeSize, color: badgeColor })))));
|
|
80
69
|
};
|
|
81
|
-
const BoxedIcon = (
|
|
82
|
-
|
|
83
|
-
return (React.createElement(IconBox, Object.assign({}, iconBoxProps), React.isValidElement(Icon) ? (Icon) : (
|
|
70
|
+
const BoxedIcon = ({ Icon, iconSize = DEFAULT_ICON_SIZE, iconColor, ...iconBoxProps }) => {
|
|
71
|
+
return (React.createElement(IconBox, { ...iconBoxProps }, React.isValidElement(Icon) ? (Icon) : (
|
|
84
72
|
/* @ts-expect-error TS 5 can't seem to be able to prove this is a react comopnent here */
|
|
85
73
|
React.createElement(Icon, { size: iconSize || DEFAULT_ICON_SIZE, color: iconColor }))));
|
|
86
74
|
};
|
|
@@ -1,22 +1,10 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React from "react";
|
|
13
2
|
import Flex from "../Layout/Flex";
|
|
14
3
|
export const DEFAULT_ICON_SIZE = 16;
|
|
15
4
|
export const DEFAULT_BACKGROUND_COLOR = "neutral.c40";
|
|
16
5
|
const BORDER_RADIUS = 999999;
|
|
17
|
-
const IconBadge = (
|
|
18
|
-
|
|
19
|
-
return (React.createElement(Flex, Object.assign({ height: iconSize * 2, width: iconSize * 2, backgroundColor: backgroundColor, borderRadius: BORDER_RADIUS, alignItems: "center", justifyContent: "center" }, rest), React.isValidElement(Icon) ? (Icon) : (
|
|
6
|
+
const IconBadge = ({ Icon, iconSize = DEFAULT_ICON_SIZE, backgroundColor = DEFAULT_BACKGROUND_COLOR, iconColor, ...rest }) => {
|
|
7
|
+
return (React.createElement(Flex, { height: iconSize * 2, width: iconSize * 2, backgroundColor: backgroundColor, borderRadius: BORDER_RADIUS, alignItems: "center", justifyContent: "center", ...rest }, React.isValidElement(Icon) ? (Icon) : (
|
|
20
8
|
/* @ts-expect-error TS 5 can't seem to be able to prove this is a react comopnent here */
|
|
21
9
|
React.createElement(Icon, { size: iconSize, color: iconColor }))));
|
|
22
10
|
};
|
|
@@ -15,7 +15,7 @@ const IconContainer = styled(Flex).attrs(({ size = DEFAULT_BOX_SIZE }) => ({
|
|
|
15
15
|
`;
|
|
16
16
|
export default function IconBox({ Icon, color, boxSize = DEFAULT_BOX_SIZE, iconSize = DEFAULT_ICON_SIZE, iconContainerProps, }) {
|
|
17
17
|
const { colors } = useTheme();
|
|
18
|
-
return (React.createElement(IconContainer,
|
|
18
|
+
return (React.createElement(IconContainer, { size: boxSize, ...iconContainerProps }, React.isValidElement(Icon) ? (Icon) : (
|
|
19
19
|
/* @ts-expect-error TS 5 can't seem to be able to prove this is a react comopnent here */
|
|
20
20
|
React.createElement(Icon, { size: iconSize, color: color || colors.neutral.c100 }))));
|
|
21
21
|
}
|
|
@@ -9,8 +9,8 @@ const DividerBase = styled(Flex).attrs((p) => ({
|
|
|
9
9
|
})) ``;
|
|
10
10
|
const Divider = (props) => {
|
|
11
11
|
if (!props.text)
|
|
12
|
-
return React.createElement(DividerBase,
|
|
13
|
-
return (React.createElement(Flex,
|
|
12
|
+
return React.createElement(DividerBase, { ...props });
|
|
13
|
+
return (React.createElement(Flex, { ...props, flexDirection: "row", alignItems: "center" },
|
|
14
14
|
React.createElement(DividerBase, { flex: 1 }),
|
|
15
15
|
React.createElement(Text, { variant: "bodyLineHeight", color: "neutral.c60", mx: 6 }, props.text),
|
|
16
16
|
React.createElement(DividerBase, { flex: 1 })));
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React, { useMemo } from "react";
|
|
13
2
|
import List from "../List";
|
|
14
3
|
import BoxedIcon from "../../../Icon/BoxedIcon";
|
|
15
|
-
export default function IconBoxList(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
export default function IconBoxList({ items, iconVariants, iconShapes, ...props }) {
|
|
5
|
+
const iconBoxItems = useMemo(() => items.map((item) => ({
|
|
6
|
+
...item,
|
|
7
|
+
bullet: (React.createElement(BoxedIcon, { variant: iconShapes, iconColor: iconVariants === "plain" ? "primary.c70" : undefined, backgroundColor: iconVariants === "plain" ? "primary.c10" : undefined, borderColor: iconVariants === "plain" ? "transparent" : undefined, Icon: item.Icon, iconSize: 20 })),
|
|
8
|
+
})), [items]);
|
|
9
|
+
return React.createElement(List, { items: iconBoxItems, ...props });
|
|
19
10
|
}
|
|
@@ -1,29 +1,16 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React, { useCallback } from "react";
|
|
13
2
|
import Text from "../../../Text";
|
|
14
3
|
import { Box, Flex } from "../../index";
|
|
15
4
|
import { FlatList } from "react-native";
|
|
16
|
-
export const ListItem = (
|
|
17
|
-
|
|
18
|
-
return (React.createElement(Flex, Object.assign({ flexDirection: "row", alignItems: "center" }, props),
|
|
5
|
+
export const ListItem = ({ title, description, bullet = null, ...props }) => {
|
|
6
|
+
return (React.createElement(Flex, { flexDirection: "row", alignItems: "center", ...props },
|
|
19
7
|
bullet && (React.createElement(Box, { mr: 7, flexShrink: 0 }, bullet)),
|
|
20
8
|
React.createElement(Flex, { flexDirection: "column", flexShrink: 1, flexWrap: "nowrap" },
|
|
21
9
|
title && (React.createElement(Text, { variant: "body", fontWeight: "semiBold", color: "neutral.c100", flexShrink: 1, mb: description ? 2 : null }, title)),
|
|
22
10
|
description && (React.createElement(Text, { variant: "body", fontWeight: "medium", color: "neutral.c80", flexShrink: 1 }, description)))));
|
|
23
11
|
};
|
|
24
|
-
export default function List(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return (React.createElement(Flex, Object.assign({ flexDirection: "column" }, props),
|
|
12
|
+
export default function List({ items, itemContainerProps, ...props }) {
|
|
13
|
+
const renderItem = useCallback(({ item }) => (React.createElement(ListItem, { ...item, mb: 6, pb: 2, ...itemContainerProps })), [itemContainerProps]);
|
|
14
|
+
return (React.createElement(Flex, { flexDirection: "column", ...props },
|
|
28
15
|
React.createElement(FlatList, { data: items, renderItem: renderItem })));
|
|
29
16
|
}
|
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React, { useMemo } from "react";
|
|
13
2
|
import List from "../List";
|
|
14
3
|
import { IconBox } from "../../../Icon";
|
|
15
4
|
import Text from "../../../Text";
|
|
16
|
-
export default function NumberedList(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return React.createElement(List, Object.assign({ items: numberedItems }, props));
|
|
5
|
+
export default function NumberedList({ items, ...props }) {
|
|
6
|
+
const numberedItems = useMemo(() => items.map((item, index) => ({
|
|
7
|
+
...item,
|
|
8
|
+
bullet: (React.createElement(IconBox, { Icon: React.createElement(Text, { variant: "body", fontWeight: "medium", color: "neutral.c100" }, item.number ?? index + 1), boxSize: 36 })),
|
|
9
|
+
})), [items]);
|
|
10
|
+
return React.createElement(List, { items: numberedItems, ...props });
|
|
23
11
|
}
|