@jobber/components-native 0.54.4-JOB-88641.9 → 0.54.4-fix-inline.3
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/dist/package.json +7 -7
- package/dist/src/ActionItem/ActionItem.js +1 -1
- package/dist/src/Banner/Banner.js +1 -1
- package/dist/src/Button/Button.js +2 -2
- package/dist/src/Button/Button.style.js +2 -2
- package/dist/src/Button/components/InternalButtonLoading/InternalButtonLoading.js +3 -0
- package/dist/src/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/src/ButtonGroup/ButtonGroup.style.js +1 -1
- package/dist/src/Card/Card.js +7 -8
- package/dist/src/Disclosure/Disclosure.js +3 -3
- package/dist/src/Glimmer/Glimmer.js +42 -0
- package/dist/src/Glimmer/Glimmer.shape.style.js +16 -0
- package/dist/src/Glimmer/Glimmer.size.style.js +9 -0
- package/dist/src/Glimmer/Glimmer.style.js +20 -0
- package/dist/src/Glimmer/index.js +1 -0
- package/dist/src/InputCurrency/InputCurrency.js +16 -17
- package/dist/src/InputFieldWrapper/InputFieldWrapper.js +39 -18
- package/dist/src/InputFieldWrapper/InputFieldWrapper.style.js +38 -1
- package/dist/src/InputText/InputText.js +6 -3
- package/dist/src/Menu/Menu.js +20 -3
- package/dist/src/Menu/Menu.style.js +1 -1
- package/dist/src/Menu/utils.js +2 -7
- package/dist/src/index.js +6 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.d.ts +1 -1
- package/dist/types/src/ButtonGroup/ButtonGroup.style.d.ts +1 -1
- package/dist/types/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.d.ts +6 -6
- package/dist/types/src/Checkbox/CheckboxGroup.d.ts +2 -2
- package/dist/types/src/Form/components/FormBody/FormBody.d.ts +3 -3
- package/dist/types/src/Form/components/FormCache/FormCache.d.ts +4 -4
- package/dist/types/src/Form/components/FormMessageBanner/FormMessageBanner.d.ts +1 -1
- package/dist/types/src/FormField/FormField.d.ts +2 -2
- package/dist/types/src/FormatFile/FormatFile.d.ts +6 -6
- package/dist/types/src/FormatFile/components/FileView/FileView.d.ts +6 -6
- package/dist/types/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.d.ts +4 -4
- package/dist/types/src/FormatFile/components/MediaView/MediaView.d.ts +6 -6
- package/dist/types/src/FormatFile/components/ProgressBar/ProgressBar.d.ts +3 -3
- package/dist/types/src/Glimmer/Glimmer.d.ts +31 -0
- package/dist/types/src/Glimmer/Glimmer.shape.style.d.ts +14 -0
- package/dist/types/src/Glimmer/Glimmer.size.style.d.ts +17 -0
- package/dist/types/src/Glimmer/Glimmer.style.d.ts +18 -0
- package/dist/types/src/Glimmer/index.d.ts +1 -0
- package/dist/types/src/InputCurrency/InputCurrency.d.ts +3 -3
- package/dist/types/src/InputFieldWrapper/InputFieldWrapper.d.ts +19 -1
- package/dist/types/src/InputFieldWrapper/InputFieldWrapper.style.d.ts +34 -0
- package/dist/types/src/InputFieldWrapper/components/Prefix/Prefix.d.ts +12 -12
- package/dist/types/src/InputFieldWrapper/components/Suffix/Suffix.d.ts +14 -14
- package/dist/types/src/InputPassword/InputPassword.d.ts +1 -1
- package/dist/types/src/InputText/InputText.d.ts +6 -2
- package/dist/types/src/InputText/context/InputAccessoriesProvider.d.ts +1 -1
- package/dist/types/src/Toast/Toast.d.ts +1 -1
- package/dist/types/src/index.d.ts +6 -5
- package/dist/types/src/utils/test/MockSafeAreaProvider.d.ts +3 -3
- package/jestSetup.js +2 -0
- package/package.json +7 -7
- package/src/ActionItem/ActionItem.test.tsx +2 -2
- package/src/ActionItem/ActionItem.tsx +3 -1
- package/src/ActionItem/ActionItemGroup.tsx +1 -0
- package/src/AutoLink/hooks/useCreateLinkedText.ts +1 -0
- package/src/AutoLink/hooks/useTokenGenerator.ts +1 -0
- package/src/Banner/Banner.tsx +1 -1
- package/src/BottomSheet/BottomSheet.tsx +3 -3
- package/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.tsx +3 -1
- package/src/Button/Button.style.ts +2 -2
- package/src/Button/Button.test.tsx +2 -2
- package/src/Button/Button.tsx +2 -2
- package/src/Button/components/InternalButtonLoading/InternalButtonLoading.tsx +4 -0
- package/src/ButtonGroup/ButtonGroup.style.ts +1 -1
- package/src/ButtonGroup/ButtonGroup.tsx +1 -0
- package/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.tsx +7 -6
- package/src/Card/Card.tsx +31 -32
- package/src/Card/components/InternalCardHeader.tsx +1 -0
- package/src/Checkbox/CheckboxGroup.tsx +12 -2
- package/src/Chip/Chip.tsx +2 -0
- package/src/Content/Content.test.tsx +1 -0
- package/src/Content/Content.tsx +1 -0
- package/src/ContentOverlay/ContentOverlay.test.tsx +1 -0
- package/src/Disclosure/Disclosure.tsx +3 -8
- package/src/Disclosure/__snapshots__/Disclosure.test.tsx.snap +18 -24
- package/src/Divider/Divider.tsx +1 -0
- package/src/EmptyState/EmptyState.tsx +2 -2
- package/src/Flex/Flex.styles.tsx +1 -0
- package/src/Flex/Flex.test.tsx +2 -0
- package/src/Form/Form.test.tsx +19 -14
- package/src/Form/components/FormBody/FormBody.tsx +4 -3
- package/src/Form/components/FormCache/FormCache.tsx +5 -4
- package/src/Form/components/FormMessage/FormMessage.tsx +1 -0
- package/src/Form/components/FormMessageBanner/FormMessageBanner.tsx +1 -1
- package/src/Form/components/FormSaveButton/FormSaveButton.test.tsx +5 -5
- package/src/Form/context/AtlantisFormContext.tsx +1 -0
- package/src/Form/hooks/useFormViewRefs.ts +1 -0
- package/src/Form/hooks/useOfflineHandler.ts +1 -0
- package/src/Form/hooks/useScrollToError/useScrollToError.ts +2 -0
- package/src/FormField/FormField.test.tsx +6 -8
- package/src/FormField/FormField.tsx +2 -2
- package/src/FormatFile/FormatFile.tsx +15 -14
- package/src/FormatFile/components/FileView/FileView.tsx +9 -6
- package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.tsx +4 -4
- package/src/FormatFile/components/MediaView/MediaView.tsx +15 -14
- package/src/FormatFile/components/ProgressBar/ProgressBar.tsx +3 -3
- package/src/FormatFile/utils/createUseCreateThumbnail.ts +1 -0
- package/src/Glimmer/Glimmer.shape.style.ts +17 -0
- package/src/Glimmer/Glimmer.size.style.ts +10 -0
- package/src/Glimmer/Glimmer.style.ts +23 -0
- package/src/Glimmer/Glimmer.test.tsx +73 -0
- package/src/Glimmer/Glimmer.tsx +106 -0
- package/src/Glimmer/index.ts +1 -0
- package/src/Icon/Icon.tsx +1 -0
- package/src/Icon/__snapshots__/Icon.test.tsx.snap +89 -24
- package/src/InputCurrency/InputCurrency.tsx +40 -38
- package/src/InputCurrency/utils.ts +9 -0
- package/src/InputDate/InputDate.test.tsx +1 -0
- package/src/InputFieldWrapper/InputFieldWrapper.style.ts +46 -1
- package/src/InputFieldWrapper/InputFieldWrapper.test.tsx +74 -0
- package/src/InputFieldWrapper/InputFieldWrapper.tsx +131 -64
- package/src/InputFieldWrapper/components/ClearAction/ClearAction.tsx +1 -0
- package/src/InputFieldWrapper/components/Prefix/Prefix.tsx +12 -12
- package/src/InputFieldWrapper/components/Suffix/Suffix.tsx +14 -14
- package/src/InputNumber/InputNumber.tsx +8 -0
- package/src/InputPassword/InputPassword.test.tsx +1 -0
- package/src/InputPassword/InputPassword.tsx +2 -1
- package/src/InputPressable/InputPressable.test.tsx +1 -0
- package/src/InputSearch/InputSearch.tsx +1 -0
- package/src/InputText/InputText.test.tsx +11 -0
- package/src/InputText/InputText.tsx +27 -2
- package/src/InputText/context/InputAccessoriesProvider.test.tsx +6 -1
- package/src/InputText/context/InputAccessoriesProvider.tsx +1 -1
- package/src/InputTime/utils/index.ts +1 -0
- package/src/Menu/Menu.style.ts +1 -1
- package/src/Menu/Menu.tsx +23 -2
- package/src/Menu/components/MenuOption/MenuOption.tsx +1 -0
- package/src/Menu/utils.ts +3 -7
- package/src/ProgressBar/ProgressBarInner.tsx +1 -0
- package/src/Select/components/SelectInternalPicker/SelectInternalPicker.tsx +1 -0
- package/src/Select/components/SelectInternalPicker/utils.ts +1 -0
- package/src/StatusLabel/StatusLabel.tsx +1 -1
- package/src/Switch/components/BaseSwitch/BaseSwitch.tsx +1 -0
- package/src/Text/Text.tsx +1 -0
- package/src/Toast/Toast.tsx +2 -1
- package/src/Typography/Typography.tsx +5 -0
- package/src/hooks/useAtlantisI18n/utils/dateFormatter.ts +1 -0
- package/src/hooks/useFormController.ts +2 -0
- package/src/index.ts +6 -5
- package/src/utils/intl/capitalize.ts +1 -0
- package/src/utils/test/MockSafeAreaProvider.tsx +3 -3
|
@@ -6,7 +6,7 @@ import { Text } from "../Text";
|
|
|
6
6
|
|
|
7
7
|
describe("ActionItem", () => {
|
|
8
8
|
const pressHandler = jest.fn();
|
|
9
|
-
const defaultActionIcon = "
|
|
9
|
+
const defaultActionIcon = "longArrowRight";
|
|
10
10
|
|
|
11
11
|
beforeEach(() => {
|
|
12
12
|
jest.resetAllMocks();
|
|
@@ -63,7 +63,7 @@ describe("ActionItem", () => {
|
|
|
63
63
|
expect(queryByTestId(defaultActionIcon)).toBeFalsy();
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
it("should display
|
|
66
|
+
it("should display longArrowRight icon when edit name is used", () => {
|
|
67
67
|
const iconName = "edit";
|
|
68
68
|
const { getByTestId } = render(
|
|
69
69
|
<ActionItem onPress={pressHandler} actionIcon={iconName} />,
|
|
@@ -116,6 +116,7 @@ function getActionIconColour(
|
|
|
116
116
|
if (actionIconColour === "subtle") {
|
|
117
117
|
return "interactiveSubtle";
|
|
118
118
|
}
|
|
119
|
+
|
|
119
120
|
return actionIconColour;
|
|
120
121
|
}
|
|
121
122
|
|
|
@@ -123,9 +124,10 @@ type ActionIconNames = IconNames | "editpencil";
|
|
|
123
124
|
|
|
124
125
|
function getActionIcon(icon: ActionIconNames): IconNames {
|
|
125
126
|
if (icon === "edit") {
|
|
126
|
-
return "
|
|
127
|
+
return "longArrowRight";
|
|
127
128
|
} else if (icon === "editpencil") {
|
|
128
129
|
return "edit";
|
|
129
130
|
}
|
|
131
|
+
|
|
130
132
|
return icon;
|
|
131
133
|
}
|
|
@@ -4,6 +4,7 @@ import { v1 } from "react-native-uuid";
|
|
|
4
4
|
export function useTokenGenerator(): [() => string, RegExp] {
|
|
5
5
|
let counter = 0;
|
|
6
6
|
const [identifier] = useState(v1());
|
|
7
|
+
|
|
7
8
|
return [
|
|
8
9
|
() => `@__ELEMENT-${identifier}-${counter++}__@`,
|
|
9
10
|
new RegExp(`(@__ELEMENT-${identifier}-\\d+__@)`, "g"),
|
package/src/Banner/Banner.tsx
CHANGED
|
@@ -101,7 +101,7 @@ function BottomSheetInternal(
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
function Header({ heading }: { heading: string }) {
|
|
104
|
+
function Header({ heading }: { readonly heading: string }) {
|
|
105
105
|
return (
|
|
106
106
|
<View style={styles.header}>
|
|
107
107
|
<Heading level={"subtitle"}>{heading}</Heading>
|
|
@@ -113,8 +113,8 @@ function Footer({
|
|
|
113
113
|
cancellable,
|
|
114
114
|
onCancel,
|
|
115
115
|
}: {
|
|
116
|
-
cancellable: boolean;
|
|
117
|
-
onCancel: () => void;
|
|
116
|
+
readonly cancellable: boolean;
|
|
117
|
+
readonly onCancel: () => void;
|
|
118
118
|
}) {
|
|
119
119
|
const insets = useSafeAreaInsets();
|
|
120
120
|
const { t } = useAtlantisI18n();
|
|
@@ -14,8 +14,9 @@ export interface BottomSheetOptionProps {
|
|
|
14
14
|
readonly textAlign?: TextAlign;
|
|
15
15
|
readonly destructive?: boolean;
|
|
16
16
|
readonly textTransform?: "none" | "capitalize";
|
|
17
|
-
onPress: () => void;
|
|
17
|
+
readonly onPress: () => void;
|
|
18
18
|
}
|
|
19
|
+
|
|
19
20
|
export function BottomSheetOption({
|
|
20
21
|
text,
|
|
21
22
|
icon,
|
|
@@ -27,6 +28,7 @@ export function BottomSheetOption({
|
|
|
27
28
|
}: BottomSheetOptionProps): JSX.Element {
|
|
28
29
|
const destructiveColor = "critical";
|
|
29
30
|
const textVariation = destructive ? destructiveColor : "subdued";
|
|
31
|
+
|
|
30
32
|
return (
|
|
31
33
|
<TouchableOpacity
|
|
32
34
|
style={styles.bottomSheetOption}
|
|
@@ -79,8 +79,8 @@ export const styles = StyleSheet.create({
|
|
|
79
79
|
},
|
|
80
80
|
|
|
81
81
|
learning: {
|
|
82
|
-
backgroundColor: tokens["color-
|
|
83
|
-
borderColor: tokens["color-
|
|
82
|
+
backgroundColor: tokens["color-interactive--subtle"],
|
|
83
|
+
borderColor: tokens["color-interactive--subtle"],
|
|
84
84
|
},
|
|
85
85
|
|
|
86
86
|
destructive: {
|
|
@@ -78,7 +78,7 @@ describe("Button", () => {
|
|
|
78
78
|
},
|
|
79
79
|
],
|
|
80
80
|
["destructive", { bgColor: tokens["color-destructive"] }],
|
|
81
|
-
["learning", { bgColor: tokens["color-
|
|
81
|
+
["learning", { bgColor: tokens["color-interactive--subtle"] }],
|
|
82
82
|
])("renders a %s Button", (variation, { bgColor, borderColor }) => {
|
|
83
83
|
const { buttonStyle } = renderButton(
|
|
84
84
|
<Button label={variation} variation={variation} onPress={jest.fn()} />,
|
|
@@ -218,7 +218,7 @@ describe("Button", () => {
|
|
|
218
218
|
variation: "learning",
|
|
219
219
|
type: "secondary",
|
|
220
220
|
});
|
|
221
|
-
expect(iconColor).toBe(tokens["color-
|
|
221
|
+
expect(iconColor).toBe(tokens["color-interactive--subtle"]);
|
|
222
222
|
expect(textColor).toBe(iconColor);
|
|
223
223
|
});
|
|
224
224
|
|
package/src/Button/Button.tsx
CHANGED
|
@@ -179,7 +179,7 @@ function getActionLabelVariation(
|
|
|
179
179
|
|
|
180
180
|
switch (variation) {
|
|
181
181
|
case "learning":
|
|
182
|
-
return "
|
|
182
|
+
return "subtle";
|
|
183
183
|
case "destructive":
|
|
184
184
|
return "destructive";
|
|
185
185
|
case "cancel":
|
|
@@ -204,7 +204,7 @@ function getIconColorVariation(
|
|
|
204
204
|
|
|
205
205
|
switch (variation) {
|
|
206
206
|
case "learning":
|
|
207
|
-
return "
|
|
207
|
+
return "interactiveSubtle";
|
|
208
208
|
case "destructive":
|
|
209
209
|
return "destructive";
|
|
210
210
|
case "cancel":
|
|
@@ -21,6 +21,9 @@ const imageWidth = 96;
|
|
|
21
21
|
const offset = PixelRatio.roundToNearestPixel(imageWidth / PixelRatio.get());
|
|
22
22
|
const leftOffset = -1 * offset;
|
|
23
23
|
|
|
24
|
+
// looks like deprecation for FlatList in reanimated is cascading down to other exports
|
|
25
|
+
// This is not createAnimatedComponent(FlatList), we are fine
|
|
26
|
+
// eslint-disable-next-line import/no-deprecated
|
|
24
27
|
const AnimatedImage = Animated.createAnimatedComponent(ImageBackground);
|
|
25
28
|
|
|
26
29
|
function InternalButtonLoadingInternal({
|
|
@@ -71,6 +74,7 @@ function getLoadingPattern({
|
|
|
71
74
|
}: InternalButtonLoadingProps): string {
|
|
72
75
|
if (variation === "cancel") return darkPattern;
|
|
73
76
|
if (type === "primary") return lightPattern;
|
|
77
|
+
|
|
74
78
|
return darkPattern;
|
|
75
79
|
}
|
|
76
80
|
|
|
@@ -6,11 +6,11 @@ export const styles = StyleSheet.create({
|
|
|
6
6
|
width: "100%",
|
|
7
7
|
flexDirection: "row",
|
|
8
8
|
justifyContent: "flex-end",
|
|
9
|
+
gap: tokens["space-small"],
|
|
9
10
|
},
|
|
10
11
|
button: {
|
|
11
12
|
flexBasis: tokens["space-largest"],
|
|
12
13
|
flexGrow: 1,
|
|
13
|
-
paddingRight: tokens["space-smaller"],
|
|
14
14
|
},
|
|
15
15
|
moreButton: {
|
|
16
16
|
flexBasis: tokens["space-largest"],
|
|
@@ -6,12 +6,12 @@ import { BottomSheetOption } from "../../../BottomSheet/components/BottomSheetOp
|
|
|
6
6
|
import { BottomSheet, BottomSheetRef } from "../../../BottomSheet/BottomSheet";
|
|
7
7
|
|
|
8
8
|
interface SecondaryActionSheetProps {
|
|
9
|
-
actions: ButtonGroupSecondaryActionProps[];
|
|
10
|
-
secondaryActionsRef: RefObject<BottomSheetRef>;
|
|
11
|
-
showCancel?: boolean;
|
|
12
|
-
heading?: string;
|
|
13
|
-
onOpenBottomSheet?: () => void;
|
|
14
|
-
onCloseBottomSheet?: () => void;
|
|
9
|
+
readonly actions: ButtonGroupSecondaryActionProps[];
|
|
10
|
+
readonly secondaryActionsRef: RefObject<BottomSheetRef>;
|
|
11
|
+
readonly showCancel?: boolean;
|
|
12
|
+
readonly heading?: string;
|
|
13
|
+
readonly onOpenBottomSheet?: () => void;
|
|
14
|
+
readonly onCloseBottomSheet?: () => void;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export function SecondaryActionSheet({
|
|
@@ -34,6 +34,7 @@ export function SecondaryActionSheet({
|
|
|
34
34
|
<View>
|
|
35
35
|
{actions.map((action, index) => {
|
|
36
36
|
const { label, onPress, icon, iconColor, destructive } = action;
|
|
37
|
+
|
|
37
38
|
return (
|
|
38
39
|
<BottomSheetOption
|
|
39
40
|
destructive={destructive}
|
package/src/Card/Card.tsx
CHANGED
|
@@ -65,6 +65,7 @@ function getElevationStyle(elevation: elevationProp) {
|
|
|
65
65
|
if (elevation === "none") {
|
|
66
66
|
return undefined;
|
|
67
67
|
}
|
|
68
|
+
|
|
68
69
|
return styles[`${elevation}Elevation`];
|
|
69
70
|
}
|
|
70
71
|
|
|
@@ -85,39 +86,37 @@ export function Card({
|
|
|
85
86
|
testID={testID}
|
|
86
87
|
>
|
|
87
88
|
{header && (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
>
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
{
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
)}
|
|
89
|
+
<InternalCardHeader
|
|
90
|
+
onPress={header.onPress}
|
|
91
|
+
testID={`${testID}Header`}
|
|
92
|
+
collapsable={!!children}
|
|
93
|
+
>
|
|
94
|
+
<View style={styles.headerTitle}>
|
|
95
|
+
<Typography
|
|
96
|
+
color="heading"
|
|
97
|
+
fontFamily="base"
|
|
98
|
+
fontWeight="bold"
|
|
99
|
+
size="default"
|
|
100
|
+
lineHeight="base"
|
|
101
|
+
accessibilityRole="header"
|
|
102
|
+
>
|
|
103
|
+
{header.title}
|
|
104
|
+
</Typography>
|
|
105
|
+
</View>
|
|
106
|
+
<View style={styles.actionItem}>
|
|
107
|
+
{!!header.actionItem?.label && (
|
|
108
|
+
<View style={styles.actionLabel}>
|
|
109
|
+
<ActionLabel type="cardTitle">
|
|
110
|
+
{header.actionItem.label}
|
|
111
|
+
</ActionLabel>
|
|
112
|
+
</View>
|
|
113
|
+
)}
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
</>
|
|
115
|
+
{header.actionItem?.iconName && (
|
|
116
|
+
<Icon name={header.actionItem.iconName} color="interactive" />
|
|
117
|
+
)}
|
|
118
|
+
</View>
|
|
119
|
+
</InternalCardHeader>
|
|
121
120
|
)}
|
|
122
121
|
{children}
|
|
123
122
|
{footer && (
|
|
@@ -17,9 +17,9 @@ interface CommonCheckboxGroupProps extends Omit<CheckboxProps, "onChange"> {
|
|
|
17
17
|
/**
|
|
18
18
|
* Checkbox items
|
|
19
19
|
*/
|
|
20
|
-
children: CheckboxElement[];
|
|
20
|
+
readonly children: CheckboxElement[];
|
|
21
21
|
|
|
22
|
-
state?: CheckboxGroupState;
|
|
22
|
+
readonly state?: CheckboxGroupState;
|
|
23
23
|
|
|
24
24
|
onChange?(groupChecks: CheckboxGroupState): void;
|
|
25
25
|
}
|
|
@@ -38,6 +38,7 @@ export type CheckboxGroupProps = XOR<
|
|
|
38
38
|
UncontrolledCheckboxGroupProps,
|
|
39
39
|
ControlledCheckboxGroupProps
|
|
40
40
|
>;
|
|
41
|
+
|
|
41
42
|
export function CheckboxGroup({
|
|
42
43
|
children,
|
|
43
44
|
state,
|
|
@@ -57,6 +58,7 @@ export function CheckboxGroup({
|
|
|
57
58
|
</CheckboxGroupInternal>
|
|
58
59
|
);
|
|
59
60
|
}
|
|
61
|
+
|
|
60
62
|
if (name) {
|
|
61
63
|
return (
|
|
62
64
|
<FormField name={name}>
|
|
@@ -114,6 +116,7 @@ function CheckboxGroupInternal({
|
|
|
114
116
|
): React.ReactElement<CheckboxProps> {
|
|
115
117
|
const name = throwErrorIfItHasNoName(checkbox.props.name);
|
|
116
118
|
const childDisabled = disabled || checkbox.props.disabled;
|
|
119
|
+
|
|
117
120
|
const childrenHandleChange = (checked: boolean) => {
|
|
118
121
|
const childrenNextValue = {
|
|
119
122
|
...actualCheckedValues.childrenChecked,
|
|
@@ -126,6 +129,7 @@ function CheckboxGroupInternal({
|
|
|
126
129
|
parentChecked: parentNextValue,
|
|
127
130
|
});
|
|
128
131
|
};
|
|
132
|
+
|
|
129
133
|
return React.cloneElement(checkbox, {
|
|
130
134
|
onChange: childrenHandleChange,
|
|
131
135
|
checked: actualCheckedValues.childrenChecked[name],
|
|
@@ -141,6 +145,7 @@ function CheckboxGroupInternal({
|
|
|
141
145
|
}
|
|
142
146
|
|
|
143
147
|
const name = throwErrorIfItHasNoName(child.props.name);
|
|
148
|
+
|
|
144
149
|
return {
|
|
145
150
|
...childCheckboxObject,
|
|
146
151
|
[name]: cloneChildCheckbox(child),
|
|
@@ -153,9 +158,11 @@ function CheckboxGroupInternal({
|
|
|
153
158
|
childName: string,
|
|
154
159
|
): boolean {
|
|
155
160
|
const currentCheckbox = checkboxObject[childName];
|
|
161
|
+
|
|
156
162
|
if (currentCheckbox?.props?.disabled) {
|
|
157
163
|
return acc;
|
|
158
164
|
}
|
|
165
|
+
|
|
159
166
|
return acc && value;
|
|
160
167
|
}
|
|
161
168
|
|
|
@@ -174,6 +181,7 @@ function CheckboxGroupInternal({
|
|
|
174
181
|
actualCheckedValues.childrenChecked,
|
|
175
182
|
(acc, currentCheckboxValue, childName) => {
|
|
176
183
|
const currentCheckbox = checkboxObject[childName];
|
|
184
|
+
|
|
177
185
|
return currentCheckbox?.props?.disabled
|
|
178
186
|
? {
|
|
179
187
|
...acc,
|
|
@@ -215,11 +223,13 @@ function throwErrorIfItHasNoName(name?: string): string {
|
|
|
215
223
|
"You must provide a name to checkboxes in a checkbox group",
|
|
216
224
|
);
|
|
217
225
|
}
|
|
226
|
+
|
|
218
227
|
return name;
|
|
219
228
|
}
|
|
220
229
|
|
|
221
230
|
function checkIndeterminateStatus(checkedValues: CheckboxGroupState): boolean {
|
|
222
231
|
const checkedValuesAsArray = Object.values(checkedValues.childrenChecked);
|
|
232
|
+
|
|
223
233
|
if (checkedValuesAsArray.length === 1) {
|
|
224
234
|
return false;
|
|
225
235
|
}
|
package/src/Chip/Chip.tsx
CHANGED
|
@@ -97,9 +97,11 @@ export function Chip({
|
|
|
97
97
|
|
|
98
98
|
const accessibilityState = useMemo(() => {
|
|
99
99
|
const checkableRoles = ["radio", "switch", "togglebutton", "checkbox"];
|
|
100
|
+
|
|
100
101
|
if (checkableRoles.includes(accessibilityRole)) {
|
|
101
102
|
return { checked: isActive };
|
|
102
103
|
}
|
|
104
|
+
|
|
103
105
|
return {};
|
|
104
106
|
}, [accessibilityRole, isActive]);
|
|
105
107
|
|
|
@@ -39,6 +39,7 @@ function setupContent(
|
|
|
39
39
|
const parentView = container.getByLabelText("contentView");
|
|
40
40
|
const contentView = getContentComponent(parentView);
|
|
41
41
|
const contentChildren = getContentChildren(contentView);
|
|
42
|
+
|
|
42
43
|
return { ...container, parentView, contentView, contentChildren };
|
|
43
44
|
}
|
|
44
45
|
|
package/src/Content/Content.tsx
CHANGED
|
@@ -56,6 +56,7 @@ export function Content({
|
|
|
56
56
|
// In order to get spacing between the children, we apply the child spacing on each of
|
|
57
57
|
// the children except for the first (top) child
|
|
58
58
|
const childStyle = index !== 0 ? [childContainerStyle] : [];
|
|
59
|
+
|
|
59
60
|
return (
|
|
60
61
|
<View key={index} style={[styles.childWrapper, ...childStyle]}>
|
|
61
62
|
{child}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import {
|
|
3
|
-
LayoutChangeEvent,
|
|
4
|
-
ScrollView,
|
|
5
|
-
TouchableOpacity,
|
|
6
|
-
View,
|
|
7
|
-
} from "react-native";
|
|
2
|
+
import { LayoutChangeEvent, TouchableOpacity, View } from "react-native";
|
|
8
3
|
import Reanimated, {
|
|
9
4
|
Easing,
|
|
10
5
|
useAnimatedStyle,
|
|
@@ -16,8 +11,8 @@ import { styles } from "./Disclosure.style";
|
|
|
16
11
|
import { tokens } from "../utils/design";
|
|
17
12
|
import { Icon } from "../Icon";
|
|
18
13
|
|
|
19
|
-
const ReanimatedView = Reanimated.
|
|
20
|
-
const ReanimatedScrollView = Reanimated.
|
|
14
|
+
const ReanimatedView = Reanimated.View;
|
|
15
|
+
const ReanimatedScrollView = Reanimated.ScrollView;
|
|
21
16
|
|
|
22
17
|
interface DisclosureProps {
|
|
23
18
|
/**
|
|
@@ -117,18 +117,16 @@ exports[`renders a Disclosure with a header and a content when open is true 1`]
|
|
|
117
117
|
</View>
|
|
118
118
|
</View>
|
|
119
119
|
<RCTScrollView
|
|
120
|
+
collapsable={false}
|
|
120
121
|
scrollEnabled={false}
|
|
122
|
+
scrollEventThrottle={0.0001}
|
|
121
123
|
showsHorizontalScrollIndicator={false}
|
|
122
124
|
showsVerticalScrollIndicator={false}
|
|
123
125
|
style={
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
{
|
|
129
|
-
"height": 100,
|
|
130
|
-
},
|
|
131
|
-
]
|
|
126
|
+
{
|
|
127
|
+
"height": 100,
|
|
128
|
+
"paddingTop": 8,
|
|
129
|
+
}
|
|
132
130
|
}
|
|
133
131
|
>
|
|
134
132
|
<View>
|
|
@@ -290,18 +288,16 @@ exports[`renders a Disclosure with a header and with a content of size 0 when cl
|
|
|
290
288
|
</View>
|
|
291
289
|
</View>
|
|
292
290
|
<RCTScrollView
|
|
291
|
+
collapsable={false}
|
|
293
292
|
scrollEnabled={false}
|
|
293
|
+
scrollEventThrottle={0.0001}
|
|
294
294
|
showsHorizontalScrollIndicator={false}
|
|
295
295
|
showsVerticalScrollIndicator={false}
|
|
296
296
|
style={
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
{
|
|
302
|
-
"height": 0,
|
|
303
|
-
},
|
|
304
|
-
]
|
|
297
|
+
{
|
|
298
|
+
"height": 0,
|
|
299
|
+
"paddingTop": 8,
|
|
300
|
+
}
|
|
305
301
|
}
|
|
306
302
|
>
|
|
307
303
|
<View>
|
|
@@ -431,18 +427,16 @@ exports[`should not render the caret when the Disclosure is empty 1`] = `
|
|
|
431
427
|
</View>
|
|
432
428
|
</View>
|
|
433
429
|
<RCTScrollView
|
|
430
|
+
collapsable={false}
|
|
434
431
|
scrollEnabled={false}
|
|
432
|
+
scrollEventThrottle={0.0001}
|
|
435
433
|
showsHorizontalScrollIndicator={false}
|
|
436
434
|
showsVerticalScrollIndicator={false}
|
|
437
435
|
style={
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
{
|
|
443
|
-
"height": 0,
|
|
444
|
-
},
|
|
445
|
-
]
|
|
436
|
+
{
|
|
437
|
+
"height": 0,
|
|
438
|
+
"paddingTop": 8,
|
|
439
|
+
}
|
|
446
440
|
}
|
|
447
441
|
>
|
|
448
442
|
<View>
|
package/src/Divider/Divider.tsx
CHANGED
package/src/Flex/Flex.styles.tsx
CHANGED
package/src/Flex/Flex.test.tsx
CHANGED
|
@@ -17,6 +17,7 @@ function getContentComponent(parentView: ReactTestInstance) {
|
|
|
17
17
|
function getFlexCol(flexRow: ReactTestInstance) {
|
|
18
18
|
return flexRow.children as ReactTestInstance[];
|
|
19
19
|
}
|
|
20
|
+
|
|
20
21
|
function setUp(props?: FlexProps) {
|
|
21
22
|
const container = render(
|
|
22
23
|
<View accessibilityLabel="contentView">
|
|
@@ -33,6 +34,7 @@ function setUp(props?: FlexProps) {
|
|
|
33
34
|
);
|
|
34
35
|
const flexRow = container.getAllByTestId("ATL-Flex-Row");
|
|
35
36
|
const flexCol = getFlexCol(flexRow[0]);
|
|
37
|
+
|
|
36
38
|
return { ...container, contentView, flexRow, flexCol };
|
|
37
39
|
}
|
|
38
40
|
|
package/src/Form/Form.test.tsx
CHANGED
|
@@ -16,6 +16,7 @@ import { InputText } from "../InputText";
|
|
|
16
16
|
jest.mock("lodash/debounce", () => {
|
|
17
17
|
return jest.fn(fn => {
|
|
18
18
|
fn.cancel = jest.fn();
|
|
19
|
+
|
|
19
20
|
return fn;
|
|
20
21
|
});
|
|
21
22
|
});
|
|
@@ -83,24 +84,24 @@ interface FormFields {
|
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
interface FormTestProps {
|
|
86
|
-
onSubmit: jest.Mock;
|
|
87
|
-
sendBannerErrors?: boolean;
|
|
88
|
-
sendNetworkErrors?: boolean;
|
|
89
|
-
saveLabel?: string;
|
|
90
|
-
renderStickySection?: (
|
|
87
|
+
readonly onSubmit: jest.Mock;
|
|
88
|
+
readonly sendBannerErrors?: boolean;
|
|
89
|
+
readonly sendNetworkErrors?: boolean;
|
|
90
|
+
readonly saveLabel?: string;
|
|
91
|
+
readonly renderStickySection?: (
|
|
91
92
|
onSubmit: () => void,
|
|
92
93
|
label: string | undefined,
|
|
93
94
|
isSubmitting: boolean,
|
|
94
95
|
) => JSX.Element;
|
|
95
|
-
initialLoading?: boolean;
|
|
96
|
-
initialValues?: FormFields;
|
|
97
|
-
bannerMessages?: FormBannerMessage[];
|
|
98
|
-
localCacheKey?: string;
|
|
99
|
-
localCacheExclude?: string[];
|
|
100
|
-
localCacheId?: string[] | string;
|
|
101
|
-
onBeforeSubmit?: jest.Mock;
|
|
102
|
-
renderFooter?: React.ReactNode;
|
|
103
|
-
saveButtonOffset?: number;
|
|
96
|
+
readonly initialLoading?: boolean;
|
|
97
|
+
readonly initialValues?: FormFields;
|
|
98
|
+
readonly bannerMessages?: FormBannerMessage[];
|
|
99
|
+
readonly localCacheKey?: string;
|
|
100
|
+
readonly localCacheExclude?: string[];
|
|
101
|
+
readonly localCacheId?: string[] | string;
|
|
102
|
+
readonly onBeforeSubmit?: jest.Mock;
|
|
103
|
+
readonly renderFooter?: React.ReactNode;
|
|
104
|
+
readonly saveButtonOffset?: number;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
function FormTest(props: FormTestProps) {
|
|
@@ -124,9 +125,11 @@ function MockForm({
|
|
|
124
125
|
saveButtonOffset,
|
|
125
126
|
}: FormTestProps) {
|
|
126
127
|
const formErrors: FormBannerErrors = {};
|
|
128
|
+
|
|
127
129
|
if (sendBannerErrors) {
|
|
128
130
|
formErrors.bannerError = bannerError;
|
|
129
131
|
}
|
|
132
|
+
|
|
130
133
|
if (sendNetworkErrors) {
|
|
131
134
|
formErrors.networkError = "Ouch";
|
|
132
135
|
}
|
|
@@ -408,6 +411,7 @@ describe("Form", () => {
|
|
|
408
411
|
errorType: FormSubmitErrorType.NetworkError,
|
|
409
412
|
}),
|
|
410
413
|
);
|
|
414
|
+
|
|
411
415
|
const setup = () => {
|
|
412
416
|
const view = render(
|
|
413
417
|
<FormTest sendNetworkErrors={true} onSubmit={mockSubmit} />,
|
|
@@ -421,6 +425,7 @@ describe("Form", () => {
|
|
|
421
425
|
newValue,
|
|
422
426
|
);
|
|
423
427
|
fireEvent.press(getByLabelText(saveButtonText));
|
|
428
|
+
|
|
424
429
|
return view;
|
|
425
430
|
};
|
|
426
431
|
|