@hero-design/rn 8.23.0 → 8.24.0-alpha.1
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/.turbo/turbo-build.log +9 -9
- package/.turbo/turbo-build:types.log +2 -0
- package/.turbo/turbo-lint.log +146 -0
- package/.turbo/turbo-publish:npm.log +9 -0
- package/.turbo/turbo-test.log +451 -0
- package/.turbo/turbo-type-check.log +1 -0
- package/es/index.js +289 -101
- package/lib/index.js +289 -101
- package/package.json +1 -1
- package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +21 -9
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +7 -3
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +7 -3
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +7 -3
- package/src/components/RichTextEditor/RichTextEditor.tsx +10 -7
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +10 -8
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +37 -16
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +37 -16
- package/src/components/Tabs/ScrollableTabs.tsx +10 -149
- package/src/components/Tabs/ScrollableTabsHeader.tsx +214 -0
- package/src/components/Tabs/ScrollableTabsV2/SceneView.tsx +61 -0
- package/src/components/Tabs/ScrollableTabsV2/ScrollableTabsV2.tsx +120 -0
- package/src/components/Tabs/ScrollableTabsV2/__tests__/SceneView.spec.tsx +76 -0
- package/src/components/Tabs/ScrollableTabsV2/__tests__/ScrollableTabsV2.spec.tsx +166 -0
- package/src/components/Tabs/ScrollableTabsV2/__tests__/__snapshots__/SceneView.spec.tsx.snap +161 -0
- package/src/components/Tabs/ScrollableTabsV2/__tests__/__snapshots__/ScrollableTabsV2.spec.tsx.snap +2497 -0
- package/src/components/Tabs/ScrollableTabsV2/index.tsx +5 -0
- package/src/components/Tabs/__tests__/ScrollableTabsHeader.spec.tsx +80 -0
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabsHeader.spec.tsx.snap +587 -0
- package/src/components/Tabs/index.tsx +2 -0
- package/src/components/TextInput/StyledTextInput.tsx +40 -29
- package/src/components/TextInput/__tests__/StyledTextInput.spec.tsx +48 -57
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +84 -58
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +326 -74
- package/src/components/TextInput/__tests__/index.spec.tsx +16 -4
- package/src/components/TextInput/index.tsx +25 -15
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +14 -6
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +14 -6
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +8 -3
- package/src/theme/components/textInput.ts +10 -4
- package/testUtils/setup.tsx +6 -0
- package/types/components/Accordion/AccordionItem.d.ts +0 -0
- package/types/components/Accordion/StyledAccordion.d.ts +0 -0
- package/types/components/Accordion/index.d.ts +0 -0
- package/types/components/Alert/StyledAlert.d.ts +0 -0
- package/types/components/Alert/index.d.ts +0 -0
- package/types/components/Attachment/StyledAttachment.d.ts +0 -0
- package/types/components/Attachment/index.d.ts +0 -0
- package/types/components/Avatar/Avatar.d.ts +0 -0
- package/types/components/Avatar/AvatarStack/StyledAvatarStack.d.ts +0 -0
- package/types/components/Avatar/AvatarStack/index.d.ts +0 -0
- package/types/components/Avatar/AvatarStack/utils.d.ts +0 -0
- package/types/components/Avatar/StyledAvatar.d.ts +0 -0
- package/types/components/Avatar/index.d.ts +0 -0
- package/types/components/Badge/Status.d.ts +0 -0
- package/types/components/Badge/StyledBadge.d.ts +0 -0
- package/types/components/Badge/index.d.ts +0 -0
- package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -0
- package/types/components/BottomNavigation/index.d.ts +0 -0
- package/types/components/BottomSheet/BottomSheetContext.d.ts +0 -0
- package/types/components/BottomSheet/Footer.d.ts +0 -0
- package/types/components/BottomSheet/Header.d.ts +0 -0
- package/types/components/BottomSheet/ScrollView.d.ts +0 -0
- package/types/components/BottomSheet/StyledBottomSheet.d.ts +0 -0
- package/types/components/BottomSheet/index.d.ts +0 -0
- package/types/components/Box/StyledBox.d.ts +0 -0
- package/types/components/Box/config.d.ts +0 -0
- package/types/components/Box/index.d.ts +0 -0
- package/types/components/Box/types.d.ts +0 -0
- package/types/components/Button/Button.d.ts +0 -0
- package/types/components/Button/IconButton.d.ts +0 -0
- package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +0 -0
- package/types/components/Button/LoadingIndicator/index.d.ts +0 -0
- package/types/components/Button/StyledButton.d.ts +0 -0
- package/types/components/Button/UtilityButton/StyledUtilityButton.d.ts +0 -0
- package/types/components/Button/UtilityButton/index.d.ts +0 -0
- package/types/components/Button/index.d.ts +0 -0
- package/types/components/Calendar/CalendarRowItem.d.ts +0 -0
- package/types/components/Calendar/StyledCalendar.d.ts +0 -0
- package/types/components/Calendar/helpers.d.ts +0 -0
- package/types/components/Calendar/index.d.ts +0 -0
- package/types/components/Card/DataCard/StyledDataCard.d.ts +0 -0
- package/types/components/Card/DataCard/index.d.ts +0 -0
- package/types/components/Card/StyledCard.d.ts +0 -0
- package/types/components/Card/index.d.ts +0 -0
- package/types/components/Carousel/CardCarousel.d.ts +0 -0
- package/types/components/Carousel/CarouselItem.d.ts +0 -0
- package/types/components/Carousel/StyledCardCarousel.d.ts +0 -0
- package/types/components/Carousel/StyledCarousel.d.ts +0 -0
- package/types/components/Carousel/contants.d.ts +0 -0
- package/types/components/Carousel/index.d.ts +0 -0
- package/types/components/Carousel/types.d.ts +0 -0
- package/types/components/Checkbox/StyledCheckbox.d.ts +0 -0
- package/types/components/Checkbox/index.d.ts +0 -0
- package/types/components/Collapse/StyledCollapse.d.ts +0 -0
- package/types/components/Collapse/index.d.ts +0 -0
- package/types/components/ContentNavigator/StyledContentNavigator.d.ts +0 -0
- package/types/components/ContentNavigator/index.d.ts +0 -0
- package/types/components/DatePicker/DatePickerAndroid.d.ts +0 -0
- package/types/components/DatePicker/DatePickerCalendar.d.ts +0 -0
- package/types/components/DatePicker/DatePickerIOS.d.ts +0 -0
- package/types/components/DatePicker/StyledDatePicker.d.ts +0 -0
- package/types/components/DatePicker/index.d.ts +0 -0
- package/types/components/DatePicker/types.d.ts +0 -0
- package/types/components/Divider/StyledDivider.d.ts +0 -0
- package/types/components/Divider/index.d.ts +0 -0
- package/types/components/Drawer/DragableDrawer/helpers.d.ts +0 -0
- package/types/components/Drawer/DragableDrawer/index.d.ts +0 -0
- package/types/components/Drawer/StyledDrawer.d.ts +0 -0
- package/types/components/Drawer/index.d.ts +0 -0
- package/types/components/Empty/StyledEmpty.d.ts +0 -0
- package/types/components/Empty/index.d.ts +0 -0
- package/types/components/Error/StyledError.d.ts +0 -0
- package/types/components/Error/index.d.ts +0 -0
- package/types/components/FAB/ActionGroup/ActionItem.d.ts +0 -0
- package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -0
- package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +0 -0
- package/types/components/FAB/ActionGroup/index.d.ts +0 -0
- package/types/components/FAB/AnimatedFABIcon.d.ts +0 -0
- package/types/components/FAB/FAB.d.ts +0 -0
- package/types/components/FAB/StyledFAB.d.ts +0 -0
- package/types/components/FAB/index.d.ts +0 -0
- package/types/components/Icon/AnimatedIcon.d.ts +0 -0
- package/types/components/Icon/HeroIcon/index.d.ts +0 -0
- package/types/components/Icon/IconList.d.ts +0 -0
- package/types/components/Icon/index.d.ts +0 -0
- package/types/components/Icon/utils.d.ts +0 -0
- package/types/components/Image/index.d.ts +0 -0
- package/types/components/List/BasicListItem.d.ts +0 -0
- package/types/components/List/ListItem.d.ts +0 -0
- package/types/components/List/StyledBasicListItem.d.ts +0 -0
- package/types/components/List/StyledListItem.d.ts +0 -0
- package/types/components/List/index.d.ts +0 -0
- package/types/components/PageControl/StyledPageControl.d.ts +0 -0
- package/types/components/PageControl/index.d.ts +0 -0
- package/types/components/PinInput/PinCell.d.ts +0 -0
- package/types/components/PinInput/StyledPinInput.d.ts +0 -0
- package/types/components/PinInput/index.d.ts +0 -0
- package/types/components/Progress/ProgressBar.d.ts +0 -0
- package/types/components/Progress/ProgressCircle.d.ts +0 -0
- package/types/components/Progress/StyledProgressBar.d.ts +0 -0
- package/types/components/Progress/StyledProgressCircle.d.ts +0 -0
- package/types/components/Progress/__tests__/index.spec.d.ts +0 -0
- package/types/components/Progress/constants.d.ts +0 -0
- package/types/components/Progress/index.d.ts +0 -0
- package/types/components/Progress/types.d.ts +0 -0
- package/types/components/Radio/Radio.d.ts +0 -0
- package/types/components/Radio/RadioGroup.d.ts +0 -0
- package/types/components/Radio/StyledRadio.d.ts +0 -0
- package/types/components/Radio/index.d.ts +0 -0
- package/types/components/Radio/types.d.ts +0 -0
- package/types/components/RefreshControl/index.d.ts +0 -0
- package/types/components/RichTextEditor/EditorEvent.d.ts +0 -0
- package/types/components/RichTextEditor/EditorToolbar.d.ts +0 -0
- package/types/components/RichTextEditor/MentionList.d.ts +0 -0
- package/types/components/RichTextEditor/RichTextEditor.d.ts +0 -0
- package/types/components/RichTextEditor/StyledRichTextEditor.d.ts +0 -0
- package/types/components/RichTextEditor/StyledToolbar.d.ts +0 -0
- package/types/components/RichTextEditor/__mocks__/heroEditorApp.d.ts +0 -0
- package/types/components/RichTextEditor/constants.d.ts +0 -0
- package/types/components/RichTextEditor/heroEditorApp.d.ts +0 -0
- package/types/components/RichTextEditor/index.d.ts +0 -0
- package/types/components/RichTextEditor/types.d.ts +0 -0
- package/types/components/RichTextEditor/utils/events.d.ts +0 -0
- package/types/components/RichTextEditor/utils/rnWebView.d.ts +0 -0
- package/types/components/SectionHeading/StyledHeading.d.ts +0 -0
- package/types/components/SectionHeading/index.d.ts +0 -0
- package/types/components/Select/BaseOptionList.d.ts +0 -0
- package/types/components/Select/Footer.d.ts +0 -0
- package/types/components/Select/MultiSelect/Option.d.ts +0 -0
- package/types/components/Select/MultiSelect/OptionList.d.ts +0 -0
- package/types/components/Select/MultiSelect/index.d.ts +0 -0
- package/types/components/Select/SingleSelect/Option.d.ts +0 -0
- package/types/components/Select/SingleSelect/OptionList.d.ts +0 -0
- package/types/components/Select/SingleSelect/StyledSingleSelect.d.ts +0 -0
- package/types/components/Select/SingleSelect/index.d.ts +0 -0
- package/types/components/Select/StyledSelect.d.ts +0 -0
- package/types/components/Select/helpers.d.ts +0 -0
- package/types/components/Select/index.d.ts +0 -0
- package/types/components/Select/types.d.ts +0 -0
- package/types/components/Skeleton/StyledSkeleton.d.ts +0 -0
- package/types/components/Skeleton/index.d.ts +0 -0
- package/types/components/Slider/index.d.ts +0 -0
- package/types/components/Spinner/AnimatedSpinner.d.ts +0 -0
- package/types/components/Spinner/StyledSpinner.d.ts +0 -0
- package/types/components/Spinner/index.d.ts +0 -0
- package/types/components/Success/StyledSuccess.d.ts +0 -0
- package/types/components/Success/index.d.ts +0 -0
- package/types/components/Swipeable/StyledSwipeable.d.ts +0 -0
- package/types/components/Swipeable/SwipeableAction.d.ts +0 -0
- package/types/components/Swipeable/index.d.ts +0 -0
- package/types/components/Switch/SelectorSwitch/Option.d.ts +0 -0
- package/types/components/Switch/SelectorSwitch/StyledSelectorSwitch.d.ts +0 -0
- package/types/components/Switch/SelectorSwitch/index.d.ts +0 -0
- package/types/components/Switch/StyledSwitch.d.ts +0 -0
- package/types/components/Switch/index.d.ts +0 -0
- package/types/components/Tabs/ActiveTabIndicator.d.ts +0 -0
- package/types/components/Tabs/SceneView.d.ts +9 -0
- package/types/components/Tabs/ScrollableTabs.d.ts +0 -0
- package/types/components/Tabs/ScrollableTabsHeader.d.ts +35 -0
- package/types/components/Tabs/ScrollableTabsV2/SceneView.d.ts +10 -0
- package/types/components/Tabs/ScrollableTabsV2/ScrollableTabsV2.d.ts +9 -0
- package/types/components/Tabs/ScrollableTabsV2/index.d.ts +4 -0
- package/types/components/Tabs/StyledScrollableTabs.d.ts +0 -0
- package/types/components/Tabs/StyledTabs.d.ts +0 -0
- package/types/components/Tabs/TabWithBadge.d.ts +0 -0
- package/types/components/Tabs/index.d.ts +3 -0
- package/types/components/Tabs/utils.d.ts +0 -0
- package/types/components/Tag/StyledTag.d.ts +0 -0
- package/types/components/Tag/index.d.ts +0 -0
- package/types/components/TextInput/StyledTextInput.d.ts +12 -7
- package/types/components/TextInput/index.d.ts +8 -4
- package/types/components/TimePicker/StyledTimePicker.d.ts +0 -0
- package/types/components/TimePicker/TimePickerAndroid.d.ts +0 -0
- package/types/components/TimePicker/TimePickerIOS.d.ts +0 -0
- package/types/components/TimePicker/index.d.ts +0 -0
- package/types/components/TimePicker/types.d.ts +0 -0
- package/types/components/Toast/StyledToast.d.ts +0 -0
- package/types/components/Toast/Toast.d.ts +0 -0
- package/types/components/Toast/ToastContainer.d.ts +0 -0
- package/types/components/Toast/ToastContext.d.ts +0 -0
- package/types/components/Toast/ToastProvider.d.ts +0 -0
- package/types/components/Toast/index.d.ts +0 -0
- package/types/components/Toast/types.d.ts +0 -0
- package/types/components/Toolbar/StyledToolbar.d.ts +0 -0
- package/types/components/Toolbar/ToolbarGroup.d.ts +0 -0
- package/types/components/Toolbar/ToolbarItem.d.ts +0 -0
- package/types/components/Toolbar/index.d.ts +0 -0
- package/types/components/Typography/Text/StyledText.d.ts +0 -0
- package/types/components/Typography/Text/index.d.ts +0 -0
- package/types/components/Typography/index.d.ts +0 -0
- package/types/index.d.ts +0 -0
- package/types/testHelpers/renderWithTheme.d.ts +0 -0
- package/types/theme/ThemeProvider.d.ts +0 -0
- package/types/theme/ThemeSwitcher.d.ts +0 -0
- package/types/theme/components/accordion.d.ts +0 -0
- package/types/theme/components/alert.d.ts +0 -0
- package/types/theme/components/attachment.d.ts +0 -0
- package/types/theme/components/avatar.d.ts +0 -0
- package/types/theme/components/badge.d.ts +0 -0
- package/types/theme/components/bottomNavigation.d.ts +0 -0
- package/types/theme/components/bottomSheet.d.ts +0 -0
- package/types/theme/components/button.d.ts +0 -0
- package/types/theme/components/calendar.d.ts +0 -0
- package/types/theme/components/card.d.ts +0 -0
- package/types/theme/components/cardCarousel.d.ts +0 -0
- package/types/theme/components/carousel.d.ts +0 -0
- package/types/theme/components/checkbox.d.ts +0 -0
- package/types/theme/components/contentNavigator.d.ts +0 -0
- package/types/theme/components/datePicker.d.ts +0 -0
- package/types/theme/components/divider.d.ts +0 -0
- package/types/theme/components/drawer.d.ts +0 -0
- package/types/theme/components/empty.d.ts +0 -0
- package/types/theme/components/error.d.ts +0 -0
- package/types/theme/components/fab.d.ts +0 -0
- package/types/theme/components/icon.d.ts +0 -0
- package/types/theme/components/image.d.ts +0 -0
- package/types/theme/components/list.d.ts +0 -0
- package/types/theme/components/pageControl.d.ts +0 -0
- package/types/theme/components/pinInput.d.ts +0 -0
- package/types/theme/components/progress.d.ts +0 -0
- package/types/theme/components/radio.d.ts +0 -0
- package/types/theme/components/refreshControl.d.ts +0 -0
- package/types/theme/components/richTextEditor.d.ts +0 -0
- package/types/theme/components/sectionHeading.d.ts +0 -0
- package/types/theme/components/select.d.ts +0 -0
- package/types/theme/components/skeleton.d.ts +0 -0
- package/types/theme/components/slider.d.ts +0 -0
- package/types/theme/components/spinner.d.ts +0 -0
- package/types/theme/components/success.d.ts +0 -0
- package/types/theme/components/swipeable.d.ts +0 -0
- package/types/theme/components/switch.d.ts +0 -0
- package/types/theme/components/tabs.d.ts +0 -0
- package/types/theme/components/tag.d.ts +0 -0
- package/types/theme/components/textInput.d.ts +5 -0
- package/types/theme/components/timePicker.d.ts +0 -0
- package/types/theme/components/toast.d.ts +0 -0
- package/types/theme/components/toolbar.d.ts +0 -0
- package/types/theme/components/typography.d.ts +0 -0
- package/types/theme/getTheme.d.ts +0 -0
- package/types/theme/global/borders.d.ts +0 -0
- package/types/theme/global/colors/eBens.d.ts +0 -0
- package/types/theme/global/colors/global.d.ts +0 -0
- package/types/theme/global/colors/globalDark.d.ts +0 -0
- package/types/theme/global/colors/jobs.d.ts +0 -0
- package/types/theme/global/colors/swag.d.ts +0 -0
- package/types/theme/global/colors/swagDark.d.ts +0 -0
- package/types/theme/global/colors/types.d.ts +0 -0
- package/types/theme/global/colors/wallet.d.ts +0 -0
- package/types/theme/global/colors/work.d.ts +0 -0
- package/types/theme/global/index.d.ts +0 -0
- package/types/theme/global/scale.d.ts +0 -0
- package/types/theme/global/sizes.d.ts +0 -0
- package/types/theme/global/space.d.ts +0 -0
- package/types/theme/global/typography.d.ts +0 -0
- package/types/theme/index.d.ts +0 -0
- package/types/types.d.ts +0 -0
- package/types/utils/functions.d.ts +0 -0
- package/types/utils/helpers.d.ts +0 -0
- package/types/utils/hooks.d.ts +0 -0
- package/types/utils/scale.d.ts +0 -0
|
@@ -4,9 +4,9 @@ import { TextInput as RNTextInput } from 'react-native';
|
|
|
4
4
|
import { theme } from '../../..';
|
|
5
5
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
6
6
|
import Icon from '../../Icon';
|
|
7
|
-
import TextInput, {
|
|
7
|
+
import TextInput, { getState, TextInputHandles } from '../index';
|
|
8
8
|
|
|
9
|
-
describe('
|
|
9
|
+
describe('getState', () => {
|
|
10
10
|
it.each`
|
|
11
11
|
disabled | error | editable | loading | isEmptyValue | expected
|
|
12
12
|
${false} | ${undefined} | ${true} | ${false} | ${true} | ${'default'}
|
|
@@ -15,10 +15,10 @@ describe('getVariant', () => {
|
|
|
15
15
|
${false} | ${'This field is required'} | ${false} | ${false} | ${true} | ${'error'}
|
|
16
16
|
${true} | ${'This field is required'} | ${false} | ${false} | ${true} | ${'disabled'}
|
|
17
17
|
`(
|
|
18
|
-
'should return the correct
|
|
18
|
+
'should return the correct state when disabled $disabled, errorMessage $errorMessage, editable $false, isEmptyValue $isEmptyValue',
|
|
19
19
|
({ disabled, error, editable, loading, isEmptyValue, expected }) => {
|
|
20
20
|
expect(
|
|
21
|
-
|
|
21
|
+
getState({
|
|
22
22
|
disabled,
|
|
23
23
|
error,
|
|
24
24
|
editable,
|
|
@@ -483,4 +483,16 @@ describe('TextInput', () => {
|
|
|
483
483
|
expect(blurSpy).toHaveBeenCalledTimes(1);
|
|
484
484
|
});
|
|
485
485
|
});
|
|
486
|
+
|
|
487
|
+
describe('variants', () => {
|
|
488
|
+
it('renders textarea variant correctly', () => {
|
|
489
|
+
const { toJSON, queryByText, queryByDisplayValue } = renderWithTheme(
|
|
490
|
+
<TextInput label="Amount (AUD)" value="2000" variant="textarea" />
|
|
491
|
+
);
|
|
492
|
+
|
|
493
|
+
expect(toJSON()).toMatchSnapshot();
|
|
494
|
+
expect(queryByText('Amount (AUD)')).toBeTruthy();
|
|
495
|
+
expect(queryByDisplayValue('2000')).toBeTruthy();
|
|
496
|
+
});
|
|
497
|
+
});
|
|
486
498
|
});
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from './StyledTextInput';
|
|
28
28
|
import Icon from '../Icon';
|
|
29
29
|
import { useTheme } from '../../theme';
|
|
30
|
-
import type {
|
|
30
|
+
import type { State } from './StyledTextInput';
|
|
31
31
|
import type { IconName } from '../Icon';
|
|
32
32
|
import { omit, pick } from '../../utils/helpers';
|
|
33
33
|
|
|
@@ -110,9 +110,13 @@ export interface TextInputProps extends NativeTextInputProps {
|
|
|
110
110
|
* Component ref.
|
|
111
111
|
*/
|
|
112
112
|
ref?: React.Ref<TextInputHandles>;
|
|
113
|
+
/**
|
|
114
|
+
* Component variant.
|
|
115
|
+
*/
|
|
116
|
+
variant?: 'text' | 'textarea';
|
|
113
117
|
}
|
|
114
118
|
|
|
115
|
-
export const
|
|
119
|
+
export const getState = ({
|
|
116
120
|
disabled,
|
|
117
121
|
error,
|
|
118
122
|
editable,
|
|
@@ -125,7 +129,7 @@ export const getVariant = ({
|
|
|
125
129
|
loading: boolean;
|
|
126
130
|
isFocused?: boolean;
|
|
127
131
|
isEmptyValue?: boolean;
|
|
128
|
-
}):
|
|
132
|
+
}): State => {
|
|
129
133
|
if (disabled) {
|
|
130
134
|
return 'disabled';
|
|
131
135
|
}
|
|
@@ -167,6 +171,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
167
171
|
defaultValue,
|
|
168
172
|
renderInputValue,
|
|
169
173
|
allowFontScaling = false,
|
|
174
|
+
variant = 'text',
|
|
170
175
|
...nativeProps
|
|
171
176
|
}: TextInputProps,
|
|
172
177
|
ref?: React.Ref<TextInputHandles>
|
|
@@ -177,7 +182,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
177
182
|
|
|
178
183
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
179
184
|
|
|
180
|
-
const
|
|
185
|
+
const state = getState({
|
|
181
186
|
disabled,
|
|
182
187
|
error,
|
|
183
188
|
editable,
|
|
@@ -252,7 +257,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
252
257
|
]),
|
|
253
258
|
testID: 'text-input',
|
|
254
259
|
accessibilityState: {
|
|
255
|
-
disabled:
|
|
260
|
+
disabled: state === 'disabled' || state === 'readonly',
|
|
256
261
|
},
|
|
257
262
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
258
263
|
// @ts-ignore
|
|
@@ -284,14 +289,14 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
284
289
|
<StyledContainer
|
|
285
290
|
style={styleWithoutBackgroundColor}
|
|
286
291
|
pointerEvents={
|
|
287
|
-
|
|
292
|
+
state === 'disabled' || state === 'readonly' ? 'none' : 'auto'
|
|
288
293
|
}
|
|
289
294
|
testID={testID}
|
|
290
295
|
>
|
|
291
296
|
<StyledTextInputContainer>
|
|
292
297
|
<StyledBorderBackDrop
|
|
293
298
|
themeFocused={isFocused}
|
|
294
|
-
|
|
299
|
+
themeState={state}
|
|
295
300
|
testID="text-input-border"
|
|
296
301
|
style={[{ backgroundColor }, borderStyle]}
|
|
297
302
|
/>
|
|
@@ -302,7 +307,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
302
307
|
style={{ backgroundColor }}
|
|
303
308
|
>
|
|
304
309
|
{required && (
|
|
305
|
-
<StyledAsteriskLabel
|
|
310
|
+
<StyledAsteriskLabel themeState={state} fontSize="small">
|
|
306
311
|
*
|
|
307
312
|
</StyledAsteriskLabel>
|
|
308
313
|
)}
|
|
@@ -311,7 +316,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
311
316
|
nativeID={accessibilityLabelledBy}
|
|
312
317
|
testID="input-label"
|
|
313
318
|
fontSize="small"
|
|
314
|
-
|
|
319
|
+
themeState={state}
|
|
315
320
|
style={{ backgroundColor }}
|
|
316
321
|
>
|
|
317
322
|
{label}
|
|
@@ -321,7 +326,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
321
326
|
)}
|
|
322
327
|
{typeof prefix === 'string' ? (
|
|
323
328
|
<Icon
|
|
324
|
-
intent={
|
|
329
|
+
intent={state === 'disabled' ? 'disabled-text' : 'text'}
|
|
325
330
|
testID="input-prefix"
|
|
326
331
|
icon={prefix}
|
|
327
332
|
size="xsmall"
|
|
@@ -331,9 +336,12 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
331
336
|
)}
|
|
332
337
|
<StyledTextInputAndLabelContainer>
|
|
333
338
|
{!isFocused && isEmptyValue && (
|
|
334
|
-
<StyledLabelContainerInsideTextInput
|
|
339
|
+
<StyledLabelContainerInsideTextInput
|
|
340
|
+
themeVariant={variant}
|
|
341
|
+
pointerEvents="none"
|
|
342
|
+
>
|
|
335
343
|
{required && (
|
|
336
|
-
<StyledAsteriskLabelInsideTextInput
|
|
344
|
+
<StyledAsteriskLabelInsideTextInput themeState={state}>
|
|
337
345
|
*
|
|
338
346
|
</StyledAsteriskLabelInsideTextInput>
|
|
339
347
|
)}
|
|
@@ -342,7 +350,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
342
350
|
nativeID={accessibilityLabelledBy}
|
|
343
351
|
testID="input-label"
|
|
344
352
|
fontSize="medium"
|
|
345
|
-
|
|
353
|
+
themeState={state}
|
|
346
354
|
>
|
|
347
355
|
{label}
|
|
348
356
|
</StyledLabelInsideTextInput>
|
|
@@ -354,6 +362,8 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
354
362
|
) : (
|
|
355
363
|
<StyledTextInput
|
|
356
364
|
{...nativeInputProps}
|
|
365
|
+
themeVariant={variant}
|
|
366
|
+
multiline={variant === 'textarea' || nativeProps.multiline}
|
|
357
367
|
ref={(reference) => {
|
|
358
368
|
innerTextInput.current = reference;
|
|
359
369
|
}}
|
|
@@ -362,7 +372,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
362
372
|
</StyledTextInputAndLabelContainer>
|
|
363
373
|
{typeof actualSuffix === 'string' ? (
|
|
364
374
|
<Icon
|
|
365
|
-
intent={
|
|
375
|
+
intent={state === 'disabled' ? 'disabled-text' : 'text'}
|
|
366
376
|
testID="input-suffix"
|
|
367
377
|
icon={actualSuffix}
|
|
368
378
|
spin={actualSuffix === 'loading'}
|
|
@@ -389,7 +399,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
389
399
|
!!helpText && <StyledHelperText>{helpText}</StyledHelperText>
|
|
390
400
|
)}
|
|
391
401
|
{shouldShowMaxLength && (
|
|
392
|
-
<StyledMaxLengthMessage
|
|
402
|
+
<StyledMaxLengthMessage themeState={state} fontSize="small">
|
|
393
403
|
{displayText.length}/{maxLength}
|
|
394
404
|
</StyledMaxLengthMessage>
|
|
395
405
|
)}
|
|
@@ -76,7 +76,7 @@ exports[`TimePickerAndroid renders correct with hide suffix 1`] = `
|
|
|
76
76
|
}
|
|
77
77
|
testID="text-input-border"
|
|
78
78
|
themeFocused={false}
|
|
79
|
-
|
|
79
|
+
themeState="filled"
|
|
80
80
|
/>
|
|
81
81
|
<View
|
|
82
82
|
pointerEvents="none"
|
|
@@ -123,8 +123,8 @@ exports[`TimePickerAndroid renders correct with hide suffix 1`] = `
|
|
|
123
123
|
themeFontSize="small"
|
|
124
124
|
themeFontWeight="regular"
|
|
125
125
|
themeIntent="body"
|
|
126
|
+
themeState="filled"
|
|
126
127
|
themeTypeface="neutral"
|
|
127
|
-
themeVariant="filled"
|
|
128
128
|
>
|
|
129
129
|
Break time
|
|
130
130
|
</Text>
|
|
@@ -160,8 +160,11 @@ exports[`TimePickerAndroid renders correct with hide suffix 1`] = `
|
|
|
160
160
|
Object {
|
|
161
161
|
"alignSelf": "stretch",
|
|
162
162
|
"flexGrow": 2,
|
|
163
|
-
"
|
|
163
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
164
|
+
"fontSize": 16,
|
|
165
|
+
"height": undefined,
|
|
164
166
|
"marginHorizontal": 8,
|
|
167
|
+
"maxHeight": 144,
|
|
165
168
|
"paddingVertical": 0,
|
|
166
169
|
"textAlignVertical": "center",
|
|
167
170
|
},
|
|
@@ -172,6 +175,7 @@ exports[`TimePickerAndroid renders correct with hide suffix 1`] = `
|
|
|
172
175
|
]
|
|
173
176
|
}
|
|
174
177
|
testID="text-input"
|
|
178
|
+
themeVariant="text"
|
|
175
179
|
value="03:24 AM"
|
|
176
180
|
/>
|
|
177
181
|
</View>
|
|
@@ -307,7 +311,7 @@ exports[`TimePickerAndroid renders correctly 1`] = `
|
|
|
307
311
|
}
|
|
308
312
|
testID="text-input-border"
|
|
309
313
|
themeFocused={false}
|
|
310
|
-
|
|
314
|
+
themeState="filled"
|
|
311
315
|
/>
|
|
312
316
|
<View
|
|
313
317
|
pointerEvents="none"
|
|
@@ -354,8 +358,8 @@ exports[`TimePickerAndroid renders correctly 1`] = `
|
|
|
354
358
|
themeFontSize="small"
|
|
355
359
|
themeFontWeight="regular"
|
|
356
360
|
themeIntent="body"
|
|
361
|
+
themeState="filled"
|
|
357
362
|
themeTypeface="neutral"
|
|
358
|
-
themeVariant="filled"
|
|
359
363
|
>
|
|
360
364
|
Break time
|
|
361
365
|
</Text>
|
|
@@ -391,8 +395,11 @@ exports[`TimePickerAndroid renders correctly 1`] = `
|
|
|
391
395
|
Object {
|
|
392
396
|
"alignSelf": "stretch",
|
|
393
397
|
"flexGrow": 2,
|
|
394
|
-
"
|
|
398
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
399
|
+
"fontSize": 16,
|
|
400
|
+
"height": undefined,
|
|
395
401
|
"marginHorizontal": 8,
|
|
402
|
+
"maxHeight": 144,
|
|
396
403
|
"paddingVertical": 0,
|
|
397
404
|
"textAlignVertical": "center",
|
|
398
405
|
},
|
|
@@ -403,6 +410,7 @@ exports[`TimePickerAndroid renders correctly 1`] = `
|
|
|
403
410
|
]
|
|
404
411
|
}
|
|
405
412
|
testID="text-input"
|
|
413
|
+
themeVariant="text"
|
|
406
414
|
value="03:24 AM"
|
|
407
415
|
/>
|
|
408
416
|
</View>
|
|
@@ -76,7 +76,7 @@ exports[`TimePickerIOS renders correct with hide suffix 1`] = `
|
|
|
76
76
|
}
|
|
77
77
|
testID="text-input-border"
|
|
78
78
|
themeFocused={false}
|
|
79
|
-
|
|
79
|
+
themeState="filled"
|
|
80
80
|
/>
|
|
81
81
|
<View
|
|
82
82
|
pointerEvents="none"
|
|
@@ -123,8 +123,8 @@ exports[`TimePickerIOS renders correct with hide suffix 1`] = `
|
|
|
123
123
|
themeFontSize="small"
|
|
124
124
|
themeFontWeight="regular"
|
|
125
125
|
themeIntent="body"
|
|
126
|
+
themeState="filled"
|
|
126
127
|
themeTypeface="neutral"
|
|
127
|
-
themeVariant="filled"
|
|
128
128
|
>
|
|
129
129
|
Break time
|
|
130
130
|
</Text>
|
|
@@ -160,8 +160,11 @@ exports[`TimePickerIOS renders correct with hide suffix 1`] = `
|
|
|
160
160
|
Object {
|
|
161
161
|
"alignSelf": "stretch",
|
|
162
162
|
"flexGrow": 2,
|
|
163
|
-
"
|
|
163
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
164
|
+
"fontSize": 16,
|
|
165
|
+
"height": undefined,
|
|
164
166
|
"marginHorizontal": 8,
|
|
167
|
+
"maxHeight": 144,
|
|
165
168
|
"paddingVertical": 0,
|
|
166
169
|
"textAlignVertical": "center",
|
|
167
170
|
},
|
|
@@ -172,6 +175,7 @@ exports[`TimePickerIOS renders correct with hide suffix 1`] = `
|
|
|
172
175
|
]
|
|
173
176
|
}
|
|
174
177
|
testID="text-input"
|
|
178
|
+
themeVariant="text"
|
|
175
179
|
value="03:24 AM"
|
|
176
180
|
/>
|
|
177
181
|
</View>
|
|
@@ -307,7 +311,7 @@ exports[`TimePickerIOS renders correctly 1`] = `
|
|
|
307
311
|
}
|
|
308
312
|
testID="text-input-border"
|
|
309
313
|
themeFocused={false}
|
|
310
|
-
|
|
314
|
+
themeState="filled"
|
|
311
315
|
/>
|
|
312
316
|
<View
|
|
313
317
|
pointerEvents="none"
|
|
@@ -354,8 +358,8 @@ exports[`TimePickerIOS renders correctly 1`] = `
|
|
|
354
358
|
themeFontSize="small"
|
|
355
359
|
themeFontWeight="regular"
|
|
356
360
|
themeIntent="body"
|
|
361
|
+
themeState="filled"
|
|
357
362
|
themeTypeface="neutral"
|
|
358
|
-
themeVariant="filled"
|
|
359
363
|
>
|
|
360
364
|
Break time
|
|
361
365
|
</Text>
|
|
@@ -391,8 +395,11 @@ exports[`TimePickerIOS renders correctly 1`] = `
|
|
|
391
395
|
Object {
|
|
392
396
|
"alignSelf": "stretch",
|
|
393
397
|
"flexGrow": 2,
|
|
394
|
-
"
|
|
398
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
399
|
+
"fontSize": 16,
|
|
400
|
+
"height": undefined,
|
|
395
401
|
"marginHorizontal": 8,
|
|
402
|
+
"maxHeight": 144,
|
|
396
403
|
"paddingVertical": 0,
|
|
397
404
|
"textAlignVertical": "center",
|
|
398
405
|
},
|
|
@@ -403,6 +410,7 @@ exports[`TimePickerIOS renders correctly 1`] = `
|
|
|
403
410
|
]
|
|
404
411
|
}
|
|
405
412
|
testID="text-input"
|
|
413
|
+
themeVariant="text"
|
|
406
414
|
value="03:24 AM"
|
|
407
415
|
/>
|
|
408
416
|
</View>
|
|
@@ -975,17 +975,22 @@ Object {
|
|
|
975
975
|
"text": "#001f23",
|
|
976
976
|
},
|
|
977
977
|
"fontSizes": Object {
|
|
978
|
-
"asteriskLabel":
|
|
978
|
+
"asteriskLabel": 16,
|
|
979
979
|
"error": 12,
|
|
980
|
-
"labelInsideTextInput":
|
|
980
|
+
"labelInsideTextInput": 16,
|
|
981
981
|
"maxLength": 12,
|
|
982
|
-
"text":
|
|
982
|
+
"text": 16,
|
|
983
|
+
},
|
|
984
|
+
"fonts": Object {
|
|
985
|
+
"text": "BeVietnamPro-Regular",
|
|
983
986
|
},
|
|
984
987
|
"radii": Object {
|
|
985
988
|
"container": 8,
|
|
986
989
|
},
|
|
987
990
|
"sizes": Object {
|
|
988
991
|
"errorAndHelpTextContainerHeight": 16,
|
|
992
|
+
"textInputMaxHeight": 144,
|
|
993
|
+
"textareaHeight": 144,
|
|
989
994
|
},
|
|
990
995
|
"space": Object {
|
|
991
996
|
"containerMarginTop": 8,
|
|
@@ -58,12 +58,16 @@ const getTextInputTheme = (theme: GlobalTheme) => {
|
|
|
58
58
|
labelInsideTextInputMarginTop: -theme.space.xxsmall,
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
+
const fonts = {
|
|
62
|
+
text: theme.fonts.neutral.regular,
|
|
63
|
+
};
|
|
64
|
+
|
|
61
65
|
const fontSizes = {
|
|
62
|
-
text: theme.fontSizes.
|
|
63
|
-
labelInsideTextInput: theme.fontSizes.
|
|
66
|
+
text: theme.fontSizes.large,
|
|
67
|
+
labelInsideTextInput: theme.fontSizes.large,
|
|
64
68
|
error: theme.fontSizes.small,
|
|
65
69
|
maxLength: theme.fontSizes.small,
|
|
66
|
-
asteriskLabel: theme.fontSizes.
|
|
70
|
+
asteriskLabel: theme.fontSizes.large,
|
|
67
71
|
};
|
|
68
72
|
|
|
69
73
|
const borderWidths = {
|
|
@@ -79,9 +83,11 @@ const getTextInputTheme = (theme: GlobalTheme) => {
|
|
|
79
83
|
|
|
80
84
|
const sizes = {
|
|
81
85
|
errorAndHelpTextContainerHeight: theme.sizes.medium,
|
|
86
|
+
textareaHeight: theme.sizes['15xlarge'],
|
|
87
|
+
textInputMaxHeight: theme.sizes['15xlarge'],
|
|
82
88
|
};
|
|
83
89
|
|
|
84
|
-
return { colors, space, fontSizes, borderWidths, radii, sizes };
|
|
90
|
+
return { colors, space, fonts, fontSizes, borderWidths, radii, sizes };
|
|
85
91
|
};
|
|
86
92
|
|
|
87
93
|
export default getTextInputTheme;
|
package/testUtils/setup.tsx
CHANGED
|
@@ -40,6 +40,12 @@ jest.mock('react-native-pager-view', () => {
|
|
|
40
40
|
this.index = Math.max(0, Math.min(page, React.Children.count(children)));
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
setPageWithoutAnimation = (page: number) => {
|
|
44
|
+
const { children } = this.props;
|
|
45
|
+
|
|
46
|
+
this.index = Math.max(0, Math.min(page, React.Children.count(children)));
|
|
47
|
+
};
|
|
48
|
+
|
|
43
49
|
render() {
|
|
44
50
|
const { children } = this.props;
|
|
45
51
|
return <RealComponent>{children}</RealComponent>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|