@jobber/components-native 0.84.4-match-mobi-55ef4ec.7 → 0.84.4-match-mobi-540af48.10
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 +26 -15
- package/dist/src/ActionItem/ActionItemGroup.js +1 -1
- package/dist/src/AutoLink/components/Link/Link.js +1 -1
- package/dist/src/Banner/Banner.js +2 -0
- package/dist/src/Banner/components/BannerIcon/BannerIcon.style.js +3 -0
- package/dist/src/BottomSheet/BottomSheet.js +58 -32
- package/dist/src/BottomSheet/BottomSheet.style.js +8 -9
- package/dist/src/BottomSheet/hooks/useBottomSheetBackHandler.js +26 -0
- package/dist/src/Button/components/InternalButtonLoading/InternalButtonLoading.js +0 -1
- package/dist/src/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/src/Chip/Chip.js +12 -1
- package/dist/src/Chip/Chip.style.js +1 -1
- package/dist/src/Content/ContentHorizontal.style.js +15 -0
- package/dist/src/Content/ContentSpaceAround.style.js +15 -0
- package/dist/src/Content/ContentVertical.style.js +15 -0
- package/dist/src/ContentOverlay/ContentOverlay.js +5 -7
- package/dist/src/ContentOverlay/UNSAFE_WrappedModalize.js +23 -0
- package/dist/src/ErrorMessageWrapper/context/ErrorMessageProvider.js +1 -1
- package/dist/src/Form/Form.js +5 -2
- package/dist/src/Form/components/FormCache/FormCache.js +1 -0
- package/dist/src/Form/components/FormMessageBanner/FormMessageBanner.js +1 -1
- package/dist/src/Form/context/AtlantisFormContext.js +1 -0
- package/dist/src/Form/hooks/useInternalForm.js +6 -3
- package/dist/src/FormatFile/components/MediaView/MediaView.js +22 -5
- package/dist/src/FormatFile/utils/createUseCreateThumbnail.js +1 -1
- package/dist/src/InputCurrency/InputCurrency.js +42 -30
- package/dist/src/InputDate/InputDate.js +2 -2
- package/dist/src/InputEmail/InputEmail.js +12 -4
- package/dist/src/InputFieldWrapper/InputFieldWrapper.js +14 -12
- package/dist/src/InputFieldWrapper/InputFieldWrapper.style.js +1 -1
- package/dist/src/InputFieldWrapper/components/Prefix/Prefix.js +5 -2
- package/dist/src/InputFieldWrapper/components/Suffix/Suffix.js +5 -2
- package/dist/src/InputNumber/InputNumber.js +10 -4
- package/dist/src/InputPressable/InputPressable.js +20 -8
- package/dist/src/InputPressable/InputPressable.style.js +3 -0
- package/dist/src/InputSearch/InputSearch.js +1 -1
- package/dist/src/InputText/InputText.js +24 -13
- package/dist/src/InputText/InputText.style.js +4 -0
- package/dist/src/InputTime/InputTime.js +2 -2
- package/dist/src/Menu/Menu.js +2 -2
- package/dist/src/ProgressBar/ProgressBar.js +10 -6
- package/dist/src/ProgressBar/ProgressBarInner.js +3 -12
- package/dist/src/ProgressBar/ProgressBarStepped.js +7 -2
- package/dist/src/Select/Select.style.js +1 -0
- package/dist/src/Select/components/SelectPressable/SelectPressable.js +1 -1
- package/dist/src/StatusLabel/StatusLabel.style.js +2 -2
- package/dist/src/Switch/components/BaseSwitch/BaseSwitch.js +7 -1
- package/dist/src/Typography/Typography.js +16 -5
- package/dist/src/hooks/useAtlantisI18n/locales/en.json +1 -0
- package/dist/src/hooks/useAtlantisI18n/locales/es.json +1 -0
- package/dist/src/hooks/useFormController.js +6 -15
- package/dist/tsconfig.build.json +7 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/tsconfig.json +4 -6
- package/dist/types/src/ActionItem/ActionItem.d.ts +2 -1
- package/dist/types/src/ActionItem/ActionItemGroup.d.ts +2 -1
- package/dist/types/src/ActionItem/components/ActionItemContainer.d.ts +2 -1
- package/dist/types/src/ActionLabel/ActionLabel.d.ts +4 -3
- package/dist/types/src/ActivityIndicator/ActivityIndicator.d.ts +2 -1
- package/dist/types/src/AutoLink/AutoLink.d.ts +2 -1
- package/dist/types/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.d.ts +2 -1
- package/dist/types/src/AutoLink/components/Link/Link.d.ts +2 -1
- package/dist/types/src/Banner/Banner.d.ts +2 -1
- package/dist/types/src/Banner/components/BannerIcon/BannerIcon.d.ts +2 -1
- package/dist/types/src/Banner/components/BannerIcon/BannerIcon.style.d.ts +3 -0
- package/dist/types/src/Banner/types.d.ts +1 -1
- package/dist/types/src/BottomSheet/BottomSheet.d.ts +7 -3
- package/dist/types/src/BottomSheet/BottomSheet.style.d.ts +7 -14
- package/dist/types/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.d.ts +2 -1
- package/dist/types/src/BottomSheet/hooks/useBottomSheetBackHandler.d.ts +8 -0
- package/dist/types/src/Button/Button.d.ts +2 -1
- package/dist/types/src/Button/components/InternalButtonLoading/InternalButtonLoading.d.ts +1 -1
- package/dist/types/src/ButtonGroup/ButtonGroup.d.ts +2 -1
- package/dist/types/src/ButtonGroup/ButtonGroupAction.d.ts +4 -3
- package/dist/types/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.d.ts +3 -2
- package/dist/types/src/Card/Card.d.ts +2 -1
- package/dist/types/src/Card/components/InternalCardHeader.d.ts +2 -1
- package/dist/types/src/Checkbox/Checkbox.d.ts +2 -1
- package/dist/types/src/Checkbox/CheckboxGroup.d.ts +2 -1
- package/dist/types/src/Chip/Chip.d.ts +2 -1
- package/dist/types/src/Content/Content.d.ts +3 -2
- package/dist/types/src/Content/ContentHorizontal.style.d.ts +15 -0
- package/dist/types/src/Content/ContentSpaceAround.style.d.ts +15 -0
- package/dist/types/src/Content/ContentVertical.style.d.ts +15 -0
- package/dist/types/src/ContentOverlay/ContentOverlay.d.ts +1 -1
- package/dist/types/src/ContentOverlay/UNSAFE_WrappedModalize.d.ts +3 -0
- package/dist/types/src/Disclosure/Disclosure.d.ts +1 -1
- package/dist/types/src/Divider/Divider.d.ts +2 -1
- package/dist/types/src/EmptyState/EmptyState.d.ts +2 -1
- package/dist/types/src/ErrorMessageWrapper/ErrorMessageWrapper.d.ts +2 -1
- package/dist/types/src/ErrorMessageWrapper/context/ErrorMessageProvider.d.ts +2 -1
- package/dist/types/src/ErrorMessageWrapper/context/types.d.ts +1 -1
- package/dist/types/src/Flex/Flex.d.ts +2 -1
- package/dist/types/src/Form/Form.d.ts +2 -1
- package/dist/types/src/Form/components/FormActionBar/FormActionBar.d.ts +3 -2
- package/dist/types/src/Form/components/FormBody/FormBody.d.ts +3 -2
- package/dist/types/src/Form/components/FormCache/FormCache.d.ts +4 -3
- package/dist/types/src/Form/components/FormErrorBanner/FormErrorBanner.d.ts +2 -1
- package/dist/types/src/Form/components/FormMask/FormMask.d.ts +2 -1
- package/dist/types/src/Form/components/FormMessage/FormMessage.d.ts +2 -1
- package/dist/types/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.d.ts +2 -1
- package/dist/types/src/Form/components/FormMessageBanner/FormMessageBanner.d.ts +2 -1
- package/dist/types/src/Form/components/FormSaveButton/FormSaveButton.d.ts +2 -1
- package/dist/types/src/Form/context/AtlantisFormContext.d.ts +2 -1
- package/dist/types/src/Form/context/types.d.ts +5 -4
- package/dist/types/src/Form/hooks/useFormViewRefs.d.ts +2 -2
- package/dist/types/src/Form/hooks/useInternalForm.d.ts +7 -7
- package/dist/types/src/Form/types.d.ts +13 -7
- package/dist/types/src/FormField/FormField.d.ts +1 -1
- package/dist/types/src/FormatFile/FormatFile.d.ts +2 -1
- package/dist/types/src/FormatFile/components/ErrorIcon/ErrorIcon.d.ts +2 -1
- package/dist/types/src/FormatFile/components/FileView/FileView.d.ts +2 -1
- package/dist/types/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.d.ts +3 -2
- package/dist/types/src/FormatFile/components/MediaView/MediaView.d.ts +2 -1
- package/dist/types/src/FormatFile/components/ProgressBar/ProgressBar.d.ts +2 -1
- package/dist/types/src/Heading/Heading.d.ts +4 -3
- package/dist/types/src/Icon/Icon.d.ts +2 -1
- package/dist/types/src/IconButton/IconButton.d.ts +1 -1
- package/dist/types/src/InputCurrency/InputCurrency.d.ts +2 -1
- package/dist/types/src/InputDate/InputDate.d.ts +4 -2
- package/dist/types/src/InputFieldWrapper/InputFieldWrapper.d.ts +9 -2
- package/dist/types/src/InputFieldWrapper/InputFieldWrapper.style.d.ts +1 -1
- package/dist/types/src/InputFieldWrapper/components/ClearAction/ClearAction.d.ts +2 -1
- package/dist/types/src/InputFieldWrapper/components/Prefix/Prefix.d.ts +4 -4
- package/dist/types/src/InputFieldWrapper/components/Suffix/Suffix.d.ts +4 -4
- package/dist/types/src/InputPressable/InputPressable.d.ts +9 -1
- package/dist/types/src/InputPressable/InputPressable.style.d.ts +3 -0
- package/dist/types/src/InputSearch/InputSearch.d.ts +1 -1
- package/dist/types/src/InputSearch/components/FilterButton.d.ts +2 -1
- package/dist/types/src/InputText/InputText.d.ts +11 -3
- package/dist/types/src/InputText/InputText.style.d.ts +4 -0
- package/dist/types/src/InputText/context/InputAccessoriesProvider.d.ts +2 -1
- package/dist/types/src/InputTime/InputTime.d.ts +4 -2
- package/dist/types/src/Menu/Menu.d.ts +2 -1
- package/dist/types/src/Menu/components/MenuOption/MenuOption.d.ts +2 -1
- package/dist/types/src/Menu/components/Overlay/Overlay.d.ts +2 -1
- package/dist/types/src/Menu/types.d.ts +6 -1
- package/dist/types/src/ProgressBar/ProgressBar.d.ts +2 -1
- package/dist/types/src/ProgressBar/ProgressBarInner.d.ts +5 -1
- package/dist/types/src/ProgressBar/ProgressBarStepped.d.ts +3 -1
- package/dist/types/src/ProgressBar/types.d.ts +20 -0
- package/dist/types/src/Select/Select.d.ts +3 -2
- package/dist/types/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.d.ts +2 -1
- package/dist/types/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.d.ts +2 -1
- package/dist/types/src/Select/components/SelectInternalPicker/SelectInternalPicker.d.ts +2 -1
- package/dist/types/src/Select/components/SelectPressable/SelectPressable.d.ts +2 -1
- package/dist/types/src/StatusLabel/StatusLabel.d.ts +2 -1
- package/dist/types/src/StatusLabel/StatusLabel.style.d.ts +1 -1
- package/dist/types/src/Switch/Switch.d.ts +2 -1
- package/dist/types/src/Switch/components/BaseSwitch/BaseSwitch.d.ts +2 -1
- package/dist/types/src/Text/Text.d.ts +4 -3
- package/dist/types/src/TextList/TextList.d.ts +2 -1
- package/dist/types/src/ThumbnailList/ThumbnailList.d.ts +2 -1
- package/dist/types/src/Toast/Toast.d.ts +2 -1
- package/dist/types/src/Typography/Typography.d.ts +3 -3
- package/dist/types/src/Typography/TypographyGestureDetector.d.ts +2 -1
- package/dist/types/src/utils/test/MockSafeAreaProvider.d.ts +1 -1
- package/package.json +26 -15
- package/src/ActionItem/ActionItem.tsx +1 -1
- package/src/ActionItem/ActionItemGroup.tsx +1 -3
- package/src/ActionItem/components/ActionItemContainer.tsx +1 -1
- package/src/ActionLabel/ActionLabel.test.tsx +12 -0
- package/src/ActionLabel/ActionLabel.tsx +3 -3
- package/src/ActionLabel/__snapshots__/ActionLabel.test.tsx.snap +66 -0
- package/src/ActivityIndicator/ActivityIndicator.tsx +1 -3
- package/src/AtlantisContext/AtlantisContext.test.tsx +1 -1
- package/src/AtlantisThemeContext/AtlantisThemeContext.test.tsx +5 -5
- package/src/AutoLink/AutoLink.test.tsx +2 -4
- package/src/AutoLink/AutoLink.tsx +1 -1
- package/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.tsx +1 -1
- package/src/AutoLink/components/Link/Link.tsx +1 -5
- package/src/Banner/Banner.test.tsx +12 -0
- package/src/Banner/Banner.tsx +4 -2
- package/src/Banner/components/BannerIcon/BannerIcon.style.ts +3 -0
- package/src/Banner/components/BannerIcon/BannerIcon.tsx +1 -1
- package/src/Banner/types.ts +1 -1
- package/src/BottomSheet/BottomSheet.stories.tsx +128 -0
- package/src/BottomSheet/BottomSheet.style.ts +7 -14
- package/src/BottomSheet/BottomSheet.test.tsx +34 -39
- package/src/BottomSheet/BottomSheet.tsx +112 -92
- package/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.tsx +1 -1
- package/src/BottomSheet/hooks/useBottomSheetBackHandler.test.ts +90 -0
- package/src/BottomSheet/hooks/useBottomSheetBackHandler.ts +41 -0
- package/src/Button/Button.tsx +1 -1
- package/src/Button/components/InternalButtonLoading/InternalButtonLoading.tsx +1 -2
- package/src/ButtonGroup/ButtonGroup.test.tsx +13 -11
- package/src/ButtonGroup/ButtonGroup.tsx +2 -2
- package/src/ButtonGroup/ButtonGroupAction.tsx +4 -4
- package/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.tsx +2 -2
- package/src/Card/Card.tsx +1 -1
- package/src/Card/components/InternalCardHeader.tsx +1 -1
- package/src/Checkbox/Checkbox.test.tsx +118 -1
- package/src/Checkbox/Checkbox.tsx +2 -2
- package/src/Checkbox/CheckboxGroup.test.tsx +3 -7
- package/src/Checkbox/CheckboxGroup.tsx +2 -2
- package/src/Chip/Chip.style.ts +1 -1
- package/src/Chip/Chip.tsx +20 -2
- package/src/Content/Content.tsx +7 -2
- package/src/Content/ContentHorizontal.style.ts +20 -0
- package/src/Content/ContentSpaceAround.style.ts +20 -0
- package/src/Content/ContentVertical.style.ts +20 -0
- package/src/ContentOverlay/ContentOverlay.test.tsx +34 -27
- package/src/ContentOverlay/ContentOverlay.tsx +7 -7
- package/src/ContentOverlay/UNSAFE_WrappedModalize.tsx +41 -0
- package/src/ContentOverlay/hooks/useKeyboardVisibility.test.ts +7 -7
- package/src/ContentOverlay/hooks/useViewLayoutHeight.test.ts +1 -1
- package/src/Disclosure/Disclosure.tsx +1 -1
- package/src/Divider/Divider.tsx +1 -1
- package/src/EmptyState/EmptyState.test.tsx +29 -42
- package/src/EmptyState/EmptyState.tsx +1 -1
- package/src/ErrorMessageWrapper/ErrorMessageWrapper.tsx +1 -1
- package/src/ErrorMessageWrapper/context/ErrorMessageProvider.tsx +3 -5
- package/src/ErrorMessageWrapper/context/types.ts +1 -1
- package/src/Flex/Flex.tsx +2 -2
- package/src/Form/Form.test.tsx +145 -2
- package/src/Form/Form.tsx +8 -1
- package/src/Form/components/FormActionBar/FormActionBar.tsx +3 -3
- package/src/Form/components/FormBody/FormBody.tsx +3 -3
- package/src/Form/components/FormCache/FormCache.tsx +5 -4
- package/src/Form/components/FormErrorBanner/FormErrorBanner.tsx +1 -1
- package/src/Form/components/FormMask/FormMask.tsx +1 -1
- package/src/Form/components/FormMessage/FormMessage.test.tsx +40 -27
- package/src/Form/components/FormMessage/FormMessage.tsx +1 -1
- package/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.tsx +1 -1
- package/src/Form/components/FormMessageBanner/FormMessageBanner.tsx +1 -3
- package/src/Form/components/FormSaveButton/FormSaveButton.test.tsx +2 -2
- package/src/Form/components/FormSaveButton/FormSaveButton.tsx +1 -1
- package/src/Form/context/AtlantisFormContext.test.tsx +1 -1
- package/src/Form/context/AtlantisFormContext.tsx +1 -0
- package/src/Form/context/types.ts +5 -4
- package/src/Form/hooks/useFormViewRefs.ts +4 -5
- package/src/Form/hooks/useInternalForm.ts +14 -6
- package/src/Form/hooks/useScrollToError/useScrollToError.test.tsx +2 -1
- package/src/Form/types.ts +14 -8
- package/src/FormField/FormField.tsx +1 -1
- package/src/FormatFile/FormatFile.test.tsx +21 -21
- package/src/FormatFile/FormatFile.tsx +3 -3
- package/src/FormatFile/components/ErrorIcon/ErrorIcon.tsx +1 -1
- package/src/FormatFile/components/FileView/FileView.tsx +1 -1
- package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.test.tsx +14 -14
- package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.tsx +2 -2
- package/src/FormatFile/components/MediaView/MediaView.test.tsx +283 -0
- package/src/FormatFile/components/MediaView/MediaView.tsx +28 -7
- package/src/FormatFile/components/ProgressBar/ProgressBar.tsx +1 -1
- package/src/FormatFile/utils/createUseCreateThumbnail.ts +1 -1
- package/src/Glimmer/Glimmer.test.tsx +2 -2
- package/src/Heading/Heading.test.tsx +13 -0
- package/src/Heading/Heading.tsx +3 -3
- package/src/Heading/__snapshots__/Heading.test.tsx.snap +65 -0
- package/src/Icon/Icon.tsx +1 -1
- package/src/Icon/__snapshots__/Icon.test.tsx.snap +7 -0
- package/src/IconButton/IconButton.tsx +1 -1
- package/src/InputCurrency/InputCurrency.tsx +72 -58
- package/src/InputDate/InputDate.tsx +7 -3
- package/src/InputEmail/InputEmail.tsx +15 -8
- package/src/InputFieldWrapper/InputFieldWrapper.style.ts +1 -1
- package/src/InputFieldWrapper/InputFieldWrapper.test.tsx +48 -1
- package/src/InputFieldWrapper/InputFieldWrapper.tsx +39 -29
- package/src/InputFieldWrapper/components/ClearAction/ClearAction.tsx +1 -1
- package/src/InputFieldWrapper/components/Prefix/Prefix.test.tsx +8 -16
- package/src/InputFieldWrapper/components/Prefix/Prefix.tsx +8 -6
- package/src/InputFieldWrapper/components/Suffix/Suffix.test.tsx +2 -4
- package/src/InputFieldWrapper/components/Suffix/Suffix.tsx +8 -6
- package/src/InputNumber/InputNumber.tsx +11 -7
- package/src/InputPassword/InputPassword.tsx +1 -1
- package/src/InputPressable/InputPressable.style.ts +4 -0
- package/src/InputPressable/InputPressable.test.tsx +75 -1
- package/src/InputPressable/InputPressable.tsx +34 -8
- package/src/InputSearch/InputSearch.tsx +2 -1
- package/src/InputSearch/components/FilterButton.tsx +1 -1
- package/src/InputText/InputText.style.ts +5 -0
- package/src/InputText/InputText.test.tsx +190 -1
- package/src/InputText/InputText.tsx +37 -20
- package/src/InputText/context/InputAccessoriesProvider.tsx +1 -1
- package/src/InputTime/InputTime.tsx +7 -3
- package/src/Menu/Menu.tsx +3 -3
- package/src/Menu/components/MenuOption/MenuOption.tsx +1 -1
- package/src/Menu/components/Overlay/Overlay.tsx +1 -1
- package/src/Menu/types.ts +7 -1
- package/src/ProgressBar/ProgressBar.test.tsx +109 -0
- package/src/ProgressBar/ProgressBar.tsx +18 -2
- package/src/ProgressBar/ProgressBarInner.tsx +8 -11
- package/src/ProgressBar/ProgressBarStepped.tsx +12 -1
- package/src/ProgressBar/__snapshots__/ProgressBar.test.tsx.snap +14 -0
- package/src/ProgressBar/types.ts +22 -0
- package/src/Select/Select.style.ts +1 -0
- package/src/Select/Select.tsx +2 -2
- package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.tsx +1 -1
- package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.tsx +1 -1
- package/src/Select/components/SelectInternalPicker/SelectInternalPicker.tsx +1 -1
- package/src/Select/components/SelectPressable/SelectPressable.tsx +1 -4
- package/src/StatusLabel/StatusLabel.style.ts +2 -2
- package/src/StatusLabel/StatusLabel.tsx +1 -1
- package/src/StatusLabel/__snapshots__/StatusLabel.test.tsx.snap +14 -14
- package/src/Switch/Switch.tsx +1 -1
- package/src/Switch/components/BaseSwitch/BaseSwitch.tsx +8 -2
- package/src/Text/Text.test.tsx +10 -0
- package/src/Text/Text.tsx +3 -3
- package/src/Text/__snapshots__/Text.test.tsx.snap +66 -0
- package/src/TextList/TextList.tsx +1 -1
- package/src/ThumbnailList/ThumbnailList.test.tsx +5 -5
- package/src/ThumbnailList/ThumbnailList.tsx +1 -1
- package/src/ThumbnailList/__snapshots__/ThumbnailList.test.tsx.snap +199 -1
- package/src/Toast/Toast.tsx +2 -2
- package/src/Typography/Typography.test.tsx +61 -0
- package/src/Typography/Typography.tsx +25 -9
- package/src/Typography/TypographyGestureDetector.tsx +1 -3
- package/src/Typography/__snapshots__/Typography.test.tsx.snap +222 -0
- package/src/hooks/useAtlantisI18n/locales/en.json +1 -0
- package/src/hooks/useAtlantisI18n/locales/es.json +1 -0
- package/src/hooks/useFormController.ts +7 -14
- package/src/utils/test/MockSafeAreaProvider.tsx +1 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -46,7 +46,7 @@ describe("Glimmer", () => {
|
|
|
46
46
|
);
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
-
it("renders sets the correct width", () => {
|
|
49
|
+
it("renders sets the correct width", async () => {
|
|
50
50
|
jest.useFakeTimers();
|
|
51
51
|
|
|
52
52
|
// Spy on Animated.timing to verify the animation configuration
|
|
@@ -54,7 +54,7 @@ describe("Glimmer", () => {
|
|
|
54
54
|
|
|
55
55
|
render(<Glimmer />);
|
|
56
56
|
|
|
57
|
-
act(() => {
|
|
57
|
+
await act(async () => {
|
|
58
58
|
fireEvent(screen.getByTestId(GLIMMER_TEST_ID), "onLayout", {
|
|
59
59
|
nativeEvent: { layout: { width: 300 } },
|
|
60
60
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render } from "@testing-library/react-native";
|
|
3
3
|
import { Heading } from "./Heading";
|
|
4
|
+
import { Text } from "../Text";
|
|
4
5
|
|
|
5
6
|
describe("when Heading called with text as the only prop", () => {
|
|
6
7
|
it("should match snapshot", () => {
|
|
@@ -81,3 +82,15 @@ describe("when Heading called with maxLines", () => {
|
|
|
81
82
|
expect(view).toMatchSnapshot();
|
|
82
83
|
});
|
|
83
84
|
});
|
|
85
|
+
|
|
86
|
+
describe("when Heading contains nested inline text", () => {
|
|
87
|
+
it("renders nested Text within Heading", () => {
|
|
88
|
+
const view = render(
|
|
89
|
+
<Heading>
|
|
90
|
+
Heading before <Text emphasis="strong">Inner</Text> after
|
|
91
|
+
</Heading>,
|
|
92
|
+
).toJSON();
|
|
93
|
+
|
|
94
|
+
expect(view).toMatchSnapshot();
|
|
95
|
+
});
|
|
96
|
+
});
|
package/src/Heading/Heading.tsx
CHANGED
|
@@ -19,9 +19,9 @@ export type HeadingLevel = "title" | "subtitle" | "heading" | "subHeading";
|
|
|
19
19
|
interface HeadingProps<T extends HeadingLevel>
|
|
20
20
|
extends Pick<TypographyProps<"base">, "selectable"> {
|
|
21
21
|
/**
|
|
22
|
-
* Text to display.
|
|
22
|
+
* Text to display. Supports nesting text elements.
|
|
23
23
|
*/
|
|
24
|
-
readonly children:
|
|
24
|
+
readonly children: React.ReactNode;
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* The type of heading, e.g., "Title"
|
|
@@ -71,7 +71,7 @@ export function Heading<T extends HeadingLevel = "heading">({
|
|
|
71
71
|
maxLines = "unlimited",
|
|
72
72
|
allowFontScaling = true,
|
|
73
73
|
selectable,
|
|
74
|
-
}: HeadingProps<T>)
|
|
74
|
+
}: HeadingProps<T>) {
|
|
75
75
|
const headingStyle = getHeadingStyle(level, variation);
|
|
76
76
|
const accessibilityRole = "header";
|
|
77
77
|
|
|
@@ -268,3 +268,68 @@ exports[`when Heading called with title variation should match snapshot 1`] = `
|
|
|
268
268
|
Title Heading
|
|
269
269
|
</Text>
|
|
270
270
|
`;
|
|
271
|
+
|
|
272
|
+
exports[`when Heading contains nested inline text renders nested Text within Heading 1`] = `
|
|
273
|
+
<Text
|
|
274
|
+
accessibilityRole="header"
|
|
275
|
+
adjustsFontSizeToFit={false}
|
|
276
|
+
allowFontScaling={true}
|
|
277
|
+
collapsable={false}
|
|
278
|
+
selectable={true}
|
|
279
|
+
selectionColor="hsl(86, 100%, 46%)"
|
|
280
|
+
style={
|
|
281
|
+
[
|
|
282
|
+
{
|
|
283
|
+
"fontFamily": "inter-bold",
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"color": "hsl(197, 90%, 12%)",
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"textAlign": "left",
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"fontSize": 20,
|
|
293
|
+
"lineHeight": 22,
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"letterSpacing": 0,
|
|
297
|
+
},
|
|
298
|
+
]
|
|
299
|
+
}
|
|
300
|
+
>
|
|
301
|
+
Heading before
|
|
302
|
+
<Text
|
|
303
|
+
accessibilityRole="text"
|
|
304
|
+
adjustsFontSizeToFit={false}
|
|
305
|
+
allowFontScaling={true}
|
|
306
|
+
collapsable={false}
|
|
307
|
+
maxFontSizeMultiplier={3.125}
|
|
308
|
+
selectable={true}
|
|
309
|
+
selectionColor="hsl(86, 100%, 46%)"
|
|
310
|
+
style={
|
|
311
|
+
[
|
|
312
|
+
{
|
|
313
|
+
"fontFamily": "inter-semibold",
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"color": "hsl(198, 35%, 21%)",
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"textAlign": "left",
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"fontSize": 16,
|
|
323
|
+
"lineHeight": 20,
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"letterSpacing": 0,
|
|
327
|
+
},
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
>
|
|
331
|
+
Inner
|
|
332
|
+
</Text>
|
|
333
|
+
after
|
|
334
|
+
</Text>
|
|
335
|
+
`;
|
package/src/Icon/Icon.tsx
CHANGED
|
@@ -80,7 +80,57 @@ const getKeyboard = (props: InputCurrencyProps) => {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
const computeDisplayFromNumericInput = (
|
|
84
|
+
numberedValue: number,
|
|
85
|
+
decimalNumbers: string,
|
|
86
|
+
decimalCount: number,
|
|
87
|
+
maxLength: number,
|
|
88
|
+
maxDecimalPlaces: number,
|
|
89
|
+
decimalPlaces: number,
|
|
90
|
+
formatNumber: (
|
|
91
|
+
value: number,
|
|
92
|
+
opts?: FormatNumberOptions | undefined,
|
|
93
|
+
) => string,
|
|
94
|
+
): {
|
|
95
|
+
onChangeValue: number | string;
|
|
96
|
+
displayValue: string;
|
|
97
|
+
} => {
|
|
98
|
+
const transformedValue = limitInputWholeDigits(numberedValue, maxLength);
|
|
99
|
+
const stringValue =
|
|
100
|
+
decimalNumbers !== ""
|
|
101
|
+
? transformedValue.toString() + "." + decimalNumbers.slice(1)
|
|
102
|
+
: transformedValue.toString();
|
|
103
|
+
|
|
104
|
+
if (checkLastChar(stringValue)) {
|
|
105
|
+
const roundedDecimal = configureDecimal(
|
|
106
|
+
decimalCount,
|
|
107
|
+
maxDecimalPlaces,
|
|
108
|
+
stringValue,
|
|
109
|
+
decimalPlaces,
|
|
110
|
+
);
|
|
111
|
+
const internationalizedValueToDisplay = formatNumber(roundedDecimal, {
|
|
112
|
+
maximumFractionDigits: maxDecimalPlaces,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
onChangeValue: roundedDecimal,
|
|
117
|
+
displayValue: internationalizedValueToDisplay,
|
|
118
|
+
};
|
|
119
|
+
} else {
|
|
120
|
+
const internationalizedValueToDisplay =
|
|
121
|
+
formatNumber(transformedValue, {
|
|
122
|
+
maximumFractionDigits: maxDecimalPlaces,
|
|
123
|
+
}) + decimalNumbers;
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
onChangeValue:
|
|
127
|
+
transformedValue.toString() + "." + decimalNumbers.slice(1),
|
|
128
|
+
displayValue: internationalizedValueToDisplay,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export function InputCurrency(props: InputCurrencyProps) {
|
|
84
134
|
const {
|
|
85
135
|
showCurrencySymbol = true,
|
|
86
136
|
maxDecimalPlaces = 5,
|
|
@@ -99,54 +149,6 @@ export function InputCurrency(props: InputCurrencyProps): JSX.Element {
|
|
|
99
149
|
internalValue,
|
|
100
150
|
);
|
|
101
151
|
|
|
102
|
-
const setOnChangeAndDisplayValues = (
|
|
103
|
-
onChangeValue: number | string | undefined,
|
|
104
|
-
valueToDisplay: string | undefined,
|
|
105
|
-
) => {
|
|
106
|
-
props.onChange?.(onChangeValue);
|
|
107
|
-
setDisplayValue(valueToDisplay);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const checkDecimalAndI18nOfDisplayValue = (
|
|
111
|
-
numberedValue: number,
|
|
112
|
-
decimalNumbers: string,
|
|
113
|
-
decimalCount: number,
|
|
114
|
-
) => {
|
|
115
|
-
const transformedValue = limitInputWholeDigits(numberedValue, maxLength);
|
|
116
|
-
const stringValue =
|
|
117
|
-
decimalNumbers !== ""
|
|
118
|
-
? transformedValue.toString() + "." + decimalNumbers.slice(1)
|
|
119
|
-
: transformedValue.toString();
|
|
120
|
-
|
|
121
|
-
if (checkLastChar(stringValue)) {
|
|
122
|
-
const roundedDecimal = configureDecimal(
|
|
123
|
-
decimalCount,
|
|
124
|
-
maxDecimalPlaces,
|
|
125
|
-
stringValue,
|
|
126
|
-
decimalPlaces,
|
|
127
|
-
);
|
|
128
|
-
const internationalizedValueToDisplay = intl.formatNumber(
|
|
129
|
-
roundedDecimal,
|
|
130
|
-
{
|
|
131
|
-
maximumFractionDigits: maxDecimalPlaces,
|
|
132
|
-
},
|
|
133
|
-
);
|
|
134
|
-
setOnChangeAndDisplayValues(
|
|
135
|
-
roundedDecimal,
|
|
136
|
-
internationalizedValueToDisplay,
|
|
137
|
-
);
|
|
138
|
-
} else {
|
|
139
|
-
const internationalizedValueToDisplay =
|
|
140
|
-
intl.formatNumber(transformedValue, {
|
|
141
|
-
maximumFractionDigits: maxDecimalPlaces,
|
|
142
|
-
}) + decimalNumbers;
|
|
143
|
-
setOnChangeAndDisplayValues(
|
|
144
|
-
transformedValue.toString() + "." + decimalNumbers.slice(1),
|
|
145
|
-
internationalizedValueToDisplay,
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
|
|
150
152
|
const handleChange = (newValue: string | undefined) => {
|
|
151
153
|
const [decimalCount, wholeIntegerValue, decimalNumbers] = parseGivenInput(
|
|
152
154
|
newValue,
|
|
@@ -158,19 +160,37 @@ export function InputCurrency(props: InputCurrencyProps): JSX.Element {
|
|
|
158
160
|
: wholeIntegerValue;
|
|
159
161
|
|
|
160
162
|
if (isValidNumber(numberedValue) && typeof numberedValue === "number") {
|
|
161
|
-
|
|
163
|
+
const result = computeDisplayFromNumericInput(
|
|
162
164
|
numberedValue,
|
|
163
165
|
decimalNumbers,
|
|
164
166
|
decimalCount,
|
|
167
|
+
maxLength,
|
|
168
|
+
maxDecimalPlaces,
|
|
169
|
+
decimalPlaces,
|
|
170
|
+
intl.formatNumber,
|
|
165
171
|
);
|
|
172
|
+
const { onChangeValue, displayValue: valueToDisplay } = result;
|
|
173
|
+
props.onChange?.(onChangeValue);
|
|
174
|
+
setDisplayValue(valueToDisplay);
|
|
166
175
|
} else {
|
|
167
176
|
const value = numberedValue?.toString() + decimalNumbers;
|
|
168
|
-
|
|
177
|
+
props.onChange?.(value);
|
|
178
|
+
setDisplayValue(value);
|
|
169
179
|
}
|
|
170
180
|
};
|
|
171
181
|
|
|
172
182
|
const { t } = useAtlantisI18n();
|
|
173
183
|
|
|
184
|
+
const defaultValidations = {
|
|
185
|
+
pattern: {
|
|
186
|
+
value: NUMBER_VALIDATION_REGEX,
|
|
187
|
+
message: t("errors.notANumber"),
|
|
188
|
+
},
|
|
189
|
+
} as const;
|
|
190
|
+
const mergedValidations = props.validations
|
|
191
|
+
? Object.assign({}, defaultValidations, props.validations)
|
|
192
|
+
: defaultValidations;
|
|
193
|
+
|
|
174
194
|
return (
|
|
175
195
|
<InputText
|
|
176
196
|
{...props}
|
|
@@ -187,13 +207,7 @@ export function InputCurrency(props: InputCurrencyProps): JSX.Element {
|
|
|
187
207
|
.replace(floatSeparators.decimal, ".");
|
|
188
208
|
},
|
|
189
209
|
}}
|
|
190
|
-
validations={
|
|
191
|
-
pattern: {
|
|
192
|
-
value: NUMBER_VALIDATION_REGEX,
|
|
193
|
-
message: t("errors.notANumber"),
|
|
194
|
-
},
|
|
195
|
-
...props.validations,
|
|
196
|
-
}}
|
|
210
|
+
validations={mergedValidations}
|
|
197
211
|
onBlur={() => {
|
|
198
212
|
props.onBlur?.();
|
|
199
213
|
|
|
@@ -8,9 +8,11 @@ import type { InputFieldWrapperProps } from "../InputFieldWrapper";
|
|
|
8
8
|
import { FormField } from "../FormField";
|
|
9
9
|
import { InputPressable } from "../InputPressable";
|
|
10
10
|
import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
11
|
+
import type { InputPressableProps } from "../InputPressable/InputPressable";
|
|
11
12
|
|
|
12
13
|
interface BaseInputDateProps
|
|
13
|
-
extends Pick<InputFieldWrapperProps, "invalid" | "disabled" | "placeholder"
|
|
14
|
+
extends Pick<InputFieldWrapperProps, "invalid" | "disabled" | "placeholder">,
|
|
15
|
+
Pick<InputPressableProps, "showMiniLabel"> {
|
|
14
16
|
/**
|
|
15
17
|
* Defaulted to "always" so user can clear the dates whenever there's a value.
|
|
16
18
|
*/
|
|
@@ -109,7 +111,7 @@ const display = Platform.OS === "ios" ? "inline" : "default";
|
|
|
109
111
|
/**
|
|
110
112
|
* Allow users to select a date using the device date picker.
|
|
111
113
|
*/
|
|
112
|
-
export function InputDate(props: InputDateProps)
|
|
114
|
+
export function InputDate(props: InputDateProps) {
|
|
113
115
|
if (props.name) {
|
|
114
116
|
return (
|
|
115
117
|
<FormField<Date>
|
|
@@ -145,11 +147,12 @@ function InternalInputDate({
|
|
|
145
147
|
minDate,
|
|
146
148
|
placeholder,
|
|
147
149
|
value,
|
|
150
|
+
showMiniLabel = true,
|
|
148
151
|
name,
|
|
149
152
|
onChange,
|
|
150
153
|
accessibilityLabel,
|
|
151
154
|
accessibilityHint,
|
|
152
|
-
}: InputDateProps)
|
|
155
|
+
}: InputDateProps) {
|
|
153
156
|
const [showPicker, setShowPicker] = useState(false);
|
|
154
157
|
const { t, locale, formatDate } = useAtlantisI18n();
|
|
155
158
|
|
|
@@ -174,6 +177,7 @@ function InternalInputDate({
|
|
|
174
177
|
return (
|
|
175
178
|
<>
|
|
176
179
|
<InputPressable
|
|
180
|
+
showMiniLabel={showMiniLabel}
|
|
177
181
|
focused={showPicker}
|
|
178
182
|
clearable={canClearDate}
|
|
179
183
|
disabled={disabled}
|
|
@@ -2,11 +2,25 @@ import type { Ref } from "react";
|
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
3
|
import type { InputTextProps, InputTextRef } from "../InputText";
|
|
4
4
|
import { InputText } from "../InputText";
|
|
5
|
+
import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
5
6
|
|
|
6
7
|
export const InputEmail = forwardRef(InputEmailInternal);
|
|
7
8
|
type InputEmailProps = Omit<InputTextProps, "keyboard">;
|
|
8
9
|
|
|
9
10
|
function InputEmailInternal(props: InputEmailProps, ref: Ref<InputTextRef>) {
|
|
11
|
+
const { t } = useAtlantisI18n();
|
|
12
|
+
|
|
13
|
+
const defaultValidations = {
|
|
14
|
+
pattern: {
|
|
15
|
+
value:
|
|
16
|
+
/[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?/,
|
|
17
|
+
message: t("InputEmail.enterEmail"),
|
|
18
|
+
},
|
|
19
|
+
} as const;
|
|
20
|
+
const mergedValidations = props.validations
|
|
21
|
+
? Object.assign({}, defaultValidations, props.validations)
|
|
22
|
+
: defaultValidations;
|
|
23
|
+
|
|
10
24
|
return (
|
|
11
25
|
<InputText
|
|
12
26
|
{...props}
|
|
@@ -14,14 +28,7 @@ function InputEmailInternal(props: InputEmailProps, ref: Ref<InputTextRef>) {
|
|
|
14
28
|
autoCapitalize="none"
|
|
15
29
|
autoCorrect={false}
|
|
16
30
|
keyboard={"email-address"}
|
|
17
|
-
validations={
|
|
18
|
-
pattern: {
|
|
19
|
-
value:
|
|
20
|
-
/[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?/,
|
|
21
|
-
message: "Enter a valid email address (email@example.com)",
|
|
22
|
-
},
|
|
23
|
-
...props.validations,
|
|
24
|
-
}}
|
|
31
|
+
validations={mergedValidations}
|
|
25
32
|
/>
|
|
26
33
|
);
|
|
27
34
|
}
|
|
@@ -43,6 +43,7 @@ export const useStyles = buildThemedStyles(tokens => {
|
|
|
43
43
|
right: 0,
|
|
44
44
|
bottom: 0,
|
|
45
45
|
left: 0,
|
|
46
|
+
zIndex: 1,
|
|
46
47
|
},
|
|
47
48
|
|
|
48
49
|
miniLabel: {
|
|
@@ -53,7 +54,6 @@ export const useStyles = buildThemedStyles(tokens => {
|
|
|
53
54
|
maxHeight:
|
|
54
55
|
(typographyStyles.defaultSize.lineHeight || 0) +
|
|
55
56
|
tokens["space-smaller"],
|
|
56
|
-
zIndex: 1,
|
|
57
57
|
},
|
|
58
58
|
// Prevents the miniLabel from cutting off the ClearAction button
|
|
59
59
|
miniLabelShowClearAction: {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { RenderAPI } from "@testing-library/react-native";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
fireEvent,
|
|
5
|
+
render,
|
|
6
|
+
renderHook,
|
|
7
|
+
screen,
|
|
8
|
+
} from "@testing-library/react-native";
|
|
4
9
|
import type { ViewStyle } from "react-native";
|
|
5
10
|
import { Text } from "react-native";
|
|
6
11
|
import type { InputFieldWrapperProps } from ".";
|
|
@@ -311,4 +316,46 @@ describe("InputFieldWrapper", () => {
|
|
|
311
316
|
expect(queryByTestId(INPUT_FIELD_WRAPPER_SPINNER_TEST_ID)).toBeNull();
|
|
312
317
|
});
|
|
313
318
|
});
|
|
319
|
+
|
|
320
|
+
describe("placeholderMode", () => {
|
|
321
|
+
it("renders the placeholder in its normal position", () => {
|
|
322
|
+
renderInputFieldWrapper({
|
|
323
|
+
placeholder: "placeholder",
|
|
324
|
+
placeholderMode: "normal",
|
|
325
|
+
});
|
|
326
|
+
const placeholder = screen.getByText("placeholder", {
|
|
327
|
+
includeHiddenElements: true,
|
|
328
|
+
});
|
|
329
|
+
expect(placeholder).toBeDefined();
|
|
330
|
+
expect(placeholder.props.style).toContainEqual(
|
|
331
|
+
typographyStyles.defaultSize,
|
|
332
|
+
);
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
it("renders the placeholder in its mini label position", () => {
|
|
336
|
+
renderInputFieldWrapper({
|
|
337
|
+
placeholder: "placeholder",
|
|
338
|
+
placeholderMode: "mini",
|
|
339
|
+
});
|
|
340
|
+
const placeholder = screen.getByText("placeholder", {
|
|
341
|
+
includeHiddenElements: true,
|
|
342
|
+
});
|
|
343
|
+
expect(placeholder).toBeDefined();
|
|
344
|
+
expect(placeholder.props.style).toContainEqual(
|
|
345
|
+
typographyStyles.smallSize,
|
|
346
|
+
);
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
it("does not render the placeholder", () => {
|
|
350
|
+
renderInputFieldWrapper({
|
|
351
|
+
placeholder: "placeholder",
|
|
352
|
+
placeholderMode: "hidden",
|
|
353
|
+
});
|
|
354
|
+
expect(
|
|
355
|
+
screen.queryByText("placeholder", {
|
|
356
|
+
includeHiddenElements: true,
|
|
357
|
+
}),
|
|
358
|
+
).toBeNull();
|
|
359
|
+
});
|
|
360
|
+
});
|
|
314
361
|
});
|
|
@@ -43,7 +43,14 @@ export interface InputFieldWrapperProps {
|
|
|
43
43
|
*/
|
|
44
44
|
readonly assistiveText?: string;
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Controls how the placeholder text is displayed.
|
|
48
|
+
* - normal: the placeholder text will be displayed in the normal placeholder position
|
|
49
|
+
* - mini: the placeholder text will float above the input value
|
|
50
|
+
* - hidden: the placeholder text will not be displayed
|
|
51
|
+
* @default "normal"
|
|
52
|
+
*/
|
|
53
|
+
readonly placeholderMode?: "normal" | "mini" | "hidden";
|
|
47
54
|
|
|
48
55
|
readonly hasValue?: boolean;
|
|
49
56
|
|
|
@@ -119,7 +126,7 @@ export function InputFieldWrapper({
|
|
|
119
126
|
assistiveText,
|
|
120
127
|
prefix,
|
|
121
128
|
suffix,
|
|
122
|
-
|
|
129
|
+
placeholderMode = "normal",
|
|
123
130
|
hasValue = false,
|
|
124
131
|
error,
|
|
125
132
|
focused = false,
|
|
@@ -131,7 +138,7 @@ export function InputFieldWrapper({
|
|
|
131
138
|
toolbarVisibility = "while-editing",
|
|
132
139
|
loading = false,
|
|
133
140
|
loadingType = "spinner",
|
|
134
|
-
}: InputFieldWrapperProps)
|
|
141
|
+
}: InputFieldWrapperProps) {
|
|
135
142
|
fieldAffixRequiredPropsCheck([prefix, suffix]);
|
|
136
143
|
const handleClear = onClear ?? noopClear;
|
|
137
144
|
warnIfClearActionWithNoOnClear(onClear, showClearAction);
|
|
@@ -143,6 +150,9 @@ export function InputFieldWrapper({
|
|
|
143
150
|
const showLoadingGlimmer = loading && loadingType === "glimmer";
|
|
144
151
|
const styles = useStyles();
|
|
145
152
|
|
|
153
|
+
const placeholderVisible = placeholderMode !== "hidden";
|
|
154
|
+
const miniLabelActive = placeholderMode === "mini";
|
|
155
|
+
|
|
146
156
|
return (
|
|
147
157
|
<ErrorMessageWrapper message={getMessage({ invalid, error })}>
|
|
148
158
|
<View
|
|
@@ -160,35 +170,36 @@ export function InputFieldWrapper({
|
|
|
160
170
|
<PrefixIcon
|
|
161
171
|
disabled={disabled}
|
|
162
172
|
focused={focused}
|
|
163
|
-
hasMiniLabel={hasMiniLabel}
|
|
164
173
|
inputInvalid={inputInvalid}
|
|
165
174
|
icon={prefix.icon}
|
|
166
175
|
/>
|
|
167
176
|
)}
|
|
168
177
|
<View style={[styles.inputContainer]}>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
178
|
+
{placeholderVisible && (
|
|
179
|
+
<View
|
|
180
|
+
style={[
|
|
181
|
+
!!placeholder && styles.label,
|
|
182
|
+
miniLabelActive && styles.miniLabel,
|
|
183
|
+
disabled && styles.disabled,
|
|
184
|
+
miniLabelActive &&
|
|
185
|
+
showClearAction &&
|
|
186
|
+
styles.miniLabelShowClearAction,
|
|
187
|
+
]}
|
|
188
|
+
pointerEvents="none"
|
|
189
|
+
>
|
|
190
|
+
<Placeholder
|
|
191
|
+
placeholder={placeholder}
|
|
192
|
+
labelVariation={getLabelVariation(error, invalid, disabled)}
|
|
193
|
+
miniLabelActive={miniLabelActive}
|
|
194
|
+
styleOverride={styleOverride?.placeholderText}
|
|
195
|
+
/>
|
|
196
|
+
</View>
|
|
197
|
+
)}
|
|
187
198
|
{prefix?.label && hasValue && (
|
|
188
199
|
<PrefixLabel
|
|
189
200
|
disabled={disabled}
|
|
190
201
|
focused={focused}
|
|
191
|
-
|
|
202
|
+
miniLabelActive={miniLabelActive}
|
|
192
203
|
inputInvalid={inputInvalid}
|
|
193
204
|
label={prefix.label}
|
|
194
205
|
styleOverride={styleOverride?.prefixLabel}
|
|
@@ -225,7 +236,7 @@ export function InputFieldWrapper({
|
|
|
225
236
|
<SuffixLabel
|
|
226
237
|
disabled={disabled}
|
|
227
238
|
focused={focused}
|
|
228
|
-
|
|
239
|
+
miniLabelActive={miniLabelActive}
|
|
229
240
|
inputInvalid={inputInvalid}
|
|
230
241
|
label={suffix.label}
|
|
231
242
|
hasLeftMargin={!showClearAction}
|
|
@@ -245,7 +256,6 @@ export function InputFieldWrapper({
|
|
|
245
256
|
<SuffixIcon
|
|
246
257
|
disabled={disabled}
|
|
247
258
|
focused={focused}
|
|
248
|
-
hasMiniLabel={hasMiniLabel}
|
|
249
259
|
hasLeftMargin={!!(!showClearAction || suffix?.label)}
|
|
250
260
|
inputInvalid={inputInvalid}
|
|
251
261
|
icon={suffix.icon}
|
|
@@ -332,12 +342,12 @@ function Placeholder({
|
|
|
332
342
|
placeholder,
|
|
333
343
|
styleOverride,
|
|
334
344
|
labelVariation,
|
|
335
|
-
|
|
345
|
+
miniLabelActive,
|
|
336
346
|
}: {
|
|
337
347
|
readonly placeholder?: string;
|
|
338
348
|
readonly styleOverride: StyleProp<TextStyle>;
|
|
339
349
|
readonly labelVariation: TextVariation;
|
|
340
|
-
readonly
|
|
350
|
+
readonly miniLabelActive: boolean;
|
|
341
351
|
}) {
|
|
342
352
|
const typographyStyles = useTypographyStyles();
|
|
343
353
|
|
|
@@ -348,7 +358,7 @@ function Placeholder({
|
|
|
348
358
|
hideFromScreenReader={true}
|
|
349
359
|
maxLines="single"
|
|
350
360
|
variation={labelVariation}
|
|
351
|
-
level={
|
|
361
|
+
level={miniLabelActive ? "textSupporting" : "text"}
|
|
352
362
|
>
|
|
353
363
|
{placeholder}
|
|
354
364
|
</Text>
|
|
@@ -361,7 +371,7 @@ function Placeholder({
|
|
|
361
371
|
style={[
|
|
362
372
|
typographyStyles[labelVariation],
|
|
363
373
|
typographyStyles.baseRegularRegular,
|
|
364
|
-
|
|
374
|
+
miniLabelActive
|
|
365
375
|
? typographyStyles.smallSize
|
|
366
376
|
: typographyStyles.defaultSize,
|
|
367
377
|
styleOverride,
|