@artsy/palette-mobile 13.2.33 → 13.2.35
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/Theme.js +9 -13
- package/dist/animation/CssTransition.js +8 -12
- package/dist/animation/index.js +1 -17
- package/dist/constants.js +4 -8
- package/dist/elements/ArtsyKeyboardAvoidingView/ArtsyKeyboardAvoidingView.js +19 -23
- package/dist/elements/ArtsyKeyboardAvoidingView/index.js +1 -17
- package/dist/elements/Autocomplete/Autocomplete.js +4 -8
- package/dist/elements/Autocomplete/Autocomplete.tests.js +9 -11
- package/dist/elements/Autocomplete/index.js +1 -17
- package/dist/elements/Avatar/Avatar.js +17 -44
- package/dist/elements/Avatar/Avatar.stories.js +7 -11
- package/dist/elements/Avatar/Avatar.tests.js +8 -10
- package/dist/elements/Avatar/index.js +1 -17
- package/dist/elements/BackButton/BackButton.js +9 -14
- package/dist/elements/BackButton/BackButton.stories.js +8 -12
- package/dist/elements/BackButton/index.js +1 -17
- package/dist/elements/Banner/Banner.js +14 -18
- package/dist/elements/Banner/Banner.stories.js +7 -11
- package/dist/elements/Banner/index.js +1 -17
- package/dist/elements/BorderBox/BorderBox.js +9 -15
- package/dist/elements/BorderBox/index.js +1 -17
- package/dist/elements/Box/Box.js +11 -17
- package/dist/elements/Box/Box.stories.js +14 -20
- package/dist/elements/Box/index.js +1 -17
- package/dist/elements/Button/Button.js +30 -37
- package/dist/elements/Button/Button.stories.js +18 -25
- package/dist/elements/Button/CTAButton.js +3 -7
- package/dist/elements/Button/FollowButton.js +7 -11
- package/dist/elements/Button/LinkButton.js +4 -8
- package/dist/elements/Button/colors.js +3 -7
- package/dist/elements/Button/index.js +4 -20
- package/dist/elements/ButtonNew/Button.js +32 -62
- package/dist/elements/ButtonNew/Button.stories.js +36 -50
- package/dist/elements/ButtonNew/Button.tests.js +13 -15
- package/dist/elements/ButtonNew/CTAButton.js +3 -7
- package/dist/elements/ButtonNew/FollowButton.js +7 -11
- package/dist/elements/ButtonNew/LinkButton.js +4 -8
- package/dist/elements/ButtonNew/colors.js +3 -7
- package/dist/elements/ButtonNew/index.js +4 -20
- package/dist/elements/Checkbox/Check.js +29 -56
- package/dist/elements/Checkbox/Checkbox.js +22 -30
- package/dist/elements/Checkbox/Checkbox.stories.js +8 -12
- package/dist/elements/Checkbox/index.js +2 -18
- package/dist/elements/ClassTheme/ClassTheme.js +5 -9
- package/dist/elements/ClassTheme/index.js +1 -17
- package/dist/elements/Collapse/Collapse.js +4 -8
- package/dist/elements/Collapse/Collapse.stories.js +9 -13
- package/dist/elements/Collapse/index.js +1 -17
- package/dist/elements/CollapsibleMenuItem/CollapsibleMenuItem.js +18 -21
- package/dist/elements/CollapsibleMenuItem/CollapsibleMenuItem.stories.js +30 -38
- package/dist/elements/CollapsibleMenuItem/index.js +1 -17
- package/dist/elements/Dialog/Dialog.js +20 -24
- package/dist/elements/Dialog/Dialog.stories.js +14 -16
- package/dist/elements/Dialog/Dialog.tests.js +12 -14
- package/dist/elements/Dialog/index.js +1 -17
- package/dist/elements/EntityHeader/EntityHeader.js +14 -18
- package/dist/elements/EntityHeader/EntityHeader.stories.js +17 -25
- package/dist/elements/EntityHeader/index.js +1 -17
- package/dist/elements/Flex/Flex.js +4 -7
- package/dist/elements/Flex/index.js +1 -17
- package/dist/elements/Header/ArtsyLogoHeader.js +8 -12
- package/dist/elements/Header/index.js +1 -17
- package/dist/elements/Histogram/Histogram.js +6 -10
- package/dist/elements/Histogram/index.js +1 -17
- package/dist/elements/Image/Image.js +26 -55
- package/dist/elements/Image/Image.stories.js +14 -16
- package/dist/elements/Image/index.js +1 -17
- package/dist/elements/Input/Input.js +127 -157
- package/dist/elements/Input/Input.stories.js +9 -11
- package/dist/elements/Input/Input.tests.js +17 -19
- package/dist/elements/Input/InputTitle.js +4 -8
- package/dist/elements/Input/helpers.d.ts +1 -1
- package/dist/elements/Input/helpers.js +51 -56
- package/dist/elements/Input/index.js +3 -19
- package/dist/elements/Input/maskValue.js +5 -10
- package/dist/elements/Input/maskValue.tests.js +11 -13
- package/dist/elements/Join/Join.js +6 -10
- package/dist/elements/Join/index.js +1 -17
- package/dist/elements/LazyFlatlist/LazyFlatlist.js +3 -7
- package/dist/elements/LazyFlatlist/index.js +2 -18
- package/dist/elements/LazyFlatlist/useHasSeenItem.js +6 -10
- package/dist/elements/LegacyScreen/LegacyScreen.js +51 -59
- package/dist/elements/LegacyScreen/index.js +1 -17
- package/dist/elements/LegacyTabs/ContentTabs.js +8 -12
- package/dist/elements/LegacyTabs/NavigationalTabs.js +11 -15
- package/dist/elements/LegacyTabs/StepTabs.js +15 -19
- package/dist/elements/LegacyTabs/Tab.js +9 -13
- package/dist/elements/LegacyTabs/TabBarContainer.js +28 -34
- package/dist/elements/LegacyTabs/index.js +9 -15
- package/dist/elements/List/BulletedItem.js +7 -11
- package/dist/elements/List/List.stories.js +8 -10
- package/dist/elements/List/index.js +1 -17
- package/dist/elements/MeasuredView/MeasuredView.js +10 -15
- package/dist/elements/MeasuredView/index.js +1 -17
- package/dist/elements/MenuItem/MenuItem.js +9 -13
- package/dist/elements/MenuItem/MenuItem.stories.js +5 -9
- package/dist/elements/MenuItem/index.js +1 -17
- package/dist/elements/Message/Message.js +15 -19
- package/dist/elements/Message/Message.stories.js +10 -12
- package/dist/elements/Message/Message.tests.js +9 -11
- package/dist/elements/Message/index.js +1 -17
- package/dist/elements/Pill/Pill.js +53 -83
- package/dist/elements/Pill/Pill.stories.js +16 -18
- package/dist/elements/Pill/Pill.tests.js +8 -10
- package/dist/elements/Pill/index.js +1 -17
- package/dist/elements/PopIn/PopIn.js +8 -12
- package/dist/elements/PopIn/index.js +1 -17
- package/dist/elements/Popover/Popover.js +21 -28
- package/dist/elements/Popover/Popover.stories.js +15 -17
- package/dist/elements/Popover/index.js +1 -17
- package/dist/elements/ProgressBar/ProgressBar.js +16 -43
- package/dist/elements/ProgressBar/ProgressBar.stories.js +6 -8
- package/dist/elements/ProgressBar/ProgressBar.tests.js +7 -9
- package/dist/elements/ProgressBar/index.js +1 -17
- package/dist/elements/Radio/RadioButton.js +20 -28
- package/dist/elements/Radio/RadioButton.stories.js +13 -15
- package/dist/elements/Radio/RadioDot.js +10 -14
- package/dist/elements/Radio/index.js +2 -7
- package/dist/elements/Screen/Background.js +3 -7
- package/dist/elements/Screen/Body.js +9 -13
- package/dist/elements/Screen/BottomView.js +9 -16
- package/dist/elements/Screen/FloatingHeader.js +9 -13
- package/dist/elements/Screen/FullWidthDivider.js +5 -9
- package/dist/elements/Screen/FullWidthItem.js +5 -9
- package/dist/elements/Screen/Header.js +21 -49
- package/dist/elements/Screen/Screen.stories.js +18 -20
- package/dist/elements/Screen/ScreenBase.js +9 -13
- package/dist/elements/Screen/ScreenFlatList.js +8 -15
- package/dist/elements/Screen/ScreenScrollContext.js +9 -14
- package/dist/elements/Screen/ScreenScrollView.js +8 -15
- package/dist/elements/Screen/StickySubHeader.js +20 -47
- package/dist/elements/Screen/constants.js +5 -8
- package/dist/elements/Screen/hooks/useAnimatedHeaderScrolling.js +10 -14
- package/dist/elements/Screen/hooks/useListenForScreenScroll.js +10 -14
- package/dist/elements/Screen/index.js +29 -46
- package/dist/elements/SearchInput/SearchInput.js +6 -10
- package/dist/elements/SearchInput/index.js +1 -17
- package/dist/elements/Separator/Separator.js +9 -15
- package/dist/elements/Separator/Separator.stories.js +6 -10
- package/dist/elements/Separator/ShadowSeparator.js +3 -9
- package/dist/elements/Separator/index.js +2 -18
- package/dist/elements/SimpleMessage/SimpleMessage.js +9 -16
- package/dist/elements/SimpleMessage/index.js +1 -17
- package/dist/elements/Skeleton/Skeleton.js +16 -45
- package/dist/elements/Skeleton/Skeleton.stories.js +10 -14
- package/dist/elements/Skeleton/index.js +1 -17
- package/dist/elements/Spacer/Spacer.js +3 -7
- package/dist/elements/Spacer/Spacer.stories.js +15 -20
- package/dist/elements/Spacer/index.js +1 -17
- package/dist/elements/Spinner/Spinner.js +15 -23
- package/dist/elements/Spinner/index.js +1 -17
- package/dist/elements/Switch/Switch.js +8 -12
- package/dist/elements/Switch/Switch.stories.js +11 -15
- package/dist/elements/Switch/index.js +1 -17
- package/dist/elements/Tabs/SubTabBar.js +11 -15
- package/dist/elements/Tabs/TabFlashList.js +8 -12
- package/dist/elements/Tabs/TabFlatList.js +8 -12
- package/dist/elements/Tabs/TabMasonry.js +8 -12
- package/dist/elements/Tabs/TabScrollView.js +8 -12
- package/dist/elements/Tabs/Tabs.js +24 -27
- package/dist/elements/Tabs/Tabs.stories.js +11 -13
- package/dist/elements/Tabs/TabsContainer.js +15 -19
- package/dist/elements/Tabs/TabsWithHeader.js +8 -12
- package/dist/elements/Tabs/hooks/useListenForTabContentScroll.js +8 -12
- package/dist/elements/Tabs/index.js +1 -17
- package/dist/elements/Text/LinkText.js +3 -7
- package/dist/elements/Text/Text.js +15 -21
- package/dist/elements/Text/Text.stories.js +18 -27
- package/dist/elements/Text/Text.tests.js +3 -5
- package/dist/elements/Text/helpers.js +5 -10
- package/dist/elements/Text/index.js +3 -19
- package/dist/elements/ToolTip/ToolTip.js +29 -34
- package/dist/elements/ToolTip/ToolTip.stories.js +11 -13
- package/dist/elements/ToolTip/ToolTip.tests.js +7 -9
- package/dist/elements/ToolTip/ToolTipFlyout.js +19 -47
- package/dist/elements/ToolTip/index.js +1 -17
- package/dist/elements/Touchable/Touchable.js +12 -19
- package/dist/elements/Touchable/Touchable.stories.js +9 -13
- package/dist/elements/Touchable/TouchableHighlightColor.js +6 -10
- package/dist/elements/Touchable/TouchableWithScale.js +7 -11
- package/dist/elements/Touchable/index.js +3 -19
- package/dist/elements/VisualClue/VisualClue.stories.js +6 -8
- package/dist/elements/VisualClue/VisualClueDot.js +6 -10
- package/dist/elements/VisualClue/VisualClueText.js +9 -13
- package/dist/elements/VisualClue/index.js +2 -18
- package/dist/elements/index.js +45 -61
- package/dist/index.js +10 -26
- package/dist/setupJest.js +2 -7
- package/dist/storybook/decorators.js +20 -28
- package/dist/storybook/helpers.js +6 -12
- package/dist/svgs/AddCircleFillIcon.js +6 -10
- package/dist/svgs/AddCircleIcon.js +6 -10
- package/dist/svgs/AddIcon.js +6 -10
- package/dist/svgs/AlertCircleFillIcon.js +6 -10
- package/dist/svgs/AlertIcon.js +6 -10
- package/dist/svgs/ArrowCircleFillIcons.js +7 -12
- package/dist/svgs/ArrowDownCircleIcon.js +6 -10
- package/dist/svgs/ArrowDownIcon.js +6 -10
- package/dist/svgs/ArrowLeftCircleIcon.js +6 -10
- package/dist/svgs/ArrowLeftIcon.js +6 -10
- package/dist/svgs/ArrowRightCircleIcon.js +6 -10
- package/dist/svgs/ArrowRightIcon.js +6 -10
- package/dist/svgs/ArrowUpCircleIcon.js +6 -10
- package/dist/svgs/ArrowUpIcon.js +6 -10
- package/dist/svgs/ArtsyLogoBlackIcon.js +6 -10
- package/dist/svgs/ArtsyLogoWhiteIcon.js +4 -8
- package/dist/svgs/ArtsyMarkBlackIcon.js +6 -10
- package/dist/svgs/ArtsyMarkWhiteIcon.js +4 -8
- package/dist/svgs/ArtworkIcon.js +6 -10
- package/dist/svgs/AuctionIcon.js +6 -10
- package/dist/svgs/BellFillIcon.js +6 -10
- package/dist/svgs/BellIcon.js +6 -10
- package/dist/svgs/BlueChipIcon.js +6 -10
- package/dist/svgs/BoltCircleFill.js +6 -10
- package/dist/svgs/BoltFill.js +6 -10
- package/dist/svgs/BookmarkFill.js +6 -10
- package/dist/svgs/BriefcaseIcon.js +6 -10
- package/dist/svgs/CertificateIcon.js +6 -10
- package/dist/svgs/CheckCircleFillIcon.js +6 -10
- package/dist/svgs/CheckCircleIcon.js +6 -10
- package/dist/svgs/CheckIcon.js +6 -10
- package/dist/svgs/ChevronIcon.js +11 -15
- package/dist/svgs/ClockFill.js +6 -10
- package/dist/svgs/CloseCircleFillIcon.js +6 -10
- package/dist/svgs/CloseCircleIcon.js +6 -10
- package/dist/svgs/CloseIcon.js +6 -10
- package/dist/svgs/CollapseIcon.js +6 -10
- package/dist/svgs/CreditCardIcon.js +14 -18
- package/dist/svgs/DecreaseIcon.js +6 -10
- package/dist/svgs/DocumentIcon.js +6 -10
- package/dist/svgs/DownloadIcon.js +6 -10
- package/dist/svgs/EditIcon.js +6 -10
- package/dist/svgs/EmptyCheckCircleIcon.js +6 -10
- package/dist/svgs/EnterIcon.js +6 -10
- package/dist/svgs/EnvelopeIcon.js +6 -10
- package/dist/svgs/EstablishedIcon.js +6 -10
- package/dist/svgs/ExclamationMarkCircleFill.js +6 -10
- package/dist/svgs/ExpandIcon.js +6 -10
- package/dist/svgs/EyeClosedIcon.js +6 -10
- package/dist/svgs/EyeOpenedIcon.js +6 -10
- package/dist/svgs/FacebookIcon.js +6 -10
- package/dist/svgs/FairIcon.js +6 -10
- package/dist/svgs/FilterIcon.js +6 -10
- package/dist/svgs/FullWidthIcon.js +6 -10
- package/dist/svgs/GenomeIcon.js +6 -10
- package/dist/svgs/GraphIcon.js +6 -10
- package/dist/svgs/GridIcon.js +6 -10
- package/dist/svgs/GuaranteeIcon.js +7 -11
- package/dist/svgs/HeartFillIcon.js +6 -10
- package/dist/svgs/HeartIcon.js +6 -10
- package/dist/svgs/HideIcon.js +6 -10
- package/dist/svgs/HomeIcon.js +6 -10
- package/dist/svgs/Icon.js +15 -30
- package/dist/svgs/ImageIcon.js +6 -10
- package/dist/svgs/ImageSetIcon.js +6 -10
- package/dist/svgs/IncreaseIcon.js +6 -10
- package/dist/svgs/InfoCircleIcon.js +6 -10
- package/dist/svgs/InstagramAppIcon.js +3 -7
- package/dist/svgs/InstitutionIcon.js +6 -10
- package/dist/svgs/LinkIcon.js +6 -10
- package/dist/svgs/LoaderIcon.js +6 -10
- package/dist/svgs/LockIcon.js +6 -10
- package/dist/svgs/LogoutIcon.js +6 -10
- package/dist/svgs/MagnifyingGlassIcon.js +6 -10
- package/dist/svgs/MapPinIcon.js +6 -10
- package/dist/svgs/MenuIcon.js +6 -10
- package/dist/svgs/MessageIcon.js +7 -11
- package/dist/svgs/MessagesAppIcon.js +4 -8
- package/dist/svgs/MoneyCircleIcon.js +6 -10
- package/dist/svgs/MoneyFillIcon.js +6 -10
- package/dist/svgs/MoreIcon.js +6 -10
- package/dist/svgs/MultiplePersonsIcon.js +6 -10
- package/dist/svgs/NoArtworkIcon.js +6 -10
- package/dist/svgs/NoImageIcon.js +6 -10
- package/dist/svgs/PageIcon.js +6 -10
- package/dist/svgs/Payment2Icon.js +6 -10
- package/dist/svgs/PaymentIcon.js +6 -10
- package/dist/svgs/PersonIcon.js +6 -10
- package/dist/svgs/PublicationIcon.js +6 -10
- package/dist/svgs/QuestionCircleIcon.js +6 -10
- package/dist/svgs/ReloadIcon.js +6 -10
- package/dist/svgs/SecureLockIcon.js +6 -10
- package/dist/svgs/SettingsIcon.js +6 -10
- package/dist/svgs/ShareIcon.js +6 -10
- package/dist/svgs/ShieldFilledIcon.js +6 -10
- package/dist/svgs/ShieldIcon.js +6 -10
- package/dist/svgs/StarCircleFill.js +6 -10
- package/dist/svgs/StarCircleIcon.js +6 -10
- package/dist/svgs/Stopwatch.js +6 -10
- package/dist/svgs/Tag2Icon.js +7 -11
- package/dist/svgs/TagIcon.js +6 -10
- package/dist/svgs/TimerIcon.js +6 -10
- package/dist/svgs/TopEmergingIcon.js +6 -10
- package/dist/svgs/TrashIcon.js +6 -10
- package/dist/svgs/TrendingIcon.js +6 -10
- package/dist/svgs/TriangleDown.js +6 -10
- package/dist/svgs/TwitterIcon.js +6 -10
- package/dist/svgs/UserMultiIcon.js +6 -10
- package/dist/svgs/UserSingleIcon.js +6 -10
- package/dist/svgs/VerifiedIcon.js +6 -10
- package/dist/svgs/VerifiedPersonIcon.js +6 -10
- package/dist/svgs/WhatsAppAppIcon.js +4 -8
- package/dist/svgs/WorldGlobeCircleIcon.js +6 -10
- package/dist/svgs/XCircleIcon.js +6 -10
- package/dist/svgs/icons.stories.js +11 -38
- package/dist/svgs/index.js +113 -129
- package/dist/tokens.js +9 -12
- package/dist/types.js +5 -10
- package/dist/utils/Wrap.js +7 -11
- package/dist/utils/colors.stories.js +16 -20
- package/dist/utils/createGeminiUrl.js +6 -10
- package/dist/utils/flattenChildren.js +5 -9
- package/dist/utils/formatLargeNumber.js +1 -5
- package/dist/utils/formatLargeNumbers.tests.js +8 -10
- package/dist/utils/hooks/index.js +4 -20
- package/dist/utils/hooks/useColor.js +2 -6
- package/dist/utils/hooks/useMeasure.js +4 -8
- package/dist/utils/hooks/useScreenDimensions.js +11 -16
- package/dist/utils/hooks/useSpace.js +2 -6
- package/dist/utils/hooks/useTheme.js +6 -10
- package/dist/utils/normalizeText.js +1 -5
- package/dist/utils/space.stories.js +9 -13
- package/dist/utils/tests/renderWithWrappers.js +7 -12
- package/dist/utils/text.js +9 -13
- package/dist/utils/types.js +1 -2
- package/dist/utils/webTokensToMobile.js +4 -9
- package/package.json +14 -14
|
@@ -1,112 +1,104 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const BackButton_1 = require("../BackButton");
|
|
16
|
-
const Flex_1 = require("../Flex");
|
|
17
|
-
const Spacer_1 = require("../Spacer");
|
|
18
|
-
const Text_1 = require("../Text");
|
|
19
|
-
const Touchable_1 = require("../Touchable");
|
|
20
|
-
const ScreenContext = (0, react_1.createContext)(null);
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
3
|
+
import { getChildByType, getChildrenByType, getChildrenByTypeDeep, removeChildrenByType, } from "react-nanny";
|
|
4
|
+
import { Keyboard, ScrollView } from "react-native";
|
|
5
|
+
import LinearGradient from "react-native-linear-gradient";
|
|
6
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
7
|
+
import { Wrap } from "../../utils/Wrap";
|
|
8
|
+
import { ArtsyKeyboardAvoidingView } from "../ArtsyKeyboardAvoidingView";
|
|
9
|
+
import { BackButton, BackButtonWithBackground } from "../BackButton";
|
|
10
|
+
import { Flex } from "../Flex";
|
|
11
|
+
import { Spacer } from "../Spacer";
|
|
12
|
+
import { Text } from "../Text";
|
|
13
|
+
import { Touchable } from "../Touchable";
|
|
14
|
+
const ScreenContext = createContext(null);
|
|
21
15
|
function useScreenContext() {
|
|
22
|
-
const context =
|
|
16
|
+
const context = useContext(ScreenContext);
|
|
23
17
|
if (!context) {
|
|
24
18
|
throw new Error("useScreenContext must be used within a Screen");
|
|
25
19
|
}
|
|
26
20
|
return context;
|
|
27
21
|
}
|
|
28
22
|
const ScreenWrapper = ({ children }) => {
|
|
29
|
-
const [options, setStateOptions] =
|
|
23
|
+
const [options, setStateOptions] = useState({
|
|
30
24
|
handleTopSafeArea: true,
|
|
31
25
|
bottomViewHeight: 0,
|
|
32
26
|
});
|
|
33
|
-
return ((
|
|
27
|
+
return (_jsx(ScreenContext.Provider, { value: {
|
|
34
28
|
options,
|
|
35
29
|
setOptions: (opts) => setStateOptions((prevOpts) => ({ ...prevOpts, ...opts })),
|
|
36
|
-
}, children: (
|
|
30
|
+
}, children: _jsx(ScreenRoot, { children: children }) }));
|
|
37
31
|
};
|
|
38
32
|
const ScreenRoot = ({ children }) => {
|
|
39
|
-
const header =
|
|
40
|
-
const headerFloating =
|
|
41
|
-
const background =
|
|
42
|
-
const bodyChildren =
|
|
43
|
-
return ((
|
|
33
|
+
const header = getChildByType(children, LegacyScreen.Header);
|
|
34
|
+
const headerFloating = getChildByType(children, LegacyScreen.FloatingHeader);
|
|
35
|
+
const background = getChildByType(children, LegacyScreen.Background);
|
|
36
|
+
const bodyChildren = getChildrenByTypeDeep(children, LegacyScreen.Body);
|
|
37
|
+
return (_jsxs(Flex, { flex: 1, backgroundColor: "white100", children: [background /* fullscreen */, header, bodyChildren, headerFloating /* floating, so keep close to the bottom */] }));
|
|
44
38
|
};
|
|
45
39
|
const useUpdateScreenContext = ({ header }) => {
|
|
46
40
|
const { setOptions } = useScreenContext();
|
|
47
|
-
|
|
41
|
+
useEffect(() => void setOptions({ handleTopSafeArea: header === "none" || header === "floating" }),
|
|
48
42
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49
43
|
[header]);
|
|
50
44
|
};
|
|
51
45
|
const NAVBAR_HEIGHT = 44;
|
|
52
|
-
const Header = ({ onBack, title, onSkip }) => {
|
|
46
|
+
export const Header = ({ onBack, title, onSkip }) => {
|
|
53
47
|
useUpdateScreenContext({ header: "regular" });
|
|
54
|
-
const insets =
|
|
55
|
-
return ((
|
|
48
|
+
const insets = useSafeAreaInsets();
|
|
49
|
+
return (_jsxs(Flex, { mt: `${insets.top}px`, height: NAVBAR_HEIGHT, flexDirection: "row", alignItems: "center", justifyContent: "space-between", px: SCREEN_HORIZONTAL_PADDING, children: [_jsx(Flex, { children: !!onBack && (_jsx(BackButton, { onPress: onBack, style: { flex: 1, justifyContent: "center" }, hitSlop: { left: 20, right: 20 } })) }), !!title && _jsx(Text, { children: title }), !!onSkip && (_jsx(Touchable, { haptic: "impactLight", onPress: onSkip, children: _jsx(Flex, { height: "100%", justifyContent: "center", children: _jsx(Text, { textAlign: "right", variant: "xs", children: "Skip" }) }) }))] }));
|
|
56
50
|
};
|
|
57
|
-
exports.Header = Header;
|
|
58
51
|
/**
|
|
59
52
|
* @deprecated Use `Screen.Header` instead.
|
|
60
53
|
*/
|
|
61
|
-
const FloatingHeader = ({ onBack }) => {
|
|
54
|
+
export const FloatingHeader = ({ onBack }) => {
|
|
62
55
|
useUpdateScreenContext({ header: "floating" });
|
|
63
|
-
const insets =
|
|
56
|
+
const insets = useSafeAreaInsets();
|
|
64
57
|
if (onBack) {
|
|
65
|
-
return ((
|
|
58
|
+
return (_jsx(Flex, { position: "absolute", top: insets.top, left: 0, right: 0, height: NAVBAR_HEIGHT, px: 1, flexDirection: "row", alignItems: "center", children: _jsx(BackButtonWithBackground, { onPress: onBack }) }));
|
|
66
59
|
}
|
|
67
60
|
return null;
|
|
68
61
|
};
|
|
69
|
-
exports.FloatingHeader = FloatingHeader;
|
|
70
62
|
const SCREEN_HORIZONTAL_PADDING = 2;
|
|
71
63
|
const Body = ({ scroll = false, noTopSafe = false, noBottomSafe = false, fullwidth = false, children, ...restFlexProps }) => {
|
|
72
|
-
const childrenExceptBottomView =
|
|
73
|
-
const bottomView =
|
|
64
|
+
const childrenExceptBottomView = removeChildrenByType(children, LegacyScreen.BottomView);
|
|
65
|
+
const bottomView = getChildrenByType(children, LegacyScreen.BottomView);
|
|
74
66
|
const { options } = useScreenContext();
|
|
75
|
-
const insets =
|
|
67
|
+
const insets = useSafeAreaInsets();
|
|
76
68
|
const withTopSafeArea = options.handleTopSafeArea && !noTopSafe;
|
|
77
69
|
const withBottomSafeArea = !noBottomSafe;
|
|
78
|
-
return ((
|
|
70
|
+
return (_jsx(_Fragment, { children: _jsx(Flex, { flex: 1, mt: withTopSafeArea ? `${insets.top}px` : undefined, mb: withBottomSafeArea ? `${insets.bottom}px` : undefined, ...restFlexProps, children: _jsx(Wrap, { if: scroll, children: _jsxs(ArtsyKeyboardAvoidingView, { children: [_jsx(ScrollView, { keyboardShouldPersistTaps: "handled", contentInset: { bottom: options.bottomViewHeight - insets.bottom }, children: _jsx(Wrap.Content, { children: _jsx(Flex, { flex: 1, px: fullwidth ? undefined : SCREEN_HORIZONTAL_PADDING, children: childrenExceptBottomView }) }) }), bottomView] }) }) }) }));
|
|
79
71
|
};
|
|
80
|
-
const Background = ({ children }) => ((
|
|
72
|
+
const Background = ({ children }) => (_jsx(Flex, { position: "absolute", top: 0, bottom: 0, left: 0, right: 0, children: children }));
|
|
81
73
|
const BottomView = ({ children }) => {
|
|
82
74
|
const { setOptions } = useScreenContext();
|
|
83
|
-
const insets =
|
|
84
|
-
const [keyboardShowing, setKeyboardShowing] =
|
|
85
|
-
const [keyboardHeight, setKeyboardHeight] =
|
|
86
|
-
|
|
75
|
+
const insets = useSafeAreaInsets();
|
|
76
|
+
const [keyboardShowing, setKeyboardShowing] = useState(false);
|
|
77
|
+
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
78
|
+
useEffect(() => {
|
|
87
79
|
const listeners = [];
|
|
88
|
-
listeners.push(
|
|
80
|
+
listeners.push(Keyboard.addListener("keyboardWillShow", // ios only event
|
|
89
81
|
(e) => {
|
|
90
82
|
setKeyboardHeight(e.endCoordinates.height);
|
|
91
83
|
setKeyboardShowing(true);
|
|
92
84
|
}));
|
|
93
|
-
listeners.push(
|
|
85
|
+
listeners.push(Keyboard.addListener("keyboardDidShow", // android event
|
|
94
86
|
(e) => {
|
|
95
87
|
setKeyboardHeight(e.endCoordinates.height);
|
|
96
88
|
setKeyboardShowing(true);
|
|
97
89
|
}));
|
|
98
|
-
listeners.push(
|
|
90
|
+
listeners.push(Keyboard.addListener("keyboardWillHide", // ios only event
|
|
99
91
|
() => setKeyboardShowing(false)));
|
|
100
|
-
listeners.push(
|
|
92
|
+
listeners.push(Keyboard.addListener("keyboardDidHide", // android event
|
|
101
93
|
() => setKeyboardShowing(false)));
|
|
102
94
|
return () => {
|
|
103
95
|
listeners.map((l) => l.remove());
|
|
104
96
|
};
|
|
105
97
|
}, []);
|
|
106
|
-
return ((
|
|
98
|
+
return (_jsxs(Flex, { position: "absolute", bottom: keyboardShowing ? keyboardHeight - insets.bottom : 0, left: 0, right: 0, onLayout: (evt) => void setOptions({ bottomViewHeight: evt.nativeEvent.layout.height }), children: [_jsx(LinearGradient, { colors: ["rgba(255,255,255,0)", "rgba(255,255,255,1)"], start: { x: 0, y: 0 }, end: { x: 0, y: 1 }, style: {
|
|
107
99
|
width: "100%",
|
|
108
100
|
height: 30,
|
|
109
|
-
}, pointerEvents: "none" }), (
|
|
101
|
+
}, pointerEvents: "none" }), _jsx(Flex, { px: SCREEN_HORIZONTAL_PADDING, py: keyboardShowing ? 1 : undefined, backgroundColor: "white100", children: children }), keyboardShowing ? null : _jsx(SafeBottomPadding, {})] }));
|
|
110
102
|
};
|
|
111
103
|
/**
|
|
112
104
|
* Only use with `<Screen.Body fullwidth>`.
|
|
@@ -114,7 +106,7 @@ const BottomView = ({ children }) => {
|
|
|
114
106
|
* One use case might be if you need to put an image background or something in the body,
|
|
115
107
|
* but you also need some content with the right padding.
|
|
116
108
|
*/
|
|
117
|
-
const BodyXPadding = (props) => ((
|
|
109
|
+
const BodyXPadding = (props) => (_jsx(Flex, { px: SCREEN_HORIZONTAL_PADDING, ...props }));
|
|
118
110
|
/**
|
|
119
111
|
* If there is a bottom safe area, this will render nothing.
|
|
120
112
|
* If there is no bottom safe area, this will render a small padding.
|
|
@@ -123,16 +115,16 @@ const BodyXPadding = (props) => ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { px: SCREE
|
|
|
123
115
|
* have enough space underneath, but with no safe area they look stuck at the bottom.
|
|
124
116
|
*/
|
|
125
117
|
const SafeBottomPadding = () => {
|
|
126
|
-
const insets =
|
|
118
|
+
const insets = useSafeAreaInsets();
|
|
127
119
|
if (insets.bottom > 0) {
|
|
128
120
|
return null;
|
|
129
121
|
}
|
|
130
|
-
return (
|
|
122
|
+
return _jsx(Spacer, { y: 2 });
|
|
131
123
|
};
|
|
132
|
-
|
|
124
|
+
export const LegacyScreen = Object.assign(ScreenWrapper, {
|
|
133
125
|
Body,
|
|
134
|
-
Header
|
|
135
|
-
FloatingHeader
|
|
126
|
+
Header,
|
|
127
|
+
FloatingHeader,
|
|
136
128
|
Background,
|
|
137
129
|
BottomView,
|
|
138
130
|
BodyXPadding,
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./LegacyScreen"), exports);
|
|
1
|
+
export * from "./LegacyScreen";
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const TabBarContainer_1 = require("./TabBarContainer");
|
|
7
|
-
const LegacyTabs_1 = require("../LegacyTabs");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { TabBarContainer } from "./TabBarContainer";
|
|
4
|
+
import { Tab } from "../LegacyTabs";
|
|
8
5
|
/**
|
|
9
6
|
* Renders a scrollable list of tabs. Tabs are not evenly spaced across screen
|
|
10
7
|
*/
|
|
11
|
-
const ContentTabs = ({ onTabPress, activeTab, tabs }) => {
|
|
12
|
-
const [tabLayouts, setTabLayouts] =
|
|
13
|
-
return ((
|
|
14
|
-
return ((
|
|
8
|
+
export const ContentTabs = ({ onTabPress, activeTab, tabs }) => {
|
|
9
|
+
const [tabLayouts, setTabLayouts] = useState(tabs.map(() => null));
|
|
10
|
+
return (_jsx(TabBarContainer, { scrollEnabled: true, activeTabIndex: activeTab, tabLayouts: tabLayouts, children: tabs.map(({ label }, index) => {
|
|
11
|
+
return (_jsx(Tab, { label: label, active: index === activeTab, onLayout: (e) => {
|
|
15
12
|
const layout = e.nativeEvent.layout;
|
|
16
13
|
setTabLayouts((layouts) => {
|
|
17
14
|
const result = layouts.slice(0);
|
|
@@ -23,4 +20,3 @@ const ContentTabs = ({ onTabPress, activeTab, tabs }) => {
|
|
|
23
20
|
} }, index));
|
|
24
21
|
}) }));
|
|
25
22
|
};
|
|
26
|
-
exports.ContentTabs = ContentTabs;
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const useScreenDimensions_1 = require("../../utils/hooks/useScreenDimensions");
|
|
8
|
-
const Box_1 = require("../Box");
|
|
9
|
-
const LegacyTabs_1 = require("../LegacyTabs");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { TabBarContainer } from "./TabBarContainer";
|
|
4
|
+
import { useScreenDimensions } from "../../utils/hooks/useScreenDimensions";
|
|
5
|
+
import { Box } from "../Box";
|
|
6
|
+
import { Tab } from "../LegacyTabs";
|
|
10
7
|
/**
|
|
11
8
|
* Renders a list of tabs. Evenly-spaces them across the screen with
|
|
12
9
|
* each tab label centered on the tab
|
|
13
10
|
*/
|
|
14
|
-
const NavigationalTabs = ({ onTabPress, activeTab, tabs }) => {
|
|
15
|
-
const [tabLayouts, setTabLayouts] =
|
|
16
|
-
const screenWidth =
|
|
11
|
+
export const NavigationalTabs = ({ onTabPress, activeTab, tabs }) => {
|
|
12
|
+
const [tabLayouts, setTabLayouts] = useState(tabs.map(() => null));
|
|
13
|
+
const screenWidth = useScreenDimensions().width;
|
|
17
14
|
const tabWidth = screenWidth / tabs.length;
|
|
18
|
-
return ((
|
|
19
|
-
return ((
|
|
15
|
+
return (_jsx(TabBarContainer, { scrollEnabled: true, activeTabIndex: activeTab, tabLayouts: tabLayouts, children: tabs.map(({ label, superscript }, index) => {
|
|
16
|
+
return (_jsx(Box, { minWidth: tabWidth, children: _jsx(Tab, { label: label, superscript: superscript, onPress: () => onTabPress(label, index), active: activeTab === index, onLayout: (e) => {
|
|
20
17
|
const layout = e.nativeEvent.layout;
|
|
21
18
|
setTabLayouts((layouts) => {
|
|
22
19
|
const result = layouts.slice(0);
|
|
@@ -26,4 +23,3 @@ const NavigationalTabs = ({ onTabPress, activeTab, tabs }) => {
|
|
|
26
23
|
} }) }, label + index));
|
|
27
24
|
}) }));
|
|
28
25
|
};
|
|
29
|
-
exports.NavigationalTabs = NavigationalTabs;
|
|
@@ -1,38 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const useScreenDimensions_1 = require("../../utils/hooks/useScreenDimensions");
|
|
10
|
-
const Box_1 = require("../Box");
|
|
11
|
-
const LegacyTabs_1 = require("../LegacyTabs");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { TouchableOpacity } from "react-native";
|
|
4
|
+
import { TabBarContainer } from "./TabBarContainer";
|
|
5
|
+
import { CheckIcon, ChevronIcon } from "../../svgs";
|
|
6
|
+
import { useScreenDimensions } from "../../utils/hooks/useScreenDimensions";
|
|
7
|
+
import { Box } from "../Box";
|
|
8
|
+
import { Tab } from "../LegacyTabs";
|
|
12
9
|
/**
|
|
13
10
|
* Renders a list of tabs. Evenly-spaces them across the screen with
|
|
14
11
|
* each tab label and chevron evenly spaced
|
|
15
12
|
*/
|
|
16
|
-
const StepTabs = ({ onTabPress, activeTab, tabs }) => {
|
|
17
|
-
const [tabLayouts, setTabLayouts] =
|
|
18
|
-
const tabWidth =
|
|
13
|
+
export const StepTabs = ({ onTabPress, activeTab, tabs }) => {
|
|
14
|
+
const [tabLayouts, setTabLayouts] = useState(tabs.map(() => null));
|
|
15
|
+
const tabWidth = useScreenDimensions().width / tabs.length;
|
|
19
16
|
const onTabSelect = (label, index) => {
|
|
20
17
|
if (index > 0 && !tabs[index - 1].completed) {
|
|
21
18
|
return;
|
|
22
19
|
}
|
|
23
20
|
onTabPress(label, index);
|
|
24
21
|
};
|
|
25
|
-
return ((
|
|
26
|
-
return ((
|
|
22
|
+
return (_jsx(TabBarContainer, { scrollEnabled: false, activeTabIndex: activeTab, tabLayouts: tabLayouts, children: tabs.map(({ label, completed }, index) => {
|
|
23
|
+
return (_jsx(TouchableOpacity, { onPress: () => onTabSelect(label, index), children: _jsxs(Box, { width: tabWidth, justifyContent: "space-between", flexDirection: "row", alignItems: "center", onLayout: (e) => {
|
|
27
24
|
const layout = e.nativeEvent.layout;
|
|
28
25
|
setTabLayouts((layouts) => {
|
|
29
26
|
const result = layouts.slice(0);
|
|
30
27
|
result[index] = layout;
|
|
31
28
|
return result;
|
|
32
29
|
});
|
|
33
|
-
}, children: [(
|
|
30
|
+
}, children: [_jsxs(Box, { flexDirection: "row", alignItems: "center", children: [_jsx(Tab, { label: label, onPress: () => onTabSelect(label, index), active: activeTab === index, style: { paddingHorizontal: 0, paddingLeft: 8, paddingRight: 5 }, onLayout: () => {
|
|
34
31
|
// noop
|
|
35
|
-
} }), !!completed && (
|
|
32
|
+
} }), !!completed && _jsx(CheckIcon, { fill: "green100", height: 15, width: 15 })] }), _jsx(ChevronIcon, { fill: "black60", height: 10, width: 10 })] }) }, label + index));
|
|
36
33
|
}) }));
|
|
37
34
|
};
|
|
38
|
-
exports.StepTabs = StepTabs;
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const TabV3 = ({ label, superscript, active, onLayout, onPress, style }) => {
|
|
9
|
-
const color = (0, hooks_1.useColor)();
|
|
10
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: onPress, children: ({ pressed }) => ((0, jsx_runtime_1.jsxs)(react_native_1.View, { onLayout: onLayout, style: {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Pressable, View } from "react-native";
|
|
3
|
+
import { useColor } from "../../utils/hooks";
|
|
4
|
+
import { Text } from "../Text";
|
|
5
|
+
export const TabV3 = ({ label, superscript, active, onLayout, onPress, style }) => {
|
|
6
|
+
const color = useColor();
|
|
7
|
+
return (_jsx(Pressable, { onPress: onPress, children: ({ pressed }) => (_jsxs(View, { onLayout: onLayout, style: {
|
|
11
8
|
alignItems: "center",
|
|
12
9
|
justifyContent: "center",
|
|
13
10
|
paddingHorizontal: 15,
|
|
14
11
|
paddingVertical: 10,
|
|
15
12
|
flexDirection: "row",
|
|
16
13
|
...style,
|
|
17
|
-
}, children: [(
|
|
14
|
+
}, children: [_jsx(Text, { fontSize: 16, color: active ? color("black100") : pressed ? color("blue100") : color("black60"), style: {
|
|
18
15
|
textDecorationLine: pressed ? "underline" : "none",
|
|
19
|
-
}, children: label }), !!superscript && ((
|
|
16
|
+
}, children: label }), !!superscript && (_jsx(Text, { fontSize: 12, color: color("blue100"), style: {
|
|
20
17
|
textDecorationLine: pressed ? "underline" : "none",
|
|
21
18
|
top: -3,
|
|
22
19
|
}, children: superscript }))] })) }));
|
|
23
20
|
};
|
|
24
|
-
exports.TabV3 = TabV3;
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const useScreenDimensions_1 = require("../../utils/hooks/useScreenDimensions");
|
|
10
|
-
const Box_1 = require("../Box");
|
|
11
|
-
exports.TAB_BAR_HEIGHT = 48;
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { compact } from "lodash";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
import { Animated, ScrollView, View } from "react-native";
|
|
5
|
+
import { useColor } from "../../utils/hooks";
|
|
6
|
+
import { useScreenDimensions } from "../../utils/hooks/useScreenDimensions";
|
|
7
|
+
import { Box } from "../Box";
|
|
8
|
+
export const TAB_BAR_HEIGHT = 48;
|
|
12
9
|
/**
|
|
13
10
|
* Wraps the respective tabs. Based on StickyTabPageTabBar
|
|
14
11
|
* Usage: ```
|
|
15
12
|
* <TabBarContainer>{props.tabs.map((tab) => <Tab {...tab} />)}</TabContainer>
|
|
16
13
|
* ```
|
|
17
14
|
*/
|
|
18
|
-
const TabBarContainer = ({ children, activeTabIndex, scrollEnabled, tabLayouts, }) => {
|
|
19
|
-
const color =
|
|
20
|
-
const screen =
|
|
15
|
+
export const TabBarContainer = ({ children, activeTabIndex, scrollEnabled, tabLayouts, }) => {
|
|
16
|
+
const color = useColor();
|
|
17
|
+
const screen = useScreenDimensions();
|
|
21
18
|
const allTabLayoutsArePresent = tabLayouts.every((l) => l);
|
|
22
|
-
const scrollViewRef =
|
|
23
|
-
|
|
19
|
+
const scrollViewRef = useRef(null);
|
|
20
|
+
useEffect(() => {
|
|
24
21
|
if (allTabLayoutsArePresent) {
|
|
25
22
|
// attempt to center the active tab
|
|
26
23
|
let left = 0;
|
|
@@ -32,30 +29,28 @@ const TabBarContainer = ({ children, activeTabIndex, scrollEnabled, tabLayouts,
|
|
|
32
29
|
scrollViewRef.current?.scrollTo({ x: scrollLeft });
|
|
33
30
|
}
|
|
34
31
|
}, [activeTabIndex]);
|
|
35
|
-
return ((
|
|
32
|
+
return (_jsx(Box, { children: _jsxs(ScrollView, { scrollEnabled: scrollEnabled, ref: scrollViewRef, horizontal: true, showsHorizontalScrollIndicator: false, contentContainerStyle: { minWidth: "100%" }, children: [_jsx(View, { style: {
|
|
36
33
|
position: "absolute",
|
|
37
34
|
bottom: 0,
|
|
38
35
|
left: 0,
|
|
39
36
|
right: 0,
|
|
40
37
|
borderBottomWidth: 1,
|
|
41
38
|
borderBottomColor: color("black30"),
|
|
42
|
-
} }), (
|
|
39
|
+
} }), _jsxs(View, { style: {
|
|
43
40
|
flex: 1,
|
|
44
41
|
minWidth: "100%",
|
|
45
|
-
height:
|
|
42
|
+
height: TAB_BAR_HEIGHT,
|
|
46
43
|
flexDirection: "row",
|
|
47
|
-
}, children: [children, !!allTabLayoutsArePresent && ((
|
|
44
|
+
}, children: [children, !!allTabLayoutsArePresent && (_jsx(ActiveTabBorder, { tabLayouts: compact(tabLayouts), activeTabIndex: activeTabIndex }))] })] }) }));
|
|
48
45
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return react_native_1.Animated.spring(node, { toValue, useNativeDriver: true, bounciness: -7, speed: 13 });
|
|
46
|
+
export function spring(node, toValue) {
|
|
47
|
+
return Animated.spring(node, { toValue, useNativeDriver: true, bounciness: -7, speed: 13 });
|
|
52
48
|
}
|
|
53
|
-
exports.spring = spring;
|
|
54
49
|
/**
|
|
55
50
|
* Underlines the Active Tab. Same implementation in StickyTabPageTabBar
|
|
56
51
|
*/
|
|
57
|
-
const ActiveTabBorder = ({ tabLayouts, activeTabIndex, }) => {
|
|
58
|
-
const color =
|
|
52
|
+
export const ActiveTabBorder = ({ tabLayouts, activeTabIndex, }) => {
|
|
53
|
+
const color = useColor();
|
|
59
54
|
// We resize this border using the `scaleX` transform property rather than the `width` property, to avoid running
|
|
60
55
|
// animations on the JS thread, so we need to set an initial, pre-transform span for the border.
|
|
61
56
|
const preTransformSpan = 100;
|
|
@@ -64,13 +59,13 @@ const ActiveTabBorder = ({ tabLayouts, activeTabIndex, }) => {
|
|
|
64
59
|
for (let i = 0; i < activeTabIndex; i++) {
|
|
65
60
|
left += tabLayouts[i].width;
|
|
66
61
|
}
|
|
67
|
-
const translateX =
|
|
68
|
-
const scaleX =
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
const translateX = useRef(new Animated.Value(left)).current;
|
|
63
|
+
const scaleX = useRef(new Animated.Value(span / preTransformSpan)).current;
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
Animated.parallel([spring(translateX, left), spring(scaleX, span / preTransformSpan)]).start();
|
|
71
66
|
}, [left, span]);
|
|
72
|
-
const scaleXOffset =
|
|
73
|
-
return ((
|
|
67
|
+
const scaleXOffset = Animated.divide(Animated.subtract(preTransformSpan, Animated.multiply(scaleX, preTransformSpan)), 2);
|
|
68
|
+
return (_jsx(Animated.View, { style: {
|
|
74
69
|
height: 1,
|
|
75
70
|
width: preTransformSpan,
|
|
76
71
|
backgroundColor: color("black100"),
|
|
@@ -78,7 +73,7 @@ const ActiveTabBorder = ({ tabLayouts, activeTabIndex, }) => {
|
|
|
78
73
|
bottom: 0,
|
|
79
74
|
transform: [
|
|
80
75
|
{
|
|
81
|
-
translateX:
|
|
76
|
+
translateX: Animated.subtract(translateX, scaleXOffset),
|
|
82
77
|
},
|
|
83
78
|
{
|
|
84
79
|
scaleX,
|
|
@@ -86,4 +81,3 @@ const ActiveTabBorder = ({ tabLayouts, activeTabIndex, }) => {
|
|
|
86
81
|
],
|
|
87
82
|
} }));
|
|
88
83
|
};
|
|
89
|
-
exports.ActiveTabBorder = ActiveTabBorder;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const StepTabs_1 = require("./StepTabs");
|
|
10
|
-
Object.defineProperty(exports, "StepTabs", { enumerable: true, get: function () { return StepTabs_1.StepTabs; } });
|
|
11
|
-
const Tab_1 = require("./Tab");
|
|
12
|
-
const Tab = ({ ...props }) => {
|
|
13
|
-
return (0, jsx_runtime_1.jsx)(Tab_1.TabV3, { ...props });
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ContentTabs } from "./ContentTabs";
|
|
3
|
+
import { NavigationalTabs } from "./NavigationalTabs";
|
|
4
|
+
import { StepTabs } from "./StepTabs";
|
|
5
|
+
import { TabV3 } from "./Tab";
|
|
6
|
+
export { NavigationalTabs, ContentTabs, StepTabs };
|
|
7
|
+
export const Tab = ({ ...props }) => {
|
|
8
|
+
return _jsx(TabV3, { ...props });
|
|
14
9
|
};
|
|
15
|
-
|
|
16
|
-
exports.TAB_BAR_HEIGHT = 44;
|
|
10
|
+
export const TAB_BAR_HEIGHT = 44;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const Text_1 = require("../Text");
|
|
9
|
-
const BulletedItem = ({ children, color = "black60", ...otherFlexProps }) => {
|
|
10
|
-
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", px: 1, ...otherFlexProps, children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "sm", color: color, children: text_1.bullet }), (0, jsx_runtime_1.jsx)(Spacer_1.Spacer, { x: 1 }), (0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "sm", color: color, children: children })] }));
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { bullet } from "../../utils/text";
|
|
3
|
+
import { Flex } from "../Flex";
|
|
4
|
+
import { Spacer } from "../Spacer";
|
|
5
|
+
import { Text } from "../Text";
|
|
6
|
+
export const BulletedItem = ({ children, color = "black60", ...otherFlexProps }) => {
|
|
7
|
+
return (_jsxs(Flex, { flexDirection: "row", px: 1, ...otherFlexProps, children: [_jsx(Text, { variant: "sm", color: color, children: bullet }), _jsx(Spacer, { x: 1 }), _jsx(Text, { variant: "sm", color: color, children: children })] }));
|
|
11
8
|
};
|
|
12
|
-
exports.BulletedItem = BulletedItem;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const Text_1 = require("../Text");
|
|
10
|
-
(0, react_native_1.storiesOf)("List", module).add("Bulleted Item", () => ((0, jsx_runtime_1.jsx)(helpers_1.List, { children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { children: [(0, jsx_runtime_1.jsx)(BulletedItem_1.BulletedItem, { children: "Bulleted Item text" }), (0, jsx_runtime_1.jsx)(BulletedItem_1.BulletedItem, { children: "The good thing about Bulleted Item text is that the bullet is aligned separately from the rest of the text" }), (0, jsx_runtime_1.jsx)(Spacer_1.Spacer, { y: 2 }), (0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "sm", mx: 1, color: "black60", children: "\u2022 Simple text acting as bulleted item" }), (0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "sm", mx: 1, color: "black60", children: "\u2022 Simple text acting as bulleted item longer text with a bullet infront of it, just like that. and that ain't so pretty, riiiight?!" })] }) })));
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { storiesOf } from "@storybook/react-native";
|
|
3
|
+
import { BulletedItem } from "./BulletedItem";
|
|
4
|
+
import { List } from "../../storybook/helpers";
|
|
5
|
+
import { Flex } from "../Flex";
|
|
6
|
+
import { Spacer } from "../Spacer";
|
|
7
|
+
import { Text } from "../Text";
|
|
8
|
+
storiesOf("List", module).add("Bulleted Item", () => (_jsx(List, { children: _jsxs(Flex, { children: [_jsx(BulletedItem, { children: "Bulleted Item text" }), _jsx(BulletedItem, { children: "The good thing about Bulleted Item text is that the bullet is aligned separately from the rest of the text" }), _jsx(Spacer, { y: 2 }), _jsx(Text, { variant: "sm", mx: 1, color: "black60", children: "\u2022 Simple text acting as bulleted item" }), _jsx(Text, { variant: "sm", mx: 1, color: "black60", children: "\u2022 Simple text acting as bulleted item longer text with a bullet infront of it, just like that. and that ain't so pretty, riiiight?!" })] }) })));
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./BulletedItem"), exports);
|
|
1
|
+
export * from "./BulletedItem";
|