@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
package/dist/Theme.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const native_1 = require("styled-components/native");
|
|
6
|
-
const tokens_1 = require("./tokens");
|
|
7
|
-
const Theme = ({ children, theme = "v3light" }) => {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ThemeProvider } from "styled-components/native";
|
|
3
|
+
import { THEMES } from "./tokens";
|
|
4
|
+
export const Theme = ({ children, theme = "v3light" }) => {
|
|
8
5
|
const currentTheme = getTheme(theme);
|
|
9
|
-
return (
|
|
6
|
+
return _jsx(ThemeProvider, { theme: currentTheme, children: children });
|
|
10
7
|
};
|
|
11
|
-
exports.Theme = Theme;
|
|
12
8
|
const getTheme = (theme) => {
|
|
13
9
|
if (theme === "v3light") {
|
|
14
|
-
return
|
|
10
|
+
return THEMES.v3light;
|
|
15
11
|
}
|
|
16
12
|
if (theme === "v3dark") {
|
|
17
|
-
return
|
|
13
|
+
return THEMES.v3dark;
|
|
18
14
|
}
|
|
19
|
-
return
|
|
15
|
+
return THEMES.v3light;
|
|
20
16
|
};
|
|
21
17
|
/**
|
|
22
18
|
* Only use this if it's are absolutely neccessary, and only in tests.
|
|
23
19
|
*/
|
|
24
|
-
|
|
20
|
+
export const _test_THEMES = THEMES;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const react_native_1 = require("react-native");
|
|
7
|
-
class CssTransition extends react_1.Component {
|
|
8
|
-
animatedValue = new react_native_1.Animated.Value(0);
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Component } from "react";
|
|
3
|
+
import { Animated } from "react-native";
|
|
4
|
+
export class CssTransition extends Component {
|
|
5
|
+
animatedValue = new Animated.Value(0);
|
|
9
6
|
// @ts-expect-error STRICTNESS_MIGRATION --- 🚨 Unsafe legacy code 🚨 Please delete this and fix any type errors if you have time 🙏
|
|
10
7
|
constructor(props) {
|
|
11
8
|
super(props);
|
|
@@ -17,8 +14,8 @@ class CssTransition extends react_1.Component {
|
|
|
17
14
|
this.setState({
|
|
18
15
|
previousStyle: this.props.style,
|
|
19
16
|
});
|
|
20
|
-
this.animatedValue = new
|
|
21
|
-
|
|
17
|
+
this.animatedValue = new Animated.Value(0);
|
|
18
|
+
Animated.timing(this.animatedValue, {
|
|
22
19
|
toValue: 1,
|
|
23
20
|
duration: nextProps.duration,
|
|
24
21
|
// not all style properties are animatable with the native driver
|
|
@@ -38,7 +35,7 @@ class CssTransition extends react_1.Component {
|
|
|
38
35
|
});
|
|
39
36
|
return acc;
|
|
40
37
|
}, {});
|
|
41
|
-
return (
|
|
38
|
+
return _jsx(Animated.View, { style: [style, animateCheckboxStyle], ...props });
|
|
42
39
|
}
|
|
43
40
|
// @ts-expect-error STRICTNESS_MIGRATION --- 🚨 Unsafe legacy code 🚨 Please delete this and fix any type errors if you have time 🙏
|
|
44
41
|
mergeStyles(style) {
|
|
@@ -49,4 +46,3 @@ class CssTransition extends react_1.Component {
|
|
|
49
46
|
}, {});
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
|
-
exports.CssTransition = CssTransition;
|
package/dist/animation/index.js
CHANGED
|
@@ -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("./CssTransition"), exports);
|
|
1
|
+
export * from "./CssTransition";
|
package/dist/constants.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setGlobalActiveOpacity = exports.DEFAULT_ACTIVE_OPACITY = exports.DEFAULT_HIT_SLOP = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Touch area box for UI elements
|
|
6
3
|
*/
|
|
7
|
-
|
|
4
|
+
export const DEFAULT_HIT_SLOP = { top: 20, bottom: 20, left: 20, right: 20 };
|
|
8
5
|
/**
|
|
9
6
|
* Default active opacity for elements that use Palette's <Touchable />
|
|
10
7
|
*/
|
|
11
|
-
|
|
8
|
+
export let DEFAULT_ACTIVE_OPACITY = 0.8;
|
|
12
9
|
// Set things globally
|
|
13
|
-
const setGlobalActiveOpacity = (opacity) => {
|
|
14
|
-
|
|
10
|
+
export const setGlobalActiveOpacity = (opacity) => {
|
|
11
|
+
DEFAULT_ACTIVE_OPACITY = opacity;
|
|
15
12
|
};
|
|
16
|
-
exports.setGlobalActiveOpacity = setGlobalActiveOpacity;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const react_native_1 = require("react-native");
|
|
7
|
-
exports.ArtsyKeyboardAvoidingViewContext = (0, react_1.createContext)({
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Component, createRef, useContext, createContext } from "react";
|
|
3
|
+
import { Dimensions, Keyboard, LayoutAnimation, StatusBar, Platform, StyleSheet, View, } from "react-native";
|
|
4
|
+
export const ArtsyKeyboardAvoidingViewContext = createContext({
|
|
8
5
|
isPresentedModally: false,
|
|
9
6
|
isVisible: true,
|
|
10
7
|
/**
|
|
@@ -13,11 +10,10 @@ exports.ArtsyKeyboardAvoidingViewContext = (0, react_1.createContext)({
|
|
|
13
10
|
*/
|
|
14
11
|
bottomOffset: 0,
|
|
15
12
|
});
|
|
16
|
-
const ArtsyKeyboardAvoidingView = ({ children }) => {
|
|
17
|
-
const { isPresentedModally, isVisible, bottomOffset } =
|
|
18
|
-
return ((
|
|
13
|
+
export const ArtsyKeyboardAvoidingView = ({ children }) => {
|
|
14
|
+
const { isPresentedModally, isVisible, bottomOffset } = useContext(ArtsyKeyboardAvoidingViewContext);
|
|
15
|
+
return (_jsx(KeyboardAvoidingView, { enabled: isVisible, mode: isPresentedModally ? "bottom-based" : "top-based", bottomOffset: bottomOffset, style: { flex: 1 }, children: children }));
|
|
19
16
|
};
|
|
20
|
-
exports.ArtsyKeyboardAvoidingView = ArtsyKeyboardAvoidingView;
|
|
21
17
|
/**
|
|
22
18
|
* This code was mostly copied directly from 'react-native'
|
|
23
19
|
*
|
|
@@ -30,11 +26,11 @@ exports.ArtsyKeyboardAvoidingView = ArtsyKeyboardAvoidingView;
|
|
|
30
26
|
* This source code is licensed under the MIT license found in the
|
|
31
27
|
* LICENSE file in the root directory of https://github.com/facebook/react-native
|
|
32
28
|
*/
|
|
33
|
-
class KeyboardAvoidingView extends
|
|
29
|
+
class KeyboardAvoidingView extends Component {
|
|
34
30
|
_frame = null;
|
|
35
31
|
_subscriptions = [];
|
|
36
32
|
_initialFrameHeight = 0;
|
|
37
|
-
viewRef =
|
|
33
|
+
viewRef = createRef();
|
|
38
34
|
constructor(props) {
|
|
39
35
|
super(props);
|
|
40
36
|
this.state = { bottom: 0 };
|
|
@@ -49,15 +45,15 @@ class KeyboardAvoidingView extends react_1.Component {
|
|
|
49
45
|
let keyboardY = keyboardFrame.screenY;
|
|
50
46
|
// on android the View layout frame coords start at -statusBarHeight but the
|
|
51
47
|
// keyboard screenY starts at 0 so we need to offset it to match the View frame
|
|
52
|
-
if (
|
|
53
|
-
keyboardY -=
|
|
48
|
+
if (Platform.OS === "android") {
|
|
49
|
+
keyboardY -= StatusBar.currentHeight ?? 0;
|
|
54
50
|
}
|
|
55
51
|
// Calculate the displacement needed for the view such that it
|
|
56
52
|
// no longer overlaps with the keyboard
|
|
57
53
|
return Math.max(frame.y + frame.height - keyboardY, 0);
|
|
58
54
|
}
|
|
59
55
|
case "bottom-based": {
|
|
60
|
-
let keyboardHeight =
|
|
56
|
+
let keyboardHeight = Dimensions.get("screen").height - keyboardFrame.screenY;
|
|
61
57
|
keyboardHeight -= this.props.bottomOffset;
|
|
62
58
|
return Math.max(keyboardHeight, 0);
|
|
63
59
|
}
|
|
@@ -74,12 +70,12 @@ class KeyboardAvoidingView extends react_1.Component {
|
|
|
74
70
|
return;
|
|
75
71
|
}
|
|
76
72
|
if (duration && easing) {
|
|
77
|
-
|
|
73
|
+
LayoutAnimation.configureNext({
|
|
78
74
|
// We have to pass the duration equal to minimal accepted duration defined here: RCTLayoutAnimation.m
|
|
79
75
|
duration: duration > 10 ? duration : 10,
|
|
80
76
|
update: {
|
|
81
77
|
duration: duration > 10 ? duration : 10,
|
|
82
|
-
type:
|
|
78
|
+
type: LayoutAnimation.Types[easing] || "keyboard",
|
|
83
79
|
},
|
|
84
80
|
});
|
|
85
81
|
}
|
|
@@ -97,15 +93,15 @@ class KeyboardAvoidingView extends react_1.Component {
|
|
|
97
93
|
}
|
|
98
94
|
};
|
|
99
95
|
componentDidMount() {
|
|
100
|
-
if (
|
|
96
|
+
if (Platform.OS === "ios") {
|
|
101
97
|
this._subscriptions = [
|
|
102
|
-
|
|
98
|
+
Keyboard.addListener("keyboardWillChangeFrame", this._onKeyboardChange),
|
|
103
99
|
];
|
|
104
100
|
}
|
|
105
101
|
else {
|
|
106
102
|
this._subscriptions = [
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
Keyboard.addListener("keyboardDidHide", this._onKeyboardChange),
|
|
104
|
+
Keyboard.addListener("keyboardDidShow", this._onKeyboardChange),
|
|
109
105
|
];
|
|
110
106
|
}
|
|
111
107
|
}
|
|
@@ -117,6 +113,6 @@ class KeyboardAvoidingView extends react_1.Component {
|
|
|
117
113
|
render() {
|
|
118
114
|
const { children, mode, enabled, style, ...props } = this.props;
|
|
119
115
|
const bottomHeight = enabled ? this.state.bottom : 0;
|
|
120
|
-
return ((
|
|
116
|
+
return (_jsx(View, { ref: this.viewRef, style: StyleSheet.compose(style, { paddingBottom: bottomHeight }), onLayout: this._onLayout, ...props, children: children }));
|
|
121
117
|
}
|
|
122
118
|
}
|
|
@@ -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("./ArtsyKeyboardAvoidingView"), exports);
|
|
1
|
+
export * from './ArtsyKeyboardAvoidingView';
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Autocomplete = void 0;
|
|
4
|
-
const normalizeText_1 = require("../../utils/normalizeText");
|
|
5
|
-
class Autocomplete {
|
|
1
|
+
import { normalizeText } from "../../utils/normalizeText";
|
|
2
|
+
export class Autocomplete {
|
|
6
3
|
entries;
|
|
7
4
|
maxCacheItems;
|
|
8
5
|
cache = {};
|
|
@@ -11,7 +8,7 @@ class Autocomplete {
|
|
|
11
8
|
this.entries = entries;
|
|
12
9
|
this.maxCacheItems = maxCacheItems;
|
|
13
10
|
for (const entry of entries) {
|
|
14
|
-
entry.searchTerms = entry.searchTerms.map(
|
|
11
|
+
entry.searchTerms = entry.searchTerms.map(normalizeText);
|
|
15
12
|
for (const searchTerm of entry.searchTerms.slice(0)) {
|
|
16
13
|
const parts = searchTerm.split(/\s+/).filter((s) => !stopWords.includes(s));
|
|
17
14
|
if (parts.length > 1) {
|
|
@@ -21,7 +18,7 @@ class Autocomplete {
|
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
20
|
getSuggestions(searchString) {
|
|
24
|
-
searchString =
|
|
21
|
+
searchString = normalizeText(searchString);
|
|
25
22
|
if (this.cache[searchString]) {
|
|
26
23
|
return this.cache[searchString].map((e) => e.key);
|
|
27
24
|
}
|
|
@@ -50,4 +47,3 @@ class Autocomplete {
|
|
|
50
47
|
return results.map((e) => e.key);
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
|
-
exports.Autocomplete = Autocomplete;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const Autocomplete_1 = require("./Autocomplete");
|
|
1
|
+
import { Autocomplete } from "./Autocomplete";
|
|
4
2
|
const artists = [
|
|
5
3
|
{
|
|
6
4
|
key: "Pablo Picasso",
|
|
@@ -23,17 +21,17 @@ const artists = [
|
|
|
23
21
|
searchTerms: ["JB", "The King of Funk"],
|
|
24
22
|
},
|
|
25
23
|
];
|
|
26
|
-
describe(
|
|
24
|
+
describe(Autocomplete, () => {
|
|
27
25
|
it(`lets you search for individual words in search terms`, async () => {
|
|
28
|
-
const auto = new
|
|
26
|
+
const auto = new Autocomplete(artists);
|
|
29
27
|
expect(auto.getSuggestions("formerly")).toEqual(["Prince"]);
|
|
30
28
|
});
|
|
31
29
|
it(`doesn't care about capitalization`, async () => {
|
|
32
|
-
const auto = new
|
|
30
|
+
const auto = new Autocomplete(artists);
|
|
33
31
|
expect(auto.getSuggestions("fOrMerly")).toEqual(["Prince"]);
|
|
34
32
|
});
|
|
35
33
|
it(`doesn't care about punctuation`, async () => {
|
|
36
|
-
const auto = new
|
|
34
|
+
const auto = new Autocomplete([
|
|
37
35
|
...artists,
|
|
38
36
|
{
|
|
39
37
|
key: "Dog",
|
|
@@ -45,7 +43,7 @@ describe(Autocomplete_1.Autocomplete, () => {
|
|
|
45
43
|
expect(auto.getSuggestions("santas")).toEqual(["Dog"]);
|
|
46
44
|
});
|
|
47
45
|
it(`doesn't care about diacritics`, async () => {
|
|
48
|
-
const auto = new
|
|
46
|
+
const auto = new Autocomplete([
|
|
49
47
|
...artists,
|
|
50
48
|
{
|
|
51
49
|
key: "Nordic",
|
|
@@ -57,15 +55,15 @@ describe(Autocomplete_1.Autocomplete, () => {
|
|
|
57
55
|
expect(auto.getSuggestions("Jonsson")).toEqual(["Nordic"]);
|
|
58
56
|
});
|
|
59
57
|
it(`orders results according to importance`, async () => {
|
|
60
|
-
const auto = new
|
|
58
|
+
const auto = new Autocomplete(artists);
|
|
61
59
|
expect(auto.getSuggestions("p")).toEqual(["Pablo Picasso", "Prince", "Grayson Perry"]);
|
|
62
60
|
});
|
|
63
61
|
it(`returns nothing when there are no matches`, async () => {
|
|
64
|
-
const auto = new
|
|
62
|
+
const auto = new Autocomplete(artists);
|
|
65
63
|
expect(auto.getSuggestions("z")).toEqual([]);
|
|
66
64
|
});
|
|
67
65
|
it(`ignores stop words which don't appear at the beginning of a search term`, async () => {
|
|
68
|
-
const auto = new
|
|
66
|
+
const auto = new Autocomplete([
|
|
69
67
|
...artists,
|
|
70
68
|
{
|
|
71
69
|
key: "PaRappa the Rapper",
|
|
@@ -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("./Autocomplete"), exports);
|
|
1
|
+
export * from "./Autocomplete";
|
|
@@ -1,37 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Avatar = void 0;
|
|
27
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
-
const react_1 = require("react");
|
|
29
|
-
const react_native_1 = require("react-native");
|
|
30
|
-
const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
|
|
31
|
-
const hooks_1 = require("../../utils/hooks");
|
|
32
|
-
const Box_1 = require("../Box");
|
|
33
|
-
const Flex_1 = require("../Flex");
|
|
34
|
-
const Text_1 = require("../Text");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Image } from "react-native";
|
|
4
|
+
import Animated, { useAnimatedStyle, useSharedValue, withTiming, Easing, withDelay, } from "react-native-reanimated";
|
|
5
|
+
import { useColor } from "../../utils/hooks";
|
|
6
|
+
import { Box } from "../Box";
|
|
7
|
+
import { Flex } from "../Flex";
|
|
8
|
+
import { Text } from "../Text";
|
|
35
9
|
const DEFAULT_SIZE = "md";
|
|
36
10
|
const VARIANTS = {
|
|
37
11
|
xxs: {
|
|
@@ -52,26 +26,25 @@ const VARIANTS = {
|
|
|
52
26
|
},
|
|
53
27
|
};
|
|
54
28
|
/** A circular Avatar component containing an image or initials */
|
|
55
|
-
const Avatar = ({ src, initials, size = DEFAULT_SIZE }) => {
|
|
56
|
-
const color =
|
|
57
|
-
const [loading, setLoading] =
|
|
58
|
-
const opacity =
|
|
59
|
-
opacity.value =
|
|
29
|
+
export const Avatar = ({ src, initials, size = DEFAULT_SIZE }) => {
|
|
30
|
+
const color = useColor();
|
|
31
|
+
const [loading, setLoading] = useState(true);
|
|
32
|
+
const opacity = useSharedValue(0);
|
|
33
|
+
opacity.value = withDelay(100, withTiming(1, {
|
|
60
34
|
duration: 200,
|
|
61
|
-
easing:
|
|
35
|
+
easing: Easing.sin,
|
|
62
36
|
}));
|
|
63
|
-
const style =
|
|
37
|
+
const style = useAnimatedStyle(() => {
|
|
64
38
|
return {
|
|
65
39
|
opacity: loading ? 0 : opacity.value,
|
|
66
40
|
};
|
|
67
41
|
}, [loading]);
|
|
68
42
|
const { diameter, textSize } = VARIANTS[size];
|
|
69
43
|
if (src) {
|
|
70
|
-
return ((
|
|
44
|
+
return (_jsx(Box, { width: diameter, height: diameter, borderRadius: diameter / 2, overflow: "hidden", borderColor: color("white100"), borderWidth: 1, children: _jsx(Animated.View, { style: style, children: _jsx(Image, { onLoadStart: () => setLoading(true), onLoadEnd: () => setLoading(false), resizeMode: "cover", source: { uri: src }, accessibilityLabel: "AvatarImage", style: {
|
|
71
45
|
width: diameter,
|
|
72
46
|
height: diameter,
|
|
73
47
|
} }) }) }));
|
|
74
48
|
}
|
|
75
|
-
return ((
|
|
49
|
+
return (_jsx(Flex, { width: diameter, height: diameter, borderColor: "black10", borderWidth: 1, borderRadius: diameter, overflow: "hidden", alignItems: "center", justifyContent: "center", accessibilityLabel: "Avatar", children: _jsx(Text, { variant: textSize, children: initials }) }));
|
|
76
50
|
};
|
|
77
|
-
exports.Avatar = Avatar;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const Avatar_1 = require("./Avatar");
|
|
6
|
-
const helpers_1 = require("../../storybook/helpers");
|
|
7
|
-
exports.default = {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar } from "./Avatar";
|
|
3
|
+
import { List, Row } from "../../storybook/helpers";
|
|
4
|
+
export default {
|
|
8
5
|
title: "Avatar",
|
|
9
|
-
component:
|
|
6
|
+
component: Avatar,
|
|
10
7
|
};
|
|
11
8
|
const sizes = ["md", "sm", "xs", "xxs"];
|
|
12
|
-
function Variants() {
|
|
13
|
-
return ((
|
|
9
|
+
export function Variants() {
|
|
10
|
+
return (_jsxs(List, { children: [_jsx(Row, { children: sizes.map((s) => (_jsx(Avatar, { initials: "A", size: s }, s))) }), _jsx(Row, { children: sizes.map((s) => (_jsx(Avatar, { initials: "AA", size: s }, s))) }), _jsx(Row, { children: sizes.map((s) => (_jsx(Avatar, { src: "https://placekitten.com/300/300", size: s }, s))) })] }));
|
|
14
11
|
}
|
|
15
|
-
exports.Variants = Variants;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const Avatar_1 = require("./Avatar");
|
|
7
|
-
const renderWithWrappers_1 = require("../../utils/tests/renderWithWrappers");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { screen } from "@testing-library/react-native";
|
|
3
|
+
import { Image } from "react-native";
|
|
4
|
+
import { Avatar } from "./Avatar";
|
|
5
|
+
import { renderWithWrappers } from "../../utils/tests/renderWithWrappers";
|
|
8
6
|
describe("Avatar", () => {
|
|
9
7
|
it("renders initials if no image url and initials provided", () => {
|
|
10
|
-
|
|
11
|
-
expect(
|
|
12
|
-
expect(
|
|
8
|
+
renderWithWrappers(_jsx(Avatar, { initials: "AB" }));
|
|
9
|
+
expect(screen.UNSAFE_queryByType(Image)).not.toBeTruthy();
|
|
10
|
+
expect(screen.getByText("AB")).toBeTruthy();
|
|
13
11
|
});
|
|
14
12
|
});
|
|
@@ -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("./Avatar"), exports);
|
|
1
|
+
export * from "./Avatar";
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const Flex_1 = require("../Flex");
|
|
9
|
-
const BackButton = ({ color = "onBackgroundHigh", hitSlop = constants_1.DEFAULT_HIT_SLOP, onPress, showX = false, style, iconSize = 18, }) => {
|
|
10
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { onPress: onPress, hitSlop: hitSlop, accessibilityRole: "button", accessibilityLabel: showX ? "Close" : "Go back", accessibilityHint: showX ? "Dismiss this screen" : "Go back to the previous screen", style: style, children: showX ? ((0, jsx_runtime_1.jsx)(svgs_1.CloseIcon, { fill: color, width: iconSize, height: iconSize })) : ((0, jsx_runtime_1.jsx)(svgs_1.ChevronIcon, { direction: "left", fill: color, height: iconSize, width: iconSize })) }));
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TouchableOpacity } from "react-native";
|
|
3
|
+
import { DEFAULT_HIT_SLOP } from "../../constants";
|
|
4
|
+
import { ChevronIcon, CloseIcon } from "../../svgs";
|
|
5
|
+
import { Flex } from "../Flex";
|
|
6
|
+
export const BackButton = ({ color = "onBackgroundHigh", hitSlop = DEFAULT_HIT_SLOP, onPress, showX = false, style, iconSize = 18, }) => {
|
|
7
|
+
return (_jsx(TouchableOpacity, { onPress: onPress, hitSlop: hitSlop, accessibilityRole: "button", accessibilityLabel: showX ? "Close" : "Go back", accessibilityHint: showX ? "Dismiss this screen" : "Go back to the previous screen", style: style, children: showX ? (_jsx(CloseIcon, { fill: color, width: iconSize, height: iconSize })) : (_jsx(ChevronIcon, { direction: "left", fill: color, height: iconSize, width: iconSize })) }));
|
|
11
8
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { onPress: onPress, hitSlop: hitSlop, children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { backgroundColor: "background", width: 40, height: 40, borderRadius: 20, alignItems: "center", justifyContent: "center", accessibilityRole: "button", accessibilityLabel: showX ? "Close" : "Go back", accessibilityHint: showX ? "Dismiss this screen" : "Go back to the previous screen", style: style, children: showX ? ((0, jsx_runtime_1.jsx)(svgs_1.CloseIcon, { fill: color, width: 26, height: 26 })) : ((0, jsx_runtime_1.jsx)(svgs_1.ChevronIcon, { fill: color, direction: "left" })) }) }));
|
|
9
|
+
export const BackButtonWithBackground = ({ color = "onBackgroundHigh", hitSlop = DEFAULT_HIT_SLOP, onPress, showX = false, style, }) => {
|
|
10
|
+
return (_jsx(TouchableOpacity, { onPress: onPress, hitSlop: hitSlop, children: _jsx(Flex, { backgroundColor: "background", width: 40, height: 40, borderRadius: 20, alignItems: "center", justifyContent: "center", accessibilityRole: "button", accessibilityLabel: showX ? "Close" : "Go back", accessibilityHint: showX ? "Dismiss this screen" : "Go back to the previous screen", style: style, children: showX ? (_jsx(CloseIcon, { fill: color, width: 26, height: 26 })) : (_jsx(ChevronIcon, { fill: color, direction: "left" })) }) }));
|
|
15
11
|
};
|
|
16
|
-
exports.BackButtonWithBackground = BackButtonWithBackground;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const helpers_1 = require("../../storybook/helpers");
|
|
8
|
-
const Flex_1 = require("../Flex");
|
|
9
|
-
exports.default = {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BackButton, BackButtonWithBackground } from "./BackButton";
|
|
3
|
+
import { Text } from "../../elements/Text";
|
|
4
|
+
import { List } from "../../storybook/helpers";
|
|
5
|
+
import { Flex } from "../Flex";
|
|
6
|
+
export default {
|
|
10
7
|
title: "BackButton",
|
|
11
|
-
component:
|
|
8
|
+
component: BackButton,
|
|
12
9
|
};
|
|
13
|
-
const Styled = () => ((
|
|
14
|
-
exports.Styled = Styled;
|
|
10
|
+
export const Styled = () => (_jsxs(List, { style: { marginLeft: 50 }, contentContainerStyle: { alignItems: "flex-start" }, children: [_jsx(Text, { children: "Back button" }), _jsx(BackButton, {}), _jsx(Text, { children: "Back button with background" }), _jsxs(Flex, { children: [_jsx(Flex, { backgroundColor: "red", width: 50, height: 50, position: "absolute" }), _jsx(BackButtonWithBackground, {})] })] }));
|
|
@@ -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("./BackButton"), exports);
|
|
1
|
+
export * from "./BackButton";
|