@hero-design/rn 8.22.0 → 8.24.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.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 +527 -165
- package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/lib/index.js +527 -164
- package/package.json +5 -5
- package/src/components/Alert/index.tsx +6 -0
- 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/Empty/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
- package/src/components/Error/__tests__/__snapshots__/index.spec.tsx.snap +5 -5
- package/src/components/List/ListItem.tsx +12 -8
- 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/Success/StyledSuccess.tsx +87 -0
- package/src/components/Success/__tests__/__snapshots__/index.spec.tsx.snap +497 -0
- package/src/components/Success/__tests__/index.spec.tsx +78 -0
- package/src/components/Success/index.tsx +129 -0
- 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/Tag/StyledTag.tsx +1 -1
- package/src/components/Tag/__tests__/Tag.spec.tsx +22 -71
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +106 -53
- 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 +587 -70
- package/src/components/TextInput/__tests__/index.spec.tsx +45 -4
- package/src/components/TextInput/index.tsx +31 -16
- 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/index.ts +2 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +41 -6
- package/src/theme/components/empty.ts +1 -1
- package/src/theme/components/error.ts +1 -1
- package/src/theme/components/success.ts +40 -0
- package/src/theme/components/tag.ts +1 -1
- package/src/theme/components/textInput.ts +10 -4
- package/src/theme/getTheme.ts +3 -0
- package/src/utils/hooks.ts +1 -1
- 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 +54 -0
- package/types/components/Success/index.d.ts +42 -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 +12 -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 +2 -1
- 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 +32 -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 +2 -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,
|
|
@@ -250,6 +250,35 @@ describe('TextInput', () => {
|
|
|
250
250
|
|
|
251
251
|
expect(getByTestId('text-input')).not.toHaveProp('multiline', 'true');
|
|
252
252
|
});
|
|
253
|
+
|
|
254
|
+
it('renders correctly with hide character count', () => {
|
|
255
|
+
const {
|
|
256
|
+
toJSON,
|
|
257
|
+
queryAllByTestId,
|
|
258
|
+
queryAllByText,
|
|
259
|
+
queryAllByDisplayValue,
|
|
260
|
+
getByTestId,
|
|
261
|
+
} = renderWithTheme(
|
|
262
|
+
<TextInput
|
|
263
|
+
label="Shout out"
|
|
264
|
+
value="shout out Tung Van"
|
|
265
|
+
required
|
|
266
|
+
maxLength={255}
|
|
267
|
+
multiline
|
|
268
|
+
error="must not exceed character limit"
|
|
269
|
+
hideCharacterCount
|
|
270
|
+
/>
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
expect(toJSON()).toMatchSnapshot();
|
|
274
|
+
expect(queryAllByText('Shout out')).toHaveLength(1);
|
|
275
|
+
expect(queryAllByDisplayValue('shout out Tung Van')).toHaveLength(1);
|
|
276
|
+
expect(queryAllByText('18/255')).toHaveLength(0);
|
|
277
|
+
expect(queryAllByTestId('input-label')).toHaveLength(1);
|
|
278
|
+
expect(queryAllByTestId('text-input')).toHaveLength(1);
|
|
279
|
+
|
|
280
|
+
expect(getByTestId('text-input')).not.toHaveProp('multiline', 'true');
|
|
281
|
+
});
|
|
253
282
|
});
|
|
254
283
|
|
|
255
284
|
describe('disabled', () => {
|
|
@@ -454,4 +483,16 @@ describe('TextInput', () => {
|
|
|
454
483
|
expect(blurSpy).toHaveBeenCalledTimes(1);
|
|
455
484
|
});
|
|
456
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
|
+
});
|
|
457
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
|
|
|
@@ -94,6 +94,10 @@ export interface TextInputProps extends NativeTextInputProps {
|
|
|
94
94
|
* If the max length is set, the input will display the current length and the max length.
|
|
95
95
|
* */
|
|
96
96
|
maxLength?: number;
|
|
97
|
+
/**
|
|
98
|
+
* Whether to hide the character count.
|
|
99
|
+
* */
|
|
100
|
+
hideCharacterCount?: boolean;
|
|
97
101
|
/**
|
|
98
102
|
* The helper text to display.
|
|
99
103
|
*/
|
|
@@ -106,9 +110,13 @@ export interface TextInputProps extends NativeTextInputProps {
|
|
|
106
110
|
* Component ref.
|
|
107
111
|
*/
|
|
108
112
|
ref?: React.Ref<TextInputHandles>;
|
|
113
|
+
/**
|
|
114
|
+
* Component variant.
|
|
115
|
+
*/
|
|
116
|
+
variant?: 'text' | 'textarea';
|
|
109
117
|
}
|
|
110
118
|
|
|
111
|
-
export const
|
|
119
|
+
export const getState = ({
|
|
112
120
|
disabled,
|
|
113
121
|
error,
|
|
114
122
|
editable,
|
|
@@ -121,7 +129,7 @@ export const getVariant = ({
|
|
|
121
129
|
loading: boolean;
|
|
122
130
|
isFocused?: boolean;
|
|
123
131
|
isEmptyValue?: boolean;
|
|
124
|
-
}):
|
|
132
|
+
}): State => {
|
|
125
133
|
if (disabled) {
|
|
126
134
|
return 'disabled';
|
|
127
135
|
}
|
|
@@ -157,11 +165,13 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
157
165
|
disabled = false,
|
|
158
166
|
loading = false,
|
|
159
167
|
maxLength,
|
|
168
|
+
hideCharacterCount = false,
|
|
160
169
|
helpText,
|
|
161
170
|
value,
|
|
162
171
|
defaultValue,
|
|
163
172
|
renderInputValue,
|
|
164
173
|
allowFontScaling = false,
|
|
174
|
+
variant = 'text',
|
|
165
175
|
...nativeProps
|
|
166
176
|
}: TextInputProps,
|
|
167
177
|
ref?: React.Ref<TextInputHandles>
|
|
@@ -172,7 +182,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
172
182
|
|
|
173
183
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
174
184
|
|
|
175
|
-
const
|
|
185
|
+
const state = getState({
|
|
176
186
|
disabled,
|
|
177
187
|
error,
|
|
178
188
|
editable,
|
|
@@ -181,7 +191,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
181
191
|
isEmptyValue,
|
|
182
192
|
});
|
|
183
193
|
|
|
184
|
-
const shouldShowMaxLength = maxLength !== undefined;
|
|
194
|
+
const shouldShowMaxLength = maxLength !== undefined && !hideCharacterCount;
|
|
185
195
|
|
|
186
196
|
const theme = useTheme();
|
|
187
197
|
|
|
@@ -247,7 +257,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
247
257
|
]),
|
|
248
258
|
testID: 'text-input',
|
|
249
259
|
accessibilityState: {
|
|
250
|
-
disabled:
|
|
260
|
+
disabled: state === 'disabled' || state === 'readonly',
|
|
251
261
|
},
|
|
252
262
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
253
263
|
// @ts-ignore
|
|
@@ -279,14 +289,14 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
279
289
|
<StyledContainer
|
|
280
290
|
style={styleWithoutBackgroundColor}
|
|
281
291
|
pointerEvents={
|
|
282
|
-
|
|
292
|
+
state === 'disabled' || state === 'readonly' ? 'none' : 'auto'
|
|
283
293
|
}
|
|
284
294
|
testID={testID}
|
|
285
295
|
>
|
|
286
296
|
<StyledTextInputContainer>
|
|
287
297
|
<StyledBorderBackDrop
|
|
288
298
|
themeFocused={isFocused}
|
|
289
|
-
|
|
299
|
+
themeState={state}
|
|
290
300
|
testID="text-input-border"
|
|
291
301
|
style={[{ backgroundColor }, borderStyle]}
|
|
292
302
|
/>
|
|
@@ -297,7 +307,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
297
307
|
style={{ backgroundColor }}
|
|
298
308
|
>
|
|
299
309
|
{required && (
|
|
300
|
-
<StyledAsteriskLabel
|
|
310
|
+
<StyledAsteriskLabel themeState={state} fontSize="small">
|
|
301
311
|
*
|
|
302
312
|
</StyledAsteriskLabel>
|
|
303
313
|
)}
|
|
@@ -306,7 +316,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
306
316
|
nativeID={accessibilityLabelledBy}
|
|
307
317
|
testID="input-label"
|
|
308
318
|
fontSize="small"
|
|
309
|
-
|
|
319
|
+
themeState={state}
|
|
310
320
|
style={{ backgroundColor }}
|
|
311
321
|
>
|
|
312
322
|
{label}
|
|
@@ -316,7 +326,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
316
326
|
)}
|
|
317
327
|
{typeof prefix === 'string' ? (
|
|
318
328
|
<Icon
|
|
319
|
-
intent={
|
|
329
|
+
intent={state === 'disabled' ? 'disabled-text' : 'text'}
|
|
320
330
|
testID="input-prefix"
|
|
321
331
|
icon={prefix}
|
|
322
332
|
size="xsmall"
|
|
@@ -326,9 +336,12 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
326
336
|
)}
|
|
327
337
|
<StyledTextInputAndLabelContainer>
|
|
328
338
|
{!isFocused && isEmptyValue && (
|
|
329
|
-
<StyledLabelContainerInsideTextInput
|
|
339
|
+
<StyledLabelContainerInsideTextInput
|
|
340
|
+
themeVariant={variant}
|
|
341
|
+
pointerEvents="none"
|
|
342
|
+
>
|
|
330
343
|
{required && (
|
|
331
|
-
<StyledAsteriskLabelInsideTextInput
|
|
344
|
+
<StyledAsteriskLabelInsideTextInput themeState={state}>
|
|
332
345
|
*
|
|
333
346
|
</StyledAsteriskLabelInsideTextInput>
|
|
334
347
|
)}
|
|
@@ -337,7 +350,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
337
350
|
nativeID={accessibilityLabelledBy}
|
|
338
351
|
testID="input-label"
|
|
339
352
|
fontSize="medium"
|
|
340
|
-
|
|
353
|
+
themeState={state}
|
|
341
354
|
>
|
|
342
355
|
{label}
|
|
343
356
|
</StyledLabelInsideTextInput>
|
|
@@ -349,6 +362,8 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
349
362
|
) : (
|
|
350
363
|
<StyledTextInput
|
|
351
364
|
{...nativeInputProps}
|
|
365
|
+
themeVariant={variant}
|
|
366
|
+
multiline={variant === 'textarea' || nativeProps.multiline}
|
|
352
367
|
ref={(reference) => {
|
|
353
368
|
innerTextInput.current = reference;
|
|
354
369
|
}}
|
|
@@ -357,7 +372,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
357
372
|
</StyledTextInputAndLabelContainer>
|
|
358
373
|
{typeof actualSuffix === 'string' ? (
|
|
359
374
|
<Icon
|
|
360
|
-
intent={
|
|
375
|
+
intent={state === 'disabled' ? 'disabled-text' : 'text'}
|
|
361
376
|
testID="input-suffix"
|
|
362
377
|
icon={actualSuffix}
|
|
363
378
|
spin={actualSuffix === 'loading'}
|
|
@@ -384,7 +399,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
|
|
|
384
399
|
!!helpText && <StyledHelperText>{helpText}</StyledHelperText>
|
|
385
400
|
)}
|
|
386
401
|
{shouldShowMaxLength && (
|
|
387
|
-
<StyledMaxLengthMessage
|
|
402
|
+
<StyledMaxLengthMessage themeState={state} fontSize="small">
|
|
388
403
|
{displayText.length}/{maxLength}
|
|
389
404
|
</StyledMaxLengthMessage>
|
|
390
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>
|
package/src/index.ts
CHANGED
|
@@ -46,6 +46,7 @@ import Radio from './components/Radio';
|
|
|
46
46
|
import SectionHeading from './components/SectionHeading';
|
|
47
47
|
import Select from './components/Select';
|
|
48
48
|
import Skeleton from './components/Skeleton';
|
|
49
|
+
import Success from './components/Success';
|
|
49
50
|
import Switch from './components/Switch';
|
|
50
51
|
import Tabs from './components/Tabs';
|
|
51
52
|
import Tag from './components/Tag';
|
|
@@ -107,6 +108,7 @@ export {
|
|
|
107
108
|
Radio,
|
|
108
109
|
SectionHeading,
|
|
109
110
|
Select,
|
|
111
|
+
Success,
|
|
110
112
|
Switch,
|
|
111
113
|
Tabs,
|
|
112
114
|
Tag,
|
|
@@ -417,7 +417,7 @@ Object {
|
|
|
417
417
|
},
|
|
418
418
|
"space": Object {
|
|
419
419
|
"imageMargin": 24,
|
|
420
|
-
"titleMargin":
|
|
420
|
+
"titleMargin": 8,
|
|
421
421
|
"wrapperPadding": 16,
|
|
422
422
|
},
|
|
423
423
|
},
|
|
@@ -446,7 +446,7 @@ Object {
|
|
|
446
446
|
"wrapperHorizontalPadding": 16,
|
|
447
447
|
"wrapperVerticalPadding": 48,
|
|
448
448
|
},
|
|
449
|
-
"imageMarginBottom":
|
|
449
|
+
"imageMarginBottom": 24,
|
|
450
450
|
"titleMarginBottom": 8,
|
|
451
451
|
"wrapperPadding": 24,
|
|
452
452
|
},
|
|
@@ -793,6 +793,36 @@ Object {
|
|
|
793
793
|
},
|
|
794
794
|
},
|
|
795
795
|
},
|
|
796
|
+
"success": Object {
|
|
797
|
+
"colors": Object {
|
|
798
|
+
"description": "#4d6265",
|
|
799
|
+
"fullScreenBackground": "#ccd2d3",
|
|
800
|
+
"inPageBackground": "#f6f6f7",
|
|
801
|
+
"title": "#001f23",
|
|
802
|
+
},
|
|
803
|
+
"fontSizes": Object {
|
|
804
|
+
"description": 18,
|
|
805
|
+
"title": 24,
|
|
806
|
+
},
|
|
807
|
+
"fonts": Object {
|
|
808
|
+
"description": "RebondGrotesque",
|
|
809
|
+
"title": "RebondGrotesque-SemiBold",
|
|
810
|
+
},
|
|
811
|
+
"sizes": Object {
|
|
812
|
+
"image": 176,
|
|
813
|
+
},
|
|
814
|
+
"space": Object {
|
|
815
|
+
"button": Object {
|
|
816
|
+
"margin": 16,
|
|
817
|
+
"padding": 16,
|
|
818
|
+
"wrapperHorizontalPadding": 16,
|
|
819
|
+
"wrapperVerticalPadding": 48,
|
|
820
|
+
},
|
|
821
|
+
"imageMarginBottom": 32,
|
|
822
|
+
"titleMarginBottom": 8,
|
|
823
|
+
"wrapperPadding": 24,
|
|
824
|
+
},
|
|
825
|
+
},
|
|
796
826
|
"swipeable": Object {
|
|
797
827
|
"colors": Object {
|
|
798
828
|
"danger": "#f46363",
|
|
@@ -874,7 +904,7 @@ Object {
|
|
|
874
904
|
"dangerBackground": "#fcebe7",
|
|
875
905
|
"info": "#4568fb",
|
|
876
906
|
"infoBackground": "#ecf0ff",
|
|
877
|
-
"primary": "#
|
|
907
|
+
"primary": "#001f23",
|
|
878
908
|
"primaryBackground": undefined,
|
|
879
909
|
"success": "#017d6d",
|
|
880
910
|
"successBackground": "#f0fef4",
|
|
@@ -945,17 +975,22 @@ Object {
|
|
|
945
975
|
"text": "#001f23",
|
|
946
976
|
},
|
|
947
977
|
"fontSizes": Object {
|
|
948
|
-
"asteriskLabel":
|
|
978
|
+
"asteriskLabel": 16,
|
|
949
979
|
"error": 12,
|
|
950
|
-
"labelInsideTextInput":
|
|
980
|
+
"labelInsideTextInput": 16,
|
|
951
981
|
"maxLength": 12,
|
|
952
|
-
"text":
|
|
982
|
+
"text": 16,
|
|
983
|
+
},
|
|
984
|
+
"fonts": Object {
|
|
985
|
+
"text": "BeVietnamPro-Regular",
|
|
953
986
|
},
|
|
954
987
|
"radii": Object {
|
|
955
988
|
"container": 8,
|
|
956
989
|
},
|
|
957
990
|
"sizes": Object {
|
|
958
991
|
"errorAndHelpTextContainerHeight": 16,
|
|
992
|
+
"textInputMaxHeight": 144,
|
|
993
|
+
"textareaHeight": 144,
|
|
959
994
|
},
|
|
960
995
|
"space": Object {
|
|
961
996
|
"containerMarginTop": 8,
|
|
@@ -3,7 +3,7 @@ import type { GlobalTheme } from '../global';
|
|
|
3
3
|
const getErrorTheme = (theme: GlobalTheme) => {
|
|
4
4
|
const space = {
|
|
5
5
|
titleMarginBottom: theme.space.small,
|
|
6
|
-
imageMarginBottom: theme.space.
|
|
6
|
+
imageMarginBottom: theme.space.large,
|
|
7
7
|
wrapperPadding: theme.space.large,
|
|
8
8
|
button: {
|
|
9
9
|
wrapperHorizontalPadding: theme.space.medium,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { GlobalTheme } from '../global';
|
|
2
|
+
|
|
3
|
+
const getSuccessTheme = (theme: GlobalTheme) => {
|
|
4
|
+
const space = {
|
|
5
|
+
titleMarginBottom: theme.space.small,
|
|
6
|
+
imageMarginBottom: theme.space.xlarge,
|
|
7
|
+
wrapperPadding: theme.space.large,
|
|
8
|
+
button: {
|
|
9
|
+
wrapperHorizontalPadding: theme.space.medium,
|
|
10
|
+
wrapperVerticalPadding: theme.space.xxxlarge,
|
|
11
|
+
margin: theme.space.medium,
|
|
12
|
+
padding: theme.space.medium,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const sizes = {
|
|
17
|
+
image: theme.sizes['19xlarge'],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const colors = {
|
|
21
|
+
title: theme.colors.onDefaultGlobalSurface,
|
|
22
|
+
description: theme.colors.mutedOnDefaultGlobalSurface,
|
|
23
|
+
fullScreenBackground: theme.colors.decorativePrimarySurface,
|
|
24
|
+
inPageBackground: theme.colors.neutralGlobalSurface,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const fontSizes = {
|
|
28
|
+
title: theme.fontSizes.xxxlarge,
|
|
29
|
+
description: theme.fontSizes.xlarge,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const fonts = {
|
|
33
|
+
title: theme.fonts.playful.semiBold,
|
|
34
|
+
description: theme.fonts.playful.regular,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return { fontSizes, colors, sizes, space, fonts };
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default getSuccessTheme;
|
|
@@ -6,7 +6,7 @@ const getTagTheme = (theme: GlobalTheme) => {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
const colors = {
|
|
9
|
-
primary: theme.colors.
|
|
9
|
+
primary: theme.colors.onDefaultGlobalSurface,
|
|
10
10
|
primaryBackground: undefined,
|
|
11
11
|
info: theme.colors.onInfoSurface,
|
|
12
12
|
infoBackground: theme.colors.infoSurface,
|
|
@@ -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/src/theme/getTheme.ts
CHANGED
|
@@ -34,6 +34,7 @@ import getSelectTheme from './components/select';
|
|
|
34
34
|
import getSkeletonTheme from './components/skeleton';
|
|
35
35
|
import getSliderTheme from './components/slider';
|
|
36
36
|
import getSpinnerTheme from './components/spinner';
|
|
37
|
+
import getSuccessTheme from './components/success';
|
|
37
38
|
import getSwipeableTheme from './components/swipeable';
|
|
38
39
|
import getSwitchTheme from './components/switch';
|
|
39
40
|
import getTabsTheme from './components/tabs';
|
|
@@ -82,6 +83,7 @@ type Theme = GlobalTheme & {
|
|
|
82
83
|
skeleton: ReturnType<typeof getSkeletonTheme>;
|
|
83
84
|
slider: ReturnType<typeof getSliderTheme>;
|
|
84
85
|
spinner: ReturnType<typeof getSpinnerTheme>;
|
|
86
|
+
success: ReturnType<typeof getSuccessTheme>;
|
|
85
87
|
swipeable: ReturnType<typeof getSwipeableTheme>;
|
|
86
88
|
switch: ReturnType<typeof getSwitchTheme>;
|
|
87
89
|
tabs: ReturnType<typeof getTabsTheme>;
|
|
@@ -136,6 +138,7 @@ const getTheme = (
|
|
|
136
138
|
skeleton: getSkeletonTheme(globalTheme),
|
|
137
139
|
slider: getSliderTheme(globalTheme),
|
|
138
140
|
spinner: getSpinnerTheme(globalTheme),
|
|
141
|
+
success: getSuccessTheme(globalTheme),
|
|
139
142
|
swipeable: getSwipeableTheme(globalTheme),
|
|
140
143
|
switch: getSwitchTheme(globalTheme),
|
|
141
144
|
tabs: getTabsTheme(globalTheme),
|
package/src/utils/hooks.ts
CHANGED
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
|